Browse Source

1.优化basicdata

master
pref_mail@163.com 7 months ago
parent
commit
ae21b600c2
  1. 6
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/controller/BasicdataStoreContactController.java
  2. 6
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/feign/BasicdataOpenIncomingClient.java
  3. 8
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataClientServiceImpl.java
  4. 231
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataDriverArteryServiceImpl.java
  5. 2
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataFreightServiceImpl.java
  6. 12
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataGoodsAreaServiceImpl.java
  7. 2
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataGoodsShelfServiceImpl.java
  8. 2
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataPriceServiceImpl.java
  9. 4
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataVehicleServiceImpl.java
  10. 4
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/util/EasyExcelUtil.java

6
blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/controller/BasicdataStoreContactController.java

@ -102,11 +102,7 @@ public class BasicdataStoreContactController extends BladeController {
List<BasicdataStoreContactEntity> storeContactEntities = basicdataStoreContactService.list(Wrappers.<BasicdataStoreContactEntity>query().lambda()
.eq(BasicdataStoreContactEntity::getShopId, basicdataStoreContact.getShopId())
);
if(storeContactEntities.size() > 0){
basicdataStoreContact.setDefaultType(false);
}else{
basicdataStoreContact.setDefaultType(true);
}
basicdataStoreContact.setDefaultType(storeContactEntities.size() <= 0);
return R.status(basicdataStoreContactService.save(basicdataStoreContact));
}

6
blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/feign/BasicdataOpenIncomingClient.java

@ -18,10 +18,6 @@ public class BasicdataOpenIncomingClient implements IBasicdataOpenIncomingClient
@Override
public Boolean checkOpenIncoming(Long warehouseId, Long brandId) {
BasicdataOpenIncomingSettingEntity settingEntity = basicdataOpenIncomingSettingService.findEntityByParam(warehouseId,brandId);
if(Objects.isNull(settingEntity)){
return false;
}else{
return true;
}
return !Objects.isNull(settingEntity);
}
}

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

