Explorar o código

数据看板数据合并 并且新增碳源相关的四个指标数据

王苗苗 hai 5 meses
pai
achega
20278d092b

BIN=BIN
.DS_Store


+ 25 - 0
src/main/java/com/xlht/xlhtproject/controller/FrontController.java

@@ -78,6 +78,31 @@ public class FrontController extends BaseController{
         return AjaxResult.success(frontService.smartAddCharList(type, timeBegin, timeEnd));
     }
 
+    /**
+     * 所有指标的数据
+     * 0  进水流量
+     * 1  #1好氧池硝酸盐
+     * 2  #2好氧池硝酸盐
+     * 3  #1缺氧池氨氮
+     * 4  #2缺氧池氨氮
+     * 5  进水COD--连续检测
+     * 6  进水COD--在线仪表
+     * 7  进水总氮
+     * 8  碳源投加量-#1-计算投药量
+     * 9  碳源投加量-#2-计算投药量
+     * 10 碳源投加量-#1-组态反馈
+     * 11 碳源投加量-#2-组态反馈
+     * @param timeBegin
+     * @param timeEnd
+     * @return
+     */
+    @GetMapping("/bigModel/smartAdd/charListAll")
+    public AjaxResult smartAddCharListAll(@RequestParam(required = false, name = "timeBegin") String timeBegin, @RequestParam(required = false, name = "timeEnd") String timeEnd)
+    {
+        log.info("进入了 智能投药系统获取对应指标最近1天的数据情况 接口");
+        return AjaxResult.success(frontService.smartAddCharListAll(timeBegin, timeEnd));
+    }
+
 
 
     /**

+ 4 - 0
src/main/java/com/xlht/xlhtproject/controller/ScheduledTasks.java

@@ -13,6 +13,7 @@ import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Component;
 
 import java.math.BigDecimal;
+import java.util.Date;
 import java.util.Objects;
 import java.util.concurrent.TimeUnit;
 
@@ -115,6 +116,9 @@ public class ScheduledTasks {
             xlhtAddRecord.setTwoAmount(val2);
             xlhtAddRecord.setRealOneAmount(tTbXie.getOneJYL());
             xlhtAddRecord.setRealTwoAmount(tTbXie.getTwoJYL());
+            Date nowDate = DateUtils.getNowDate();
+            xlhtAddRecord.setCreateTime(nowDate);
+            xlhtAddRecord.setRemark(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, nowDate));
             this.xlhtAddRecordMapper.insertTXlhtAddRecord(xlhtAddRecord);
         }
         log.info("进入了定时投药的逻辑处理--结束");

+ 8 - 0
src/main/java/com/xlht/xlhtproject/domain/TXlhtAddRecord.java

@@ -51,4 +51,12 @@ public class TXlhtAddRecord extends BaseEntity
     private Long revision;
 
 
+    //下面是查询参数
+    /**  开始时间 */
+    private String timeBegin;
+
+    /** 截止时间 */
+    private String timeEnd;
+
+
 }

+ 2 - 0
src/main/java/com/xlht/xlhtproject/service/IFrontService.java

@@ -15,4 +15,6 @@ public interface IFrontService {
     Map<String, List<ChartBasic>> smartAddCharList(int type, String timeBegin, String timeEnd);
 
     HomeCountInfo homeCountInfo();
+
+    List<Map<String, List<ChartBasic>>> smartAddCharListAll(String timeBegin, String timeEnd);
 }

+ 111 - 4
src/main/java/com/xlht/xlhtproject/service/impl/FrontServiceImpl.java

@@ -2,10 +2,7 @@ package com.xlht.xlhtproject.service.impl;
 
 import com.xlht.xlhtproject.domain.*;
 import com.xlht.xlhtproject.enums.BusinessEnum;
-import com.xlht.xlhtproject.mapper.TShuju1Mapper;
-import com.xlht.xlhtproject.mapper.TTbXieMapper;
-import com.xlht.xlhtproject.mapper.ZAssayMapper;
-import com.xlht.xlhtproject.mapper.ZAssayResultMapper;
+import com.xlht.xlhtproject.mapper.*;
 import com.xlht.xlhtproject.service.IFrontService;
 import com.xlht.xlhtproject.utils.DateUtils;
 import com.xlht.xlhtproject.utils.StringUtils;
