فهرست منبع

新增接口给前端使用 以前的查询调整

wangmiaomiao 9 ماه پیش
والد
کامیت
567c25afeb

+ 15 - 0
slibra-admin/src/main/java/com/slibra/web/controller/business/FrontController.java

@@ -1,5 +1,7 @@
 package com.slibra.web.controller.business;
 
+import com.alibaba.fastjson2.JSON;
+import com.alibaba.fastjson2.JSONWriter;
 import com.slibra.business.domain.TXinyiChatRecord;
 import com.slibra.business.domain.TXinyiWarningRecord;
 import com.slibra.business.mapper.*;
@@ -314,6 +316,19 @@ public class FrontController extends BaseController {
         return AjaxResult.success(frontService.forecastList(warningId));
     }
 
+
+    /**
+     * 获取 最新的一条日报相关的费用信息
+     * @return
+     */
+    @GetMapping("/bigModel/daily/recentlyOneFeeInfo")
+    public String recentlyOneFeeInfo()
+    {
+        log.info("进入了 获取 最新的一条日报相关的费用信息  接口");
+        return JSON.toJSONString(success(frontService.recentlyOneFeeInfo()), JSONWriter.Feature.WriteNulls);
+    }
+
+
     //--------------------下面是测试的方法--------------------
     /*@GetMapping("/test/data")
     public void testData(){

+ 3 - 3
slibra-quartz/src/main/java/com/slibra/quartz/task/GetRealTimeData.java

@@ -18,7 +18,7 @@ public class GetRealTimeData {
 
 
 //    public static final String[] queryTags = {"信义污水厂实际碳源加药量"};
-    public static final String[] queryTags = {"信义污水厂除磷加药瞬时流量"};
+    public static final String[] queryTags = {"信义污水厂升级出水TN"};
 
     /**
      * 定时从工业库获取数据
@@ -34,8 +34,8 @@ public class GetRealTimeData {
 
         // 给定时间段的起始时间和结束时间
 
-        LocalDateTime startTime = LocalDateTime.parse("2024-05-27T12:00:00");
-        LocalDateTime endTime = LocalDateTime.parse("2024-05-27T12:01:00");
+        LocalDateTime startTime = LocalDateTime.parse("2024-06-09T23:00:00");
+        LocalDateTime endTime = LocalDateTime.parse("2024-06-09T23:01:00");
 
         // 每个小时的时间格式
         DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");

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

@@ -77,4 +77,6 @@ public interface TXinyiIndustryMapper
     List<HashMap<String, Object>> selectLast10RecordsForDecision();
 
     List<DecisionReq> selectLast10RecordsForDecisionOnlyIndustry();
+
+    TXinyiIndustry selectTXinyiIndustryNewest();
 }

+ 2 - 0
slibra-system/src/main/java/com/slibra/business/mapper/TXinyiRobotMapper.java

@@ -62,4 +62,6 @@ public interface TXinyiRobotMapper
     String selectLastTime();
 
     List<TXinyiRobot> selectTXinyiRobotListByTime(String lastTime);
+
+    TXinyiRobot selectNewest();
 }

+ 79 - 0
slibra-system/src/main/java/com/slibra/business/res/XinyiDailyFeeSimple.java

@@ -0,0 +1,79 @@
+package com.slibra.business.res;
+
+
+import com.alibaba.fastjson2.annotation.JSONField;
+import com.slibra.common.annotation.Excel;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import java.math.BigDecimal;
+
+@Builder
+@Data
+@AllArgsConstructor
+@NoArgsConstructor
+public class XinyiDailyFeeSimple {
+
+
+
+    /** 化验日期 */
+    @Excel(name = "化验日期")
+    @JSONField(name = "testDate")
+    private String testDate;
+
+    /** 电费 */
+    @Excel(name = "电费")
+    @JSONField(name = "DF")
+    private BigDecimal DF;
+
+    /** 絮凝剂费 */
+    @Excel(name = "絮凝剂费")
+    @JSONField(name = "XNJF")
+    private BigDecimal XNJF;
+
+    /** 除磷费 */
+    @Excel(name = "除磷费")
+    @JSONField(name = "CLF")
+    private BigDecimal CLF;
+
+    /** 碳源费 */
+    @Excel(name = "碳源费")
+    @JSONField(name = "TYF")
+    private BigDecimal TYF;
+
+    /** 消毒剂费 */
+    @Excel(name = "消毒剂费")
+    @JSONField(name = "XDJF")
+    private BigDecimal XDJF;
+
+    /** 其他药剂费 */
+    @Excel(name = "其他药剂费")
+    @JSONField(name = "QTYJF")
+    private BigDecimal QTYJF;
+
+    /** 采暖费 */
+    @Excel(name = "采暖费")
+    @JSONField(name = "CNF")
+    private BigDecimal CNF;
+
+    /** 自来水费 */
+    @Excel(name = "自来水费")
+    @JSONField(name = "ZLSF")
+    private BigDecimal ZLSF;
+
+    /** 直接成本 */
+    @Excel(name = "直接成本")
+    @JSONField(name = "ZJCB")
+    private BigDecimal ZJCB;
+
+    /** 单位成本 */
+    @Excel(name = "单位成本")
+    @JSONField(name = "DWCB")
+    private BigDecimal DWCB;
+
+
+
+
+}

