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