Merge remote-tracking branch 'origin/master-云门户待阅'

# Conflicts:
#	src/main/java/com/chinaunicom/mall/ebtp/extend/funcswitch/dao/BizFuncSwitchConfigMapper.java
#	src/main/java/com/chinaunicom/mall/ebtp/extend/funcswitch/dao/mapper/BizFuncSwitchConfigMapper.xml
This commit is contained in:
yss
2023-05-12 14:09:54 +08:00
9 changed files with 431 additions and 0 deletions

View File

@ -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 sendReading(@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);
}

View File

@ -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<NotificationFeignClient> {
@ -26,6 +30,16 @@ public class NotificationFeignFallbackFactory implements FallbackFactory<Notific
log.error(eshopMailPendingPO.toString());
return new BaseResponse();
}
@Override
public BaseResponse sendReading(@Valid NoticeReadingPO noticeReadingPO) {
return BaseResponse.fail("云门户-新增待阅失败:" + ExceptionUtil.stacktraceToString(throwable), noticeReadingPO);
}
@Override
public BaseResponse updateReading(@Valid NoticeReadingUpdateRequestBody noticeReadingUpdateRequestBody) {
return BaseResponse.fail("云门户-待阅更新或删除失败:" + ExceptionUtil.stacktraceToString(throwable), noticeReadingUpdateRequestBody);
}
};
log.error(ExceptionUtil.stacktraceToString(throwable));
return back;

View File

@ -0,0 +1,40 @@
package com.chinaunicom.mall.ebtp.extend.bizshortmessageemail.controller;
import com.chinaunicom.mall.ebtp.common.base.entity.BaseResponse;
import com.chinaunicom.mall.ebtp.extend.bizshortmessageemail.entity.BizSendMsgInfoVO;
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.bizshortmessageemail.service.BizSendMsgTemplateService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
@RestController
@Api(tags = "待阅")
@RequestMapping("/v1/reading")
public class BizReadingController {
@Resource
private BizReadingService readingService;
@ApiOperation("发送待阅")
@PostMapping("save")
public BaseResponse sendReading(@RequestBody NoticeReadingPO noticeReadingPO) {
return readingService.sendReading(noticeReadingPO);
}
@ApiOperation("待阅更新或删除-readingStatus:0:待阅 1:已阅 d:待阅删除")
@PostMapping("update")
public BaseResponse updateReading(@RequestBody NoticeReadingUpdateRequestBody noticeReadingUpdateRequestBody) {
return readingService.updateReading(noticeReadingUpdateRequestBody);
}
@ApiOperation("待阅更新1:已阅")
@PostMapping("updateReaded")
public BaseResponse updateReaded(@RequestParam String readingCode) {
return readingService.updateReaded(readingCode);
}
}

View File

