Ver código fonte

自定义工单新请求demo处理

wangmiaomiao 8 meses atrás
pai
commit
fdda47d9f4

+ 71 - 2
slibra-common/src/main/java/com/slibra/common/constant/MyConstants.java

@@ -78,8 +78,77 @@ public class MyConstants {
     public static final String WARNING_DEFAULT_QUESTION= "在线仪表数据异常";
     public static final String WARNING_DEFAULT_CREATE = "task-job";
     public static final String DEFAULT_ID_IDENTIFIER = "@@id@@";
-
-//    public static final String ZLSY = "zlsy";//正磷酸盐
+    public static final String TOOLS_WORK_ORDER = "work-order";
+    public static final String TIMEBEGIN = "timeBegin";
+    public static final String TIMEEND = "timeEnd";
+    public static final String MODULE = "module";
+    public static final String TYPE = "type";
+    public static final String DATA = "data";
+    public static final String MODULE_CONTENT = "自定义工单查询";
+    public static final String ONLINE = "online";
+    public static final String REPORT = "report";
+    public static final String ROBOT = "robot";
+    public static final String TOOLS_WORK_ORDER_SQL_INDUSTRY = " SELECT" +
+            "TEST_DATE 化验日期, " +
+            "AVG(JS_SLQ)  进水量," +
+            "AVG(JS_COD)  进水COD," +
+            "AVG(JS_TN)  进水总氮," +
+            "AVG(JS_TP)  进水总磷," +
+            "AVG(JS_NH3)  进水氨氮," +
+            "AVG(JS_SS)  进水SS," +
+            "AVG(CS_SLQC)  出水量," +
+            "AVG(CS_COD)  出水COD," +
+            "AVG(CS_TN)  出水总氮," +
+            "AVG(CS_TP)  出水总磷," +
+            "AVG(CS_NH3)  出水氨氮," +
+            "AVG(CS_SS)  出水SS" +
+            "FROM" +
+            "t_xinyi_industry " +
+            "WHERE" +
+            "TEST_DATE BETWEEN #{0} " +
+            "AND #{1}" +
+            "GROUP BY TEST_DATE";
+
+    public static final String TOOLS_WORK_ORDER_SQL_DAILY = " SELECT" +
+            "TEST_DATE 化验日期, " +
+            "AVG(JSL)  进水量," +
+            "AVG(JS_COD)  进水COD," +
+            "AVG(JS_TN)  进水总氮," +
+            "AVG(JS_TP)  进水总磷," +
+            "AVG(JS_NH3)  进水氨氮," +
+            "AVG(JS_SS)  进水SS," +
+            "AVG(CSL)  出水量," +
+            "AVG(CS_COD)  出水COD," +
+            "AVG(CS_TN)  出水总氮," +
+            "AVG(CS_TP)  出水总磷," +
+            "AVG(CS_NH3)  出水氨氮," +
+            "AVG(CS_SS)  出水SS" +
+            "FROM" +
+            "t_xinyi_daily " +
+            "WHERE" +
+            "TEST_DATE BETWEEN #{0} " +
+            "AND #{1}" +
+            "GROUP BY TEST_DATE";
+
+
+    public static final String TOOLS_WORK_ORDER_SQL_ROBOT = "SELECT" +
+            "TEST_DATE 化验日期, " +
+            "AVG(NO3_HLJ1_JQR) '1#好氧池硝酸盐'," +
+            "AVG(NO3_HLJ2_JQR) '2#好氧池硝酸盐'," +
+            "AVG(NH3_1_JQR) '1#缺氧氨氮'," +
+            "AVG(NH3_2_JQR) '2#缺氧氨氮'," +
+            "AVG(NO3_QYC_1_JQR) '1#缺氧池硝酸盐'," +
+            "AVG(NO3_QYC_2_JQR) '2#缺氧池硝酸盐'," +
+            "AVG(TP_RCC_JQR) '二沉池正磷酸盐'" +
+            "FROM" +
+            "t_xinyi_robot " +
+            "WHERE" +
+            "TEST_DATE BETWEEN #{0} " +
+            "AND #{1} " +
+            "GROUP BY" +
+            "TEST_DATE";
+
+    //    public static final String ZLSY = "zlsy";//正磷酸盐
 //    public static final String XSY1 = "xsy1";//正磷酸盐
 //    public static final String XSY2 = "xsy2";//正磷酸盐
 //    public static final String TN = "tn";//总氮

+ 3 - 0
slibra-common/src/main/java/com/slibra/common/enums/BusinessEnum.java

@@ -28,6 +28,9 @@ public class BusinessEnum {
         ROBOT_ANDAN_1("#1氨氮", "#1氨氮"),
         ROBOT_ANDAN_2("#2氨氮", "#2氨氮"),
 
+        //2024年7月26日11:11:06 氨氮报警(两个池子)合成一个
+        ROBOT_CS_ANDAN("出水氨氮", "出水氨氮"),
+
         //生化报警
         NHLB("内回流比", "内回流比"),
         WHLB("外回流比", "外回流比"),

+ 1 - 0
slibra-quartz/src/main/java/com/slibra/quartz/task/AsyncTask.java

@@ -2055,6 +2055,7 @@ public class AsyncTask {
                 handleXinYiWarningsRobot(csadBzz, anDan2, csadGkz, ROBOT_ANDAN_2.getCode(), tXinyiIndustry, normConfig);
             }
 
+            //TODO:合并成一个
         }
     }
 

+ 27 - 0
slibra-system/src/main/java/com/slibra/business/req/ChatRequest.java

@@ -1,14 +1,19 @@
 package com.slibra.business.req;
 
+import com.alibaba.fastjson2.JSON;
 import com.alibaba.fastjson2.annotation.JSONField;
 import lombok.AllArgsConstructor;
 import lombok.Builder;
 import lombok.Data;
 import lombok.NoArgsConstructor;
 
+import java.util.Collections;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
+import static com.slibra.common.constant.MyConstants.*;
+
 
 @Data
 @Builder
@@ -50,4 +55,26 @@ public class ChatRequest {
     private String tools = "false";
 
 
+    public static void main(String[] args) {
+        //2024年7月26日10:37:50  自定义工单的传参demo给永创
+        ChatRequest chatRequest = new ChatRequest();
+        chatRequest.setTools(TOOLS_WORK_ORDER);
+        String timeBegin = "2024/07/11";
+        String timeEnd = "2024/07/12";
+        //存放的JSON
+        HashMap<String, Object> map = new HashMap<>();
+        map.put(TIMEBEGIN, timeBegin);
+        map.put(TIMEEND, timeEnd);
+        map.put(MODULE, MODULE_CONTENT);
+        map.put(TYPE, 2);
+        //拼装的SQL
+        HashMap<String, Object> sqlMap = new HashMap<>();
+        sqlMap.put(ONLINE, TOOLS_WORK_ORDER_SQL_INDUSTRY.replace("#{0}", timeBegin).replace("#{1}", timeEnd));
+        sqlMap.put(ROBOT, TOOLS_WORK_ORDER_SQL_ROBOT.replace("#{0}", timeBegin).replace("#{1}", timeEnd));
+        map.put(DATA, sqlMap);
+        chatRequest.setHistoryDia(Collections.singletonList(JSON.toJSONString(map)));
+        System.out.println(JSON.toJSONString(chatRequest));
+    }
+
+
 }