tao.mo

common-dependencies、biz-customer | 修改 | 国际化文件配置调整

mt
2024年11月11日18:11:23
Showing 32 changed files with 199 additions and 262 deletions
...@@ -3,6 +3,7 @@ package com.fedex.connect.customer.controller.base; ...@@ -3,6 +3,7 @@ package com.fedex.connect.customer.controller.base;
3 3
4 import com.fedex.connect.common.dependencies.common.BasicController; 4 import com.fedex.connect.common.dependencies.common.BasicController;
5 import com.fedex.connect.common.dependencies.i18n.LocaleMessageUtil; 5 import com.fedex.connect.common.dependencies.i18n.LocaleMessageUtil;
6 +import com.fedex.connect.common.dependencies.util.ResponseUtils;
6 import com.fedex.connect.common.model.sys.User; 7 import com.fedex.connect.common.model.sys.User;
7 import com.fedex.connect.customer.service.biz.*; 8 import com.fedex.connect.customer.service.biz.*;
8 import com.fedex.connect.customer.validate.controller.biz.AttachmentValidate; 9 import com.fedex.connect.customer.validate.controller.biz.AttachmentValidate;
...@@ -23,6 +24,9 @@ public class BaseController extends BasicController { ...@@ -23,6 +24,9 @@ public class BaseController extends BasicController {
23 protected LocaleMessageUtil localeMessageUtil; 24 protected LocaleMessageUtil localeMessageUtil;
24 25
25 @Autowired 26 @Autowired
27 + protected ResponseUtils responseUtils;
28 +
29 + @Autowired
26 protected IConsignmentService consignmentService; 30 protected IConsignmentService consignmentService;
27 31
28 @Autowired 32 @Autowired
......
...@@ -7,7 +7,6 @@ import com.fedex.connect.common.model.sys.User; ...@@ -7,7 +7,6 @@ import com.fedex.connect.common.model.sys.User;
7 import com.fedex.connect.customer.controller.base.BaseController; 7 import com.fedex.connect.customer.controller.base.BaseController;
8 import com.fedex.connect.customer.controller.biz.IConsignmentController; 8 import com.fedex.connect.customer.controller.biz.IConsignmentController;
9 import com.fedex.connect.customer.data.bo.ConsignmentBo; 9 import com.fedex.connect.customer.data.bo.ConsignmentBo;
10 -import com.fedex.connect.customer.data.query.UserConsignmentInfoQuery;
11 import io.swagger.annotations.Api; 10 import io.swagger.annotations.Api;
12 import io.swagger.annotations.ApiOperation; 11 import io.swagger.annotations.ApiOperation;
13 import org.springframework.web.bind.annotation.*; 12 import org.springframework.web.bind.annotation.*;
...@@ -26,12 +25,9 @@ public class ConsignmentController extends BaseController implements IConsignmen ...@@ -26,12 +25,9 @@ public class ConsignmentController extends BaseController implements IConsignmen
26 @Override 25 @Override
27 @PostMapping("/add") 26 @PostMapping("/add")
28 @ApiOperation(value = "ResponseVo", notes = "上传运单") 27 @ApiOperation(value = "ResponseVo", notes = "上传运单")
29 - @OperationMethodLog(describe = "con_add_oper") 28 + @OperationMethodLog(describe = "business_log_20001")
30 public ResponseVo addConsignment(@RequestBody ConsignmentBo bo){ 29 public ResponseVo addConsignment(@RequestBody ConsignmentBo bo){
31 - ResponseVo responseResultVo = consignmentValidate.preCheckAdd(bo); 30 + consignmentValidate.preCheckAdd(bo);
32 - if (responseResultVo != null){
33 - return responseResultVo;
34 - }
35 /** 31 /**
36 * 获取当前用户信息 32 * 获取当前用户信息
37 */ 33 */
...@@ -42,7 +38,7 @@ public class ConsignmentController extends BaseController implements IConsignmen ...@@ -42,7 +38,7 @@ public class ConsignmentController extends BaseController implements IConsignmen
42 @Override 38 @Override
43 @PostMapping("/submit") 39 @PostMapping("/submit")
44 @ApiOperation(value = "ResponseVo", notes = "运单提交") 40 @ApiOperation(value = "ResponseVo", notes = "运单提交")
45 - @OperationMethodLog(describe = "con_submit_oper") 41 + @OperationMethodLog(describe = "business_log_20002")
46 public ResponseVo submitConsignment(@RequestParam("fileUpload") MultipartFile[] files, 42 public ResponseVo submitConsignment(@RequestParam("fileUpload") MultipartFile[] files,
47 @RequestParam("consignmentJson") String consignmentJson) { 43 @RequestParam("consignmentJson") String consignmentJson) {
48 ConsignmentBo consignmentBo = JSONObject.parseObject(consignmentJson,ConsignmentBo.class); 44 ConsignmentBo consignmentBo = JSONObject.parseObject(consignmentJson,ConsignmentBo.class);
......
...@@ -7,11 +7,18 @@ package com.fedex.connect.customer.enums; ...@@ -7,11 +7,18 @@ package com.fedex.connect.customer.enums;
7 */ 7 */
8 public enum ResponseCode { 8 public enum ResponseCode {
9 //********************biz_customer模块 9 //********************biz_customer模块
10 + MESSAGE_CODE_30001(30001,"business_exception_30001"),
11 + MESSAGE_CODE_30002(30002,"business_exception_30002"),
12 + MESSAGE_CODE_30003(30003,"business_exception_30003"),
13 + MESSAGE_CODE_30004(30004,"business_exception_30004"),
14 + MESSAGE_CODE_30005(30005,"business_exception_30005"),
15 + MESSAGE_CODE_30006(30006,"business_exception_30006"),
10 /******打个样,编写样例*****/ 16 /******打个样,编写样例*****/
11 - MESSAGE_CODE_10001(10001,"business_exception_10001"), 17 +// MESSAGE_CODE_30001(30001,"business_exception_30001"),
12 -// MESSAGE_CODE_10002(10002,"business_success_10002"), 18 +// MESSAGE_CODE_30002(30002,"business_success_30002"),
13 -// MESSAGE_CODE_10003(10003,"system_exception_10003"), 19 +// MESSAGE_CODE_30003(30003,"system_exception_30003"),
14 -// MESSAGE_CODE_10004(10004,"system_success_10004"), 20 +// MESSAGE_CODE_30004(30004,"system_success_30004"),
21 +// MESSAGE_CODE_30005(30005,"business_log_30005"),
15 ; 22 ;
16 private Integer code; 23 private Integer code;
17 private String msg; 24 private String msg;
......
1 package com.fedex.connect.customer.service.base; 1 package com.fedex.connect.customer.service.base;
2 2
3 -import com.fedex.connect.common.dependencies.i18n.LocaleMessageUtil; 3 +import com.fedex.connect.common.dependencies.util.ResponseUtils;
4 import com.fedex.connect.customer.repository.repo.IAttachmentRepository; 4 import com.fedex.connect.customer.repository.repo.IAttachmentRepository;
5 import com.fedex.connect.customer.repository.repo.IConsignmentRepository; 5 import com.fedex.connect.customer.repository.repo.IConsignmentRepository;
6 import com.fedex.connect.customer.repository.repo.IUploadRecordRepository; 6 import com.fedex.connect.customer.repository.repo.IUploadRecordRepository;
7 import org.springframework.beans.factory.annotation.Autowired; 7 import org.springframework.beans.factory.annotation.Autowired;
8 -import javax.annotation.Resource;
9 8
10 public class BaseService { 9 public class BaseService {
11 10
12 - @Resource 11 + @Autowired
13 - protected LocaleMessageUtil localeMessageUtil; 12 + protected ResponseUtils responseUtils;
14 13
15 @Autowired 14 @Autowired
16 protected IConsignmentRepository consignmentRepository; 15 protected IConsignmentRepository consignmentRepository;
......
...@@ -24,6 +24,6 @@ public class AttachmentQueryServiceImpl extends BaseService implements IAttachme ...@@ -24,6 +24,6 @@ public class AttachmentQueryServiceImpl extends BaseService implements IAttachme
24 */ 24 */
25 public ResponseVo queryInfo(UserConsignmentInfoQuery userConsignmentInfoQuery){ 25 public ResponseVo queryInfo(UserConsignmentInfoQuery userConsignmentInfoQuery){
26 Attachment attachment = attachmentRepository.queryInfo(userConsignmentInfoQuery); 26 Attachment attachment = attachmentRepository.queryInfo(userConsignmentInfoQuery);
27 - return ResponseVo.succ(attachment); 27 + return responseUtils.success(attachment);
28 } 28 }
29 } 29 }
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -8,6 +8,7 @@ import com.fedex.connect.common.model.biz.Consignment; ...@@ -8,6 +8,7 @@ import com.fedex.connect.common.model.biz.Consignment;
8 import com.fedex.connect.customer.data.dto.FindConsignmentsDto; 8 import com.fedex.connect.customer.data.dto.FindConsignmentsDto;
9 import com.fedex.connect.customer.data.query.UserConsignmentInfoQuery; 9 import com.fedex.connect.customer.data.query.UserConsignmentInfoQuery;
10 import com.fedex.connect.customer.data.query.ConsignmentQuery; 10 import com.fedex.connect.customer.data.query.ConsignmentQuery;
11 +import com.fedex.connect.customer.enums.ResponseCode;
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.IConsignmentQueryService; 13 import com.fedex.connect.customer.service.biz.IConsignmentQueryService;
13 import org.springframework.stereotype.Service; 14 import org.springframework.stereotype.Service;
...@@ -32,7 +33,7 @@ public class ConsignmentQueryServiceImpl extends BaseService implements IConsign ...@@ -32,7 +33,7 @@ public class ConsignmentQueryServiceImpl extends BaseService implements IConsign
32 public ResponseVo findConsignments(ConsignmentQuery query) { 33 public ResponseVo findConsignments(ConsignmentQuery query) {
33 List<String> consignmentCodeList = query.getConsignmentCodeList(); 34 List<String> consignmentCodeList = query.getConsignmentCodeList();
34 if (Utils.isNotEmpty(consignmentCodeList) && consignmentCodeList.size() > GlobalConstantFedex.DECLARE_COUNT) { 35 if (Utils.isNotEmpty(consignmentCodeList) && consignmentCodeList.size() > GlobalConstantFedex.DECLARE_COUNT) {
35 - return ResponseVo.fail(localeMessageUtil.getMessage("conl_cus_declare_count_max")); 36 + responseUtils.fail(ResponseCode.MESSAGE_CODE_30002);
36 } 37 }
37 38
38 //查询数量 39 //查询数量
...@@ -46,7 +47,7 @@ public class ConsignmentQueryServiceImpl extends BaseService implements IConsign ...@@ -46,7 +47,7 @@ public class ConsignmentQueryServiceImpl extends BaseService implements IConsign
46 List<FindConsignmentsDto> consignments = consignmentRepository.findConsignments(query); 47 List<FindConsignmentsDto> consignments = consignmentRepository.findConsignments(query);
47 pageResult.setList(consignments); 48 pageResult.setList(consignments);
48 } 49 }
49 - return ResponseVo.succ(pageResult); 50 + return responseUtils.success(pageResult);
50 } 51 }
51 52
52 /** 53 /**
...@@ -69,6 +70,6 @@ public class ConsignmentQueryServiceImpl extends BaseService implements IConsign ...@@ -69,6 +70,6 @@ public class ConsignmentQueryServiceImpl extends BaseService implements IConsign
69 consignmentTemp.setDestinationCountry(consignment.getDestinationCountry()); 70 consignmentTemp.setDestinationCountry(consignment.getDestinationCountry());
70 consignment = consignmentTemp; 71 consignment = consignmentTemp;
71 } 72 }
72 - return ResponseVo.succ(consignment); 73 + return responseUtils.success(consignment);
73 } 74 }
74 } 75 }
......
1 package com.fedex.connect.customer.service.biz.impl; 1 package com.fedex.connect.customer.service.biz.impl;
2 2
3 import com.fedex.connect.common.dependencies.date.vo.ResponseVo; 3 import com.fedex.connect.common.dependencies.date.vo.ResponseVo;
4 +import com.fedex.connect.common.dependencies.util.ResponseUtils;
4 import com.fedex.connect.common.model.biz.Consignment; 5 import com.fedex.connect.common.model.biz.Consignment;
5 import com.fedex.connect.common.model.sys.User; 6 import com.fedex.connect.common.model.sys.User;
6 import com.fedex.connect.customer.data.bo.ConsignmentBo; 7 import com.fedex.connect.customer.data.bo.ConsignmentBo;
...@@ -22,6 +23,9 @@ public class ConsignmentServiceImpl extends BaseService implements IConsignmentS ...@@ -22,6 +23,9 @@ public class ConsignmentServiceImpl extends BaseService implements IConsignmentS
22 @Autowired 23 @Autowired
23 private ConsignmentUtil consignmentUtil; 24 private ConsignmentUtil consignmentUtil;
24 25
26 + @Autowired
27 + private ResponseUtils responseUtils;
28 +
25 /** 29 /**
26 * @Author Szl 30 * @Author Szl
27 * @Description 功能说明 新增运单 31 * @Description 功能说明 新增运单
...@@ -35,18 +39,13 @@ public class ConsignmentServiceImpl extends BaseService implements IConsignmentS ...@@ -35,18 +39,13 @@ public class ConsignmentServiceImpl extends BaseService implements IConsignmentS
35 Consignment consignment = consignmentRepository.findByConsignmentCode(bo.getConsignmentCode()); 39 Consignment consignment = consignmentRepository.findByConsignmentCode(bo.getConsignmentCode());
36 if (consignment != null && consignment.getId() != null){ 40 if (consignment != null && consignment.getId() != null){
37 //如果存在则进行bo基础校验 41 //如果存在则进行bo基础校验
38 - ResponseVo responseResultVo = consignmentUtil.consignmentCreatorCheck(consignment,bo); 42 + consignmentUtil.consignmentCreatorCheck(consignment,bo);
39 - if (responseResultVo != null){
40 - return responseResultVo;
41 - }
42 //校验是否是本账号的运单 43 //校验是否是本账号的运单
43 ResponseVo responseVo = consignmentUtil.consignmentUuidCheck(consignment, user); 44 ResponseVo responseVo = consignmentUtil.consignmentUuidCheck(consignment, user);
44 - if (responseVo != null){
45 return responseVo; 45 return responseVo;
46 } 46 }
47 - }
48 //如果不存在直接返回 47 //如果不存在直接返回
49 - return ResponseVo.succ(null); 48 + return responseUtils.success();
50 } 49 }
51 50
52 /** 51 /**
......
...@@ -44,6 +44,6 @@ public class UploadRecordServiceImpl extends BaseService implements IUploadRecor ...@@ -44,6 +44,6 @@ public class UploadRecordServiceImpl extends BaseService implements IUploadRecor
44 PageResult pageResult = new PageResult(); 44 PageResult pageResult = new PageResult();
45 pageResult.setList(history != null ? history : Collections.emptyList()); 45 pageResult.setList(history != null ? history : Collections.emptyList());
46 46
47 - return ResponseVo.succ(pageResult); 47 + return responseUtils.success(pageResult);
48 } 48 }
49 } 49 }
......
...@@ -4,6 +4,7 @@ import com.fedex.connect.common.dependencies.contants.DigitConstants; ...@@ -4,6 +4,7 @@ import com.fedex.connect.common.dependencies.contants.DigitConstants;
4 import com.fedex.connect.common.dependencies.date.vo.ResponseVo; 4 import com.fedex.connect.common.dependencies.date.vo.ResponseVo;
5 import com.fedex.connect.common.dependencies.enums.BaseResponseCode; 5 import com.fedex.connect.common.dependencies.enums.BaseResponseCode;
6 import com.fedex.connect.common.dependencies.i18n.LocaleMessageUtil; 6 import com.fedex.connect.common.dependencies.i18n.LocaleMessageUtil;
7 +import com.fedex.connect.common.dependencies.util.ResponseUtils;
7 import com.fedex.connect.common.model.biz.Consignment; 8 import com.fedex.connect.common.model.biz.Consignment;
8 import com.fedex.connect.common.model.sys.User; 9 import com.fedex.connect.common.model.sys.User;
9 import com.fedex.connect.customer.data.bo.ConsignmentBo; 10 import com.fedex.connect.customer.data.bo.ConsignmentBo;
...@@ -25,6 +26,10 @@ import java.util.Objects; ...@@ -25,6 +26,10 @@ import java.util.Objects;
25 public class ConsignmentUtil { 26 public class ConsignmentUtil {
26 @Autowired 27 @Autowired
27 private LocaleMessageUtil localeMessageUtil; 28 private LocaleMessageUtil localeMessageUtil;
29 +
30 + @Autowired
31 + ResponseUtils responseUtils;
32 +
28 /** 33 /**
29 * @Author Szl 34 * @Author Szl
30 * @Description 功能说明 校验运单创建人 35 * @Description 功能说明 校验运单创建人
...@@ -32,21 +37,19 @@ public class ConsignmentUtil { ...@@ -32,21 +37,19 @@ public class ConsignmentUtil {
32 * @param consignment 37 * @param consignment
33 * @return com.fedex.connect.common.dependencies.date.vo.ResponseVo 38 * @return com.fedex.connect.common.dependencies.date.vo.ResponseVo
34 */ 39 */
35 - public ResponseVo consignmentCreatorCheck(Consignment consignment, ConsignmentBo bo) { 40 + public void consignmentCreatorCheck(Consignment consignment, ConsignmentBo bo) {
36 List<String> errList = new ArrayList<>(); 41 List<String> errList = new ArrayList<>();
37 42
38 // 校验字段是否匹配,并将错误信息添加到errList中 43 // 校验字段是否匹配,并将错误信息添加到errList中
39 - checkFieldMismatch(bo.getShipperAccount(), consignment.getShipperAccount(), "con_shipperAccount", errList); 44 + checkFieldMismatch(bo.getShipperAccount(), consignment.getShipperAccount(), ResponseCode.MESSAGE_CODE_30006.getMsg(), errList);
40 //checkFieldMismatch(bo.getRecipientCountry(), consignment.getRecipientCountry(), "con_recipientCountry", errList); 45 //checkFieldMismatch(bo.getRecipientCountry(), consignment.getRecipientCountry(), "con_recipientCountry", errList);
41 //checkFieldMismatch(bo.getShipperCountry(), consignment.getShipperCountry(), "con_shipperCountry", errList); 46 //checkFieldMismatch(bo.getShipperCountry(), consignment.getShipperCountry(), "con_shipperCountry", errList);
42 47
43 if (!errList.isEmpty()) { 48 if (!errList.isEmpty()) {
44 - String enumResCode601 = localeMessageUtil.getMessage("enum_res_code_601"); 49 + String enumResCode = localeMessageUtil.getMessage(ResponseCode.MESSAGE_CODE_30003.getMsg());
45 - String errResult = String.join(",", errList) + enumResCode601; 50 + String errResult = String.join(",", errList) + enumResCode;
46 - return ResponseVo.fail(BaseResponseCode.CONSIGNMENT_CREATOR_ERR, errResult); 51 + responseUtils.fail(ResponseCode.MESSAGE_CODE_30003,errResult);
47 } 52 }
48 -
49 - return null;
50 } 53 }
51 54
52 /** 55 /**
...@@ -80,12 +83,12 @@ public class ConsignmentUtil { ...@@ -80,12 +83,12 @@ public class ConsignmentUtil {
80 if (!Objects.equals(consignment.getUserUuid(), user.getUserUuid())){ 83 if (!Objects.equals(consignment.getUserUuid(), user.getUserUuid())){
81 consignmentAddDto.setIsCreatorFlag(DigitConstants.DIGIT_TWO); 84 consignmentAddDto.setIsCreatorFlag(DigitConstants.DIGIT_TWO);
82 if (Objects.equals(consignment.getShipperAccount(),user.getAccountNo())){ 85 if (Objects.equals(consignment.getShipperAccount(),user.getAccountNo())){
83 - return ResponseVo.succ(BaseResponseCode.CONSIGNMENT_CREATOR_SHIPPER_ACCOUNT_SUC.getCode(), BaseResponseCode.CONSIGNMENT_CREATOR_SHIPPER_ACCOUNT_SUC.getMsg(),consignmentAddDto); 86 + return responseUtils.success(ResponseCode.MESSAGE_CODE_30004,consignmentAddDto);
84 }else { 87 }else {
85 - return ResponseVo.succ(BaseResponseCode.CONSIGNMENT_CREATOR_SHIPPER_ACCOUNT_DIFF_SUC.getCode(), BaseResponseCode.CONSIGNMENT_CREATOR_SHIPPER_ACCOUNT_DIFF_SUC.getMsg(),consignmentAddDto); 88 + return responseUtils.success(ResponseCode.MESSAGE_CODE_30005,consignmentAddDto);
86 } 89 }
87 }else { 90 }else {
88 - return ResponseVo.succ(consignmentAddDto); 91 + return responseUtils.success(consignmentAddDto);
89 } 92 }
90 } 93 }
91 } 94 }
......
1 package com.fedex.connect.customer.validate.controller.biz; 1 package com.fedex.connect.customer.validate.controller.biz;
2 2
3 -import com.fedex.connect.common.dependencies.date.vo.ResponseVo;
4 -import com.fedex.connect.common.dependencies.enums.BaseResponseCode;
5 -import com.fedex.connect.common.dependencies.exception.OpErrorException;
6 import com.fedex.connect.common.dependencies.i18n.LocaleMessageUtil; 3 import com.fedex.connect.common.dependencies.i18n.LocaleMessageUtil;
4 +import com.fedex.connect.common.dependencies.util.ResponseUtils;
5 +import com.fedex.connect.customer.enums.ResponseCode;
7 import org.springframework.beans.factory.annotation.Autowired; 6 import org.springframework.beans.factory.annotation.Autowired;
8 import org.springframework.stereotype.Component; 7 import org.springframework.stereotype.Component;
9 8
...@@ -17,6 +16,8 @@ import java.util.Objects; ...@@ -17,6 +16,8 @@ import java.util.Objects;
17 @Component 16 @Component
18 public class ConsignmentInfoValidate { 17 public class ConsignmentInfoValidate {
19 @Autowired 18 @Autowired
19 + protected ResponseUtils responseUtils;
20 + @Autowired
20 protected LocaleMessageUtil localeMessageUtil; 21 protected LocaleMessageUtil localeMessageUtil;
21 22
22 /** 23 /**
...@@ -28,8 +29,7 @@ public class ConsignmentInfoValidate { ...@@ -28,8 +29,7 @@ public class ConsignmentInfoValidate {
28 */ 29 */
29 public void validateConsignmentId(Long consignmentId){ 30 public void validateConsignmentId(Long consignmentId){
30 if (Objects.isNull(consignmentId)){ 31 if (Objects.isNull(consignmentId)){
31 - ResponseVo rsVo = ResponseVo.fail(localeMessageUtil.getMessage(BaseResponseCode.REQUEST_PARAM_NULL.getMsg())); 32 + responseUtils.fail(ResponseCode.MESSAGE_CODE_30001);
32 - throw new OpErrorException(rsVo.getCode(),rsVo.getMsg());
33 } 33 }
34 } 34 }
35 } 35 }
......
1 package com.fedex.connect.customer.validate.controller.biz; 1 package com.fedex.connect.customer.validate.controller.biz;
2 2
3 -import com.fedex.connect.common.dependencies.date.vo.ResponseVo;
4 -import com.fedex.connect.common.dependencies.enums.BaseResponseCode;
5 -import com.fedex.connect.common.dependencies.exception.OpErrorException;
6 import com.fedex.connect.common.dependencies.i18n.LocaleMessageUtil; 3 import com.fedex.connect.common.dependencies.i18n.LocaleMessageUtil;
7 import com.fedex.connect.common.dependencies.util.BaseValidateUtils; 4 import com.fedex.connect.common.dependencies.util.BaseValidateUtils;
5 +import com.fedex.connect.common.dependencies.util.ResponseUtils;
8 import com.fedex.connect.customer.data.bo.ConsignmentBo; 6 import com.fedex.connect.customer.data.bo.ConsignmentBo;
9 import com.fedex.connect.customer.enums.ResponseCode; 7 import com.fedex.connect.customer.enums.ResponseCode;
10 import org.springframework.beans.factory.annotation.Autowired; 8 import org.springframework.beans.factory.annotation.Autowired;
...@@ -22,6 +20,8 @@ import java.util.Objects; ...@@ -22,6 +20,8 @@ import java.util.Objects;
22 @Component 20 @Component
23 public class ConsignmentValidate { 21 public class ConsignmentValidate {
24 @Autowired 22 @Autowired
23 + protected ResponseUtils responseUtils;
24 + @Autowired
25 protected LocaleMessageUtil localeMessageUtil; 25 protected LocaleMessageUtil localeMessageUtil;
26 @Autowired 26 @Autowired
27 protected BaseValidateUtils baseValidateUtils; 27 protected BaseValidateUtils baseValidateUtils;
...@@ -33,13 +33,12 @@ public class ConsignmentValidate { ...@@ -33,13 +33,12 @@ public class ConsignmentValidate {
33 * @param bo 33 * @param bo
34 * @return com.fedex.connect.common.dependencies.date.vo.ResponseVo 34 * @return com.fedex.connect.common.dependencies.date.vo.ResponseVo
35 */ 35 */
36 - public ResponseVo preCheckAdd(ConsignmentBo bo){ 36 + public void preCheckAdd(ConsignmentBo bo){
37 if (bo == null || StringUtils.isEmpty(bo.getConsignmentCode()) || 37 if (bo == null || StringUtils.isEmpty(bo.getConsignmentCode()) ||
38 StringUtils.isEmpty(bo.getOriginCountryCode()) || StringUtils.isEmpty(bo.getShipperAccount()) || 38 StringUtils.isEmpty(bo.getOriginCountryCode()) || StringUtils.isEmpty(bo.getShipperAccount()) ||
39 StringUtils.isEmpty(bo.getDestinationCountryCode())){ 39 StringUtils.isEmpty(bo.getDestinationCountryCode())){
40 - return ResponseVo.fail(localeMessageUtil.getMessage(BaseResponseCode.REQUEST_PARAM_NULL.getMsg())); 40 + responseUtils.fail(ResponseCode.MESSAGE_CODE_30001);
41 } 41 }
42 - return null;
43 } 42 }
44 43
45 /** 44 /**
...@@ -51,10 +50,10 @@ public class ConsignmentValidate { ...@@ -51,10 +50,10 @@ public class ConsignmentValidate {
51 * @return void 50 * @return void
52 */ 51 */
53 public void validateConsignmentSubmit(MultipartFile[] files,ConsignmentBo consignmentBo){ 52 public void validateConsignmentSubmit(MultipartFile[] files,ConsignmentBo consignmentBo){
54 - Integer code = ResponseCode.MESSAGE_CODE_10001.getCode(); 53 + Integer code = ResponseCode.MESSAGE_CODE_30001.getCode();
55 - String msg = ResponseCode.MESSAGE_CODE_10001.getMsg(); 54 + String msg = ResponseCode.MESSAGE_CODE_30001.getMsg();
56 if(Objects.isNull(files)){ 55 if(Objects.isNull(files)){
57 - throw new OpErrorException(code,msg); 56 + responseUtils.fail(ResponseCode.MESSAGE_CODE_30001);
58 } 57 }
59 /** 58 /**
60 * 非空字段校验 59 * 非空字段校验
......
1 #******************系统操作日志记录,中文展示****************** 1 #******************系统操作日志记录,中文展示******************
2 -con_add_oper=添加运单 2 +business_log_20001=添加运单
3 -con_submit_oper=提交运单 3 +business_log_20002=提交运单
4 -config_aspect_length_error=提示信息过长,未保存成功 4 +system_exception_20003=提示信息过长,未保存成功
5 5
6 #******************鉴权相关提示,需要做国际化****************** 6 #******************鉴权相关提示,需要做国际化******************
7 #authentication包 7 #authentication包
8 -auth_exc_no_auth=没有访问权限 8 +system_exception_10001=没有访问权限
9 -auth_exc_no_pass_auth=没有通过权限认证 9 +system_exception_10002=没有通过权限认证
10 -auth_filter_user_error=登录身份异常 10 +system_exception_10003=登录身份异常
11 -auth_filter_timeout=登录超过8小时,请重新登录 11 +system_exception_10004=登录超过8小时,请重新登录
12 -auth_filter_stale_dated=登录已过期 12 +system_exception_10005=登录已过期
13 -enum_res_code_301=登录身份异常 13 +system_exception_10006=登录已过期,请重新登录
14 -enum_res_code_305=登录已过期,请重新登录
15 14
16 #******************业务相关、需要做国际化****************** 15 #******************业务相关、需要做国际化******************
17 -con_shipperAccount=发货人计费账号
18 -con_shipperCountry=始发国
19 -con_recipientCountry=目的国
20 -enum_res_code_601=不正确,请重新输入
21 -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.
22 -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.
23 -conl_cus_declare_count_max=單次最多可查詢1000個運單號碼
24 -business_exception_10001=必填字段未填写
...\ No newline at end of file ...\ No newline at end of file
16 +business_exception_30001=必填字段未填写
17 +business_exception_30002=单次最多可查询1000个运单号码
18 +business_exception_30003=不正确,请重新输入
19 +business_exception_30004=The waybill you entered is generated by another user, whether continue uploading? Confirm, Cancel. No more prompts in the future for the same situation.
20 +business_exception_30005=The waybill you entered is generated by another account, whether continue uploading? Confirm, Cancel. No more prompts in the future for the same situation.
21 +business_exception_30006=发货人计费账号
...\ No newline at end of file ...\ No newline at end of file
......
1 #******************系统操作日志记录,中文展示****************** 1 #******************系统操作日志记录,中文展示******************
2 -con_add_oper=添加运单 2 +business_exception_20001=添加运单
3 -con_submit_oper=提交运单 3 +business_exception_20002=提交运单
4 -config_aspect_length_error=提示信息过长,未保存成功 4 +system_exception_20003=提示信息过长,未保存成功
5 5
6 #******************鉴权相关提示,需要做国际化****************** 6 #******************鉴权相关提示,需要做国际化******************
7 #authentication包 7 #authentication包
8 -auth_exc_no_auth=没有访问权限 8 +system_exception_10001=没有访问权限
9 -auth_exc_no_pass_auth=没有通过权限认证 9 +system_exception_10002=没有通过权限认证
10 -auth_filter_user_error=登录身份异常 10 +system_exception_10003=登录身份异常
11 -auth_filter_timeout=登录超过8小时,请重新登录 11 +system_exception_10004=登录超过8小时,请重新登录
12 -auth_filter_stale_dated=登录已过期 12 +system_exception_10005=登录已过期
13 -enum_res_code_301=登录身份异常 13 +system_exception_10006=登录已过期,请重新登录
14 -enum_res_code_305=登录已过期,请重新登录
15 14
16 #******************业务相关、需要做国际化****************** 15 #******************业务相关、需要做国际化******************
17 -con_shipperAccount=发货人计费账号
18 -con_shipperCountry=始发国
19 -con_recipientCountry=目的国
20 -enum_res_code_601=不正确,请重新输入
21 -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.
22 -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.
23 -conl_cus_declare_count_max=單次最多可查詢1000個運單號碼
24 -business_exception_10001=必填字段未填写
...\ No newline at end of file ...\ No newline at end of file
16 +business_exception_30001=必填字段未填写
17 +business_exception_30002=单次最多可查询1000个运单号码
18 +business_exception_30003=不正确,请重新输入
19 +business_exception_30004=The waybill you entered is generated by another user, whether continue uploading? Confirm, Cancel. No more prompts in the future for the same situation.
20 +business_exception_30005=The waybill you entered is generated by another account, whether continue uploading? Confirm, Cancel. No more prompts in the future for the same situation.
21 +business_exception_30006=发货人计费账号
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -3,6 +3,7 @@ package com.fedex.connect.common.dependencies.aspect; ...@@ -3,6 +3,7 @@ package com.fedex.connect.common.dependencies.aspect;
3 import com.fedex.connect.common.dependencies.annotation.OperationMethodLog; 3 import com.fedex.connect.common.dependencies.annotation.OperationMethodLog;
4 import com.fedex.connect.common.dependencies.contants.AnnotationConstants; 4 import com.fedex.connect.common.dependencies.contants.AnnotationConstants;
5 import com.fedex.connect.common.dependencies.date.vo.ResponseVo; 5 import com.fedex.connect.common.dependencies.date.vo.ResponseVo;
6 +import com.fedex.connect.common.dependencies.enums.BaseResponseCode;
6 import com.fedex.connect.common.dependencies.i18n.LocaleMessageUtil; 7 import com.fedex.connect.common.dependencies.i18n.LocaleMessageUtil;
7 import com.fedex.connect.common.dependencies.repository.repo.log.IOperationRepository; 8 import com.fedex.connect.common.dependencies.repository.repo.log.IOperationRepository;
8 import com.fedex.connect.common.dependencies.util.CurrentUserInfo; 9 import com.fedex.connect.common.dependencies.util.CurrentUserInfo;
...@@ -148,7 +149,7 @@ public class OperationLogAspect { ...@@ -148,7 +149,7 @@ public class OperationLogAspect {
148 r.remove("data"); 149 r.remove("data");
149 resultJson = JsonUtils.objectToJson(r); 150 resultJson = JsonUtils.objectToJson(r);
150 if (resultJson.length() > 255){ 151 if (resultJson.length() > 255){
151 - r.put("msg", localeMessageUtil.getMessage("config_aspect_length_error")); 152 + r.put("msg", localeMessageUtil.getMessage(BaseResponseCode.MESSAGE_CODE_20003.getMsg()));
152 resultJson = JsonUtils.objectToJson(r); 153 resultJson = JsonUtils.objectToJson(r);
153 } 154 }
154 } 155 }
......
1 package com.fedex.connect.common.dependencies.authentication.exception; 1 package com.fedex.connect.common.dependencies.authentication.exception;
2 2
3 import com.fedex.connect.common.dependencies.date.vo.ResponseVo; 3 import com.fedex.connect.common.dependencies.date.vo.ResponseVo;
4 +import com.fedex.connect.common.dependencies.enums.BaseResponseCode;
4 import com.fedex.connect.common.dependencies.i18n.LocaleMessageUtil; 5 import com.fedex.connect.common.dependencies.i18n.LocaleMessageUtil;
5 import com.fedex.connect.common.dependencies.util.SpringBeanUtil; 6 import com.fedex.connect.common.dependencies.util.SpringBeanUtil;
6 import com.google.gson.Gson; 7 import com.google.gson.Gson;
...@@ -28,7 +29,7 @@ public class JwtAccessDeniedHandler implements AccessDeniedHandler { ...@@ -28,7 +29,7 @@ public class JwtAccessDeniedHandler implements AccessDeniedHandler {
28 result.setCode(HttpServletResponse.SC_FORBIDDEN); 29 result.setCode(HttpServletResponse.SC_FORBIDDEN);
29 //使用context手动注入 30 //使用context手动注入
30 LocaleMessageUtil localeMessageUtil = SpringBeanUtil.getBean(LocaleMessageUtil.class); 31 LocaleMessageUtil localeMessageUtil = SpringBeanUtil.getBean(LocaleMessageUtil.class);
31 - result.setMsg(localeMessageUtil.getMessage("auth_exc_no_auth")); 32 + result.setMsg(localeMessageUtil.getMessage(BaseResponseCode.MESSAGE_CODE_10001.getMsg()));
32 Gson gson = new Gson(); 33 Gson gson = new Gson();
33 response.getWriter().println(gson.toJson(result)); 34 response.getWriter().println(gson.toJson(result));
34 response.getWriter().flush(); 35 response.getWriter().flush();
......
...@@ -2,6 +2,7 @@ package com.fedex.connect.common.dependencies.authentication.exception; ...@@ -2,6 +2,7 @@ package com.fedex.connect.common.dependencies.authentication.exception;
2 2
3 3
4 import com.fedex.connect.common.dependencies.date.vo.ResponseVo; 4 import com.fedex.connect.common.dependencies.date.vo.ResponseVo;
5 +import com.fedex.connect.common.dependencies.enums.BaseResponseCode;
5 import com.fedex.connect.common.dependencies.i18n.LocaleMessageUtil; 6 import com.fedex.connect.common.dependencies.i18n.LocaleMessageUtil;
6 import com.fedex.connect.common.dependencies.util.SpringBeanUtil; 7 import com.fedex.connect.common.dependencies.util.SpringBeanUtil;
7 import com.google.gson.Gson; 8 import com.google.gson.Gson;
...@@ -30,7 +31,7 @@ public class JwtAuthenticationEntryPoint implements AuthenticationEntryPoint { ...@@ -30,7 +31,7 @@ public class JwtAuthenticationEntryPoint implements AuthenticationEntryPoint {
30 result.setCode(HttpServletResponse.SC_UNAUTHORIZED); 31 result.setCode(HttpServletResponse.SC_UNAUTHORIZED);
31 //使用context手动注入 32 //使用context手动注入
32 LocaleMessageUtil localeMessageUtil = SpringBeanUtil.getBean(LocaleMessageUtil.class); 33 LocaleMessageUtil localeMessageUtil = SpringBeanUtil.getBean(LocaleMessageUtil.class);
33 - result.setMsg(localeMessageUtil.getMessage("auth_exc_no_pass_auth")); 34 + result.setMsg(localeMessageUtil.getMessage(BaseResponseCode.MESSAGE_CODE_10002.getMsg()));
34 Gson gson = new Gson(); 35 Gson gson = new Gson();
35 response.getWriter().println(gson.toJson(result)); 36 response.getWriter().println(gson.toJson(result));
36 response.getWriter().flush(); 37 response.getWriter().flush();
......
...@@ -2,6 +2,7 @@ package com.fedex.connect.common.dependencies.authentication.filter; ...@@ -2,6 +2,7 @@ package com.fedex.connect.common.dependencies.authentication.filter;
2 2
3 import com.fedex.connect.common.dependencies.authentication.SecurityConstants; 3 import com.fedex.connect.common.dependencies.authentication.SecurityConstants;
4 import com.fedex.connect.common.dependencies.contants.RedisConstants; 4 import com.fedex.connect.common.dependencies.contants.RedisConstants;
5 +import com.fedex.connect.common.dependencies.enums.BaseResponseCode;
5 import com.fedex.connect.common.dependencies.i18n.LocaleMessageUtil; 6 import com.fedex.connect.common.dependencies.i18n.LocaleMessageUtil;
6 import com.fedex.connect.common.dependencies.service.sys.IRedisSlabService; 7 import com.fedex.connect.common.dependencies.service.sys.IRedisSlabService;
7 import com.fedex.connect.common.dependencies.util.JsonUtils; 8 import com.fedex.connect.common.dependencies.util.JsonUtils;
...@@ -72,10 +73,6 @@ public class JwtAuthorizationFilter extends BasicAuthenticationFilter { ...@@ -72,10 +73,6 @@ public class JwtAuthorizationFilter extends BasicAuthenticationFilter {
72 //使用context手动注入 73 //使用context手动注入
73 LocaleMessageUtil localeMessageUtil = SpringBeanUtil.getBean(LocaleMessageUtil.class); 74 LocaleMessageUtil localeMessageUtil = SpringBeanUtil.getBean(LocaleMessageUtil.class);
74 IRedisSlabService redisSlabService = SpringBeanUtil.getBean(IRedisSlabService.class); 75 IRedisSlabService redisSlabService = SpringBeanUtil.getBean(IRedisSlabService.class);
75 -
76 - String str = localeMessageUtil.getMessage("auth_filter_user_error");
77 - System.out.println(str);
78 -
79 if (token == null || !token.startsWith(SecurityConstants.TOKEN_PREFIX)) { 76 if (token == null || !token.startsWith(SecurityConstants.TOKEN_PREFIX)) {
80 SecurityContextHolder.clearContext(); 77 SecurityContextHolder.clearContext();
81 78
...@@ -90,9 +87,9 @@ public class JwtAuthorizationFilter extends BasicAuthenticationFilter { ...@@ -90,9 +87,9 @@ public class JwtAuthorizationFilter extends BasicAuthenticationFilter {
90 } 87 }
91 88
92 Map<String, Object> result = new HashMap<>(); 89 Map<String, Object> result = new HashMap<>();
93 - result.put("code", 301); 90 + result.put("code", BaseResponseCode.MESSAGE_CODE_10003.getCode());
94 - result.put("msg", localeMessageUtil.getMessage("auth_filter_user_error")); 91 + result.put("msg", localeMessageUtil.getMessage(BaseResponseCode.MESSAGE_CODE_10003.getMsg()));
95 - logger.info("CODE_301 requestURL:{} ,reason:{}" , request.getRequestURL()," 非白名单url路径登录"); 92 + logger.info("CODE : {} requestURL:{} ,reason:{}", BaseResponseCode.MESSAGE_CODE_10003.getCode() , request.getRequestURL()," 非白名单url路径登录");
96 ServletOutputStream out = response.getOutputStream(); 93 ServletOutputStream out = response.getOutputStream();
97 out.write(JsonUtils.mapToJson(result).getBytes()); 94 out.write(JsonUtils.mapToJson(result).getBytes());
98 out.flush(); 95 out.flush();
...@@ -114,9 +111,9 @@ public class JwtAuthorizationFilter extends BasicAuthenticationFilter { ...@@ -114,9 +111,9 @@ public class JwtAuthorizationFilter extends BasicAuthenticationFilter {
114 if (StringUtils.isEmpty(tokenRedis)) { 111 if (StringUtils.isEmpty(tokenRedis)) {
115 //redis没有,超过8小时,踢出去 112 //redis没有,超过8小时,踢出去
116 Map<String, Object> result = new HashMap<>(); 113 Map<String, Object> result = new HashMap<>();
117 - result.put("code", 301); 114 + result.put("code", BaseResponseCode.MESSAGE_CODE_10004.getCode());
118 - result.put("msg", localeMessageUtil.getMessage("auth_filter_timeout")); 115 + result.put("msg", localeMessageUtil.getMessage(BaseResponseCode.MESSAGE_CODE_10004.getMsg()));
119 - logger.info("CODE_301 requestURL:{} ,reason:{}" , request.getRequestURL() ,"tokenRedis is empty"); 116 + logger.info("CODE : {} requestURL:{} ,reason:{}", BaseResponseCode.MESSAGE_CODE_10004.getCode() , request.getRequestURL() ,"tokenRedis is empty");
120 ServletOutputStream out = response.getOutputStream(); 117 ServletOutputStream out = response.getOutputStream();
121 out.write(JsonUtils.mapToJson(result).getBytes()); 118 out.write(JsonUtils.mapToJson(result).getBytes());
122 out.flush(); 119 out.flush();
...@@ -132,12 +129,12 @@ public class JwtAuthorizationFilter extends BasicAuthenticationFilter { ...@@ -132,12 +129,12 @@ public class JwtAuthorizationFilter extends BasicAuthenticationFilter {
132 response.setHeader("Token", newToken);*/ 129 response.setHeader("Token", newToken);*/
133 } catch (ExpiredJwtException ee) { 130 } catch (ExpiredJwtException ee) {
134 //已经过期了,直接踢 131 //已经过期了,直接踢
135 - logger.error("CODE_301 requestURL:{},reason:{}" , request.getRequestURL(),"ExpiredJwtException ",ee); 132 + logger.error("CODE : {} requestURL:{},reason:{}",BaseResponseCode.MESSAGE_CODE_10004.getCode() , request.getRequestURL(),"ExpiredJwtException ",ee);
136 Claims claims = ee.getClaims(); 133 Claims claims = ee.getClaims();
137 String id = claims.getId(); 134 String id = claims.getId();
138 Map<String, Object> result = new HashMap<>(); 135 Map<String, Object> result = new HashMap<>();
139 - result.put("code", 301); 136 + result.put("code", BaseResponseCode.MESSAGE_CODE_10005.getCode());
140 - result.put("msg", localeMessageUtil.getMessage("auth_filter_stale_dated")); 137 + result.put("msg", localeMessageUtil.getMessage(BaseResponseCode.MESSAGE_CODE_10005.getMsg()));
141 ServletOutputStream out = response.getOutputStream(); 138 ServletOutputStream out = response.getOutputStream();
142 out.write(JsonUtils.mapToJson(result).getBytes()); 139 out.write(JsonUtils.mapToJson(result).getBytes());
143 out.flush(); 140 out.flush();
...@@ -145,8 +142,8 @@ public class JwtAuthorizationFilter extends BasicAuthenticationFilter { ...@@ -145,8 +142,8 @@ public class JwtAuthorizationFilter extends BasicAuthenticationFilter {
145 } catch (Exception e) { 142 } catch (Exception e) {
146 logger.error("*********************token 异常 : *******************************", e); 143 logger.error("*********************token 异常 : *******************************", e);
147 Map<String, Object> result = new HashMap<>(); 144 Map<String, Object> result = new HashMap<>();
148 - result.put("code", 301); 145 + result.put("code", BaseResponseCode.MESSAGE_CODE_10003.getCode());
149 - result.put("msg", localeMessageUtil.getMessage("auth_filter_user_error")); 146 + result.put("msg", localeMessageUtil.getMessage(BaseResponseCode.MESSAGE_CODE_10003.getMsg()));
150 ServletOutputStream out = response.getOutputStream(); 147 ServletOutputStream out = response.getOutputStream();
151 out.write(JsonUtils.mapToJson(result).getBytes()); 148 out.write(JsonUtils.mapToJson(result).getBytes());
152 out.flush(); 149 out.flush();
......
...@@ -17,10 +17,10 @@ public class BasicController { ...@@ -17,10 +17,10 @@ public class BasicController {
17 try { 17 try {
18 user = CurrentUserInfo.getUser(); 18 user = CurrentUserInfo.getUser();
19 } catch (Exception e) { 19 } catch (Exception e) {
20 - throw new OpErrorException(BaseResponseCode.TOKEN_FORMAT_ERROR.getCode(),localeMessageUtil.getMessage(BaseResponseCode.TOKEN_FORMAT_ERROR.getMsg()),e); 20 + throw new OpErrorException(BaseResponseCode.MESSAGE_CODE_10003.getCode(),localeMessageUtil.getMessage(BaseResponseCode.MESSAGE_CODE_10003.getMsg()),e);
21 } 21 }
22 if (user == null) { 22 if (user == null) {
23 - throw new OpErrorException(BaseResponseCode.OVERDUE_TOKEN_CODE.getCode(),localeMessageUtil.getMessage(BaseResponseCode.OVERDUE_TOKEN_CODE.getMsg())); 23 + throw new OpErrorException(BaseResponseCode.MESSAGE_CODE_10006.getCode(),localeMessageUtil.getMessage(BaseResponseCode.MESSAGE_CODE_10006.getMsg()));
24 } 24 }
25 return user; 25 return user;
26 } 26 }
......
...@@ -41,10 +41,10 @@ public class ResponseVo<T> { ...@@ -41,10 +41,10 @@ public class ResponseVo<T> {
41 this.data = null; 41 this.data = null;
42 } 42 }
43 43
44 - public ResponseVo(String code,String message){ 44 + public ResponseVo(Integer code,String message,T data){
45 this.success = true; 45 this.success = true;
46 - this.code = DigitConstants.DIGIT_TWO_HUNDRED; 46 + this.code = code;
47 this.msg = message; 47 this.msg = message;
48 - this.data = null; 48 + this.data = data;
49 } 49 }
50 } 50 }
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -6,56 +6,13 @@ package com.fedex.connect.common.dependencies.enums; ...@@ -6,56 +6,13 @@ package com.fedex.connect.common.dependencies.enums;
6 */ 6 */
7 7
8 public enum BaseResponseCode { 8 public enum BaseResponseCode {
9 - /** 9 + MESSAGE_CODE_20003(20003,"system_exception_20003"),
10 - * 200=操作成功 10 + MESSAGE_CODE_10001(10001,"system_exception_10001"),
11 - * 201=操作失败 11 + MESSAGE_CODE_10002(10002,"system_exception_10002"),
12 - * 202=API接口请求异常 12 + MESSAGE_CODE_10003(10003,"system_exception_10003"),
13 - * 203=后台程序发生异常 13 + MESSAGE_CODE_10004(10004,"system_exception_10004"),
14 - * 204=请求方式错误 14 + MESSAGE_CODE_10005(10005,"system_exception_10005"),
15 - * 205=api接口请求错误 15 + MESSAGE_CODE_10006(10006,"system_exception_10006"),
16 - * 206=api接口请求结果为空
17 - * 207=系统异常!
18 - *
19 - * 301=登录身份异常
20 - * 302=登录已过期
21 - * 303=用户不存在
22 - * 304=用户已禁用,不能登录!
23 - * 305=登录token过期,请重新登录!
24 - * 306=该角色下有用户存在,是否确认删除?
25 - *
26 - * 601=数据被占用
27 - * 602=记录已存在,请勿重复添加
28 - * 603=导出数据量过大,请不要超过10W条
29 - *
30 - * 604=请求参数为空
31 - * 605=ID为空
32 - * 606=数据不存在
33 - * 607=请求参数值不合理
34 - */
35 - SUCCESS_CODE(200,"enum_res_code_200"),
36 - FAIL_CODE(201,"enum_res_code_201"),
37 - API_EXCEPTION(202, "enum_res_code_202"),
38 - PROGRAM_ERROR(203,"enum_res_code_203"),
39 - METHOD_EXCEPTION_CODE(204, "enum_res_code_204"),
40 - HTTP_CLIENT_ERROR(205, "enum_res_code_205"),
41 - HTTP_CLIENT_EMPTY(206, "enum_res_code_206"),
42 - SYSTEM_EXECEPTION_CODE(207,"enum_res_code_207"),
43 -
44 - TOKEN_FORMAT_ERROR(301, "enum_res_code_301"),
45 - TOKEN_EXPIRE(302, "enum_res_code_302"),
46 - USER_IS_NULL(303, "enum_res_code_303"),
47 - USER_DISABLED(304, "enum_res_code_304"),
48 - OVERDUE_TOKEN_CODE(305,"enum_res_code_305"),
49 - ROLE_CONFIRM_DEL(306, "enum_res_code_306"),
50 -
51 - REQUEST_PARAM_NULL(604, "enum_res_code_604"),
52 - REQUEST_ID_NULL(605, "enum_res_code_605"),
53 - REQUEST_OBJECT_NULL(606, "enum_res_code_606"),
54 - REQUEST_PARAM_UNREASONABLE(606, "enum_res_code_607"),
55 -
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"),
59 ; 16 ;
60 private Integer code; 17 private Integer code;
61 private String msg; 18 private String msg;
...@@ -69,9 +26,7 @@ public enum BaseResponseCode { ...@@ -69,9 +26,7 @@ public enum BaseResponseCode {
69 return code; 26 return code;
70 } 27 }
71 28
72 -
73 public String getMsg() { 29 public String getMsg() {
74 return msg; 30 return msg;
75 } 31 }
76 -
77 } 32 }
...\ No newline at end of file ...\ No newline at end of file
......
1 -package com.fedex.connect.common.dependencies.enums.biz;
2 -
3 -public enum ConsignmentEnum {
4 - SHIPPER_ACCOUNT(01,"con_shipperAccount"),
5 - SHIPPER_COUNTRY(02,"con_shipperCountry"),
6 - RECIPIENT_COUNTRY(03,"con_recipientCountry"),
7 - ;
8 -
9 - private Integer code;
10 - private String msg;
11 -
12 - ConsignmentEnum(Integer code, String msg) {
13 - this.code = code;
14 - this.msg = msg;
15 - }
16 -
17 - public Integer getCode() {
18 - return code;
19 - }
20 -
21 -
22 - public String getMsg() {
23 - return msg;
24 - }
25 -}
...@@ -6,7 +6,6 @@ import com.fedex.connect.common.dependencies.date.vo.ResponseVo; ...@@ -6,7 +6,6 @@ import com.fedex.connect.common.dependencies.date.vo.ResponseVo;
6 import com.fedex.connect.common.dependencies.exception.OpErrorException; 6 import com.fedex.connect.common.dependencies.exception.OpErrorException;
7 import com.fedex.connect.common.dependencies.i18n.LocaleMessageUtil; 7 import com.fedex.connect.common.dependencies.i18n.LocaleMessageUtil;
8 import lombok.extern.slf4j.Slf4j; 8 import lombok.extern.slf4j.Slf4j;
9 -import org.apache.poi.ss.formula.functions.T;
10 import org.springframework.beans.factory.annotation.Autowired; 9 import org.springframework.beans.factory.annotation.Autowired;
11 import org.springframework.stereotype.Component; 10 import org.springframework.stereotype.Component;
12 11
...@@ -28,13 +27,19 @@ public class ResponseUtils { ...@@ -28,13 +27,19 @@ public class ResponseUtils {
28 * @param codeEnum 27 * @param codeEnum
29 * @return void 28 * @return void
30 */ 29 */
31 - public void fail(T codeEnum) { 30 + public void fail(Object codeEnum) {
32 ResponseCodeBo responseCodeBo = this.ref(codeEnum); 31 ResponseCodeBo responseCodeBo = this.ref(codeEnum);
33 log.error(responseCodeBo.getErrMsg()); 32 log.error(responseCodeBo.getErrMsg());
34 throw new OpErrorException(responseCodeBo.getCode(), responseCodeBo.getErrMsg()); 33 throw new OpErrorException(responseCodeBo.getCode(), responseCodeBo.getErrMsg());
35 } 34 }
36 35
37 - public void fail(T codeEnum,Throwable e) { 36 + public void fail(Object codeEnum,String errMsg) {
37 + ResponseCodeBo responseCodeBo = this.ref(codeEnum);
38 + log.error(errMsg);
39 + throw new OpErrorException(responseCodeBo.getCode(), errMsg);
40 + }
41 +
42 + public void fail(Object codeEnum,Throwable e) {
38 ResponseCodeBo responseCodeBo = this.ref(codeEnum); 43 ResponseCodeBo responseCodeBo = this.ref(codeEnum);
39 log.error(responseCodeBo.getErrMsg()); 44 log.error(responseCodeBo.getErrMsg());
40 throw new OpErrorException(responseCodeBo.getCode(), responseCodeBo.getErrMsg(),e); 45 throw new OpErrorException(responseCodeBo.getCode(), responseCodeBo.getErrMsg(),e);
...@@ -44,7 +49,12 @@ public class ResponseUtils { ...@@ -44,7 +49,12 @@ public class ResponseUtils {
44 return new ResponseVo<>(); 49 return new ResponseVo<>();
45 } 50 }
46 51
47 - public ResponseVo success(T data) { 52 + public <T> ResponseVo success(Object codeEnum,T data) {
53 + ResponseCodeBo responseCodeBo = this.ref(codeEnum);
54 + return new ResponseVo<>(responseCodeBo.getCode(),responseCodeBo.getMsg(),data);
55 + }
56 +
57 + public <T> ResponseVo success(T data) {
48 return new ResponseVo<>(data); 58 return new ResponseVo<>(data);
49 } 59 }
50 60
...@@ -53,7 +63,7 @@ public class ResponseUtils { ...@@ -53,7 +63,7 @@ public class ResponseUtils {
53 return message; 63 return message;
54 } 64 }
55 65
56 - private ResponseCodeBo ref(T obj){ 66 + private ResponseCodeBo ref(Object obj){
57 ResponseCodeBo responseCodeBo = new ResponseCodeBo(); 67 ResponseCodeBo responseCodeBo = new ResponseCodeBo();
58 try { 68 try {
59 Object codeObj = AssignmentFieldUtils.getFieldValue(obj, BaseConstants.RESPONSE_CODE_KEYS.CODE); 69 Object codeObj = AssignmentFieldUtils.getFieldValue(obj, BaseConstants.RESPONSE_CODE_KEYS.CODE);
......
1 -#******************系统操作日志记录,中文展示******************
2 -config_aspect_length_error=提示信息过长,未保存成功
3 -
4 #******************鉴权相关提示,需要做国际化****************** 1 #******************鉴权相关提示,需要做国际化******************
5 #authentication包 2 #authentication包
6 -auth_exc_no_auth=没有访问权限 3 +system_exception_10001=没有访问权限
7 -auth_exc_no_pass_auth=没有通过权限认证 4 +system_exception_10002=没有通过权限认证
8 -auth_filter_user_error=登录身份异常 5 +system_exception_10003=登录身份异常
9 -auth_filter_timeout=登录超过8小时,请重新登录 6 +system_exception_10004=登录超过8小时,请重新登录
10 -auth_filter_stale_dated=登录已过期 7 +system_exception_10005=登录已过期
11 -enum_res_code_301=登录身份异常 8 +system_exception_10006=登录身份异常
12 -enum_res_code_305=登录已过期,请重新登录 9 +system_exception_10007=登录已过期,请重新登录
...\ No newline at end of file ...\ No newline at end of file
......
1 -#******************系统操作日志记录,中文展示******************
2 -config_aspect_length_error=提示信息过长,未保存成功
3 -
4 #******************鉴权相关提示,需要做国际化****************** 1 #******************鉴权相关提示,需要做国际化******************
5 #authentication包 2 #authentication包
6 -auth_exc_no_auth=没有访问权限
7 -auth_exc_no_pass_auth=没有通过权限认证
8 -auth_filter_user_error=登录身份异常
9 -auth_filter_timeout=登录超过8小时,请重新登录
10 -auth_filter_stale_dated=登录已过期
11 -enum_res_code_301=登录身份异常
12 -enum_res_code_305=登录已过期,请重新登录
...\ No newline at end of file ...\ No newline at end of file
3 +system_exception_10001=没有访问权限
4 +system_exception_10002=没有通过权限认证
5 +system_exception_10003=登录身份异常
6 +system_exception_10004=登录超过8小时,请重新登录
7 +system_exception_10005=登录已过期
8 +system_exception_10006=登录身份异常
9 +system_exception_10007=登录已过期,请重新登录
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -3,6 +3,7 @@ package com.fedex.connect.manager.controller.base; ...@@ -3,6 +3,7 @@ package com.fedex.connect.manager.controller.base;
3 3
4 import com.fedex.connect.common.dependencies.common.BasicController; 4 import com.fedex.connect.common.dependencies.common.BasicController;
5 import com.fedex.connect.common.dependencies.i18n.LocaleMessageUtil; 5 import com.fedex.connect.common.dependencies.i18n.LocaleMessageUtil;
6 +import com.fedex.connect.common.dependencies.util.ResponseUtils;
6 import com.fedex.connect.common.model.sys.User; 7 import com.fedex.connect.common.model.sys.User;
7 import com.fedex.connect.manager.config.PropertiesConfig; 8 import com.fedex.connect.manager.config.PropertiesConfig;
8 import com.fedex.connect.manager.service.bi.IDicEntriesService; 9 import com.fedex.connect.manager.service.bi.IDicEntriesService;
...@@ -20,6 +21,8 @@ public class BaseController extends BasicController { ...@@ -20,6 +21,8 @@ public class BaseController extends BasicController {
20 @Resource 21 @Resource
21 protected LocaleMessageUtil localeMessageUtil; 22 protected LocaleMessageUtil localeMessageUtil;
22 @Autowired 23 @Autowired
24 + protected ResponseUtils responseUtils;
25 + @Autowired
23 protected PropertiesConfig propertiesConfig; 26 protected PropertiesConfig propertiesConfig;
24 @Autowired 27 @Autowired
25 protected ISysUserService sysUserService; 28 protected ISysUserService sysUserService;
......
...@@ -15,6 +15,7 @@ import com.fedex.connect.manager.controller.sys.ISysAuthController; ...@@ -15,6 +15,7 @@ import com.fedex.connect.manager.controller.sys.ISysAuthController;
15 import com.fedex.connect.manager.data.dto.LogLoginDto; 15 import com.fedex.connect.manager.data.dto.LogLoginDto;
16 import com.fedex.connect.manager.data.dto.LoginRequest; 16 import com.fedex.connect.manager.data.dto.LoginRequest;
17 import com.fedex.connect.manager.data.dto.SysUserDto; 17 import com.fedex.connect.manager.data.dto.SysUserDto;
18 +import com.fedex.connect.manager.enums.ResponseCode;
18 import com.google.gson.JsonObject; 19 import com.google.gson.JsonObject;
19 import io.swagger.annotations.Api; 20 import io.swagger.annotations.Api;
20 import io.swagger.annotations.ApiOperation; 21 import io.swagger.annotations.ApiOperation;
...@@ -50,7 +51,7 @@ public class SysAuthController extends BaseController implements ISysAuthControl ...@@ -50,7 +51,7 @@ public class SysAuthController extends BaseController implements ISysAuthControl
50 @PostMapping("/init") 51 @PostMapping("/init")
51 @ApiOperation(value = "ResponseVo", notes = "初始化进入首页获取FCL登录地址") 52 @ApiOperation(value = "ResponseVo", notes = "初始化进入首页获取FCL登录地址")
52 public ResponseVo init(){ 53 public ResponseVo init(){
53 - return ResponseVo.succ(fclIndexLoginUrl); 54 + return responseUtils.success(fclIndexLoginUrl);
54 } 55 }
55 56
56 57
...@@ -148,7 +149,7 @@ public class SysAuthController extends BaseController implements ISysAuthControl ...@@ -148,7 +149,7 @@ public class SysAuthController extends BaseController implements ISysAuthControl
148 DictionaryEntries dicUserLoginType = cacheSystem.getDicUserLoginType(UserLoginTypeEnum.FCLLOGINREGISTRATION.getEnMsg()); 149 DictionaryEntries dicUserLoginType = cacheSystem.getDicUserLoginType(UserLoginTypeEnum.FCLLOGINREGISTRATION.getEnMsg());
149 //记录日志 150 //记录日志
150 LogLoginDto dto = new LogLoginDto(loginUser.getId(), dicUserLoginType.getId(), 151 LogLoginDto dto = new LogLoginDto(loginUser.getId(), dicUserLoginType.getId(),
151 - localeMessageUtil.getMessage("auth_login_desc")); 152 + localeMessageUtil.getMessage(ResponseCode.MESSAGE_CODE_40002.getMsg()));
152 logLoginService.saveLoginLog(dto); 153 logLoginService.saveLoginLog(dto);
153 154
154 try{ 155 try{
......
1 package com.fedex.connect.manager.data.dto; 1 package com.fedex.connect.manager.data.dto;
2 2
3 3
4 -import com.fedex.connect.common.dependencies.date.vo.ResponseVo;
5 -import com.fedex.connect.common.dependencies.enums.BaseResponseCode;
6 import com.fedex.connect.common.dependencies.util.Utils; 4 import com.fedex.connect.common.dependencies.util.Utils;
7 -import org.apache.commons.lang3.StringUtils;
8 5
9 import java.io.Serializable; 6 import java.io.Serializable;
10 7
...@@ -22,24 +19,6 @@ public class LoginRequest implements Serializable { ...@@ -22,24 +19,6 @@ public class LoginRequest implements Serializable {
22 } 19 }
23 20
24 /** 21 /**
25 - * 验证用户登录信息
26 - * @param dto
27 - * @return
28 - */
29 - public static ResponseVo validate(LoginRequest dto){
30 - if (dto == null){
31 - ResponseVo.fail(BaseResponseCode.REQUEST_PARAM_NULL.getMsg());
32 - }
33 - if (StringUtils.isBlank(dto.getAccNo())){
34 - ResponseVo.fail("auth_login_accno_null");
35 - }
36 - if (StringUtils.isBlank(dto.getPassword())){
37 - ResponseVo.fail("auth_login_pwd_null");
38 - }
39 - return ResponseVo.succ(null);
40 - }
41 -
42 - /**
43 * 用户账号 22 * 用户账号
44 */ 23 */
45 private String accNo; 24 private String accNo;
......
...@@ -7,11 +7,15 @@ package com.fedex.connect.manager.enums; ...@@ -7,11 +7,15 @@ package com.fedex.connect.manager.enums;
7 */ 7 */
8 public enum ResponseCode { 8 public enum ResponseCode {
9 //********************manager-server模块 9 //********************manager-server模块
10 + MESSAGE_CODE_40001(40001,"business_exception_40001"),
11 + MESSAGE_CODE_40002(40002,"business_log_40002"),
12 + MESSAGE_CODE_40003(40003,"system_exception_40003"),
10 /******打个样,编写样例*****/ 13 /******打个样,编写样例*****/
11 -// MESSAGE_CODE_20001(20001,"business_exception_20001"), 14 +// MESSAGE_CODE_40001(40001,"business_exception_40001"),
12 -// MESSAGE_CODE_20002(20002,"business_success_20002"), 15 +// MESSAGE_CODE_40002(40002,"business_success_40002"),
13 -// MESSAGE_CODE_20003(20003,"system_exception_20003"), 16 +// MESSAGE_CODE_40003(40003,"system_exception_40003"),
14 -// MESSAGE_CODE_20004(20004,"system_success_20004"), 17 +// MESSAGE_CODE_40004(40004,"system_success_40004"),
18 +// MESSAGE_CODE_40005(40005,"business_log_40005"),
15 ; 19 ;
16 private Integer code; 20 private Integer code;
17 private String msg; 21 private String msg;
......
1 package com.fedex.connect.manager.service.base; 1 package com.fedex.connect.manager.service.base;
2 2
3 3
4 -import com.fedex.connect.common.dao.log.UserLoginInfoMapper;
5 -import com.fedex.connect.common.dao.sys.RoleMapper;
6 -import com.fedex.connect.common.dao.sys.UserMapper;
7 -import com.fedex.connect.common.dao.sys.UserRoleMapper;
8 import com.fedex.connect.common.dependencies.i18n.LocaleMessageUtil; 4 import com.fedex.connect.common.dependencies.i18n.LocaleMessageUtil;
5 +import com.fedex.connect.common.dependencies.util.ResponseUtils;
9 import com.fedex.connect.manager.repository.repo.bi.IDicEntriesRepository; 6 import com.fedex.connect.manager.repository.repo.bi.IDicEntriesRepository;
10 import com.fedex.connect.manager.repository.repo.log.IUserLoginLogRepository; 7 import com.fedex.connect.manager.repository.repo.log.IUserLoginLogRepository;
11 -import com.fedex.connect.manager.repository.repo.sys.*; 8 +import com.fedex.connect.manager.repository.repo.sys.IRedisSlabRepository;
9 +import com.fedex.connect.manager.repository.repo.sys.IRoleRepository;
10 +import com.fedex.connect.manager.repository.repo.sys.IUserRepository;
11 +import com.fedex.connect.manager.repository.repo.sys.IUserRoleRepository;
12 import org.springframework.beans.factory.annotation.Autowired; 12 import org.springframework.beans.factory.annotation.Autowired;
13 13
14 import javax.annotation.Resource; 14 import javax.annotation.Resource;
...@@ -18,6 +18,9 @@ public class BaseService { ...@@ -18,6 +18,9 @@ public class BaseService {
18 @Resource 18 @Resource
19 protected LocaleMessageUtil localeMessageUtil; 19 protected LocaleMessageUtil localeMessageUtil;
20 20
21 + @Autowired
22 + protected ResponseUtils responseUtils;
23 +
21 /** 24 /**
22 * repository 25 * repository
23 */ 26 */
......
...@@ -11,6 +11,7 @@ import com.fedex.connect.common.model.sys.RedisSlab; ...@@ -11,6 +11,7 @@ import com.fedex.connect.common.model.sys.RedisSlab;
11 import com.fedex.connect.common.model.sys.Role; 11 import com.fedex.connect.common.model.sys.Role;
12 import com.fedex.connect.common.model.sys.User; 12 import com.fedex.connect.common.model.sys.User;
13 import com.fedex.connect.manager.data.dto.LoginRequest; 13 import com.fedex.connect.manager.data.dto.LoginRequest;
14 +import com.fedex.connect.manager.enums.ResponseCode;
14 import com.fedex.connect.manager.service.base.BaseService; 15 import com.fedex.connect.manager.service.base.BaseService;
15 import com.fedex.connect.manager.service.sys.IRedisUtilService; 16 import com.fedex.connect.manager.service.sys.IRedisUtilService;
16 import com.fedex.connect.manager.service.sys.ISysAuthService; 17 import com.fedex.connect.manager.service.sys.ISysAuthService;
...@@ -65,10 +66,10 @@ public class SysAuthServiceImpl extends BaseService implements ISysAuthService { ...@@ -65,10 +66,10 @@ public class SysAuthServiceImpl extends BaseService implements ISysAuthService {
65 redisUtilService.set(RedisConstants.REDIS_KEY_TOKEN + user.getId(), token, redisExpireTime); 66 redisUtilService.set(RedisConstants.REDIS_KEY_TOKEN + user.getId(), token, redisExpireTime);
66 } catch (NullPointerException e) { 67 } catch (NullPointerException e) {
67 logger.error("***************** redis 异常:{} *********************", e); 68 logger.error("***************** redis 异常:{} *********************", e);
68 - return ResponseVo.fail(BaseResponseCode.SYSTEM_EXECEPTION_CODE.getCode(), localeMessageUtil.getMessage("service_auth_token_reeids"), null); 69 + responseUtils.fail(ResponseCode.MESSAGE_CODE_40003);
69 } 70 }
70 71
71 - return ResponseVo.succ(token); 72 + return responseUtils.success(token);
72 } 73 }
73 74
74 75
...@@ -84,10 +85,10 @@ public class SysAuthServiceImpl extends BaseService implements ISysAuthService { ...@@ -84,10 +85,10 @@ public class SysAuthServiceImpl extends BaseService implements ISysAuthService {
84 redisUtilService.set(RedisConstants.REDIS_KEY_TOKEN + tokenKey, GsonUtils.beanToString(token), 1); 85 redisUtilService.set(RedisConstants.REDIS_KEY_TOKEN + tokenKey, GsonUtils.beanToString(token), 1);
85 } catch (NullPointerException e) { 86 } catch (NullPointerException e) {
86 logger.error("***************** redis 异常:{} *********************", e); 87 logger.error("***************** redis 异常:{} *********************", e);
87 - return ResponseVo.fail(BaseResponseCode.SYSTEM_EXECEPTION_CODE.getCode(), localeMessageUtil.getMessage("service_auth_token_reeids"), null); 88 + responseUtils.fail(ResponseCode.MESSAGE_CODE_40001);
88 } 89 }
89 90
90 - return ResponseVo.succ(tokenKey); 91 + return responseUtils.success(tokenKey);
91 } 92 }
92 93
93 /** 94 /**
......
1 #******************鉴权相关提示,需要做国际化****************** 1 #******************鉴权相关提示,需要做国际化******************
2 #authentication包 2 #authentication包
3 -auth_exc_no_auth=没有访问权限 3 +system_exception_10001=没有访问权限
4 -auth_exc_no_pass_auth=没有通过权限认证 4 +system_exception_10002=没有通过权限认证
5 -auth_filter_user_error=登录身份异常 5 +system_exception_10003=登录身份异常
6 -auth_filter_timeout=登录超过8小时,请重新登录 6 +system_exception_10004=登录超过8小时,请重新登录
7 -auth_filter_stale_dated=登录已过期 7 +system_exception_10005=登录已过期
8 -enum_res_code_301=登录身份异常 8 +system_exception_10006=登录身份异常
9 -enum_res_code_305=登录已过期,请重新登录 9 +system_exception_10007=登录已过期,请重新登录
10 +
11 +#******************业务相关、需要做国际化******************
12 +business_exception_40001=存入token失败
13 +business_log_40002=用户登录
14 +system_exception_40003=系统异常,请联系清关部门
...\ No newline at end of file ...\ No newline at end of file
......
1 #******************鉴权相关提示,需要做国际化****************** 1 #******************鉴权相关提示,需要做国际化******************
2 #authentication包 2 #authentication包
3 -auth_exc_no_auth=没有访问权限 3 +system_exception_10001=没有访问权限
4 -auth_exc_no_pass_auth=没有通过权限认证 4 +system_exception_10002=没有通过权限认证
5 -auth_filter_user_error=登录身份异常 5 +system_exception_10003=登录身份异常
6 -auth_filter_timeout=登录超过8小时,请重新登录 6 +system_exception_10004=登录超过8小时,请重新登录
7 -auth_filter_stale_dated=登录已过期 7 +system_exception_10005=登录已过期
8 -enum_res_code_301=登录身份异常 8 +system_exception_10006=登录身份异常
9 -enum_res_code_305=登录已过期,请重新登录 9 +system_exception_10007=登录已过期,请重新登录
10 +
11 +#******************业务相关、需要做国际化******************
12 +business_exception_40001=存入token失败
13 +business_log_40002=用户登录
14 +system_exception_40003=系统异常,请联系清关部门
...\ No newline at end of file ...\ No newline at end of file
......