|
|
@@ -36,6 +36,8 @@ import com.sckw.order.api.dubbo.TradeOrderInfoService;
|
|
|
import com.sckw.order.api.model.CompleteLogisticsOrderParam;
|
|
|
import com.sckw.order.api.model.OrderDetailRes;
|
|
|
import com.sckw.order.api.model.UnitInfoDetailRes;
|
|
|
+import com.sckw.payment.api.dubbo.PaymentDubboService;
|
|
|
+import com.sckw.payment.api.model.dto.SettlementMoney;
|
|
|
import com.sckw.stream.model.SckwBusSum;
|
|
|
import com.sckw.system.api.RemoteSystemService;
|
|
|
import com.sckw.system.api.model.dto.res.AreaTreeFrontResDto;
|
|
|
@@ -99,6 +101,9 @@ public class ConsignOrderService {
|
|
|
@DubboReference(version = "1.0.0", group = "design", check = false, timeout = 8000)
|
|
|
RemoteFleetService fleetService;
|
|
|
|
|
|
+ @DubboReference(version = "1.0.0", group = "design", check = false, timeout = 6000)
|
|
|
+ PaymentDubboService paymentDubboService;
|
|
|
+
|
|
|
@Autowired
|
|
|
public CommonService commonService;
|
|
|
|
|
|
@@ -1965,7 +1970,7 @@ public class ConsignOrderService {
|
|
|
String lastWeekDateStart = DateUtil.getLastWeekDateStartToString(LocalDate.now(), 13);
|
|
|
//结束时间
|
|
|
String lastWeekDateEnd = DateUtil.getLastWeekDateEndToString(7);
|
|
|
- return computeCompare(entCacheResDto.getId(), weekDateStart, weekDateEnd, lastWeekDateStart, lastWeekDateEnd);
|
|
|
+ return computeCompare(entCacheResDto.getId(), weekDateStart, weekDateEnd, lastWeekDateStart, lastWeekDateEnd,2);
|
|
|
} else if (String.valueOf(NumberConstant.TWO).equals(dateType)) {
|
|
|
//月
|
|
|
//开始时间
|
|
|
@@ -1977,7 +1982,7 @@ public class ConsignOrderService {
|
|
|
String lastMonthDateStart = DateUtil.getBeforeMonthDateAndDaysStartToString(LocalDateTime.now(), 2, -1);
|
|
|
//结束时间
|
|
|
String lastMonthDateEnd = DateUtil.getBeforeMonthDateAndDaysEndToString(LocalDateTime.now(), 1, 0);
|
|
|
- return computeCompare(entCacheResDto.getId(), monthDateStart, monthDateEnd, lastMonthDateStart, lastMonthDateEnd);
|
|
|
+ return computeCompare(entCacheResDto.getId(), monthDateStart, monthDateEnd, lastMonthDateStart, lastMonthDateEnd,3);
|
|
|
} else if (String.valueOf(NumberConstant.THREE).equals(dateType)) {
|
|
|
//年
|
|
|
|
|
|
@@ -1998,8 +2003,9 @@ public class ConsignOrderService {
|
|
|
* @param lastWeekDateEnd 环比上次结束时间
|
|
|
* @return
|
|
|
*/
|
|
|
- private HttpResult computeCompare(Long id, String weekDateStart, String weekDateEnd, String lastWeekDateStart, String lastWeekDateEnd) {
|
|
|
+ private HttpResult computeCompare(Long id, String weekDateStart, String weekDateEnd, String lastWeekDateStart, String lastWeekDateEnd,Integer dateType) {
|
|
|
HttpResult httpResult = new HttpResult();
|
|
|
+ StatisticsResultVO resultVO = new StatisticsResultVO();
|
|
|
//本周
|
|
|
//排除掉不做统计中的数据
|
|
|
//获取完结的单据
|
|
|
@@ -2007,28 +2013,28 @@ public class ConsignOrderService {
|
|
|
statusList.add(LogisticsOrderEnum.HAVE_FINISHED.getCode());
|
|
|
statusList.add(LogisticsOrderEnum.HAVE_RECONCILED.getCode());
|
|
|
statusList.add(LogisticsOrderEnum.HAVE_ALREADY_SETTLED.getCode());
|
|
|
- StatisticsByOrderVO statistics = kwtLogisticsOrderMapper.selectAcceptCarriageFinishOrder(statusList, weekDateStart, weekDateEnd, id, OrderTypeEnum.CONSIGN_ORDER.getType());
|
|
|
+ StatisticsByOrderVO currentFinish = kwtLogisticsOrderMapper.selectAcceptCarriageFinishOrder(statusList, weekDateStart, weekDateEnd, id, OrderTypeEnum.CONSIGN_ORDER.getType());
|
|
|
//获取完结中的单据
|
|
|
statusList.clear();
|
|
|
statusList.add(LogisticsOrderEnum.TO_BE_PLANNED.getCode());
|
|
|
statusList.add(LogisticsOrderEnum.PENDING_ORDER.getCode());
|
|
|
statusList.add(LogisticsOrderEnum.WAIT_DELIVERY.getCode());
|
|
|
statusList.add(LogisticsOrderEnum.IN_TRANSIT.getCode());
|
|
|
- StatisticsByOrderVO statisticsByOrderVO = kwtLogisticsOrderMapper.selectAcceptCarriageAwaitFinishOrder(statusList, weekDateStart, weekDateEnd, id, OrderTypeEnum.CONSIGN_ORDER.getType());
|
|
|
+ StatisticsByOrderVO currentFinishIng= kwtLogisticsOrderMapper.selectAcceptCarriageAwaitFinishOrder(statusList, weekDateStart, weekDateEnd, id, OrderTypeEnum.CONSIGN_ORDER.getType());
|
|
|
//全部的未履约量
|
|
|
- BigDecimal waitingAmount = statistics.getWaitingAmount().add(statisticsByOrderVO.getWaitingAmount());
|
|
|
- BigDecimal amount = statistics.getAmount().add(statisticsByOrderVO.getAmount());
|
|
|
- BigDecimal entrustAmount = statistics.getEntrustAmount().add(statisticsByOrderVO.getEntrustAmount());
|
|
|
- BigDecimal subcontractAmount = statistics.getSubcontractAmount().add(statisticsByOrderVO.getSubcontractAmount());
|
|
|
- BigDecimal totalPrice = statistics.getTotalPrice().add(statisticsByOrderVO.getTotalPrice());
|
|
|
+ BigDecimal waitingAmount = currentFinish.getWaitingAmount().add(currentFinishIng.getWaitingAmount());
|
|
|
+ BigDecimal amount = currentFinish.getAmount().add(currentFinishIng.getAmount());
|
|
|
+ BigDecimal entrustAmount = currentFinish.getEntrustAmount().add(currentFinishIng.getEntrustAmount());
|
|
|
+ BigDecimal subcontractAmount = currentFinish.getSubcontractAmount().add(currentFinishIng.getSubcontractAmount());
|
|
|
+ BigDecimal totalPrice = currentFinish.getTotalPrice().add(currentFinishIng.getTotalPrice());
|
|
|
|
|
|
|
|
|
- StatisticsByOrderVO vo = new StatisticsByOrderVO();
|
|
|
- vo.setWaitingAmount(waitingAmount);
|
|
|
- vo.setAmount(amount);
|
|
|
- vo.setEntrustAmount(entrustAmount);
|
|
|
- vo.setSubcontractAmount(subcontractAmount);
|
|
|
- vo.setTotalPrice(totalPrice);
|
|
|
+ StatisticsByOrderVO current = new StatisticsByOrderVO();
|
|
|
+ current.setWaitingAmount(waitingAmount);
|
|
|
+ current.setAmount(amount);
|
|
|
+ current.setEntrustAmount(entrustAmount);
|
|
|
+ current.setSubcontractAmount(subcontractAmount);
|
|
|
+ current.setTotalPrice(totalPrice);
|
|
|
|
|
|
//上周
|
|
|
|
|
|
@@ -2052,37 +2058,113 @@ public class ConsignOrderService {
|
|
|
BigDecimal lastSubcontractAmount = lastStatistics.getSubcontractAmount().add(lastStatisticsByOrderVO.getSubcontractAmount());
|
|
|
BigDecimal lastTotalPrice = lastStatistics.getTotalPrice().add(lastStatisticsByOrderVO.getTotalPrice());
|
|
|
|
|
|
- vo.setLastWaitingAmount(lastWaitingAmount);
|
|
|
- vo.setLastAmount(lastAmount);
|
|
|
- vo.setLastEntrustAmount(lastEntrustAmount);
|
|
|
- vo.setLastSubcontractAmount(lastSubcontractAmount);
|
|
|
- vo.setLastTotalPrice(lastTotalPrice);
|
|
|
+ StatisticsByOrderVO last = new StatisticsByOrderVO();
|
|
|
+ last.setWaitingAmount(lastWaitingAmount);
|
|
|
+ last.setAmount(lastAmount);
|
|
|
+ last.setEntrustAmount(lastEntrustAmount);
|
|
|
+ last.setSubcontractAmount(lastSubcontractAmount);
|
|
|
+ last.setTotalPrice(lastTotalPrice);
|
|
|
+
|
|
|
+ /**计算待承运量*/
|
|
|
+ computeCompareWaitingAmount(resultVO,current,last);
|
|
|
+
|
|
|
+ /**承运量*/
|
|
|
+ computeCompareAmount(resultVO,current,last);
|
|
|
+
|
|
|
+ /**总金额(费用)*/
|
|
|
+ computeCompareTotalPrice(resultVO,current,last);
|
|
|
+
|
|
|
+ /**待处理的金额*/
|
|
|
+ SettlementMoney settlementMoney = paymentDubboService.countShipper(id, dateType);
|
|
|
+ StatisticsMoneyVO moneyVO = new StatisticsMoneyVO();
|
|
|
+ moneyVO.setCurrent(settlementMoney.getCurrent());
|
|
|
+ moneyVO.setBefore(settlementMoney.getBefore());
|
|
|
+ moneyVO.setChainRatio(settlementMoney.getPercent());
|
|
|
+ moneyVO.setFlag(settlementMoney.getFlag());
|
|
|
+ resultVO.setMoneyVO(moneyVO);
|
|
|
+ httpResult.setData(resultVO);
|
|
|
+ return httpResult;
|
|
|
+ }
|
|
|
|
|
|
- //环比计算
|
|
|
- BigDecimal chainRatio = new BigDecimal("0.00");
|
|
|
+ private void computeCompareTotalPrice(StatisticsResultVO resultVO, StatisticsByOrderVO currentWeek, StatisticsByOrderVO lastWeek) {
|
|
|
Integer flag = 1;
|
|
|
- if (waitingAmount.compareTo(new BigDecimal("0.00")) == 0
|
|
|
- && lastWaitingAmount.compareTo(new BigDecimal("0.00")) == 0) {
|
|
|
+ BigDecimal chainRatio = new BigDecimal("0.00");
|
|
|
+ if (currentWeek.getTotalPrice().compareTo(new BigDecimal("0.00")) == 0
|
|
|
+ && lastWeek.getTotalPrice().compareTo(new BigDecimal("0.00")) == 0) {
|
|
|
chainRatio = new BigDecimal("0.00");
|
|
|
- } else if (waitingAmount.compareTo(new BigDecimal("0.00")) == 0) {
|
|
|
+ } else if (currentWeek.getTotalPrice().compareTo(new BigDecimal("0.00")) == 0) {
|
|
|
chainRatio = chainRatio.subtract(new BigDecimal("100.00"));
|
|
|
flag = 2;
|
|
|
- } else if (lastWaitingAmount.compareTo(new BigDecimal("0.00")) == 0) {
|
|
|
+ } else if (lastWeek.getTotalPrice().compareTo(new BigDecimal("0.00")) == 0) {
|
|
|
chainRatio = new BigDecimal("100.00").subtract(chainRatio);
|
|
|
} else {
|
|
|
- chainRatio = (waitingAmount.subtract(lastWaitingAmount)).divide(lastWaitingAmount, NumberConstant.SIX, BigDecimal.ROUND_HALF_UP)
|
|
|
+ chainRatio = (currentWeek.getTotalPrice().subtract(lastWeek.getTotalPrice())).divide(lastWeek.getTotalPrice(), NumberConstant.SIX, BigDecimal.ROUND_HALF_UP)
|
|
|
.multiply(new BigDecimal("100.00")).setScale(NumberConstant.TWO, BigDecimal.ROUND_HALF_UP);
|
|
|
}
|
|
|
if (chainRatio.compareTo(new BigDecimal("0.00")) == -1) {
|
|
|
flag = 2;
|
|
|
}
|
|
|
- vo.setFlag(flag);
|
|
|
- vo.setChainRatio(chainRatio.abs() + "%");
|
|
|
- httpResult.setData(vo);
|
|
|
- return httpResult;
|
|
|
+ StatisticsTotalPriceVO priceVO = new StatisticsTotalPriceVO();
|
|
|
+ priceVO.setTotalPrice(currentWeek.getTotalPrice());
|
|
|
+ priceVO.setChainRatio(chainRatio.abs() + "%");
|
|
|
+ priceVO.setFlag(flag);
|
|
|
+ priceVO.setLastTotalPrice(lastWeek.getTotalPrice());
|
|
|
+ resultVO.setTotalPriceVO(priceVO);
|
|
|
}
|
|
|
|
|
|
+ private void computeCompareAmount(StatisticsResultVO resultVO, StatisticsByOrderVO currentWeek, StatisticsByOrderVO lastWeek) {
|
|
|
+ Integer amountFlag = 1;
|
|
|
+ BigDecimal amountChainRatio = new BigDecimal("0.00");
|
|
|
+ if (currentWeek.getAmount().compareTo(new BigDecimal("0.00")) == 0
|
|
|
+ && lastWeek.getAmount().compareTo(new BigDecimal("0.00")) == 0) {
|
|
|
+ amountChainRatio = new BigDecimal("0.00");
|
|
|
+ } else if (currentWeek.getAmount().compareTo(new BigDecimal("0.00")) == 0) {
|
|
|
+ amountChainRatio = amountChainRatio.subtract(new BigDecimal("100.00"));
|
|
|
+ amountFlag = 2;
|
|
|
+ } else if (lastWeek.getAmount().compareTo(new BigDecimal("0.00")) == 0) {
|
|
|
+ amountChainRatio = new BigDecimal("100.00").subtract(amountChainRatio);
|
|
|
+ } else {
|
|
|
+ amountChainRatio = (currentWeek.getAmount().subtract(lastWeek.getAmount())).divide(lastWeek.getAmount(), NumberConstant.SIX, BigDecimal.ROUND_HALF_UP)
|
|
|
+ .multiply(new BigDecimal("100.00")).setScale(NumberConstant.TWO, BigDecimal.ROUND_HALF_UP);
|
|
|
+ }
|
|
|
+ if (amountChainRatio.compareTo(new BigDecimal("0.00")) == -1) {
|
|
|
+ amountFlag = 2;
|
|
|
+ }
|
|
|
|
|
|
+ /**承运量*/
|
|
|
+ StatisticsAmountVO amountVO = new StatisticsAmountVO();
|
|
|
+ amountVO.setAmount(currentWeek.getAmount());
|
|
|
+ amountVO.setChainRatio(amountChainRatio.abs() + "%");
|
|
|
+ amountVO.setFlag(amountFlag);
|
|
|
+ amountVO.setLastAmount(lastWeek.getAmount());
|
|
|
+ resultVO.setAmountVO(amountVO);
|
|
|
+ }
|
|
|
+ private void computeCompareWaitingAmount(StatisticsResultVO resultVO,StatisticsByOrderVO currentWeek,StatisticsByOrderVO lastWeek) {
|
|
|
+ Integer flag = 1;
|
|
|
+ BigDecimal chainRatio = new BigDecimal("0.00");
|
|
|
+ if (currentWeek.getWaitingAmount().compareTo(new BigDecimal("0.00")) == 0
|
|
|
+ && lastWeek.getWaitingAmount().compareTo(new BigDecimal("0.00")) == 0) {
|
|
|
+ chainRatio = new BigDecimal("0.00");
|
|
|
+ } else if (currentWeek.getWaitingAmount().compareTo(new BigDecimal("0.00")) == 0) {
|
|
|
+ chainRatio = chainRatio.subtract(new BigDecimal("100.00"));
|
|
|
+ flag = 2;
|
|
|
+ } else if (lastWeek.getWaitingAmount().compareTo(new BigDecimal("0.00")) == 0) {
|
|
|
+ chainRatio = new BigDecimal("100.00").subtract(chainRatio);
|
|
|
+ } else {
|
|
|
+ chainRatio = (currentWeek.getWaitingAmount().subtract(lastWeek.getWaitingAmount())).divide(lastWeek.getWaitingAmount(), NumberConstant.SIX, BigDecimal.ROUND_HALF_UP)
|
|
|
+ .multiply(new BigDecimal("100.00")).setScale(NumberConstant.TWO, BigDecimal.ROUND_HALF_UP);
|
|
|
+ }
|
|
|
+ if (chainRatio.compareTo(new BigDecimal("0.00")) == -1) {
|
|
|
+ flag = 2;
|
|
|
+ }
|
|
|
+ /**待分配量*/
|
|
|
+ StatisticsWaitingAmountVO waitingAmountVO = new StatisticsWaitingAmountVO();
|
|
|
+ waitingAmountVO.setWaitingAmount(currentWeek.getWaitingAmount());
|
|
|
+ waitingAmountVO.setChainRatio(chainRatio.abs() + "%");
|
|
|
+ waitingAmountVO.setFlag(flag);
|
|
|
+ waitingAmountVO.setLastWaitingAmount(lastWeek.getWaitingAmount());
|
|
|
+ resultVO.setWaitingAmountVO(waitingAmountVO);
|
|
|
+ }
|
|
|
/**
|
|
|
* 工作台-物流运输数据统计
|
|
|
*
|