tao.mo

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

mt
2024年12月24日14:38:28
......@@ -12,9 +12,12 @@ import com.fedex.connect.customer.data.query.UserConsignmentInfoQuery;
import com.fedex.connect.customer.enums.ResponseCode;
import com.fedex.connect.customer.service.base.BaseService;
import com.fedex.connect.customer.service.biz.IConsignmentQueryService;
import com.fedex.connect.customer.util.service.biz.ConsignmentQueryUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Objects;
/**
* @Author Szl
......@@ -23,6 +26,10 @@ import java.util.List;
*/
@Service
public class ConsignmentQueryServiceImpl extends BaseService implements IConsignmentQueryService {
@Autowired
ConsignmentQueryUtil consignmentQueryUtil;
/**
* @Author Szl
* @Description 功能说明 运单查询
......@@ -61,6 +68,10 @@ public class ConsignmentQueryServiceImpl extends BaseService implements IConsign
*/
public ResponseVo findConsignmentInfo(UserConsignmentInfoQuery userConsignmentInfoQuery) {
Consignment consignment = consignmentRepository.findConsignmentInfo(userConsignmentInfoQuery);
return responseUtils.success(consignment);
/**
* 对查询数据进行筛选
*/
Consignment resultConsignment = consignmentQueryUtil.findConsignment(userConsignmentInfoQuery,consignment);
return responseUtils.success(resultConsignment);
}
}
\ No newline at end of file
......
package com.fedex.connect.customer.util.service.biz;
import com.fedex.connect.common.model.biz.Consignment;
import com.fedex.connect.customer.data.query.UserConsignmentInfoQuery;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import java.util.Objects;
/**
* @Author mt
* @Description 运单数据查询处理
* @Date 2024/12/24
*/
@Slf4j
@Component
public class ConsignmentQueryUtil {
/**
* @Author mt
* @Description 运单查询数据筛选
* @Date 2024/12/24
* @param userConsignmentInfoQuery
* @param consignment
* @return com.fedex.connect.common.model.biz.Consignment
*/
public Consignment findConsignment(UserConsignmentInfoQuery userConsignmentInfoQuery,Consignment consignment){
Consignment resultConsignment = null;
if(Objects.nonNull(consignment)){
//uuid相同,则将运单所有信息返回给到前端
if(userConsignmentInfoQuery.getUserUuid().equals(consignment.getUserUuid()) ||
userConsignmentInfoQuery.getShipperAccount().equals(consignment.getShipperAccount())){
//1:如果运单UUID与登录账号UUID相同或者用户shipperAccount与运单shipperAccount相同,则显示运单、收发件人信息,以及501信息
resultConsignment = consignment;
}else if(userConsignmentInfoQuery.getShipperAccount().equals(consignment.getUserInputShipperAccount()) ||
userConsignmentInfoQuery.getUserId().equals(consignment.getCreateUserId())){
//如果运单UUID与登录账号UUID不同,用户shipperAccount与运单录入的shipperAccount一致,则只显示用户录入的运单号、shipperAccount、始发国
resultConsignment = new Consignment();
resultConsignment.setId(consignment.getId());
resultConsignment.setConsignmentCode(consignment.getConsignmentCode());
resultConsignment.setUserInputOriginCountry(consignment.getUserInputOriginCountry());
resultConsignment.setUserInputOriginCountryCode(consignment.getUserInputOriginCountryCode());
resultConsignment.setUserInputShipperAccount(consignment.getUserInputShipperAccount());
resultConsignment.setDestinationCountry(consignment.getDestinationCountry());
resultConsignment.setDestinationCountryCode(consignment.getDestinationCountryCode());
}
}
return resultConsignment;
}
}