瀏覽代碼

解决冲突

fuyuchuan 10 小時之前
父節點
當前提交
6bfe44b5c8
共有 100 個文件被更改,包括 2227 次插入2621 次删除
  1. 3 1
      pom.xml
  2. 1 0
      service-agbox/service-agbox-biz/pom.xml
  3. 15 16
      service-agbox/service-agbox-biz/src/main/java/com/usky/agbox/service/job/patrolAgbox.java
  4. 1 6
      service-agbox/service-agbox-biz/src/main/java/com/usky/agbox/service/mqtt/event/event.java
  5. 1 1
      service-agbox/service-agbox-biz/src/main/java/com/usky/agbox/service/util/HttpClientUtils.java
  6. 19 0
      service-ai/pom.xml
  7. 27 0
      service-ai/service-ai-api/pom.xml
  8. 88 0
      service-ai/service-ai-biz/pom.xml
  9. 40 0
      service-ai/service-ai-biz/src/main/java/com/usky/ai/AIChatApplication.java
  10. 536 0
      service-ai/service-ai-biz/src/main/java/com/usky/ai/controller/web/AiChatController.java
  11. 43 0
      service-ai/service-ai-biz/src/main/java/com/usky/ai/controller/web/AiQuestionController.java
  12. 94 0
      service-ai/service-ai-biz/src/main/java/com/usky/ai/controller/web/AiSessionController.java
  13. 41 0
      service-ai/service-ai-biz/src/main/java/com/usky/ai/mapper/AiQuestionMapper.java
  14. 37 0
      service-ai/service-ai-biz/src/main/java/com/usky/ai/mapper/AiSessionMapper.java
  15. 70 0
      service-ai/service-ai-biz/src/main/java/com/usky/ai/service/AiQuestion.java
  16. 51 0
      service-ai/service-ai-biz/src/main/java/com/usky/ai/service/AiQuestionItem.java
  17. 48 0
      service-ai/service-ai-biz/src/main/java/com/usky/ai/service/AiSession.java
  18. 14 0
      service-ai/service-ai-biz/src/main/java/com/usky/ai/service/config/AiChatConfig.java
  19. 19 0
      service-ai/service-ai-biz/src/main/java/com/usky/ai/service/config/MyGlobalCorsConfig.java
  20. 14 0
      service-ai/service-ai-biz/src/main/java/com/usky/ai/service/config/WebConfig.java
  21. 22 0
      service-ai/service-ai-biz/src/main/java/com/usky/ai/service/vo/AiStreamOutputVO.java
  22. 24 0
      service-ai/service-ai-biz/src/main/resources/bootstrap.yml
  23. 94 0
      service-ai/service-ai-biz/src/main/resources/logback.xml
  24. 151 0
      service-ai/service-ai-biz/src/main/resources/static/dpsk.html
  25. 150 0
      service-ai/service-ai-biz/src/main/resources/static/tyqw.html
  26. 5 0
      service-alarm/service-alarm-biz/pom.xml
  27. 2 1
      service-alarm/service-alarm-biz/src/main/java/com/usky/alarm/RuoYiSystemApplication.java
  28. 151 53
      service-alarm/service-alarm-biz/src/main/java/com/usky/alarm/service/impl/BaseAlarmNoticeResultServiceImpl.java
  29. 1 0
      service-alarm/service-alarm-biz/src/main/java/com/usky/alarm/service/impl/BaseAlarmServiceImpl.java
  30. 7 2
      service-alarm/service-alarm-biz/src/main/java/com/usky/alarm/service/mqtt/alarm/Alarm.java
  31. 0 13
      service-cockpit/service-cockpit-biz/src/main/java/com/usky/cockpit/ServletInitializer.java
  32. 0 116
      service-cockpit/service-cockpit-biz/src/main/java/com/usky/cockpit/common/base/BaseController.java
  33. 0 24
      service-cockpit/service-cockpit-biz/src/main/java/com/usky/cockpit/common/config/CorsConfig.java
  34. 0 16
      service-cockpit/service-cockpit-biz/src/main/java/com/usky/cockpit/common/config/DateStringConvert.java
  35. 0 20
      service-cockpit/service-cockpit-biz/src/main/java/com/usky/cockpit/common/config/MybatisPlusConfig.java
  36. 0 16
      service-cockpit/service-cockpit-biz/src/main/java/com/usky/cockpit/common/config/StringDateConverter.java
  37. 0 72
      service-cockpit/service-cockpit-biz/src/main/java/com/usky/cockpit/common/config/V2Config.java
  38. 0 104
      service-cockpit/service-cockpit-biz/src/main/java/com/usky/cockpit/common/domain/AjaxResult.java
  39. 0 84
      service-cockpit/service-cockpit-biz/src/main/java/com/usky/cockpit/common/domain/ResultTable.java
  40. 0 50
      service-cockpit/service-cockpit-biz/src/main/java/com/usky/cockpit/common/domain/Tablepar.java
  41. 0 21
      service-cockpit/service-cockpit-biz/src/main/java/com/usky/cockpit/common/interceptor/Interceptor.java
  42. 0 31
      service-cockpit/service-cockpit-biz/src/main/java/com/usky/cockpit/common/interceptor/WebMvcConfig.java
  43. 0 371
      service-cockpit/service-cockpit-biz/src/main/java/com/usky/cockpit/controller/web/FileController.java
  44. 0 254
      service-cockpit/service-cockpit-biz/src/main/java/com/usky/cockpit/controller/web/GoviewProjectController.java
  45. 0 21
      service-cockpit/service-cockpit-biz/src/main/java/com/usky/cockpit/controller/web/Indexcontroller.java
  46. 0 19
      service-cockpit/service-cockpit-biz/src/main/java/com/usky/cockpit/controller/web/SysUserController.java
  47. 0 18
      service-cockpit/service-cockpit-biz/src/main/java/com/usky/cockpit/mapper/GoviewProjectDataMapper.java
  48. 0 16
      service-cockpit/service-cockpit-biz/src/main/java/com/usky/cockpit/mapper/GoviewProjectMapper.java
  49. 0 19
      service-cockpit/service-cockpit-biz/src/main/java/com/usky/cockpit/mapper/SysFileMapper.java
  50. 0 16
      service-cockpit/service-cockpit-biz/src/main/java/com/usky/cockpit/mapper/SysUserMapper.java
  51. 0 48
      service-cockpit/service-cockpit-biz/src/main/java/com/usky/cockpit/model/GoviewProject.java
  52. 0 39
      service-cockpit/service-cockpit-biz/src/main/java/com/usky/cockpit/model/GoviewProjectData.java
  53. 0 119
      service-cockpit/service-cockpit-biz/src/main/java/com/usky/cockpit/model/SysFile.java
  54. 0 39
      service-cockpit/service-cockpit-biz/src/main/java/com/usky/cockpit/model/SysUser.java
  55. 0 119
      service-cockpit/service-cockpit-biz/src/main/java/com/usky/cockpit/model/vo/GoviewProjectVo.java
  56. 0 70
      service-cockpit/service-cockpit-biz/src/main/java/com/usky/cockpit/model/vo/SysFileVo.java
  57. 0 19
      service-cockpit/service-cockpit-biz/src/main/java/com/usky/cockpit/service/IGoviewProjectDataService.java
  58. 0 17
      service-cockpit/service-cockpit-biz/src/main/java/com/usky/cockpit/service/IGoviewProjectService.java
  59. 0 20
      service-cockpit/service-cockpit-biz/src/main/java/com/usky/cockpit/service/ISysFileService.java
  60. 0 17
      service-cockpit/service-cockpit-biz/src/main/java/com/usky/cockpit/service/ISysUserService.java
  61. 0 31
      service-cockpit/service-cockpit-biz/src/main/java/com/usky/cockpit/service/impl/GoviewProjectDataServiceImpl.java
  62. 0 20
      service-cockpit/service-cockpit-biz/src/main/java/com/usky/cockpit/service/impl/GoviewProjectServiceImpl.java
  63. 0 30
      service-cockpit/service-cockpit-biz/src/main/java/com/usky/cockpit/service/impl/SysFileServiceImpl.java
  64. 0 20
      service-cockpit/service-cockpit-biz/src/main/java/com/usky/cockpit/service/impl/SysUserServiceImpl.java
  65. 0 252
      service-cockpit/service-cockpit-biz/src/main/java/com/usky/cockpit/util/ConvertUtil.java
  66. 0 73
      service-cockpit/service-cockpit-biz/src/main/java/com/usky/cockpit/util/SaTokenUtil.java
  67. 0 155
      service-cockpit/service-cockpit-biz/src/main/java/com/usky/cockpit/util/SnowflakeIdWorker.java
  68. 0 5
      service-cockpit/service-cockpit-biz/src/main/resources/mapper/GoviewProjectDataMapper.xml
  69. 0 5
      service-cockpit/service-cockpit-biz/src/main/resources/mapper/GoviewProjectMapper.xml
  70. 0 5
      service-cockpit/service-cockpit-biz/src/main/resources/mapper/SysFileMapper.xml
  71. 0 5
      service-cockpit/service-cockpit-biz/src/main/resources/mapper/SysUserMapper.xml
  72. 4 2
      service-eg/service-eg-biz/src/main/java/com/usky/eg/controller/web/EgDeviceController.java
  73. 12 0
      service-eg/service-eg-biz/src/main/java/com/usky/eg/domain/EgDevice.java
  74. 3 1
      service-eg/service-eg-biz/src/main/java/com/usky/eg/service/EgDeviceService.java
  75. 68 29
      service-eg/service-eg-biz/src/main/java/com/usky/eg/service/impl/EgDeviceServiceImpl.java
  76. 7 0
      service-eg/service-eg-biz/src/main/java/com/usky/eg/service/impl/EgRecordServiceImpl.java
  77. 5 0
      service-eg/service-eg-biz/src/main/java/com/usky/eg/service/vo/EgDeviceRequestVO.java
  78. 1 1
      service-eg/service-eg-biz/src/main/resources/logback.xml
  79. 2 0
      service-eg/service-eg-biz/src/main/resources/mapper/eg/EgDeviceMapper.xml
  80. 4 0
      service-fire/service-fire-biz/pom.xml
  81. 2 0
      service-fire/service-fire-biz/src/main/java/com/usky/fire/RuoYiSystemApplication.java
  82. 14 5
      service-fire/service-fire-biz/src/main/java/com/usky/fire/controller/web/DemReportInfoController.java
  83. 10 0
      service-fire/service-fire-biz/src/main/java/com/usky/fire/domain/DemReportInfo.java
  84. 21 0
      service-fire/service-fire-biz/src/main/java/com/usky/fire/domain/ReportResult.java
  85. 7 1
      service-fire/service-fire-biz/src/main/java/com/usky/fire/service/DemReportInfoService.java
  86. 92 9
      service-fire/service-fire-biz/src/main/java/com/usky/fire/service/impl/DemReportInfoServiceImpl.java
  87. 51 47
      service-fire/service-fire-biz/src/main/java/com/usky/fire/service/impl/PatrolInspectionPlanSonServiceImpl.java
  88. 68 12
      service-fire/service-fire-biz/src/main/java/com/usky/fire/service/impl/ReportResultServiceImpl.java
  89. 1 0
      service-ids/service-ids-biz/pom.xml
  90. 16 0
      service-iot/service-iot-api/src/main/java/com/usky/iot/RemoteIotService.java
  91. 1 3
      service-iot/service-iot-api/src/main/java/com/usky/iot/RemoteIotTaskService.java
  92. 0 13
      service-iot/service-iot-api/src/main/java/com/usky/iot/RemotePmService.java
  93. 40 0
      service-iot/service-iot-api/src/main/java/com/usky/iot/factory/RemoteIotFactory.java
  94. 0 2
      service-iot/service-iot-api/src/main/java/com/usky/iot/factory/RemoteIotTaskFactory.java
  95. 4 0
      service-iot/service-iot-biz/pom.xml
  96. 3 1
      service-iot/service-iot-biz/src/main/java/com/usky/iot/RuoYiSystemApplication.java
  97. 8 3
      service-iot/service-iot-biz/src/main/java/com/usky/iot/controller/api/PmTimedSendingApi.java
  98. 4 2
      service-iot/service-iot-biz/src/main/java/com/usky/iot/controller/web/DeviceHttpController.java
  99. 9 0
      service-iot/service-iot-biz/src/main/java/com/usky/iot/controller/web/DmpDeviceInfoController.java
  100. 1 1
      service-iot/service-iot-biz/src/main/java/com/usky/iot/controller/web/DmpProductInfoController.java

+ 3 - 1
pom.xml

@@ -90,8 +90,10 @@
 
     <module>service-oa</module>
 
-    <module>service-cockpit</module>
 
+    <module>service-ai</module>
+
+    <module>service-pm</module>
 
     <module>service-ids</module>
 

+ 1 - 0
service-agbox/service-agbox-biz/pom.xml

@@ -74,6 +74,7 @@
             <plugin>
                 <groupId>org.springframework.boot</groupId>
                 <artifactId>spring-boot-maven-plugin</artifactId>
+                <version>2.2.6.RELEASE</version>
                 <executions>
                     <execution>
                         <goals>

+ 15 - 16
service-agbox/service-agbox-biz/src/main/java/com/usky/agbox/service/job/patrolAgbox.java

@@ -104,24 +104,23 @@ public class patrolAgbox {
         map.put("json", "{\"jsonrpc\":\"2.0\",\"method\":\"addEvent\",\"params\":{\"deviceId\":\""+eventVO.get("deviceId").toString()+"\"," +
                 "\"triggerTime\":\""+eventVO.get("triggerTime").toString()+"\",\"eventCode\":"+eventVO.get("eventCode")+",\"name" +
                 "\":\""+eventVO.get("name").toString()+"\",\"certifiedNo\":\""+eventVO.get("certifiedNo").toString()+"\"}}");
-        System.out.println("FEvent收到消息: " + map.toString());
         String resultString = HttpClientUtils.doPost(list.get(0).getAgboxUrl(),map);
         JSONObject resultVO = JSONObject.parseObject(resultString);
-//        LocalDateTime now = LocalDateTime.now();
-////        String host = "127.0.0.1";
-//        int port = 5901;
-//        String xmlData = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>  \n" +
-//                "<Agent ID=\"SGT100006088\" Type=\"SG\" Ver=\"1.2.0.0\">\n" +
-//                "<DVRHeart State=\"0\" TotalSpace=\"1000\" FreeSpace=\"500\">\n" +
-//                "System,smss.exe,csrss.exe\n" +
-//                "</DVRHeart>\n" +
-//                "<GetTicks/>\n" +
-//                "<OperationCmd Type=\"18\" Channel=\"2\" TriggerTime=\""+now+"\" Note=\"5rWL6K+V\" " +
-//                "GUID=\"7b726e15-4d45-53e7-f0e0-0abb91156fd7\">\n" +
-//                "/9j/4AAQSkZJRgABAQEASABIAAD/2wBDABsSFBcUERsXFhceHBsgKEIrKCUlKFE6PTBCYFVlZF9V\n" +
-//                "</OperationCmd>\n" +
-//                "</Agent>";
-//        sendMessage(URL, port, xmlData);
+        LocalDateTime now = LocalDateTime.now();
+//        String host = "127.0.0.1";
+        int port = 5901;
+        String xmlData = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>  \n" +
+                "<Agent ID=\"SGT100006088\" Type=\"SG\" Ver=\"1.2.0.0\">\n" +
+                "<DVRHeart State=\"0\" TotalSpace=\"1000\" FreeSpace=\"500\">\n" +
+                "System,smss.exe,csrss.exe\n" +
+                "</DVRHeart>\n" +
+                "<GetTicks/>\n" +
+                "<OperationCmd Type=\"18\" Channel=\"2\" TriggerTime=\""+now+"\" Note=\"5rWL6K+V\" " +
+                "GUID=\"7b726e15-4d45-53e7-f0e0-0abb91156fd7\">\n" +
+                "/9j/4AAQSkZJRgABAQEASABIAAD/2wBDABsSFBcUERsXFhceHBsgKEIrKCUlKFE6PTBCYFVlZF9V\n" +
+                "</OperationCmd>\n" +
+                "</Agent>";
+        sendMessage(URL, port, xmlData);
         return resultVO;
     }
 

+ 1 - 6
service-agbox/service-agbox-biz/src/main/java/com/usky/agbox/service/mqtt/event/event.java

