Browse Source

# 消息推送接口修改

zhongwei
haungxing 2 years ago
parent
commit
95571d461d
  1. 3
      hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/dto/MessagePushRecordDto.java
  2. 3
      hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/entity/MessagePushRecordEntity.java
  3. 4
      hzims-service/inspect/src/main/resources/db/1.0.0.sql
  4. 5
      hzims-service/message/src/main/java/com/hnac/hzims/message/fegin/MessageClient.java
  5. 2
      hzims-service/message/src/main/resources/db/1.0.0.sql
  6. 4
      hzims-service/message/src/main/resources/db/1.0.1.sql

3
hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/dto/MessagePushRecordDto.java

@ -22,4 +22,7 @@ public class MessagePushRecordDto extends MessagePushRecordEntity implements Ser
@NotNull
private List<String> types;
@ApiModelProperty("创建人")
private Long createUser;
}

3
hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/entity/MessagePushRecordEntity.java

@ -68,6 +68,9 @@ public class MessagePushRecordEntity extends MessageTemplateEntity {
@ApiModelProperty(value = "内容")
private String content;
@ApiModelProperty("阿里云短信模板参数")
private String smsParam;
@ApiModelProperty(value = "计划推送时间")
@JsonFormat(pattern = DateUtil.PATTERN_DATETIME)
@DateTimeFormat(pattern = DateUtil.PATTERN_DATETIME)

4
hzims-service/inspect/src/main/resources/db/1.0.0.sql

@ -0,0 +1,4 @@
-- 巡检计划添加消息模板字段
alter table `hz_st_re_plan` add column `message_template_id` bigint(20) comment '消息模板ID';
-- 巡检任务添加消息模板字段
alter table `hz_st_ex_task` add column `message_template_id` bigint(20) comment '消息模板ID';

5
hzims-service/message/src/main/java/com/hnac/hzims/message/fegin/MessageClient.java

@ -18,6 +18,7 @@ import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.core.tool.utils.Func;
@ -58,6 +59,10 @@ public class MessageClient extends BladeController implements IMessageClient{
request.getTypes().forEach(type -> {
MessagePushRecordEntity entity = BeanUtil.copy(request,MessagePushRecordEntity.class);
entity.setType(type);
if(Func.isEmpty(AuthUtil.getUserId())) {
entity.setCreateUser(request.getCreateUser());
entity.setCreateDept(request.getCreateDept());
}
entity.setMessageId(messageId);
recordService.saveAndSend(entity);
});

2
hzims-service/message/src/main/resources/db/1.0.0.sql

@ -25,7 +25,7 @@ SET FOREIGN_KEY_CHECKS = 1;
CREATE TABLE IF NOT EXISTS `hzims_message_push_record` (
`ID` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键ID',
`TASK_ID` bigint(20) NOT NULL COMMENT '消息类型',
`TEMPLATE_ID` bigint(20) NOT NULL COMMENT '消息模板ID',
`TEMPLATE_ID` bigint(20) COMMENT '消息模板ID',
`PUSHER` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '推送人',
`PUSHER_NAME` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '推送人名称',
`CONTENT` varchar(1000) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '内容',

4
hzims-service/message/src/main/resources/db/1.0.1.sql

@ -1,4 +1,6 @@
-- 添加消息ID
alter table hzims_message_push_record add COLUMN `MESSAGE_ID` bigint(20) DEFAULT NULL comment '消息ID';
-- 添加消息推送类型
alter table hzims_message_push_record add COLUMN `PUSH_TYPE` VARCHAR(2) DEFAULT NULL comment '推送类型,0:即时推送,1:计划推送';
alter table hzims_message_push_record add COLUMN `PUSH_TYPE` VARCHAR(2) DEFAULT NULL comment '推送类型,0:即时推送,1:计划推送';
-- 添加短信推送参数
alter table `hzims_message_push_record` add COLUMN `SMS_PARAM` VARCHAR(255) COMMENT '阿里云短信模板参数';

Loading…
Cancel
Save