Showing
32 changed files
with
327 additions
and
184 deletions
| 1 | package com.fedex.connect.customer.controller.base; | 1 | package com.fedex.connect.customer.controller.base; |
| 2 | 2 | ||
| 3 | 3 | ||
| 4 | +import com.fedex.connect.common.dependencies.common.BasicController; | ||
| 4 | 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; | ||
| 7 | +import com.fedex.connect.common.dependencies.exception.OpErrorException; | ||
| 5 | import com.fedex.connect.common.dependencies.i18n.LocaleMessageUtil; | 8 | import com.fedex.connect.common.dependencies.i18n.LocaleMessageUtil; |
| 9 | +import com.fedex.connect.common.dependencies.util.CurrentUserInfo; | ||
| 10 | +import com.fedex.connect.common.model.sys.User; | ||
| 6 | import com.fedex.connect.customer.service.biz.IAttachmentService; | 11 | import com.fedex.connect.customer.service.biz.IAttachmentService; |
| 7 | import com.fedex.connect.customer.service.biz.IConsignmentService; | 12 | import com.fedex.connect.customer.service.biz.IConsignmentService; |
| 8 | import com.fedex.connect.customer.validate.controller.biz.AttachmentValidate; | 13 | import com.fedex.connect.customer.validate.controller.biz.AttachmentValidate; |
| 9 | import com.fedex.connect.customer.validate.controller.biz.ConsignmentValidate; | 14 | import com.fedex.connect.customer.validate.controller.biz.ConsignmentValidate; |
| 15 | +import lombok.extern.slf4j.Slf4j; | ||
| 10 | import org.springframework.beans.factory.annotation.Autowired; | 16 | import org.springframework.beans.factory.annotation.Autowired; |
| 11 | -import org.springframework.http.HttpHeaders; | ||
| 12 | -import org.springframework.http.HttpStatus; | ||
| 13 | -import org.springframework.http.ResponseEntity; | ||
| 14 | -import org.springframework.util.MultiValueMap; | ||
| 15 | 17 | ||
| 16 | import javax.annotation.Resource; | 18 | import javax.annotation.Resource; |
| 17 | -import java.net.URI; | ||
| 18 | -import java.util.Objects; | ||
| 19 | 19 | ||
| 20 | /** | 20 | /** |
| 21 | * @author EDY | 21 | * @author EDY |
| 22 | */ | 22 | */ |
| 23 | -public class BaseController { | 23 | +@Slf4j |
| 24 | +public class BaseController extends BasicController { | ||
| 24 | 25 | ||
| 25 | @Resource | 26 | @Resource |
| 26 | protected LocaleMessageUtil localeMessageUtil; | 27 | protected LocaleMessageUtil localeMessageUtil; |
| ... | @@ -37,82 +38,8 @@ public class BaseController { | ... | @@ -37,82 +38,8 @@ public class BaseController { |
| 37 | @Autowired | 38 | @Autowired |
| 38 | protected ConsignmentValidate consignmentValidate; | 39 | protected ConsignmentValidate consignmentValidate; |
| 39 | 40 | ||
| 40 | - | 41 | + public User getCurrentUserInfo(){ |
| 41 | - public <T> ResponseEntity<T> seeOther(String url) { | 42 | + User user = this.getUserInfo(localeMessageUtil); |
| 42 | - HttpHeaders httpHeaders = new HttpHeaders(); | 43 | + return user; |
| 43 | - httpHeaders.setLocation(URI.create(url)); | ||
| 44 | - return result(HttpStatus.SEE_OTHER, httpHeaders); | ||
| 45 | - } | ||
| 46 | - | ||
| 47 | - public <T> ResponseEntity<T> temporaryRedirect(String url) { | ||
| 48 | - HttpHeaders httpHeaders = new HttpHeaders(); | ||
| 49 | - httpHeaders.setLocation(URI.create(url)); | ||
| 50 | - return result(HttpStatus.TEMPORARY_REDIRECT, httpHeaders); | ||
| 51 | - } | ||
| 52 | - | ||
| 53 | - public <T> ResponseEntity<T> permanentRedirect(String url) { | ||
| 54 | - HttpHeaders httpHeaders = new HttpHeaders(); | ||
| 55 | - httpHeaders.setLocation(URI.create(url)); | ||
| 56 | - return result(HttpStatus.PERMANENT_REDIRECT, httpHeaders); | ||
| 57 | - } | ||
| 58 | - | ||
| 59 | - public <T> ResponseEntity<T> result(HttpStatus status, T data) { | ||
| 60 | - return new ResponseEntity<>(data, status); | ||
| 61 | - } | ||
| 62 | - | ||
| 63 | - public <T> ResponseEntity<T> result(HttpStatus status, HttpHeaders headers) { | ||
| 64 | - return new ResponseEntity<>(headers, status); | ||
| 65 | - } | ||
| 66 | - | ||
| 67 | - public <T> ResponseEntity<T> ok(T data) { | ||
| 68 | - return new ResponseEntity<>(data, HttpStatus.OK); | ||
| 69 | - } | ||
| 70 | - | ||
| 71 | - public <T> ResponseEntity<T> ok(MultiValueMap<String, String> headers, T data) { | ||
| 72 | - return new ResponseEntity<>(data, headers, HttpStatus.OK); | ||
| 73 | - } | ||
| 74 | - | ||
| 75 | - public <T> ResponseEntity<T> error(HttpStatus code) { | ||
| 76 | - return new ResponseEntity<>(code); | ||
| 77 | } | 44 | } |
| 78 | - | ||
| 79 | - | ||
| 80 | - public <T> ResponseEntity<T> error(HttpStatus code, MultiValueMap<String, String> headers) { | ||
| 81 | - return new ResponseEntity<>(headers, code); | ||
| 82 | - } | ||
| 83 | - | ||
| 84 | - | ||
| 85 | - /** | ||
| 86 | - * 通过自定义的错误码,转换为对应的HttpStatus | ||
| 87 | - * @param response | ||
| 88 | - * @return | ||
| 89 | - */ | ||
| 90 | - public HttpStatus errorMappingStatus(ResponseVo response) { | ||
| 91 | - if (Objects.isNull(response)) { | ||
| 92 | - return HttpStatus.BAD_REQUEST; //400 | ||
| 93 | - } | ||
| 94 | - return HttpStatus.BAD_REQUEST; //400 | ||
| 95 | - } | ||
| 96 | - | ||
| 97 | - | ||
| 98 | - /** | ||
| 99 | - * 判定是否返回成功 | ||
| 100 | - * @param responseEntity | ||
| 101 | - * @param <T> | ||
| 102 | - * @return | ||
| 103 | - */ | ||
| 104 | - public <T> boolean isSuccess(ResponseEntity<ResponseVo<T>> responseEntity) { | ||
| 105 | - return responseEntity != null && responseEntity.getBody() != null && responseEntity.getBody().isSuccess(); | ||
| 106 | - } | ||
| 107 | - | ||
| 108 | - /** | ||
| 109 | - * 判定是否返回成功 | ||
| 110 | - * @param response | ||
| 111 | - * @param <T> | ||
| 112 | - * @return | ||
| 113 | - */ | ||
| 114 | - public <T> boolean isSuccess(ResponseVo<T> response) { | ||
| 115 | - return response != null && response.isSuccess(); | ||
| 116 | - } | ||
| 117 | - | ||
| 118 | } | 45 | } |
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| ... | @@ -2,8 +2,8 @@ package com.fedex.connect.customer.controller.biz; | ... | @@ -2,8 +2,8 @@ package com.fedex.connect.customer.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.customer.data.query.ConsignmentQuery; | 4 | import com.fedex.connect.customer.data.query.ConsignmentQuery; |
| 5 | -import org.springframework.web.bind.annotation.RequestBody; | ||
| 6 | 5 | ||
| 7 | public interface IConsignmentQueryController { | 6 | public interface IConsignmentQueryController { |
| 8 | - ResponseVo findConsignmentList(@RequestBody ConsignmentQuery consignmentQuery); | 7 | + ResponseVo findConsignmentList(ConsignmentQuery consignmentQuery); |
| 8 | + ResponseVo findConsignmentInfo(Long id); | ||
| 9 | } | 9 | } |
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| ... | @@ -6,6 +6,7 @@ import com.fedex.connect.common.dependencies.enums.ResponseCode; | ... | @@ -6,6 +6,7 @@ import com.fedex.connect.common.dependencies.enums.ResponseCode; |
| 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.IAttachmentController; | 8 | import com.fedex.connect.customer.controller.biz.IAttachmentController; |
| 9 | +import com.fedex.connect.customer.controller.biz.IAttachmentQueryController; | ||
| 9 | import com.fedex.connect.customer.data.bo.LongBo; | 10 | import com.fedex.connect.customer.data.bo.LongBo; |
| 10 | import io.swagger.annotations.Api; | 11 | import io.swagger.annotations.Api; |
| 11 | import io.swagger.annotations.ApiOperation; | 12 | import io.swagger.annotations.ApiOperation; |
| ... | @@ -24,10 +25,11 @@ import org.springframework.web.bind.annotation.RestController; | ... | @@ -24,10 +25,11 @@ import org.springframework.web.bind.annotation.RestController; |
| 24 | @RestController | 25 | @RestController |
| 25 | @RequestMapping(value = "/attachment/query", name = "附件查询相关") | 26 | @RequestMapping(value = "/attachment/query", name = "附件查询相关") |
| 26 | @Api(value = "AttachmentQueryController", tags = {"附件查询相关"}) | 27 | @Api(value = "AttachmentQueryController", tags = {"附件查询相关"}) |
| 27 | -public class AttachmentQueryController extends BaseController implements IAttachmentController { | 28 | +public class AttachmentQueryController extends BaseController implements IAttachmentQueryController { |
| 28 | 29 | ||
| 29 | @PostMapping("/history") | 30 | @PostMapping("/history") |
| 30 | @ApiOperation(value = "历史上传记录查询") | 31 | @ApiOperation(value = "历史上传记录查询") |
| 32 | + @Override | ||
| 31 | public ResponseVo findHistory(@RequestBody LongBo bo) { | 33 | public ResponseVo findHistory(@RequestBody LongBo bo) { |
| 32 | ResponseVo responseResultVo = attachmentValidate.preCheckForFindHistory(bo); | 34 | ResponseVo responseResultVo = attachmentValidate.preCheckForFindHistory(bo); |
| 33 | if (responseResultVo != null){ | 35 | if (responseResultVo != null){ | ... | ... |
| ... | @@ -32,6 +32,7 @@ public class ConsignmentController extends BaseController implements IConsignmen | ... | @@ -32,6 +32,7 @@ public class ConsignmentController extends BaseController implements IConsignmen |
| 32 | @PostMapping("/add") | 32 | @PostMapping("/add") |
| 33 | @ApiOperation("上传运单") | 33 | @ApiOperation("上传运单") |
| 34 | @OperationMethodLog(describe = "con_add_oper") | 34 | @OperationMethodLog(describe = "con_add_oper") |
| 35 | + @Override | ||
| 35 | public ResponseVo addConsignment(@RequestBody AddBo bo){ | 36 | public ResponseVo addConsignment(@RequestBody AddBo bo){ |
| 36 | ResponseVo responseResultVo = consignmentValidate.preCheckAdd(bo); | 37 | ResponseVo responseResultVo = consignmentValidate.preCheckAdd(bo); |
| 37 | if (responseResultVo != null){ | 38 | if (responseResultVo != null){ | ... | ... |
| ... | @@ -7,45 +7,53 @@ import com.fedex.connect.common.dependencies.util.CurrentUserInfo; | ... | @@ -7,45 +7,53 @@ import com.fedex.connect.common.dependencies.util.CurrentUserInfo; |
| 7 | import com.fedex.connect.common.model.sys.User; | 7 | import com.fedex.connect.common.model.sys.User; |
| 8 | import com.fedex.connect.customer.controller.base.BaseController; | 8 | import com.fedex.connect.customer.controller.base.BaseController; |
| 9 | import com.fedex.connect.customer.controller.biz.IConsignmentQueryController; | 9 | import com.fedex.connect.customer.controller.biz.IConsignmentQueryController; |
| 10 | +import com.fedex.connect.customer.data.query.ConsignmentInfoQuery; | ||
| 10 | import com.fedex.connect.customer.data.query.ConsignmentQuery; | 11 | import com.fedex.connect.customer.data.query.ConsignmentQuery; |
| 11 | import io.swagger.annotations.Api; | 12 | import io.swagger.annotations.Api; |
| 12 | import io.swagger.annotations.ApiOperation; | 13 | import io.swagger.annotations.ApiOperation; |
| 13 | -import org.slf4j.Logger; | 14 | +import io.swagger.annotations.ApiParam; |
| 14 | -import org.slf4j.LoggerFactory; | 15 | +import lombok.extern.slf4j.Slf4j; |
| 15 | -import org.springframework.web.bind.annotation.PostMapping; | 16 | +import org.springframework.web.bind.annotation.*; |
| 16 | -import org.springframework.web.bind.annotation.RequestBody; | ||
| 17 | -import org.springframework.web.bind.annotation.RequestMapping; | ||
| 18 | -import org.springframework.web.bind.annotation.RestController; | ||
| 19 | 17 | ||
| 20 | /** | 18 | /** |
| 21 | * @Author Szl | 19 | * @Author Szl |
| 22 | * @Description 类说明 运单查询相关接口 | 20 | * @Description 类说明 运单查询相关接口 |
| 23 | * @Date 2024/10/30 | 21 | * @Date 2024/10/30 |
| 24 | */ | 22 | */ |
| 23 | +@Slf4j | ||
| 25 | @RestController | 24 | @RestController |
| 26 | @RequestMapping(value = "/consignment/query", name = "运单查询相关") | 25 | @RequestMapping(value = "/consignment/query", name = "运单查询相关") |
| 27 | @Api(value = "ConsignmentQueryController", tags = {"运单查询相关"}) | 26 | @Api(value = "ConsignmentQueryController", tags = {"运单查询相关"}) |
| 28 | public class ConsignmentQueryController extends BaseController implements IConsignmentQueryController { | 27 | public class ConsignmentQueryController extends BaseController implements IConsignmentQueryController { |
| 29 | - private static final Logger logger = LoggerFactory.getLogger(ConsignmentQueryController.class); | ||
| 30 | 28 | ||
| 31 | @PostMapping("/list") | 29 | @PostMapping("/list") |
| 32 | @ApiOperation(value = "运单查询") | 30 | @ApiOperation(value = "运单查询") |
| 31 | + @Override | ||
| 33 | public ResponseVo findConsignmentList(@RequestBody ConsignmentQuery consignmentQuery) { | 32 | public ResponseVo findConsignmentList(@RequestBody ConsignmentQuery consignmentQuery) { |
| 34 | - User user = null; | 33 | + /** |
| 35 | - try { | 34 | + * 获取当前用户信息 |
| 36 | - user = CurrentUserInfo.getUser(); | 35 | + */ |
| 37 | - //userId = 0L; | 36 | + User user = this.getCurrentUserInfo(); |
| 38 | - } catch (Exception e) { | ||
| 39 | - logger.error(LogShowModel.showException("Exception", e)); | ||
| 40 | - return ResponseVo.fail(localeMessageUtil.getMessage(ResponseCode.TOKEN_FORMAT_ERROR.getMsg())); | ||
| 41 | - } | ||
| 42 | - if (user == null) { | ||
| 43 | - return ResponseVo.fail(localeMessageUtil.getMessage(ResponseCode.OVERDUE_TOKEN_CODE.getMsg())); | ||
| 44 | - } | ||
| 45 | - | ||
| 46 | ConsignmentQuery query = ConsignmentQuery.dataProcessing(consignmentQuery); | 37 | ConsignmentQuery query = ConsignmentQuery.dataProcessing(consignmentQuery); |
| 47 | query.setUserId(user.getId()); | 38 | query.setUserId(user.getId()); |
| 48 | query.setUuid(user.getUserUuid()); | 39 | query.setUuid(user.getUserUuid()); |
| 49 | return consignmentService.findConsignments(query); | 40 | return consignmentService.findConsignments(query); |
| 50 | } | 41 | } |
| 42 | + | ||
| 43 | + @PostMapping("/info/{id}") | ||
| 44 | + @ApiOperation(value = "运单详细信息查询") | ||
| 45 | + @Override | ||
| 46 | + public ResponseVo findConsignmentInfo(@ApiParam(value="运单ID",required = true) @PathVariable(value = "id") Long id) { | ||
| 47 | + /** | ||
| 48 | + * 获取当前用户信息 | ||
| 49 | + */ | ||
| 50 | + User user = this.getCurrentUserInfo(); | ||
| 51 | + | ||
| 52 | + ConsignmentInfoQuery detailQuery = new ConsignmentInfoQuery(); | ||
| 53 | + detailQuery.setUserId(user.getId()); | ||
| 54 | + detailQuery.setUuid(user.getUserUuid()); | ||
| 55 | + detailQuery.setConsignmentId(id); | ||
| 56 | +// return consignmentService.findConsignmentInfo(detailQuery); | ||
| 57 | + return null; | ||
| 58 | + } | ||
| 51 | } | 59 | } | ... | ... |
server/biz-customer/src/main/java/com/fedex/connect/customer/data/query/ConsignmentInfoQuery.java
0 → 100644
| 1 | +package com.fedex.connect.customer.data.query; | ||
| 2 | + | ||
| 3 | +import lombok.Data; | ||
| 4 | + | ||
| 5 | +/** | ||
| 6 | + * @Author mt | ||
| 7 | + * @Description 查询运单详情 | ||
| 8 | + * @Date 2024/11/6 | ||
| 9 | + */ | ||
| 10 | +@Data | ||
| 11 | +public class ConsignmentInfoQuery { | ||
| 12 | + //用户id | ||
| 13 | + private Long userId; | ||
| 14 | + //用户uuid | ||
| 15 | + private String uuid; | ||
| 16 | + //运单id | ||
| 17 | + private Long consignmentId; | ||
| 18 | +} |
| 1 | package com.fedex.connect.customer.data.query; | 1 | package com.fedex.connect.customer.data.query; |
| 2 | 2 | ||
| 3 | -import com.fasterxml.jackson.annotation.JsonIgnore; | ||
| 4 | import com.fedex.connect.common.dependencies.util.DateUtil; | 3 | import com.fedex.connect.common.dependencies.util.DateUtil; |
| 5 | import com.fedex.connect.common.dependencies.util.Utils; | 4 | import com.fedex.connect.common.dependencies.util.Utils; |
| 6 | import com.fedex.connect.customer.data.PageBase; | 5 | import com.fedex.connect.customer.data.PageBase; |
| 6 | +import lombok.Data; | ||
| 7 | import org.springframework.util.CollectionUtils; | 7 | import org.springframework.util.CollectionUtils; |
| 8 | 8 | ||
| 9 | import java.time.LocalDate; | 9 | import java.time.LocalDate; |
| ... | @@ -16,6 +16,7 @@ import java.util.List; | ... | @@ -16,6 +16,7 @@ import java.util.List; |
| 16 | * @Description 类说明 运单查询条件对象 | 16 | * @Description 类说明 运单查询条件对象 |
| 17 | * @Date 2024/10/31 | 17 | * @Date 2024/10/31 |
| 18 | */ | 18 | */ |
| 19 | +@Data | ||
| 19 | public class ConsignmentQuery extends PageBase { | 20 | public class ConsignmentQuery extends PageBase { |
| 20 | 21 | ||
| 21 | public static ConsignmentQuery dataProcessing(ConsignmentQuery query){ | 22 | public static ConsignmentQuery dataProcessing(ConsignmentQuery query){ |
| ... | @@ -45,68 +46,9 @@ public class ConsignmentQuery extends PageBase { | ... | @@ -45,68 +46,9 @@ public class ConsignmentQuery extends PageBase { |
| 45 | 46 | ||
| 46 | private Long sort; | 47 | private Long sort; |
| 47 | 48 | ||
| 48 | - @JsonIgnore | ||
| 49 | private List<String> consignmentCodeList; | 49 | private List<String> consignmentCodeList; |
| 50 | 50 | ||
| 51 | - @JsonIgnore | ||
| 52 | private Long userId; | 51 | private Long userId; |
| 53 | 52 | ||
| 54 | - @JsonIgnore | ||
| 55 | private String uuid; | 53 | private String uuid; |
| 56 | - | ||
| 57 | - public String getUuid() { | ||
| 58 | - return uuid; | ||
| 59 | - } | ||
| 60 | - | ||
| 61 | - public void setUuid(String uuid) { | ||
| 62 | - this.uuid = uuid; | ||
| 63 | - } | ||
| 64 | - | ||
| 65 | - public String getCreateTimeFrom() { | ||
| 66 | - return createTimeFrom; | ||
| 67 | - } | ||
| 68 | - | ||
| 69 | - public void setCreateTimeFrom(String createTimeFrom) { | ||
| 70 | - this.createTimeFrom = createTimeFrom; | ||
| 71 | - } | ||
| 72 | - | ||
| 73 | - public String getCreateTimeTo() { | ||
| 74 | - return createTimeTo; | ||
| 75 | - } | ||
| 76 | - | ||
| 77 | - public void setCreateTimeTo(String createTimeTo) { | ||
| 78 | - this.createTimeTo = createTimeTo; | ||
| 79 | - } | ||
| 80 | - | ||
| 81 | - public String getConsignmentCode() { | ||
| 82 | - return consignmentCode; | ||
| 83 | - } | ||
| 84 | - | ||
| 85 | - public void setConsignmentCode(String consignmentCode) { | ||
| 86 | - this.consignmentCode = consignmentCode; | ||
| 87 | - } | ||
| 88 | - | ||
| 89 | - public Long getUserId() { | ||
| 90 | - return userId; | ||
| 91 | - } | ||
| 92 | - | ||
| 93 | - public void setUserId(Long userId) { | ||
| 94 | - this.userId = userId; | ||
| 95 | - } | ||
| 96 | - | ||
| 97 | - public List<String> getConsignmentCodeList() { | ||
| 98 | - return consignmentCodeList; | ||
| 99 | - } | ||
| 100 | - | ||
| 101 | - public void setConsignmentCodeList(List<String> consignmentCodeList) { | ||
| 102 | - this.consignmentCodeList = consignmentCodeList; | ||
| 103 | - } | ||
| 104 | - | ||
| 105 | - public Long getSort() { | ||
| 106 | - return sort; | ||
| 107 | - } | ||
| 108 | - | ||
| 109 | - public void setSort(Long sort) { | ||
| 110 | - this.sort = sort; | ||
| 111 | - } | ||
| 112 | } | 54 | } | ... | ... |
| ... | @@ -4,6 +4,7 @@ import com.fedex.connect.common.dependencies.date.vo.ResponseVo; | ... | @@ -4,6 +4,7 @@ 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.ResponseCode; |
| 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.stereotype.Component; | 8 | import org.springframework.stereotype.Component; |
| 8 | 9 | ||
| 9 | import javax.annotation.Resource; | 10 | import javax.annotation.Resource; |
| ... | @@ -15,7 +16,7 @@ import javax.annotation.Resource; | ... | @@ -15,7 +16,7 @@ import javax.annotation.Resource; |
| 15 | */ | 16 | */ |
| 16 | @Component | 17 | @Component |
| 17 | public class AttachmentValidate { | 18 | public class AttachmentValidate { |
| 18 | - @Resource | 19 | + @Autowired |
| 19 | protected LocaleMessageUtil localeMessageUtil; | 20 | protected LocaleMessageUtil localeMessageUtil; |
| 20 | 21 | ||
| 21 | /** | 22 | /** | ... | ... |
| 1 | +package com.fedex.connect.customer.validate.controller.biz; | ||
| 2 | + | ||
| 3 | +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.exception.OpErrorException; | ||
| 6 | +import com.fedex.connect.common.dependencies.i18n.LocaleMessageUtil; | ||
| 7 | +import com.fedex.connect.customer.data.bo.AddBo; | ||
| 8 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 9 | +import org.springframework.stereotype.Component; | ||
| 10 | +import org.springframework.util.StringUtils; | ||
| 11 | + | ||
| 12 | +import java.util.Objects; | ||
| 13 | + | ||
| 14 | +/** | ||
| 15 | + * @Author mt | ||
| 16 | + * @Description 运单信息校验 | ||
| 17 | + * @Date 2024/11/6 | ||
| 18 | + */ | ||
| 19 | +@Component | ||
| 20 | +public class ConsignmentInfoValidate { | ||
| 21 | + @Autowired | ||
| 22 | + protected LocaleMessageUtil localeMessageUtil; | ||
| 23 | + | ||
| 24 | + /** | ||
| 25 | + * @Author mt | ||
| 26 | + * @Description 验证运单ID是否为空 | ||
| 27 | + * @Date 2024/11/6 | ||
| 28 | + * @param consignmentId | ||
| 29 | + * @return void | ||
| 30 | + */ | ||
| 31 | + public void validateConsignmentId(Long consignmentId){ | ||
| 32 | + if (Objects.isNull(consignmentId)){ | ||
| 33 | + ResponseVo rsVo = ResponseVo.fail(localeMessageUtil.getMessage(ResponseCode.REQUEST_PARAM_NULL.getMsg())); | ||
| 34 | + throw new OpErrorException(rsVo.getCode(),rsVo.getMsg()); | ||
| 35 | + } | ||
| 36 | + } | ||
| 37 | +} |
| ... | @@ -4,11 +4,10 @@ import com.fedex.connect.common.dependencies.date.vo.ResponseVo; | ... | @@ -4,11 +4,10 @@ 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.ResponseCode; |
| 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.stereotype.Component; | 8 | import org.springframework.stereotype.Component; |
| 8 | import org.springframework.util.StringUtils; | 9 | import org.springframework.util.StringUtils; |
| 9 | 10 | ||
| 10 | -import javax.annotation.Resource; | ||
| 11 | - | ||
| 12 | /** | 11 | /** |
| 13 | * @Author Szl | 12 | * @Author Szl |
| 14 | * @Description 类说明 运单校验类 | 13 | * @Description 类说明 运单校验类 |
| ... | @@ -16,7 +15,7 @@ import javax.annotation.Resource; | ... | @@ -16,7 +15,7 @@ import javax.annotation.Resource; |
| 16 | */ | 15 | */ |
| 17 | @Component | 16 | @Component |
| 18 | public class ConsignmentValidate { | 17 | public class ConsignmentValidate { |
| 19 | - @Resource | 18 | + @Autowired |
| 20 | protected LocaleMessageUtil localeMessageUtil; | 19 | protected LocaleMessageUtil localeMessageUtil; |
| 21 | 20 | ||
| 22 | /** | 21 | /** | ... | ... |
| 1 | conl_cus_declare_count_max=單次最多可查詢1000個運單號碼 | 1 | conl_cus_declare_count_max=單次最多可查詢1000個運單號碼 |
| 2 | 2 | ||
| 3 | +#authentication包 | ||
| 4 | +auth_exc_no_auth=沒有訪問許可權 | ||
| 5 | +auth_exc_no_pass_auth=沒有通過許可權認證 | ||
| 6 | +auth_filter_user_error=登錄身份異常 | ||
| 7 | +auth_filter_timeout=登錄超過8小時,請重新登錄 | ||
| 8 | +auth_filter_stale_dated=登錄已過期 | ||
| 9 | + | ||
| 3 | enum_res_code_301=登錄身份異常 | 10 | enum_res_code_301=登錄身份異常 |
| 4 | enum_res_code_305=登錄已過期,請重新登錄 | 11 | enum_res_code_305=登錄已過期,請重新登錄 |
| 5 | 12 | ... | ... |
| ... | @@ -63,7 +63,7 @@ public class JwtAuthorizationFilter extends BasicAuthenticationFilter { | ... | @@ -63,7 +63,7 @@ public class JwtAuthorizationFilter extends BasicAuthenticationFilter { |
| 63 | //返回客户端发出请求完整URL | 63 | //返回客户端发出请求完整URL |
| 64 | String reqeustUrl = request.getRequestURL().toString(); | 64 | String reqeustUrl = request.getRequestURL().toString(); |
| 65 | logger.info("------------- FROM NETWORK :{}", requestUri); | 65 | logger.info("------------- FROM NETWORK :{}", requestUri); |
| 66 | - if (reqeustUrl.indexOf("/sysUser/logout") > 0) { | 66 | + if (reqeustUrl.indexOf("/user/logout") > 0) { |
| 67 | //退出登录接口,不验token | 67 | //退出登录接口,不验token |
| 68 | chain.doFilter(request, response); | 68 | chain.doFilter(request, response); |
| 69 | return; | 69 | return; | ... | ... |
| 1 | +package com.fedex.connect.common.dependencies.common; | ||
| 2 | + | ||
| 3 | +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.exception.OpErrorException; | ||
| 6 | +import com.fedex.connect.common.dependencies.i18n.LocaleMessageUtil; | ||
| 7 | +import com.fedex.connect.common.dependencies.util.CurrentUserInfo; | ||
| 8 | +import com.fedex.connect.common.model.sys.User; | ||
| 9 | + | ||
| 10 | +/** | ||
| 11 | + * @Author mt | ||
| 12 | + * @Description controller基础类 | ||
| 13 | + * @Date 2024/11/6 | ||
| 14 | + */ | ||
| 15 | +public class BasicController { | ||
| 16 | + public User getUserInfo(LocaleMessageUtil localeMessageUtil){ | ||
| 17 | + User user; | ||
| 18 | + try { | ||
| 19 | + user = CurrentUserInfo.getUser(); | ||
| 20 | + } catch (Exception e) { | ||
| 21 | + ResponseVo rsVo = ResponseVo.fail(ResponseCode.TOKEN_FORMAT_ERROR.getCode(),localeMessageUtil.getMessage(ResponseCode.TOKEN_FORMAT_ERROR.getMsg()),null); | ||
| 22 | + throw new OpErrorException(rsVo.getCode(),rsVo.getMsg(),e); | ||
| 23 | + } | ||
| 24 | + if (user == null) { | ||
| 25 | + ResponseVo rsVo = ResponseVo.fail(ResponseCode.TOKEN_FORMAT_ERROR.getCode(),localeMessageUtil.getMessage(ResponseCode.OVERDUE_TOKEN_CODE.getMsg()),null); | ||
| 26 | + throw new OpErrorException(rsVo.getCode(),rsVo.getMsg()); | ||
| 27 | + } | ||
| 28 | + return user; | ||
| 29 | + } | ||
| 30 | +} | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| ... | @@ -5,7 +5,7 @@ package com.fedex.connect.common.dependencies.contants; | ... | @@ -5,7 +5,7 @@ package com.fedex.connect.common.dependencies.contants; |
| 5 | */ | 5 | */ |
| 6 | public class RedisConstants { | 6 | public class RedisConstants { |
| 7 | 7 | ||
| 8 | - public static final String REDIS_KEY_TOKEN = "tw_user:token:"; | 8 | + public static final String REDIS_KEY_TOKEN = "user:token:"; |
| 9 | 9 | ||
| 10 | public static final int REDIS_EXPIRE_TIME_2H = 7200; | 10 | public static final int REDIS_EXPIRE_TIME_2H = 7200; |
| 11 | public static final int REDIS_EXPIRE_TIME_8H = 28800; | 11 | public static final int REDIS_EXPIRE_TIME_8H = 28800; | ... | ... |
| ... | @@ -56,6 +56,10 @@ public enum ResponseCode { | ... | @@ -56,6 +56,10 @@ 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模块 | ||
| 59 | ; | 63 | ; |
| 60 | private Integer code; | 64 | private Integer code; |
| 61 | private String msg; | 65 | private String msg; | ... | ... |
| 1 | package com.fedex.connect.manager.controller.base; | 1 | package com.fedex.connect.manager.controller.base; |
| 2 | 2 | ||
| 3 | 3 | ||
| 4 | +import com.fedex.connect.common.dependencies.common.BasicController; | ||
| 4 | import com.fedex.connect.common.dependencies.i18n.LocaleMessageUtil; | 5 | import com.fedex.connect.common.dependencies.i18n.LocaleMessageUtil; |
| 6 | +import com.fedex.connect.common.model.sys.User; | ||
| 5 | import com.fedex.connect.manager.config.PropertiesConfig; | 7 | import com.fedex.connect.manager.config.PropertiesConfig; |
| 6 | import com.fedex.connect.manager.service.bi.IDicEntriesService; | 8 | import com.fedex.connect.manager.service.bi.IDicEntriesService; |
| 7 | import com.fedex.connect.manager.service.log.ILogLoginService; | 9 | import com.fedex.connect.manager.service.log.ILogLoginService; |
| ... | @@ -14,7 +16,7 @@ import javax.annotation.Resource; | ... | @@ -14,7 +16,7 @@ import javax.annotation.Resource; |
| 14 | /** | 16 | /** |
| 15 | * @author EDY | 17 | * @author EDY |
| 16 | */ | 18 | */ |
| 17 | -public class BaseController { | 19 | +public class BaseController extends BasicController { |
| 18 | @Resource | 20 | @Resource |
| 19 | protected LocaleMessageUtil localeMessageUtil; | 21 | protected LocaleMessageUtil localeMessageUtil; |
| 20 | @Autowired | 22 | @Autowired |
| ... | @@ -27,4 +29,9 @@ public class BaseController { | ... | @@ -27,4 +29,9 @@ public class BaseController { |
| 27 | protected ILogLoginService logLoginService; | 29 | protected ILogLoginService logLoginService; |
| 28 | @Autowired | 30 | @Autowired |
| 29 | protected IDicEntriesService dicEntriesService; | 31 | protected IDicEntriesService dicEntriesService; |
| 32 | + | ||
| 33 | + public User getCurrentUserInfo(){ | ||
| 34 | + User user = this.getUserInfo(localeMessageUtil); | ||
| 35 | + return user; | ||
| 36 | + } | ||
| 30 | } | 37 | } | ... | ... |
| 1 | +package com.fedex.connect.task.job; | ||
| 2 | + | ||
| 3 | +import com.fedex.connect.task.annotation.ProcessingTime; | ||
| 4 | +import com.fedex.connect.task.service.sys.IRedisSlabExtService; | ||
| 5 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 6 | +import org.springframework.scheduling.annotation.Scheduled; | ||
| 7 | +import org.springframework.stereotype.Component; | ||
| 8 | + | ||
| 9 | +/** | ||
| 10 | + * @Author mt | ||
| 11 | + * @Description 基础定时任务,存放系统相关操作,与具体业务无关 | ||
| 12 | + * @Date 2024/11/6 | ||
| 13 | + */ | ||
| 14 | +@Component | ||
| 15 | +public class BaseJob { | ||
| 16 | + @Autowired | ||
| 17 | + protected IRedisSlabExtService redisUtilService; | ||
| 18 | + | ||
| 19 | + | ||
| 20 | + /** | ||
| 21 | + * 30秒一次作废失效token | ||
| 22 | + */ | ||
| 23 | + @ProcessingTime | ||
| 24 | + @Scheduled(cron="0/30 * * * * ?") | ||
| 25 | + public void validRedisMsgJob(){ | ||
| 26 | + redisUtilService.validRedisMsg(); | ||
| 27 | + } | ||
| 28 | +} |
server/task-schedule/src/main/java/com/fedex/connect/task/repository/base/AbstractDaoRepository.java
| ... | @@ -3,16 +3,18 @@ package com.fedex.connect.task.repository.base; | ... | @@ -3,16 +3,18 @@ package com.fedex.connect.task.repository.base; |
| 3 | import com.fedex.connect.common.dao.sys.KafkaStorageHistoryMapper; | 3 | import com.fedex.connect.common.dao.sys.KafkaStorageHistoryMapper; |
| 4 | import com.fedex.connect.common.dao.sys.KafkaTemporaryStorageMapper; | 4 | import com.fedex.connect.common.dao.sys.KafkaTemporaryStorageMapper; |
| 5 | import com.fedex.connect.task.repository.dao.KafkaTemporaryStorageMapperExt; | 5 | import com.fedex.connect.task.repository.dao.KafkaTemporaryStorageMapperExt; |
| 6 | +import com.fedex.connect.task.repository.dao.RedisSlabMapperExt; | ||
| 6 | import org.slf4j.Logger; | 7 | import org.slf4j.Logger; |
| 7 | import org.slf4j.LoggerFactory; | 8 | import org.slf4j.LoggerFactory; |
| 8 | import org.springframework.beans.factory.annotation.Autowired; | 9 | import org.springframework.beans.factory.annotation.Autowired; |
| 9 | 10 | ||
| 10 | public class AbstractDaoRepository { | 11 | public class AbstractDaoRepository { |
| 11 | - protected Logger log = LoggerFactory.getLogger(this.getClass()); | ||
| 12 | @Autowired | 12 | @Autowired |
| 13 | protected KafkaTemporaryStorageMapperExt kafkaTemporaryStorageMapperExt; | 13 | protected KafkaTemporaryStorageMapperExt kafkaTemporaryStorageMapperExt; |
| 14 | @Autowired | 14 | @Autowired |
| 15 | protected KafkaTemporaryStorageMapper kafkaTemporaryStorageMapper; | 15 | protected KafkaTemporaryStorageMapper kafkaTemporaryStorageMapper; |
| 16 | @Autowired | 16 | @Autowired |
| 17 | protected KafkaStorageHistoryMapper kafkaStorageHistoryMapper; | 17 | protected KafkaStorageHistoryMapper kafkaStorageHistoryMapper; |
| 18 | + @Autowired | ||
| 19 | + protected RedisSlabMapperExt redisSlabMapperExt; | ||
| 18 | } | 20 | } |
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
server/task-schedule/src/main/java/com/fedex/connect/task/repository/dao/RedisSlabMapperExt.java
0 → 100644
| 1 | +package com.fedex.connect.task.repository.dao; | ||
| 2 | + | ||
| 3 | +import com.fedex.connect.common.model.sys.RedisSlab; | ||
| 4 | +import org.apache.ibatis.annotations.Mapper; | ||
| 5 | + | ||
| 6 | +import java.util.Date; | ||
| 7 | +import java.util.List; | ||
| 8 | + | ||
| 9 | +@Mapper | ||
| 10 | +public interface RedisSlabMapperExt { | ||
| 11 | + List<RedisSlab> findValidRedisMsgList(Date curDate); | ||
| 12 | +} | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
server/task-schedule/src/main/java/com/fedex/connect/task/repository/mapper/RedisSlabMapperExt.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
| 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.task.repository.dao.RedisSlabMapperExt"> | ||
| 4 | + <resultMap id="BaseResultMap" type="com.fedex.connect.common.model.sys.RedisSlab"> | ||
| 5 | + <id column="ID" jdbcType="NUMERIC" property="id" /> | ||
| 6 | + <result column="REDIS_KEY" jdbcType="VARCHAR" property="redisKey" /> | ||
| 7 | + <result column="REDIS_MSG" jdbcType="VARCHAR" property="redisMsg" /> | ||
| 8 | + <result column="VALID_DURATION" jdbcType="NUMERIC" property="validDuration" /> | ||
| 9 | + <result column="DIS_TIME" jdbcType="TIMESTAMP" property="disTime" /> | ||
| 10 | + <result column="CREATE_TIME" jdbcType="TIMESTAMP" property="createTime" /> | ||
| 11 | + </resultMap> | ||
| 12 | + <sql id="Base_Column_List"> | ||
| 13 | + ID, REDIS_KEY, REDIS_MSG, VALID_DURATION, DIS_TIME, CREATE_TIME | ||
| 14 | + </sql> | ||
| 15 | + | ||
| 16 | + <select id="findValidRedisMsgList" resultMap="BaseResultMap"> | ||
| 17 | + SELECT <include refid="Base_Column_List" /> FROM T_REDIS_SLAB WHERE DIS_TIME < #{curDate,jdbcType=TIMESTAMP} | ||
| 18 | + </select> | ||
| 19 | +</mapper> | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | +package com.fedex.connect.task.repository.repo.sys; | ||
| 2 | + | ||
| 3 | +import com.fedex.connect.common.model.sys.RedisSlab; | ||
| 4 | + | ||
| 5 | +import java.util.Date; | ||
| 6 | +import java.util.List; | ||
| 7 | + | ||
| 8 | +public interface IRedisSlabExtRepository { | ||
| 9 | + List<RedisSlab> findValidRedisMsgList(Date curDate); | ||
| 10 | +} | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file |
| 1 | -package com.fedex.connect.task.repository.repo.impl; | 1 | +package com.fedex.connect.task.repository.repo.sys.impl; |
| 2 | 2 | ||
| 3 | import com.fedex.connect.common.model.sys.KafkaStorageHistory; | 3 | import com.fedex.connect.common.model.sys.KafkaStorageHistory; |
| 4 | import com.fedex.connect.task.repository.base.AbstractDaoRepository; | 4 | import com.fedex.connect.task.repository.base.AbstractDaoRepository; |
| 5 | -import com.fedex.connect.task.repository.repo.IKafkaStorageHistoryRepository; | 5 | +import com.fedex.connect.task.repository.repo.sys.IKafkaStorageHistoryRepository; |
| 6 | import org.springframework.stereotype.Repository; | 6 | import org.springframework.stereotype.Repository; |
| 7 | 7 | ||
| 8 | import java.util.List; | 8 | import java.util.List; | ... | ... |
| 1 | -package com.fedex.connect.task.repository.repo.impl; | 1 | +package com.fedex.connect.task.repository.repo.sys.impl; |
| 2 | 2 | ||
| 3 | import com.fedex.connect.common.model.sys.KafkaTemporaryStorage; | 3 | import com.fedex.connect.common.model.sys.KafkaTemporaryStorage; |
| 4 | import com.fedex.connect.task.repository.base.AbstractDaoRepository; | 4 | import com.fedex.connect.task.repository.base.AbstractDaoRepository; |
| 5 | -import com.fedex.connect.task.repository.repo.IKafkaTemporaryStorageRepository; | 5 | +import com.fedex.connect.task.repository.repo.sys.IKafkaTemporaryStorageRepository; |
| 6 | import org.springframework.stereotype.Repository; | 6 | import org.springframework.stereotype.Repository; |
| 7 | 7 | ||
| 8 | import java.util.Date; | 8 | import java.util.Date; | ... | ... |
| 1 | +package com.fedex.connect.task.repository.repo.sys.impl; | ||
| 2 | + | ||
| 3 | +import com.fedex.connect.common.model.sys.RedisSlab; | ||
| 4 | +import com.fedex.connect.task.repository.base.AbstractDaoRepository; | ||
| 5 | +import com.fedex.connect.task.repository.repo.sys.IRedisSlabExtRepository; | ||
| 6 | + | ||
| 7 | +import java.util.Date; | ||
| 8 | +import java.util.List; | ||
| 9 | + | ||
| 10 | +/** | ||
| 11 | + * @Author mt | ||
| 12 | + * @Description redis平替操作类 | ||
| 13 | + * @Date 2024/11/6 | ||
| 14 | + */ | ||
| 15 | +public class RedisSlabExtRepositoryImpl extends AbstractDaoRepository implements IRedisSlabExtRepository { | ||
| 16 | + | ||
| 17 | + /** | ||
| 18 | + * @Author mt | ||
| 19 | + * @Description 根据日期查找有效用户信息 | ||
| 20 | + * @Date 2024/11/6 | ||
| 21 | + * @param curDate | ||
| 22 | + * @return java.util.List<com.fedex.connect.common.model.sys.RedisSlab> | ||
| 23 | + */ | ||
| 24 | + public List<RedisSlab> findValidRedisMsgList(Date curDate){ | ||
| 25 | + return redisSlabMapperExt.findValidRedisMsgList(curDate); | ||
| 26 | + } | ||
| 27 | +} |
| 1 | package com.fedex.connect.task.service.base; | 1 | package com.fedex.connect.task.service.base; |
| 2 | 2 | ||
| 3 | -import com.fedex.connect.task.repository.repo.IKafkaStorageHistoryRepository; | 3 | +import com.fedex.connect.common.dependencies.repository.repo.sys.IRedisSlabRepository; |
| 4 | -import com.fedex.connect.task.repository.repo.IKafkaTemporaryStorageRepository; | 4 | +import com.fedex.connect.task.repository.repo.sys.IKafkaStorageHistoryRepository; |
| 5 | +import com.fedex.connect.task.repository.repo.sys.IKafkaTemporaryStorageRepository; | ||
| 6 | +import com.fedex.connect.task.repository.repo.sys.IRedisSlabExtRepository; | ||
| 5 | import org.springframework.beans.factory.annotation.Autowired; | 7 | import org.springframework.beans.factory.annotation.Autowired; |
| 6 | 8 | ||
| 7 | /** | 9 | /** |
| ... | @@ -14,4 +16,8 @@ public class BaseService { | ... | @@ -14,4 +16,8 @@ public class BaseService { |
| 14 | protected IKafkaTemporaryStorageRepository kafKaTemporaryStorageRepository; | 16 | protected IKafkaTemporaryStorageRepository kafKaTemporaryStorageRepository; |
| 15 | @Autowired | 17 | @Autowired |
| 16 | protected IKafkaStorageHistoryRepository kafkaStorageHistoryRepository; | 18 | protected IKafkaStorageHistoryRepository kafkaStorageHistoryRepository; |
| 19 | + @Autowired | ||
| 20 | + protected IRedisSlabRepository redisSlabRepository; | ||
| 21 | + @Autowired | ||
| 22 | + protected IRedisSlabExtRepository redisRepository; | ||
| 17 | } | 23 | } |
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| 1 | +package com.fedex.connect.task.service.sys.impl; | ||
| 2 | + | ||
| 3 | +import com.fedex.connect.common.model.sys.RedisSlab; | ||
| 4 | +import com.fedex.connect.task.service.base.BaseService; | ||
| 5 | +import com.fedex.connect.task.service.sys.IRedisSlabExtService; | ||
| 6 | +import lombok.extern.slf4j.Slf4j; | ||
| 7 | +import org.springframework.stereotype.Service; | ||
| 8 | +import org.springframework.util.CollectionUtils; | ||
| 9 | + | ||
| 10 | +import java.util.*; | ||
| 11 | + | ||
| 12 | +@Slf4j | ||
| 13 | +@Service | ||
| 14 | +public class RedisSlabExtServiceImpl extends BaseService implements IRedisSlabExtService { | ||
| 15 | + | ||
| 16 | + /** | ||
| 17 | + * 查询已经失效的数据 | ||
| 18 | + * @return | ||
| 19 | + */ | ||
| 20 | + @Override | ||
| 21 | + public void validRedisMsg(){ | ||
| 22 | + Date curDate = new Date(); | ||
| 23 | + List<RedisSlab> redisSlabList = redisRepository.findValidRedisMsgList(curDate); | ||
| 24 | + if (CollectionUtils.isEmpty(redisSlabList)){ | ||
| 25 | + return; | ||
| 26 | + } | ||
| 27 | + Optional.ofNullable(redisSlabList).orElse(new ArrayList<>()).stream().filter(Objects::nonNull).map(RedisSlab::getId) | ||
| 28 | + .distinct().forEach(id ->{ | ||
| 29 | + log.info("定时作废RedisSlab-id:{}",id); | ||
| 30 | + redisSlabRepository.deleteByPrimaryKey(id); | ||
| 31 | + }); | ||
| 32 | + } | ||
| 33 | +} |
| ... | @@ -6,8 +6,8 @@ import com.fedex.connect.common.dependencies.util.RPCUtils; | ... | @@ -6,8 +6,8 @@ import com.fedex.connect.common.dependencies.util.RPCUtils; |
| 6 | import com.fedex.connect.common.model.sys.KafkaStorageHistory; | 6 | import com.fedex.connect.common.model.sys.KafkaStorageHistory; |
| 7 | import com.fedex.connect.common.model.sys.KafkaTemporaryStorage; | 7 | import com.fedex.connect.common.model.sys.KafkaTemporaryStorage; |
| 8 | import com.fedex.connect.task.config.PropertiesConfig; | 8 | import com.fedex.connect.task.config.PropertiesConfig; |
| 9 | -import com.fedex.connect.task.repository.repo.IKafkaStorageHistoryRepository; | 9 | +import com.fedex.connect.task.repository.repo.sys.IKafkaStorageHistoryRepository; |
| 10 | -import com.fedex.connect.task.repository.repo.IKafkaTemporaryStorageRepository; | 10 | +import com.fedex.connect.task.repository.repo.sys.IKafkaTemporaryStorageRepository; |
| 11 | import org.springframework.beans.factory.annotation.Autowired; | 11 | import org.springframework.beans.factory.annotation.Autowired; |
| 12 | import org.springframework.stereotype.Component; | 12 | import org.springframework.stereotype.Component; |
| 13 | 13 | ... | ... |
-
Please register or login to post a comment