@@ -36,13 +36,8 @@ public class event implements MqttStrategy {
                 eventVO2.put("deviceId",eventVO1.get("deviceId"));
                 PatrolAgbox.updateHeart(eventVO2.toJSONString());
             }else {
-                if (eventVO1.get("eventType").equals(33)||eventVO1.get("eventType").equals(34)||eventVO1.get(
-                        "eventType").equals(9)){
+                if (eventVO1.get("eventType").equals(33)||eventVO1.get("eventType").equals(34)){
                     eventVO.put("eventCode",5);
-                }else if (eventVO1.get("eventType").equals(8)){
-                    eventVO.put("eventCode",3);
-                }else if (eventVO1.get("eventType").equals(10)){
-                    eventVO.put("eventCode",4);
                 }else {
                     eventVO.put("eventCode",16);
                 }

+ 1 - 1
service-agbox/service-agbox-biz/src/main/java/com/usky/agbox/service/util/HttpClientUtils.java

@@ -77,7 +77,7 @@ public class HttpClientUtils {
         try {
             // 创建Http Post请求
             HttpPost httpPost = new HttpPost(url);
-            httpPost.setHeader("Content-Type", "application/x-www-form-urlencoded");
+            httpPost.setHeader("Content-Type", "charset=utf-8");
             // 创建参数列表
             if (param != null) {
                 List<NameValuePair> paramList = new ArrayList<>();

+ 19 - 0
service-ai/pom.xml

@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<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>usky-modules</artifactId>
+        <groupId>com.usky</groupId>
+        <version>0.0.1</version>
+    </parent>
+
+    <modelVersion>4.0.0</modelVersion>
+    <artifactId>service-ai</artifactId>
+    <packaging>pom</packaging>
+    <version>0.0.1</version>
+
+    <modules>
+        <module>service-ai-biz</module>
+        <module>service-ai-api</module>
+    </modules>
+</project>

+ 27 - 0
service-ai/service-ai-api/pom.xml

@@ -0,0 +1,27 @@
+<?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>service-ai</artifactId>
+        <groupId>com.usky</groupId>
+        <version>0.0.1</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>service-ai-api</artifactId>
+    <!-- SpringCloud Openfeign -->
+    <dependencies>
+        <dependency>
+            <groupId>org.springframework.cloud</groupId>
+            <artifactId>spring-cloud-starter-openfeign</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.usky</groupId>
+            <artifactId>usky-common-core</artifactId>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <finalName>${project.artifactId}</finalName>
+    </build>
+
+</project>

+ 88 - 0
service-ai/service-ai-biz/pom.xml

@@ -0,0 +1,88 @@
+<?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>service-ai</artifactId>
+        <groupId>com.usky</groupId>
+        <version>0.0.1</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>service-ai-biz</artifactId>
+    <dependencies>
+        <dependency>
+            <groupId>com.usky</groupId>
+            <artifactId>common-cloud-starter</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>com.usky</groupId>
+            <artifactId>service-ai-api</artifactId>
+            <version>0.0.1</version>
+        </dependency>
+
+        <dependency>
+            <groupId>com.usky</groupId>
+            <artifactId>ruoyi-common-swagger</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.mybatis.spring.boot</groupId>
+            <artifactId>mybatis-spring-boot-starter</artifactId>
+            <version>2.1.4</version>
+        </dependency>
+        <dependency>
+            <groupId>mysql</groupId>
+            <artifactId>mysql-connector-java</artifactId>
+            <scope>runtime</scope>
+        </dependency>
+
+        <!-- 阿里dashscope依赖 -->
+        <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>dashscope-sdk-java</artifactId>
+            <version>2.14.0</version>
+            <exclusions>
+                <exclusion>
+                    <groupId>org.slf4j</groupId>
+                    <artifactId>slf4j-simple</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+
+
+    </dependencies>
+
+    <build>
+        <finalName>${project.artifactId}</finalName>
+        <plugins>
+            <plugin>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-maven-plugin</artifactId>
+                <version>2.2.6.RELEASE</version>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>repackage</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>com.github.shalousun</groupId>
+                <artifactId>smart-doc-maven-plugin</artifactId>
+                <version>2.1.1</version>
+                <configuration>
+                    <!--指定生成文档的使用的配置文件,配置文件放在自己的项目中-->
+                    <configFile>./src/main/resources/smart-doc.json</configFile>
+                    <!--指定项目名称-->
+                    <projectName>test</projectName>
+                    <!--                    <excludes>-->
+                    <!--                        <exclude>com.bizmatics:product-service-provider</exclude>-->
+                    <!--                        <exclude>cn.afterturn:easypoi-web</exclude>-->
+                    <!--                    </excludes>-->
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+</project>

+ 40 - 0
service-ai/service-ai-biz/src/main/java/com/usky/ai/AIChatApplication.java

@@ -0,0 +1,40 @@
+package com.usky.ai;
+
+import com.ruoyi.common.swagger.annotation.EnableCustomSwagger2;
+import org.mybatis.spring.annotation.MapperScan;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.cloud.openfeign.EnableFeignClients;
+import org.springframework.context.ConfigurableApplicationContext;
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.context.annotation.EnableAspectJAutoProxy;
+import org.springframework.core.env.Environment;
+
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+
+@EnableCustomSwagger2
+@EnableAspectJAutoProxy(proxyTargetClass = true, exposeProxy = true)
+@EnableFeignClients(basePackages = {"com.usky"})
+@MapperScan(value = "com.usky.ai.mapper")
+@ComponentScan(basePackages = {"com.usky"})
+@SpringBootApplication
+public class AIChatApplication {
+        private static final Logger LOGGER = LoggerFactory.getLogger(AIChatApplication.class);
+
+        public static void main (String[]args) throws UnknownHostException {
+        ConfigurableApplicationContext application = SpringApplication.run(AIChatApplication.class, args);
+        Environment env = application.getEnvironment();
+        String ip = InetAddress.getLocalHost().getHostAddress();
+        String port = env.getProperty("server.port");
+        String path = env.getProperty("server.servlet.context-path");
+        LOGGER.info("\n----------------------------------------------------------\n\t" +
+                "Application is running! Access URLs:\n\t" +
+                "Local: \t\thttp://localhost:" + port + (null == path ? "" : path) + "/\n\t" +
+                "External: \thttp://" + ip + ":" + port + (null == path ? "" : path) + "/\n\t" +
+                "Api: \t\thttp://" + ip + ":" + port + (null == path ? "" : path) + "/swagger-ui/index.html\n\t" +
+                "----------------------------------------------------------");
+       }
+}

+ 536 - 0
service-ai/service-ai-biz/src/main/java/com/usky/ai/controller/web/AiChatController.java

@@ -0,0 +1,536 @@
+package com.usky.ai.controller.web;
+
+import com.alibaba.dashscope.aigc.generation.Generation;
+import com.alibaba.dashscope.aigc.generation.GenerationParam;
+import com.alibaba.dashscope.common.Message;
+import com.alibaba.dashscope.common.Role;
+import com.alibaba.dashscope.exception.ApiException;
+import com.alibaba.dashscope.exception.InputRequiredException;
+import com.alibaba.dashscope.exception.NoApiKeyException;
+import com.alibaba.fastjson.JSONObject;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.usky.ai.mapper.AiQuestionMapper;
+import com.usky.ai.mapper.AiSessionMapper;
+import com.usky.ai.service.AiQuestion;
+import com.usky.ai.service.AiQuestionItem;
+import com.usky.ai.service.AiSession;
+import com.usky.ai.service.vo.AiStreamOutputVO;
+import com.usky.common.core.bean.ApiResult;
+import com.usky.common.security.utils.SecurityUtils;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.http.HttpStatus;
+import org.springframework.http.MediaType;
+import org.springframework.http.ResponseEntity;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.servlet.mvc.method.annotation.StreamingResponseBody;
+
+import javax.annotation.Resource;
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.time.LocalDateTime;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
+
+@Slf4j
+@RestController
+@RequestMapping("/ai")
+public class AiChatController {
+
+    @Value("${ai.api.key}")
+    private String apiKey;
+
+    @Value("${airole}")
+    private String aiRole;
+
+    @Value("${aliTyqw.model}")
+    private String tyqwModel;
+
+    @Value("${aliDpsk.model}")
+    private String dpskModel;
+
+    @Value("${ai.historyLimit}")
+    private int Limit;
+
+    @Value("${ai.millis}")
+    private int millis;
+
+    @Resource
+    private Generation generation;
+
+    @Autowired
+    private AiQuestionMapper aiQuestionMapper;
+
+    @Autowired
+    private AiSessionMapper aiSessionMapper;
+
+    private final ObjectMapper objectMapper = new ObjectMapper();
+
+    // 阿里百炼通义千问大模型(修改后)
+    @PostMapping(value = "/aliTyqw", produces = MediaType.TEXT_EVENT_STREAM_VALUE)
+    public ResponseEntity<StreamingResponseBody> send1(@RequestBody JSONObject object) throws NoApiKeyException, InputRequiredException {
+        // 获取当前登录用户的信息
+        Long userId = SecurityUtils.getUserId();
+        String userName = SecurityUtils.getLoginUser().getSysUser().getNickName();
+        String sessionId = null;
+        String content = object.get("content").toString();
+
+        // 如果没有传入 sessionId,则创建一个新的会话ID
+        if (object.containsKey("sessionId")) {
+            sessionId = object.get("sessionId").toString();
+        } else {
+            sessionId = java.util.UUID.randomUUID().toString();
+        }
+
+        // 解析 JSON 并提取 "content" 字段的值
+        String questionText = content;
+
+        // 检查是否已经存在相同的 sessionId
+        boolean exists = aiSessionMapper.existsBySessionId(sessionId);
+
+        if (!exists) {
+            // 创建新的 AiSession 实体并存入数据库
+            AiSession aiSession = new AiSession();
+            aiSession.setSessionId(sessionId);
+            aiSession.setUserId(userId);
+            aiSession.setUserName(userName);
+            aiSession.setQuestion(questionText);
+            aiSession.setAskTime(LocalDateTime.now());
+            aiSessionMapper.save(aiSession);
+        }
+
+        // 构建消息列表,包含角色定义、历史对话记录和用户新消息
+        List<Message> messages = new ArrayList<>();
+
+        // 插入角色定义(在对话历史的开头)
+        Message roleDefinition = Message.builder()
+                .role(Role.SYSTEM.getValue()) // 使用系统角色
+                .content(aiRole) // 定义角色的行为和风格
+                .build();
+        messages.add(roleDefinition); // 将角色定义插入到对话历史的开头
+
+        // 从数据库中获取历史对话记录
+        List<AiQuestion> questions = aiQuestionMapper.findQuestionsBySessionId(sessionId);
+
+        // 如果历史记录超过限制,则只取最近的记录
+        if (questions.size() > Limit) {
+            questions = questions.subList(questions.size() - Limit, questions.size());
+        }
+
+        // 将历史对话记录转换为 AiQuestionItem 列表
+        List<AiQuestionItem> itemList = new ArrayList<>();
+        for (AiQuestion question : questions) {
+            AiQuestionItem userItem = new AiQuestionItem("user", question.getQuestion());
+            userItem.setId(question.getId());
+            userItem.setSessionId(question.getSessionId());
+            userItem.setUserId(question.getUserId());
+            userItem.setUserName(question.getUserName());
+            userItem.setAskTime(question.getAskTime());
+
+            AiQuestionItem assistantItem = new AiQuestionItem("assistant", question.getAnswer());
+            assistantItem.setId(question.getId());
+            assistantItem.setSessionId(question.getSessionId());
+            assistantItem.setUserId(question.getUserId());
+            assistantItem.setUserName(question.getUserName());
+            assistantItem.setAskTime(question.getAskTime());
+
+            itemList.add(userItem);
+            itemList.add(assistantItem);
+        }
+
+        // 将 AiQuestionItem 列表转换为消息列表
+        for (AiQuestionItem item : itemList) {
+            Message message = Message.builder()
+                    .role(item.getRole().equals("user") ? Role.USER.getValue() : Role.ASSISTANT.getValue())
+                    .content(item.getContent() != null ? item.getContent() : item.getReasoningContent())
+                    .build();
+            messages.add(message);
+        }
+
+        // 添加用户的新消息
+        Message userMessage = Message.builder()
+                .role(Role.USER.getValue())
+                .content(questionText) // 使用提取的文本
+                .build();
+        messages.add(userMessage);
+
+        // 构建模型调用参数
+        GenerationParam param = GenerationParam.builder()
+                .model(tyqwModel)
+                .messages(messages)
+                .resultFormat(GenerationParam.ResultFormat.MESSAGE)
+                .topP(0.8)
+                .apiKey(apiKey)
+                .incrementalOutput(true) // 开启增量输出
+                .enableSearch(true)  // 联网搜索
+                .build();
+
+        String finalSessionId = sessionId;
+        StringBuilder completeAnswer = new StringBuilder(); // 用于收集完整的回答内容
+        return ResponseEntity.ok()
+                .contentType(MediaType.TEXT_EVENT_STREAM)
+                .body(outputStream -> {
+                    try {
+// 调用流式接口
+                        generation.streamCall(param).blockingForEach(chunk -> {
+                            try {
+                                // 获取每次生成的内容
+                                String partialAnswer = chunk.getOutput().getChoices().get(0).getMessage().getContent();
+
+                                // 检查内容是否为空,如果为空则跳过
+                                if (partialAnswer == null || partialAnswer.trim().isEmpty()) {
+                                    return; // 如果内容为空,直接返回,不进行后续操作
+                                }
+
+                                // 构建输出对象
+                                AiStreamOutputVO aiStreamOutputVO = new AiStreamOutputVO();
+                                aiStreamOutputVO.setSessionId(finalSessionId);
+                                aiStreamOutputVO.setReasoningContent(partialAnswer);
+
+                                // 转换为 JSON 字符串
+                                String newString = objectMapper.writeValueAsString(aiStreamOutputVO);
+
+                                // 写入输出流
+                                outputStream.write(("data: " + newString + "\n\n").getBytes(StandardCharsets.UTF_8));
+                                outputStream.flush(); // 确保立即发送到前端
+
+                                // 累加到完整回答内容中
+                                completeAnswer.append(partialAnswer);
+
+                                // 添加延迟
+                                try {
+                                    Thread.sleep(millis); // 延迟*毫秒
+                                } catch (InterruptedException e) {
+                                    Thread.currentThread().interrupt();
+                                    log.error("Thread interrupted", e);
+                                }
+
+                            } catch (Exception e) {
+                                log.error("Error processing chunk", e);
+                                outputStream.write(("data: Error processing chunk\n\n").getBytes(StandardCharsets.UTF_8));
+                                outputStream.flush();
+                            }
+                        });
+
+                        // 流式接口调用完成后,将完整回答存入数据库
+                        AiQuestion aiQuestion = new AiQuestion();
+                        aiQuestion.setModel(tyqwModel);
+                        aiQuestion.setSessionId(finalSessionId);
+                        aiQuestion.setUserId(userId);
+                        aiQuestion.setUserName(userName);
+                        aiQuestion.setQuestion(questionText);
+                        aiQuestion.setAnswer(completeAnswer.toString());
+                        aiQuestion.setAskTime(LocalDateTime.now());
+                        aiQuestionMapper.save(aiQuestion);
+
+                    } catch (ApiException e) {
+                        log.error("Error processing request", e);
+                        outputStream.write(("data: Error processing request\n\n").getBytes(StandardCharsets.UTF_8));
+                        outputStream.flush();
+                    } catch (NoApiKeyException | InputRequiredException e) {
+                        throw new RuntimeException(e);
+                    }
+                });
+    }
+
+    // 阿里百炼DeepSeek大模型
+    @PostMapping(value = "/aliDeepSeek", produces = MediaType.TEXT_EVENT_STREAM_VALUE)
+    public ResponseEntity<StreamingResponseBody> send2(@RequestBody JSONObject object )throws NoApiKeyException, InputRequiredException {
+        // 获取当前登录用户的信息
+        Long userId = SecurityUtils.getUserId();
+        String userName = SecurityUtils.getLoginUser().getSysUser().getNickName();
+        String sessionId = null;
+        String content = object.get("content").toString();
+
+        // 如果没有传入 sessionId,则创建一个新的会话ID
+        if (object.containsKey("sessionId")) {
+            sessionId = object.get("sessionId").toString();
+        } else {
+            sessionId = java.util.UUID.randomUUID().toString();
+        }
+
+        // 解析 JSON 并提取 "content" 字段的值
+        String questionText = content;
+
+        // 检查是否已经存在相同的 sessionId
+        boolean exists = aiSessionMapper.existsBySessionId(sessionId);
+
+        if (!exists) {
+            // 创建新的 AiSession 实体并存入数据库
+            AiSession aiSession = new AiSession();
+            aiSession.setSessionId(sessionId);
+            aiSession.setUserId(userId);
+            aiSession.setUserName(userName);
+            aiSession.setQuestion(questionText);
+            aiSession.setAskTime(LocalDateTime.now());
+            aiSessionMapper.save(aiSession);
+        }
+
+        // 构建消息列表,包含角色定义、历史对话记录和用户新消息
+        List<Message> messages = new ArrayList<>();
+
+        // 插入角色定义(在对话历史的开头)
+        Message roleDefinition = Message.builder()
+                .role(Role.SYSTEM.getValue()) // 使用系统角色
+                .content(aiRole) // 定义角色的行为和风格
+                .build();
+        messages.add(roleDefinition); // 将角色定义插入到对话历史的开头
+
+        // 从数据库中获取历史对话记录
+        List<AiQuestion> questions = aiQuestionMapper.findQuestionsBySessionId(sessionId);
+
+        // 如果历史记录超过限制,则只取最近的记录
+        if (questions.size() > Limit) {
+            questions = questions.subList(questions.size() - Limit, questions.size());
+        }
+
+        // 将历史对话记录转换为 AiQuestionItem 列表
+        List<AiQuestionItem> itemList = new ArrayList<>();
+        for (AiQuestion question : questions) {
+            AiQuestionItem userItem = new AiQuestionItem("user", question.getQuestion());
+            userItem.setId(question.getId());
+            userItem.setSessionId(question.getSessionId());
+            userItem.setUserId(question.getUserId());
+            userItem.setUserName(question.getUserName());
+            userItem.setAskTime(question.getAskTime());
+
+            AiQuestionItem assistantItem = new AiQuestionItem("assistant", question.getAnswer());
+            assistantItem.setId(question.getId());
+            assistantItem.setSessionId(question.getSessionId());
+            assistantItem.setUserId(question.getUserId());
+            assistantItem.setUserName(question.getUserName());
+            assistantItem.setAskTime(question.getAskTime());
+
+            itemList.add(userItem);
+            itemList.add(assistantItem);
+        }
+
+        // 将 AiQuestionItem 列表转换为消息列表
+        for (AiQuestionItem item : itemList) {
+            Message message = Message.builder()
+                    .role(item.getRole().equals("user") ? Role.USER.getValue() : Role.ASSISTANT.getValue())
+                    .content(item.getContent() != null ? item.getContent() : item.getReasoningContent())
+                    .build();
+            messages.add(message);
+        }
+
+        // 添加用户的新消息
+        Message userMessage = Message.builder()
+                .role(Role.USER.getValue())
+                .content(questionText) // 使用提取的文本
+                .build();
+        messages.add(userMessage);
+
+        // 构建模型调用参数
+        GenerationParam param = GenerationParam.builder()
+                .model(dpskModel)
+                .messages(messages)
+                .resultFormat(GenerationParam.ResultFormat.MESSAGE)
+                .apiKey(apiKey)
+                .incrementalOutput(true) // 开启增量输出[^1^]
+                .build();
+
+        String finalSessionId = sessionId;
+        StringBuilder completeAnswer = new StringBuilder(); // 用于收集完整的回答内容
+        return ResponseEntity.ok()
+                .contentType(MediaType.TEXT_EVENT_STREAM)
+                .body(outputStream -> {
+                    try {
+                        // 调用流式接口
+                        generation.streamCall(param).blockingForEach(chunk -> {
+                            try {
+                                // 获取每次生成的内容
+                                String partialAnswer = chunk.getOutput().getChoices().get(0).getMessage().getContent();
+
+                                // 检查内容是否为空,如果为空则跳过
+                                if (partialAnswer == null || partialAnswer.trim().isEmpty()) {
+                                    return; // 如果内容为空,直接返回,不进行后续操作
+                                }
+
+                                // 构建输出对象
+                                AiStreamOutputVO aiStreamOutputVO = new AiStreamOutputVO();
+                                aiStreamOutputVO.setSessionId(finalSessionId);
+                                aiStreamOutputVO.setReasoningContent(partialAnswer);
+
+                                // 转换为 JSON 字符串
+                                String newString = objectMapper.writeValueAsString(aiStreamOutputVO);
+
+                                // 写入输出流
+                                outputStream.write(("data: " + newString + "\n\n").getBytes(StandardCharsets.UTF_8));
+                                outputStream.flush(); // 确保立即发送到前端
+
+                                // 累加到完整回答内容中
+                                completeAnswer.append(partialAnswer);
+
+                                // 添加延迟
+                                try {
+                                    Thread.sleep(millis); // 延迟*毫秒
+                                } catch (InterruptedException e) {
+                                    Thread.currentThread().interrupt();
+                                    log.error("Thread interrupted", e);
+                                }
+
+                            } catch (Exception e) {
+                                log.error("Error processing chunk", e);
+                                outputStream.write(("data: Error processing chunk\n\n").getBytes(StandardCharsets.UTF_8));
+                                outputStream.flush();
+                            }
+                        });
+
+                        // 流式接口调用完成后,将完整回答存入数据库
+                        AiQuestion aiQuestion = new AiQuestion();
+                        aiQuestion.setModel(dpskModel);
+                        aiQuestion.setSessionId(finalSessionId);
+                        aiQuestion.setUserId(userId);
+                        aiQuestion.setUserName(userName);
+                        aiQuestion.setQuestion(questionText);
+                        aiQuestion.setAnswer(completeAnswer.toString());
+                        aiQuestion.setAskTime(LocalDateTime.now());
+                        aiQuestionMapper.save(aiQuestion);
+
+                    } catch (ApiException e) {
+                        log.error("Error processing request", e);
+                        outputStream.write(("data: Error processing request\n\n").getBytes(StandardCharsets.UTF_8));
+                        outputStream.flush();
+                    } catch (NoApiKeyException | InputRequiredException e) {
+                        throw new RuntimeException(e);
+                    }
+                });
+    }
+
+    @PostMapping(value = "/aliTyqw-test")
+    public ResponseEntity<AiStreamOutputVO> send3(@RequestBody JSONObject object) throws NoApiKeyException, InputRequiredException {
+        // 获取当前登录用户的信息
+        Long userId = SecurityUtils.getUserId();
+        String userName = SecurityUtils.getLoginUser().getSysUser().getNickName();
+        String sessionId = null;
+        String content = object.get("content").toString();
+
+        // 如果没有传入 sessionId,则创建一个新的会话ID
+        if (object.containsKey("sessionId")) {
+            sessionId = object.get("sessionId").toString();
+        } else {
+            sessionId = java.util.UUID.randomUUID().toString();
+        }
+
+        // 解析 JSON 并提取 "content" 字段的值
+        String questionText = content;
+
+        // 检查是否已经存在相同的 sessionId
+        boolean exists = aiSessionMapper.existsBySessionId(sessionId);
+
+        if (!exists) {
+            // 创建新的 AiSession 实体并存入数据库
+            AiSession aiSession = new AiSession();
+            aiSession.setSessionId(sessionId);
+            aiSession.setUserId(userId);
+            aiSession.setUserName(userName);
+            aiSession.setQuestion(questionText);
+            aiSession.setAskTime(LocalDateTime.now());
+            aiSessionMapper.save(aiSession);
+        }
+
+        // 构建消息列表,包含角色定义、历史对话记录和用户新消息
+        List<Message> messages = new ArrayList<>();
+
+        // 插入角色定义(在对话历史的开头)
+        Message roleDefinition = Message.builder()
+                .role(Role.SYSTEM.getValue()) // 使用系统角色
+                .content(aiRole) // 定义角色的行为和风格
+                .build();
+        messages.add(roleDefinition); // 将角色定义插入到对话历史的开头
+
+        // 从数据库中获取历史对话记录
+        List<AiQuestion> questions = aiQuestionMapper.findQuestionsBySessionId(sessionId);
+
+        // 如果历史记录超过限制,则只取最近的记录
+        if (questions.size() > Limit) {
+            questions = questions.subList(questions.size() - Limit, questions.size());
+        }
+
+        // 将历史对话记录转换为 AiQuestionItem 列表
+        List<AiQuestionItem> itemList = new ArrayList<>();
+        for (AiQuestion question : questions) {
+            AiQuestionItem userItem = new AiQuestionItem("user", question.getQuestion());
+            userItem.setId(question.getId());
+            userItem.setSessionId(question.getSessionId());
+            userItem.setUserId(question.getUserId());
+            userItem.setUserName(question.getUserName());
+            userItem.setAskTime(question.getAskTime());
+
+            AiQuestionItem assistantItem = new AiQuestionItem("assistant", question.getAnswer());
+            assistantItem.setId(question.getId());
+            assistantItem.setSessionId(question.getSessionId());
+            assistantItem.setUserId(question.getUserId());
+            assistantItem.setUserName(question.getUserName());
+            assistantItem.setAskTime(question.getAskTime());
+
+            itemList.add(userItem);
+            itemList.add(assistantItem);
+        }
+
+        // 将 AiQuestionItem 列表转换为消息列表
+        for (AiQuestionItem item : itemList) {
+            Message message = Message.builder()
+                    .role(item.getRole().equals("user") ? Role.USER.getValue() : Role.ASSISTANT.getValue())
+                    .content(item.getContent() != null ? item.getContent() : item.getReasoningContent())
+                    .build();
+            messages.add(message);
+        }
+
+        // 添加用户的新消息
+        Message userMessage = Message.builder()
+                .role(Role.USER.getValue())
+                .content(questionText) // 使用提取的文本
+                .build();
+        messages.add(userMessage);
+
+        // 构建模型调用参数
+        GenerationParam param = GenerationParam.builder()
+                .model(tyqwModel)
+                .messages(messages)
+                .resultFormat(GenerationParam.ResultFormat.MESSAGE)
+                .topP(0.8)
+                .apiKey(apiKey)
+                .incrementalOutput(false) // 关闭增量输出
+                .enableSearch(true)  // 联网搜索
+                .build();
+
+        try {
+            // 调用非流式接口
+            String completeAnswer = generation.call(param).getOutput().getChoices().get(0).getMessage().getContent();
+
+            // 将完整回答存入数据库
+            AiQuestion aiQuestion = new AiQuestion();
+            aiQuestion.setModel(tyqwModel);
+            aiQuestion.setSessionId(sessionId);
+            aiQuestion.setUserId(userId);
+            aiQuestion.setUserName(userName);
+            aiQuestion.setQuestion(questionText);
+            aiQuestion.setAnswer(completeAnswer);
+            aiQuestion.setAskTime(LocalDateTime.now());
+            aiQuestionMapper.save(aiQuestion);
+
+            // 构建返回对象
+            AiStreamOutputVO aiStreamOutputVO = new AiStreamOutputVO();
+            aiStreamOutputVO.setSessionId(sessionId);
+            aiStreamOutputVO.setReasoningContent(completeAnswer);
+
+            // 返回完整回答给前端
+            return ResponseEntity.ok(aiStreamOutputVO);
+        } catch (ApiException e) {
+            log.error("Error processing request", e);
+
+            // 构建错误返回对象
+            AiStreamOutputVO aiStreamOutputVO = new AiStreamOutputVO();
+            aiStreamOutputVO.setSessionId(sessionId);
+            aiStreamOutputVO.setReasoningContent("Error processing request");
+
+            return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(aiStreamOutputVO);
+        } catch (NoApiKeyException | InputRequiredException e) {
+            throw new RuntimeException(e);
+        }
+    }
+}

+ 43 - 0
service-ai/service-ai-biz/src/main/java/com/usky/ai/controller/web/AiQuestionController.java

@@ -0,0 +1,43 @@
+package com.usky.ai.controller.web;
+
+import com.usky.ai.mapper.AiQuestionMapper;
+import com.usky.ai.service.AiQuestion;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+@Slf4j
+@RestController
+@RequestMapping("/questions")
+public class AiQuestionController {
+
+    @Autowired
+    private AiQuestionMapper aiQuestionMapper;
+
+    // 查询所有数据
+    @GetMapping("/all")
+    public List<AiQuestion> getAllQuestions() {
+        return aiQuestionMapper.findAll();
+    }
+
+    // 根据 userId 查询数据
+    @GetMapping("/user/{userId}")
+    public List<AiQuestion> getQuestionsByUserId(@PathVariable Long userId) {
+        return aiQuestionMapper.findByUserId(userId);
+    }
+
+    // 根据 id 删除数据
+    @DeleteMapping("/deleted/{id}")
+    public String deleteQuestion(@PathVariable Long id) {
+        aiQuestionMapper.deleteById(id);
+        return "Question with id " + id + " deleted successfully.";
+    }
+
+    // 根据 sessionId 查询数据
+    @GetMapping("/session/{sessionId}")
+    public List<AiQuestion> getQuestionsBySessionId(@PathVariable String sessionId) {
+        return aiQuestionMapper.findBySessionId(sessionId);
+    }
+}

+ 94 - 0
service-ai/service-ai-biz/src/main/java/com/usky/ai/controller/web/AiSessionController.java

@@ -0,0 +1,94 @@
+package com.usky.ai.controller.web;
+
+import com.usky.ai.mapper.AiQuestionMapper;
+import com.usky.ai.mapper.AiSessionMapper;
+import com.usky.ai.service.AiQuestion;
+import com.usky.ai.service.AiQuestionItem;
+import com.usky.ai.service.AiSession;
+import com.usky.common.core.bean.ApiResult;
+import com.usky.common.security.utils.SecurityUtils;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@Slf4j
+@RestController
+@RequestMapping("/session")
+public class AiSessionController {
+
+    @Autowired
+    private AiSessionMapper aiSessionMapper;
+
+    @Autowired
+    private AiQuestionMapper aiQuestionMapper;
+
+    @GetMapping("/all")
+    public List<AiSession> getAllSessions() {
+        return aiSessionMapper.findAll();
+    }
+
+    @GetMapping("/current")
+    public List<AiSession> getCurrentSessions(@RequestHeader("Authorization") String token) {
+        // 解析 token 获取 userId
+        Long userId = SecurityUtils.getUserId();
+        return getSessionsByUserId(userId);
+    }
+
+    public List<AiSession> getSessionsByUserId(Long userId) {
+        List<AiSession> sessions = aiSessionMapper.findByUserId(userId);
+
+        for (AiSession session : sessions) {
+            List<AiQuestion> questions = aiQuestionMapper.findQuestionsBySessionId(session.getSessionId());
+            List<AiQuestionItem> itemList = new ArrayList<>();
+
+            for (AiQuestion question : questions) {
+                AiQuestionItem userItem = new AiQuestionItem("user", question.getQuestion());
+                userItem.setId(question.getId());
+                userItem.setSessionId(question.getSessionId());
+                userItem.setUserId(question.getUserId());
+                userItem.setUserName(question.getUserName());
+                userItem.setAskTime(question.getAskTime());
+                // 不设置 reasoningContent,因为 role 是 user
+
+                itemList.add(userItem);
+
+                AiQuestionItem assistantItem = new AiQuestionItem("assistant", null); // 初始化 content 为 null
+                assistantItem.setId(question.getId());
+                assistantItem.setSessionId(question.getSessionId());
+                assistantItem.setUserId(question.getUserId());
+                assistantItem.setUserName(question.getUserName());
+                assistantItem.setAskTime(question.getAskTime());
+                assistantItem.setReasoningContent(question.getAnswer()); // 设置 reasoningContent
+                // 不设置 content,因为 role 是 assistant
+
+                itemList.add(assistantItem);
+            }
+
+            session.setItemList(itemList);
+        }
+
+        return ApiResult.success(sessions).getData();
+    }
+
+    @PostMapping("/update")
+    public ApiResult updateSession(@RequestBody AiSession aiSession) {
+        aiSessionMapper.updateQuestion(aiSession.getSessionId(), aiSession.getQuestion());
+        return ApiResult.success("更新会话成功");
+    }
+
+    @DeleteMapping("/delete")
+    public ApiResult deleteSession(@RequestParam String sessionId) {
+        try {
+            aiSessionMapper.delete(sessionId);
+            aiQuestionMapper.delete(sessionId);
+            return ApiResult.success("删除会话成功");
+        } catch (Exception e) {
+            // 如果出现异常,可以记录日志或者返回错误信息
+            log.error("删除会话失败", e);
+            return ApiResult.error("删除会话失败");
+        }
+    }
+}

+ 41 - 0
service-ai/service-ai-biz/src/main/java/com/usky/ai/mapper/AiQuestionMapper.java

@@ -0,0 +1,41 @@
+package com.usky.ai.mapper;
+
+import com.usky.ai.service.AiQuestion;
+import org.apache.ibatis.annotations.*;
+
+import java.util.List;
+
+@Mapper
+public interface AiQuestionMapper {
+    @Insert("INSERT INTO ai_questions (model, session_id, user_id, user_name, question, answer, ask_time) " +
+            "VALUES (#{model},  #{sessionId}, #{userId}, #{userName}, #{question}, #{answer}, #{askTime})")
+    void save(AiQuestion aiQuestion);
+
+    // 查询所有数据
+    @Select("SELECT * FROM ai_questions ORDER BY ask_time ASC")
+    List<AiQuestion> findAll();
+
+    // 根据 userId 查询数据
+    @Select("SELECT * FROM ai_questions WHERE user_id = #{userId} ORDER BY ask_time ASC")
+    List<AiQuestion> findByUserId(Long userId);
+
+    // 根据 id 删除数据
+    @Delete("DELETE FROM ai_questions WHERE id = #{id}")
+    void deleteById(Long id);
+
+    // 根据 sessionId 和 userId 查询数据
+    @Select("SELECT * FROM ai_questions WHERE session_id = #{sessionId} AND user_id = #{userId} ORDER BY ask_time ASC")
+    List<AiQuestion> findByUserIdAndSessionId(@Param("sessionId") String sessionId, @Param("userId") Long userId);
+
+    //根据 sessionId查询数据
+    @Select("SELECT * FROM ai_questions WHERE session_id = #{sessionId} ORDER BY ask_time ASC")
+    List<AiQuestion> findBySessionId(String sessionId);
+
+    // 根据 sessionId 查询 ai_questions 表中的数据
+    @Select("SELECT * FROM ai_questions WHERE session_id = #{sessionId} ORDER BY ask_time ASC")
+    List<AiQuestion> findQuestionsBySessionId(String sessionId);
+
+    //标记会话为删除
+    @Update("UPDATE ai_questions SET deleted = true WHERE session_id = #{sessionId}")
+    void delete(String sessionId);
+}

+ 37 - 0
service-ai/service-ai-biz/src/main/java/com/usky/ai/mapper/AiSessionMapper.java

@@ -0,0 +1,37 @@
+package com.usky.ai.mapper;
+
+import com.usky.ai.service.AiQuestion;
+import com.usky.ai.service.AiSession;
+import org.apache.ibatis.annotations.*;
+
+import java.util.List;
+
+@Mapper
+public interface AiSessionMapper {
+    @Insert("INSERT INTO ai_sessions (session_id, user_id, user_name, question, ask_time) " +
+            "VALUES (#{sessionId}, #{userId}, #{userName}, #{question}, #{askTime})")
+    void save(AiSession aiSession);
+
+    //查询所有数据
+    @Select("SELECT * FROM ai_sessions ORDER BY ask_time DESC")
+    List<AiSession> findAll();
+
+    // 根据 user_id 查询未删除的数据
+    @Select("SELECT * FROM ai_sessions WHERE user_id = #{userId} AND deleted = false ORDER BY ask_time DESC")
+    List<AiSession> findByUserId(Long userId);
+
+    // 检查是否存在指定的 session_id 且未删除
+    @Select("SELECT COUNT(*) FROM ai_sessions WHERE session_id = #{sessionId} ORDER BY ask_time DESC")
+    boolean existsBySessionId(String sessionId);
+
+    @Select("SELECT * FROM ai_questions WHERE session_id = #{sessionId} ORDER BY ask_time DESC")
+    List<AiQuestion> findQuestionsBySessionId(String sessionId);
+
+    // 更新会话主题
+    @Update("UPDATE ai_sessions SET question = #{question} WHERE session_id = #{sessionId}")
+    void updateQuestion(@Param("sessionId") String sessionId, @Param("question") String question);
+
+    //标记会话为删除
+    @Update("UPDATE ai_sessions SET deleted = true WHERE session_id = #{sessionId}")
+    void delete(String sessionId);
+}

+ 70 - 0
service-ai/service-ai-biz/src/main/java/com/usky/ai/service/AiQuestion.java

@@ -0,0 +1,70 @@
+package com.usky.ai.service;
+
+import java.time.LocalDateTime;
+
+public class AiQuestion {
+    private Long id;
+    private String model;
+    private String sessionId;
+    private Long userId; // 添加用户ID字段
+    private String userName; // 添加用户名字段
+    private String question;
+    private String answer;
+    private LocalDateTime askTime;
+
+    public Long getId() {
+        return id;
+    }
+
+    public void setId(Long id) {
+        this.id = id;
+    }
+
+    public String getModel() { return model; }
+
+    public void setModel(String model) { this.model = model; }
+
+    public String getSessionId() { return sessionId; }
+
+    public void setSessionId(String sessionId) { this.sessionId = sessionId; }
+
+    public Long getUserId() {
+        return userId;
+    }
+
+    public void setUserId(Long userId) {
+        this.userId = userId;
+    }
+
+    public String getUserName() {
+        return userName;
+    }
+
+    public void setUserName(String userName) {
+        this.userName = userName;
+    }
+
+    public String getQuestion() {
+        return question;
+    }
+
+    public void setQuestion(String question) {
+        this.question = question;
+    }
+
+    public String getAnswer() {
+        return answer;
+    }
+
+    public void setAnswer(String answer) {
+        this.answer = answer;
+    }
+
+    public LocalDateTime getAskTime() {
+        return askTime;
+    }
+
+    public void setAskTime(LocalDateTime askTime) {
+        this.askTime = askTime;
+    }
+}

+ 51 - 0
service-ai/service-ai-biz/src/main/java/com/usky/ai/service/AiQuestionItem.java

@@ -0,0 +1,51 @@
+package com.usky.ai.service;
+
+import java.time.LocalDateTime;
+
+public class AiQuestionItem {
+    private Long id;
+    private String sessionId;
+    private Long userId;
+    private String userName;
+    private String role;
+    private String content;
+    private String reasoningContent;
+    private LocalDateTime askTime;
+
+    public AiQuestionItem(String role, String content) {
+        this.role = role;
+        this.content = content;
+    }
+
+    public Long getId() { return id; }
+
+    public void setId(Long id) { this.id = id; }
+
+    public String getSessionId() { return sessionId; }
+
+    public void setSessionId(String sessionId) { this.sessionId = sessionId; }
+
+    public Long getUserId() { return userId; }
+
+    public void setUserId(Long userId) { this.userId = userId; }
+
+    public String getUserName() { return userName; }
+
+    public void setUserName(String userName) { this.userName = userName; }
+
+    public String getRole() { return role; }
+
+    public void setRole(String role) { this.role = role; }
+
+    public String getContent() { return content; }
+
+    public void setContent(String content) { this.content = content; }
+
+    public String getReasoningContent() { return reasoningContent; }
+
+    public void setReasoningContent(String reasoningContent) { this.reasoningContent = reasoningContent; }
+
+    public LocalDateTime getAskTime() { return askTime; }
+
+    public void setAskTime(LocalDateTime askTime) { this.askTime = askTime; }
+}

+ 48 - 0
service-ai/service-ai-biz/src/main/java/com/usky/ai/service/AiSession.java

@@ -0,0 +1,48 @@
+package com.usky.ai.service;
+
+import java.time.LocalDateTime;
+import java.util.List;
+
+public class AiSession {
+
+    private Long id;
+    private String sessionId;
+    private Long userId; // 添加用户ID字段
+    private String userName; // 添加用户名字段
+    private String question;
+    private LocalDateTime askTime;
+    private List<AiQuestionItem> itemList;
+    private boolean deleted; // 添加删除标识字段
+
+    public Long getId() { return id; }
+
+    public void setId(Long id) { this.id = id; }
+
+    public String getSessionId() { return sessionId; }
+
+    public void setSessionId(String sessionId) { this.sessionId = sessionId; }
+
+    public Long getUserId() { return userId; }
+
+    public void setUserId(Long userId) { this.userId = userId; }
+
+    public String getUserName() { return userName; }
+
+    public void setUserName(String userName) { this.userName = userName; }
+
+    public String getQuestion() { return question; }
+
+    public void setQuestion(String question) { this.question = question; }
+
+    public LocalDateTime getAskTime() { return askTime; }
+
+    public void setAskTime(LocalDateTime askTime) { this.askTime = askTime; }
+
+    public List<AiQuestionItem> getItemList() { return itemList; }
+
+    public void setItemList(List<AiQuestionItem> itemList) { this.itemList = itemList; }
+
+    public boolean isDeleted() { return deleted; }
+
+    public void setDeleted(boolean deleted) { this.deleted = deleted; }
+}

+ 14 - 0
service-ai/service-ai-biz/src/main/java/com/usky/ai/service/config/AiChatConfig.java

@@ -0,0 +1,14 @@
+package com.usky.ai.service.config;
+
+import com.alibaba.dashscope.aigc.generation.Generation;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+@Configuration
+public class AiChatConfig {
+
+    @Bean
+    public Generation generation() {
+        return new Generation();
+    }
+}

+ 19 - 0
service-ai/service-ai-biz/src/main/java/com/usky/ai/service/config/MyGlobalCorsConfig.java

@@ -0,0 +1,19 @@
+package com.usky.ai.service.config;
+
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.servlet.config.annotation.CorsRegistry;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
+
+@Configuration
+public class MyGlobalCorsConfig implements WebMvcConfigurer {
+
+    @Override
+    public void addCorsMappings(CorsRegistry registry) {
+        registry.addMapping("/**") // 对所有的路径允许跨域请求
+                .allowedOrigins("*") // 允许来自任何源的请求
+                .allowedMethods("GET", "POST", "PUT", "DELETE") // 允许的请求方法
+                .allowedHeaders("*") // 允许的请求头
+                .allowCredentials(false) // 是否允许证书(cookies),根据需要设置
+                .maxAge(3600); // 预检请求的缓存时间(秒)
+    }
+}

+ 14 - 0
service-ai/service-ai-biz/src/main/java/com/usky/ai/service/config/WebConfig.java

@@ -0,0 +1,14 @@
+package com.usky.ai.service.config;
+
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.servlet.config.annotation.AsyncSupportConfigurer;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
+
+@Configuration
+public class WebConfig implements WebMvcConfigurer {
+    @Override
+    public void configureAsyncSupport(AsyncSupportConfigurer configurer) {
+        // 设置默认的异步请求超时时间为300秒(单位:毫秒)
+        configurer.setDefaultTimeout(300000);
+    }
+}

+ 22 - 0
service-ai/service-ai-biz/src/main/java/com/usky/ai/service/vo/AiStreamOutputVO.java

@@ -0,0 +1,22 @@
+package com.usky.ai.service.vo;
+
+import lombok.Data;
+
+@Data
+public class AiStreamOutputVO {
+
+    /**
+     * 会话id
+     */
+    private String sessionId;
+
+    /**
+     * 输入内容
+     */
+    private String content;
+
+    /**
+     * 输出内容
+     */
+    private String reasoningContent;
+}

+ 24 - 0
service-ai/service-ai-biz/src/main/resources/bootstrap.yml

@@ -0,0 +1,24 @@
+# Tomcat
+server:
+  port: 9899
+# Spring
+spring: 
+  application:
+    # 应用名称
+    name: service-ai
+  profiles:
+    # 环境配置
+    active: dev
+  cloud:
+    nacos:
+      discovery:
+        # 服务注册地址
+        server-addr: usky-cloud-nacos:8848
+      config:
+        # 配置中心地址
+        server-addr: usky-cloud-nacos:8848
+        # 配置文件格式
+        file-extension: yml
+        # 共享配置
+        shared-configs:
+          - application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}

+ 94 - 0
service-ai/service-ai-biz/src/main/resources/logback.xml

@@ -0,0 +1,94 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<configuration scan="true" scanPeriod="60 seconds" debug="false">
+    <!-- 日志存放路径 -->
+    <property name="log.path" value="/var/log/uskycloud/service-ai" />
+    <!-- 日志输出格式 -->
+    <property name="log.pattern" value="%d{MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{26}:%line: %msg%n" />
+    <!--    	<property name="log.pattern" value="%gray(%d{MM-dd HH:mm:ss.SSS}) %highlight(%-5level) &#45;&#45; [%gray(%thread)] %cyan(%logger{26}:%line): %msg%n" />-->
+
+
+    <property name="SQL_PACKAGE" value="com.usky.ai.mapper"/>
+
+    <!-- 控制台输出 -->
+    <appender name="console" class="ch.qos.logback.core.ConsoleAppender">
+        <encoder>
+            <pattern>${log.pattern}</pattern>
+        </encoder>
+    </appender>
+
+    <appender name="file_sql" class="ch.qos.logback.core.rolling.RollingFileAppender">
+        <file>${log.path}/sql.log</file>
+        <!-- 循环政策:基于时间创建日志文件 -->
+        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+            <!-- 日志文件名格式 -->
+            <fileNamePattern>${log.path}/sql.%d{yyyy-MM-dd}.log</fileNamePattern>
+            <!-- 日志最大的历史 60天 -->
+            <maxHistory>3</maxHistory>
+        </rollingPolicy>
+        <encoder>
+            <pattern>${log.pattern}</pattern>
+        </encoder>
+    </appender>
+
+    <!-- 系统日志输出 -->
+    <appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
+        <file>${log.path}/info.log</file>
+        <!-- 循环政策:基于时间创建日志文件 -->
+        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+            <!-- 日志文件名格式 -->
+            <fileNamePattern>${log.path}/info.%d{yyyy-MM-dd}.log</fileNamePattern>
+            <!-- 日志最大的历史 60天 -->
+            <maxHistory>3</maxHistory>
+        </rollingPolicy>
+        <encoder>
+            <pattern>${log.pattern}</pattern>
+        </encoder>
+        <filter class="ch.qos.logback.classic.filter.LevelFilter">
+            <!-- 过滤的级别 -->
+            <level>INFO</level>
+            <!-- 匹配时的操作:接收(记录) -->
+            <onMatch>ACCEPT</onMatch>
+            <!-- 不匹配时的操作:拒绝(不记录) -->
+            <onMismatch>DENY</onMismatch>
+        </filter>
+    </appender>
+
+    <appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
+        <file>${log.path}/error.log</file>
+        <!-- 循环政策:基于时间创建日志文件 -->
+        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+            <!-- 日志文件名格式 -->
+            <fileNamePattern>${log.path}/error.%d{yyyy-MM-dd}.log</fileNamePattern>
+            <!-- 日志最大的历史 60天 -->
+            <maxHistory>60</maxHistory>
+        </rollingPolicy>
+        <encoder>
+            <pattern>${log.pattern}</pattern>
+        </encoder>
+        <filter class="ch.qos.logback.classic.filter.LevelFilter">
+            <!-- 过滤的级别 -->
+            <level>ERROR</level>
+            <!-- 匹配时的操作:接收(记录) -->
+            <onMatch>ACCEPT</onMatch>
+            <!-- 不匹配时的操作:拒绝(不记录) -->
+            <onMismatch>DENY</onMismatch>
+        </filter>
+    </appender>
+
+    <!-- 系统模块日志级别控制  -->
+    <!--	<logger name="com.usky" level="info" />-->
+    <!-- Spring日志级别控制  -->
+    <!--	<logger name="org.springframework" level="warn" />-->
+
+    <logger name="${SQL_PACKAGE}" additivity="false" level="debug">
+        <appender-ref ref="console"/>
+        <appender-ref ref="file_sql"/>
+    </logger>
+
+    <!--系统操作日志-->
+    <root level="info">
+        <appender-ref ref="file_info" />
+        <appender-ref ref="file_error" />
+        <appender-ref ref="console" />
+    </root>
+</configuration>

+ 151 - 0
service-ai/service-ai-biz/src/main/resources/static/dpsk.html

@@ -0,0 +1,151 @@
+<!--
+<!DOCTYPE html>
+<html lang="en">
+<head>
+    <meta charset="UTF-8">
+    <meta name="viewport" content="width=device-width, initial-scale=1.0">
+    <title>小天-AI</title>
+    <style>
+        body {
+            font-family: 'Roboto', Arial, sans-serif;
+            margin: 0;
+            padding: 0;
+            background-color: #f4f4f9;
+            display: flex;
+            justify-content: center;
+            align-items: center;
+            height: 100vh;
+        }
+        .container {
+            width: 500px;
+            background-color: #fff;
+            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
+            border-radius: 8px;
+            overflow: hidden;
+        }
+        h1 {
+            background-color: #007bff;
+            color: #fff;
+            text-align: center;
+            padding: 15px;
+            margin: 0;
+            font-size: 1.5em;
+        }
+        form {
+            padding: 20px;
+        }
+        label {
+            display: block;
+            margin-bottom: 10px;
+            font-weight: bold;
+        }
+        textarea {
+            width: 100%;
+            height: 100px;
+            border: 1px solid #ccc;
+            border-radius: 4px;
+            padding: 10px;
+            resize: none;
+        }
+        button {
+            width: 100%;
+            padding: 10px;
+            background-color: #007bff;
+            color: #fff;
+            border: none;
+            border-radius: 4px;
+            cursor: pointer;
+            transition: background-color 0.3s ease;
+        }
+        button:hover {
+            background-color: #0056b3;
+        }
+        #response {
+            margin-top: 20px;
+            padding: 10px;
+            background-color: #f9f9f9;
+            border-top: 1px solid #ccc;
+            max-height: 200px;
+            overflow-y: auto;
+            font-family: monospace;
+            white-space: pre-wrap;
+        }
+    </style>
+</head>
+<body>
+<div class="container">
+    <h1>小天-AI</h1>
+    <form id="chatForm">
+        <label for="content">你的问题:</label>
+        <textarea id="content" name="content" placeholder="请输入你的问题在这里..."></textarea>
+        <button type="submit">发送</button>
+    </form>
+    <div id="response"></div>
+    <div id="sessionId" style="margin-top: 10px; font-size: 0.9em; color: #666;"></div>
+</div>
+
+<script>
+    document.getElementById('chatForm').addEventListener('submit', function(event) {
+        event.preventDefault();
+
+        const content = document.getElementById('content').value;
+
+        const requestBody = JSON.stringify({content: content});
+
+        const token = "eyJhbGciOiJIUzUxMiJ9.eyIiOjEwMDMsInVzZXJfaWQiOjIxMywidXNlcl9rZXkiOiJlYzUxODMzNjdmYTk0ODgwOGQwZjEwODEyOWVmNjgwOSIsInVzZXJuYW1lIjoi6LW16YeR6ZuoIn0.zWulXcesI1TRcDmiAHuQ9P2WHDE2l7mDmuunx13TmVl6E5Yvs8nZvu1ddtINdw0lrnnR3Q5lZaRH3mJJTaDhig";
+
+        fetch('/ai/aliDeepSeek', {
+            method: 'POST',
+            headers: {
+                'Content-Type': 'application/json',
+                'Authorization': `Bearer ${token}`
+            },
+            body: requestBody
+        })
+            .then(response => {
+                if (!response.ok) {
+                    throw new Error('Network response was not ok');
+                }
+                return response.text();
+            })
+            .then(data => {
+                document.getElementById('response').innerText = '';
+
+                // 解析数据,提取 reasoningContent
+                const lines = data.split('\n');
+                let responseLines = [];
+
+                for (let line of lines) {
+                    try {
+                        const parsedLine = JSON.parse(line.replace('data: ', '').trim());
+                        if (parsedLine.reasoningContent !== null) {
+                            responseLines.push(parsedLine.reasoningContent);
+                        }
+                    } catch (e) {
+                        console.error('Error parsing line:', e);
+                    }
+                }
+
+                // 将 reasoningContent 的内容拼接成完整字符串
+                const fullResponse = responseLines.join('');
+
+                // 逐字显示响应内容
+                let index = 0;
+                const responseElement = document.getElementById('response');
+                const interval = setInterval(() => {
+                    if (index < fullResponse.length) {
+                        responseElement.innerText += fullResponse[index];
+                        index++;
+                    } else {
+                        clearInterval(interval);
+                    }
+                }, 50);
+            })
+            .catch(error => {
+                document.getElementById('response').innerText = 'Error: ' + error.message;
+            });
+    })
+</script>
+</body>
+</html>
+-->

+ 150 - 0
service-ai/service-ai-biz/src/main/resources/static/tyqw.html

@@ -0,0 +1,150 @@
+<!--
+<!DOCTYPE html>
+<html lang="en">
+<head>
+    <meta charset="UTF-8">
+    <meta name="viewport" content="width=device-width, initial-scale=1.0">
+    <title>小天-AI</title>
+    <style>
+        body {
+            font-family: 'Roboto', Arial, sans-serif;
+            margin: 0;
+            padding: 0;
+            background-color: #f4f4f9;
+            display: flex;
+            justify-content: center;
+            align-items: center;
+            height: 100vh;
+        }
+        .container {
+            width: 500px;
+            background-color: #fff;
+            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
+            border-radius: 8px;
+            overflow: hidden;
+        }
+        h1 {
+            background-color: #007bff;
+            color: #fff;
+            text-align: center;
+            padding: 15px;
+            margin: 0;
+            font-size: 1.5em;
+        }
+        form {
+            padding: 20px;
+        }
+        label {
+            display: block;
+            margin-bottom: 10px;
+            font-weight: bold;
+        }
+        textarea {
+            width: 100%;
+            height: 100px;
+            border: 1px solid #ccc;
+            border-radius: 4px;
+            padding: 10px;
+            resize: none;
+        }
+        button {
+            width: 100%;
+            padding: 10px;
+            background-color: #007bff;
+            color: #fff;
+            border: none;
+            border-radius: 4px;
+            cursor: pointer;
+            transition: background-color 0.3s ease;
+        }
+        button:hover {
+            background-color: #0056b3;
+        }
+        #response {
+            margin-top: 20px;
+            padding: 10px;
+            background-color: #f9f9f9;
+            border-top: 1px solid #ccc;
+            max-height: 200px;
+            overflow-y: auto;
+            font-family: monospace;
+            white-space: pre-wrap;
+        }
+    </style>
+</head>
+<body>
+<div class="container">
+    <h1>小天-AI</h1>
+    <form id="chatForm">
+        <label for="content">你的问题:</label>
+        <textarea id="content" name="content" placeholder="请输入你的问题在这里..."></textarea>
+        <button type="submit">发送</button>
+    </form>
+    <div id="response"></div>
+    <div id="sessionId" style="margin-top: 10px; font-size: 0.9em; color: #666;"></div>
+</div>
+
+<script>
+    document.getElementById('chatForm').addEventListener('submit', function(event) {
+        event.preventDefault();
+
+        const content = document.getElementById('content').value;
+
+        const requestBody = JSON.stringify({content: content});
+
+        const token = "eyJhbGciOiJIUzUxMiJ9.eyIiOjEwMDMsInVzZXJfaWQiOjIxMywidXNlcl9rZXkiOiJlYzUxODMzNjdmYTk0ODgwOGQwZjEwODEyOWVmNjgwOSIsInVzZXJuYW1lIjoi6LW16YeR6ZuoIn0.zWulXcesI1TRcDmiAHuQ9P2WHDE2l7mDmuunx13TmVl6E5Yvs8nZvu1ddtINdw0lrnnR3Q5lZaRH3mJJTaDhig";
+
+        fetch('/ai/aliTyqw', {
+            method: 'POST',
+            headers: {
+                'Content-Type': 'application/json',
+                'Authorization': `Bearer ${token}`
+            },
+            body: requestBody
+        })
+            .then(response => {
+                if (!response.ok) {
+                    throw new Error('Network response was not ok');
+                }
+                return response.text();
+            })
+            .then(data => {
+                document.getElementById('response').innerText = '';
+
+                // 解析数据,提取 reasoningContent
+                const lines = data.split('\n');
+                let responseLines = [];
+
+                for (let line of lines) {
+                    try {
+                        const parsedLine = JSON.parse(line.replace('data: ', '').trim());
+                        if (parsedLine.reasoningContent !== null) {
+                            responseLines.push(parsedLine.reasoningContent);
+                        }
+                    } catch (e) {
+                        console.error('Error parsing line:', e);
+                    }
+                }
+
+                // 将 reasoningContent 的内容拼接成完整字符串
+                const fullResponse = responseLines.join('');
+
+                // 逐字显示响应内容
+                let index = 0;
+                const responseElement = document.getElementById('response');
+                const interval = setInterval(() => {
+                    if (index < fullResponse.length) {
+                        responseElement.innerText += fullResponse[index];
+                        index++;
+                    } else {
+                        clearInterval(interval);
+                    }
+                }, 50);
+            })
+            .catch(error => {
+                document.getElementById('response').innerText = 'Error: ' + error.message;
+            });
+    })
+</script>
+</body>
+</html>-->

+ 5 - 0
service-alarm/service-alarm-biz/pom.xml

@@ -62,6 +62,10 @@
             <version>0.0.1</version>
             <scope>compile</scope>
         </dependency>
+        <dependency>
+            <groupId>com.usky</groupId>
+            <artifactId>ruoyi-common-swagger</artifactId>
+        </dependency>
     </dependencies>
 
     <build>
@@ -70,6 +74,7 @@
             <plugin>
                 <groupId>org.springframework.boot</groupId>
                 <artifactId>spring-boot-maven-plugin</artifactId>
+                <version>2.2.6.RELEASE</version>
                 <executions>
                     <execution>
                         <goals>

+ 2 - 1
service-alarm/service-alarm-biz/src/main/java/com/usky/alarm/RuoYiSystemApplication.java

@@ -1,6 +1,7 @@
 package com.usky.alarm;
 
 
+import com.ruoyi.common.swagger.annotation.EnableCustomSwagger2;
 import org.mybatis.spring.annotation.MapperScan;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -20,7 +21,7 @@ import java.net.UnknownHostException;
  * @author ruoyi
  */
 
-
+@EnableCustomSwagger2
 @EnableFeignClients(basePackages = "com.usky")
 @MapperScan(value = "com.usky.alarm.mapper")
 @ComponentScan("com.usky")

+ 151 - 53
service-alarm/service-alarm-biz/src/main/java/com/usky/alarm/service/impl/BaseAlarmNoticeResultServiceImpl.java

@@ -19,14 +19,16 @@ import com.usky.alarm.service.BaseAlarmNoticeResultService;
 import com.usky.alarm.service.config.voice.VoiceNotice;
 import com.usky.common.core.bean.CommonPage;
 import com.usky.common.mybatis.core.AbstractCrudService;
-import com.usky.common.security.utils.SecurityUtils;
+import com.usky.system.domain.MceRequestVO;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.scheduling.annotation.Async;
 import org.springframework.stereotype.Service;
+import com.usky.system.RemoteMceService;
 
 import java.time.LocalDateTime;
 import java.time.format.DateTimeFormatter;
+import java.util.Collections;
 import java.util.List;
 
 /**
@@ -44,77 +46,173 @@ public class BaseAlarmNoticeResultServiceImpl extends AbstractCrudService<BaseAl
     private VoiceNotice voiceNotice;
     @Autowired
     private SysUserMapper sysUserMapper;
+    @Autowired
+    private RemoteMceService remoteMceService;
+
+    private static final String SMS_SIGN_NAME = "上海永天科技股份有限公司";
+    private static final String SMS_TEMPLATE_CODE = "SMS_463791105";
+    private static final String REGION_ID = "cn-beijing";
+    private static final String ACCESS_KEY_ID = "LTAI5tH3VvRL5BUkovCokHJX";
+    private static final String ACCESS_KEY_SECRET = "SaaWUouNqvcA0C746gcNOH9m6SRYN4";
+
+    private static final String INFO_TYPE = "4";
+    private static final String INFO_TITLE = "设备告警";
+    private static final String ALARM_TIME_FORMAT = "yyyy-MM-dd HH:mm:ss";
+    private static final String REMARK_TEMPLATE = "设备名称:%s,请及时处理!";
+
 
     @Override
     public CommonPage<BaseAlarmNoticeResult> resultInfo(String receiver, Integer alarmId, Integer current, Integer size) {
         IPage<BaseAlarmNoticeResult> page = new Page<>(current, size);
         LambdaQueryWrapper<BaseAlarmNoticeResult> queryWrapper1 = Wrappers.lambdaQuery();
-        queryWrapper1.like(StringUtils.isNotBlank(receiver),BaseAlarmNoticeResult::getReceiver, receiver)
+        queryWrapper1.like(StringUtils.isNotBlank(receiver), BaseAlarmNoticeResult::getReceiver, receiver)
                 .eq(BaseAlarmNoticeResult::getAlarmId, alarmId);
 //                .eq(BaseAlarmNoticeResult::getTenantId, SecurityUtils.getTenantId());
-        page = this.page(page,queryWrapper1);
-        return new CommonPage<>(page.getRecords(),page.getTotal(),page.getCurrent(),page.getSize());
+        page = this.page(page, queryWrapper1);
+        return new CommonPage<>(page.getRecords(), page.getTotal(), page.getCurrent(), page.getSize());
     }
 
-    //异步多线程调用
+    // 异步多线程调用
     @Async("asyncServiceExecutor")
     public Integer send(BaseAlarm baseAlarm, List<BaseAlarmNotice> records3, Integer alarmId, List<DmpProduct> records,
                         BaseAlarmType baseAlarmType, List<DmpDevice> records2) throws ClientException {
-        log.info("start asyncServiceExecutor--------------------");
+        log.info("Start asyncServiceExecutor--------------------");
         Integer saveAlarmResult = 0;
-        try{
-            String[] array = records3.get(0).getReceiver1().split(",");
-            for (String s : array) {
-                LambdaQueryWrapper<SysUser> lambdaQuery4 = Wrappers.lambdaQuery();
-                lambdaQuery4.eq(SysUser::getUserId,s)
-                        .eq(SysUser::getDelFlag,0);
-                SysUser sysUser = sysUserMapper.selectOne(lambdaQuery4);
-                BaseAlarmNoticeResult baseAlarmNoticeResult = new BaseAlarmNoticeResult();
-                baseAlarmNoticeResult.setReceiver(sysUser.getNickName());
-                baseAlarmNoticeResult.setReceiverPhone(sysUser.getPhonenumber());
-                baseAlarmNoticeResult.setAlarmId(alarmId);
-                baseAlarmNoticeResult.setNoticeTime(LocalDateTime.now());
-                baseAlarmNoticeResult.setNoticeContent(records.get(0).getProductName()+","+baseAlarmType.getTypeName()+","+baseAlarm.getAlarmTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd " +
-                        "HH:mm:ss")));
-                baseAlarmNoticeResult.setTenantId(records.get(0).getTenantId());
-                if (records3.get(0).getNoticeMethod().contains("电话")){
-                    SingleCallByTtsResponse code = voiceNotice.sendCVoice(sysUser.getPhonenumber(),
-                            records.get(0).getProductName(),baseAlarmType.getTypeName(),
-                            baseAlarm.getAlarmTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd " +
-                                    "HH:mm:ss")));
-                    baseAlarmNoticeResult.setNoticeType(3);
-                    if(code.getCode() != null && code.getCode().equals("OK")) {
-                        //请求成功
-                        baseAlarmNoticeResult.setNoticeResult(1);
-                    }else {
-                        baseAlarmNoticeResult.setNoticeResult(2);
-                    }
+        String templateParam = createTemplateParam(baseAlarm, baseAlarmType, records2.get(0));
+
+        try {
+            String[] receivers = records3.get(0).getReceiver1().split(",");
+            for (String receiver : receivers) {
+                SysUser sysUser = getSysUser(receiver);
+                if (sysUser == null) {
+                    log.warn("查询不到告警接收用户: {}", receiver);
+                    continue;
+                }
+
+                BaseAlarmNoticeResult baseAlarmNoticeResult = createBaseAlarmNoticeResult(sysUser, baseAlarm, baseAlarmType, records.get(0), alarmId);
+
+                if (records3.get(0).getNoticeMethod().contains("电话")) {
+                    handleVoiceNotice(sysUser, baseAlarmNoticeResult, records.get(0), baseAlarmType, baseAlarm);
                     saveAlarmResult = baseMapper.insert(baseAlarmNoticeResult);
                 }
-                if (records3.get(0).getNoticeMethod().contains("短信")){
-                    DefaultProfile profile = DefaultProfile.getProfile("cn-beijing", "LTAI5tH3VvRL5BUkovCokHJX", "SaaWUouNqvcA0C746gcNOH9m6SRYN4");
-                    IAcsClient client = new DefaultAcsClient(profile);
-                    SendSmsRequest request = new SendSmsRequest();
-                    request.setPhoneNumbers(sysUser.getPhonenumber());//接收短信的手机号码
-                    request.setSignName("上海永天科技股份有限公司");//短信签名名称
-                    request.setTemplateCode("SMS_463791105");//短信模板CODE
-                    request.setTemplateParam("{\"deviceName\":\""+records2.get(0).getDeviceName()+"\","+"\"time\":\""+baseAlarm.getAlarmTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd " +
-                            "HH:mm:ss"))+"\","+
-                            "\"alarmType\":\""+baseAlarmType.getTypeName()+"\","+"\"alarmContent\":\""+baseAlarm.getAlarmContent()+"\"}");
-                    SendSmsResponse code = client.getAcsResponse(request);
-                    baseAlarmNoticeResult.setNoticeType(4);
-                    if(code.getCode() != null && code.getCode().equals("OK")) {
-                        //请求成功
-                        baseAlarmNoticeResult.setNoticeResult(1);
-                    }else {
-                        baseAlarmNoticeResult.setNoticeResult(2);
-                    }
+
+                if (records3.get(0).getNoticeMethod().contains("短信")) {
+                    handleSmsNotice(sysUser, baseAlarmNoticeResult, templateParam);
+                    saveAlarmResult = baseMapper.insert(baseAlarmNoticeResult);
+                }
+
+                if (records3.get(0).getNoticeMethod().contains("APP")) {
+                    handleMceNotice(sysUser, baseAlarmNoticeResult, baseAlarm, baseAlarmType, records2.get(0), "1");
+                    saveAlarmResult = baseMapper.insert(baseAlarmNoticeResult);
+                }
+
+                if (records3.get(0).getNoticeMethod().contains("微信")) {
+                    handleMceNotice(sysUser, baseAlarmNoticeResult, baseAlarm, baseAlarmType, records2.get(0), "2");
                     saveAlarmResult = baseMapper.insert(baseAlarmNoticeResult);
                 }
             }
-        }catch (Exception e){
-            e.printStackTrace();
+        } catch (Exception e) {
+            log.error("发送报警通知时异常", e);
         }
         return saveAlarmResult;
     }
+
+    private String createTemplateParam(BaseAlarm baseAlarm, BaseAlarmType baseAlarmType, DmpDevice device) {
+        return "{\"deviceName\":\"" + device.getDeviceName() + "\"," +
+                "\"time\":\"" + formatAlarmTime(baseAlarm.getAlarmTime()) + "\"," +
+                "\"alarmType\":\"" + baseAlarmType.getTypeName() + "\"," +
+                "\"alarmContent\":\"" + baseAlarm.getAlarmContent() + "\"}";
+    }
+
+    private SysUser getSysUser(String userId) {
+        LambdaQueryWrapper<SysUser> queryWrapper = Wrappers.lambdaQuery();
+        queryWrapper.eq(SysUser::getUserId, userId)
+                .eq(SysUser::getDelFlag, 0);
+        return sysUserMapper.selectOne(queryWrapper);
+    }
+
+    private BaseAlarmNoticeResult createBaseAlarmNoticeResult(SysUser sysUser, BaseAlarm baseAlarm, BaseAlarmType baseAlarmType, DmpProduct product, Integer alarmId) {
+        BaseAlarmNoticeResult result = new BaseAlarmNoticeResult();
+        result.setReceiver(sysUser.getNickName());
+        result.setReceiverPhone(sysUser.getPhonenumber());
+        result.setAlarmId(alarmId);
+        result.setNoticeTime(LocalDateTime.now());
+        result.setNoticeContent(product.getProductName() + "," + baseAlarmType.getTypeName() + "," + formatAlarmTime(baseAlarm.getAlarmTime()));
+        result.setTenantId(product.getTenantId());
+        return result;
+    }
+
+    private void handleVoiceNotice(SysUser sysUser, BaseAlarmNoticeResult baseAlarmNoticeResult, DmpProduct product, BaseAlarmType baseAlarmType, BaseAlarm baseAlarm) {
+        baseAlarmNoticeResult.setNoticeType(3);
+        try {
+            SingleCallByTtsResponse response = voiceNotice.sendCVoice(sysUser.getPhonenumber(),
+                    product.getProductName(), baseAlarmType.getTypeName(),
+                    formatAlarmTime(baseAlarm.getAlarmTime()));
+            baseAlarmNoticeResult.setNoticeResult(response.getCode() != null && "OK".equals(response.getCode()) ? 1 : 2);
+        } catch (Exception e) {
+            log.error("用户:{},告警消息电话拨打失败", sysUser.getUserId(), e);
+            baseAlarmNoticeResult.setNoticeResult(2);
+        }
+    }
+
+    private void handleSmsNotice(SysUser sysUser, BaseAlarmNoticeResult baseAlarmNoticeResult, String templateParam) {
+        baseAlarmNoticeResult.setNoticeType(4);
+        try {
+            IAcsClient client = createAcsClient();
+            SendSmsRequest request = new SendSmsRequest();
+            request.setPhoneNumbers(sysUser.getPhonenumber());
+            request.setSignName(SMS_SIGN_NAME);
+            request.setTemplateCode(SMS_TEMPLATE_CODE);
+            request.setTemplateParam(templateParam);
+            SendSmsResponse response = client.getAcsResponse(request);
+            baseAlarmNoticeResult.setNoticeResult(response.getCode() != null && "OK".equals(response.getCode()) ? 1 : 2);
+        } catch (Exception e) {
+            log.error("用户:{},告警消息短信发送失败", sysUser.getUserId(), e);
+            baseAlarmNoticeResult.setNoticeResult(2);
+        }
+    }
+
+    private IAcsClient createAcsClient() {
+        DefaultProfile profile = DefaultProfile.getProfile(REGION_ID, ACCESS_KEY_ID, ACCESS_KEY_SECRET);
+        return new DefaultAcsClient(profile);
+    }
+
+    // 发送消息中心
+    private void handleMceNotice(SysUser sysUser, BaseAlarmNoticeResult baseAlarmNoticeResult, BaseAlarm baseAlarm, BaseAlarmType baseAlarmType, DmpDevice device, String sendType) {
+        MceRequestVO mceRequestVO = createMceRequestVO(sysUser, baseAlarm, baseAlarmType, device, sendType);
+
+        try {
+            remoteMceService.addMceReceive(mceRequestVO);
+            baseAlarmNoticeResult.setNoticeResult(1);
+        } catch (Exception e) {
+            String noticeType = "1".equals(sendType) ? "APP" : "微信";
+            log.error("用户:{},告警消息{}推送失败:", sysUser.getUserId(), noticeType, e);
+            baseAlarmNoticeResult.setNoticeResult(2);
+        }
+
+        // 设置通知类型
+        baseAlarmNoticeResult.setNoticeType("1".equals(sendType) ? 1 : 2);
+    }
+
+    // 创建消息请求参数
+    private MceRequestVO createMceRequestVO(SysUser sysUser, BaseAlarm baseAlarm, BaseAlarmType baseAlarmType, DmpDevice device, String sendType) {
+        MceRequestVO mceRequestVO = new MceRequestVO();
+        mceRequestVO.setInfoType(INFO_TYPE);
+        mceRequestVO.setInfoTitle(INFO_TITLE);
+        mceRequestVO.setDeviceId(device.getDeviceId());
+        log.info("设备ID:{}", device.getDeviceId());
+        mceRequestVO.setInfoContent(baseAlarmType.getTypeName());
+        mceRequestVO.setAlarmTime(formatAlarmTime(baseAlarm.getAlarmTime()));
+        log.info("告警时间:{}", baseAlarm.getAlarmTime());
+        mceRequestVO.setAlarmSendType(sendType);
+        mceRequestVO.setRemark(String.format(REMARK_TEMPLATE, device.getDeviceName()));
+        mceRequestVO.setUserIds(Collections.singletonList(sysUser.getUserId()));
+        mceRequestVO.setUserName(sysUser.getUserName());
+        mceRequestVO.setId(baseAlarm.getId());
+        return mceRequestVO;
+    }
+
+    private String formatAlarmTime(LocalDateTime alarmTime) {
+        return alarmTime.format(DateTimeFormatter.ofPattern(ALARM_TIME_FORMAT));
+    }
 }

+ 1 - 0
service-alarm/service-alarm-biz/src/main/java/com/usky/alarm/service/impl/BaseAlarmServiceImpl.java

@@ -115,6 +115,7 @@ public class BaseAlarmServiceImpl extends AbstractCrudService<BaseAlarmMapper, B
                     List<BaseAlarmNotice> records3 = baseAlarmNoticeService.list(lambdaQuery3);
                     if (records3.size()>0){
                         Integer saveAlarmResult = baseAlarmNoticeResultService.send(baseAlarm,records3,alarmId,records,baseAlarmType,records2);
+                        log.info("异步发送告警通知数据: {}", baseAlarm);
                     }
                     return saveResult;
                 }

+ 7 - 2
service-alarm/service-alarm-biz/src/main/java/com/usky/alarm/service/mqtt/alarm/Alarm.java

@@ -56,13 +56,18 @@ public class Alarm implements MqttStrategy {
         List<DmpDevice> list = dmpDeviceService.list(queryWrapper1);
         baseAlarm.setDeviceId(alarams.get(0).get("devId").toString());
         baseAlarm.setAlarmTime(time2);
-        baseAlarm.setAlarmType(dp.get(0).get("serial").toString());
+        String alarmType = dp.get(0).get("serial").toString();
+        baseAlarm.setAlarmType(alarmType);
         baseAlarm.setAlarmObject(alarams.get(0).get("deviceName").toString());
         baseAlarm.setAlarmData(dp.get(0).get("status").toString());
         baseAlarm.setAlarmAttribute(dp.get(0).get("property").toString());
         if (alarams.get(0).get("deviceType").equals("1")){
             baseAlarm.setAlarmContent(dp.get(0).get("property").toString()+","+dp.get(0).get("value").toString());
-            baseAlarm.setAlarmGrade(1);
+            if(alarmType.equals("812") || alarmType.equals("815") || alarmType.equals("819")){
+                baseAlarm.setAlarmGrade(1);
+            }else{
+                baseAlarm.setAlarmGrade(2);
+            }
             baseAlarm.setAlarmAddress(dp.get(0).get("value").toString());
         }else if (alarams.get(0).get("deviceType").equals("2")){
             baseAlarm.setAlarmContent(dp.get(0).get("property").toString()+","+dp.get(0).get("value").toString());

+ 0 - 13
service-cockpit/service-cockpit-biz/src/main/java/com/usky/cockpit/ServletInitializer.java

@@ -1,13 +0,0 @@
-package com.usky.cockpit;
-
-import org.springframework.boot.builder.SpringApplicationBuilder;
-import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
-
-public class ServletInitializer extends SpringBootServletInitializer {
-
-	@Override
-	protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
-		return application.sources(RuoYiSystemApplication.class);
-	}
-
-}

+ 0 - 116
service-cockpit/service-cockpit-biz/src/main/java/com/usky/cockpit/common/base/BaseController.java

@@ -1,116 +0,0 @@
-package com.usky.cockpit.common.base;
-
-import com.usky.cockpit.common.domain.AjaxResult;
-import org.springframework.web.bind.WebDataBinder;
-import org.springframework.web.bind.annotation.InitBinder;
-import java.beans.PropertyEditorSupport;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-/**
- * web层通用数据处理
- * 
- * @ClassName: BaseController
- * @author fuce
- * @date 2018年8月18日
- *
- */
-
-public class BaseController {
-
-	/**
-	 * 将前台传递过来的日期格式的字符串,自动转化为Date类型
-	 */
-	@InitBinder
-	public void initBinder(WebDataBinder binder) {
-		// SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-		// dateFormat.setLenient(false);
-		binder.registerCustomEditor(Date.class, new MyDateEditor());
-	}
-
-	private class MyDateEditor extends PropertyEditorSupport {
-		@Override
-		public void setAsText(String text) throws IllegalArgumentException {
-			// 通过两次异常的处理可以,绑定两次日期的格式
-			SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-			Date date = null;
-			try {
-				date = format.parse(text);
-			} catch (ParseException e) {
-				format = new SimpleDateFormat("yyyy-MM-dd");
-				try {
-					date = format.parse(text);
-				} catch (ParseException e1) {
-					format = new SimpleDateFormat("yyyy/MM/dd H:mm");
-					try {
-						date = format.parse(text);
-					} catch (ParseException e2) {
-						e2.printStackTrace();
-					}
-				}
-			}
-			setValue(date);
-		}
-	}
-
-	/**
-	 * 响应返回结果
-	 * 
-	 * @param rows 影响行数
-	 * @return 操作结果
-	 */
-	protected AjaxResult toAjax(int rows) {
-		return rows > 0 ? success() : error();
-	}
-
-	/**
-	 * 返回成功
-	 */
-	public AjaxResult success() {
-		return AjaxResult.success();
-	}
-
-	/**
-	 * 返回失败消息
-	 */
-	public AjaxResult error() {
-		return AjaxResult.error();
-	}
-
-	public AjaxResult successData(int code, Object value) {
-		AjaxResult json = new AjaxResult();
-		json.put("code", code);
-		json.put("data", value);
-		return json;
-	}
-
-	/**
-	 * 返回成功消息
-	 */
-	public AjaxResult success(String message) {
-		return AjaxResult.success(message);
-	}
-
-	/**
-	 * 返回失败消息
-	 */
-	public AjaxResult error(String message) {
-		return AjaxResult.error(message);
-	}
-
-	/**
-	 * 返回错误码消息
-	 */
-	public AjaxResult error(int code, String message) {
-		return AjaxResult.error(code, message);
-	}
-
-	/**
-	 * 返回object数据
-	 */
-	public AjaxResult retobject(int code, Object data) {
-		return AjaxResult.successData(code, data);
-	}
-
-}

+ 0 - 24
service-cockpit/service-cockpit-biz/src/main/java/com/usky/cockpit/common/config/CorsConfig.java

@@ -1,24 +0,0 @@
-//package com.usky.cockpit.common.config;
-//
-//import org.springframework.context.annotation.Configuration;
-//import org.springframework.web.servlet.config.annotation.CorsRegistry;
-//import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
-//
-////重写WebMvcConfigurer实现全局跨域配置
-//@Configuration
-//public class CorsConfig implements WebMvcConfigurer{
-//	@Override
-//    public void addCorsMappings(CorsRegistry registry) {
-//        	registry.addMapping("/**")
-//            // 是否发送Cookie
-//            .allowCredentials(true)
-//            // 放行哪些原始域
-//            .allowedOrigins("*")
-//            // 放行哪些请求方式
-//            .allowedMethods("GET", "POST", "PUT", "DELETE")
-//            // 放行哪些原始请求头部信息
-//            .allowedHeaders("*")
-//            // 暴露哪些头部信息
-//            .exposedHeaders("*");
-//    }
-//}

+ 0 - 16
service-cockpit/service-cockpit-biz/src/main/java/com/usky/cockpit/common/config/DateStringConvert.java

@@ -1,16 +0,0 @@
-package com.usky.cockpit.common.config;
-
-import com.usky.common.core.util.DateUtils;
-import org.springframework.core.convert.converter.Converter;
-
-import java.util.Date;
-
-/**
- * @author han
- */
-public class DateStringConvert implements Converter<Date, String> {
-    @Override
-    public String convert(Date source) {
-        return DateUtils.format(source);
-    }
-}

+ 0 - 20
service-cockpit/service-cockpit-biz/src/main/java/com/usky/cockpit/common/config/MybatisPlusConfig.java

@@ -1,20 +0,0 @@
-package com.usky.cockpit.common.config;
-
-import com.baomidou.mybatisplus.annotation.DbType;
-import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
-import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-
-@Configuration
-public class MybatisPlusConfig {
-	 /**
-     * 新的分页插件,一缓和二缓遵循mybatis的规则,
-     */
-    @Bean
-    public MybatisPlusInterceptor mybatisPlusInterceptor() {
-        MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
-        interceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.SQLITE));
-        return interceptor;
-    }
-}

