|
|
@@ -46,7 +46,9 @@ import com.sckw.system.api.model.dto.res.KwsUserResDto;
|
|
|
import com.sckw.system.api.model.dto.res.SysDictResDto;
|
|
|
import com.sckw.system.api.model.dto.res.UserCacheResDto;
|
|
|
import com.sckw.transport.api.dubbo.TransportRemoteService;
|
|
|
+import com.sckw.transport.api.model.vo.KwtLogisticsOrderVO;
|
|
|
import com.sckw.transport.api.model.vo.RWaybillSubOrderVo;
|
|
|
+import com.sckw.transport.api.model.vo.WayContaractbillOrderVo;
|
|
|
import jakarta.servlet.http.HttpServletResponse;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
@@ -1140,13 +1142,19 @@ public class KwcContractLogisticsService {
|
|
|
logTradeOrderIdAndWaybillMap = rWaybillSubOrderVos.stream()
|
|
|
.collect(Collectors.toMap(RWaybillSubOrderVo::getLogContractId, Function.identity(), (x, y) -> x));
|
|
|
}
|
|
|
-
|
|
|
+ List<WayContaractbillOrderVo> wayContaractbillOrderVos = transportRemoteService.queryLogisticContractByContTradeIds(contractIds);
|
|
|
+ Map<Long, WayContaractbillOrderVo> contractIdAndLogisticsOrderMap = Optional.ofNullable(wayContaractbillOrderVos)
|
|
|
+ .orElse(List.of())
|
|
|
+ .stream()
|
|
|
+ .collect(Collectors.toMap(WayContaractbillOrderVo::getContractId, Function.identity(), (x, y) -> x));
|
|
|
Map<Long, UserCacheResDto> finalLongUserCacheResDtoMap = longUserCacheResDtoMap;
|
|
|
Map<String, KwcContractLogisticsUnit> finalContractUniTypeAndUnitMap = contractUniTypeAndUnitMap;
|
|
|
Map<Long, List<KwcContractLogisticsGoods>> finalContractIdAndGoodsMap = contractIdAndGoodsMap;
|
|
|
Map<Long, RWaybillSubOrderVo> finalLogTradeOrderIdAndWaybillMap = logTradeOrderIdAndWaybillMap;
|
|
|
List<QueryLogisticListResp> resp = records.stream()
|
|
|
- .map(r -> getQueryLogisticListResp(r, finalContractUniTypeAndUnitMap, finalContractIdAndGoodsMap, finalLongUserCacheResDtoMap, finalLogTradeOrderIdAndWaybillMap))
|
|
|
+ .map(r -> getQueryLogisticListResp(r, finalContractUniTypeAndUnitMap,
|
|
|
+ finalContractIdAndGoodsMap, finalLongUserCacheResDtoMap, finalLogTradeOrderIdAndWaybillMap,
|
|
|
+ contractIdAndLogisticsOrderMap))
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
|
return PageDataResult.of(page, resp);
|
|
|
@@ -1157,7 +1165,8 @@ public class KwcContractLogisticsService {
|
|
|
Map<String, KwcContractLogisticsUnit> finalContractUniTypeAndUnitMap,
|
|
|
Map<Long, List<KwcContractLogisticsGoods>> finalContractIdAndGoodsMap,
|
|
|
Map<Long, UserCacheResDto> finalLongUserCacheResDtoMap,
|
|
|
- Map<Long, RWaybillSubOrderVo> logTradeOrderIdAndWaybillMap) {
|
|
|
+ Map<Long, RWaybillSubOrderVo> logTradeOrderIdAndWaybillMap,
|
|
|
+ Map<Long, WayContaractbillOrderVo> contractIdAndLogisticsOrderMap) {
|
|
|
QueryLogisticListResp queryLogisticListResp = new QueryLogisticListResp();
|
|
|
queryLogisticListResp.setId(r.getId());
|
|
|
queryLogisticListResp.setContractStatus(r.getStatus());
|
|
|
@@ -1183,8 +1192,7 @@ public class KwcContractLogisticsService {
|
|
|
//设置派车方式和派车方式描述字段
|
|
|
queryLogisticListResp.setDispatchWay(r.getDispatchWay());
|
|
|
queryLogisticListResp.setDispatchWayDesc(DispatchingTypeEnum.getLabel(r.getDispatchWay()));
|
|
|
- queryLogisticListResp.setPerformedAmount(Objects.nonNull(r.getPerformedAmount())
|
|
|
- ? r.getPerformedAmount().toPlainString() : null);
|
|
|
+
|
|
|
List<KwcContractLogisticsGoods> goods = finalContractIdAndGoodsMap.get(r.getId());
|
|
|
if (org.apache.commons.collections4.CollectionUtils.isNotEmpty(goods)){
|
|
|
boolean b = goods.stream().anyMatch(g -> Objects.isNull(g.getAmount()));
|
|
|
@@ -1202,25 +1210,64 @@ public class KwcContractLogisticsService {
|
|
|
RWaybillSubOrderVo waybillSubOrderVo = logTradeOrderIdAndWaybillMap.getOrDefault(r.getId(), new RWaybillSubOrderVo());
|
|
|
List<RWaybillSubOrderVo.BillSubOrder> subOrders = waybillSubOrderVo.getSubOrders();
|
|
|
BigDecimal totalTransportAmount = BigDecimal.ZERO;
|
|
|
- if (org.apache.commons.collections4.CollectionUtils.isNotEmpty(subOrders)){
|
|
|
- String billMode = subOrders.get(0).getBillMode();
|
|
|
- if (org.apache.commons.lang3.StringUtils.equals(billMode, DictEnum.LOAD_UNLOAD_WAY_1.getValue())){
|
|
|
- totalTransportAmount = subOrders.stream()
|
|
|
- .filter(x->Arrays.asList(CarWaybillV1Enum.COMPLETION_LOADING.getCode(),CarWaybillV1Enum.COMPLETED.getCode()).contains(x.getStatus()))
|
|
|
- .map(RWaybillSubOrderVo.BillSubOrder::getLoadAmount)
|
|
|
- .filter(Objects::nonNull)
|
|
|
- .reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
- }else {
|
|
|
- totalTransportAmount = subOrders.stream()
|
|
|
- .filter(x->Objects.equals(x.getStatus(), CarWaybillV1Enum.COMPLETED.getCode()))
|
|
|
- .map(RWaybillSubOrderVo.BillSubOrder::getUnloadAmount)
|
|
|
- .filter(Objects::nonNull)
|
|
|
- .reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ BigDecimal totalAmount = BigDecimal.ZERO;
|
|
|
+// BigDecimal performedAmount = BigDecimal.ZERO;
|
|
|
+// if (org.apache.commons.collections4.CollectionUtils.isNotEmpty(subOrders)){
|
|
|
+// String billMode = subOrders.get(0).getBillMode();
|
|
|
+// if (org.apache.commons.lang3.StringUtils.equals(billMode, DictEnum.LOAD_UNLOAD_WAY_1.getValue())){
|
|
|
+// totalTransportAmount = subOrders.stream()
|
|
|
+// .filter(x->Arrays.asList(CarWaybillV1Enum.COMPLETION_LOADING.getCode(),CarWaybillV1Enum.COMPLETED.getCode()).contains(x.getStatus()))
|
|
|
+// .map(RWaybillSubOrderVo.BillSubOrder::getLoadAmount)
|
|
|
+// .filter(Objects::nonNull)
|
|
|
+// .reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+// }else {
|
|
|
+// totalTransportAmount = subOrders.stream()
|
|
|
+// .filter(x->Objects.equals(x.getStatus(), CarWaybillV1Enum.COMPLETED.getCode()))
|
|
|
+// .map(RWaybillSubOrderVo.BillSubOrder::getUnloadAmount)
|
|
|
+// .filter(Objects::nonNull)
|
|
|
+// .reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+// }
|
|
|
+//
|
|
|
+// queryLogisticListResp.setTotalTransportAmount(totalTransportAmount.setScale(2, RoundingMode.HALF_UP).toPlainString());
|
|
|
+// }
|
|
|
+ WayContaractbillOrderVo wayContaractbillOrderVo = contractIdAndLogisticsOrderMap.get(r.getId());
|
|
|
+ if (Objects.nonNull(wayContaractbillOrderVo) ){
|
|
|
+ List<KwtLogisticsOrderVO> orderVos = wayContaractbillOrderVo.getOrderVos();
|
|
|
+ if (org.apache.commons.collections4.CollectionUtils.isNotEmpty(orderVos)){
|
|
|
+ String billingMode = orderVos.get(0).getBillingMode();
|
|
|
+ if (org.apache.commons.lang3.StringUtils.equals(billingMode, DictEnum.LOAD_UNLOAD_WAY_1.getValue())){
|
|
|
+ totalTransportAmount = orderVos.stream()
|
|
|
+ .map(KwtLogisticsOrderVO::getTotalLoadAmount)
|
|
|
+ .filter(Objects::nonNull)
|
|
|
+ .reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+
|
|
|
+
|
|
|
+ totalAmount = orderVos.stream()
|
|
|
+ .filter(x->Arrays.asList(CarWaybillV1Enum.COMPLETION_LOADING.getCode(),CarWaybillV1Enum.COMPLETED.getCode()).contains(x.getStatus()))
|
|
|
+ .map(vo -> {
|
|
|
+ BigDecimal loadAmount = vo.getTotalLoadAmount();
|
|
|
+ BigDecimal price = vo.getPrice() != null ? vo.getPrice() : BigDecimal.ONE;
|
|
|
+ return loadAmount != null ? loadAmount.multiply(price) : BigDecimal.ZERO;
|
|
|
+ })
|
|
|
+ .reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ }else {
|
|
|
+ totalTransportAmount = orderVos.stream()
|
|
|
+ .map(KwtLogisticsOrderVO::getTotalUnloadAmount)
|
|
|
+ .filter(Objects::nonNull)
|
|
|
+ .reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ totalAmount = orderVos.stream()
|
|
|
+ .filter(x->Arrays.asList(CarWaybillV1Enum.COMPLETION_LOADING.getCode(),CarWaybillV1Enum.COMPLETED.getCode()).contains(x.getStatus()))
|
|
|
+ .map(vo -> {
|
|
|
+ BigDecimal loadAmount = vo.getTotalUnloadAmount();
|
|
|
+ BigDecimal price = vo.getPrice() != null ? vo.getPrice() : BigDecimal.ONE;
|
|
|
+ return loadAmount != null ? loadAmount.multiply(price) : BigDecimal.ZERO;
|
|
|
+ })
|
|
|
+ .reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ }
|
|
|
}
|
|
|
- queryLogisticListResp.setTotalTransportAmount(totalTransportAmount.setScale(2, RoundingMode.HALF_UP).toPlainString());
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
+ queryLogisticListResp.setPerformedAmount(totalTransportAmount.setScale(2, RoundingMode.HALF_UP).toPlainString());
|
|
|
+ queryLogisticListResp.setTotalTransportAmount(totalAmount.setScale(2, RoundingMode.HALF_UP).toPlainString());
|
|
|
String startDate = DateUtils.format(r.getStartTime(), DateUtils.DATE_PATTERN);
|
|
|
queryLogisticListResp.setStartDate(startDate);
|
|
|
String endDate = DateUtils.format(r.getEndTime(), DateUtils.DATE_PATTERN);
|