|
|
@@ -301,6 +301,17 @@ public class WaybillManagementService {
|
|
|
// 执行查询
|
|
|
List<SckwWaybillOrder> list = mongoTemplate.find(queryFormat, SckwWaybillOrder.class);
|
|
|
List<WaybillBoardListVO> orders = new ArrayList<>();
|
|
|
+ packageWaybillIndexResult(list, statusVOS, orders);
|
|
|
+ PageResult build = PageResult.build(query.getPage(), query.getPageSize(), total, orders);
|
|
|
+ return HttpResult.ok(build);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public void packageWaybillIndexResult(List<SckwWaybillOrder> list, List<WaybillStatusVO> statusVOS, List<WaybillBoardListVO> returnList) {
|
|
|
+ // 执行查询
|
|
|
for (SckwWaybillOrder sckwWaybillOrder:list) {
|
|
|
WaybillBoardListVO waybillBoardListVO = new WaybillBoardListVO();
|
|
|
waybillBoardListVO.setWOrderId(String.valueOf(sckwWaybillOrder.getWOrderId()));
|
|
|
@@ -356,11 +367,8 @@ public class WaybillManagementService {
|
|
|
});
|
|
|
});
|
|
|
}
|
|
|
- orders.add(waybillBoardListVO);
|
|
|
+ returnList.add(waybillBoardListVO);
|
|
|
}
|
|
|
-
|
|
|
- PageResult build = PageResult.build(query.getPage(), query.getPageSize(), total, orders);
|
|
|
- return HttpResult.ok(build);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -506,15 +514,25 @@ public class WaybillManagementService {
|
|
|
public HttpResult waybillDataStatisticApp(String keyword){
|
|
|
Long entId = LoginUserHolder.getEntId();
|
|
|
// 运输途中
|
|
|
+ Map<String, String> _onway = new HashMap<>();
|
|
|
+ _onway.put("name", "运输中");
|
|
|
+ _onway.put("value", "onway");
|
|
|
+ _onway.put("total", "0");
|
|
|
List<Integer> onWayStates = getWallBillStatues("onway");
|
|
|
Long onWayCount = kwtWaybillOrderMapper.selectWaybillOrderCountByStatus(entId, onWayStates, keyword);
|
|
|
+ _onway.put("total", onWayCount.toString());
|
|
|
// 已完成
|
|
|
+ Map<String, String> _finish = new HashMap<>();
|
|
|
+ _finish.put("name", "已完成");
|
|
|
+ _finish.put("value", "finish");
|
|
|
+ _finish.put("total", "0");
|
|
|
List<Integer> finishStates = getWallBillStatues("finish");
|
|
|
Long finishCount = kwtWaybillOrderMapper.selectWaybillOrderCountByStatus(entId, finishStates, keyword);
|
|
|
- Map<String, Long> statistic = new HashMap<>();
|
|
|
- statistic.put("onway", onWayCount);
|
|
|
- statistic.put("finish", finishCount);
|
|
|
- return HttpResult.ok(statistic);
|
|
|
+ _onway.put("total", finishCount.toString());
|
|
|
+ List<Map<String, String>> _list = new ArrayList<>();
|
|
|
+ _list.add(_onway);
|
|
|
+ _list.add(_finish);
|
|
|
+ return HttpResult.ok(_list);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -548,84 +566,22 @@ public class WaybillManagementService {
|
|
|
Sort.by(Sort.Order.desc("createTime"))));
|
|
|
// 执行查询
|
|
|
List<SckwWaybillOrder> list = mongoTemplate.find(queryFormat, SckwWaybillOrder.class);
|
|
|
- List<CarWaybillAppVo> returnList = new ArrayList<>();
|
|
|
+ List<WaybillBoardListVO> returnList = new ArrayList<>();
|
|
|
if (CollectionUtils.isNotEmpty(list)) {
|
|
|
- packageWayBillReturnList(list, returnList);
|
|
|
+ List<WaybillStatusVO> statusVOS = new ArrayList();
|
|
|
+ _statuses.forEach(e -> {
|
|
|
+ WaybillStatusVO waybillStatusVO = new WaybillStatusVO();
|
|
|
+ waybillStatusVO.setStatus(false);
|
|
|
+ waybillStatusVO.setCode(e);
|
|
|
+ waybillStatusVO.setDestination(CarWaybillEnum.getName(e));
|
|
|
+ statusVOS.add(waybillStatusVO);
|
|
|
+ });
|
|
|
+ packageWaybillIndexResult(list, statusVOS, returnList);
|
|
|
}
|
|
|
PageResult build = PageResult.build(page, pageSize, total, returnList);
|
|
|
return HttpResult.ok(build);
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 运单处理运单查询结果
|
|
|
- *
|
|
|
- * @param list
|
|
|
- * @param returnList
|
|
|
- */
|
|
|
- private void packageWayBillReturnList(List<SckwWaybillOrder> list, List<CarWaybillAppVo> returnList) {
|
|
|
- for (SckwWaybillOrder waybillOrder : list) {
|
|
|
- CarWaybillAppVo vo = new CarWaybillAppVo();
|
|
|
- vo.setWOrderNo(waybillOrder.getWOrderNo() == null ?
|
|
|
- null : String.valueOf(waybillOrder.getWOrderNo()));
|
|
|
- vo.setWOrderId(waybillOrder.getWOrderId() == null ?
|
|
|
- String.valueOf(waybillOrder.get_id()) : String.valueOf(waybillOrder.getWOrderId()));
|
|
|
- vo.setTruckNo(waybillOrder.getTruckNo());
|
|
|
- vo.setDriverName(waybillOrder.getDriverName() == null ?
|
|
|
- null : String.valueOf(waybillOrder.getDriverName()));
|
|
|
- vo.setType(String.valueOf(waybillOrder.getType()));
|
|
|
- String typeString = "";
|
|
|
- if (waybillOrder.getType().equals(NumberConstant.ONE)) {
|
|
|
- typeString = "趟次";
|
|
|
- }
|
|
|
- if (waybillOrder.getType().equals(NumberConstant.TWO)) {
|
|
|
- typeString = "循环";
|
|
|
- }
|
|
|
- vo.setTypeLabel(typeString);
|
|
|
- vo.setStatus(waybillOrder.getStatus() == null ?
|
|
|
- null : String.valueOf(waybillOrder.getStatus()));
|
|
|
- vo.setStatusLabel(CarWaybillEnum.getName(waybillOrder.getStatus()));
|
|
|
- vo.setSendCarTime(waybillOrder.getCreateTime() == null ?
|
|
|
- null : DateUtil.getDateTime(waybillOrder.getCreateTime()));
|
|
|
- vo.setStartTime(waybillOrder.getStartTime() == null ?
|
|
|
- null : waybillOrder.getStartTime());
|
|
|
- vo.setEndTime(waybillOrder.getEndTime() == null ?
|
|
|
- null : waybillOrder.getEndTime());
|
|
|
- vo.setEntrustAmount(String.valueOf(waybillOrder.getEntrustAmount()));
|
|
|
- vo.setLoadName(waybillOrder.getLoadName() == null ?
|
|
|
- null : waybillOrder.getLoadName());
|
|
|
- vo.setLoadAddress((waybillOrder.getLoadCityName() == null ? "" : waybillOrder.getLoadCityName())
|
|
|
- .concat(waybillOrder.getLoadDetailAddress() == null ? "" : waybillOrder.getLoadDetailAddress()));
|
|
|
- vo.setUnloadName(waybillOrder.getUnloadName() == null ?
|
|
|
- null : waybillOrder.getUnloadName());
|
|
|
- vo.setUnloadAddress((waybillOrder.getUnloadCityName() == null ? "" : waybillOrder.getUnloadCityName())
|
|
|
- .concat(waybillOrder.getUnloadDetailAddress() == null ? "" : waybillOrder.getUnloadDetailAddress()));
|
|
|
- vo.setLoadAmount(waybillOrder.getLoadAmount() == null ?
|
|
|
- null : String.valueOf(waybillOrder.getLoadAmount()));
|
|
|
- vo.setUnloadAmount(waybillOrder.getUnloadAmount() == null ?
|
|
|
- null : String.valueOf(waybillOrder.getUnloadAmount()));
|
|
|
- vo.setLoadDateTime(waybillOrder.getLoadTime() == null ?
|
|
|
- null : DateUtil.getDateTime(waybillOrder.getLoadTime()));
|
|
|
- vo.setUnloadDateTime(waybillOrder.getUnloadTime() == null ?
|
|
|
- null : DateUtil.getDateTime(waybillOrder.getUnloadTime()));
|
|
|
- vo.setCreateTime(waybillOrder.getCreateTime() == null ?
|
|
|
- null : DateUtil.getDateTime(waybillOrder.getCreateTime()));
|
|
|
- vo.setUpdateTime(waybillOrder.getUpdateTime() == null ?
|
|
|
- null : DateUtil.getDateTime(waybillOrder.getUpdateTime()));
|
|
|
- vo.setDeficitAmount(waybillOrder.getDeficitAmount() == null ?
|
|
|
- null : String.valueOf(waybillOrder.getDeficitAmount()));
|
|
|
- BigDecimal deficitLoss = waybillOrder.getLoss() == null ? BigDecimal.valueOf(0) : waybillOrder.getLoss();
|
|
|
- BigDecimal deficitAmount = waybillOrder.getDeficitAmount() == null ? BigDecimal.valueOf(0) : waybillOrder.getDeficitAmount();
|
|
|
- BigDecimal deficitRealAmount = BigDecimal.valueOf(0);
|
|
|
- if(deficitAmount.compareTo(BigDecimal.valueOf(0)) > 0) {
|
|
|
- deficitRealAmount = deficitLoss.subtract(deficitAmount);
|
|
|
- }
|
|
|
- vo.setDeficitRealAmount(deficitRealAmount.toString());
|
|
|
- vo.setGoodsPriceUnit(waybillOrder.getGoodsPriceUnit() == null ?
|
|
|
- null : String.valueOf(waybillOrder.getGoodsPriceUnit()));
|
|
|
- returnList.add(vo);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* 获取 [运输中|已完成] 状态列表
|
|
|
* @param status
|