From ed27ac8115ce27b913da4c49d7c61671eff3c92e Mon Sep 17 00:00:00 2001 From: yss <17921@qq.com> Date: Tue, 18 Apr 2023 11:09:20 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E5=BE=85=E9=98=85=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../client/NotificationFeignClient.java | 17 ++ .../NotificationFeignFallbackFactory.java | 14 ++ .../controller/BizReadingController.java | 37 ++++ .../entity/NoticeReadingPO.java | 204 ++++++++++++++++++ .../NoticeReadingUpdateRequestBody.java | 50 +++++ .../service/BizReadingService.java | 21 ++ .../service/impl/BizReadingServiceImpl.java | 35 +++ 7 files changed, 378 insertions(+) create mode 100644 src/main/java/com/chinaunicom/mall/ebtp/extend/bizshortmessageemail/controller/BizReadingController.java create mode 100644 src/main/java/com/chinaunicom/mall/ebtp/extend/bizshortmessageemail/entity/NoticeReadingPO.java create mode 100644 src/main/java/com/chinaunicom/mall/ebtp/extend/bizshortmessageemail/entity/NoticeReadingUpdateRequestBody.java create mode 100644 src/main/java/com/chinaunicom/mall/ebtp/extend/bizshortmessageemail/service/BizReadingService.java create mode 100644 src/main/java/com/chinaunicom/mall/ebtp/extend/bizshortmessageemail/service/impl/BizReadingServiceImpl.java diff --git a/src/main/java/com/chinaunicom/mall/ebtp/extend/bizshortmessageemail/client/NotificationFeignClient.java b/src/main/java/com/chinaunicom/mall/ebtp/extend/bizshortmessageemail/client/NotificationFeignClient.java index 4220e7e..1323887 100644 --- a/src/main/java/com/chinaunicom/mall/ebtp/extend/bizshortmessageemail/client/NotificationFeignClient.java +++ b/src/main/java/com/chinaunicom/mall/ebtp/extend/bizshortmessageemail/client/NotificationFeignClient.java @@ -2,13 +2,20 @@ package com.chinaunicom.mall.ebtp.extend.bizshortmessageemail.client; import com.chinaunicom.mall.ebtp.common.base.entity.BaseResponse; +import com.chinaunicom.mall.ebtp.common.log.OperationLogDetail; +import com.chinaunicom.mall.ebtp.common.log.enums.EbtpLogBusinessModule; +import com.chinaunicom.mall.ebtp.common.log.enums.EbtpLogType; import com.chinaunicom.mall.ebtp.extend.bizshortmessageemail.entity.EshopMailPendingPO; import com.chinaunicom.mall.ebtp.extend.bizshortmessageemail.entity.EshopSmsPendingPO; +import com.chinaunicom.mall.ebtp.extend.bizshortmessageemail.entity.NoticeReadingPO; +import com.chinaunicom.mall.ebtp.extend.bizshortmessageemail.entity.NoticeReadingUpdateRequestBody; import io.swagger.annotations.ApiOperation; import org.springframework.cloud.openfeign.FeignClient; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; +import javax.validation.Valid; + @FeignClient(value = "${mconfig.feign.name.notification}", fallbackFactory = NotificationFeignFallbackFactory.class) public interface NotificationFeignClient { @@ -20,4 +27,14 @@ public interface NotificationFeignClient { @PostMapping("/v1/notification/sendMail") BaseResponse sendMail(@RequestBody EshopMailPendingPO eshopMailPendingPO); + @ApiOperation(value = "新增待阅", tags = "新增待阅", notes = "新增待阅") + @PostMapping("/v1/notification/sendReading") + @OperationLogDetail(businessModule = EbtpLogBusinessModule.OTHER,operationType = EbtpLogType.SELECT,detail = "待阅-新增") + BaseResponse sendPending(@Valid @RequestBody NoticeReadingPO noticeReadingPO); + + @ApiOperation(value = "待阅更新或删除", tags = "待阅更新或删除", notes = "待阅更新或删除") + @PostMapping("/v1/notification/updateReading") + @OperationLogDetail(businessModule = EbtpLogBusinessModule.OTHER,operationType = EbtpLogType.SELECT,detail = "待阅-更新或删除") + BaseResponse updateReading(@Valid @RequestBody NoticeReadingUpdateRequestBody noticeReadingUpdateRequestBody); + } diff --git a/src/main/java/com/chinaunicom/mall/ebtp/extend/bizshortmessageemail/client/NotificationFeignFallbackFactory.java b/src/main/java/com/chinaunicom/mall/ebtp/extend/bizshortmessageemail/client/NotificationFeignFallbackFactory.java index 246f90a..29a5916 100644 --- a/src/main/java/com/chinaunicom/mall/ebtp/extend/bizshortmessageemail/client/NotificationFeignFallbackFactory.java +++ b/src/main/java/com/chinaunicom/mall/ebtp/extend/bizshortmessageemail/client/NotificationFeignFallbackFactory.java @@ -4,10 +4,14 @@ import cn.hutool.core.exceptions.ExceptionUtil; import com.chinaunicom.mall.ebtp.common.base.entity.BaseResponse; import com.chinaunicom.mall.ebtp.extend.bizshortmessageemail.entity.EshopMailPendingPO; import com.chinaunicom.mall.ebtp.extend.bizshortmessageemail.entity.EshopSmsPendingPO; +import com.chinaunicom.mall.ebtp.extend.bizshortmessageemail.entity.NoticeReadingPO; +import com.chinaunicom.mall.ebtp.extend.bizshortmessageemail.entity.NoticeReadingUpdateRequestBody; import feign.hystrix.FallbackFactory; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; +import javax.validation.Valid; + @Component @Slf4j public class NotificationFeignFallbackFactory implements FallbackFactory { @@ -26,6 +30,16 @@ public class NotificationFeignFallbackFactory implements FallbackFactory Date: Tue, 18 Apr 2023 13:45:41 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E5=BE=85=E9=98=85=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../NoticeReadingUpdateRequestBody.java | 24 +++++++------------ 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/src/main/java/com/chinaunicom/mall/ebtp/extend/bizshortmessageemail/entity/NoticeReadingUpdateRequestBody.java b/src/main/java/com/chinaunicom/mall/ebtp/extend/bizshortmessageemail/entity/NoticeReadingUpdateRequestBody.java index 66539f1..2a0b564 100644 --- a/src/main/java/com/chinaunicom/mall/ebtp/extend/bizshortmessageemail/entity/NoticeReadingUpdateRequestBody.java +++ b/src/main/java/com/chinaunicom/mall/ebtp/extend/bizshortmessageemail/entity/NoticeReadingUpdateRequestBody.java @@ -2,37 +2,29 @@ package com.chinaunicom.mall.ebtp.extend.bizshortmessageemail.entity; import io.swagger.annotations.ApiModelProperty; - -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.experimental.Accessors; import org.hibernate.validator.constraints.Length; - - import javax.validation.constraints.NotBlank; -@Data -@EqualsAndHashCode(callSuper = false) -@Accessors(chain = true) + public class NoticeReadingUpdateRequestBody { @ApiModelProperty("待阅信息的编号") - @NotBlank(message = "待阅编号不能为空" ) - @Length(message = "待阅编号不能超过{max}个字符",max = 100 ) + @NotBlank(message = "待阅编号不能为空") + @Length(message = "待阅编号不能超过{max}个字符",max = 100) private String readingCode; @ApiModelProperty("待阅状态 0:待阅 1:已阅 d:待阅删除") - @NotBlank(message = "待阅状态不能为空" ) - @Length(message = "待阅状态不能超过{max}个字符",max = 1 ) + @NotBlank(message = "待阅状态不能为空") + @Length(message = "待阅状态不能超过{max}个字符",max = 1) private String readingStatus; @ApiModelProperty("待阅状态更新时间") - @Length(message = "待阅更新时间不能超过{max}个字符",max = 20 ) + @Length(message = "待阅更新时间不能超过{max}个字符",max = 20) private String lastUpdateDate; @ApiModelProperty("待办类型:1 门户待阅 2 门户流程待办 3 商城待阅") - @NotBlank(message = "待阅类型不能为空" ) - @Length(message = "待阅类型不能超过{max}个字符",max = 1 ) + @NotBlank(message = "待阅类型不能为空") + @Length(message = "待阅类型不能超过{max}个字符",max = 1) private String readingType; @ApiModelProperty("待阅产生时间") From ab730ad2c5d9e04fae675458210b150577a473b3 Mon Sep 17 00:00:00 2001 From: yss <17921@qq.com> Date: Tue, 18 Apr 2023 13:57:45 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E5=BE=85=E9=98=85=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/BizReadingServiceImpl.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/main/java/com/chinaunicom/mall/ebtp/extend/bizshortmessageemail/service/impl/BizReadingServiceImpl.java b/src/main/java/com/chinaunicom/mall/ebtp/extend/bizshortmessageemail/service/impl/BizReadingServiceImpl.java index 013e662..fe7bf06 100644 --- a/src/main/java/com/chinaunicom/mall/ebtp/extend/bizshortmessageemail/service/impl/BizReadingServiceImpl.java +++ b/src/main/java/com/chinaunicom/mall/ebtp/extend/bizshortmessageemail/service/impl/BizReadingServiceImpl.java @@ -1,11 +1,14 @@ package com.chinaunicom.mall.ebtp.extend.bizshortmessageemail.service.impl; import com.chinaunicom.mall.ebtp.common.base.entity.BaseResponse; +import com.chinaunicom.mall.ebtp.common.base.service.IBaseCacheUserService; import com.chinaunicom.mall.ebtp.extend.bizshortmessageemail.client.NotificationFeignClient; import com.chinaunicom.mall.ebtp.extend.bizshortmessageemail.entity.NoticeReadingPO; import com.chinaunicom.mall.ebtp.extend.bizshortmessageemail.entity.NoticeReadingUpdateRequestBody; import com.chinaunicom.mall.ebtp.extend.bizshortmessageemail.service.BizReadingService; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import javax.annotation.Resource; @@ -19,12 +22,21 @@ public class BizReadingServiceImpl implements BizReadingService { @Resource private NotificationFeignClient notificationFeignClient; + @Autowired + private IBaseCacheUserService cacheUserService; @Override public BaseResponse sendPending(NoticeReadingPO noticeReadingPO) { // noticeReadingPO.setSendCenter("na134"); noticeReadingPO.setSendCenter("ebtp"); noticeReadingPO.setSendModule("biz-service-ebtp-extend"); + if(StringUtils.isBlank(noticeReadingPO.getOperatorType())){ + noticeReadingPO.setOperatorType("a"); + } + if(StringUtils.isBlank(noticeReadingPO.getReadingSourceUserId())){ + noticeReadingPO.setReadingSourceUserId(cacheUserService.getCacheUser().getUserId()); + noticeReadingPO.setReadingSourceUserCn(cacheUserService.getCacheUser().getFullName()); + } return notificationFeignClient.sendPending(noticeReadingPO); } From 984cab3089b6b0adadcb91bed4adfc2fa2ee5003 Mon Sep 17 00:00:00 2001 From: yss <17921@qq.com> Date: Tue, 18 Apr 2023 17:20:23 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E5=BE=85=E9=98=85=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../client/NotificationFeignClient.java | 2 +- .../NotificationFeignFallbackFactory.java | 2 +- .../controller/BizReadingController.java | 19 +++++++----- .../NoticeReadingUpdateRequestBody.java | 7 ++++- .../service/BizReadingService.java | 4 ++- .../service/impl/BizReadingServiceImpl.java | 29 ++++++++++++++++--- 6 files changed, 47 insertions(+), 16 deletions(-) diff --git a/src/main/java/com/chinaunicom/mall/ebtp/extend/bizshortmessageemail/client/NotificationFeignClient.java b/src/main/java/com/chinaunicom/mall/ebtp/extend/bizshortmessageemail/client/NotificationFeignClient.java index 1323887..8f28a9d 100644 --- a/src/main/java/com/chinaunicom/mall/ebtp/extend/bizshortmessageemail/client/NotificationFeignClient.java +++ b/src/main/java/com/chinaunicom/mall/ebtp/extend/bizshortmessageemail/client/NotificationFeignClient.java @@ -30,7 +30,7 @@ public interface NotificationFeignClient { @ApiOperation(value = "新增待阅", tags = "新增待阅", notes = "新增待阅") @PostMapping("/v1/notification/sendReading") @OperationLogDetail(businessModule = EbtpLogBusinessModule.OTHER,operationType = EbtpLogType.SELECT,detail = "待阅-新增") - BaseResponse sendPending(@Valid @RequestBody NoticeReadingPO noticeReadingPO); + BaseResponse sendReading(@Valid @RequestBody NoticeReadingPO noticeReadingPO); @ApiOperation(value = "待阅更新或删除", tags = "待阅更新或删除", notes = "待阅更新或删除") @PostMapping("/v1/notification/updateReading") diff --git a/src/main/java/com/chinaunicom/mall/ebtp/extend/bizshortmessageemail/client/NotificationFeignFallbackFactory.java b/src/main/java/com/chinaunicom/mall/ebtp/extend/bizshortmessageemail/client/NotificationFeignFallbackFactory.java index 29a5916..21c86c5 100644 --- a/src/main/java/com/chinaunicom/mall/ebtp/extend/bizshortmessageemail/client/NotificationFeignFallbackFactory.java +++ b/src/main/java/com/chinaunicom/mall/ebtp/extend/bizshortmessageemail/client/NotificationFeignFallbackFactory.java @@ -32,7 +32,7 @@ public class NotificationFeignFallbackFactory implements FallbackFactory Date: Wed, 19 Apr 2023 14:37:49 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E5=BE=85=E9=98=85=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bizshortmessageemail/entity/NoticeReadingPO.java | 3 +++ .../service/impl/BizReadingServiceImpl.java | 7 +++++++ .../extend/funcswitch/dao/BizFuncSwitchConfigMapper.java | 3 +++ .../funcswitch/dao/mapper/BizFuncSwitchConfigMapper.xml | 5 +++++ 4 files changed, 18 insertions(+) diff --git a/src/main/java/com/chinaunicom/mall/ebtp/extend/bizshortmessageemail/entity/NoticeReadingPO.java b/src/main/java/com/chinaunicom/mall/ebtp/extend/bizshortmessageemail/entity/NoticeReadingPO.java index 7b7fb4c..3c2e0bc 100644 --- a/src/main/java/com/chinaunicom/mall/ebtp/extend/bizshortmessageemail/entity/NoticeReadingPO.java +++ b/src/main/java/com/chinaunicom/mall/ebtp/extend/bizshortmessageemail/entity/NoticeReadingPO.java @@ -201,4 +201,7 @@ public class NoticeReadingPO implements Serializable { @ApiModelProperty("最后一次更新时间") private LocalDateTime lastUpdateTime; + @ApiModelProperty("功能标识:字典中包含才发送,所以要在字典中配置") + private String functionFlag; + } diff --git a/src/main/java/com/chinaunicom/mall/ebtp/extend/bizshortmessageemail/service/impl/BizReadingServiceImpl.java b/src/main/java/com/chinaunicom/mall/ebtp/extend/bizshortmessageemail/service/impl/BizReadingServiceImpl.java index a8f2fba..e61582d 100644 --- a/src/main/java/com/chinaunicom/mall/ebtp/extend/bizshortmessageemail/service/impl/BizReadingServiceImpl.java +++ b/src/main/java/com/chinaunicom/mall/ebtp/extend/bizshortmessageemail/service/impl/BizReadingServiceImpl.java @@ -6,6 +6,7 @@ import com.chinaunicom.mall.ebtp.extend.bizshortmessageemail.client.Notification import com.chinaunicom.mall.ebtp.extend.bizshortmessageemail.entity.NoticeReadingPO; import com.chinaunicom.mall.ebtp.extend.bizshortmessageemail.entity.NoticeReadingUpdateRequestBody; import com.chinaunicom.mall.ebtp.extend.bizshortmessageemail.service.BizReadingService; +import com.chinaunicom.mall.ebtp.extend.funcswitch.dao.BizFuncSwitchConfigMapper; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang.StringUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -25,9 +26,15 @@ public class BizReadingServiceImpl implements BizReadingService { private NotificationFeignClient notificationFeignClient; @Autowired private IBaseCacheUserService cacheUserService; + @Autowired + private BizFuncSwitchConfigMapper funcSwitchConfigMapper; @Override public BaseResponse sendReading(NoticeReadingPO noticeReadingPO) { + String active =funcSwitchConfigMapper.getValueByKey("sendReading"); + if(StringUtils.isBlank(active) || !active.contains(noticeReadingPO.getFunctionFlag())){ + return BaseResponse.fail("字典中未配置此功能"); + } noticeReadingPO.setSendCenter("ebtp"); noticeReadingPO.setSendModule("biz-service-ebtp-extend"); if(StringUtils.isBlank(noticeReadingPO.getOperatorType())){ diff --git a/src/main/java/com/chinaunicom/mall/ebtp/extend/funcswitch/dao/BizFuncSwitchConfigMapper.java b/src/main/java/com/chinaunicom/mall/ebtp/extend/funcswitch/dao/BizFuncSwitchConfigMapper.java index be26038..a09a7ce 100644 --- a/src/main/java/com/chinaunicom/mall/ebtp/extend/funcswitch/dao/BizFuncSwitchConfigMapper.java +++ b/src/main/java/com/chinaunicom/mall/ebtp/extend/funcswitch/dao/BizFuncSwitchConfigMapper.java @@ -3,10 +3,13 @@ package com.chinaunicom.mall.ebtp.extend.funcswitch.dao; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.chinaunicom.mall.ebtp.extend.funcswitch.entity.BizFuncSwitchConfig; +import org.apache.ibatis.annotations.Param; import org.springframework.stereotype.Repository; @Repository public interface BizFuncSwitchConfigMapper extends BaseMapper { Integer selectByType(String type); + + String getValueByKey(@Param("key")String key); } diff --git a/src/main/java/com/chinaunicom/mall/ebtp/extend/funcswitch/dao/mapper/BizFuncSwitchConfigMapper.xml b/src/main/java/com/chinaunicom/mall/ebtp/extend/funcswitch/dao/mapper/BizFuncSwitchConfigMapper.xml index 6d745e8..8d899ed 100644 --- a/src/main/java/com/chinaunicom/mall/ebtp/extend/funcswitch/dao/mapper/BizFuncSwitchConfigMapper.xml +++ b/src/main/java/com/chinaunicom/mall/ebtp/extend/funcswitch/dao/mapper/BizFuncSwitchConfigMapper.xml @@ -13,4 +13,9 @@ resultType="java.lang.Integer"> SELECT active FROM biz_func_switch_config WHERE `type` = #{type} + \ No newline at end of file