+ 0 - 16
service-cockpit/service-cockpit-biz/src/main/java/com/usky/cockpit/common/config/StringDateConverter.java

@@ -1,16 +0,0 @@
-package com.usky.cockpit.common.config;
-
-import com.usky.common.core.util.DateUtils;
-import org.springframework.core.convert.converter.Converter;
-
-import java.util.Date;
-
-/**
- * @author yq
- */
-public class StringDateConverter implements Converter<String, Date> {
-    @Override
-    public Date convert(String source) {
-        return DateUtils.parseDate(source);
-    }
-}

+ 0 - 72
service-cockpit/service-cockpit-biz/src/main/java/com/usky/cockpit/common/config/V2Config.java

@@ -1,72 +0,0 @@
-package com.usky.cockpit.common.config;
-
-import java.util.Map;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.stereotype.Component;
-
-/**
- * 读取项目相关配置
- * 
- * @author fuce
- */
-@Component
-@Configuration
-public class V2Config {
-
-	/**
-	 * 存储路径
-	 */
-	private String fileurl;
-	/**
-	 * 请求url
-	 */
-	private String httpurl;
-	/**
-	 * 虚拟路径map
-	 */
-	private Map<String, String> xnljmap;
-	
-	/**
-	 * 默认文件格式
-	 */
-	private String defaultFormat;
-	
-
-	public String getFileurl() {
-		return fileurl;
-	}
-
-	public void setFileurl(String fileurl) {
-		this.fileurl = fileurl;
-	}
-
-	
-
-	
-
-	public String getHttpurl() {
-		return httpurl;
-	}
-
-	public void setHttpurl(String httpurl) {
-		this.httpurl = httpurl;
-	}
-
-	public Map<String, String> getXnljmap() {
-		return xnljmap;
-	}
-
-	public void setXnljmap(Map<String, String> xnljmap) {
-		this.xnljmap = xnljmap;
-	}
-
-	public String getDefaultFormat() {
-		return defaultFormat;
-	}
-
-	public void setDefaultFormat(String defaultFormat) {
-		this.defaultFormat = defaultFormat;
-	}
-	
-	
-}