+ 20 - 0
slibra-system/src/main/java/com/slibra/business/res/XinyiIndustrySimple.java

@@ -215,6 +215,26 @@ public class XinyiIndustrySimple {
     private BigDecimal csssGkz;
 
 
+    //2024年6月11日16:28:59 新增返回的一些字段(化验室的数据)
+    /** 1#好氧池硝酸盐(内回流)+ 回流进水化验机器人有效值1(硝氮1池回流机器人) */
+    @Excel(name = "1#好氧池硝酸盐", readConverterExp = "内=回流")
+    private BigDecimal no3Hlj1Jqr;
+
+    /** 2#好氧池硝酸盐(内回流) + 回流进水化验机器人有效值2(硝氮2池回流机器人) */
+    @Excel(name = "2#好氧池硝酸盐", readConverterExp = "内=回流")
+    private BigDecimal no3Hlj2Jqr;
+
+    /** 二沉池-正磷酸盐 + 化验机器人正磷化验有效值二沉池(正磷二沉池机器人) */
+    @Excel(name = "二沉池-正磷酸盐 + 化验机器人正磷化验有效值二沉池", readConverterExp = "正=磷二沉池机器人")
+    private BigDecimal tpRccJqr;
+
+    /** 1#缺氧氨氮 + 化验机器人氨氮化验有效值1(氨氮1池缺氧机器人) */
+    @Excel(name = "1#缺氧氨氮 + 化验机器人氨氮化验有效值1", readConverterExp = "氨=氮1池缺氧机器人")
+    private BigDecimal nh31Jqr;
+
+    /** 2#缺氧氨氮 + 化验机器人氨氮化验有效值2(氨氮2池缺氧机器人) */
+    @Excel(name = "2#缺氧氨氮 + 化验机器人氨氮化验有效值2", readConverterExp = "氨=氮2池缺氧机器人")
+    private BigDecimal nh32Jqr;
 
 
 }

+ 3 - 0
slibra-system/src/main/java/com/slibra/business/service/IFrontService.java

@@ -4,6 +4,7 @@ import com.slibra.business.domain.TXinyiChatRecord;
 import com.slibra.business.domain.TXinyiRecommendQa;
 import com.slibra.business.domain.TXinyiWarningRecord;
 import com.slibra.business.req.ChatReq;
+import com.slibra.business.res.XinyiDailyFeeSimple;
 import com.slibra.business.res.XinyiIndustrySimple;
 
 import java.util.List;
@@ -34,4 +35,6 @@ public interface IFrontService
     TXinyiChatRecord getLeastShortReport();
 
     List<TXinyiChatRecord> forecastList(String warningId);
+
+    XinyiDailyFeeSimple recentlyOneFeeInfo();
 }

+ 28 - 4
slibra-system/src/main/java/com/slibra/business/service/impl/FrontServiceImpl.java

@@ -7,6 +7,7 @@ import com.alibaba.fastjson2.JSONArray;
 import com.slibra.business.domain.*;
 import com.slibra.business.mapper.*;
 import com.slibra.business.req.ChatReq;
+import com.slibra.business.res.XinyiDailyFeeSimple;
 import com.slibra.business.res.XinyiIndustrySimple;
 import com.slibra.business.service.IFrontService;
 import com.slibra.common.exception.ServiceException;
