Przeglądaj źródła

Merge branch 'master' of ssh://gitlab.fuxicarbon.com:1111/hongshan/big-model-java

wangmiaomiao 8 miesięcy temu
rodzic
commit
2f6a2bec99
20 zmienionych plików z 338 dodań i 91 usunięć
  1. 6 27
      slibra-admin/src/main/java/com/slibra/web/controller/business/GRPCController.java
  2. 1 4
      slibra-admin/src/main/java/com/slibra/web/controller/business/HandleDataController.java
  3. 1 1
      slibra-admin/src/main/java/com/slibra/web/controller/business/OutController.java
  4. 1 3
      slibra-admin/src/main/java/com/slibra/web/controller/business/TXinyiDailyController.java
  5. 1 8
      slibra-admin/src/main/java/com/slibra/web/controller/business/WarningController.java
  6. 17 2
      slibra-common/src/main/java/com/slibra/common/DecimalUtils.java
  7. 1 1
      slibra-common/src/main/java/com/slibra/common/config/WeChatPayConfig.java
  8. 1 0
      slibra-common/src/main/java/com/slibra/common/constant/MyConstants.java
  9. 1 1
      slibra-common/src/main/java/com/slibra/common/core/domain/DecisionReq.java
  10. 1 1
      slibra-common/src/main/java/com/slibra/common/core/domain/TXinyiDaily.java
  11. 129 0
      slibra-common/src/main/java/com/slibra/common/utils/format/WaterFormat.java
  12. 121 0
      slibra-quartz/src/main/java/com/slibra/quartz/business/JsCsFormatData.java
  13. 41 30
      slibra-quartz/src/main/java/com/slibra/quartz/task/AsyncTask.java
  14. 10 4
      slibra-quartz/src/main/java/com/slibra/quartz/task/RyTask.java
  15. 1 2
      slibra-system/src/main/java/com/slibra/business/mapper/TXinyiDailyMapper.java
  16. 1 2
      slibra-system/src/main/java/com/slibra/business/mapper/TXinyiIndustryMapper.java
  17. 1 1
      slibra-system/src/main/java/com/slibra/business/service/ITXinyiDailyService.java
  18. 1 0
      slibra-system/src/main/java/com/slibra/business/service/impl/FrontServiceImpl.java
  19. 1 3
      slibra-system/src/main/java/com/slibra/business/service/impl/TXinyiDailyServiceImpl.java
  20. 1 1
      slibra-system/src/main/resources/mapper/business/TXinyiIndustryMapper.xml

+ 6 - 27
slibra-admin/src/main/java/com/slibra/web/controller/business/GRPCController.java

@@ -13,11 +13,14 @@ import com.slibra.common.DecimalUtils;
 import com.slibra.common.config.BigModelConfig;
 import com.slibra.common.constant.MyConstants;
 import com.slibra.common.core.controller.BaseController;
+import com.slibra.common.core.domain.DecisionReq;
+import com.slibra.common.core.domain.TXinyiDaily;
 import com.slibra.common.enums.BusinessEnum;
 import com.slibra.common.exception.ServiceException;
 import com.slibra.common.utils.DateUtils;
 import com.slibra.common.utils.SecurityUtils;
 import com.slibra.common.utils.StringUtils;
+import com.slibra.common.utils.format.WaterFormat;
 import com.slibra.common.utils.ip.IpUtils;
 import com.slibra.common.utils.uuid.IdUtils;
 import io.grpc.ManagedChannel;
@@ -431,38 +434,14 @@ public class GRPCController extends BaseController {
         if(!CollectionUtils.isEmpty(decisionReqs)){
             //处理日报数据
             TXinyiDaily daily = this.xinyiDailyMapper.selectNewestData();
+
             for (DecisionReq decisionReq : decisionReqs) {
                 if(!Objects.isNull(daily)){
-                    decisionReq.setT(DecimalUtils.getAbsAndScale(daily.getJsSw(), MyConstants.INT_0));
-                    decisionReq.setSVI(daily.getWntjzsAll());
-                    decisionReq.setSV(daily.getWncjbAll());
-                    decisionReq.setMlvss(daily.getHfxwnndAll());
-                    //2024年7月2日17:20:12  mlss和DO_O也要从日报获取
-                    decisionReq.setMlss(daily.getHycWnndAll());
-                    decisionReq.setDoO(daily.getHycRjyAll());
-                    decisionReq.setDoAna(daily.getYycRjyAll());
-                    decisionReq.setDoQue(daily.getQycRjyAll());
-                    //2024年5月26日11:59:02 干污泥量数据做了同步
-                    decisionReq.setGwnl(daily.getGWNL());
-                    BigDecimal jsBod5 = daily.getJsBod5();
-                    decisionReq.setBodIn(jsBod5);
-                    BigDecimal tpIn = decisionReq.getTpIn();
-                    BigDecimal tnIn = decisionReq.getTnIn();
-                    if(!Objects.isNull(jsBod5)){
-                        if(!Objects.isNull(tpIn) && tpIn.compareTo(new BigDecimal("0")) >0){
-                            decisionReq.setC(jsBod5.divide(tpIn, 4, RoundingMode.HALF_UP));
-                        }
-                        if(!Objects.isNull(tnIn) && tnIn.compareTo(new BigDecimal("0")) >0){
-                            decisionReq.setB(jsBod5.divide(tnIn, 4, RoundingMode.HALF_UP));
-                        }
-                    }
-                    //2024年6月1日08:37:09 内回流加上
-                    decisionReq.setR(daily.getNhlR());
-                    decisionReq.setRR(daily.getWhlR());
-                    //todo 字符串的调用getAbsAndScaleStr()
+                    WaterFormat.getWaterDecimationData(decisionReq, daily);
                 }
             }
         }
+
         return decisionReqs;
     }
 

+ 1 - 4
slibra-admin/src/main/java/com/slibra/web/controller/business/HandleDataController.java

@@ -1,23 +1,20 @@
 package com.slibra.web.controller.business;
 
