Browse Source

导入客户BUG修复、

dev
汤建军 2 months ago
parent
commit
93a583b171
  1. 18
      blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/entity/BasicdataClientEntity.java
  2. 24
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/controller/BasicdataClientController.java
  3. 44
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/excel/BasicdataClientExcel.java
  4. 7
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/IBasicdataClientService.java
  5. 420
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataClientServiceImpl.java

18
blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/entity/BasicdataClientEntity.java

@ -164,16 +164,34 @@ public class BasicdataClientEntity extends TenantEntity {
*/
@ApiModelProperty(value = "省份")
private String bladeRegionProvinceId;
/**
* 省份
*/
@ApiModelProperty(value = "省份")
private String bladeRegionProvinceName;
/**
*
*/
@ApiModelProperty(value = "市")
private String bladeRegionCityId;
/**
*
*/
@ApiModelProperty(value = "市")
private String bladeRegionCityName;
/**
* /
*/
@ApiModelProperty(value = "区/县")
private String bladeRegionAreaId;
/**
* /
*/
@ApiModelProperty(value = "区/县")
private String bladeRegionAreaName;
/**
* 合同附件
*/

24
blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/controller/BasicdataClientController.java

@ -257,6 +257,30 @@ public class BasicdataClientController extends BladeController {
return R.success("操作成功");
}
/**
* 导入数据
*/
@PostMapping("/newImportBasicDataClient")
@ApiOperationSupport(order = 9)
@ApiOperation(value = "导入数据", notes = "传入basicDataClient")
public R newImportBasicDataClient(MultipartFile file, Integer isCovered) {
isCovered = 1;
BasicDataClienImporter clientImporter = new BasicDataClienImporter(basicdataClientService, isCovered == 1);
ExcelUtil.save(file, clientImporter, BasicdataClientExcel.class);
return R.success("操作成功");
}
/**
* 导入模板
*/
@PostMapping("/exportclientTemplate")
@ApiOperationSupport(order = 9)
@ApiOperation(value = "导入数据", notes = "传入basicDataClient")
public void exportclientTemplate(HttpServletResponse response) {
List<BasicdataClientExcel> list = basicdataClientService.exportclientTemplate();
ExcelUtil.export(response, "基础客户导入模板" + DateUtil.time(), "基础客户导入模板", list, BasicdataClientExcel.class);
}
/**
* 校验导入数据

44
blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/excel/BasicdataClientExcel.java

@ -78,19 +78,19 @@ public class BasicdataClientExcel implements Serializable {
*/
@ColumnWidth(20)
@ExcelProperty("省")
private String bladeRegionProvinceId;
private String bladeRegionProvinceName;
/**
*
*/
@ColumnWidth(20)
@ExcelProperty("市")
private String bladeRegionCityId;
private String bladeRegionCityName;
/**
* /
*/
@ColumnWidth(20)
@ExcelProperty("区/县")
private String bladeRegionAreaId;
private String bladeRegionAreaName;
/**
* 是否控货
*/
@ -128,26 +128,26 @@ public class BasicdataClientExcel implements Serializable {
@ColumnWidth(20)
@ExcelProperty("品牌")
private String brandName;
/**
* 三方商场
*/
@ColumnWidth(20)
@ExcelProperty("三方商场编码")
private String tripartiteCoding;
/**
* 三方商场品牌
*/
@ColumnWidth(20)
@ExcelProperty("三方商场品牌")
private String tripartiteMallBrand;
// /**
// * 三方商场
// */
// @ColumnWidth(20)
// @ExcelProperty("三方商场编码")
// private String tripartiteCoding;
/**
* 三方商场
*/
@ColumnWidth(20)
@ExcelProperty("三方商场名称")
private String tripartiteMall;
// /**
// * 三方商场品牌
// */
// @ColumnWidth(20)
// @ExcelProperty("三方商场品牌")
// private String tripartiteMallBrand;
//
// /**
// * 三方商场
// */
// @ColumnWidth(20)
// @ExcelProperty("三方商场名称")
// private String tripartiteMall;
/**
* 配送类型

7
blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/IBasicdataClientService.java

@ -134,4 +134,11 @@ public interface IBasicdataClientService extends BaseService<BasicdataClientEnti
R checkImportBasicDataClient(MultipartFile file);
List<BasicdataClientEntity> listNameLike(String name);
/**
* 获取客户导入模板
* @return
*/
List<BasicdataClientExcel> exportclientTemplate();
}

420
blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataClientServiceImpl.java

@ -74,6 +74,7 @@ import org.springblade.system.cache.DictBizCache;
import org.springblade.system.entity.DictBiz;
import org.springblade.system.feign.IRegionFeign;
import org.springblade.system.feign.IUserClient;
import org.springblade.system.vo.RegionAllVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
@ -409,14 +410,22 @@ public class BasicdataClientServiceImpl extends BaseServiceImpl<BasicdataClientM
if(!Objects.isNull(predicateContractStartTime)){
boolean contractStartTime = predicateContractStartTime.test(newClientEntity.getContractStartTime());
if (!contractStartTime) {
content.append("合同开始时间由[").append(sdf.format(oldClientEntity.getContractStartTime())).append("]变更为-->[").append(sdf.format(oldClientEntity.getContractStartTime())).append("],");
if (!Objects.isNull(oldClientEntity.getContractStartTime())){
content.append("合同开始时间由[").append(sdf.format(oldClientEntity.getContractStartTime())).append("]变更为-->[").append(sdf.format(oldClientEntity.getContractStartTime())).append("],");
}else {
content.append("添加合同开始时间[").append(sdf.format(newClientEntity.getContractStartTime())).append("],");
}
}
}
//对于合同结束时间比对
Predicate<Date> predicateContractEntTime = Predicate.isEqual(oldClientEntity.getContractEntTime());
boolean contractEndTime = predicateContractEntTime.test(newClientEntity.getContractEntTime());
if (!contractEndTime) {
content.append("合同开始时间由[").append(sdf.format(oldClientEntity.getContractEntTime())).append("]变更为-->[").append(sdf.format(newClientEntity.getContractEntTime())).append("],");
if (!Objects.isNull(oldClientEntity.getContractEntTime())){
content.append("合同结束时间由[").append(sdf.format(oldClientEntity.getContractStartTime())).append("]变更为-->[").append(sdf.format(oldClientEntity.getContractStartTime())).append("],");
}else {
content.append("添加合同结束时间[").append(sdf.format(newClientEntity.getContractStartTime())).append("],");
}
}
BasicdataClientLogEntity basicdataClientLogEntity = new BasicdataClientLogEntity();
basicdataClientLogEntity.setClientName(newClientEntity.getClientName());
@ -444,6 +453,35 @@ public class BasicdataClientServiceImpl extends BaseServiceImpl<BasicdataClientM
);
}
@Override
public List<BasicdataClientExcel> exportclientTemplate() {
List<BasicdataClientExcel> list = new ArrayList<>();
BasicdataClientExcel basicdataClientExcel = new BasicdataClientExcel();
basicdataClientExcel.setClientName("示例:商场A");
basicdataClientExcel.setTypeService("示例:干线,仓库,配送");
basicdataClientExcel.setClientType("示例:商配");
basicdataClientExcel.setDetailedly("示例:XXX省XX市XX区/县");
basicdataClientExcel.setBladeRegionProvinceName("示例:XX省");
basicdataClientExcel.setBladeRegionCityName("示例:XX市");
basicdataClientExcel.setBladeRegionAreaName("示例:XX区/县");
basicdataClientExcel.setCargoControl("示例:是");
basicdataClientExcel.setSendWarehouseName("示例:XX仓");
basicdataClientExcel.setServeWarehouseName("示例:XX仓");
basicdataClientExcel.setLinkman("示例:张三");
basicdataClientExcel.setPhone("示例:120********");
basicdataClientExcel.setBrandName("示例:品牌");
// basicdataClientExcel.setTripartiteCoding("示例:张三");
// basicdataClientExcel.setTripartiteMallBrand("示例:张三");
// basicdataClientExcel.setTripartiteMall("示例:张三");
basicdataClientExcel.setMold("示例:商配");
basicdataClientExcel.setContractStartTime(new Date());
basicdataClientExcel.setContractEntTime(new Date());
basicdataClientExcel.setDefaultPaymentMethods("示例:月结");
basicdataClientExcel.setCleanObjType("示例:工厂");
list.add(basicdataClientExcel);
return list;
}
@Override
@Transactional(rollbackFor = Exception.class)
public Boolean ownDeleteLogic(List<Long> toLongList) {
@ -497,6 +535,308 @@ public class BasicdataClientServiceImpl extends BaseServiceImpl<BasicdataClientM
return list;
}
// /**
// * 导入数据
// *
// * @param data
// * @param isCovered
// */
// @Override
// @Transactional(rollbackFor = Exception.class)
// public void importClient(List<BasicdataClientExcel> data, Boolean isCovered) {
// log.info("客户导入数据");
//
// QueryWrapper<BasicdataClientEntity> queryWrapper = new QueryWrapper<>();
// List<BasicdataClientEntity> basicdataClients = baseMapper.selectList(queryWrapper);
// // 验证数据
// checkImportBasicDataClient(data,basicdataClients);
//
//
// List<BasicdataStoreContactEntity> storeContactEntities = new ArrayList<>(); // 联系人
// List<BasicdataTripartiteMallEntity> tripartiteMallEntities = new ArrayList<>(); // 三方商场
// List<BasicdataStoreBrandEntity> storeBrandEntities = new ArrayList<>(); // 品牌
// List<BasicdataStorageServicesEntity> storageServicesEntities = new ArrayList<>(); // 服务仓
// List<BasicdataStoreBusinessEntity> storeBusinessEntities = new ArrayList<>(); // 服务类型
// //查询仓库信息
// List<BasicdataWarehouseEntity> list1 = warehouseService.warehouseListqx();
// List<DictBiz> dictBizs = DictBizCache.getList(DictBizConstant.DISTRIBUTION_TYPE);//商 市 自
// List<DictBiz> clientBiz = DictBizCache.getList(DictBizConstant.CLIENT_TYPE); //客 工
// List<DictBiz> freightBiz = DictBizCache.getList(BASIC_FREIGHT_TYPE); //客 工
// Set<String> set = new HashSet<>();
//
//
//
// LambdaQueryWrapper<BasicdataBrandEntity> lambdaQueryWrapper = new LambdaQueryWrapper<>();
// lambdaQueryWrapper.eq(BasicdataBrandEntity::getIsDeleted, 0);
// List<BasicdataBrandEntity> basicdataBrandEntityList = basicdataBrandService.list(lambdaQueryWrapper);
//
//
//
// for (BasicdataClientExcel i : data) {
//
// // 处理下空格 换行
// i.setClientName(i.getClientName().trim());
//
// log.info("导入数据《》《》{}", i);
//
// if (ObjectUtils.isNull(i.getClientName())) {
// throw new ServiceException("客户编码或客户名称不能为空!");
// }
// BasicdataClientEntity basicdataClient = new BasicdataClientEntity();
// BeanUtil.copyProperties(i, basicdataClient);
// //系统生成码值
// String finallyClientCode = this.getFinallyClientCode();
// basicdataClient.setClientCode(finallyClientCode);
// //将这个最新的防止缓存中
//
// log.info(">>>>>> basicdataClient.getClientCode() {}", basicdataClient.getClientCode());
//
// if(!basicdataClients.isEmpty()){
// List<BasicdataClientEntity> basicdataClientEntities = basicdataClients.stream().filter(ii -> ii.getClientName().equals(basicdataClient.getClientName()) && ii.getClientCode().equals(basicdataClient.getClientCode())).collect(Collectors.toList());
// if(!basicdataClientEntities.isEmpty()){
// // 获取全部重复的数据
// List<String> clientNames = basicdataClientEntities.stream().map(BasicdataClientEntity::getClientName).collect(Collectors.toList());
// List<String> clientCodes = basicdataClientEntities.stream().map(BasicdataClientEntity::getClientCode).collect(Collectors.toList());
// String clientNameStr = String.join(",", clientNames);
// String clientCodeStr = String.join(",", clientCodes);
// throw new ServiceException("客户编码 "+clientCodeStr+" 或客户名称 "+clientNameStr+" 已存在");
// }
//
// }
//
// Optional<DictBiz> clientFirst = clientBiz.stream().filter(ii -> ii.getDictValue().equals(i.getClientType())).findFirst();
// basicdataClient.setClientType(clientFirst.get().getDictKey());
// //查询客户名称是不是重复
// List<BasicdataClientEntity> basicdataClientEntities = baseMapper.selectList(Wrappers.<BasicdataClientEntity>query().lambda()
// .eq(BasicdataClientEntity::getClientName, i.getClientName())
// );
// if (basicdataClientEntities.isEmpty()) {
// BladeUser user = AuthUtil.getUser();
// basicdataClient.setPid(0L);
// basicdataClient.setCreateUser(user.getUserId());
// basicdataClient.setCargoControl(false);
// basicdataClient.setStatus(1);
// basicdataClient.setIsDeleted(0);
// basicdataClient.setCreateTime(new Date());
// basicdataClient.setUpdateTime(new Date());
//
// // 默认付款方式
// String keyValue = matchDictValue(DictBizCache.getList(OPEN_ORDER_PAY_WAY), i.getDefaultPaymentMethods().trim());
//
// basicdataClient.setDefaultPaymentMethods(keyValue);
//
// String s = matchDictValue(DictBizCache.getList(CLEAN_OBJ_TYPE), i.getCleanObjType());
//
// basicdataClient.setCleanObjType(s);
//
//
// String typeValue= matchDictValue(DictBizCache.getList(DISTRIBUTION_TYPE), i.getMold());
//
// basicdataClient.setTypeService(StringUtil.isNoneBlank(typeValue)?Integer.parseInt(typeValue):null);
//
// baseMapper.insert(basicdataClient);
// redis.set(RedisKeyConstant.FINAL_CLIENT_CODE + AuthUtil.getTenantId(), basicdataClient.getClientCode());
// if (ObjectUtils.isNull(basicdataClient.getId())) {
// throw new ServiceException("客户ID不存在");
// }
//
// //添加服务类型
// if (ObjectUtils.isNotNull(i.getTypeService())) {
// BasicdataStoreBusinessEntity storeBusinessEntity = new BasicdataStoreBusinessEntity();
// storeBusinessEntity.setClientId(basicdataClient.getId().toString());
// storeBusinessEntity.setTypeService(i.getTypeService());
// storeBusinessEntity.setMold(i.getMold());
// storeBusinessEntities.add(storeBusinessEntity);
// }
// //添加服务仓
// if (ObjectUtils.isNotNull(i.getServeWarehouseName())) {
// BasicdataStorageServicesEntity servicesEntity = new BasicdataStorageServicesEntity();
// servicesEntity.setClientId(basicdataClient.getId());
// servicesEntity.setDistinguish(2);
// if (ObjectUtils.isNotNull(i.getSendWarehouseName())) {
//// Long id = list1.stream().filter(q -> q.getName().equals(i.getSendWarehouseName())).findFirst().get().getId();
//// servicesEntity.setSendWarehouseId(String.valueOf(id));
// servicesEntity.setSendWarehouseName(i.getSendWarehouseName());
// }
// Long id = list1.stream().filter(q -> q.getName().equals(i.getServeWarehouseName())).findFirst().get().getId();
// servicesEntity.setServeWarehouseId(id);
// servicesEntity.setServeWarehouseName(i.getServeWarehouseName());
// storageServicesEntities.add(servicesEntity);
// }else {
// BasicdataStorageServicesEntity servicesEntity = new BasicdataStorageServicesEntity();
// servicesEntity.setClientId(basicdataClient.getId());
// servicesEntity.setDistinguish(2);
// servicesEntity.setSendWarehouseName("全部");
// storageServicesEntities.add(servicesEntity);
// }
// //添加品牌
// if (ObjectUtils.isNotNull(i.getBrandName())) {
//
// String[] ars = i.getBrandName().split(",");
//
// for (String ar : ars) {
// BasicdataStoreBrandEntity storeBrandEntity = new BasicdataStoreBrandEntity();
// storeBrandEntity.setClientId(basicdataClient.getId());
// storeBrandEntity.setShopId(basicdataClient.getId().toString());
// BasicdataBrandEntity one = matchBasicdataBrandEntityListValue(basicdataBrandEntityList, ar);
//
//
// if (ObjectUtils.isNull(one)) {
// throw new ServiceException("品牌不存在");
// }
// assert one != null;
// storeBrandEntity.setBrandId(one.getId());
// storeBrandEntity.setBrandName(one.getBrandName());
// storeBrandEntities.add(storeBrandEntity);
// }
//
//
// }
// //添加联系人
// if (ObjectUtils.isNotNull(i.getLinkman())) {
// BasicdataStoreContactEntity storeContactEntity = new BasicdataStoreContactEntity();
// storeContactEntity.setShopId(basicdataClient.getId());
// storeContactEntity.setPhone(i.getPhone());
// storeContactEntity.setLinkman(i.getLinkman());
// storeContactEntity.setDefaultType(true);
// storeContactEntities.add(storeContactEntity);
//
// }
// //添加三方商场
//// if (ObjectUtils.isNotNull(i.getTripartiteMall())) {
//// BasicdataTripartiteMallEntity tripartiteMallEntity = new BasicdataTripartiteMallEntity();
//// tripartiteMallEntity.setClientId(basicdataClient.getId());
//// tripartiteMallEntity.setTripartiteMall(i.getTripartiteMall());
//// tripartiteMallEntity.setTripartiteCoding(i.getTripartiteCoding());
////
//// BasicdataBrandEntity one = matchBasicdataBrandEntityListValue(basicdataBrandEntityList, i.getTripartiteMallBrand());
////
//// if (ObjectUtil.isNotEmpty(one)) {
//// //三方名称
//// assert one != null;
//// tripartiteMallEntity.setBrandId(one.getId());
//// tripartiteMallEntity.setBrandName(one.getBrandName());
//// }
//// tripartiteMallEntities.add(tripartiteMallEntity);
//// }
//
// }
// }
//
// //品牌
// if (!storeBrandEntities.isEmpty()) {
// basicdataStoreBrandService.saveBatch(storeBrandEntities);
// }
// //服务类型
// if (!storeBusinessEntities.isEmpty()) {
// List<BasicdataStoreBusinessEntity> list = new ArrayList<>();
// storeBusinessEntities.stream().forEach(i -> {
// if (i.getTypeService().contains(",")) {
// String[] split = i.getTypeService().split(",");
// for (int j = 0; j < split.length; j++) {
// BasicdataStoreBusinessEntity business = new BasicdataStoreBusinessEntity();
// BeanUtil.copyProperties(i, business);
// int finalJ = j;
// if ("配送".equals(split[j])) {
// switch (business.getMold()) {
// case "商配":
// business.setMold("1");
// break;
// case "市配":
// business.setMold("2");
// break;
// case "自提":
// business.setMold("3");
// break;
// case "三方中转":
// business.setMold("4");
// break;
// default:
// throw new CustomerException("未知的服务类型");
// }
//
// } else {
// business.setMold(null);
// }
// log.info("#################split[finalJ]>>>>>>>>>>>>>>:{}", split[finalJ]);
// String dictValue = freightBiz.stream().filter(q -> q.getDictValue().equals(split[finalJ])).findFirst().get().getDictKey();
// business.setTypeService(dictValue);
// list.add(business);
// }
// } else {
// String dictValue = freightBiz.stream().filter(q -> q.getDictValue().equals(i.getTypeService())).findFirst().get().getDictKey();
// i.setTypeService(dictValue);
// if ("配送".equals(i.getTypeService())) {
// String mold = i.getMold();
// switch (mold) {
// case "商配":
// i.setMold("1");
// break;
// case "市配":
// i.setMold("2");
// break;
// case "自提":
// i.setMold("3");
// break;
// case "三方中转":
// i.setMold("4");
// break;
// default:
// throw new CustomerException("未知的服务类型");
// }
//
// } else {
// i.setMold(null);
// }
// list.add(i);
// }
// });
// basicdataStoreBusinessService.saveBatch(list);
// }
// //服务仓
// if (!storageServicesEntities.isEmpty()) {
// List<BasicdataStorageServicesEntity> servicesEntityList = new ArrayList<>();
// storageServicesEntities.forEach(i -> {
// if (ObjectUtils.isNotNull(i.getSendWarehouseName())) {
// if (i.getSendWarehouseName().contains(",")) {
// String[] split = i.getSendWarehouseName().split(",");
// for (int j = 0; j < split.length; j++) {
// BasicdataStorageServicesEntity servicesEntity = new BasicdataStorageServicesEntity();
// Long id = list1.stream().filter(q -> q.getName().equals(i.getSendWarehouseName())).findFirst().get().getId();
// BeanUtil.copyProperties(i, servicesEntity);
// servicesEntity.setSendWarehouseId(id.toString());
// servicesEntity.setSendWarehouseName(split[j]);
// servicesEntityList.add(servicesEntity);
// }
// } else {
// Long id = list1.stream().filter(q -> q.getName().equals(i.getSendWarehouseName())).findFirst().get().getId();
// i.setSendWarehouseId(id.toString());
// servicesEntityList.add(i);
// }
// } else {
// BasicdataStorageServicesEntity servicesEntity = new BasicdataStorageServicesEntity();
// BeanUtil.copyProperties(i, servicesEntity);
// servicesEntityList.add(servicesEntity);
// }
//
// });
// basicdataStorageServicesService.saveBatch(servicesEntityList);
// }
// //联系人
// if (!storeContactEntities.isEmpty()) {
// basicdataStoreContactService.saveBatch(storeContactEntities);
// }
// //三方
// if (!tripartiteMallEntities.isEmpty()) {
// basicdataTripartiteMallService.saveBatch(tripartiteMallEntities);
// }
// }
/**
* 导入数据
*
@ -506,7 +846,6 @@ public class BasicdataClientServiceImpl extends BaseServiceImpl<BasicdataClientM
@Override
@Transactional(rollbackFor = Exception.class)
public void importClient(List<BasicdataClientExcel> data, Boolean isCovered) {
log.info("客户导入数据");
QueryWrapper<BasicdataClientEntity> queryWrapper = new QueryWrapper<>();
List<BasicdataClientEntity> basicdataClients = baseMapper.selectList(queryWrapper);
@ -533,7 +872,6 @@ public class BasicdataClientServiceImpl extends BaseServiceImpl<BasicdataClientM
List<BasicdataBrandEntity> basicdataBrandEntityList = basicdataBrandService.list(lambdaQueryWrapper);
for (BasicdataClientExcel i : data) {
// 处理下空格 换行
@ -554,7 +892,7 @@ public class BasicdataClientServiceImpl extends BaseServiceImpl<BasicdataClientM
log.info(">>>>>> basicdataClient.getClientCode() {}", basicdataClient.getClientCode());
if(!basicdataClients.isEmpty()){
List<BasicdataClientEntity> basicdataClientEntities = basicdataClients.stream().filter(ii -> ii.getClientName().equals(basicdataClient.getClientName()) && ii.getClientCode().equals(basicdataClient.getClientCode())).collect(Collectors.toList());
List<BasicdataClientEntity> basicdataClientEntities = basicdataClients.stream().filter(ii -> ii.getClientName().equals(basicdataClient.getClientName())).collect(Collectors.toList());
if(!basicdataClientEntities.isEmpty()){
// 获取全部重复的数据
List<String> clientNames = basicdataClientEntities.stream().map(BasicdataClientEntity::getClientName).collect(Collectors.toList());
@ -567,7 +905,9 @@ public class BasicdataClientServiceImpl extends BaseServiceImpl<BasicdataClientM
}
Optional<DictBiz> clientFirst = clientBiz.stream().filter(ii -> ii.getDictValue().equals(i.getClientType())).findFirst();
basicdataClient.setClientType(clientFirst.get().getDictKey());
if (!Objects.isNull(clientFirst.get())){
basicdataClient.setClientType(clientFirst.get().getDictKey());
}
//查询客户名称是不是重复
List<BasicdataClientEntity> basicdataClientEntities = baseMapper.selectList(Wrappers.<BasicdataClientEntity>query().lambda()
.eq(BasicdataClientEntity::getClientName, i.getClientName())
@ -579,8 +919,6 @@ public class BasicdataClientServiceImpl extends BaseServiceImpl<BasicdataClientM
basicdataClient.setCargoControl(false);
basicdataClient.setStatus(1);
basicdataClient.setIsDeleted(0);
basicdataClient.setCreateTime(new Date());
basicdataClient.setUpdateTime(new Date());
// 默认付款方式
String keyValue = matchDictValue(DictBizCache.getList(OPEN_ORDER_PAY_WAY), i.getDefaultPaymentMethods().trim());
@ -596,8 +934,42 @@ public class BasicdataClientServiceImpl extends BaseServiceImpl<BasicdataClientM
basicdataClient.setTypeService(StringUtil.isNoneBlank(typeValue)?Integer.parseInt(typeValue):null);
baseMapper.insert(basicdataClient);
List<RegionAllVO> regionAllVOList= redis.get("blade:sys:regions::SimpleKey []");
if (!Objects.isNull(i.getBladeRegionProvinceName())){
List<RegionAllVO> collect = regionAllVOList.stream().filter(f -> i.getBladeRegionProvinceName().equals(f.getLabel())).collect(Collectors.toList());
if (!collect.isEmpty()) {
RegionAllVO regionAllVO = collect.get(0);
basicdataClient.setBladeRegionProvinceId(regionAllVO.getValue());
basicdataClient.setBladeRegionProvinceName(regionAllVO.getLabel());
if (!Objects.isNull(i.getBladeRegionCityName())){
List<RegionAllVO> children1 = regionAllVO.getChildren();
if (!children1.isEmpty()) {
List<RegionAllVO> collect1 = children1.stream().filter(f -> i.getBladeRegionCityName().equals(f.getLabel())).collect(Collectors.toList());
if (!collect1.isEmpty()) {
RegionAllVO regionAllVO1 = collect1.get(0);
basicdataClient.setBladeRegionCityId(regionAllVO1.getValue());
basicdataClient.setBladeRegionCityName(regionAllVO1.getLabel());
if (!Objects.isNull(i.getBladeRegionAreaName())){
List<RegionAllVO> children2 = regionAllVO1.getChildren();
if (!children2.isEmpty()) {
List<RegionAllVO> collect2 = children2.stream().filter(f -> i.getBladeRegionAreaName().equals(f.getLabel())).collect(Collectors.toList());
if (!collect2.isEmpty()) {
RegionAllVO regionAllVO2= collect2.get(0);
basicdataClient.setBladeRegionAreaId(regionAllVO2.getValue());
basicdataClient.setBladeRegionAreaName(regionAllVO2.getLabel());
}
}
}
}
}
}
}
}
this.save(basicdataClient);
redis.set(RedisKeyConstant.FINAL_CLIENT_CODE + AuthUtil.getTenantId(), basicdataClient.getClientCode());
if (ObjectUtils.isNull(basicdataClient.getId())) {
throw new ServiceException("客户ID不存在");
}
@ -621,9 +993,12 @@ public class BasicdataClientServiceImpl extends BaseServiceImpl<BasicdataClientM
servicesEntity.setSendWarehouseName(i.getSendWarehouseName());
}
Long id = list1.stream().filter(q -> q.getName().equals(i.getServeWarehouseName())).findFirst().get().getId();
servicesEntity.setServeWarehouseId(id);
servicesEntity.setServeWarehouseName(i.getServeWarehouseName());
storageServicesEntities.add(servicesEntity);
if (!Objects.isNull(id)){
servicesEntity.setServeWarehouseId(id);
servicesEntity.setServeWarehouseName(i.getServeWarehouseName());
storageServicesEntities.add(servicesEntity);
}
}else {
BasicdataStorageServicesEntity servicesEntity = new BasicdataStorageServicesEntity();
servicesEntity.setClientId(basicdataClient.getId());
@ -651,8 +1026,6 @@ public class BasicdataClientServiceImpl extends BaseServiceImpl<BasicdataClientM
storeBrandEntity.setBrandName(one.getBrandName());
storeBrandEntities.add(storeBrandEntity);
}
}
//添加联系人
if (ObjectUtils.isNotNull(i.getLinkman())) {
@ -662,26 +1035,7 @@ public class BasicdataClientServiceImpl extends BaseServiceImpl<BasicdataClientM
storeContactEntity.setLinkman(i.getLinkman());
storeContactEntity.setDefaultType(true);
storeContactEntities.add(storeContactEntity);
}
//添加三方商场
if (ObjectUtils.isNotNull(i.getTripartiteMall())) {
BasicdataTripartiteMallEntity tripartiteMallEntity = new BasicdataTripartiteMallEntity();
tripartiteMallEntity.setClientId(basicdataClient.getId());
tripartiteMallEntity.setTripartiteMall(i.getTripartiteMall());
tripartiteMallEntity.setTripartiteCoding(i.getTripartiteCoding());
BasicdataBrandEntity one = matchBasicdataBrandEntityListValue(basicdataBrandEntityList, i.getTripartiteMallBrand());
if (ObjectUtil.isNotEmpty(one)) {
//三方名称
assert one != null;
tripartiteMallEntity.setBrandId(one.getId());
tripartiteMallEntity.setBrandName(one.getBrandName());
}
tripartiteMallEntities.add(tripartiteMallEntity);
}
}
}

Loading…
Cancel
Save