zelong.shao

customer|多余代码去除

......@@ -7,15 +7,12 @@ import com.fedex.connect.common.dependencies.util.ResponseUtils;
import com.fedex.connect.common.model.biz.Consignment;
import com.fedex.connect.common.model.sys.User;
import com.fedex.connect.customer.data.bo.AddBo;
import com.fedex.connect.customer.data.bo.ConsignmentBo;
import com.fedex.connect.customer.data.dto.ConsignmentAddDto;
import com.fedex.connect.customer.enums.ResponseCode;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
/**
......@@ -111,64 +108,4 @@ public class ConsignmentUtil {
private boolean isShipperAccountMatch(String account1, String account2) {
return StringUtils.hasText(account1) && StringUtils.hasText(account2) && account1.equals(account2);
}
/**
* @Author Szl
* @Description 功能说明 校验运单创建人
* @Date 2024/11/5
* @param consignment
* @return com.fedex.connect.common.dependencies.date.vo.ResponseVo
*/
public void consignmentCreatorCheck(Consignment consignment, ConsignmentBo bo) {
List<String> errList = new ArrayList<>();
// 校验字段是否匹配,并将错误信息添加到errList中
checkFieldMismatch(bo.getShipperAccount(), consignment.getShipperAccount(), ResponseCode.MESSAGE_CODE_31001.getMsg(), errList);
//checkFieldMismatch(bo.getRecipientCountry(), consignment.getRecipientCountry(), "con_recipientCountry", errList);
//checkFieldMismatch(bo.getShipperCountry(), consignment.getShipperCountry(), "con_shipperCountry", errList);
if (!errList.isEmpty()) {
responseUtils.fail(ResponseCode.MESSAGE_CODE_30003,errList);
}
}
/**
* @Author Szl
* @Description 功能说明 对比是否一致
* @Date 2024/11/5
* @param boField
* @param consignmentField
* @param messageKey
* @param errList
* @return void
*/
private void checkFieldMismatch(String boField, String consignmentField, String messageKey, List<String> errList) {
if (!boField.equals(consignmentField)) {
errList.add(localeMessageUtil.getMessage(messageKey));
}
}
/**
* @Author Szl
* @Description 功能说明 判断是否为该用户的uuid
* @Date 2024/11/6
* @param consignment
* @param user
* @return com.fedex.connect.common.dependencies.date.vo.ResponseVo
*/
public ResponseVo consignmentUuidCheck(Consignment consignment, User user){
ConsignmentAddDto consignmentAddDto = new ConsignmentAddDto();
consignmentAddDto.setIsCreatorFlag(DigitConstants.DIGIT_ONE);
consignmentAddDto.setConsignment(consignment);
if (!Objects.equals(consignment.getUserUuid(), user.getUserUuid())){
consignmentAddDto.setIsCreatorFlag(DigitConstants.DIGIT_TWO);
if (Objects.equals(consignment.getShipperAccount(),user.getAccountNo())){
return responseUtils.success(ResponseCode.MESSAGE_CODE_30004,consignmentAddDto);
}else {
return responseUtils.success(ResponseCode.MESSAGE_CODE_30005,consignmentAddDto);
}
}else {
return responseUtils.success(consignmentAddDto);
}
}
}
......