-import cn.hutool.core.date.DateTime;
 import cn.hutool.core.date.DateUtil;
 import cn.hutool.http.HttpRequest;
 import cn.hutool.poi.excel.ExcelReader;
 import cn.hutool.poi.excel.ExcelUtil;
 import com.alibaba.fastjson2.JSON;
 import com.alibaba.fastjson2.JSONArray;
-import com.slibra.business.domain.TXinyiDaily;
+import com.slibra.common.core.domain.TXinyiDaily;
 import com.slibra.business.domain.TXinyiIndustry;
 import com.slibra.business.domain.TXinyiLaboratory;
-import com.slibra.business.domain.TXinyiRobot;
 import com.slibra.business.mapper.TXinyiDailyMapper;
 import com.slibra.business.mapper.TXinyiIndustryMapper;
 import com.slibra.business.mapper.TXinyiLaboratoryMapper;
 import com.slibra.business.mapper.TXinyiRobotMapper;
 import com.slibra.common.core.controller.BaseController;
 import com.slibra.common.utils.DateUtils;
-import com.slibra.common.utils.StringUtils;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.util.CollectionUtils;

+ 1 - 1
slibra-admin/src/main/java/com/slibra/web/controller/business/OutController.java

@@ -1,7 +1,7 @@
 package com.slibra.web.controller.business;
 
 
-import com.slibra.business.domain.TXinyiDaily;
+import com.slibra.common.core.domain.TXinyiDaily;
 import com.slibra.business.mapper.TXinyiDailyMapper;
 import com.slibra.common.core.domain.AjaxResult;
 import lombok.extern.slf4j.Slf4j;

+ 1 - 3
slibra-admin/src/main/java/com/slibra/web/controller/business/TXinyiDailyController.java

@@ -5,13 +5,11 @@ import javax.servlet.http.HttpServletResponse;
 
 import com.alibaba.fastjson2.JSON;
 import com.alibaba.fastjson2.JSONWriter;
-import com.slibra.business.domain.TXinyiDaily;
+import com.slibra.common.core.domain.TXinyiDaily;
 import com.slibra.business.mapper.TXinyiDailyMapper;
 import com.slibra.business.service.ITXinyiDailyService;
 import com.slibra.common.utils.poi.ExcelUtil;
-import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.util.CollectionUtils;
 import org.springframework.web.bind.annotation.*;
 import com.slibra.common.annotation.Log;
 import com.slibra.common.core.controller.BaseController;

+ 1 - 8
slibra-admin/src/main/java/com/slibra/web/controller/business/WarningController.java

@@ -1,16 +1,13 @@
 package com.slibra.web.controller.business;
 
 import cn.hutool.core.date.DateUtil;
-import com.slibra.business.domain.TXinyiDaily;
+import com.slibra.common.core.domain.TXinyiDaily;
 import com.slibra.business.domain.TXinyiIndustry;
 import com.slibra.business.domain.TXinyiNormConfig;
-import com.slibra.business.domain.TXinyiRobot;
 import com.slibra.business.mapper.TXinyiDailyMapper;
 import com.slibra.business.mapper.TXinyiIndustryMapper;
 import com.slibra.business.mapper.TXinyiNormConfigMapper;
 import com.slibra.business.mapper.TXinyiRobotMapper;
-import com.slibra.business.service.ITXinyiNormConfigService;
-import com.slibra.business.service.impl.TXinyiNormConfigServiceImpl;
 import com.slibra.common.constant.MyConstants;
 import com.slibra.common.core.controller.BaseController;
 import com.slibra.common.core.domain.AjaxResult;
@@ -18,17 +15,13 @@ import com.slibra.common.utils.DateUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.util.CollectionUtils;
 import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
 import java.math.BigDecimal;
 import java.math.RoundingMode;
-import java.time.LocalDate;
 import java.time.LocalDateTime;
 import java.time.ZoneId;
-import java.time.format.DateTimeFormatter;
-import java.time.temporal.TemporalUnit;
 import java.util.Date;
 import java.util.List;
 import java.util.Objects;

+ 17 - 2
slibra-common/src/main/java/com/slibra/common/DecimalUtils.java

@@ -1,10 +1,15 @@
 package com.slibra.common;
 
+import com.alibaba.fastjson2.JSONArray;
 import com.slibra.common.utils.StringUtils;
 
 import java.math.BigDecimal;
 import java.math.RoundingMode;