@@ -32,6 +29,9 @@ public class FrontServiceImpl implements IFrontService {
     @Autowired
     private ZAssayMapper zAssayMapper;
 
+    @Autowired
+    private TXlhtAddRecordMapper xlhtAddRecordMapper;
+
     @Autowired
     private ZAssayResultMapper zAssayResultMapper;
 
@@ -120,6 +120,111 @@ public class FrontServiceImpl implements IFrontService {
         return result;
     }
 
+
+    /**
+     *
+     * 0  进水流量
+     * 1  #1好氧池硝酸盐
+     * 2  #2好氧池硝酸盐
+     * 3  #1缺氧池氨氮
+     * 4  #2缺氧池氨氮
+     * 5  进水COD--连续检测
+     * 6  进水COD--在线仪表
+     * 7  进水总氮
+     * 8  碳源投加量-#1-计算投药量
+     * 9  碳源投加量-#2-计算投药量
+     * 10 碳源投加量-#1-组态反馈
+     * 11 碳源投加量-#2-组态反馈
+     * @param timeBegin
+     * @param timeEnd
+     * @return
+     */
+    @Override
+    public List<Map<String, List<ChartBasic>>> smartAddCharListAll(String timeBegin, String timeEnd) {
+        List<Map<String, List<ChartBasic>>> result = new ArrayList<>();
+        //日期兜底处理
+        Date nowDate = DateUtils.getNowDate();
+        Date dayBefore7 = DateUtils.plusDate(-1, nowDate);
+        //2024年09月13日17:02:59 支持前段自定义起止时间
+        //先用日期获取当天和前一天的数据,如果获取不到,则提示错误信息
+        String nowDateStr = StringUtils.isBlank(timeEnd) ? DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, nowDate) : timeEnd;
+        String dayBefore1Str = StringUtils.isBlank(timeBegin) ? DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, dayBefore7) : timeBegin;
+        //获取筛选日期内的所有的数据
+        List<TShuju1> tShuju1List = this.shuju1Mapper.selectTShuju1List(TShuju1.builder().timeBegin(dayBefore1Str).timeEnd(nowDateStr).build());
+        //返回的对象具体内容
+        //进水流量
+        Map<String, List<ChartBasic>> map0 = new HashMap<>();
+        map0.put("0", tShuju1List.stream()
+                .map(o -> new ChartBasic(o.getTIME(), Objects.isNull(o.getScJsZll()) ? null : o.getScJsZll().divide(BigDecimal_2, NUMBER_SCALE_4, RoundingMode.HALF_UP)))
+                .collect(Collectors.toList()));
+        result.add(map0);
+        //#1好氧池硝酸盐
+        Map<String, List<ChartBasic>> map1 = new HashMap<>();
+        map1.put("1", tShuju1List.stream()
+                .map(o -> new ChartBasic(o.getTIME(), o.getJqr1HyXiaodan()))
+                .collect(Collectors.toList()));
+        result.add(map1);
+        //#2好氧池硝酸盐
+        Map<String, List<ChartBasic>> map2 = new HashMap<>();
+        map2.put("2", tShuju1List.stream()
+                .map(o -> new ChartBasic(o.getTIME(), o.getJqr2HyXiaodan()))
+                .collect(Collectors.toList()));
+        result.add(map2);
+        //#1缺氧池氨氮
+        Map<String, List<ChartBasic>> map3 = new HashMap<>();
+        map3.put("3", tShuju1List.stream()
+                .map(o -> new ChartBasic(o.getTIME(), o.getJqr1QyAndan()))
+                .collect(Collectors.toList()));
+        result.add(map3);
+        //#2缺氧池氨氮
+        Map<String, List<ChartBasic>> map4 = new HashMap<>();
+        map4.put("4", tShuju1List.stream()
+                .map(o -> new ChartBasic(o.getTIME(), o.getJqr2QyAndan()))
+                .collect(Collectors.toList()));
+        result.add(map4);
+        //进水COD--连续检测
+        Map<String, List<ChartBasic>> map5 = new HashMap<>();
+        map5.put("5", tShuju1List.stream()
+                .map(o -> new ChartBasic(o.getTIME(), o.getJqrSwcCod()))
+                .collect(Collectors.toList()));
+        result.add(map5);
+        //进水COD--在线仪表
+        Map<String, List<ChartBasic>> map6 = new HashMap<>();
+        map6.put("6", tShuju1List.stream()
+                .map(o -> new ChartBasic(o.getTIME(), o.getScJsCod()))
+                .collect(Collectors.toList()));
+        result.add(map6);
+        //进水总氮
+        Map<String, List<ChartBasic>> map7 = new HashMap<>();
+        map7.put("7", tShuju1List.stream()
+                .map(o -> new ChartBasic(o.getTIME(), o.getScJsZongdan()))
+                .collect(Collectors.toList()));
+        result.add(map7);
+        //处理投加信息
+        List<TXlhtAddRecord> tXlhtAddRecords = xlhtAddRecordMapper.selectTXlhtAddRecordList(TXlhtAddRecord.builder().build());
+        Map<String, List<ChartBasic>> map8 = new HashMap<>();
+        map8.put("8", tXlhtAddRecords.stream()
+                .map(o -> new ChartBasic(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, o.getCreateTime()), o.getOneAmount()))
+                .collect(Collectors.toList()));
+        result.add(map8);
+        Map<String, List<ChartBasic>> map9 = new HashMap<>();
+        map9.put("9", tXlhtAddRecords.stream()
+                .map(o -> new ChartBasic(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, o.getCreateTime()), o.getTwoAmount()))
+                .collect(Collectors.toList()));
+        result.add(map9);
+        Map<String, List<ChartBasic>> map10 = new HashMap<>();
+        map10.put("10", tXlhtAddRecords.stream()
+                .map(o -> new ChartBasic(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, o.getCreateTime()), o.getRealOneAmount()))
+                .collect(Collectors.toList()));
+        result.add(map10);
+        Map<String, List<ChartBasic>> map11 = new HashMap<>();
+        map11.put("11", tXlhtAddRecords.stream()
+                .map(o -> new ChartBasic(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, o.getCreateTime()), o.getRealTwoAmount()))
+                .collect(Collectors.toList()));
+        result.add(map11);
+        return result;
+    }
+
     @Override
     public HomeCountInfo homeCountInfo() {
         HomeCountInfo build = HomeCountInfo.builder().build();
@@ -140,4 +245,6 @@ public class FrontServiceImpl implements IFrontService {
         build.setTotals(count * INT_7);
         return build;
     }
+
+
 }

