diff --git a/hzims-service-api/inspect-api/pom.xml b/hzims-service-api/inspect-api/pom.xml
index a39874a..992ed93 100644
--- a/hzims-service-api/inspect-api/pom.xml
+++ b/hzims-service-api/inspect-api/pom.xml
@@ -3,9 +3,9 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- BladeX
- org.springblade
- 2.7.6.RELEASE
+ hzims-service-api
+ com.hnac.hzims
+ 4.0.0-SNAPSHOT
4.0.0
@@ -15,19 +15,17 @@
- 2.7.6.RELEASE
+
org.springblade
blade-starter-mybatis
- ${bladex.project.version}
org.springblade
blade-starter-tenant
- ${bladex.project.version}
org.springframework.cloud
diff --git a/hzims-service-api/message-api/pom.xml b/hzims-service-api/message-api/pom.xml
index 0be6322..c09c119 100644
--- a/hzims-service-api/message-api/pom.xml
+++ b/hzims-service-api/message-api/pom.xml
@@ -16,9 +16,9 @@
org.springblade
blade-resource-api
-
- com.hnac.hzims
- hzims-biz-common
-
+
+
+
+
diff --git a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/entity/MessagePushRecordEntity.java b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/entity/MessagePushRecordEntity.java
new file mode 100644
index 0000000..9d871bd
--- /dev/null
+++ b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/entity/MessagePushRecordEntity.java
@@ -0,0 +1,69 @@
+package com.hnac.hzims.message.entity;
+
+import com.alibaba.fastjson.annotation.JSONField;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.hnac.hzims.message.entity.config.MessageTemplateEntity;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import org.springblade.core.mp.support.QueryField;
+import org.springblade.core.mp.support.SqlCondition;
+import org.springblade.core.tool.utils.DateUtil;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import java.time.LocalDateTime;
+
+@Data
+@ApiModel(value = "消息推送记录",description = "消息推送记录")
+@TableName("hzims_message_push_record")
+@EqualsAndHashCode
+public class MessagePushRecordEntity extends MessageTemplateEntity {
+
+ @ApiModelProperty("业务任务ID")
+ @QueryField(condition = SqlCondition.EQUAL)
+ private Long taskId;
+
+ @ApiModelProperty("消息模板ID")
+ @QueryField(condition = SqlCondition.EQUAL)
+ private Long templateId;
+
+ @ApiModelProperty("资源编码")
+ @QueryField(condition = SqlCondition.EQUAL)
+ private String resourceCode;
+
+ @ApiModelProperty(value = "推送人")
+ @QueryField(condition = SqlCondition.LIKE)
+ private String pusher;
+
+ @ApiModelProperty(value = "推送账号:手机号,邮箱")
+ private String account;
+
+ @ApiModelProperty(value = "推送人名称")
+ @QueryField(condition = SqlCondition.LIKE)
+ private String pusherName;
+
+ @ApiModelProperty(value = "内容")
+ private String content;
+
+ @ApiModelProperty(value = "计划推送时间")
+ @JsonFormat(pattern = DateUtil.PATTERN_DATETIME)
+ @DateTimeFormat(pattern = DateUtil.PATTERN_DATETIME)
+ private LocalDateTime planTime;
+
+ @ApiModelProperty(value = "实际推送时间")
+ @JsonFormat(pattern = DateUtil.PATTERN_DATETIME)
+ @DateTimeFormat(pattern = DateUtil.PATTERN_DATETIME)
+ private LocalDateTime pushTime;
+
+ @ApiModelProperty(value = "响应时间")
+ @JsonFormat(pattern = DateUtil.PATTERN_DATETIME)
+ @DateTimeFormat(pattern = DateUtil.PATTERN_DATETIME)
+ private LocalDateTime respondTime;
+
+ @ApiModelProperty(value = "响应说明")
+ private String respondRemark;
+
+}
diff --git a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/entity/config/ConfigEntity.java b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/entity/config/ConfigEntity.java
index 9126282..711abd5 100644
--- a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/entity/config/ConfigEntity.java
+++ b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/entity/config/ConfigEntity.java
@@ -1,6 +1,5 @@
package com.hnac.hzims.message.entity.config;
-import com.hnac.hzims.common.invalid.DictInvalid;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@@ -25,7 +24,6 @@ public class ConfigEntity extends TenantEntity implements Serializable {
@ApiModelProperty(value = "业务分类。系统通知:system,事务消息:business,日常提醒:dailyRemind,巡检消息:inspect",required = true)
@NotNull(message = "业务分类不能为空")
- @DictInvalid(dictKey = "businessClassify")
@QueryField(condition = SqlCondition.EQUAL)
private String businessClassify;
diff --git a/hzims-service-api/pom.xml b/hzims-service-api/pom.xml
index 8f51cac..46e8f12 100644
--- a/hzims-service-api/pom.xml
+++ b/hzims-service-api/pom.xml
@@ -21,7 +21,7 @@
equipment-api
safeproduct-api
hzims-operational-api
-
+ inspect-api
message-api
ticket-api
weather-api
@@ -32,6 +32,12 @@
org.springblade
blade-starter-mybatis
+
+
+ lettuce-core
+ io.lettuce
+
+
org.springblade
diff --git a/hzims-service/equipment/pom.xml b/hzims-service/equipment/pom.xml
index 24ad6ad..4df5b8e 100644
--- a/hzims-service/equipment/pom.xml
+++ b/hzims-service/equipment/pom.xml
@@ -24,11 +24,11 @@
org.springblade
blade-starter-oss-all
-
- com.hnac.hzims
- spare-api
- ${hzims.project.version}
-
+
+
+
+
+
com.baomidou
dynamic-datasource-spring-boot-starter
@@ -94,7 +94,10 @@
hzims-operational-api
compile
-
+
+ org.apache.commons
+ commons-collections4
+
diff --git a/hzims-service/inspect/pom.xml b/hzims-service/inspect/pom.xml
index 7376582..3e4bef2 100644
--- a/hzims-service/inspect/pom.xml
+++ b/hzims-service/inspect/pom.xml
@@ -4,19 +4,18 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- BladeX
- org.springblade
- 2.7.6.RELEASE
+ hzims-service
+ com.hnac.hzims
+ 4.0.0-SNAPSHOT
4.0.0
-
com.hnac.hzinfo.inspect
hzinfo-inspect
jar
- 2.7.6.RELEASE
+
4.5.6.RELEASE
4.0.0-SNAPSHOT
1.4.13
@@ -112,7 +111,7 @@
com.hnac.hzinfo
inspect-api
- ${bladex.project.version}
+ ${hzims.project.version}
com.hikvision.ga
diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/config/MessageFactory.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/config/MessageFactory.java
new file mode 100644
index 0000000..898685e
--- /dev/null
+++ b/hzims-service/message/src/main/java/com/hnac/hzims/message/config/MessageFactory.java
@@ -0,0 +1,34 @@
+package com.hnac.hzims.message.config;
+
+import com.hnac.hzims.message.MessageConstants;
+import com.hnac.hzims.message.service.IMessageService;
+import org.springblade.core.tool.utils.SpringUtil;
+
+
+public class MessageFactory {
+
+ /** @Author hx
+ * @Description 获取方法类型
+ * @Date 2023/4/4 14:22
+ * @Param [messageType] 消息类型
+ * @return com.hnac.hzims.message.service.IMessageService
+ **/
+ public static IMessageService getMessageSend(String messageType) {
+ if(MessageConstants.APP_PUSH.equals(messageType)) {
+ return SpringUtil.getBean("pushMessageService");
+ }
+ else if(MessageConstants.SMS_PUSH.equals(messageType)) {
+ return SpringUtil.getBean("smsMessageService");
+ }
+ else if(MessageConstants.MAIL_PUSH.equals(messageType)) {
+ return SpringUtil.getBean("mailMessageService");
+ }
+ else if(MessageConstants.WS_PUSH.equals(messageType)) {
+ return SpringUtil.getBean("websocketService");
+ }
+ else {
+ return null;
+ }
+ }
+
+}
diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/controller/MessagePushRecordController.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/controller/MessagePushRecordController.java
new file mode 100644
index 0000000..ff38d71
--- /dev/null
+++ b/hzims-service/message/src/main/java/com/hnac/hzims/message/controller/MessagePushRecordController.java
@@ -0,0 +1,60 @@
+package com.hnac.hzims.message.controller;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
+import com.hnac.hzims.message.entity.MessagePushRecordEntity;
+import com.hnac.hzims.message.service.IMessagePushRecordService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import lombok.AllArgsConstructor;
+import org.springblade.core.boot.ctrl.BladeController;
+import org.springblade.core.mp.support.Query;
+import org.springblade.core.tool.api.R;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+@RestController
+@RequestMapping("/message/record")
+@Api(value = "消息推送记录",tags = "消息推送记录")
+@AllArgsConstructor
+public class MessagePushRecordController extends BladeController {
+
+ private final IMessagePushRecordService messagePushRecordService;
+
+ @PostMapping("/save")
+ @ApiOperation("保存消息推送")
+ @ApiOperationSupport(order = 1)
+ public R save(@RequestBody MessagePushRecordEntity request) {
+ return R.status(messagePushRecordService.save(request));
+ }
+
+ @PostMapping("/update")
+ @ApiOperation("更新消息推送记录")
+ @ApiOperationSupport(order = 2)
+ public R update(@RequestBody MessagePushRecordEntity request) {
+ return R.status(messagePushRecordService.updateById(request));
+ }
+
+ @GetMapping("/list")
+ @ApiOperation("查询消息推送记录列表")
+ @ApiOperationSupport(order = 3)
+ public R> list(MessagePushRecordEntity request) {
+ return R.data(messagePushRecordService.list(request));
+ }
+
+ @GetMapping("/listPage")
+ @ApiOperation("分页查询消息推送记录列表")
+ @ApiOperationSupport(order = 4)
+ public R> listPage(MessagePushRecordEntity request, Query query) {
+ return R.data(messagePushRecordService.listPage(request,query));
+ }
+
+ @GetMapping("/send/{id}")
+ @ApiOperation("推送消息记录")
+ @ApiOperationSupport(order = 4)
+ public R send(@PathVariable @ApiParam("消息记录ID") String id) {
+ return R.data(messagePushRecordService.send(id));
+ }
+}
diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/controller/MessageTemplateController.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/controller/MessageTemplateController.java
new file mode 100644
index 0000000..9e22aad
--- /dev/null
+++ b/hzims-service/message/src/main/java/com/hnac/hzims/message/controller/MessageTemplateController.java
@@ -0,0 +1,66 @@
+package com.hnac.hzims.message.controller;
+
+import com.aliyun.oss.ServiceException;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
+import com.hnac.hzims.message.entity.config.MessageTemplateEntity;
+import com.hnac.hzims.message.service.IMessageTemplateService;
+import groovy.util.logging.Slf4j;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.AllArgsConstructor;
+import org.springblade.core.boot.ctrl.BladeController;
+import org.springblade.core.mp.support.Query;
+import org.springblade.core.tool.api.R;
+import org.springblade.core.tool.utils.Func;
+import org.springframework.util.Assert;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+@RestController
+@AllArgsConstructor
+@RequestMapping("/message/template")
+@Api(value = "消息模板管理",tags = "消息模板管理")
+public class MessageTemplateController extends BladeController {
+
+ private final IMessageTemplateService messageTemplateService;
+
+ @PostMapping("/save")
+ @ApiOperation("保存消息模板")
+ @ApiOperationSupport(order = 1)
+ public R save(@RequestBody MessageTemplateEntity request) {
+ return R.status(messageTemplateService.save(request));
+ }
+
+ @GetMapping("/list")
+ @ApiOperation("查询列表")
+ @ApiOperationSupport(order = 2)
+ public R> list(MessageTemplateEntity request) {
+ return R.data(messageTemplateService.list(request));
+ }
+
+ @GetMapping("/listPage")
+ @ApiOperation("分页查询")
+ @ApiOperationSupport(order = 3)
+ public R> listPage(MessageTemplateEntity request, Query query) {
+ return R.data(messageTemplateService.listPage(request,query));
+ }
+
+ @DeleteMapping("/delete/{ids}")
+ @ApiOperation("删除消息模板")
+ @ApiOperationSupport(order = 4)
+ public R delete(@PathVariable String ids) {
+ return R.status(messageTemplateService.deleteLogic(Func.toLongList(",",ids)));
+ }
+
+ @PutMapping("/update")
+ @ApiOperation("修改消息模板")
+ @ApiOperationSupport(order = 5)
+ public R update(@RequestBody MessageTemplateEntity request) {
+ Assert.isTrue(Func.isNotEmpty(request.getId()),() -> {
+ throw new ServiceException("消息模板编辑时传入ID不能为空");
+ });
+ return R.status(messageTemplateService.updateById(request));
+ }
+}
diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/mapper/MessagePushRecordMapper.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/mapper/MessagePushRecordMapper.java
new file mode 100644
index 0000000..37b4698
--- /dev/null
+++ b/hzims-service/message/src/main/java/com/hnac/hzims/message/mapper/MessagePushRecordMapper.java
@@ -0,0 +1,8 @@
+package com.hnac.hzims.message.mapper;
+
+import com.hnac.hzims.message.entity.MessagePushRecordEntity;
+import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper;
+
+public interface MessagePushRecordMapper extends UserDataScopeBaseMapper {
+
+}
diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/mapper/MessageTemplateMapper.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/mapper/MessageTemplateMapper.java
new file mode 100644
index 0000000..edd01b0
--- /dev/null
+++ b/hzims-service/message/src/main/java/com/hnac/hzims/message/mapper/MessageTemplateMapper.java
@@ -0,0 +1,8 @@
+package com.hnac.hzims.message.mapper;
+
+import com.hnac.hzims.message.entity.config.MessageTemplateEntity;
+import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper;
+
+public interface MessageTemplateMapper extends UserDataScopeBaseMapper {
+
+}
diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/schedule/MessagePushSchedule.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/schedule/MessagePushSchedule.java
index a5f0b53..797bec7 100644
--- a/hzims-service/message/src/main/java/com/hnac/hzims/message/schedule/MessagePushSchedule.java
+++ b/hzims-service/message/src/main/java/com/hnac/hzims/message/schedule/MessagePushSchedule.java
@@ -1,135 +1,112 @@
package com.hnac.hzims.message.schedule;
-import cn.hutool.core.map.MapUtil;
import com.alibaba.fastjson.JSON;
-import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.hnac.hzims.common.utils.DateUtil;
-import com.hnac.hzims.message.configure.service.ISmsConfigService;
-import com.hnac.hzims.message.constants.RedisKeyConstants;
-import com.hnac.hzims.message.dto.PushMessageDTO;
-import com.hnac.hzims.message.dto.SmsPushDto;
-import com.hnac.hzims.message.entity.PushMessageEntity;
-import com.hnac.hzims.message.entity.config.SmsConfigEntity;
-import com.hnac.hzims.message.push.service.IPushService;
-import com.hnac.hzims.message.service.IPushMessageService;
+import com.hnac.hzims.message.MessageConstants;
+import com.hnac.hzims.message.config.MessageFactory;
+import com.hnac.hzims.message.entity.MessagePushRecordEntity;
+import com.hnac.hzims.message.entity.config.MessageTemplateEntity;
+import com.hnac.hzims.message.service.IMessagePushRecordService;
+import com.hnac.hzims.message.service.IMessageService;
+import com.hnac.hzims.message.service.IMessageTemplateService;
import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.annotation.XxlJob;
-import com.xxl.job.core.log.XxlJobLogger;
+import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
-import org.springblade.core.tool.api.R;
-import org.springblade.core.tool.utils.BeanUtil;
-import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.Func;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Qualifier;
-import org.springframework.data.redis.core.RedisTemplate;
+import org.springblade.core.tool.utils.ObjectUtil;
import org.springframework.stereotype.Component;
-import javax.validation.constraints.NotNull;
import java.time.LocalDateTime;
-import java.time.ZoneOffset;
-import java.util.*;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
import java.util.stream.Collectors;
-import static com.hnac.hzims.message.constants.XxlJobConstants.*;
+import static com.hnac.hzims.message.constants.XxlJobConstants.PUSH_MESSAGE_BY_NOTICE;
+import static com.hnac.hzims.message.constants.XxlJobConstants.PUSH_SMS_MESSAGE_BY_NOTICE;
/**
- * 消息中心定时推送任务调度
- * @author hx
- */
+ * @ClassName MessagePushSchedule
+ * @description: 消息推送
+ * @author: hx
+ * @create: 2023-04-04 14:31
+ * @Version 4.0
+ **/
@Component
+@AllArgsConstructor
@Slf4j
public class MessagePushSchedule {
- @Autowired
- private ISmsConfigService smsConfigService;
- @Autowired
- private IPushMessageService pushMessageService;
- @Autowired
- @Qualifier("smsPushService")
- private IPushService pushService;
+ private final IMessageTemplateService templateService;
+ private final IMessagePushRecordService recordService;
- public static final String MESSAGE_ID = "messageId";
-
- /**
- * 消息推送根据推送人分时段推送任务调度
- * @param params 暂不支持参数参入执行调度任务
- * @return
- */
- @XxlJob(PUSH_SMS_MESSAGE_BY_NOTICE)
+ @XxlJob(PUSH_MESSAGE_BY_NOTICE)
public ReturnT pushSmsMessageByNotice(String params) {
- List list = smsConfigService.list();
- list.stream().filter(e -> Func.isNotEmpty(e.getDuration()) && Func.isNotEmpty(e.getTimeUnit())).forEach(smsConfigEntity -> {
- //查询出规定时段内的短信数量统一发送
- // 获取配置的时间范围内的消息
- LocalDateTime endTime = DateUtil.plus(LocalDateTime.now(), smsConfigEntity.getDuration(), smsConfigEntity.getTimeUnit());
- PushMessageDTO pushMessageDTO = new PushMessageDTO();
- pushMessageDTO.setStartTime(LocalDateTime.now());
- pushMessageDTO.setEndTime(endTime);
- pushMessageDTO.setBusinessKey(smsConfigEntity.getBusinessKey());
- pushMessageDTO.setIsPush(false);
- List pushMessageList = pushMessageService.list(pushMessageDTO);
- XxlJobLogger.log("开始推送短信,推送条数为:"+pushMessageList.size());
- // 获取推送消息内容体 根据用户拆分出多条短信推送
- List splitSmsList = this.transform(pushMessageList);
- if(CollectionUtil.isEmpty(splitSmsList)) {
- return;
- }
- this.push(splitSmsList,smsConfigEntity);
-
+ // 获取消息模板
+ List templateList = templateService.list();
+ LocalDateTime now = LocalDateTime.now();
+ templateList.forEach(template -> {
+ LocalDateTime endTime = DateUtil.plus(LocalDateTime.now(), template.getConcentratedDuration(), template.getConcentratedTimeUnit());
+ endTime = DateUtil.plus(endTime, template.getAdvanceDuration(), template.getAdvanceTimeUnit());
+ LambdaQueryWrapper lqw = Wrappers.lambdaQuery()
+ .eq(MessagePushRecordEntity::getStatus, MessageConstants.NOT_PUSH)
+ .ge(MessagePushRecordEntity::getPlanTime, now)
+ .le(MessagePushRecordEntity::getPlanTime, endTime);
+ List list = recordService.list(lqw);
+ this.sendMessage(list);
});
return ReturnT.SUCCESS;
}
- /**
- * 推送短信
- * @param splitSmsList 短信内容
- * @param configEntity 短信配置
- */
- private void push(List splitSmsList,SmsConfigEntity configEntity) {
- Map> phoneMap = splitSmsList.stream().collect(Collectors.groupingBy(sms -> sms.getString("phones")));
- phoneMap.forEach((phone,messages) -> {
- String messageIds = messages.stream().map(message -> message.getString(MESSAGE_ID)).collect(Collectors.joining(","));
- List smsPushDtoList = JSONArray.parseArray(JSON.toJSONString(messages), SmsPushDto.class);
- SmsPushDto templatePush = smsPushDtoList.get(0);
- Map params = new HashMap<>();
- Arrays.stream(configEntity.getContentVariables().split(",")).forEachOrdered(contentVariable ->{
- String value = smsPushDtoList.stream().map(SmsPushDto::getParams)
- .map(pm -> MapUtil.getStr(pm,contentVariable)).collect(Collectors.joining(","));
- params.put(contentVariable,value);
- });
- templatePush.setParams(params);
- XxlJobLogger.log(">>>>>>>>>>开始推送消息,推送内容为:"+JSONObject.toJSONString(templatePush)+"<<<<<<<<<<");
- LambdaUpdateWrapper pushLU = Wrappers.lambdaUpdate()
- .set(PushMessageEntity::getIsPush, true)
- .in(PushMessageEntity::getId, messageIds.split(","));
- pushMessageService.update(pushLU);
- R pushResult = pushService.send(templatePush);
- LambdaUpdateWrapper successLU = Wrappers.lambdaUpdate();
- if(pushResult.isSuccess()) {
- successLU.set(PushMessageEntity::getIsSuccess,true);
- }
- else {
- successLU.set(PushMessageEntity::getIsSuccess,false);
- }
- successLU.in(PushMessageEntity::getId, messageIds.split(","));
- pushMessageService.update(successLU);
+ /** @Author hx
+ * @Description 消息集中推送
+ * @Date 2023/4/4 15:31
+ * @Param [list] 消息推送记录
+ * @return void
+ **/
+ private void sendMessage(List list) {
+ Map> collect = list.stream().collect(Collectors.groupingBy(MessagePushRecordEntity::getAccount));
+ String type = list.get(0).getType();
+ IMessageService service = MessageFactory.getMessageSend(type);
+ collect.forEach((account,records) -> {
+ MessagePushRecordEntity request = records.get(0);
+ // 完善推送内容
+ request.setContent(this.getPushContent(type,records));
+ Boolean flag = service.send(request);
+ List ids = records.stream().map(MessagePushRecordEntity::getId).collect(Collectors.toList());
+ // 更新消息推送状态
+ LambdaUpdateWrapper lwq = Wrappers.lambdaUpdate()
+ .set(MessagePushRecordEntity::getStatus, flag ? MessageConstants.PUSH_SUCCESS : MessageConstants.PUSH_FAILED)
+ .set(MessagePushRecordEntity::getPushTime,LocalDateTime.now())
+ .in(MessagePushRecordEntity::getId, ids);
+ recordService.update(lwq);
});
}
- /**
- * 获取推送消息内容体 根据用户拆分出多条短信推送
- * @param pushMessageList
- * @return
- */
- private List transform(List pushMessageList) {
- return pushMessageList.stream().map(m -> {
- JSONObject object = JSONObject.parseObject(m.getMessageContent());
- object.put(MESSAGE_ID,m.getId());
- return object;
- }).filter(object -> Func.isNotEmpty(object.getString("phones"))).collect(Collectors.toList());
+ /** @Author hx
+ * @Description 获取群推送内容
+ * @Date 2023/4/4 16:06
+ * @Param [type, list]
+ * @return java.lang.String
+ **/
+ private String getPushContent(String type,List list) {
+ if(MessageConstants.APP_NAME.equals(type)) {
+ return list.stream().map(MessagePushRecordEntity::getContent).collect(Collectors.joining("\r\n"));
+ }
+ else if(MessageConstants.SMS_PUSH.equals(type)) {
+ Map params = new HashMap<>();
+ list.stream().map(MessagePushRecordEntity::getContent).forEachOrdered(record -> {
+ JSONObject param = JSONObject.parseObject(record);
+ param.forEach((k,v) -> {
+ params.put(k, params.containsKey(k) && Func.isNotEmpty(params.get(k)) ? params.get(k) + "," + v : (String) v);
+ });
+ });
+ return JSON.toJSONString(params);
+ }
+ return null;
}
-
}
diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/schedule/MessagePushScheduleOld.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/schedule/MessagePushScheduleOld.java
new file mode 100644
index 0000000..00862dc
--- /dev/null
+++ b/hzims-service/message/src/main/java/com/hnac/hzims/message/schedule/MessagePushScheduleOld.java
@@ -0,0 +1,130 @@
+package com.hnac.hzims.message.schedule;
+
+import cn.hutool.core.map.MapUtil;
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.hnac.hzims.common.utils.DateUtil;
+import com.hnac.hzims.message.configure.service.ISmsConfigService;
+import com.hnac.hzims.message.dto.PushMessageDTO;
+import com.hnac.hzims.message.dto.SmsPushDto;
+import com.hnac.hzims.message.entity.PushMessageEntity;
+import com.hnac.hzims.message.entity.config.SmsConfigEntity;
+import com.hnac.hzims.message.push.service.IPushService;
+import com.hnac.hzims.message.service.IPushMessageService;
+import com.xxl.job.core.biz.model.ReturnT;
+import com.xxl.job.core.handler.annotation.XxlJob;
+import com.xxl.job.core.log.XxlJobLogger;
+import lombok.extern.slf4j.Slf4j;
+import org.springblade.core.tool.api.R;
+import org.springblade.core.tool.utils.CollectionUtil;
+import org.springblade.core.tool.utils.Func;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.stereotype.Component;
+
+import java.time.LocalDateTime;
+import java.util.*;
+import java.util.stream.Collectors;
+
+import static com.hnac.hzims.message.constants.XxlJobConstants.*;
+
+/**
+ * 消息中心定时推送任务调度
+ * @author hx
+ */
+@Component
+@Slf4j
+public class MessagePushScheduleOld {
+ @Autowired
+ private ISmsConfigService smsConfigService;
+ @Autowired
+ private IPushMessageService pushMessageService;
+ @Autowired
+ @Qualifier("smsPushService")
+ private IPushService pushService;
+
+ public static final String MESSAGE_ID = "messageId";
+
+ /**
+ * 消息推送根据推送人分时段推送任务调度
+ * @param params 暂不支持参数参入执行调度任务
+ * @return
+ */
+ @XxlJob(PUSH_SMS_MESSAGE_BY_NOTICE)
+ public ReturnT pushSmsMessageByNotice(String params) {
+ List list = smsConfigService.list();
+ list.stream().filter(e -> Func.isNotEmpty(e.getDuration()) && Func.isNotEmpty(e.getTimeUnit())).forEach(smsConfigEntity -> {
+ //查询出规定时段内的短信数量统一发送
+ // 获取配置的时间范围内的消息
+ LocalDateTime endTime = DateUtil.plus(LocalDateTime.now(), smsConfigEntity.getDuration(), smsConfigEntity.getTimeUnit());
+ PushMessageDTO pushMessageDTO = new PushMessageDTO();
+ pushMessageDTO.setStartTime(LocalDateTime.now());
+ pushMessageDTO.setEndTime(endTime);
+ pushMessageDTO.setBusinessKey(smsConfigEntity.getBusinessKey());
+ pushMessageDTO.setIsPush(false);
+ List pushMessageList = pushMessageService.list(pushMessageDTO);
+ XxlJobLogger.log("开始推送短信,推送条数为:"+pushMessageList.size());
+ // 获取推送消息内容体 根据用户拆分出多条短信推送
+ List splitSmsList = this.transform(pushMessageList);
+ if(CollectionUtil.isEmpty(splitSmsList)) {
+ return;
+ }
+ this.push(splitSmsList,smsConfigEntity);
+
+ });
+ return ReturnT.SUCCESS;
+ }
+
+ /**
+ * 推送短信
+ * @param splitSmsList 短信内容
+ * @param configEntity 短信配置
+ */
+ private void push(List splitSmsList,SmsConfigEntity configEntity) {
+ Map> phoneMap = splitSmsList.stream().collect(Collectors.groupingBy(sms -> sms.getString("phones")));
+ phoneMap.forEach((phone,messages) -> {
+ String messageIds = messages.stream().map(message -> message.getString(MESSAGE_ID)).collect(Collectors.joining(","));
+ List smsPushDtoList = JSONArray.parseArray(JSON.toJSONString(messages), SmsPushDto.class);
+ SmsPushDto templatePush = smsPushDtoList.get(0);
+ Map params = new HashMap<>();
+ Arrays.stream(configEntity.getContentVariables().split(",")).forEachOrdered(contentVariable ->{
+ String value = smsPushDtoList.stream().map(SmsPushDto::getParams)
+ .map(pm -> MapUtil.getStr(pm,contentVariable)).collect(Collectors.joining(","));
+ params.put(contentVariable,value);
+ });
+ templatePush.setParams(params);
+ XxlJobLogger.log(">>>>>>>>>>开始推送消息,推送内容为:"+JSONObject.toJSONString(templatePush)+"<<<<<<<<<<");
+ LambdaUpdateWrapper pushLU = Wrappers.lambdaUpdate()
+ .set(PushMessageEntity::getIsPush, true)
+ .in(PushMessageEntity::getId, messageIds.split(","));
+ pushMessageService.update(pushLU);
+ R pushResult = pushService.send(templatePush);
+ LambdaUpdateWrapper successLU = Wrappers.lambdaUpdate();
+ if(pushResult.isSuccess()) {
+ successLU.set(PushMessageEntity::getIsSuccess,true);
+ }
+ else {
+ successLU.set(PushMessageEntity::getIsSuccess,false);
+ }
+ successLU.in(PushMessageEntity::getId, messageIds.split(","));
+ pushMessageService.update(successLU);
+ });
+ }
+
+ /**
+ * 获取推送消息内容体 根据用户拆分出多条短信推送
+ * @param pushMessageList
+ * @return
+ */
+ private List transform(List pushMessageList) {
+ return pushMessageList.stream().map(m -> {
+ JSONObject object = JSONObject.parseObject(m.getMessageContent());
+ object.put(MESSAGE_ID,m.getId());
+ return object;
+ }).filter(object -> Func.isNotEmpty(object.getString("phones"))).collect(Collectors.toList());
+ }
+
+}
diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/service/IMessagePushRecordService.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/service/IMessagePushRecordService.java
new file mode 100644
index 0000000..4ae863a
--- /dev/null
+++ b/hzims-service/message/src/main/java/com/hnac/hzims/message/service/IMessagePushRecordService.java
@@ -0,0 +1,35 @@
+package com.hnac.hzims.message.service;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.hnac.hzims.message.entity.MessagePushRecordEntity;
+import org.springblade.core.mp.base.BaseService;
+import org.springblade.core.mp.support.Query;
+
+import java.util.List;
+
+public interface IMessagePushRecordService extends BaseService {
+
+ /**
+ * 查询消息推送记录列表
+ * @param request 查询条件
+ * @return 消息记录列表
+ */
+ List list(MessagePushRecordEntity request);
+
+ /**
+ * 分页查询消息推送记录列表
+ * @param request 查询条件
+ * @param query 分页
+ * @return 消息记录列表
+ */
+ IPage listPage(MessagePushRecordEntity request, Query query);
+
+ /** @Author hx
+ * @Description 根据ID发送短信
+ * @Date 2023/4/4 17:37
+ * @Param ids 消息记录ID
+ * @return
+ **/
+ Boolean send(String id);
+
+}
diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/service/IMessageService.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/service/IMessageService.java
index c0f9574..fbb4ae0 100644
--- a/hzims-service/message/src/main/java/com/hnac/hzims/message/service/IMessageService.java
+++ b/hzims-service/message/src/main/java/com/hnac/hzims/message/service/IMessageService.java
@@ -2,6 +2,7 @@ package com.hnac.hzims.message.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.hnac.hzims.message.dto.PushDto;
+import com.hnac.hzims.message.entity.MessagePushRecordEntity;
import org.springblade.core.tool.api.R;
/**
@@ -16,4 +17,6 @@ public interface IMessageService {
*/
R send(T pushObject);
+ Boolean send(MessagePushRecordEntity request);
+
}
diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/service/IMessageTemplateService.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/service/IMessageTemplateService.java
new file mode 100644
index 0000000..14fb453
--- /dev/null
+++ b/hzims-service/message/src/main/java/com/hnac/hzims/message/service/IMessageTemplateService.java
@@ -0,0 +1,28 @@
+package com.hnac.hzims.message.service;
+
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.hnac.hzims.message.entity.config.MessageTemplateEntity;
+import org.springblade.core.mp.base.BaseService;
+import org.springblade.core.mp.support.Query;
+
+import java.util.List;
+
+public interface IMessageTemplateService extends BaseService {
+
+ /**
+ * 查询消息模板列表
+ * @param req 查询条件
+ * @return 消息模板列表
+ */
+ List list(MessageTemplateEntity req);
+
+
+ /**
+ * 分页查询消息
+ * @param req 查询条件
+ * @param query 分页条件
+ * @return 消息模板分页查询结果
+ */
+ IPage listPage(MessageTemplateEntity req, Query query);
+
+}
diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/MailMessageServiceImpl.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/MailMessageServiceImpl.java
index 1181a69..03051ba 100644
--- a/hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/MailMessageServiceImpl.java
+++ b/hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/MailMessageServiceImpl.java
@@ -3,6 +3,7 @@ package com.hnac.hzims.message.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.hnac.hzims.message.MessageConstants;
+import com.hnac.hzims.message.entity.MessagePushRecordEntity;
import com.hnac.hzims.message.log.aspect.SaveLog;
import com.hnac.hzims.message.dto.MailPushDto;
import com.hnac.hzims.message.dto.PushDto;
@@ -75,4 +76,9 @@ public class MailMessageServiceImpl implements IMessageService {
return R.success("发送成功!");
}
+ @Override
+ public Boolean send(MessagePushRecordEntity request) {
+ return null;
+ }
+
}
diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/MessagePushRecordServiceImpl.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/MessagePushRecordServiceImpl.java
new file mode 100644
index 0000000..7f615b3
--- /dev/null
+++ b/hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/MessagePushRecordServiceImpl.java
@@ -0,0 +1,55 @@
+package com.hnac.hzims.message.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.hnac.hzims.message.config.MessageFactory;
+import com.hnac.hzims.message.entity.MessagePushRecordEntity;
+import com.hnac.hzims.message.mapper.MessagePushRecordMapper;
+import com.hnac.hzims.message.service.IMessagePushRecordService;
+import com.hnac.hzims.message.service.IMessageService;
+import lombok.AllArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
+import org.springblade.core.mp.base.BaseServiceImpl;
+import org.springblade.core.mp.support.Condition;
+import org.springblade.core.mp.support.Query;
+import org.springblade.core.tool.utils.Func;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+@Service
+@AllArgsConstructor
+@Slf4j
+public class MessagePushRecordServiceImpl extends BaseServiceImpl implements IMessagePushRecordService {
+
+ @Override
+ public List list(MessagePushRecordEntity request) {
+ return this.list(this.getQueryWrapper(request));
+ }
+
+ @Override
+ public IPage listPage(MessagePushRecordEntity request, Query query) {
+ return this.page(Condition.getPage(query),this.getQueryWrapper(request));
+ }
+
+ @Override
+ public Boolean send(String id) {
+ MessagePushRecordEntity record = this.getById(id);
+ IMessageService messageSend = MessageFactory.getMessageSend(record.getType());
+ return messageSend.send(record);
+ }
+
+ /**
+ * 获取 QueryWrapper
+ * @param request 查询条件
+ * @return QueryWrapper
+ */
+ private LambdaQueryWrapper getQueryWrapper(MessagePushRecordEntity request) {
+ LambdaQueryWrapper lambda = Condition.getQueryWrapper(request).lambda();
+ if(Func.isNotEmpty(request.getStatus())) {
+ lambda.eq(MessagePushRecordEntity::getStatus,request.getStatus());
+ }
+ return lambda;
+ }
+}
diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/MessageTemplateServiceImpl.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/MessageTemplateServiceImpl.java
new file mode 100644
index 0000000..a446c39
--- /dev/null
+++ b/hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/MessageTemplateServiceImpl.java
@@ -0,0 +1,44 @@
+package com.hnac.hzims.message.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.hnac.hzims.common.utils.Condition;
+import com.hnac.hzims.message.entity.config.MessageTemplateEntity;
+import com.hnac.hzims.message.mapper.MessageTemplateMapper;
+import com.hnac.hzims.message.service.IMessageTemplateService;
+import groovy.util.logging.Slf4j;
+import lombok.AllArgsConstructor;
+import org.springblade.core.mp.base.BaseServiceImpl;
+import org.springblade.core.mp.support.Query;
+import org.springblade.core.tool.utils.Func;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+@Service
+@AllArgsConstructor
+@Slf4j
+public class MessageTemplateServiceImpl extends BaseServiceImpl implements IMessageTemplateService {
+ @Override
+ public List list(MessageTemplateEntity req) {
+ return this.list(this.getQueryWrapper(req));
+ }
+
+ @Override
+ public IPage listPage(MessageTemplateEntity req, Query query) {
+ return this.page(Condition.getPage(query) , this.getQueryWrapper(req));
+ }
+
+ /**
+ * 根据查询条件获取消息模板QueryWrapper
+ * @param req 查询条件
+ * @return 消息模板QueryWrapper
+ */
+ private LambdaQueryWrapper getQueryWrapper(MessageTemplateEntity req) {
+ LambdaQueryWrapper lambda = Condition.getQueryWrapper(req).lambda();
+ if(Func.isNotEmpty(req.getStatus())) {
+ lambda.eq(MessageTemplateEntity::getStatus,req.getStatus());
+ }
+ return lambda;
+ }
+}
diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/PushMessageServiceImpl.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/PushMessageServiceImpl.java
index 24c6107..6f19844 100644
--- a/hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/PushMessageServiceImpl.java
+++ b/hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/PushMessageServiceImpl.java
@@ -2,23 +2,32 @@ package com.hnac.hzims.message.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
+import com.google.common.collect.Lists;
import com.hnac.hzims.message.MessageConstants;
+import com.hnac.hzims.message.entity.MessagePushRecordEntity;
import com.hnac.hzims.message.log.aspect.SaveLog;
import com.hnac.hzims.message.dto.AppPushDto;
import com.hnac.hzims.message.dto.PushDto;
import com.hnac.hzims.message.service.IMessageService;
import com.hnac.hzinfo.core.push.enums.PlatformType;
+import com.hnac.hzinfo.core.push.enums.PushAudienceType;
import com.hnac.hzinfo.core.push.model.PushAudience;
import com.hnac.hzinfo.core.push.model.PushInfo;
import com.hnac.hzinfo.core.push.model.PushPlatform;
+import com.hnac.hzinfo.core.push.model.PushResponse;
import lombok.AllArgsConstructor;
+import org.springblade.core.log.exception.ServiceException;
+import org.springblade.core.log.logger.BladeLogger;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R;
+import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.ObjectUtil;
import org.springblade.resource.feign.IPushClient;
import org.springblade.resource.vo.PushInfoVO;
import org.springframework.stereotype.Service;
+import org.springframework.util.Assert;
+import java.util.ArrayList;
import java.util.Arrays;
import java.util.concurrent.atomic.AtomicReference;
@@ -30,6 +39,7 @@ import java.util.concurrent.atomic.AtomicReference;
public class PushMessageServiceImpl implements IMessageService {
private final IPushClient pushClient;
+ private final BladeLogger logger;
@Override
@SaveLog(type = MessageConstants.APP_NAME)
@@ -73,4 +83,38 @@ public class PushMessageServiceImpl implements IMessageService {
});
return R.success("推送成功");
}
+
+ @Override
+ public Boolean send(MessagePushRecordEntity request) {
+ PushInfoVO pushInfoVO = new PushInfoVO();
+ pushInfoVO.setTenantId(Func.isNotEmpty(AuthUtil.getTenantId()) ? AuthUtil.getTenantId() : request.getTenantId());
+ ArrayList platformTypes = Lists.newArrayList(PlatformType.Android, PlatformType.IOS);
+ platformTypes.forEach(platformType -> {
+ PushPlatform platform = PushPlatform.newBuilder().addPlatformType(platformType).build();
+ R response;
+ // 安卓推送
+ if(PlatformType.Android.equals(platformType)) {
+ PushAudience pushAudience = PushAudience.newBuilder().addPushAudienceType(PushAudienceType.TAG, Lists.newArrayList(request.getPusher())).build();
+ PushInfo pushInfo = new PushInfo("ops-push-android", request.getSubject(), request.getContent(),
+ "", null, platform, pushAudience);
+ pushInfoVO.setPushInfo(pushInfo);
+ response = pushClient.tenantPush(pushInfoVO);
+ }
+ // IOS推送
+ else if(PlatformType.IOS.equals(platformType)) {
+ PushAudience pushAudience = PushAudience.newBuilder().addPushAudienceType(PushAudienceType.TAG, Lists.newArrayList(request.getPusher())).build();
+ PushInfo pushInfo = new PushInfo("ops-push-ios", request.getSubject(), request.getContent(),
+ "", null, platform, pushAudience);
+ pushInfoVO.setPushInfo(pushInfo);
+ response = pushClient.tenantPush(pushInfoVO);
+ } else {
+ response = null;
+ }
+ Assert.isTrue(ObjectUtil.isNotEmpty(response) && response.isSuccess(),() -> {
+ logger.error("hzims-message:PushMessageServiceImpl:send", "请求参数为:"+JSON.toJSONString(pushInfoVO)+"错误信息为:"+response.getMsg());
+ throw new ServiceException(response.getMsg());
+ });
+ });
+ return true;
+ }
}
diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/SmsMessageServiceImpl.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/SmsMessageServiceImpl.java
index 2f1bc0f..b614eb6 100644
--- a/hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/SmsMessageServiceImpl.java
+++ b/hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/SmsMessageServiceImpl.java
@@ -2,7 +2,9 @@ package com.hnac.hzims.message.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
+import com.google.api.client.util.Value;
import com.hnac.hzims.message.MessageConstants;
+import com.hnac.hzims.message.entity.MessagePushRecordEntity;
import com.hnac.hzims.message.log.aspect.SaveLog;
import com.hnac.hzims.message.dto.PushDto;
import com.hnac.hzims.message.dto.SmsPushDto;
@@ -10,11 +12,13 @@ import com.hnac.hzims.message.service.IMessageService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.log.exception.ServiceException;
+import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.sms.model.SmsResponse;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
import org.springblade.resource.feign.ISmsClient;
import org.springframework.stereotype.Service;
+import org.springframework.util.Assert;
/**
* @author hx
@@ -41,4 +45,18 @@ public class SmsMessageServiceImpl implements IMessageService {
}
return response;
}
+
+ @Override
+ public Boolean send(MessagePushRecordEntity request) {
+ R response = smsClient.sendMessage(
+ Func.isNotEmpty(AuthUtil.getTenantId()) ? AuthUtil.getTenantId() : request.getTenantId(),
+ request.getResourceCode(),
+ request.getContent(),
+ request.getAccount()
+ );
+ Assert.isTrue(response.isSuccess(),() -> {
+ throw new ServiceException(response.getMsg());
+ });
+ return response.getData().isSuccess();
+ }
}
diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/WebsocketServiceImpl.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/WebsocketServiceImpl.java
index b71b4ce..9b9ddfb 100644
--- a/hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/WebsocketServiceImpl.java
+++ b/hzims-service/message/src/main/java/com/hnac/hzims/message/service/impl/WebsocketServiceImpl.java
@@ -3,6 +3,7 @@ package com.hnac.hzims.message.service.impl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.hnac.hzims.message.MessageConstants;
+import com.hnac.hzims.message.entity.MessagePushRecordEntity;
import com.hnac.hzims.message.log.aspect.SaveLog;
import com.hnac.hzims.message.dto.PushDto;
import com.hnac.hzims.message.dto.WsPushDto;
@@ -83,4 +84,9 @@ public class WebsocketServiceImpl implements IMessageService {
}
return R.success("推送成功");
}
+
+ @Override
+ public Boolean send(MessagePushRecordEntity request) {
+ return null;
+ }
}
diff --git a/hzims-service/middle/pom.xml b/hzims-service/middle/pom.xml
deleted file mode 100644
index d4f8665..0000000
--- a/hzims-service/middle/pom.xml
+++ /dev/null
@@ -1,69 +0,0 @@
-
-
-
- hzims-service
- com.hnac.hzims
- 4.0.0-SNAPSHOT
-
- 4.0.0
- com.hnac.hzims
- hzims-middle
- 4.0.0-SNAPSHOT
- middle
- middle
-
- 1.8
- UTF-8
- UTF-8
- 2.6.13
-
-
-
-
- org.springblade
- blade-common
- ${bladex.projet.common.version}
-
-
- org.springblade
- blade-core-boot
-
-
- org.springblade
- blade-starter-swagger
-
-
- org.springblade
- blade-core-test
- test
-
-
- org.springblade
- blade-core-auto
- provided
-
-
-
-
- ${project.name}-${project.version}
-
-
- com.spotify
- dockerfile-maven-plugin
-
- ${docker.username}
- ${docker.password}
- ${docker.registry.url}/${docker.namespace}/${project.artifactId}
- ${project.version}
- true
-
- target/${project.build.finalName}.jar
-
- false
-
-
-
-
-
-
diff --git a/hzims-service/middle/src/main/java/com/hnac/hzims/middle/MiddleApplication.java b/hzims-service/middle/src/main/java/com/hnac/hzims/middle/MiddleApplication.java
deleted file mode 100644
index 4b48c6c..0000000
--- a/hzims-service/middle/src/main/java/com/hnac/hzims/middle/MiddleApplication.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package com.hnac.hzims.middle;
-
-import org.mybatis.spring.annotation.MapperScan;
-import org.springblade.core.cloud.feign.EnableBladeFeign;
-import org.springblade.core.launch.BladeApplication;
-import org.springframework.boot.SpringApplication;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.cloud.client.SpringCloudApplication;
-import org.springframework.context.annotation.ComponentScan;
-
-@EnableBladeFeign
-@SpringCloudApplication
-@MapperScan("com.hnac.hzims.*.**.mapper.**")
-@ComponentScan(basePackages = {"com.hnac.*"})
-public class MiddleApplication {
-
- public static void main(String[] args) {
- BladeApplication.run("hzims-middle", MiddleApplication.class, args);
- }
-
-}
diff --git a/hzims-service/middle/src/main/resources/application.yml b/hzims-service/middle/src/main/resources/application.yml
deleted file mode 100644
index 575c445..0000000
--- a/hzims-service/middle/src/main/resources/application.yml
+++ /dev/null
@@ -1,36 +0,0 @@
-#服务器端口
-server:
- port: 8400
-
-#数据源配置
-spring:
- #排除DruidDataSourceAutoConfigure
- autoconfigure:
- exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure
- datasource:
- url: jdbc:mysql://192.168.1.20:3576/dev_hzims_assets?useSSL=false&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&transformedBitIsBoolean=true&tinyInt1isBit=false&allowMultiQueries=true&serverTimezone=GMT%2B8&nullCatalogMeansCurrent=true&allowPublicKeyRetrieval=true
- username: root
- password: 123
-
-
-#mybatis-plus配置
-mybatis-plus:
- mapper-locations: classpath:com/hnac/hzims/**/mapper/*Mapper.xml
- #实体扫描,多个package用逗号或者分号分隔
- typeAliasesPackage: com.hnac.hzims.**.entity
-
-#swagger扫描路径配置
-swagger:
- base-packages:
- - org.springbalde
- - com.hnac
-
-blade:
- data-scope:
- enabled: false
- lock:
- enabled: true
- address: redis://192.168.1.20:3577
- password: 1qaz2WSX@redis
- database: 0
- ssl: false
diff --git a/hzims-service/middle/src/test/java/com/hnac/hzims/middle/MiddleApplicationTests.java b/hzims-service/middle/src/test/java/com/hnac/hzims/middle/MiddleApplicationTests.java
deleted file mode 100644
index 05189d9..0000000
--- a/hzims-service/middle/src/test/java/com/hnac/hzims/middle/MiddleApplicationTests.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package com.hnac.hzims.middle;
-
-import org.junit.jupiter.api.Test;
-import org.springframework.boot.test.context.SpringBootTest;
-
-@SpringBootTest
-class MiddleApplicationTests {
-
- @Test
- void contextLoads() {
- }
-
-}
diff --git a/hzims-service/pom.xml b/hzims-service/pom.xml
index 9cfd5d3..4fabd19 100644
--- a/hzims-service/pom.xml
+++ b/hzims-service/pom.xml
@@ -22,10 +22,11 @@
equipment
safeproduct
operational
-
+ inspect
message
ticket
weather
+ middle
diff --git a/hzims-service/safeproduct/pom.xml b/hzims-service/safeproduct/pom.xml
index 0b92495..6f517bf 100644
--- a/hzims-service/safeproduct/pom.xml
+++ b/hzims-service/safeproduct/pom.xml
@@ -30,11 +30,11 @@
org.springblade
blade-starter-oss-all
-
- com.hnac.hzims
- spare-api
- ${hzims.project.version}
-
+
+
+
+
+
com.hnac.hzims
safeproduct-api
@@ -133,7 +133,7 @@
com.hnac.hzinfo
inspect-api
- 2.7.6.RELEASE
+ ${hzims.project.version}
com.hnac.hzims
diff --git a/hzims-service/ticket/pom.xml b/hzims-service/ticket/pom.xml
index 3c2b1e1..8026887 100644
--- a/hzims-service/ticket/pom.xml
+++ b/hzims-service/ticket/pom.xml
@@ -54,14 +54,11 @@
-
- e-iceblue
+ e-iceblue
spire.xls.free
3.9.1
-
-
org.apache.poi
poi
@@ -83,18 +80,14 @@
easypoi-web
${easypoi.version}
-
cn.hutool
hutool-core
- 5.7.16
-
org.springblade
blade-starter-http
-
commons-collections
commons-collections
@@ -102,6 +95,12 @@
org.springblade
blade-core-boot
+
+
+ lettuce-core
+ io.lettuce
+
+
org.springblade
diff --git a/pom.xml b/pom.xml
index eafbbae..c42f8ec 100644
--- a/pom.xml
+++ b/pom.xml
@@ -13,14 +13,12 @@
4.5.8-SNAPSHOT
4.0.0-SNAPSHOT
- 4.5.6.RELEASE
+ 4.5.8-SNAPSHOT
UTF-81.8
3.8.1
UTF-8
4.6.1-SNAPSHOT
-
-
6.4.2
2.7.5
@@ -123,7 +121,8 @@
org.springblade
blade-flow-api
- ${bladex.project.version}
+
+ 4.5.8-SNAPSHOT
org.springblade
@@ -157,11 +156,11 @@
spring-boot-starter-websocket
${spring.boot.version}
-
com.hnac.hzinfo
inspect-api
- 2.7.6.RELEASE
+
+ ${hzims.project.version}
com.hnac.hzims