+ 0 - 104
service-cockpit/service-cockpit-biz/src/main/java/com/usky/cockpit/common/domain/AjaxResult.java

@@ -1,104 +0,0 @@
-package com.usky.cockpit.common.domain;
-
-import java.util.HashMap;
-
-/**
-* @ClassName: AjaxResult
-* @Description: ajax操作消息提醒
-* @author fuce
-* @date 2018年8月18日
-*
- */
-public class AjaxResult extends HashMap<String, Object>
-{
-    private static final long serialVersionUID = 1L;
-
-    /**
-     * 初始化一个新创建的 Message 对象
-     */
-    public AjaxResult()
-    {
-    }
-
-    /**
-     * 返回错误消息
-     * 
-     * @return 错误消息
-     */
-    public static AjaxResult error()
-    {
-        return error(500, "操作失败");
-    }
-
-    /**
-     * 返回错误消息
-     * 
-     * @param msg 内容
-     * @return 错误消息
-     */
-    public static AjaxResult error(String msg)
-    {
-        return error(500, msg);
-    }
-
-    /**
-     * 返回错误消息
-     * 
-     * @param code 错误码
-     * @param msg 内容
-     * @return 错误消息
-     */
-    public static AjaxResult error(int code, String msg)
-    {
-        AjaxResult json = new AjaxResult();
-        json.put("code", code);
-        json.put("msg", msg);
-        return json;
-    }
-
-    /**
-     * 返回成功消息
-     * 
-     * @param msg 内容
-     * @return 成功消息
-     */
-    public static AjaxResult success(String msg)
-    {
-        AjaxResult json = new AjaxResult();
-        json.put("msg", msg);
-        json.put("code", 200);
-        return json;
-    }
-    
-    /**
-     * 返回成功消息
-     * 
-     * @return 成功消息
-     */
-    public static AjaxResult success()
-    {
-        return AjaxResult.success("操作成功");
-    }
-    
-    public static AjaxResult successData(int code, Object value){
-    	 AjaxResult json = new AjaxResult();
-    	 json.put("code", code);
-         json.put("data", value);
-         return json;
-    }
-   
-    
-    /**
-     * 返回成功消息
-     * 
-     * @param key 键值
-     * @param value 内容
-     * @return 成功消息
-     */
-    @Override
-    public AjaxResult put(String key, Object value)
-    {
-        super.put(key, value);
-        return this;
-    }
-}

+ 0 - 84
service-cockpit/service-cockpit-biz/src/main/java/com/usky/cockpit/common/domain/ResultTable.java

@@ -1,84 +0,0 @@
-package com.usky.cockpit.common.domain;
-
-public class ResultTable {
-     /**
-     * 状态码
-     * */
-    private Integer code;
-
-    /**
-     * 提示消息
-     * */
-    private String msg;
-
-    /**
-     * 消息总量
-     * */
-    private Long count;
-
-    /**
-     * 数据对象
-     * */
-    private Object data;
-
-    public Integer getCode() {
-        return code;
-    }
-
-    public void setCode(Integer code) {
-        this.code = code;
-    }
-
-    public String getMsg() {
-        return msg;
-    }
-
-    public void setMsg(String msg) {
-        this.msg = msg;
-    }
-
-    public Long getCount() {
-        return count;
-    }
-
-    public void setCount(Long count) {
-        this.count = count;
-    }
-
-    public Object getData() {
-        return data;
-    }
-
-    public void setData(Object data) {
-        this.data = data;
-    }
-
-    /**
-     * 构 建
-     * */
-    public static ResultTable pageTable(long count,Object data){
-        ResultTable resultTable = new ResultTable();
-        resultTable.setData(data);
-        resultTable.setCode(0);
-        resultTable.setCount(count);
-        if(data!=null) {
-       	 resultTable.setMsg("获取成功");
-       }else {
-       	 resultTable.setMsg("获取失败");
-       }
-        return resultTable;
-    }
-
-    public static ResultTable dataTable(Object data){
-        ResultTable resultTable = new ResultTable();
-        resultTable.setData(data);
-        resultTable.setCode(0);
-        if(data!=null) {
-        	 resultTable.setMsg("获取成功");
-        }else {
-        	 resultTable.setMsg("获取失败");
-        }
-       
-        return resultTable;
-    }
-}

+ 0 - 50
service-cockpit/service-cockpit-biz/src/main/java/com/usky/cockpit/common/domain/Tablepar.java

@@ -1,50 +0,0 @@
-package com.usky.cockpit.common.domain;
-
-/**
- * boostrap table post 参数
- * @author fc
- *
- */
-public class Tablepar {
-	private int page;//页码
-	private int limit;//数量
-	private String orderByColumn;//排序字段
-	private String isAsc;//排序字符 asc desc 
-	private String searchText;//列表table里面的搜索
-
-	public int getPage() {
-		return page;
-	}
-
-	public void setPage(int page) {
-		this.page = page;
-	}
-
-	public int getLimit() {
-		return limit;
-	}
-
-	public void setLimit(int limit) {
-		this.limit = limit;
-	}
-
-	public String getOrderByColumn() {
-		return orderByColumn;
-	}
-	public void setOrderByColumn(String orderByColumn) {
-		this.orderByColumn = orderByColumn;
-	}
-	public String getIsAsc() {
-		return isAsc;
-	}
-	public void setIsAsc(String isAsc) {
-		this.isAsc = isAsc;
-	}
-	public String getSearchText() {
-		return searchText;
-	}
-	public void setSearchText(String searchText) {
-		this.searchText = searchText;
-	}
-
-}

+ 0 - 21
service-cockpit/service-cockpit-biz/src/main/java/com/usky/cockpit/common/interceptor/Interceptor.java

@@ -1,21 +0,0 @@
-package com.usky.cockpit.common.interceptor;
-
-import org.springframework.web.servlet.HandlerInterceptor;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-/**
- * 拦截器
- */
-public class Interceptor implements HandlerInterceptor {
-    /**
-     * 在请求处理之前进行调用(Controller方法调用之前)
-     */
-	@Override
-    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) {
-       
-        return true;//如果设置为false时,被请求时,拦截器执行到此处将不会继续操作
-        //如果设置为true时,请求将会继续执行后面的操作
-    }
-
-}

+ 0 - 31
service-cockpit/service-cockpit-biz/src/main/java/com/usky/cockpit/common/interceptor/WebMvcConfig.java

@@ -1,31 +0,0 @@
-package com.usky.cockpit.common.interceptor;
-
-import com.usky.cockpit.common.config.DateStringConvert;
-import com.usky.cockpit.common.config.StringDateConverter;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.format.FormatterRegistry;
-import org.springframework.format.support.FormattingConversionService;
-import org.springframework.http.converter.ObjectToStringHttpMessageConverter;
-import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
-
-/**
- * @author han
- */
-@Configuration
-public class WebMvcConfig implements WebMvcConfigurer {
-
-    @Override
-    public void addFormatters(FormatterRegistry registry) {
-        registry.addConverter(new StringDateConverter());
-    }
-
-    @Bean
-    public ObjectToStringHttpMessageConverter objectToStringHttpMessageConverter() {
-        FormattingConversionService conversionService = new FormattingConversionService();
-        conversionService.addConverter(new StringDateConverter());
-        conversionService.addConverter(new DateStringConvert());
-        ObjectToStringHttpMessageConverter httpMessageconverter = new ObjectToStringHttpMessageConverter(conversionService);
-        return httpMessageconverter;
-    }
-}

+ 0 - 371
service-cockpit/service-cockpit-biz/src/main/java/com/usky/cockpit/controller/web/FileController.java

