Browse Source

Merge branch 'dev' into pre-production

master
zhenghaoyu 10 months ago
parent
commit
50e86b806b
  1. 1
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataDriverArteryMapper.xml
  2. 45
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataDriverArteryServiceImpl.java

1
blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataDriverArteryMapper.xml

@ -173,6 +173,7 @@
from logpm_basicdata_driver_artery lbda from logpm_basicdata_driver_artery lbda
left join logpm_basicdata_driver_warehouse lbdw on lbdw.driver_id = lbda.id left join logpm_basicdata_driver_warehouse lbdw on lbdw.driver_id = lbda.id
where lbdw.warehouse_id = #{warehouseId} where lbdw.warehouse_id = #{warehouseId}
and lbda.is_deleted = 0
</select> </select>
<select id="findEntityByPhone" resultType="com.logpm.basicdata.entity.BasicdataDriverArteryEntity"> <select id="findEntityByPhone" resultType="com.logpm.basicdata.entity.BasicdataDriverArteryEntity">

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

@ -16,6 +16,7 @@
*/ */
package com.logpm.basicdata.service.impl; package com.logpm.basicdata.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
@ -218,15 +219,28 @@ public class BasicdataDriverArteryServiceImpl extends BaseServiceImpl<BasicdataD
datum.setCarrierId(basicdataCarrierEntities.get(0).getId()); datum.setCarrierId(basicdataCarrierEntities.get(0).getId());
} }
} }
List<JSONObject> warehouseList = new ArrayList<>();
if (!ObjectUtils.isEmpty(datum.getWarehouseName())) { if (!ObjectUtils.isEmpty(datum.getWarehouseName())) {
//在数据库找到仓库名字对应 String warehouseNames = datum.getWarehouseName();
BasicdataWarehouseEntity byName = warehouseClient.findByName(datum.getWarehouseName()); warehouseNames = warehouseNames.replaceAll(",",",");
if (ObjectUtils.isEmpty(byName)) { List<String> warehouseNameList = new ArrayList<>();
// log.error("未找到仓库"); if(warehouseNames.contains(",")){
// continue; warehouseNameList = Arrays.asList(warehouseNames.split(","));
throw new ServiceException("未找到仓库!"); }else{
} else { warehouseNameList.add(warehouseNames);
datum.setWarehouseId(String.valueOf(byName.getId())); }
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);
}
} }
} }
//根据手机号去重 如果有手机号相同 就删除老数据 //根据手机号去重 如果有手机号相同 就删除老数据
@ -246,6 +260,21 @@ public class BasicdataDriverArteryServiceImpl extends BaseServiceImpl<BasicdataD
log.info("复制后>>>>>>>>>>>>{}", copy); log.info("复制后>>>>>>>>>>>>{}", copy);
this.save(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) { for (BasicdataDrivermiddleEntity basicdataDrivermiddleEntity : driverMiddleEntity) {
basicdataDrivermiddleEntity.setDriverId(copy.getId()); basicdataDrivermiddleEntity.setDriverId(copy.getId());

Loading…
Cancel
Save