提交 48ecb1a7 authored 作者: huyufan's avatar huyufan

还吨处理

上级 b2202439
......@@ -4,17 +4,33 @@ import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.json.JSONUtil;
import com.clx.performance.component.ThirdComponent;
import com.clx.performance.dao.settle.OrderChildSyncTransportRecordDao;
import com.clx.performance.dao.settle.SettlementDriverDetailDao;
import com.clx.performance.dto.OrderChildSyncDTO;
import com.clx.performance.enums.PerformanceResultEnum;
import com.clx.performance.enums.settle.SettlementDriverEnum;
import com.clx.performance.enums.settle.SettlementOwnerEnum;
import com.clx.performance.extranal.user.OwnerInfoService;
import com.clx.performance.feign.TransportFeignService;
import com.clx.performance.model.OrderGoods;
import com.clx.performance.model.settle.OrderChildSyncTransportRecord;
import com.clx.performance.model.settle.SettlementDriverDetail;
import com.clx.performance.model.settle.SettlementOwner;
import com.clx.performance.model.settle.SettlementOwnerDetail;
import com.clx.performance.param.feign.transport.OrderChildPaySyncParam;
import com.clx.performance.service.settle.SettlementMqHandlerService;
import com.clx.performance.utils.LocalDateTimeUtils;
import com.clx.performance.vo.mq.SettlementDetailInvoiceTypeSyncMqParam;
import com.clx.user.vo.feign.OwnerInfoFeignVO;
import com.msl.common.dto.HttpDTO;
import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
@Slf4j
......@@ -26,6 +42,8 @@ public class OrderChildPaySyncTransportJob {
private final TransportFeignService transportFeignService;
private final SettlementMqHandlerService settlementMqHandlerService;
/**
* 同步网络货运
*/
......@@ -52,4 +70,17 @@ public class OrderChildPaySyncTransportJob {
}
}
/**
* 结算信息job处理
* @param childNo
*/
@XxlJob("settlementDetailInvoiceTypeSyncJob")
public void settlementDetailInvoiceTypeSyncJob(String childNo) {
SettlementDetailInvoiceTypeSyncMqParam mqParam = new SettlementDetailInvoiceTypeSyncMqParam();
mqParam.setChildNo(childNo);
settlementMqHandlerService.settlementDetailInvoiceTypeSync(mqParam);
}
}
......@@ -95,7 +95,6 @@ public class OrderChildSyncTransportListener {
SettlementOwnerDetail settlementOwnerDetail = settlementOwnerDetailDao.getByChildNo(orderChild.getChildNo()).orElseThrow(PerformanceResultEnum.DATA_NOT_FIND);
SettlementDriverDetail settlementDriverDetail = settlementDriverDetailDao.getByChildNo(orderChild.getChildNo()).orElseThrow(PerformanceResultEnum.DATA_NOT_FIND);
settlementOwnerDetail.setInvoiceFreight(invoiceFreightCalc(orderChild.getSettlementWay(), settlementOwnerDetail));
OrderGoods orderGoods = orderGoodsDao.getByOrderGoodsNo(orderChild.getOrderGoodsNo()).get();
ThirdOrderChildBrokerParam param = transportSyncService.generateOrderChildSync(orderChild, orderGoods, settlementOwnerDetail, settlementDriverDetail);
......@@ -109,6 +108,7 @@ public class OrderChildSyncTransportListener {
public void extracted(OrderChild orderChild, OrderChildSyncDTO bean, String remark,
SettlementOwnerDetail settlementOwnerDetail,
Integer invoiceType, SettlementDriverDetail settlementDriverDetail) {
settlementOwnerDetail.setInvoiceFreight(invoiceFreightCalc(orderChild.getSettlementWay(), settlementOwnerDetail));
if (null != bean && bean.getCode() == 0) {
log.info("当前OrderChildSyncTransportListener监听同步网络货运成功,运单号为{}", orderChild.getChildNo());
......
......@@ -791,7 +791,7 @@ public class OrderChildServiceImpl implements OrderChildService {
imageList.add(image);
}
BigDecimal dif = loadNet.subtract(orderChild.getWeight());
BigDecimal dif = loadNet.subtract(orderChild.getLoadNet());
orderChild.setLoadRough(param.getLoadRough());
orderChild.setLoadTare(param.getLoadTare());
......
package com.clx.performance.service.impl.settle;
import cn.hutool.json.JSONUtil;
import com.clx.order.vo.feign.FeignOrderInfoVO;
import com.clx.performance.config.MslPaymentConfig;
import com.clx.performance.constant.RedissonConstants;
......@@ -13,10 +14,7 @@ import com.clx.performance.enums.OrderChildEnum;
import com.clx.performance.enums.OrderChildLogEnum;
import com.clx.performance.enums.PayRemarkEnum;
import com.clx.performance.enums.PerformanceResultEnum;
import com.clx.performance.enums.settle.SettlementDriverEnum;
import com.clx.performance.enums.settle.SettlementLogEnum;
import com.clx.performance.enums.settle.SettlementOwnerEnum;
import com.clx.performance.enums.settle.SettlementPlatformEnum;
import com.clx.performance.enums.settle.*;
import com.clx.performance.extranal.user.DriverService;
import com.clx.performance.extranal.user.OrderService;
import com.clx.performance.extranal.user.OwnerInfoService;
......@@ -109,15 +107,17 @@ public class SettlementMqHandlerServiceImpl implements SettlementMqHandlerServic
private OrderService orderService;
@Override
@Transactional(rollbackFor = Exception.class)
public void settlementDetailInvoiceTypeSync(SettlementDetailInvoiceTypeSyncMqParam mq) {
SettlementOwnerDetail settlementOwnerDetail = settlementOwnerDetailDao.getByChildNo(mq.getChildNo()).orElseThrow(PerformanceResultEnum.DATA_NOT_FIND);
SettlementDriverDetail settlementDriverDetail = settlementDriverDetailDao.getByChildNo(mq.getChildNo()).orElseThrow(PerformanceResultEnum.DATA_NOT_FIND);
log.info("当前车主计费信息{},司机计费信息:{}", JSONUtil.parse(settlementOwnerDetail), JSONUtil.parse(settlementDriverDetail));
if (settlementOwnerDetail.getInvoiceFreight() == null) {
log.info("当前车主计费信息开票金额为空,需要重新处理计算开票金额");
OrderChild orderChild = orderChildDao.getByChildNo(mq.getChildNo()).get();
settlementOwnerDetail.setInvoiceFreight(invoiceFreightCalc(orderChild.getSettlementWay(), settlementOwnerDetail));
}
String settlementNo = null ;
SettlementOwner settlementOwner = null;
......@@ -482,4 +482,13 @@ public class SettlementMqHandlerServiceImpl implements SettlementMqHandlerServic
return uniqueOrderNumService.getUniqueOrderNum(com.msl.common.utils.LocalDateTimeUtils.convertLocalDateTimeToString(LocalDateTime.now(), com.msl.common.utils.LocalDateTimeUtils.DATE_DAY));
}
private BigDecimal invoiceFreightCalc(Integer settlementWay, SettlementOwnerDetail settlementOwnerDetail) {
if (Objects.equals(settlementWay, SettlementWayEnum.WayType.LOAD.getCode())) { //订单结算方式为“装车净重”时,开票金额=实际净重*平台运费报价-货损金额。
return settlementOwnerDetail.getWeight().multiply(settlementOwnerDetail.getFreightPrice())
.subtract(settlementOwnerDetail.getLossFreight());
} else { //订单结算方式为“卸车净重”时,开票金额=实际净重*平台运费报价。
return settlementOwnerDetail.getWeight().multiply(settlementOwnerDetail.getFreightPrice());
}
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论