|
|
@@ -94,7 +94,7 @@ public class WaybillManagementService {
|
|
|
WayBillDetailDTO wayBillDetailDTO = new WayBillDetailDTO();
|
|
|
WaybillTicketVO waybillTicketVO = new WaybillTicketVO();
|
|
|
WaybillCarVO waybillCarVO = new WaybillCarVO();
|
|
|
- if(!ObjectUtils.isEmpty(info)) {
|
|
|
+ if (!ObjectUtils.isEmpty(info)) {
|
|
|
// 基础信息
|
|
|
wayBillDetailDTO.setTruckId(info.getTruckId());
|
|
|
wayBillDetailDTO.setStatus(String.valueOf(info.getStatus()));
|
|
|
@@ -123,22 +123,22 @@ public class WaybillManagementService {
|
|
|
wayBillDetailDTO.setCheckFirmName(info.getCheckFirmName());
|
|
|
// 计费方式
|
|
|
KwtLogisticsOrder kwtLogisticsOrder = kwtLogisticsOrderMapper.selectById(info.getLOrderId());
|
|
|
- if(!ObjectUtils.isEmpty(kwtLogisticsOrder)) {
|
|
|
+ if (!ObjectUtils.isEmpty(kwtLogisticsOrder)) {
|
|
|
wayBillDetailDTO.setPriceType(kwtLogisticsOrder.getBillingMode());
|
|
|
SysDictResDto billingMode = remoteSystemService.queryDictByTypeAndValue(DictTypeEnum.CHARGING_TYPE.getType(), kwtLogisticsOrder.getBillingMode());
|
|
|
- if(!ObjectUtils.isEmpty(billingMode)) {
|
|
|
+ if (!ObjectUtils.isEmpty(billingMode)) {
|
|
|
wayBillDetailDTO.setPriceTypeLabe(billingMode.getLabel());
|
|
|
}
|
|
|
}
|
|
|
wayBillDetailDTO.setCheckFirmName(info.getCheckFirmName());
|
|
|
// 派车人信息
|
|
|
UserCacheResDto createUser = remoteSystemService.queryUserCacheById(info.getCreateBy());
|
|
|
- if(!ObjectUtils.isEmpty(createUser)) {
|
|
|
+ if (!ObjectUtils.isEmpty(createUser)) {
|
|
|
wayBillDetailDTO.setCreateByPhone(createUser.getPhone());
|
|
|
}
|
|
|
// 车辆信息
|
|
|
SysDictResDto truckTypeString = remoteSystemService.queryDictByTypeAndValue(DictTypeEnum.TRUCK_TYPE.getType(), info.getTruckType());
|
|
|
- if(!ObjectUtils.isEmpty(truckTypeString)) {
|
|
|
+ if (!ObjectUtils.isEmpty(truckTypeString)) {
|
|
|
waybillCarVO.setTypeLabel(truckTypeString.getLabel());
|
|
|
}
|
|
|
waybillCarVO.setTruckId(String.valueOf(info.getTruckId()));
|
|
|
@@ -149,12 +149,12 @@ public class WaybillManagementService {
|
|
|
waybillCarVO.setDriverId(String.valueOf(info.getTruckId()));
|
|
|
waybillCarVO.setTrailerNo(info.getTruckTrailerNo());
|
|
|
// 票据
|
|
|
- if (info.getLoadTime()!=null){
|
|
|
+ if (info.getLoadTime() != null) {
|
|
|
waybillTicketVO.setLoadTime(DateUtil.getDateTime(info.getLoadTime()));
|
|
|
}
|
|
|
waybillTicketVO.setLoadWeight(String.valueOf(info.getLoadAmount()));
|
|
|
waybillTicketVO.setLoadUrl(String.valueOf(info.getLoadUrls()));
|
|
|
- if (info.getUnloadTime()!=null){
|
|
|
+ if (info.getUnloadTime() != null) {
|
|
|
waybillTicketVO.setUnloadTime(DateUtil.getDateTime(info.getUnloadTime()));
|
|
|
}
|
|
|
waybillTicketVO.setUnloadWeight(String.valueOf(info.getUnloadAmount()));
|
|
|
@@ -163,7 +163,7 @@ public class WaybillManagementService {
|
|
|
BigDecimal deficitLoss = info.getLoss() == null ? BigDecimal.valueOf(0) : info.getLoss();
|
|
|
BigDecimal deficitAmount = info.getDeficitAmount() == null ? BigDecimal.valueOf(0) : info.getDeficitAmount();
|
|
|
BigDecimal deficitRealAmount = BigDecimal.valueOf(0);
|
|
|
- if(deficitAmount.compareTo(BigDecimal.valueOf(0)) > 0) {
|
|
|
+ if (deficitAmount.compareTo(BigDecimal.valueOf(0)) > 0) {
|
|
|
deficitRealAmount = deficitLoss.subtract(deficitAmount);
|
|
|
}
|
|
|
waybillTicketVO.setDeficitRealAmount(deficitRealAmount.toString());
|
|
|
@@ -189,9 +189,9 @@ public class WaybillManagementService {
|
|
|
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())) {
|
|
|
+ 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()));
|
|
|
@@ -226,10 +226,11 @@ public class WaybillManagementService {
|
|
|
|
|
|
/**
|
|
|
* 简洁版运单详情
|
|
|
+ *
|
|
|
* @param id
|
|
|
* @return
|
|
|
*/
|
|
|
- public HttpResult waybillSimpleData(Long id){
|
|
|
+ public HttpResult waybillSimpleData(Long id) {
|
|
|
WaybillSimpleDataVO waybillSimpleDataVO = new WaybillSimpleDataVO();
|
|
|
Criteria criteria = new Criteria();
|
|
|
criteria.and("wOrderId").is(id);
|
|
|
@@ -237,7 +238,7 @@ public class WaybillManagementService {
|
|
|
criteria.and("delFlag").is(NumberConstant.ZERO);
|
|
|
Query queryFormat = new Query(criteria);
|
|
|
SckwWaybillOrder info = mongoTemplate.findOne(queryFormat, SckwWaybillOrder.class);
|
|
|
- if(!ObjectUtils.isEmpty(info)) {
|
|
|
+ if (!ObjectUtils.isEmpty(info)) {
|
|
|
waybillSimpleDataVO.setWOrderId(info.getWOrderId() == null ?
|
|
|
String.valueOf(info.get_id()) : String.valueOf(info.getWOrderId()));
|
|
|
waybillSimpleDataVO.setWOrderNo(info.getWOrderNo());
|
|
|
@@ -289,8 +290,10 @@ public class WaybillManagementService {
|
|
|
waybillSimpleDataVO.setProcess(statusVOS);
|
|
|
return HttpResult.ok(waybillSimpleDataVO);
|
|
|
}
|
|
|
+
|
|
|
/**
|
|
|
* 运单看板列表
|
|
|
+ *
|
|
|
* @param query
|
|
|
* @return
|
|
|
* @throws Exception
|
|
|
@@ -323,12 +326,11 @@ public class WaybillManagementService {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- *
|
|
|
* @return
|
|
|
*/
|
|
|
public void packageWaybillIndexResult(List<SckwWaybillOrder> list, List<WaybillStatusVO> statusVOS, List<WaybillBoardListVO> returnList) {
|
|
|
// 执行查询
|
|
|
- for (SckwWaybillOrder sckwWaybillOrder:list) {
|
|
|
+ for (SckwWaybillOrder sckwWaybillOrder : list) {
|
|
|
WaybillBoardListVO waybillBoardListVO = new WaybillBoardListVO();
|
|
|
waybillBoardListVO.setWOrderId(String.valueOf(sckwWaybillOrder.getWOrderId()));
|
|
|
waybillBoardListVO.setWOrderNo(String.valueOf(sckwWaybillOrder.getWOrderNo()));
|
|
|
@@ -374,11 +376,11 @@ public class WaybillManagementService {
|
|
|
users.forEach(e -> usersMap.put(e.getId(), e.getName()));
|
|
|
waybillBoardListVO.getTracks().forEach(e -> {
|
|
|
kwtWaybillOrderTracks.forEach(e2 -> {
|
|
|
- if(e.getCode().equals(e2.getStatus())) {
|
|
|
+ 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.setOperateTime(e2.getOperateTime() == null ? null : DateUtil.getDateTime(e2.getOperateTime()));
|
|
|
+ e.setCreateTime(e2.getCreateTime() == null ? null : DateUtil.getDateTime(e2.getCreateTime()));
|
|
|
e.setCreateByName(usersMap.get(e2.getCreateBy()) == null ? null : usersMap.get(e2.getCreateBy()));
|
|
|
}
|
|
|
});
|
|
|
@@ -389,10 +391,9 @@ public class WaybillManagementService {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- *
|
|
|
* @return
|
|
|
*/
|
|
|
- public List<Integer> initWaybillIndexStatus() {
|
|
|
+ public List<Integer> initWaybillIndexStatus() {
|
|
|
List<Integer> statuses = new ArrayList<>();
|
|
|
statuses.add(CarWaybillEnum.PENDING_ORDER.getCode());
|
|
|
statuses.add(CarWaybillEnum.PENDING_VEHICLE.getCode());
|
|
|
@@ -407,6 +408,7 @@ public class WaybillManagementService {
|
|
|
|
|
|
/**
|
|
|
* 运单看板 查询条件构造
|
|
|
+ *
|
|
|
* @param query
|
|
|
* @return
|
|
|
*/
|
|
|
@@ -419,14 +421,13 @@ public class WaybillManagementService {
|
|
|
if (CollectionUtils.isNotEmpty(wOrderIds)) {
|
|
|
Criteria.where("wOrderId").in(wOrderIds);
|
|
|
}
|
|
|
- if (StringUtils.isNotBlank(query.getStatus())){
|
|
|
+ if (StringUtils.isNotBlank(query.getStatus())) {
|
|
|
if (query.getStatus().equals(String.valueOf(CarWaybillEnum.COMPLETION_UNLOADING.getCode()))) {
|
|
|
List<Integer> _statuses = new ArrayList<>();
|
|
|
_statuses.add(CarWaybillEnum.COMPLETION_UNLOADING.getCode());
|
|
|
_statuses.add(CarWaybillEnum.APPROVAL_NO_PASS.getCode());
|
|
|
criteria.and("status").in(_statuses);
|
|
|
- }
|
|
|
- if (!query.getStatus().equals("all")) {
|
|
|
+ } else if (!query.getStatus().equals("all") && (!query.getStatus().equals(String.valueOf(CarWaybillEnum.COMPLETION_UNLOADING.getCode())))) {
|
|
|
criteria.and("status").is(Integer.valueOf(query.getStatus()));
|
|
|
}
|
|
|
}
|
|
|
@@ -491,11 +492,12 @@ public class WaybillManagementService {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 运单看板TOP
|
|
|
+ * 运单看板TOP
|
|
|
+ *
|
|
|
* @param query
|
|
|
* @return
|
|
|
*/
|
|
|
- public HttpResult waybillIndexStatistics(WaybillOrderDTO query){
|
|
|
+ public HttpResult waybillIndexStatistics(WaybillOrderDTO query) {
|
|
|
List<Integer> statuses = initWaybillIndexStatus();
|
|
|
Criteria criteria = buildWaybillIndexQuery(query);
|
|
|
Aggregation aggregation = Aggregation.newAggregation(
|
|
|
@@ -519,9 +521,9 @@ public class WaybillManagementService {
|
|
|
top.setName(CarWaybillEnum.getName(e));
|
|
|
listMap.put(String.valueOf(e), top);
|
|
|
});
|
|
|
- if(CollectionUtils.isNotEmpty(results)) {
|
|
|
- for(TableTops result: results) {
|
|
|
- if(listMap.containsKey(result.getValue())) {
|
|
|
+ if (CollectionUtils.isNotEmpty(results)) {
|
|
|
+ for (TableTops result : results) {
|
|
|
+ if (listMap.containsKey(result.getValue())) {
|
|
|
listMap.get(result.getValue()).setTotal(result.getTotal());
|
|
|
}
|
|
|
allTotal += result.getTotal();
|
|
|
@@ -533,10 +535,11 @@ public class WaybillManagementService {
|
|
|
|
|
|
/**
|
|
|
* app 运单分类统计数据 [运输中|已完成]
|
|
|
+ *
|
|
|
* @param keyword
|
|
|
* @return
|
|
|
*/
|
|
|
- public HttpResult waybillDataStatisticApp(String keyword){
|
|
|
+ public HttpResult waybillDataStatisticApp(String keyword) {
|
|
|
Long entId = LoginUserHolder.getEntId();
|
|
|
// 运输途中
|
|
|
Map<String, String> _onway = new HashMap<>();
|
|
|
@@ -562,10 +565,11 @@ public class WaybillManagementService {
|
|
|
|
|
|
/**
|
|
|
* app 运单列表 [运输中|已完成]
|
|
|
+ *
|
|
|
* @param query
|
|
|
* @return
|
|
|
*/
|
|
|
- public HttpResult waybillDataApp(WaybillListAppDTO query){
|
|
|
+ public HttpResult waybillDataApp(WaybillListAppDTO query) {
|
|
|
List<Integer> processStatuses = initWaybillIndexStatus();
|
|
|
List<Long> _statuses = getWallBillStatues(query.getStatus());
|
|
|
Criteria criteria = new Criteria();
|
|
|
@@ -611,12 +615,13 @@ public class WaybillManagementService {
|
|
|
|
|
|
/**
|
|
|
* app 运单分类吨量统计数据 [运输中|已完成]
|
|
|
+ *
|
|
|
* @param query
|
|
|
* @return
|
|
|
*/
|
|
|
- public HttpResult waybillAmountStatistic(WaybillListAppDTO query){
|
|
|
+ public HttpResult waybillAmountStatistic(WaybillListAppDTO query) {
|
|
|
List<Long> _statuses = getWallBillStatues(query.getStatus());
|
|
|
- Map<String,Object> amount = kwtWaybillOrderMapper.selectWaybillOrderAmountByStatus(
|
|
|
+ Map<String, Object> amount = kwtWaybillOrderMapper.selectWaybillOrderAmountByStatus(
|
|
|
LoginUserHolder.getEntId(),
|
|
|
_statuses,
|
|
|
query.getKeyword(),
|
|
|
@@ -628,12 +633,13 @@ public class WaybillManagementService {
|
|
|
|
|
|
/**
|
|
|
* 获取 [运输中|已完成] 状态列表
|
|
|
+ *
|
|
|
* @param status
|
|
|
* @return
|
|
|
*/
|
|
|
public List<Long> getWallBillStatues(String status) {
|
|
|
List<Long> _list = new ArrayList<>();
|
|
|
- if(status.equals("onway")) {
|
|
|
+ if (status.equals("onway")) {
|
|
|
_list.add(CarWaybillEnum.PENDING_ORDER.getCode().longValue());
|
|
|
_list.add(CarWaybillEnum.PENDING_VEHICLE.getCode().longValue());
|
|
|
_list.add(CarWaybillEnum.EXIT_COMPLETED.getCode().longValue());
|
|
|
@@ -641,7 +647,7 @@ public class WaybillManagementService {
|
|
|
_list.add(CarWaybillEnum.COMPLETION_LOADING.getCode().longValue());
|
|
|
_list.add(CarWaybillEnum.WAIT_UNLOADING.getCode().longValue());
|
|
|
}
|
|
|
- if(status.equals("finish")) {
|
|
|
+ if (status.equals("finish")) {
|
|
|
_list.add(CarWaybillEnum.COMPLETION_UNLOADING.getCode().longValue());
|
|
|
_list.add(CarWaybillEnum.APPROVAL_PASS.getCode().longValue());
|
|
|
}
|
|
|
@@ -655,7 +661,7 @@ public class WaybillManagementService {
|
|
|
**/
|
|
|
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);
|