提交 65f0ecf5 authored 作者: 李瑞鑫's avatar 李瑞鑫

Merge branch 'v26.5_optimize_20240919'

package com.clx.performance.enums.settle;
import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.Arrays;
import java.util.Objects;
import java.util.Optional;
public enum SettlementDriverDetailEnum {
;
@Getter
@AllArgsConstructor
public enum PayAcceptStatus {
INIT(0, "未受理支付"),
ACCEPTING(1, "支付受理中"),
ACCEPTED(2,"已受理支付"),
;
private final Integer code;
private final String msg;
public static Optional<PayAcceptStatus> getByCode(int code) {
return Arrays.stream(values()).filter(e -> Objects.equals(e.getCode(), code)).findFirst();
}
public static String getMsgByCode(int code) {
return getByCode(code).map(PayAcceptStatus::getMsg).orElse(null);
}
}
}
......@@ -31,6 +31,7 @@ public enum SettlementDriverEnum {
@Getter
@AllArgsConstructor
public enum Status {
DRIVER_UNCONFIRMED(0, "待司机确认交货"),
WAIT_SETTLEMENT(1, "待结算"),
SETTLED(2, "已结算"),
;
......
package com.clx.performance.vo.mq.broker;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
@Setter
@Getter
@ToString
@NoArgsConstructor
public class BrokerOrderChildDriverPayMqParam {
private String childNo; //运单编号
}
package com.clx.performance.vo.mq.settle;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
@Setter
@Getter
@ToString
@NoArgsConstructor
public class SettlementDriverConfirmMqParam {
private String childNo;
}
package com.clx.performance.vo.mq.settle;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
/**
* @Author: aiqingguo
* @Description: 支付受理
* @Date: 2023-10-19 15:45:25
* @Version: 1.0
*/
@Setter
@Getter
@ToString
@NoArgsConstructor
public class SettlementDriverPayAcceptSyncMqParam {
private String childNo; //运单编号
}
package com.clx.performance.vo.pc.broker;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import javax.validation.constraints.NotNull;
@Getter
@Setter
@ToString
@NoArgsConstructor
public class TransportPayConfirmParam {
@ApiModelProperty(value = "用户编号", required = true)
@NotNull(message = "用户编号不能为空")
private String userCode;
@ApiModelProperty(value = "运单编号", required = true)
@NotNull(message = "运单编号不能为空")
String orderCode;
}
......@@ -37,5 +37,7 @@ public class TransportVO {
@ApiModelProperty(value = "开票状态 0 未开票 1 已开票 ", example = "1234124", dataType = "String")
private Integer invoiceStatus;
@ApiModelProperty(value = "第三方运单状态 20-已卸货,30-已创建支付单", example = "1234124", dataType = "String")
private Integer thirdPartyChildStatus;
}
package com.clx.performance.vo.pc.carrier.settle;
import com.clx.performance.enums.settle.SettlementDriverEnum;
import com.msl.common.convertor.type.MoneyOutConvert;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
......@@ -81,6 +82,11 @@ public class CarrierPageSettlementDriverVO {
private BigDecimal settlementFreight;
@ApiModelProperty(value = "状态")
private Integer status;
private String statusMsg;
public String getStatusMsg() {
return SettlementDriverEnum.Status.getMsgByCode(status);
}
@ApiModelProperty(value = "创建时间")
private String createTime;
@ApiModelProperty(value = "结算平台 1:马上来 2:网运平台")
......
......@@ -77,4 +77,17 @@ public class RabbitBrokerConfig {
.with(RabbitKeyBrokerConstants.ORDER_CHILD_UPDATE_ROUTING_KEY);
}
/**
* 运单司机确认收货
*/
@Bean
public Queue brokerOrderChildDriverConfirmQueue() {
return new Queue(RabbitKeyBrokerConstants.ORDER_CHILD_DRIVER_PAY_QUEUE);
}
@Bean
public Binding brokerOrderChildDriverConfirmQueueBinding() {
return BindingBuilder.bind(brokerOrderChildDriverConfirmQueue()).to(brokerDefaultExchange())
.with(RabbitKeyBrokerConstants.ORDER_CHILD_DRIVER_PAY_ROUTING_KEY);
}
}
......@@ -86,6 +86,19 @@ public class RabbitSettlementConfig {
.with(RabbitKeySettlementConstants.SETTLEMENT_INVOICE_TYPE_SYNC_ROUTING_KEY);
}
/**
* 开票方式同步
*/
@Bean
public Queue settlementDriverPayAcceptSyncQueue() {
return new Queue(RabbitKeySettlementConstants.SETTLEMENT_DRIVER_PAY_ACCEPT_SYNC_QUEUE);
}
@Bean
public Binding settlementDriverPayAcceptSyncQueueBinding() {
return BindingBuilder.bind(settlementDriverPayAcceptSyncQueue()).to(settlementDefaultExchange())
.with(RabbitKeySettlementConstants.SETTLEMENT_DRIVER_PAY_ACCEPT_SYNC_ROUTING_KEY);
}
/**
* 货主结算
*/
......@@ -201,4 +214,17 @@ public class RabbitSettlementConfig {
.with(RabbitKeySettlementConstants.SETTLEMENT_INVOICE_STATUS_UPDATE_ROUTING_KEY);
}
/**
* 司机确认收货
*/
@Bean
public Queue settlementDriverConfirmQueue() {
return new Queue(RabbitKeySettlementConstants.SETTLEMENT_DRIVER_CONFIRM_QUEUE);
}
@Bean
public Binding settlementDriverConfirmQueueBinding() {
return BindingBuilder.bind(settlementDriverConfirmQueue()).to(settlementDefaultExchange())
.with(RabbitKeySettlementConstants.SETTLEMENT_DRIVER_CONFIRM_ROUTING_KEY);
}
}
......@@ -45,4 +45,10 @@ public class RabbitKeyBrokerConstants {
public static final String ORDER_CHILD_UPDATE_QUEUE = PREFIX +"orderChild.update"+QUEUE;
public static final String ORDER_CHILD_UPDATE_ROUTING_KEY = PREFIX +"orderChild.update"+QUEUE_ROUTING_KEY;
/**
* 司机支付
*/
public static final String ORDER_CHILD_DRIVER_PAY_QUEUE = PREFIX +"orderChildDriver.pay"+QUEUE;
public static final String ORDER_CHILD_DRIVER_PAY_ROUTING_KEY = PREFIX +"orderChildDriver.pay"+QUEUE_ROUTING_KEY;
}
......@@ -51,6 +51,12 @@ public class RabbitKeySettlementConstants {
public static final String SETTLEMENT_INVOICE_TYPE_SYNC_QUEUE = PREFIX +"settlementInvoiceType.sync"+QUEUE;
public static final String SETTLEMENT_INVOICE_TYPE_SYNC_ROUTING_KEY = PREFIX +"settlementInvoiceType.sync"+QUEUE_ROUTING_KEY;
/**
* 同步支付受理
*/
public static final String SETTLEMENT_DRIVER_PAY_ACCEPT_SYNC_QUEUE = PREFIX +"settlementDriverPayAccept.sync"+QUEUE;
public static final String SETTLEMENT_DRIVER_PAY_ACCEPT_SYNC_ROUTING_KEY = PREFIX +"settlementDriverPayAccept.sync"+QUEUE_ROUTING_KEY;
/**
* 货主结算
*/
......@@ -105,4 +111,10 @@ public class RabbitKeySettlementConstants {
public static final String SETTLEMENT_INVOICE_STATUS_UPDATE_QUEUE = PREFIX +"settlementInvoice.update"+QUEUE;
public static final String SETTLEMENT_INVOICE_STATUS_UPDATE_ROUTING_KEY = PREFIX +"settlementInvoice.update"+QUEUE_ROUTING_KEY;
/**
* 司机确认收货
*/
public static final String SETTLEMENT_DRIVER_CONFIRM_QUEUE = PREFIX +"settlementDriver.confirm"+QUEUE;
public static final String SETTLEMENT_DRIVER_CONFIRM_ROUTING_KEY = PREFIX +"settlementDriver.confirm"+QUEUE_ROUTING_KEY;
}
......@@ -212,6 +212,9 @@ public interface OrderChildDao extends BaseDao<OrderChildMapper, OrderChild, Int
void batchUpdateCancel(List<OrderChild> canCancelOrderChildList);
List<OrderChild> findListByChildNoList(List<String> childNoList);
int countTakeByOrderGoodsNo(String orderGoodsNo);
int countLoadByOrderGoodsNo(String orderGoodsNo);
}
......@@ -704,6 +704,15 @@ public class OrderChildDaoImpl extends BaseDaoImpl<OrderChildMapper, OrderChild,
baseMapper.batchUpdateCancel(canCancelOrderChildList);
}
@Override
public List<OrderChild> findListByChildNoList(List<String> childNoList) {
return list(lQrWrapper()
.in(OrderChild :: getChildNo, childNoList)
);
}
@Override
public int countTakeByOrderGoodsNo(String orderGoodsNo) {
return baseMapper.countTakeByOrderGoodsNo(orderGoodsNo);
......
......@@ -6,6 +6,8 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.clx.performance.dao.settle.SettlementDriverDao;
import com.clx.performance.enums.loan.OwnerLoanRecordEnum;
import com.clx.performance.enums.settle.SettlementDriverEnum;
import com.clx.performance.enums.settle.SettlementOwnerEnum;
import com.clx.performance.mapper.settle.SettlementDriverMapper;
import com.clx.performance.model.settle.SettlementDriver;
import com.clx.performance.param.pc.driver.PageCarrierSettlementDriverParam;
......@@ -47,6 +49,14 @@ public class SettlementDriverDaoImpl extends BaseDaoImpl<SettlementDriverMapper,
);
}
@Override
public boolean updateSettleStatus(SettlementDriver item) {
return update(lUdWrapper()
.eq(SettlementDriver::getId, item.getId())
.set(SettlementDriver::getStatus, item.getStatus())
);
}
@Override
public Optional<SettlementDriver> findBySettlementNo(String settlementNo) {
return Optional.of(lQrWrapper()
......@@ -63,6 +73,13 @@ public class SettlementDriverDaoImpl extends BaseDaoImpl<SettlementDriverMapper,
.map(super::getOne);
}
@Override
public List<SettlementDriver> listDriverConfirmSync() {
return list(lUdWrapper()
.eq(SettlementDriver::getStatus, SettlementDriverEnum.Status.DRIVER_UNCONFIRMED.getCode())
);
}
@Override
public IPage<SettlementDriver> pageCarrierSettlementDriver(PageCarrierSettlementDriverParam param) {
LambdaQueryWrapper<SettlementDriver> query = new LambdaQueryWrapper<>();
......
......@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.clx.performance.dao.settle.SettlementDriverDetailDao;
import com.clx.performance.enums.loan.OwnerLoanRecordEnum;
import com.clx.performance.enums.settle.SettlementDriverDetailEnum;
import com.clx.performance.enums.settle.SettlementDriverEnum;
import com.clx.performance.enums.settle.SettlementOwnerEnum;
import com.clx.performance.mapper.settle.SettlementDriverDetailMapper;
......@@ -85,6 +86,13 @@ public class SettlementDriverDetailDaoImpl extends BaseDaoImpl<SettlementDriverD
);
}
@Override
public boolean updatePayAcceptStatus(SettlementDriverDetail item) {
return update(lUdWrapper()
.eq(SettlementDriverDetail::getId, item.getId())
.set(SettlementDriverDetail::getPayAcceptStatus, item.getPayAcceptStatus())
);
}
@Override
......@@ -96,6 +104,23 @@ public class SettlementDriverDetailDaoImpl extends BaseDaoImpl<SettlementDriverD
.map(super::getOne);
}
@Override
public List<SettlementDriverDetail> listDriverPaySync(LocalDateTime time) {
return list(lUdWrapper()
.eq(SettlementDriverDetail::getInvoiceType, SettlementOwnerEnum.InvoiceType.ONLINE.getCode())
.eq(SettlementDriverDetail::getPayAcceptStatus, SettlementDriverDetailEnum.PayAcceptStatus.INIT.getCode())
.ge(SettlementDriverDetail::getCreateTime, time)
);
}
@Override
public List<SettlementDriverDetail> listDriverPayAcceptSync() {
return list(lUdWrapper()
.eq(SettlementDriverDetail::getInvoiceType, SettlementOwnerEnum.InvoiceType.ONLINE.getCode())
.eq(SettlementDriverDetail::getPayAcceptStatus, SettlementDriverDetailEnum.PayAcceptStatus.ACCEPTING.getCode())
);
}
@Override
public IPage<SettlementDriverDetail> pageSettlementDriverDetail(PageCarrierSettlementDriverDetailParam param) {
LambdaQueryWrapper<SettlementDriverDetail> query = new LambdaQueryWrapper<>();
......
......@@ -20,12 +20,16 @@ public interface SettlementDriverDao extends BaseDao<SettlementDriverMapper, Set
boolean updatePayStatus(SettlementDriver item);
boolean updateSettleStatus(SettlementDriver item);
boolean updateInvoiceCompany(SettlementDriver item);
Optional<SettlementDriver> findBySettlementNo(String settlementNo);
Optional<SettlementDriver> findByChildNo(String childNo);
List<SettlementDriver> listDriverConfirmSync();
IPage<SettlementDriver> pageCarrierSettlementDriver(PageCarrierSettlementDriverParam param);
......
......@@ -24,10 +24,15 @@ public interface SettlementDriverDetailDao extends BaseDao<SettlementDriverDetai
boolean updateInvoiceTypeAndPrepayFreightFlag(SettlementDriverDetail item);
boolean updateConvertOrdinary(SettlementDriverDetail item);
boolean updatePreFreight(SettlementDriverDetail item);
boolean updatePayAcceptStatus(SettlementDriverDetail item);
Optional<SettlementDriverDetail> getByChildNo(String childNo);
List<SettlementDriverDetail> listDriverPaySync(LocalDateTime time);
List<SettlementDriverDetail> listDriverPayAcceptSync();
IPage<SettlementDriverDetail> pageSettlementDriverDetail(PageCarrierSettlementDriverDetailParam param);
List<SettlementDriverDetail> listUnPay(LocalDateTime beginTime);
......
......@@ -7,6 +7,7 @@ public interface BrokerService {
void orderChildSync(TransportParam param);
void orderChildUpdate(TransportParam param);
void orderChildPay(String childNo);
TransportVO getOrderChildStatus(String childNo);
......
......@@ -6,6 +6,7 @@ import com.clx.performance.enums.ResultEnum;
import com.clx.performance.extranal.broker.BrokerService;
import com.clx.performance.feign.BrokerFeign;
import com.clx.performance.vo.pc.broker.TransportParam;
import com.clx.performance.vo.pc.broker.TransportPayConfirmParam;
import com.clx.performance.vo.pc.broker.TransportVO;
import com.msl.common.exception.ServiceSystemException;
import com.msl.common.result.Result;
......@@ -45,6 +46,21 @@ public class BrokerServiceImpl implements BrokerService {
log.info("运单更新网络货运, childNo:{}, result:{}", param.getOrderChild().getSourceChildNo(), JSON.toJSONString(result));
}
@Override
public void orderChildPay(String childNo) {
TransportPayConfirmParam param = new TransportPayConfirmParam();
param.setOrderCode(childNo);
param.setUserCode(settlementConfig.getBrokerUserCode());
Result<Object> result = brokerFeign.payConfirm(param);
if (result.getCode() != 0) {
log.info("司机支付, childNo:{}, msg:{}", childNo, result.getMsg());
}
log.info("司机支付, childNo:{}, result:{}", childNo, JSON.toJSONString(result));
}
@Override
public TransportVO getOrderChildStatus(String childNo) {
......
package com.clx.performance.feign;
import com.clx.performance.vo.pc.broker.TransportPayConfirmParam;
import com.clx.performance.vo.pc.broker.TransportParam;
import com.clx.performance.vo.pc.broker.TransportVO;
import com.msl.common.result.Result;
......@@ -32,4 +33,10 @@ public interface BrokerFeign {
@RequestParam @NotNull(message = "userCode不能为空") String userCode,
@RequestParam String settlementNo);
/**
* 司机支付
*/
@RequestMapping(value = "/broker-service/open/transport/payConfirm", method = RequestMethod.POST)
Result<Object> payConfirm(@RequestBody TransportPayConfirmParam param);
}
......@@ -2,13 +2,11 @@ package com.clx.performance.job.settlement;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.clx.performance.dao.OrderChildDao;
import com.clx.performance.dao.OrderChildSyncTransportInvoiceRecordDao;
import com.clx.performance.dao.settle.OrderChildSyncTransportRecordDao;
import com.clx.performance.dao.settle.SettlementOwnerDao;
import com.clx.performance.dao.settle.SettlementOwnerDetailDao;
import com.clx.performance.model.settle.OrderChildSyncTransportRecord;
import com.clx.performance.model.settle.SettlementOwner;
import com.clx.performance.model.settle.SettlementOwnerDetail;
import com.clx.performance.dao.settle.*;
import com.clx.performance.model.OrderChild;
import com.clx.performance.model.settle.*;
import com.clx.performance.service.broker.OrderChildBrokerMqService;
import com.clx.performance.service.settle.SettlementMqService;
import com.msl.common.job.JobLog;
......@@ -22,6 +20,7 @@ import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
import java.util.List;
import java.util.stream.Collectors;
@Slf4j
@Service
......@@ -35,9 +34,12 @@ public class SettlementJob {
private final SettlementMqService settlementMqService;
private final SettlementOwnerDetailDao settlementOwnerDetailDao;
private final SettlementDriverDetailDao settlementDriverDetailDao;
private final SettlementDriverDao settlementDriverDao;
private final SettlementOwnerDao settlementOwnerDao;
private final OrderChildSyncTransportRecordDao orderChildSyncTransportRecordDao;
private final OrderChildBrokerMqService orderChildBrokerMqService;
private final OrderChildDao orderChildDao;
/**
* 同步无车承运运单开票类型
......@@ -57,6 +59,45 @@ public class SettlementJob {
}
}
/**
* 司机确认收货同步
*/
@XxlJob("settlementDriverConfirmSync")
public void settlementDriverConfirmSync() {
List<SettlementDriver> recordList = settlementDriverDao
.listDriverConfirmSync();
log.info("待司机确认收货同步,size:{}", recordList.size());
if (recordList.isEmpty()) {return;}
List<OrderChild> childList = orderChildDao.findListByChildNoList(
recordList.stream().map(SettlementDriver::getChildNo).collect(Collectors.toList()));
childList = childList.stream().filter(item -> item.getConfirmTime() != null).collect(Collectors.toList());
log.info("待司机确认收货同步,size:{}", childList.size());
for (OrderChild item : childList) {
settlementMqService.settlementDriverConfirm(item.getChildNo());
}
}
/**
* 同步无车承运运单支付受理
*/
@XxlJob("settlementDriverPayAcceptSync")
public void settlementDriverPayAcceptSync() {
List<SettlementDriverDetail> recordList = settlementDriverDetailDao
.listDriverPayAcceptSync();
log.info("待同步无车承运运单支付受理,size:{}", recordList.size());
if (recordList.isEmpty()) {return;}
for (SettlementDriverDetail item : recordList) {
settlementMqService.driverPayAcceptSync(item.getChildNo());
}
}
/**
* 同步无车承运运单开票状态
*/
......@@ -188,4 +229,32 @@ public class SettlementJob {
}
}
/**
* 网络货运运单支付同步(测试)
*/
@XxlJob("settlementDriverPayTest")
public void settlementDriverPayTest() {
try {
List<String> childNoList=null;
String jobParam= XxlJobHelper.getJobParam();
log.info("网络货运运单支付同步, param:{}", jobParam);
if (StringUtils.isNotBlank(jobParam)) {
childNoList = JSON.parseArray(jobParam, String.class);
}
if (childNoList == null || childNoList.isEmpty()) {
return;
}
for (String childNo : childNoList) {
// 发送mq (运单司机支付)
orderChildBrokerMqService.orderChildDriverPay(childNo);
}
} catch (Exception e) {
log.warn("网络货运运单支付同步 失败,msg:{}", ExceptionUtils.getStackTrace(e));
JobLog.error("网络货运运单支付同步 失败", e);
}
}
}
package com.clx.performance.listener.broker;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.TypeReference;
import com.clx.performance.common.MqWrapper;
import com.clx.performance.constant.RabbitKeyBrokerConstants;
import com.clx.performance.service.broker.OrderChildBrokerMqHandlerService;
import com.clx.performance.vo.mq.broker.BrokerOrderChildDriverPayMqParam;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.exception.ExceptionUtils;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* @Author: 艾庆国
* @Description: 司机支付 mq
* @Date: 2023-10-20 11:45:08
* @Version: 1.0
*/
@Slf4j
@Component
public class BrokerOrderChildDriverPayListener {
@Autowired
private OrderChildBrokerMqHandlerService orderChildBrokerMqHandlerService;
@RabbitListener(queues = RabbitKeyBrokerConstants.ORDER_CHILD_DRIVER_PAY_QUEUE)
public void process(Message message) {
try{
log.info("无车承运-司机支付, message:{}", new String(message.getBody()));
process(JSON.parseObject(new String(message.getBody()), new TypeReference<MqWrapper<BrokerOrderChildDriverPayMqParam>>(){}).getData());
log.info("无车承运-司机支付 成功, message:{}", new String(message.getBody()));
}catch (Exception e){
log.info("无车承运-司机支付 失败,msg:{}", ExceptionUtils.getStackTrace(e));
}
}
private void process(BrokerOrderChildDriverPayMqParam mq){
orderChildBrokerMqHandlerService.orderChildDriverPay(mq);
}
}
package com.clx.performance.listener.settle;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.TypeReference;
import com.clx.performance.common.MqWrapper;
import com.clx.performance.constant.RabbitKeySettlementConstants;
import com.clx.performance.service.settle.SettlementMqHandlerService;
import com.clx.performance.vo.mq.settle.SettlementDriverConfirmMqParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* @Author: 艾庆国
* @Description: 司机确认收货 mq
* @Date: 2023-10-20 11:45:08
* @Version: 1.0
*/
@Slf4j
@Component
public class SettlementDriverConfirmListener {
@Autowired
private SettlementMqHandlerService settlementMqHandlerService;
@RabbitListener(queues = RabbitKeySettlementConstants.SETTLEMENT_DRIVER_CONFIRM_QUEUE)
public void process(Message message) {
try{
log.info("结算-司机确认收货, message:{}", new String(message.getBody()));
process(JSON.parseObject(new String(message.getBody()), new TypeReference<MqWrapper<SettlementDriverConfirmMqParam>>(){}).getData());
}catch (Exception e){
log.info("结算-司机确认收货 失败",e);
}
}
private void process(SettlementDriverConfirmMqParam mq){
settlementMqHandlerService.settlementDriverConfirm(mq);
}
}
package com.clx.performance.listener.settle;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.TypeReference;
import com.clx.performance.common.MqWrapper;
import com.clx.performance.constant.RabbitKeySettlementConstants;
import com.clx.performance.service.settle.SettlementMqHandlerService;
import com.clx.performance.vo.mq.settle.SettlementDriverPayAcceptSyncMqParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* @Author: 艾庆国
* @Description: 司机支付受理同步 mq
* @Date: 2023-10-20 11:45:08
* @Version: 1.0
*/
@Slf4j
@Component
public class SettlementDriverPayAcceptSyncListener {
@Autowired
private SettlementMqHandlerService settlementMqHandlerService;
@RabbitListener(queues = RabbitKeySettlementConstants.SETTLEMENT_DRIVER_PAY_ACCEPT_SYNC_QUEUE)
public void process(Message message) {
try{
log.info("结算-司机支付受理同步, message:{}", new String(message.getBody()));
process(JSON.parseObject(new String(message.getBody()), new TypeReference<MqWrapper<SettlementDriverPayAcceptSyncMqParam>>(){}).getData());
}catch (Exception e){
log.info("结算-司机支付受理同步 失败",e);
}
}
private void process(SettlementDriverPayAcceptSyncMqParam mq){
settlementMqHandlerService.driverPayAcceptSync(mq);
}
}
......@@ -53,6 +53,7 @@ public class SettlementDriverDetail implements HasKey<Integer> {
private String invoicingCompanyGroupCode; //开票公司统一社会信用代码
private BigDecimal platformServiceFee; //平台服务费(分)
private BigDecimal platformServiceFeeRate; //平台服务费费率%
private Integer payAcceptStatus; //支付受理状态:0未受理支付 1支付受理中 2已受理支付
private Integer status; //状态
private LocalDateTime createTime; //创建时间
private LocalDateTime modifiedTime; //修改时间
......
package com.clx.performance.service.broker;
import com.clx.performance.vo.mq.broker.BrokerOrderChildDriverPayMqParam;
import com.clx.performance.vo.mq.broker.BrokerOrderChildSyncMqParam;
import com.clx.performance.vo.mq.broker.BrokerOrderChildUpdateMqParam;
......@@ -7,4 +8,7 @@ public interface OrderChildBrokerMqHandlerService {
void orderChildSync(BrokerOrderChildSyncMqParam mq);
void orderChildUpdate(BrokerOrderChildUpdateMqParam mq);
void orderChildDriverPay(BrokerOrderChildDriverPayMqParam mq);
}
......@@ -9,4 +9,6 @@ public interface OrderChildBrokerMqService {
void orderChildUpdate(List<String> childNoList);
void orderChildDriverPay(String childNo);
}
......@@ -12,4 +12,7 @@ public interface OrderChildBrokerService {
SettlementDriverDetail settlementDriverDetail);
void orderChildUpdate(OrderChild orderChild, OrderGoods orderGoods, SettlementOwnerDetail settlementOwnerDetail,
SettlementDriverDetail settlementDriverDetail, SettlementDriver settlementDriver);
void orderChildDriverPay(SettlementDriverDetail settlementDriverDetail);
}
......@@ -94,7 +94,6 @@ import com.purchase.manage.action.SupplyChainSupervisionLoadTruckAction;
import com.purchase.manage.dto.SupervisionLoadInfoDto;
import com.purchase.manage.dto.SupervisionLoadTruckInfoDto;
import com.scm.lms.manage.action.LmsWeighingSignatureAction;
import com.smart.business.sdk.request.dto.WeighingSignatureDto;
import com.smart.business.sdk.request.dto.WeightChildSignatureDto;
import com.tencentcloudapi.common.Credential;
import com.tencentcloudapi.common.exception.TencentCloudSDKException;
......
......@@ -7,6 +7,7 @@ import com.clx.performance.dao.settle.SettlementDriverDetailDao;
import com.clx.performance.dao.settle.SettlementOrderChildRiskDao;
import com.clx.performance.dao.settle.SettlementOwnerDetailDao;
import com.clx.performance.enums.PerformanceResultEnum;
import com.clx.performance.enums.settle.SettlementDriverDetailEnum;
import com.clx.performance.enums.settle.SettlementOrderChildRiskEnum;
import com.clx.performance.enums.settle.SettlementOwnerDetailEnum;
import com.clx.performance.model.OrderChild;
......@@ -18,6 +19,7 @@ import com.clx.performance.model.settle.SettlementOwnerDetail;
import com.clx.performance.service.broker.OrderChildBrokerMqHandlerService;
import com.clx.performance.service.broker.OrderChildBrokerMqService;
import com.clx.performance.service.broker.OrderChildBrokerService;
import com.clx.performance.vo.mq.broker.BrokerOrderChildDriverPayMqParam;
import com.clx.performance.service.settle.SettlementPostService;
import com.clx.performance.vo.mq.broker.BrokerOrderChildSyncMqParam;
import com.clx.performance.vo.mq.broker.BrokerOrderChildUpdateMqParam;
......@@ -147,4 +149,17 @@ public class OrderChildBrokerMqHandlerServiceImpl implements OrderChildBrokerMqH
}
@Override
public void orderChildDriverPay(BrokerOrderChildDriverPayMqParam mq) {
SettlementDriverDetail settlementDriverDetail = settlementDriverDetailDao
.getByChildNo(mq.getChildNo()).orElseThrow(PerformanceResultEnum.DATA_NOT_FIND);
settlementDriverDetail.setPayAcceptStatus(SettlementDriverDetailEnum.PayAcceptStatus.ACCEPTING.getCode());
settlementDriverDetailDao.updatePayAcceptStatus(settlementDriverDetail);
// 司机支付
orderChildBrokerService.orderChildDriverPay(settlementDriverDetail);
}
}
......@@ -5,6 +5,7 @@ import com.clx.performance.common.MqDelay;
import com.clx.performance.common.MqWrapper;
import com.clx.performance.constant.RabbitKeyBrokerConstants;
import com.clx.performance.service.broker.OrderChildBrokerMqService;
import com.clx.performance.vo.mq.broker.BrokerOrderChildDriverPayMqParam;
import com.clx.performance.vo.mq.broker.BrokerOrderChildSyncMqParam;
import com.clx.performance.vo.mq.broker.BrokerOrderChildUpdateMqParam;
import lombok.extern.slf4j.Slf4j;
......@@ -58,4 +59,18 @@ public class OrderChildBrokerMqServiceImpl implements OrderChildBrokerMqService
}
}
@Override
public void orderChildDriverPay(String childNo) {
BrokerOrderChildDriverPayMqParam mq = new BrokerOrderChildDriverPayMqParam();
mq.setChildNo(childNo);
MqDelay delay =
new MqDelay<>(RabbitKeyBrokerConstants.DEFAULT_EXCHANGE,
RabbitKeyBrokerConstants.ORDER_CHILD_DRIVER_PAY_ROUTING_KEY, new MqWrapper<>(mq));
Message message = MessageBuilder.withBody(JSON.toJSONString(new MqWrapper<>(delay)).getBytes()).build();
message.getMessageProperties().setExpiration("5000");
rabbitTemplate.send(RabbitKeyBrokerConstants.DEFAULT_EXCHANGE,
RabbitKeyBrokerConstants.DEFAULT_DELAY_ROUTING_KEY, message);
}
}
......@@ -7,6 +7,7 @@ import com.clx.order.vo.feign.FeignOrderVO;
import com.clx.order.vo.pc.carrier.InvoicingCompanyVO;
import com.clx.performance.dao.OrderChildImageDao;
import com.clx.performance.dao.settle.SettlementOwnerDetailDao;
import com.clx.performance.enums.PerformanceResultEnum;
import com.clx.performance.enums.PowerTypeEnum;
import com.clx.performance.enums.settle.SettlementDriverEnum;
import com.clx.performance.enums.settle.SettlementOwnerDetailEnum;
......@@ -84,6 +85,13 @@ public class OrderChildBrokerServiceImpl implements OrderChildBrokerService {
brokerService.orderChildUpdate(transportParam);
}
@Override
public void orderChildDriverPay(SettlementDriverDetail settlementDriverDetail) {
// 运单支付
brokerService.orderChildPay(settlementDriverDetail.getChildNo());
}
private TransportParam buildParam(OrderChild orderChild, OrderGoods orderGoods, SettlementOwnerDetail settlementOwnerDetail,
SettlementDriverDetail settlementDriverDetail, SettlementDriver settlementDriver){
String host = documentFeign.getHost().getData();
......
......@@ -90,6 +90,9 @@ public class OrderChildPostServiceImpl implements OrderChildPostService {
// 发送mq 司机确认收货
orderChildMqService.orderChildDriverConfirm(orderChild.getChildNo());
// 发送mq (司机付款同步网络货运)
settlementMqService.settlementDriverConfirm(orderChild.getChildNo());
// 发送mq (更新无车承运)
orderChildBrokerMqService.orderChildUpdate(orderChild.getChildNo());
}
......
......@@ -253,11 +253,6 @@ public class SettlementMqHandlerServiceImpl implements SettlementMqHandlerServic
@Transactional(rollbackFor = Exception.class)
public void settlementDriverSettlement(SettlementDriverSettleMqParam mq) {
OrderChild orderChild = orderChildDao
.getByChildNo(mq.getChildNo()).orElseThrow(PerformanceResultEnum.ORDER_CHILD_NO_FOUND);
OrderGoods orderGoods = orderGoodsDao
.getByOrderGoodsNo(orderChild.getOrderGoodsNo()).orElseThrow(PerformanceResultEnum.DATA_NOT_FIND);
SettlementDriverDetail settlementDriverDetail = settlementDriverDetailDao
.getByChildNo(mq.getChildNo()).orElseThrow(PerformanceResultEnum.DATA_NOT_FIND);
......@@ -290,7 +285,7 @@ public class SettlementMqHandlerServiceImpl implements SettlementMqHandlerServic
String.valueOf(SettlementPlatformEnum.Platform.WY.getCode()):
String.valueOf(SettlementPlatformEnum.Platform.MSL.getCode()));
settlementDriver.setStatus(SettlementDriverEnum.Status.WAIT_SETTLEMENT.getCode());
settlementDriver.setStatus(SettlementDriverEnum.Status.DRIVER_UNCONFIRMED.getCode());
settlementDriver.setInvoicingCompanyId(settlementDriverDetail.getInvoicingCompanyId());
settlementDriver.setInvoicingCompanyShorterName(settlementDriverDetail.getInvoicingCompanyShorterName());
......@@ -303,26 +298,6 @@ public class SettlementMqHandlerServiceImpl implements SettlementMqHandlerServic
settlementDriverDetail.setSettlementNo(settlementDriver.getSettlementNo());
settlementDriverDetailDao.updateSettlementNo(settlementDriverDetail);
//车主结算单自动支付
log.info(" 运单号 {}, 是否是普通单 {} ",settlementDriverDetail.getChildNo(),settlementDriverDetail.getInvoiceType());
if (!settlementDriverDetail.getInvoiceType().equals(SettlementOwnerEnum.InvoiceType.ONLINE.getCode())) {
paySettlementDriver(settlementDriverDetail);
} else {
if (Objects.equals(orderGoods.getPlatformFreightQuotationTaxType(),
QuotationEnum.PlatformFreightQuotationTaxType.NO.getCode())
&& Objects.equals(orderGoods.getSettlementWay(), SettlementWayEnum.WayType.UNLOAD_LOSS.getCode())) {
settlementDriverDetail.setSettlementNo(settlementNo);
//插入同步网络货运待支付记录
childSyncTransportRecordService.addOrderChildSyncTransportRecord(settlementDriverDetail);
}
else if (settlementDriverDetail.getPrepayFreightFlag().equals(SettlementDriverEnum.PrepayFreightFlag.PAYED.getCode())
&& settlementDriverDetail.getPrepayFreight().compareTo(BigDecimal.ZERO) > 0) {
settlementDriverDetail.setSettlementNo(settlementNo);
//插入同步网络货运待支付记录
childSyncTransportRecordService.addOrderChildSyncTransportRecord(settlementDriverDetail);
}
}
}
@Transactional(rollbackFor = Exception.class)
......@@ -412,6 +387,49 @@ public class SettlementMqHandlerServiceImpl implements SettlementMqHandlerServic
}
}
@Override
public void driverPayAcceptSync(SettlementDriverPayAcceptSyncMqParam mq) {
OrderChild orderChild = orderChildDao.getByChildNo(mq.getChildNo()).orElseThrow(PerformanceResultEnum.DATA_NOT_FIND);
SettlementOwnerDetail settlementOwnerDetail = settlementOwnerDetailDao
.getByChildNo(orderChild.getChildNo()).orElseThrow(PerformanceResultEnum.DATA_NOT_FIND);
if (!Objects.equals(settlementOwnerDetail.getInvoiceChannel(), SettlementOwnerDetailEnum.InvoiceChannel.BROKER.getCode())){
return;
}
if (settlementOwnerDetail.getInvoiceType() == null) {return;}
SettlementDriverDetail settlementDriverDetail = settlementDriverDetailDao
.getByChildNo(orderChild.getChildNo()).orElseThrow(PerformanceResultEnum.DATA_NOT_FIND);
if (!Objects.equals(settlementDriverDetail.getPayAcceptStatus(), SettlementDriverDetailEnum.PayAcceptStatus.ACCEPTING.getCode())){
return;
}
SettlementDriver settlementDriver = settlementDriverDao
.getByChildNo(orderChild.getChildNo()).orElseThrow(PerformanceResultEnum.DATA_NOT_FIND);
try {
// 获取状态
TransportVO result = brokerService.getOrderChildStatus(mq.getChildNo());
if (result == null){
log.info("运单号 {} 未找到运单信息",mq.getChildNo());
return;
}
if (Objects.equals(result.getSyncStatus(), 0)) {
return;
}
else if (Objects.equals(result.getThirdPartyChildStatus(), 30)) {
// 更新状态
settlementDriverDetail.setPayAcceptStatus(SettlementDriverDetailEnum.PayAcceptStatus.ACCEPTED.getCode());
settlementDriverDetailDao.updatePayAcceptStatus(settlementDriverDetail);
}
}catch (Exception e){
log.info("结算获取支付受理状态失败, 运单号 {}",mq.getChildNo(),e);
}
}
@Transactional(rollbackFor = Exception.class)
@Override
public void invoiceStatusSync(SettlementInvoiceStatusSyncMqParam mq) {
......@@ -666,46 +684,6 @@ public class SettlementMqHandlerServiceImpl implements SettlementMqHandlerServic
// settlementService.updateSettlementDetailInvoiceType(settlementOwnerDetail.getChildNo(), SettlementOwnerEnum.InvoiceType.ORDINARY.getCode());
}
private void settlementDriverSave(SettlementDriverDetail detail,String settlementNo){
SettlementDriver settlementDriver = settlementDriverDao.findByChildNo(detail.getChildNo()).orElse(new SettlementDriver());
settlementDriver.setDriverUserNo(detail.getDriverUserNo());
settlementDriver.setDriverName(detail.getDriverName());
settlementDriver.setSettlementNo(settlementNo);
settlementDriver.setChildNo(detail.getChildNo());
settlementDriver.setOrderGoodsNo(detail.getOrderGoodsNo());
settlementDriver.setOrderNo(detail.getOrderNo());
settlementDriver.setGoodsId(detail.getGoodsId());
settlementDriver.setGoodsName(detail.getGoodsName());
settlementDriver.setTruckNo(detail.getTruckNo());
settlementDriver.setFreightPrice(detail.getFreightPrice());
settlementDriver.setWeight(detail.getWeight());
settlementDriver.setFreight(detail.getFreight());
settlementDriver.setLossPrice(detail.getLossPrice());
settlementDriver.setLossWeight(detail.getLossWeight());
settlementDriver.setLoanFlag(detail.getLoanFlag());
settlementDriver.setLossFreight(detail.getLossFreight());
settlementDriver.setPrepayFreightFlag(detail.getPrepayFreightFlag());
settlementDriver.setSettlementFreight(detail.getSettlementFreight());
settlementDriver.setInvoiceType(detail.getInvoiceType());
settlementDriver.setSettlementPlatform(detail.getInvoiceType() == 1 ?
String.valueOf(SettlementPlatformEnum.Platform.WY.getCode()):
String.valueOf(SettlementPlatformEnum.Platform.MSL.getCode()));
settlementDriver.setStatus(SettlementDriverEnum.Status.WAIT_SETTLEMENT.getCode());
settlementDriver.setInvoicingCompanyId(detail.getInvoicingCompanyId());
settlementDriver.setInvoicingCompanyShorterName(detail.getInvoicingCompanyShorterName());
settlementDriver.setInvoicingCompanyGroupCode(detail.getInvoicingCompanyGroupCode());
settlementDriver.setPlatformServiceFeeRate(detail.getPlatformServiceFeeRate());
settlementDriver.setPlatformServiceFee(detail.getPlatformServiceFee());
if (settlementDriver.getId() == null) {
settlementDriverDao.saveEntity(settlementDriver);
}else {
settlementDriverDao.updateEntityByKey(settlementDriver);
}
}
@Override
public void settlementDriverNotify(String childNo,Integer payType,String payErrorMsg){
......@@ -973,8 +951,54 @@ public class SettlementMqHandlerServiceImpl implements SettlementMqHandlerServic
}
@Override
@Transactional(rollbackFor = Exception.class)
public void riskAdd(SettlementOrderChildRiskAddMqParam mq) {
SettlementOrderChildRisk settlementOrderChildRisk = settlementOrderChildRiskDao
.getById(mq.getId()).orElseThrow(ResultEnum.DATA_NOT_FIND);
if (Objects.equals(settlementOrderChildRisk.getStatus(), SettlementOrderChildRiskEnum.Status.PROCESSED.getCode())) {
return;
}
OrderChild orderChild = orderChildDao
.getByChildNo(settlementOrderChildRisk.getChildNo()).orElseThrow(ResultEnum.DATA_NOT_FIND);
InvoicingCompanyVO invoicingCompanyByGroupCode = invoicingCompanyService
.getInvoicingCompanyByGroupCode(orderChild.getInvoicingCompanyGroupCode());
if (!Objects.equals(invoicingCompanyByGroupCode.getRiskProcessType(), InvoicingCompanyEnum.RiskProcessType.AUTO.getCode())) {
return;
}
// 转普通单
SettlementOwnerDetail settlementOwnerDetail = settlementOwnerDetailDao
.getByChildNo(settlementOrderChildRisk.getChildNo()).orElseThrow(ResultEnum.DATA_NOT_FIND);
SettlementDriverDetail settlementDriverDetail = settlementDriverDetailDao
.getByChildNo(settlementOrderChildRisk.getChildNo()).orElseThrow(PerformanceResultEnum.DATA_NOT_FIND);
settlementOrderChildRisk.setStatus(SettlementOrderChildRiskEnum.Status.PROCESSED.getCode());
settlementOrderChildRisk.setProcessMethod(SettlementOrderChildRiskEnum.ProcessMethod.CONVERT_ORDINARY.getCode());
settlementOrderChildRisk.setProcessBy("系统");
settlementOrderChildRisk.setProcessTime(LocalDateTime.now());
settlementOwnerDetail.setInvoiceType(SettlementOwnerEnum.InvoiceType.ORDINARY.getCode());
settlementOwnerDetail.setInvoicingCompanyId(null);
settlementOwnerDetail.setInvoicingCompanyShorterName(null);
settlementOwnerDetail.setInvoicingCompanyGroupCode(null);
settlementOwnerDetail.setInvoiceTypeStatus(SettlementOwnerDetailEnum.InvoiceTypeStatus.SUCCESS.getCode());
settlementOwnerDetail.setInvoiceTypeModifiedTime(LocalDateTime.now());
settlementOwnerDetailDao.updateConvertOrdinary(settlementOwnerDetail);
settlementDriverDetail.setInvoiceType(settlementOwnerDetail.getInvoiceType());
settlementDriverDetail.setInvoicingCompanyId(settlementOwnerDetail.getInvoicingCompanyId());
settlementDriverDetail.setInvoicingCompanyShorterName(settlementOwnerDetail.getInvoicingCompanyShorterName());
settlementDriverDetail.setInvoicingCompanyGroupCode(settlementOwnerDetail.getInvoicingCompanyGroupCode());
settlementDriverDetailDao.updateConvertOrdinary(settlementDriverDetail);
settlementOrderChildRisk.setInvoiceType(settlementOwnerDetail.getInvoiceType());
settlementOrderChildRiskDao.updateProcess(settlementOrderChildRisk);
// 发送mq (风控处理)
settlementMqService.riskProcess(settlementOrderChildRisk.getId());
}
@Transactional(rollbackFor = Exception.class)
......@@ -1213,6 +1237,56 @@ public class SettlementMqHandlerServiceImpl implements SettlementMqHandlerServic
}
@Override
public void settlementDriverConfirm(SettlementDriverConfirmMqParam mq) {
OrderChild orderChild = orderChildDao.getByChildNo(mq.getChildNo()).orElseThrow(ResultEnum.DATA_NOT_FIND);
if (orderChild.getConfirmTime() == null) {return;}
OrderGoods orderGoods = orderGoodsDao
.getByOrderGoodsNo(orderChild.getOrderGoodsNo()).orElseThrow(PerformanceResultEnum.DATA_NOT_FIND);
SettlementDriver settlementDriver = settlementDriverDao.findByChildNo(orderChild.getChildNo()).orNull();
if (settlementDriver == null
|| !Objects.equals(settlementDriver.getStatus(), SettlementDriverEnum.Status.DRIVER_UNCONFIRMED.getCode())
) {
return;
}
SettlementDriverDetail settlementDriverDetail = settlementDriverDetailDao
.getByChildNo(mq.getChildNo()).orElseThrow(PerformanceResultEnum.DATA_NOT_FIND);
//车主结算单自动支付
log.info(" 运单号 {}, 是否是普通单 {} ",settlementDriverDetail.getChildNo(),settlementDriverDetail.getInvoiceType());
if (!settlementDriverDetail.getInvoiceType().equals(SettlementOwnerEnum.InvoiceType.ONLINE.getCode())) {
paySettlementDriver(settlementDriverDetail);
} else {
if (Objects.equals(orderGoods.getPlatformFreightQuotationTaxType(),
QuotationEnum.PlatformFreightQuotationTaxType.NO.getCode())
&& Objects.equals(orderGoods.getSettlementWay(), SettlementWayEnum.WayType.UNLOAD_LOSS.getCode())) {
//插入同步网络货运待支付记录
childSyncTransportRecordService.addOrderChildSyncTransportRecord(settlementDriverDetail);
}
else if (settlementDriverDetail.getPrepayFreightFlag().equals(SettlementDriverEnum.PrepayFreightFlag.PAYED.getCode())
&& settlementDriverDetail.getPrepayFreight().compareTo(BigDecimal.ZERO) > 0) {
//插入同步网络货运待支付记录
childSyncTransportRecordService.addOrderChildSyncTransportRecord(settlementDriverDetail);
}
}
settlementDriver.setStatus(SettlementDriverEnum.Status.WAIT_SETTLEMENT.getCode());
settlementDriverDao.updateSettleStatus(settlementDriver);
if (!Objects.equals(settlementDriver.getInvoiceType(), SettlementOwnerEnum.InvoiceType.ONLINE.getCode())){
return;
}
// 发送mq (运单司机支付)
orderChildBrokerMqService.orderChildDriverPay(orderChild.getChildNo());
}
private BigDecimal invoiceFreightCalc(Integer settlementWay, BigDecimal invoiceServiceFeeRate, SettlementOwnerDetail settlementOwnerDetail) {
if (Objects.equals(settlementWay, SettlementWayEnum.WayType.LOAD.getCode())) { //订单结算方式为“装车净重”时,开票金额=实际净重*平台运费报价-货损金额。
return settlementOwnerDetail.getWeight().multiply(settlementOwnerDetail.getFreightPrice())
......
......@@ -85,6 +85,19 @@ public class SettlementMqServiceImpl implements SettlementMqService {
RabbitKeySettlementConstants.DEFAULT_DELAY_ROUTING_KEY, message);
}
@Override
public void driverPayAcceptSync(String childNo) {
SettlementDriverPayAcceptSyncMqParam mq = new SettlementDriverPayAcceptSyncMqParam();
mq.setChildNo(childNo);
MqDelay delay =
new MqDelay<>(RabbitKeySettlementConstants.DEFAULT_EXCHANGE,
RabbitKeySettlementConstants.SETTLEMENT_DRIVER_PAY_ACCEPT_SYNC_ROUTING_KEY, new MqWrapper<>(mq));
Message message = MessageBuilder.withBody(JSON.toJSONString(new MqWrapper<>(delay)).getBytes()).build();
message.getMessageProperties().setExpiration("5000");
rabbitTemplate.send(RabbitKeySettlementConstants.DEFAULT_EXCHANGE,
RabbitKeySettlementConstants.DEFAULT_DELAY_ROUTING_KEY, message);
}
@Override
public void settle(String childNo, Integer invoiceType, String remark) {
......@@ -184,4 +197,16 @@ public class SettlementMqServiceImpl implements SettlementMqService {
RabbitKeySettlementConstants.DEFAULT_DELAY_ROUTING_KEY, message);
}
@Override
public void settlementDriverConfirm(String childNo) {
SettlementDriverConfirmMqParam mq = new SettlementDriverConfirmMqParam();
mq.setChildNo(childNo);
MqDelay delay = new MqDelay<>(RabbitKeySettlementConstants.DEFAULT_EXCHANGE,
RabbitKeySettlementConstants.SETTLEMENT_DRIVER_CONFIRM_ROUTING_KEY, new MqWrapper<>(mq));
Message message = MessageBuilder.withBody(JSON.toJSONString(new MqWrapper<>(delay)).getBytes()).build();
message.getMessageProperties().setExpiration("5000");
rabbitTemplate.send(RabbitKeySettlementConstants.DEFAULT_EXCHANGE,
RabbitKeySettlementConstants.DEFAULT_DELAY_ROUTING_KEY, message);
}
}
......@@ -8,10 +8,7 @@ import com.clx.performance.dao.settle.SettlementOrderChildRiskDao;
import com.clx.performance.dao.settle.SettlementOwnerDetailDao;
import com.clx.performance.enums.PerformanceResultEnum;
import com.clx.performance.enums.ResultEnum;
import com.clx.performance.enums.settle.SettlementDriverEnum;
import com.clx.performance.enums.settle.SettlementOrderChildRiskEnum;
import com.clx.performance.enums.settle.SettlementOwnerDetailEnum;
import com.clx.performance.enums.settle.SettlementOwnerEnum;
import com.clx.performance.enums.settle.*;
import com.clx.performance.model.settle.SettlementDriver;
import com.clx.performance.model.settle.SettlementDriverDetail;
import com.clx.performance.model.settle.SettlementOrderChildRisk;
......@@ -108,8 +105,13 @@ public class SettlementOrderChildRiskServiceImpl implements SettlementOrderChild
}
}
else {
// 状态回滚
if (settlementDriver != null){
settlementDriver.setStatus(SettlementDriverEnum.Status.DRIVER_UNCONFIRMED.getCode());
settlementDriverDao.updatePayStatus(settlementDriver);
}
settlementDriverDetail.setPayAcceptStatus(SettlementDriverDetailEnum.PayAcceptStatus.INIT.getCode());
settlementDriverDetailDao.updatePayAcceptStatus(settlementDriverDetail);
}
settlementOrderChildRiskDao.updateProcess(settlementOrderChildRisk);
......
......@@ -456,16 +456,20 @@ public class SettlementOwnerDetailServiceImpl implements SettlementOwnerDetailS
fieldList.add(new ExcelField(12, "管理费", "invoiceServiceFee", 5000));
fieldList.add(new ExcelField(13, "预付运费金额", "prepayFreight", 5000));
fieldList.add(new ExcelField(14, "借款抵扣金额", "loanFreight", 5000));
fieldList.add(new ExcelField(15, "结算金额", "settlementFreight", 5000));
fieldList.add(new ExcelField(16, "开票金额", "invoiceFreight", 5000));
fieldList.add(new ExcelField(17, "开票标识", "invoiceType", 5000));
fieldList.add(new ExcelField(18, "状态", "handleStatus", 5000));
fieldList.add(new ExcelField(19, "订单编号", "orderNo", 5000));
fieldList.add(new ExcelField(20, "结算单号", "settlementNo", 5000));
fieldList.add(new ExcelField(21, "磅单审核通过时间", "poundAuditTime", 5000));
fieldList.add(new ExcelField(22, "创建时间", "createTime", 5000));
fieldList.add(new ExcelField(23, "操作人", "invoicingCompanyModifiedBy", 5000));
fieldList.add(new ExcelField(24, "操作时间", "invoicingCompanyModifiedTime", 5000));
fieldList.add(new ExcelField(18, "开票公司", "invoicingCompanyShorterName", 5000));
fieldList.add(new ExcelField(19, "状态", "handleStatus", 5000));
fieldList.add(new ExcelField(20, "订单编号", "orderNo", 5000));
fieldList.add(new ExcelField(21, "结算单号", "settlementNo", 5000));
fieldList.add(new ExcelField(22, "磅单审核通过时间", "poundAuditTime", 5000));
fieldList.add(new ExcelField(23, "创建时间", "createTime", 5000));
fieldList.add(new ExcelField(24, "操作人", "invoicingCompanyModifiedBy", 5000));
fieldList.add(new ExcelField(25, "操作时间", "invoicingCompanyModifiedTime", 5000));
// 组装数据
List<List<ExcelData>> dataList = new ArrayList<>();
......@@ -489,10 +493,13 @@ public class SettlementOwnerDetailServiceImpl implements SettlementOwnerDetailS
rowData.add(new ExcelData(dto.getInvoiceServiceFee()==null?null:dto.getInvoiceServiceFee().movePointLeft(2)));
rowData.add(new ExcelData(dto.getPrepayFreight()==null?null:dto.getPrepayFreight().movePointLeft(2)));
rowData.add(new ExcelData(dto.getLoanFreight()==null?null:dto.getLoanFreight().movePointLeft(2)));
rowData.add(new ExcelData(dto.getSettlementFreight()==null?null:dto.getSettlementFreight().movePointLeft(2)));
rowData.add(new ExcelData(dto.getInvoiceFreight()==null?null:dto.getInvoiceFreight().movePointLeft(2)));
rowData.add(new ExcelData(SettlementOwnerEnum.InvoiceType.getMsgByCode(dto.getInvoiceType())));
rowData.add(new ExcelData(dto.getInvoicingCompanyShorterName(),"-"));
rowData.add(new ExcelData(SettlementOwnerDetailEnum.HandleStatus.getMsgByCode(dto.getHandleStatus())));
rowData.add(new ExcelData(dto.getOrderNo()));
rowData.add(new ExcelData(dto.getSettlementNo()));
rowData.add(new ExcelData(dto.getPoundAuditTime()));
......
......@@ -30,6 +30,7 @@ import com.clx.performance.model.settle.SettlementPlatformAccount;
import com.clx.performance.param.pc.owner.*;
import com.clx.performance.service.OwnerAccountService;
import com.clx.performance.service.PlatformAccountConfigService;
import com.clx.performance.service.broker.OrderChildBrokerMqService;
import com.clx.performance.service.settle.SettlementLogService;
import com.clx.performance.service.settle.SettlementMqHandlerService;
import com.clx.performance.service.settle.SettlementOwnerService;
......@@ -99,7 +100,7 @@ public class SettlementOwnerServiceImpl implements SettlementOwnerService {
private final PlatformAccountConfigService platformAccountConfigService;
private final OrderFeign orderFeign;
private final BreakContractSettlementOwnerDao breakContractSettlementOwnerDao;
private final OrderChildBrokerMqService orderChildBrokerMqService;
@Override
......@@ -893,6 +894,10 @@ public class SettlementOwnerServiceImpl implements SettlementOwnerService {
settlementOwnerDao.saveEntity(merge);
//更新货主运单计费明细
settlementOwnerDetailDao.updateSettlementMerge(settlementNo,settlementNos);
List<SettlementOwnerDetail> settlementOwnerDetailList = settlementOwnerDetailDao.getBySettlementNo(settlementNo);
// 发送mq (运单更新)
orderChildBrokerMqService.orderChildUpdate(settlementOwnerDetailList.stream().map(item->item.getChildNo()).collect(Collectors.toList()));
}
}
......@@ -67,4 +67,10 @@ public class SettlementPostServiceImpl implements SettlementPostService {
settlementMqService.riskAdd(id);
}
@Override
public void driverSettle(String childNo) {
// 发送mq (司机确认收货)
settlementMqService.settlementDriverConfirm(childNo);
}
}
......@@ -14,6 +14,7 @@ public interface SettlementMqHandlerService {
void settle(SettlementSettleMqParam mq);
void invoiceTypeSync(SettlementInvoiceTypeSyncMqParam mq);
void driverPayAcceptSync(SettlementDriverPayAcceptSyncMqParam mq);
void invoiceStatusSync(SettlementInvoiceStatusSyncMqParam mq);
......@@ -34,4 +35,6 @@ public interface SettlementMqHandlerService {
void settlementInvoiceStatusUpdate(SettlementInvoiceStatusUpdateMqParam mq);
void settlementDriverConfirm(SettlementDriverConfirmMqParam mq);
}
......@@ -10,6 +10,8 @@ public interface SettlementMqService {
void invoiceTypeSync(String childNo);
void driverPayAcceptSync(String childNo);
void settle(String childNo, Integer invoiceType, String remark);
void invoiceStatusSync(String childNo);
......@@ -26,4 +28,6 @@ public interface SettlementMqService {
void settlementInvoiceStatusUpdate(String settlementNo);
void settlementDriverConfirm(String childNo);
}
......@@ -15,6 +15,7 @@ public interface SettlementPostService {
void updateInvoice(List<String> childNoList);
void driverSettle(String childNo);
void riskAdd(Integer id);
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论