|
|
@@ -13,6 +13,7 @@ import com.sckw.core.utils.IdWorker;
|
|
|
import com.sckw.core.utils.OrderGenerateUtils;
|
|
|
import com.sckw.core.utils.StringTimeUtil;
|
|
|
import com.sckw.core.web.context.LoginUserHolder;
|
|
|
+import com.sckw.core.web.response.HttpResult;
|
|
|
import com.sckw.payment.dao.KwpLedgerLogisticsMapper;
|
|
|
import com.sckw.payment.model.*;
|
|
|
import com.sckw.payment.model.constant.LedgerEnum;
|
|
|
@@ -29,8 +30,9 @@ import com.sckw.system.api.RemoteSystemService;
|
|
|
import com.sckw.system.api.model.dto.res.EntCacheResDto;
|
|
|
import com.sckw.system.api.model.dto.res.SysDictResDto;
|
|
|
import com.sckw.transport.api.dubbo.TransportDubboService;
|
|
|
+import com.sckw.transport.api.model.dto.AccountCheckingBindDTO;
|
|
|
import com.sckw.transport.api.model.dto.LogisticsOrderDTO;
|
|
|
-import com.sckw.transport.api.model.vo.KwtLogisticsOrderVO;
|
|
|
+import io.seata.spring.annotation.GlobalTransactional;
|
|
|
import jakarta.annotation.Resource;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
@@ -134,7 +136,7 @@ public class KwpLedgerLogisticsService extends AbsLedger {
|
|
|
* @param logisticsReq
|
|
|
* @return
|
|
|
*/
|
|
|
- @Transactional(rollbackFor = Exception.class)
|
|
|
+ @GlobalTransactional(name = "default_tx_group", rollbackFor = Exception.class)
|
|
|
public String sendLedger(LogisticsSendReq logisticsReq) {
|
|
|
String id = logisticsReq.getId();
|
|
|
if (StringUtils.isBlank(id)) {
|
|
|
@@ -159,7 +161,7 @@ public class KwpLedgerLogisticsService extends AbsLedger {
|
|
|
*
|
|
|
* @param id 物流对账单id
|
|
|
*/
|
|
|
- private void removeDraft(Long id) {
|
|
|
+ public void removeDraft(Long id) {
|
|
|
//删除 kwp_ledger_logistics_order
|
|
|
logisticsOrderService.remove(id);
|
|
|
//删除 kwp_ledger_logistics_track
|
|
|
@@ -174,7 +176,7 @@ public class KwpLedgerLogisticsService extends AbsLedger {
|
|
|
* @param logisticsSendReq 物流对账单新增参数
|
|
|
* @return
|
|
|
*/
|
|
|
- private Long saveDraft(LogisticsSendReq logisticsSendReq) {
|
|
|
+ public Long saveDraft(LogisticsSendReq logisticsSendReq) {
|
|
|
KwpLedgerLogistics kwpLedgerLogistics = new KwpLedgerLogistics();
|
|
|
kwpLedgerLogistics.setId(Objects.isNull(logisticsSendReq.getIdLong()) ? new IdWorker(1).nextId() : logisticsSendReq.getIdLong());
|
|
|
kwpLedgerLogistics.setEntId(LoginUserHolder.getEntId());
|
|
|
@@ -222,16 +224,27 @@ public class KwpLedgerLogisticsService extends AbsLedger {
|
|
|
List<Long> ids = logisticsSendReq.getIdList();
|
|
|
//验当前订单是否已存在绑定的对账单
|
|
|
logisticsOrderService.check(ids);
|
|
|
- List<KwtLogisticsOrderVO> acceptCarriageOrderDetail = transportDubboService.getAcceptCarriageOrderDetail(logisticsSendReq.getIdsList());
|
|
|
+ List<LogisticsOrderDTO> acceptCarriageOrderDetail = transportDubboService.getAcceptCarriageOrderList(logisticsSendReq.getIdsList());
|
|
|
if (CollectionUtils.isEmpty(acceptCarriageOrderDetail) || acceptCarriageOrderDetail.size() < ids.size()) {
|
|
|
throw new BusinessException("未找到物流订单!");
|
|
|
}
|
|
|
+ //更新物流订单状态为已绑定
|
|
|
+ AccountCheckingBindDTO accountCheckingBindDTO = new AccountCheckingBindDTO();
|
|
|
+ accountCheckingBindDTO.setLOrderList(ids);
|
|
|
+ accountCheckingBindDTO.setStatus("1");
|
|
|
+ accountCheckingBindDTO.setUpdateBy(LoginUserHolder.getUserId());
|
|
|
+ accountCheckingBindDTO.setUpdateName(LoginUserHolder.getUserName());
|
|
|
+ HttpResult httpResult = transportDubboService.logisticsOrderAccountCheckingBind(accountCheckingBindDTO);
|
|
|
+ if (httpResult.getCode() != 60200) {
|
|
|
+ throw new BusinessException(httpResult.getMsg());
|
|
|
+ }
|
|
|
+
|
|
|
List<KwpLedgerLogisticsOrder> collect = acceptCarriageOrderDetail.stream().map(a -> {
|
|
|
KwpLedgerLogisticsOrder logisticsOrder = new KwpLedgerLogisticsOrder();
|
|
|
logisticsOrder.setId(new IdWorker(NumberConstant.ONE).nextId());
|
|
|
logisticsOrder.setLLedgerId(kwpLedgerLogistics.getId());
|
|
|
- logisticsOrder.setLOrderId(a.getId());
|
|
|
- logisticsOrder.setLOrderNo(a.getLOrderNo());
|
|
|
+ logisticsOrder.setLOrderId(Long.parseLong(a.getLOrderId()));
|
|
|
+ logisticsOrder.setLOrderNo(a.getLOrderNO());
|
|
|
logisticsOrder.setRemark(Global.EMPTY_STRING);
|
|
|
logisticsOrder.setStatus(NumberConstant.ZERO);
|
|
|
logisticsOrder.setCreateBy(LoginUserHolder.getUserId());
|
|
|
@@ -307,7 +320,7 @@ public class KwpLedgerLogisticsService extends AbsLedger {
|
|
|
* @param logisticsReq 物流对账单保存的参数
|
|
|
* @return
|
|
|
*/
|
|
|
- @Transactional(rollbackFor = Exception.class)
|
|
|
+ @GlobalTransactional(name = "default_tx_group", rollbackFor = Exception.class)
|
|
|
public String sendLedgerDraft(LogisticsSendReq logisticsReq) {
|
|
|
logisticsReq.setGenerateTime(null);
|
|
|
logisticsReq.setStatus(LedgerEnum.SAVE.getStatus());
|
|
|
@@ -322,6 +335,7 @@ public class KwpLedgerLogisticsService extends AbsLedger {
|
|
|
* @param id 物流对账单id
|
|
|
* @return
|
|
|
*/
|
|
|
+ @GlobalTransactional(rollbackFor = Exception.class)
|
|
|
public String remove(Long id) {
|
|
|
KwpLedgerLogistics kwpLedgerLogistics = logisticsMapper.selectById(id);
|
|
|
if (Objects.isNull(kwpLedgerLogistics)) {
|
|
|
@@ -331,6 +345,17 @@ public class KwpLedgerLogisticsService extends AbsLedger {
|
|
|
kwpLedgerLogistics.setDelFlag(Global.DELETED);
|
|
|
logisticsMapper.updateById(kwpLedgerLogistics);
|
|
|
logisticsTrackService.saveTrack(id, Global.EMPTY_STRING, LedgerTrackEnum.DELETE);
|
|
|
+ List<KwpLedgerLogisticsOrder> kwpLedgerLogisticsOrders = logisticsOrderService.queryList(id);
|
|
|
+ //更新物流订单状态为已解绑
|
|
|
+ AccountCheckingBindDTO accountCheckingBindDTO = new AccountCheckingBindDTO();
|
|
|
+ accountCheckingBindDTO.setLOrderList(kwpLedgerLogisticsOrders.stream().map(KwpLedgerLogisticsOrder::getLOrderId).collect(Collectors.toList()));
|
|
|
+ accountCheckingBindDTO.setStatus("0");
|
|
|
+ accountCheckingBindDTO.setUpdateBy(LoginUserHolder.getUserId());
|
|
|
+ accountCheckingBindDTO.setUpdateName(LoginUserHolder.getUserName());
|
|
|
+ HttpResult httpResult = transportDubboService.logisticsOrderAccountCheckingBind(accountCheckingBindDTO);
|
|
|
+ if (httpResult.getCode() != 60200) {
|
|
|
+ throw new BusinessException(httpResult.getMsg());
|
|
|
+ }
|
|
|
return "删除成功";
|
|
|
}
|
|
|
|
|
|
@@ -340,6 +365,7 @@ public class KwpLedgerLogisticsService extends AbsLedger {
|
|
|
* @param id 物流对账单id
|
|
|
* @return
|
|
|
*/
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
public String backOrder(Long id) {
|
|
|
KwpLedgerLogistics kwpLedgerLogistics = logisticsMapper.selectById(id);
|
|
|
if (Objects.isNull(kwpLedgerLogistics)) {
|
|
|
@@ -374,6 +400,7 @@ public class KwpLedgerLogisticsService extends AbsLedger {
|
|
|
* @param ledgerReq 驳回参数
|
|
|
* @return
|
|
|
*/
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
public String doBack(LedgerReq ledgerReq) {
|
|
|
KwpLedgerLogistics kwpLedgerLogistics = logisticsMapper.selectById(ledgerReq.getIdLong());
|
|
|
if (Objects.isNull(kwpLedgerLogistics)) {
|