tao.mo

biz-customer | 修改 | 运单查询逻辑处理

mt
2024年12月24日14:38:28
...@@ -12,9 +12,12 @@ import com.fedex.connect.customer.data.query.UserConsignmentInfoQuery; ...@@ -12,9 +12,12 @@ import com.fedex.connect.customer.data.query.UserConsignmentInfoQuery;
12 import com.fedex.connect.customer.enums.ResponseCode; 12 import com.fedex.connect.customer.enums.ResponseCode;
13 import com.fedex.connect.customer.service.base.BaseService; 13 import com.fedex.connect.customer.service.base.BaseService;
14 import com.fedex.connect.customer.service.biz.IConsignmentQueryService; 14 import com.fedex.connect.customer.service.biz.IConsignmentQueryService;
15 +import com.fedex.connect.customer.util.service.biz.ConsignmentQueryUtil;
16 +import org.springframework.beans.factory.annotation.Autowired;
15 import org.springframework.stereotype.Service; 17 import org.springframework.stereotype.Service;
16 18
17 import java.util.List; 19 import java.util.List;
20 +import java.util.Objects;
18 21
19 /** 22 /**
20 * @Author Szl 23 * @Author Szl
...@@ -23,6 +26,10 @@ import java.util.List; ...@@ -23,6 +26,10 @@ import java.util.List;
23 */ 26 */
24 @Service 27 @Service
25 public class ConsignmentQueryServiceImpl extends BaseService implements IConsignmentQueryService { 28 public class ConsignmentQueryServiceImpl extends BaseService implements IConsignmentQueryService {
29 +
30 + @Autowired
31 + ConsignmentQueryUtil consignmentQueryUtil;
32 +
26 /** 33 /**
27 * @Author Szl 34 * @Author Szl
28 * @Description 功能说明 运单查询 35 * @Description 功能说明 运单查询
...@@ -61,6 +68,10 @@ public class ConsignmentQueryServiceImpl extends BaseService implements IConsign ...@@ -61,6 +68,10 @@ public class ConsignmentQueryServiceImpl extends BaseService implements IConsign
61 */ 68 */
62 public ResponseVo findConsignmentInfo(UserConsignmentInfoQuery userConsignmentInfoQuery) { 69 public ResponseVo findConsignmentInfo(UserConsignmentInfoQuery userConsignmentInfoQuery) {
63 Consignment consignment = consignmentRepository.findConsignmentInfo(userConsignmentInfoQuery); 70 Consignment consignment = consignmentRepository.findConsignmentInfo(userConsignmentInfoQuery);
64 - return responseUtils.success(consignment); 71 + /**
72 + * 对查询数据进行筛选
73 + */
74 + Consignment resultConsignment = consignmentQueryUtil.findConsignment(userConsignmentInfoQuery,consignment);
75 + return responseUtils.success(resultConsignment);
65 } 76 }
66 -} 77 +}
...\ No newline at end of file ...\ No newline at end of file
......
1 +package com.fedex.connect.customer.util.service.biz;
2 +
3 +import com.fedex.connect.common.model.biz.Consignment;
4 +import com.fedex.connect.customer.data.query.UserConsignmentInfoQuery;
5 +import lombok.extern.slf4j.Slf4j;
6 +import org.springframework.stereotype.Component;
7 +
8 +import java.util.Objects;
9 +
10 +/**
11 + * @Author mt
12 + * @Description 运单数据查询处理
13 + * @Date 2024/12/24
14 + */
15 +@Slf4j
16 +@Component
17 +public class ConsignmentQueryUtil {
18 + /**
19 + * @Author mt
20 + * @Description 运单查询数据筛选
21 + * @Date 2024/12/24
22 + * @param userConsignmentInfoQuery
23 + * @param consignment
24 + * @return com.fedex.connect.common.model.biz.Consignment
25 + */
26 + public Consignment findConsignment(UserConsignmentInfoQuery userConsignmentInfoQuery,Consignment consignment){
27 + Consignment resultConsignment = null;
28 + if(Objects.nonNull(consignment)){
29 + //uuid相同,则将运单所有信息返回给到前端
30 + if(userConsignmentInfoQuery.getUserUuid().equals(consignment.getUserUuid()) ||
31 + userConsignmentInfoQuery.getShipperAccount().equals(consignment.getShipperAccount())){
32 + //1:如果运单UUID与登录账号UUID相同或者用户shipperAccount与运单shipperAccount相同,则显示运单、收发件人信息,以及501信息
33 + resultConsignment = consignment;
34 + }else if(userConsignmentInfoQuery.getShipperAccount().equals(consignment.getUserInputShipperAccount()) ||
35 + userConsignmentInfoQuery.getUserId().equals(consignment.getCreateUserId())){
36 + //如果运单UUID与登录账号UUID不同,用户shipperAccount与运单录入的shipperAccount一致,则只显示用户录入的运单号、shipperAccount、始发国
37 + resultConsignment = new Consignment();
38 + resultConsignment.setId(consignment.getId());
39 + resultConsignment.setConsignmentCode(consignment.getConsignmentCode());
40 + resultConsignment.setUserInputOriginCountry(consignment.getUserInputOriginCountry());
41 + resultConsignment.setUserInputOriginCountryCode(consignment.getUserInputOriginCountryCode());
42 + resultConsignment.setUserInputShipperAccount(consignment.getUserInputShipperAccount());
43 + resultConsignment.setDestinationCountry(consignment.getDestinationCountry());
44 + resultConsignment.setDestinationCountryCode(consignment.getDestinationCountryCode());
45 + }
46 + }
47 + return resultConsignment;
48 + }
49 +}