|
|
@@ -1,11 +1,9 @@
|
|
|
package org.springblade.client.corps.controller;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
|
|
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
@@ -13,12 +11,9 @@ import io.swagger.annotations.ApiParam;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
import org.springblade.client.corps.excel.CorpsCompanyExcel;
|
|
|
import org.springblade.client.corps.excel.CorpsExcel;
|
|
|
-import org.springblade.client.corps.excel.CorpsImport;
|
|
|
import org.springblade.client.corps.excel.CorpsSupplierExcel;
|
|
|
import org.springblade.client.corps.service.ICorpsDescService;
|
|
|
import org.springblade.client.entity.CorpsDesc;
|
|
|
-import org.springblade.client.entity.GoodsDesc;
|
|
|
-import org.springblade.client.goods.excel.GoodsExcel;
|
|
|
import org.springblade.client.vo.CorpsDescVO;
|
|
|
import org.springblade.core.boot.ctrl.BladeController;
|
|
|
import org.springblade.core.excel.util.ExcelUtil;
|
|
|
@@ -79,24 +74,29 @@ public class CorpsDescController extends BladeController {
|
|
|
@ApiOperationSupport(order = 2)
|
|
|
@ApiOperation(value = "分页", notes = "传入corpsDesc")
|
|
|
public R<IPage<CorpsDescVO>> list(CorpsDescVO corpsDesc, Query query) {
|
|
|
- corpsDesc.setIsDeleted(0);//默认查有效的
|
|
|
+ // 默认查有效的
|
|
|
+ corpsDesc.setIsDeleted(0);
|
|
|
corpsDesc.setTenantId(SecureUtil.getTenantId());
|
|
|
IPage<CorpsDescVO> pages = corpsDescService.selectCorpsDescPage(Condition.getPage(query), corpsDesc);
|
|
|
- if (CollectionUtils.isNotEmpty(pages.getRecords())){
|
|
|
- pages.getRecords().stream().forEach(item ->{
|
|
|
- if(StringUtils.isNotBlank(item.getAdminProfiles())){
|
|
|
+ if (CollectionUtils.isNotEmpty(pages.getRecords())) {
|
|
|
+ pages.getRecords().forEach(item -> {
|
|
|
+ if (StringUtils.isNotBlank(item.getAdminProfiles())) {
|
|
|
List<String> list = Arrays.asList(item.getAdminProfiles().split(","));
|
|
|
StringBuffer stringBuffer = new StringBuffer();
|
|
|
- if (CollectionUtils.isNotEmpty(list)){
|
|
|
- list.stream().forEach(items ->{
|
|
|
+ if (CollectionUtils.isNotEmpty(list)) {
|
|
|
+ list.forEach(items -> {
|
|
|
R<User> user = userClient.userInfoById(Long.valueOf(items));
|
|
|
- if (user.isSuccess() && user.getData() != null){
|
|
|
- stringBuffer.append(user.getData().getName()+",");
|
|
|
+ if (user.isSuccess() && user.getData() != null) {
|
|
|
+ stringBuffer.append(user.getData().getName()).append(",");
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
item.setAdminProfilesName(stringBuffer.toString());
|
|
|
}
|
|
|
+ if (StringUtils.isNotBlank(item.getBelongtocompany())) {
|
|
|
+ CorpsDesc desc = corpsDescService.getById(item.getBelongtocompany());
|
|
|
+ item.setBelongCompany(desc.getCname());
|
|
|
+ }
|
|
|
});
|
|
|
}
|
|
|
return R.data(pages);
|
|
|
@@ -138,26 +138,23 @@ public class CorpsDescController extends BladeController {
|
|
|
//删除客户详情,增加校验
|
|
|
|
|
|
//采购销售校验
|
|
|
- Order order=new Order();
|
|
|
+ Order order = new Order();
|
|
|
order.setCorpId(corpsDesc.getId());
|
|
|
order.setTenantId(AuthUtil.getTenantId());
|
|
|
R<List<Order>> byConditions = orderDescClient.getByConditions(order);
|
|
|
- if(byConditions.isSuccess()&&byConditions.getData().size()>0)
|
|
|
- {
|
|
|
- throw new SecurityException("存在绑定的订单信息,禁止删除");
|
|
|
+ if (byConditions.isSuccess() && byConditions.getData().size() > 0) {
|
|
|
+ throw new SecurityException("存在绑定的订单信息,禁止删除");
|
|
|
}
|
|
|
//财务校验
|
|
|
- Acc acc=new Acc();
|
|
|
+ Acc acc = new Acc();
|
|
|
acc.setCorpId(corpsDesc.getId());
|
|
|
acc.setTenantId(AuthUtil.getTenantId());
|
|
|
R<List<Acc>> accListByCondition = financeClient.getAccListByCondition(acc);
|
|
|
- if(accListByCondition.isSuccess()&&accListByCondition.getData().size()>0)
|
|
|
- {
|
|
|
+ if (accListByCondition.isSuccess() && accListByCondition.getData().size() > 0) {
|
|
|
throw new SecurityException("存在绑定的财务信息,禁止删除");
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
corpsDesc.setIsDeleted(1);
|
|
|
return R.status(corpsDescService.updateById(corpsDesc));
|
|
|
}
|
|
|
@@ -205,53 +202,45 @@ public class CorpsDescController extends BladeController {
|
|
|
@PostMapping("/import-desc")
|
|
|
@ApiOperationSupport(order = 12)
|
|
|
@ApiOperation(value = "导入客户资料", notes = "传入excel")
|
|
|
- public R importUser(@RequestParam("file") MultipartFile file,@RequestParam("corpType")String corpType) {
|
|
|
+ public R importUser(@RequestParam("file") MultipartFile file, @RequestParam("corpType") String corpType) {
|
|
|
List<CorpsExcel> excelList = ExcelUtil.read(file, CorpsExcel.class);
|
|
|
- if(CollectionUtils.isEmpty(excelList))
|
|
|
- {
|
|
|
+ if (CollectionUtils.isEmpty(excelList)) {
|
|
|
throw new SecurityException("数据不能为空");
|
|
|
}
|
|
|
- return corpsDescService.importUser(excelList,false,corpType);
|
|
|
+ return corpsDescService.importUser(excelList, false, corpType);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 导入公司主体信息
|
|
|
- *
|
|
|
- * */
|
|
|
+ */
|
|
|
@PostMapping("/import-company-desc")
|
|
|
@ApiOperationSupport(order = 12)
|
|
|
@ApiOperation(value = "导入公司主体", notes = "传入excel")
|
|
|
- public R importCompanyDesc(@RequestParam("file") MultipartFile file)
|
|
|
- {
|
|
|
+ public R importCompanyDesc(@RequestParam("file") MultipartFile file) {
|
|
|
List<CorpsCompanyExcel> excelList = ExcelUtil.read(file, CorpsCompanyExcel.class);
|
|
|
- if(CollectionUtils.isEmpty(excelList))
|
|
|
- {
|
|
|
+ if (CollectionUtils.isEmpty(excelList)) {
|
|
|
throw new SecurityException("数据不能为空");
|
|
|
}
|
|
|
- return corpsDescService.importCompanyDesc(excelList,false,"GS");
|
|
|
+ return corpsDescService.importCompanyDesc(excelList, false, "GS");
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 导入供应商信息
|
|
|
- *
|
|
|
- * */
|
|
|
+ */
|
|
|
@PostMapping("/import-supplier-desc")
|
|
|
@ApiOperationSupport(order = 12)
|
|
|
@ApiOperation(value = "导入供应商信息", notes = "传入excel")
|
|
|
- public R importSupplierDesc(@RequestParam("file") MultipartFile file)
|
|
|
- {
|
|
|
+ public R importSupplierDesc(@RequestParam("file") MultipartFile file) {
|
|
|
List<CorpsSupplierExcel> excelList = ExcelUtil.read(file, CorpsSupplierExcel.class);
|
|
|
- if(CollectionUtils.isEmpty(excelList))
|
|
|
- {
|
|
|
+ if (CollectionUtils.isEmpty(excelList)) {
|
|
|
throw new SecurityException("数据不能为空");
|
|
|
}
|
|
|
- return corpsDescService.importSupplierDesc(excelList,false,"GYS");
|
|
|
+ return corpsDescService.importSupplierDesc(excelList, false, "GYS");
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 导出公司主体信息
|
|
|
- *
|
|
|
- * */
|
|
|
+ */
|
|
|
@GetMapping("/export-supplier-template")
|
|
|
@ApiOperationSupport(order = 9)
|
|
|
@ApiOperation(value = "导出模板")
|
|
|
@@ -262,8 +251,7 @@ public class CorpsDescController extends BladeController {
|
|
|
|
|
|
/**
|
|
|
* 导出公司主体信息
|
|
|
- *
|
|
|
- * */
|
|
|
+ */
|
|
|
@GetMapping("/export-company-template")
|
|
|
@ApiOperationSupport(order = 9)
|
|
|
@ApiOperation(value = "导出模板")
|
|
|
@@ -283,6 +271,7 @@ public class CorpsDescController extends BladeController {
|
|
|
List<CorpsExcel> list = new ArrayList<>();
|
|
|
ExcelUtil.export(response, "导入模板", "导入数据表", list, CorpsExcel.class);
|
|
|
}
|
|
|
+
|
|
|
/**
|
|
|
* 客户信息
|
|
|
*/
|
|
|
@@ -290,19 +279,19 @@ public class CorpsDescController extends BladeController {
|
|
|
@ApiOperationSupport(order = 2)
|
|
|
@ApiOperation(value = "所有客户信息", notes = "corpType必填")
|
|
|
public R<List<CorpsDesc>> orderList(CorpsDescVO corpsDesc) {
|
|
|
- if (StringUtils.isBlank(corpsDesc.getCorpType())){
|
|
|
+ if (StringUtils.isBlank(corpsDesc.getCorpType())) {
|
|
|
throw new SecurityException("缺少必要的参数,客户类型");
|
|
|
}
|
|
|
LambdaQueryWrapper<CorpsDesc> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
- if (corpsDesc.getCorpType().equals("KG")){
|
|
|
- lambdaQueryWrapper.in(CorpsDesc::getCorpType,"KH","GYS");
|
|
|
- }else{
|
|
|
- lambdaQueryWrapper.eq(CorpsDesc::getCorpType,corpsDesc.getCorpType());
|
|
|
+ if ("KG".equals(corpsDesc.getCorpType())) {
|
|
|
+ lambdaQueryWrapper.in(CorpsDesc::getCorpType, "KH", "GYS");
|
|
|
+ } else {
|
|
|
+ lambdaQueryWrapper.eq(CorpsDesc::getCorpType, corpsDesc.getCorpType());
|
|
|
}
|
|
|
- lambdaQueryWrapper.like(Func.isNotEmpty(corpsDesc.getCname()),CorpsDesc::getCname,corpsDesc.getCname());
|
|
|
- lambdaQueryWrapper.like(Func.isNotEmpty(corpsDesc.getCode()),CorpsDesc::getCode,corpsDesc.getCode());
|
|
|
- lambdaQueryWrapper.eq(CorpsDesc::getIsDeleted,0);
|
|
|
- lambdaQueryWrapper.eq(CorpsDesc::getTenantId,SecureUtil.getTenantId());
|
|
|
+ lambdaQueryWrapper.like(Func.isNotEmpty(corpsDesc.getCname()), CorpsDesc::getCname, corpsDesc.getCname());
|
|
|
+ lambdaQueryWrapper.like(Func.isNotEmpty(corpsDesc.getCode()), CorpsDesc::getCode, corpsDesc.getCode());
|
|
|
+ lambdaQueryWrapper.eq(CorpsDesc::getIsDeleted, 0);
|
|
|
+ lambdaQueryWrapper.eq(CorpsDesc::getTenantId, SecureUtil.getTenantId());
|
|
|
|
|
|
return R.data(corpsDescService.list(lambdaQueryWrapper));
|
|
|
}
|