提交 8a10f253 authored 作者: jiangwenye's avatar jiangwenye

Merge branch 'v6.4_transportation_20231110' of…

Merge branch 'v6.4_transportation_20231110' of https://t.clxkj.cn/clx-java/clx-performance into test
package com.clx.performance.controller.payment;
import com.clx.performance.param.pay.NotifyString;
import com.clx.performance.service.settle.SettlementMqHandlerService;
import com.msl.common.result.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -19,6 +20,8 @@ import java.util.Objects;
@AllArgsConstructor
public class PayNotifyController {
private final SettlementMqHandlerService settlementMqHandlerService;
@ApiOperation(value = "用户支付完成回调接口", notes = " <br>By:胡宁宁")
@RequestMapping(value = "/userPayNotify", method = RequestMethod.POST)
public Result<Object> userPayNotify(@RequestBody NotifyString notify) {
......@@ -29,9 +32,11 @@ public class PayNotifyController {
if (notify.getCode() != 0) {
// 支付失败处理
log.info("支付失败处理 唯一id {}", notify.getOrderNo());
settlementMqHandlerService.settlementDriverNotify(notify.getOrderNo(),0,notify.getMsg());
} else {
// 支付支付成功处理
log.info(" 支付支付成功处理 唯一id {}", notify.getOrderNo());
settlementMqHandlerService.settlementDriverNotify(notify.getOrderNo(),1,notify.getMsg());
}
Result<Object> ret = new Result<>();
return ret;
......
......@@ -7,6 +7,7 @@ import com.clx.performance.dao.settle.SettlementDriverDao;
import com.clx.performance.mapper.settle.SettlementDriverMapper;
import com.clx.performance.model.settle.SettlementDriver;
import com.clx.performance.param.pc.driver.PageCarrierSettlementDriverParam;
import com.msl.common.base.Optional;
import com.msl.common.dao.impl.BaseDaoImpl;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Repository;
......@@ -47,4 +48,13 @@ public class SettlementDriverDaoImpl extends BaseDaoImpl<SettlementDriverMapper,
query.orderByDesc(SettlementDriver :: getCreateTime);
return baseMapper.selectPage(Page.of(param.getPage(),param.getPageSize()),query);
}
@Override
public Optional<SettlementDriver> getByChildNo(String childNo) {
return Optional.of(childNo)
.map(item -> lQrWrapper()
.eq(SettlementDriver::getChildNo, item)
)
.map(super::getOne);
}
}
......@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.clx.performance.mapper.settle.SettlementDriverMapper;
import com.clx.performance.model.settle.SettlementDriver;
import com.clx.performance.param.pc.driver.PageCarrierSettlementDriverParam;
import com.msl.common.base.Optional;
import com.msl.common.dao.BaseDao;
/**
......@@ -14,4 +15,7 @@ import com.msl.common.dao.BaseDao;
*/
public interface SettlementDriverDao extends BaseDao<SettlementDriverMapper, SettlementDriver, Integer> {
IPage<SettlementDriver> pageCarrierSettlementDriver(PageCarrierSettlementDriverParam param);
Optional<SettlementDriver> getByChildNo(String childNo);
}
......@@ -45,6 +45,7 @@ public class SettlementDriver implements HasKey<Integer> {
private BigDecimal settlementFreight; //结算金额(分)
private Integer invoiceType; //开票标识:1网运单 2普通单
private String settlementPlatform; //结算平台
private String payErrorMsg; //支付失败原因
private Integer status; //状态
private LocalDateTime createTime; //创建时间
private LocalDateTime modifiedTime; //修改时间
......@@ -54,4 +55,4 @@ public class SettlementDriver implements HasKey<Integer> {
public Integer gainKey() {
return id;
}
}
\ No newline at end of file
}
......@@ -125,14 +125,10 @@ public class SettlementMqHandlerServiceImpl implements SettlementMqHandlerServic
}
}
//车主结算单自动支付
paySettlementDriver(settlementDriverDetail);
//生成车主结算单
settlementDriverSave(settlementDriverDetail,settlementNo);
//运单状态修改为完成
OrderChild orderChild = orderChildDao.getByChildNo(settlementDriverDetail.getChildNo()).orElseThrow(PerformanceResultEnum.ORDER_CHILD_NO_FOUND);
orderChild.setStatus(OrderChildEnum.Status.COMPLETE.getCode());
orderChildDao.updateSettlement(orderChild);
//车主结算单自动支付
paySettlementDriver(settlementDriverDetail);
// 更新结算单
settlementOwnerDetail.setSettlementNo(settlementNo);
......@@ -173,11 +169,29 @@ public class SettlementMqHandlerServiceImpl implements SettlementMqHandlerServic
settlementDriver.setSettlementFreight(detail.getSettlementFreight());
settlementDriver.setInvoiceType(detail.getInvoiceType());
settlementDriver.setSettlementPlatform(String.valueOf(SettlementPlatformEnum.Platform.MSL.getCode()));
settlementDriver.setStatus(SettlementDriverEnum.Status.SETTLED.getCode());
settlementDriver.setStatus(SettlementDriverEnum.Status.WAIT_SETTLEMENT.getCode());
settlementDriverDao.saveEntity(settlementDriver);
}
public void settlementDriverNotify(String childNo,Integer payType,String payErrorMsg){
//运单状态修改为完成
OrderChild orderChild = orderChildDao.getByChildNo(childNo).orElseThrow(PerformanceResultEnum.ORDER_CHILD_NO_FOUND);
SettlementDriver settlementDriver = settlementDriverDao.getByChildNo(childNo).orElseThrow(PerformanceResultEnum.ORDER_CHILD_NO_FOUND);
if(1 == payType){
orderChild.setStatus(OrderChildEnum.Status.COMPLETE.getCode());
orderChildDao.updateSettlement(orderChild);
settlementDriver.setStatus(SettlementDriverEnum.Status.SETTLED.getCode());
settlementDriverDao.updateEntityByKey(settlementDriver);
}else{
settlementDriver.setPayErrorMsg(payErrorMsg);
settlementDriverDao.updateEntityByKey(settlementDriver);
}
}
/**
* 车主结算单自动支付
*/
......@@ -192,7 +206,12 @@ public class SettlementMqHandlerServiceImpl implements SettlementMqHandlerServic
.pwd("noCheckPwd")
.remark(PayRemarkEnum.toString(PayRemarkEnum.FREIGHT_TO_OWNER.getValue()))
.build();
paymentService.paymentWallet(noCheckPwd);
try{
paymentService.paymentWallet(noCheckPwd);
}catch (Exception e){
e.printStackTrace();
}
}
/**
......
......@@ -9,4 +9,6 @@ public interface SettlementMqHandlerService {
void settlementDetailInvoiceTypeSync(SettlementDetailInvoiceTypeSyncMqParam mq);
void settlementDriverNotify(String childNo,Integer payType,String payErrorMsg);
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论