提交 4597ac59 authored 作者: 胡宁宁's avatar 胡宁宁

司机接单逻辑调整

上级 9c243c1e
...@@ -37,7 +37,7 @@ public enum PerformanceResultEnum implements ResultEnum { ...@@ -37,7 +37,7 @@ public enum PerformanceResultEnum implements ResultEnum {
ORDER_WEIGHT_LACK(1201, "剩余吨数不足,请联系客服"), ORDER_WEIGHT_LACK(1201, "剩余吨数不足,请联系客服"),
ORDER_INVALID(1202, "无效的货单"), ORDER_INVALID(1202, "无效的货单"),
ORDER_INVALID1(1203, "当前运单的货源已完成或取消,请查看其他货源"), ORDER_INVALID1(1203, "当前运单的货源已完成或取消,请查看其他货源"),
ORDER_DRIVER_LIMIT(1204, "该货单不支持车主抢单"),
ORDER_CHILD_NO_FOUND(1301, "运单不存在"), ORDER_CHILD_NO_FOUND(1301, "运单不存在"),
ORDER_CHILD_STATUS_CHANGED(1302, "运单状态已变更,请重新刷新页面"), ORDER_CHILD_STATUS_CHANGED(1302, "运单状态已变更,请重新刷新页面"),
...@@ -97,6 +97,10 @@ public enum PerformanceResultEnum implements ResultEnum { ...@@ -97,6 +97,10 @@ public enum PerformanceResultEnum implements ResultEnum {
INTEGRAL_RULE_NAME_EXIST(1703, "层级名称已存在"), INTEGRAL_RULE_NAME_EXIST(1703, "层级名称已存在"),
APP_POP_UP_ERROR(-1000, "app弹窗提示"), APP_POP_UP_ERROR(-1000, "app弹窗提示"),
/**司机提示语 **/
APP_POP_UP_DRIVER_RESIDUE_ERROR(-500, "app弹窗提示"),
/**车主提示语 **/
APP_POP_UP_OWNER_RESIDUE_ERROR(-499, "app弹窗提示"),
WALLET_CODE_IS_NULL(1704, "用户钱包不存在"), WALLET_CODE_IS_NULL(1704, "用户钱包不存在"),
ORDER_GOODS_SAVE_FAIL(1801, "保存货单失败,请稍后再试"), ORDER_GOODS_SAVE_FAIL(1801, "保存货单失败,请稍后再试"),
......
...@@ -25,4 +25,7 @@ public class OrderChildSaveParam extends PositionParam { ...@@ -25,4 +25,7 @@ public class OrderChildSaveParam extends PositionParam {
@NotNull(message = "司机用户编号空") @NotNull(message = "司机用户编号空")
private Long driverUserNo; private Long driverUserNo;
@ApiModelProperty(value = "支付方密码", example = "2356", dataType = "String")
private String pwd;
} }
...@@ -13,13 +13,11 @@ import javax.validation.constraints.NotBlank; ...@@ -13,13 +13,11 @@ import javax.validation.constraints.NotBlank;
@Builder @Builder
@Accessors(chain = true) @Accessors(chain = true)
public class PayPlatformFeeParam { public class PayPlatformFeeParam {
@NotBlank(message = "支付人不能为空")
@ApiModelProperty(value = "支付来源", example = "2234", dataType = "int") @ApiModelProperty(value = "支付来源", example = "2234", dataType = "int")
Integer from; Integer from;
@NotBlank(message = "支付密码不能为空")
@ApiModelProperty(value = "支付方密码", example = "2356", dataType = "String") @ApiModelProperty(value = "支付方密码", example = "2356", dataType = "String")
String pwd; String pwd;
@NotBlank(message = "金额不能为空")
@ApiModelProperty(value = "金额", example = "2356", dataType = "int") @ApiModelProperty(value = "金额", example = "2356", dataType = "int")
Integer figure; Integer figure;
@NotBlank(message = "交易单号不能为空") @NotBlank(message = "交易单号不能为空")
......
package com.clx.performance.param.pc.payment;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
@ApiModel(description = "钱包查询")
@Getter
@Setter
@ToString
@NoArgsConstructor
public class WalletParam {
/**
* 用户编号从10000001开始
*/
@ApiModelProperty(value = "主钱包账号", dataType = "int", example = "1")
private Integer userCode;
}
package com.clx.performance.param.pc.payment;
import com.fasterxml.jackson.annotation.JsonGetter;
import io.swagger.annotations.ApiModelProperty;
import java.math.BigDecimal;
public class WalletResidueDTO {
//余额
@ApiModelProperty(value = "余额", dataType = "double", example = "11.10")
private Long residue;
//冻结的资金
@ApiModelProperty(value = "冻结的资金", dataType = "double", example = "11.10")
private Long frozen;
//保证金
@ApiModelProperty(value = "保证金", dataType = "double", example = "11.10")
private Double deposit;
//状态0锁定1正常2异常
@ApiModelProperty(value = "状态0锁定1正常2异常", dataType = "int", example = "1")
private Integer status;
//是否设置交易密码0没有1有
@ApiModelProperty(value = "是否设置交易密码0没有1有", dataType = "String", example = "1")
private String pwd;
public Long getResidue() {
return residue;
}
public void setResidue(Long residue) {
this.residue = residue;
}
public Long getFrozen() {
return frozen;
}
public void setFrozen(Long frozen) {
this.frozen = frozen;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public String getPwd() {
return pwd;
}
public void setPwd(String pwd) {
this.pwd = pwd;
}
@JsonGetter(value="frozen")
public BigDecimal frozenFormat() {
return new BigDecimal(new Double(this.frozen)/100);
}
@JsonGetter(value="residue")
public Double residueFormat() {
return new Double(this.residue)/100;
}
@JsonGetter(value="deposit")
public Double depositFormat() {
return new Double(this.deposit)/100;
}
public Double getDeposit() {
return deposit;
}
public void setDeposit(Double deposit) {
this.deposit = deposit;
}
@Override
public String toString() {
return "WalletDTO [residue=" + residue + ", frozen=" + frozen
+ ", status=" + status + "]";
}
}
...@@ -227,5 +227,7 @@ public class OrderChildVO { ...@@ -227,5 +227,7 @@ public class OrderChildVO {
@ApiModelProperty(value = "车辆未开启中交兴路的提示信息") @ApiModelProperty(value = "车辆未开启中交兴路的提示信息")
private String notOpenZJXLMsg; private String notOpenZJXLMsg;
@ApiModelProperty("接单保证金 平台服务费费率 弹窗和文案显示 0 不显示 1 显示")
private Integer goodsOrderDetailShow = 0;
} }
\ No newline at end of file
...@@ -155,4 +155,9 @@ public class OrderGoodsVO { ...@@ -155,4 +155,9 @@ public class OrderGoodsVO {
@ApiModelProperty("接单保证金(分/车)") @ApiModelProperty("接单保证金(分/车)")
private BigDecimal deposit; private BigDecimal deposit;
@ApiModelProperty("结算方式 1装车净重 2卸车净重")
private Integer settlementWay;
@ApiModelProperty("接单保证金 平台服务费费率 弹窗和文案显示 0 不显示 1 显示")
private Integer goodsOrderDetailShow = 0;
} }
\ No newline at end of file
...@@ -34,6 +34,8 @@ import com.clx.performance.model.loan.OwnerLoanAccountRunningWaterRecord; ...@@ -34,6 +34,8 @@ import com.clx.performance.model.loan.OwnerLoanAccountRunningWaterRecord;
import com.clx.performance.model.loan.OwnerRepayment; import com.clx.performance.model.loan.OwnerRepayment;
import com.clx.performance.model.settle.SettlementDriverDetail; import com.clx.performance.model.settle.SettlementDriverDetail;
import com.clx.performance.model.settle.SettlementOwnerDetail; import com.clx.performance.model.settle.SettlementOwnerDetail;
import com.clx.performance.param.pc.payment.PayPlatformFeeParam;
import com.clx.performance.service.PaymentService;
import com.clx.performance.service.loan.OwnerLoanRecordService; import com.clx.performance.service.loan.OwnerLoanRecordService;
import com.clx.performance.service.settle.NetworkDriverRunningWaterRecordService; import com.clx.performance.service.settle.NetworkDriverRunningWaterRecordService;
import com.clx.user.vo.feign.OwnerInfoFeignVO; import com.clx.user.vo.feign.OwnerInfoFeignVO;
...@@ -42,6 +44,7 @@ import lombok.AllArgsConstructor; ...@@ -42,6 +44,7 @@ import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.redisson.api.RLock; import org.redisson.api.RLock;
import org.redisson.api.RedissonClient; import org.redisson.api.RedissonClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationEventPublisher; import org.springframework.context.ApplicationEventPublisher;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -84,7 +87,7 @@ public class OrderChildLoanComponent { ...@@ -84,7 +87,7 @@ public class OrderChildLoanComponent {
private final NetworkDriverRunningWaterRecordService networkDriverRunningWaterRecordService; private final NetworkDriverRunningWaterRecordService networkDriverRunningWaterRecordService;
private final PaymentService paymentService;
/** /**
* 接单校验判断 * 接单校验判断
...@@ -338,6 +341,45 @@ public class OrderChildLoanComponent { ...@@ -338,6 +341,45 @@ public class OrderChildLoanComponent {
networkDriverRunningWaterRecordService.generateNetworkCaseOutRecord(settlementDriverDetail); networkDriverRunningWaterRecordService.generateNetworkCaseOutRecord(settlementDriverDetail);
} }
@Transactional(rollbackFor = Exception.class)
public void orderChildCancelAfter(String childNo){
//运单取消
OrderChild orderChild = orderChildDao.getByChildNo(childNo).orElseThrow(
PerformanceResultEnum.ORDER_CHILD_NO_FOUND);
BigDecimal platformServiceFee = orderChild.getPlatformServiceFee(); //平台服务费
List<OwnerLoanAccountRunningWaterRecord> runningWaterRecordList = ownerLoanAccountRunningWaterRecordDao.getListByChildNoAndRunningWaterType(childNo, OwnerLoanAccountRunningWaterRecordEnum.RunWaterType.APPROVE_FROZEN.getCode());
if (CollectionUtil.isEmpty(runningWaterRecordList)) {
if( Objects.nonNull(platformServiceFee) && platformServiceFee.compareTo(BigDecimal.ZERO) != 0){
PayPlatformFeeParam payPlatformFeeParam = new PayPlatformFeeParam();
payPlatformFeeParam.setTradeNo(childNo);
payPlatformFeeParam.setFigure(platformServiceFee.intValue());
paymentService.paymentCancelPlatformFee(payPlatformFeeParam);
}
return;
}
Long ownerUserNo = runningWaterRecordList.get(0).getOwnerUserNo();
log.info("当前解冻货主:{},流水记录长度{},流水记录{}", ownerUserNo, runningWaterRecordList.size(), JSONUtil.parse(runningWaterRecordList));
for (OwnerLoanAccountRunningWaterRecord record : runningWaterRecordList) {
Long loanNo = record.getLoanNo();
Integer loanType = record.getLoanType();
String ownerUserName = record.getOwnerUserName();
BigDecimal balance = record.getAlterationBalance();
//解冻借款
thawOwnerLoanAccount(loanNo, loanType, ownerUserNo, ownerUserName, record.getMobile(), childNo, balance);
}
if( Objects.nonNull(platformServiceFee) && platformServiceFee.compareTo(BigDecimal.ZERO) != 0){
PayPlatformFeeParam payPlatformFeeParam = new PayPlatformFeeParam();
payPlatformFeeParam.setTradeNo(childNo);
payPlatformFeeParam.setFigure(platformServiceFee.intValue());
paymentService.paymentCancelPlatformFee(payPlatformFeeParam);
}
}
//归还借款单的剩余金额+解冻流水 //归还借款单的剩余金额+解冻流水
public void thawOwnerLoanAccount(Long loanNo, Integer loanType, Long userNo, String userName, String mobile, String childNo, BigDecimal balance) { public void thawOwnerLoanAccount(Long loanNo, Integer loanType, Long userNo, String userName, String mobile, String childNo, BigDecimal balance) {
log.info("归还借款单的剩余金额+解冻流水,loanNo:{},loanType:{},userNo:{},childNo:{}, balance:{}", loanNo, loanType, userNo, childNo, balance); log.info("归还借款单的剩余金额+解冻流水,loanNo:{},loanType:{},userNo:{},childNo:{}, balance:{}", loanNo, loanType, userNo, childNo, balance);
......
...@@ -66,6 +66,8 @@ public class OrderChildDaoImpl extends BaseDaoImpl<OrderChildMapper, OrderChild, ...@@ -66,6 +66,8 @@ public class OrderChildDaoImpl extends BaseDaoImpl<OrderChildMapper, OrderChild,
.set(OrderChild::getWeight, item.getWeight()) .set(OrderChild::getWeight, item.getWeight())
.set(OrderChild::getFreight, item.getFreight()) .set(OrderChild::getFreight, item.getFreight())
.set(OrderChild::getStatus, item.getStatus()) .set(OrderChild::getStatus, item.getStatus())
.set(OrderChild::getDeposit, item.getDeposit())
.set(OrderChild::getPlatformServiceFee, item.getPlatformServiceFee())
); );
} }
...@@ -83,6 +85,8 @@ public class OrderChildDaoImpl extends BaseDaoImpl<OrderChildMapper, OrderChild, ...@@ -83,6 +85,8 @@ public class OrderChildDaoImpl extends BaseDaoImpl<OrderChildMapper, OrderChild,
.set(OrderChild::getWeight, item.getWeight()) .set(OrderChild::getWeight, item.getWeight())
.set(OrderChild::getFreight, item.getFreight()) .set(OrderChild::getFreight, item.getFreight())
.set(OrderChild::getStatus, item.getStatus()) .set(OrderChild::getStatus, item.getStatus())
.set(OrderChild::getDeposit, item.getDeposit())
.set(OrderChild::getPlatformServiceFee, item.getPlatformServiceFee())
); );
} }
...@@ -103,6 +107,8 @@ public class OrderChildDaoImpl extends BaseDaoImpl<OrderChildMapper, OrderChild, ...@@ -103,6 +107,8 @@ public class OrderChildDaoImpl extends BaseDaoImpl<OrderChildMapper, OrderChild,
.set(OrderChild::getWeight, item.getWeight()) .set(OrderChild::getWeight, item.getWeight())
.set(OrderChild::getFreight, item.getFreight()) .set(OrderChild::getFreight, item.getFreight())
.set(OrderChild::getPoundStatus, item.getPoundStatus()) .set(OrderChild::getPoundStatus, item.getPoundStatus())
.set(OrderChild::getDeposit, item.getDeposit())
.set(OrderChild::getPlatformServiceFee, item.getPlatformServiceFee())
); );
} }
......
...@@ -2,12 +2,13 @@ package com.clx.performance.dao.impl.payment; ...@@ -2,12 +2,13 @@ package com.clx.performance.dao.impl.payment;
import com.clx.performance.dao.payment.OrderPaymentDao; import com.clx.performance.dao.payment.OrderPaymentDao;
import com.clx.performance.mapper.payment.OrderPaymentMapper; import com.clx.performance.mapper.payment.OrderPaymentMapper;
import com.clx.performance.model.IntegralStatistics;
import com.clx.performance.model.payment.OrderPayment; import com.clx.performance.model.payment.OrderPayment;
import com.msl.common.base.Optional; import com.msl.common.base.Optional;
import com.msl.common.dao.impl.BaseDaoImpl; import com.msl.common.dao.impl.BaseDaoImpl;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
import java.util.List;
/** /**
* @author huningning * @author huningning
* Date 2024-06-18 * Date 2024-06-18
...@@ -48,5 +49,11 @@ public class OrderPaymentDaoImpl extends BaseDaoImpl<OrderPaymentMapper, OrderPa ...@@ -48,5 +49,11 @@ public class OrderPaymentDaoImpl extends BaseDaoImpl<OrderPaymentMapper, OrderPa
.map(super::getOne); .map(super::getOne);
} }
@Override
public List<OrderPayment> listByOrderNo(String orderNo, String paymentItem) {
return list(lQrWrapper()
.eq(OrderPayment::getOrderNo, orderNo)
.eq(OrderPayment::getPaymentItem, paymentItem)
);
}
} }
...@@ -6,6 +6,8 @@ import com.msl.common.base.Optional; ...@@ -6,6 +6,8 @@ import com.msl.common.base.Optional;
import com.msl.common.dao.BaseDao; import com.msl.common.dao.BaseDao;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List;
/** /**
* @author huningning * @author huningning
* Date 2024-06-18 * Date 2024-06-18
...@@ -24,4 +26,6 @@ public interface OrderPaymentDao extends BaseDao<OrderPaymentMapper, OrderPaymen ...@@ -24,4 +26,6 @@ public interface OrderPaymentDao extends BaseDao<OrderPaymentMapper, OrderPaymen
@Param("paymentItem")String paymentItem, @Param("paymentItem")String paymentItem,
@Param("operation")Integer operation); @Param("operation")Integer operation);
List<OrderPayment> listByOrderNo(@Param("orderNo")String orderNo, @Param("paymentItem")String paymentItem);
} }
package com.clx.performance.dto.payment;
import com.fasterxml.jackson.annotation.JsonGetter;
import io.swagger.annotations.ApiModelProperty;
import lombok.Builder;
import lombok.Data;
import java.math.BigDecimal;
/**
*
* @author 胡宁宁
* @date 2024年06
* @description
*/
@Data
@Builder
public class PaymentDTO {
/** 本次调整金额 **/
BigDecimal changeDeposit ;
/** 最新的保证金**/
BigDecimal platformServiceFeeNew;
}
...@@ -9,7 +9,7 @@ import java.math.BigDecimal; ...@@ -9,7 +9,7 @@ import java.math.BigDecimal;
/** /**
* *
* @author 胡宁宁 * @author 胡宁宁
* @date 2023年11月12日 * @date 2024年06
* @description * @description
*/ */
public class WalletResidueCardDTO extends WalletResidueDTO{ public class WalletResidueCardDTO extends WalletResidueDTO{
......
...@@ -7,12 +7,11 @@ import java.math.BigDecimal; ...@@ -7,12 +7,11 @@ import java.math.BigDecimal;
/** /**
* *
* @author 胡宁宁 * @author 胡宁宁
* @date 2023年11月12日 * @date 2024年06
* @description * @description
*/ */
public class WalletResidueDTO { public class WalletResidueDTO {
@ApiModelProperty(value = "余额", dataType = "double", example = "11.10") @ApiModelProperty(value = "余额", dataType = "double", example = "11.10")
......
...@@ -10,11 +10,14 @@ public enum HttpEnum { ...@@ -10,11 +10,14 @@ public enum HttpEnum {
PERFORMANCE_PAY_CLX_PAYMENT(10000, "履约服务向老马上来发起钱包转账", PERFORMANCE_PAY_CLX_PAYMENT(10000, "履约服务向老马上来发起钱包转账",
"/payment-service/performance/payUserWalletTransfer"), "/payment-service/performance/payUserWalletTransfer"),
PERFORMANCE_PAY_CLX_DRIVER_FREEZE(10000, "履约服务向老马上来发起司机押金冻结", PERFORMANCE_PAY_CLX_DRIVER_FREEZE(10001, "履约服务向老马上来发起司机押金冻结",
"/payment-service/performance/freezeUserMQ"), "/payment-service/performance/freezeUserMQ"),
PERFORMANCE_PAY_CLX_ADJUST_DRIVER_FREEZE(10000, "履约服务向老马上来发起司机押金冻结调整", PERFORMANCE_PAY_CLX_ADJUST_DRIVER_FREEZE(10002, "履约服务向老马上来发起司机押金冻结调整",
"/payment-service/performance/completeFreezeBatchMQ"), "/payment-service/performance/completeFreezeBatchMQ"),
PERFORMANCE_PAY_CLX_WALLET(10003, "履约服务向老马上来发起司机余额查询",
"/payment-service/performance/getWalletAndCard"),
; ;
private final int code; private final int code;
......
...@@ -211,24 +211,7 @@ public class EventListenerComponent { ...@@ -211,24 +211,7 @@ public class EventListenerComponent {
String childNo = event.getChildNo(); String childNo = event.getChildNo();
log.info("需要解冻借款的的运单号:{}", childNo); log.info("需要解冻借款的的运单号:{}", childNo);
List<OwnerLoanAccountRunningWaterRecord> runningWaterRecordList = ownerLoanAccountRunningWaterRecordDao.getListByChildNoAndRunningWaterType(childNo, OwnerLoanAccountRunningWaterRecordEnum.RunWaterType.APPROVE_FROZEN.getCode()); orderChildLoanComponent.orderChildCancelAfter(childNo);
if (CollectionUtil.isEmpty(runningWaterRecordList)) {
return;
}
Long ownerUserNo = runningWaterRecordList.get(0).getOwnerUserNo();
log.info("当前解冻货主:{},流水记录长度{},流水记录{}", ownerUserNo, runningWaterRecordList.size(), JSONUtil.parse(runningWaterRecordList));
for (OwnerLoanAccountRunningWaterRecord record : runningWaterRecordList) {
Long loanNo = record.getLoanNo();
Integer loanType = record.getLoanType();
String ownerUserName = record.getOwnerUserName();
BigDecimal balance = record.getAlterationBalance();
//解冻借款
orderChildLoanComponent.thawOwnerLoanAccount(loanNo, loanType, ownerUserNo, ownerUserName, record.getMobile(), childNo, balance);
}
} }
@EventListener(classes = {OwnerLoanThawEvent.class}) @EventListener(classes = {OwnerLoanThawEvent.class})
......
package com.clx.performance.extranal.order; package com.clx.performance.extranal.order;
import com.clx.order.vo.pc.carrier.InvoicingCompanyVO; import com.clx.order.vo.pc.carrier.InvoicingCompanyVO;
import com.msl.common.base.Optional;
public interface InvoicingCompanyService { public interface InvoicingCompanyService {
InvoicingCompanyVO getInvoicingCompanyByGroupCode(String companyGroupCode); Optional<InvoicingCompanyVO> getInvoicingCompany(int id);
} }
package com.clx.performance.extranal.order.impl;
import com.clx.order.feign.InvoicingCompanyFeign;
import com.clx.order.vo.pc.carrier.InvoicingCompanyVO;
import com.clx.performance.extranal.order.InvoicingCompanyService;
import com.msl.common.base.Optional;
import com.msl.common.result.Result;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
@Service
@Slf4j
@AllArgsConstructor
public class InvoicingCompanyImpl implements InvoicingCompanyService {
private final InvoicingCompanyFeign invoicingCompanyFeign;
@Override
public Optional<InvoicingCompanyVO> getInvoicingCompany(int id) {
return Optional.ofNullable(invoicingCompanyFeign.getInvoicingCompany(id))
.filter(Result::succeed)
.map(Result::getData);
}
}
...@@ -3,6 +3,7 @@ package com.clx.performance.service; ...@@ -3,6 +3,7 @@ package com.clx.performance.service;
import com.clx.performance.param.pc.payment.PayParam; import com.clx.performance.param.pc.payment.PayParam;
import com.clx.performance.param.pc.payment.PayPlatformFeeParam; import com.clx.performance.param.pc.payment.PayPlatformFeeParam;
import com.clx.performance.param.pc.payment.WalletResidueDTO;
import com.msl.common.result.Result; import com.msl.common.result.Result;
public interface PaymentService { public interface PaymentService {
...@@ -23,4 +24,8 @@ public interface PaymentService { ...@@ -23,4 +24,8 @@ public interface PaymentService {
void updateOrderPaymentSuccess(String orderNo,Integer operation, String paymentItem); void updateOrderPaymentSuccess(String orderNo,Integer operation, String paymentItem);
void updateOrderPaymentSerialNoSuccess(String orderNo,String serialNo,Integer operation, String paymentItem); void updateOrderPaymentSerialNoSuccess(String orderNo,String serialNo,Integer operation, String paymentItem);
WalletResidueDTO getWalletAndCard(Integer userCode);
} }
...@@ -4,12 +4,15 @@ import cn.hutool.json.JSONUtil; ...@@ -4,12 +4,15 @@ import cn.hutool.json.JSONUtil;
import cn.hutool.core.util.ArrayUtil; import cn.hutool.core.util.ArrayUtil;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.clx.order.enums.InvoicingCompanyEnum;
import com.clx.order.enums.OrderEnum; import com.clx.order.enums.OrderEnum;
import com.clx.order.enums.VehicleUsageEnum; import com.clx.order.enums.VehicleUsageEnum;
import com.clx.order.feign.OrderFeign; import com.clx.order.feign.OrderFeign;
import com.clx.order.vo.feign.FeignAddressVO; import com.clx.order.vo.feign.FeignAddressVO;
import com.clx.order.vo.feign.FeignOrderInfoVO; import com.clx.order.vo.feign.FeignOrderInfoVO;
import com.clx.order.vo.feign.FeignOrderVO; import com.clx.order.vo.feign.FeignOrderVO;
import com.clx.order.vo.pc.carrier.InvoicingCompanyVO;
import com.clx.order.vo.pc.owner.OwnerQuotationDetailVO;
import com.clx.performance.component.GoodsOrderTruckRecordComponent; import com.clx.performance.component.GoodsOrderTruckRecordComponent;
import com.clx.performance.component.OrderChildLoanComponent; import com.clx.performance.component.OrderChildLoanComponent;
import com.clx.performance.constant.RedisConstants; import com.clx.performance.constant.RedisConstants;
...@@ -19,10 +22,14 @@ import com.clx.performance.dao.breakcontract.BreakContractDriverRecordDao; ...@@ -19,10 +22,14 @@ import com.clx.performance.dao.breakcontract.BreakContractDriverRecordDao;
import com.clx.performance.dao.settle.SettlementOwnerDetailDao; import com.clx.performance.dao.settle.SettlementOwnerDetailDao;
import com.clx.performance.dto.OrderChildExpectDTO; import com.clx.performance.dto.OrderChildExpectDTO;
import com.clx.performance.dto.gd.GdRouteDTO; import com.clx.performance.dto.gd.GdRouteDTO;
import com.clx.performance.dto.payment.PaymentDTO;
import com.clx.performance.dto.payment.WalletResidueCardDTO; import com.clx.performance.dto.payment.WalletResidueCardDTO;
import com.clx.performance.dto.zjxl.TruckLocationDTO; import com.clx.performance.dto.zjxl.TruckLocationDTO;
import com.clx.performance.dto.zjxl.TruckTraceDTO; import com.clx.performance.dto.zjxl.TruckTraceDTO;
import com.clx.performance.enums.*; import com.clx.performance.enums.*;
import com.clx.performance.enums.settle.SettlementWayEnum;
import com.clx.performance.extranal.order.InvoicingCompanyService;
import com.clx.performance.extranal.order.QuotationService;
import com.clx.performance.extranal.user.*; import com.clx.performance.extranal.user.*;
import com.clx.performance.feign.FeignPaymentService; import com.clx.performance.feign.FeignPaymentService;
import com.clx.performance.model.*; import com.clx.performance.model.*;
...@@ -34,6 +41,7 @@ import com.clx.performance.param.pc.OrderChildCarrierCancelParam; ...@@ -34,6 +41,7 @@ import com.clx.performance.param.pc.OrderChildCarrierCancelParam;
import com.clx.performance.param.pc.PageCarrierOrderChildParam; import com.clx.performance.param.pc.PageCarrierOrderChildParam;
import com.clx.performance.param.pc.PageMonitorOrderChildQCParam; import com.clx.performance.param.pc.PageMonitorOrderChildQCParam;
import com.clx.performance.param.pc.PagePoundAuditParam; import com.clx.performance.param.pc.PagePoundAuditParam;
import com.clx.performance.param.pc.payment.PayPlatformFeeParam;
import com.clx.performance.service.*; import com.clx.performance.service.*;
import com.clx.performance.service.breakcontract.BreakContractDriverRecordService; import com.clx.performance.service.breakcontract.BreakContractDriverRecordService;
import com.clx.performance.service.child.OrderChildPostService; import com.clx.performance.service.child.OrderChildPostService;
...@@ -49,6 +57,7 @@ import com.clx.performance.utils.zjxl.ZjxlGpsService; ...@@ -49,6 +57,7 @@ import com.clx.performance.utils.zjxl.ZjxlGpsService;
import com.clx.performance.vo.app.*; import com.clx.performance.vo.app.*;
import com.clx.performance.vo.app.owner.OwnerOrderChildVO; import com.clx.performance.vo.app.owner.OwnerOrderChildVO;
import com.clx.performance.vo.pc.*; import com.clx.performance.vo.pc.*;
import com.clx.performance.vo.pc.carrier.settle.CarrierPagePlatformServiceFeeConfigVO;
import com.clx.user.enums.driver.DriverInfoEnum; import com.clx.user.enums.driver.DriverInfoEnum;
import com.clx.user.vo.feign.DriverTruckInfoFeignVo; import com.clx.user.vo.feign.DriverTruckInfoFeignVo;
import com.clx.user.vo.feign.OwnerInfoFeignVO; import com.clx.user.vo.feign.OwnerInfoFeignVO;
...@@ -188,8 +197,15 @@ public class OrderChildServiceImpl implements OrderChildService { ...@@ -188,8 +197,15 @@ public class OrderChildServiceImpl implements OrderChildService {
@Autowired @Autowired
private TruckTraceService truckTraceService; private TruckTraceService truckTraceService;
@Autowired
private PlatformServiceFeeConfigService platformServiceFeeConfigService;
@Autowired
private InvoicingCompanyService invoicingCompanyService;
@Autowired
private PaymentService paymentService;
@Autowired
private QuotationService quotationService;
@Override @Override
public SaveOrderChildVO saveOrderChild(OrderChildSaveParam param) { public SaveOrderChildVO saveOrderChild(OrderChildSaveParam param) {
...@@ -269,8 +285,10 @@ public class OrderChildServiceImpl implements OrderChildService { ...@@ -269,8 +285,10 @@ public class OrderChildServiceImpl implements OrderChildService {
// 司机接单限制 // 司机接单限制
driverTakeOrderLimit(driverTruckInfo.getUserNo()); driverTakeOrderLimit(driverTruckInfo.getUserNo());
//接单钱包限制 /** 判断当前用户是否为车主 true 车主 */
driverTakeOrderPaymentLimit(driverTruckInfo.getWalletCode(),driverTruckInfo.getTruckOwnWalletCode()); boolean truckOwnerFlag = Objects.equals(driverTruckInfo.getWalletCode(), driverTruckInfo.getTruckOwnWalletCode());
/** 冻结的钱包账户**/
Integer checkWalletCode = truckOwnerFlag ? driverTruckInfo.getWalletCode() : driverTruckInfo.getTruckOwnWalletCode();
LocalDateTime now = LocalDateTime.now(); LocalDateTime now = LocalDateTime.now();
OrderGoods orderGoods = orderGoodsDao.getByOrderGoodsNo(param.getOrderGoodsNo()).orElseThrow( OrderGoods orderGoods = orderGoodsDao.getByOrderGoodsNo(param.getOrderGoodsNo()).orElseThrow(
...@@ -280,6 +298,13 @@ public class OrderChildServiceImpl implements OrderChildService { ...@@ -280,6 +298,13 @@ public class OrderChildServiceImpl implements OrderChildService {
log.warn("货单已暂停"); log.warn("货单已暂停");
throw new ServiceSystemException(PerformanceResultEnum.ORDER_INVALID,"当前货单无效"); throw new ServiceSystemException(PerformanceResultEnum.ORDER_INVALID,"当前货单无效");
} }
//获取平台 接单保证金 和服务费率
BigDecimal deposit = BigDecimal.ZERO;
if(Objects.nonNull(orderGoods.getDeposit())){
deposit = orderGoods.getDeposit();//接单保证金
}
//接单钱包限制
driverTakeOrderPaymentLimit(driverTruckInfo.getWalletCode(),driverTruckInfo.getTruckOwnWalletCode(),deposit);
// 状态验证 // 状态验证
if (!Objects.equals(orderGoods.getOrderGoodsStatus(), OrderGoodsStatusEnum.Status.PAYING.getCode()) && if (!Objects.equals(orderGoods.getOrderGoodsStatus(), OrderGoodsStatusEnum.Status.PAYING.getCode()) &&
...@@ -289,6 +314,21 @@ public class OrderChildServiceImpl implements OrderChildService { ...@@ -289,6 +314,21 @@ public class OrderChildServiceImpl implements OrderChildService {
FeignOrderInfoVO orderInfo = orderService.getOrderInfo(orderGoods.getOrderNo()).orElseThrow(PerformanceResultEnum.ORDER_INVALID); FeignOrderInfoVO orderInfo = orderService.getOrderInfo(orderGoods.getOrderNo()).orElseThrow(PerformanceResultEnum.ORDER_INVALID);
/** 存在开票公司 **/
if (Objects.nonNull(orderInfo.getInvoicingCompanyId())
&& orderInfo.getInvoicingCompanyId() > 0) {
InvoicingCompanyVO invoicingCompanyVO = invoicingCompanyService.
getInvoicingCompany(orderInfo.getInvoicingCompanyId()).orElseThrow(PerformanceResultEnum.DATA_NOT_FIND);
/** 是否支持车主接单,0:否,1:是,默认是
* 逻辑:如果结算方式是 卸车净重(减货损),开票公司支持车主模式 , 那么都可以接单 如果不支持车主模式 ,只能车主接单**/
if (Objects.equals(invoicingCompanyVO.getSupportOwnerOrder(), 1) &&
Objects.equals(orderGoods.getSettlementWay(), SettlementWayEnum.WayType.UNLOAD_LOSS.getCode())) {
if (!truckOwnerFlag) {
throw new ServiceSystemException(PerformanceResultEnum.ORDER_DRIVER_LIMIT);
}
}
}
OwnerInfoFeignVO ownerInfo = ownerInfoService.getOwnerInfo(orderInfo.getOwnerUserNo()); OwnerInfoFeignVO ownerInfo = ownerInfoService.getOwnerInfo(orderInfo.getOwnerUserNo());
// // 车型限制 // // 车型限制
// FeignOrderInfoVO orderInfo = orderService.getOrderInfo(orderGoods.getOrderNo()).orElseThrow // FeignOrderInfoVO orderInfo = orderService.getOrderInfo(orderGoods.getOrderNo()).orElseThrow
...@@ -418,7 +458,7 @@ public class OrderChildServiceImpl implements OrderChildService { ...@@ -418,7 +458,7 @@ public class OrderChildServiceImpl implements OrderChildService {
// 平台服务费 // 平台服务费
orderChild.setPlatformServiceFeeRate(orderGoods.getPlatformServiceFeeRate()); orderChild.setPlatformServiceFeeRate(orderGoods.getPlatformServiceFeeRate());
orderChild.setPlatformServiceFee(orderGoods.getDeposit());
orderChild.setDeposit(orderGoods.getDeposit()); orderChild.setDeposit(orderGoods.getDeposit());
// 更新货单数据 // 更新货单数据
...@@ -437,7 +477,16 @@ public class OrderChildServiceImpl implements OrderChildService { ...@@ -437,7 +477,16 @@ public class OrderChildServiceImpl implements OrderChildService {
// 新增日志 // 新增日志
orderChildLogService.saveDriverOrderChildLog(childNo, OrderChildLogEnum.Type.CREATED.getCode(), orderChildLogService.saveDriverOrderChildLog(childNo, OrderChildLogEnum.Type.CREATED.getCode(),
OrderChildLogEnum.Type.CREATED.getMsg(), loginUserInfo.getUserNo(), loginUserInfo.getUserName()); OrderChildLogEnum.Type.CREATED.getMsg(), loginUserInfo.getUserNo(), loginUserInfo.getUserName());
// 冻结司机保证金
if(deposit.compareTo(BigDecimal.ZERO) ==1){
PayPlatformFeeParam payPlatformFeeParam = new PayPlatformFeeParam();
payPlatformFeeParam.setTradeNo(childNo);
payPlatformFeeParam.setFrom(checkWalletCode);
payPlatformFeeParam.setFigure(orderGoods.getDeposit().intValue());
payPlatformFeeParam.setPwd(param.getPwd());
//冻结司机押金
paymentService.paymentPlatformFee(payPlatformFeeParam);
}
// 司机接单后置逻辑 // 司机接单后置逻辑
orderChildPostService.orderChildAdd(orderChild.getChildNo()); orderChildPostService.orderChildAdd(orderChild.getChildNo());
...@@ -747,18 +796,77 @@ public class OrderChildServiceImpl implements OrderChildService { ...@@ -747,18 +796,77 @@ public class OrderChildServiceImpl implements OrderChildService {
if (orderChild.getLoadTime() == null && if (orderChild.getLoadTime() == null &&
Objects.equals(orderChild.getStatus(), OrderChildEnum.Status.ARRIVE_SEND.getCode())) { Objects.equals(orderChild.getStatus(), OrderChildEnum.Status.ARRIVE_SEND.getCode())) {
//计算司机保证金
BigDecimal net = param.getLoadRough().subtract(param.getLoadTare());
PaymentDTO paymentDTO = getPaymentDTO(net, orderChild);
if (Objects.nonNull(paymentDTO.getPlatformServiceFeeNew()) &&
paymentDTO.getPlatformServiceFeeNew().compareTo(BigDecimal.ZERO) != 0) {
orderChild.setPlatformServiceFee(paymentDTO.getPlatformServiceFeeNew());
}
updateLoadFirst(param, orderChild, orderGoods); updateLoadFirst(param, orderChild, orderGoods);
// 日志 // 日志
orderChildLogService.saveDriverOrderChildLog(childNo, OrderChildLogEnum.Type.LOAD.getCode(), orderChildLogService.saveDriverOrderChildLog(childNo, OrderChildLogEnum.Type.LOAD.getCode(),
OrderChildLogEnum.Type.LOAD.getMsg(), loginUserInfo.getUserNo(), loginUserInfo.getUserName()); OrderChildLogEnum.Type.LOAD.getMsg(), loginUserInfo.getUserNo(), loginUserInfo.getUserName());
//判断是否平衡冻结金额
if(Objects.nonNull(paymentDTO.getChangeDeposit()) &&
paymentDTO.getChangeDeposit().compareTo(BigDecimal.ZERO) !=0){
paymentChangePlatformFee(childNo,paymentDTO.getChangeDeposit());
}
} else { } else {
//计算司机保证金
BigDecimal net =param.getLoadRough().subtract(param.getLoadTare());
PaymentDTO paymentDTO = getPaymentDTO(net, orderChild);
if (Objects.nonNull(paymentDTO.getPlatformServiceFeeNew()) &&
paymentDTO.getPlatformServiceFeeNew().compareTo(BigDecimal.ZERO) != 0) {
orderChild.setPlatformServiceFee(paymentDTO.getPlatformServiceFeeNew());
}
updateReload(param, orderChild, orderGoods); updateReload(param, orderChild, orderGoods);
// 日志 // 日志
orderChildLogService.saveDriverOrderChildLog(childNo, OrderChildLogEnum.Type.RELOAD.getCode(), orderChildLogService.saveDriverOrderChildLog(childNo, OrderChildLogEnum.Type.RELOAD.getCode(),
OrderChildLogEnum.Type.RELOAD.getMsg(), loginUserInfo.getUserNo(), loginUserInfo.getUserName()); OrderChildLogEnum.Type.RELOAD.getMsg(), loginUserInfo.getUserNo(), loginUserInfo.getUserName());
//判断是否平衡冻结金额
if(Objects.nonNull(paymentDTO.getChangeDeposit()) &&
paymentDTO.getChangeDeposit().compareTo(BigDecimal.ZERO) !=0){
paymentChangePlatformFee(childNo,paymentDTO.getChangeDeposit());
}
} }
} }
/***
* 获取最新的保证金金额和本次调增的金额
*/
public PaymentDTO getPaymentDTO(BigDecimal net , OrderChild orderChild){
//计算司机保证金
BigDecimal freightPrice = orderChild.getFreightPrice();
BigDecimal deposit = orderChild.getDeposit();
BigDecimal platformServiceFeeRate = orderChild.getPlatformServiceFeeRate();
BigDecimal platformServiceFee = orderChild.getPlatformServiceFee(); //平台服务费
//本次调整金额
BigDecimal changeDeposit = BigDecimal.ZERO;
//本次调整金额
BigDecimal platformServiceFeeNew = BigDecimal.ZERO;
/**
* 如果之前未冻结保证金,本次不调整
* 如果 平台服务费率 为0 本次不处理
* 如果 本次吨数为 0 本次不处理
* 如果 本次调整金额为 0 本次不处理
* **/
if(Objects.nonNull(deposit) && deposit.compareTo(BigDecimal.ZERO) != 0 &&
Objects.nonNull(platformServiceFee) && platformServiceFee.compareTo(BigDecimal.ZERO) != 0 &&
Objects.nonNull(platformServiceFeeRate) && platformServiceFeeRate.compareTo(BigDecimal.ZERO) != 0 &&
Objects.nonNull(net) && net.compareTo(BigDecimal.ZERO) != 0
)
{
platformServiceFeeNew = net.multiply(freightPrice).setScale(2, RoundingMode.HALF_UP).multiply(platformServiceFeeRate).setScale(2, RoundingMode.HALF_UP);
changeDeposit = platformServiceFeeNew.subtract(platformServiceFee);
}
return PaymentDTO.builder().changeDeposit(changeDeposit).platformServiceFeeNew(platformServiceFeeNew).build();
}
private void updateLoadFirst(OrderChildLoadParam param, OrderChild orderChild, OrderGoods orderGoods) { private void updateLoadFirst(OrderChildLoadParam param, OrderChild orderChild, OrderGoods orderGoods) {
String childNo = param.getChildNo(); String childNo = param.getChildNo();
BigDecimal loadNet = param.getLoadRough().subtract(param.getLoadTare()); BigDecimal loadNet = param.getLoadRough().subtract(param.getLoadTare());
...@@ -875,16 +983,38 @@ public class OrderChildServiceImpl implements OrderChildService { ...@@ -875,16 +983,38 @@ public class OrderChildServiceImpl implements OrderChildService {
// throw new ServiceSystemException(PerformanceResultEnum.ORDER_CHILD_UNLOAD_WEIGHT_ERROR); // throw new ServiceSystemException(PerformanceResultEnum.ORDER_CHILD_UNLOAD_WEIGHT_ERROR);
// } // }
if (orderChild.getUnloadTime() == null && if (orderChild.getUnloadTime() == null &&
Objects.equals(orderChild.getStatus(), OrderChildEnum.Status.ARRIVE_RECEIVE.getCode())) { Objects.equals(orderChild.getStatus(), OrderChildEnum.Status.ARRIVE_RECEIVE.getCode())) {
//计算司机保证金
BigDecimal net = param.getUnloadRough().subtract(param.getUnloadTare());
PaymentDTO paymentDTO = getPaymentDTO(net, orderChild);
if (Objects.nonNull(paymentDTO.getPlatformServiceFeeNew()) &&
paymentDTO.getPlatformServiceFeeNew().compareTo(BigDecimal.ZERO) != 0) {
orderChild.setPlatformServiceFee(paymentDTO.getPlatformServiceFeeNew());
}
updateUnloadFirst(param, orderChild); updateUnloadFirst(param, orderChild);
// 日志 // 日志
orderChildLogService.saveDriverOrderChildLog(childNo, OrderChildLogEnum.Type.UNLOAD.getCode(), orderChildLogService.saveDriverOrderChildLog(childNo, OrderChildLogEnum.Type.UNLOAD.getCode(),
OrderChildLogEnum.Type.UNLOAD.getMsg(), loginUserInfo.getUserNo(), loginUserInfo.getUserName()); OrderChildLogEnum.Type.UNLOAD.getMsg(), loginUserInfo.getUserNo(), loginUserInfo.getUserName());
orderChildPoundLogService.saveDriverOrderChildLog(childNo, OrderChildPoundAuditEnum.Status.AUDIT.getCode(), orderChildPoundLogService.saveDriverOrderChildLog(childNo, OrderChildPoundAuditEnum.Status.AUDIT.getCode(),
OrderChildPoundAuditEnum.Status.AUDIT.getMsg(), OrderChildLogEnum.CreateType.DRIVER.getCode(), OrderChildPoundAuditEnum.Status.AUDIT.getMsg(), OrderChildLogEnum.CreateType.DRIVER.getCode(),
loginUserInfo.getUserNo(), loginUserInfo.getUserName()); loginUserInfo.getUserNo(), loginUserInfo.getUserName());
//判断是否平衡冻结金额
if(Objects.nonNull(paymentDTO.getChangeDeposit()) &&
paymentDTO.getChangeDeposit().compareTo(BigDecimal.ZERO) !=0){
paymentChangePlatformFee(childNo,paymentDTO.getChangeDeposit());
}
} else { } else {
//计算司机保证金
BigDecimal net = param.getUnloadRough().subtract(param.getUnloadTare());
PaymentDTO paymentDTO = getPaymentDTO(net, orderChild);
if (Objects.nonNull(paymentDTO.getPlatformServiceFeeNew()) &&
paymentDTO.getPlatformServiceFeeNew().compareTo(BigDecimal.ZERO) != 0) {
orderChild.setPlatformServiceFee(paymentDTO.getPlatformServiceFeeNew());
}
updateReUnload(param, orderChild); updateReUnload(param, orderChild);
// 日志 // 日志
orderChildLogService.saveDriverOrderChildLog(childNo, OrderChildLogEnum.Type.REUNLOAD.getCode(), orderChildLogService.saveDriverOrderChildLog(childNo, OrderChildLogEnum.Type.REUNLOAD.getCode(),
...@@ -892,6 +1022,24 @@ public class OrderChildServiceImpl implements OrderChildService { ...@@ -892,6 +1022,24 @@ public class OrderChildServiceImpl implements OrderChildService {
orderChildPoundLogService.saveDriverOrderChildLog(childNo, OrderChildPoundAuditEnum.Status.AUDIT.getCode(), orderChildPoundLogService.saveDriverOrderChildLog(childNo, OrderChildPoundAuditEnum.Status.AUDIT.getCode(),
OrderChildPoundAuditEnum.Status.AUDIT.getMsg(), OrderChildLogEnum.CreateType.DRIVER.getCode(), OrderChildPoundAuditEnum.Status.AUDIT.getMsg(), OrderChildLogEnum.CreateType.DRIVER.getCode(),
loginUserInfo.getUserNo(), loginUserInfo.getUserName()); loginUserInfo.getUserNo(), loginUserInfo.getUserName());
//判断是否平衡冻结金额
if(Objects.nonNull(paymentDTO.getChangeDeposit()) &&
paymentDTO.getChangeDeposit().compareTo(BigDecimal.ZERO) !=0){
paymentChangePlatformFee(childNo,paymentDTO.getChangeDeposit());
}
}
}
/***
* 平衡司机冻结保证金
*/
public void paymentChangePlatformFee(String childNo,BigDecimal changeDeposite){
if(changeDeposite.compareTo(BigDecimal.ZERO) ==1){
PayPlatformFeeParam payPlatformFeeParam = new PayPlatformFeeParam();
payPlatformFeeParam.setTradeNo(childNo);
payPlatformFeeParam.setFigure(changeDeposite.intValue());
//冻结司机押金
paymentService.paymentChangePlatformFee(payPlatformFeeParam);
} }
} }
...@@ -1108,6 +1256,13 @@ public class OrderChildServiceImpl implements OrderChildService { ...@@ -1108,6 +1256,13 @@ public class OrderChildServiceImpl implements OrderChildService {
audit.setLoadRough(orderChild.getLoadRough()); audit.setLoadRough(orderChild.getLoadRough());
audit.setLoadTare(orderChild.getLoadTare()); audit.setLoadTare(orderChild.getLoadTare());
//计算司机保证金
BigDecimal net =param.getLoadRough().subtract(param.getLoadTare());
PaymentDTO paymentDTO = getPaymentDTO(net, orderChild);
if (Objects.nonNull(paymentDTO.getPlatformServiceFeeNew()) &&
paymentDTO.getPlatformServiceFeeNew().compareTo(BigDecimal.ZERO) != 0) {
orderChild.setPlatformServiceFee(paymentDTO.getPlatformServiceFeeNew());
}
// 更新装车净重 // 更新装车净重
updateOrderGoodsAmountLoad(orderGoods, childNo,dif,OrderGoodsStatusEnum.Status.GO_TO_SEND.getCode()); updateOrderGoodsAmountLoad(orderGoods, childNo,dif,OrderGoodsStatusEnum.Status.GO_TO_SEND.getCode());
...@@ -1126,6 +1281,12 @@ public class OrderChildServiceImpl implements OrderChildService { ...@@ -1126,6 +1281,12 @@ public class OrderChildServiceImpl implements OrderChildService {
orderChildPoundLogService.saveDriverOrderChildLog(childNo, OrderChildPoundAuditEnum.Status.AUDIT.getCode(), orderChildPoundLogService.saveDriverOrderChildLog(childNo, OrderChildPoundAuditEnum.Status.AUDIT.getCode(),
OrderChildPoundAuditEnum.Status.AUDIT.getMsg(), OrderChildLogEnum.CreateType.DRIVER.getCode(), OrderChildPoundAuditEnum.Status.AUDIT.getMsg(), OrderChildLogEnum.CreateType.DRIVER.getCode(),
loginUserInfo.getUserNo(), loginUserInfo.getUserName()); loginUserInfo.getUserNo(), loginUserInfo.getUserName());
//判断是否平衡冻结金额
if(Objects.nonNull(paymentDTO.getChangeDeposit()) &&
paymentDTO.getChangeDeposit().compareTo(BigDecimal.ZERO) !=0){
paymentChangePlatformFee(childNo,paymentDTO.getChangeDeposit());
}
} }
@Override @Override
...@@ -1449,7 +1610,20 @@ public class OrderChildServiceImpl implements OrderChildService { ...@@ -1449,7 +1610,20 @@ public class OrderChildServiceImpl implements OrderChildService {
result.setPrepayFreight(settlementOwnerDetail.getPrepayFreight()); result.setPrepayFreight(settlementOwnerDetail.getPrepayFreight());
result.setSettlementFreight(settlementOwnerDetail.getSettlementFreight()); result.setSettlementFreight(settlementOwnerDetail.getSettlementFreight());
} }
//获取订单配置的违约金方案
OwnerQuotationDetailVO quotationDetailVO = quotationService.getQuotationByOrderNo(orderChild.getOrderNo())
.orElseThrow(PerformanceResultEnum.DATA_NOT_FIND);
if(Objects.isNull(quotationDetailVO.getLiquidatedDamagesPlanId())){
throw new ServiceSystemException(PerformanceResultEnum.DATA_NOT_FIND);
}
//货源详情页面 是否显示弹窗和显示平台服务费率
/** 订单结算方式为“卸车净重(减货损)”且平台运费报价为“未税”时 显示平台服务费率和弹窗提示司机平台服务费率**/
if (Objects.equals(orderGoods.getSettlementWay(),
SettlementWayEnum.WayType.UNLOAD_LOSS.getCode())
&& Objects.equals(quotationDetailVO.getPlatformFreightQuotationTaxType(),
InvoicingCompanyEnum.TaxType.TAX_EXCLUDED.getCode())) {
result.setGoodsOrderDetailShow(0);
}
//查询进行中的运单车辆是否开启了中交兴路 //查询进行中的运单车辆是否开启了中交兴路
result.setNotOpenZJXLMsg(isOpenZJXL(orderChild.getStatus(),orderChild.getTruckNo())); result.setNotOpenZJXLMsg(isOpenZJXL(orderChild.getStatus(),orderChild.getTruckNo()));
return result; return result;
...@@ -1807,7 +1981,7 @@ public class OrderChildServiceImpl implements OrderChildService { ...@@ -1807,7 +1981,7 @@ public class OrderChildServiceImpl implements OrderChildService {
/** /**
* 司机接单支付校验 * 司机接单支付校验
*/ */
private void driverTakeOrderPaymentLimit(Integer driverWallCode, Integer truckWalletCode) { private void driverTakeOrderPaymentLimit(Integer driverWallCode, Integer truckWalletCode,BigDecimal deposit) {
//判断是司机还是车主 接单校验 必须两个都有钱包 //判断是司机还是车主 接单校验 必须两个都有钱包
if (Objects.isNull(driverWallCode) || Objects.isNull(truckWalletCode)) { if (Objects.isNull(driverWallCode) || Objects.isNull(truckWalletCode)) {
throw new ServiceSystemException(PerformanceResultEnum.WALLET_CODE_IS_NULL); throw new ServiceSystemException(PerformanceResultEnum.WALLET_CODE_IS_NULL);
...@@ -1823,6 +1997,15 @@ public class OrderChildServiceImpl implements OrderChildService { ...@@ -1823,6 +1997,15 @@ public class OrderChildServiceImpl implements OrderChildService {
String remark = truckOwnerFlag ? "钱包余额不足" : "车主钱包余额不足"; String remark = truckOwnerFlag ? "钱包余额不足" : "车主钱包余额不足";
throw new ServiceSystemException(PerformanceResultEnum.APP_POP_UP_ERROR, remark); throw new ServiceSystemException(PerformanceResultEnum.APP_POP_UP_ERROR, remark);
} }
//判断余额是否能够缴纳保证金
if (data.getResidue() < deposit.longValue()) {
String remark = truckOwnerFlag ? "账户可用余额不足,接单保证金冻结失败,请尽快充值,本次需重置"+deposit.movePointLeft(2) +"元" : "车主钱包余额不足,保证金冻结失败请联系车主充值";
if(truckOwnerFlag){
throw new ServiceSystemException(PerformanceResultEnum.APP_POP_UP_OWNER_RESIDUE_ERROR, remark);
}else{
throw new ServiceSystemException(PerformanceResultEnum.APP_POP_UP_DRIVER_RESIDUE_ERROR, remark);
}
}
//有效银行卡数量 不能为空 //有效银行卡数量 不能为空
if (Objects.isNull(data.getCardCount()) || data.getCardCount() <= 0) { if (Objects.isNull(data.getCardCount()) || data.getCardCount() <= 0) {
......
...@@ -5,12 +5,14 @@ import cn.hutool.json.JSONUtil; ...@@ -5,12 +5,14 @@ import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.clx.order.enums.InvoicingCompanyEnum;
import com.clx.order.enums.UpdateEnum; import com.clx.order.enums.UpdateEnum;
import com.clx.order.enums.VehicleUsageEnum; import com.clx.order.enums.VehicleUsageEnum;
import com.clx.order.feign.OrderFeign; import com.clx.order.feign.OrderFeign;
import com.clx.order.param.feign.OrderCancelReasonParam; import com.clx.order.param.feign.OrderCancelReasonParam;
import com.clx.order.param.feign.RollbackOrderWeightParam; import com.clx.order.param.feign.RollbackOrderWeightParam;
import com.clx.order.vo.feign.FeignOrderVO; import com.clx.order.vo.feign.FeignOrderVO;
import com.clx.order.vo.pc.owner.OwnerQuotationDetailVO;
import com.clx.performance.component.GoodsOrderTruckRecordComponent; import com.clx.performance.component.GoodsOrderTruckRecordComponent;
import com.clx.performance.component.OrderCancelComponent; import com.clx.performance.component.OrderCancelComponent;
import com.clx.performance.component.OrderGoodsStatusLazyComponent; import com.clx.performance.component.OrderGoodsStatusLazyComponent;
...@@ -21,6 +23,8 @@ import com.clx.performance.dao.OrderGoodsDriverTruckDao; ...@@ -21,6 +23,8 @@ import com.clx.performance.dao.OrderGoodsDriverTruckDao;
import com.clx.performance.dao.OrderGoodsTruckBindDao; import com.clx.performance.dao.OrderGoodsTruckBindDao;
import com.clx.performance.dto.OrderGoodsCancelDTO; import com.clx.performance.dto.OrderGoodsCancelDTO;
import com.clx.performance.enums.*; import com.clx.performance.enums.*;
import com.clx.performance.enums.settle.SettlementWayEnum;
import com.clx.performance.extranal.order.QuotationService;
import com.clx.performance.extranal.user.DriverService; import com.clx.performance.extranal.user.DriverService;
import com.clx.performance.model.OrderChild; import com.clx.performance.model.OrderChild;
import com.clx.performance.model.OrderGoods; import com.clx.performance.model.OrderGoods;
...@@ -43,6 +47,7 @@ import com.clx.performance.vo.pc.OrderGoodsEditVO; ...@@ -43,6 +47,7 @@ import com.clx.performance.vo.pc.OrderGoodsEditVO;
import com.clx.performance.vo.pc.OrderGoodsVO; import com.clx.performance.vo.pc.OrderGoodsVO;
import com.clx.user.enums.driver.DriverInfoEnum; import com.clx.user.enums.driver.DriverInfoEnum;
import com.clx.user.feign.UserClxFeign; import com.clx.user.feign.UserClxFeign;
import com.github.mustachejava.ObjectHandler;
import com.msl.common.base.Optional; import com.msl.common.base.Optional;
import com.msl.common.enums.ResultCodeEnum; import com.msl.common.enums.ResultCodeEnum;
import com.msl.common.exception.ServiceSystemException; import com.msl.common.exception.ServiceSystemException;
...@@ -115,6 +120,8 @@ public class OrderGoodsServiceImpl implements OrderGoodsService, InitializingBea ...@@ -115,6 +120,8 @@ public class OrderGoodsServiceImpl implements OrderGoodsService, InitializingBea
private OrderChildPostService orderChildPostService; private OrderChildPostService orderChildPostService;
@Autowired @Autowired
private RabbitTemplate rabbitTemplate; private RabbitTemplate rabbitTemplate;
@Autowired
private QuotationService quotationService;
private static Map<Integer, Consumer<OrderGoodsCancelDTO>> orderGoodsCancelMap = new HashMap<>(); private static Map<Integer, Consumer<OrderGoodsCancelDTO>> orderGoodsCancelMap = new HashMap<>();
...@@ -142,6 +149,21 @@ public class OrderGoodsServiceImpl implements OrderGoodsService, InitializingBea ...@@ -142,6 +149,21 @@ public class OrderGoodsServiceImpl implements OrderGoodsService, InitializingBea
orderGoodsVO.setLoadBeginTime(orderInfoFeign.getLoadBeginTime()); orderGoodsVO.setLoadBeginTime(orderInfoFeign.getLoadBeginTime());
orderGoodsVO.setLoadEndTime(orderInfoFeign.getLoadEndTime()); orderGoodsVO.setLoadEndTime(orderInfoFeign.getLoadEndTime());
orderGoodsVO.setResidueTransportWeight(BigDecimal.ZERO.compareTo(orderGoodsVO.getResidueTransportWeight()) > 0 ? BigDecimal.ZERO : orderGoodsVO.getResidueTransportWeight()); orderGoodsVO.setResidueTransportWeight(BigDecimal.ZERO.compareTo(orderGoodsVO.getResidueTransportWeight()) > 0 ? BigDecimal.ZERO : orderGoodsVO.getResidueTransportWeight());
//获取订单配置的违约金方案
OwnerQuotationDetailVO quotationDetailVO = quotationService.getQuotationByOrderNo(orderNo).orElseThrow(PerformanceResultEnum.DATA_NOT_FIND);
if(Objects.isNull(quotationDetailVO.getLiquidatedDamagesPlanId())){
throw new ServiceSystemException(PerformanceResultEnum.DATA_NOT_FIND);
}
//货源详情页面 是否显示弹窗和显示平台服务费率
/** 订单结算方式为“卸车净重(减货损)”且平台运费报价为“未税”时 显示平台服务费率和弹窗提示司机平台服务费率**/
if (Objects.equals(orderGoodsVO.getSettlementWay(),
SettlementWayEnum.WayType.UNLOAD_LOSS.getCode())
&& Objects.equals(quotationDetailVO.getPlatformFreightQuotationTaxType(),
InvoicingCompanyEnum.TaxType.TAX_EXCLUDED.getCode())) {
orderGoodsVO.setGoodsOrderDetailShow(0);
}
return orderGoodsVO; return orderGoodsVO;
} }
......
...@@ -2,6 +2,7 @@ package com.clx.performance.service.impl; ...@@ -2,6 +2,7 @@ package com.clx.performance.service.impl;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.TypeReference; import com.alibaba.fastjson.TypeReference;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.clx.performance.config.MslPaymentConfig; import com.clx.performance.config.MslPaymentConfig;
import com.clx.performance.constant.ActionConstants; import com.clx.performance.constant.ActionConstants;
import com.clx.performance.dao.ThirdPartRequestLogDao; import com.clx.performance.dao.ThirdPartRequestLogDao;
...@@ -13,6 +14,7 @@ import com.clx.performance.enums.*; ...@@ -13,6 +14,7 @@ import com.clx.performance.enums.*;
import com.clx.performance.enums.payment.PayOperationStatusEnum; import com.clx.performance.enums.payment.PayOperationStatusEnum;
import com.clx.performance.enums.payment.PaymentActionEnum; import com.clx.performance.enums.payment.PaymentActionEnum;
import com.clx.performance.enums.payment.PaymentStatusEnum; import com.clx.performance.enums.payment.PaymentStatusEnum;
import com.clx.performance.model.OrderGoodsTruckBind;
import com.clx.performance.model.ThirdPartRequestLog; import com.clx.performance.model.ThirdPartRequestLog;
import com.clx.performance.model.payment.OrderPayment; import com.clx.performance.model.payment.OrderPayment;
import com.clx.performance.param.pc.payment.*; import com.clx.performance.param.pc.payment.*;
...@@ -26,8 +28,10 @@ import com.msl.common.result.Result; ...@@ -26,8 +28,10 @@ import com.msl.common.result.Result;
import com.msl.common.utils.EncryptUtil; import com.msl.common.utils.EncryptUtil;
import com.msl.common.utils.HttpUtil; import com.msl.common.utils.HttpUtil;
import com.msl.common.utils.LocalDateTimeUtils; import com.msl.common.utils.LocalDateTimeUtils;
import io.swagger.models.auth.In;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Propagation;
...@@ -40,6 +44,7 @@ import java.time.LocalDateTime; ...@@ -40,6 +44,7 @@ import java.time.LocalDateTime;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.UUID; import java.util.UUID;
import java.util.stream.Collectors;
import static com.clx.performance.enums.HttpEnum.PERFORMANCE_PAY_CLX_PAYMENT; import static com.clx.performance.enums.HttpEnum.PERFORMANCE_PAY_CLX_PAYMENT;
...@@ -255,14 +260,25 @@ public class PaymentServiceImpl implements PaymentService { ...@@ -255,14 +260,25 @@ public class PaymentServiceImpl implements PaymentService {
@Override @Override
public Result paymentCompletePlatformFee(PayPlatformFeeParam param) { public Result paymentCompletePlatformFee(PayPlatformFeeParam param) {
//查询冻结记录 List<OrderPayment> orderPaymentList = checkOrderPaymentExit(param);
OrderPayment orderPaymentOptional = //如果没有冻结记录
orderPaymentDao.selectByOrderNoAndItemIdAndOperation(param.getTradeNo(), List<OrderPayment> orderPaymentFreezeList = orderPaymentList.stream()
PayUnitTypeEnum.FREEZE_PLATFORM_FEE.getCode() + "", .filter(i -> i.getOperation().equals(PayOperationStatusEnum.FREEZE.getValue()))
PayOperationStatusEnum.FREEZE.getValue()).orNull(); .filter(i -> i.getStatus().equals(PaymentStatusEnum.SUCCESS.getValue()))
if (null == orderPaymentOptional){ .collect(Collectors.toList());
if (CollectionUtils.isEmpty(orderPaymentFreezeList)){
throw new ServiceSystemException(PerformanceResultEnum.DATA_NOT_FIND,"数据不存在") ; throw new ServiceSystemException(PerformanceResultEnum.DATA_NOT_FIND,"数据不存在") ;
} }
//冻结记录是否已经处理
List<OrderPayment> orderPaymentUnFreezeList = orderPaymentList.stream()
.filter(i -> i.getOperation().equals(PayOperationStatusEnum.UNFREEZE.getValue()))
.filter(i -> i.getStatus().equals(PaymentStatusEnum.SUCCESS.getValue()))
.collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(orderPaymentUnFreezeList)){
throw new ServiceSystemException(PerformanceResultEnum.DATA_NOT_FIND,"冻结记录已处理") ;
}
OrderPayment orderPaymentOptional = orderPaymentFreezeList.get(0);
/** 创建记录 新的调整记录 **/ /** 创建记录 新的调整记录 **/
OrderPayment orderPayment = new OrderPayment() OrderPayment orderPayment = new OrderPayment()
.setAmount(param.getFigure()) .setAmount(param.getFigure())
...@@ -291,16 +307,37 @@ public class PaymentServiceImpl implements PaymentService { ...@@ -291,16 +307,37 @@ public class PaymentServiceImpl implements PaymentService {
return notify; return notify;
} }
public List<OrderPayment> checkOrderPaymentExit(PayPlatformFeeParam param){
//查询冻结记录
List<OrderPayment> orderPaymentList= orderPaymentDao.listByOrderNo(param.getTradeNo(),
PayUnitTypeEnum.FREEZE_PLATFORM_FEE.getCode() + "");
if (CollectionUtils.isEmpty(orderPaymentList)){
throw new ServiceSystemException(PerformanceResultEnum.DATA_NOT_FIND,"数据不存在") ;
}
return orderPaymentList;
}
@Override @Override
public Result paymentCancelPlatformFee(PayPlatformFeeParam param) { public Result paymentCancelPlatformFee(PayPlatformFeeParam param) {
//查询冻结记录 List<OrderPayment> orderPaymentList = checkOrderPaymentExit(param);
OrderPayment orderPaymentOptional = //如果没有冻结记录
orderPaymentDao.selectByOrderNoAndItemIdAndOperation(param.getTradeNo(), List<OrderPayment> orderPaymentFreezeList = orderPaymentList.stream()
PayUnitTypeEnum.FREEZE_PLATFORM_FEE.getCode() + "", .filter(i -> i.getOperation().equals(PayOperationStatusEnum.FREEZE.getValue()))
PayOperationStatusEnum.FREEZE.getValue()).orNull(); .filter(i -> i.getStatus().equals(PaymentStatusEnum.SUCCESS.getValue()))
if (null == orderPaymentOptional){ .collect(Collectors.toList());
if (CollectionUtils.isEmpty(orderPaymentFreezeList)){
throw new ServiceSystemException(PerformanceResultEnum.DATA_NOT_FIND,"数据不存在") ; throw new ServiceSystemException(PerformanceResultEnum.DATA_NOT_FIND,"数据不存在") ;
} }
//冻结记录是否已经处理
List<OrderPayment> orderPaymentUnFreezeList = orderPaymentList.stream()
.filter(i -> i.getOperation().equals(PayOperationStatusEnum.UNFREEZE.getValue()))
.filter(i -> i.getStatus().equals(PaymentStatusEnum.SUCCESS.getValue()))
.collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(orderPaymentUnFreezeList)){
throw new ServiceSystemException(PerformanceResultEnum.DATA_NOT_FIND,"冻结记录已处理") ;
}
OrderPayment orderPaymentOptional = orderPaymentFreezeList.get(0);
/** 创建记录 新的调整记录 **/ /** 创建记录 新的调整记录 **/
OrderPayment orderPayment = new OrderPayment() OrderPayment orderPayment = new OrderPayment()
.setAmount(param.getFigure()) .setAmount(param.getFigure())
...@@ -367,6 +404,8 @@ public class PaymentServiceImpl implements PaymentService { ...@@ -367,6 +404,8 @@ public class PaymentServiceImpl implements PaymentService {
} }
/** /**
* post请求 * post请求
*/ */
...@@ -537,4 +576,25 @@ public class PaymentServiceImpl implements PaymentService { ...@@ -537,4 +576,25 @@ public class PaymentServiceImpl implements PaymentService {
return freezeBatchDTO; return freezeBatchDTO;
} }
/***
* 获取用户的钱包
* @param userCode
* @return
*/
@Override
public WalletResidueDTO getWalletAndCard(Integer userCode) {
WalletParam walletParam = new WalletParam();
walletParam.setUserCode(userCode);
Result<Object> notify = (Result<Object>) postRequest(mslPaymentConfig.getHost()
+ HttpEnum.PERFORMANCE_PAY_CLX_WALLET.getUrl(), JSON.toJSONString(walletParam));
log.info("获取司机钱包 {} 返回日志 {}",userCode, notify);
if (notify == null) {
throw new ServiceSystemException(PerformanceResultEnum.HTTP_ERROR);
}
if (notify.getCode() != 0) {
throw new ServiceSystemException(PerformanceResultEnum.HTTP_ERROR, notify.getMsg());
}
return JSON.parseObject(notify.getData().toString(), WalletResidueDTO.class);
}
} }
package com.clx.performance.service.impl.settle; package com.clx.performance.service.impl.settle;
import com.clx.performance.dao.OrderChildDao;
import com.clx.performance.dao.settle.NetworkCaseOutRecordDao; import com.clx.performance.dao.settle.NetworkCaseOutRecordDao;
import com.clx.performance.dao.settle.OrderChildSyncTransportRecordDao; import com.clx.performance.dao.settle.OrderChildSyncTransportRecordDao;
import com.clx.performance.dto.PayStatusNotifyDTO; import com.clx.performance.dto.PayStatusNotifyDTO;
import com.clx.performance.enums.NetworkDriverAccountEnum; import com.clx.performance.enums.NetworkDriverAccountEnum;
import com.clx.performance.enums.PerformanceResultEnum;
import com.clx.performance.model.OrderChild;
import com.clx.performance.model.settle.OrderChildSyncTransportRecord; import com.clx.performance.model.settle.OrderChildSyncTransportRecord;
import com.clx.performance.model.settle.SettlementDriverDetail; import com.clx.performance.model.settle.SettlementDriverDetail;
import com.clx.performance.param.pc.payment.PayPlatformFeeParam;
import com.clx.performance.service.PaymentService;
import com.clx.performance.service.settle.NetworkDriverRunningWaterRecordService; import com.clx.performance.service.settle.NetworkDriverRunningWaterRecordService;
import com.clx.performance.service.settle.OrderChildSyncTransportRecordService; import com.clx.performance.service.settle.OrderChildSyncTransportRecordService;
import com.clx.performance.service.settle.SettlementDriverDetailService; import com.clx.performance.service.settle.SettlementDriverDetailService;
import com.clx.performance.service.settle.SettlementDriverService; import com.clx.performance.service.settle.SettlementDriverService;
import com.clx.performance.struct.settle.SettlementDriverDetailStruct; import com.clx.performance.struct.settle.SettlementDriverDetailStruct;
import com.msl.common.result.Result;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Objects;
/** /**
* @author kavin * @author kavin
...@@ -36,6 +46,9 @@ public class OrderChildSyncTransportRecordServiceImpl implements OrderChildSyncT ...@@ -36,6 +46,9 @@ public class OrderChildSyncTransportRecordServiceImpl implements OrderChildSyncT
private final SettlementDriverDetailService settlementDriverDetailService; private final SettlementDriverDetailService settlementDriverDetailService;
private final OrderChildDao orderChildDao;
private final PaymentService paymentService;
@Override @Override
public void addOrderChildSyncTransportRecord(SettlementDriverDetail detail) { public void addOrderChildSyncTransportRecord(SettlementDriverDetail detail) {
OrderChildSyncTransportRecord record = struct.convertRecord(detail); OrderChildSyncTransportRecord record = struct.convertRecord(detail);
...@@ -44,6 +57,7 @@ public class OrderChildSyncTransportRecordServiceImpl implements OrderChildSyncT ...@@ -44,6 +57,7 @@ public class OrderChildSyncTransportRecordServiceImpl implements OrderChildSyncT
orderChildSyncTransportRecordDao.saveEntity(record); orderChildSyncTransportRecordDao.saveEntity(record);
} }
@Transactional(rollbackFor = Exception.class)
@Override @Override
public void updateStatus(PayStatusNotifyDTO payStatusNotifyDTO) { public void updateStatus(PayStatusNotifyDTO payStatusNotifyDTO) {
String childNo = payStatusNotifyDTO.getChildNo(); String childNo = payStatusNotifyDTO.getChildNo();
...@@ -54,5 +68,21 @@ public class OrderChildSyncTransportRecordServiceImpl implements OrderChildSyncT ...@@ -54,5 +68,21 @@ public class OrderChildSyncTransportRecordServiceImpl implements OrderChildSyncT
); );
SettlementDriverDetail driverDetail = settlementDriverDetailService.selectOneByChildNo(childNo); SettlementDriverDetail driverDetail = settlementDriverDetailService.selectOneByChildNo(childNo);
networkDriverRunningWaterRecordService.generateCaseOutSuccessRunningWaterRecord(driverDetail); networkDriverRunningWaterRecordService.generateCaseOutSuccessRunningWaterRecord(driverDetail);
try{
//支付平台服务费
OrderChild orderChild = orderChildDao.getByChildNo(childNo).orElseThrow(PerformanceResultEnum.ORDER_CHILD_NO_FOUND);
if (Objects.nonNull(orderChild.getPlatformServiceFee()) &&
!Objects.equals(orderChild.getPlatformServiceFee().intValue(), 0)) {
PayPlatformFeeParam payPlatformFeeParam = PayPlatformFeeParam.builder()
.figure(orderChild.getPlatformServiceFee().intValue())
.tradeNo(childNo)
.build();
Result result = paymentService.paymentCompletePlatformFee(payPlatformFeeParam);
log.info("运单完成 第三方回调 {} ,{} " ,childNo,result);
}
}catch (Exception e){
log.error("支付平台服务费异常 {}",e);
}
} }
} }
...@@ -19,6 +19,7 @@ import com.clx.performance.model.OrderChild; ...@@ -19,6 +19,7 @@ import com.clx.performance.model.OrderChild;
import com.clx.performance.model.OrderGoods; import com.clx.performance.model.OrderGoods;
import com.clx.performance.model.settle.*; import com.clx.performance.model.settle.*;
import com.clx.performance.param.pc.payment.PayParam; import com.clx.performance.param.pc.payment.PayParam;
import com.clx.performance.param.pc.payment.PayPlatformFeeParam;
import com.clx.performance.service.OrderChildLogService; import com.clx.performance.service.OrderChildLogService;
import com.clx.performance.service.PaymentService; import com.clx.performance.service.PaymentService;
import com.clx.performance.service.impl.UniqueOrderNumService; import com.clx.performance.service.impl.UniqueOrderNumService;
...@@ -316,7 +317,7 @@ public class SettlementMqHandlerServiceImpl implements SettlementMqHandlerServic ...@@ -316,7 +317,7 @@ public class SettlementMqHandlerServiceImpl implements SettlementMqHandlerServic
.remark(PayRemarkEnum.toString(PayRemarkEnum.FREIGHT_TO_OWNER.getValue())) .remark(PayRemarkEnum.toString(PayRemarkEnum.FREIGHT_TO_OWNER.getValue()))
.build(); .build();
} }
//支付司机运费
Result result = null; Result result = null;
String msg = null; String msg = null;
try{ try{
...@@ -325,6 +326,20 @@ public class SettlementMqHandlerServiceImpl implements SettlementMqHandlerServic ...@@ -325,6 +326,20 @@ public class SettlementMqHandlerServiceImpl implements SettlementMqHandlerServic
settlementDriverNotify(detail.getChildNo(),0,e.getMessage()); settlementDriverNotify(detail.getChildNo(),0,e.getMessage());
msg = e.getMessage(); msg = e.getMessage();
} }
//支付平台服务费
try{
OrderChild orderChild = orderChildDao.getByChildNo(detail.getChildNo()).orElseThrow(PerformanceResultEnum.ORDER_CHILD_NO_FOUND);
if (Objects.nonNull(orderChild.getPlatformServiceFee()) &&
!Objects.equals(orderChild.getPlatformServiceFee().intValue(), 0)) {
PayPlatformFeeParam payPlatformFeeParam = PayPlatformFeeParam.builder()
.figure(orderChild.getPlatformServiceFee().intValue())
.tradeNo(detail.getChildNo())
.build();
result = paymentService.paymentCompletePlatformFee(payPlatformFeeParam);
}
}catch (Exception e){
log.error("支付平台服务费异常 {}",e);
}
if(Objects.nonNull(result)){ if(Objects.nonNull(result)){
settlementDriverNotify(detail.getChildNo(),0,result.getMsg()); settlementDriverNotify(detail.getChildNo(),0,result.getMsg());
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论