|
@@ -24,6 +24,7 @@ import com.sckw.transport.model.dto.*;
|
|
|
import com.sckw.transport.model.vo.*;
|
|
import com.sckw.transport.model.vo.*;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.apache.dubbo.config.annotation.DubboReference;
|
|
import org.apache.dubbo.config.annotation.DubboReference;
|
|
|
|
|
+import org.apache.poi.hpsf.Decimal;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.data.domain.PageRequest;
|
|
import org.springframework.data.domain.PageRequest;
|
|
|
import org.springframework.data.domain.Sort;
|
|
import org.springframework.data.domain.Sort;
|
|
@@ -317,9 +318,9 @@ public class WaybillManagementService {
|
|
|
if (statusVO.getCode().equals(kwtWaybillOrderTrack.getStatus())) {
|
|
if (statusVO.getCode().equals(kwtWaybillOrderTrack.getStatus())) {
|
|
|
statusVO.setStatus(true);
|
|
statusVO.setStatus(true);
|
|
|
statusVO.setId(kwtWaybillOrderTrack.getId());
|
|
statusVO.setId(kwtWaybillOrderTrack.getId());
|
|
|
- statusVO.setCreateTime(DateUtil.getDateTime(kwtWaybillOrderTrack.getCreateTime()));
|
|
|
|
|
|
|
+ statusVO.setCreateTime(DateUtil.getDateTime(kwtWaybillOrderTrack.getCreateTime()).substring(0, 15));
|
|
|
statusVO.setOperateTime(kwtWaybillOrderTrack.getOperateTime() == null
|
|
statusVO.setOperateTime(kwtWaybillOrderTrack.getOperateTime() == null
|
|
|
- ? null : DateUtil.getDateTime(kwtWaybillOrderTrack.getOperateTime()));
|
|
|
|
|
|
|
+ ? null : DateUtil.getDateTime(kwtWaybillOrderTrack.getOperateTime()).substring(0, 15));
|
|
|
statusVO.setCreateByName(usersMap.get(kwtWaybillOrderTrack.getCreateBy()) == null
|
|
statusVO.setCreateByName(usersMap.get(kwtWaybillOrderTrack.getCreateBy()) == null
|
|
|
? null : usersMap.get(kwtWaybillOrderTrack.getCreateBy()).getName());
|
|
? null : usersMap.get(kwtWaybillOrderTrack.getCreateBy()).getName());
|
|
|
break;
|
|
break;
|
|
@@ -769,6 +770,86 @@ public class WaybillManagementService {
|
|
|
return HttpResult.ok(_list);
|
|
return HttpResult.ok(_list);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * app 运单分类统计数据 [运输中|已完成] - mongo查询
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param keyword
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ public HttpResult waybillStatisticCountApp(String keyword, String startDate, String endDate) {
|
|
|
|
|
+ Long entId = LoginUserHolder.getEntId();
|
|
|
|
|
+ if (StringUtils.isNotBlank(startDate)) {
|
|
|
|
|
+ startDate = StringTimeUtil.fillStart(startDate);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (StringUtils.isNotBlank(endDate)) {
|
|
|
|
|
+ endDate = StringTimeUtil.fillEnd(endDate);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ Criteria criteria = new Criteria();
|
|
|
|
|
+ criteria.and("entId").is(entId);
|
|
|
|
|
+ criteria.and("delFlag").is(NumberConstant.ZERO);
|
|
|
|
|
+ // 多条件模糊查询
|
|
|
|
|
+ List<Criteria> orCriteria = new ArrayList<>();
|
|
|
|
|
+ if (StringUtils.isNotBlank(keyword)) {
|
|
|
|
|
+ Pattern pattern = Pattern.compile("^.*" + keyword + ".*$", Pattern.CASE_INSENSITIVE);
|
|
|
|
|
+ orCriteria.add(Criteria.where("wOrderNo").regex(pattern));
|
|
|
|
|
+ orCriteria.add(Criteria.where("truckNo").regex(pattern));
|
|
|
|
|
+ orCriteria.add(Criteria.where("driverName").regex(pattern));
|
|
|
|
|
+ orCriteria.add(Criteria.where("driverPhone").regex(pattern));
|
|
|
|
|
+ orCriteria.add(Criteria.where("firmName").regex(pattern));
|
|
|
|
|
+ criteria.orOperator(orCriteria);
|
|
|
|
|
+ }
|
|
|
|
|
+ // in查询
|
|
|
|
|
+ List<Long> onWayStates = getWallBillStatues("onway");
|
|
|
|
|
+ List<Long> finishStates = getWallBillStatues("finish");
|
|
|
|
|
+ List<Long> statuses = new ArrayList<Long>();
|
|
|
|
|
+ statuses.addAll(onWayStates);
|
|
|
|
|
+ statuses.addAll(finishStates);
|
|
|
|
|
+ if (CollectionUtils.isNotEmpty(statuses)) {
|
|
|
|
|
+ criteria.and("status").in(statuses);
|
|
|
|
|
+ }
|
|
|
|
|
+ // 查询时间段
|
|
|
|
|
+ if (!StringUtils.isEmpty(startDate) && !StringUtils.isEmpty(endDate)) {
|
|
|
|
|
+ criteria.and("updateTime")
|
|
|
|
|
+ .gte(DateUtil.strDateTimeToDateTime(startDate))
|
|
|
|
|
+ .lte(DateUtil.strDateTimeToDateTime(endDate));
|
|
|
|
|
+ }
|
|
|
|
|
+ Aggregation aggregation = Aggregation.newAggregation(
|
|
|
|
|
+ Aggregation.match(criteria),
|
|
|
|
|
+ Aggregation.group("status").count().as("total"),
|
|
|
|
|
+ Aggregation.project("total").and("value").previousOperation()
|
|
|
|
|
+ );
|
|
|
|
|
+ AggregationResults<TableTops> outputTypeCount = mongoTemplate.aggregate(aggregation, SckwWaybillOrder.class, TableTops.class);
|
|
|
|
|
+ List<TableTops> results = outputTypeCount.getMappedResults();
|
|
|
|
|
+ Map<String, String> _onway = new HashMap<>(Global.NUMERICAL_SIXTEEN);
|
|
|
|
|
+ _onway.put("name", "运输中");
|
|
|
|
|
+ _onway.put("value", "onway");
|
|
|
|
|
+ _onway.put("total", "0");
|
|
|
|
|
+
|
|
|
|
|
+ Map<String, String> _finish = new HashMap<>(Global.NUMERICAL_SIXTEEN);
|
|
|
|
|
+ _finish.put("name", "已完成");
|
|
|
|
|
+ _finish.put("value", "finish");
|
|
|
|
|
+ _finish.put("total", "0");
|
|
|
|
|
+ long wayCount = 0L;
|
|
|
|
|
+ long finishCount = 0L;
|
|
|
|
|
+ if (CollectionUtils.isNotEmpty(results)) {
|
|
|
|
|
+ for (TableTops tableTops:results) {
|
|
|
|
|
+ if (onWayStates.contains(Long.parseLong(tableTops.getValue()))){
|
|
|
|
|
+ wayCount += tableTops.getTotal().longValue();
|
|
|
|
|
+ }
|
|
|
|
|
+ if (finishStates.contains(Long.parseLong(tableTops.getValue()))){
|
|
|
|
|
+ finishCount += tableTops.getTotal().longValue();
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ _onway.put("total", String.valueOf(wayCount));
|
|
|
|
|
+ _finish.put("total", String.valueOf(finishCount));
|
|
|
|
|
+ List<Map<String, String>> _list = new ArrayList<>();
|
|
|
|
|
+ _list.add(_onway);
|
|
|
|
|
+ _list.add(_finish);
|
|
|
|
|
+ return HttpResult.ok(_list);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* app 运单列表 [运输中|已完成]
|
|
* app 运单列表 [运输中|已完成]
|
|
|
*
|
|
*
|
|
@@ -929,6 +1010,75 @@ public class WaybillManagementService {
|
|
|
return HttpResult.ok(amount);
|
|
return HttpResult.ok(amount);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * app 运单分类吨量统计数据 [运输中|已完成] - mongo
|
|
|
|
|
+ *
|
|
|
|
|
+ * @param query
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ public HttpResult waybillAmountStatisticCount(WaybillListAppDTO query) {
|
|
|
|
|
+ Long entId = LoginUserHolder.getEntId();
|
|
|
|
|
+ Criteria criteria = new Criteria();
|
|
|
|
|
+ criteria.and("entId").is(entId);
|
|
|
|
|
+ criteria.and("delFlag").is(NumberConstant.ZERO);
|
|
|
|
|
+ // 多条件模糊查询
|
|
|
|
|
+ List<Criteria> orCriteria = new ArrayList<>();
|
|
|
|
|
+ if (StringUtils.isNotBlank(query.getKeyword())) {
|
|
|
|
|
+ Pattern pattern = Pattern.compile("^.*" + query.getKeyword() + ".*$", Pattern.CASE_INSENSITIVE);
|
|
|
|
|
+ orCriteria.add(Criteria.where("wOrderNo").regex(pattern));
|
|
|
|
|
+ orCriteria.add(Criteria.where("truckNo").regex(pattern));
|
|
|
|
|
+ orCriteria.add(Criteria.where("driverName").regex(pattern));
|
|
|
|
|
+ orCriteria.add(Criteria.where("driverPhone").regex(pattern));
|
|
|
|
|
+ orCriteria.add(Criteria.where("firmName").regex(pattern));
|
|
|
|
|
+ criteria.orOperator(orCriteria);
|
|
|
|
|
+ }
|
|
|
|
|
+ // in查询
|
|
|
|
|
+ List<Long> finishStates = getWallBillStatues("finish");
|
|
|
|
|
+ if (CollectionUtils.isNotEmpty(finishStates)) {
|
|
|
|
|
+ criteria.and("status").in(finishStates);
|
|
|
|
|
+ }
|
|
|
|
|
+ // 查询时间段
|
|
|
|
|
+ if (!StringUtils.isEmpty(query.getStartDate()) && !StringUtils.isEmpty(query.getEndDate())) {
|
|
|
|
|
+ criteria.and("updateTime")
|
|
|
|
|
+ .gte(DateUtil.strDateTimeToDateTime(StringTimeUtil.fillStart(query.getStartDate())))
|
|
|
|
|
+ .lte(DateUtil.strDateTimeToDateTime(StringTimeUtil.fillStart(query.getEndDate())));
|
|
|
|
|
+ }
|
|
|
|
|
+ Query queryFormat = new Query(criteria);
|
|
|
|
|
+ List<SckwWaybillOrder> list = mongoTemplate.find(queryFormat, SckwWaybillOrder.class);
|
|
|
|
|
+ int total = 0;
|
|
|
|
|
+ BigDecimal loadAmount = new BigDecimal(Global.AMOUNT);
|
|
|
|
|
+ BigDecimal unloadAmount = new BigDecimal(Global.AMOUNT);
|
|
|
|
|
+ BigDecimal lossAmount = new BigDecimal(Global.AMOUNT);
|
|
|
|
|
+ BigDecimal deficitRealAmount = new BigDecimal(Global.AMOUNT);
|
|
|
|
|
+ if (CollectionUtils.isNotEmpty(list)) {
|
|
|
|
|
+ for (SckwWaybillOrder wOrder:list) {
|
|
|
|
|
+ total += 1;
|
|
|
|
|
+ loadAmount = loadAmount.add(wOrder.getLoadAmount() == null ? new BigDecimal(Global.AMOUNT) : wOrder.getLoadAmount());
|
|
|
|
|
+ unloadAmount = unloadAmount.add(wOrder.getUnloadAmount() == null ? new BigDecimal(Global.AMOUNT) : wOrder.getUnloadAmount());
|
|
|
|
|
+ lossAmount = lossAmount.add(wOrder.getDeficitAmount() == null ? new BigDecimal(Global.AMOUNT) : wOrder.getDeficitAmount());
|
|
|
|
|
+ BigDecimal _deficitRealAmount = commonService.deficitLossAmount(
|
|
|
|
|
+ wOrder.getLoadAmount(),
|
|
|
|
|
+ wOrder.getDeficitAmount(),
|
|
|
|
|
+ wOrder.getLoss(),
|
|
|
|
|
+ wOrder.getLossUnit()
|
|
|
|
|
+ );
|
|
|
|
|
+ deficitRealAmount.add(_deficitRealAmount);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ Map<String, String> amount = new HashMap<>(Global.NUMERICAL_SIXTEEN);
|
|
|
|
|
+ // 总计条数
|
|
|
|
|
+ amount.put("total", String.valueOf(total));
|
|
|
|
|
+ // 总计装货量
|
|
|
|
|
+ amount.put("loadAmount", String.valueOf(loadAmount));
|
|
|
|
|
+ // 总计卸货量
|
|
|
|
|
+ amount.put("unloadAmount", String.valueOf(unloadAmount));
|
|
|
|
|
+ // 总计货损量
|
|
|
|
|
+ amount.put("lossAmount", String.valueOf(lossAmount));
|
|
|
|
|
+ // 总计扣亏量
|
|
|
|
|
+ amount.put("deficitRealAmount", String.valueOf(deficitRealAmount));
|
|
|
|
|
+ return HttpResult.ok(amount);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 获取 [运输中|已完成] 状态列表
|
|
* 获取 [运输中|已完成] 状态列表
|
|
|
*
|
|
*
|