|
|
@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject;
|
|
|
import com.github.pagehelper.PageHelper;
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
import com.sckw.core.common.enums.NumberConstant;
|
|
|
+import com.sckw.core.common.enums.enums.DictEnum;
|
|
|
import com.sckw.core.common.enums.enums.DictTypeEnum;
|
|
|
import com.sckw.core.exception.BusinessException;
|
|
|
import com.sckw.core.model.constant.Global;
|
|
|
@@ -16,6 +17,7 @@ import com.sckw.core.utils.StringTimeUtil;
|
|
|
import com.sckw.core.web.context.LoginUserHolder;
|
|
|
import com.sckw.order.api.dubbo.TradeOrderInfoService;
|
|
|
import com.sckw.order.api.model.OrderDetailRes;
|
|
|
+import com.sckw.order.api.model.UpdateOrderStatusParam;
|
|
|
import com.sckw.payment.dao.KwpLedgerTradeMapper;
|
|
|
import com.sckw.payment.model.*;
|
|
|
import com.sckw.payment.model.constant.LedgerEnum;
|
|
|
@@ -31,6 +33,7 @@ import com.sckw.payment.model.vo.res.LedgerTradeDetailVo;
|
|
|
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 io.seata.spring.annotation.GlobalTransactional;
|
|
|
import jakarta.annotation.Resource;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
@@ -433,12 +436,18 @@ public class KwpLedgerTradeService extends AbsLedger {
|
|
|
* @return
|
|
|
*/
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
+ @GlobalTransactional(rollbackFor = Exception.class)
|
|
|
public String orderSuccess(LedgerSuccessReq ledgerReq) {
|
|
|
Long id = ledgerReq.getIdLong();
|
|
|
//校验对账单状态
|
|
|
KwpLedgerTrade kwpLedgerTrade = tradeMapper.selectById(id);
|
|
|
orderCheck(kwpLedgerTrade);
|
|
|
successCheck(kwpLedgerTrade.getStatus());
|
|
|
+ //查询对账单关联的订单
|
|
|
+ List<KwpLedgerTradeOrder> kwpLedgerTradeOrders = tradeOrderService.queryList(id);
|
|
|
+ if (CollectionUtils.isEmpty(kwpLedgerTradeOrders)) {
|
|
|
+ throw new BusinessException("未找到关联的贸易订单");
|
|
|
+ }
|
|
|
//更新对账单
|
|
|
kwpLedgerTrade.setReceiptTime(LocalDateTime.of(ledgerReq.getReceiptTime(), LocalTime.MIN));
|
|
|
kwpLedgerTrade.setStatus(LedgerEnum.SUCCESS.getStatus());
|
|
|
@@ -467,6 +476,17 @@ public class KwpLedgerTradeService extends AbsLedger {
|
|
|
kwpSettlementTrade.setDelFlag(Global.UN_DELETED);
|
|
|
settlementTradeService.save(kwpSettlementTrade);
|
|
|
|
|
|
+ //更新贸易订单状态
|
|
|
+ List<Long> list = kwpLedgerTradeOrders.stream().map(KwpLedgerTradeOrder::getTOrderId).toList();
|
|
|
+ for (Long aLong : list) {
|
|
|
+ UpdateOrderStatusParam updateOrderStatusParam = new UpdateOrderStatusParam();
|
|
|
+ updateOrderStatusParam.setTOrderId(aLong);
|
|
|
+ updateOrderStatusParam.setStatus(Integer.valueOf(DictEnum.TORDER_STATUS_6.getValue()));
|
|
|
+ updateOrderStatusParam.setUpdateBy(LoginUserHolder.getUserId());
|
|
|
+ updateOrderStatusParam.setUpdateByName(LoginUserHolder.getUserName());
|
|
|
+ tradeOrderInfoService.updateOrderStatus(updateOrderStatusParam);
|
|
|
+ }
|
|
|
+ //保存操作记录
|
|
|
tradeTrackService.saveTrack(id, Global.EMPTY_STRING, LedgerTrackEnum.SUCCESS);
|
|
|
return "对账完成";
|
|
|
}
|