+ 19 - 14
src/main/resources/mapper/TXlhtAddRecordMapper.xml

@@ -25,20 +25,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         select id, one_system_add, two_system_add, one_amount, two_amount, real_one_amount, real_two_amount, del_flag, revision, create_by, create_time, update_by, update_time, remark from t_xlht_add_record
     </sql>
 
-    <select id="selectTXlhtAddRecordList" parameterType="TXlhtAddRecord" resultMap="TXlhtAddRecordResult">
-        <include refid="selectTXlhtAddRecordVo"/>
-        <where>
-            1 = 1
-            <if test="oneSystemAdd != null "> and one_system_add = #{oneSystemAdd}</if>
-            <if test="twoSystemAdd != null "> and two_system_add = #{twoSystemAdd}</if>
-            <if test="oneAmount != null "> and one_amount = #{oneAmount}</if>
-            <if test="twoAmount != null "> and two_amount = #{twoAmount}</if>
-            <if test="realOneAmount != null "> and real_one_amount = #{realOneAmount}</if>
-            <if test="realTwoAmount != null "> and real_two_amount = #{realTwoAmount}</if>
-            <if test="revision != null "> and revision = #{revision}</if>
-        </where>
-        and del_flag = 0 order by id desc
-    </select>
 
     <select id="selectTXlhtAddRecordById" parameterType="Long" resultMap="TXlhtAddRecordResult">
         <include refid="selectTXlhtAddRecordVo"/>
@@ -113,4 +99,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         </foreach>
     </delete>
 
+
+    <!-- 下面是新增的,不允许覆盖 -->
+    <select id="selectTXlhtAddRecordList" parameterType="TXlhtAddRecord" resultMap="TXlhtAddRecordResult">
+        <include refid="selectTXlhtAddRecordVo"/>
+        <where>
+            1 = 1
+            <if test="oneSystemAdd != null "> and one_system_add = #{oneSystemAdd}</if>
+            <if test="twoSystemAdd != null "> and two_system_add = #{twoSystemAdd}</if>
+            <if test="oneAmount != null "> and one_amount = #{oneAmount}</if>
+            <if test="twoAmount != null "> and two_amount = #{twoAmount}</if>
+            <if test="realOneAmount != null "> and real_one_amount = #{realOneAmount}</if>
+            <if test="realTwoAmount != null "> and real_two_amount = #{realTwoAmount}</if>
+            <if test="revision != null "> and revision = #{revision}</if>
+            <!-- 下面是新增的SQL检索条件  SqlServer写法-->
+            <if test="timeBegin != null  and timeBegin != ''"> and remark &gt;= #{timeBegin}</if>
+            <if test="timeEnd != null  and timeEnd != ''"> and remark &lt;= #{timeEnd}</if>
+        </where>
+        and del_flag = 0 order by id desc
+    </select>
 </mapper>