|
|
@@ -16,11 +16,15 @@ import com.sckw.fleet.api.RemoteFleetService;
|
|
|
import com.sckw.mongo.model.SckwWaybillOrder;
|
|
|
import com.sckw.mongo.model.TableTops;
|
|
|
import com.sckw.system.api.RemoteSystemService;
|
|
|
+import com.sckw.system.api.model.dto.res.AreaTreeFrontResDto;
|
|
|
import com.sckw.system.api.model.dto.res.SysDictResDto;
|
|
|
import com.sckw.system.api.model.dto.res.UserCacheResDto;
|
|
|
import com.sckw.transport.dao.*;
|
|
|
import com.sckw.transport.model.KwtLogisticsOrder;
|
|
|
+import com.sckw.transport.model.KwtLogisticsOrderCirculate;
|
|
|
+import com.sckw.transport.model.KwtWaybillOrder;
|
|
|
import com.sckw.transport.model.KwtWaybillOrderTrack;
|
|
|
+import com.sckw.transport.model.dto.AddressDropListDTO;
|
|
|
import com.sckw.transport.model.dto.WayBillDetailDTO;
|
|
|
import com.sckw.transport.model.dto.WaybillListAppDTO;
|
|
|
import com.sckw.transport.model.dto.WaybillOrderDTO;
|
|
|
@@ -69,6 +73,9 @@ public class WaybillManagementService {
|
|
|
@Autowired
|
|
|
public KwtWaybillOrderTicketMapper kwtWaybillOrderTicketMapper;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private KwtLogisticsOrderCirculateMapper orderCirculateDao;
|
|
|
+
|
|
|
@Autowired
|
|
|
public KwtWaybillOrderTrackMapper kwtWaybillOrderTrackMapper;
|
|
|
|
|
|
@@ -228,7 +235,60 @@ public class WaybillManagementService {
|
|
|
* @return
|
|
|
*/
|
|
|
public HttpResult waybillSimpleData(Long id){
|
|
|
+ // 数据校验
|
|
|
+ if (id == null) {
|
|
|
+ return HttpResult.error("车辆运单ID不能为空!");
|
|
|
+ }
|
|
|
WaybillSimpleDataVO waybillSimpleDataVO = new WaybillSimpleDataVO();
|
|
|
+ KwtWaybillOrder waybillOrder = kwtWaybillOrderMapper.selectById(id);
|
|
|
+ if (waybillOrder != null) {
|
|
|
+ BeanUtils.copyPropertiesValue(waybillOrder, waybillSimpleDataVO);
|
|
|
+ waybillSimpleDataVO.setWOrderId(waybillOrder.getId());
|
|
|
+ } else {
|
|
|
+ KwtLogisticsOrderCirculate orderCirculate = orderCirculateDao.selectById(id);
|
|
|
+ if (orderCirculate == null) {
|
|
|
+ return HttpResult.error("车辆运单已不存在!");
|
|
|
+ }
|
|
|
+ BeanUtils.copyPropertiesValue(orderCirculate, waybillSimpleDataVO);
|
|
|
+ waybillSimpleDataVO.setWOrderId(orderCirculate.getId());
|
|
|
+ }
|
|
|
+
|
|
|
+ // 初始化各状态
|
|
|
+ List<WaybillStatusVO> statusVOS = new ArrayList<>();
|
|
|
+ List<Integer> statuses = initWaybillIndexStatus();
|
|
|
+ statuses.forEach(e -> {
|
|
|
+ WaybillStatusVO waybillStatusVO = new WaybillStatusVO();
|
|
|
+ waybillStatusVO.setStatus(false);
|
|
|
+ waybillStatusVO.setCode(e);
|
|
|
+ waybillStatusVO.setDestination(CarWaybillEnum.getName(e));
|
|
|
+ statusVOS.add(waybillStatusVO);
|
|
|
+ });
|
|
|
+
|
|
|
+ List<KwtWaybillOrderTrack> kwtWaybillOrderTracks = kwtWaybillOrderTrackMapper.selectList(new LambdaQueryWrapper<KwtWaybillOrderTrack>().eq(KwtWaybillOrderTrack::getWOrderId, id));
|
|
|
+ if (CollectionUtils.isNotEmpty(kwtWaybillOrderTracks)) {
|
|
|
+ List<Long> userIds = new ArrayList<>();
|
|
|
+ kwtWaybillOrderTracks.forEach(e -> userIds.add(e.getCreateBy()));
|
|
|
+ List<UserCacheResDto> users = remoteSystemService.queryUserCacheByIds(userIds);
|
|
|
+ Map<Long, UserCacheResDto> usersMap = new HashMap<>(Global.NUMERICAL_SIXTEEN);
|
|
|
+ users.forEach(e -> usersMap.put(e.getId(), e));
|
|
|
+ for (KwtWaybillOrderTrack kwtWaybillOrderTrack : kwtWaybillOrderTracks) {
|
|
|
+ for (WaybillStatusVO statusVO : statusVOS) {
|
|
|
+ if (statusVO.getCode().equals(kwtWaybillOrderTrack.getStatus())) {
|
|
|
+ statusVO.setStatus(true);
|
|
|
+ statusVO.setId(kwtWaybillOrderTrack.getId());
|
|
|
+ statusVO.setCreateTime(DateUtil.getDateTime(kwtWaybillOrderTrack.getCreateTime()));
|
|
|
+ statusVO.setOperateTime(kwtWaybillOrderTrack.getOperateTime() == null
|
|
|
+ ? null : DateUtil.getDateTime(kwtWaybillOrderTrack.getOperateTime()));
|
|
|
+ statusVO.setCreateByName(usersMap.get(kwtWaybillOrderTrack.getCreateBy()) == null
|
|
|
+ ? null : usersMap.get(kwtWaybillOrderTrack.getCreateBy()).getName());
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ waybillSimpleDataVO.setProcess(statusVOS);
|
|
|
+ return HttpResult.ok(waybillSimpleDataVO);
|
|
|
+ /*WaybillSimpleDataVO waybillSimpleDataVO = new WaybillSimpleDataVO();
|
|
|
Criteria criteria = new Criteria();
|
|
|
criteria.and("wOrderId").is(id);
|
|
|
criteria.and("entId").is(LoginUserHolder.getEntId());
|
|
|
@@ -285,7 +345,7 @@ public class WaybillManagementService {
|
|
|
}
|
|
|
}
|
|
|
waybillSimpleDataVO.setProcess(statusVOS);
|
|
|
- return HttpResult.ok(waybillSimpleDataVO);
|
|
|
+ return HttpResult.ok(waybillSimpleDataVO);*/
|
|
|
}
|
|
|
/**
|
|
|
* 运单看板列表
|
|
|
@@ -375,6 +435,7 @@ public class WaybillManagementService {
|
|
|
if(e.getCode().equals(e2.getStatus())) {
|
|
|
e.setStatus(true);
|
|
|
e.setId(e2.getId());
|
|
|
+ e.setOperateTime(DateUtil.getDateTime(e2.getOperateTime()));
|
|
|
e.setCreateTime(DateUtil.getDateTime(e2.getCreateTime()));
|
|
|
e.setCreateByName(usersMap.get(e2.getCreateBy()) == null ? null : usersMap.get(e2.getCreateBy()));
|
|
|
}
|
|
|
@@ -644,4 +705,25 @@ public class WaybillManagementService {
|
|
|
}
|
|
|
return _list;
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * @desc 获取企业地址信息
|
|
|
+ * @author zk
|
|
|
+ * @date 2023/9/1
|
|
|
+ **/
|
|
|
+ public AddressDropListDTO findAddressList() {
|
|
|
+ AddressDropListDTO res = new AddressDropListDTO();
|
|
|
+ //装货地址树
|
|
|
+ List<Integer> loadAddressList = kwtWaybillOrderAddressMapper.findAddressCodeList(LoginUserHolder.getEntId(), Global.NUMERICAL_ONE);
|
|
|
+ //卸货地址树
|
|
|
+ List<Integer> unloadAddressList = kwtWaybillOrderAddressMapper.findAddressCodeList(LoginUserHolder.getEntId(), Global.NUMERICAL_TWO);
|
|
|
+
|
|
|
+ //装货地址下拉列表树
|
|
|
+ List<AreaTreeFrontResDto> loadTree = remoteSystemService.queryAreaTreeFrontByCodeList(loadAddressList);
|
|
|
+ res.setLoadAddressList(loadTree);
|
|
|
+ //卸货地址下拉列表树
|
|
|
+ List<AreaTreeFrontResDto> unloadTree = remoteSystemService.queryAreaTreeFrontByCodeList(unloadAddressList);
|
|
|
+ res.setUnloadAddressList(unloadTree);
|
|
|
+ return res;
|
|
|
+ }
|
|
|
}
|