|
@@ -8,6 +8,7 @@ import com.github.pagehelper.PageInfo;
|
|
|
import com.sckw.core.common.enums.enums.DictTypeEnum;
|
|
import com.sckw.core.common.enums.enums.DictTypeEnum;
|
|
|
import com.sckw.core.model.constant.Global;
|
|
import com.sckw.core.model.constant.Global;
|
|
|
import com.sckw.core.model.constant.NumberConstant;
|
|
import com.sckw.core.model.constant.NumberConstant;
|
|
|
|
|
+import com.sckw.core.model.enums.AddressTypeEnum;
|
|
|
import com.sckw.core.model.enums.CarWaybillEnum;
|
|
import com.sckw.core.model.enums.CarWaybillEnum;
|
|
|
import com.sckw.core.model.enums.CarWaybillQueryEnum;
|
|
import com.sckw.core.model.enums.CarWaybillQueryEnum;
|
|
|
import com.sckw.core.model.page.PageHelperUtil;
|
|
import com.sckw.core.model.page.PageHelperUtil;
|
|
@@ -17,6 +18,7 @@ import com.sckw.core.web.context.LoginUserHolder;
|
|
|
import com.sckw.core.web.response.HttpResult;
|
|
import com.sckw.core.web.response.HttpResult;
|
|
|
import com.sckw.excel.utils.DateUtil;
|
|
import com.sckw.excel.utils.DateUtil;
|
|
|
import com.sckw.fleet.api.RemoteFleetService;
|
|
import com.sckw.fleet.api.RemoteFleetService;
|
|
|
|
|
+import com.sckw.fleet.api.model.vo.RTruckVo;
|
|
|
import com.sckw.mongo.model.SckwWaybillOrder;
|
|
import com.sckw.mongo.model.SckwWaybillOrder;
|
|
|
import com.sckw.mongo.model.TableTops;
|
|
import com.sckw.mongo.model.TableTops;
|
|
|
import com.sckw.system.api.RemoteSystemService;
|
|
import com.sckw.system.api.RemoteSystemService;
|
|
@@ -27,6 +29,7 @@ import com.sckw.system.api.model.dto.res.UserCacheResDto;
|
|
|
import com.sckw.transport.dao.*;
|
|
import com.sckw.transport.dao.*;
|
|
|
import com.sckw.transport.model.*;
|
|
import com.sckw.transport.model.*;
|
|
|
import com.sckw.transport.model.dto.*;
|
|
import com.sckw.transport.model.dto.*;
|
|
|
|
|
+import com.sckw.transport.model.enuma.ApproveStatusEnum;
|
|
|
import com.sckw.transport.model.enuma.CarWaybillAppEnum;
|
|
import com.sckw.transport.model.enuma.CarWaybillAppEnum;
|
|
|
import com.sckw.transport.model.enuma.CarWaybillDetailEnum;
|
|
import com.sckw.transport.model.enuma.CarWaybillDetailEnum;
|
|
|
import com.sckw.transport.model.enuma.CarWaybillNdexTopEnum;
|
|
import com.sckw.transport.model.enuma.CarWaybillNdexTopEnum;
|
|
@@ -213,4 +216,101 @@ public class KwtWaybillManagementV1Service {
|
|
|
return HttpResult.ok(pageResult);
|
|
return HttpResult.ok(pageResult);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * @param wOrderId 运单ID
|
|
|
|
|
+ * @desc 运单详情
|
|
|
|
|
+ * @author zk
|
|
|
|
|
+ * @date 2024/3/13
|
|
|
|
|
+ **/
|
|
|
|
|
+ public HttpResult waybillDetail(Long wOrderId) {
|
|
|
|
|
+ //运单信息
|
|
|
|
|
+ KwtWaybillOrderV1 waybillOrder = waybillOrderV1Mapper.selectById(wOrderId);
|
|
|
|
|
+ if (waybillOrder == null) {
|
|
|
|
|
+ return HttpResult.error("运单" + wOrderId + "不存在,请确认!");
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ //子单
|
|
|
|
|
+ List<KwtWaybillOrderSubtask> subtasks = waybillOrderSubtaskMapper.findByWOrderId(wOrderId);
|
|
|
|
|
+ //运单状态记录
|
|
|
|
|
+ List<KwtWaybillOrderTrack> tracks = kwtWaybillOrderTrackMapper.findTrack(wOrderId, null, null, null);
|
|
|
|
|
+ //用户信息
|
|
|
|
|
+ List<Long> userIds = tracks.stream().map(KwtWaybillOrderTrack::getCreateBy).toList();
|
|
|
|
|
+ List<Long> userIdList = new ArrayList<>(NumberConstant.SIXTEEN){{add(waybillOrder.getCreateBy());}};
|
|
|
|
|
+ userIdList.addAll(userIds);
|
|
|
|
|
+ List<UserCacheResDto> users = remoteSystemService.queryUserCacheByIds(userIdList);
|
|
|
|
|
+ Map<Long, UserCacheResDto> usersMap = new HashMap<>(Global.NUMERICAL_SIXTEEN);
|
|
|
|
|
+ users.forEach(e -> usersMap.put(e.getId(), e));
|
|
|
|
|
+ //企业ID
|
|
|
|
|
+ List<Long> entIds = new ArrayList<>(){{add(waybillOrder.getEntId());}};
|
|
|
|
|
+ Map<Long, EntCacheResDto> ents = remoteSystemService.queryEntCacheMapByIds(entIds);
|
|
|
|
|
+ //单位
|
|
|
|
|
+ Map<String, Map<String, String>> dict = remoteSystemService.queryDictByType(List.of(DictTypeEnum.UNIT_TYPE.getType()));
|
|
|
|
|
+ Map<String, String> unitMap = CollectionUtils.isNotEmpty(dict) ? dict.get(DictTypeEnum.UNIT_TYPE.getType()) : new HashMap<>(NumberConstant.SIXTEEN);
|
|
|
|
|
+ //车辆信息
|
|
|
|
|
+ RTruckVo truck = remoteFleetService.findTruck(waybillOrder.getTruckId());
|
|
|
|
|
+
|
|
|
|
|
+ //返回信息
|
|
|
|
|
+ WaybillDetailVo waybillDetail = new WaybillDetailVo();
|
|
|
|
|
+ //地址信息
|
|
|
|
|
+ List<KwtWaybillOrderAddress> addresses = kwtWaybillOrderAddressMapper.findByAddresses(wOrderId, null);
|
|
|
|
|
+ //地址数据处理
|
|
|
|
|
+ List<Map<String, Object>> addressList = new ArrayList<>(NumberConstant.SIXTEEN);
|
|
|
|
|
+ for (KwtWaybillOrderAddress address:addresses) {
|
|
|
|
|
+ //运单子单
|
|
|
|
|
+ KwtWaybillOrderSubtask subtask = waybillOrderSubtaskMapper.selectById(address.getWSubtaskId());
|
|
|
|
|
+ //物流订单商品信息
|
|
|
|
|
+ KwtLogisticsOrderGoods goods = logisticsOrderGoodsMapper.findByGoods(subtask != null ? subtask.getLOrderId() : null);
|
|
|
|
|
+ //榜单信息
|
|
|
|
|
+ KwtWaybillOrderTicket ticket = kwtWaybillOrderTicketMapper.findWaybillOrderTicketV2(address.getId(), subtask.getUnit());
|
|
|
|
|
+ Map<String, Object> addressData = new HashMap<>(NumberConstant.SIXTEEN);
|
|
|
|
|
+ addressData.put("addressType", address.getAddressType());
|
|
|
|
|
+ addressData.put("addressName", address.getName());
|
|
|
|
|
+ addressData.put("addressCityName", address.getCityName());
|
|
|
|
|
+ addressData.put("addressDetail", address.getDetailAddress());
|
|
|
|
|
+ addressData.put("planTime", DateUtils.format(address.getPlanTime(), DateUtils.FORMAT12));
|
|
|
|
|
+ addressData.put("entrustAmount", address.getEntrustAmount());
|
|
|
|
|
+ addressData.put("goodsName", goods != null ? goods.getGoodsName() : null);
|
|
|
|
|
+ addressData.put("unit", subtask.getUnit());
|
|
|
|
|
+ addressData.put("unitName", unitMap.get(subtask.getUnit()));
|
|
|
|
|
+ addressData.put("amount", ticket != null ? ticket.getAmount() : null);
|
|
|
|
|
+ addressData.put("urls", ticket != null ? FileUtils.spliceBatch(ticket.getUrls()) : null);
|
|
|
|
|
+ addressData.put("operateStatus", ticket != null);
|
|
|
|
|
+ addressData.put("operateTime", ticket != null ? DateUtils.format(address.getPlanTime(), DateUtils.FORMAT11) : null);
|
|
|
|
|
+ addressData.put("status", ticket != null ? ticket.getStatus() : null);
|
|
|
|
|
+ addressData.put("statusName", ticket != null ? ApproveStatusEnum.getName(ticket.getStatus()) : null);
|
|
|
|
|
+ addressList.add(addressData);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ //物流订单编号
|
|
|
|
|
+ for (KwtWaybillOrderSubtask subtask:subtasks) {
|
|
|
|
|
+ KwtLogisticsOrder logisticsOrder = kwtLogisticsOrderMapper.selectById(subtask.getLOrderId());
|
|
|
|
|
+ waybillDetail.setLOrderNo((StringUtils.isBlank(waybillDetail.getLOrderNo()) ? Global.EMPTY_STRING : Global.COMMA) + logisticsOrder.getLOrderNo());
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ //榜单信息
|
|
|
|
|
+ List<KwtWaybillOrderTicket> tickets = kwtWaybillOrderTicketMapper.findWaybillOrderTicket(wOrderId, null, null);
|
|
|
|
|
+ //数据处理
|
|
|
|
|
+ List<String> loadUrl = new ArrayList<>(), unloadUrl = new ArrayList<>();
|
|
|
|
|
+ for (KwtWaybillOrderTicket ticket:tickets) {
|
|
|
|
|
+ if(ticket.getType().equals(AddressTypeEnum.SHIPMENT.getCode())){
|
|
|
|
|
+ loadUrl.add(FileUtils.spliceBatch(ticket.getUrls()));
|
|
|
|
|
+ } else {
|
|
|
|
|
+ unloadUrl.add(FileUtils.spliceBatch(ticket.getUrls()));
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ waybillDetail.setLoadUrl(loadUrl);
|
|
|
|
|
+ waybillDetail.setUnloadUrl(unloadUrl);
|
|
|
|
|
+
|
|
|
|
|
+ BeanUtils.copyProperties(waybillOrder, waybillDetail);
|
|
|
|
|
+ waybillDetail.setWOrderId(waybillOrder.getId());
|
|
|
|
|
+ waybillDetail.setStatusName(CarWaybillEnum.getName(waybillOrder.getStatus()));
|
|
|
|
|
+ waybillDetail.setCreateByName(usersMap.get(waybillOrder.getCreateBy()) != null ? usersMap.get(waybillOrder.getCreateBy()).getName() : null);
|
|
|
|
|
+ waybillDetail.setCreateByPhone(usersMap.get(waybillOrder.getCreateBy()) != null ? usersMap.get(waybillOrder.getCreateBy()).getPhone() : null);
|
|
|
|
|
+ waybillDetail.setTrailerNo(truck != null ? truck.getTrailerNo() : null);
|
|
|
|
|
+ waybillDetail.setTruckType(truck != null ? truck.getTruckType() : null);
|
|
|
|
|
+ waybillDetail.setFirmName(ents.get(waybillOrder.getEntId()) != null ? ents.get(waybillOrder.getEntId()).getFirmName() : null);
|
|
|
|
|
+ waybillDetail.setAddresses(addressList);
|
|
|
|
|
+ return HttpResult.ok(waybillDetail);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
}
|
|
}
|