@ -0,0 +1,207 @@
package com.chinaunicom.mall.ebtp.extend.bizshortmessageemail.entity;
import io.swagger.annotations.ApiModel;
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;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.time.LocalDateTime;
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value = "EshopBpmReading对象",description = "待阅表信息实体")
public class NoticeReadingPO implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty("主键")
private String id;
@ApiModelProperty("发送中心标识")
@NotBlank(message = "发送中心标识不能为空")
@Length(message = "发送中心标识不能超过{max}个字符",max = 36)
private String sendCenter;
@ApiModelProperty("发送业务模块标识")
@NotBlank(message = "发送业务模块标识不能为空")
@Length(message = "发送业务模块标识不能超过{max}个字符",max = 36)
private String sendModule;
@ApiModelProperty("待阅信息的编号")
@NotBlank(message = "待阅信息的编号不能为空")
@Length(message = "待阅信息的编号不能超过{max}个字符",max = 100)
private String readingCode;
@ApiModelProperty("待阅标题")
@NotBlank(message = "待阅标题不能为空")
@Length(message = "待阅标题不能超过{max}个字符",max = 500)
private String readingTitle;
@ApiModelProperty("待阅产生时间")
private String readingDate;
@ApiModelProperty("待阅人用户标识,门户待办为邮箱前缀;非门户待办为用户账号")
@NotBlank(message = "待阅人用户标识不能为空")
@Length(message = "待阅人用户标识不能超过{max}个字符",max = 128)
private String readingUserId;
@ApiModelProperty("待阅人名")
@NotBlank(message = "待阅人名不能为空")
@Length(message = "待阅人名不能超过{max}个字符",max = 50)
private String readingUserCn;
@ApiModelProperty("待阅信息URL")
@NotBlank(message = "待阅信息URL不能为空")
@Length(message = "待阅信息URL不能超过{max}个字符",max = 4000)
private String readingUrl;
@ApiModelProperty("待阅状态 0:待阅 1:以阅")
@NotBlank(message = "待阅状态不能为空")
@Length(message = "待阅状态不能超过{max}个字符",max = 1)
private String readingStatus;
@ApiModelProperty("待阅等级 0.普通1.重要2加急")
@NotNull(message = "待阅等级不能为空")
private Integer readingLevel;
@ApiModelProperty("省分代码")
@Length(message = "省分代码不能超过{max}个字符",max = 10)
private String readingCityCode;
@ApiModelProperty("待阅类型 1:门户待阅 2门户流程待阅 3:商城待阅")
@NotBlank(message = "待阅类型不能为空")
@Length(message = "待阅类型不能超过{max}个字符",max = 1)
private String readingType;
@ApiModelProperty("待阅信息上一步处理人邮件前缀 上一步处理人的帐号,若为发起待办则填发起人的账号")
@NotBlank(message = "上一步处理人的帐号不能为空")
@Length(message = "上一步处理人的帐号不能超过{max}个字符",max = 128)
private String readingSourceUserId;
@ApiModelProperty("上一步处理人的姓名")
@NotBlank(message = "上一步处理人的姓名不能为空")
@Length(message = "上一步处理人的姓名不能超过{max}个字符",max = 50)
private String readingSourceUserCn;
@ApiModelProperty("a:新增待阅 u:更新待阅 t:更新待阅标题 d:删除待阅")
@NotBlank(message = "操作类型不能为空")
@Length(message = "操作类型不能超过{max}个字符",max = 1)
private String operatorType;
@ApiModelProperty("省ou")
@Length(message = "省ou不能超过{max}个字符",max = 20)
private String provinceOu;
@ApiModelProperty("省ou名")
@Length(message = "省ou名不能超过{max}个字符",max = 100)
private String provinceOuName;
@ApiModelProperty("市ou")
@Length(message = "市ou不能超过{max}个字符",max = 20)
private String cityOu;
@ApiModelProperty("市ou名")
@Length(message = "市ou名不能超过{max}个字符",max = 100)
private String cityOuName;
@ApiModelProperty("待办所属系统简称")
private String readingNote;
@ApiModelProperty("待阅接口入参信息")
private String inputMessage;
@ApiModelProperty("待阅接口返回结果")
private String returnResult;
@ApiModelProperty("创建人uid")
private String createBy;
@ApiModelProperty("更新人uid")
private String updateBy;
@ApiModelProperty("表插入生成时间")
private LocalDateTime createDate;
@ApiModelProperty("待办生成时间")
private LocalDateTime launchDate;
@ApiModelProperty("更新时间")
private LocalDateTime updateDate;
@ApiModelProperty("租户标识")
private String tenantId;
@ApiModelProperty("逻辑删除normal表示正常默认deleted表示删除")
private String deleteFlag;
@ApiModelProperty("乐观锁")
private Integer versions;
@ApiModelProperty("云门户预留字段")
private String dbReserved1;
@ApiModelProperty("云门户预留字段")
private String dbReserved2;
@ApiModelProperty("云门户预留字段")
private String dbReserved3;
@ApiModelProperty("云门户预留字段")
private String dbReserved4;
@ApiModelProperty("云门户预留字段")
private String dbReserved5;
@ApiModelProperty("云门户预留字段")
private String dbReserved6;
@ApiModelProperty("云门户预留字段")
private String dbReserved7;
@ApiModelProperty("云门户预留字段")
private String dbReserved8;
@ApiModelProperty("云门户预留字段")
private String dbReserved9;
@ApiModelProperty("云门户预留字段")
private String dbReserved10;
@ApiModelProperty("云门户预留字段")
private String dbReserved11;
@ApiModelProperty("云门户预留字段")
private String dbReserved12;
@ApiModelProperty("云门户预留字段")
private String dbReserved13;
@ApiModelProperty("云门户预留字段")
private String dbReserved14;
@ApiModelProperty("云门户预留字段")
private String dbReserved15;
@ApiModelProperty("最后一次更新时间")
private LocalDateTime lastUpdateTime;
@ApiModelProperty("功能标识:字典中包含才发送,所以要在字典中配置")
private String functionFlag;
}

