Browse Source

MQ相关

Signed-off-by: liuyc <56808083@qq.com>
liuyc 1 year ago
parent
commit
9943e9ad6f
47 changed files with 1235 additions and 1031 deletions
  1. 8 0
      blade-common/src/main/java/org/springblade/common/constant/ClientIdConstant.java
  2. 28 3
      blade-common/src/main/java/org/springblade/common/constant/LauncherConstant.java
  3. 18 0
      blade-service-api/blade-archive-api/src/main/java/org/springblade/feign/ArchiveWebSocketClient.java
  4. 6 0
      blade-service-api/blade-business-api/src/main/java/org/springblade/business/dto/ArchiveTaskBatchRepealDTO.java
  5. 6 0
      blade-service-api/blade-business-api/src/main/java/org/springblade/business/dto/TaskArchiveOuterLayerDTO.java
  6. 0 4
      blade-service-api/blade-business-api/src/main/java/org/springblade/business/feign/ArchiveFileClient.java
  7. 19 0
      blade-service-api/blade-business-api/src/main/java/org/springblade/business/feign/BusinessWebSocketClient.java
  8. 5 0
      blade-service-api/blade-business-api/src/main/java/org/springblade/business/feign/OpinionUserClient.java
  9. 4 0
      blade-service-api/blade-business-api/src/main/java/org/springblade/business/feign/TaskClient.java
  10. 6 0
      blade-service-api/blade-business-api/src/main/java/org/springblade/business/vo/BatchTaskVO.java
  11. 18 0
      blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/feign/ManagerWebSocketClient.java
  12. 18 0
      blade-service-api/blade-meter-api/src/main/java/org/springblade/meter/feign/MeterWebSocketClient.java
  13. 1 27
      blade-service/blade-archive/src/main/java/org/springblade/archive/controller/ArchiveFileTaskController.java
  14. 25 0
      blade-service/blade-archive/src/main/java/org/springblade/archive/feign/ArchiveWebSocketClientImpl.java
  15. 7 0
      blade-service/blade-business/pom.xml
  16. 2 0
      blade-service/blade-business/src/main/java/org/springblade/BusinessApplication.java
  17. 27 39
      blade-service/blade-business/src/main/java/org/springblade/business/controller/ArchiveFileController.java
  18. 2 5
      blade-service/blade-business/src/main/java/org/springblade/business/controller/BusinessUserOpinionController.java
  19. 25 44
      blade-service/blade-business/src/main/java/org/springblade/business/controller/ContractLogController.java
  20. 31 35
      blade-service/blade-business/src/main/java/org/springblade/business/controller/InformationWriteQueryController.java
  21. 21 60
      blade-service/blade-business/src/main/java/org/springblade/business/controller/MessageWarningController.java
  22. 58 223
      blade-service/blade-business/src/main/java/org/springblade/business/controller/TaskController.java
  23. 15 27
      blade-service/blade-business/src/main/java/org/springblade/business/controller/UserOpinionController.java
  24. 0 46
      blade-service/blade-business/src/main/java/org/springblade/business/feignClient/ArchiveFileClientImpl.java
  25. 25 0
      blade-service/blade-business/src/main/java/org/springblade/business/feignClient/BusinessWebSocketClientImpl.java
  26. 14 0
      blade-service/blade-business/src/main/java/org/springblade/business/feignClient/OpinionUserClientImpl.java
  27. 17 10
      blade-service/blade-business/src/main/java/org/springblade/business/feignClient/TaskClientImpl.java
  28. 11 14
      blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TaskServiceImpl.java
  29. 0 202
      blade-service/blade-business/src/main/java/org/springblade/business/socket/WebSocket.java
  30. 0 196
      blade-service/blade-business/src/main/java/org/springblade/business/socket/WebSocketManager.java
  31. 138 92
      blade-service/blade-manager/src/main/java/org/springblade/manager/controller/ExcelTabController.java
  32. 24 0
      blade-service/blade-manager/src/main/java/org/springblade/manager/feign/ManagerWebSocketClientImpl.java
  33. 1 1
      blade-service/blade-meter/pom.xml
  34. 66 0
      blade-service/blade-rabbitmq-consumer/pom.xml
  35. 18 0
      blade-service/blade-rabbitmq-consumer/src/main/java/org/springblade/consumer/MQConsumerApplication.java
  36. 2 3
      blade-service/blade-rabbitmq-consumer/src/main/java/org/springblade/consumer/config/WebSocketConfig.java
  37. 60 0
      blade-service/blade-rabbitmq-consumer/src/main/java/org/springblade/consumer/service/RabbitMqConsumerService.java
  38. 213 0
      blade-service/blade-rabbitmq-consumer/src/main/java/org/springblade/consumer/socket/WebSocketEndpoint.java
  39. 11 0
      blade-service/blade-rabbitmq-consumer/src/main/resources/application-dev.yml
  40. 48 0
      blade-service/blade-rabbitmq-producer/pom.xml
  41. 18 0
      blade-service/blade-rabbitmq-producer/src/main/java/org/springblade/producer/MQProducerApplication.java
  42. 12 0
      blade-service/blade-rabbitmq-producer/src/main/java/org/springblade/producer/bean/PushMessage.java
  43. 127 0
      blade-service/blade-rabbitmq-producer/src/main/java/org/springblade/producer/bean/PushMessageAspect.java
  44. 30 0
      blade-service/blade-rabbitmq-producer/src/main/java/org/springblade/producer/config/RabbitMqConfig.java
  45. 37 0
      blade-service/blade-rabbitmq-producer/src/main/java/org/springblade/producer/service/RabbitMqProducerService.java
  46. 11 0
      blade-service/blade-rabbitmq-producer/src/main/resources/application-dev.yml
  47. 2 0
      blade-service/pom.xml

+ 8 - 0
blade-common/src/main/java/org/springblade/common/constant/ClientIdConstant.java

@@ -0,0 +1,8 @@
+package org.springblade.common.constant;
+
+public interface ClientIdConstant {
+    String ARCHIVE_CLIENT_ID = "archive";
+    String MANAGER_CLIENT_ID = "manager";
+    String BUSINESS_CLIENT_ID = "business";
+    String METER_CLIENT_ID = "meter";
+}

+ 28 - 3
blade-common/src/main/java/org/springblade/common/constant/LauncherConstant.java