+import java.util.Arrays;
+import java.util.List;
 import java.util.Objects;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
 
 public class DecimalUtils {
 
@@ -28,10 +33,20 @@ public class DecimalUtils {
      * @param length
      * @return
      */
-    public static BigDecimal getAbsAndScaleStr(String req, int length){
+    public static String getAbsAndScaleStr(String req, int length){
         if(StringUtils.isBlank(req))
             return null;
-        return new BigDecimal(req).abs().setScale(length, RoundingMode.HALF_UP);
+        return new BigDecimal(req).abs().setScale(length, RoundingMode.HALF_UP).toString();
+    }
+
+    public static String getAbsForArray(String list, int length) {
+        if ( Objects.isNull( list ) ) {
+            return null;
+        }
+
+        List<BigDecimal> arrayStr = JSONArray.parseArray(list, BigDecimal.class).stream().map(num -> getAbsAndScale(num, length)).collect(Collectors.toList());
+
+        return arrayStr.toString();
     }
 
 

+ 1 - 1
slibra-common/src/main/java/com/slibra/common/config/WeChatPayConfig.java

@@ -11,7 +11,7 @@ import org.springframework.context.annotation.Configuration;
 /**
  * 配置 NativePayService
  */
-@Configuration
+// @Configuration
 public class WeChatPayConfig {
 
 

+ 1 - 0
slibra-common/src/main/java/com/slibra/common/constant/MyConstants.java

@@ -32,6 +32,7 @@ public class MyConstants {
     public static final String NUMBER_24 = "24";
     public static final String NUMBER_2 = "2";
     public static final int INT_0 = 0;
+    public static final int INT_1 = 1;
     public static final Double DOUBLE_75 = 75D;
     public static final int NUMBER_SCALE_4 = 4;
 //    public static final BigDecimal ROBOT_HY_DIVIDE = new BigDecimal("0.8");

+ 1 - 1
slibra-system/src/main/java/com/slibra/business/req/DecisionReq.java → slibra-common/src/main/java/com/slibra/common/core/domain/DecisionReq.java

@@ -1,4 +1,4 @@
-package com.slibra.business.req;
+package com.slibra.common.core.domain;
 
 
 import com.alibaba.fastjson2.annotation.JSONField;

+ 1 - 1
slibra-system/src/main/java/com/slibra/business/domain/TXinyiDaily.java → slibra-common/src/main/java/com/slibra/common/core/domain/TXinyiDaily.java

@@ -1,4 +1,4 @@
-package com.slibra.business.domain;
+package com.slibra.common.core.domain;
 
 import java.math.BigDecimal;
 import java.util.Date;

+ 129 - 0
slibra-common/src/main/java/com/slibra/common/utils/format/WaterFormat.java

@@ -0,0 +1,129 @@
+package com.slibra.common.utils.format;
+
+import com.alibaba.fastjson2.JSON;
+import com.slibra.common.DecimalUtils;
+import com.slibra.common.constant.MyConstants;
+import com.slibra.common.core.domain.DecisionReq;
+import com.slibra.common.core.domain.TXinyiDaily;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.util.CollectionUtils;
+
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.util.List;
+import java.util.Objects;
+
+import static com.slibra.common.constant.MyConstants.*;
+
+public class WaterFormat {
+
+    public static DecisionReq getWaterDecimationData(DecisionReq decisionReq, TXinyiDaily daily ) {
+        // 格式化小数
+        // 溶解氧1位 碳源投加量 2位 其他都是整数
+        decisionReq.setCodIn(DecimalUtils.getAbsAndScale(decisionReq.getCodIn(), INT_0));
+        decisionReq.setCodInName(DecimalUtils.getAbsAndScale(decisionReq.getCodInName(), INT_0));
+        decisionReq.setCodOff(DecimalUtils.getAbsAndScale(decisionReq.getCodOff(), INT_0));
+        decisionReq.setCodOffName(DecimalUtils.getAbsAndScale(decisionReq.getCodOffName(), INT_0));
+        decisionReq.setCodOffCon(DecimalUtils.getAbsAndScale(decisionReq.getCodOffCon(), INT_0));
+        decisionReq.setTpIn(DecimalUtils.getAbsAndScale(decisionReq.getTpIn(), INT_0));
+        decisionReq.setTpInName(DecimalUtils.getAbsAndScale(decisionReq.getTpInName(), INT_0));
+        decisionReq.setTpOff(DecimalUtils.getAbsAndScale(decisionReq.getTpOff(), INT_0));
+        decisionReq.setTpOffName(DecimalUtils.getAbsAndScale(decisionReq.getTpOffName(), INT_0));
+        decisionReq.setTpOffCon(DecimalUtils.getAbsAndScale(decisionReq.getTpOffCon(), INT_0));
+        decisionReq.setTnIn(DecimalUtils.getAbsAndScale(decisionReq.getTnIn(), INT_0));
+        decisionReq.setTnInName(DecimalUtils.getAbsAndScale(decisionReq.getTnInName(), INT_0));
+        decisionReq.setTnOff(DecimalUtils.getAbsAndScale(decisionReq.getTnOff(), INT_0));
+        decisionReq.setTnOffName(DecimalUtils.getAbsAndScale(decisionReq.getTnOffName(), INT_0));
+        decisionReq.setTnOffCon(DecimalUtils.getAbsAndScale(decisionReq.getTnOffCon(), INT_0));
+        decisionReq.setAddanIn(DecimalUtils.getAbsAndScale(decisionReq.getAddanIn(), INT_0));
+        decisionReq.setAddanInName(DecimalUtils.getAbsAndScale(decisionReq.getAddanInName(), INT_0));
+        decisionReq.setAndanOff(DecimalUtils.getAbsAndScale(decisionReq.getAndanOff(), INT_0));
+        decisionReq.setAndanOffName(DecimalUtils.getAbsAndScale(decisionReq.getAndanOffName(), INT_0));
+        decisionReq.setAndanOffCon(DecimalUtils.getAbsAndScale(decisionReq.getAndanOffCon(), INT_0));
+        decisionReq.setSsIn(DecimalUtils.getAbsAndScale(decisionReq.getSsIn(), INT_0));
+        decisionReq.setSsInName(DecimalUtils.getAbsAndScale(decisionReq.getSsInName(), INT_0));
+        decisionReq.setSsOff(DecimalUtils.getAbsAndScale(decisionReq.getSsOff(), INT_0));
+        decisionReq.setSsOffName(DecimalUtils.getAbsAndScale(decisionReq.getSsOffName(), INT_0));
+        decisionReq.setSsOffCon(DecimalUtils.getAbsAndScale(decisionReq.getSsOffCon(), INT_0));
+        decisionReq.setTdsIn(DecimalUtils.getAbsAndScale(decisionReq.getTdsIn(), INT_0));
+        decisionReq.setTdsInName(DecimalUtils.getAbsAndScale(decisionReq.getTdsInName(), INT_0));
+        decisionReq.setT(DecimalUtils.getAbsAndScale(daily.getJsSw(), MyConstants.INT_0));
+        decisionReq.setPH(DecimalUtils.getAbsAndScale(decisionReq.getPH(), INT_0));
+        decisionReq.setQIn(DecimalUtils.getAbsAndScale(decisionReq.getQIn(), INT_0));
+        decisionReq.setQInName(DecimalUtils.getAbsAndScale(decisionReq.getQInName(), INT_0));
+        decisionReq.setCheckRise(DecimalUtils.getAbsAndScaleStr(decisionReq.getCheckRise(), INT_0));
+        decisionReq.setSVI(DecimalUtils.getAbsForArray(daily.getWntjzsAll(), INT_0));
+        decisionReq.setSviCon(DecimalUtils.getAbsAndScale(decisionReq.getSviCon(), INT_0));
+        decisionReq.setSV(DecimalUtils.getAbsForArray(daily.getWncjbAll(), INT_0));
+        decisionReq.setSvCon(DecimalUtils.getAbsAndScale(decisionReq.getSviCon(), INT_0));
+        decisionReq.setMlvss(DecimalUtils.getAbsForArray(daily.getHfxwnndAll(), INT_0));
+        decisionReq.setMlss(DecimalUtils.getAbsForArray(daily.getHycWnndAll(), INT_0));
+        decisionReq.setMlvssWentai(DecimalUtils.getAbsAndScaleStr(decisionReq.getMlvssWentai(), INT_0));
+        decisionReq.setMlssWentai(DecimalUtils.getAbsAndScaleStr(decisionReq.getMlssWentai(), INT_0));
+        decisionReq.setDoAna(DecimalUtils.getAbsForArray(daily.getYycRjyAll(), INT_1));
+        decisionReq.setDoO(DecimalUtils.getAbsForArray(daily.getHycRjyAll(), INT_1));
+        decisionReq.setDoQue(DecimalUtils.getAbsForArray(daily.getQycRjyAll(), INT_1));
+        // decisionReq.setDoQueWentai(DecimalUtils.getAbsAndScaleStr(decisionReq.getDoQueWentai(), INT_0));
+        // decisionReq.setDoAnaWentai(DecimalUtils.getAbsAndScaleStr(decisionReq.getDoAnaWentai(), INT_0));
+        // decisionReq.setDoOWentai(DecimalUtils.getAbsAndScaleStr(decisionReq.getDoAnaWentai(), INT_0));
+        decisionReq.setC(DecimalUtils.getAbsAndScale(decisionReq.getC(), INT_0));
+        decisionReq.setB(DecimalUtils.getAbsAndScale(decisionReq.getB(), INT_0));
+        decisionReq.setBtpWending(DecimalUtils.getAbsAndScaleStr(decisionReq.getBtpWending(), INT_0));
+        decisionReq.setJsTnWentai(DecimalUtils.getAbsAndScaleStr(decisionReq.getJsTnWentai(), INT_0));
+        decisionReq.setClP04YCZ(DecimalUtils.getAbsAndScale(decisionReq.getClP04YCZ(), INT_0));
+        decisionReq.setTpLv(DecimalUtils.getAbsAndScale(decisionReq.getTpLv(), INT_0));
+        decisionReq.setTpLvContinuity(DecimalUtils.getAbsAndScale(decisionReq.getTpLvContinuity(), INT_0));
+        // 碳源投加量 2位
+        decisionReq.setTyjyl(DecimalUtils.getAbsAndScaleStr(decisionReq.getTyjyl(), INT_2));
+        decisionReq.setCltjl(DecimalUtils.getAbsAndScaleStr(decisionReq.getCltjl(), INT_0));
+        decisionReq.setHycxsyAll(DecimalUtils.getAbsForArray(decisionReq.getHycxsyAll(), INT_0));
+        decisionReq.setQyanAll(DecimalUtils.getAbsForArray(decisionReq.getQyanAll(), INT_0));
+        decisionReq.setQyckxsyAll(DecimalUtils.getAbsForArray(decisionReq.getQyckxsyAll(), INT_0));
+        decisionReq.setGwnl(DecimalUtils.getAbsAndScale(daily.getGWNL(), INT_0));
+        decisionReq.setEccZl(DecimalUtils.getAbsAndScaleStr(decisionReq.getEccZl(), INT_0));
+        decisionReq.setHyzlsyAll(DecimalUtils.getAbsForArray(decisionReq.getHyzlsyAll(), INT_0));
+        decisionReq.setR(DecimalUtils.getAbsAndScale(daily.getNhlR(), INT_0));
+        decisionReq.setRR(DecimalUtils.getAbsAndScale(daily.getWhlR(), INT_0));
+        BigDecimal jsBod5 = daily.getJsBod5();
+        BigDecimal tpIn = decisionReq.getTpIn();
+        BigDecimal tnIn = decisionReq.getTnIn();
+        decisionReq.setBodIn(DecimalUtils.getAbsAndScale(daily.getJsBod5(), INT_0));
+        if(!Objects.isNull(jsBod5)){
+            if(!Objects.isNull(tpIn) && tpIn.compareTo(new BigDecimal("0")) >0){
+                decisionReq.setC(DecimalUtils.getAbsAndScale(jsBod5.divide(tpIn, 4, RoundingMode.HALF_UP), INT_0));
+            }
+            if(!Objects.isNull(tnIn) && tnIn.compareTo(new BigDecimal("0")) >0){
+                decisionReq.setC(DecimalUtils.getAbsAndScale(jsBod5.divide(tnIn, 4, RoundingMode.HALF_UP), INT_0));
+            }
+        }
+        // decisionReq.setT(DecimalUtils.getAbsAndScale(daily.getJsSw(), MyConstants.INT_0));
+        // decisionReq.setSVI(daily.getWntjzsAll());
+        // decisionReq.setSV(daily.getWncjbAll());
+        // decisionReq.setMlvss(daily.getHfxwnndAll());
+        //2024年7月2日17:20:12  mlss和DO_O也要从日报获取
+        // decisionReq.setMlss(daily.getHycWnndAll());
+        // decisionReq.setDoO(daily.getHycRjyAll());
+        // decisionReq.setDoAna(daily.getYycRjyAll());
+        // decisionReq.setDoQue(daily.getQycRjyAll());
+        //2024年5月26日11:59:02 干污泥量数据做了同步
+        // decisionReq.setGwnl(daily.getGWNL());
+        // BigDecimal jsBod5 = daily.getJsBod5();
+        // decisionReq.setBodIn(jsBod5);
+        // BigDecimal tpIn = decisionReq.getTpIn();
+        // BigDecimal tnIn = decisionReq.getTnIn();
+        // if(!Objects.isNull(jsBod5)){
+        //     if(!Objects.isNull(tpIn) && tpIn.compareTo(new BigDecimal("0")) >0){
+        //         decisionReq.setC(jsBod5.divide(tpIn, 4, RoundingMode.HALF_UP));
+        //     }
+        //     if(!Objects.isNull(tnIn) && tnIn.compareTo(new BigDecimal("0")) >0){
+        //         decisionReq.setB(jsBod5.divide(tnIn, 4, RoundingMode.HALF_UP));
+        //     }
+        // }
+        //2024年6月1日08:37:09 内回流加上
+        // decisionReq.setR(daily.getNhlR());
+        // decisionReq.setRR(daily.getWhlR());
+        return decisionReq;
+
+    }
+
+}

+ 121 - 0
slibra-quartz/src/main/java/com/slibra/quartz/business/JsCsFormatData.java

@@ -0,0 +1,121 @@
+package com.slibra.quartz.business;
+
+
+import com.alibaba.fastjson2.JSONArray;
+import com.alibaba.fastjson2.JSONObject;
+import com.slibra.business.domain.TXinyiIndustry;
+import com.slibra.business.domain.TXinyiNormConfig;
+import com.slibra.business.domain.TXinyiRobot;
+import com.slibra.business.mapper.TXinyiRobotMapper;
+import com.slibra.common.DecimalUtils;
+import com.slibra.common.constant.MyConstants;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+import org.springframework.util.CollectionUtils;
+
+import java.math.BigDecimal;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Objects;
+import java.util.stream.Collectors;
+
+import static com.slibra.common.constant.MyConstants.INT_2;
+
+@Component
+public class JsCsFormatData {
+
+    @Autowired
+    private TXinyiRobotMapper xinyiRobotMapper;
+
+    public JSONObject getJsonObject(TXinyiIndustry tXinyiIndustry, TXinyiNormConfig normConfig) {
+        JSONObject jsData = new JSONObject();
+        HashMap<Object, Object> temp1 = new HashMap<>();
+        BigDecimal jsSlq = tXinyiIndustry.getJsSlq();
+        temp1.put("value", DecimalUtils.getAbsAndScale(jsSlq, INT_2));
+        temp1.put("exceed", jsSlq.compareTo(normConfig.getJsslSjz()) >0);
+        jsData.put("流量", temp1);
+        HashMap<Object, Object> temp2 = new HashMap<>();
+        BigDecimal jsCod = tXinyiIndustry.getJsCod();
+        temp2.put("value", DecimalUtils.getAbsAndScale(jsCod, INT_2));
+        temp2.put("exceed", jsCod.compareTo(normConfig.getJscodSjz()) > 0);
+        jsData.put("COD", temp2);
+        HashMap<Object, Object> temp3 = new HashMap<>();
+        BigDecimal jsNh3 = tXinyiIndustry.getJsNh3();
+        temp3.put("value", DecimalUtils.getAbsAndScale(jsNh3, INT_2));
+        temp3.put("exceed", jsNh3.compareTo(normConfig.getJsadSjz()) > 0);
+        jsData.put("NH3-N", temp3);
+        HashMap<Object, Object> temp4 = new HashMap<>();
+        BigDecimal jsTp = tXinyiIndustry.getJsTp();
+        temp4.put("value", DecimalUtils.getAbsAndScale(jsTp, INT_2));
+        temp4.put("exceed", jsTp.compareTo(normConfig.getJszlSjz()) > 0);
+        jsData.put("TP", temp4);
+        HashMap<Object, Object> temp5 = new HashMap<>();
+        BigDecimal jsSs = tXinyiIndustry.getJsSs();
+        temp5.put("value", DecimalUtils.getAbsAndScale(jsSs, INT_2));
+        temp5.put("exceed", jsSs.compareTo(normConfig.getJsssSjz()) > 0);
+        jsData.put("SS", temp5);
+        HashMap<Object, Object> temp6 = new HashMap<>();
+        BigDecimal jsTn = tXinyiIndustry.getJsTn();
+        temp6.put("value", DecimalUtils.getAbsAndScale(jsTn, INT_2));
+        temp6.put("exceed", jsTn.compareTo(normConfig.getJszdSjz()) > 0);
+        jsData.put("TN", temp6);
+        return jsData;
+    }
+
+    public JSONObject getCsonObject(TXinyiIndustry tXinyiIndustry, TXinyiNormConfig normConfig) {
+
+        JSONObject csData = new JSONObject();
+
+        // 出水cod - 连续检测
+        HashMap<Object, Object> temp1 = new HashMap<>();
+        BigDecimal csCod = tXinyiIndustry.getCsCod();
+        temp1.put("value", DecimalUtils.getAbsAndScale(csCod, INT_2));
+        temp1.put("exceed", csCod.compareTo(normConfig.getCscodGkz()) > 0);
+        csData.put("COD", temp1);
+
+        // 好氧池硝酸盐 | 二沉池正磷酸盐 | 连续监测 - 化验室
+        List<TXinyiRobot> tXinyiRobots = this.xinyiRobotMapper.selectNRobot(1);
+        if ( !CollectionUtils.isEmpty(tXinyiRobots) ) {
+            BigDecimal csTp = tXinyiIndustry.getCsTp();
+
+            TXinyiRobot tXinyiRobot = tXinyiRobots.get(0);
+            BigDecimal hl1Jqr = tXinyiRobot.getTpHl1Jqr();
+            BigDecimal hl2Jqr = tXinyiRobot.getTpHl2Jqr();
+            BigDecimal tpRccJqr = tXinyiRobot.getTpRccJqr();
+
+            HashMap<Object, Object> temp2 = new HashMap<>();
+            HashMap<Object, Object> temp3 = new HashMap<>();
+            HashMap<Object, Object> temp4 = new HashMap<>();
+
+            temp2.put("value", DecimalUtils.getAbsAndScale(hl1Jqr, INT_2));
+            temp2.put("exceed", Objects.isNull(hl1Jqr) ?  false : hl1Jqr.compareTo(normConfig.getCszzGkz()) > 0);
+
+            temp3.put("value", DecimalUtils.getAbsAndScale(hl2Jqr, INT_2));
+            temp3.put("exceed", Objects.isNull(hl2Jqr) ?  false : hl1Jqr.compareTo(normConfig.getCszzGkz()) > 0);
+
+            temp4.put("value", DecimalUtils.getAbsAndScale(tpRccJqr, INT_2));
+            temp4.put("exceed", Objects.isNull(tpRccJqr) ? false : csTp.compareTo(normConfig.getCszlGkz()) > 0);
+
+            csData.put("HYC1", temp2);
+            csData.put("HYC2", temp3);
+            csData.put("TP", temp4);
+        }
+
+        // 出水氨氮 | 在线仪表 - 工业
+        HashMap<Object, Object> temp3 = new HashMap<>();
+        BigDecimal csNh3 = tXinyiIndustry.getCsNh3();
+        temp3.put("value", DecimalUtils.getAbsAndScale(csNh3, INT_2));
+        temp3.put("exceed", csNh3.compareTo(normConfig.getCsadGkz()) > 0);
+        csData.put("NH3-N", temp3);
+
+        // 出水SS | 在线仪表 - 工业
+        HashMap<Object, Object> temp5 = new HashMap<>();
+        BigDecimal csSs = tXinyiIndustry.getCsSs();
+        temp5.put("value", DecimalUtils.getAbsAndScale(csSs, INT_2));
+        temp5.put("exceed", csSs.compareTo(normConfig.getCsssGkz()) > 0);
+        csData.put("SS", temp5);
+
+        return csData;
+    }
+
+}

+ 41 - 30
slibra-quartz/src/main/java/com/slibra/quartz/task/AsyncTask.java

@@ -13,11 +13,15 @@ import com.slibra.business.res.ShowValueSHBasic;
 import com.slibra.common.DecimalUtils;
 import com.slibra.common.config.BigModelConfig;
 import com.slibra.common.constant.MyConstants;
+import com.slibra.common.core.domain.DecisionReq;
+import com.slibra.common.core.domain.TXinyiDaily;
 import com.slibra.common.enums.BusinessEnum;
 import com.slibra.common.utils.DateUtils;
 import com.slibra.common.utils.LocalDateTimeUtil;
 import com.slibra.common.utils.StringUtils;
+import com.slibra.common.utils.format.WaterFormat;
 import com.slibra.common.utils.uuid.IdUtils;
+import com.slibra.quartz.business.JsCsFormatData;
 import inference.InferenceAPIsServiceGrpc;
 import inference.PredictionResponse;
 import inference.PredictionsRequest;
@@ -73,6 +77,9 @@ public class AsyncTask {
     @Autowired
     private BigModelConfig bigModelConfig;
 
+    @Autowired
+    private JsCsFormatData jsCsFormatData;
+
 
     /**
      *
@@ -1279,34 +1286,38 @@ public class AsyncTask {
         if(!CollectionUtils.isEmpty(decisionReqs)){
             //处理日报数据
             TXinyiDaily daily = this.xinyiDailyMapper.selectNewestData();
+
             for (DecisionReq decisionReq : decisionReqs) {
                 if(!Objects.isNull(daily)){
-                    decisionReq.setT(daily.getJsSw());
-                    decisionReq.setSVI(daily.getWntjzsAll());
-                    decisionReq.setSV(daily.getWncjbAll());
-                    decisionReq.setMlvss(daily.getHfxwnndAll());
-                    //2024年7月2日17:20:12  mlss和DO_O也要从日报获取
-                    decisionReq.setMlss(daily.getHycWnndAll());
-                    decisionReq.setDoO(daily.getHycRjyAll());
-                    decisionReq.setDoAna(daily.getYycRjyAll());
-                    decisionReq.setDoQue(daily.getQycRjyAll());
-                    //2024年5月26日11:59:02 干污泥量数据做了同步
-                    decisionReq.setGwnl(daily.getGWNL());
-                    BigDecimal jsBod5 = daily.getJsBod5();
-                    decisionReq.setBodIn(jsBod5);
-                    BigDecimal tpIn = decisionReq.getTpIn();
-                    BigDecimal tnIn = decisionReq.getTnIn();
-                    if(!Objects.isNull(jsBod5)){
-                        if(!Objects.isNull(tpIn) && tpIn.compareTo(new BigDecimal("0")) >0){
-                            decisionReq.setC(jsBod5.divide(tpIn, 4, RoundingMode.HALF_UP));
-                        }
-                        if(!Objects.isNull(tnIn) && tnIn.compareTo(new BigDecimal("0")) >0){
-                            decisionReq.setB(jsBod5.divide(tnIn, 4, RoundingMode.HALF_UP));
-                        }
-                    }
-                    //2024年6月1日08:37:09 内回流加上
-                    decisionReq.setR(daily.getNhlR());
-                    decisionReq.setRR(daily.getWhlR());
+
+                    WaterFormat.getWaterDecimationData(decisionReq, daily);
+
+                    // decisionReq.setT(daily.getJsSw());
+                    // decisionReq.setSVI(daily.getWntjzsAll());
+                    // decisionReq.setSV(daily.getWncjbAll());
+                    // decisionReq.setMlvss(daily.getHfxwnndAll());
+                    // //2024年7月2日17:20:12  mlss和DO_O也要从日报获取
+                    // decisionReq.setMlss(daily.getHycWnndAll());
+                    // decisionReq.setDoO(daily.getHycRjyAll());
+                    // decisionReq.setDoAna(daily.getYycRjyAll());
+                    // decisionReq.setDoQue(daily.getQycRjyAll());
+                    // //2024年5月26日11:59:02 干污泥量数据做了同步
+                    // decisionReq.setGwnl(daily.getGWNL());
+                    // BigDecimal jsBod5 = daily.getJsBod5();
+                    // decisionReq.setBodIn(jsBod5);
+                    // BigDecimal tpIn = decisionReq.getTpIn();
+                    // BigDecimal tnIn = decisionReq.getTnIn();
+                    // if(!Objects.isNull(jsBod5)){
+                    //     if(!Objects.isNull(tpIn) && tpIn.compareTo(new BigDecimal("0")) >0){
+                    //         decisionReq.setC(jsBod5.divide(tpIn, 4, RoundingMode.HALF_UP));
+                    //     }
+                    //     if(!Objects.isNull(tnIn) && tnIn.compareTo(new BigDecimal("0")) >0){
+                    //         decisionReq.setB(jsBod5.divide(tnIn, 4, RoundingMode.HALF_UP));
+                    //     }
+                    // }
+                    // //2024年6月1日08:37:09 内回流加上
+                    // decisionReq.setR(daily.getNhlR());
+                    // decisionReq.setRR(daily.getWhlR());
                 }
                 //如果是机器人化验室的报警,需要把总磷和总氮,获取化验室对应的数据且计算
                 if(isSpecial){
@@ -1475,9 +1486,9 @@ public class AsyncTask {
         else
             showValueSHBasic.setI(status == 0 ? "预警中" : "已完成");
         result.put("basic", showValueSHBasic);
-        JSONObject jsData = getJsonObject(tXinyiIndustry, normConfig);//进水数据
+        JSONObject jsData = jsCsFormatData.getJsonObject(tXinyiIndustry, normConfig);//进水数据
         result.put("jsData", jsData);
-        JSONObject csData = getCsonObject(tXinyiIndustry, normConfig);//出水数据
+        JSONObject csData = jsCsFormatData.getCsonObject(tXinyiIndustry, normConfig);//出水数据
         result.put("csData", csData);
 //        return JSON.toJSONString(result, JSONWriter.Feature.WriteNulls);
         return JSON.toJSONString(result);
@@ -1562,9 +1573,9 @@ public class AsyncTask {
                 showValueJSBasic.setI(status == 0 ? "预警中" : "已完成");
             result.put("basic", showValueJSBasic);
         }
-        JSONObject jsData = getJsonObject(tXinyiIndustry, normConfig);//进水数据
+        JSONObject jsData = jsCsFormatData.getJsonObject(tXinyiIndustry, normConfig);//进水数据
         result.put("jsData", jsData);
-        JSONObject csData = getCsonObject(tXinyiIndustry, normConfig);//出水数据
+        JSONObject csData = jsCsFormatData.getCsonObject(tXinyiIndustry, normConfig);//出水数据
         result.put("csData", csData);
 //        return JSON.toJSONString(result, JSONWriter.Feature.WriteNulls);
         return JSON.toJSONString(result);

+ 10 - 4
slibra-quartz/src/main/java/com/slibra/quartz/task/RyTask.java

@@ -20,12 +20,14 @@ import com.slibra.business.service.ITXinyiForecastComparisonService;
 import com.slibra.common.DecimalUtils;
 import com.slibra.common.config.BigModelConfig;
 import com.slibra.common.constant.MyConstants;
+import com.slibra.common.core.domain.TXinyiDaily;
 import com.slibra.common.enums.BusinessEnum;
 import com.slibra.common.enums.DataSourceType;
 import com.slibra.common.utils.DateUtils;
 import com.slibra.common.utils.LocalDateTimeUtil;
 import com.slibra.common.utils.uuid.IdUtils;
 import com.slibra.framework.datasource.DynamicDataSourceContextHolder;
+import com.slibra.quartz.business.JsCsFormatData;
 import inference.InferenceAPIsServiceGrpc;
 import inference.PredictionResponse;
 import inference.PredictionsRequest;
@@ -111,6 +113,9 @@ public class RyTask
     @Autowired
     private TXinyiBigTableHourMapper xinyiBigTableHourMapper;
 
+    @Autowired
+    private JsCsFormatData jsCsFormatData;
+
 
 //    public final static StopWatch watch = new StopWatch("task");
     public static final String[] queryTags = {"信义污水厂JS_COD_Value","信义污水厂JS_PH_Value","信义污水厂JS_SS_Value","信义污水厂JS_ZL_Value","信义污水厂JS_ZA_Value","信义污水厂JS_AD_Value","信义污水厂JS_T_Value","信义污水厂进水泵房液位","信义污水厂出水瞬时流量","信义污水厂升级出水COD","信义污水厂升级出水PH","信义污水厂升级出水SS","信义污水厂升级出水TN","信义污水厂升级出水TP","信义污水厂升级出水氨氮","信义污水厂AIT202_Value","信义污水厂AIT203_Value","信义污水厂AIT207_Value","信义污水厂AIT206_Value","信义污水厂AIT209_Value","信义污水厂AIT210_Value","信义污水厂进水TDS","信义污水厂FT101_Value","信义污水厂SWCHHYHLB1_R_Value","信义污水厂SWCHHYHLB2_R_Value","信义污水厂SWCHHYHLB3_R_Value","信义污水厂SWCHHYHLB4_R_Value","信义污水厂SWCHHYHLB5_R_Value","信义污水厂SWCHHYHLB6_R_Value","信义污水厂SWCWNHLB1_R_Value","信义污水厂SWCWNHLB2_R_Value","信义污水厂SWCWNHLB3_R_Value","信义污水厂SWCWNHLB4_R_Value","信义污水厂SWCWNHLB5_R_Value","信义污水厂GFJ1_R_Value","信义污水厂GFJ2_R_Value","信义污水厂GFJ3_R_Value","信义污水厂GFJ4_R_Value","信义污水厂GFJ5_R_Value","信义污水厂GFJ6_R_Value","信义污水厂GFJ1_KQLL_Value","信义污水厂GFJ2_KQLL_Value","信义污水厂GFJ3_KQLL_Value","信义污水厂GFJ4_KQLL_Value","信义污水厂GFJ5_KQLL_Value","信义污水厂GFJ6_KQLL_Value","信义污水厂实际碳源加药量","信义污水厂除磷加药瞬时流量", "信义污水厂_除磷P04预测值_"};
@@ -401,9 +406,10 @@ public class RyTask
 //        basic.put("管控值", tXinyiWarningRecord.getControlVal());
         basic.put("告警级别", tXinyiWarningRecord.getLevel());
         result.put("basic", basic);
-        JSONObject jsData = getJsonObject(tXinyiIndustry, normConfig);//进水数据
+
+        JSONObject jsData = jsCsFormatData.getJsonObject(tXinyiIndustry, normConfig);//进水数据
         result.put("jsData", jsData);
-        JSONObject csData = getCsonObject(tXinyiIndustry, normConfig);//出水数据
+        JSONObject csData = jsCsFormatData.getCsonObject(tXinyiIndustry, normConfig);//出水数据
         result.put("csData", csData);
         return JSON.toJSONString(result, JSONWriter.Feature.WriteNulls);
     }
@@ -452,9 +458,9 @@ public class RyTask
             showValueChartBasic.setI(status == 0 ? "预警中" : "已完成");
 
         result.put("basic", showValueChartBasic);
-        JSONObject jsData = getJsonObject(tXinyiIndustry, normConfig);//进水数据
+        JSONObject jsData = jsCsFormatData.getJsonObject(tXinyiIndustry, normConfig);//进水数据
         result.put("jsData", jsData);
-        JSONObject csData = getCsonObject(tXinyiIndustry, normConfig);//出水数据
+        JSONObject csData = jsCsFormatData.getCsonObject(tXinyiIndustry, normConfig);//出水数据
         result.put("csData", csData);
 //        JSONObject chartsData = getChartsCsonObject(tXinyiIndustry, normConfig);//图表数据 因为展示不同,所以要传过来或者判断
         result.put("chartsData", chartsDataList);

+ 1 - 2
slibra-system/src/main/java/com/slibra/business/mapper/TXinyiDailyMapper.java

@@ -1,12 +1,11 @@
 package com.slibra.business.mapper;
 
-import com.slibra.business.domain.TXinyiDaily;
+import com.slibra.common.core.domain.TXinyiDaily;
 import org.apache.ibatis.annotations.Param;
 
 import java.math.BigDecimal;
 import java.util.HashMap;
 import java.util.List;
-import java.util.Map;
 
 /**
  * 信义日报数据Mapper接口

+ 1 - 2
slibra-system/src/main/java/com/slibra/business/mapper/TXinyiIndustryMapper.java

@@ -5,8 +5,7 @@ import java.util.HashMap;
 import java.util.List;
 
 import com.slibra.business.domain.TXinyiIndustry;
-import com.slibra.business.domain.TXinyiRobot;
-import com.slibra.business.req.DecisionReq;
+import com.slibra.common.core.domain.DecisionReq;
 import org.apache.ibatis.annotations.Param;
 
 /**

+ 1 - 1
slibra-system/src/main/java/com/slibra/business/service/ITXinyiDailyService.java

@@ -1,6 +1,6 @@
 package com.slibra.business.service;
 
-import com.slibra.business.domain.TXinyiDaily;
+import com.slibra.common.core.domain.TXinyiDaily;
 import com.slibra.business.res.XinyiDailySimple;
 
 import java.util.List;

+ 1 - 0
slibra-system/src/main/java/com/slibra/business/service/impl/FrontServiceImpl.java

@@ -11,6 +11,7 @@ import com.slibra.business.res.XinyiDailyFeeSimple;
 import com.slibra.business.res.XinyiIndustrySimple;
 import com.slibra.business.service.IFrontService;
 import com.slibra.common.DecimalUtils;
+import com.slibra.common.core.domain.TXinyiDaily;
 import com.slibra.common.core.redis.RedisCache;
 import com.slibra.common.exception.ServiceException;
 import com.slibra.common.utils.DateUtils;

+ 1 - 3
slibra-system/src/main/java/com/slibra/business/service/impl/TXinyiDailyServiceImpl.java

@@ -2,7 +2,6 @@ package com.slibra.business.service.impl;
 
 import java.math.BigDecimal;
 import java.time.LocalDate;
-import java.time.format.DateTimeFormatter;
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
@@ -10,14 +9,13 @@ import java.util.Objects;
 
 import com.alibaba.fastjson2.JSON;
 import com.slibra.business.domain.TXinyiBigTableHour;
-import com.slibra.business.domain.TXinyiDaily;
+import com.slibra.common.core.domain.TXinyiDaily;
 import com.slibra.business.mapper.TXinyiBigTableHourMapper;
 import com.slibra.business.mapper.TXinyiDailyMapper;
 import com.slibra.business.res.XinyiDailySimple;
 import com.slibra.business.service.ITXinyiDailyService;
 import com.slibra.common.exception.ServiceException;
 import com.slibra.common.utils.DateUtils;
-import com.slibra.common.utils.SecurityUtils;
 import com.slibra.common.utils.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;

+ 1 - 1
slibra-system/src/main/resources/mapper/business/TXinyiIndustryMapper.xml

@@ -430,7 +430,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <!-- todo 以后不用sql拼接实验室数据 处理历史数据并新增字段,直接获取 另外把关联查询改成在java代码中处理
      不用再拼接了 SqlServer同步过来的机器人实验室数据已经有了新的字段
      -->
-    <select id="selectLast10RecordsForDecisionOnlyIndustry" resultType="com.slibra.business.req.DecisionReq">
+    <select id="selectLast10RecordsForDecisionOnlyIndustry" resultType="com.slibra.common.core.domain.DecisionReq">
         SELECT
             a.ID ID,
             a.TEST_DATE testDate,