From dc6ef1a3c464d55e8a7ffb23433cc0cb56232aeb Mon Sep 17 00:00:00 2001
From: nieziyan <nzyone@qq.com>
Date: Wed, 30 Aug 2023 16:29:28 +0800
Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9A=E5=AE=8C=E5=96=84?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../service/impl/SysDatabaseServiceImpl.java  |  4 +++-
 .../service/impl/SysServerServiceImpl.java    |  4 +++-
 .../modules/mapper/StationMetDataMapper.java  |  3 +++
 .../mapper/StationSampleDataMapper.java       |  2 ++
 .../modules/mapper/StationSohDataMapper.java  |  5 ++--
 .../mapper/xml/stationSampleDataMapper.xml    |  2 +-
 .../mapper/xml/stationSohDataMapper.xml       |  3 +--
 .../impl/StationOperationServiceImpl.java     | 23 +++++++++++++------
 8 files changed, 32 insertions(+), 14 deletions(-)

diff --git a/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/service/impl/SysDatabaseServiceImpl.java b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/service/impl/SysDatabaseServiceImpl.java
index 06e754d6..74965c4f 100644
--- a/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/service/impl/SysDatabaseServiceImpl.java
+++ b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/service/impl/SysDatabaseServiceImpl.java
@@ -167,8 +167,10 @@ public class SysDatabaseServiceImpl extends ServiceImpl<SysDatabaseMapper, SysDa
     @Override
     public List<SourceDto> listAll() {
         LambdaQueryWrapper<SysDatabase> wrapper = new LambdaQueryWrapper<>();
+        wrapper.orderByDesc(SysDatabase::getStatus);
+        wrapper.orderByAsc(SysDatabase::getName);
         List<SourceDto> sourceDtos = new ArrayList<>();
-        for (SysDatabase sysDatabase : list()) {
+        for (SysDatabase sysDatabase : list(wrapper)) {
             SourceDto sourceDto = new SourceDto();
             sourceDto.setSourceId(sysDatabase.getId());
             sourceDto.setSourceName(sysDatabase.getName());
diff --git a/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/service/impl/SysServerServiceImpl.java b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/service/impl/SysServerServiceImpl.java
index 9766e9d1..3c18ab28 100644
--- a/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/service/impl/SysServerServiceImpl.java
+++ b/jeecg-module-abnormal-alarm/src/main/java/org/jeecg/modules/service/impl/SysServerServiceImpl.java
@@ -158,8 +158,10 @@ public class SysServerServiceImpl extends ServiceImpl<SysServerMapper, SysServer
     @Override
     public List<SourceDto> listAll() {
         LambdaQueryWrapper<SysServer> wrapper = new LambdaQueryWrapper<>();
+        wrapper.orderByDesc(SysServer::getStatus);
+        wrapper.orderByAsc(SysServer::getName);
         List<SourceDto> sourceDtos = new ArrayList<>();
-        for (SysServer sysServer : list()) {
+        for (SysServer sysServer : list(wrapper)) {
             SourceDto sourceDto = new SourceDto();
             sourceDto.setSourceId(sysServer.getId());
             sourceDto.setSourceName(sysServer.getName());
diff --git a/jeecg-module-station-operation/src/main/java/org/jeecg/modules/mapper/StationMetDataMapper.java b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/mapper/StationMetDataMapper.java
index 4bd5b650..83822d7c 100644
--- a/jeecg-module-station-operation/src/main/java/org/jeecg/modules/mapper/StationMetDataMapper.java
+++ b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/mapper/StationMetDataMapper.java
@@ -2,12 +2,15 @@ package org.jeecg.modules.mapper;
 
 import com.baomidou.dynamic.datasource.annotation.DS;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 import org.jeecg.modules.base.entity.original.GardsMetData;
+import org.springframework.beans.factory.annotation.Autowired;
 
 import java.util.List;
 
 @DS("ora")
+@Mapper
 public interface StationMetDataMapper extends BaseMapper<GardsMetData> {
 
     List<GardsMetData> findMetDataList(@Param("stationIds") List<String> stationIds, @Param("startDate") String startDate);
diff --git a/jeecg-module-station-operation/src/main/java/org/jeecg/modules/mapper/StationSampleDataMapper.java b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/mapper/StationSampleDataMapper.java
index f534e9c2..d0c234d1 100644
--- a/jeecg-module-station-operation/src/main/java/org/jeecg/modules/mapper/StationSampleDataMapper.java
+++ b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/mapper/StationSampleDataMapper.java
@@ -2,12 +2,14 @@ package org.jeecg.modules.mapper;
 
 import com.baomidou.dynamic.datasource.annotation.DS;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 import org.jeecg.modules.base.entity.original.GardsSampleData;
 
 import java.util.List;
 
 @DS("ora")
+@Mapper
 public interface StationSampleDataMapper extends BaseMapper<GardsSampleData> {
 
     List<GardsSampleData> findSampleDataList(@Param("detectorIds") List<Integer> detectorIds, @Param("startDate") String startDate);
diff --git a/jeecg-module-station-operation/src/main/java/org/jeecg/modules/mapper/StationSohDataMapper.java b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/mapper/StationSohDataMapper.java
index 43048b64..7b5779e2 100644
--- a/jeecg-module-station-operation/src/main/java/org/jeecg/modules/mapper/StationSohDataMapper.java
+++ b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/mapper/StationSohDataMapper.java
@@ -2,15 +2,16 @@ package org.jeecg.modules.mapper;
 
 import com.baomidou.dynamic.datasource.annotation.DS;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
+import org.apache.ibatis.cursor.Cursor;
 import org.jeecg.modules.base.entity.original.GardsSohData;
 
 import java.util.List;
 
 @DS("ora")
+@Mapper
 public interface StationSohDataMapper extends BaseMapper<GardsSohData> {
 
     List<GardsSohData> findSohDataList(@Param("stationId") String stationId, @Param("detectorIds") List<Integer> detectorIds, @Param("startDate") String startDate);
-
-
 }
diff --git a/jeecg-module-station-operation/src/main/java/org/jeecg/modules/mapper/xml/stationSampleDataMapper.xml b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/mapper/xml/stationSampleDataMapper.xml
index 7df1bee2..0d06e88b 100644
--- a/jeecg-module-station-operation/src/main/java/org/jeecg/modules/mapper/xml/stationSampleDataMapper.xml
+++ b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/mapper/xml/stationSampleDataMapper.xml
@@ -20,7 +20,7 @@
                 </foreach>
             </if>
             <if test=" startDate!=null and startDate!='' ">
-                and MODDATE >= TO_DATE(#{startDate}, 'YYYY-MM-DD hh24:mi:ss')
+                and MODDATE >= TO_DATE('${startDate}', 'YYYY-MM-DD hh24:mi:ss')
             </if>
         </where>
         ORDER BY ACQUISITION_STOP
diff --git a/jeecg-module-station-operation/src/main/java/org/jeecg/modules/mapper/xml/stationSohDataMapper.xml b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/mapper/xml/stationSohDataMapper.xml
index 314cd50a..5ea5afe8 100644
--- a/jeecg-module-station-operation/src/main/java/org/jeecg/modules/mapper/xml/stationSohDataMapper.xml
+++ b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/mapper/xml/stationSohDataMapper.xml
@@ -19,9 +19,8 @@
                 and STATION_ID = #{stationId}
             </if>
             <if test=" startDate!=null and startDate!='' ">
-                and MODDATE >= TO_DATE(#{startDate}, 'YYYY-MM-DD hh24:mi:ss')
+                and MODDATE >= TO_DATE('${startDate}', 'YYYY-MM-DD hh24:mi:ss')
             </if>
         </where>
     </select>
-
 </mapper>
\ No newline at end of file
diff --git a/jeecg-module-station-operation/src/main/java/org/jeecg/modules/service/impl/StationOperationServiceImpl.java b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/service/impl/StationOperationServiceImpl.java
index 415130a6..f6be1886 100644
--- a/jeecg-module-station-operation/src/main/java/org/jeecg/modules/service/impl/StationOperationServiceImpl.java
+++ b/jeecg-module-station-operation/src/main/java/org/jeecg/modules/service/impl/StationOperationServiceImpl.java
@@ -1,5 +1,6 @@
 package org.jeecg.modules.service.impl;
 
+import cn.hutool.core.util.StrUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
 import com.baomidou.mybatisplus.core.toolkit.StringUtils;
@@ -116,6 +117,10 @@ public class StationOperationServiceImpl extends ServiceImpl<StationOperationMap
         if (StringUtils.isNotBlank(stationType)){
             result = result.stream().filter(item-> StringUtils.isNotBlank(item.getStationType()) && item.getStationType().equalsIgnoreCase(stationType)).collect(Collectors.toList());
         }
+        // 根据StationId排序
+        result = result.stream()
+                .sorted(Comparator.comparingInt(StationOperation::getStationId))
+                .collect(Collectors.toList());
         return result;
     }
 
@@ -419,6 +424,7 @@ public class StationOperationServiceImpl extends ServiceImpl<StationOperationMap
                         List<GardsSohData> sohDataList = stationSohDataMapper.findSohDataList(stationId, detectorIds, startDateTime);
                         //用于接收当前台站下所有探测器及探测器所有的样品数据,气体数据,状态数据集合
                         List<Map<String, DetectorData>> detectorDataList = new LinkedList<>();
+
                         for (Integer detectorId:detectorIds) {
                             Map<String, DetectorData> detectorMap = new HashMap<>();
                             DetectorData detectorData = new DetectorData();
@@ -432,21 +438,23 @@ public class StationOperationServiceImpl extends ServiceImpl<StationOperationMap
                                     for (GardsSampleData sampleData:dataListSample) {
                                         DataInfoVo dataInfo = new DataInfoVo();
                                         //根据样品数据类型判断 数据类型  根据不同的样品数据状态
-                                        if (sampleData.getDataType().equals("S")){
+                                        String dataType = sampleData.getDataType();
+                                        String spectralQualifie = sampleData.getSpectralQualifie();
+                                        if (StrUtil.equals(dataType,"S")){
                                             dataInfo.setType("PHD");
-                                            if(sampleData.getStatus() == "PREL") {
+                                            if (StrUtil.equals(spectralQualifie,"PREL")){
                                                 dataInfo.setStatus("SPREL");
-                                            } else {
+                                            } else if (StrUtil.equals(spectralQualifie,"FULL")) {
                                                 dataInfo.setStatus("SFULL");
                                             }
-                                        } else if (sampleData.getDataType().equals("Q")){
+                                        } else if (StrUtil.equals(dataType,"Q")){
                                             dataInfo.setType("QC");
                                             dataInfo.setStatus("QC");
-                                        } else if (sampleData.getDataType().equals("G")){
+                                        } else if (StrUtil.equals(dataType,"G")){
                                             dataInfo.setType("PHD");
-                                            if(sampleData.getStatus() == "PREL") {
+                                            if (StrUtil.equals(spectralQualifie,"PREL")){
                                                 dataInfo.setStatus("GPREL");
-                                            } else {
+                                            } else if (StrUtil.equals(spectralQualifie,"FULL")) {
                                                 dataInfo.setStatus("GFULL");
                                             }
                                         } else {
@@ -506,6 +514,7 @@ public class StationOperationServiceImpl extends ServiceImpl<StationOperationMap
                             detectorMap.put(String.valueOf(detectorId), detectorData);
                             detectorDataList.add(detectorMap);
                         }
+
                         stationMap.put(stationId, detectorDataList);
                         stationData.setStationId(stationId);
                         if (CollectionUtils.isNotEmpty(stationInfoMap)){