|
|
@@ -21,9 +21,7 @@ import com.sckw.core.web.context.LoginUserHolder;
|
|
|
import com.sckw.core.web.response.HttpResult;
|
|
|
import com.sckw.excel.utils.DateUtil;
|
|
|
import com.sckw.fleet.api.RemoteFleetService;
|
|
|
-import com.sckw.fleet.api.model.vo.RDriverVo;
|
|
|
-import com.sckw.fleet.api.model.vo.RTruckRouteVo;
|
|
|
-import com.sckw.fleet.api.model.vo.RTruckVo;
|
|
|
+import com.sckw.fleet.api.model.vo.*;
|
|
|
import com.sckw.mongo.model.SckwWaybillOrder;
|
|
|
import com.sckw.order.api.dubbo.TradeOrderInfoService;
|
|
|
import com.sckw.stream.enums.MessageEnum;
|
|
|
@@ -2861,4 +2859,56 @@ public class KwtWaybillOrderV1Service {
|
|
|
//罚款值=扣亏量 * 扣亏货值
|
|
|
return deficitLossAmount.multiply(goodsPrice).setScale(4, RoundingMode.HALF_UP);
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @param params
|
|
|
+ * @desc 订单信息
|
|
|
+ * @author zk
|
|
|
+ * @date 2024/3/13
|
|
|
+ **/
|
|
|
+ public HttpResult queryBillOrderInfo(WaybillOrderRequest params) {
|
|
|
+ //运单信息
|
|
|
+ KwtWaybillOrderV1 waybillOrder = waybillOrderV1Dao.selectById(params.getWOrderId());
|
|
|
+ if (waybillOrder == null) {
|
|
|
+ return HttpResult.error("运单" + params.getWOrderId() + "不存在,请确认!");
|
|
|
+ }
|
|
|
+ WaybillOrderDetailVo orderDetailVo = new WaybillOrderDetailVo();
|
|
|
+ //车队车辆映射关系
|
|
|
+ RFleetDriverVo fleetByDriveId = remoteFleetService.findFleetByDriveId(waybillOrder.getDriverId());
|
|
|
+ if (fleetByDriveId == null) {
|
|
|
+ return HttpResult.error("运单:" + params.getWOrderId(), "车辆信息不存在,请确认!");
|
|
|
+ }
|
|
|
+
|
|
|
+ //查询车辆信息
|
|
|
+ RFleetVo fleetVO = remoteFleetService.findFleetById(fleetByDriveId.getFleetId());
|
|
|
+ orderDetailVo.setDriverId(waybillOrder.getDriverId());
|
|
|
+ orderDetailVo.setDriverName(waybillOrder.getDriverName());
|
|
|
+ orderDetailVo.setTruckNo(waybillOrder.getTruckNo());
|
|
|
+ orderDetailVo.setFleetId(fleetByDriveId.getFleetId());
|
|
|
+ orderDetailVo.setFleetName(Optional.ofNullable(fleetVO).map(RFleetVo::getName).orElse(""));
|
|
|
+
|
|
|
+ //查询企业信息
|
|
|
+ EntCacheResDto entCacheResDto = remoteSystemService.queryEntCacheById(waybillOrder.getEntId());
|
|
|
+ orderDetailVo.setEntId(waybillOrder.getEntId());
|
|
|
+ orderDetailVo.setEntName(Optional.ofNullable(entCacheResDto).map(EntCacheResDto::getFirmName).orElse(""));
|
|
|
+
|
|
|
+ //查询定制信息
|
|
|
+ List<KwtWaybillOrderAddress> orderAddresses = waybillOrderAddressRepository.queryBywOrderIds(Arrays.asList(waybillOrder.getId()));
|
|
|
+ if (CollectionUtils.isEmpty(orderAddresses)) {
|
|
|
+ return HttpResult.error("运单:" + params.getWOrderId(), "地址信息不存在,请确认!");
|
|
|
+ }
|
|
|
+
|
|
|
+ Map<Integer, String> addressNameMap = orderAddresses.stream()
|
|
|
+ .filter(address -> address.getAddressType() != null && (address.getAddressType() == 1 || address.getAddressType() == 2))
|
|
|
+ .collect(Collectors.groupingBy(
|
|
|
+ KwtWaybillOrderAddress::getAddressType,
|
|
|
+ Collectors.collectingAndThen(
|
|
|
+ Collectors.mapping(KwtWaybillOrderAddress::getName, Collectors.toList()),
|
|
|
+ list -> list.isEmpty() ? "" : list.get(0)
|
|
|
+ )
|
|
|
+ ));
|
|
|
+ orderDetailVo.setAddresses(addressNameMap);
|
|
|
+
|
|
|
+ return HttpResult.ok(orderDetailVo);
|
|
|
+ }
|
|
|
}
|