@@ -1,371 +0,0 @@
-package com.usky.cockpit.controller.web;
-
-import java.io.File;
-import java.io.IOException;
-import java.math.BigInteger;
-import java.security.MessageDigest;
-import java.time.LocalDateTime;
-import java.util.Date;
-import java.util.Map;
-import java.util.Map.Entry;
-import javax.servlet.http.HttpServletResponse;
-
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.usky.cockpit.model.SysFile;
-import com.usky.cockpit.model.vo.SysFileVo;
-import com.usky.cockpit.service.ISysFileService;
-import com.usky.cockpit.util.SnowflakeIdWorker;
-import com.usky.common.core.web.domain.AjaxResult;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.*;
-import org.springframework.web.multipart.MultipartFile;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import lombok.extern.slf4j.Slf4j;
-import com.usky.cockpit.common.config.V2Config;
-import cn.hutool.core.bean.BeanUtil;
-import cn.hutool.core.codec.Base64;
-import cn.hutool.core.date.DateUtil;
-import cn.hutool.core.io.FileUtil;
-import cn.hutool.core.io.IORuntimeException;
-import cn.hutool.core.util.StrUtil;
-
-/**
- * 文件上传controller
- * @author fuce 
- * @date: 2018年9月16日 下午4:23:50
- */
-@Api(value = "文件上传")
-@RestController
-@RequestMapping("/api/file")
-@Slf4j
-public class FileController{
-
-
-	@Autowired
-	private V2Config v2Config;
-	@Autowired
-	private ISysFileService iSysFileService;
-
-	/**
-	 * 删除文件
-	 * @param ids
-	 * @return
-	 */
-	@ApiOperation(value = "删除", notes = "删除")
-	@DeleteMapping("/remove")
-	public AjaxResult remove(String ids){
-		Boolean b=iSysFileService.removeByIds(StrUtil.split(ids, ',',-1));
-		if(b){
-			return AjaxResult.success();
-		}else{
-			return AjaxResult.error();
-		}
-	}
-	
-	
-	@ApiOperation(value = "修改", notes = "修改")
-	@PutMapping("/update")
-	public AjaxResult update(String id,@RequestBody MultipartFile object) throws IllegalStateException, IOException{
-		SysFile sysFile=iSysFileService.getById(id);
-		if(sysFile!=null){
-			String fileurl=sysFile.getAbsolutePath()+sysFile.getRelativePath()+File.separator+sysFile.getFileName();
-			object.transferTo(new File(fileurl));
-			return AjaxResult.success("修改成功");
-		}else{
-			return AjaxResult.error();
-		}
-	}
-
-	/**
-	 * 上传文件
-	 * @param object 文件流对象
-	 * @return
-	 * @throws Exception
-	 */
-	@PostMapping("/upload")
-	public AjaxResult upload(@RequestBody MultipartFile object) throws IOException{
-		String fileName = object.getOriginalFilename();
-		//默认文件格式
-		String suffixName=v2Config.getDefaultFormat();
-		String mediaKey="";
-		Long filesize= object.getSize();
-		//文件名字
-		String fileSuffixName="";
-		if(fileName.lastIndexOf(".")!=-1) {//有后缀
-			 suffixName = fileName.substring(fileName.lastIndexOf(".")).toLowerCase();
-			 //mediaKey=MD5.create().digestHex(fileName);
-			 mediaKey= SnowflakeIdWorker.getUUID();
-			 fileSuffixName=mediaKey+suffixName;
-		}else {//无后缀
-			//取得唯一id
-			 //mediaKey = MD5.create().digestHex(fileName+suffixName);
-			mediaKey=SnowflakeIdWorker.getUUID();
-			//fileSuffixName=mediaKey+suffixName;
-		}
-		String virtualKey=getFirstNotNull(v2Config.getXnljmap());
-		String absolutePath=v2Config.getXnljmap().get(getFirstNotNull(v2Config.getXnljmap()));
-		SysFile sysFile=new SysFile();
-		sysFile.setId(SnowflakeIdWorker.getUUID());
-		sysFile.setFileName(fileSuffixName);
-		sysFile.setFileSize(Integer.parseInt(filesize+""));
-		sysFile.setFileSuffix(suffixName);
-		sysFile.setCreateTime(DateUtil.formatLocalDateTime(LocalDateTime.now()));
-		String filepath=DateUtil.formatDate(new Date());
-		sysFile.setRelativePath(filepath);
-		sysFile.setVirtualKey(virtualKey);
-		sysFile.setAbsolutePath(absolutePath.replace("file:",""));
-		iSysFileService.saveOrUpdate(sysFile);
-		File desc = getAbsoluteFile(v2Config.getFileurl()+File.separator+filepath,fileSuffixName);
-		object.transferTo(desc);
-		SysFileVo sysFileVo=BeanUtil.copyProperties(sysFile, SysFileVo.class);
-		sysFileVo.setFileurl(v2Config.getHttpurl()+sysFile.getVirtualKey()+"/"+sysFile.getRelativePath()+"/"+sysFile.getFileName());
-		return AjaxResult.success(sysFileVo);
-	}
-	
-	
-	/**
-	 * Base64字符串转成图片
-	 * @throws IOException 
-	 */
-	@PostMapping("/uploadbase64")
-	public synchronized AjaxResult uploadbase64(String base64str) throws IOException{
-		if(StrUtil.isNotBlank(base64str)){
-			String suffixName=v2Config.getDefaultFormat();
-			String mediaKey=SnowflakeIdWorker.getUUID();
-			String fileSuffixName=mediaKey+suffixName;
-			String virtualKey=getFirstNotNull(v2Config.getXnljmap());
-			String absolutePath=v2Config.getXnljmap().get(getFirstNotNull(v2Config.getXnljmap()));
-			SysFile sysFile=new SysFile();
-			sysFile.setId(SnowflakeIdWorker.getUUID());
-			sysFile.setFileName(fileSuffixName);
-			sysFile.setFileSuffix(suffixName);
-			sysFile.setCreateTime(DateUtil.formatLocalDateTime(LocalDateTime.now()));
-			String filepath=DateUtil.formatDate(new Date());
-			sysFile.setRelativePath(filepath);
-			sysFile.setVirtualKey(virtualKey);
-			sysFile.setAbsolutePath(absolutePath.replace("file:",""));
-			File desc = getAbsoluteFile(v2Config.getFileurl()+File.separator+filepath,fileSuffixName);
-			File file=null;
-			try {
-				 file=Base64.decodeToFile(base64str, desc);
-			} catch (Exception e) {
-				System.out.println("错误base64:"+base64str);
-				e.printStackTrace();
-			}
-			sysFile.setFileSize(Integer.parseInt(file.length()+""));
-			iSysFileService.saveOrUpdate(sysFile);
-			SysFileVo sysFileVo=BeanUtil.copyProperties(sysFile, SysFileVo.class);
-			sysFileVo.setFileurl(v2Config.getHttpurl()+sysFile.getVirtualKey()+"/"+sysFile.getRelativePath()+"/"+sysFile.getFileName());
-			return AjaxResult.success(sysFileVo);
-		}
-		return AjaxResult.error();
-		
-	}
-	
-	
-	/**
-	 * 定制方法
-	 * 根据关键字与相对路径获取文件内容 
-	 * @param key 访问关键字
-	 * @return
-	 */
-	@PostMapping("/getFileText")
-	public AjaxResult getFileText(String key,String relativePath){
-		String absolutePath= v2Config.getXnljmap().get(key).replace("file:", "");
-		String fileurl=absolutePath+relativePath;
-		try {
-			String text=FileUtil.readUtf8String(fileurl);
-			return AjaxResult.success(text);
-		}catch (IORuntimeException e) {
-			return AjaxResult.error("没有该文件");
-		}
-		catch (Exception e) {
-			return AjaxResult.error("报错:"+e.getMessage());
-		}
-	}
-	
-	
-	/**
-	 * 定制方法
-	 * 根据关键字与相对路径获取文件内容 
-	 * @param key 访问关键字
-	 * @return
-	 * @throws IOException 
-	 */
-	@PostMapping("/getFileText302")
-	public void getFileText302(String key,String relativePath,HttpServletResponse response) throws IOException{
-		String str=v2Config.getHttpurl()+key+"/"+relativePath;
-		response.sendRedirect(str);
-		
-	}
-	
-	
-	
-	
-	/**
-	 * 覆盖上传文件 key与指定路径
-	 * @param object 文件流对象
-	 * @return
-	 * @throws Exception
-	 */
-	@PostMapping("/coverupload")
-	public AjaxResult coverupload(@RequestBody MultipartFile object,String key,String relativePath) throws IOException{
-		
-		String fileName = object.getOriginalFilename();
-		String suffixName=v2Config.getDefaultFormat();
-		Long filesize= object.getSize();
-		//文件名字
-		String fileSuffixName="";
-		if(fileName.lastIndexOf(".")!=-1) {//有后缀
-			 suffixName = fileName.substring(fileName.lastIndexOf(".")).toLowerCase();
-			 //mediaKey=MD5.create().digestHex(fileName);
-			 //mediaKey=SnowflakeIdWorker.getUUID();
-			 fileSuffixName=relativePath.substring(relativePath.lastIndexOf("/")+1,relativePath.length());
-		}else {//无后缀
-			//取得唯一id
-			 //mediaKey = MD5.create().digestHex(fileName+suffixName);
-			//mediaKey=SnowflakeIdWorker.getUUID();
-			//fileSuffixName=mediaKey+suffixName;
-		}
-		String virtualKey=key;
-		String absolutePath=v2Config.getXnljmap().get(key).replace("file:", "");
-		SysFile sysFile=new SysFile();
-		sysFile.setId(SnowflakeIdWorker.getUUID());
-		sysFile.setFileName(fileSuffixName);
-		sysFile.setFileSize(Integer.parseInt(filesize+""));
-		sysFile.setFileSuffix(suffixName);
-		sysFile.setCreateTime(DateUtil.formatLocalDateTime(LocalDateTime.now()));
-		String filepath=relativePath.substring(0,relativePath.lastIndexOf("/"));
-		sysFile.setRelativePath(filepath);
-		sysFile.setVirtualKey(virtualKey);
-		sysFile.setAbsolutePath(absolutePath);
-		iSysFileService.saveOrUpdate(sysFile);
-		File desc = getAbsoluteFile(absolutePath+filepath,fileSuffixName);
-		object.transferTo(desc);
-		SysFileVo sysFileVo=BeanUtil.copyProperties(sysFile, SysFileVo.class);
-		sysFileVo.setFileurl(v2Config.getHttpurl()+sysFile.getVirtualKey()+"/"+sysFile.getRelativePath()+"/"+sysFile.getFileName());
-		return AjaxResult.success(sysFileVo);
-	}
-	
-	
-	
-
-	
-	/**
-	 * 根据文件id查询文件信息json
-	 * @param id
-	 * @return
-	 */
-	@GetMapping("/getFileid/{id}")
-	public AjaxResult getFileid(@PathVariable("id") String id){
-		SysFile sysFile=iSysFileService.getById(id);
-		if(sysFile!=null){
-			SysFileVo sysFileVo=BeanUtil.copyProperties(sysFile, SysFileVo.class);
-			sysFileVo.setFileurl(v2Config.getHttpurl()+sysFile.getVirtualKey()+"/"+sysFile.getRelativePath()+"/"+sysFile.getFileName());
-			return AjaxResult.success(sysFileVo);
-		}
-		return AjaxResult.error("没有该文件");
-		
-	}
-	
-	/**
-	 * 根据文件id 302跳转到绝对地址
-	 * @param id
-	 * @param response
-	 * @throws IOException
-	 */
-	@GetMapping("/getFileid/302/{id}")
-	public void getFileid302(@PathVariable("id") String id,HttpServletResponse response) throws IOException{
-		SysFile sysFile=iSysFileService.getById(id);
-		if(sysFile!=null){
-			String str=v2Config.getHttpurl()+sysFile.getVirtualKey()+"/"+sysFile.getRelativePath()+"/"+sysFile.getFileName();
-			response.sendRedirect(str);
-		}
-	}
-	
-	
-	
-	
-	
-	
-	/**
-	 * 分页查询
-	 * @param current
-	 * @param size
-	 * @return
-	 */
-	@GetMapping("/list")
-	public Object list(long current, long size){
-		Page<SysFile> page= new Page<SysFile>(current, size);
-		IPage<SysFile> sysFile=iSysFileService.page(page, new LambdaQueryWrapper<SysFile>());
-		return sysFile;
-	}
-	
-	
-	
-	
-
-    /**
-     * 获取map中第一个非空数据key
-     *
-     * @param <K> Key的类型
-     * @param <V> Value的类型
-     * @param map 数据源
-     * @return 返回的值
-     */
-    public static <K, V> K getFirstNotNull(Map<K, V> map) {
-        K obj = null;
-        for (Entry<K, V> entry : map.entrySet()) {
-            obj =  entry.getKey();
-            if (obj != null) {
-                break;
-            }
-        }
-        return obj;
-    }
-	
-	
-    public  final static File getAbsoluteFile(String uploadDir, String filename) throws IOException
-    {
-        File desc = new File(uploadDir+File.separator + filename);
-
-        if (!desc.getParentFile().exists())
-        {
-            desc.getParentFile().mkdirs();
-        }
-        if (!desc.exists())
-        {
-            desc.createNewFile();
-        }
-        return desc;
-    }
-	
-	
-	/**
-	 * 获取上传文件的md5
-	 * @param file
-	 * @return
-	 * @throws IOException
-	 */
-	public String getMd5(MultipartFile file) {
-	    try {
-	        //获取文件的byte信息
-	        byte[] uploadBytes = file.getBytes();
-	        // 拿到一个MD5转换器
-	        MessageDigest md5 = MessageDigest.getInstance("MD5");
-	        byte[] digest = md5.digest(uploadBytes);
-	        //转换为16进制
-	        return new BigInteger(1, digest).toString(16);
-	    } catch (Exception e) {
-	        log.error(e.getMessage());
-	    }
-	    return null;
-	}
-
-
-    
-    
-}

+ 0 - 254
service-cockpit/service-cockpit-biz/src/main/java/com/usky/cockpit/controller/web/GoviewProjectController.java

@@ -1,254 +0,0 @@
-package com.usky.cockpit.controller.web;
-
-import com.usky.cockpit.common.config.V2Config;
-import com.usky.cockpit.common.domain.ResultTable;
-import com.usky.cockpit.common.domain.Tablepar;
-import com.usky.cockpit.controller.web.FileController;
-import com.usky.cockpit.model.GoviewProject;
-import com.usky.cockpit.model.GoviewProjectData;
-import com.usky.cockpit.model.SysFile;
-import com.usky.cockpit.model.vo.GoviewProjectVo;
-import com.usky.cockpit.model.vo.SysFileVo;
-import com.usky.cockpit.service.IGoviewProjectDataService;
-import com.usky.cockpit.service.IGoviewProjectService;
-import com.usky.cockpit.service.ISysFileService;
-import com.usky.cockpit.util.ConvertUtil;
-import com.usky.cockpit.util.SnowflakeIdWorker;
-import com.usky.common.core.web.domain.AjaxResult;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.PutMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.ResponseBody;
-import org.springframework.web.bind.annotation.RestController;
-import org.springframework.web.multipart.MultipartFile;
-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.extension.plugins.pagination.Page;
-import cn.hutool.core.bean.BeanUtil;
-import cn.hutool.core.date.DateUtil;
-import io.swagger.annotations.ApiOperation;
-import java.io.File;
-import java.io.IOException;
-import java.time.LocalDateTime;
-import java.util.Date;
-import java.util.List;
-import org.springframework.beans.BeanUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.ui.ModelMap;
-
-/**
- * <p>
- *  前端控制器
- * </p>
- *
- * @author fc
- * @since 2023-04-30
- */
-@RestController
-@RequestMapping("/api/goview/project")
-public class GoviewProjectController{
-	@Autowired
-	private ISysFileService iSysFileService;
-	@Autowired
-	private V2Config v2Config;
-	@Autowired
-	private IGoviewProjectService iGoviewProjectService;
-	@Autowired
-	private IGoviewProjectDataService iGoviewProjectDataService;
-	
-
-	@GetMapping("/list")
-	@ResponseBody
-	public ResultTable list(Tablepar tablepar){
-		Page<GoviewProject> page= new Page<GoviewProject>(tablepar.getPage(), tablepar.getLimit());
-		IPage<GoviewProject> iPages=iGoviewProjectService.page(page, new LambdaQueryWrapper<GoviewProject>());
-		ResultTable resultTable=new ResultTable();
-		resultTable.setData(iPages.getRecords());
-		resultTable.setCode(200);
-		resultTable.setCount(iPages.getTotal());
-		resultTable.setMsg("获取成功");
-		return resultTable;
-	}
-	
-	
-	/**
-     * 新增保存
-     * @param 
-     * @return
-     */
-	//@Log(title = "项目表新增", action = "111")
-	@ApiOperation(value = "新增", notes = "新增")
-	@PostMapping("/create")
-	@ResponseBody
-	public AjaxResult add(@RequestBody GoviewProject goviewProject){
-		goviewProject.setCreateTime(DateUtil.now());
-		goviewProject.setState(-1);
-		boolean b=iGoviewProjectService.save(goviewProject);
-		if(b){
-			return AjaxResult.success("创建成功");
-		}else{
-			return AjaxResult.error();
-		}
-	}
-	
-	
-	/**
-	 * 项目表删除
-	 * @param ids
-	 * @return
-	 */
-	//@Log(title = "项目表删除", action = "111")
-	@ApiOperation(value = "删除", notes = "删除")
-	@DeleteMapping("/delete")
-	@ResponseBody
-	public AjaxResult remove(String ids){
-		List<String> lista= ConvertUtil.toListStrArray(ids);
-		Boolean b=iGoviewProjectService.removeByIds(lista);
-		if(b){
-			return AjaxResult.success();
-		}else{
-			return AjaxResult.error();
-		}
-	}
-	
-	@ApiOperation(value = "修改保存", notes = "修改保存")
-    @PostMapping("/edit")
-    @ResponseBody
-    public AjaxResult editSave(@RequestBody GoviewProject goviewProject)
-    {
-		Boolean b= iGoviewProjectService.updateById(goviewProject);
-        if(b){
-        	return AjaxResult.success();
-        }
-        return AjaxResult.error();
-    }
-	
-	
-	@ApiOperation(value = "项目重命名", notes = "项目重命名")
-    @PostMapping("/rename")
-    @ResponseBody
-    public AjaxResult rename(@RequestBody GoviewProject goviewProject)
-    {
-		
-		LambdaUpdateWrapper<GoviewProject> updateWrapper=new LambdaUpdateWrapper<GoviewProject>();
-		updateWrapper.eq(GoviewProject::getId, goviewProject.getId());
-		updateWrapper.set(GoviewProject::getProjectName, goviewProject.getProjectName());
-		Boolean b=iGoviewProjectService.update(updateWrapper);
-		if(b){
-        	return AjaxResult.success();
-        }
-		return AjaxResult.error();
-    }
-	
-	
-	//发布/取消项目状态
-    @PutMapping("/publish")
-	@ResponseBody
-    public AjaxResult updateVisible(@RequestBody GoviewProject goviewProject){
-    	if(goviewProject.getState()==-1||goviewProject.getState()==1) {
-    	
-    		LambdaUpdateWrapper<GoviewProject> updateWrapper=new LambdaUpdateWrapper<GoviewProject>();
-    		updateWrapper.eq(GoviewProject::getId, goviewProject.getId());
-    		updateWrapper.set(GoviewProject::getState, goviewProject.getState());
-    		Boolean b=iGoviewProjectService.update(updateWrapper);
-    		if(b){
-            	return AjaxResult.success();
-            }
-    		return AjaxResult.error();
-    	}
-    	return AjaxResult.error("警告非法字段");
-	}
-	
-    
-    @ApiOperation(value = "获取项目存储数据", notes = "获取项目存储数据")
-	@GetMapping("/getData")
-	@ResponseBody
-    public AjaxResult getData(String projectId, ModelMap map)
-    {
-		GoviewProject goviewProject= iGoviewProjectService.getById(projectId);
-		
-		GoviewProjectData blogText=iGoviewProjectDataService.getProjectid(projectId);
-		if(blogText!=null) {
-			GoviewProjectVo goviewProjectVo=new GoviewProjectVo();
-			BeanUtils.copyProperties(goviewProject,goviewProjectVo);
-			goviewProjectVo.setContent(blogText.getContent());
-			return AjaxResult.success("获取成功");
-		}
-		return AjaxResult.success("无数据");
-        
-    }
-	
-	
-	
-	@ApiOperation(value = "保存项目数据", notes = "保存项目数据")
-	@PostMapping("/save/data")
-	@ResponseBody
-	public AjaxResult saveData(GoviewProjectData data) {
-		
-		GoviewProject goviewProject= iGoviewProjectService.getById(data.getProjectId());
-		if(goviewProject==null) {
-			return AjaxResult.error("没有该项目ID");
-		}
-		GoviewProjectData goviewProjectData= iGoviewProjectDataService.getOne(new LambdaQueryWrapper<GoviewProjectData>().eq(GoviewProjectData::getProjectId, goviewProject.getId()));
-		if(goviewProjectData!=null) {
-			 data.setId(goviewProjectData.getId());
-			 iGoviewProjectDataService.updateById(data);
-			 return AjaxResult.success("数据保存成功");
-		}else {
-			iGoviewProjectDataService.save(data);
-			return AjaxResult.success("数据保存成功");
-		}
-	}
-	
-	/**
-	 * 上传文件
-	 * @param object 文件流对象
-	 * @return
-	 * @throws Exception
-	 */
-	@PostMapping("/upload")
-	public AjaxResult upload(@RequestBody MultipartFile object) throws IOException{
-		String fileName = object.getOriginalFilename();
-		//默认文件格式
-		String suffixName=v2Config.getDefaultFormat();
-		String mediaKey="";
-		Long filesize= object.getSize();
-		//文件名字
-		String fileSuffixName="";
-		if(fileName.lastIndexOf(".")!=-1) {//有后缀
-			 suffixName = fileName.substring(fileName.lastIndexOf(".")).toLowerCase();
-			 //mediaKey=MD5.create().digestHex(fileName);
-			 mediaKey= SnowflakeIdWorker.getUUID();
-			 fileSuffixName=mediaKey+suffixName;
-		}else {//无后缀
-			//取得唯一id
-			 //mediaKey = MD5.create().digestHex(fileName+suffixName);
-			mediaKey=SnowflakeIdWorker.getUUID();
-			//fileSuffixName=mediaKey+suffixName;
-		}
-		String virtualKey= FileController.getFirstNotNull(v2Config.getXnljmap());
-		String absolutePath=v2Config.getXnljmap().get(FileController.getFirstNotNull(v2Config.getXnljmap()));
-		SysFile sysFile=new SysFile();
-		sysFile.setId(SnowflakeIdWorker.getUUID());
-		sysFile.setFileName(fileSuffixName);
-		sysFile.setFileSize(Integer.parseInt(filesize+""));
-		sysFile.setFileSuffix(suffixName);
-		sysFile.setCreateTime(DateUtil.formatLocalDateTime(LocalDateTime.now()));
-		String filepath=DateUtil.formatDate(new Date());
-		sysFile.setRelativePath(filepath);
-		sysFile.setVirtualKey(virtualKey);
-		sysFile.setAbsolutePath(absolutePath.replace("file:",""));
-		iSysFileService.saveOrUpdate(sysFile);
-		File desc = FileController.getAbsoluteFile(v2Config.getFileurl()+File.separator+filepath,fileSuffixName);
-		object.transferTo(desc);
-		SysFileVo sysFileVo=BeanUtil.copyProperties(sysFile, SysFileVo.class);
-		sysFileVo.setFileurl(v2Config.getHttpurl()+sysFile.getVirtualKey()+"/"+sysFile.getRelativePath()+"/"+sysFile.getFileName());
-		return AjaxResult.success(sysFileVo);
-	}
-	
-
-}

+ 0 - 21
service-cockpit/service-cockpit-biz/src/main/java/com/usky/cockpit/controller/web/Indexcontroller.java

@@ -1,21 +0,0 @@
-package com.usky.cockpit.controller.web;
-
-import java.io.IOException;
-import java.io.PrintWriter;
-import javax.servlet.http.HttpServletResponse;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-@RestController
-public class Indexcontroller {
-
-	@GetMapping("/")
-	public void index(HttpServletResponse response) throws IOException {
-		response.setContentType("text/html; charset=utf-8");
-		PrintWriter out = response.getWriter();
-		out.println("<p style='color:orange'>goview后台首页</p>");
-		out.flush();
-		out.close();
-
-	}
-}

+ 0 - 19
service-cockpit/service-cockpit-biz/src/main/java/com/usky/cockpit/controller/web/SysUserController.java

@@ -1,19 +0,0 @@
-package com.usky.cockpit.controller.web;
-
-
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-/**
- * <p>
- *  前端控制器
- * </p>
- *
- * @author fc
- * @since 2023-04-30
- */
-@RestController
-@RequestMapping("/v2/sys-user")
-public class SysUserController {
-
-}

+ 0 - 18
service-cockpit/service-cockpit-biz/src/main/java/com/usky/cockpit/mapper/GoviewProjectDataMapper.java

@@ -1,18 +0,0 @@
-package com.usky.cockpit.mapper;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.usky.cockpit.model.GoviewProjectData;
-import org.springframework.stereotype.Repository;
-
-/**
- * <p>
- *  Mapper 接口
- * </p>
- *
- * @author fc
- * @since 2023-04-30
- */
-@Repository
-public interface GoviewProjectDataMapper extends BaseMapper<GoviewProjectData> {
-
-}

+ 0 - 16
service-cockpit/service-cockpit-biz/src/main/java/com/usky/cockpit/mapper/GoviewProjectMapper.java

@@ -1,16 +0,0 @@
-package com.usky.cockpit.mapper;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.usky.cockpit.model.GoviewProject;
-
-/**
- * <p>
- *  Mapper 接口
- * </p>
- *
- * @author fc
- * @since 2023-04-30
- */
-public interface GoviewProjectMapper extends BaseMapper<GoviewProject> {
-
-}

+ 0 - 19
service-cockpit/service-cockpit-biz/src/main/java/com/usky/cockpit/mapper/SysFileMapper.java

@@ -1,19 +0,0 @@
-package com.usky.cockpit.mapper;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.usky.cockpit.model.SysFile;
-import org.springframework.stereotype.Repository;
-
-
-/**
- * <p>
- *  Mapper 接口
- * </p>
- *
- * @author fc
- * @since 2022-12-22
- */
-@Repository
-public interface SysFileMapper extends BaseMapper<SysFile> {
-
-}

+ 0 - 16
service-cockpit/service-cockpit-biz/src/main/java/com/usky/cockpit/mapper/SysUserMapper.java

@@ -1,16 +0,0 @@
-package com.usky.cockpit.mapper;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.usky.cockpit.model.SysUser;
-
-/**
- * <p>
- *  Mapper 接口
- * </p>
- *
- * @author fc
- * @since 2023-04-30
- */
-public interface SysUserMapper extends BaseMapper<SysUser> {
-
-}

+ 0 - 48
service-cockpit/service-cockpit-biz/src/main/java/com/usky/cockpit/model/GoviewProject.java

@@ -1,48 +0,0 @@
-package com.usky.cockpit.model;
-
-import com.baomidou.mybatisplus.annotation.FieldFill;
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableField;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.baomidou.mybatisplus.annotation.TableName;
-
-import lombok.Data;
-
-import java.io.Serializable;
-
-/**
- * <p>
- * 
- * </p>
- *
- * @author fc
- * @since 2023-04-30
- */
-@TableName("ckpt_project")
-@Data
-public class GoviewProject implements Serializable {
-
-    private static final long serialVersionUID = 1L;
-
-    @TableId(value = "id", type = IdType.AUTO)
-    private Integer id;
-
-    private String projectName;
-
-    private Integer state;
-
-    @TableField(fill = FieldFill.INSERT)
-    private String createTime;
-
-    private String createUserId;
-
-    private Integer isDelete;
-
-    private String indexImage;
-
-    private String remarks;
-
-}
-
-
-

+ 0 - 39
service-cockpit/service-cockpit-biz/src/main/java/com/usky/cockpit/model/GoviewProjectData.java

@@ -1,39 +0,0 @@
-package com.usky.cockpit.model;
-
-import com.baomidou.mybatisplus.annotation.FieldFill;
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableField;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.baomidou.mybatisplus.annotation.TableName;
-import lombok.Data;
-import java.io.Serializable;
-import java.sql.Blob;
-import java.sql.SQLException;
-
-/**
- * <p>
- * 
- * </p>
- *
- * @author fc
- * @since 2023-04-30
- */
-@TableName("ckpt_project_data")
-@Data
-public class GoviewProjectData implements Serializable {
-
-    private static final long serialVersionUID = 1L;
-    @TableId(type = IdType.ASSIGN_ID)
-    private String id;
-
-    private String projectId;
-
-    @TableField(fill = FieldFill.INSERT)
-    private String createTime;
-
-    private String createUserId;
-
-    private String content;
-
-   
-}

+ 0 - 119
service-cockpit/service-cockpit-biz/src/main/java/com/usky/cockpit/model/SysFile.java

@@ -1,119 +0,0 @@
-package com.usky.cockpit.model;
-
-import com.baomidou.mybatisplus.annotation.FieldFill;
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableField;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.baomidou.mybatisplus.annotation.TableName;
-import java.io.Serializable;
-
-/**
- * <p>
- * 
- * </p>
- *
- * @author fc
- * @since 2022-12-22
- */
-@TableName("sys_file")
-public class SysFile implements Serializable {
-
-    private static final long serialVersionUID = 1L;
-
-    @TableId(value = "id", type = IdType.INPUT)
-    private String id;
-
-    private String fileName;
-
-    private Integer fileSize;
-
-    private String fileSuffix;
-    
-    /**
-     * 虚拟路径
-     */
-    private String virtualKey;
-    
-    /**
-     * 相对路径
-     */
-    private String relativePath;
-    
-    /**
-     * 绝对路径
-     */
-    private String absolutePath;
-    
-    
-    
-    
-    @TableField(fill = FieldFill.INSERT)
-    private String createTime;
-
-    public String getId() {
-        return id;
-    }
-
-    public void setId(String id) {
-        this.id = id;
-    }
-    public String getFileName() {
-        return fileName;
-    }
-
-    public void setFileName(String fileName) {
-        this.fileName = fileName;
-    }
-   
-    public Integer getFileSize() {
-        return fileSize;
-    }
-
-    public void setFileSize(Integer fileSize) {
-        this.fileSize = fileSize;
-    }
-    public String getFileSuffix() {
-        return fileSuffix;
-    }
-
-    public void setFileSuffix(String fileSuffix) {
-        this.fileSuffix = fileSuffix;
-    }
-    public String getCreateTime() {
-        return createTime;
-    }
-
-    public void setCreateTime(String createTime) {
-        this.createTime = createTime;
-    }
-    
-
-	public String getVirtualKey() {
-		return virtualKey;
-	}
-
-	public void setVirtualKey(String virtualKey) {
-		this.virtualKey = virtualKey;
-	}
-
-	public String getAbsolutePath() {
-		return absolutePath;
-	}
-
-	public void setAbsolutePath(String absolutePath) {
-		this.absolutePath = absolutePath;
-	}
-
-	public String getRelativePath() {
-		return relativePath;
-	}
-
-	public void setRelativePath(String relativePath) {
-		this.relativePath = relativePath;
-	}
-
-
-
-	
-	
-}

+ 0 - 39
service-cockpit/service-cockpit-biz/src/main/java/com/usky/cockpit/model/SysUser.java

@@ -1,39 +0,0 @@
-package com.usky.cockpit.model;
-
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.baomidou.mybatisplus.annotation.TableName;
-
-import lombok.Data;
-
-import java.io.Serializable;
-
-/**
- * <p>
- * 
- * </p>
- *
- * @author fc
- * @since 2023-04-30
- */
-@TableName("sys_user")
-@Data
-public class SysUser implements Serializable {
-
-    private static final long serialVersionUID = 1L;
-
-    @TableId(type = IdType.ASSIGN_ID)
-    private String id;
-
-    private String username;
-
-    private String password;
-
-    private String nickname;
-
-    private Integer depId;
-
-    private String posId;
-
- 
-}

+ 0 - 119
service-cockpit/service-cockpit-biz/src/main/java/com/usky/cockpit/model/vo/GoviewProjectVo.java

