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