zelong.shao

customer|添加ce标志

package com.fedex.connect.customer.data.dto;
import com.fedex.connect.common.model.biz.Consignment;
import lombok.Data;
@Data
......@@ -9,5 +8,5 @@ public class ConsignmentAddDto {
* 是否为该用户的运单 1:是 0:否
*/
private Integer isCreatorFlag;
private Consignment consignment;
private ConsignmentDto consignment;
}
......
package com.fedex.connect.customer.data.dto;
import com.fedex.connect.common.model.biz.Consignment;
import lombok.Data;
@Data
public class ConsignmentDto extends Consignment {
private Long ceFlag;
}
......@@ -34,4 +34,6 @@ public class FindConsignmentsDto {
private String userInputOriginCountryCode;
private String userInputOriginCountry;
private Long ceFlag;
}
......
......@@ -33,7 +33,8 @@
c.SHIPPER_ACCOUNT,
c.USER_INPUT_SHIPPER_ACCOUNT,
c.USER_INPUT_ORIGIN_COUNTRY_CODE,
c.USER_INPUT_ORIGIN_COUNTRY
c.USER_INPUT_ORIGIN_COUNTRY,
m.CE_FLAG
</sql>
<select id="findConsignments" resultType="com.fedex.connect.customer.data.dto.FindConsignmentsDto">
......@@ -47,9 +48,12 @@
(m.user_id = #{userId} AND m.consignment_id IS NOT NULL)
OR c.user_uuid = #{uuid,jdbcType=VARCHAR}
)
<if test="statusCode != null and statusCode != ''">
<if test="statusCode != null and statusCode != '' and statusCode != 'null'">
AND c.STATUS_CODE = #{statusCode}
</if>
<if test="statusCode == 'null'">
AND c.STATUS_CODE IS NULL
</if>
<if test="createTimeFrom != null and createTimeFrom != ''">
AND c.CREATE_TIME &gt; TO_DATE(#{createTimeFrom} || ' 00:00:00', 'YYYY-MM-DD HH24:MI:SS')
</if>
......
......@@ -30,4 +30,14 @@ public interface IUserConsignmentMappingRepository {
* @return void
*/
void saveOrUpdateAll(List<UserConsignmentMapping> list);
/**
* @Author Szl
* @Description 功能说明 根据用户id和运单号查询mapping
* @Date 2024/12/31
* @param userId
* @param consignmentCode
* @return com.fedex.connect.common.model.biz.UserConsignmentMapping
*/
UserConsignmentMapping findByUserIdAndConsignmentCode(Long userId,String consignmentCode);
}
......
......@@ -9,10 +9,7 @@ import com.fedex.connect.customer.data.query.UserConsignmentInfoQuery;
import com.fedex.connect.customer.repository.base.BaseDao;
import com.fedex.connect.customer.repository.repo.IConsignmentRepository;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDate;
import java.util.Collections;
......@@ -49,9 +46,7 @@ public class ConsignmentRepositoryImpl extends BaseDao implements IConsignmentRe
if (SystemDefaultUserConstants.SYSTEM_USER_KEYS.USER_NAME.equals(consignment.getCreateUserName())){
consignment.setCreateUserName(user.getUserName());
}
if (!StringUtils.equals(user.getUserUuid(), consignment.getUserUuid())
&& !StringUtils.equals(user.getAccountNo(), consignment.getShipperAccount())
&& !StringUtils.equals(consignment.getUserInputShipperAccount(), consignment.getShipperAccount())) {
if (!StringUtils.equals(user.getUserUuid(), consignment.getUserUuid()) || (consignment.getCeFlag() != null && consignment.getCeFlag() == 0)) {
consignment.setRecipientContactName(null);
consignment.setRecipientCompany(null);
consignment.setDocNondocFlag(null);
......
......@@ -51,4 +51,22 @@ public class UserConsignmentMappingRepositoryImpl extends BaseDao implements IUs
}
});
}
/**
* @Author Szl
* @Description 功能说明 根据用户id和运单号查询mapping
* @Date 2024/12/31
* @param userId
* @param consignmentCode
* @return com.fedex.connect.common.model.biz.UserConsignmentMapping
*/
@Override
public UserConsignmentMapping findByUserIdAndConsignmentCode(Long userId,String consignmentCode){
UserConsignmentMappingExample example = new UserConsignmentMappingExample();
UserConsignmentMappingExample.Criteria criteria = example.createCriteria();
criteria.andUserIdEqualTo(userId);
criteria.andConsignmentCodeEqualTo(consignmentCode);
criteria.andStatusEqualTo(StatusEnum.YES.getCode());
return CollectionUtils.firstElement(userConsignmentMappingMapper.selectByExample(example));
}
}
......
......@@ -6,6 +6,7 @@ import com.fedex.connect.common.dependencies.exception.OpErrorException;
import com.fedex.connect.common.model.biz.Attachment;
import com.fedex.connect.common.model.biz.Consignment;
import com.fedex.connect.common.model.biz.UploadRecord;
import com.fedex.connect.common.model.biz.UserConsignmentMapping;
import com.fedex.connect.common.model.sys.User;
import com.fedex.connect.customer.data.bo.AddBo;
import com.fedex.connect.customer.data.bo.ConsignmentBo;
......@@ -84,6 +85,18 @@ public class ConsignmentServiceImpl extends BaseService implements IConsignmentS
}
}
/**
* 存在运单则获取mapping表
*/
UserConsignmentMapping byUserIdAndConsignmentCode = userConsignmentMappingRepository.findByUserIdAndConsignmentCode(user.getId(), consignment.getConsignmentCode());
Long ceFlag = 1L;
if (byUserIdAndConsignmentCode == null){
ceFlag = 3L;
}else if (byUserIdAndConsignmentCode.getCeFlag() != null){
ceFlag = byUserIdAndConsignmentCode.getCeFlag();
}
/**
* 根据是否是DM501返回不同的提示
*/
if (StringUtils.isEmpty(consignment.getUserUuid()) && StringUtils.isEmpty(consignment.getShipperAccount())){
......@@ -99,7 +112,7 @@ public class ConsignmentServiceImpl extends BaseService implements IConsignmentS
/**
* 501数据
*/
return consignmentUtil.consignmentCheckWithCe(consignment,bo,user);
return consignmentUtil.consignmentCheckWithCe(consignment,bo,user,ceFlag);
}
}
......
......@@ -12,10 +12,12 @@ 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.data.dto.ConsignmentDto;
import com.fedex.connect.customer.enums.ResponseCode;
import com.fedex.connect.customer.repository.repo.*;
import com.fedex.connect.customer.service.biz.IEmailService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
......@@ -130,7 +132,7 @@ public class ConsignmentUtil {
ConsignmentAddDto consignmentAddDto = new ConsignmentAddDto();
if (isShipperAccountMatch(bo.getShipperAccount(), consignment.getUserInputShipperAccount())){
consignmentAddDto.setIsCreatorFlag(DigitConstants.DIGIT_ONE);
Consignment consignmentUserInput = new Consignment();
ConsignmentDto consignmentUserInput = new ConsignmentDto();
consignmentUserInput.setId(consignment.getId());
consignmentUserInput.setConsignmentCode(consignment.getConsignmentCode());
consignmentUserInput.setUserInputShipperAccount(consignment.getUserInputShipperAccount());
......@@ -141,6 +143,7 @@ public class ConsignmentUtil {
consignmentUserInput.setShipperAccount(consignment.getUserInputShipperAccount());
consignmentUserInput.setDestinationCountryCode(consignment.getDestinationCountryCode());
consignmentUserInput.setDestinationCountry(consignment.getDestinationCountry());
consignmentUserInput.setCeFlag(0L);
consignmentAddDto.setConsignment(consignmentUserInput);
return responseUtils.success(consignmentAddDto);
}else {
......@@ -158,15 +161,17 @@ public class ConsignmentUtil {
* @param user
* @return void
*/
public ResponseVo consignmentCheckWithCe(Consignment consignment, AddBo bo, User user) {
public ResponseVo consignmentCheckWithCe(Consignment consignment, AddBo bo, User user,Long ceFlag) {
ConsignmentAddDto consignmentAddDto = new ConsignmentAddDto();
ConsignmentDto consignmentDto = new ConsignmentDto();
BeanUtils.copyProperties(consignment, consignmentDto);
/**
* uuid相同,直接返回所有运单信息
*/
if (Objects.equals(consignment.getUserUuid(), user.getUserUuid())) {
consignmentAddDto.setIsCreatorFlag(DigitConstants.DIGIT_ONE);
consignmentAddDto.setConsignment(consignment);
consignmentDto.setCeFlag(1L);
consignmentAddDto.setConsignment(consignmentDto);
return responseUtils.success(consignmentAddDto);
}
......@@ -175,11 +180,29 @@ public class ConsignmentUtil {
*/
if (isShipperAccountMatch(user.getAccountNo(), consignment.getShipperAccount())) {
consignmentAddDto.setIsCreatorFlag(DigitConstants.DIGIT_ONE);
consignmentAddDto.setConsignment(consignment);
consignmentDto.setCeFlag(1L);
consignmentAddDto.setConsignment(consignmentDto);
return responseUtils.success(ResponseCode.MESSAGE_CODE_30004, consignmentAddDto);
}
/**
* mapping表判断,存在mapping则返回对应数据
*/
if (ceFlag == 0){
consignmentAddDto.setIsCreatorFlag(DigitConstants.DIGIT_ONE);
ConsignmentDto consignmentUserInput = new ConsignmentDto();
this.initConByNotCe(consignmentUserInput,consignmentDto);
consignmentDto.setCeFlag(0L);
consignmentAddDto.setConsignment(consignmentUserInput);
return responseUtils.success(consignmentAddDto);
}else if (ceFlag == 1){
consignmentAddDto.setIsCreatorFlag(DigitConstants.DIGIT_ONE);
consignmentDto.setCeFlag(1L);
consignmentAddDto.setConsignment(consignmentDto);
return responseUtils.success(consignmentAddDto);
}
/**
* uuid不一致且未填写shipperAccount
*/
if (!StringUtils.hasText(bo.getShipperAccount())){
......@@ -192,7 +215,7 @@ public class ConsignmentUtil {
*/
if (isShipperAccountMatch(bo.getShipperAccount(), consignment.getShipperAccount())) {
consignmentAddDto.setIsCreatorFlag(DigitConstants.DIGIT_ONE);
consignmentAddDto.setConsignment(consignment);
consignmentAddDto.setConsignment(consignmentDto);
return responseUtils.success(consignmentAddDto);
}
......@@ -200,17 +223,9 @@ public class ConsignmentUtil {
if (!StringUtils.isEmpty(consignment.getUserInputShipperAccount())){
if (isShipperAccountMatch(bo.getShipperAccount(),consignment.getUserInputShipperAccount())){
consignmentAddDto.setIsCreatorFlag(DigitConstants.DIGIT_ONE);
Consignment consignmentUserInput = new Consignment();
consignmentUserInput.setId(consignment.getId());
consignmentUserInput.setConsignmentCode(consignment.getConsignmentCode());
consignmentUserInput.setUserInputShipperAccount(consignment.getUserInputShipperAccount());
consignmentUserInput.setUserInputOriginCountry(consignment.getUserInputOriginCountry());
consignmentUserInput.setUserInputOriginCountryCode(consignment.getUserInputOriginCountryCode());
consignmentUserInput.setOriginCountry(consignment.getUserInputOriginCountry());
consignmentUserInput.setOriginCountryCode(consignment.getUserInputOriginCountryCode());
consignmentUserInput.setShipperAccount(consignment.getUserInputShipperAccount());
consignmentUserInput.setDestinationCountryCode(consignment.getDestinationCountryCode());
consignmentUserInput.setDestinationCountry(consignment.getDestinationCountry());
ConsignmentDto consignmentUserInput = new ConsignmentDto();
this.initConByNotCe(consignmentUserInput,consignmentDto);
consignmentDto.setCeFlag(0L);
consignmentAddDto.setConsignment(consignmentUserInput);
return responseUtils.success(consignmentAddDto);
}else {
......@@ -235,6 +250,20 @@ public class ConsignmentUtil {
return StringUtils.hasText(account1) && StringUtils.hasText(account2) && account1.equals(account2);
}
private Consignment initConByNotCe(ConsignmentDto consignmentUserInput,ConsignmentDto consignment){
consignmentUserInput.setId(consignment.getId());
consignmentUserInput.setConsignmentCode(consignment.getConsignmentCode());
consignmentUserInput.setUserInputShipperAccount(consignment.getUserInputShipperAccount());
consignmentUserInput.setUserInputOriginCountry(consignment.getUserInputOriginCountry());
consignmentUserInput.setUserInputOriginCountryCode(consignment.getUserInputOriginCountryCode());
consignmentUserInput.setOriginCountry(consignment.getUserInputOriginCountry());
consignmentUserInput.setOriginCountryCode(consignment.getUserInputOriginCountryCode());
consignmentUserInput.setShipperAccount(consignment.getUserInputShipperAccount());
consignmentUserInput.setDestinationCountryCode(consignment.getDestinationCountryCode());
consignmentUserInput.setDestinationCountry(consignment.getDestinationCountry());
return consignmentUserInput;
}
/**
* @Author mt
* @Description 保存运单相关信息
......
......@@ -13,6 +13,7 @@
<result column="MODIFY_USER_ID" jdbcType="NUMERIC" property="modifyUserId" />
<result column="MODIFY_USER_NAME" jdbcType="VARCHAR" property="modifyUserName" />
<result column="CONSIGNMENT_CODE" jdbcType="VARCHAR" property="consignmentCode" />
<result column="CE_FLAG" jdbcType="NUMERIC" property="ceFlag" />
</resultMap>
<sql id="Example_Where_Clause">
<where>
......@@ -74,7 +75,7 @@
</sql>
<sql id="Base_Column_List">
ID, USER_ID, CONSIGNMENT_ID, STATUS, CREATE_TIME, CREATE_USER_ID, CREATE_USER_NAME,
MODIFY_TIME, MODIFY_USER_ID, MODIFY_USER_NAME, CONSIGNMENT_CODE
MODIFY_TIME, MODIFY_USER_ID, MODIFY_USER_NAME, CONSIGNMENT_CODE, CE_FLAG
</sql>
<select id="selectByExample" parameterType="com.fedex.connect.common.model.biz.UserConsignmentMappingExample" resultMap="BaseResultMap">
<include refid="OracleDialectPrefix" />
......@@ -116,11 +117,11 @@
insert into ICLEARIMP.T_BIZ_USER_CONSIGNMENT_MAPPING (ID, USER_ID, CONSIGNMENT_ID,
STATUS, CREATE_TIME, CREATE_USER_ID,
CREATE_USER_NAME, MODIFY_TIME, MODIFY_USER_ID,
MODIFY_USER_NAME, CONSIGNMENT_CODE)
MODIFY_USER_NAME, CONSIGNMENT_CODE, CE_FLAG)
values (#{id,jdbcType=NUMERIC}, #{userId,jdbcType=NUMERIC}, #{consignmentId,jdbcType=NUMERIC},
#{status,jdbcType=NUMERIC}, #{createTime,jdbcType=TIMESTAMP}, #{createUserId,jdbcType=NUMERIC},
#{createUserName,jdbcType=VARCHAR}, #{modifyTime,jdbcType=TIMESTAMP}, #{modifyUserId,jdbcType=NUMERIC},
#{modifyUserName,jdbcType=VARCHAR}, #{consignmentCode,jdbcType=VARCHAR})
#{modifyUserName,jdbcType=VARCHAR}, #{consignmentCode,jdbcType=VARCHAR}, #{ceFlag,jdbcType=NUMERIC})
</insert>
<insert id="insertSelective" parameterType="com.fedex.connect.common.model.biz.UserConsignmentMapping">
<selectKey keyProperty="id" order="BEFORE" resultType="java.lang.Long">
......@@ -159,6 +160,9 @@
<if test="consignmentCode != null">
CONSIGNMENT_CODE,
</if>
<if test="ceFlag != null">
CE_FLAG,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
#{id,jdbcType=NUMERIC},
......@@ -192,6 +196,9 @@
<if test="consignmentCode != null">
#{consignmentCode,jdbcType=VARCHAR},
</if>
<if test="ceFlag != null">
#{ceFlag,jdbcType=NUMERIC},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.fedex.connect.common.model.biz.UserConsignmentMappingExample" resultType="java.lang.Long">
......@@ -236,6 +243,9 @@
<if test="record.consignmentCode != null">
CONSIGNMENT_CODE = #{record.consignmentCode,jdbcType=VARCHAR},
</if>
<if test="record.ceFlag != null">
CE_FLAG = #{record.ceFlag,jdbcType=NUMERIC},
</if>
</set>
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
......@@ -254,6 +264,7 @@
MODIFY_USER_ID = #{record.modifyUserId,jdbcType=NUMERIC},
MODIFY_USER_NAME = #{record.modifyUserName,jdbcType=VARCHAR},
CONSIGNMENT_CODE = #{record.consignmentCode,jdbcType=VARCHAR}
CE_FLAG = #{record.ceFlag,jdbcType=NUMERIC}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
......@@ -291,6 +302,9 @@
<if test="consignmentCode != null">
CONSIGNMENT_CODE = #{consignmentCode,jdbcType=VARCHAR},
</if>
<if test="cceFlag != null">
CE_FLAG = #{cceFlag,jdbcType=NUMERIC},
</if>
</set>
where ID = #{id,jdbcType=NUMERIC}
</update>
......@@ -306,6 +320,7 @@
MODIFY_USER_ID = #{modifyUserId,jdbcType=NUMERIC},
MODIFY_USER_NAME = #{modifyUserName,jdbcType=VARCHAR},
CONSIGNMENT_CODE = #{consignmentCode,jdbcType=VARCHAR}
CE_FLAG = #{ceFlag,jdbcType=NUMERIC}
where ID = #{id,jdbcType=NUMERIC}
</update>
<sql id="OracleDialectPrefix">
......
......@@ -63,6 +63,11 @@ public class UserConsignmentMapping implements Serializable {
*/
private String consignmentCode;
/**
* 是否使用CE数据标志
*/
private Long ceFlag;
private static final long serialVersionUID = 1L;
public Long getId() {
......@@ -153,6 +158,18 @@ public class UserConsignmentMapping implements Serializable {
this.consignmentCode = consignmentCode == null ? null : consignmentCode.trim();
}
public Long getCeFlag() {
return ceFlag;
}
public void setCeFlag(Long ceFlag) {
this.ceFlag = ceFlag;
}
public static long getSerialVersionUID() {
return serialVersionUID;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
......
......@@ -2,7 +2,7 @@ package com.fedex.connect.common.dependencies.enums.sys;
public enum UserTypeEnum {
LOCAL("userType_01","LOCAL","本地账号"),
FCL("userType_02","FCL","FCL账号");
FCL("userType_02","FCL account number","FCL账号");
private String code;
private String enMsg;
......