@@ -1,119 +0,0 @@
-package com.usky.cockpit.model.vo;
-
-import java.io.Serializable;
-import java.util.Date;
-import com.fasterxml.jackson.annotation.JsonFormat;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import cn.hutool.core.date.DateUtil;
-import io.swagger.annotations.ApiModelProperty;
-
-public class GoviewProjectVo implements Serializable {
-    private static final long serialVersionUID = 1L;
-
-	
-	@ApiModelProperty(value = "主键")
-	private String id;
-	
-	@ApiModelProperty(value = "项目名称")
-	private String projectName;
-	
-	@ApiModelProperty(value = "项目状态[-1未发布,1发布]")
-	private Integer state;
-	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
-	@ApiModelProperty(value = "创建时间")
-	private Date createTime;
-	
-	@ApiModelProperty(value = "创建人id")
-	private String createUserId;
-	
-	@ApiModelProperty(value = "删除状态[1删除,-1未删除]")
-	private Integer isDelete;
-	
-	@ApiModelProperty(value = "首页图片")
-	private String indexImage;
-	
-	@ApiModelProperty(value = "项目介绍")
-	private String remarks;
-	
-	private String content;
-	
-	
-	@JsonProperty("id")
-	public String getId() {
-		return id;
-	}
-
-	public void setId(String id) {
-		this.id =  id;
-	}
-	@JsonProperty("projectName")
-	public String getProjectName() {
-		return projectName;
-	}
-
-	public void setProjectName(String projectName) {
-		this.projectName =  projectName;
-	}
-	@JsonProperty("state")
-	public Integer getState() {
-		return state;
-	}
-
-	public void setState(Integer state) {
-		this.state =  state;
-	}
-	@JsonProperty("createTime")
-	public Date getCreateTime() {
-		return createTime;
-	}
-
-	public void setCreateTime(Date createTime) {
-		this.createTime =  createTime;
-	}
-	@JsonProperty("createUserId")
-	public String getCreateUserId() {
-		return createUserId;
-	}
-
-	public void setCreateUserId(String createUserId) {
-		this.createUserId =  createUserId;
-	}
-	@JsonProperty("isDelete")
-	public Integer getIsDelete() {
-		return isDelete;
-	}
-
-	public void setIsDelete(Integer isDelete) {
-		this.isDelete =  isDelete;
-	}
-	@JsonProperty("indexImage")
-	public String getIndexImage() {
-		return indexImage;
-	}
-
-	public void setIndexImage(String indexImage) {
-		this.indexImage =  indexImage;
-	}
-	@JsonProperty("remarks")
-	public String getRemarks() {
-		return remarks;
-	}
-
-	public void setRemarks(String remarks) {
-		this.remarks =  remarks;
-	}
-	public String getContent() {
-		return content;
-	}
-
-	public void setContent(String content) {
-		this.content = content;
-	}
-
-	public String dateToStringConvert(Date date) {
-		if(date!=null) {
-			return DateUtil.format(date, "yyyy-MM-dd HH:mm:ss");
-		}
-		return "";
-	}
-}

+ 0 - 70
service-cockpit/service-cockpit-biz/src/main/java/com/usky/cockpit/model/vo/SysFileVo.java

@@ -1,70 +0,0 @@
-package com.usky.cockpit.model.vo;
-
-
-public class SysFileVo {
-	
-    private String id;
-    private String fileName;
-    private Integer fileSize;
-    private String createTime;
-    
-    /**
-     * 相对路径
-     */
-    private String relativePath;
-    
-    /**
-     * 虚拟路径key
-     */
-    private String virtualKey;
-    
-    /**
-     * 请求url
-     */
-    private String fileurl;
-    
-    
-	public String getId() {
-		return id;
-	}
-	public void setId(String id) {
-		this.id = id;
-	}
-	public String getFileName() {
-		return fileName;
-	}
-	public void setFileName(String fileName) {
-		this.fileName = fileName;
-	}
-	public Integer getFileSize() {
-		return fileSize;
-	}
-	public void setFileSize(Integer fileSize) {
-		this.fileSize = fileSize;
-	}
-	public String getCreateTime() {
-		return createTime;
-	}
-	public void setCreateTime(String createTime) {
-		this.createTime = createTime;
-	}
-	public String getRelativePath() {
-		return relativePath;
-	}
-	public void setRelativePath(String relativePath) {
-		this.relativePath = relativePath;
-	}
-	public String getVirtualKey() {
-		return virtualKey;
-	}
-	public void setVirtualKey(String virtualKey) {
-		this.virtualKey = virtualKey;
-	}
-	public String getFileurl() {
-		return fileurl;
-	}
-	public void setFileurl(String fileurl) {
-		this.fileurl = fileurl;
-	}
-	
-}

+ 0 - 19
service-cockpit/service-cockpit-biz/src/main/java/com/usky/cockpit/service/IGoviewProjectDataService.java

@@ -1,19 +0,0 @@
-package com.usky.cockpit.service;
-
-import com.baomidou.mybatisplus.extension.service.IService;
-import com.usky.cockpit.model.GoviewProjectData;
-import org.springframework.stereotype.Service;
-
-/**
- * <p>
- *  服务类
- * </p>
- *
- * @author fc
- * @since 2023-04-30
- */
-public interface IGoviewProjectDataService extends IService<GoviewProjectData> {
-	
-	public GoviewProjectData getProjectid(String projectId);
-
-}

+ 0 - 17
service-cockpit/service-cockpit-biz/src/main/java/com/usky/cockpit/service/IGoviewProjectService.java

@@ -1,17 +0,0 @@
-package com.usky.cockpit.service;
-
-import com.baomidou.mybatisplus.extension.service.IService;
-import com.usky.cockpit.model.GoviewProject;
-import org.springframework.stereotype.Service;
-
-/**
- * <p>
- *  服务类
- * </p>
- *
- * @author fc
- * @since 2023-04-30
- */
-public interface IGoviewProjectService extends IService<GoviewProject> {
-
-}

+ 0 - 20
service-cockpit/service-cockpit-biz/src/main/java/com/usky/cockpit/service/ISysFileService.java

@@ -1,20 +0,0 @@
-package com.usky.cockpit.service;
-
-import com.baomidou.mybatisplus.extension.service.IService;
-import com.usky.cockpit.model.SysFile;
-import org.springframework.stereotype.Service;
-
-
-/**
- * <p>
- *  服务类
- * </p>
- *
- * @author fc
- * @since 2022-12-22
- */
-public interface ISysFileService extends IService<SysFile> {
-
-	
-	public SysFile selectByExamplefileName(String filename);
-}

+ 0 - 17
service-cockpit/service-cockpit-biz/src/main/java/com/usky/cockpit/service/ISysUserService.java

@@ -1,17 +0,0 @@
-package com.usky.cockpit.service;
-
-import com.baomidou.mybatisplus.extension.service.IService;
-import com.usky.cockpit.model.SysUser;
-import org.springframework.stereotype.Service;
-
-/**
- * <p>
- *  服务类
- * </p>
- *
- * @author fc
- * @since 2023-04-30
- */
-public interface ISysUserService extends IService<SysUser> {
-
-}

+ 0 - 31
service-cockpit/service-cockpit-biz/src/main/java/com/usky/cockpit/service/impl/GoviewProjectDataServiceImpl.java

@@ -1,31 +0,0 @@
-package com.usky.cockpit.service.impl;
-
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.usky.cockpit.mapper.GoviewProjectDataMapper;
-import com.usky.cockpit.model.GoviewProjectData;
-import com.usky.cockpit.service.IGoviewProjectDataService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-/**
- * <p>
- *  服务实现类
- * </p>
- *
- * @author fc
- * @since 2023-04-30
- */
-@Service
-public class GoviewProjectDataServiceImpl extends ServiceImpl<GoviewProjectDataMapper, GoviewProjectData> implements IGoviewProjectDataService {
-	@Autowired
-	GoviewProjectDataMapper dataMapper;
-	@Override
-	public GoviewProjectData getProjectid(String projectId) {
-		LambdaQueryWrapper<GoviewProjectData> lambdaQueryWrapper=new LambdaQueryWrapper<GoviewProjectData>();
-		lambdaQueryWrapper.eq(GoviewProjectData::getProjectId, projectId);
-		return dataMapper.selectOne(lambdaQueryWrapper);
-		
-	}
-
-}

+ 0 - 20
service-cockpit/service-cockpit-biz/src/main/java/com/usky/cockpit/service/impl/GoviewProjectServiceImpl.java

@@ -1,20 +0,0 @@
-package com.usky.cockpit.service.impl;
-
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.usky.cockpit.mapper.GoviewProjectMapper;
-import com.usky.cockpit.model.GoviewProject;
-import com.usky.cockpit.service.IGoviewProjectService;
-import org.springframework.stereotype.Service;
-
-/**
- * <p>
- *  服务实现类
- * </p>
- *
- * @author fc
- * @since 2023-04-30
- */
-@Service
-public class GoviewProjectServiceImpl extends ServiceImpl<GoviewProjectMapper, GoviewProject> implements IGoviewProjectService {
-
-}

+ 0 - 30
service-cockpit/service-cockpit-biz/src/main/java/com/usky/cockpit/service/impl/SysFileServiceImpl.java

@@ -1,30 +0,0 @@
-package com.usky.cockpit.service.impl;
-
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.usky.cockpit.mapper.SysFileMapper;
-import com.usky.cockpit.model.SysFile;
-import com.usky.cockpit.service.ISysFileService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-/**
- * <p>
- *  服务实现类
- * </p>
- *
- * @author fc
- * @since 2022-12-22
- */
-@Service
-public class SysFileServiceImpl extends ServiceImpl<SysFileMapper, SysFile> implements ISysFileService {
-	@Autowired
-	private SysFileMapper sysFileMapper;
-	
-	@Override
-	public SysFile selectByExamplefileName(String filename) {
-		SysFile sysFile=sysFileMapper.selectOne(new LambdaQueryWrapper<SysFile>().eq(SysFile::getFileName, filename));
-        return sysFile;
-	}
-
-}

+ 0 - 20
service-cockpit/service-cockpit-biz/src/main/java/com/usky/cockpit/service/impl/SysUserServiceImpl.java

@@ -1,20 +0,0 @@
-package com.usky.cockpit.service.impl;
-
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.usky.cockpit.mapper.SysUserMapper;
-import com.usky.cockpit.model.SysUser;
-import com.usky.cockpit.service.ISysUserService;
-import org.springframework.stereotype.Service;
-
-/**
- * <p>
- *  服务实现类
- * </p>
- *
- * @author fc
- * @since 2023-04-30
- */
-@Service
-public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> implements ISysUserService {
-
-}

+ 0 - 252
service-cockpit/service-cockpit-biz/src/main/java/com/usky/cockpit/util/ConvertUtil.java

@@ -1,252 +0,0 @@
-package com.usky.cockpit.util;
-
-import cn.hutool.core.util.StrUtil;
-import java.math.BigDecimal;
-import java.util.Arrays;
-import java.util.List;
-
-/**
- * 类型转换器
- * 
- * @author fc
- * 
- */
-public class ConvertUtil {
-
-	/**
-	 * 转换为字符串<br>
-	 * 如果给定的值为null,或者转换失败,返回默认值<br>
-	 * 转换失败不会报错
-	 * 
-	 * @param value 被转换的值
-	 * @param defaultValue 转换错误时的默认值
-	 * @return 结果
-	 */
-	public static String toStr(Object value, String defaultValue) {
-		if (null == value) {
-			return defaultValue;
-		}
-		if (value instanceof String) {
-			return (String) value;
-		}
-		return value.toString();
-	}
-
-	/**
-	 * 转换为Integer数组<br>
-	 * @param split 被转换的值
-	 * @return 结果
-	 */
-	public static Integer[] toIntArray(String str) {
-		return toIntArray(",", str);
-	}
-
-	/**
-	 * 转换为Integer数组<br>
-	 * @param split 分隔符
-	 * @param split 被转换的值
-	 * @return 结果
-	 */
-	public static Integer[] toIntArray(String split, String str) {
-		if (StrUtil.isEmpty(str)) {
-			return new Integer[] {};
-		}
-		String[] strings = str.split(split);
-		final Integer[] ints = new Integer[strings.length];
-		for (int i = 0; i < strings.length; i++) {
-			final Integer v = toInt(strings[i], 0);
-			ints[i] = v;
-		}
-		return ints;
-	}
-
-	/**
-	 * 转换为int<br>
-	 * 如果给定的值为空,或者转换失败,返回默认值<br>
-	 * 转换失败不会报错
-	 * @param value 被转换的值
-	 * @param defaultValue 转换错误时的默认值
-	 * @return 结果
-	 */
-	public static Integer toInt(Object value, Integer defaultValue) {
-		if (value == null) {
-			return defaultValue;
-		}
-		if (value instanceof Integer) {
-			return (Integer) value;
-		}
-		if (value instanceof Number) {
-			return ((Number) value).intValue();
-		}
-		final String valueStr = toStr(value, null);
-		if (StrUtil.isEmpty(valueStr)) {
-			return defaultValue;
-		}
-		try {
-			return Integer.parseInt(valueStr.trim());
-		} catch (Exception e) {
-			return defaultValue;
-		}
-	}
-
-	/**
-	 * 转换为List<String>数组<br>
-	 * @param split 被转换的值
-	 * @return 结果
-	 */
-	public static List<String> toListStrArray(String str) {
-		String[] stringArray = toStrArray(str);
-		List<String> stringB = Arrays.asList(stringArray);
-		return stringB;
-	}
-
-
-
-	/**
-	 * 转换为List<Long>数组<br>
-	 * @param split 被转换的值
-	 * @return 结果
-	 */
-	public static List<Long> toListLongArray(String str) {
-		Long[] stringArray = toLongArray(str);
-		List<Long> stringB = Arrays.asList(stringArray);
-		return stringB;
-	}
-
-
-	/**
-	 * 转换为String数组<br> 
-	 * @param split 被转换的值
-	 * @return 结果
-	 */
-	public static String[] toStrArray(String str) {
-		return toStrArray(",", str);
-	}
-
-	/**
-	 * 转换为String数组<br>
-	 * 
-	 * @param split 分隔符
-	 * @param split 被转换的值
-	 * @return 结果
-	 */
-	public static String[] toStrArray(String split, String str) {
-		return str.split(split);
-	}
-	/**
-     * 转换为Long数组<br>
-     * 
-     * @param split 被转换的值
-     * @return 结果
-     */
-    public static Long[] toLongArray(String str)
-    {
-        return toLongArray(",", str);
-    }
-    /**
-     * 转换为Long数组<br>
-     * 
-     * @param isIgnoreConvertError 是否忽略转换错误,忽略则给值null
-     * @param values 被转换的值
-     * @return 结果
-     */
-    public static Long[] toLongArray(String split, String str)
-    {
-        if (StrUtil.isEmpty(str))
-        {
-            return new Long[] {};
-        }
-        String[] arr = str.split(split);
-        final Long[] longs = new Long[arr.length];
-        for (int i = 0; i < arr.length; i++)
-        {
-            final Long v = toLong(arr[i], null);
-            longs[i] = v;
-        }
-        return longs;
-    }
-    /**
-     * 转换为long<br>
-     * 如果给定的值为空,或者转换失败,返回默认值<br>
-     * 转换失败不会报错
-     * 
-     * @param value 被转换的值
-     * @param defaultValue 转换错误时的默认值
-     * @return 结果
-     */
-    public static Long toLong(Object value, Long defaultValue)
-    {
-        if (value == null)
-        {
-            return defaultValue;
-        }
-        if (value instanceof Long)
-        {
-            return (Long) value;
-        }
-        if (value instanceof Number)
-        {
-            return ((Number) value).longValue();
-        }
-        final String valueStr = toStr(value, null);
-        if (StrUtil.isEmpty(valueStr))
-        {
-            return defaultValue;
-        }
-        try
-        {
-            // 支持科学计数法
-            return new BigDecimal(valueStr.trim()).longValue();
-        }
-        catch (Exception e)
-        {
-            return defaultValue;
-        }
-    }
-    
-    /**
-     * 转换为BigDecimal<br>
-     * 如果给定的值为空,或者转换失败,返回默认值<br>
-     * 转换失败不会报错
-     * 
-     * @param value 被转换的值
-     * @param defaultValue 转换错误时的默认值
-     * @return 结果
-     */
-    public static BigDecimal toBigDecimal(Object value, BigDecimal defaultValue)
-    {
-        if (value == null)
-        {
-            return defaultValue;
-        }
-        if (value instanceof BigDecimal)
-        {
-            return (BigDecimal) value;
-        }
-        if (value instanceof Long)
-        {
-            return new BigDecimal((Long) value);
-        }
-        if (value instanceof Double)
-        {
-            return new BigDecimal((Double) value);
-        }
-        if (value instanceof Integer)
-        {
-            return new BigDecimal((Integer) value);
-        }
-        final String valueStr = toStr(value, null);
-        if (StrUtil.isEmpty(valueStr))
-        {
-            return defaultValue;
-        }
-        try
-        {
-            return new BigDecimal(valueStr);
-        }
-        catch (Exception e)
-        {
-            return defaultValue;
-        }
-    }
-}

+ 0 - 73
service-cockpit/service-cockpit-biz/src/main/java/com/usky/cockpit/util/SaTokenUtil.java

@@ -1,73 +0,0 @@
-//package com.usky.cockpit.util;
-//
-//
-//import com.usky.cockpit.model.SysUser;
-//import org.springframework.beans.BeanUtils;
-//import cn.dev33.satoken.stp.StpUtil;
-//
-///**
-// * 封装 Sa-Token 常用操作
-// * @author kong
-// *
-// */
-//public class SaTokenUtil {
-//
-//	/**
-//     * 获取登录用户model
-//     */
-//    public static SysUser getUser() {
-//    	Object object=StpUtil.getSession().get("user");
-//    	if(object!=null){
-//    		SysUser tsysUser=new SysUser();
-//    		BeanUtils.copyProperties(tsysUser, object);
-//    		return tsysUser;
-//    	}
-//    	return null;
-//    }
-//
-//    /**
-//     * set用户
-//     */
-//    public static void setUser(SysUser user) {
-//    	StpUtil.getSession().set("user", user);
-//    }
-//
-//  /**
-//   * 获取登录用户id
-//   */
-//	public static String getUserId() {
-//		return StpUtil.getLoginIdAsString();
-//	}
-//
-//    /**
-//     * 获取登录用户name
-//     */
-//    public static String getLoginName() {
-//    	SysUser tsysUser = getUser();
-//        if (tsysUser == null){
-//            throw new RuntimeException("用户不存在!");
-//        }
-//        return tsysUser.getUsername();
-//    }
-//
-//    /**
-//     * 获取登录用户ip
-//     * @return
-//     * @author fuce
-//     * @Date 2019年11月21日 上午9:58:26
-//     */
-//    public static String getIp() {
-//
-//        return StpUtil.getTokenSession().getString("login_ip");
-//    }
-//    /**
-//     * 判断是否登录
-//     * @return
-//     * @author fuce
-//     * @Date 2019年11月21日 上午9:58:26
-//     */
-//    public static boolean isLogin() {
-//        return StpUtil.isLogin();
-//    }
-//
-//}

+ 0 - 155
service-cockpit/service-cockpit-biz/src/main/java/com/usky/cockpit/util/SnowflakeIdWorker.java

@@ -1,155 +0,0 @@
-package com.usky.cockpit.util;
-
-/**
- * Twitter_Snowflake<br>
- * SnowFlake的结构如下(每部分用-分开):<br>
- * 0 - 0000000000 0000000000 0000000000 0000000000 0 - 00000 - 00000 - 000000000000 <br>
- * 1位标识,由于long基本类型在Java中是带符号的,最高位是符号位,正数是0,负数是1,所以id一般是正数,最高位是0<br>
- * 41位时间截(毫秒级),注意,41位时间截不是存储当前时间的时间截,而是存储时间截的差值(当前时间截 - 开始时间截)
- * 得到的值),这里的的开始时间截,一般是我们的id生成器开始使用的时间,由我们程序来指定的(如下下面程序IdWorker类的startTime属性)。41位的时间截,可以使用69年,年T = (1L << 41) / (1000L * 60 * 60 * 24 * 365) = 69<br>
- * 10位的数据机器位,可以部署在1024个节点,包括5位datacenterId和5位workerId<br>
- * 12位序列,毫秒内的计数,12位的计数顺序号支持每个节点每毫秒(同一机器,同一时间截)产生4096个ID序号<br>
- * 加起来刚好64位,为一个Long型。<br>
- * SnowFlake的优点是,整体上按照时间自增排序,并且整个分布式系统内不会产生ID碰撞(由数据中心ID和机器ID作区分),并且效率较高,经测试,SnowFlake每秒能够产生26万ID左右。
- */
-public class SnowflakeIdWorker {
- 
-    // ==============================Fields===========================================
-    /** 开始时间截 (2015-01-01) */
-    private final long twepoch = 1489111610226L;
- 
-    /** 机器id所占的位数 */
-    private final long workerIdBits = 5L;
- 
-    /** 数据标识id所占的位数 */
-    private final long dataCenterIdBits = 5L;
- 
-    /** 支持的最大机器id,结果是31 (这个移位算法可以很快的计算出几位二进制数所能表示的最大十进制数) */
-    private final long maxWorkerId = -1L ^ (-1L << workerIdBits);
- 
-    /** 支持的最大数据标识id,结果是31 */
-    private final long maxDataCenterId = -1L ^ (-1L << dataCenterIdBits);
- 
-    /** 序列在id中占的位数 */
-    private final long sequenceBits = 12L;
- 
-    /** 机器ID向左移12位 */
-    private final long workerIdShift = sequenceBits;
- 
-    /** 数据标识id向左移17位(12+5) */
-    private final long dataCenterIdShift = sequenceBits + workerIdBits;
- 
-    /** 时间截向左移22位(5+5+12) */
-    private final long timestampLeftShift = sequenceBits + workerIdBits + dataCenterIdBits;
- 
-    /** 生成序列的掩码,这里为4095 (0b111111111111=0xfff=4095) */
-    private final long sequenceMask = -1L ^ (-1L << sequenceBits);
- 
-    /** 工作机器ID(0~31) */
-    private long workerId;
- 
-    /** 数据中心ID(0~31) */
-    private long dataCenterId;
- 
-    /** 毫秒内序列(0~4095) */
-    private long sequence = 0L;
- 
-    /** 上次生成ID的时间截 */
-    private long lastTimestamp = -1L;
- 
-    
-    static SnowflakeIdWorker idWorker = new SnowflakeIdWorker(1, 1);
-    //==============================Constructors=====================================
-    /**
-     * 构造函数
-     * @param workerId 工作ID (0~31)
-     * @param dataCenterId 数据中心ID (0~31)
-     */
-    public SnowflakeIdWorker(long workerId, long dataCenterId) {
-        if (workerId > maxWorkerId || workerId < 0) {
-            throw new IllegalArgumentException(String.format("workerId can't be greater than %d or less than 0", maxWorkerId));
-        }
-        if (dataCenterId > maxDataCenterId || dataCenterId < 0) {
-            throw new IllegalArgumentException(String.format("dataCenterId can't be greater than %d or less than 0", maxDataCenterId));
-        }
-        this.workerId = workerId;
-        this.dataCenterId = dataCenterId;
-    }
- 
-    // ==============================Methods==========================================
-    /**
-     * 获得下一个ID (该方法是线程安全的)
-     * @return SnowflakeId
-     */
-    public synchronized long nextId() {
-        long timestamp = timeGen();
- 
-        //如果当前时间小于上一次ID生成的时间戳,说明系统时钟回退过这个时候应当抛出异常
-        if (timestamp < lastTimestamp) {
-            throw new RuntimeException(
-                    String.format("Clock moved backwards.  Refusing to generate id for %d milliseconds", lastTimestamp - timestamp));
-        }
- 
-        //如果是同一时间生成的,则进行毫秒内序列
-        if (lastTimestamp == timestamp) {
-            sequence = (sequence + 1) & sequenceMask;
-            //毫秒内序列溢出
-            if (sequence == 0) {
-                //阻塞到下一个毫秒,获得新的时间戳
-                timestamp = tilNextMillis(lastTimestamp);
-            }
-        }
-        //时间戳改变,毫秒内序列重置
-        else {
-            sequence = 0L;
-        }
- 
-        //上次生成ID的时间截
-        lastTimestamp = timestamp;
- 
-        //移位并通过或运算拼到一起组成64位的ID
-        return ((timestamp - twepoch) << timestampLeftShift) //
-                | (dataCenterId << dataCenterIdShift) //
-                | (workerId << workerIdShift) //
-                | sequence;
-    }
- 
-    /**
-     * 阻塞到下一个毫秒,直到获得新的时间戳
-     * @param lastTimestamp 上次生成ID的时间截
-     * @return 当前时间戳
-     */
-    protected long tilNextMillis(long lastTimestamp) {
-        long timestamp = timeGen();
-        while (timestamp <= lastTimestamp) {
-            timestamp = timeGen();
-        }
-        return timestamp;
-    }
- 
-    /**
-     * 返回以毫秒为单位的当前时间
-     * @return 当前时间(毫秒)
-     */
-    protected long timeGen() {
-        return System.currentTimeMillis();
-    }
- 
-    //==============================Test=============================================
-    /** 测试 */
-    public static void main(String[] args) {
-        System.out.println(System.currentTimeMillis());
-        SnowflakeIdWorker idWorker = new SnowflakeIdWorker(1, 1);
-        long startTime = System.nanoTime();
-        for (int i = 0; i < 500; i++) {
-            long id = idWorker.nextId();
-            System.out.println(id);
-        }
-        System.out.println((System.nanoTime()-startTime)/1000000+"ms");
-    }
-    
-    public static String getUUID() {
-    	long id = idWorker.nextId();
-    	return String.valueOf(id);
-    }
-}

+ 0 - 5
service-cockpit/service-cockpit-biz/src/main/resources/mapper/GoviewProjectDataMapper.xml

@@ -1,5 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="cn.com.v2.mapper.GoviewProjectDataMapper">
-
-</mapper>

+ 0 - 5
service-cockpit/service-cockpit-biz/src/main/resources/mapper/GoviewProjectMapper.xml

@@ -1,5 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="cn.com.v2.mapper.GoviewProjectMapper">
-
-</mapper>

+ 0 - 5
service-cockpit/service-cockpit-biz/src/main/resources/mapper/SysFileMapper.xml

@@ -1,5 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="cn.com.v2oss.mapper.SysFileMapper">
-
-</mapper>

+ 0 - 5
service-cockpit/service-cockpit-biz/src/main/resources/mapper/SysUserMapper.xml

@@ -1,5 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="cn.com.v2.mapper.SysUserMapper">
-
-</mapper>

+ 4 - 2
service-eg/service-eg-biz/src/main/java/com/usky/eg/controller/web/EgDeviceController.java

@@ -92,8 +92,10 @@ public class EgDeviceController {
                                                  @RequestParam("commandValue") String commandValue,
                                                  @RequestParam(value = "domain",required = false) String domain,
                                                  @RequestParam(value = "userId",required = false) Long userId,
-                                                 @RequestParam(value = "userName",required = false) String userName){
-        return ApiResult.success(egDeviceService.control(productCode,deviceUuid,commandCode,commandValue,domain,userId,userName));
+                                                 @RequestParam(value = "userName",required = false) String userName,
+                                                 @RequestParam(value = "categoryType",required = false , defaultValue = "1") Integer categoryType,
+                                                 @RequestParam(value = "gatewayUuid",required = false) String gatewayUuid){
+        return ApiResult.success(egDeviceService.control(productCode,deviceUuid,commandCode,commandValue,domain,userId,userName,categoryType,gatewayUuid));
     }
 
 }

+ 12 - 0
service-eg/service-eg-biz/src/main/java/com/usky/eg/domain/EgDevice.java