@ -383,14 +383,12 @@ public class BasicdataClientServiceImpl extends BaseServiceImpl<BasicdataClientM
log.info(">>>>>> basicdataClient.getClientCode() {}", basicdataClient.getClientCode());
//查询客户编码和客户名称是否存在
boolean b = basicdataClients.stream().anyMatch(ii -> {
if (ii.getClientCode() != null && !ii.getClientCode().equals("")) {
if (ii.getClientCode() != null && !ii.getClientCode().isEmpty()) {
log.info(">>>>>>>>>>>>> 1{}", ii.getClientCode());
log.info(">>>>>>>>>>>>> 2{}", ii.getClientName());
if (ii.getClientCode().equals(basicdataClient.getClientCode())
|| ii.getClientName().equals(basicdataClient.getClientName().trim())) {
return true;
}
return ii.getClientCode().equals(basicdataClient.getClientCode())
|| ii.getClientName().equals(basicdataClient.getClientName().trim());
}
return false;
});

231
blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataDriverArteryServiceImpl.java

@ -198,132 +198,131 @@ public class BasicdataDriverArteryServiceImpl extends BaseServiceImpl<BasicdataD
@Transactional(rollbackFor = Exception.class)
public void importDriverArtery(List<BasicdataDriverArteryImproterExcel> data) {
log.info("传入参数>>>>>>>>>>>>>>>>>>>>>>>{}", data);
outerLoop:
for (BasicdataDriverArteryImproterExcel datum : data) {
for (BasicdataDriverArteryImproterExcel datum : data) {
try {
List<BasicdataDrivermiddleEntity> driverMiddleEntity = new ArrayList<>();
try {
List<BasicdataDrivermiddleEntity> driverMiddleEntity = new ArrayList<>();
//检查数据是否为空
if (ObjectUtils.isEmpty(datum.getPhone()) || ObjectUtils.isEmpty(datum.getName()) || ObjectUtils.isEmpty(datum.getWarehouseName()) || ObjectUtils.isEmpty(datum.getCarrierName())) {
//检查数据是否为空
if (ObjectUtils.isEmpty(datum.getPhone()) || ObjectUtils.isEmpty(datum.getName()) || ObjectUtils.isEmpty(datum.getWarehouseName()) || ObjectUtils.isEmpty(datum.getCarrierName())) {
// log.error("必填数据不能为空");
// continue;
throw new ServiceException("必填数据不能为空!");
}
if (!ObjectUtils.isEmpty(datum.getPhone())) {
String phone = datum.getPhone();
BasicdataDriverArteryEntity arteryEntity = baseMapper.findEntityByPhone(phone);
if(!Objects.isNull(arteryEntity)){
throw new ServiceException(phone+"手机号码已存在!");
}
R<User> userR = userClient.userInfoByPhone("627683", datum.getPhone());
if (userR.getData() == null) {
throw new ServiceException("必填数据不能为空!");
}
if (!ObjectUtils.isEmpty(datum.getPhone())) {
String phone = datum.getPhone();
BasicdataDriverArteryEntity arteryEntity = baseMapper.findEntityByPhone(phone);
if (!Objects.isNull(arteryEntity)) {
throw new ServiceException(phone + "手机号码已存在!");
}
R<User> userR = userClient.userInfoByPhone("627683", datum.getPhone());
if (userR.getData() == null) {
// log.error("未找到用户");
// continue;
throw new ServiceException("未找到用户!");
} else {
datum.setUserId(userR.getData().getId());
}
}
if (!ObjectUtils.isEmpty(datum.getBindVehicle())) {
String[] car = datum.getBindVehicle().split(",");
for (String s : car) {
List<BasicdataVehicleEntity> carListByName = basicdataVehicleService.findCarListByName(s);
if (carListByName.isEmpty()) {
throw new ServiceException("未找到用户!");
} else {
datum.setUserId(userR.getData().getId());
}
}
if (!ObjectUtils.isEmpty(datum.getBindVehicle())) {
String[] car = datum.getBindVehicle().split(",");
for (String s : car) {
List<BasicdataVehicleEntity> carListByName = basicdataVehicleService.findCarListByName(s);
if (carListByName.isEmpty()) {
// log.error("未找到可绑定的车辆");
throw new ServiceException("未找到可绑定的车辆!");
} else {
BasicdataDrivermiddleEntity basicdataDrivermiddleEntity = new BasicdataDrivermiddleEntity();
basicdataDrivermiddleEntity.setBrandId(carListByName.get(0).getId());
driverMiddleEntity.add(basicdataDrivermiddleEntity);
}
}
}
if (!ObjectUtils.isEmpty(datum.getCarrierName())) {
//找到数据库内的承运商
List<BasicdataCarrierEntity> basicdataCarrierEntities = basicdataCarrierService.list(Wrappers.<BasicdataCarrierEntity>lambdaQuery().eq(BasicdataCarrierEntity::getCarrierName, datum.getCarrierName()));
if (ObjectUtils.isEmpty(basicdataCarrierEntities)) {
throw new ServiceException("未找到可绑定的车辆!");
} else {
BasicdataDrivermiddleEntity basicdataDrivermiddleEntity = new BasicdataDrivermiddleEntity();
basicdataDrivermiddleEntity.setBrandId(carListByName.get(0).getId());
driverMiddleEntity.add(basicdataDrivermiddleEntity);
}
}
}
if (!ObjectUtils.isEmpty(datum.getCarrierName())) {
//找到数据库内的承运商
List<BasicdataCarrierEntity> basicdataCarrierEntities = basicdataCarrierService.list(Wrappers.<BasicdataCarrierEntity>lambdaQuery().eq(BasicdataCarrierEntity::getCarrierName, datum.getCarrierName()));
if (ObjectUtils.isEmpty(basicdataCarrierEntities)) {
// log.error("未找到承运商");
// continue;
throw new ServiceException("未找到承运商!");
} else {
datum.setCarrierId(basicdataCarrierEntities.get(0).getId());
}
}
List<JSONObject> warehouseList = new ArrayList<>();
if (!ObjectUtils.isEmpty(datum.getWarehouseName())) {
String warehouseNames = datum.getWarehouseName();
warehouseNames = warehouseNames.replaceAll(",",",");
List<String> warehouseNameList = new ArrayList<>();
if(warehouseNames.contains(",")){
warehouseNameList = Arrays.asList(warehouseNames.split(","));
}else{
warehouseNameList.add(warehouseNames);
}
for (String wn : warehouseNameList) {
//在数据库找到仓库名字对应
BasicdataWarehouseEntity byName = warehouseClient.findByName(wn);
if (ObjectUtils.isEmpty(byName)) {
throw new ServiceException("未找到仓库!");
} else {
JSONObject jsonObject = new JSONObject();
jsonObject.put("warehouseId",byName.getId());
jsonObject.put("warehouseName",wn);
warehouseList.add(jsonObject);
}
}
}
//根据手机号去重 如果有手机号相同 就删除老数据
if (ObjectUtils.isNotNull(datum) && ObjectUtils.isNotNull(datum.getPhone())) {
List<BasicdataDriverArteryEntity> basicdataVehicleEntities = baseMapper.selectList(new QueryWrapper<BasicdataDriverArteryEntity>().lambda()
.eq(BasicdataDriverArteryEntity::getPhone, datum.getPhone()));
if (!basicdataVehicleEntities.isEmpty()) {
basicdataDriverArteryMapper.updateIsdeletedByPhone(datum.getPhone());
}
}
BasicdataDriverArteryEntity copy = Func.copy(datum, BasicdataDriverArteryEntity.class);
//连接到前端后取消注释
BladeUser user = AuthUtil.getUser();
copy.setTenantId(user.getTenantId());// 租户号
copy.setCreateUser(user.getUserId()); // 创建人
copy.setUpdateUser(user.getUserId());// 更新人
log.info("复制后>>>>>>>>>>>>{}", copy);
this.save(copy);
List<BasicdataDriverWarehouseEntity> driverWarehouseEntities = new ArrayList<>();
for (JSONObject jsonObject : warehouseList) {
Long warehouseId = jsonObject.getLong("warehouseId");
BasicdataDriverWarehouseEntity basicdataDriverWarehouseEntity = new BasicdataDriverWarehouseEntity();
basicdataDriverWarehouseEntity.setTenantId(AuthUtil.getTenantId());
basicdataDriverWarehouseEntity.setCreateUser(AuthUtil.getUserId());
basicdataDriverWarehouseEntity.setUpdateUser(AuthUtil.getUserId());
basicdataDriverWarehouseEntity.setCreateDept(Func.firstLong(AuthUtil.getDeptId()));
basicdataDriverWarehouseEntity.setDriverId(copy.getId());
basicdataDriverWarehouseEntity.setWarehouseId(warehouseId);
driverWarehouseEntities.add(basicdataDriverWarehouseEntity);
}
basicdataDriverWarehouseService.saveBatch(driverWarehouseEntities);
//车辆和司机绑定关系
for (BasicdataDrivermiddleEntity basicdataDrivermiddleEntity : driverMiddleEntity) {
basicdataDrivermiddleEntity.setDriverId(copy.getId());
basicdataDrivermiddleServiceImpl.save(basicdataDrivermiddleEntity);
}
} catch (DataAccessException e) {
throw new ServiceException("用户" + datum.getName() + "数据长度异常");
} catch (ServiceException e) {
throw new ServiceException("用户" + datum.getName() + e.getMessage());
} catch (Exception e) {
throw new RuntimeException("用户" + datum.getName() + "数据错误" + e.getMessage());
}
}
throw new ServiceException("未找到承运商!");
} else {
datum.setCarrierId(basicdataCarrierEntities.get(0).getId());
}
}
List<JSONObject> warehouseList = new ArrayList<>();
if (!ObjectUtils.isEmpty(datum.getWarehouseName())) {
String warehouseNames = datum.getWarehouseName();
warehouseNames = warehouseNames.replaceAll(",", ",");
List<String> warehouseNameList = new ArrayList<>();
if (warehouseNames.contains(",")) {
warehouseNameList = Arrays.asList(warehouseNames.split(","));
} else {
warehouseNameList.add(warehouseNames);
}
for (String wn : warehouseNameList) {
//在数据库找到仓库名字对应
BasicdataWarehouseEntity byName = warehouseClient.findByName(wn);
if (ObjectUtils.isEmpty(byName)) {
throw new ServiceException("未找到仓库!");
} else {
JSONObject jsonObject = new JSONObject();
jsonObject.put("warehouseId", byName.getId());
jsonObject.put("warehouseName", wn);
warehouseList.add(jsonObject);
}
}
}
//根据手机号去重 如果有手机号相同 就删除老数据
if (ObjectUtils.isNotNull(datum) && ObjectUtils.isNotNull(datum.getPhone())) {
List<BasicdataDriverArteryEntity> basicdataVehicleEntities = baseMapper.selectList(new QueryWrapper<BasicdataDriverArteryEntity>().lambda()
.eq(BasicdataDriverArteryEntity::getPhone, datum.getPhone()));
if (!basicdataVehicleEntities.isEmpty()) {
basicdataDriverArteryMapper.updateIsdeletedByPhone(datum.getPhone());
}
}
BasicdataDriverArteryEntity copy = Func.copy(datum, BasicdataDriverArteryEntity.class);
//连接到前端后取消注释
BladeUser user = AuthUtil.getUser();
copy.setTenantId(user.getTenantId());// 租户号
copy.setCreateUser(user.getUserId()); // 创建人
copy.setUpdateUser(user.getUserId());// 更新人
log.info("复制后>>>>>>>>>>>>{}", copy);
this.save(copy);
List<BasicdataDriverWarehouseEntity> driverWarehouseEntities = new ArrayList<>();
for (JSONObject jsonObject : warehouseList) {
Long warehouseId = jsonObject.getLong("warehouseId");
BasicdataDriverWarehouseEntity basicdataDriverWarehouseEntity = new BasicdataDriverWarehouseEntity();
basicdataDriverWarehouseEntity.setTenantId(AuthUtil.getTenantId());
basicdataDriverWarehouseEntity.setCreateUser(AuthUtil.getUserId());
basicdataDriverWarehouseEntity.setUpdateUser(AuthUtil.getUserId());
basicdataDriverWarehouseEntity.setCreateDept(Func.firstLong(AuthUtil.getDeptId()));
basicdataDriverWarehouseEntity.setDriverId(copy.getId());
basicdataDriverWarehouseEntity.setWarehouseId(warehouseId);
driverWarehouseEntities.add(basicdataDriverWarehouseEntity);
}
basicdataDriverWarehouseService.saveBatch(driverWarehouseEntities);
//车辆和司机绑定关系
for (BasicdataDrivermiddleEntity basicdataDrivermiddleEntity : driverMiddleEntity) {
basicdataDrivermiddleEntity.setDriverId(copy.getId());
basicdataDrivermiddleServiceImpl.save(basicdataDrivermiddleEntity);
}
} catch (DataAccessException e) {
throw new ServiceException("用户" + datum.getName() + "数据长度异常");
} catch (ServiceException e) {
throw new ServiceException("用户" + datum.getName() + e.getMessage());
} catch (Exception e) {
throw new RuntimeException("用户" + datum.getName() + "数据错误" + e.getMessage());
}
}
}

2
blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataFreightServiceImpl.java

@ -411,7 +411,7 @@ public class BasicdataFreightServiceImpl extends BaseServiceImpl<BasicdataFreigh
if (StrUtil.isNotBlank(rowMessage.toString())) {
message.append("<p>");
message.append(firstMessage);
message.append(rowMessage.toString());
message.append(rowMessage);
message.append("</p>");
message.append("<br>");
}

12
blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataGoodsAreaServiceImpl.java

@ -130,8 +130,7 @@ public class BasicdataGoodsAreaServiceImpl extends BaseServiceImpl<BasicdataGood
excelWriter.finish();
} catch (IOException var6) {
log.error("导出错误>>>>>>",var6);
return;
}
}
//return warehouseGoodsAreaList;
}
@ -387,8 +386,7 @@ public class BasicdataGoodsAreaServiceImpl extends BaseServiceImpl<BasicdataGood
} catch (IOException var6) {
log.error("导出错误>>>>>>",var6);
return;
}
}
}else if (type ==2){
//sheetOne
List<BasicdatavisualizationKCSheetOne> basicdatavisualizationSheetKCOnes = baseMapper.exportWarehouseByCKStrip(warehouseId);
@ -440,8 +438,7 @@ public class BasicdataGoodsAreaServiceImpl extends BaseServiceImpl<BasicdataGood
} catch (IOException var6) {
log.error("导出错误>>>>>>",var6);
return;
}
}
}else if (type ==3){
//sheetOne
@ -487,8 +484,7 @@ public class BasicdataGoodsAreaServiceImpl extends BaseServiceImpl<BasicdataGood
} catch (IOException var6) {
log.error("导出错误>>>>>>",var6);
return;
}
}
}
//return warehouseGoodsAreaList;
}