View File

@ -0,0 +1,47 @@
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)
private String readingCode;
@ApiModelProperty("待阅状态 0:待阅 1:已阅 d:待阅删除")
@NotBlank(message = "待阅状态不能为空")
@Length(message = "待阅状态不能超过{max}个字符",max = 1)
private String readingStatus;
@ApiModelProperty("待阅状态更新时间")
@Length(message = "待阅更新时间不能超过{max}个字符",max = 20)
private String lastUpdateDate;
@ApiModelProperty("待办类型1 门户待阅 2 门户流程待办 3 商城待阅")
@NotBlank(message = "待阅类型不能为空")
@Length(message = "待阅类型不能超过{max}个字符",max = 1)
private String readingType;
@ApiModelProperty("待阅产生时间")
private String readingDate;
@ApiModelProperty("待阅接口入参信息")
private String inputMessage;
@ApiModelProperty("待阅接口返回结果:100为成功")
private String returnCode;
@ApiModelProperty("待阅接口返回信息")
private String returnMessage;
}

View File

@ -0,0 +1,23 @@
package com.chinaunicom.mall.ebtp.extend.bizshortmessageemail.service;
import com.chinaunicom.mall.ebtp.common.base.entity.BaseResponse;
import com.chinaunicom.mall.ebtp.extend.bizshortmessageemail.entity.BizSendEmailVO;
import com.chinaunicom.mall.ebtp.extend.bizshortmessageemail.entity.BizSendMsgVO;
import com.chinaunicom.mall.ebtp.extend.bizshortmessageemail.entity.NoticeReadingPO;
import com.chinaunicom.mall.ebtp.extend.bizshortmessageemail.entity.NoticeReadingUpdateRequestBody;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestBody;
import javax.validation.Valid;
import java.io.IOException;
@Component
public interface BizReadingService {
BaseResponse sendReading(NoticeReadingPO noticeReadingPO);
BaseResponse updateReading(NoticeReadingUpdateRequestBody noticeReadingUpdateRequestBody);
BaseResponse updateReaded(String readingCode);
}

View File

@ -0,0 +1,75 @@
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 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
*/
@Service
@Slf4j
public class BizReadingServiceImpl implements BizReadingService {
@Resource
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())){
noticeReadingPO.setOperatorType("a");
}
if(StringUtils.isBlank(noticeReadingPO.getReadingSourceUserId())){
noticeReadingPO.setReadingSourceUserId(cacheUserService.getCacheUser().getUserId());
noticeReadingPO.setReadingSourceUserCn(cacheUserService.getCacheUser().getFullName());
}
BaseResponse baseResponse=notificationFeignClient.sendReading(noticeReadingPO);
if(baseResponse.isSuccess() && baseResponse.getCode()==1){
BaseResponse.success(baseResponse.getMessage(),null);
}
return baseResponse;
}
@Override
public BaseResponse updateReading(NoticeReadingUpdateRequestBody 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,6 +3,7 @@ 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
@ -17,4 +18,6 @@ public interface BizFuncSwitchConfigMapper extends BaseMapper<BizFuncSwitchConfi
* @return
*/
String selectByUser(String role,String account);
String getValueByKey(@Param("key")String key);
}

View File

@ -17,4 +17,9 @@
resultType="java.lang.String">
SELECT account FROM maint_base_user WHERE `role` = #{role} and account=#{account}
</select>
<select id="getValueByKey" resultType="java.lang.String" >
select
value
from biz_extend_dict where `key`=#{key }
</select>
</mapper>