@@ -27,16 +27,41 @@ import static org.springblade.core.launch.constant.AppConstant.APPLICATION_NAME_
  */
 public interface LauncherConstant {
 
-    String APPLICATION_MANAGER_NAME = APPLICATION_NAME_PREFIX + "manager"; /*后管*/
+    /**
+     * 后管
+     */
+    String APPLICATION_MANAGER_NAME = APPLICATION_NAME_PREFIX + "manager";
 
-    String APPLICATION_METER_NAME = APPLICATION_NAME_PREFIX + "meter"; /*计量*/
+    /**
+     * 计量
+     */
+    String APPLICATION_METER_NAME = APPLICATION_NAME_PREFIX + "meter";
 
-    String APPLICATION_ARCHIVE_NAME = APPLICATION_NAME_PREFIX + "archive"; /*档案*/
+    /**
+     * 档案
+     */
+    String APPLICATION_ARCHIVE_NAME = APPLICATION_NAME_PREFIX + "archive";
 
+    /**
+     * 大屏
+     */
     String APPLICATION_VISUAL_NAME = APPLICATION_NAME_PREFIX + "visual";
 
+    /**
+     * 征拆
+     */
     String APPLICATION_LAND_NAME = APPLICATION_NAME_PREFIX + "land";
 
+    /**
+     * MQ生产者
+     */
+    String APPLICATION_MQ_PRODUCER = APPLICATION_NAME_PREFIX + "rabbitmq-producer";
+
+    /**
+     * MQ消费者
+     */
+    String APPLICATION_MQ_CONSUMER = APPLICATION_NAME_PREFIX + "rabbitmq-consumer";
+
     /**
      * xxljob
      */

+ 18 - 0
blade-service-api/blade-archive-api/src/main/java/org/springblade/feign/ArchiveWebSocketClient.java

@@ -0,0 +1,18 @@
+package org.springblade.feign;
+
+import org.springblade.common.constant.LauncherConstant;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.stereotype.Component;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+
+import java.util.Map;
+
+@FeignClient(value = LauncherConstant.APPLICATION_ARCHIVE_NAME)
+@Component
+public interface ArchiveWebSocketClient {
+
+    @GetMapping(value = "/archive/getWebsocketMsg")
+    Map<String, String> getWebsocketMsg(@RequestParam String projectId, @RequestParam String contractId, @RequestParam String userIdResult);
+
+}

+ 6 - 0
blade-service-api/blade-business-api/src/main/java/org/springblade/business/dto/ArchiveTaskBatchRepealDTO.java

@@ -14,4 +14,10 @@ public class ArchiveTaskBatchRepealDTO implements Serializable {
     @ApiModelProperty(value = "数据ids,type=1时表示档案收集数据的ids;type=2时表示审批任务的ids;字符串逗号分割拼接")
     private String ids;
 
+    @ApiModelProperty(value = "项目id")
+    private String projectId;
+
+    @ApiModelProperty(value = "合同id")
+    private String contractId;
+
 }

+ 6 - 0
blade-service-api/blade-business-api/src/main/java/org/springblade/business/dto/TaskArchiveOuterLayerDTO.java

@@ -12,4 +12,10 @@ public class TaskArchiveOuterLayerDTO implements Serializable {
     @ApiModelProperty("档案批量审批入参集合")
     private List<TaskArchiveDTO> taskArchiveDtoList;
 
+    @ApiModelProperty(value = "项目id")
+    private String projectId;
+
+    @ApiModelProperty(value = "合同段id")
+    private String contractId;
+
 }

+ 0 - 4
blade-service-api/blade-business-api/src/main/java/org/springblade/business/feign/ArchiveFileClient.java

@@ -4,7 +4,6 @@ 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.metadata.IPage;
 import org.springblade.archive.dto.SendsWebSocketArchiveDTO;
 import org.springblade.business.entity.ArchiveFile;
 import org.springblade.business.vo.ArchiveFileVO;
@@ -151,7 +150,4 @@ public interface ArchiveFileClient {
     @PostMapping(API_PREFIX + "/updateById2")
     void updateById2(@RequestBody ArchiveFile archiveFile);
 
-    @PostMapping(API_PREFIX + "/sendWebSocketArchiveMsg")
-    void sendWebSocketArchiveMsg(@RequestBody SendsWebSocketArchiveDTO webSocketArchiveDTO) throws IOException;
-
 }

+ 19 - 0
blade-service-api/blade-business-api/src/main/java/org/springblade/business/feign/BusinessWebSocketClient.java

@@ -0,0 +1,19 @@
+package org.springblade.business.feign;
+
+
+import org.springblade.common.constant.BusinessConstant;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.stereotype.Component;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+
+import java.util.Map;
+
+@FeignClient(value = BusinessConstant.APPLICATION_WEATHER_NAME)
+@Component
+public interface BusinessWebSocketClient {
+
+    @GetMapping(value = "/business/getWebsocketMsg")
+    Map<String, String> getWebsocketMsg(@RequestParam String projectId, @RequestParam String contractId, @RequestParam String userIdResult);
+
+}

+ 5 - 0
blade-service-api/blade-business-api/src/main/java/org/springblade/business/feign/OpinionUserClient.java

@@ -13,6 +13,7 @@ import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestParam;
 
 import java.util.List;
+import java.util.Map;
 
 @FeignClient(value = BusinessConstant.APPLICATION_WEATHER_NAME)
 public interface OpinionUserClient {
@@ -88,4 +89,8 @@ public interface OpinionUserClient {
     @GetMapping(API_PREFIX + "/countUserAssessmentPageList")
     Integer countUserAssessmentPageList(@RequestBody AssessmentUserVOS vo);
 
+    /*获取后管任务信息*/
+    @GetMapping(API_PREFIX + "/getWebsocketMsg")
+    Map<String, String> getWebsocketMsg(@RequestParam String projectId, @RequestParam String contractId, @RequestParam String userIdResult);
+
 }

+ 4 - 0
blade-service-api/blade-business-api/src/main/java/org/springblade/business/feign/TaskClient.java

@@ -120,4 +120,8 @@ public interface TaskClient {
     @PostMapping(BATCH_RE_SIGN)
     R<Boolean> reSigningEVisa(@RequestParam String taskIds, @RequestParam String contractId,@RequestParam String projectId,@RequestParam String header);
 
+    /*获取档案任务*/
+    @GetMapping(value = "/getWebsocketMsgArchive")
+    Map<String, String> getWebsocketMsgArchive(@RequestParam String projectId,@RequestParam  String contractId,@RequestParam  String userIdResult);
+
 }

+ 6 - 0
blade-service-api/blade-business-api/src/main/java/org/springblade/business/vo/BatchTaskVO.java

@@ -24,4 +24,10 @@ public class BatchTaskVO {
     @ApiModelProperty("业务数据")
     private String formDataId;
 
+    @ApiModelProperty("项目id")
+    private String projectId;
+
+    @ApiModelProperty("合同段id")
+    private String contractId;
+
 }

+ 18 - 0
blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/feign/ManagerWebSocketClient.java

@@ -0,0 +1,18 @@
+package org.springblade.manager.feign;
+
+import org.springblade.common.constant.LauncherConstant;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.stereotype.Component;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+
+import java.util.Map;
+
+@FeignClient(value = LauncherConstant.APPLICATION_MANAGER_NAME)
+@Component
+public interface ManagerWebSocketClient {
+
+    @GetMapping(value = "/manager/getWebsocketMsg")
+    Map<String, String> getWebsocketMsg(@RequestParam String projectId, @RequestParam String contractId, @RequestParam String userIdResult);
+
+}

+ 18 - 0
blade-service-api/blade-meter-api/src/main/java/org/springblade/meter/feign/MeterWebSocketClient.java

@@ -0,0 +1,18 @@
+package org.springblade.meter.feign;
+
+import org.springblade.common.constant.LauncherConstant;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.stereotype.Component;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestParam;
+
+import java.util.Map;
+
+@FeignClient(value = LauncherConstant.APPLICATION_METER_NAME)
+@Component
+public interface MeterWebSocketClient {
+
+    @GetMapping(value = "/meter/getWebsocketMsg")
+    Map<String, String> getWebsocketMsg(@RequestParam String projectId, @RequestParam String contractId, @RequestParam String userIdResult);
+
+}

+ 1 - 27
blade-service/blade-archive/src/main/java/org/springblade/archive/controller/ArchiveFileTaskController.java

@@ -3,16 +3,12 @@ package org.springblade.archive.controller;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
-import com.itextpdf.text.Image;
-import com.itextpdf.text.Rectangle;
 import com.itextpdf.text.pdf.PdfReader;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.AllArgsConstructor;
 import org.apache.commons.lang.StringUtils;
-import org.apache.poi.util.IOUtils;
 import org.springblade.archive.dto.ArchiveTaskDTO;
-import org.springblade.archive.dto.SendsWebSocketArchiveDTO;
 import org.springblade.archive.vo.ArchiveTaskPageVO;
 import org.springblade.business.entity.ArchiveFile;
 import org.springblade.business.entity.Task;
@@ -34,7 +30,6 @@ import org.springblade.manager.feign.SignPfxClient;
 import org.springblade.system.user.entity.User;
 import org.springframework.jdbc.core.BeanPropertyRowMapper;
 import org.springframework.jdbc.core.JdbcTemplate;
-import org.springframework.scheduling.annotation.Async;
 import org.springframework.web.bind.annotation.*;
 
 import java.io.*;
@@ -51,7 +46,6 @@ public class ArchiveFileTaskController extends BladeController {
     private final JdbcTemplate jdbcTemplate;
     private final SignPfxClient signPfxClient;
     private final EVisaClient eVisaClient;
-    private final ArchiveFileClient archiveFileClient;
 
     /**
      * 批量认证(水印图片签章默认认证电签)
@@ -370,27 +364,7 @@ public class ArchiveFileTaskController extends BladeController {
                 .collect(Collectors.toList());
         page.setRecords(pageList);
         page.setTotal(totalCount);
-
-        R<IPage<ArchiveTaskPageVO>> iPageR = R.data(page);
-        //待办推送
-        /*if (dto.getSelectedType().equals(1)) {
-            if (ObjectUtil.isNotEmpty(iPageR.getData()) && ObjectUtil.isNotEmpty(iPageR.getData().getRecords()) && ObjectUtil.isNotEmpty(dto.getContractIdValue()) && ObjectUtil.isNotEmpty(dto.getProjectIdValue())) {
-                this.sendWebSocketArchiveMsg(new SendsWebSocketArchiveDTO(totalCount, 1, dto));
-            } else if (ObjectUtil.isNotEmpty(dto.getContractIdValue()) && ObjectUtil.isNotEmpty(dto.getProjectIdValue())) {
-                this.sendWebSocketArchiveMsg(new SendsWebSocketArchiveDTO(0, 2, dto));
-            }
-        }*/
-        return iPageR;
-    }
-
-    /**
-     * 推送消息
-     *
-     * @throws IOException
-     */
-    @Async
-    public void sendWebSocketArchiveMsg(SendsWebSocketArchiveDTO webSocketArchiveDTO) throws IOException {
-        archiveFileClient.sendWebSocketArchiveMsg(webSocketArchiveDTO);
+        return R.data(page);
     }
 
 }

+ 25 - 0
blade-service/blade-archive/src/main/java/org/springblade/archive/feign/ArchiveWebSocketClientImpl.java

@@ -0,0 +1,25 @@
+package org.springblade.archive.feign;
+
+import lombok.AllArgsConstructor;
+import org.springblade.business.feign.TaskClient;
+import org.springblade.core.tenant.annotation.NonDS;
+import org.springblade.feign.ArchiveWebSocketClient;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.Map;
+
+@RestController
+@AllArgsConstructor
+@NonDS
+public class ArchiveWebSocketClientImpl implements ArchiveWebSocketClient {
+
+    private final TaskClient taskClient;
+
+    @Override
+    @GetMapping(value = "/archive/getWebsocketMsg")
+    public Map<String, String> getWebsocketMsg(String projectId, String contractId, String userIdResult) {
+        return taskClient.getWebsocketMsgArchive(projectId, contractId, userIdResult);
+    }
+
+}

+ 7 - 0
blade-service/blade-business/pom.xml

@@ -167,6 +167,13 @@
             <scope>compile</scope>
         </dependency>
 
+        <dependency>
+            <groupId>org.springblade</groupId>
+            <artifactId>blade-rabbitmq-producer</artifactId>
+            <version>2.9.1.RELEASE</version>
+            <scope>compile</scope>
+        </dependency>
+
     </dependencies>
 
     <build>

+ 2 - 0
blade-service/blade-business/src/main/java/org/springblade/BusinessApplication.java

@@ -4,6 +4,8 @@ import org.springblade.common.constant.BusinessConstant;
 import org.springblade.core.cloud.feign.EnableBladeFeign;
 import org.springblade.core.launch.BladeApplication;
 import org.springframework.cloud.client.SpringCloudApplication;
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.context.annotation.EnableAspectJAutoProxy;
 import org.springframework.scheduling.annotation.EnableAsync;
 
 

+ 27 - 39
blade-service/blade-business/src/main/java/org/springblade/business/controller/ArchiveFileController.java

@@ -1,7 +1,6 @@
 package org.springblade.business.controller;
 
 import com.alibaba.excel.util.DateUtils;
-import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
@@ -20,12 +19,11 @@ import org.springblade.business.feign.MessageWarningClient;
 import org.springblade.business.feign.OperationLogClient;
 import org.springblade.business.feign.RecycleBinClient;
 import org.springblade.business.feign.TaskClient;
-import org.springblade.business.service.ITaskService;
-import org.springblade.business.socket.WebSocket;
 import org.springblade.business.utils.FileUtils;
 import org.springblade.business.vo.MessageWarningVO;
 import org.springblade.business.vo.StartTaskVO;
 import org.springblade.business.vo.TaskVO;
+import org.springblade.common.constant.ClientIdConstant;
 import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.tool.api.R;
 import org.springblade.core.tool.utils.Func;
@@ -37,8 +35,8 @@ import org.springblade.manager.entity.ProjectInfo;
 import org.springblade.manager.feign.ArchiveTreeClient;
 import org.springblade.manager.feign.ContractClient;
 import org.springblade.manager.feign.ProjectClient;
-import org.springblade.manager.vo.ArchiveTreeVO;
 import org.springblade.manager.vo.ArchiveTreeVO2;
+import org.springblade.producer.bean.PushMessage;
 import org.springblade.system.entity.Role;
 import org.springblade.system.feign.ISysClient;
 import org.springframework.beans.BeanUtils;
@@ -51,7 +49,6 @@ import org.springblade.business.service.IArchiveFileService;
 import org.springblade.core.boot.ctrl.BladeController;
 
 import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
 import java.util.*;
 import java.util.stream.Collectors;
 
@@ -87,10 +84,6 @@ public class ArchiveFileController extends BladeController {
 
     private final MessageWarningClient messageWarningClient;
 
-    private final ITaskService iTaskService;
-
-    private final WebSocket webSocket;
-
     /**
      * 批量认证(特殊签章 签个透明空白图片,主要目的是在验签的时候有验签信息 )
      */
@@ -165,9 +158,12 @@ public class ArchiveFileController extends BladeController {
     @PostMapping("batchAbolish")
     @ApiOperationSupport(order = 7)
     @ApiOperation(value = "批量废除")
-    public R<Boolean> batchAbolish(@RequestParam String ids) throws IOException {
+    @PushMessage(clientId = ClientIdConstant.BUSINESS_CLIENT_ID)
+    public R<Object> batchAbolish(@RequestParam String ids) {
         //获取所有相关任务记录
         List<Task> taskList = this.taskClient.queryTaskListByFormDataId(ids);
+
+        Set<String> aopParamsSet = new HashSet<>();
         if (taskList != null && taskList.size() > 0) {
             //执行废除
             for (Task task : taskList) {
@@ -202,14 +198,9 @@ public class ArchiveFileController extends BladeController {
                                 0
                         ));
 
-                        //通过WebSocket推送数量条数
                         if (ObjectUtil.isNotEmpty(archiveFile.getProjectId()) && ObjectUtil.isNotEmpty(archiveFile.getContractId()) && ObjectUtil.isNotEmpty(archiveFile.getCreateUser())) {
-                            Map<String, String> stringMap = iTaskService.getTaskCount(archiveFile.getProjectId(), archiveFile.getContractId(), archiveFile.getCreateUser().toString());
-                            try {
-                                webSocket.sendMessageByUserId(archiveFile.getCreateUser().toString(), JSON.toJSONString(stringMap));
-                            } catch (IOException e) {
-                                e.printStackTrace();
-                            }
+                            String param = archiveFile.getCreateUser() + "," + archiveFile.getProjectId() + "," + archiveFile.getContractId();
+                            aopParamsSet.add(param);
                         }
 
                         //保存操作记录
@@ -238,18 +229,12 @@ public class ArchiveFileController extends BladeController {
                             if (messageList.size() > 0) {
                                 this.messageWarningClient.savePushUserMessageWarning(messageList);
 
-                                //通过WebSocket推送数量条数
                                 for (MessageWarning messageWarning : messageList) {
                                     if (ObjectUtil.isNotEmpty(messageWarning.getProjectId()) && ObjectUtil.isNotEmpty(messageWarning.getContractId()) && ObjectUtil.isNotEmpty(messageWarning.getPushUser())) {
-                                        Map<String, String> stringMap = iTaskService.getTaskCount(messageWarning.getProjectId().toString(), messageWarning.getContractId().toString(), messageWarning.getPushUser().toString());
-                                        try {
-                                            webSocket.sendMessageByUserId(messageWarning.getPushUser().toString(), JSON.toJSONString(stringMap));
-                                        } catch (IOException e) {
-                                            e.printStackTrace();
-                                        }
+                                        String param = messageWarning.getPushUser() + "," + messageWarning.getProjectId() + "," + messageWarning.getContractId();
+                                        aopParamsSet.add(param);
                                     }
                                 }
-
                             }
                         }
                     } catch (Exception e) {
@@ -258,7 +243,7 @@ public class ArchiveFileController extends BladeController {
                 }
             }
 
-            return R.data(true);
+            return R.data(200, aopParamsSet, "操作成功");
         }
 
         return R.data(false);
@@ -270,7 +255,8 @@ public class ArchiveFileController extends BladeController {
     @PostMapping("/batchApproval")
     @ApiOperationSupport(order = 6)
     @ApiOperation(value = "批量上报")
-    public R<Boolean> batchApproval(@RequestBody StartTaskVO startTaskVO) throws IOException {
+    @PushMessage(clientId = ClientIdConstant.BUSINESS_CLIENT_ID)
+    public R<Object> batchApproval(@RequestBody StartTaskVO startTaskVO) {
         String archiveTaskIds = startTaskVO.getIds();
         if (StringUtils.isNotEmpty(archiveTaskIds)) {
             //生成流程实体
@@ -302,14 +288,14 @@ public class ArchiveFileController extends BladeController {
             String[] archiveTaskIdArray = archiveTaskIds.split(",");
             boolean update = this.archiveFileService.update(Wrappers.<ArchiveFile>lambdaUpdate().set(ArchiveFile::getStatus, 1).in(ArchiveFile::getId, Arrays.asList(archiveTaskIdArray)));
             if (update) {
-                //通过WebSocket推送数量条数
+                Set<String> aopParamsSet = new HashSet<>();
                 if (ObjectUtil.isNotEmpty(startTaskVO.getUserTasks())) {
                     for (StartTaskVO.CustomUserTask userTask : startTaskVO.getUserTasks()) {
-                        Map<String, String> stringMap = iTaskService.getTaskCount(startTaskVO.getProjectId(), startTaskVO.getContractId(), userTask.getUserId());
-                        webSocket.sendMessageByUserId(userTask.getUserId(), JSON.toJSONString(stringMap));
+                        String param = userTask.getUserId() + "," + startTaskVO.getProjectId() + "," + startTaskVO.getContractId();
+                        aopParamsSet.add(param);
                     }
                 }
-                return R.data(true);
+                return R.data(200, aopParamsSet, "操作成功");
             }
         }
         return R.data(false);
@@ -321,9 +307,11 @@ public class ArchiveFileController extends BladeController {
     @PostMapping("/batchApproval2")
     @ApiOperationSupport(order = 6)
     @ApiOperation(value = "批量上报")
-    public R<Boolean> batchApproval2(@RequestBody StartTaskVO startTaskVO) throws IOException {
+    @PushMessage(clientId = ClientIdConstant.BUSINESS_CLIENT_ID)
+    public R<Object> batchApproval2(@RequestBody StartTaskVO startTaskVO) {
         String archiveTaskIds = startTaskVO.getIds();
         if (StringUtils.isNotEmpty(archiveTaskIds)) {
+            Set<String> aopParamsSet = new HashSet<>();
             String[] ids = archiveTaskIds.split(",");
             for (String id : ids) {
                 //生成流程实体
@@ -344,11 +332,10 @@ public class ArchiveFileController extends BladeController {
                 String[] archiveTaskIdArray = id.split(",");
                 boolean update = this.archiveFileService.update(Wrappers.<ArchiveFile>lambdaUpdate().set(ArchiveFile::getStatus, 1).in(ArchiveFile::getId, Arrays.asList(archiveTaskIdArray)));
                 if (update) {
-                    //通过WebSocket推送数量条数
                     if (ObjectUtil.isNotEmpty(startTaskVO.getUserTasks())) {
                         for (StartTaskVO.CustomUserTask userTask : startTaskVO.getUserTasks()) {
-                            Map<String, String> stringMap = iTaskService.getTaskCount(startTaskVO.getProjectId(), startTaskVO.getContractId(), userTask.getUserId());
-                            webSocket.sendMessageByUserId(userTask.getUserId(), JSON.toJSONString(stringMap));
+                            String param = userTask.getUserId() + "," + startTaskVO.getProjectId() + "," + startTaskVO.getContractId();
+                            aopParamsSet.add(param);
                         }
                     }
                 }
@@ -357,7 +344,7 @@ public class ArchiveFileController extends BladeController {
             StringBuilder builder = new StringBuilder();
             if (archiveFiles != null && archiveFiles.size() > 0) {
                 for (ArchiveFile archiveFile : archiveFiles) {
-                    builder.append(archiveFile.getFileName() + "-");
+                    builder.append(archiveFile.getFileName()).append("-");
                 }
             }
             String title = builder.toString();
@@ -366,7 +353,8 @@ public class ArchiveFileController extends BladeController {
             json.put("operationObjIds", Func.toStrList(archiveTaskIds));
             json.put("operationObjName", title.substring(0, title.length() - 1));
             this.operationLogClient.saveUserOperationLog(25, "其它文件", "工程文件", json);
-            return R.data(true);
+
+            return R.data(200, aopParamsSet, "操作成功");
         }
         return R.data(false);
     }
@@ -382,10 +370,10 @@ public class ArchiveFileController extends BladeController {
         list.stream().forEach(l -> {
             if (l.getIsNeedCertification() == 0) {
                 l.setIsCertification(1);
-            }else {
+            } else {
                 l.setIsCertification(0);
             }
-            if (l.getIsApproval() == 0){
+            if (l.getIsApproval() == 0) {
                 l.setStatus(2);
             }
         });

+ 2 - 5
blade-service/blade-business/src/main/java/org/springblade/business/controller/BusinessUserOpinionController.java

@@ -1,6 +1,5 @@
 package org.springblade.business.controller;
 
-import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
@@ -19,7 +18,6 @@ import org.springblade.business.service.ITaskService;
 import org.springblade.business.service.IUserOpinionFileService;
 import org.springblade.business.service.IUserOpinionFlowService;
 import org.springblade.business.service.IUserOpinionService;
-import org.springblade.business.socket.WebSocket;
 import org.springblade.business.vo.AssessmentUserVOS;
 import org.springblade.business.vo.BusinessUserOpinionVO;
 import org.springblade.business.vo.MessageWarningVO;
@@ -33,7 +31,6 @@ import org.springblade.core.tool.utils.DateUtil;
 import org.springblade.core.tool.utils.ObjectUtil;
 import org.springframework.web.bind.annotation.*;
 
-import java.io.IOException;
 import java.util.Date;
 import java.util.List;
 import java.util.Map;
@@ -55,7 +52,7 @@ public class BusinessUserOpinionController {
 
     private final ITaskService iTaskService;
 
-    private final WebSocket webSocket;
+    //private final MessagePushClient messagePushClient;
 
     /**
      * isIgnore
@@ -214,7 +211,7 @@ public class BusinessUserOpinionController {
                 //通过WebSocket推送数量条数推送给反馈人
                 if (ObjectUtil.isNotEmpty(userOpinion.getProjectId()) && ObjectUtil.isNotEmpty(userOpinion.getContractId()) && ObjectUtil.isNotEmpty(userOpinion.getCreateUser())) {
                     Map<String, String> stringMap = iTaskService.getTaskCount(userOpinion.getProjectId().toString(), userOpinion.getContractId().toString(), userOpinion.getCreateUser().toString());
-                    webSocket.sendMessageByUserId(userOpinion.getCreateUser().toString(), JSON.toJSONString(stringMap));
+                    //messagePushClient.pushMessageToUser(userOpinion.getCreateUser().toString(), JSON.toJSONString(stringMap));
                 }
 
             } catch (Exception e) {

+ 25 - 44
blade-service/blade-business/src/main/java/org/springblade/business/controller/ContractLogController.java

@@ -1,6 +1,5 @@
 package org.springblade.business.controller;
 
-import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
@@ -18,17 +17,15 @@ import org.springblade.business.feign.MessageWarningClient;
 import org.springblade.business.feign.OperationLogClient;
 import org.springblade.business.feign.TaskClient;
 import org.springblade.business.service.IContractLogWbsService;
-import org.springblade.business.service.ITaskService;
-import org.springblade.business.socket.WebSocket;
 import org.springblade.business.utils.FileUtils;
 import org.springblade.business.utils.YearTreeUtils;
 import org.springblade.business.vo.*;
+import org.springblade.common.constant.ClientIdConstant;
 import org.springblade.common.constant.CommonConstant;
 import org.springblade.common.utils.SnowFlakeUtil;
 import org.springblade.core.log.exception.ServiceException;
 import org.springblade.core.oss.model.BladeFile;
 import org.springblade.core.secure.utils.AuthUtil;
-import org.springblade.core.secure.utils.SecureUtil;
 import org.springblade.core.tool.api.R;
 import org.springblade.core.tool.utils.Func;
 import org.springblade.core.tool.utils.ObjectUtil;
@@ -39,6 +36,7 @@ import org.springblade.manager.feign.ContractClient;
 import org.springblade.manager.feign.ProjectClient;
 import org.springblade.manager.feign.WbsTreeContractClient;
 import org.springblade.manager.vo.WbsTreeContractTreeVOS;
+import org.springblade.producer.bean.PushMessage;
 import org.springblade.resource.feign.NewIOSSClient;
 import org.springblade.system.cache.ParamCache;
 import org.springframework.beans.BeanUtils;
@@ -47,7 +45,6 @@ import org.springframework.jdbc.core.JdbcTemplate;
 import org.springframework.web.bind.annotation.*;
 import org.springblade.business.service.IContractLogService;
 import org.springblade.core.boot.ctrl.BladeController;
-import springfox.documentation.spring.web.json.Json;
 
 import java.io.IOException;
 import java.util.*;
@@ -83,10 +80,6 @@ public class ContractLogController extends BladeController {
 
     private final ProjectClient projectClient;
 
-    private final ITaskService iTaskService;
-
-    private final WebSocket webSocket;
-
     private final JdbcTemplate jdbcTemplate;
 
     /**
@@ -185,7 +178,8 @@ public class ContractLogController extends BladeController {
             @ApiImplicitParam(name = "nodePrimaryKeyId", value = "当前操作的日志类型ID,即左侧列表的节点primaryKeyId", required = true),
             @ApiImplicitParam(name = "recordTime", value = "当前选择的填写日期,即右侧日期控件所选日期,格式为 yyyy-MM-dd", required = true)
     })
-    public R<Boolean> oneAbolish(@RequestParam String nodePrimaryKeyId, @RequestParam String recordTime, @RequestParam String contractId) throws IOException {
+    @PushMessage(clientId = ClientIdConstant.BUSINESS_CLIENT_ID)
+    public R<Object> oneAbolish(@RequestParam String nodePrimaryKeyId, @RequestParam String recordTime, @RequestParam String contractId) throws IOException {
         //查询数据
         ContractLog log = this.contractLogService.getOne(Wrappers.<ContractLog>lambdaQuery().eq(ContractLog::getWbsNodeId, nodePrimaryKeyId)
                 .eq(ContractLog::getCreateUser, AuthUtil.getUserId())
@@ -288,8 +282,8 @@ public class ContractLogController extends BladeController {
             @ApiImplicitParam(name = "nodePrimaryKeyId", value = "当前操作的日志类型ID,即左侧列表的节点primaryKeyId", required = true),
             @ApiImplicitParam(name = "recordTime", value = "当前选择的填写日期,即右侧日期控件所选日期,格式为 yyyy-MM-dd", required = true)
     })
-    public R<Boolean> startTaskTheLog(@RequestBody JSONObject json) throws IOException {
-
+    @PushMessage(clientId = ClientIdConstant.BUSINESS_CLIENT_ID)
+    public R<Object> startTaskTheLog(@RequestBody JSONObject json) {
         if (json != null) {
             StartTaskVO startTaskVO = JSONObject.parseObject(JSONObject.toJSONString(json), StartTaskVO.class);
 
@@ -318,10 +312,9 @@ public class ContractLogController extends BladeController {
                 }
                 startTaskVO.setIds(String.valueOf(log.getId()));
             }
-            return this.batchTask(startTaskVO);
 
+            return this.batchTask(startTaskVO);
         }
-
         return R.data(300, false, "上报失败");
     }
 
@@ -406,10 +399,12 @@ public class ContractLogController extends BladeController {
     @PostMapping("/batchAbolish")
     @ApiOperationSupport(order = 5)
     @ApiOperation(value = "批量废除")
-    public R<Boolean> batchAbolish(@RequestParam String ids) throws IOException {
+    @PushMessage(clientId = ClientIdConstant.BUSINESS_CLIENT_ID)
+    public R<Object> batchAbolish(@RequestParam String ids) {
         //获取所有相关任务记录
         List<Task> taskList = this.taskClient.queryTaskListByFormDataId(ids);
         if (taskList != null && taskList.size() > 0) {
+            Set<String> aopParamsSet = new HashSet<>();
             //执行废除
             for (Task task : taskList) {
                 if (new Integer("1").equals(task.getStatus())) {
@@ -446,14 +441,9 @@ public class ContractLogController extends BladeController {
                                 0
                         ));
 
-                        //通过WebSocket推送数量条数
                         if (ObjectUtil.isNotEmpty(contractLog.getProjectId()) && ObjectUtil.isNotEmpty(contractLog.getContractId()) && ObjectUtil.isNotEmpty(contractLog.getCreateUser())) {
-                            Map<String, String> stringMap = iTaskService.getTaskCount(contractLog.getProjectId().toString(), contractLog.getContractId().toString(), contractLog.getCreateUser().toString());
-                            try {
-                                webSocket.sendMessageByUserId(contractLog.getCreateUser().toString(), JSON.toJSONString(stringMap));
-                            } catch (IOException e) {
-                                e.printStackTrace();
-                            }
+                            String param = contractLog.getCreateUser() + "," + contractLog.getProjectId() + "," + contractLog.getContractId();
+                            aopParamsSet.add(param);
                         }
 
                         //保存操作记录
@@ -495,40 +485,30 @@ public class ContractLogController extends BladeController {
                         if (messageList.size() > 0) {
                             this.messageWarningClient.savePushUserMessageWarning(messageList);
 
-                            //通过WebSocket推送数量条数 给上报任务人
                             for (MessageWarning messageWarning : messageList) {
                                 if (ObjectUtil.isNotEmpty(messageWarning.getProjectId()) && ObjectUtil.isNotEmpty(messageWarning.getContractId()) && ObjectUtil.isNotEmpty(messageWarning.getPushUser())) {
-                                    Map<String, String> stringMap = iTaskService.getTaskCount(messageWarning.getProjectId().toString(), messageWarning.getContractId().toString(), messageWarning.getPushUser().toString());
-                                    try {
-                                        webSocket.sendMessageByUserId(messageWarning.getPushUser().toString(), JSON.toJSONString(stringMap));
-                                    } catch (IOException e) {
-                                        e.printStackTrace();
-                                    }
+                                    String param = messageWarning.getPushUser() + "," + messageWarning.getProjectId() + "," + messageWarning.getContractId();
+                                    aopParamsSet.add(param);
                                 }
                             }
 
-                            //通过WebSocket推送数量条数 给日志记录人
+                            /*日志人*/
                             List<ContractLog> logs = contractLogService.getBaseMapper().selectList(Wrappers.<ContractLog>lambdaQuery().in(ContractLog::getId, ids));
                             for (ContractLog log : logs) {
                                 if (ObjectUtil.isNotEmpty(log.getProjectId()) && ObjectUtil.isNotEmpty(log.getContractId()) && ObjectUtil.isNotEmpty(log.getCreateUser())) {
-                                    Map<String, String> stringMap = iTaskService.getTaskCount(log.getProjectId().toString(), log.getContractId().toString(), log.getCreateUser().toString());
-                                    try {
-                                        webSocket.sendMessageByUserId(log.getCreateUser().toString(), JSON.toJSONString(stringMap));
-                                    } catch (IOException e) {
-                                        e.printStackTrace();
-                                    }
+                                    String param = log.getCreateUser() + "," + log.getProjectId() + "," + log.getContractId();
+                                    aopParamsSet.add(param);
                                 }
                             }
-
                         }
                     }
                 } catch (Exception e) {
                     e.printStackTrace();
                 }
             }
+            return R.data(200, aopParamsSet, "操作成功");
         }
-
-        return R.data(true);
+        return R.fail("操作失败");
     }
 
     /**
@@ -537,11 +517,13 @@ public class ContractLogController extends BladeController {
     @PostMapping("/batchTask")
     @ApiOperationSupport(order = 4)
     @ApiOperation(value = "批量上报")
-    public R<Boolean> batchTask(@RequestBody StartTaskVO startTaskVO) throws IOException {
+    @PushMessage(clientId = ClientIdConstant.BUSINESS_CLIENT_ID)
+    public R<Object> batchTask(@RequestBody StartTaskVO startTaskVO) {
         if (StringUtils.isNotEmpty(startTaskVO.getIds())) {
             //获取数据源id
             String[] ids = startTaskVO.getIds().split(",");
             if (ids.length > 0) {
+                Set<String> aopParamsSet = new HashSet<>();
                 List<ContractLog> logList = this.contractLogService.list(Wrappers.<ContractLog>lambdaQuery().in(ContractLog::getId, Arrays.asList(ids)));
                 Map<String, String> logMap = new HashMap<>();
                 logList.forEach(log -> logMap.put(log.getId().toString(), log.getFileName()));
@@ -600,15 +582,14 @@ public class ContractLogController extends BladeController {
                     e.printStackTrace();
                 }
 
-                //通过WebSocket推送数量条数
                 if (ObjectUtil.isNotEmpty(startTaskVO.getUserTasks())) {
                     for (StartTaskVO.CustomUserTask userTask : startTaskVO.getUserTasks()) {
-                        Map<String, String> stringMap = iTaskService.getTaskCount(startTaskVO.getProjectId(), startTaskVO.getContractId(), userTask.getUserId());
-                        webSocket.sendMessageByUserId(userTask.getUserId(), JSON.toJSONString(stringMap));
+                        String param = userTask.getUserId() + "," + startTaskVO.getProjectId() + "," + startTaskVO.getContractId();
+                        aopParamsSet.add(param);
                     }
                 }
 
-                return R.data(true);
+                return R.data(200, aopParamsSet, "操作成功");
             }
         }
         return R.data(false);

+ 31 - 35
blade-service/blade-business/src/main/java/org/springblade/business/controller/InformationWriteQueryController.java

@@ -22,9 +22,9 @@ import org.springblade.business.feign.RecycleBinClient;
 import org.springblade.business.feign.TaskClient;
 import org.springblade.business.mapper.InformationQueryMapper;
 import org.springblade.business.service.*;
-import org.springblade.business.socket.WebSocket;
 import org.springblade.business.utils.FileUtils;
 import org.springblade.business.vo.*;
+import org.springblade.common.constant.ClientIdConstant;
 import org.springblade.common.constant.CommonConstant;
 import org.springblade.common.utils.BaseUtils;
 import org.springblade.common.utils.CommonUtil;
@@ -35,6 +35,7 @@ import org.springblade.core.mp.support.Condition;
 import org.springblade.core.mp.support.Query;
 import org.springblade.core.oss.model.BladeFile;
 import org.springblade.core.secure.utils.AuthUtil;
+import org.springblade.core.secure.utils.SecureUtil;
 import org.springblade.core.tool.api.R;
 import org.springblade.core.tool.node.ForestNodeMerger;
 import org.springblade.core.tool.utils.*;
@@ -46,6 +47,7 @@ import org.springblade.manager.entity.*;
 import org.springblade.manager.feign.*;
 import org.springblade.manager.vo.WbsTreeContractTreeVOS;
 import org.springblade.manager.vo.WbsTreeContractVO8;
+import org.springblade.producer.bean.PushMessage;
 import org.springblade.resource.feign.NewIOSSClient;
 import org.springblade.system.cache.ParamCache;
 import org.springblade.system.entity.DictBiz;
@@ -61,7 +63,6 @@ import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletResponse;
 import javax.validation.Valid;
-import java.io.IOException;
 import java.sql.ResultSet;
 import java.sql.ResultSetMetaData;
 import java.sql.SQLException;
@@ -115,8 +116,6 @@ public class InformationWriteQueryController extends BladeController {
 
     private final ITaskService iTaskService;
 
-    private final WebSocket webSocket;
-
     private final TableFileClient tableFileClient;
 
     private final ITreeContractFirstService treeContractFirstService;
@@ -582,18 +581,19 @@ public class InformationWriteQueryController extends BladeController {
     @PostMapping("/abolishOne")
     @ApiOperationSupport(order = 24)
     @ApiOperation(value = "单个废除")
-    public R<Boolean> abolishOne(@RequestParam String primaryKeyId, @RequestParam String classify) {
+    @PushMessage(clientId = ClientIdConstant.BUSINESS_CLIENT_ID)
+    public R<Object> abolishOne(@RequestParam String primaryKeyId, @RequestParam String classify, @RequestParam String projectId, @RequestParam String contractId) {
         //查询填报状态
         InformationQuery businessData = this.informationQueryService.getOne(Wrappers.<InformationQuery>lambdaQuery().eq(InformationQuery::getWbsId, primaryKeyId).eq(InformationQuery::getClassify, classify).eq(InformationQuery::getType, 1));
         if (businessData != null) {
             //使用批量废除接口
-            return this.batchAbolish(businessData.getId().toString(), primaryKeyId);
+            return this.batchAbolish(businessData.getId().toString(), primaryKeyId, projectId, contractId);
         } else {
             //试验
             InformationQuery businessDataTrial = this.informationQueryService.getOne(Wrappers.<InformationQuery>lambdaQuery().eq(InformationQuery::getWbsId, primaryKeyId).eq(InformationQuery::getClassify, classify).eq(InformationQuery::getType, 2));
             if (businessDataTrial != null) {
                 //使用批量废除接口
-                return this.batchAbolish(businessDataTrial.getId().toString(), primaryKeyId);
+                return this.batchAbolish(businessDataTrial.getId().toString(), primaryKeyId, projectId, contractId);
             }
         }
         return R.data(300, false, "废除失败,未找到业务数据");
@@ -605,13 +605,14 @@ public class InformationWriteQueryController extends BladeController {
     @PostMapping("/abolishOne-sj")
     @ApiOperationSupport(order = 24)
     @ApiOperation(value = "单个废除-首件")
-    public R<Boolean> abolishOneSJ(@RequestParam String primaryKeyId, @RequestParam String id) {
+    @PushMessage(clientId = ClientIdConstant.BUSINESS_CLIENT_ID)
+    public R<Object> abolishOneSJ(@RequestParam String primaryKeyId, @RequestParam String id, @RequestParam String projectId, @RequestParam String contractId) {
         //查询填报状态
         InformationQuery businessData = this.informationQueryService.getOne(Wrappers.<InformationQuery>lambdaQuery()
                 .eq(InformationQuery::getId, id));
         if (businessData != null) {
             //使用批量废除接口
-            return this.batchAbolish(businessData.getId().toString(), primaryKeyId);
+            return this.batchAbolish(businessData.getId().toString(), primaryKeyId, projectId, contractId);
         }
         return R.data(300, false, "废除失败,未找到业务数据");
     }
@@ -873,7 +874,8 @@ public class InformationWriteQueryController extends BladeController {
     @PostMapping("/taskOne")
     @ApiOperationSupport(order = 22)
     @ApiOperation(value = "填报页单个上报")
-    public R<Boolean> taskOne(@RequestBody StartTaskVO startTaskVO) throws IOException {
+    @PushMessage(clientId = ClientIdConstant.BUSINESS_CLIENT_ID)
+    public R<Object> taskOne(@RequestBody StartTaskVO startTaskVO) {
         InformationQuery businessData;
         //此时的ids是当前节点的primaryKeyId但并不是业务数据ID,需要根据ids和classify去查询具体的业务ID
         if (ObjectUtil.isNotEmpty(startTaskVO.getTrialSelfInspectionRecordId())) {
@@ -1023,7 +1025,11 @@ public class InformationWriteQueryController extends BladeController {
     @PostMapping("/batchAbolish")
     @ApiOperationSupport(order = 18)
     @ApiOperation(value = "批量废除", notes = "质检的ids,试验的记录ids")
-    public R<Boolean> batchAbolish(@RequestParam String ids, String primaryKeyId) {
+    @PushMessage(clientId = ClientIdConstant.BUSINESS_CLIENT_ID)
+    public R<Object> batchAbolish(@RequestParam String ids, String primaryKeyId, @RequestParam String projectId, @RequestParam String contractId) {
+        Set<String> aopParamsSet = new HashSet<>();
+        aopParamsSet.add(SecureUtil.getUserId() + "," + projectId + "," + contractId);
+
         //获取所有相关任务记录
         List<Task> taskList = this.taskClient.queryTaskListByFormDataId(ids);
 
@@ -1111,14 +1117,9 @@ public class InformationWriteQueryController extends BladeController {
                                                         0
                                                 ));
 
-                                        //通过WebSocket推送数量条数
                                         if (ObjectUtil.isNotEmpty(query.getProjectId()) && ObjectUtil.isNotEmpty(query.getContractId()) && ObjectUtil.isNotEmpty(strs[0])) {
-                                            Map<String, String> stringMap = iTaskService.getTaskCount(query.getProjectId().toString(), query.getContractId().toString(), strs[0]);
-                                            try {
-                                                webSocket.sendMessageByUserId(strs[0], JSON.toJSONString(stringMap));
-                                            } catch (IOException e) {
-                                                e.printStackTrace();
-                                            }
+                                            String param = strs[0] + "," + query.getProjectId() + "," + query.getContractId();
+                                            aopParamsSet.add(param);
                                         }
 
                                     } catch (Exception e) {
@@ -1149,15 +1150,10 @@ public class InformationWriteQueryController extends BladeController {
                                 if (messageList.size() > 0) {
                                     this.messageWarningClient.savePushUserMessageWarning(messageList);
 
-                                    //通过WebSocket推送数量条数
                                     for (MessageWarning messageWarning : messageList) {
                                         if (ObjectUtil.isNotEmpty(messageWarning.getProjectId()) && ObjectUtil.isNotEmpty(messageWarning.getContractId()) && ObjectUtil.isNotEmpty(messageWarning.getPushUser())) {
-                                            Map<String, String> stringMap = iTaskService.getTaskCount(messageWarning.getProjectId().toString(), messageWarning.getContractId().toString(), messageWarning.getPushUser().toString());
-                                            try {
-                                                webSocket.sendMessageByUserId(messageWarning.getPushUser().toString(), JSON.toJSONString(stringMap));
-                                            } catch (IOException e) {
-                                                e.printStackTrace();
-                                            }
+                                            String param = messageWarning.getPushUser() + "," + messageWarning.getProjectId() + "," + messageWarning.getContractId();
+                                            aopParamsSet.add(param);
                                         }
                                     }
                                 }
@@ -1167,8 +1163,8 @@ public class InformationWriteQueryController extends BladeController {
                         }
 
                         //更新Redis缓存
-                        for (Long contractId : contractIds) {
-                            informationQueryService.delAsyncWbsTree(contractId + "");
+                        for (Long contractId1 : contractIds) {
+                            informationQueryService.delAsyncWbsTree(contractId1 + "");
                         }
                     }
 
@@ -1195,13 +1191,13 @@ public class InformationWriteQueryController extends BladeController {
                 }
                 jdbcTemplate.execute(sql);
 
-                return R.data(true, "废除成功");
+                return R.data(200, aopParamsSet, "废除成功");
+
             } catch (Exception e) {
                 e.printStackTrace();
                 return R.data(300, false, "废除失败");
             }
         }
-
         return R.data(300, false, "未获取到任务信息,废除失败");
     }
 
@@ -1211,7 +1207,8 @@ public class InformationWriteQueryController extends BladeController {
     @PostMapping("/batchTask")
     @ApiOperationSupport(order = 17)
     @ApiOperation(value = "批量上报")
-    public R<Boolean> batchTask(@RequestBody StartTaskVO startTaskVO) throws IOException {
+    @PushMessage(clientId = ClientIdConstant.BUSINESS_CLIENT_ID)
+    public R<Object> batchTask(@RequestBody StartTaskVO startTaskVO) {
         if (StringUtils.isNotEmpty(startTaskVO.getIds())) {
             //获取数据源id
             String[] ids = startTaskVO.getIds().split(",");
@@ -1323,18 +1320,17 @@ public class InformationWriteQueryController extends BladeController {
                     e.printStackTrace();
                 }
 
-                //通过WebSocket推送数量条数
+                Set<String> aopParamsSet = new HashSet<>();
                 if (startTaskVO.getUserTasks() != null) {
                     for (StartTaskVO.CustomUserTask userTask : startTaskVO.getUserTasks()) {
-                        Map<String, String> stringMap = iTaskService.getTaskCount(startTaskVO.getProjectId(), startTaskVO.getContractId(), userTask.getUserId());
-                        webSocket.sendMessageByUserId(userTask.getUserId(), JSON.toJSONString(stringMap));
+                        String param = userTask.getUserId() + "," + startTaskVO.getProjectId() + "," + startTaskVO.getContractId();
+                        aopParamsSet.add(param);
                     }
                 }
 
-                //更新Redis缓存
                 informationQueryService.delAsyncWbsTree(startTaskVO.getContractId());
 
-                return R.data(true);
+                return R.data(200, aopParamsSet, "操作成功");
             }
         }
         return R.fail("上报失败,没有找到选中数据的id");

+ 21 - 60
blade-service/blade-business/src/main/java/org/springblade/business/controller/MessageWarningController.java

@@ -16,7 +16,6 @@
  */
 package org.springblade.business.controller;
 
-import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
@@ -28,20 +27,17 @@ import lombok.AllArgsConstructor;
 
 import org.apache.commons.lang.StringUtils;
 import org.apache.commons.lang.time.DateUtils;
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
 import org.springblade.business.entity.MessageWarning;
-import org.springblade.business.service.ITaskService;
-import org.springblade.business.socket.WebSocket;
 import org.springblade.business.vo.MessageWarningVO;
 import org.springblade.business.wrapper.MessageWarningWrapper;
+import org.springblade.common.constant.ClientIdConstant;
 import org.springblade.core.mp.support.Condition;
 import org.springblade.core.mp.support.Query;
 import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.tool.api.R;
 import org.springblade.core.tool.utils.DateUtil;
 import org.springblade.core.tool.utils.Func;
-import org.springblade.core.tool.utils.ObjectUtil;
+import org.springblade.producer.bean.PushMessage;
 import org.springblade.system.entity.DictBiz;
 import org.springblade.system.feign.IDictBizClient;
 import org.springframework.web.bind.annotation.*;
@@ -65,47 +61,27 @@ import java.util.*;
 @Api(value = "消息提醒", tags = "消息提醒接口")
 public class MessageWarningController extends BladeController {
 
-    private final static Logger logger = LogManager.getLogger(MessageWarningController.class);
-
     private final IMessageWarningService messageWarningService;
 
     private final IDictBizClient dictBizClient;
 
-    private final ITaskService iTaskService;
-
-    private final WebSocket webSocket;
-
     /**
      * 标记已读
      */
     @PostMapping("/setMessageWarningRead")
-    @ApiOperationSupport(order = 5)
+    @ApiOperationSupport(order = 1)
     @ApiOperation(value = "标记已读")
-    public R<Boolean> setMessageWarningRead(MessageWarningVO vo) {
+    @PushMessage(clientId = ClientIdConstant.BUSINESS_CLIENT_ID)
+    public R<Object> setMessageWarningRead(MessageWarningVO vo) {
         if (vo.getIds() != null && vo.getIds().size() > 0) {
             try {
-                this.messageWarningService.update(Wrappers.<MessageWarning>lambdaUpdate().set(MessageWarning::getIsRead, 1).in(MessageWarning::getId, vo.getIds()));
-
-                //通过WebSocket推送数量条数
-                if (ObjectUtil.isNotEmpty(AuthUtil.getUserId())) {
-                    Map<String, String> webSocketMessageMap = WebSocket.getWebSocketMessageMap();
-                    Set<Map.Entry<String, String>> message = webSocketMessageMap.entrySet();
-                    for (Map.Entry<String, String> entry : message) {
-                        String userId = entry.getKey();
-                        if (userId.equals(AuthUtil.getUserId().toString())) { //只推送当前用户
-                            String projectAndContractId = entry.getValue();
-                            if (StringUtils.isNotEmpty(projectAndContractId) && StringUtils.isNotEmpty(userId)) {
-                                String projectId = projectAndContractId.split(",")[0];
-                                String contractId = projectAndContractId.split(",")[1];
-                                Map<String, String> stringMap = iTaskService.getTaskCount(projectId, contractId, userId);
-
-                                webSocket.sendMessageByUserId(AuthUtil.getUserId().toString(), JSON.toJSONString(stringMap));
-                            }
-                        }
-                    }
+                if (this.messageWarningService.update(Wrappers.<MessageWarning>lambdaUpdate().set(MessageWarning::getIsRead, 1).in(MessageWarning::getId, vo.getIds()))) {
+                    Set<String> aopParamsSet = new HashSet<>();
+                    String param = AuthUtil.getUserId() + "," + vo.getProjectId() + "," + vo.getContractId();
+                    //String testParam = "1536985094571823105,1630011899725201410,1630017379264610305";
+                    aopParamsSet.add(param);
+                    return R.data(200, aopParamsSet, "操作成功");
                 }
-
-                return R.data(true);
             } catch (Exception e) {
                 e.printStackTrace();
             }
@@ -117,7 +93,7 @@ public class MessageWarningController extends BladeController {
      * 获取当前用户的消息数量
      */
     @GetMapping("/queryCurrentUserMessageCount")
-    @ApiOperationSupport(order = 4)
+    @ApiOperationSupport(order = 2)
     @ApiOperation(value = "获取当前用户的消息数量")
     public R<MessageWarningVO> queryCurrentUserMessageCount(@RequestParam String projectId, @RequestParam String contractId) {
         MessageWarningVO vo = new MessageWarningVO();
@@ -177,7 +153,7 @@ public class MessageWarningController extends BladeController {
      * 分页
      */
     @GetMapping("/list")
-    @ApiOperationSupport(order = 1)
+    @ApiOperationSupport(order = 4)
     @ApiOperation(value = "分页", notes = "传入operationWarning")
     public R<IPage<MessageWarningVO>> list(MessageWarningVO vo, Query query) {
 
@@ -218,36 +194,21 @@ public class MessageWarningController extends BladeController {
         return R.data(iPage);
     }
 
-
     /**
      * 删除
      */
     @PostMapping("/remove")
-    @ApiOperationSupport(order = 2)
+    @ApiOperationSupport(order = 5)
     @ApiOperation(value = "逻辑删除", notes = "传入ids")
-    public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) throws IOException {
+    @PushMessage(clientId = ClientIdConstant.BUSINESS_CLIENT_ID)
+    public R<Object> remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids, @RequestParam String projectId, @RequestParam String contractId) throws IOException {
         if (this.messageWarningService.deleteLogic(Func.toLongList(ids))) {
-            //通过WebSocket推送数量条数
-            if (ObjectUtil.isNotEmpty(AuthUtil.getUserId())) {
-                Map<String, String> webSocketMessageMap = WebSocket.getWebSocketMessageMap();
-                Set<Map.Entry<String, String>> message = webSocketMessageMap.entrySet();
-                for (Map.Entry<String, String> entry : message) {
-                    String userId = entry.getKey();
-                    if (userId.equals(AuthUtil.getUserId().toString())) { //只推送当前用户
-                        String projectAndContractId = entry.getValue();
-                        if (StringUtils.isNotEmpty(projectAndContractId) && StringUtils.isNotEmpty(userId)) {
-                            String projectId = projectAndContractId.split(",")[0];
-                            String contractId = projectAndContractId.split(",")[1];
-                            Map<String, String> stringMap = iTaskService.getTaskCount(projectId, contractId, userId);
-
-                            webSocket.sendMessageByUserId(AuthUtil.getUserId().toString(), JSON.toJSONString(stringMap));
-                        }
-                    }
-                }
-            }
-            return R.status(true);
+            Set<String> aopParamsSet = new HashSet<>();
+            String param = AuthUtil.getUserId() + "," + projectId + "," + contractId;
+            //String testParam = "1536985094571823105,1630011899725201410,1630017379264610305";
+            aopParamsSet.add(param);
+            return R.data(200, aopParamsSet, "操作成功");
         }
-
         return R.status(false);
     }
 

+ 58 - 223
blade-service/blade-business/src/main/java/org/springblade/business/controller/TaskController.java

@@ -17,19 +17,14 @@ import lombok.AllArgsConstructor;
 import org.apache.commons.lang.StringUtils;
 import org.apache.commons.lang.time.DateUtils;
 import org.jetbrains.annotations.NotNull;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springblade.archive.dto.ArchiveTaskDTO;
 import org.springblade.archive.dto.SaveApplyDTO;
 import org.springblade.archive.feign.ArchiveAutoClient;
-import org.springblade.archive.vo.ArchiveTaskPageVO;
 import org.springblade.business.dto.*;
 import org.springblade.business.entity.*;
 import org.springblade.business.service.*;
-import org.springblade.business.socket.WebSocket;
 import org.springblade.business.utils.StringSPUtils;
 import org.springblade.business.vo.*;
-import org.springblade.common.utils.CommonUtil;
+import org.springblade.common.constant.ClientIdConstant;
 import org.springblade.common.utils.SnowFlakeUtil;
 import org.springblade.core.boot.ctrl.BladeController;
 import org.springblade.core.log.exception.ServiceException;
@@ -53,20 +48,16 @@ import org.springblade.manager.dto.SaveUserInfoByProjectDTO;
 import org.springblade.manager.entity.ContractInfo;
 import org.springblade.manager.entity.ContractRelationJlyz;
 import org.springblade.manager.entity.ProjectInfo;
-import org.springblade.manager.feign.ContractClient;
-import org.springblade.manager.feign.ExcelTabClient;
+import org.springblade.producer.bean.PushMessage;
 import org.springblade.resource.feign.CommonFileClient;
 import org.springblade.resource.feign.NewISmsClient;
 import org.springblade.system.entity.DictBiz;
-import org.springblade.system.entity.Role;
-import org.springblade.system.feign.IDictBizClient;
 import org.springblade.system.user.dto.UserDTO;
 import org.springblade.system.user.entity.User;
 import org.springblade.system.user.feign.IUserClient;
 import org.springframework.beans.BeanUtils;
 import org.springframework.jdbc.core.BeanPropertyRowMapper;
 import org.springframework.jdbc.core.JdbcTemplate;
-import org.springframework.scheduling.annotation.Async;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.bind.annotation.*;
 
@@ -91,22 +82,14 @@ import java.util.stream.Collectors;
 @Api(value = "任务审核主表", tags = "任务审核主表接口")
 public class TaskController extends BladeController {
 
-    private static final Logger log = LoggerFactory.getLogger(TaskController.class);
     private final JdbcTemplate jdbcTemplate;
     private final ITaskService taskService;
     private final ITaskParallelService taskParallelService;
     private final NewFlowClient newFlowClient;
-    private final IDictBizClient dictBizClient;
     private final NewISmsClient newSmsClient;
     private final IDefaultConfigService defaultConfigService;
-    private final ITaskBatchService taskBatchService;
-    private final ITaskService iTaskService;
-    private final WebSocket webSocket;
     private final CommonFileClient commonFileClient;
-    private final ContractClient contractClient;
-    private final IInformationQueryService informationQueryService;
     private final EVisaClient eVisaClient;
-    private final ExcelTabClient excelTabClient;
     private final ArchiveFileTaskClient archiveFileTaskClient;
     private final IUserClient userClient;
     private final ArchiveAutoClient archiveClient;
@@ -319,7 +302,8 @@ public class TaskController extends BladeController {
     @PostMapping("/batch-complete-approval-task")
     @ApiOperationSupport(order = 8)
     @ApiOperation(value = "批量审批")
-    public R<Boolean> batchCompleteApprovalTask(@RequestBody BatchTaskVO batchTaskVO) throws IOException {
+    @PushMessage(clientId = ClientIdConstant.BUSINESS_CLIENT_ID)
+    public R<Object> batchCompleteApprovalTask(@RequestBody BatchTaskVO batchTaskVO) throws IOException {
         String taskIds = batchTaskVO.getTaskIds();
         String parallelProcessInstanceIds = batchTaskVO.getParallelProcessInstanceIds();
         if (StringUtils.isNotEmpty(taskIds)) {
@@ -383,24 +367,13 @@ public class TaskController extends BladeController {
             //审批
             this.taskService.batchCompleteApprovalTask(taskApprovalVOS);
 
-            //通过WebSocket推送数量条数
+            Set<String> aopParamsSet = new HashSet<>();
             if (ObjectUtil.isNotEmpty(AuthUtil.getUserId())) {
-                Map<String, String> webSocketMessageMap = WebSocket.getWebSocketMessageMap();
-                Set<Map.Entry<String, String>> message = webSocketMessageMap.entrySet();
-                for (Map.Entry<String, String> entry : message) {
-                    String userId = entry.getKey();
-                    if (userId.equals(AuthUtil.getUserId().toString())) { //只推送当前用户
-                        String projectAndContractId = entry.getValue();
-                        if (StringUtils.isNotEmpty(projectAndContractId) && StringUtils.isNotEmpty(userId) && projectAndContractId.contains(",")) {
-                            String projectId = projectAndContractId.split(",")[0];
-                            String contractId = projectAndContractId.split(",")[1];
-                            Map<String, String> stringMap = iTaskService.getTaskCount(projectId, contractId, userId);
-                            webSocket.sendMessageByUserId(AuthUtil.getUserId().toString(), JSON.toJSONString(stringMap));
-                        }
-                    }
-                }
+                String param = AuthUtil.getUserId() + "," + batchTaskVO.getProjectId() + "," + batchTaskVO.getContractId();
+                aopParamsSet.add(param);
             }
-            return R.data(true);
+
+            return R.data(200, aopParamsSet, "操作成功");
         }
         return R.data(false);
     }
@@ -411,7 +384,8 @@ public class TaskController extends BladeController {
     @PostMapping("/batch-report-task-archive")
     @ApiOperationSupport(order = 8)
     @ApiOperation(value = "批量上报-档案")
-    public R<Object> batchReportTaskArchive(@RequestBody ArchiveTaskBatchReportDTO archiveTaskBatchReportDTO) throws IOException {
+    @PushMessage(clientId = ClientIdConstant.ARCHIVE_CLIENT_ID)
+    public R<Object> batchReportTaskArchive(@RequestBody ArchiveTaskBatchReportDTO archiveTaskBatchReportDTO) {
         if (ObjectUtil.isEmpty(archiveTaskBatchReportDTO.getDataIds())
                 || ObjectUtil.isEmpty(archiveTaskBatchReportDTO.getBatch())
                 || ObjectUtil.isEmpty(archiveTaskBatchReportDTO.getProjectId())
@@ -457,7 +431,7 @@ public class TaskController extends BladeController {
 
         //创建上报任务
         Map<Long, String> nameMap = jdbcTemplate.query("select id,name from blade_user where is_deleted = 0", new BeanPropertyRowMapper<>(User.class)).stream().collect(Collectors.toMap(User::getId, User::getName, (key1, key2) -> key1));
-
+        String[] userIds = archiveTaskBatchReportDTO.getUserIds().split(",");
         String[] dataArr = archiveTaskBatchReportDTO.getDataIds().split(",");
         if (dataArr.length > 0) {
             for (String id : dataArr) {
@@ -520,7 +494,6 @@ public class TaskController extends BladeController {
                 taskService.save(task);
 
                 //创建任务相关信息
-                String[] userIds = archiveTaskBatchReportDTO.getUserIds().split(",");
                 for (String userId : userIds) {
                     TaskParallel taskParallel = new TaskParallel();
                     taskParallel.setId(SnowFlakeUtil.getId());
@@ -552,25 +525,15 @@ public class TaskController extends BladeController {
                 }
             }
 
-            //WebSocket推送
-            if (ObjectUtil.isNotEmpty(AuthUtil.getUserId())) {
-                Map<String, String> webSocketMessageMap = WebSocket.getWebSocketMessageMap();
-                Set<Map.Entry<String, String>> message = webSocketMessageMap.entrySet();
-                for (Map.Entry<String, String> entry : message) {
-                    String userId = entry.getKey();
-                    if (userId.equals(AuthUtil.getUserId().toString())) { //只推送当前用户
-                        String projectAndContractId = entry.getValue();
-                        if (StringUtils.isNotEmpty(projectAndContractId) && StringUtils.isNotEmpty(userId)) {
-                            String projectId = projectAndContractId.split(",")[0];
-                            String contractId = projectAndContractId.split(",")[1];
-                            Map<String, String> stringMap = iTaskService.getTaskCountArchive(projectId, contractId, userId);
-                            webSocket.sendMessageByUserId(AuthUtil.getUserId().toString(), JSON.toJSONString(stringMap));
-                        }
-                    }
+            Set<String> aopParamsSet = new HashSet<>();
+            if (userIds.length > 0) {
+                for (String userId : userIds) {
+                    String param = userId + "," + archiveTaskBatchReportDTO.getProjectId() + "," + archiveTaskBatchReportDTO.getContractId();
+                    aopParamsSet.add(param);
                 }
             }
 
-            return R.success("上报成功");
+            return R.data(200, aopParamsSet, "操作成功");
         }
         return R.fail("操作失败");
     }
@@ -581,8 +544,11 @@ public class TaskController extends BladeController {
     @PostMapping("/batch-repeal-task-archive")
     @ApiOperationSupport(order = 8)
     @ApiOperation(value = "批量撤销(废除)-档案")
-    public R<Object> batchRepealTaskArchive(@RequestBody ArchiveTaskBatchRepealDTO repealDTO) throws IOException {
-        if (repealDTO.getType().equals(1)) { //文件收集废除(有可能是 认证废除 或 上报任务废除)
+    @PushMessage(clientId = ClientIdConstant.ARCHIVE_CLIENT_ID)
+    public R<Object> batchRepealTaskArchive(@RequestBody ArchiveTaskBatchRepealDTO repealDTO) {
+        Set<String> aopParamsSet = new HashSet<>();
+        if (repealDTO.getType().equals(1)) {
+            //文件收集废除
             String[] archiveIds = repealDTO.getIds().split(",");
             for (String archiveId : archiveIds) {
                 //判断现在的数据是否是待审批数据,只有上报状态、未认证状态的数据才能撤销
@@ -597,29 +563,21 @@ public class TaskController extends BladeController {
                         jdbcTemplate.execute("update u_task set status = 3 where id = " + task.getId());
                         //审批任务详情=已废除
                         jdbcTemplate.execute("update u_task_parallel set status = 3 where process_instance_id = '" + task.getProcessInstanceId() + "'");
-                    }
-                }
-            }
-            //WebSocket推送
-            if (ObjectUtil.isNotEmpty(AuthUtil.getUserId())) {
-                Map<String, String> webSocketMessageMap = WebSocket.getWebSocketMessageMap();
-                Set<Map.Entry<String, String>> message = webSocketMessageMap.entrySet();
-                for (Map.Entry<String, String> entry : message) {
-                    String userId = entry.getKey();
-                    if (userId.equals(AuthUtil.getUserId().toString())) { //只推送当前用户
-                        String projectAndContractId = entry.getValue();
-                        if (StringUtils.isNotEmpty(projectAndContractId) && StringUtils.isNotEmpty(userId)) {
-                            String projectId = projectAndContractId.split(",")[0];
-                            String contractId = projectAndContractId.split(",")[1];
-                            Map<String, String> stringMap = iTaskService.getTaskCountArchive(projectId, contractId, userId);
-                            webSocket.sendMessageByUserId(AuthUtil.getUserId().toString(), JSON.toJSONString(stringMap));
+
+                        /*通知*/
+                        List<TaskParallel> taskParallelList = jdbcTemplate.query("SELECT task_user FROM u_task_parallel WHERE process_instance_id = '" + task.getProcessInstanceId() + "'", new BeanPropertyRowMapper<>(TaskParallel.class));
+                        for (TaskParallel taskParallel : taskParallelList) {
+                            String param = taskParallel.getTaskUser() + "," + repealDTO.getProjectId() + "," + repealDTO.getContractId();
+                            aopParamsSet.add(param);
                         }
                     }
                 }
             }
-            return R.success("操作成功");
 
-        } else if (repealDTO.getType().equals(2)) { //任务审批废除
+            return R.data(200, aopParamsSet, "操作成功");
+
+        } else if (repealDTO.getType().equals(2)) {
+            //任务审批废除
             String[] taskIds = repealDTO.getIds().split(",");
             for (String taskId : taskIds) {
                 Task task = jdbcTemplate.query("select id,status,process_instance_id,form_data_id from u_task where id = " + taskId, new BeanPropertyRowMapper<>(Task.class)).stream().findAny().orElse(null);
@@ -630,26 +588,18 @@ public class TaskController extends BladeController {
                     jdbcTemplate.execute("update u_task_parallel set status = 3 where process_instance_id = '" + task.getProcessInstanceId() + "'");
                     //修改档案文件收集业务数据状态
                     jdbcTemplate.execute("update u_archive_file set status = 3,e_visa_file = null where id = " + task.getFormDataId());
-                }
-            }
-            //WebSocket推送
-            if (ObjectUtil.isNotEmpty(AuthUtil.getUserId())) {
-                Map<String, String> webSocketMessageMap = WebSocket.getWebSocketMessageMap();
-                Set<Map.Entry<String, String>> message = webSocketMessageMap.entrySet();
-                for (Map.Entry<String, String> entry : message) {
-                    String userId = entry.getKey();
-                    if (userId.equals(AuthUtil.getUserId().toString())) { //只推送当前用户
-                        String projectAndContractId = entry.getValue();
-                        if (StringUtils.isNotEmpty(projectAndContractId) && StringUtils.isNotEmpty(userId)) {
-                            String projectId = projectAndContractId.split(",")[0];
-                            String contractId = projectAndContractId.split(",")[1];
-                            Map<String, String> stringMap = iTaskService.getTaskCountArchive(projectId, contractId, userId);
-                            webSocket.sendMessageByUserId(AuthUtil.getUserId().toString(), JSON.toJSONString(stringMap));
-                        }
+
+                    /*通知*/
+                    List<TaskParallel> taskParallelList = jdbcTemplate.query("SELECT task_user FROM u_task_parallel WHERE process_instance_id = '" + task.getProcessInstanceId() + "'", new BeanPropertyRowMapper<>(TaskParallel.class));
+                    for (TaskParallel taskParallel : taskParallelList) {
+                        String param = taskParallel.getTaskUser() + "," + repealDTO.getProjectId() + "," + repealDTO.getContractId();
+                        aopParamsSet.add(param);
                     }
                 }
             }
-            return R.success("操作成功");
+
+            return R.data(200, aopParamsSet, "操作成功");
+
         }
         return R.fail(400, "操作失败");
     }
@@ -661,7 +611,8 @@ public class TaskController extends BladeController {
     @ApiOperationSupport(order = 8)
     @ApiOperation(value = "批量审批(档案 垂直审批)")
     @Transactional
-    public R<Boolean> batchCompleteApprovalTaskArchive(@RequestBody TaskArchiveOuterLayerDTO taskArchiveOuterLayerDTO) throws IOException {
+    @PushMessage(clientId = ClientIdConstant.ARCHIVE_CLIENT_ID)
+    public R<Object> batchCompleteApprovalTaskArchive(@RequestBody TaskArchiveOuterLayerDTO taskArchiveOuterLayerDTO) {
         if (ObjectUtil.isEmpty(SecureUtil.getUser()) || ObjectUtil.isEmpty(SecureUtil.getUserId()) || SecureUtil.getUserId().equals(-1L)) {
             throw new ServiceException("未获取到当前登陆的用户信息,操作失败");
         }
@@ -671,7 +622,7 @@ public class TaskController extends BladeController {
             throw new ServiceException("请选择审批操作类型,【同意】或【废除任务】");
         }
 
-        //同意审批
+        /*同意审批*/
         if (flag.equals("OK")) {
             //检查审批人是否符合顺序
             this.checkArchiveTaskUserByCurrent(taskArchiveOuterLayerDTO.getTaskArchiveDtoList());
@@ -732,7 +683,7 @@ public class TaskController extends BladeController {
                                     dto.setProjectAndUserList(list);
                                     //单个保存专家信息
                                     R<Boolean> booleanR = userClient.saveUserDTO(dto);
-                                    if (booleanR.getData() == null || booleanR.isSuccess() != true) {
+                                    if (booleanR.getData() == null || !booleanR.isSuccess()) {
                                         throw new ServiceException(booleanR.getMsg());
                                     }
                                 }
@@ -741,7 +692,7 @@ public class TaskController extends BladeController {
                                 if (StringUtils.isNotBlank(archiveIds)) {
                                     List<Long> longs = Func.toLongList(archiveIds);
                                     R<Boolean> booleanR = archiveClient.batchUpdateIsApply(1, longs);
-                                    if (booleanR.getData() == null || booleanR.isSuccess() != true) {
+                                    if (booleanR.getData() == null || !booleanR.isSuccess()) {
                                         throw new ServiceException("修改档案类型失败");
                                     }
                                 }
@@ -783,26 +734,16 @@ public class TaskController extends BladeController {
                 }
             }
 
-            //WebSocket推送
+            Set<String> aopParamsSet = new HashSet<>();
             if (ObjectUtil.isNotEmpty(AuthUtil.getUserId())) {
-                Map<String, String> webSocketMessageMap = WebSocket.getWebSocketMessageMap();
-                Set<Map.Entry<String, String>> message = webSocketMessageMap.entrySet();
-                for (Map.Entry<String, String> entry : message) {
-                    String userId = entry.getKey();
-                    if (userId.equals(AuthUtil.getUserId().toString())) { //只推送当前用户
-                        String projectAndContractId = entry.getValue();
-                        if (StringUtils.isNotEmpty(projectAndContractId) && StringUtils.isNotEmpty(userId)) {
-                            String projectId = projectAndContractId.split(",")[0];
-                            String contractId = projectAndContractId.split(",")[1];
-                            Map<String, String> stringMap = iTaskService.getTaskCountArchive(projectId, contractId, userId);
-                            webSocket.sendMessageByUserId(AuthUtil.getUserId().toString(), JSON.toJSONString(stringMap));
-                        }
-                    }
-                }
+                String param = AuthUtil.getUserId() + "," + taskArchiveOuterLayerDTO.getProjectId() + "," + taskArchiveOuterLayerDTO.getContractId();
+                aopParamsSet.add(param);
             }
-            return R.data(true);
+
+            return R.data(200, aopParamsSet, "操作成功");
 
         } else {
+            /*废除任务*/
             List<String> taskIds = taskArchiveOuterLayerDTO.getTaskArchiveDtoList().stream().map(TaskArchiveDTO::getTaskId).filter(ObjectUtil::isNotEmpty).collect(Collectors.toList());
             //判断任务类型是否是验收任务,档案验收任务单独处理修改状态直接返回
             if (taskArchiveOuterLayerDTO.getTaskArchiveDtoList().get(0) == null || taskArchiveOuterLayerDTO.getTaskArchiveDtoList().get(0).getTaskId() == null) {
@@ -819,35 +760,12 @@ public class TaskController extends BladeController {
                     return R.data(true);
                 }
             }
-            //废除任务
+
             ArchiveTaskBatchRepealDTO dto = new ArchiveTaskBatchRepealDTO();
             dto.setType(2);
             dto.setIds(StringUtils.join(taskIds, ","));
-            R<Object> objectR = this.batchRepealTaskArchive(dto);
-            if (objectR.getCode() == 200) {
-                //WebSocket推送
-                if (ObjectUtil.isNotEmpty(AuthUtil.getUserId())) {
-                    Map<String, String> webSocketMessageMap = WebSocket.getWebSocketMessageMap();
-                    Set<Map.Entry<String, String>> message = webSocketMessageMap.entrySet();
-                    for (Map.Entry<String, String> entry : message) {
-                        String userId = entry.getKey();
-                        if (userId.equals(AuthUtil.getUserId().toString())) { //只推送当前用户
-                            String projectAndContractId = entry.getValue();
-                            if (StringUtils.isNotEmpty(projectAndContractId) && StringUtils.isNotEmpty(userId)) {
-                                String projectId = projectAndContractId.split(",")[0];
-                                String contractId = projectAndContractId.split(",")[1];
-                                Map<String, String> stringMap = iTaskService.getTaskCountArchive(projectId, contractId, userId);
-                                webSocket.sendMessageByUserId(AuthUtil.getUserId().toString(), JSON.toJSONString(stringMap));
-                            }
-                        }
-                    }
-                }
-                return R.data(true);
-            } else if (objectR.getCode() == 400) {
-                return R.data(false);
-            }
+            return this.batchRepealTaskArchive(dto);
         }
-        return R.data(false);
     }
 
     /**
@@ -1020,7 +938,7 @@ public class TaskController extends BladeController {
     @GetMapping("/user-to-do-task-list")
     @ApiOperationSupport(order = 3)
     @ApiOperation(value = "获取当前用户待办流程")
-    public R<IPage<TaskVO>> todoUserApprovalTask(TaskQueryVO queryVO) throws IOException {
+    public R<IPage<TaskVO>> todoUserApprovalTask(TaskQueryVO queryVO){
         //设置获取参数
         Map<String, Task> masterTaskMap = new HashMap<>();
         Map<String, TaskParallel> parallelMap = new HashMap<>();
@@ -1031,7 +949,6 @@ public class TaskController extends BladeController {
 
         //如果为空直接返回
         if (masterTaskMap.size() == 0 && parallelMap.size() == 0 && ObjectUtil.isNotEmpty(queryVO.getContractId()) && ObjectUtil.isNotEmpty(queryVO.getProjectId())) {
-            this.sendsWebSocketCount(null, 2, queryVO);
             return R.data(null);
         }
 
@@ -1039,46 +956,7 @@ public class TaskController extends BladeController {
         R<Object> rObject = this.newFlowClient.selectTodoPage(queryVO.getCurrent(), queryVO.getSize(), queryVO.getOrdType() == null ? 1 : queryVO.getOrdType(), String.join(",", parallelProcessInstanceIds));
 
         //处理参数
-        R<IPage<TaskVO>> iPageR = this.integrationMethod(queryVO, rObject, masterTaskMap, parallelMap, true);
-
-        //推送
-        if (ObjectUtil.isNotEmpty(iPageR.getData()) && ObjectUtil.isNotEmpty(iPageR.getData().getRecords()) && ObjectUtil.isNotEmpty(queryVO.getContractId()) && ObjectUtil.isNotEmpty(queryVO.getProjectId())) {
-            this.sendsWebSocketCount(iPageR, 1, queryVO);
-        } else if (ObjectUtil.isNotEmpty(queryVO.getContractId()) && ObjectUtil.isNotEmpty(queryVO.getProjectId())) {
-            this.sendsWebSocketCount(null, 2, queryVO);
-        }
-        return iPageR;
-    }
-
-    /**
-     * 推送消息
-     *
-     * @param iPageR
-     * @param type
-     * @param queryVO
-     * @throws IOException
-     */
-    @Async
-    public void sendsWebSocketCount(R<IPage<TaskVO>> iPageR, int type, TaskQueryVO queryVO) throws IOException {
-        if (ObjectUtil.isEmpty(queryVO.getCurrentContractId())) {
-            //如果getCurrentContractId=null,那么表示是APP的待办查询(web端不为null)
-            queryVO.setCurrentContractId(queryVO.getContractId());
-        }
-        if (type == 1) {
-            Map<String, String> stringMap = iTaskService.getTaskCount(queryVO.getProjectId(), queryVO.getCurrentContractId(), SecureUtil.getUserId().toString());
-            stringMap.put("taskCount", String.valueOf(iPageR.getData().getTotal()));
-            long messageCount = Long.parseLong(stringMap.get("messageCount"));
-            long taskCount = Long.parseLong(stringMap.get("taskCount"));
-            stringMap.put("allCount", String.valueOf(messageCount + taskCount));
-            webSocket.sendMessageByUserId(AuthUtil.getUserId().toString(), JSON.toJSONString(stringMap));
-        } else if (type == 2) {
-            Map<String, String> stringMap = iTaskService.getTaskCount(queryVO.getProjectId(), queryVO.getCurrentContractId(), SecureUtil.getUserId().toString());
-            stringMap.put("taskCount", "0");
-            long messageCount = Long.parseLong(stringMap.get("messageCount"));
-            long taskCount = Long.parseLong(stringMap.get("taskCount"));
-            stringMap.put("allCount", String.valueOf(messageCount + taskCount));
-            webSocket.sendMessageByUserId(AuthUtil.getUserId().toString(), JSON.toJSONString(stringMap));
-        }
+        return this.integrationMethod(queryVO, rObject, masterTaskMap, parallelMap, true);
     }
 
     /**
@@ -1503,50 +1381,7 @@ public class TaskController extends BladeController {
                 .collect(Collectors.toList());
         page.setRecords(pageList);
         page.setTotal(totalCount);
-
-        R<IPage<BusinessTaskPageVO>> iPageR = R.data(page);
-
-        //待办推送
-        if (dto.getSelectedType().equals(1)) {
-            if (ObjectUtil.isNotEmpty(iPageR.getData()) && ObjectUtil.isNotEmpty(iPageR.getData().getRecords()) && ObjectUtil.isNotEmpty(dto.getContractIdValue()) && ObjectUtil.isNotEmpty(dto.getProjectIdValue())) {
-                this.sendsWebSocketCount(iPageR, 1, dto);
-            } else if (ObjectUtil.isNotEmpty(dto.getContractIdValue()) && ObjectUtil.isNotEmpty(dto.getProjectIdValue())) {
-                this.sendsWebSocketCount(null, 2, dto);
-            }
-        }
-
-        return iPageR;
-    }
-
-    /**
-     * 推送消息
-     *
-     * @param iPageR
-     * @param type
-     * @param dto
-     * @throws IOException
-     */
-    @Async
-    public void sendsWebSocketCount(R<IPage<BusinessTaskPageVO>> iPageR, int type, BusinessTaskDTO dto) throws IOException {
-        if (ObjectUtil.isEmpty(dto.getCurrentContractId())) {
-            //如果getCurrentContractId=null,那么表示是APP的待办查询(web端不为null)
-            dto.setCurrentContractId(dto.getContractIdValue());
-        }
-        if (type == 1) {
-            Map<String, String> stringMap = iTaskService.getTaskCount(dto.getProjectIdValue().toString(), dto.getCurrentContractId().toString(), SecureUtil.getUserId().toString());
-            stringMap.put("taskCount", String.valueOf(iPageR.getData().getTotal()));
-            long messageCount = Long.parseLong(stringMap.get("messageCount"));
-            long taskCount = Long.parseLong(stringMap.get("taskCount"));
-            stringMap.put("allCount", String.valueOf(messageCount + taskCount));
-            webSocket.sendMessageByUserId(AuthUtil.getUserId().toString(), JSON.toJSONString(stringMap));
-        } else if (type == 2) {
-            Map<String, String> stringMap = iTaskService.getTaskCount(dto.getProjectIdValue().toString(), dto.getCurrentContractId().toString(), SecureUtil.getUserId().toString());
-            stringMap.put("taskCount", "0");
-            long messageCount = Long.parseLong(stringMap.get("messageCount"));
-            long taskCount = Long.parseLong(stringMap.get("taskCount"));
-            stringMap.put("allCount", String.valueOf(messageCount + taskCount));
-            webSocket.sendMessageByUserId(AuthUtil.getUserId().toString(), JSON.toJSONString(stringMap));
-        }
+        return R.data(page);
     }
 
     /**

+ 15 - 27
blade-service/blade-business/src/main/java/org/springblade/business/controller/UserOpinionController.java

@@ -1,6 +1,5 @@
 package org.springblade.business.controller;
 
-import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
@@ -17,9 +16,8 @@ import org.springblade.business.entity.UserOpinionFlow;
 import org.springblade.business.entity.UserOpinionGood;
 import org.springblade.business.feign.MessageWarningClient;
 import org.springblade.business.service.*;
-import org.springblade.business.socket.WebSocket;
-import org.springblade.business.socket.WebSocketManager;
 import org.springblade.business.vo.MessageWarningVO;
+import org.springblade.common.constant.ClientIdConstant;
 import org.springblade.common.utils.SnowFlakeUtil;
 import org.springblade.core.mp.support.Condition;
 import org.springblade.core.mp.support.Query;
@@ -35,6 +33,7 @@ import org.springblade.manager.entity.ProjectInfo;
 import org.springblade.manager.feign.ContractClient;
 import org.springblade.manager.feign.ProjectAssignmentUserClient;
 import org.springblade.manager.feign.ProjectClient;
+import org.springblade.producer.bean.PushMessage;
 import org.springblade.system.entity.DictBiz;
 import org.springblade.system.feign.IDictBizClient;
 import org.springblade.system.user.entity.User;
@@ -48,7 +47,6 @@ import org.springblade.business.entity.UserOpinion;
 import org.springblade.business.vo.UserOpinionVO;
 import org.springblade.core.boot.ctrl.BladeController;
 
-import java.io.IOException;
 import java.util.*;
 
 /**
@@ -83,12 +81,6 @@ public class UserOpinionController extends BladeController {
 
     private final ProjectClient projectClient;
 
-    private final ITaskService iTaskService;
-
-    private final WebSocket webSocket;
-
-    private final WebSocketManager webSocketManager;
-
     /**
      * 取消点赞
      *
@@ -235,7 +227,9 @@ public class UserOpinionController extends BladeController {
     @PostMapping("/saveUserOpinion")
     @ApiOperationSupport(order = 1)
     @ApiOperation(value = "新增工单服务信息", notes = "传入userOpinion")
-    public R<Boolean> saveUserOpinion(@Valid @RequestBody UserOpinionVO userOpinionVo) {
+    @PushMessage(clientId = ClientIdConstant.BUSINESS_CLIENT_ID + "," + ClientIdConstant.MANAGER_CLIENT_ID)
+    public R<Object> saveUserOpinion(@Valid @RequestBody UserOpinionVO userOpinionVo) {
+        Set<String> aopParamsSet = new HashSet<>();
         //设置用户信息
         this.setUserData(userOpinionVo);
         //生成主表ID
@@ -298,27 +292,17 @@ public class UserOpinionController extends BladeController {
                     0
             ));
 
-            //通过WebSocket推送数量条数,推送到对应维护人客户端的工单反馈中
             if (ObjectUtil.isNotEmpty(userOpinionVo.getProjectId()) && ObjectUtil.isNotEmpty(userOpinionVo.getContractId()) && ObjectUtil.isNotEmpty(manageUser)) {
-                Map<String, String> stringMap = iTaskService.getTaskCount(userOpinionVo.getProjectId().toString(), userOpinionVo.getContractId().toString(), manageUser.toString());
-                try {
-                    webSocket.sendMessageByUserId(manageUser.toString(), JSON.toJSONString(stringMap));
-                } catch (IOException e) {
-                    e.printStackTrace();
-                }
+                String param = manageUser + "," + userOpinionVo.getProjectId() + "," + userOpinionVo.getContractId();
+                aopParamsSet.add(param);
             }
 
-            //通过WebSocket推送数量条数,推送到对应维护人后管的消息区我的消息中
+            /*后管,projectId=1,contractId=1*/
             if (ObjectUtil.isNotEmpty(manageUser)) {
-                Map<String, String> stringMap = iTaskService.getTaskCount(null, null, manageUser.toString());
-                try {
-                    webSocketManager.sendMessageByUserId(manageUser.toString(), JSON.toJSONString(stringMap));
-                } catch (IOException e) {
-                    e.printStackTrace();
-                }
+                String param = manageUser + ",1,1";
+                aopParamsSet.add(param);
             }
 
-
         } catch (Exception e) {
             e.printStackTrace();
         }
@@ -343,7 +327,11 @@ public class UserOpinionController extends BladeController {
         BeanUtils.copyProperties(userOpinionVo, newUserOpinion);
         newUserOpinion.setCreateTime(nowDate);
 
-        return R.status(this.userOpinionService.save(newUserOpinion));
+        if (this.userOpinionService.save(newUserOpinion)) {
+            return R.data(200, aopParamsSet, "操作成功");
+        }
+
+        return R.fail("操作失败");
     }
 
     //设置登录用户信息

+ 0 - 46
blade-service/blade-business/src/main/java/org/springblade/business/feignClient/ArchiveFileClientImpl.java

@@ -1,43 +1,26 @@
 package org.springblade.business.feignClient;
 
-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.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import lombok.AllArgsConstructor;
 import org.apache.commons.lang.StringUtils;
-import org.springblade.archive.dto.ArchiveTaskDTO;
-import org.springblade.archive.dto.SendsWebSocketArchiveDTO;
-import org.springblade.archive.entity.ArchivesAuto;
-import org.springblade.archive.vo.ArchiveTaskPageVO;
 import org.springblade.archive.vo.ArchivesAutoVO;
 import org.springblade.business.entity.ArchiveFile;
 import org.springblade.business.feign.ArchiveFileClient;
 import org.springblade.business.mapper.ArchiveFileMapper;
 import org.springblade.business.service.IArchiveFileService;
 import org.springblade.business.service.ITaskService;
-import org.springblade.business.socket.WebSocket;
 import org.springblade.business.vo.ArchiveFileVO;
-import org.springblade.business.vo.TaskQueryVO;
-import org.springblade.business.vo.TaskVO;
 import org.springblade.common.utils.FileUtils;
-import org.springblade.common.vo.FileSize;
-import org.springblade.core.secure.utils.AuthUtil;
-import org.springblade.core.secure.utils.SecureUtil;
-import org.springblade.core.tool.api.R;
-import org.springblade.core.tool.utils.ObjectUtil;
 import org.springblade.manager.entity.ContractInfo;
 import org.springblade.manager.feign.ContractClient;
-import org.springframework.scheduling.annotation.Async;
-import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RestController;
 
-import java.io.IOException;
 import java.util.*;
 
 
@@ -53,9 +36,6 @@ public class ArchiveFileClientImpl implements ArchiveFileClient {
 
     private final ITaskService iTaskService;
 
-    private final WebSocket webSocket;
-
-
     @Override
     public void saveArchiveFile(ArchiveFileVO vo) {
         this.iArchiveFileService.saveArchiveFile(vo.getList());
@@ -342,30 +322,4 @@ public class ArchiveFileClientImpl implements ArchiveFileClient {
         iArchiveFileService.updateById(archiveFile);
     }
 
-    @Override
-    public void sendWebSocketArchiveMsg(SendsWebSocketArchiveDTO webSocketArchiveDTO) throws IOException {
-        Integer pageTotal = webSocketArchiveDTO.getPageTotal();
-        Integer type = webSocketArchiveDTO.getType();
-        ArchiveTaskDTO dto = webSocketArchiveDTO.getDto();
-        if (ObjectUtil.isEmpty(dto.getCurrentContractId())) {
-            //如果getCurrentContractId=null,那么表示是APP的待办查询(web端不为null)
-            dto.setCurrentContractId(dto.getContractIdValue());
-        }
-        if (type == 1) {
-            Map<String, String> stringMap = iTaskService.getTaskCountArchive(dto.getProjectIdValue().toString(), dto.getCurrentContractId().toString(), SecureUtil.getUserId().toString());
-            stringMap.put("taskCount", String.valueOf(pageTotal));
-            long messageCount = Long.parseLong(stringMap.get("messageCount"));
-            long taskCount = Long.parseLong(stringMap.get("taskCount"));
-            stringMap.put("allCount", String.valueOf(messageCount + taskCount));
-            webSocket.sendMessageByUserId(AuthUtil.getUserId().toString(), JSON.toJSONString(stringMap));
-        } else if (type == 2) {
-            Map<String, String> stringMap = iTaskService.getTaskCountArchive(dto.getProjectIdValue().toString(), dto.getCurrentContractId().toString(), SecureUtil.getUserId().toString());
-            stringMap.put("taskCount", "0");
-            long messageCount = Long.parseLong(stringMap.get("messageCount"));
-            long taskCount = Long.parseLong(stringMap.get("taskCount"));
-            stringMap.put("allCount", String.valueOf(messageCount + taskCount));
-            webSocket.sendMessageByUserId(AuthUtil.getUserId().toString(), JSON.toJSONString(stringMap));
-        }
-    }
-
 }

+ 25 - 0
blade-service/blade-business/src/main/java/org/springblade/business/feignClient/BusinessWebSocketClientImpl.java

@@ -0,0 +1,25 @@
+package org.springblade.business.feignClient;
+
+import lombok.AllArgsConstructor;
+import org.springblade.business.feign.BusinessWebSocketClient;
+import org.springblade.business.service.ITaskService;
+import org.springblade.core.tenant.annotation.NonDS;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.Map;
+
+@RestController
+@AllArgsConstructor
+@NonDS
+public class BusinessWebSocketClientImpl implements BusinessWebSocketClient {
+
+    private final ITaskService iTaskService;
+
+    @Override
+    @GetMapping(value = "/business/getWebsocketMsg")
+    public Map<String, String> getWebsocketMsg(String projectId, String contractId, String userIdResult) {
+        return iTaskService.getTaskCount(projectId, contractId, userIdResult);
+    }
+
+}

+ 14 - 0
blade-service/blade-business/src/main/java/org/springblade/business/feignClient/OpinionUserClientImpl.java

@@ -12,6 +12,7 @@ import org.springblade.business.service.IAssessmentUserService;
 import org.springblade.business.service.IUserOpinionFileService;
 import org.springblade.business.service.IUserOpinionFlowService;
 import org.springblade.business.service.IUserOpinionService;
+import org.springblade.business.service.impl.UserOpinionServiceImpl;
 import org.springblade.business.vo.AssessmentUserVOS;
 import org.springblade.business.vo.BusinessUserOpinionVO;
 import org.springblade.core.mp.support.Query;
@@ -19,7 +20,9 @@ import org.springblade.core.secure.utils.AuthUtil;
 import org.springframework.web.bind.annotation.RestController;
 
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 import java.util.stream.Collectors;
 
 @RestController
@@ -32,6 +35,8 @@ public class OpinionUserClientImpl implements OpinionUserClient {
 
     private final IUserOpinionService userOpinionService;
 
+    private final UserOpinionServiceImpl userOpinionServiceImpl;
+
     private final IUserOpinionFileService userOpinionFileService;
 
     @Override
@@ -122,4 +127,13 @@ public class OpinionUserClientImpl implements OpinionUserClient {
         return this.userOpinionFlowService.countUserAssessmentPageList(vo);
     }
 
+    @Override
+    public Map<String, String> getWebsocketMsg(String projectId, String contractId, String userIdResult) {
+        Map<String, String> map = new HashMap<>();
+        List<BusinessUserOpinionVO> businessUserOpinionVOS = userOpinionServiceImpl.getBaseMapper().queryManageUserOpinionList(userIdResult).stream().filter(f -> f.getIsCurrent().equals(false)).collect(Collectors.toList());
+        map.put("myMessageCount", String.valueOf(businessUserOpinionVOS.size()));
+        map.put("userId", userIdResult);
+        return map;
+    }
+
 }

+ 17 - 10
blade-service/blade-business/src/main/java/org/springblade/business/feignClient/TaskClientImpl.java

@@ -45,26 +45,26 @@ public class TaskClientImpl implements TaskClient {
     }
 
     @Override
-    public List<Task> queryUserTask(Long projectId,Integer type, Long reportUser, Integer status) {
+    public List<Task> queryUserTask(Long projectId, Integer type, Long reportUser, Integer status) {
         return taskService.list(new LambdaQueryWrapper<Task>()
-                .eq(Task::getReportUser,reportUser)
-                .eq(Task::getType,type)
-                .eq(Task::getStatus,status)
-                .eq(Task::getProjectId,projectId));
+                .eq(Task::getReportUser, reportUser)
+                .eq(Task::getType, type)
+                .eq(Task::getStatus, status)
+                .eq(Task::getProjectId, projectId));
     }
 
     @Override
     @Transactional
-    public Boolean deleteUserTask(Long projectId,Long reportUser) {
+    public Boolean deleteUserTask(Long projectId, Long reportUser) {
         //获取任务,并判断是否只有一条
-        List<Task> tasks = this.queryUserTask(projectId,2, reportUser, 1);
-        if (tasks == null || tasks.size() != 1){
+        List<Task> tasks = this.queryUserTask(projectId, 2, reportUser, 1);
+        if (tasks == null || tasks.size() != 1) {
             return false;
         }
         //删除主任务
         taskService.removeById(tasks.get(0));
         //删除副任务
-        taskParallelService.remove(new LambdaQueryWrapper<TaskParallel>().eq(TaskParallel::getProcessInstanceId,tasks.get(0).getId()+""));
+        taskParallelService.remove(new LambdaQueryWrapper<TaskParallel>().eq(TaskParallel::getProcessInstanceId, tasks.get(0).getId() + ""));
         return true;
     }
 
@@ -154,7 +154,14 @@ public class TaskClientImpl implements TaskClient {
 
     @Override
     public R<Boolean> reSigningEVisa(String taskIds, String contractId, String projectId, String header) {
-        this.taskService.reSigningEVisa(taskIds,contractId,projectId,header);
+        this.taskService.reSigningEVisa(taskIds, contractId, projectId, header);
         return null;
     }
+
+    @Override
+    public Map<String, String> getWebsocketMsgArchive(String projectId, String contractId, String userIdResult) {
+        return taskService.getTaskCountArchive(projectId, contractId, userIdResult);
+    }
+
+
 }

+ 11 - 14
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/TaskServiceImpl.java

@@ -388,6 +388,7 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
      */
     @Override
     public Map<String, String> getTaskCount(String projectId, String contractId, String userId) {
+        Map<String, String> map = new HashMap<>();
         if (StringUtils.isNotEmpty(projectId) && StringUtils.isNotEmpty(contractId)) {
             List<Task> tasks = this.baseMapper.selectList(Wrappers.<Task>lambdaQuery()
                     .select(Task::getProcessInstanceId)
@@ -422,7 +423,7 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
             long messageCount3 = messageWarnings.stream().filter(f -> f.getType().equals(3)).count();
             long messageCount4 = messageWarnings.stream().filter(f -> f.getType().equals(4)).count();
             long messageCount5 = messageWarnings.stream().filter(f -> f.getType().equals(5)).count();
-            Map<String, String> map = new HashMap<>();
+
             map.put("allCount", String.valueOf(taskAllCount + messageWarnings.size()));//任务管理
             map.put("taskCount", String.valueOf(taskAllCount));//任务查看
             map.put("messageCount", String.valueOf(messageWarnings.size()));//消息提醒
@@ -432,14 +433,15 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
             map.put("messageCount_4", String.valueOf(messageCount4));//工单反馈
             map.put("messageCount_5", String.valueOf(messageCount5));//系统消息
             map.put("userId", userId);
-            return map;
-        } else {
+        }
+        return map;
+        /*else {
             Map<String, String> map = new HashMap<>();
             List<BusinessUserOpinionVO> businessUserOpinionVOS = userOpinionService.getBaseMapper().queryManageUserOpinionList(userId).stream().filter(f -> f.getIsCurrent().equals(false)).collect(Collectors.toList());
             map.put("myMessageCount", String.valueOf(businessUserOpinionVOS.size()));//后管消息区-我的消息-未处理
             map.put("userId", userId);
             return map;
-        }
+        }*/
     }
 
     /**
@@ -452,6 +454,7 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
      */
     @Override
     public Map<String, String> getTaskCountArchive(String projectId, String contractId, String userId) {
+        Map<String, String> map = new HashMap<>();
         if (StringUtils.isNotEmpty(projectId) && StringUtils.isNotEmpty(contractId)) {
             List<Task> tasks = this.baseMapper.selectList(Wrappers.<Task>lambdaQuery()
                     .select(Task::getProcessInstanceId)
@@ -486,7 +489,7 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
             long messageCount3 = messageWarnings.stream().filter(f -> f.getType().equals(3)).count();
             long messageCount4 = messageWarnings.stream().filter(f -> f.getType().equals(4)).count();
             long messageCount5 = messageWarnings.stream().filter(f -> f.getType().equals(5)).count();
-            Map<String, String> map = new HashMap<>();
+
             map.put("allCount", String.valueOf(taskAllCount + messageWarnings.size()));//任务管理
             map.put("taskCount", String.valueOf(taskAllCount));//任务查看
             map.put("messageCount", String.valueOf(messageWarnings.size()));//消息提醒
@@ -496,14 +499,8 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
             map.put("messageCount_4", String.valueOf(messageCount4));//工单反馈
             map.put("messageCount_5", String.valueOf(messageCount5));//系统消息
             map.put("userId", userId);
-            return map;
-        } else {
-            Map<String, String> map = new HashMap<>();
-            List<BusinessUserOpinionVO> businessUserOpinionVOS = userOpinionService.getBaseMapper().queryManageUserOpinionList(userId).stream().filter(f -> f.getIsCurrent().equals(false)).collect(Collectors.toList());
-            map.put("myMessageCount", String.valueOf(businessUserOpinionVOS.size()));//后管消息区-我的消息-未处理
-            map.put("userId", userId);
-            return map;
         }
+        return map;
     }
 
     /**
@@ -576,7 +573,7 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
     }
 
 
-   // @Scheduled(cron = "0 */1 * * * ?")
+    // @Scheduled(cron = "0 */1 * * * ?")
     public void SignInfo() {
         //执行代码
         logger.debug("扫描开始");
@@ -606,7 +603,7 @@ public class TaskServiceImpl extends BaseServiceImpl<TaskMapper, Task> implement
                     if (wtask >= 200) {
                         break;
                     }
-                   // taskBatchService.update(Wrappers.<TaskBatch>update().set("is_deleted", 2).eq("id", taskBatchId));
+                    // taskBatchService.update(Wrappers.<TaskBatch>update().set("is_deleted", 2).eq("id", taskBatchId));
                     RedisTemplate.opsForValue().set("sign-" + taskApprovalVO.getFormDataId(), "1", 70, TimeUnit.SECONDS);
                     CompletableFuture<Void> runAsync = CompletableFuture.runAsync(() -> {
                         try {

+ 0 - 202
blade-service/blade-business/src/main/java/org/springblade/business/socket/WebSocket.java

@@ -1,202 +0,0 @@
-package org.springblade.business.socket;
-
-import com.alibaba.fastjson.JSON;
-import org.apache.commons.lang.StringUtils;
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
-import org.springblade.business.service.ITaskService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
-import org.springframework.scheduling.annotation.Scheduled;
-import org.springframework.stereotype.Component;
-import cn.hutool.core.util.StrUtil;
-import org.springframework.web.bind.annotation.CrossOrigin;
-
-import javax.websocket.*;
-import javax.websocket.server.PathParam;
-import javax.websocket.server.ServerEndpoint;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
-
-@Component
-@CrossOrigin
-@ServerEndpoint(value = "/websocket/{userId}")
-@Scope("prototype")
-public class WebSocket {
-
-    private static ITaskService iTaskService;
-
-    private final static Logger logger = LogManager.getLogger(WebSocket.class);
-    private static int onlineCount = 0;
-    private static ConcurrentHashMap<String, WebSocket> webSocketMap = new ConcurrentHashMap<>();
-    private static ConcurrentHashMap<String, String> webSocketMessageMap = new ConcurrentHashMap<>();
-    private Session session;
-    private String userId;
-
-    /**
-     * 注入service
-     */
-    @Autowired
-    public void setApplicationContext(ITaskService iTaskService) {
-        WebSocket.iTaskService = iTaskService;
-    }
-
-    public static Map<String, WebSocket> getWebSocketMap() {
-        return webSocketMap;
-    }
-
-    public static Map<String, String> getWebSocketMessageMap() {
-        return webSocketMessageMap;
-    }
-
-    @OnOpen
-    public void onOpen(Session session, @PathParam("userId") String userId) {
-        this.session = session;
-        this.userId = userId;
-        //加入map
-        webSocketMap.put(userId, this);
-        addOnlineCount();//在线数加1
-        logger.info("用户:{}连接成功,当前在线人数为{}人", userId, getOnlineCount());
-        try {
-            sendMessage(String.valueOf(this.session.getQueryString()));
-        } catch (IOException e) {
-            logger.error("IO异常");
-        }
-    }
-
-    @OnClose
-    public void onClose() {
-        //从map中删除
-        webSocketMap.remove(userId);
-        webSocketMessageMap.remove(userId);
-        subOnlineCount(); //在线数减1
-        logger.info("用户:{}关闭了连接!当前在线人数为{}人", userId, getOnlineCount());
-    }
-
-    /**
-     * 收到客户端消息后调用的方法
-     *
-     * @param message 客户端发送过来的消息
-     */
-    @OnMessage
-    public void onMessage(String message, Session session) {
-        if (StringUtils.isNotEmpty(userId)) {
-            webSocketMessageMap.put(userId, message);
-
-            logger.info("来自客户端用户:{} 消息:{}", userId, message);
-            String projectId = message.split(",")[0];
-            String contractId = message.split(",")[1];
-            //客户端
-            Map<String, String> stringMap = iTaskService.getTaskCount(projectId, contractId, userId);
-
-            try {
-                webSocketMap.get(userId).sendMessage(JSON.toJSONString(stringMap));
-            } catch (IOException e) {
-                e.printStackTrace();
-            }
-
-        } else {
-            logger.info("未获取到用户信息,接收消息失败");
-        }
-    }
-
-    /**
-     * 发生错误时调用
-     */
-    @OnError
-    public void onError(Session session, Throwable error) {
-        logger.error("用户错误:" + this.userId + ",原因:" + error.getMessage());
-        error.printStackTrace();
-    }
-
-    /**
-     * 向客户端发送消息
-     */
-    public void sendMessage(String message) throws IOException {
-        //同步
-        //this.session.getBasicRemote().sendText(message);
-
-        //异步
-        this.session.getAsyncRemote().sendText(message);
-    }
-
-    /**
-     * 通过userId向客户端发送消息
-     */
-    public void sendMessageByUserId(String userId, String message) throws IOException {
-        logger.info("服务端发送消息到{},消息:{}", userId, message);
-        if (StrUtil.isNotBlank(userId) && webSocketMap.containsKey(userId)) {
-            webSocketMap.get(userId).sendMessage(message);
-        } else {
-            logger.error("用户{}不在线", userId);
-        }
-    }
-
-    /**
-     * 群发自定义消息
-     */
-    public static void sendInfo(String message) throws IOException {
-        for (String item : webSocketMap.keySet()) {
-            try {
-                webSocketMap.get(item).sendMessage(message);
-            } catch (IOException e) {
-                continue;
-            }
-        }
-    }
-
-    public static synchronized int getOnlineCount() {
-        return onlineCount;
-    }
-
-    public static synchronized void addOnlineCount() {
-        WebSocket.onlineCount++;
-    }
-
-    public static synchronized void subOnlineCount() {
-        WebSocket.onlineCount--;
-    }
-
-    /***
-     * 定时重发任务消息WebSocket - 客户端
-     */
-    @Scheduled(cron = "0 0/5 * * * ?")
-    public void reSendMessage() throws IOException {
-        if (webSocketMap.isEmpty() || webSocketMessageMap.isEmpty()) {
-            return;
-        }
-
-        logger.info("定时重发消息WebSocket,reSendMessage()方法执行成功,入参:webSocketMap->{},webSocketMessageMap->{}", webSocketMap, webSocketMessageMap);
-
-        Set<Map.Entry<String, String>> message = webSocketMessageMap.entrySet();
-
-        List<Map<String, String>> maps = new ArrayList<>();
-
-        for (Map.Entry<String, String> entry : message) {
-            String userId = entry.getKey();
-            String projectAndContractId = entry.getValue();
-            if (projectAndContractId.contains(",") && StringUtils.isNotEmpty(userId)) {
-                //客户端
-                String projectId = projectAndContractId.split(",")[0];
-                String contractId = projectAndContractId.split(",")[1];
-                Map<String, String> stringMap = iTaskService.getTaskCount(projectId, contractId, userId);
-                maps.add(stringMap);
-            }
-        }
-
-        for (Map<String, String> map : maps) {
-            String userId = map.get("userId");
-            webSocketMap.get(userId).sendMessage(JSON.toJSONString(map));
-            logger.info("给用户{}重发消息{}", userId, map);
-        }
-
-        logger.info("定时重发消息WebSocket,reSendMessage()方法执行结束");
-    }
-
-}
-
-

+ 0 - 196
blade-service/blade-business/src/main/java/org/springblade/business/socket/WebSocketManager.java

@@ -1,196 +0,0 @@
-package org.springblade.business.socket;
-
-import cn.hutool.core.util.StrUtil;
-import com.alibaba.fastjson.JSON;
-import org.apache.commons.lang.StringUtils;
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
-import org.springblade.business.service.ITaskService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
-import org.springframework.scheduling.annotation.Scheduled;
-import org.springframework.stereotype.Component;
-import org.springframework.web.bind.annotation.CrossOrigin;
-
-import javax.websocket.*;
-import javax.websocket.server.PathParam;
-import javax.websocket.server.ServerEndpoint;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
-
-@Component
-@CrossOrigin
-@ServerEndpoint(value = "/websocket/manager/{userId}")
-@Scope("prototype")
-public class WebSocketManager {
-
-    private static ITaskService iTaskService;
-
-    private final static Logger logger = LogManager.getLogger(WebSocketManager.class);
-    private static int onlineCount = 0;
-    private static ConcurrentHashMap<String, WebSocketManager> webSocketMap2 = new ConcurrentHashMap<>();
-    private static ConcurrentHashMap<String, String> webSocketMessageMap2 = new ConcurrentHashMap<>();
-    private Session session;
-    private String userId;
-
-    /**
-     * 注入service
-     */
-    @Autowired
-    public void setApplicationContext(ITaskService iTaskService) {
-        WebSocketManager.iTaskService = iTaskService;
-    }
-
-    public static Map<String, WebSocketManager> getWebSocketMap() {
-        return webSocketMap2;
-    }
-
-    public static Map<String, String> getWebSocketMessageMap() {
-        return webSocketMessageMap2;
-    }
-
-    @OnOpen
-    public void onOpen(Session session, @PathParam("userId") String userId) {
-        this.session = session;
-        this.userId = userId;
-        //加入map
-        webSocketMap2.put(userId, this);
-        addOnlineCount();//在线数加1
-        logger.info("用户:{}连接成功,当前在线人数为{}人", userId, getOnlineCount());
-        try {
-            sendMessage(String.valueOf(this.session.getQueryString()));
-        } catch (IOException e) {
-            logger.error("IO异常");
-        }
-    }
-
-    @OnClose
-    public void onClose() {
-        //从map中删除
-        webSocketMap2.remove(userId);
-        webSocketMessageMap2.remove(userId);
-        subOnlineCount(); //在线数减1
-        logger.info("用户:{}关闭了连接!当前在线人数为{}人", userId, getOnlineCount());
-    }
-
-    /**
-     * 收到后管消息后调用的方法
-     *
-     * @param message 后管发送过来的消息
-     */
-    @OnMessage
-    public void onMessage(String message, Session session) {
-        if (StringUtils.isNotEmpty(userId)) {
-            webSocketMessageMap2.put(userId, message);
-            logger.info("来自后管用户:{} 消息:{}", userId, message);
-            userId = message;
-
-            //后管
-            Map<String, String> stringMap = iTaskService.getTaskCount(null, null, userId);
-
-            try {
-                webSocketMap2.get(userId).sendMessage(JSON.toJSONString(stringMap));
-            } catch (IOException e) {
-                e.printStackTrace();
-            }
-
-        } else {
-            logger.info("未获取到用户信息,接收消息失败");
-        }
-    }
-
-    /**
-     * 发生错误时调用
-     */
-    @OnError
-    public void onError(Session session, Throwable error) {
-        logger.error("用户错误:" + this.userId + ",原因:" + error.getMessage());
-        error.printStackTrace();
-    }
-
-    /**
-     * 向客户端发送消息
-     */
-    public void sendMessage(String message) throws IOException {
-        //同步
-        //this.session.getBasicRemote().sendText(message);
-
-        //异步
-        this.session.getAsyncRemote().sendText(message);
-    }
-
-    /**
-     * 通过userId向客户端发送消息
-     */
-    public void sendMessageByUserId(String userId, String message) throws IOException {
-        logger.info("服务端发送消息到{},消息:{}", userId, message);
-        if (StrUtil.isNotBlank(userId) && webSocketMap2.containsKey(userId)) {
-            webSocketMap2.get(userId).sendMessage(message);
-        } else {
-            logger.error("用户{}不在线", userId);
-        }
-    }
-
-    /**
-     * 群发自定义消息
-     */
-    public static void sendInfo(String message) throws IOException {
-        for (String item : webSocketMap2.keySet()) {
-            try {
-                webSocketMap2.get(item).sendMessage(message);
-            } catch (IOException e) {
-                continue;
-            }
-        }
-    }
-
-    public static synchronized int getOnlineCount() {
-        return onlineCount;
-    }
-
-    public static synchronized void addOnlineCount() {
-        WebSocketManager.onlineCount++;
-    }
-
-    public static synchronized void subOnlineCount() {
-        WebSocketManager.onlineCount--;
-    }
-
-    /***
-     * 定时重发任务消息WebSocket - 后管
-     */
-    @Scheduled(cron = "0 0/5 * * * ?")
-    public void reSendMessageManager() throws IOException {
-        if (webSocketMap2.isEmpty() || webSocketMessageMap2.isEmpty()) {
-            return;
-        }
-
-        logger.info("定时重发消息WebSocket,reSendMessageManager()方法执行成功,入参:webSocketMap->{},webSocketMessageMap->{}", webSocketMap2, webSocketMessageMap2);
-
-        Set<Map.Entry<String, String>> message = webSocketMessageMap2.entrySet();
-
-        List<Map<String, String>> maps = new ArrayList<>();
-
-        for (Map.Entry<String, String> entry : message) {
-            String userId = entry.getKey();
-            //后管
-            Map<String, String> stringMap = iTaskService.getTaskCount(null, null, userId);
-            maps.add(stringMap);
-        }
-
-        for (Map<String, String> map : maps) {
-            String userId = map.get("userId");
-            webSocketMap2.get(userId).sendMessage(JSON.toJSONString(map));
-            logger.info("给用户{}重发消息{}", userId, map);
-        }
-
-        logger.info("定时重发消息WebSocket,reSendMessageManager()方法执行结束");
-    }
-
-}
-
-

+ 138 - 92
blade-service/blade-manager/src/main/java/org/springblade/manager/controller/ExcelTabController.java

@@ -68,6 +68,8 @@ import org.springblade.resource.vo.NewBladeFile;
 import org.springblade.system.cache.ParamCache;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.data.redis.core.StringRedisTemplate;
+import org.springframework.http.HttpHeaders;
+import org.springframework.http.MediaType;
 import org.springframework.jdbc.core.BeanPropertyRowMapper;
 import org.springframework.jdbc.core.JdbcTemplate;
 import org.springframework.transaction.annotation.Transactional;
@@ -80,7 +82,11 @@ import javax.validation.Valid;
 import java.awt.*;
 import java.awt.image.BufferedImage;
 import java.io.*;
+import java.net.URL;
 import java.net.URLEncoder;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.StandardCopyOption;
 import java.text.SimpleDateFormat;
 import java.util.List;
 import java.util.*;
@@ -319,7 +325,7 @@ public class ExcelTabController extends BladeController {
         // 上传excel文件
         BladeFile bladeFile = newIOSSClient.uploadFile(file.getOriginalFilename(), exceUrl);
 
-        if(bladeFile==null || ObjectUtil.isEmpty(bladeFile)){
+        if (bladeFile == null || ObjectUtil.isEmpty(bladeFile)) {
             return R.fail("oss上传失败,请校验oss配置是否正确");
         }
         // 解析原始excel
@@ -633,7 +639,7 @@ public class ExcelTabController extends BladeController {
     @ApiImplicitParams(value = {
             @ApiImplicitParam(name = "pkeyId", value = "pkeyId", required = true)
     })
-    public R getExcelHtmlByBuss(Long pkeyId){
+    public R getExcelHtmlByBuss(Long pkeyId) {
 
         WbsTreeContract wbsTreeContract = wbsTreeContractService.getBaseMapper().selectOne(Wrappers.<WbsTreeContract>query().lambda()
                 .eq(WbsTreeContract::getPKeyId, pkeyId));
@@ -743,7 +749,7 @@ public class ExcelTabController extends BladeController {
             doc.select("Col").remove();
             fileInputStream.close();
             return R.data(table + "");
-        }catch (Exception e){
+        } catch (Exception e) {
             return R.fail("暂无表单!");
         }
     }
@@ -1828,7 +1834,7 @@ public class ExcelTabController extends BladeController {
             @ApiImplicitParam(name = "pkeyId", value = "pkeyId", required = true)
     })
     public R getBussDataInfo(Long pkeyId) throws FileNotFoundException {
-        return R.data(excelTabService.getBussDataInfo(pkeyId, 0,true));
+        return R.data(excelTabService.getBussDataInfo(pkeyId, 0, true));
     }
 
 
@@ -2024,10 +2030,10 @@ public class ExcelTabController extends BladeController {
     })
     public R getPdfS(String nodeId, String classify, String contractId) throws FileNotFoundException {
         String file_path = FileUtils.getSysLocalFileUrl();
-        Boolean aBoolean = RedisTemplate.hasKey("pdf-" + nodeId+"-"+classify);
-        if(aBoolean){
+        Boolean aBoolean = RedisTemplate.hasKey("pdf-" + nodeId + "-" + classify);
+        if (aBoolean) {
             Long expire = RedisTemplate.getExpire("pdf-" + nodeId + "-" + classify);
-            return R.fail("pdf正在生成,还有"+expire+"秒");
+            return R.fail("pdf正在生成,还有" + expire + "秒");
         }
 
         //获取节点下的所有表单,和附件,如果表单全是隐藏的,并且没有附件,则提示暂无数据
@@ -2147,7 +2153,7 @@ public class ExcelTabController extends BladeController {
         List<AppWbsTreeContractVO> tableAll = new ArrayList<>();
         List<TableInfo> tableInfoList = this.excelTabService.getTableInfoList(dataArray);
         if (tableInfoList != null) {
-            tableAll = wbsTreeContractService.searchNodeAllTable(nodeId, "1", contractId, projectId,null);
+            tableAll = wbsTreeContractService.searchNodeAllTable(nodeId, "1", contractId, projectId, null);
             List<Long> tableAllIds = tableAll.stream().map(AppWbsTreeContractVO::getPKeyId).collect(Collectors.toList());
             if (tableAll.size() > tableInfoList.size()) {
                 List<Long> exclude = tableInfoList.stream().map(TableInfo::getPkeyId).map(Long::parseLong).collect(Collectors.toList());
@@ -2224,7 +2230,8 @@ public class ExcelTabController extends BladeController {
     }
 
 
-    public static final  String CACHE_DEL="delete from m_cache where remark is null";
+    public static final String CACHE_DEL = "delete from m_cache where remark is null";
+
     @GetMapping("/data-batch-refresh")
     @ApiOperationSupport(order = 100)
     @ApiOperation(value = "批量重新保存", notes = "批量重新保存")
@@ -2233,115 +2240,114 @@ public class ExcelTabController extends BladeController {
             @ApiImplicitParam(name = "reset", value = "是否重置任务,是:1 否:非1"),
             @ApiImplicitParam(name = "mode", value = "执行模式,0未上报,1已上报,2全部", required = true)
     })
-    public R saveBussDataBatchRefresh(Long pkeyId,Integer mode,Integer reset){
+    public R saveBussDataBatchRefresh(Long pkeyId, Integer mode, Integer reset) {
         /*进度条(未上报30工序执行一批)(已上报15工序执行一批)*/
-        WbsTreeContract parent =this.wbsTreeContractService.getOne(Wrappers.<WbsTreeContract>lambdaQuery().eq(WbsTreeContract::getPKeyId,pkeyId));
-        if(reset!=null&&reset==1){
+        WbsTreeContract parent = this.wbsTreeContractService.getOne(Wrappers.<WbsTreeContract>lambdaQuery().eq(WbsTreeContract::getPKeyId, pkeyId));
+        if (reset != null && reset == 1) {
             /*重置任务*/
             this.jdbcTemplate.execute(CACHE_DEL);
         }
-        this.batchRedo(parent.getProjectId(),parent.getContractId(),parent.getTreeCode(),"1", mode);
-       return   R.success("完成");
+        this.batchRedo(parent.getProjectId(), parent.getContractId(), parent.getTreeCode(), "1", mode);
+        return R.success("完成");
     }
 
-    public void batchInsert(List<String> sqlInit){
+    public void batchInsert(List<String> sqlInit) {
         try {
             List<List<String>> sqlListSeg = BaseUtils.splitList(sqlInit, 200);
             sqlListSeg.parallelStream().map(l -> String.join(";", l)).forEach(this.jdbcTemplate::execute);
-        }catch (Exception e){
+        } catch (Exception e) {
             e.printStackTrace();
         }
     }
 
 
-
-    public void batchRedo(String projectId,String contractId,String treeCode,String classify ,Integer mode){
-        String XXt="002004";
-        List<String> list= this.jdbcTemplate.queryForList("select tree_code treeCode from m_wbs_tree_contract where  contract_id=1630017379264610305 and is_deleted=0 and (id in(1541601335840210946,1541601355272421378,1703032661549219842,1541708754314547201,1575309161938681858) or old_id in(1541601335840210946,1541601355272421378,1703032661549219842,1541708754314547201,1575309161938681858)) and tree_code is not null ORDER BY tree_code",String.class);
-       if(list.size()<1){
-           return;
-       }
-       Set<String> treeCodeSet = new HashSet<>(list);
-       List<String>treeCodeList = new ArrayList<>();
-        treeCodeSet.forEach(t->{
-            if(BaseUtils.notInChain(treeCodeList,t)){
+    public void batchRedo(String projectId, String contractId, String treeCode, String classify, Integer mode) {
+        String XXt = "002004";
+        List<String> list = this.jdbcTemplate.queryForList("select tree_code treeCode from m_wbs_tree_contract where  contract_id=1630017379264610305 and is_deleted=0 and (id in(1541601335840210946,1541601355272421378,1703032661549219842,1541708754314547201,1575309161938681858) or old_id in(1541601335840210946,1541601355272421378,1703032661549219842,1541708754314547201,1575309161938681858)) and tree_code is not null ORDER BY tree_code", String.class);
+        if (list.size() < 1) {
+            return;
+        }
+        Set<String> treeCodeSet = new HashSet<>(list);
+        List<String> treeCodeList = new ArrayList<>();
+        treeCodeSet.forEach(t -> {
+            if (BaseUtils.notInChain(treeCodeList, t)) {
                 treeCodeList.add(t);
             }
         });
         /*删除测试分支*/
-        treeCodeList.removeIf(s->s.startsWith(XXt));
-        if(Func.isNotEmpty(contractId)&&Func.isNotBlank(treeCode)) {
+        treeCodeList.removeIf(s -> s.startsWith(XXt));
+        if (Func.isNotEmpty(contractId) && Func.isNotBlank(treeCode)) {
             /*List<Map<String, Object>> listMaps = this.jdbcTemplate.queryForList("select a.p_key_id pkeyId,a.update_user user,b.status from m_wbs_tree_contract a join u_information_query b on a.p_key_id = b.wbs_id where a.contract_id=" + contractId + " and a.is_deleted=0 and b.is_deleted=0 and b.classify=1 and a.node_type=6 and a.tree_code like '" + treeCode + "%' and b.is_deleted=0 ORDER BY a.sort");*/
             List<Redo> redoList = this.jdbcTemplate.query("select  a.p_key_id pkeyId,a.update_user userId,b.status,tree_code treeCode from m_wbs_tree_contract a join u_information_query b on a.p_key_id = b.wbs_id where a.contract_id=" + contractId + " and a.is_deleted=0 and b.is_deleted=0 and b.classify=1 and a.node_type=6 and a.tree_code like '" + treeCode + "%' and b.is_deleted=0 ORDER BY a.tree_code", new BeanPropertyRowMapper<>(Redo.class));
-            redoList.removeIf(x->!BaseUtils.inChain(treeCodeList,x.getTreeCode()));
-            List<Map<String,Object>> excludeListMap = this.jdbcTemplate.queryForList("select id  from m_cache where remark is null");
-            if(excludeListMap.size()>0){
-               List<String>  excludeList=  excludeListMap.stream().map(m->m.get("id").toString()).collect(Collectors.toList());
-               /*排除已经执行的*/
-                redoList.removeIf(x->excludeList.contains(x.getPkeyId()));
+            redoList.removeIf(x -> !BaseUtils.inChain(treeCodeList, x.getTreeCode()));
+            List<Map<String, Object>> excludeListMap = this.jdbcTemplate.queryForList("select id  from m_cache where remark is null");
+            if (excludeListMap.size() > 0) {
+                List<String> excludeList = excludeListMap.stream().map(m -> m.get("id").toString()).collect(Collectors.toList());
+                /*排除已经执行的*/
+                redoList.removeIf(x -> excludeList.contains(x.getPkeyId()));
             }
             /*st03 未上报 st12 已上报*/
-            boolean st03=false,st12=false;
-            if(mode==2){
-                st03=true;
-                st12=true;
-            }else if(mode==0){
-                st03=true;
-            }else if(mode==1){
-                st12=true;
+            boolean st03 = false, st12 = false;
+            if (mode == 2) {
+                st03 = true;
+                st12 = true;
+            } else if (mode == 0) {
+                st03 = true;
+            } else if (mode == 1) {
+                st12 = true;
             }
             if (redoList.size() > 0) {
                 /*未上报*/
-                List<String> status0 = redoList.stream().filter(m -> m.getStatus().equals(0)||m.getStatus().equals(3)).map(Redo::getPkeyId).collect(Collectors.toList());
+                List<String> status0 = redoList.stream().filter(m -> m.getStatus().equals(0) || m.getStatus().equals(3)).map(Redo::getPkeyId).collect(Collectors.toList());
                 /*已上报*/
-                List<String> status12 = redoList.stream().filter(m -> m.getStatus().equals(1)||m.getStatus().equals(2)).map(Redo::getPkeyId).collect(Collectors.toList());
-                if(status0.size()>0&&st03){
-                   List<List<String>> status0Seg=  BaseUtils.splitList(status0,30);
-                   List<String> sqlIntA= new ArrayList<>();
-                   String start ="未上报数据共计"+status0.size()+"条,开始任务";
+                List<String> status12 = redoList.stream().filter(m -> m.getStatus().equals(1) || m.getStatus().equals(2)).map(Redo::getPkeyId).collect(Collectors.toList());
+                if (status0.size() > 0 && st03) {
+                    List<List<String>> status0Seg = BaseUtils.splitList(status0, 30);
+                    List<String> sqlIntA = new ArrayList<>();
+                    String start = "未上报数据共计" + status0.size() + "条,开始任务";
                     StaticLog.info(start);
-                   AtomicInteger sum= new AtomicInteger();
-                   sqlIntA.add("insert into m_cache (id,remark,create_time) VALUES ("+SnowFlakeUtil.getId()+",'"+start+"',NOW())");
-                   status0Seg.forEach(l->{
-                       try {
-                           sqlIntA.addAll(l.stream().map(id->"insert into m_cache (id) VALUES ("+id+")").collect(Collectors.toList()));
-                           this.synPDFInfo(contractId,String.join(",",l),"1",projectId);
-                           sum.addAndGet(l.size());
-                           double d=100*(double) sum.get()/(double)status0.size();
-                           String str ="未上报数据共计"+status0.size()+"条,已经执行"+sum.get()+"条("+d+"%)";
-                           sqlIntA.add("insert into m_cache (id,remark,create_time) VALUES ("+SnowFlakeUtil.getId()+",'"+str+"',NOW())");
-                           this.batchInsert(sqlIntA);
-                          sqlIntA.clear();
-                       }catch (Exception e){
-                           e.printStackTrace();
-                       }
-                   });
+                    AtomicInteger sum = new AtomicInteger();
+                    sqlIntA.add("insert into m_cache (id,remark,create_time) VALUES (" + SnowFlakeUtil.getId() + ",'" + start + "',NOW())");
+                    status0Seg.forEach(l -> {
+                        try {
+                            sqlIntA.addAll(l.stream().map(id -> "insert into m_cache (id) VALUES (" + id + ")").collect(Collectors.toList()));
+                            this.synPDFInfo(contractId, String.join(",", l), "1", projectId);
+                            sum.addAndGet(l.size());
+                            double d = 100 * (double) sum.get() / (double) status0.size();
+                            String str = "未上报数据共计" + status0.size() + "条,已经执行" + sum.get() + "条(" + d + "%)";
+                            sqlIntA.add("insert into m_cache (id,remark,create_time) VALUES (" + SnowFlakeUtil.getId() + ",'" + str + "',NOW())");
+                            this.batchInsert(sqlIntA);
+                            sqlIntA.clear();
+                        } catch (Exception e) {
+                            e.printStackTrace();
+                        }
+                    });
 
                 }
-                if(status12.size()>0&&st12){
+                if (status12.size() > 0 && st12) {
                     try {
                         String nodeIds = status12.stream().distinct().collect(Collectors.joining(","));
-                        List<Map<String,Object>> taskList= this.jdbcTemplate.queryForList("select c.id taskId,b.wbs_id nodeId  from  u_information_query b   join u_task c on b.id=c.form_data_id where  b.is_deleted=0 and b.classify=1 and b.status in(1,2)and b.wbs_id in("+nodeIds+") ORDER BY c.update_time ");
-                        List<String> taskIds= taskList.stream().collect(Collectors.toMap(m->m.get("nodeId"),m->m,(m1,m2)->m2)).values().stream().map(m->m.get("taskId").toString()).collect(Collectors.toList());
-                        if(taskIds.size()>0) {
+                        List<Map<String, Object>> taskList = this.jdbcTemplate.queryForList("select c.id taskId,b.wbs_id nodeId  from  u_information_query b   join u_task c on b.id=c.form_data_id where  b.is_deleted=0 and b.classify=1 and b.status in(1,2)and b.wbs_id in(" + nodeIds + ") ORDER BY c.update_time ");
+                        List<String> taskIds = taskList.stream().collect(Collectors.toMap(m -> m.get("nodeId"), m -> m, (m1, m2) -> m2)).values().stream().map(m -> m.get("taskId").toString()).collect(Collectors.toList());
+                        if (taskIds.size() > 0) {
                             /*处理已经上报部分 */
-                            List<List<String>> taskIdsSeg=  BaseUtils.splitList(taskIds,15);
-                            List<String> sqlIntA= new ArrayList<>();
-                            String start ="已经上报数据共计"+taskIds.size()+"条,开始任务";
+                            List<List<String>> taskIdsSeg = BaseUtils.splitList(taskIds, 15);
+                            List<String> sqlIntA = new ArrayList<>();
+                            String start = "已经上报数据共计" + taskIds.size() + "条,开始任务";
                             StaticLog.info(start);
-                            AtomicInteger sum= new AtomicInteger();
-                            sqlIntA.add("insert into m_cache (id,remark,create_time) VALUES ("+SnowFlakeUtil.getId()+",'"+start+"',NOW())");
-                            taskIdsSeg.forEach(l->{
+                            AtomicInteger sum = new AtomicInteger();
+                            sqlIntA.add("insert into m_cache (id,remark,create_time) VALUES (" + SnowFlakeUtil.getId() + ",'" + start + "',NOW())");
+                            taskIdsSeg.forEach(l -> {
                                 try {
-                                    sqlIntA.addAll(l.stream().map(id->"insert into m_cache (id) VALUES ("+id+")").collect(Collectors.toList()));
-                                    this.taskClient.reSigningEVisa(String.join(",",l),contractId,projectId,AuthUtil.getHeader());
+                                    sqlIntA.addAll(l.stream().map(id -> "insert into m_cache (id) VALUES (" + id + ")").collect(Collectors.toList()));
+                                    this.taskClient.reSigningEVisa(String.join(",", l), contractId, projectId, AuthUtil.getHeader());
                                     sum.addAndGet(l.size());
-                                    double d=100*(double) sum.get()/(double)taskIds.size();
-                                    String str ="未上报数据共计"+taskIdsSeg.size()+"条,已经执行"+sum.get()+"条("+d+"%)";
-                                    sqlIntA.add("insert into m_cache (id,remark,create_time) VALUES ("+SnowFlakeUtil.getId()+",'"+str+"',NOW())");
+                                    double d = 100 * (double) sum.get() / (double) taskIds.size();
+                                    String str = "未上报数据共计" + taskIdsSeg.size() + "条,已经执行" + sum.get() + "条(" + d + "%)";
+                                    sqlIntA.add("insert into m_cache (id,remark,create_time) VALUES (" + SnowFlakeUtil.getId() + ",'" + str + "',NOW())");
                                     this.batchInsert(sqlIntA);
                                     sqlIntA.clear();
-                                }catch (Exception e){
+                                } catch (Exception e) {
                                     e.printStackTrace();
                                 }
                             });
@@ -2350,14 +2356,15 @@ public class ExcelTabController extends BladeController {
                         e.printStackTrace();
                     }
                 }
-                this.jdbcTemplate.execute("insert into m_cache (id,remark,create_time) VALUES ("+SnowFlakeUtil.getId()+",'完成',NOW())");
+                this.jdbcTemplate.execute("insert into m_cache (id,remark,create_time) VALUES (" + SnowFlakeUtil.getId() + ",'完成',NOW())");
             }
         }
     }
-   @Deprecated
-    public void redo(String nodeId,String projectId,String contractId, String classify) throws Exception {
+
+    @Deprecated
+    public void redo(String nodeId, String projectId, String contractId, String classify) throws Exception {
         JSONArray dataArray = new JSONArray();
-        List<AppWbsTreeContractVO> tableAll  = wbsTreeContractService.searchNodeAllTable(nodeId, "1", contractId, projectId,null);
+        List<AppWbsTreeContractVO> tableAll = wbsTreeContractService.searchNodeAllTable(nodeId, "1", contractId, projectId, null);
         List<Long> tableAllIds = tableAll.stream().map(AppWbsTreeContractVO::getPKeyId).collect(Collectors.toList());
         for (Long pk : tableAllIds) {
             Map<String, Object> jo = this.excelTabService.getBussDataInfo(pk, 1);
@@ -2419,6 +2426,7 @@ public class ExcelTabController extends BladeController {
         //更新缓存
         informationQueryClient.delAsyncWbsTree(contractId);
     }
+
     /***
      * 覆盖上传-  (修改为上传导入模板)
      */
@@ -3754,7 +3762,7 @@ public class ExcelTabController extends BladeController {
     @ApiImplicitParams(value = {
             @ApiImplicitParam(name = "pkeyId", value = "pkeyId", required = true)
     })
-    public R getHtmlBussCols(Long pkeyId)  {
+    public R getHtmlBussCols(Long pkeyId) {
         String file_path = ParamCache.getValue(CommonConstant.SYS_LOCAL_URL);
         String sys_file_net_url = ParamCache.getValue(CommonConstant.SYS_FILE_NET_URL);
         WbsTreeContract wbsTreeContract = wbsTreeContractService.getBaseMapper().selectOne(Wrappers.<WbsTreeContract>query().lambda()
@@ -3810,7 +3818,7 @@ public class ExcelTabController extends BladeController {
                 res[i] = redata.get(i).toArray(new String[redata.get(i).size()]);
             }
             return R.data(res);
-        }catch (Exception e){
+        } catch (Exception e) {
             return R.fail("暂无表单!");
         }
     }
@@ -4025,7 +4033,7 @@ public class ExcelTabController extends BladeController {
                 String classify = dataMap.get("classify") + "";
                 String contractId = dataMap.get("contract_id") + "";
                 String projectId = dataMap.get("project_id") + "";
-                List<AppWbsTreeContractVO> tableAll = wbsTreeContractService.searchNodeAllTable(nodeId, classify, contractId, projectId,null);
+                List<AppWbsTreeContractVO> tableAll = wbsTreeContractService.searchNodeAllTable(nodeId, classify, contractId, projectId, null);
                 if (tableAll != null && tableAll.size() >= 1) {
                     for (AppWbsTreeContractVO tab : tableAll) {
                         try {
@@ -4071,9 +4079,9 @@ public class ExcelTabController extends BladeController {
             dataArray.add(dataInfo);
         }
         this.excelTabService.formulaFillData2(dataArray, ExecuteType.INSPECTION);
-        if(dataArray!=null && dataArray.size()>=1){
+        if (dataArray != null && dataArray.size() >= 1) {
             return excelTabService.saveBussData(dataArray);
-        }else{
+        } else {
             return R.fail("公式报错,导致保存接口无入参数");
         }
     }
@@ -4119,7 +4127,6 @@ public class ExcelTabController extends BladeController {
     }
 
 
-
     @PostMapping("/save_nodeId")
     @ApiOperationSupport(order = 72)
     @ApiOperation(value = "pdf", notes = "pdf")
@@ -4152,7 +4159,7 @@ public class ExcelTabController extends BladeController {
             for (String noId : nodeId) {
                 JSONObject js = new JSONObject();
                 JSONObject js2 = new JSONObject();
-                List<AppWbsTreeContractVO> tableAll = wbsTreeContractService.searchNodeAllTable(noId, classify, contractId, projectId,null);
+                List<AppWbsTreeContractVO> tableAll = wbsTreeContractService.searchNodeAllTable(noId, classify, contractId, projectId, null);
                 JSONArray array = new JSONArray();
                 if (tableAll != null && tableAll.size() >= 1) {
                     for (AppWbsTreeContractVO tab : tableAll) {
@@ -4186,4 +4193,43 @@ public class ExcelTabController extends BladeController {
         return R.data("成功");
     }
 
+    @PostMapping("/test-downLoad-excel")
+    @ApiOperationSupport(order = 73)
+    public void testDownLoadExcel(@RequestParam String parentId, @RequestParam String aliasId, HttpServletResponse response) {
+        String sql = "SELECT" +
+                " a.NAME," +
+                " a.file_url" +
+                " FROM" +
+                " m_excel_tab a " +
+                " WHERE" +
+                " a.is_deleted = 0 " +
+                " AND a.parent_id = " + parentId +
+                " AND a.alias LIKE concat(" +
+                " concat( '%', " + aliasId + ", '%' ) )" +
+                " AND a.tenant_id = 000000 " +
+                " ORDER BY" +
+                " a.sort," +
+                " a.create_time";
+        List<ExcelTab> excelTabs = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(ExcelTab.class));
+
+        response.setHeader(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=excel_download.zip");
+        response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
+
+        File uploadFolder = new File("D:/download/excelFile");
+        uploadFolder.mkdirs();
+
+        for (ExcelTab excelTab : excelTabs) {
+            String fileName = excelTab.getName();
+            String fileUrl = excelTab.getFileUrl();
+
+            try (InputStream inputStream = new URL(fileUrl).openStream()) {
+                Path targetPath = new File(uploadFolder, fileName + ".xlsx").toPath();
+                Files.copy(inputStream, targetPath, StandardCopyOption.REPLACE_EXISTING);
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        }
+    }
+
+
 }

+ 24 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/feign/ManagerWebSocketClientImpl.java

@@ -0,0 +1,24 @@
+package org.springblade.manager.feign;
+
+import lombok.AllArgsConstructor;
+import org.springblade.business.feign.OpinionUserClient;
+import org.springblade.core.tenant.annotation.NonDS;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.Map;
+
+@RestController
+@AllArgsConstructor
+@NonDS
+public class ManagerWebSocketClientImpl implements ManagerWebSocketClient {
+
+    private final OpinionUserClient opinionUserClient;
+
+    @Override
+    @GetMapping(value = "/manager/getWebsocketMsg")
+    public Map<String, String> getWebsocketMsg(String projectId, String contractId, String userIdResult) {
+        return opinionUserClient.getWebsocketMsg(projectId, contractId, userIdResult);
+    }
+
+}

+ 1 - 1
blade-service/blade-meter/pom.xml

@@ -11,7 +11,7 @@
 
     <artifactId>blade-meter</artifactId>
     <name>${project.artifactId}</name>
-    <version>${blade.project.version}</version>
+    <version>${bladex.project.version}</version>
     <packaging>jar</packaging>
 
     <dependencies>

+ 66 - 0
blade-service/blade-rabbitmq-consumer/pom.xml

@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         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">
+    <parent>
+        <artifactId>blade-service</artifactId>
+        <groupId>org.springblade</groupId>
+        <version>2.9.1.RELEASE</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>blade-rabbitmq-consumer</artifactId>
+    <name>${project.artifactId}</name>
+    <version>${bladex.project.version}</version>
+    <packaging>jar</packaging>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.springblade</groupId>
+            <artifactId>blade-core-boot</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springblade</groupId>
+            <artifactId>blade-archive-api</artifactId>
+            <version>2.9.1.RELEASE</version>
+        </dependency>
+        <dependency>
+            <groupId>org.springblade</groupId>
+            <artifactId>blade-manager-api</artifactId>
+            <version>2.9.1.RELEASE</version>
+        </dependency>
+        <dependency>
+            <groupId>org.springblade</groupId>
+            <artifactId>blade-business-api</artifactId>
+            <version>2.9.1.RELEASE</version>
+        </dependency>
+        <dependency>
+            <groupId>org.springblade</groupId>
+            <artifactId>blade-meter-api</artifactId>
+            <version>2.9.1.RELEASE</version>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-amqp</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-websocket</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-web</artifactId>
+            <exclusions>
+                <exclusion>
+                    <groupId>org.springframework.boot</groupId>
+                    <artifactId>spring-boot-starter-tomcat</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+    </dependencies>
+
+</project>

+ 18 - 0
blade-service/blade-rabbitmq-consumer/src/main/java/org/springblade/consumer/MQConsumerApplication.java

@@ -0,0 +1,18 @@
+package org.springblade.consumer;
+
+import org.springblade.common.constant.LauncherConstant;
+import org.springblade.core.cloud.feign.EnableBladeFeign;
+import org.springblade.core.launch.BladeApplication;
+import org.springframework.cloud.client.SpringCloudApplication;
+import org.springframework.scheduling.annotation.EnableAsync;
+
+@EnableAsync
+@EnableBladeFeign
+@SpringCloudApplication
+public class MQConsumerApplication {
+
+    public static void main(String[] args) {
+        BladeApplication.run(LauncherConstant.APPLICATION_MQ_CONSUMER, MQConsumerApplication.class, args);
+    }
+
+}

+ 2 - 3
blade-service/blade-business/src/main/java/org/springblade/business/socket/WebSocketConfig.java → blade-service/blade-rabbitmq-consumer/src/main/java/org/springblade/consumer/config/WebSocketConfig.java

@@ -1,4 +1,4 @@
-package org.springblade.business.socket;
+package org.springblade.consumer.config;
 
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
@@ -20,7 +20,7 @@ public class WebSocketConfig implements WebSocketMessageBrokerConfigurer {
     @Override
     public void registerStompEndpoints(StompEndpointRegistry registry) {
         registry.addEndpoint("/websocket")
-                .setAllowedOrigins("*") //跨域
+                .setAllowedOrigins("*")
                 .withSockJS();
     }
 
@@ -32,4 +32,3 @@ public class WebSocketConfig implements WebSocketMessageBrokerConfigurer {
     }
 
 }
-

+ 60 - 0
blade-service/blade-rabbitmq-consumer/src/main/java/org/springblade/consumer/service/RabbitMqConsumerService.java

@@ -0,0 +1,60 @@
+package org.springblade.consumer.service;
+
+import cn.hutool.core.util.ObjectUtil;
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+import org.springblade.consumer.socket.WebSocketEndpoint;
+import org.springframework.amqp.rabbit.annotation.RabbitListener;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.io.IOException;
+import java.util.Map;
+
+@Service
+public class RabbitMqConsumerService {
+
+    private static final Logger logger = LogManager.getLogger(RabbitMqConsumerService.class);
+    private final WebSocketEndpoint webSocketEndpoint;
+
+    @Autowired
+    public RabbitMqConsumerService(WebSocketEndpoint webSocketEndpoint) {
+        this.webSocketEndpoint = webSocketEndpoint;
+    }
+
+    private void processMessage(String queueName, String message) throws IOException {
+        ObjectMapper objectMapper = new ObjectMapper();
+        Map<String, Object> resultMap = objectMapper.readValue(message, new TypeReference<Map<String, Object>>() {
+        });
+        Object userId = resultMap.getOrDefault("userId", null);
+        if (ObjectUtil.isNotEmpty(userId)) {
+            webSocketEndpoint.sendMessageByUserId(userId.toString(), message);
+            logger.info("Pass " + queueName + " push msg to userId: " + userId + ",msg:" + message);
+        } else {
+            logger.info("No message for" + queueName + " was obtained,msg:" + message);
+        }
+    }
+
+    @RabbitListener(queues = "archiveQueue")
+    public void consumeMessageFromArchiveQueue(String message) throws IOException {
+        processMessage("archiveQueue", message);
+    }
+
+    @RabbitListener(queues = "managerQueue")
+    public void consumeMessageFromManagerQueue(String message) throws IOException {
+        processMessage("managerQueue", message);
+    }
+
+    @RabbitListener(queues = "businessQueue")
+    public void consumeMessageFromBusinessQueue(String message) throws IOException {
+        processMessage("businessQueue", message);
+    }
+
+    @RabbitListener(queues = "meterQueue")
+    public void consumeMessageFromMeterQueue(String message) throws IOException {
+        processMessage("meterQueue", message);
+    }
+
+}

+ 213 - 0
blade-service/blade-rabbitmq-consumer/src/main/java/org/springblade/consumer/socket/WebSocketEndpoint.java

@@ -0,0 +1,213 @@
+package org.springblade.consumer.socket;
+
+import cn.hutool.core.util.ObjectUtil;
+import cn.hutool.core.util.StrUtil;
+import com.alibaba.fastjson.JSON;
+import org.apache.commons.lang.StringUtils;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+import org.springblade.business.feign.BusinessWebSocketClient;
+import org.springblade.common.constant.ClientIdConstant;
+import org.springblade.feign.ArchiveWebSocketClient;
+import org.springblade.manager.feign.ManagerWebSocketClient;
+import org.springblade.meter.feign.MeterWebSocketClient;
+import org.springframework.beans.BeansException;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.ApplicationContextAware;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Component;
+import org.springframework.web.bind.annotation.CrossOrigin;
+
+import javax.websocket.*;
+import javax.websocket.server.PathParam;
+import javax.websocket.server.ServerEndpoint;
+import java.io.IOException;
+import java.util.*;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.Executors;
+import java.util.concurrent.ScheduledExecutorService;
+import java.util.concurrent.TimeUnit;
+
+@Component
+@CrossOrigin
+@ServerEndpoint(value = "/websocket/{userId}")
+public class WebSocketEndpoint implements ApplicationContextAware {
+
+    private static final ConcurrentHashMap<String, WebSocketEndpoint> webSocketMap = new ConcurrentHashMap<>();
+    private static final ConcurrentHashMap<String, String> webSocketMsgMap = new ConcurrentHashMap<>();
+    private static final Logger logger = LogManager.getLogger(WebSocketEndpoint.class);
+    private static int onlineCount = 0;
+    private Session session;
+    private String userId;
+
+    private static ArchiveWebSocketClient archiveWebSocketClient;
+    private static BusinessWebSocketClient businessWebSocketClient;
+    private static ManagerWebSocketClient managerWebSocketClient;
+    private static MeterWebSocketClient meterWebSocketClient;
+
+    @Override
+    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
+        WebSocketEndpoint.archiveWebSocketClient = applicationContext.getBean(ArchiveWebSocketClient.class);
+        WebSocketEndpoint.businessWebSocketClient = applicationContext.getBean(BusinessWebSocketClient.class);
+        WebSocketEndpoint.managerWebSocketClient = applicationContext.getBean(ManagerWebSocketClient.class);
+        WebSocketEndpoint.meterWebSocketClient = applicationContext.getBean(MeterWebSocketClient.class);
+    }
+
+    @OnOpen
+    public void onOpen(Session session, @PathParam("userId") String userId) {
+        this.session = session;
+        this.userId = userId;
+
+        ScheduledExecutorService executorService = Executors.newSingleThreadScheduledExecutor();
+        executorService.schedule(() -> {
+
+            webSocketMap.put(userId, this);
+
+            addOnlineCount();
+            logger.info("用户:{}连接成功,当前在线人数为{}人", userId, getOnlineCount());
+            if (ObjectUtil.isNotEmpty(this.session.getQueryString())) {
+                try {
+                    sendMessageByUserId(userId, this.session.getQueryString());
+                } catch (IOException e) {
+                    logger.error("IO异常");
+                } finally {
+                    executorService.shutdown();
+                }
+            }
+        }, 1, TimeUnit.SECONDS);
+    }
+
+
+    @OnClose
+    public void onClose() {
+        webSocketMap.remove(userId);
+        webSocketMsgMap.remove(userId);
+        subOnlineCount();
+        logger.info("用户:{}关闭了连接!当前在线人数为{}人", userId, getOnlineCount());
+    }
+
+    @OnMessage
+    public void onMessage(String message, Session session) {
+        if (StringUtils.isNotEmpty(userId)) {
+            String projectId, contractId, clientId;
+            if (!message.contains(",")) {
+                clientId = ClientIdConstant.MANAGER_CLIENT_ID;
+                projectId = "1";
+                contractId = "1";
+            } else {
+                projectId = message.split(",")[0];
+                contractId = message.split(",")[1];
+                clientId = message.split(",")[2];
+            }
+
+            if (StringUtils.isNotEmpty(clientId) && StringUtils.isNotEmpty(projectId) && StringUtils.isNotEmpty(contractId)) {
+
+                logger.info("来自用户:{} 消息:{}", userId, message);
+                webSocketMsgMap.put(userId, message);
+
+                Map<String, String> stringMap = new HashMap<>();
+                switch (clientId) {
+                    case ClientIdConstant.ARCHIVE_CLIENT_ID:
+                        stringMap = archiveWebSocketClient.getWebsocketMsg(projectId, contractId, userId);
+                        break;
+                    case ClientIdConstant.MANAGER_CLIENT_ID:
+                        stringMap = managerWebSocketClient.getWebsocketMsg(projectId, contractId, userId);
+                        break;
+                    case ClientIdConstant.BUSINESS_CLIENT_ID:
+                        stringMap = businessWebSocketClient.getWebsocketMsg(projectId, contractId, userId);
+                        break;
+                    case ClientIdConstant.METER_CLIENT_ID:
+                        // TODO stringMap = meterWebSocketClient.getWebsocketMsg(projectId, contractId, userId);
+                        break;
+                }
+                try {
+                    sendMessageByUserId(userId, JSON.toJSONString(stringMap));
+                } catch (IOException e) {
+                    e.printStackTrace();
+                }
+            }
+        } else {
+            logger.info("未获取到用户信息,接收消息失败");
+        }
+    }
+
+    @OnError
+    public void onError(Session session, Throwable error) {
+        logger.error("用户错误:" + this.userId + ",原因:" + error.getMessage());
+        error.printStackTrace();
+    }
+
+    public void sendMessageByUserId(String userId, String message) throws IOException {
+        logger.info("服务端发送消息到用户:{},消息:{}", userId, message);
+        if (StrUtil.isNotBlank(userId) && webSocketMap.containsKey(userId)) {
+            webSocketMap.get(userId).sendMessage(message);
+        } else {
+            logger.error("用户{}不在线", userId);
+        }
+    }
+
+    public void sendMessage(String message) {
+        this.session.getAsyncRemote().sendText(message);
+    }
+
+    public static synchronized int getOnlineCount() {
+        return onlineCount;
+    }
+
+    public static synchronized void addOnlineCount() {
+        WebSocketEndpoint.onlineCount++;
+    }
+
+    public static synchronized void subOnlineCount() {
+        WebSocketEndpoint.onlineCount--;
+    }
+
+    @Scheduled(cron = "0 0/5 * * * ?")
+    public void reSendMessage() {
+        if (webSocketMap.isEmpty() || webSocketMsgMap.isEmpty()) {
+            return;
+        }
+
+        logger.info("************************ 定时重发消息,reSendMessage()方法执行开始 ************************");
+
+        Set<Map.Entry<String, String>> messageMaps = webSocketMsgMap.entrySet();
+        for (Map.Entry<String, String> message : messageMaps) {
+            String userId = message.getKey();
+            String values = message.getValue();
+            if (values.contains(",") && StringUtils.isNotEmpty(userId)) {
+                String[] splitValues = values.split(",");
+                if (splitValues.length == 3) {
+                    String projectId = splitValues[0];
+                    String contractId = splitValues[1];
+                    String clientId = splitValues[2];
+                    if (StringUtils.isNotEmpty(clientId) && StringUtils.isNotEmpty(contractId) && StringUtils.isNotEmpty(projectId)) {
+                        Map<String, String> stringMap = new HashMap<>();
+                        switch (clientId) {
+                            case ClientIdConstant.ARCHIVE_CLIENT_ID:
+                                stringMap = archiveWebSocketClient.getWebsocketMsg(projectId, contractId, userId);
+                                break;
+                            case ClientIdConstant.MANAGER_CLIENT_ID:
+                                stringMap = managerWebSocketClient.getWebsocketMsg(projectId, contractId, userId);
+                                break;
+                            case ClientIdConstant.BUSINESS_CLIENT_ID:
+                                stringMap = businessWebSocketClient.getWebsocketMsg(projectId, contractId, userId);
+                                break;
+                            case ClientIdConstant.METER_CLIENT_ID:
+                                // TODO stringMap = meterWebSocketClient.getWebsocketMsg(projectId, contractId, userId);
+                                break;
+                        }
+                        if (stringMap.size() > 0) {
+                            try {
+                                sendMessageByUserId(userId, JSON.toJSONString(stringMap));
+                            } catch (IOException e) {
+                                e.printStackTrace();
+                            }
+                        }
+                    }
+                }
+            }
+        }
+        logger.info("************************ 定时重发消息,reSendMessage()方法执行结束 ************************");
+    }
+
+}

+ 11 - 0
blade-service/blade-rabbitmq-consumer/src/main/resources/application-dev.yml

@@ -0,0 +1,11 @@
+#服务器端口
+server:
+  port: 5696
+
+#数据源配置
+spring:
+  datasource:
+    url: ${blade.datasource.dev.url}
+    username: ${blade.datasource.dev.username}
+    password: ${blade.datasource.dev.password}
+

+ 48 - 0
blade-service/blade-rabbitmq-producer/pom.xml

@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         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">
+    <parent>
+        <artifactId>blade-service</artifactId>
+        <groupId>org.springblade</groupId>
+        <version>2.9.1.RELEASE</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>blade-rabbitmq-producer</artifactId>
+    <name>${project.artifactId}</name>
+    <version>${bladex.project.version}</version>
+    <packaging>jar</packaging>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.springblade</groupId>
+            <artifactId>blade-core-boot</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springblade</groupId>
+            <artifactId>blade-archive-api</artifactId>
+            <version>2.9.1.RELEASE</version>
+        </dependency>
+        <dependency>
+            <groupId>org.springblade</groupId>
+            <artifactId>blade-manager-api</artifactId>
+            <version>2.9.1.RELEASE</version>
+        </dependency>
+        <dependency>
+            <groupId>org.springblade</groupId>
+            <artifactId>blade-business-api</artifactId>
+            <version>2.9.1.RELEASE</version>
+        </dependency>
+        <dependency>
+            <groupId>org.springblade</groupId>
+            <artifactId>blade-meter-api</artifactId>
+            <version>2.9.1.RELEASE</version>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-amqp</artifactId>
+        </dependency>
+    </dependencies>
+
+</project>

+ 18 - 0
blade-service/blade-rabbitmq-producer/src/main/java/org/springblade/producer/MQProducerApplication.java

@@ -0,0 +1,18 @@
+package org.springblade.producer;
+
+import org.springblade.common.constant.LauncherConstant;
+import org.springblade.core.cloud.feign.EnableBladeFeign;
+import org.springblade.core.launch.BladeApplication;
+import org.springframework.cloud.client.SpringCloudApplication;
+import org.springframework.scheduling.annotation.EnableAsync;
+
+@EnableAsync
+@EnableBladeFeign
+@SpringCloudApplication
+public class MQProducerApplication {
+
+    public static void main(String[] args) {
+        BladeApplication.run(LauncherConstant.APPLICATION_MQ_PRODUCER, MQProducerApplication.class, args);
+    }
+
+}

+ 12 - 0
blade-service/blade-rabbitmq-producer/src/main/java/org/springblade/producer/bean/PushMessage.java

@@ -0,0 +1,12 @@
+package org.springblade.producer.bean;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Target(ElementType.METHOD)
+@Retention(RetentionPolicy.RUNTIME)
+public @interface PushMessage {
+    String clientId() default "";
+}

+ 127 - 0
blade-service/blade-rabbitmq-producer/src/main/java/org/springblade/producer/bean/PushMessageAspect.java

@@ -0,0 +1,127 @@
+package org.springblade.producer.bean;
+
+import com.alibaba.fastjson.JSON;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+import org.aspectj.lang.JoinPoint;
+import org.aspectj.lang.annotation.AfterReturning;
+import org.aspectj.lang.annotation.Aspect;
+import org.aspectj.lang.annotation.Pointcut;
+import org.aspectj.lang.reflect.MethodSignature;
+import org.springblade.business.feign.BusinessWebSocketClient;
+import org.springblade.core.tool.api.R;
+import org.springblade.feign.ArchiveWebSocketClient;
+import org.springblade.manager.feign.ManagerWebSocketClient;
+import org.springblade.meter.feign.MeterWebSocketClient;
+import org.springblade.common.constant.ClientIdConstant;
+
+import org.springblade.producer.service.RabbitMqProducerService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+import org.springframework.util.StringUtils;
+
+import java.lang.reflect.Method;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+@Aspect
+@Component
+public class PushMessageAspect {
+
+    private static final Logger logger = LogManager.getLogger(PushMessageAspect.class);
+    private final RabbitMqProducerService rabbitMqProducerService;
+    private final ArchiveWebSocketClient archiveWebSocketClient;
+    private final BusinessWebSocketClient businessWebSocketClient;
+    private final ManagerWebSocketClient managerWebSocketClient;
+    private final MeterWebSocketClient meterWebSocketClient;
+
+    @Autowired
+    public PushMessageAspect(RabbitMqProducerService rabbitMqProducerService, ArchiveWebSocketClient archiveWebSocketClient, BusinessWebSocketClient businessWebSocketClient, ManagerWebSocketClient managerWebSocketClient, MeterWebSocketClient meterWebSocketClient) {
+        this.rabbitMqProducerService = rabbitMqProducerService;
+        this.archiveWebSocketClient = archiveWebSocketClient;
+        this.businessWebSocketClient = businessWebSocketClient;
+        this.managerWebSocketClient = managerWebSocketClient;
+        this.meterWebSocketClient = meterWebSocketClient;
+    }
+
+    @Pointcut("@annotation(org.springblade.producer.bean.PushMessage)")
+    public void pushMessagePointcut() {
+    }
+
+    @AfterReturning(value = "pushMessagePointcut()", returning = "result")
+    public void pushMessageAfterMethod(JoinPoint joinPoint, Object result) {
+        logger.info("=========================================== push message start ======================================");
+        if (result instanceof R) {
+            R<?> r = (R<?>) result;
+            Object objSet = r.getData();
+            if (objSet instanceof Set) {
+                MethodSignature signature = (MethodSignature) joinPoint.getSignature();
+                Method method = signature.getMethod();
+                PushMessage pushMessage = method.getAnnotation(PushMessage.class);
+                String clientIds = pushMessage.clientId();
+                if (StringUtils.hasText(clientIds)) {
+                    for (String clientId : clientIds.split(",")) {
+                        Set<?> rawSet = (Set<?>) objSet;
+                        for (Object element : rawSet) {
+                            if (element instanceof String) {
+                                String param = (String) element;
+                                String userId = param.split(",")[0];
+                                String projectId = param.split(",")[1];
+                                String contractId = param.split(",")[2];
+                                this.pushMessageToMqQueue(clientId, userId, projectId, contractId);
+                            }
+                        }
+                        logger.info("=========================================== push message end ========================================");
+                    }
+                } else {
+                    logger.info("=========================================== clientId is null ========================================");
+                }
+            } else {
+                logger.info("=========================================== data is null ========================================");
+            }
+        }
+    }
+
+    private void pushMessageToMqQueue(String clientId, String userId, String projectId, String contractId) {
+        Map<String, String> stringMap = this.getTaskStringMapData(projectId, contractId, userId, clientId);
+        if (stringMap.size() > 0) {
+            switch (clientId) {
+                case ClientIdConstant.ARCHIVE_CLIENT_ID:
+                    rabbitMqProducerService.sendMessageToArchiveQueue(JSON.toJSONString(stringMap));
+                    break;
+                case ClientIdConstant.MANAGER_CLIENT_ID:
+                    rabbitMqProducerService.sendMessageToManagerQueue(JSON.toJSONString(stringMap));
+                    break;
+                case ClientIdConstant.BUSINESS_CLIENT_ID:
+                    rabbitMqProducerService.sendMessageToBusinessQueue(JSON.toJSONString(stringMap));
+                    break;
+                case ClientIdConstant.METER_CLIENT_ID:
+                    rabbitMqProducerService.sendMessageToMeterQueue(JSON.toJSONString(stringMap));
+                    break;
+            }
+        }
+    }
+
+    private Map<String, String> getTaskStringMapData(String projectId, String contractId, String userId, String clientId) {
+        Map<String, String> stringMap = new HashMap<>();
+        if (StringUtils.hasText(clientId)) {
+            switch (clientId) {
+                case ClientIdConstant.ARCHIVE_CLIENT_ID:
+                    stringMap = archiveWebSocketClient.getWebsocketMsg(projectId, contractId, userId);
+                    break;
+                case ClientIdConstant.MANAGER_CLIENT_ID:
+                    stringMap = managerWebSocketClient.getWebsocketMsg(projectId, contractId, userId);
+                    break;
+                case ClientIdConstant.BUSINESS_CLIENT_ID:
+                    stringMap = businessWebSocketClient.getWebsocketMsg(projectId, contractId, userId);
+                    break;
+                case ClientIdConstant.METER_CLIENT_ID:
+                    // TODO stringMap = meterWebSocketClient.getWebsocketMsg(projectId, contractId, userId);
+                    break;
+            }
+        }
+        return stringMap;
+    }
+
+}

+ 30 - 0
blade-service/blade-rabbitmq-producer/src/main/java/org/springblade/producer/config/RabbitMqConfig.java

@@ -0,0 +1,30 @@
+package org.springblade.producer.config;
+
+import org.springframework.amqp.core.*;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+@Configuration
+public class RabbitMqConfig {
+
+    @Bean
+    public Queue archiveQueue() {
+        return new Queue("archiveQueue");
+    }
+
+    @Bean
+    public Queue managerQueue() {
+        return new Queue("managerQueue");
+    }
+
+    @Bean
+    public Queue businessQueue() {
+        return new Queue("businessQueue");
+    }
+
+    @Bean
+    public Queue meterQueue() {
+        return new Queue("meterQueue");
+    }
+
+}

+ 37 - 0
blade-service/blade-rabbitmq-producer/src/main/java/org/springblade/producer/service/RabbitMqProducerService.java

@@ -0,0 +1,37 @@
+package org.springblade.producer.service;
+
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+import org.springframework.amqp.rabbit.core.RabbitTemplate;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+@Service
+public class RabbitMqProducerService {
+
+    private static final Logger logger = LogManager.getLogger(RabbitMqProducerService.class);
+
+    @Autowired
+    private RabbitTemplate rabbitTemplate;
+
+    public void sendMessageToArchiveQueue(String message) {
+        logger.info("push msg to archiveQueue,msg:" + message);
+        rabbitTemplate.convertAndSend("archiveQueue", message);
+    }
+
+    public void sendMessageToManagerQueue(String message) {
+        logger.info("push msg to managerQueue,msg:" + message);
+        rabbitTemplate.convertAndSend("managerQueue", message);
+    }
+
+    public void sendMessageToBusinessQueue(String message) {
+        logger.info("push msg to businessQueue,msg:" + message);
+        rabbitTemplate.convertAndSend("businessQueue", message);
+    }
+
+    public void sendMessageToMeterQueue(String message) {
+        logger.info("push msg to meterQueue,msg:" + message);
+        rabbitTemplate.convertAndSend("meterQueue", message);
+    }
+
+}

+ 11 - 0
blade-service/blade-rabbitmq-producer/src/main/resources/application-dev.yml

@@ -0,0 +1,11 @@
+#服务器端口
+server:
+  port: 5695
+
+#数据源配置
+spring:
+  datasource:
+    url: ${blade.datasource.dev.url}
+    username: ${blade.datasource.dev.username}
+    password: ${blade.datasource.dev.password}
+

+ 2 - 0
blade-service/pom.xml

@@ -28,6 +28,8 @@
         <module>blade-control</module>
         <module>blade-land</module>
         <module>blade-meter</module>
+        <module>blade-rabbitmq-producer</module>
+        <module>blade-rabbitmq-consumer</module>
     </modules>
 
     <dependencies>