|
@@ -11,22 +11,23 @@ import com.sckw.core.model.enums.OrderRuleEnum;
|
|
|
import com.sckw.core.model.enums.RedisOrderGenerateEnum;
|
|
import com.sckw.core.model.enums.RedisOrderGenerateEnum;
|
|
|
import com.sckw.core.model.page.PageRes;
|
|
import com.sckw.core.model.page.PageRes;
|
|
|
import com.sckw.core.model.vo.TableTop;
|
|
import com.sckw.core.model.vo.TableTop;
|
|
|
-import com.sckw.core.utils.*;
|
|
|
|
|
|
|
+import com.sckw.core.utils.CollectionUtils;
|
|
|
|
|
+import com.sckw.core.utils.IdWorker;
|
|
|
|
|
+import com.sckw.core.utils.OrderGenerateSeqNoUtils;
|
|
|
|
|
+import com.sckw.core.utils.StringTimeUtil;
|
|
|
import com.sckw.core.web.context.LoginUserHolder;
|
|
import com.sckw.core.web.context.LoginUserHolder;
|
|
|
import com.sckw.core.web.response.HttpResult;
|
|
import com.sckw.core.web.response.HttpResult;
|
|
|
import com.sckw.payment.dao.KwpLedgerLogisticsMapper;
|
|
import com.sckw.payment.dao.KwpLedgerLogisticsMapper;
|
|
|
import com.sckw.payment.model.*;
|
|
import com.sckw.payment.model.*;
|
|
|
import com.sckw.payment.model.constant.LedgerEnum;
|
|
import com.sckw.payment.model.constant.LedgerEnum;
|
|
|
-import com.sckw.payment.model.constant.LedgerTrackEnum;
|
|
|
|
|
import com.sckw.payment.model.constant.LogisticsUnitType;
|
|
import com.sckw.payment.model.constant.LogisticsUnitType;
|
|
|
import com.sckw.payment.model.constant.SettlementEnum;
|
|
import com.sckw.payment.model.constant.SettlementEnum;
|
|
|
-import com.sckw.payment.model.dto.ILedger;
|
|
|
|
|
-import com.sckw.payment.model.dto.LedgerCarrierDto;
|
|
|
|
|
-import com.sckw.payment.model.dto.LedgerLogisticsDto;
|
|
|
|
|
-import com.sckw.payment.model.dto.LedgerShipperDto;
|
|
|
|
|
|
|
+import com.sckw.payment.model.dto.*;
|
|
|
import com.sckw.payment.model.vo.req.*;
|
|
import com.sckw.payment.model.vo.req.*;
|
|
|
import com.sckw.payment.model.vo.res.LedgerCountSumVo;
|
|
import com.sckw.payment.model.vo.res.LedgerCountSumVo;
|
|
|
import com.sckw.payment.model.vo.res.LedgerLogisticsDetailVo;
|
|
import com.sckw.payment.model.vo.res.LedgerLogisticsDetailVo;
|
|
|
|
|
+import com.sckw.stream.enums.MessageEnum;
|
|
|
|
|
+import com.sckw.stream.model.UserInfo;
|
|
|
import com.sckw.system.api.RemoteSystemService;
|
|
import com.sckw.system.api.RemoteSystemService;
|
|
|
import com.sckw.system.api.model.dto.res.EntCacheResDto;
|
|
import com.sckw.system.api.model.dto.res.EntCacheResDto;
|
|
|
import com.sckw.system.api.model.dto.res.SysDictResDto;
|
|
import com.sckw.system.api.model.dto.res.SysDictResDto;
|
|
@@ -63,6 +64,9 @@ public class KwpLedgerLogisticsService extends AbsLedger {
|
|
|
private KwpLedgerLogisticsUnitService logisticsUnitService;
|
|
private KwpLedgerLogisticsUnitService logisticsUnitService;
|
|
|
@Resource
|
|
@Resource
|
|
|
private KwpLedgerLogisticsOrderService logisticsOrderService;
|
|
private KwpLedgerLogisticsOrderService logisticsOrderService;
|
|
|
|
|
+ @Resource
|
|
|
|
|
+ private MessageSender messageSender;
|
|
|
|
|
+
|
|
|
@Resource
|
|
@Resource
|
|
|
private KwpLedgerLogisticsMapper logisticsMapper;
|
|
private KwpLedgerLogisticsMapper logisticsMapper;
|
|
|
@DubboReference(version = "1.0.0", group = "design", check = false)
|
|
@DubboReference(version = "1.0.0", group = "design", check = false)
|
|
@@ -172,21 +176,31 @@ public class KwpLedgerLogisticsService extends AbsLedger {
|
|
|
@GlobalTransactional(name = "default_tx_group", rollbackFor = Exception.class)
|
|
@GlobalTransactional(name = "default_tx_group", rollbackFor = Exception.class)
|
|
|
public String sendLedger(LogisticsSendReq logisticsReq) {
|
|
public String sendLedger(LogisticsSendReq logisticsReq) {
|
|
|
log.info("保存物流对账单:{}", JSONObject.toJSONString(logisticsReq));
|
|
log.info("保存物流对账单:{}", JSONObject.toJSONString(logisticsReq));
|
|
|
- String id = logisticsReq.getId();
|
|
|
|
|
- if (StringUtils.isBlank(id)) {
|
|
|
|
|
- //新增
|
|
|
|
|
- logisticsReq.setGenerateTime(LocalDateTime.now());
|
|
|
|
|
- logisticsReq.setStatus(LedgerEnum.TO_LEDGER.getStatus());
|
|
|
|
|
- Long aLong = saveDraft(logisticsReq);
|
|
|
|
|
- logisticsTrackService.saveTrack(aLong, Global.EMPTY_STRING, LedgerEnum.TO_LEDGER);
|
|
|
|
|
- } else {
|
|
|
|
|
- removeDraft(Long.parseLong(id));
|
|
|
|
|
- logisticsReq.setGenerateTime(LocalDateTime.now());
|
|
|
|
|
- logisticsReq.setStatus(LedgerEnum.TO_LEDGER.getStatus());
|
|
|
|
|
- Long aLong = saveDraft(logisticsReq);
|
|
|
|
|
- logisticsTrackService.saveTrack(aLong, Global.EMPTY_STRING, LedgerEnum.TO_LEDGER);
|
|
|
|
|
-
|
|
|
|
|
|
|
+ if (Objects.nonNull(logisticsReq.getIdLong())) {
|
|
|
|
|
+ removeDraft(logisticsReq.getIdLong());
|
|
|
}
|
|
}
|
|
|
|
|
+ logisticsReq.setGenerateTime(LocalDateTime.now());
|
|
|
|
|
+ logisticsReq.setStatus(LedgerEnum.TO_LEDGER.getStatus());
|
|
|
|
|
+ IdNo idNo = saveDraft(logisticsReq);
|
|
|
|
|
+ logisticsTrackService.saveTrack(idNo.id(), Global.EMPTY_STRING, LedgerEnum.TO_LEDGER);
|
|
|
|
|
+
|
|
|
|
|
+ //托运方
|
|
|
|
|
+ KwpLedgerLogisticsUnit logisticsUnit = logisticsUnitService.queryCustomerEnt(idNo.id(), LogisticsUnitType.SHIPPER);
|
|
|
|
|
+ //承运方
|
|
|
|
|
+ KwpLedgerLogisticsUnit logisticsUnit2 = logisticsUnitService.queryCustomerEnt(idNo.id(), LogisticsUnitType.CARRIER);
|
|
|
|
|
+ //推送创建人
|
|
|
|
|
+ messageSender.sendCreate(LoginUserHolder.getUserId(), new HashMap<>() {{
|
|
|
|
|
+ put("company", logisticsUnit.getFirmName());
|
|
|
|
|
+ put("number", idNo.no());
|
|
|
|
|
+ put("name", logisticsReq.getName());
|
|
|
|
|
+ }}, new UserInfo().setUserId(LoginUserHolder.getUserId()).setEntId(LoginUserHolder.getEntId()), MessageEnum.LEDGER_CARRIER);
|
|
|
|
|
+ //推送系统管理员
|
|
|
|
|
+ messageSender.sendManager(LoginUserHolder.getUserId(), new HashMap<>() {{
|
|
|
|
|
+ put("company", logisticsUnit2.getFirmName());
|
|
|
|
|
+ put("number", idNo.no());
|
|
|
|
|
+ put("name", logisticsReq.getName());
|
|
|
|
|
+ }}, logisticsUnit.getEntId(), MessageEnum.LEDGER_SHIPPER);
|
|
|
|
|
+
|
|
|
return "保存对账单成功";
|
|
return "保存对账单成功";
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -210,7 +224,7 @@ public class KwpLedgerLogisticsService extends AbsLedger {
|
|
|
* @param logisticsSendReq 物流对账单新增参数
|
|
* @param logisticsSendReq 物流对账单新增参数
|
|
|
* @return
|
|
* @return
|
|
|
*/
|
|
*/
|
|
|
- public Long saveDraft(LogisticsSendReq logisticsSendReq) {
|
|
|
|
|
|
|
+ public IdNo saveDraft(LogisticsSendReq logisticsSendReq) {
|
|
|
KwpLedgerLogistics kwpLedgerLogistics = new KwpLedgerLogistics();
|
|
KwpLedgerLogistics kwpLedgerLogistics = new KwpLedgerLogistics();
|
|
|
kwpLedgerLogistics.setId(Objects.isNull(logisticsSendReq.getIdLong()) ? new IdWorker(1).nextId() : logisticsSendReq.getIdLong());
|
|
kwpLedgerLogistics.setId(Objects.isNull(logisticsSendReq.getIdLong()) ? new IdWorker(1).nextId() : logisticsSendReq.getIdLong());
|
|
|
kwpLedgerLogistics.setEntId(LoginUserHolder.getEntId());
|
|
kwpLedgerLogistics.setEntId(LoginUserHolder.getEntId());
|
|
@@ -348,7 +362,7 @@ public class KwpLedgerLogisticsService extends AbsLedger {
|
|
|
|
|
|
|
|
logisticsUnits.add(carrierUnit);
|
|
logisticsUnits.add(carrierUnit);
|
|
|
logisticsUnitService.saveList(logisticsUnits);
|
|
logisticsUnitService.saveList(logisticsUnits);
|
|
|
- return kwpLedgerLogistics.getId();
|
|
|
|
|
|
|
+ return new IdNo(kwpLedgerLogistics.getId(), kwpLedgerLogistics.getLLedgerNo());
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -362,8 +376,8 @@ public class KwpLedgerLogisticsService extends AbsLedger {
|
|
|
log.info("物流对账单草稿:{}", JSONObject.toJSONString(logisticsReq));
|
|
log.info("物流对账单草稿:{}", JSONObject.toJSONString(logisticsReq));
|
|
|
logisticsReq.setGenerateTime(null);
|
|
logisticsReq.setGenerateTime(null);
|
|
|
logisticsReq.setStatus(LedgerEnum.SAVE.getStatus());
|
|
logisticsReq.setStatus(LedgerEnum.SAVE.getStatus());
|
|
|
- Long aLong = saveDraft(logisticsReq);
|
|
|
|
|
- logisticsTrackService.saveTrack(aLong, Global.EMPTY_STRING, LedgerEnum.SAVE);
|
|
|
|
|
|
|
+ IdNo aLong = saveDraft(logisticsReq);
|
|
|
|
|
+ logisticsTrackService.saveTrack(aLong.id(), Global.EMPTY_STRING, LedgerEnum.SAVE);
|
|
|
return "草稿保存成功";
|
|
return "草稿保存成功";
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -416,6 +430,23 @@ public class KwpLedgerLogisticsService extends AbsLedger {
|
|
|
kwpLedgerLogistics.setUpdateTime(LocalDateTime.now());
|
|
kwpLedgerLogistics.setUpdateTime(LocalDateTime.now());
|
|
|
logisticsMapper.updateById(kwpLedgerLogistics);
|
|
logisticsMapper.updateById(kwpLedgerLogistics);
|
|
|
logisticsTrackService.saveTrack(id, Global.EMPTY_STRING, LedgerEnum.REVOCATION);
|
|
logisticsTrackService.saveTrack(id, Global.EMPTY_STRING, LedgerEnum.REVOCATION);
|
|
|
|
|
+
|
|
|
|
|
+ //托运方
|
|
|
|
|
+ KwpLedgerLogisticsUnit logisticsUnit = logisticsUnitService.queryCustomerEnt(id, LogisticsUnitType.SHIPPER);
|
|
|
|
|
+ //承运方
|
|
|
|
|
+ KwpLedgerLogisticsUnit logisticsUnit2 = logisticsUnitService.queryCustomerEnt(id, LogisticsUnitType.CARRIER);
|
|
|
|
|
+ //推送创建人
|
|
|
|
|
+ messageSender.sendCreate(LoginUserHolder.getUserId(), new HashMap<>() {{
|
|
|
|
|
+ put("company", logisticsUnit.getFirmName());
|
|
|
|
|
+ put("number", kwpLedgerLogistics.getLLedgerNo());
|
|
|
|
|
+ put("name", kwpLedgerLogistics.getName());
|
|
|
|
|
+ }}, new UserInfo().setUserId(LoginUserHolder.getUserId()).setEntId(LoginUserHolder.getEntId()), MessageEnum.LEDGER_REVOCATION_CARRIER);
|
|
|
|
|
+ //推送系统管理员
|
|
|
|
|
+ messageSender.sendManager(LoginUserHolder.getUserId(), new HashMap<>() {{
|
|
|
|
|
+ put("company", logisticsUnit2.getFirmName());
|
|
|
|
|
+ put("number", kwpLedgerLogistics.getLLedgerNo());
|
|
|
|
|
+ put("name", kwpLedgerLogistics.getName());
|
|
|
|
|
+ }}, logisticsUnit.getEntId(), MessageEnum.LEDGER_REVOCATION_SHIPPER);
|
|
|
return "撤回成功";
|
|
return "撤回成功";
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -429,7 +460,7 @@ public class KwpLedgerLogisticsService extends AbsLedger {
|
|
|
KwpLedgerLogistics kwpLedgerLogistics = logisticsMapper.selectById(id);
|
|
KwpLedgerLogistics kwpLedgerLogistics = logisticsMapper.selectById(id);
|
|
|
orderCheck(kwpLedgerLogistics);
|
|
orderCheck(kwpLedgerLogistics);
|
|
|
backQueryCheck(kwpLedgerLogistics.getStatus());
|
|
backQueryCheck(kwpLedgerLogistics.getStatus());
|
|
|
- return logisticsTrackService.selectOne(id, LedgerTrackEnum.REJECT);
|
|
|
|
|
|
|
+ return logisticsTrackService.selectOne(id, LedgerEnum.BACK);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -450,6 +481,24 @@ public class KwpLedgerLogisticsService extends AbsLedger {
|
|
|
kwpLedgerLogistics.setUpdateTime(LocalDateTime.now());
|
|
kwpLedgerLogistics.setUpdateTime(LocalDateTime.now());
|
|
|
logisticsMapper.updateById(kwpLedgerLogistics);
|
|
logisticsMapper.updateById(kwpLedgerLogistics);
|
|
|
logisticsTrackService.saveTrack(ledgerReq.getIdLong(), ledgerReq.getRemark(), LedgerEnum.BACK);
|
|
logisticsTrackService.saveTrack(ledgerReq.getIdLong(), ledgerReq.getRemark(), LedgerEnum.BACK);
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ //托运方
|
|
|
|
|
+ KwpLedgerLogisticsUnit logisticsUnit = logisticsUnitService.queryCustomerEnt(ledgerReq.getIdLong(), LogisticsUnitType.SHIPPER);
|
|
|
|
|
+ //承运方
|
|
|
|
|
+ KwpLedgerLogisticsUnit logisticsUnit2 = logisticsUnitService.queryCustomerEnt(ledgerReq.getIdLong(), LogisticsUnitType.CARRIER);
|
|
|
|
|
+ //推送创建人
|
|
|
|
|
+ messageSender.sendCreate(LoginUserHolder.getUserId(), new HashMap<>() {{
|
|
|
|
|
+ put("company", logisticsUnit.getFirmName());
|
|
|
|
|
+ put("number", kwpLedgerLogistics.getLLedgerNo());
|
|
|
|
|
+ put("name", kwpLedgerLogistics.getName());
|
|
|
|
|
+ }}, new UserInfo().setUserId(LoginUserHolder.getUserId()).setEntId(LoginUserHolder.getEntId()), MessageEnum.LEDGER_BACK_CARRIER);
|
|
|
|
|
+ //推送系统管理员和变更人
|
|
|
|
|
+ messageSender.sendPurchaseBoth(LoginUserHolder.getUserId(), new HashMap<>() {{
|
|
|
|
|
+ put("company", logisticsUnit2.getFirmName());
|
|
|
|
|
+ put("number", kwpLedgerLogistics.getLLedgerNo());
|
|
|
|
|
+ put("name", kwpLedgerLogistics.getName());
|
|
|
|
|
+ }}, ledgerReq.getIdLong(), logisticsUnit.getEntId(), MessageEnum.LEDGER_BACK_SHIPPER);
|
|
|
return "驳回成功";
|
|
return "驳回成功";
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -473,6 +522,24 @@ public class KwpLedgerLogisticsService extends AbsLedger {
|
|
|
kwpLedgerLogistics.setUpdateBy(LoginUserHolder.getUserId());
|
|
kwpLedgerLogistics.setUpdateBy(LoginUserHolder.getUserId());
|
|
|
logisticsMapper.updateById(kwpLedgerLogistics);
|
|
logisticsMapper.updateById(kwpLedgerLogistics);
|
|
|
logisticsTrackService.saveTrack(confirmReq.getIdLong(), Global.EMPTY_STRING, LedgerEnum.LEDGERED);
|
|
logisticsTrackService.saveTrack(confirmReq.getIdLong(), Global.EMPTY_STRING, LedgerEnum.LEDGERED);
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ //托运方
|
|
|
|
|
+ KwpLedgerLogisticsUnit logisticsUnit = logisticsUnitService.queryCustomerEnt(confirmReq.getIdLong(), LogisticsUnitType.SHIPPER);
|
|
|
|
|
+ //承运方
|
|
|
|
|
+ KwpLedgerLogisticsUnit logisticsUnit2 = logisticsUnitService.queryCustomerEnt(confirmReq.getIdLong(), LogisticsUnitType.CARRIER);
|
|
|
|
|
+ //推送创建人
|
|
|
|
|
+ messageSender.sendCreate(LoginUserHolder.getUserId(), new HashMap<>() {{
|
|
|
|
|
+ put("company", logisticsUnit.getFirmName());
|
|
|
|
|
+ put("number", kwpLedgerLogistics.getLLedgerNo());
|
|
|
|
|
+ put("name", kwpLedgerLogistics.getName());
|
|
|
|
|
+ }}, new UserInfo().setUserId(LoginUserHolder.getUserId()).setEntId(LoginUserHolder.getEntId()), MessageEnum.LEDGER_CONFIRM_SHIPPER);
|
|
|
|
|
+ //推送系统管理员和变更人
|
|
|
|
|
+ messageSender.sendPurchaseBoth(LoginUserHolder.getUserId(), new HashMap<>() {{
|
|
|
|
|
+ put("company", logisticsUnit2.getFirmName());
|
|
|
|
|
+ put("number", kwpLedgerLogistics.getLLedgerNo());
|
|
|
|
|
+ put("name", kwpLedgerLogistics.getName());
|
|
|
|
|
+ }}, confirmReq.getIdLong(), logisticsUnit.getEntId(), MessageEnum.LEDGER_CONFIRM_SHIPPER);
|
|
|
return "对账确认成功";
|
|
return "对账确认成功";
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -529,6 +596,35 @@ public class KwpLedgerLogisticsService extends AbsLedger {
|
|
|
settlementLogisticsService.save(kwpSettlementLogistics);
|
|
settlementLogisticsService.save(kwpSettlementLogistics);
|
|
|
|
|
|
|
|
logisticsTrackService.saveTrack(ledgerReq.getIdLong(), Global.EMPTY_STRING, LedgerEnum.SUCCESS);
|
|
logisticsTrackService.saveTrack(ledgerReq.getIdLong(), Global.EMPTY_STRING, LedgerEnum.SUCCESS);
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ //托运方
|
|
|
|
|
+ KwpLedgerLogisticsUnit logisticsUnit = logisticsUnitService.queryCustomerEnt(ledgerReq.getIdLong(), LogisticsUnitType.SHIPPER);
|
|
|
|
|
+ //承运方
|
|
|
|
|
+ KwpLedgerLogisticsUnit logisticsUnit2 = logisticsUnitService.queryCustomerEnt(ledgerReq.getIdLong(), LogisticsUnitType.CARRIER);
|
|
|
|
|
+ //推送创建人
|
|
|
|
|
+ messageSender.sendCreate(LoginUserHolder.getUserId(), new HashMap<>() {{
|
|
|
|
|
+ put("company", logisticsUnit.getFirmName());
|
|
|
|
|
+ put("number", kwpLedgerLogistics.getLLedgerNo());
|
|
|
|
|
+ put("name", kwpLedgerLogistics.getName());
|
|
|
|
|
+ }}, new UserInfo().setUserId(LoginUserHolder.getUserId()).setEntId(LoginUserHolder.getEntId()), MessageEnum.LEDGER_SUCCESS_CARRIER);
|
|
|
|
|
+ //推送系统管理员和变更人
|
|
|
|
|
+ messageSender.sendPurchaseBoth(LoginUserHolder.getUserId(), new HashMap<>() {{
|
|
|
|
|
+ put("company", logisticsUnit2.getFirmName());
|
|
|
|
|
+ put("number", kwpLedgerLogistics.getLLedgerNo());
|
|
|
|
|
+ put("name", kwpLedgerLogistics.getName());
|
|
|
|
|
+ }}, ledgerReq.getIdLong(), logisticsUnit.getEntId(), MessageEnum.LEDGER_SUCCESS_SHIPPER);
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ //推送双方系统管理员
|
|
|
|
|
+ messageSender.sendManager(LoginUserHolder.getUserId(), new HashMap<>() {{
|
|
|
|
|
+ put("company", logisticsUnit.getFirmName());
|
|
|
|
|
+ put("number", kwpSettlementLogistics.getSlOrderNo());
|
|
|
|
|
+ }}, logisticsUnit2.getEntId(), MessageEnum.SETTLEMENT_CARRIER);
|
|
|
|
|
+ messageSender.sendManager(LoginUserHolder.getUserId(), new HashMap<>() {{
|
|
|
|
|
+ put("company", logisticsUnit2.getFirmName());
|
|
|
|
|
+ put("number", kwpSettlementLogistics.getSlOrderNo());
|
|
|
|
|
+ }}, logisticsUnit.getEntId(), MessageEnum.SETTLEMENT_SHIPPER);
|
|
|
return "对账完成";
|
|
return "对账完成";
|
|
|
}
|
|
}
|
|
|
|
|
|