diff --git a/hzims-biz-common/pom.xml b/hzims-biz-common/pom.xml
index be7e8e8..de9115d 100644
--- a/hzims-biz-common/pom.xml
+++ b/hzims-biz-common/pom.xml
@@ -22,6 +22,10 @@
blade-core-auto
provided
+
+ org.springblade
+ blade-common
+
com.alibaba
diff --git a/hzims-biz-common/src/main/java/com/hnac/hzims/common/logs/constant/TicketProcessConstant.java b/hzims-biz-common/src/main/java/com/hnac/hzims/common/logs/constant/TicketProcessConstant.java
deleted file mode 100644
index 466e9e4..0000000
--- a/hzims-biz-common/src/main/java/com/hnac/hzims/common/logs/constant/TicketProcessConstant.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package com.hnac.hzims.common.logs.constant;
-
-/**
- * 开票常量类
- *
- * @Author WL
- * @Version v1.0
- * @Serial 1.0
- * @Date 2023/4/8 10:53
- */
-public class TicketProcessConstant {
-
- /**
- * 第一种工作票的key
- */
- public static final String FIRST_TICKET_KEY = "networking";
-
-
- /**
- * 操作票
- */
- public static final String OPERATION_TICKET_KEY = "moreActionBankDirect";
-
- /**
- * 水力机械工作票
- */
- public static final String MACHINERY_TICKET_KEY = "machinery";
- /**
- * 日常维护
- */
- public static final String MAINTENANCE_KEY = "maintenance";
-}
diff --git a/hzims-biz-common/src/main/java/com/hnac/hzims/common/utils/Condition.java b/hzims-biz-common/src/main/java/com/hnac/hzims/common/utils/Condition.java
index 6b76112..571cb72 100644
--- a/hzims-biz-common/src/main/java/com/hnac/hzims/common/utils/Condition.java
+++ b/hzims-biz-common/src/main/java/com/hnac/hzims/common/utils/Condition.java
@@ -32,6 +32,67 @@ public class Condition extends org.springblade.core.mp.support.Condition {
return c;
}
+ public static LambdaQueryWrapper getQueryWrapper(Class clazz, Object query) {
+ QueryWrapper qw = new QueryWrapper();
+ qw.setEntityClass(clazz);
+ Class queryClass = query.getClass();
+ List fieldList = new ArrayList<>();
+ while (null != queryClass){
+ fieldList.addAll(Arrays.asList(queryClass.getDeclaredFields()));
+ queryClass = queryClass.getSuperclass();
+ }
+ for(Field field:fieldList){
+ field.setAccessible(true);
+ QueryField queryField = field.getAnnotation(QueryField.class);
+ if(queryField==null) {
+ continue;
+ }
+ Object value;
+ try {
+ value = field.get(query);
+ } catch (Exception e) {
+ throw new ServiceException("获取属性性出错");
+ }
+ if(value==null) {
+ continue;
+ }
+ List list = null;
+ if(value instanceof List){
+ list = (List)value;
+ if(list.size()==0) {
+ continue;
+ }
+ }
+ String condition = queryField.condition();
+ if(Func.isBlank(condition)) {
+ continue;
+ }
+ String fileName = camel2under(field.getName());
+ if(SqlCondition.EQUAL.equals(condition)) {
+ qw.eq(fileName, value);
+ }else if(SqlCondition.LIKE.equals(condition)){
+ qw.like(fileName,value);
+ }else if(SqlCondition.LIKE_LEFT.equals(condition)){
+ qw.likeLeft(fileName,value);
+ }else if(SqlCondition.LIKE_RIGHT.equals(condition)){
+ qw.likeRight(fileName,value);
+ }else if(SqlCondition.NOT_IN.equals(condition)){
+ String columnName = queryField.columnName();
+ if(Func.isBlank(columnName)) {
+ throw new ServiceException("查询不包含条件时需要指定列名");
+ }
+ qw.notIn(camel2under(columnName),list);
+ }else if(SqlCondition.IN.equals(condition)){
+ String columnName = queryField.columnName();
+ if(Func.isBlank(columnName)) {
+ throw new ServiceException("查询包含条件时需要指定列名");
+ }
+ qw.in(camel2under(columnName),list);
+ }
+ }
+ return qw.lambda();
+ }
+
/**
* 支持配置化的模糊查询
* @param entity 数据库返回的对象实体
diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/constants/AbnormalAlarmConstant.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/constants/AbnormalAlarmConstant.java
index eab3ee0..1f18d55 100644
--- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/constants/AbnormalAlarmConstant.java
+++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/alert/constants/AbnormalAlarmConstant.java
@@ -12,7 +12,7 @@ public interface AbnormalAlarmConstant {
List LONG_TYPE_LIST = Arrays.asList(3L,2L,5L,10L,13L,14L);
- List SEND_MESSSAGE_TYPE_LIST = Arrays.asList("2","13","14");
+ List SEND_MESSSAGE_TYPE_LIST = Arrays.asList("3","13","14");
String LEVEL_TYPE_LIST = "3,2,5,10,13,14";
diff --git a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/MessageConstants.java b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/MessageConstants.java
index 6741a3f..abe695b 100644
--- a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/MessageConstants.java
+++ b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/MessageConstants.java
@@ -1,7 +1,6 @@
package com.hnac.hzims.message;
import lombok.AllArgsConstructor;
-import lombok.Data;
import lombok.Getter;
import lombok.NoArgsConstructor;
@@ -53,8 +52,15 @@ public class MessageConstants {
DUTY("duty","值班消息"),
SAFE("safe","安全消息"),
ACCESS("access","检修消息"),
+ BUSINESS("business","事务消息"),
TICKETMESSAGE("ticket-message","工作票消息"),
OPERATIONTICKETMESSAGE("operation-ticket-message","操作票消息"),
+ ROUTINEMAINTENANCE("operation-maintenance-message","日常维护消息"),
+ OPERATIONDEFECTMESSAGE("operation-defect-message","消缺消息"),
+
+ OVERHAUL_PLAN("overhaul-plan","检修计划"),
+
+ OVERHAUL_TASK("overhaul-task","检修任务"),
;
@Getter
private String key;
diff --git a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/dto/BusinessMessageDTO.java b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/dto/BusinessMessageDTO.java
new file mode 100644
index 0000000..b3d8d4c
--- /dev/null
+++ b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/dto/BusinessMessageDTO.java
@@ -0,0 +1,66 @@
+package com.hnac.hzims.message.dto;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.fasterxml.jackson.annotation.JsonFormat;
+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 javax.validation.constraints.NotNull;
+import java.io.Serializable;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+
+/**
+ * @ClassName BusinessMessageDTO
+ * @description:
+ * @author: hx
+ * @create: 2023-06-15 19:10
+ * @Version 4.0
+ **/
+@Data
+@ApiModel("事务消息")
+@EqualsAndHashCode
+public class BusinessMessageDTO implements Serializable {
+ @ApiModelProperty(value = "机构ID",required = true)
+ @NotNull(message = "机构ID不能为空")
+ private Long deptId;
+
+ @ApiModelProperty("机构名称")
+ private String deptName;
+
+ @ApiModelProperty(value = "业务关键字",required = true)
+ @NotNull(message = "业务关键字不能为空")
+ private String businessKey;
+
+ @ApiModelProperty(value = "业务分类。系统通知:system,事务消息:business,日常提醒:dailyRemind,巡检消息:inspect",required = true)
+ @NotNull(message = "业务分类不能为空")
+ private String businessClassify;
+
+ @ApiModelProperty("业务任务ID")
+ @QueryField(condition = SqlCondition.EQUAL)
+ private Long taskId;
+
+ @NotNull
+ @ApiModelProperty(value = "内容")
+ private String content;
+
+ @NotNull
+ @ApiModelProperty(value = "主题")
+ private String subject;
+
+ @NotNull
+ @ApiModelProperty(value = "推送用户")
+ private String userIds;
+
+ @ApiModelProperty(value = "创建用户")
+ private Long createUser;
+
+ @ApiModelProperty(value = "租户ID")
+ private String tenantId;
+}
diff --git a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/fegin/IMessageClient.java b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/fegin/IMessageClient.java
index be87e27..887e97c 100644
--- a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/fegin/IMessageClient.java
+++ b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/fegin/IMessageClient.java
@@ -1,10 +1,7 @@
package com.hnac.hzims.message.fegin;
import com.hnac.hzims.message.MessageConstants;
-import com.hnac.hzims.message.dto.MessagePushRecordDto;
-import com.hnac.hzims.message.dto.PlanMsgRecordDto;
-import com.hnac.hzims.message.dto.PushDto;
-import com.hnac.hzims.message.dto.SmsPushDto;
+import com.hnac.hzims.message.dto.*;
import com.hnac.hzims.message.entity.MessagePushRecordEntity;
import com.hnac.hzims.message.entity.config.MessageTemplateEntity;
import org.springblade.core.tool.api.R;
@@ -29,6 +26,7 @@ public interface IMessageClient {
String SEND_MESSAGE = API_PREFIX + "/sendMessage";
String GET_TEMPLATE_BY_ID = API_PREFIX + "/getMsgTemplateById";
String PLAN_SEND_MESSAGE = API_PREFIX + "/planSendMessage";
+ String SEND_APP_AND_WS_MSG = API_PREFIX + "/sendAppAndWsMsgByUsers";
/**
* 推送消息(短信)
@@ -54,4 +52,13 @@ public interface IMessageClient {
**/
@PostMapping(PLAN_SEND_MESSAGE)
R planSendMessage(@RequestBody PlanMsgRecordDto request);
+
+ /**
+ * 发送多人APP、WEB消息
+ * @Author hx
+ * @param request
+ * @return
+ */
+ @PostMapping(value = SEND_APP_AND_WS_MSG,consumes = "application/json; charset=UTF-8")
+ R sendAppAndWsMsgByUsers(@RequestBody BusinessMessageDTO request);
}
diff --git a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/fegin/MessageClientFallback.java b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/fegin/MessageClientFallback.java
index e03c604..37f26e4 100644
--- a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/fegin/MessageClientFallback.java
+++ b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/fegin/MessageClientFallback.java
@@ -1,9 +1,6 @@
package com.hnac.hzims.message.fegin;
-import com.hnac.hzims.message.dto.MessagePushRecordDto;
-import com.hnac.hzims.message.dto.PlanMsgRecordDto;
-import com.hnac.hzims.message.dto.PushDto;
-import com.hnac.hzims.message.dto.SmsPushDto;
+import com.hnac.hzims.message.dto.*;
import com.hnac.hzims.message.entity.MessagePushRecordEntity;
import com.hnac.hzims.message.entity.config.MessageTemplateEntity;
import org.springblade.core.tool.api.R;
@@ -34,4 +31,9 @@ public class MessageClientFallback implements IMessageClient {
public R planSendMessage(PlanMsgRecordDto request) {
return R.fail("调用失败!");
}
+
+ @Override
+ public R sendAppAndWsMsgByUsers(BusinessMessageDTO request) {
+ return R.fail("调用失败!");
+ }
}
diff --git a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/msgpushrecord/PushStatResponseVo.java b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/msgpushrecord/PushStatResponseVo.java
new file mode 100644
index 0000000..7850b7b
--- /dev/null
+++ b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/msgpushrecord/PushStatResponseVo.java
@@ -0,0 +1,33 @@
+package com.hnac.hzims.message.vo.msgpushrecord;
+
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * @Author WL
+ * @Version v1.0
+ * @Serial 1.0
+ * @Date 2023/6/29 14:18
+ */
+@Data
+public class PushStatResponseVo {
+
+ /**
+ * 推送人名称
+ */
+ private String pusherName;
+
+ /**
+ * 业务分类
+ */
+ private String businessClassify;
+ /**
+ * 业务分类名称
+ */
+ private String businessClassifyName;
+ /**
+ * 统计数量
+ */
+ private Integer count;
+}
diff --git a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/msgpushrecord/UserPushStatResponseVo.java b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/msgpushrecord/UserPushStatResponseVo.java
new file mode 100644
index 0000000..b40af0d
--- /dev/null
+++ b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/msgpushrecord/UserPushStatResponseVo.java
@@ -0,0 +1,33 @@
+package com.hnac.hzims.message.vo.msgpushrecord;
+
+import lombok.Data;
+
+import javax.sound.sampled.Port;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * @Author WL
+ * @Version v1.0
+ * @Serial 1.0
+ * @Date 2023/6/29 13:58
+ */
+@Data
+public class UserPushStatResponseVo {
+
+ /**
+ * 业务分类
+ */
+ private String businessClassify;
+
+ /**
+ * 业务分类名称
+ */
+ private String businessClassifyName;
+
+ /**
+ * 封装map
+ */
+ private Map params;
+}
diff --git a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/msgpushrecord/UserPushStatTypeResponseVo.java b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/msgpushrecord/UserPushStatTypeResponseVo.java
new file mode 100644
index 0000000..1536709
--- /dev/null
+++ b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/msgpushrecord/UserPushStatTypeResponseVo.java
@@ -0,0 +1,28 @@
+package com.hnac.hzims.message.vo.msgpushrecord;
+
+import lombok.Data;
+
+import java.util.List;
+import java.util.Set;
+
+/**
+ * @Author WL
+ * @Version v1.0
+ * @Serial 1.0
+ * @Date 2023/6/29 13:46
+ */
+@Data
+public class UserPushStatTypeResponseVo {
+
+ /**
+ * 封装人员信息
+ */
+ private List userNames;
+
+
+ /**
+ * 封装业务分类对象
+ */
+ private List userPushStatResponseVos;
+
+}
diff --git a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/msgpushrecord/UserPushStatTypeVo.java b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/msgpushrecord/UserPushStatTypeVo.java
index 8ac126f..2ed9570 100644
--- a/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/msgpushrecord/UserPushStatTypeVo.java
+++ b/hzims-service-api/message-api/src/main/java/com/hnac/hzims/message/vo/msgpushrecord/UserPushStatTypeVo.java
@@ -22,4 +22,8 @@ public class UserPushStatTypeVo {
* 推送业务分类数组
*/
private List pushStatList;
+
+
+
+
}
diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/config/ThreadPoolConfig.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/config/ThreadPoolConfig.java
index d8feb4f..b3e8b1a 100644
--- a/hzims-service/message/src/main/java/com/hnac/hzims/message/config/ThreadPoolConfig.java
+++ b/hzims-service/message/src/main/java/com/hnac/hzims/message/config/ThreadPoolConfig.java
@@ -18,9 +18,13 @@ public class ThreadPoolConfig {
@Bean
public ExecutorService logExecutorService() {
- return new ThreadPoolExecutor(1, 1,
+ return new ThreadPoolExecutor(2, 5,
0L, TimeUnit.MILLISECONDS,
new LinkedBlockingQueue());
}
+ @Bean
+ public ExecutorService appMessagePushExecutor() {
+ return new ThreadPoolExecutor(2, 5, 5L, TimeUnit.SECONDS,new LinkedBlockingQueue());
+ }
}
diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/controller/MessageController.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/controller/MessageController.java
index 4b84621..89a171d 100644
--- a/hzims-service/message/src/main/java/com/hnac/hzims/message/controller/MessageController.java
+++ b/hzims-service/message/src/main/java/com/hnac/hzims/message/controller/MessageController.java
@@ -7,6 +7,7 @@ import com.hnac.hzims.message.dto.SmsPushDto;
import com.hnac.hzims.message.dto.WsPushDto;
import com.hnac.hzims.message.fegin.IPushMsgClient;
import com.hnac.hzims.message.service.IMessageService;
+import com.hnac.hzims.message.service.IPushMessageService;
import com.hnac.hzims.message.service.impl.MailMessageServiceImpl;
import com.hnac.hzims.message.service.impl.PushMessageServiceImpl;
import com.hnac.hzims.message.service.impl.SmsMessageServiceImpl;
@@ -14,16 +15,16 @@ import com.hnac.hzims.message.service.impl.WebsocketServiceImpl;
import com.hnac.hzims.message.utils.HtmlModule;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.tool.api.R;
+import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.SpringUtil;
-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 java.util.List;
import java.util.Map;
/**
@@ -79,4 +80,15 @@ public class MessageController extends BladeController {
IMessageService messageService = SpringUtil.getBean(WebsocketServiceImpl.class);
return messageService.send(wsPushDto);
}
+
+ @GetMapping("/sendByUsers")
+ @ApiOperation("发送APP消息(多人)")
+ @ApiOperationSupport(order=5)
+ public R sendByUsers(@ApiParam("消息主题") String subject,
+ @ApiParam("消息内容") String content,
+ @ApiParam("用户ID列表") String userIds,
+ @ApiParam("租户ID") String tenantId) throws Exception {
+ PushMessageServiceImpl messageService = SpringUtil.getBean(PushMessageServiceImpl.class);
+ return R.status(messageService.sendByUsers(subject,content, Func.toStrList(",",userIds),tenantId));
+ }
}
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
index 83fcb29..c5c3958 100644
--- 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
@@ -102,8 +102,6 @@ public class MessagePushRecordController extends BladeController {
@GetMapping("/getPersonalUnreadMessage")
@ApiOperation("获取当前登录人待办消息")
@ApiOperationSupport(order = 8)
- @OperationAnnotation(moduleName = "视频集中监控", title = "视频集中监控", action = "获取当前登录人待办消息",
- operatorType = OperatorType.MOBILE, businessType = BusinessType.GENCODE)
public R> getPersonalUnreadMessage() {
List personalUnreadMessage = messagePushRecordService.getPersonalUnreadMessage();
return R.data(personalUnreadMessage);
diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/controller/web/MessageStatisticsController.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/controller/web/MessageStatisticsController.java
index 1c43025..154660e 100644
--- a/hzims-service/message/src/main/java/com/hnac/hzims/message/controller/web/MessageStatisticsController.java
+++ b/hzims-service/message/src/main/java/com/hnac/hzims/message/controller/web/MessageStatisticsController.java
@@ -56,10 +56,22 @@ public class MessageStatisticsController {
/**
* 人员发送统计
*/
+ @GetMapping("/userPushStatWithMessgae")
+ public R userPushStatWithMessgae(MessagePushRecordEntityVo vo) {
+ log.info("人员发送统计");
+ List messagePushRecordVos = messagePushRecordService.userPushStat(vo);
+ log.info("人员发送统计 返回的数据: {}",messagePushRecordVos);
+ return R.data(messagePushRecordVos);
+ }
+
+
+ /**
+ * 新人员发送统计
+ */
@GetMapping("/userPushStat")
public R userPushStat(MessagePushRecordEntityVo vo) {
log.info("人员发送统计");
- List messagePushRecordVos = messagePushRecordService.userPushStat(vo);
+ UserPushStatTypeResponseVo messagePushRecordVos = messagePushRecordService.newUserPushStat(vo);
log.info("人员发送统计 返回的数据: {}",messagePushRecordVos);
return R.data(messagePushRecordVos);
}
diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/fegin/MessageClient.java b/hzims-service/message/src/main/java/com/hnac/hzims/message/fegin/MessageClient.java
index 57afdb2..0660fdd 100644
--- a/hzims-service/message/src/main/java/com/hnac/hzims/message/fegin/MessageClient.java
+++ b/hzims-service/message/src/main/java/com/hnac/hzims/message/fegin/MessageClient.java
@@ -2,28 +2,26 @@ package com.hnac.hzims.message.fegin;
import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.google.common.collect.Lists;
import com.hnac.hzims.message.MessageConstants;
-import com.hnac.hzims.message.dto.MessagePushRecordDto;
-import com.hnac.hzims.message.dto.PlanMsgRecordDto;
-import com.hnac.hzims.message.dto.PushDto;
-import com.hnac.hzims.message.dto.SmsPushDto;
+import com.hnac.hzims.message.dto.*;
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.hnac.hzims.message.service.impl.PushMessageServiceImpl;
import com.hnac.hzims.message.service.impl.SmsMessageServiceImpl;
import com.xxl.job.core.log.XxlJobLogger;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.collections4.CollectionUtils;
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;
-import org.springblade.core.tool.utils.ObjectUtil;
-import org.springblade.core.tool.utils.SpringUtil;
+import org.springblade.core.tool.utils.*;
import org.springblade.system.user.cache.UserCache;
import org.springblade.system.user.entity.User;
import org.springframework.util.Assert;
@@ -33,7 +31,9 @@ import javax.validation.Valid;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.Arrays;
+import java.util.List;
import java.util.Optional;
+import java.util.stream.Collectors;
/**
* @author hx
@@ -115,4 +115,37 @@ public class MessageClient extends BladeController implements IMessageClient{
return R.success("推送成功!");
}
+ @Override
+ @PostMapping(value = SEND_APP_AND_WS_MSG , produces="application/json; charset=UTF-8")
+ public R sendAppAndWsMsgByUsers(@RequestBody BusinessMessageDTO request) {
+ // 保存消息记录
+ List pushRecords = Func.toLongList(request.getUserIds()).stream().flatMap(userId -> {
+ long messageId = IdWorker.getId();
+ return Lists.newArrayList(MessageConstants.APP_PUSH, MessageConstants.WS_PUSH).stream().map(messageType -> {
+ MessagePushRecordEntity record = BeanUtil.copy(request, MessagePushRecordEntity.class);
+ record.setMessageId(messageId);
+ record.setPusher(userId.toString());
+ record.setPusherName(Optional.ofNullable(UserCache.getUser(userId)).map(User::getName).orElse(null));
+ record.setPushType(MessageConstants.IMMEDIATELY);
+ record.setAccount(userId.toString());
+ record.setPlanTime(LocalDateTime.now());
+ record.setType(messageType);
+ record.setCreateDept(record.getDeptId());
+ return record;
+ });
+ }).collect(Collectors.toList());
+ boolean saveResult = recordService.saveBatch(pushRecords);
+ if(saveResult) {
+ List appRecords = pushRecords.stream().filter(record -> MessageConstants.APP_PUSH.equals(record.getType())).collect(Collectors.toList());
+ // 推送消息 - app
+ Boolean appFlag = recordService.sendAppMsgByUsers(request, appRecords);
+ // 推送消息 - web
+ Boolean wsFlag = recordService.sendWsMsgByUsers(CollectionUtils.subtract(pushRecords, appRecords).stream().collect(Collectors.toList()));
+ return R.data(appFlag && wsFlag);
+ }
+ else {
+ return R.data(false);
+ }
+ }
+
}
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
index c317ec1..4d76dc3 100644
--- 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
@@ -6,6 +6,7 @@ import org.apache.ibatis.annotations.Param;
import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper;
import java.util.List;
+import java.util.Set;
public interface MessagePushRecordMapper extends UserDataScopeBaseMapper {
@@ -43,4 +44,11 @@ public interface MessagePushRecordMapper extends UserDataScopeBaseMapper selectByStatus();
+
+ /**
+ * 新人员发送统计
+ * @param vo
+ * @return
+ */
+ List selectUserPushStat(@Param("vo") MessagePushRecordEntityVo vo);
}
diff --git a/hzims-service/message/src/main/java/com/hnac/hzims/message/mapper/MessagePushRecordMapper.xml b/hzims-service/message/src/main/java/com/hnac/hzims/message/mapper/MessagePushRecordMapper.xml
index 0eb5aa4..a44dbe5 100644
--- a/hzims-service/message/src/main/java/com/hnac/hzims/message/mapper/MessagePushRecordMapper.xml
+++ b/hzims-service/message/src/main/java/com/hnac/hzims/message/mapper/MessagePushRecordMapper.xml
@@ -14,6 +14,7 @@
+
@@ -50,6 +52,7 @@
and
type = #{vo.type}
+ and (BUSINESS_CLASSIFY != '' and BUSINESS_CLASSIFY is not null)
group by businessClassify
@@ -74,6 +77,7 @@
and
type = #{vo.type}
+ and (BUSINESS_CLASSIFY != '' and BUSINESS_CLASSIFY is not null)
group by businessClassify, pusherName
@@ -107,6 +111,7 @@
and
type = #{vo.type}
+ and (BUSINESS_CLASSIFY != '' and BUSINESS_CLASSIFY is not null)
group by businessClassify,status
@@ -116,4 +121,33 @@
from hzims_message_push_record
group by STATUS
+
+
+
+
+
+
+
\ No newline at end of file
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
index 40e5e03..56a2974 100644
--- 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
@@ -1,11 +1,14 @@
package com.hnac.hzims.message.service;
import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.hnac.hzims.message.dto.BusinessMessageDTO;
import com.hnac.hzims.message.entity.MessagePushRecordEntity;
import com.hnac.hzims.message.vo.UnreadMessageVO;
import com.hnac.hzims.message.vo.msgpushrecord.*;
import org.springblade.core.mp.base.BaseService;
import org.springblade.core.mp.support.Query;
+import org.springblade.core.tool.api.R;
+import org.springframework.web.bind.annotation.RequestBody;
import java.util.List;
@@ -84,4 +87,15 @@ public interface IMessagePushRecordService extends BaseService getPersonalAppUnreadMessage();
+ Boolean sendAppMsgByUsers(BusinessMessageDTO request,List records);
+
+ Boolean sendWsMsgByUsers(List request);
+
+
+ /**
+ * 新人员发送统计
+ * @param vo
+ * @return
+ */
+ UserPushStatTypeResponseVo newUserPushStat(MessagePushRecordEntityVo vo);
}
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
index 437cacc..909b955 100644
--- 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
@@ -14,6 +14,7 @@ import com.google.common.collect.Lists;
import com.hnac.hzims.common.utils.CacheUtil;
import com.hnac.hzims.message.MessageConstants;
import com.hnac.hzims.message.config.MessageFactory;
+import com.hnac.hzims.message.dto.BusinessMessageDTO;
import com.hnac.hzims.message.entity.MessagePushRecordEntity;
import com.hnac.hzims.message.enums.PushStatEnum;
import com.hnac.hzims.message.mapper.MessagePushRecordMapper;
@@ -22,29 +23,25 @@ import com.hnac.hzims.message.service.IMessagePushRecordService;
import com.hnac.hzims.message.service.IMessageService;
import com.hnac.hzims.message.vo.UnreadMessageVO;
import com.hnac.hzims.message.vo.msgpushrecord.*;
+import io.minio.messages.Item;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.mp.base.BaseServiceImpl;
-import org.springblade.core.mp.support.Condition;
+import com.hnac.hzims.common.utils.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.utils.Func;
+import org.springblade.core.tool.utils.SpringUtil;
import org.springblade.system.cache.DictCache;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert;
import javax.validation.Valid;
-import java.time.LocalDate;
-import java.time.LocalDateTime;
-import java.time.Year;
-import java.time.YearMonth;
+import java.time.*;
import java.time.format.DateTimeFormatter;
-import java.util.ArrayList;
-import java.util.Comparator;
-import java.util.List;
-import java.util.Map;
+import java.util.*;
import java.util.stream.Collectors;
@Service
@@ -118,13 +115,14 @@ public class MessagePushRecordServiceImpl extends BaseServiceImpl getQueryWrapper(MessagePushRecordEntity request) {
- LambdaQueryWrapper lambda = Condition.getQueryWrapper(request).lambda();
- if (Func.isNotEmpty(request.getStartTime())) {
- lambda.ge(MessagePushRecordEntity::getPushTime, request.getStartTime());
+ LambdaQueryWrapper lambda = Condition.getQueryWrapper(MessagePushRecordEntity.class,request);
+ if(Func.isNotEmpty(request.getStartTime())) {
+ lambda.ge(MessagePushRecordEntity::getPushTime, LocalDateTime.of(request.getStartTime(), LocalTime.MIN));
}
- if (Func.isNotEmpty(request.getEndTime())) {
- lambda.le(MessagePushRecordEntity::getPushTime, request.getEndTime());
+ if(Func.isNotEmpty(request.getEndTime())) {
+ lambda.le(MessagePushRecordEntity::getPushTime, LocalDateTime.of(request.getEndTime(), LocalTime.MAX));
}
+ lambda.eq(Func.isNotEmpty(request.getStatus()),MessagePushRecordEntity::getStatus,request.getStatus());
lambda.orderByDesc(MessagePushRecordEntity::getPushTime);
return lambda;
}
@@ -234,11 +232,55 @@ public class MessagePushRecordServiceImpl extends BaseServiceImpl results = new ArrayList<>();
+ List pushStat = baseMapper.selectUserPushStat(vo);
+ List list = pushStat.stream().map(item -> item.getPusherName()).distinct().collect(Collectors.toList());
+ pushStatList.setUserNames(list);
+ //封装业务分类对象
+ Map> collect = pushStat.stream().collect(Collectors.groupingBy(PushStatResponseVo::getBusinessClassify));
+ //
+ for (Map.Entry> entry : collect.entrySet()) {
+ List arrayList = Lists.newArrayList(list);
+ UserPushStatResponseVo userPushStatTypeResponseVo = new UserPushStatResponseVo();
+ //存储key
+ userPushStatTypeResponseVo.setBusinessClassify(entry.getKey());
+ userPushStatTypeResponseVo.setBusinessClassifyName(this.getBusinessClassifyByName(entry.getKey()));
+ TreeMap treeMap = new TreeMap<>();
+ //存储业务分类
+ List pushStatResponseVos = entry.getValue();
+ for (PushStatResponseVo pushStatResponseVo : pushStatResponseVos) {
+ if (arrayList.contains(pushStatResponseVo.getPusherName())){
+ arrayList.remove(pushStatResponseVo.getPusherName());
+ }
+ treeMap.put(pushStatResponseVo.getPusherName(),pushStatResponseVo.getCount());
+ }
+ //如果不存在设为0
+ for (String name : arrayList) {
+ treeMap.put(name,0);
+ }
+ userPushStatTypeResponseVo.setParams(treeMap);
+ results.add(userPushStatTypeResponseVo);
+ }
+ pushStatList.setUserPushStatResponseVos(results);
+
+ return pushStatList;
+ }
+
+
/**
* 推送成功失败统计
*
@@ -321,6 +363,40 @@ public class MessagePushRecordServiceImpl extends BaseServiceImpl records) {
+ PushMessageServiceImpl service = SpringUtil.getBean(PushMessageServiceImpl.class);
+ try {
+ boolean sendFlag = service.sendByUsers(request.getSubject(), request.getContent(), Arrays.asList(request.getUserIds().split(",")), request.getTenantId());
+ if (sendFlag) {
+ return this.update(Wrappers.lambdaUpdate()
+ .set(MessagePushRecordEntity::getPushTime, LocalDateTime.now())
+ .set(MessagePushRecordEntity::getStatus, MessageConstants.PUSH_SUCCESS)
+ .in(MessagePushRecordEntity::getId, records.stream().map(MessagePushRecordEntity::getId).collect(Collectors.toList()))
+ );
+ }
+ return false;
+ } catch (Exception e) {
+ throw new ServiceException(e.getMessage());
+ }
+ }
+
+ @Override
+ public Boolean sendWsMsgByUsers(List request) {
+ WebsocketServiceImpl service = SpringUtil.getBean(WebsocketServiceImpl.class);
+ request.forEach(record -> {
+ boolean sendFlag = service.send(record);
+ if (sendFlag) {
+ this.update(Wrappers.lambdaUpdate()
+ .set(MessagePushRecordEntity::getPushTime, LocalDateTime.now())
+ .set(MessagePushRecordEntity::getStatus, MessageConstants.PUSH_SUCCESS)
+ .in(MessagePushRecordEntity::getId, record.getId())
+ );
+ }
+ });
+ return true;
+ }
+
/**
* 状态 ===> 状态名称
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 b62134f..9c1d6be 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
@@ -29,6 +29,9 @@ import org.springframework.util.Assert;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.List;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.FutureTask;
import java.util.concurrent.atomic.AtomicReference;
/**
@@ -40,6 +43,7 @@ public class PushMessageServiceImpl implements IMessageService {
private final IPushClient pushClient;
private final BladeLogger logger;
+ private final ExecutorService appMessagePushExecutor;
@Override
@SaveLog(type = MessageConstants.APP_NAME)
@@ -85,36 +89,51 @@ public class PushMessageServiceImpl implements IMessageService {
}
@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());
- });
+ public boolean send(MessagePushRecordEntity request) {
+ String tenantId = Func.isNotEmpty(AuthUtil.getTenantId()) ? AuthUtil.getTenantId() : request.getTenantId();
+ try {
+ return this.sendByUsers(request.getSubject(), request.getContent(), Func.toStrList(",",request.getPusher()),tenantId);
+ }
+ catch (Exception e) {
+ throw new ServiceException(e.getMessage());
+ }
+ }
+
+ /**
+ * 发送APP消息(多人)
+ * @param subject 消息主题
+ * @param content 消息内容
+ * @param userIds 用户ID列表
+ * @param tenantId 租户ID
+ * @return
+ */
+ public boolean sendByUsers(String subject, String content, List userIds,String tenantId) throws Exception {
+ // 安卓推送
+ FutureTask androidPush = new FutureTask<>(() -> {
+ PushInfoVO pushInfoVO = new PushInfoVO();
+ PushPlatform pushPlatform = PushPlatform.newBuilder().addPlatformType(PlatformType.Android).build();
+ PushAudience pushAudience = PushAudience.newBuilder().addPushAudienceType(PushAudienceType.TAG, userIds).build();
+ PushInfo pushInfo = new PushInfo("ops-push-android", subject, content,"", null, pushPlatform, pushAudience);
+ pushInfoVO.setPushInfo(pushInfo);
+ pushInfoVO.setTenantId(tenantId);
+ R pushResult = pushClient.tenantPush(pushInfoVO);
+ return pushResult.isSuccess();
});
- return true;
+ appMessagePushExecutor.submit(new Thread(androidPush,"安卓推送"));
+
+ // IOS推送
+ FutureTask iosPush = new FutureTask<>(() -> {
+ PushInfoVO pushInfoVO = new PushInfoVO();
+ PushPlatform pushPlatform = PushPlatform.newBuilder().addPlatformType(PlatformType.IOS).build();
+ PushAudience pushAudience = PushAudience.newBuilder().addPushAudienceType(PushAudienceType.TAG, userIds).build();
+ PushInfo pushInfo = new PushInfo("ops-push-ios", subject, content,"", null, pushPlatform, pushAudience);
+ pushInfoVO.setPushInfo(pushInfo);
+ pushInfoVO.setTenantId(tenantId);
+ R pushResult = pushClient.tenantPush(pushInfoVO);
+ return pushResult.isSuccess();
+ });
+ appMessagePushExecutor.submit(new Thread(iosPush,"ios推送"));
+
+ return androidPush.get() && iosPush.get();
}
}
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 07730aa..419da82 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
@@ -23,6 +23,7 @@ import org.springframework.web.socket.TextMessage;
import org.springframework.web.socket.WebSocketSession;
import java.io.IOException;
import java.time.LocalDateTime;
+import java.util.List;
import java.util.concurrent.TimeUnit;
/**
diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/AbnormalAlarmServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/AbnormalAlarmServiceImpl.java
index 88e8312..aa406db 100644
--- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/AbnormalAlarmServiceImpl.java
+++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/alert/service/impl/AbnormalAlarmServiceImpl.java
@@ -1,16 +1,15 @@
package com.hnac.hzims.operational.alert.service.impl;
import com.hnac.hzims.message.MessageConstants;
+import com.hnac.hzims.message.dto.BusinessMessageDTO;
import com.hnac.hzims.message.dto.MessagePushRecordDto;
import com.hnac.hzims.message.fegin.IMessageClient;
import com.hnac.hzims.operational.alert.constants.AbnormalAlarmConstant;
import com.hnac.hzims.operational.alert.entity.AbnormalAlarmEntity;
import com.hnac.hzims.operational.alert.entity.HistoryAbnormalAlarmEntity;
-import com.hnac.hzims.operational.alert.entity.HistoryLevelAlarmEntity;
import com.hnac.hzims.operational.alert.mapper.AbnormalAlarmMapper;
import com.hnac.hzims.operational.alert.service.AbnormalAlarmService;
import com.hnac.hzims.operational.alert.service.HistoryAbnormalAlarmService;
-import com.hnac.hzims.operational.main.constant.HomePageConstant;
import com.hnac.hzims.operational.station.entity.StationEntity;
import com.hnac.hzims.operational.station.service.IStationService;
import com.hnac.hzinfo.datasearch.soe.ISoeClient;
@@ -18,7 +17,6 @@ import com.hnac.hzinfo.datasearch.soe.domian.SoeData;
import com.hnac.hzinfo.datasearch.soe.domian.SoeQueryConditionByStation;
import com.hnac.hzinfo.sdk.core.response.HzPage;
import com.hnac.hzinfo.sdk.core.response.Result;
-
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.mp.base.BaseServiceImpl;
@@ -27,13 +25,13 @@ import org.springblade.core.tool.utils.CollectionUtil;
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.ObjectUtil;
import org.springblade.core.tool.utils.StringUtil;
+import org.springblade.system.entity.Dept;
import org.springblade.system.feign.ISysClient;
import org.springblade.system.user.entity.User;
import org.springblade.system.user.feign.IUserClient;
import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
-import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.concurrent.CompletableFuture;
import java.util.function.Function;
@@ -203,34 +201,46 @@ public class AbnormalAlarmServiceImpl extends BaseServiceImpl> result = userClient.userListByDeptId(depts.get(0));
- if(!result.isSuccess() || CollectionUtil.isEmpty(result.getData())){
+ List users = this.parentAuthUser(depts.get(0));
+ if(CollectionUtil.isEmpty(users)){
return;
}
- MessagePushRecordDto message = new MessagePushRecordDto();
+ BusinessMessageDTO message = new BusinessMessageDTO();
+ message.setDeptId(depts.get(0));
message.setBusinessClassify("warning");
message.setBusinessKey(MessageConstants.BusinessClassifyEnum.WARNING.getKey());
message.setSubject(MessageConstants.BusinessClassifyEnum.WARNING.getDescription());
message.setTaskId(entity.getId());
message.setTenantId("200000");
message.setContent(entity.getSoeExplain());
- message.setTypes(Arrays.asList(MessageConstants.APP_PUSH, MessageConstants.WS_PUSH));
- message.setPushType(MessageConstants.IMMEDIATELY);
- message.setDeptId(depts.get(0));
- message.setCreateDept(depts.get(0));
R deptName = sysClient.getDeptName(depts.get(0));
if (deptName.isSuccess()) {
message.setDeptName(deptName.getData());
}
User admin = userClient.userByAccount("200000", "admin").getData();
message.setCreateUser(admin.getId());
- result.getData().forEach(user->{
- message.setPusher(String.valueOf(user.getId()));
- message.setPusherName(user.getName());
- message.setAccount(String.valueOf(user.getId()));
- messageClient.sendMessage(message);
- });
+ messageClient.sendAppAndWsMsgByUsers(message);
});
}
+
+ /**
+ * 获取本级机构或者上级机构用户
+ * @param deptId
+ * @return
+ */
+ private List parentAuthUser(Long deptId) {
+ List users = new ArrayList<>();
+ R> selfs = userClient.userListByDeptId(deptId);
+ if(selfs.isSuccess() && CollectionUtil.isNotEmpty(selfs.getData())){
+ users.addAll(selfs.getData());
+ }
+ R dept = sysClient.getDept(deptId);
+ if(dept.isSuccess() && ObjectUtil.isNotEmpty(dept.getData())){
+ R> parents = userClient.userListByDeptId(deptId);
+ if(parents.isSuccess() && CollectionUtil.isNotEmpty(parents.getData())){
+ users.addAll(parents.getData().stream().filter(o->!users.stream().map(User::getId).collect(Collectors.toList()).contains(o.getId())).collect(Collectors.toList()));
+ }
+ }
+ return users;
+ }
}