|
@@ -107,6 +107,14 @@ public class KwtAcceptCarriageOrderService {
|
|
|
* 物流订单企业表代理单位类型。
|
|
* 物流订单企业表代理单位类型。
|
|
|
*/
|
|
*/
|
|
|
static final int LOGISTICS_AGENT_UNIT_TYPE = 4;
|
|
static final int LOGISTICS_AGENT_UNIT_TYPE = 4;
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 物流订单企业表采购单位类型。
|
|
|
|
|
+ */
|
|
|
|
|
+ static final int LOGISTICS_PURCHASE_UNIT_TYPE = 5;
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 物流订单企业表供应单位类型。
|
|
|
|
|
+ */
|
|
|
|
|
+ static final int LOGISTICS_SUPPLY_UNIT_TYPE = 6;
|
|
|
|
|
|
|
|
@DubboReference(version = "1.0.0", group = "design", check = false, timeout = 8000)
|
|
@DubboReference(version = "1.0.0", group = "design", check = false, timeout = 8000)
|
|
|
RemoteSystemService remoteSystemService;
|
|
RemoteSystemService remoteSystemService;
|
|
@@ -3530,6 +3538,12 @@ public class KwtAcceptCarriageOrderService {
|
|
|
if (shouldSaveAgentUnit(orderDTO)) {
|
|
if (shouldSaveAgentUnit(orderDTO)) {
|
|
|
entIds.add(orderDTO.getAgentCompanyId());
|
|
entIds.add(orderDTO.getAgentCompanyId());
|
|
|
}
|
|
}
|
|
|
|
|
+ if (Objects.nonNull(orderDTO.getPurchaseCompanyId())) {
|
|
|
|
|
+ entIds.add(orderDTO.getPurchaseCompanyId());
|
|
|
|
|
+ }
|
|
|
|
|
+ if (Objects.nonNull(orderDTO.getSupplyCompanyId())) {
|
|
|
|
|
+ entIds.add(orderDTO.getSupplyCompanyId());
|
|
|
|
|
+ }
|
|
|
entIds = entIds.stream().filter(Objects::nonNull).distinct().collect(Collectors.toList());
|
|
entIds = entIds.stream().filter(Objects::nonNull).distinct().collect(Collectors.toList());
|
|
|
Map<Long, EntCacheResDto> entMap = remoteSystemService.queryEntTreeByIds(entIds);
|
|
Map<Long, EntCacheResDto> entMap = remoteSystemService.queryEntTreeByIds(entIds);
|
|
|
EntCacheResDto ent = entMap.get(orderDTO.getConsignCompanyId());
|
|
EntCacheResDto ent = entMap.get(orderDTO.getConsignCompanyId());
|
|
@@ -3594,6 +3608,51 @@ public class KwtAcceptCarriageOrderService {
|
|
|
savelogOrderUnitList.add(notifyUnit);
|
|
savelogOrderUnitList.add(notifyUnit);
|
|
|
log.info("物流订单新增代理企业信息");
|
|
log.info("物流订单新增代理企业信息");
|
|
|
appendAgentUnit(orderDTO, lOrderId, savelogOrderUnitList, entMap);
|
|
appendAgentUnit(orderDTO, lOrderId, savelogOrderUnitList, entMap);
|
|
|
|
|
+ appendTradeOrderUnits(orderDTO, lOrderId, savelogOrderUnitList, entMap);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 创建物流订单时追加贸易订单采购单位和供应单位。
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param orderDTO 物流订单新增DTO
|
|
|
|
|
+ * @param lOrderId 物流订单id
|
|
|
|
|
+ * @param savelogOrderUnitList 待批量保存企业列表
|
|
|
|
|
+ * @param entMap 企业缓存
|
|
|
|
|
+ */
|
|
|
|
|
+ private void appendTradeOrderUnits(AddLogisticOrderDTO orderDTO, Long lOrderId,
|
|
|
|
|
+ List<KwtLogisticsOrderUnit> savelogOrderUnitList,
|
|
|
|
|
+ Map<Long, EntCacheResDto> entMap) {
|
|
|
|
|
+ appendTradeOrderUnit(orderDTO, lOrderId, savelogOrderUnitList, entMap,
|
|
|
|
|
+ orderDTO.getPurchaseCompanyId(), orderDTO.getPurchaseCompany(), LOGISTICS_PURCHASE_UNIT_TYPE);
|
|
|
|
|
+ appendTradeOrderUnit(orderDTO, lOrderId, savelogOrderUnitList, entMap,
|
|
|
|
|
+ orderDTO.getSupplyCompanyId(), orderDTO.getSupplyCompany(), LOGISTICS_SUPPLY_UNIT_TYPE);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 创建物流订单时追加贸易订单企业。
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param orderDTO 物流订单新增DTO
|
|
|
|
|
+ * @param lOrderId 物流订单id
|
|
|
|
|
+ * @param savelogOrderUnitList 待批量保存企业列表
|
|
|
|
|
+ * @param entMap 企业缓存
|
|
|
|
|
+ * @param companyId 企业id
|
|
|
|
|
+ * @param companyName 企业名称
|
|
|
|
|
+ * @param unitType 企业类型
|
|
|
|
|
+ */
|
|
|
|
|
+ private void appendTradeOrderUnit(AddLogisticOrderDTO orderDTO, Long lOrderId,
|
|
|
|
|
+ List<KwtLogisticsOrderUnit> savelogOrderUnitList,
|
|
|
|
|
+ Map<Long, EntCacheResDto> entMap,
|
|
|
|
|
+ Long companyId, String companyName, int unitType) {
|
|
|
|
|
+ if (Objects.isNull(companyId)) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ EntCacheResDto ent = MapUtils.isEmpty(entMap) ? null : entMap.get(companyId);
|
|
|
|
|
+ if (Objects.isNull(ent)) {
|
|
|
|
|
+ log.warn("物流订单未找到贸易订单企业一级企业信息,lOrderId:{}, companyId:{}, companyName:{}, unitType:{}",
|
|
|
|
|
+ lOrderId, companyId, companyName, unitType);
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ savelogOrderUnitList.add(buildLogisticsOrderUnit(orderDTO, lOrderId, companyId, ent, unitType));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -3639,22 +3698,37 @@ public class KwtAcceptCarriageOrderService {
|
|
|
* @return 代理单位记录
|
|
* @return 代理单位记录
|
|
|
*/
|
|
*/
|
|
|
static KwtLogisticsOrderUnit buildAgentLogisticsOrderUnit(AddLogisticOrderDTO orderDTO, Long lOrderId, EntCacheResDto agentEnt) {
|
|
static KwtLogisticsOrderUnit buildAgentLogisticsOrderUnit(AddLogisticOrderDTO orderDTO, Long lOrderId, EntCacheResDto agentEnt) {
|
|
|
- KwtLogisticsOrderUnit agentUnit = new KwtLogisticsOrderUnit();
|
|
|
|
|
- agentUnit.setId(new IdWorker(NumberConstant.FOUR).nextId());
|
|
|
|
|
- agentUnit.setLOrderId(lOrderId);
|
|
|
|
|
- agentUnit.setUnitType(LOGISTICS_AGENT_UNIT_TYPE);
|
|
|
|
|
- agentUnit.setEntId(orderDTO.getAgentCompanyId());
|
|
|
|
|
- agentUnit.setContactsId(agentEnt.getContactsId());
|
|
|
|
|
- agentUnit.setTopEntId(agentEnt.getId());
|
|
|
|
|
- agentUnit.setFirmName(agentEnt.getFirmName());
|
|
|
|
|
- agentUnit.setContacts(agentEnt.getContacts());
|
|
|
|
|
- agentUnit.setPhone(agentEnt.getPhone());
|
|
|
|
|
- agentUnit.setStatus(NumberConstant.ZERO);
|
|
|
|
|
- agentUnit.setCreateBy(orderDTO.getUserId());
|
|
|
|
|
- agentUnit.setCreateTime(new Date());
|
|
|
|
|
- agentUnit.setUpdateBy(orderDTO.getUserId());
|
|
|
|
|
- agentUnit.setUpdateTime(new Date());
|
|
|
|
|
- return agentUnit;
|
|
|
|
|
|
|
+ return buildLogisticsOrderUnit(orderDTO, lOrderId, orderDTO.getAgentCompanyId(), agentEnt, LOGISTICS_AGENT_UNIT_TYPE);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 构建物流订单企业记录。
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param orderDTO 物流订单新增DTO
|
|
|
|
|
+ * @param lOrderId 物流订单id
|
|
|
|
|
+ * @param entId 企业id
|
|
|
|
|
+ * @param ent 企业缓存
|
|
|
|
|
+ * @param unitType 企业类型
|
|
|
|
|
+ * @return 物流订单企业记录
|
|
|
|
|
+ */
|
|
|
|
|
+ static KwtLogisticsOrderUnit buildLogisticsOrderUnit(AddLogisticOrderDTO orderDTO, Long lOrderId,
|
|
|
|
|
+ Long entId, EntCacheResDto ent, int unitType) {
|
|
|
|
|
+ KwtLogisticsOrderUnit orderUnit = new KwtLogisticsOrderUnit();
|
|
|
|
|
+ orderUnit.setId(new IdWorker(unitType).nextId());
|
|
|
|
|
+ orderUnit.setLOrderId(lOrderId);
|
|
|
|
|
+ orderUnit.setUnitType(unitType);
|
|
|
|
|
+ orderUnit.setEntId(entId);
|
|
|
|
|
+ orderUnit.setContactsId(ent.getContactsId());
|
|
|
|
|
+ orderUnit.setTopEntId(ent.getId());
|
|
|
|
|
+ orderUnit.setFirmName(ent.getFirmName());
|
|
|
|
|
+ orderUnit.setContacts(ent.getContacts());
|
|
|
|
|
+ orderUnit.setPhone(ent.getPhone());
|
|
|
|
|
+ orderUnit.setStatus(NumberConstant.ZERO);
|
|
|
|
|
+ orderUnit.setCreateBy(orderDTO.getUserId());
|
|
|
|
|
+ orderUnit.setCreateTime(new Date());
|
|
|
|
|
+ orderUnit.setUpdateBy(orderDTO.getUserId());
|
|
|
|
|
+ orderUnit.setUpdateTime(new Date());
|
|
|
|
|
+ return orderUnit;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
private static void setLogisticContractInfo(AddLogisticOrderDTO orderDTO,LogisticData x, Long lOrderId, List<KwtLogisticsOrderContract> saveContractList) {
|
|
private static void setLogisticContractInfo(AddLogisticOrderDTO orderDTO,LogisticData x, Long lOrderId, List<KwtLogisticsOrderContract> saveContractList) {
|