tao.mo

biz-customer | 修改 | 异常编码放自己模块

mt
2024年11月7日10:34:27
Showing 17 changed files with 105 additions and 53 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.date.model.LogShowModel;
4 -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.util.CurrentUserInfo;
7 import com.fedex.connect.customer.controller.base.BaseController; 3 import com.fedex.connect.customer.controller.base.BaseController;
8 import com.fedex.connect.customer.controller.biz.IAttachmentController; 4 import com.fedex.connect.customer.controller.biz.IAttachmentController;
9 -import com.fedex.connect.customer.data.bo.LongBo;
10 import io.swagger.annotations.Api; 5 import io.swagger.annotations.Api;
11 -import io.swagger.annotations.ApiOperation;
12 import lombok.extern.slf4j.Slf4j; 6 import lombok.extern.slf4j.Slf4j;
13 -import org.springframework.web.bind.annotation.PostMapping;
14 -import org.springframework.web.bind.annotation.RequestBody;
15 import org.springframework.web.bind.annotation.RequestMapping; 7 import org.springframework.web.bind.annotation.RequestMapping;
16 import org.springframework.web.bind.annotation.RestController; 8 import org.springframework.web.bind.annotation.RestController;
17 9
......
...@@ -2,7 +2,7 @@ package com.fedex.connect.customer.controller.biz.impl; ...@@ -2,7 +2,7 @@ package com.fedex.connect.customer.controller.biz.impl;
2 2
3 import com.fedex.connect.common.dependencies.date.model.LogShowModel; 3 import com.fedex.connect.common.dependencies.date.model.LogShowModel;
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.ResponseCode; 5 +import com.fedex.connect.common.dependencies.enums.BaseResponseCode;
6 import com.fedex.connect.common.dependencies.util.CurrentUserInfo; 6 import com.fedex.connect.common.dependencies.util.CurrentUserInfo;
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.IAttachmentQueryController; 8 import com.fedex.connect.customer.controller.biz.IAttachmentQueryController;
...@@ -40,7 +40,7 @@ public class AttachmentQueryController extends BaseController implements IAttach ...@@ -40,7 +40,7 @@ public class AttachmentQueryController extends BaseController implements IAttach
40 //userId = 0L; 40 //userId = 0L;
41 } catch (Exception e) { 41 } catch (Exception e) {
42 log.error(LogShowModel.showException("Exception", e)); 42 log.error(LogShowModel.showException("Exception", e));
43 - return ResponseVo.fail(localeMessageUtil.getMessage(ResponseCode.TOKEN_FORMAT_ERROR.getMsg())); 43 + return ResponseVo.fail(localeMessageUtil.getMessage(BaseResponseCode.TOKEN_FORMAT_ERROR.getMsg()));
44 } 44 }
45 return attachmentQueryService.findHistory(userId,bo.getId()); 45 return attachmentQueryService.findHistory(userId,bo.getId());
46 } 46 }
......
...@@ -3,7 +3,7 @@ package com.fedex.connect.customer.controller.biz.impl; ...@@ -3,7 +3,7 @@ package com.fedex.connect.customer.controller.biz.impl;
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.date.model.LogShowModel; 4 import com.fedex.connect.common.dependencies.date.model.LogShowModel;
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.ResponseCode; 6 +import com.fedex.connect.common.dependencies.enums.BaseResponseCode;
7 import com.fedex.connect.common.dependencies.util.CurrentUserInfo; 7 import com.fedex.connect.common.dependencies.util.CurrentUserInfo;
8 import com.fedex.connect.common.model.sys.User; 8 import com.fedex.connect.common.model.sys.User;
9 import com.fedex.connect.customer.controller.base.BaseController; 9 import com.fedex.connect.customer.controller.base.BaseController;
...@@ -43,10 +43,10 @@ public class ConsignmentController extends BaseController implements IConsignmen ...@@ -43,10 +43,10 @@ public class ConsignmentController extends BaseController implements IConsignmen
43 user = CurrentUserInfo.getUser(); 43 user = CurrentUserInfo.getUser();
44 } catch (Exception e) { 44 } catch (Exception e) {
45 logger.error(LogShowModel.showException("Exception", e)); 45 logger.error(LogShowModel.showException("Exception", e));
46 - return ResponseVo.fail(localeMessageUtil.getMessage(ResponseCode.TOKEN_FORMAT_ERROR.getMsg())); 46 + return ResponseVo.fail(localeMessageUtil.getMessage(BaseResponseCode.TOKEN_FORMAT_ERROR.getMsg()));
47 } 47 }
48 if (user == null) { 48 if (user == null) {
49 - return ResponseVo.fail(localeMessageUtil.getMessage(ResponseCode.OVERDUE_TOKEN_CODE.getMsg())); 49 + return ResponseVo.fail(localeMessageUtil.getMessage(BaseResponseCode.OVERDUE_TOKEN_CODE.getMsg()));
50 } 50 }
51 return consignmentService.add(bo,user); 51 return consignmentService.add(bo,user);
52 } 52 }
......
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.date.model.LogShowModel;
4 import com.fedex.connect.common.dependencies.date.vo.ResponseVo; 3 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.util.CurrentUserInfo;
7 import com.fedex.connect.common.model.sys.User; 4 import com.fedex.connect.common.model.sys.User;
8 import com.fedex.connect.customer.controller.base.BaseController; 5 import com.fedex.connect.customer.controller.base.BaseController;
9 import com.fedex.connect.customer.controller.biz.IConsignmentQueryController; 6 import com.fedex.connect.customer.controller.biz.IConsignmentQueryController;
...@@ -48,14 +45,14 @@ public class ConsignmentQueryController extends BaseController implements IConsi ...@@ -48,14 +45,14 @@ public class ConsignmentQueryController extends BaseController implements IConsi
48 * 获取当前用户信息 45 * 获取当前用户信息
49 */ 46 */
50 User user = this.getCurrentUserInfo(); 47 User user = this.getCurrentUserInfo();
51 - 48 + /**
49 + * 运单id校验
50 + */
52 consignmentInfoValidate.validateConsignmentId(id); 51 consignmentInfoValidate.validateConsignmentId(id);
53 -
54 ConsignmentInfoQuery detailQuery = new ConsignmentInfoQuery(); 52 ConsignmentInfoQuery detailQuery = new ConsignmentInfoQuery();
55 detailQuery.setUserId(user.getId()); 53 detailQuery.setUserId(user.getId());
56 detailQuery.setUuid(user.getUserUuid()); 54 detailQuery.setUuid(user.getUserUuid());
57 detailQuery.setConsignmentId(id); 55 detailQuery.setConsignmentId(id);
58 -// return consignmentQueryService.findConsignmentInfo(detailQuery); 56 + return consignmentQueryService.findConsignmentInfo(detailQuery);
59 - return null;
60 } 57 }
61 } 58 }
......
1 +package com.fedex.connect.customer.enums;
2 +
3 +/**
4 + * @Author mt
5 + * @Description 响应编码样例
6 + * @Date 2024/11/7
7 + */
8 +public enum ResponseCode {
9 + //********************biz_customer模块
10 + /******打个样,编写样例*****/
11 + MESSAGE_CODE_10001(10001,"business_exception_10001"),
12 + MESSAGE_CODE_10002(10002,"business_success_10002"),
13 + MESSAGE_CODE_10003(10003,"system_exception_10003"),
14 + MESSAGE_CODE_10004(10004,"system_success_10004"),
15 +;
16 + private Integer code;
17 + private String msg;
18 +
19 + ResponseCode(Integer code, String msg) {
20 + this.code = code;
21 + this.msg = msg;
22 + }
23 +
24 + public Integer getCode() {
25 + return code;
26 + }
27 +
28 + public String getMsg() {
29 + return msg;
30 + }
31 +}
1 package com.fedex.connect.customer.service.biz; 1 package com.fedex.connect.customer.service.biz;
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.customer.data.query.ConsignmentInfoQuery;
4 import com.fedex.connect.customer.data.query.ConsignmentQuery; 5 import com.fedex.connect.customer.data.query.ConsignmentQuery;
5 6
6 public interface IConsignmentQueryService { 7 public interface IConsignmentQueryService {
...@@ -12,4 +13,6 @@ public interface IConsignmentQueryService { ...@@ -12,4 +13,6 @@ public interface IConsignmentQueryService {
12 * @return com.fedex.connect.common.dependencies.date.vo.ResponseVo 13 * @return com.fedex.connect.common.dependencies.date.vo.ResponseVo
13 */ 14 */
14 ResponseVo findConsignments(ConsignmentQuery query); 15 ResponseVo findConsignments(ConsignmentQuery query);
16 +
17 + ResponseVo findConsignmentInfo(ConsignmentInfoQuery detailQuery);
15 } 18 }
......
...@@ -5,6 +5,7 @@ import com.fedex.connect.common.dependencies.date.vo.PageResult; ...@@ -5,6 +5,7 @@ import com.fedex.connect.common.dependencies.date.vo.PageResult;
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.util.Utils; 6 import com.fedex.connect.common.dependencies.util.Utils;
7 import com.fedex.connect.customer.data.dto.FindConsignmentsDto; 7 import com.fedex.connect.customer.data.dto.FindConsignmentsDto;
8 +import com.fedex.connect.customer.data.query.ConsignmentInfoQuery;
8 import com.fedex.connect.customer.data.query.ConsignmentQuery; 9 import com.fedex.connect.customer.data.query.ConsignmentQuery;
9 import com.fedex.connect.customer.service.base.BaseService; 10 import com.fedex.connect.customer.service.base.BaseService;
10 import com.fedex.connect.customer.service.biz.IConsignmentQueryService; 11 import com.fedex.connect.customer.service.biz.IConsignmentQueryService;
...@@ -27,7 +28,6 @@ public class ConsignmentQueryServiceImpl extends BaseService implements IConsign ...@@ -27,7 +28,6 @@ public class ConsignmentQueryServiceImpl extends BaseService implements IConsign
27 * @return com.fedex.connect.common.dependencies.date.vo.ResponseVo 28 * @return com.fedex.connect.common.dependencies.date.vo.ResponseVo
28 */ 29 */
29 public ResponseVo findConsignments(ConsignmentQuery query) { 30 public ResponseVo findConsignments(ConsignmentQuery query) {
30 -
31 List<String> consignmentCodeList = query.getConsignmentCodeList(); 31 List<String> consignmentCodeList = query.getConsignmentCodeList();
32 if (Utils.isNotEmpty(consignmentCodeList) && consignmentCodeList.size() > GlobalConstantFedex.DECLARE_COUNT) { 32 if (Utils.isNotEmpty(consignmentCodeList) && consignmentCodeList.size() > GlobalConstantFedex.DECLARE_COUNT) {
33 return ResponseVo.fail(localeMessageUtil.getMessage("conl_cus_declare_count_max")); 33 return ResponseVo.fail(localeMessageUtil.getMessage("conl_cus_declare_count_max"));
...@@ -46,4 +46,8 @@ public class ConsignmentQueryServiceImpl extends BaseService implements IConsign ...@@ -46,4 +46,8 @@ public class ConsignmentQueryServiceImpl extends BaseService implements IConsign
46 } 46 }
47 return ResponseVo.succ(pageResult); 47 return ResponseVo.succ(pageResult);
48 } 48 }
49 +
50 + public ResponseVo findConsignmentInfo(ConsignmentInfoQuery detailQuery){
51 + return null;
52 + }
49 } 53 }
......
...@@ -2,7 +2,7 @@ package com.fedex.connect.customer.util.service.biz; ...@@ -2,7 +2,7 @@ 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.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.ResponseCode; 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.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;
...@@ -42,7 +42,7 @@ public class ConsignmentUtil { ...@@ -42,7 +42,7 @@ public class ConsignmentUtil {
42 if (!errList.isEmpty()) { 42 if (!errList.isEmpty()) {
43 String enumResCode601 = localeMessageUtil.getMessage("enum_res_code_601"); 43 String enumResCode601 = localeMessageUtil.getMessage("enum_res_code_601");
44 String errResult = String.join(",", errList) + enumResCode601; 44 String errResult = String.join(",", errList) + enumResCode601;
45 - return ResponseVo.fail(ResponseCode.CONSIGNMENT_CREATOR_ERR, errResult); 45 + return ResponseVo.fail(BaseResponseCode.CONSIGNMENT_CREATOR_ERR, errResult);
46 } 46 }
47 47
48 return null; 48 return null;
...@@ -79,9 +79,9 @@ public class ConsignmentUtil { ...@@ -79,9 +79,9 @@ public class ConsignmentUtil {
79 if (!Objects.equals(consignment.getUserUuid(), user.getUserUuid())){ 79 if (!Objects.equals(consignment.getUserUuid(), user.getUserUuid())){
80 consignmentAddDto.setIsCreatorFlag(DigitConstants.DIGIT_TWO); 80 consignmentAddDto.setIsCreatorFlag(DigitConstants.DIGIT_TWO);
81 if (Objects.equals(consignment.getShipperAccount(),user.getAccountNo())){ 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); 82 + return ResponseVo.succ(BaseResponseCode.CONSIGNMENT_CREATOR_SHIPPER_ACCOUNT_SUC.getCode(), BaseResponseCode.CONSIGNMENT_CREATOR_SHIPPER_ACCOUNT_SUC.getMsg(),consignmentAddDto);
83 }else { 83 }else {
84 - return ResponseVo.succ(ResponseCode.CONSIGNMENT_CREATOR_SHIPPER_ACCOUNT_DIFF_SUC.getCode(),ResponseCode.CONSIGNMENT_CREATOR_SHIPPER_ACCOUNT_DIFF_SUC.getMsg(),consignmentAddDto); 84 + return ResponseVo.succ(BaseResponseCode.CONSIGNMENT_CREATOR_SHIPPER_ACCOUNT_DIFF_SUC.getCode(), BaseResponseCode.CONSIGNMENT_CREATOR_SHIPPER_ACCOUNT_DIFF_SUC.getMsg(),consignmentAddDto);
85 } 85 }
86 }else { 86 }else {
87 return ResponseVo.succ(consignmentAddDto); 87 return ResponseVo.succ(consignmentAddDto);
......
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; 3 import com.fedex.connect.common.dependencies.date.vo.ResponseVo;
4 -import com.fedex.connect.common.dependencies.enums.ResponseCode; 4 +import com.fedex.connect.common.dependencies.enums.BaseResponseCode;
5 import com.fedex.connect.common.dependencies.i18n.LocaleMessageUtil; 5 import com.fedex.connect.common.dependencies.i18n.LocaleMessageUtil;
6 import com.fedex.connect.customer.data.bo.LongBo; 6 import com.fedex.connect.customer.data.bo.LongBo;
7 import org.springframework.beans.factory.annotation.Autowired; 7 import org.springframework.beans.factory.annotation.Autowired;
8 import org.springframework.stereotype.Component; 8 import org.springframework.stereotype.Component;
9 9
10 -import javax.annotation.Resource;
11 -
12 /** 10 /**
13 * @Author Szl 11 * @Author Szl
14 * @Description 类说明 附件校验类 12 * @Description 类说明 附件校验类
...@@ -28,7 +26,7 @@ public class AttachmentValidate { ...@@ -28,7 +26,7 @@ public class AttachmentValidate {
28 */ 26 */
29 public ResponseVo preCheckForFindHistory(LongBo bo){ 27 public ResponseVo preCheckForFindHistory(LongBo bo){
30 if (bo == null || bo.getId() == null){ 28 if (bo == null || bo.getId() == null){
31 - return ResponseVo.fail(localeMessageUtil.getMessage(ResponseCode.REQUEST_PARAM_NULL.getMsg())); 29 + return ResponseVo.fail(localeMessageUtil.getMessage(BaseResponseCode.REQUEST_PARAM_NULL.getMsg()));
32 } 30 }
33 return null; 31 return null;
34 } 32 }
......
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; 3 import com.fedex.connect.common.dependencies.date.vo.ResponseVo;
4 -import com.fedex.connect.common.dependencies.enums.ResponseCode; 4 +import com.fedex.connect.common.dependencies.enums.BaseResponseCode;
5 import com.fedex.connect.common.dependencies.exception.OpErrorException; 5 import com.fedex.connect.common.dependencies.exception.OpErrorException;
6 import com.fedex.connect.common.dependencies.i18n.LocaleMessageUtil; 6 import com.fedex.connect.common.dependencies.i18n.LocaleMessageUtil;
7 import org.springframework.beans.factory.annotation.Autowired; 7 import org.springframework.beans.factory.annotation.Autowired;
...@@ -28,7 +28,7 @@ public class ConsignmentInfoValidate { ...@@ -28,7 +28,7 @@ public class ConsignmentInfoValidate {
28 */ 28 */
29 public void validateConsignmentId(Long consignmentId){ 29 public void validateConsignmentId(Long consignmentId){
30 if (Objects.isNull(consignmentId)){ 30 if (Objects.isNull(consignmentId)){
31 - ResponseVo rsVo = ResponseVo.fail(localeMessageUtil.getMessage(ResponseCode.REQUEST_PARAM_NULL.getMsg())); 31 + ResponseVo rsVo = ResponseVo.fail(localeMessageUtil.getMessage(BaseResponseCode.REQUEST_PARAM_NULL.getMsg()));
32 throw new OpErrorException(rsVo.getCode(),rsVo.getMsg()); 32 throw new OpErrorException(rsVo.getCode(),rsVo.getMsg());
33 } 33 }
34 } 34 }
......
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; 3 import com.fedex.connect.common.dependencies.date.vo.ResponseVo;
4 -import com.fedex.connect.common.dependencies.enums.ResponseCode; 4 +import com.fedex.connect.common.dependencies.enums.BaseResponseCode;
5 import com.fedex.connect.common.dependencies.i18n.LocaleMessageUtil; 5 import com.fedex.connect.common.dependencies.i18n.LocaleMessageUtil;
6 import com.fedex.connect.customer.data.bo.AddBo; 6 import com.fedex.connect.customer.data.bo.AddBo;
7 import org.springframework.beans.factory.annotation.Autowired; 7 import org.springframework.beans.factory.annotation.Autowired;
...@@ -29,7 +29,7 @@ public class ConsignmentValidate { ...@@ -29,7 +29,7 @@ public class ConsignmentValidate {
29 if (bo == null || StringUtils.isEmpty(bo.getConsignmentCode()) || 29 if (bo == null || StringUtils.isEmpty(bo.getConsignmentCode()) ||
30 StringUtils.isEmpty(bo.getRecipientCountry()) || StringUtils.isEmpty(bo.getShipperAccount()) || 30 StringUtils.isEmpty(bo.getRecipientCountry()) || StringUtils.isEmpty(bo.getShipperAccount()) ||
31 StringUtils.isEmpty(bo.getShipperCountry())){ 31 StringUtils.isEmpty(bo.getShipperCountry())){
32 - return ResponseVo.fail(localeMessageUtil.getMessage(ResponseCode.REQUEST_PARAM_NULL.getMsg())); 32 + return ResponseVo.fail(localeMessageUtil.getMessage(BaseResponseCode.REQUEST_PARAM_NULL.getMsg()));
33 } 33 }
34 return null; 34 return null;
35 } 35 }
......
1 package com.fedex.connect.common.dependencies.common; 1 package com.fedex.connect.common.dependencies.common;
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.ResponseCode; 4 +import com.fedex.connect.common.dependencies.enums.BaseResponseCode;
5 import com.fedex.connect.common.dependencies.exception.OpErrorException; 5 import com.fedex.connect.common.dependencies.exception.OpErrorException;
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.CurrentUserInfo; 7 import com.fedex.connect.common.dependencies.util.CurrentUserInfo;
...@@ -18,11 +18,11 @@ public class BasicController { ...@@ -18,11 +18,11 @@ public class BasicController {
18 try { 18 try {
19 user = CurrentUserInfo.getUser(); 19 user = CurrentUserInfo.getUser();
20 } catch (Exception e) { 20 } catch (Exception e) {
21 - ResponseVo rsVo = ResponseVo.fail(ResponseCode.TOKEN_FORMAT_ERROR.getCode(),localeMessageUtil.getMessage(ResponseCode.TOKEN_FORMAT_ERROR.getMsg()),null); 21 + ResponseVo rsVo = ResponseVo.fail(BaseResponseCode.TOKEN_FORMAT_ERROR.getCode(),localeMessageUtil.getMessage(BaseResponseCode.TOKEN_FORMAT_ERROR.getMsg()),null);
22 throw new OpErrorException(rsVo.getCode(),rsVo.getMsg(),e); 22 throw new OpErrorException(rsVo.getCode(),rsVo.getMsg(),e);
23 } 23 }
24 if (user == null) { 24 if (user == null) {
25 - ResponseVo rsVo = ResponseVo.fail(ResponseCode.TOKEN_FORMAT_ERROR.getCode(),localeMessageUtil.getMessage(ResponseCode.OVERDUE_TOKEN_CODE.getMsg()),null); 25 + ResponseVo rsVo = ResponseVo.fail(BaseResponseCode.TOKEN_FORMAT_ERROR.getCode(),localeMessageUtil.getMessage(BaseResponseCode.OVERDUE_TOKEN_CODE.getMsg()),null);
26 throw new OpErrorException(rsVo.getCode(),rsVo.getMsg()); 26 throw new OpErrorException(rsVo.getCode(),rsVo.getMsg());
27 } 27 }
28 return user; 28 return user;
......
1 package com.fedex.connect.common.dependencies.date.vo; 1 package com.fedex.connect.common.dependencies.date.vo;
2 2
3 -import com.fedex.connect.common.dependencies.enums.ResponseCode; 3 +import com.fedex.connect.common.dependencies.enums.BaseResponseCode;
4 4
5 import javax.servlet.http.HttpServletResponse; 5 import javax.servlet.http.HttpServletResponse;
6 6
...@@ -49,11 +49,11 @@ public class ResponseVo<T> { ...@@ -49,11 +49,11 @@ public class ResponseVo<T> {
49 } 49 }
50 50
51 public static ResponseVo succ(Object data, String message) { 51 public static ResponseVo succ(Object data, String message) {
52 - return succ(ResponseCode.SUCCESS_CODE.getCode(), message, data); 52 + return succ(BaseResponseCode.SUCCESS_CODE.getCode(), message, data);
53 } 53 }
54 54
55 public static ResponseVo succ(Object data) { 55 public static ResponseVo succ(Object data) {
56 - return succ(ResponseCode.SUCCESS_CODE.getCode(), "SUCCESS", data); 56 + return succ(BaseResponseCode.SUCCESS_CODE.getCode(), "SUCCESS", data);
57 } 57 }
58 58
59 public static ResponseVo succ(int code, String msg, Object data) { 59 public static ResponseVo succ(int code, String msg, Object data) {
...@@ -66,7 +66,7 @@ public class ResponseVo<T> { ...@@ -66,7 +66,7 @@ public class ResponseVo<T> {
66 } 66 }
67 67
68 public static ResponseVo fail(String msg) { 68 public static ResponseVo fail(String msg) {
69 - return fail(ResponseCode.FAIL_CODE.getCode(), msg,null); 69 + return fail(BaseResponseCode.FAIL_CODE.getCode(), msg,null);
70 } 70 }
71 71
72 public static ResponseVo fail(int code, String msg, Object data) { 72 public static ResponseVo fail(int code, String msg, Object data) {
...@@ -78,11 +78,11 @@ public class ResponseVo<T> { ...@@ -78,11 +78,11 @@ public class ResponseVo<T> {
78 return r; 78 return r;
79 } 79 }
80 80
81 - public static ResponseVo fail(ResponseCode resultCode) { 81 + public static ResponseVo fail(BaseResponseCode resultCode) {
82 return fail(resultCode.getCode(), resultCode.getMsg(), null); 82 return fail(resultCode.getCode(), resultCode.getMsg(), null);
83 } 83 }
84 84
85 - public static ResponseVo fail(ResponseCode resultCode, Object data) { 85 + public static ResponseVo fail(BaseResponseCode resultCode, Object data) {
86 return fail(resultCode.getCode(), resultCode.getMsg(), data); 86 return fail(resultCode.getCode(), resultCode.getMsg(), data);
87 } 87 }
88 } 88 }
......
...@@ -5,7 +5,7 @@ package com.fedex.connect.common.dependencies.enums; ...@@ -5,7 +5,7 @@ package com.fedex.connect.common.dependencies.enums;
5 * @author erry 5 * @author erry
6 */ 6 */
7 7
8 -public enum ResponseCode { 8 +public enum BaseResponseCode {
9 /** 9 /**
10 * 200=操作成功 10 * 200=操作成功
11 * 201=操作失败 11 * 201=操作失败
...@@ -56,15 +56,11 @@ public enum ResponseCode { ...@@ -56,15 +56,11 @@ public enum ResponseCode {
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"), 57 CONSIGNMENT_CREATOR_SHIPPER_ACCOUNT_SUC(602,"enum_res_code_602"),
58 CONSIGNMENT_CREATOR_SHIPPER_ACCOUNT_DIFF_SUC(603,"enum_res_code_603"), 58 CONSIGNMENT_CREATOR_SHIPPER_ACCOUNT_DIFF_SUC(603,"enum_res_code_603"),
59 - //********************biz_customer模块
60 -
61 -
62 - //********************manager-server模块
63 ; 59 ;
64 private Integer code; 60 private Integer code;
65 private String msg; 61 private String msg;
66 62
67 - ResponseCode(Integer code, String msg) { 63 + BaseResponseCode(Integer code, String msg) {
68 this.code = code; 64 this.code = code;
69 this.msg = msg; 65 this.msg = msg;
70 } 66 }
......
...@@ -2,7 +2,7 @@ package com.fedex.connect.manager.data.dto; ...@@ -2,7 +2,7 @@ package com.fedex.connect.manager.data.dto;
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.ResponseCode; 5 +import com.fedex.connect.common.dependencies.enums.BaseResponseCode;
6 import com.fedex.connect.common.dependencies.util.Utils; 6 import com.fedex.connect.common.dependencies.util.Utils;
7 import org.apache.commons.lang3.StringUtils; 7 import org.apache.commons.lang3.StringUtils;
8 8
...@@ -28,7 +28,7 @@ public class LoginRequest implements Serializable { ...@@ -28,7 +28,7 @@ public class LoginRequest implements Serializable {
28 */ 28 */
29 public static ResponseVo validate(LoginRequest dto){ 29 public static ResponseVo validate(LoginRequest dto){
30 if (dto == null){ 30 if (dto == null){
31 - ResponseVo.fail(ResponseCode.REQUEST_PARAM_NULL.getMsg()); 31 + ResponseVo.fail(BaseResponseCode.REQUEST_PARAM_NULL.getMsg());
32 } 32 }
33 if (StringUtils.isBlank(dto.getAccNo())){ 33 if (StringUtils.isBlank(dto.getAccNo())){
34 ResponseVo.fail("auth_login_accno_null"); 34 ResponseVo.fail("auth_login_accno_null");
......
1 +package com.fedex.connect.manager.enums;
2 +
3 +/**
4 + * @Author mt
5 + * @Description 响应编码样例
6 + * @Date 2024/11/7
7 + */
8 +public enum ResponseCode {
9 + //********************manager-server模块
10 + /******打个样,编写样例*****/
11 +// MESSAGE_CODE_20001(20001,"business_exception_20001"),
12 +// MESSAGE_CODE_20002(20002,"business_success_20002"),
13 +// MESSAGE_CODE_20003(20003,"system_exception_20003"),
14 +// MESSAGE_CODE_20004(20004,"system_success_20004"),
15 +;
16 + private Integer code;
17 + private String msg;
18 +
19 + ResponseCode(Integer code, String msg) {
20 + this.code = code;
21 + this.msg = msg;
22 + }
23 +
24 + public Integer getCode() {
25 + return code;
26 + }
27 +
28 + public String getMsg() {
29 + return msg;
30 + }
31 +}
...\ No newline at end of file ...\ No newline at end of file
...@@ -4,7 +4,7 @@ package com.fedex.connect.manager.service.sys.impl; ...@@ -4,7 +4,7 @@ package com.fedex.connect.manager.service.sys.impl;
4 import com.fedex.connect.common.dependencies.contants.DatabaseConstants; 4 import com.fedex.connect.common.dependencies.contants.DatabaseConstants;
5 import com.fedex.connect.common.dependencies.contants.RedisConstants; 5 import com.fedex.connect.common.dependencies.contants.RedisConstants;
6 import com.fedex.connect.common.dependencies.date.vo.ResponseVo; 6 import com.fedex.connect.common.dependencies.date.vo.ResponseVo;
7 -import com.fedex.connect.common.dependencies.enums.ResponseCode; 7 +import com.fedex.connect.common.dependencies.enums.BaseResponseCode;
8 import com.fedex.connect.common.dependencies.util.GsonUtils; 8 import com.fedex.connect.common.dependencies.util.GsonUtils;
9 import com.fedex.connect.common.dependencies.util.JwtTokenUtils; 9 import com.fedex.connect.common.dependencies.util.JwtTokenUtils;
10 import com.fedex.connect.common.model.sys.RedisSlab; 10 import com.fedex.connect.common.model.sys.RedisSlab;
...@@ -65,7 +65,7 @@ public class SysAuthServiceImpl extends BaseService implements ISysAuthService { ...@@ -65,7 +65,7 @@ public class SysAuthServiceImpl extends BaseService implements ISysAuthService {
65 redisUtilService.set(RedisConstants.REDIS_KEY_TOKEN + user.getId(), token, redisExpireTime); 65 redisUtilService.set(RedisConstants.REDIS_KEY_TOKEN + user.getId(), token, redisExpireTime);
66 } catch (NullPointerException e) { 66 } catch (NullPointerException e) {
67 logger.error("***************** redis 异常:{} *********************", e); 67 logger.error("***************** redis 异常:{} *********************", e);
68 - return ResponseVo.fail(ResponseCode.SYSTEM_EXECEPTION_CODE.getCode(), localeMessageUtil.getMessage("service_auth_token_reeids"), null); 68 + return ResponseVo.fail(BaseResponseCode.SYSTEM_EXECEPTION_CODE.getCode(), localeMessageUtil.getMessage("service_auth_token_reeids"), null);
69 } 69 }
70 70
71 return ResponseVo.succ(token); 71 return ResponseVo.succ(token);
...@@ -84,7 +84,7 @@ public class SysAuthServiceImpl extends BaseService implements ISysAuthService { ...@@ -84,7 +84,7 @@ public class SysAuthServiceImpl extends BaseService implements ISysAuthService {
84 redisUtilService.set(RedisConstants.REDIS_KEY_TOKEN + tokenKey, GsonUtils.beanToString(token), 1); 84 redisUtilService.set(RedisConstants.REDIS_KEY_TOKEN + tokenKey, GsonUtils.beanToString(token), 1);
85 } catch (NullPointerException e) { 85 } catch (NullPointerException e) {
86 logger.error("***************** redis 异常:{} *********************", e); 86 logger.error("***************** redis 异常:{} *********************", e);
87 - return ResponseVo.fail(ResponseCode.SYSTEM_EXECEPTION_CODE.getCode(), localeMessageUtil.getMessage("service_auth_token_reeids"), null); 87 + return ResponseVo.fail(BaseResponseCode.SYSTEM_EXECEPTION_CODE.getCode(), localeMessageUtil.getMessage("service_auth_token_reeids"), null);
88 } 88 }
89 89
90 return ResponseVo.succ(tokenKey); 90 return ResponseVo.succ(tokenKey);
......