@@ -39,6 +40,9 @@ public class FrontServiceImpl implements IFrontService {
     @Autowired
     private TXinyiDailyMapper xinyiDailyMapper;
 
+    @Autowired
+    private TXinyiRobotMapper xinyiRobotMapper;
+
     @Autowired
     private TXinyiNormConfigMapper tXinyiNormConfigMapper;
 
@@ -143,6 +147,16 @@ public class FrontServiceImpl implements IFrontService {
         return this.xinyiChatRecordMapper.selectTXinyiChatRecordList(TXinyiChatRecord.builder().warningId(warningId).type(3).build());
     }
 
+    @Override
+    public XinyiDailyFeeSimple recentlyOneFeeInfo() {
+        //获取最新的一条日报
+        TXinyiDaily tXinyiDaily = this.xinyiDailyMapper.selectNewestData();
+        XinyiDailyFeeSimple xinyiDailyFeeSimple = new XinyiDailyFeeSimple();
+        if(!Objects.isNull(tXinyiDaily))
+            BeanUtils.copyProperties(tXinyiDaily, xinyiDailyFeeSimple);
+        return xinyiDailyFeeSimple;
+    }
+
     private XinyiIndustrySimple calculateData(XinyiIndustrySimple xinyiIndustrySimple, LocalDateTime nowTime) {
         LocalDateTime yesterdaySameTime = nowTime.plusDays(-1);
         DateTimeFormatter formatter = DateTimeFormatter.ofPattern(DateUtils.YYYYMMDDHH_TS);
@@ -243,10 +257,10 @@ public class FrontServiceImpl implements IFrontService {
 
     private XinyiIndustrySimple getRealTimeData(String[] queryTags, LocalDateTime nowTime) {
 
-        AtomicReference<XinyiIndustrySimple> result = new AtomicReference<>();
+        /*AtomicReference<XinyiIndustrySimple> result = new AtomicReference<>();
 
-        /*String time = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH, DateUtils.getNowDate());
-        time = time + ":00:00";*/
+        *//*String time = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH, DateUtils.getNowDate());
+        time = time + ":00:00";*//*
         DateTimeFormatter formatter = DateTimeFormatter.ofPattern(DateUtils.YYYY_MM_DD_HH_MM_SS);
 
         //获取当前的时间
@@ -358,7 +372,17 @@ public class FrontServiceImpl implements IFrontService {
             });
         }
         XinyiIndustrySimple xinyiIndustrySimple = result.get();
-        return Objects.isNull(xinyiIndustrySimple) ? new XinyiIndustrySimple() : xinyiIndustrySimple;
+        return Objects.isNull(xinyiIndustrySimple) ? new XinyiIndustrySimple() : xinyiIndustrySimple;*/
+        //2024年6月11日16:16:17 逻辑调整,获取最新的那条工业库的数据
+        TXinyiIndustry tXinyiIndustry = this.xinyiIndustryMapper.selectTXinyiIndustryNewest();
+        XinyiIndustrySimple xinyiIndustrySimple = new XinyiIndustrySimple();
+        if(!Objects.isNull(tXinyiIndustry))
+            BeanUtils.copyProperties(tXinyiIndustry, xinyiIndustrySimple);
+        //获取化验室的最新的一条数据
+        TXinyiRobot tXinyiRobot = this.xinyiRobotMapper.selectNewest();
+        if(!Objects.isNull(tXinyiRobot))
+            BeanUtils.copyProperties(tXinyiRobot, xinyiIndustrySimple);
+        return xinyiIndustrySimple;
     }
 
 

+ 3 - 3
slibra-system/src/main/resources/mapper/business/TXinyiDailyMapper.xml

@@ -162,7 +162,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="ZJCB != null "> and ZJCB = #{ZJCB}</if>
             <if test="DWCB != null "> and DWCB = #{DWCB}</if>
         </where>
-        order by id desc
+        order by TEST_DATE desc
     </select>
 
     <select id="selectTXinyiDailyByID" parameterType="Long" resultMap="TXinyiDailyResult">
@@ -428,12 +428,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </select>
 
     <select id="selectNewestData" resultMap="TXinyiDailyResult">
-        <include refid="selectTXinyiDailyVo"/> order by id desc limit 1
+        <include refid="selectTXinyiDailyVo"/> order by TEST_DATE desc limit 1
     </select>
 
 
     <select id="selectNRecords" resultMap="TXinyiDailyResult">
-        <include refid="selectTXinyiDailyVo"/> order by id desc limit #{size}
+        <include refid="selectTXinyiDailyVo"/> order by TEST_DATE desc limit #{size}
     </select>
 
     <select id="getDetailByDay" resultMap="TXinyiDailyResult">

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

@@ -513,4 +513,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             a.ID DESC
             LIMIT 0,10
     </select>
+
+
+    <select id="selectTXinyiIndustryNewest" resultMap="TXinyiIndustryResult">
+        <include refid="selectTXinyiIndustryVo"/>
+        order by id desc limit 1
+    </select>
 </mapper>

+ 5 - 0
slibra-system/src/main/resources/mapper/business/TXinyiRobotMapper.xml

@@ -235,4 +235,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <include refid="selectTXinyiSqlServer"/> where 1 = 1
         <if test="lastTime != null  and lastTime != ''"> and CONVERT ( datetime, LTRIM( RTRIM( V_DATE ) ) + ' ' + LTRIM( RTRIM( V_TIME ) ) ) > = #{lastTime}</if>
     </select>
+
+
+    <select id="selectNewest" resultMap="TXinyiRobotResult">
+        <include refid="selectTXinyiRobotVo"/> order by id desc limit 1
+    </select>
 </mapper>