Merge branch 'master-云门户待阅' into 'uat_code'

Master 云门户待阅

See merge request eshop/biz_service_ebtp_extend!10
This commit is contained in:
jlyanss
2023-04-19 06:42:54 +00:00
9 changed files with 65 additions and 16 deletions

View File

@ -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")

View File

@ -32,7 +32,7 @@ public class NotificationFeignFallbackFactory implements FallbackFactory<Notific
}
@Override
public BaseResponse sendPending(@Valid NoticeReadingPO noticeReadingPO) {
public BaseResponse sendReading(@Valid NoticeReadingPO noticeReadingPO) {
return BaseResponse.fail("云门户-新增待阅失败:" + ExceptionUtil.stacktraceToString(throwable), noticeReadingPO);
}

View File

@ -8,16 +8,13 @@ import com.chinaunicom.mall.ebtp.extend.bizshortmessageemail.service.BizReadingS
import com.chinaunicom.mall.ebtp.extend.bizshortmessageemail.service.BizSendMsgTemplateService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
@RestController
@Api(tags = "待阅")
@RequestMapping("/v1/send/reading")
@RequestMapping("/v1/reading")
public class BizReadingController {
@Resource
@ -25,13 +22,19 @@ public class BizReadingController {
@ApiOperation("发送待阅")
@PostMapping("save")
public BaseResponse sendPending(@RequestBody NoticeReadingPO noticeReadingPO) {
return BaseResponse.success(readingService.sendPending(noticeReadingPO));
public BaseResponse sendReading(@RequestBody NoticeReadingPO noticeReadingPO) {
return readingService.sendReading(noticeReadingPO);
}
@ApiOperation("待阅更新或删除-readingStatus:0:待阅 1:已阅 d:待阅删除")
@PostMapping("update")
public BaseResponse updateReading(@RequestBody NoticeReadingUpdateRequestBody noticeReadingUpdateRequestBody) {
return BaseResponse.success(readingService.updateReading(noticeReadingUpdateRequestBody));
return readingService.updateReading(noticeReadingUpdateRequestBody);
}
@ApiOperation("待阅更新1:已阅")
@PostMapping("updateReaded")
public BaseResponse updateReaded(@RequestParam String readingCode) {
return readingService.updateReaded(readingCode);
}
}

View File

@ -201,4 +201,7 @@ public class NoticeReadingPO implements Serializable {
@ApiModelProperty("最后一次更新时间")
private LocalDateTime lastUpdateTime;
@ApiModelProperty("功能标识:字典中包含才发送,所以要在字典中配置")
private String functionFlag;
}

View File

@ -2,10 +2,15 @@ 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("待阅信息的编号")

View File

@ -15,7 +15,9 @@ import java.io.IOException;
@Component
public interface BizReadingService {
BaseResponse sendPending(NoticeReadingPO noticeReadingPO);
BaseResponse sendReading(NoticeReadingPO noticeReadingPO);
BaseResponse updateReading(NoticeReadingUpdateRequestBody noticeReadingUpdateRequestBody);
BaseResponse updateReaded(String readingCode);
}

View File

@ -6,12 +6,14 @@ 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;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Date;
/**
* @author yanss
@ -24,10 +26,15 @@ public class BizReadingServiceImpl implements BizReadingService {
private NotificationFeignClient notificationFeignClient;
@Autowired
private IBaseCacheUserService cacheUserService;
@Autowired
private BizFuncSwitchConfigMapper funcSwitchConfigMapper;
@Override
public BaseResponse sendPending(NoticeReadingPO noticeReadingPO) {
// noticeReadingPO.setSendCenter("na134");
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())){
@ -37,11 +44,32 @@ public class BizReadingServiceImpl implements BizReadingService {
noticeReadingPO.setReadingSourceUserId(cacheUserService.getCacheUser().getUserId());
noticeReadingPO.setReadingSourceUserCn(cacheUserService.getCacheUser().getFullName());
}
return notificationFeignClient.sendPending(noticeReadingPO);
BaseResponse baseResponse=notificationFeignClient.sendReading(noticeReadingPO);
if(baseResponse.isSuccess() && baseResponse.getCode()==1){
BaseResponse.success(baseResponse.getMessage(),null);
}
return baseResponse;
}
@Override
public BaseResponse updateReading(NoticeReadingUpdateRequestBody noticeReadingUpdateRequestBody) {
return notificationFeignClient.updateReading(noticeReadingUpdateRequestBody);
BaseResponse baseResponse=notificationFeignClient.updateReading(noticeReadingUpdateRequestBody);
if(baseResponse.isSuccess() && baseResponse.getCode()==1){
BaseResponse.success(baseResponse.getMessage(),null);
}
return baseResponse;
}
@Override
public BaseResponse updateReaded(String readingCode) {
NoticeReadingUpdateRequestBody noticeReadingUpdateRequestBody=new NoticeReadingUpdateRequestBody();
noticeReadingUpdateRequestBody.setReadingCode(readingCode);
noticeReadingUpdateRequestBody.setReadingStatus("1");
noticeReadingUpdateRequestBody.setReadingType("1");
BaseResponse baseResponse=notificationFeignClient.updateReading(noticeReadingUpdateRequestBody);
if(baseResponse.isSuccess() && baseResponse.getCode()==1){
BaseResponse.success(baseResponse.getMessage(),null);
}
return baseResponse;
}
}

View File

@ -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<BizFuncSwitchConfig> {
Integer selectByType(String type);
String getValueByKey(@Param("key")String key);
}

View File

@ -13,4 +13,9 @@
resultType="java.lang.Integer">
SELECT active FROM biz_func_switch_config WHERE `type` = #{type}
</select>
<select id="getValueByKey" resultType="java.lang.String" >
select
value
from biz_extend_dict where `key`=#{key }
</select>
</mapper>