|
|
@@ -153,7 +153,7 @@ public class KwtWaybillOrderV1Service {
|
|
|
private final KwtWaybillOrderTicketRepository kwtWaybillOrderTicketRepository;
|
|
|
private final KwtWaybillOrderNodeRepository kwtWaybillOrderNodeRepository;
|
|
|
private final VehicleTraceClient vehicleTraceClient;
|
|
|
- private final KwtLogisticsOrderContractRepository logisticsOrderContractRepository;
|
|
|
+
|
|
|
@Resource
|
|
|
private StreamBridge streamBridge;
|
|
|
@DubboReference(version = "1.0.0", group = "design", check = false)
|
|
|
@@ -4788,10 +4788,6 @@ public class KwtWaybillOrderV1Service {
|
|
|
resp.setLoadCompleteRate(calculatePercentage(loadAmount, entrustAmount));
|
|
|
String lossRate = calculateLossRate(loadAmount, unloadAmount);
|
|
|
resp.setLossRate(lossRate);
|
|
|
- // 原矿运输订单计算是否超过货损率
|
|
|
- if (Objects.equals(logOrder.getOrderType(), 1)) {
|
|
|
- resp.setIsPassReason(isLossRateExceeded(logOrder, lossRate));
|
|
|
- }
|
|
|
|
|
|
// 轨迹记录
|
|
|
if (!CollectionUtils.isEmpty(nodeList)) {
|
|
|
@@ -4821,31 +4817,6 @@ public class KwtWaybillOrderV1Service {
|
|
|
return resp;
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 校验货损率是否超过千分之三
|
|
|
- */
|
|
|
- private boolean isLossRateExceeded(KwtLogisticsOrder logOrder, String lossRate) {
|
|
|
- log.info("[门卫]开始计算货损率是否超过配置值,物流订单:{},货损率:{}", JSON.toJSONString(logOrder), JSON.toJSONString(lossRate));
|
|
|
- BigDecimal lossRateBig = StringUtils.isBlank(lossRate) ? BigDecimal.ZERO : new BigDecimal(lossRate);
|
|
|
-
|
|
|
- KwtLogisticsOrderContract orderContract = logisticsOrderContractRepository.queryByLogOrderId(logOrder.getId());
|
|
|
- if (orderContract == null) {
|
|
|
- throw new BusinessPlatfromException(ErrorCodeEnum.LOGISTICS_CONTRACT_NOT_FOUND, "物流订单无合同数据!");
|
|
|
- }
|
|
|
- KwcContractLogisticsDto contractLogisticsDto = remoteContractService.queryContractByContractId(orderContract.getContractId());
|
|
|
- if (contractLogisticsDto == null) {
|
|
|
- throw new BusinessPlatfromException(ErrorCodeEnum.DATA_NOT_EXIST, "物流合同不存在!");
|
|
|
- }
|
|
|
- if (contractLogisticsDto.getAllowedError() == null || contractLogisticsDto.getAllowedError().compareTo(BigDecimal.ZERO) <= 0) {
|
|
|
- return false;
|
|
|
- }
|
|
|
- // 查询出来的货损率为5,表示千分之5,需除以1000
|
|
|
- BigDecimal allowedError = contractLogisticsDto.getAllowedError().divide(new BigDecimal("1000"), 6, RoundingMode.HALF_UP);
|
|
|
-
|
|
|
- log.info("[门卫]计算货损率是否超过配置值完成,配置的货损率:{}", com.alibaba.fastjson.JSON.toJSONString(allowedError));
|
|
|
- return lossRateBig.compareTo(allowedError) > 0;
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* 格式化金额
|
|
|
*/
|