提交 98723261 authored 作者: 胡宁宁's avatar 胡宁宁

Merge branch 'v17.5_order_child_sync_broker_20240617' into dev

......@@ -20,6 +20,10 @@ public class PayPlatformFeeParam {
@ApiModelProperty(value = "金额", example = "2356", dataType = "int")
Integer figure;
@ApiModelProperty(value = "最新冻结金额金额", example = "2356", dataType = "int")
Integer figureNew;
@NotBlank(message = "交易单号不能为空")
@ApiModelProperty(value = "交易单号", example = "2356", dataType = "String")
String tradeNo;
......
......@@ -3,7 +3,9 @@ package com.clx.performance.controller.temp;
import com.clx.performance.dao.OrderChildDao;
import com.clx.performance.listener.OrderChildSyncTransportListener;
import com.clx.performance.model.OrderChild;
import com.clx.performance.service.settle.SettlementMqHandlerService;
import com.clx.performance.service.settle.SettlementMqService;
import com.clx.performance.vo.mq.SettlementStatisticsMqParam;
import com.msl.common.result.Result;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
......@@ -29,7 +31,20 @@ public class TempSettlementController {
private SettlementMqService settlementMqService;
@Autowired
private OrderChildSyncTransportListener orderChildSyncTransportListener;
@Autowired
private SettlementMqHandlerService settlementMqHandlerService;
@ApiOperation(value = "settlementStatistics", notes = "<br>By:艾庆国")
@RequestMapping(value = "/settlementStatistics", method = RequestMethod.GET)
public Result settlementStatistics(String childNo) {
SettlementStatisticsMqParam mq = new SettlementStatisticsMqParam();
mq.setChildNo(childNo);
mq.setInvoiceType(1);
settlementMqHandlerService.settlementStatistics(mq);
return Result.ok();
}
@ApiOperation(value = "运单同步broker", notes = "<br>By:艾庆国")
@RequestMapping(value = "/orderChildSync", method = RequestMethod.GET)
......
......@@ -169,6 +169,7 @@ public class OrderChildSyncTransportListener {
&& Objects.equals(orderGoods.getSettlementWay(), SettlementWayEnum.WayType.UNLOAD_LOSS.getCode())) {
settlementOwnerDetail.setPrepayFreight(BigDecimal.ZERO);
settlementDriverDetail.setPrepayFreightFlag(SettlementDriverEnum.PrepayFreightFlag.NO_PAY.getCode());
settlementOwnerDetail.setFinalPaymentStatus(SettlementOwnerDetailEnum.FinalPaymentStatus.NO_REQUIRE.getCode());
}
else if (Objects.equals(invoiceType, SettlementOwnerEnum.InvoiceType.ONLINE.getCode())) {
......
......@@ -156,7 +156,7 @@ public class OrderChildPoundAuditServiceImpl implements OrderChildPoundAuditSer
//判断是否平衡冻结金额
if(Objects.nonNull(paymentDTO.getChangeDeposit()) &&
paymentDTO.getChangeDeposit().compareTo(BigDecimal.ZERO) !=0){
paymentChangePlatformFee(orderChild.getChildNo(),paymentDTO.getChangeDeposit());
paymentChangePlatformFee(orderChild.getChildNo(),paymentDTO.getChangeDeposit(),paymentDTO.getPlatformServiceFeeNew());
}
//保存运单日志数据
orderChildLogService.saveOrderChildLog(param.getChildNo(),type,OrderChildLogEnum.Type.getByCode(type).isPresent() ? OrderChildLogEnum.Type.getByCode(type).get().getMsg() :"",
......@@ -167,11 +167,12 @@ public class OrderChildPoundAuditServiceImpl implements OrderChildPoundAuditSer
/***
* 平衡司机冻结保证金
*/
public void paymentChangePlatformFee(String childNo,BigDecimal changeDeposite){
public void paymentChangePlatformFee(String childNo,BigDecimal changeDeposite,BigDecimal figureNew){
if(changeDeposite.compareTo(BigDecimal.ZERO) !=0){
PayPlatformFeeParam payPlatformFeeParam = new PayPlatformFeeParam();
payPlatformFeeParam.setTradeNo(childNo);
payPlatformFeeParam.setFigure(changeDeposite.intValue());
payPlatformFeeParam.setFigureNew(figureNew.intValue());
//冻结司机押金
paymentService.paymentChangePlatformFee(payPlatformFeeParam);
}
......@@ -226,6 +227,9 @@ public class OrderChildPoundAuditServiceImpl implements OrderChildPoundAuditSer
//本次调整金额
BigDecimal platformServiceFeeNew = BigDecimal.ZERO;
log.info("运单号 {} ,原始冻结金额 {} ",orderChild.getChildNo(),platformServiceFee);
if(freight.compareTo(BigDecimal.ZERO)<=0){
return PaymentDTO.builder().changeDeposit(platformServiceFee.multiply(new BigDecimal("-1"))).platformServiceFeeNew(platformServiceFeeNew).build();
}
/**
* 如果之前未冻结保证金,本次不调整
* 如果 平台服务费率 为0 本次不处理
......@@ -240,7 +244,7 @@ public class OrderChildPoundAuditServiceImpl implements OrderChildPoundAuditSer
{
platformServiceFeeNew = freight
//平台服务费率 * 100
.multiply(platformServiceFeeRate).movePointLeft(2).setScale(2, RoundingMode.HALF_UP);
.multiply(platformServiceFeeRate).movePointLeft(2).setScale(0, RoundingMode.HALF_UP);
changeDeposit = platformServiceFeeNew.subtract(platformServiceFee);
log.info("运单号 {} ,原始冻结金额 {} ,最新冻结金额 {},运费差 {} 运费价格{},费率 {}",orderChild.getChildNo(),
platformServiceFee,platformServiceFeeNew,changeDeposit,freightPrice,platformServiceFeeRate
......
......@@ -808,7 +808,7 @@ public class OrderChildServiceImpl implements OrderChildService {
//判断是否平衡冻结金额
if(Objects.nonNull(paymentDTO.getChangeDeposit()) &&
paymentDTO.getChangeDeposit().compareTo(BigDecimal.ZERO) !=0){
paymentChangePlatformFee(childNo,paymentDTO.getChangeDeposit());
paymentChangePlatformFee(childNo,paymentDTO.getChangeDeposit(),paymentDTO.getPlatformServiceFeeNew());
}
} else {
//计算司机保证金
......@@ -826,7 +826,7 @@ public class OrderChildServiceImpl implements OrderChildService {
//判断是否平衡冻结金额
if(Objects.nonNull(paymentDTO.getChangeDeposit()) &&
paymentDTO.getChangeDeposit().compareTo(BigDecimal.ZERO) !=0){
paymentChangePlatformFee(childNo,paymentDTO.getChangeDeposit());
paymentChangePlatformFee(childNo,paymentDTO.getChangeDeposit(),paymentDTO.getPlatformServiceFeeNew());
}
}
}
......@@ -1007,7 +1007,7 @@ public class OrderChildServiceImpl implements OrderChildService {
//判断是否平衡冻结金额
if(Objects.nonNull(paymentDTO.getChangeDeposit()) &&
paymentDTO.getChangeDeposit().compareTo(BigDecimal.ZERO) !=0){
paymentChangePlatformFee(childNo,paymentDTO.getChangeDeposit());
paymentChangePlatformFee(childNo,paymentDTO.getChangeDeposit(),paymentDTO.getPlatformServiceFeeNew());
}
} else {
//计算司机保证金
......@@ -1028,7 +1028,7 @@ public class OrderChildServiceImpl implements OrderChildService {
//判断是否平衡冻结金额
if(Objects.nonNull(paymentDTO.getChangeDeposit()) &&
paymentDTO.getChangeDeposit().compareTo(BigDecimal.ZERO) !=0){
paymentChangePlatformFee(childNo,paymentDTO.getChangeDeposit());
paymentChangePlatformFee(childNo,paymentDTO.getChangeDeposit(),paymentDTO.getPlatformServiceFeeNew());
}
}
}
......@@ -1036,11 +1036,12 @@ public class OrderChildServiceImpl implements OrderChildService {
/***
* 平衡司机冻结保证金
*/
public void paymentChangePlatformFee(String childNo,BigDecimal changeDeposite){
public void paymentChangePlatformFee(String childNo,BigDecimal changeDeposite,BigDecimal deposite){
if(changeDeposite.compareTo(BigDecimal.ZERO) !=0){
PayPlatformFeeParam payPlatformFeeParam = new PayPlatformFeeParam();
payPlatformFeeParam.setTradeNo(childNo);
payPlatformFeeParam.setFigure(changeDeposite.intValue());
payPlatformFeeParam.setFigureNew(deposite.intValue());
//冻结司机押金
paymentService.paymentChangePlatformFee(payPlatformFeeParam);
}
......@@ -1288,7 +1289,7 @@ public class OrderChildServiceImpl implements OrderChildService {
//判断是否平衡冻结金额
if(Objects.nonNull(paymentDTO.getChangeDeposit()) &&
paymentDTO.getChangeDeposit().compareTo(BigDecimal.ZERO) !=0){
paymentChangePlatformFee(childNo,paymentDTO.getChangeDeposit());
paymentChangePlatformFee(childNo,paymentDTO.getChangeDeposit(),paymentDTO.getPlatformServiceFeeNew());
}
}
......
......@@ -43,6 +43,7 @@ import java.security.GeneralSecurityException;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.UUID;
import java.util.stream.Collectors;
......@@ -253,7 +254,12 @@ public class PaymentServiceImpl implements PaymentService {
throw new ServiceSystemException(PerformanceResultEnum.HTTP_ERROR);
}
if (notify.getCode() != 0) {
throw new ServiceSystemException(PerformanceResultEnum.HTTP_ERROR, notify.getMsg());
if(Objects.equals(notify.getCode(),"")){
throw new ServiceSystemException(PerformanceResultEnum.HTTP_ERROR,
"预估接单保证金"+new BigDecimal(param.getFigureNew()).movePointLeft(2)+"元,车主钱包余额不足,请先充值");
}else{
throw new ServiceSystemException(PerformanceResultEnum.HTTP_ERROR, notify.getMsg());
}
}
return notify;
}
......
......@@ -21,6 +21,7 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.time.LocalDateTime;
/**
......@@ -69,15 +70,11 @@ public class NetworkDriverAccountServiceImpl implements NetworkDriverAccountServ
UserSessionData loginUserInfo = TokenUtil.getLoginUserInfo();
Result<WalletResidueCardVO> result = paymentServiceFeign.getWallet(userCode);
log.info("WalletResidueCardVO:result:{}", JSONUtil.parse(result));
WalletResidueCardVO data = result.getData();
NetworkDriverAccount account = networkDriverAccountDao.getOneByField(NetworkDriverAccount::getDriverUserNo, loginUserInfo.getUserNo()).get();
log.info("WalletResidueCardVO:{}", JSONUtil.parse(data));
log.info("NetworkDriverAccount:{}", JSONUtil.parse(account));
data.setAssetSum(data.getAssetSum().add(account.getAccountBalance().movePointLeft(2)));
data.setFrozen(data.getFrozen().add(account.getFrozenBalance()));
data.setResidue(data.getResidue().add(account.getUsableBalance()));
log.info("WalletResidueCardVO222:{}", JSONUtil.parse(data));
data.setFrozen(data.getFrozen().add(account.getFrozenBalance()).setScale(2, RoundingMode.UP));
data.setResidue(data.getResidue().add(account.getUsableBalance()).setScale(2, RoundingMode.UP));
return data;
}
}
......@@ -212,6 +212,7 @@ public class SettlementMqHandlerServiceImpl implements SettlementMqHandlerServic
if (Objects.equals(orderGoods.getPlatformFreightQuotationTaxType(),
QuotationEnum.PlatformFreightQuotationTaxType.NO.getCode())
&& Objects.equals(orderGoods.getSettlementWay(), SettlementWayEnum.WayType.UNLOAD_LOSS.getCode())) {
settlementDriverDetail.setSettlementNo(settlementNo);
//插入同步网络货运待支付记录
childSyncTransportRecordService.addOrderChildSyncTransportRecord(settlementDriverDetail);
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论