|
@@ -131,7 +131,7 @@ public class LogisticsConsignmentService {
|
|
|
* @return
|
|
* @return
|
|
|
*/
|
|
*/
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
- public HttpResult purchaseLogisticsConsignment(LogisticsConsignmentParam bo) {
|
|
|
|
|
|
|
+ public HttpResult purchaseLogisticsConsignment(LogisticsConsignmentParam bo, String orderType) {
|
|
|
HttpResult httpResult = ValidUtil.serviceValid(bo);
|
|
HttpResult httpResult = ValidUtil.serviceValid(bo);
|
|
|
if (HttpStatus.SUCCESS_CODE != httpResult.getCode()) {
|
|
if (HttpStatus.SUCCESS_CODE != httpResult.getCode()) {
|
|
|
return HttpResult.error(httpResult.getMsg());
|
|
return HttpResult.error(httpResult.getMsg());
|
|
@@ -140,7 +140,7 @@ public class LogisticsConsignmentService {
|
|
|
if (checked.getCode() != HttpStatus.SUCCESS_CODE) {
|
|
if (checked.getCode() != HttpStatus.SUCCESS_CODE) {
|
|
|
return HttpResult.error(checked.getMsg());
|
|
return HttpResult.error(checked.getMsg());
|
|
|
}
|
|
}
|
|
|
- logisticsConsignmentInsert(bo);
|
|
|
|
|
|
|
+ logisticsConsignmentInsert(bo, orderType);
|
|
|
return HttpResult.ok();
|
|
return HttpResult.ok();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -165,7 +165,7 @@ public class LogisticsConsignmentService {
|
|
|
* @return
|
|
* @return
|
|
|
*/
|
|
*/
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
- public HttpResult sellLogisticsConsignment(LogisticsConsignmentParam bo) {
|
|
|
|
|
|
|
+ public HttpResult sellLogisticsConsignment(LogisticsConsignmentParam bo, String orderType) {
|
|
|
HttpResult httpResult = ValidUtil.serviceValid(bo);
|
|
HttpResult httpResult = ValidUtil.serviceValid(bo);
|
|
|
if (HttpStatus.SUCCESS_CODE != httpResult.getCode()) {
|
|
if (HttpStatus.SUCCESS_CODE != httpResult.getCode()) {
|
|
|
return HttpResult.error(httpResult.getMsg());
|
|
return HttpResult.error(httpResult.getMsg());
|
|
@@ -174,11 +174,11 @@ public class LogisticsConsignmentService {
|
|
|
if (checked.getCode() != HttpStatus.SUCCESS_CODE) {
|
|
if (checked.getCode() != HttpStatus.SUCCESS_CODE) {
|
|
|
return HttpResult.error(checked.getMsg());
|
|
return HttpResult.error(checked.getMsg());
|
|
|
}
|
|
}
|
|
|
- logisticsConsignmentInsert(bo);
|
|
|
|
|
|
|
+ logisticsConsignmentInsert(bo, orderType);
|
|
|
return HttpResult.ok();
|
|
return HttpResult.ok();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- void logisticsConsignmentInsert(LogisticsConsignmentParam bo) {
|
|
|
|
|
|
|
+ void logisticsConsignmentInsert(LogisticsConsignmentParam bo, String orderType) {
|
|
|
commonService.getRedisGenerateOrderNo();
|
|
commonService.getRedisGenerateOrderNo();
|
|
|
Long count = kwtLogisticsOrderMapper.selectCount(new LambdaQueryWrapper<KwtLogisticsOrder>().eq(KwtLogisticsOrder::getTOrderId, bo.getTOrderId()));
|
|
Long count = kwtLogisticsOrderMapper.selectCount(new LambdaQueryWrapper<KwtLogisticsOrder>().eq(KwtLogisticsOrder::getTOrderId, bo.getTOrderId()));
|
|
|
String lOrderNo = OrderGenerateSeqNoUtils.getSeqNo(RedisOrderGenerateEnum.LOGISTICS_ORDER, OrderRuleEnum.LOGISTICS_ORDER, "1", "0", String.valueOf(count + 1));
|
|
String lOrderNo = OrderGenerateSeqNoUtils.getSeqNo(RedisOrderGenerateEnum.LOGISTICS_ORDER, OrderRuleEnum.LOGISTICS_ORDER, "1", "0", String.valueOf(count + 1));
|
|
@@ -228,31 +228,66 @@ public class LogisticsConsignmentService {
|
|
|
log.info("{}生成物流托运失败!,返回信息:{}", tradeOrder.getTOrderNo(), JSONObject.toJSONString(httpResult));
|
|
log.info("{}生成物流托运失败!,返回信息:{}", tradeOrder.getTOrderNo(), JSONObject.toJSONString(httpResult));
|
|
|
throw new BusinessException("{" + tradeOrder.getTOrderNo() + "}生成物流托运失败!" + httpResult.getMsg());
|
|
throw new BusinessException("{" + tradeOrder.getTOrderNo() + "}生成物流托运失败!" + httpResult.getMsg());
|
|
|
}
|
|
}
|
|
|
- /**消息列表*/
|
|
|
|
|
- EntCacheResDto consignentMap = remoteSystemService.queryEntTreeById(Long.parseLong(bo.getConsignCompanyId()));
|
|
|
|
|
- EntCacheResDto checkentMap = remoteSystemService.queryEntTreeById(Long.parseLong(bo.getCheckCompanyId()));
|
|
|
|
|
|
|
+ /**消息列表
|
|
|
|
|
+ * 1 采购 2 销售
|
|
|
|
|
+ * */
|
|
|
|
|
+ String pcConsignUrl = "";
|
|
|
|
|
+ String appConsignUrl = "";
|
|
|
|
|
+ String pcCarriageUrl = "";
|
|
|
|
|
+ String appCarriageUrl = "";
|
|
|
|
|
+ String type = "";
|
|
|
|
|
+ MessageEnum consignMessageEnum = null;
|
|
|
|
|
+ MessageEnum carriageMessageEnum = null;
|
|
|
//托运单位
|
|
//托运单位
|
|
|
KwtLogisticsOrderUnit checkUnit = new KwtLogisticsOrderUnit();
|
|
KwtLogisticsOrderUnit checkUnit = new KwtLogisticsOrderUnit();
|
|
|
-
|
|
|
|
|
- checkUnit.setUnitType(1);
|
|
|
|
|
- checkUnit.setFirmName(bo.getCheckCompany());
|
|
|
|
|
- checkUnit.setEntId(Long.parseLong(bo.getConsignCompanyId()));
|
|
|
|
|
- checkUnit.setTopEntId(consignentMap == null ? null : consignentMap.getId());
|
|
|
|
|
- checkUnit.setContactsId(Long.parseLong(bo.getConsignContactsId()));
|
|
|
|
|
-
|
|
|
|
|
//承运单位
|
|
//承运单位
|
|
|
KwtLogisticsOrderUnit carriageUnit = new KwtLogisticsOrderUnit();
|
|
KwtLogisticsOrderUnit carriageUnit = new KwtLogisticsOrderUnit();
|
|
|
- carriageUnit.setUnitType(2);
|
|
|
|
|
- carriageUnit.setFirmName(bo.getConsignCompany());
|
|
|
|
|
- carriageUnit.setEntId(Long.parseLong(bo.getCheckCompanyId()));
|
|
|
|
|
- carriageUnit.setTopEntId(checkentMap == null ? null : checkentMap.getId());
|
|
|
|
|
- carriageUnit.setContactsId(Long.parseLong(bo.getCheckContactsId()));
|
|
|
|
|
-
|
|
|
|
|
|
|
+ if ("1".equals(orderType)) {
|
|
|
|
|
+ EntCacheResDto consignentMap = remoteSystemService.queryEntTreeById(Long.parseLong(bo.getConsignCompanyId()));
|
|
|
|
|
+ EntCacheResDto checkentMap = remoteSystemService.queryEntTreeById(Long.parseLong(bo.getCheckCompanyId()));
|
|
|
|
|
+ checkUnit.setUnitType(1);
|
|
|
|
|
+ checkUnit.setFirmName(bo.getCheckCompany());
|
|
|
|
|
+ checkUnit.setEntId(Long.parseLong(bo.getCheckCompanyId()));
|
|
|
|
|
+ checkUnit.setTopEntId(consignentMap == null ? null : consignentMap.getId());
|
|
|
|
|
+ checkUnit.setContactsId(Long.parseLong(bo.getCheckContactsId()));
|
|
|
|
|
+
|
|
|
|
|
+ carriageUnit.setUnitType(2);
|
|
|
|
|
+ carriageUnit.setFirmName(bo.getConsignCompany());
|
|
|
|
|
+ carriageUnit.setEntId(Long.parseLong(bo.getConsignCompanyId()));
|
|
|
|
|
+ carriageUnit.setTopEntId(checkentMap == null ? null : checkentMap.getId());
|
|
|
|
|
+ carriageUnit.setContactsId(Long.parseLong(bo.getConsignContactsId()));
|
|
|
|
|
+ type = "1";
|
|
|
|
|
+ } else if ("2".equals(orderType)) {
|
|
|
|
|
+ EntCacheResDto consignentMap = remoteSystemService.queryEntTreeById(Long.parseLong(bo.getConsignCompanyId()));
|
|
|
|
|
+ EntCacheResDto checkentMap = remoteSystemService.queryEntTreeById(Long.parseLong(bo.getCheckCompanyId()));
|
|
|
|
|
+
|
|
|
|
|
+ //发起方
|
|
|
|
|
+ checkUnit.setUnitType(1);
|
|
|
|
|
+ checkUnit.setFirmName(bo.getCheckCompany());
|
|
|
|
|
+ checkUnit.setEntId(Long.parseLong(bo.getCheckCompanyId()));
|
|
|
|
|
+ checkUnit.setTopEntId(consignentMap == null ? null : consignentMap.getId());
|
|
|
|
|
+ checkUnit.setContactsId(Long.parseLong(bo.getConsignContactsId()));
|
|
|
|
|
+
|
|
|
|
|
+ //接收方
|
|
|
|
|
+ carriageUnit.setUnitType(2);
|
|
|
|
|
+ carriageUnit.setFirmName(bo.getConsignCompany());
|
|
|
|
|
+ carriageUnit.setEntId(Long.parseLong(bo.getConsignCompanyId()));
|
|
|
|
|
+ carriageUnit.setTopEntId(checkentMap == null ? null : checkentMap.getId());
|
|
|
|
|
+ carriageUnit.setContactsId(Long.parseLong(bo.getCheckContactsId()));
|
|
|
|
|
+
|
|
|
|
|
+ pcConsignUrl = messageUrlConfig.getPc().getConsignLogisticsAddOrderUrl();
|
|
|
|
|
+ appConsignUrl = messageUrlConfig.getApp().getConsignLogisticsAddOrderUrl();
|
|
|
|
|
+ pcCarriageUrl = messageUrlConfig.getPc().getCarriageLogisticsAddOrderUrl();
|
|
|
|
|
+ appCarriageUrl = messageUrlConfig.getApp().getCarriageLogisticsAddOrderUrl();
|
|
|
|
|
+ consignMessageEnum = MessageEnum.NEW_CARRIAGE_ORDER;
|
|
|
|
|
+ carriageMessageEnum = MessageEnum.INITIATING_LOGISTICS_CONSIGNMENT;
|
|
|
|
|
+ type = "1";
|
|
|
|
|
+ }
|
|
|
// commonService.initIatingLogisticsConsignment(checkUnit, carriageUnit, lOrderNo, LoginUserHolder.getUserId(), LoginUserHolder.getEntId());
|
|
// commonService.initIatingLogisticsConsignment(checkUnit, carriageUnit, lOrderNo, LoginUserHolder.getUserId(), LoginUserHolder.getEntId());
|
|
|
commonService.newSendLogisticsOrderToMessage(checkUnit, carriageUnit, lOrderNo, LoginUserHolder.getUserId(), LoginUserHolder.getEntId(),
|
|
commonService.newSendLogisticsOrderToMessage(checkUnit, carriageUnit, lOrderNo, LoginUserHolder.getUserId(), LoginUserHolder.getEntId(),
|
|
|
- messageUrlConfig.getPc().getConsignLogisticsAddOrderUrl(), messageUrlConfig.getApp().getConsignLogisticsAddOrderUrl(),
|
|
|
|
|
- messageUrlConfig.getPc().getCarriageLogisticsAddOrderUrl(), messageUrlConfig.getApp().getCarriageLogisticsAddOrderUrl(),
|
|
|
|
|
- MessageEnum.INITIATING_LOGISTICS_CONSIGNMENT, MessageEnum.NEW_CARRIAGE_ORDER, "1");
|
|
|
|
|
|
|
+ pcConsignUrl, appConsignUrl,
|
|
|
|
|
+ pcCarriageUrl, appCarriageUrl,
|
|
|
|
|
+ consignMessageEnum, carriageMessageEnum, type);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|