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 1/2] =?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 2/2] =?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