|
|
@@ -1,7 +1,9 @@
|
|
|
package com.sckw.report.service;
|
|
|
|
|
|
import com.sckw.core.common.enums.NumberConstant;
|
|
|
+import com.sckw.core.common.enums.enums.DictTypeEnum;
|
|
|
import com.sckw.core.model.enums.CarWaybillEnum;
|
|
|
+import com.sckw.core.model.enums.LogisticsOrderEnum;
|
|
|
import com.sckw.core.model.page.PageResult;
|
|
|
import com.sckw.core.utils.CollectionUtils;
|
|
|
import com.sckw.core.utils.StringUtils;
|
|
|
@@ -16,6 +18,8 @@ import com.sckw.report.dao.SckwLogisticsOrderRepository;
|
|
|
import com.sckw.report.service.param.WaybillOrderQuery;
|
|
|
import com.sckw.report.service.vo.CarWaybillVo;
|
|
|
import com.sckw.report.service.vo.WaybillsCountVo;
|
|
|
+import com.sckw.system.api.RemoteSystemService;
|
|
|
+import com.sckw.system.api.model.dto.res.SysDictResDto;
|
|
|
import com.sckw.transport.api.dubbo.TransportDubboService;
|
|
|
import com.sckw.transport.api.model.dto.vo.KwtLogisticsOrderVO;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
@@ -33,6 +37,8 @@ import org.springframework.stereotype.Service;
|
|
|
import java.text.ParseException;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+import java.util.Objects;
|
|
|
import java.util.regex.Pattern;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
@@ -54,13 +60,16 @@ public class KwTransportService {
|
|
|
@DubboReference(version = "2.0.0", group = "design", check = false)
|
|
|
TransportDubboService transportDubboService;
|
|
|
|
|
|
+ @DubboReference(version = "2.0.0", group = "design", check = false)
|
|
|
+ RemoteSystemService remoteSystemService;
|
|
|
+
|
|
|
/**
|
|
|
* @param sourceList 源数据 [1,2,3]
|
|
|
* @param targetList 目标数据 [1]
|
|
|
* @Description: 获取targetList中在sourceList中不存在的项
|
|
|
* @return: List<String> [2,3]
|
|
|
*/
|
|
|
- public List<String> getDiffrentList(List<String> sourceList, List<String> targetList) {
|
|
|
+ public List<String> getDiffrentList(List<String> sourceList, List<String> targetList) {
|
|
|
return targetList.stream().filter(item -> sourceList.stream().allMatch(each -> !item.equals(each))).collect(Collectors.toList());
|
|
|
}
|
|
|
|
|
|
@@ -83,6 +92,7 @@ public class KwTransportService {
|
|
|
|
|
|
/**
|
|
|
* 司机端 运单详情页面-【作废】
|
|
|
+ *
|
|
|
* @param id
|
|
|
* @param type
|
|
|
* @return
|
|
|
@@ -164,7 +174,8 @@ public class KwTransportService {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 构造运单关联查询条件
|
|
|
+ * 构造运单关联查询条件
|
|
|
+ *
|
|
|
* @param query
|
|
|
* @return
|
|
|
*/
|
|
|
@@ -179,7 +190,7 @@ public class KwTransportService {
|
|
|
|
|
|
if (StringUtils.isNotBlank(query.getStatus())) {
|
|
|
// TODO 此处需要修改
|
|
|
- if(query.getStatus().equals(String.valueOf(NumberConstant.ONE_ZERO_ZERO))) {
|
|
|
+ if (query.getStatus().equals(String.valueOf(NumberConstant.ONE_ZERO_ZERO))) {
|
|
|
List<Long> statuses = new ArrayList<>();
|
|
|
statuses.add(CarWaybillEnum.REJECT_ORDER.getCode().longValue());
|
|
|
statuses.add(CarWaybillEnum.REFUSE_TRAFFIC.getCode().longValue());
|
|
|
@@ -227,7 +238,7 @@ public class KwTransportService {
|
|
|
* @author jc
|
|
|
* @date 2023/07/21
|
|
|
*/
|
|
|
- public HttpResult getWayBillStatistics(WaybillOrderQuery query){
|
|
|
+ public HttpResult getWayBillStatistics(WaybillOrderQuery query) {
|
|
|
Criteria criteria = buildWaybillOrdersQuery(query);
|
|
|
Aggregation aggregation = Aggregation.newAggregation(
|
|
|
Aggregation.match(criteria),
|
|
|
@@ -262,7 +273,7 @@ public class KwTransportService {
|
|
|
for (TableTops result : results) {
|
|
|
if (StringUtils.isNotEmpty(result.getValue())
|
|
|
&& String.valueOf(result.getValue()).equals(String.valueOf(status.getCode()))) {
|
|
|
- if(expiredFlag) {
|
|
|
+ if (expiredFlag) {
|
|
|
topExpired.setTotal(topExpired.getTotal() + result.getTotal());
|
|
|
} else {
|
|
|
top.setTotal(result.getTotal());
|
|
|
@@ -271,7 +282,7 @@ public class KwTransportService {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- if(!expiredFlag) {
|
|
|
+ if (!expiredFlag) {
|
|
|
list.add(top);
|
|
|
}
|
|
|
}
|
|
|
@@ -290,7 +301,7 @@ public class KwTransportService {
|
|
|
* @author jc
|
|
|
* @date 2023/07/21
|
|
|
*/
|
|
|
- public HttpResult wayBillTotalCount(WaybillOrderQuery query){
|
|
|
+ public HttpResult wayBillTotalCount(WaybillOrderQuery query) {
|
|
|
// 统计项字段
|
|
|
Criteria criteria = buildWaybillOrdersQuery(query);
|
|
|
Aggregation aggregation = Aggregation.newAggregation(
|
|
|
@@ -308,6 +319,7 @@ public class KwTransportService {
|
|
|
|
|
|
/**
|
|
|
* 运单处理运单查询结果
|
|
|
+ *
|
|
|
* @param list
|
|
|
* @param returnList
|
|
|
*/
|
|
|
@@ -338,21 +350,22 @@ public class KwTransportService {
|
|
|
vo.setLoadTime(waybillOrder.getLoadTime() == null ?
|
|
|
null : DateUtil.getDateTime(waybillOrder.getLoadTime()));
|
|
|
vo.setUnloadTime(waybillOrder.getUnloadTime() == null ?
|
|
|
- null :DateUtil.getDateTime(waybillOrder.getUnloadTime()));
|
|
|
+ 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()));
|
|
|
+ null : DateUtil.getDateTime(waybillOrder.getUpdateTime()));
|
|
|
vo.setDeficitAmount(waybillOrder.getDeficitAmount() == null ?
|
|
|
- null :String.valueOf(waybillOrder.getDeficitAmount()));
|
|
|
+ null : String.valueOf(waybillOrder.getDeficitAmount()));
|
|
|
vo.setGoodsPriceUnit(waybillOrder.getGoodsPriceUnit() == null ?
|
|
|
- null :String.valueOf(waybillOrder.getGoodsPriceUnit()));
|
|
|
+ null : String.valueOf(waybillOrder.getGoodsPriceUnit()));
|
|
|
returnList.add(vo);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 承运订单-分包托运列表数据展示
|
|
|
+ *
|
|
|
* @param lOrderId
|
|
|
* @param page
|
|
|
* @param pageSize
|
|
|
@@ -391,4 +404,54 @@ public class KwTransportService {
|
|
|
// }
|
|
|
return null;
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 托运合同-根据合同id获取托运订单列表
|
|
|
+ *
|
|
|
+ * @param contractId 合同id
|
|
|
+ * @param page 当前页
|
|
|
+ * @param pageSize 每页条数
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public HttpResult getLogisticsOrderByContractId(String contractId, int page, int pageSize) {
|
|
|
+ //模糊匹配
|
|
|
+ //根据条件查询所有并排序,且分页
|
|
|
+ //设置模糊查询匹配规则 忽略大小写
|
|
|
+ // 创建条件对象
|
|
|
+ Criteria criteria = new Criteria();
|
|
|
+ // 1. 全等于
|
|
|
+ if (StringUtils.isBlank(contractId)){
|
|
|
+ return HttpResult.error("合同id为空");
|
|
|
+ }else {
|
|
|
+ criteria.and("contractId").is(contractId);
|
|
|
+ }
|
|
|
+ criteria.and("delFlag").is(String.valueOf(NumberConstant.ZERO));
|
|
|
+ Query query1 = new Query(criteria);
|
|
|
+ // 12. 总记录数
|
|
|
+ long total = mongoTemplate.count(query1, SckwLogisticsOrder.class);
|
|
|
+ // 10. 分页
|
|
|
+ query1.with(PageRequest.of(page - 1, pageSize, Sort.by(Sort.Order.desc("createTime"))));
|
|
|
+ // 执行查询
|
|
|
+ List<SckwLogisticsOrder> list = mongoTemplate.find(query1, SckwLogisticsOrder.class);
|
|
|
+ //字典等数据转换
|
|
|
+ //计费方式
|
|
|
+ Map<String, SysDictResDto> chargingType = remoteSystemService.queryDictMapByType(DictTypeEnum.CHARGING_TYPE.getType());
|
|
|
+ //结算周期
|
|
|
+ Map<String, SysDictResDto> settlementCycle = remoteSystemService.queryDictMapByType(DictTypeEnum.SETTLEMENT_CYCLE.getType());
|
|
|
+ for (SckwLogisticsOrder logisticsOrder : list) {
|
|
|
+ Long settlementCycle1 = logisticsOrder.getSettlementCycle();
|
|
|
+ String billingMode = logisticsOrder.getBillingMode();
|
|
|
+ SysDictResDto sysDictResDto = chargingType.get(String.valueOf(settlementCycle1));
|
|
|
+ SysDictResDto sysDictResDto1 = settlementCycle.get(String.valueOf(billingMode));
|
|
|
+ if (Objects.nonNull(sysDictResDto)) {
|
|
|
+ logisticsOrder.setSettlementCycleLabel(sysDictResDto.getLabel());
|
|
|
+ }
|
|
|
+ if (Objects.nonNull(sysDictResDto1)) {
|
|
|
+ logisticsOrder.setBillingModeLabel(sysDictResDto1.getLabel());
|
|
|
+ }
|
|
|
+ logisticsOrder.setStatusLabel(LogisticsOrderEnum.getDestination(logisticsOrder.getStatus()));
|
|
|
+ }
|
|
|
+ PageResult build = PageResult.build(page, pageSize, total, list);
|
|
|
+ return HttpResult.ok(build);
|
|
|
+ }
|
|
|
}
|