2
blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataGoodsShelfServiceImpl.java

@ -563,7 +563,7 @@ public class BasicdataGoodsShelfServiceImpl extends BaseServiceImpl<BasicdataGoo
ArrayList<Long> longs = new ArrayList<>();
for (BasicdataGoodsAllocationEntity basicdataGoodsAllocationEntity : basicdataGoodsAllocationEntitiesDate) {
Long id = basicdataGoodsAllocationEntity.getId();
List<Long> longs1 = Arrays.asList(id);
List<Long> longs1 = Collections.singletonList(id);
//查询有无绑定货物
Integer integer = warehouseUpdownGoodsClient.selectCountByAllo(id.toString());
if (integer > 0) {

2
blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataPriceServiceImpl.java

@ -2888,7 +2888,7 @@ public class BasicdataPriceServiceImpl extends BaseServiceImpl<BasicdataPriceMap
if (StrUtil.isNotEmpty(rowMessage.toString())) {
message.append("<p>");
message.append(firstMessage);
message.append(rowMessage.toString());
message.append(rowMessage);
message.append("</p>");
message.append("<br>");
}

4
blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataVehicleServiceImpl.java

@ -252,8 +252,8 @@ public class BasicdataVehicleServiceImpl extends BaseServiceImpl<BasicdataVehicl
log.info(method+ "查询到司机信息,进行绑定!>>>:{}",driverArteryEntity.getPhone());
//绑定用户
basicdataDrivermiddleEntity = new BasicdataDrivermiddleEntity();
basicdataDrivermiddleEntity.setDriverId(driverArteryEntity.getId());;
}
basicdataDrivermiddleEntity.setDriverId(driverArteryEntity.getId());
}
}
}

4
blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/util/EasyExcelUtil.java

@ -47,7 +47,7 @@ public class EasyExcelUtil {
if (builder == null) {
return null;
} else {
((ExcelReaderSheetBuilder) builder.sheet(sheetNo).headRowNumber(headRowNumber)).doRead();
builder.sheet(sheetNo).headRowNumber(headRowNumber).doRead();
return dataListener.getDataList();
}
}
@ -57,7 +57,7 @@ public class EasyExcelUtil {
if (builder == null) {
return null;
} else {
((ExcelReaderSheetBuilder) builder.sheet(sheetNo).headRowNumber(headRowNumber)).registerConverter(new TrimConverter()).doRead();
builder.sheet(sheetNo).headRowNumber(headRowNumber).registerConverter(new TrimConverter()).doRead();
return dataListener.getDataList();
}
}

Loading…
Cancel
Save