@@ -123,6 +123,18 @@ public class EgDevice implements Serializable {
      */
     private String openMode;
 
+    /**
+     * 密码
+     */
+    private String password;
+
+    /**
+     * 工作状态
+     */
+    private String workStatus;
+
+    /**
+
     /**
      * 用户人脸信息记录
      */

+ 3 - 1
service-eg/service-eg-biz/src/main/java/com/usky/eg/service/EgDeviceService.java

@@ -31,5 +31,7 @@ public interface EgDeviceService extends CrudService<EgDevice> {
 
     boolean checkNameUnique(EgDevice egDevice);
 
-    Map<String,Object> control(String productCode, String deviceUuid, String commandCode, String commandValue, String domain, Long userId, String userName);
+    boolean checkDeviceNameUnique(EgDevice egDevice);
+
+    Map<String,Object> control(String productCode, String deviceUuid, String commandCode, String commandValue, String domain, Long userId, String userName, Integer categoryType, String gatewayUuid);
 }

+ 68 - 29
service-eg/service-eg-biz/src/main/java/com/usky/eg/service/impl/EgDeviceServiceImpl.java

@@ -68,13 +68,15 @@ public class EgDeviceServiceImpl extends AbstractCrudService<EgDeviceMapper, EgD
                 .like(StringUtils.isNotBlank(requestVO.getInstallAddress()),EgDevice::getInstallAddress,requestVO.getInstallAddress())
                 .eq(null != requestVO.getServiceStatus(),EgDevice::getServiceStatus,requestVO.getServiceStatus())
                 .eq(null != requestVO.getId(),EgDevice::getId,requestVO.getId())
+                .eq(null != requestVO.getDeviceUuid(),EgDevice::getDeviceUuid, requestVO.getDeviceUuid())
                 .eq(EgDevice::getTenantId,tenantId)
                 .orderByDesc(EgDevice::getId);
         page = this.page(page,queryWrapper);
-        if(page.getRecords().size() > 0){
+        if(!page.getRecords().isEmpty()){
 
             LambdaQueryWrapper<MeetingFace> meetingFaceQuery = Wrappers.lambdaQuery();
-            meetingFaceQuery.eq(MeetingFace::getTenantId,tenantId);
+            meetingFaceQuery.select(MeetingFace::getFid,MeetingFace::getCreateTime,MeetingFace::getVefNum,MeetingFace::getFaceName,MeetingFace::getRemark,MeetingFace::getFaceStatus,MeetingFace::getCardNum,MeetingFace::getBindDevice,MeetingFace::getDeptId,MeetingFace::getTenantId,MeetingFace::getUserId)
+                    .eq(MeetingFace::getTenantId,tenantId);
             List<MeetingFace> meetingAllFaceList = meetingFaceMapper.selectList(meetingFaceQuery);
 
             for (int i = 0; i < page.getRecords().size(); i++) {
@@ -105,24 +107,27 @@ public class EgDeviceServiceImpl extends AbstractCrudService<EgDeviceMapper, EgD
         long userId = SecurityUtils.getUserId();
         //人员设备权限校验,校验通过,可以下发命令控制设备
         Integer fid = baseMapper.getMeetingFaceData(userId);
-        if(fid == null){
-            throw new BusinessException("人脸卡号信息未注册");
-        }
+//        if(fid == null){
+//            throw new BusinessException("人脸卡号信息未注册");
+//        }
         Integer[] deviceFid = baseMapper.getMeetingFaceDeviceList(fid);
-        if(deviceFid.length == 0){
-            throw new BusinessException("人员未绑定设备,请检查");
-        }
+//        if(deviceFid.length == 0){
+//            throw new BusinessException("人员未绑定设备,请检查");
+//        }
 
         IPage<EgDevice> page = new Page<>(requestVO.getCurrent(),requestVO.getSize());
-        LambdaQueryWrapper<EgDevice> queryWrapper = Wrappers.lambdaQuery();
-        queryWrapper.like(StringUtils.isNotBlank(requestVO.getDeviceName()),EgDevice::getDeviceName,requestVO.getDeviceName())
-                .like(StringUtils.isNotBlank(requestVO.getInstallAddress()),EgDevice::getInstallAddress,requestVO.getInstallAddress())
-                .eq(null != requestVO.getServiceStatus(),EgDevice::getServiceStatus,requestVO.getServiceStatus())
-                .eq(null != requestVO.getId(),EgDevice::getId,requestVO.getId())
-                .in(EgDevice::getId,deviceFid)
-                .eq(EgDevice::getTenantId,SecurityUtils.getTenantId())
-                .orderByDesc(EgDevice::getId);
-        page = this.page(page,queryWrapper);
+        if(deviceFid.length > 0){
+            LambdaQueryWrapper<EgDevice> queryWrapper = Wrappers.lambdaQuery();
+            queryWrapper.like(StringUtils.isNotBlank(requestVO.getDeviceName()),EgDevice::getDeviceName,requestVO.getDeviceName())
+                    .like(StringUtils.isNotBlank(requestVO.getInstallAddress()),EgDevice::getInstallAddress,requestVO.getInstallAddress())
+                    .eq(null != requestVO.getServiceStatus(),EgDevice::getServiceStatus,requestVO.getServiceStatus())
+                    .eq(null != requestVO.getId(),EgDevice::getId,requestVO.getId())
+                    .in(EgDevice::getId,deviceFid)
+                    .eq(EgDevice::getTenantId,SecurityUtils.getTenantId())
+                    .orderByDesc(EgDevice::getId);
+            page = this.page(page,queryWrapper);
+        }
+
 
         return new CommonPage<>(page.getRecords(),page.getTotal(),requestVO.getSize(),requestVO.getCurrent());
     }
@@ -132,6 +137,9 @@ public class EgDeviceServiceImpl extends AbstractCrudService<EgDeviceMapper, EgD
         if(checkNameUnique(egDevice)){
             throw new BusinessException("新增门禁门号设备'"+egDevice.getDeviceId()+","+egDevice.getEgNumber()+"'失败,设备已存在");
         }
+        if(checkDeviceNameUnique(egDevice)){
+            throw new BusinessException("新增门禁设备'"+egDevice.getDeviceName()+"'失败,设备已存在");
+        }
 
         egDevice.setDeviceUuid(UUIDUtils.uuid());
         egDevice.setCreateBy(SecurityUtils.getUsername());
@@ -154,33 +162,49 @@ public class EgDeviceServiceImpl extends AbstractCrudService<EgDeviceMapper, EgD
     }
 
     @Override
-    public void update(EgDevice egDevice){
-        if(checkNameUnique(egDevice)){
-            throw new BusinessException("修改门禁门号设备'"+egDevice.getDeviceId()+","+egDevice.getEgNumber()+"'失败,设备已存在");
-        }
-
-        egDevice.setUpdateBy(SecurityUtils.getUsername());
-        egDevice.setUpdateTime(LocalDateTime.now());
-
-        this.updateById(egDevice);
+    public void update(EgDevice egDevice) {
 
         String[] fids = new String[0];
-        egDeviceMapper.deleteMeetingFaceDevice(egDevice.getId());
         if(Objects.nonNull(egDevice.getBindFace()) || StringUtils.isNotBlank(egDevice.getBindFace())){
             fids = egDevice.getBindFace().split(",");
+
+            egDeviceMapper.deleteMeetingFaceDevice(egDevice.getId());
+        }else{
+            EgDevice one = this.getById(egDevice.getId());
+            egDevice.setBindFace(one.getBindFace());
         }
         if(fids.length > 0){
             for (int i = 0; i < fids.length; i++) {
                 egDeviceMapper.insertMeetingFaceDevice(Integer.parseInt(fids[i]),egDevice.getId());
             }
         }
+
+
+        if(checkNameUnique(egDevice)){
+            throw new BusinessException("修改门禁门号设备'"+egDevice.getDeviceId()+","+egDevice.getEgNumber()+"'失败,设备已存在");
+        }
+        if(checkDeviceNameUnique(egDevice)){
+            throw new BusinessException("新增门禁设备'"+egDevice.getDeviceName()+"'失败,设备已存在");
+        }
+
+        egDevice.setUpdateBy(SecurityUtils.getUsername());
+        egDevice.setUpdateTime(LocalDateTime.now());
+
+        this.updateById(egDevice);
     }
 
     @Override
     public void attachUpdate(EgDevice egDevice){
+
+        EgDevice one = this.getById(egDevice.getId());
+        egDevice.setBindFace(one.getBindFace());
+
         if(checkNameUnique(egDevice)){
             throw new BusinessException("更新门禁设备附加功能'"+egDevice.getDeviceId()+"'失败,设备已存在");
         }
+        if(checkDeviceNameUnique(egDevice)){
+            throw new BusinessException("新增门禁设备'"+egDevice.getDeviceName()+"'失败,设备已存在");
+        }
 
         egDevice.setUpdateBy(SecurityUtils.getUsername());
         egDevice.setUpdateTime(LocalDateTime.now());
@@ -217,7 +241,17 @@ public class EgDeviceServiceImpl extends AbstractCrudService<EgDeviceMapper, EgD
     }
 
     @Override
-    public Map<String,Object> control(String productCode, String deviceUuid, String commandCode, String commandValue, String domain, Long userId, String userName){
+    public boolean checkDeviceNameUnique(EgDevice egDevice){
+        Integer id = null == egDevice.getId() ? -1 : egDevice.getId();
+        LambdaQueryWrapper<EgDevice> queryWrapper = Wrappers.lambdaQuery();
+        queryWrapper.eq(EgDevice::getDeviceName,egDevice.getDeviceName())
+                .eq(EgDevice::getTenantId, SecurityUtils.getTenantId());
+        EgDevice one = this.getOne(queryWrapper);
+        return null != one && !Objects.equals(one.getId(),id);
+    }
+
+    @Override
+    public Map<String,Object> control(String productCode, String deviceUuid, String commandCode, String commandValue, String domain, Long userId, String userName, Integer categoryType, String gatewayUuid){
         Integer tenantId;
         long commandUserId;
         String commandUserName;
@@ -257,11 +291,16 @@ public class EgDeviceServiceImpl extends AbstractCrudService<EgDeviceMapper, EgD
 
         Map<String,Object> map = new HashMap<>();
         map.put("method","control");
+        map.put("deviceUuid", deviceUuid);
         Map<String,Object> map1 = new HashMap<>();
         map1.put("commandCode",commandCode);
         map1.put("commandValue",commandValue);
         map.put("params",map1);
 
-        return remoteTransferService.deviceControl(productCode,deviceUuid, JSON.toJSONString(map),tenantId,commandUserId,commandUserName);
+        if(categoryType == 3){
+            return remoteTransferService.deviceControl(productCode, gatewayUuid, JSON.toJSONString(map), tenantId, commandUserId, commandUserName);
+        }else{
+            return remoteTransferService.deviceControl(productCode, deviceUuid, JSON.toJSONString(map), tenantId, commandUserId, commandUserName);
+        }
     }
 }

+ 7 - 0
service-eg/service-eg-biz/src/main/java/com/usky/eg/service/impl/EgRecordServiceImpl.java

@@ -6,6 +6,8 @@ import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
 import com.baomidou.mybatisplus.core.toolkit.StringUtils;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.ruoyi.common.datascope.annotation.DataScope;
+import com.ruoyi.common.datascope.context.DataScopeContextHolder;
 import com.usky.common.core.bean.CommonPage;
 import com.usky.common.core.exception.BusinessException;
 import com.usky.common.security.utils.SecurityUtils;
@@ -61,11 +63,13 @@ public class EgRecordServiceImpl extends AbstractCrudService<EgRecordMapper, EgR
 
         egRecord.setCreateTime(LocalDateTime.now());
         egRecord.setTenantId(tenantId);
+        egRecord.setDeptId(SecurityUtils.getLoginUser().getSysUser().getDeptId().intValue());
 
         this.save(egRecord);
     }
 
     @Override
+    @DataScope
     public CommonPage<EgRecord> page(EgRecordRequestVO requestVO){
         IPage<EgRecord> page = new Page<>(requestVO.getCurrent(),requestVO.getSize());
         String deviceName = requestVO.getDeviceName();
@@ -86,11 +90,14 @@ public class EgRecordServiceImpl extends AbstractCrudService<EgRecordMapper, EgR
             egDeviceList = egDeviceMapper.selectList(egDeviceQuery);
         }
 
+        String dataScopeSql = DataScopeContextHolder.getDataScopeSql();
+
         LambdaQueryWrapper<EgRecord> queryWrapper = Wrappers.lambdaQuery();
         queryWrapper.like(StringUtils.isNotBlank(requestVO.getUserName()),EgRecord::getUserName,requestVO.getUserName())
                 .eq(null != requestVO.getPassType(),EgRecord::getPassType,requestVO.getPassType())
                 .in(CollectionUtils.isNotEmpty(egDeviceIdList),EgRecord::getEgDeviceId,egDeviceIdList)
                 .between(StringUtils.isNotBlank(requestVO.getStartTime())&&StringUtils.isNotBlank(requestVO.getEndTime()),EgRecord::getPassTime,requestVO.getStartTime(),requestVO.getEndTime())
+                .apply(Objects.nonNull(dataScopeSql), dataScopeSql)
                 .orderByDesc(EgRecord::getId);
         page = this.page(page,queryWrapper);
         if((page.getRecords().size() > 0) && (egDeviceList.size() > 0)){

+ 5 - 0
service-eg/service-eg-biz/src/main/java/com/usky/eg/service/vo/EgDeviceRequestVO.java

@@ -40,4 +40,9 @@ public class EgDeviceRequestVO implements Serializable {
      * 域名
      */
     private String domain;
+
+    /**
+     * 设备uuid
+     */
+    private String deviceUuid;
 }

+ 1 - 1
service-eg/service-eg-biz/src/main/resources/logback.xml

@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <configuration scan="true" scanPeriod="60 seconds" debug="false">
     <!-- 日志存放路径 -->
-	<property name="log.path" value="/var/log/uskycloud/data-eg" />
+	<property name="log.path" value="/var/log/uskycloud/service-eg"/>
    <!-- 日志输出格式 -->
 	<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" />
 

+ 2 - 0
service-eg/service-eg-biz/src/main/resources/mapper/eg/EgDeviceMapper.xml

@@ -23,6 +23,8 @@
         <result column="img_path" property="imgPath" />
         <result column="remark" property="remark" />
         <result column="open_mode" property="openMode" />
+        <result column="password" property="password" />
+        <result column="work_status" property="workStatus" />
     </resultMap>
     <insert id="insertMeetingFaceDevice" parameterType="integer">
         insert into meeting_face_device (face_id,device_id) value (#{fid}, #{egDeviceId});

+ 4 - 0
service-fire/service-fire-biz/pom.xml

@@ -121,6 +121,10 @@
             <version>0.0.1</version>
             <scope>compile</scope>
         </dependency>
+        <dependency>
+            <groupId>com.usky</groupId>
+            <artifactId>ruoyi-common-swagger</artifactId>
+        </dependency>
 
     </dependencies>
 

+ 2 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/RuoYiSystemApplication.java

@@ -1,6 +1,7 @@
 package com.usky.fire;
 
 
+import com.ruoyi.common.swagger.annotation.EnableCustomSwagger2;
 import org.mybatis.spring.annotation.MapperScan;
 import org.springframework.amqp.rabbit.annotation.EnableRabbit;
 import org.springframework.boot.SpringApplication;
@@ -15,6 +16,7 @@ import org.springframework.context.annotation.ComponentScan;
  */
 
 //@EnableRabbit
+@EnableCustomSwagger2
 @EnableFeignClients(basePackages = "com.usky")
 @MapperScan(value = "com.usky.fire.mapper")
 @ComponentScan("com.usky")

+ 14 - 5
service-fire/service-fire-biz/src/main/java/com/usky/fire/controller/web/DemReportInfoController.java

@@ -8,10 +8,7 @@ import com.usky.common.log.enums.BusinessType;
 import com.usky.fire.domain.BaseCompany;
 import com.usky.fire.domain.DemReportInfo;
 import com.usky.fire.service.DemReportInfoService;
-import com.usky.fire.service.vo.CompanyAddVO;
-import com.usky.fire.service.vo.CompanyDataVo;
-import com.usky.fire.service.vo.DemReportInfoIdVo;
-import com.usky.fire.service.vo.DemReportInfoVo;
+import com.usky.fire.service.vo.*;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
@@ -45,7 +42,7 @@ public class DemReportInfoController {
                                                                @RequestParam(value = "sourceType", required = false) String sourceType,
                                                                @RequestParam(value = "pageNum", required = false, defaultValue = "1") Integer pageNum,
                                                                @RequestParam(value = "pageSize", required = false, defaultValue = "10") Integer pageSize) {
-        return ApiResult.success(demReportInfoService.reportInfoList(companyId,sourceType,pageNum, pageSize));
+        return ApiResult.success(demReportInfoService.reportInfoList(companyId, sourceType, pageNum, pageSize));
     }
 
     /**
@@ -82,5 +79,17 @@ public class DemReportInfoController {
     public ApiResult<List<DemReportInfo>> reportById(@RequestParam(value = "id", required = false) Integer id) {
         return ApiResult.success(demReportInfoService.reportById(id));
     }
+
+    /**
+     * 报告读取状态更新
+     *
+     * @return
+     */
+    @Log(title = "报告读取状态更新", businessType = BusinessType.UPDATE)
+    @PutMapping("/updateReadStatus")
+    public ApiResult<Void> updateReadStatus(@RequestBody DemReportInfoVo vo) {
+        demReportInfoService.updateReadStatus(vo.getId());
+        return ApiResult.success();
+    }
 }
 

+ 10 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/domain/DemReportInfo.java

@@ -77,5 +77,15 @@ public class DemReportInfo implements Serializable {
      */
     private LocalDateTime sendTime;
 
+    /**
+     * 是否已读
+     */
+    private Integer isRead;
+
+    /**
+     * 读取时间
+     */
+    private LocalDateTime readTime;
+
 
 }

+ 21 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/domain/ReportResult.java

@@ -1,10 +1,15 @@
 package com.usky.fire.domain;
 
 import com.baomidou.mybatisplus.annotation.IdType;
+
 import java.time.LocalDate;
+
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
+
 import java.time.LocalDateTime;
 import java.io.Serializable;
+
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 
@@ -78,5 +83,21 @@ public class ReportResult implements Serializable {
      */
     private Integer tenantId;
 
+    /**
+     * 报告状态
+     */
+    @TableField(exist = false)
+    private Integer reportStatus;
 
+    /**
+     * 阅读时间
+     */
+    @TableField(exist = false)
+    private LocalDateTime readTime;
+
+    /**
+     * 是否已读
+     */
+    @TableField(exist = false)
+    private Integer isRead;
 }

+ 7 - 1
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/DemReportInfoService.java

@@ -26,7 +26,7 @@ public interface DemReportInfoService extends CrudService<DemReportInfo> {
      * @param pageSize     每页条数
      * @return
      */
-    CommonPage<DemReportInfo> reportInfoList(String companyId, String sourceType,Integer pageNum, Integer pageSize);
+    CommonPage<DemReportInfo> reportInfoList(String companyId, String sourceType, Integer pageNum, Integer pageSize);
 
     /**
      * 生成报告单位信息-列表查询
@@ -51,4 +51,10 @@ public interface DemReportInfoService extends CrudService<DemReportInfo> {
      * @return
      */
     List<DemReportInfo> reportById(Integer id);
+
+    /**
+     * 批量更新已读状态
+     * @param id 主键ID
+     */
+    void updateReadStatus(Integer id);
 }

+ 92 - 9
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/impl/DemReportInfoServiceImpl.java

@@ -1,21 +1,26 @@
 package com.usky.fire.service.impl;
 
 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.CollectionUtils;
 import com.baomidou.mybatisplus.core.toolkit.StringUtils;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.usky.common.core.bean.CommonPage;
+import com.usky.common.core.exception.BusinessException;
+import com.usky.common.security.utils.SecurityUtils;
 import com.usky.fire.domain.BaseCompany;
-import com.usky.fire.domain.BaseCompanyAttach1;
 import com.usky.fire.domain.DemReportInfo;
+import com.usky.fire.mapper.BaseCompanyMapper;
 import com.usky.fire.mapper.DemReportInfoMapper;
 import com.usky.fire.service.DemReportInfoService;
 import com.usky.common.mybatis.core.AbstractCrudService;
 import com.usky.fire.service.vo.CompanyDataVo;
 import com.usky.fire.service.vo.DemReportInfoIdVo;
 import com.usky.fire.service.vo.DemReportInfoVo;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
@@ -30,21 +35,53 @@ import java.util.*;
  * @author han
  * @since 2023-03-02
  */
+@Slf4j
 @Service
 public class DemReportInfoServiceImpl extends AbstractCrudService<DemReportInfoMapper, DemReportInfo> implements DemReportInfoService {
+
+    @Autowired
+    private BaseCompanyMapper baseCompanyMapper;
+
     @Override
-    public CommonPage<DemReportInfo> reportInfoList(String companyId,String sourceType,Integer pageNum, Integer pageSize) {
+    public CommonPage<DemReportInfo> reportInfoList(String companyId, String sourceType, Integer pageNum, Integer pageSize) {
         IPage<DemReportInfo> page = new Page<>(pageNum, pageSize);
+
+        String organization = null;
+        try {
+            organization = SecurityUtils.getLoginUser().getSysUser().getRemark();
+        } catch (Exception e) {
+            log.error("获取remake失败", e);
+            return ToCommonPage(page);
+        }
+
+        if (StringUtils.isBlank(organization)) {
+            throw new BusinessException("当前登录账号非消防重点单位,请联系管理员!");
+        }
+
+        LambdaQueryWrapper<BaseCompany> queryWrapper3 = Wrappers.lambdaQuery();
+        queryWrapper3.select(BaseCompany::getCompanyId)
+                .eq(BaseCompany::getOrganization, organization);
+        String companyId1 = null;
+        try {
+            companyId1 = baseCompanyMapper.selectOne(queryWrapper3).getCompanyId();
+        } catch (Exception e) {
+            return ToCommonPage(page);
+        }
+
+        if (StringUtils.isBlank(companyId)) {
+            companyId = companyId1;
+        }
+
         LambdaQueryWrapper<DemReportInfo> queryWrapper = Wrappers.lambdaQuery();
-        if ("2".equals(sourceType)){
-            queryWrapper.eq(StringUtils.isNotBlank(companyId), DemReportInfo::getCompanyId, companyId)
-                    .eq(DemReportInfo::getReportStatus, 1)
-                    .orderByDesc(DemReportInfo::getId);
-        }else {
-            queryWrapper.eq(StringUtils.isNotBlank(companyId), DemReportInfo::getCompanyId, companyId)
+        queryWrapper.eq(DemReportInfo::getCompanyId, companyId);
+        if ("2".equals(sourceType)) {
+            queryWrapper.eq(DemReportInfo::getReportStatus, 1)
                     .orderByDesc(DemReportInfo::getId);
+        } else {
+            queryWrapper.orderByDesc(DemReportInfo::getId);
         }
         page = this.page(page, queryWrapper);
+
         return ToCommonPage(page);
     }
 
@@ -62,7 +99,7 @@ public class DemReportInfoServiceImpl extends AbstractCrudService<DemReportInfoM
             LambdaQueryWrapper<DemReportInfo> queryWrapper1 = Wrappers.lambdaQuery();
             queryWrapper1.select(DemReportInfo::getId, DemReportInfo::getCompanyId)
                     .in(DemReportInfo::getCompanyId, companyIdList)
-                    .eq(DemReportInfo::getStatisticsTime, now.get(Calendar.YEAR)+"-"+now.get(Calendar.MONTH)).groupBy(DemReportInfo::getCompanyId);
+                    .eq(DemReportInfo::getStatisticsTime, now.get(Calendar.YEAR) + "-" + now.get(Calendar.MONTH)).groupBy(DemReportInfo::getCompanyId);
             list2 = this.list(queryWrapper1);
             for (int i = 0; i < companyList.size(); i++) {
                 for (int j = 0; j < list2.size(); j++) {
@@ -102,4 +139,50 @@ public class DemReportInfoServiceImpl extends AbstractCrudService<DemReportInfoM
         List<DemReportInfo> list2 = this.list(queryWrapper1);
         return list2;
     }
+
+    @Override
+    public void updateReadStatus(Integer id) {
+        String remark = null;
+        try {
+            remark = SecurityUtils.getLoginUser().getSysUser().getRemark();
+        } catch (NullPointerException e) {
+            log.error("获取remake失败", e);
+            return;
+        }
+
+        String companyId = null;
+        LambdaQueryWrapper<BaseCompany> queryWrapper = Wrappers.lambdaQuery();
+        queryWrapper.select(BaseCompany::getCompanyId)
+                .eq(BaseCompany::getOrganization, remark);
+        BaseCompany baseCompany = baseCompanyMapper.selectOne(queryWrapper);
+        if (baseCompany != null) {
+            companyId = baseCompany.getCompanyId();
+        } else {
+            log.warn("未查询到与组织[{}]匹配的公司信息", remark);
+            return;
+        }
+
+        DemReportInfo report = this.getOne(Wrappers.<DemReportInfo>lambdaQuery()
+                .eq(DemReportInfo::getId, id));
+        if (report == null) {
+            log.warn("报告ID[{}]不存在,无法更新已读状态", id);
+            return;
+        }
+
+        String reportCompanyId = report.getCompanyId();
+        if (!Objects.equals(reportCompanyId, companyId)) {
+            log.warn("报告ID[{}]所属公司[{}]与当前用户公司[{}]不匹配,无权限更新",
+                    id, reportCompanyId, companyId);
+            return;
+        }
+
+        if (report.getIsRead() == 0) {
+            report.setReadTime(LocalDateTime.now());
+            report.setIsRead(1);
+            this.updateById(report);
+            log.info("报告ID[{}]已更新为已读状态", id);
+        } else {
+            log.info("报告ID[{}]非第一次阅读,无需更新", id);
+        }
+    }
 }

+ 51 - 47
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/impl/PatrolInspectionPlanSonServiceImpl.java

@@ -113,9 +113,9 @@ public class PatrolInspectionPlanSonServiceImpl extends AbstractCrudService<Patr
         }
 
         Map<String, Object> map = new HashMap<>();
-        map.put("planSonCount", planSonCount);//巡检任务总数
-        map.put("patrolledCount", patrolledCount);//已巡检任务
-        map.put("undetectedCount", undetectedCount);//漏检任务
+        map.put("planSonCount", planSonCount);// 巡检任务总数
+        map.put("patrolledCount", patrolledCount);// 已巡检任务
+        map.put("undetectedCount", undetectedCount);// 漏检任务
         return map;
     }
 
@@ -301,8 +301,8 @@ public class PatrolInspectionPlanSonServiceImpl extends AbstractCrudService<Patr
          * 巡检时间判断
          * */
         LocalDateTime now = LocalDateTime.now();
-        LocalDateTime inspectionDateTime = LocalDateTime.parse(planSonList.get(0).getInspectionDate() +" "+ planSonList.get(0).getStartTime(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
-        LocalDateTime inspectionDateTime1 = LocalDateTime.parse(planSonList.get(0).getInspectionDate() +" "+ planSonList.get(0).getEndTime(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
+        LocalDateTime inspectionDateTime = LocalDateTime.parse(planSonList.get(0).getInspectionDate() + " " + planSonList.get(0).getStartTime(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
+        LocalDateTime inspectionDateTime1 = LocalDateTime.parse(planSonList.get(0).getInspectionDate() + " " + planSonList.get(0).getEndTime(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
         if (inspectionDateTime.isAfter(now)) {
             PatrolInspectionEvent patrolInspectionEvent = new PatrolInspectionEvent();
             patrolInspectionEvent.setEventName("早到");
@@ -314,7 +314,7 @@ public class PatrolInspectionPlanSonServiceImpl extends AbstractCrudService<Patr
             patrolInspectionEvent.setCreateTime(LocalDateTime.now());
             patrolInspectionEventService.add(patrolInspectionEvent);
             throw new BusinessException("计划未开始,不可巡检");
-        } else if (now.isAfter(inspectionDateTime1)){
+        } else if (now.isAfter(inspectionDateTime1)) {
             PatrolInspectionEvent patrolInspectionEvent = new PatrolInspectionEvent();
             patrolInspectionEvent.setEventName("迟到");
             patrolInspectionEvent.setEventType(34);
@@ -375,9 +375,13 @@ public class PatrolInspectionPlanSonServiceImpl extends AbstractCrudService<Patr
             patrolInspectionRecordPictureService.save(recordPictureList.get(i));
         }
 
-        for (int i = 0; i < recordOptionList.size(); i++) {
-            recordOptionList.get(i).setRecordId(recordId);
-            patrolInspectionRecordOptionService.save(recordOptionList.get(i));
+        if (recordOptionList != null && !recordOptionList.isEmpty()) {
+            for (int i = 0; i < recordOptionList.size(); i++) {
+                recordOptionList.get(i).setRecordId(recordId);
+                patrolInspectionRecordOptionService.save(recordOptionList.get(i));
+            }
+        } else {
+            throw new BusinessException("请选择或填写巡检内容!");
         }
 
         LambdaQueryWrapper<PatrolInspectionPlanSiteSon> queryWrapperTwo = Wrappers.lambdaQuery();
@@ -402,46 +406,46 @@ public class PatrolInspectionPlanSonServiceImpl extends AbstractCrudService<Patr
     }
 
     @Override
-    public void addPatrolInspectionAbnormalData(){
+    public void addPatrolInspectionAbnormalData() {
         LOGGER.info("巡检漏检定时任务 begin");
         DateTimeFormatter df1 = DateTimeFormatter.ofPattern("yyyy-MM-dd");
         String datetime1 = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
         String datetime2 = LocalDateTime.now().minusHours(1).format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
 
-        List<PatrolInspectionPlanSon> list = patrolInspectionPlanSonMapper.selectInspectionPlanSonData(datetime1,datetime2);
-        if(list.size() <=0){
+        List<PatrolInspectionPlanSon> list = patrolInspectionPlanSonMapper.selectInspectionPlanSonData(datetime1, datetime2);
+        if (list.size() <= 0) {
             LOGGER.info("当前时间向前一小时没有漏检记录");
-        }else{
+        } else {
             List<Integer> sonIdlist = new ArrayList<>();
             for (int i = 0; i < list.size(); i++) {
                 sonIdlist.add(list.get(i).getId());
             }
             LambdaQueryWrapper<PatrolInspectionPlanSiteSon> queryWrapper = Wrappers.lambdaQuery();
-            queryWrapper.in(PatrolInspectionPlanSiteSon::getPlanId,sonIdlist)
-                    .eq(PatrolInspectionPlanSiteSon::getInspectionStatus,1);
+            queryWrapper.in(PatrolInspectionPlanSiteSon::getPlanId, sonIdlist)
+                    .eq(PatrolInspectionPlanSiteSon::getInspectionStatus, 1);
             List<PatrolInspectionPlanSiteSon> siteSonList = patrolInspectionPlanSiteSonService.list(queryWrapper);
-            if(CollectionUtils.isNotEmpty(siteSonList)){
+            if (CollectionUtils.isNotEmpty(siteSonList)) {
                 List<Integer> siteIdList = new ArrayList<>();
                 List<Integer> noSonIdList = new ArrayList<>();
                 for (int i = 0; i < siteSonList.size(); i++) {
                     siteIdList.add(siteSonList.get(i).getSiteId());
                     noSonIdList.add(siteSonList.get(i).getPlanId());
                 }
-                //获取巡检地点
+                // 获取巡检地点
                 LOGGER.info("获取巡检地点");
                 LambdaQueryWrapper<PatrolInspectionSite> queryWrapper1 = Wrappers.lambdaQuery();
-                if(CollectionUtils.isNotEmpty(siteIdList)){
-                    queryWrapper1.in(PatrolInspectionSite::getId,siteIdList)
-                            .eq(PatrolInspectionSite::getEnable,1);
+                if (CollectionUtils.isNotEmpty(siteIdList)) {
+                    queryWrapper1.in(PatrolInspectionSite::getId, siteIdList)
+                            .eq(PatrolInspectionSite::getEnable, 1);
                 }
                 List<PatrolInspectionSite> siteList = patrolInspectionSiteService.list(queryWrapper1);
-                if(siteList.size() <= 0){
+                if (siteList.size() <= 0) {
                     LOGGER.info("查询巡检地点记录为空");
                 }
-                //获取巡检子计划
+                // 获取巡检子计划
                 LambdaQueryWrapper<PatrolInspectionPlanSon> planSonQueryWrapper = Wrappers.lambdaQuery();
-                if(CollectionUtils.isNotEmpty(noSonIdList)){
-                    planSonQueryWrapper.in(PatrolInspectionPlanSon::getId,noSonIdList);
+                if (CollectionUtils.isNotEmpty(noSonIdList)) {
+                    planSonQueryWrapper.in(PatrolInspectionPlanSon::getId, noSonIdList);
                 }
                 List<PatrolInspectionPlanSon> noPlanSonList = this.list(planSonQueryWrapper);
                 List<Integer> planIdList = new ArrayList<>();
@@ -453,27 +457,27 @@ public class PatrolInspectionPlanSonServiceImpl extends AbstractCrudService<Patr
                     areaList.add(noPlanSonList.get(i).getAreaId());
                 }
 
-                //获取巡检计划
+                // 获取巡检计划
                 List<PatrolInspectionPlan> noPlanIdList = patrolInspectionPlanMapper.selectNoPlanList(planIdList);
-                //获取巡检人员
+                // 获取巡检人员
                 LOGGER.info("获取巡检人员");
                 LambdaQueryWrapper<PatrolInspectionPersonnel> personnelQueryWrapper = Wrappers.lambdaQuery();
-                if(CollectionUtils.isNotEmpty(personnelList)){
-                    personnelQueryWrapper.in(PatrolInspectionPersonnel::getId,personnelList)
-                            .eq(PatrolInspectionPersonnel::getEnable,1);
+                if (CollectionUtils.isNotEmpty(personnelList)) {
+                    personnelQueryWrapper.in(PatrolInspectionPersonnel::getId, personnelList)
+                            .eq(PatrolInspectionPersonnel::getEnable, 1);
                 }
                 List<PatrolInspectionPersonnel> inspectionPersonnelList = patrolInspectionPersonnelService.list(personnelQueryWrapper);
-                if(inspectionPersonnelList.size() <= 0){
+                if (inspectionPersonnelList.size() <= 0) {
                     LOGGER.info("巡检人员信息不存在");
                 }
-                //获取巡检区域
+                // 获取巡检区域
                 LambdaQueryWrapper<PatrolInspectionArea> queryWrapperOne = Wrappers.lambdaQuery();
-                if(CollectionUtils.isNotEmpty(areaList)){
+                if (CollectionUtils.isNotEmpty(areaList)) {
                     queryWrapperOne.in(PatrolInspectionArea::getId, areaList)
-                            .eq(PatrolInspectionArea::getEnable,1);
+                            .eq(PatrolInspectionArea::getEnable, 1);
                 }
                 List<PatrolInspectionArea> areaInfoList = patrolInspectionAreaService.list(queryWrapperOne);
-                if(areaInfoList.size() <= 0){
+                if (areaInfoList.size() <= 0) {
                     LOGGER.info("巡检区域不存在");
                 }
 
@@ -482,7 +486,7 @@ public class PatrolInspectionPlanSonServiceImpl extends AbstractCrudService<Patr
                     Integer siteId = siteSonList.get(i).getSiteId();
                     Integer planSonId = siteSonList.get(i).getPlanId();
                     for (int j = 0; j < siteList.size(); j++) {
-                        if(siteId.equals(siteList.get(j).getId())){
+                        if (siteId.equals(siteList.get(j).getId())) {
                             patrolInspectionAbnormal.setSiteNubmber(siteList.get(j).getSiteNubmber());
                             patrolInspectionAbnormal.setSiteType(siteList.get(j).getSiteType());
                             patrolInspectionAbnormal.setSiteName(siteList.get(j).getSiteName());
@@ -495,7 +499,7 @@ public class PatrolInspectionPlanSonServiceImpl extends AbstractCrudService<Patr
                     }
 
                     for (int j = 0; j < noPlanSonList.size(); j++) {
-                        if(planSonId.equals(noPlanSonList.get(j).getId())){
+                        if (planSonId.equals(noPlanSonList.get(j).getId())) {
                             patrolInspectionAbnormal.setPlanId(noPlanSonList.get(j).getPlanId());
                             patrolInspectionAbnormal.setPlanSonId(noPlanSonList.get(j).getId());
                             patrolInspectionAbnormal.setTenantId(noPlanSonList.get(j).getTenantId());
@@ -516,14 +520,14 @@ public class PatrolInspectionPlanSonServiceImpl extends AbstractCrudService<Patr
 
                             Integer noAreaId = noPlanSonList.get(j).getAreaId();
                             for (int k = 0; k < areaInfoList.size(); k++) {
-                                if(noAreaId.equals(areaInfoList.get(k).getId())){
+                                if (noAreaId.equals(areaInfoList.get(k).getId())) {
                                     patrolInspectionAbnormal.setAreaName(areaInfoList.get(k).getAreaName());
                                     break;
                                 }
                             }
                             Integer noPersonnelId = noPlanSonList.get(j).getPersonnelId();
                             for (int k = 0; k < inspectionPersonnelList.size(); k++) {
-                                if(noPersonnelId.equals(inspectionPersonnelList.get(k).getId())){
+                                if (noPersonnelId.equals(inspectionPersonnelList.get(k).getId())) {
                                     patrolInspectionAbnormal.setName(inspectionPersonnelList.get(k).getFullName());
                                     patrolInspectionAbnormal.setPhone(inspectionPersonnelList.get(k).getPhoneNumber());
                                     break;
@@ -531,7 +535,7 @@ public class PatrolInspectionPlanSonServiceImpl extends AbstractCrudService<Patr
                             }
                             Integer planId = noPlanSonList.get(j).getPlanId();
                             for (int k = 0; k < noPlanIdList.size(); k++) {
-                                if(planId.equals(noPlanIdList.get(k).getId())){
+                                if (planId.equals(noPlanIdList.get(k).getId())) {
                                     patrolInspectionAbnormal.setRouteId(noPlanIdList.get(k).getRouteId());
                                     break;
                                 }
@@ -976,7 +980,7 @@ public class PatrolInspectionPlanSonServiceImpl extends AbstractCrudService<Patr
             for (int i = 0; i < planSonList.size(); i++) {
                 planSonidList.add(planSonList.get(i).getId());
             }
-            //巡检计划名称查询
+            // 巡检计划名称查询
             LambdaQueryWrapper<PatrolInspectionPlan> queryWrapperOne = Wrappers.lambdaQuery();
 //            queryWrapperOne.eq(PatrolInspectionPlan::getTenantId, SecurityUtils.getTenantId());
 //            queryWrapperOne.eq(PatrolInspectionPlan::getEnable, 1);
@@ -986,8 +990,8 @@ public class PatrolInspectionPlanSonServiceImpl extends AbstractCrudService<Patr
             }
 
             List<PatrolInspectionPlan> planList = patrolInspectionPlanMapper.selectList(queryWrapperOne);
-            List<DataCountVo> patrolledSiteCountList = this.planSiteSonCount(planSonidList, 2);//已巡检地点数量
-            List<DataCountVo> undetectedSiteCountList = this.planSiteSonCount(planSonidList, 1);//漏检地点数量
+            List<DataCountVo> patrolledSiteCountList = this.planSiteSonCount(planSonidList, 2);// 已巡检地点数量
+            List<DataCountVo> undetectedSiteCountList = this.planSiteSonCount(planSonidList, 1);// 漏检地点数量
             for (int i = 0; i < planSonList.size(); i++) {
                 PatrolInspectionPlanSonVo patrolInspectionPlanSonVo = new PatrolInspectionPlanSonVo();
                 patrolInspectionPlanSonVo.setId(planSonList.get(i).getId());
@@ -1001,7 +1005,7 @@ public class PatrolInspectionPlanSonServiceImpl extends AbstractCrudService<Patr
                 patrolInspectionPlanSonVo.setInspectionDate(planSonList.get(i).getInspectionDate());
                 patrolInspectionPlanSonVo.setPatrolledSiteCount(0);
                 patrolInspectionPlanSonVo.setUndetectedSiteCount(0);
-                //计划名称
+                // 计划名称
                 for (int j = 0; j < planList.size(); j++) {
                     if (planSonList.get(i).getPlanId().equals(planList.get(j).getId())) {
                         patrolInspectionPlanSonVo.setPlanId(planList.get(j).getId());
@@ -1012,7 +1016,7 @@ public class PatrolInspectionPlanSonServiceImpl extends AbstractCrudService<Patr
                 Date currentTime = new Date();
                 Date endTime = null;
                 if (planSonList.get(i).getPlanType() == 1) {
-                    //获取结束日期时间
+                    // 获取结束日期时间
                     LocalDate inspectionDate = planSonList.get(i).getInspectionDate();
                     String inspectionDateOne = df1.format(inspectionDate);
                     String inspectionDateTwo = inspectionDateOne + " " + planSonList.get(i).getEndTime();
@@ -1022,14 +1026,14 @@ public class PatrolInspectionPlanSonServiceImpl extends AbstractCrudService<Patr
                     }
 
                 } else {
-                    //获取结束日期时间
+                    // 获取结束日期时间
                     LocalDate endDate = planSonList.get(i).getEndDate();
                     String endDateOne = df1.format(endDate) + " 23:59:59";
                     try {
                         endTime = formatter.parse(endDateOne);
                     } catch (Exception e) {
                     }
-                    //计划类型描述
+                    // 计划类型描述
                     String planCycleName = null;
                     if (planSonList.get(i).getPlanCycle() == 1) {
                         planCycleName = "(日)";
@@ -1042,7 +1046,7 @@ public class PatrolInspectionPlanSonServiceImpl extends AbstractCrudService<Patr
                     }
                     patrolInspectionPlanSonVo.setPlanTypeDescribe("按次计划" + planCycleName);
                 }
-                //判断计划状态
+                // 判断计划状态
                 int status = endTime.compareTo(currentTime);
                 if (status == -1) {
                     if (planSonList.get(i).getCompletion() == 100) {

+ 68 - 12
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/impl/ReportResultServiceImpl.java

@@ -6,9 +6,9 @@ import com.baomidou.mybatisplus.core.toolkit.StringUtils;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.usky.common.core.bean.CommonPage;
-import com.usky.fire.domain.BaseCompanyPerson;
-import com.usky.fire.domain.ReportConfig;
-import com.usky.fire.domain.ReportResult;
+import com.usky.fire.domain.*;
+import com.usky.fire.mapper.BaseCompanyMapper;
+import com.usky.fire.mapper.DemReportInfoMapper;
 import com.usky.fire.mapper.ReportResultMapper;
 import com.usky.fire.service.ReportConfigService;
 import com.usky.fire.service.ReportResultService;
@@ -20,6 +20,7 @@ import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.stream.Collectors;
 
 /**
  * <p>
@@ -33,23 +34,78 @@ import java.util.Map;
 public class ReportResultServiceImpl extends AbstractCrudService<ReportResultMapper, ReportResult> implements ReportResultService {
     @Autowired
     private ReportConfigService reportConfigService;
+    @Autowired
+    private BaseCompanyMapper baseCompanyMapper;
+    @Autowired
+    private DemReportInfoMapper demReportInfoMapper;
 
     @Override
-    public CommonPage<ReportResult> reportResultList(Integer companyId, String sourceType, Integer pageNum,
-                                                     Integer pageSize) {
-        IPage<ReportResult> page = new Page<>(pageNum, pageSize);
+    public CommonPage<ReportResult> reportResultList(Integer companyId, String sourceType, Integer pageNum, Integer pageSize) {
+        Page<ReportResult> page = new Page<>(pageNum, pageSize);
+
         LambdaQueryWrapper<ReportResult> queryWrapper = Wrappers.lambdaQuery();
         queryWrapper.eq(ReportResult::getObjectId, companyId)
-                    .orderByDesc(ReportResult::getId);
-        page = this.page(page, queryWrapper);
-        return ToCommonPage(page);
+                .orderByDesc(ReportResult::getId);
+        IPage<ReportResult> resultPage = this.page(page, queryWrapper);
+        List<ReportResult> resultList = resultPage.getRecords();
+
+        List<Integer> objectIdList = resultList.stream()
+                .map(ReportResult::getObjectId)
+                .distinct()
+                .collect(Collectors.toList());
+
+        if (objectIdList.isEmpty()) {
+            return ToCommonPage(resultPage);
+        }
+
+        LambdaQueryWrapper<BaseCompany> baseCompanyQuery = Wrappers.lambdaQuery();
+        baseCompanyQuery.select(BaseCompany::getId, BaseCompany::getCompanyId)
+                .in(BaseCompany::getId, objectIdList);
+        List<BaseCompany> baseCompanyList = baseCompanyMapper.selectList(baseCompanyQuery);
+
+        List<String> companyIdList = baseCompanyList.stream()
+                .map(BaseCompany::getCompanyId)
+                .distinct()
+                .collect(Collectors.toList());
+
+        if (companyIdList.isEmpty()) {
+            return ToCommonPage(resultPage);
+        }
+
+        LambdaQueryWrapper<DemReportInfo> demReportQuery = Wrappers.lambdaQuery();
+        demReportQuery.select(DemReportInfo::getIsRead, DemReportInfo::getReadTime, DemReportInfo::getCompanyId, DemReportInfo::getReportStatus)
+                .in(DemReportInfo::getCompanyId, companyIdList);
+        List<DemReportInfo> demReportInfoList = demReportInfoMapper.selectList(demReportQuery);
+
+        Map<String, DemReportInfo> demReportMap = demReportInfoList.stream()
+                .collect(Collectors.toMap(DemReportInfo::getCompanyId, info -> info, (existing, replacement) -> existing));
+
+        Map<Integer, String> baseCompanyMap = baseCompanyList.stream()
+                .collect(Collectors.toMap(BaseCompany::getId, BaseCompany::getCompanyId, (existing, replacement) -> existing));
+
+        for (ReportResult reportResult : resultList) {
+            Integer objectId = reportResult.getObjectId();
+            String relatedCompanyId = baseCompanyMap.get(objectId);
+
+            if (relatedCompanyId != null) {
+                DemReportInfo demReportInfo = demReportMap.get(relatedCompanyId);
+                if (demReportInfo != null) {
+                    reportResult.setReportStatus(demReportInfo.getReportStatus());
+                    reportResult.setReadTime(demReportInfo.getReadTime());
+                    reportResult.setIsRead(demReportInfo.getIsRead());
+                }
+            }
+        }
+
+        return ToCommonPage(resultPage);
     }
+
     @Override
     public CommonPage<Object> newReportResultList(String reportObject, Integer pageNum, Integer pageSize) {
         List<Object> list = new ArrayList<>();
         IPage<ReportResult> page = new Page<>(pageNum, pageSize);
         LambdaQueryWrapper<ReportResult> queryWrapper = Wrappers.lambdaQuery();
-        queryWrapper.like(StringUtils.isNotBlank(reportObject),ReportResult::getReportObject, reportObject)
+        queryWrapper.like(StringUtils.isNotBlank(reportObject), ReportResult::getReportObject, reportObject)
                 .orderByDesc(ReportResult::getId);
         page = this.page(page, queryWrapper);
         LambdaQueryWrapper<ReportConfig> queryWrapper1 = Wrappers.lambdaQuery();
@@ -61,8 +117,8 @@ public class ReportResultServiceImpl extends AbstractCrudService<ReportResultMap
                 map.put("reportObject", page.getRecords().get(i).getReportObject());
                 map.put("overallScore", page.getRecords().get(i).getOverallScore());
                 map.put("createDate", page.getRecords().get(i).getCreateDate());
-                for (int j = 0; j < list1.size(); j++){
-                    if (page.getRecords().get(i).getConfigId().equals(list1.get(j).getId())){
+                for (int j = 0; j < list1.size(); j++) {
+                    if (page.getRecords().get(i).getConfigId().equals(list1.get(j).getId())) {
                         map.put("reportName", list1.get(j).getReportName());
                     }
                 }

+ 1 - 0
service-ids/service-ids-biz/pom.xml

@@ -64,6 +64,7 @@
             <plugin>
                 <groupId>org.springframework.boot</groupId>
                 <artifactId>spring-boot-maven-plugin</artifactId>
+                <version>2.2.6.RELEASE</version>
                 <executions>
                     <execution>
                         <goals>

+ 16 - 0
service-iot/service-iot-api/src/main/java/com/usky/iot/RemoteIotService.java

@@ -0,0 +1,16 @@
+package com.usky.iot;
+
+
+import com.usky.iot.factory.RemoteIotFactory;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.GetMapping;
+
+@FeignClient(contextId = "remoteIotService", value = "service-iot" , fallbackFactory = RemoteIotFactory.class)
+public interface RemoteIotService {
+
+    @GetMapping("/executeTimedSendingOld")
+    void executeTimedSendingOld();
+
+    @GetMapping("/reportSubmissionReminderOld")
+    void reportSubmissionReminderOld();
+}

+ 1 - 3
service-iot/service-iot-api/src/main/java/com/usky/iot/RemoteIotTaskService.java

@@ -2,13 +2,11 @@ package com.usky.iot;
 
 
 import com.usky.iot.factory.RemoteIotTaskFactory;
-import com.usky.iot.factory.RemotePmFactory;
-import org.apache.ibatis.annotations.Param;
 import org.springframework.cloud.openfeign.FeignClient;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestParam;
 
-@FeignClient(contextId = "RemoteIotTaskService", value = "service-iot" , fallbackFactory = RemoteIotTaskFactory.class)
+@FeignClient(contextId = "remoteIotTaskService", value = "service-iot" , fallbackFactory = RemoteIotTaskFactory.class)
 public interface RemoteIotTaskService {
 
     @GetMapping("/dataOverviewJobData")

+ 0 - 13
service-iot/service-iot-api/src/main/java/com/usky/iot/RemotePmService.java

@@ -1,13 +0,0 @@
-package com.usky.iot;
-
-
-import com.usky.iot.factory.RemotePmFactory;
-import org.springframework.cloud.openfeign.FeignClient;
-import org.springframework.web.bind.annotation.GetMapping;
-
-@FeignClient(contextId = "remoteIotService", value = "service-iot" , fallbackFactory = RemotePmFactory.class)
-public interface RemotePmService {
-
-    @GetMapping("/executeTimedSending")
-    void executeTimedSending();
-}

+ 40 - 0
service-iot/service-iot-api/src/main/java/com/usky/iot/factory/RemoteIotFactory.java

@@ -0,0 +1,40 @@
+package com.usky.iot.factory;
+
+import com.usky.common.core.exception.FeignBadRequestException;
+import com.usky.iot.RemoteIotService;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.cloud.openfeign.FallbackFactory;
+import org.springframework.stereotype.Component;
+
+
+/**
+ * 用户服务降级处理
+ *
+ * @author ruoyi
+ */
+@Component
+public class RemoteIotFactory implements FallbackFactory<RemoteIotService>
+{
+    private static final Logger log = LoggerFactory.getLogger(RemoteIotFactory.class);
+
+    @Override
+    public RemoteIotService create(Throwable throwable)
+    {
+        return new RemoteIotService()
+        {
+            @Override
+            public void executeTimedSendingOld() {
+                log.error("工作报告定时发送异常:{}", throwable.getMessage());
+                throw new FeignBadRequestException(500,"工作报告定时发送异常"+throwable.getMessage());
+            }
+
+            @Override
+            public void reportSubmissionReminderOld() {
+                log.error("工作报告提交提醒发送异常:{}", throwable.getMessage());
+                throw new FeignBadRequestException(500,"工作报告提交提醒发送异常"+throwable.getMessage());
+            }
+
+        };
+    }
+}

+ 0 - 2
service-iot/service-iot-api/src/main/java/com/usky/iot/factory/RemoteIotTaskFactory.java

@@ -2,8 +2,6 @@ package com.usky.iot.factory;
 
 import com.usky.common.core.exception.FeignBadRequestException;
 import com.usky.iot.RemoteIotTaskService;
-import com.usky.iot.RemotePmService;
-import org.apache.ibatis.annotations.Param;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.cloud.openfeign.FallbackFactory;

+ 4 - 0
service-iot/service-iot-biz/pom.xml

@@ -117,6 +117,10 @@
             <artifactId>alibaba-dingtalk-service-sdk</artifactId>
             <version>2.0.0</version>
         </dependency>
+        <dependency>
+            <groupId>com.usky</groupId>
+            <artifactId>ruoyi-common-swagger</artifactId>
+        </dependency>
 
     </dependencies>
 

+ 3 - 1
service-iot/service-iot-biz/src/main/java/com/usky/iot/RuoYiSystemApplication.java

@@ -2,6 +2,7 @@ package com.usky.iot;
 
 
 
+import com.ruoyi.common.swagger.annotation.EnableCustomSwagger2;
 import com.usky.iot.constant.constant;
 import io.swagger.annotations.SwaggerDefinition;
 import lombok.val;
@@ -31,12 +32,13 @@ import java.net.UnknownHostException;
  */
 
 //@EnableSwagger2
+@EnableCustomSwagger2
 @EnableFeignClients(basePackages = "com.usky")
 @MapperScan(value = "com.usky.iot.mapper")
 @ComponentScan("com.usky")
 @SpringBootApplication
 //开启异步
-@EnableAsync
+//@EnableAsync
 //@EnableRabbit
 public class RuoYiSystemApplication
 {

+ 8 - 3
service-iot/service-iot-biz/src/main/java/com/usky/iot/controller/api/PmTimedSendingApi.java

@@ -1,6 +1,6 @@
 package com.usky.iot.controller.api;
 
-import com.usky.iot.RemotePmService;
+import com.usky.iot.RemoteIotService;
 import com.usky.iot.service.PmWorkReportService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.RestController;
@@ -15,15 +15,20 @@ import java.time.LocalDateTime;
  * @author f
  */
 @RestController
-public class PmTimedSendingApi implements RemotePmService {
+public class PmTimedSendingApi implements RemoteIotService {
 
     @Autowired
     private PmWorkReportService pmWorkReportService;
 
     @Override
-    public void executeTimedSending() {
+    public void executeTimedSendingOld() {
         LocalDateTime now = LocalDateTime.now();
         pmWorkReportService.timedSending(now);
     }
 
+    @Override
+    public void reportSubmissionReminderOld() {
+        pmWorkReportService.reportSubmissionReminder();
+    }
+
 }

+ 4 - 2
service-iot/service-iot-biz/src/main/java/com/usky/iot/controller/web/DeviceHttpController.java

@@ -68,8 +68,10 @@ public class DeviceHttpController {
                                                  @RequestParam("commandValue") String commandValue,
                                                  @RequestParam(value = "domain",required = false) String domain,
                                                  @RequestParam(value = "userId",required = false) Long userId,
-                                                 @RequestParam(value = "userName",required = false) String userName){
-        return ApiResult.success(dmpDeviceInfoService.control(productCode,deviceUuid,commandCode,commandValue,domain,userId,userName));
+                                                 @RequestParam(value = "userName",required = false) String userName,
+                                                 @RequestParam(value = "categoryType",required = false , defaultValue = "1") Integer categoryType,
+                                                 @RequestParam(value = "gatewayUuid",required = false) String gatewayUuid){
+        return ApiResult.success(dmpDeviceInfoService.control(productCode,deviceUuid,commandCode,commandValue,domain,userId,userName,categoryType,gatewayUuid));
     }
 
 

+ 9 - 0
service-iot/service-iot-biz/src/main/java/com/usky/iot/controller/web/DmpDeviceInfoController.java

@@ -85,6 +85,15 @@ public class DmpDeviceInfoController {
         return ApiResult.success(dmpDeviceInfoService.pageWhite(dmpDeviceInfoRequest));
     }
 
+    /**
+     * 网关设备信息下拉接口
+     * @return
+     */
+    @GetMapping("gatewayDeviceList")
+    public ApiResult<List<DmpDeviceInfo>> gatewayDeviceList() {
+        return ApiResult.success(dmpDeviceInfoService.gatewayDeviceList());
+    }
+
     /**
      * 删除记录
      */

+ 1 - 1
service-iot/service-iot-biz/src/main/java/com/usky/iot/controller/web/DmpProductInfoController.java

@@ -34,7 +34,7 @@ public class DmpProductInfoController {
      * @return
      */
     @PostMapping
-    public ApiResult<Void> add(@RequestBody DmpProductInfo dmpProductInfo){
+    public ApiResult<Void> add(@RequestBody List<DmpProductInfo> dmpProductInfo){
         dmpProductInfoService.add(dmpProductInfo);
         return ApiResult.success();
     }

Some files were not shown because too many files changed in this diff