zelong.shao

customer|add运单校验

Showing 15 changed files with 181 additions and 18 deletions
1 package com.fedex.connect.customer.controller.biz.impl; 1 package com.fedex.connect.customer.controller.biz.impl;
2 2
3 +import com.fedex.connect.common.dependencies.annotation.OperationMethodLog;
3 import com.fedex.connect.common.dependencies.date.model.LogShowModel; 4 import com.fedex.connect.common.dependencies.date.model.LogShowModel;
4 import com.fedex.connect.common.dependencies.date.vo.ResponseVo; 5 import com.fedex.connect.common.dependencies.date.vo.ResponseVo;
5 import com.fedex.connect.common.dependencies.enums.ResponseCode; 6 import com.fedex.connect.common.dependencies.enums.ResponseCode;
...@@ -30,7 +31,7 @@ public class ConsignmentController extends BaseController implements IConsignmen ...@@ -30,7 +31,7 @@ public class ConsignmentController extends BaseController implements IConsignmen
30 31
31 @PostMapping("/add") 32 @PostMapping("/add")
32 @ApiOperation("上传运单") 33 @ApiOperation("上传运单")
33 -// @OperationMethodLog() 34 + @OperationMethodLog(describe = "con_add_oper")
34 public ResponseVo addConsignment(@RequestBody AddBo bo){ 35 public ResponseVo addConsignment(@RequestBody AddBo bo){
35 ResponseVo responseResultVo = consignmentValidate.preCheckAdd(bo); 36 ResponseVo responseResultVo = consignmentValidate.preCheckAdd(bo);
36 if (responseResultVo != null){ 37 if (responseResultVo != null){
......
1 +package com.fedex.connect.customer.data.dto;
2 +
3 +import com.fedex.connect.common.model.biz.Consignment;
4 +import lombok.Data;
5 +
6 +@Data
7 +public class ConsignmentAddDto {
8 + Integer isCreatorFlag;
9 + Consignment consignment;
10 +}
1 +package com.fedex.connect.customer.data.dto;
2 +
3 +import lombok.Data;
4 +
5 +import java.util.Date;
6 +@Data
7 +public class FindConsignmentsDto {
8 + private String consignmentCode;
9 +
10 + private String recipientContactName;
11 +
12 + private String recipientCompany;
13 +
14 + private String shipperCountry;
15 +
16 + private String docNondocFlag;
17 +
18 + private String createUserName;
19 +
20 + private Date createTime;
21 +
22 + private Date commitTime;
23 +
24 + private String statusName;
25 +}
1 package com.fedex.connect.customer.repository.dao; 1 package com.fedex.connect.customer.repository.dao;
2 2
3 import com.fedex.connect.common.model.biz.Consignment; 3 import com.fedex.connect.common.model.biz.Consignment;
4 +import com.fedex.connect.customer.data.dto.FindConsignmentsDto;
4 import com.fedex.connect.customer.data.query.ConsignmentQuery; 5 import com.fedex.connect.customer.data.query.ConsignmentQuery;
5 import org.apache.ibatis.annotations.Mapper; 6 import org.apache.ibatis.annotations.Mapper;
6 import org.apache.ibatis.annotations.Param; 7 import org.apache.ibatis.annotations.Param;
...@@ -10,7 +11,7 @@ import java.util.List; ...@@ -10,7 +11,7 @@ import java.util.List;
10 11
11 @Mapper 12 @Mapper
12 public interface ConsignmentExtMapper { 13 public interface ConsignmentExtMapper {
13 - List<Consignment> findConsignments(ConsignmentQuery query); 14 + List<FindConsignmentsDto> findConsignments(ConsignmentQuery query);
14 15
15 Long findAllCount(ConsignmentQuery query); 16 Long findAllCount(ConsignmentQuery query);
16 17
......
...@@ -2,8 +2,38 @@ ...@@ -2,8 +2,38 @@
2 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> 2 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3 <mapper namespace="com.fedex.connect.customer.repository.dao.ConsignmentExtMapper"> 3 <mapper namespace="com.fedex.connect.customer.repository.dao.ConsignmentExtMapper">
4 4
5 - <select id="findConsignments" resultType="com.fedex.connect.common.model.biz.Consignment"> 5 + <sql id="OracleDialectPrefix">
6 - SELECT DISTINCT c.* 6 + <if test="start != null and start >= 0 and size != null and size >= 0">
7 + select * from ( select row_.*, rownum rownum_ from (
8 + </if>
9 + </sql>
10 +
11 + <sql id="OracleDialectSuffix">
12 + <if test="start != null and start >= 0 and size != null and size >= 0">
13 + <![CDATA[ ) row_ ) where rownum_ > #{start} and rownum_ <= #{start} + #{size} ]]>
14 + </if>
15 + </sql>
16 +
17 + <sql id="findConsignments_Column">
18 + c.CONSIGNMENT_CODE,
19 + c.RECIPIENT_CONTACT_NAME,
20 + c.RECIPIENT_COMPANY,
21 + c.SHIPPER_COUNTRY,
22 + CASE
23 + WHEN c.DOC_NONDOC_FLAG = 'Y' THEN 'ITEM'
24 + WHEN c.DOC_NONDOC_FLAG = 'N' THEN 'DOC'
25 + ELSE c.DOC_NONDOC_FLAG
26 + END AS DOC_NONDOC_FLAG,
27 + c.CREATE_USER_NAME,
28 + c.CREATE_TIME,
29 + c.COMMIT_TIME,
30 + c.STATUS_NAME
31 +</sql>
32 +
33 + <select id="findConsignments" resultType="com.fedex.connect.customer.data.dto.FindConsignmentsDto">
34 + <include refid="OracleDialectPrefix"/>
35 + SELECT DISTINCT
36 + <include refid="findConsignments_Column"/>
7 FROM T_BIZ_CONSIGNMENT c 37 FROM T_BIZ_CONSIGNMENT c
8 LEFT JOIN T_BIZ_USER_CONSIGNMENT_MAPPING m ON c.id = m.consignment_id 38 LEFT JOIN T_BIZ_USER_CONSIGNMENT_MAPPING m ON c.id = m.consignment_id
9 WHERE 39 WHERE
...@@ -23,6 +53,7 @@ ...@@ -23,6 +53,7 @@
23 #{item} 53 #{item}
24 </foreach> 54 </foreach>
25 </if> 55 </if>
56 + <include refid="OracleDialectSuffix" />
26 </select> 57 </select>
27 58
28 59
......
1 package com.fedex.connect.customer.repository.repo; 1 package com.fedex.connect.customer.repository.repo;
2 2
3 import com.fedex.connect.common.model.biz.Consignment; 3 import com.fedex.connect.common.model.biz.Consignment;
4 +import com.fedex.connect.customer.data.dto.FindConsignmentsDto;
4 import com.fedex.connect.customer.data.query.ConsignmentQuery; 5 import com.fedex.connect.customer.data.query.ConsignmentQuery;
5 6
6 import java.util.List; 7 import java.util.List;
7 8
8 public interface IConsignmentExtRepository { 9 public interface IConsignmentExtRepository {
9 - List<Consignment> findConsignments(ConsignmentQuery query); 10 + List<FindConsignmentsDto> findConsignments(ConsignmentQuery query);
10 11
11 Long findAllCount(ConsignmentQuery query); 12 Long findAllCount(ConsignmentQuery query);
12 13
......
1 package com.fedex.connect.customer.repository.repo.impl; 1 package com.fedex.connect.customer.repository.repo.impl;
2 2
3 import com.fedex.connect.common.model.biz.Consignment; 3 import com.fedex.connect.common.model.biz.Consignment;
4 +import com.fedex.connect.customer.data.dto.FindConsignmentsDto;
4 import com.fedex.connect.customer.data.query.ConsignmentQuery; 5 import com.fedex.connect.customer.data.query.ConsignmentQuery;
5 import com.fedex.connect.customer.repository.base.BaseDao; 6 import com.fedex.connect.customer.repository.base.BaseDao;
6 import com.fedex.connect.customer.repository.repo.IConsignmentExtRepository; 7 import com.fedex.connect.customer.repository.repo.IConsignmentExtRepository;
...@@ -12,7 +13,7 @@ import java.util.List; ...@@ -12,7 +13,7 @@ import java.util.List;
12 public class ConsignmentExtRepositoryImpl extends BaseDao implements IConsignmentExtRepository { 13 public class ConsignmentExtRepositoryImpl extends BaseDao implements IConsignmentExtRepository {
13 14
14 @Override 15 @Override
15 - public List<Consignment> findConsignments(ConsignmentQuery query) { 16 + public List<FindConsignmentsDto> findConsignments(ConsignmentQuery query) {
16 return consignmentExtMapper.findConsignments(query); 17 return consignmentExtMapper.findConsignments(query);
17 } 18 }
18 19
......
...@@ -7,6 +7,7 @@ import com.fedex.connect.common.dependencies.util.Utils; ...@@ -7,6 +7,7 @@ import com.fedex.connect.common.dependencies.util.Utils;
7 import com.fedex.connect.common.model.biz.Consignment; 7 import com.fedex.connect.common.model.biz.Consignment;
8 import com.fedex.connect.common.model.sys.User; 8 import com.fedex.connect.common.model.sys.User;
9 import com.fedex.connect.customer.data.bo.AddBo; 9 import com.fedex.connect.customer.data.bo.AddBo;
10 +import com.fedex.connect.customer.data.dto.FindConsignmentsDto;
10 import com.fedex.connect.customer.data.query.ConsignmentQuery; 11 import com.fedex.connect.customer.data.query.ConsignmentQuery;
11 import com.fedex.connect.customer.service.base.BaseService; 12 import com.fedex.connect.customer.service.base.BaseService;
12 import com.fedex.connect.customer.service.biz.IConsignmentService; 13 import com.fedex.connect.customer.service.biz.IConsignmentService;
...@@ -49,7 +50,7 @@ public class ConsignmentServiceImpl extends BaseService implements IConsignmentS ...@@ -49,7 +50,7 @@ public class ConsignmentServiceImpl extends BaseService implements IConsignmentS
49 pageResult.setPage(query.getPage()); 50 pageResult.setPage(query.getPage());
50 pageResult.setSize(query.getSize()); 51 pageResult.setSize(query.getSize());
51 if (total != null && total > 0) { 52 if (total != null && total > 0) {
52 - List<Consignment> consignments = consignmentExtRepository.findConsignments(query); 53 + List<FindConsignmentsDto> consignments = consignmentExtRepository.findConsignments(query);
53 pageResult.setList(consignments); 54 pageResult.setList(consignments);
54 } 55 }
55 return ResponseVo.succ(pageResult); 56 return ResponseVo.succ(pageResult);
...@@ -73,7 +74,10 @@ public class ConsignmentServiceImpl extends BaseService implements IConsignmentS ...@@ -73,7 +74,10 @@ public class ConsignmentServiceImpl extends BaseService implements IConsignmentS
73 return responseResultVo; 74 return responseResultVo;
74 } 75 }
75 //校验是否是本账号的运单 76 //校验是否是本账号的运单
76 - 77 + ResponseVo responseVo = consignmentUtil.consignmentUuidCheck(consignment, user);
78 + if (responseVo != null){
79 + return responseVo;
80 + }
77 } 81 }
78 //如果不存在直接返回 82 //如果不存在直接返回
79 return ResponseVo.succ(null); 83 return ResponseVo.succ(null);
......
1 package com.fedex.connect.customer.util.service.biz; 1 package com.fedex.connect.customer.util.service.biz;
2 2
3 +import com.fedex.connect.common.dependencies.contants.DigitConstants;
3 import com.fedex.connect.common.dependencies.date.vo.ResponseVo; 4 import com.fedex.connect.common.dependencies.date.vo.ResponseVo;
4 import com.fedex.connect.common.dependencies.enums.ResponseCode; 5 import com.fedex.connect.common.dependencies.enums.ResponseCode;
5 import com.fedex.connect.common.dependencies.i18n.LocaleMessageUtil; 6 import com.fedex.connect.common.dependencies.i18n.LocaleMessageUtil;
6 import com.fedex.connect.common.model.biz.Consignment; 7 import com.fedex.connect.common.model.biz.Consignment;
8 +import com.fedex.connect.common.model.sys.User;
7 import com.fedex.connect.customer.data.bo.AddBo; 9 import com.fedex.connect.customer.data.bo.AddBo;
10 +import com.fedex.connect.customer.data.dto.ConsignmentAddDto;
8 import org.springframework.beans.factory.annotation.Autowired; 11 import org.springframework.beans.factory.annotation.Autowired;
9 import org.springframework.stereotype.Component; 12 import org.springframework.stereotype.Component;
10 13
11 import java.util.ArrayList; 14 import java.util.ArrayList;
12 import java.util.List; 15 import java.util.List;
16 +import java.util.Objects;
13 17
14 /** 18 /**
15 * @Author Szl 19 * @Author Szl
...@@ -38,7 +42,7 @@ public class ConsignmentUtil { ...@@ -38,7 +42,7 @@ public class ConsignmentUtil {
38 if (!errList.isEmpty()) { 42 if (!errList.isEmpty()) {
39 String enumResCode601 = localeMessageUtil.getMessage("enum_res_code_601"); 43 String enumResCode601 = localeMessageUtil.getMessage("enum_res_code_601");
40 String errResult = String.join(",", errList) + enumResCode601; 44 String errResult = String.join(",", errList) + enumResCode601;
41 - return ResponseVo.fail(ResponseCode.CONSIGNMENT_CREATOR_ERR.getCode(), errResult); 45 + return ResponseVo.fail(ResponseCode.CONSIGNMENT_CREATOR_ERR, errResult);
42 } 46 }
43 47
44 return null; 48 return null;
...@@ -59,4 +63,28 @@ public class ConsignmentUtil { ...@@ -59,4 +63,28 @@ public class ConsignmentUtil {
59 errList.add(localeMessageUtil.getMessage(messageKey)); 63 errList.add(localeMessageUtil.getMessage(messageKey));
60 } 64 }
61 } 65 }
66 +
67 + /**
68 + * @Author Szl
69 + * @Description 功能说明 判断是否为该用户的uuid
70 + * @Date 2024/11/6
71 + * @param consignment
72 + * @param user
73 + * @return com.fedex.connect.common.dependencies.date.vo.ResponseVo
74 + */
75 + public ResponseVo consignmentUuidCheck(Consignment consignment, User user){
76 + ConsignmentAddDto consignmentAddDto = new ConsignmentAddDto();
77 + consignmentAddDto.setIsCreatorFlag(DigitConstants.DIGIT_ONE);
78 + consignmentAddDto.setConsignment(consignment);
79 + if (!Objects.equals(consignment.getUserUuid(), user.getUserUuid())){
80 + consignmentAddDto.setIsCreatorFlag(DigitConstants.DIGIT_TWO);
81 + if (Objects.equals(consignment.getShipperAccount(),user.getAccountNo())){
82 + return ResponseVo.succ(ResponseCode.CONSIGNMENT_CREATOR_SHIPPER_ACCOUNT_SUC.getCode(),ResponseCode.CONSIGNMENT_CREATOR_SHIPPER_ACCOUNT_SUC.getMsg(),consignmentAddDto);
83 + }else {
84 + return ResponseVo.succ(ResponseCode.CONSIGNMENT_CREATOR_SHIPPER_ACCOUNT_DIFF_SUC.getCode(),ResponseCode.CONSIGNMENT_CREATOR_SHIPPER_ACCOUNT_DIFF_SUC.getMsg(),consignmentAddDto);
85 + }
86 + }else {
87 + return ResponseVo.succ(consignmentAddDto);
88 + }
89 + }
62 } 90 }
......
...@@ -3,8 +3,12 @@ conl_cus_declare_count_max=單次最多可查詢1000個運單號碼 ...@@ -3,8 +3,12 @@ conl_cus_declare_count_max=單次最多可查詢1000個運單號碼
3 enum_res_code_301=登錄身份異常 3 enum_res_code_301=登錄身份異常
4 enum_res_code_305=登錄已過期,請重新登錄 4 enum_res_code_305=登錄已過期,請重新登錄
5 5
6 -enum_res_code_601 = 不正确,请重新输入 6 +enum_res_code_601=不正确,请重新输入
7 +enum_res_code_602=The waybill you entered is generated by another user, whether continue uploading? Confirm, Cancel. No more prompts in the future for the same situation.
8 +enum_res_code_603=The waybill you entered is generated by another account, whether continue uploading? Confirm, Cancel. No more prompts in the future for the same situation.
7 9
8 -con_shipperAccount = 发货人计费账号
9 -con_shipperCountry = 始发国
10 -con_recipientCountry = 目的国
...\ No newline at end of file ...\ No newline at end of file
10 +con_shipperAccount=发货人计费账号
11 +con_shipperCountry=始发国
12 +con_recipientCountry=目的国
13 +
14 +con_add_oper=添加运单
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -3,8 +3,12 @@ conl_cus_declare_count_max=單次最多可查詢1000個運單號碼 ...@@ -3,8 +3,12 @@ conl_cus_declare_count_max=單次最多可查詢1000個運單號碼
3 enum_res_code_301=登錄身份異常 3 enum_res_code_301=登錄身份異常
4 enum_res_code_305=登錄已過期,請重新登錄 4 enum_res_code_305=登錄已過期,請重新登錄
5 5
6 -enum_res_code_601 = 不正确,请重新输入 6 +enum_res_code_601=不正确,请重新输入
7 +enum_res_code_602=The waybill you entered is generated by another user, whether continue uploading? Confirm, Cancel. No more prompts in the future for the same situation.
8 +enum_res_code_603=The waybill you entered is generated by another account, whether continue uploading? Confirm, Cancel. No more prompts in the future for the same situation.
7 9
8 -con_shipperAccount = 发货人计费账号
9 -con_shipperCountry = 始发国
10 -con_recipientCountry = 目的国
...\ No newline at end of file ...\ No newline at end of file
10 +con_shipperAccount=发货人计费账号
11 +con_shipperCountry=始发国
12 +con_recipientCountry=目的国
13 +
14 +con_add_oper=添加运单
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -110,4 +110,9 @@ public class CacheSystem implements CommandLineRunner { ...@@ -110,4 +110,9 @@ public class CacheSystem implements CommandLineRunner {
110 List<DictionaryEntries> filter = dictionaryMap.get(DictionaryConstants.COUNTRY).stream().filter(p -> ext1.equals(p.getExt1())).collect(Collectors.toList()); 110 List<DictionaryEntries> filter = dictionaryMap.get(DictionaryConstants.COUNTRY).stream().filter(p -> ext1.equals(p.getExt1())).collect(Collectors.toList());
111 return filter.isEmpty() ? null : filter.get(DigitConstants.DIGIT_ZERO); 111 return filter.isEmpty() ? null : filter.get(DigitConstants.DIGIT_ZERO);
112 } 112 }
113 +
114 + public DictionaryEntries getDicUserLoginType(String code){
115 + List<DictionaryEntries> filter = dictionaryMap.get(DictionaryConstants.USER_LOGIN_TYPE).stream().filter(p -> code.equals(p.getCode())).collect(Collectors.toList());
116 + return filter.isEmpty() ? null : filter.get(DigitConstants.DIGIT_ZERO);
117 + }
113 } 118 }
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -12,4 +12,6 @@ public interface DictionaryConstants { ...@@ -12,4 +12,6 @@ public interface DictionaryConstants {
12 String USER_TYPE = "USER_TYPE"; 12 String USER_TYPE = "USER_TYPE";
13 //国家 13 //国家
14 String COUNTRY = "COUNTRY"; 14 String COUNTRY = "COUNTRY";
15 + //用户操作类型
16 + String USER_LOGIN_TYPE = "USER_LOGIN_TYPE";
15 } 17 }
......
...@@ -53,7 +53,9 @@ public enum ResponseCode { ...@@ -53,7 +53,9 @@ public enum ResponseCode {
53 REQUEST_OBJECT_NULL(606, "enum_res_code_606"), 53 REQUEST_OBJECT_NULL(606, "enum_res_code_606"),
54 REQUEST_PARAM_UNREASONABLE(606, "enum_res_code_607"), 54 REQUEST_PARAM_UNREASONABLE(606, "enum_res_code_607"),
55 55
56 - CONSIGNMENT_CREATOR_ERR(601,"enum_res_code_601") 56 + CONSIGNMENT_CREATOR_ERR(601,"enum_res_code_601"),
57 + CONSIGNMENT_CREATOR_SHIPPER_ACCOUNT_SUC(602,"enum_res_code_602"),
58 + CONSIGNMENT_CREATOR_SHIPPER_ACCOUNT_DIFF_SUC(603,"enum_res_code_603"),
57 ; 59 ;
58 private Integer code; 60 private Integer code;
59 private String msg; 61 private String msg;
......
1 +package com.fedex.connect.common.dependencies.enums.sys;
2 +
3 +public enum UserLoginTypeEnum {
4 + LOGIN(0L,"Login","登录"),
5 + EXIT(1L,"Exit","退出"),
6 + CHANGEPASSWORD(2L,"ChangePassword","修改密码"),
7 + FCLLOGINREGISTRATION(3L,"FCLLoginRegistration","FCL登录注册"),
8 + DEACTIVATE(4L,"Deactivate","停用"),
9 + ENABLE(5L,"Enable","启用"),
10 +;
11 + private Long code;
12 + private String enMsg;
13 + private String msg;
14 +
15 + UserLoginTypeEnum(Long code, String enMsg,String msg) {
16 + this.code = code;
17 + this.enMsg = enMsg;
18 + this.msg = msg;
19 + }
20 +
21 + public Long getCode() {
22 + return code;
23 + }
24 +
25 + public void setCode(Long code) {
26 + this.code = code;
27 + }
28 +
29 + public String getEnMsg() {
30 + return enMsg;
31 + }
32 +
33 + public void setEnMsg(String enMsg) {
34 + this.enMsg = enMsg;
35 + }
36 +
37 + public String getMsg() {
38 + return msg;
39 + }
40 +
41 + public void setMsg(String msg) {
42 + this.msg = msg;
43 + }
44 +}