zjs 3 semanas atrás
pai
commit
6e05e7a098

+ 1 - 0
src/main/java/com/cn/esermis/constant/Constant.java

@@ -8,6 +8,7 @@ public class Constant {
8 8
         public static final  String HOUR = "2061"; //小时值
9 9
         public static final String MINUTE = "2051"; //分钟值
10 10
         public static final String REAL = "2011"; //实时值
11
+        public static final String DAY = "2031"; //日数据
11 12
 
12 13
         public static final  String CN = "CN"; //大气环境污染源
13 14
         public static final  String SERVER = "server"; //大气环境污染源

+ 20 - 22
src/main/java/com/cn/esermis/controller/DataAcquisitionInstrumentController.java

@@ -52,7 +52,7 @@ public class DataAcquisitionInstrumentController {
52 52
             List<DataAcquisitionInstrumentVo> revoList = new ArrayList<>();
53 53
             records.forEach(x->{
54 54
                 DataAcquisitionInstrumentVo instrumentVo = new DataAcquisitionInstrumentVo();
55
-                List<AnalyticalInstruments> analyticalInstruments = analyticalInstrumentsService.list(new QueryWrapper<AnalyticalInstruments>().eq("data_acquisition_instrument_id", x.getId()));
55
+                List<AnalyticalInstruments> analyticalInstruments = analyticalInstrumentsService.getByDataAcquisitionInstrumentid(x.getId());
56 56
                 BeanUtils.copyProperties(x, instrumentVo);
57 57
                 if (!analyticalInstruments.isEmpty()){
58 58
                     List<AnalyticalInstrumentsVo> analyticalInstrumentList = new ArrayList<>();
@@ -60,7 +60,7 @@ public class DataAcquisitionInstrumentController {
60 60
                         AnalyticalInstrumentsVo analyticalInstrumentsVo = new AnalyticalInstrumentsVo();
61 61
                         BeanUtils.copyProperties(y, analyticalInstrumentsVo);
62 62
                         analyticalInstrumentList.add(analyticalInstrumentsVo);
63
-                        List<DetectMonitoringFactor> analyticalInstrumentId = detectMonitoringFactorService.list(new QueryWrapper<DetectMonitoringFactor>().eq("analytical_instrument_id", y.getId()));
63
+                        List<DetectMonitoringFactor> analyticalInstrumentId = detectMonitoringFactorService.listByParentId(y.getId());
64 64
                         if (!analyticalInstrumentId.isEmpty()){
65 65
                             analyticalInstrumentId.forEach(z->{
66 66
                                 analyticalInstrumentsVo.getDetectMonitoringFactors().add(z);
@@ -79,30 +79,26 @@ public class DataAcquisitionInstrumentController {
79 79
     /**
80 80
      * 根据菜单编号获取详细信息
81 81
      */
82
-    @GetMapping(value = "/{id}")
82
+    @GetMapping(value = "delete/{id}")
83 83
     public AjaxResult getInfo(@PathVariable String id)
84 84
     {
85 85
         DataAcquisitionInstrument dataAcquisitionInstrument = dataAcquisitionInstrumentService.getById(id);
86 86
         DataAcquisitionInstrumentVo instrumentVo = new DataAcquisitionInstrumentVo();
87 87
         if (dataAcquisitionInstrument != null){
88 88
             BeanUtils.copyProperties(dataAcquisitionInstrument, instrumentVo);
89
-            List<AnalyticalInstruments> analyticalInstruments = analyticalInstrumentsService.list(new QueryWrapper<AnalyticalInstruments>().eq("data_acquisition_instrument_id", instrumentVo.getId()));
89
+            List<AnalyticalInstruments> analyticalInstruments = analyticalInstrumentsService.getByDataAcquisitionInstrumentid(dataAcquisitionInstrument.getId());
90 90
             if (!analyticalInstruments.isEmpty()){
91 91
                 List<AnalyticalInstrumentsVo> analyticalInstrumentList = new ArrayList<>();
92 92
                 analyticalInstruments.forEach(y->{
93
-                    AnalyticalInstrumentsVo analyticalInstrumentsVo = new AnalyticalInstrumentsVo();
94
-                    BeanUtils.copyProperties(y, analyticalInstrumentsVo);
95
-                    analyticalInstrumentList.add(analyticalInstrumentsVo);
96
-                    List<DetectMonitoringFactor> analyticalInstrumentId = detectMonitoringFactorService.list(new QueryWrapper<DetectMonitoringFactor>().eq("analytical_instrument_id", y.getId()));
97
-                    if (!analyticalInstrumentId.isEmpty()){
98
-                        analyticalInstrumentId.forEach(z->{
99
-                            analyticalInstrumentsVo.getDetectMonitoringFactors().add(z);
100
-                        });
101
-                    }
93
+                    if (y.getId() != null)
94
+                    detectMonitoringFactorService.remove(new QueryWrapper<DetectMonitoringFactor>().eq("analytical_instrument_id", y.getId()));
102 95
                 });
96
+                if (analyticalInstruments.isEmpty())
97
+                analyticalInstrumentsService.remove(new QueryWrapper<AnalyticalInstruments>().eq("data_acquisition_instrument_id", dataAcquisitionInstrument.getId()));
103 98
                 instrumentVo.setAnalyticalInstruments(analyticalInstrumentList);
104 99
             }
105 100
         }
101
+        dataAcquisitionInstrumentService.remove(new QueryWrapper<DataAcquisitionInstrument>().eq("id", id));
106 102
         return success(instrumentVo);
107 103
     }
108 104
 
@@ -117,28 +113,30 @@ public class DataAcquisitionInstrumentController {
117 113
         DataAcquisitionInstrument dataAcquisitionInstrument = new DataAcquisitionInstrument();
118 114
         BeanUtils.copyProperties(vo, dataAcquisitionInstrument);
119 115
         boolean save = dataAcquisitionInstrumentService.saveOrUpdate(dataAcquisitionInstrument);
120
-        if (save){
116
+        if (save && vo.getAnalyticalInstruments()!=null){
121 117
             List<AnalyticalInstrumentsVo> analyticalInstrumentList = vo.getAnalyticalInstruments();
122 118
             // 删除子项 全删全增操作
123 119
             {
124
-                List<AnalyticalInstruments> dataAcquisitionInstrumentId = analyticalInstrumentsService.list(new QueryWrapper<AnalyticalInstruments>().eq("data_acquisition_instrument_id", dataAcquisitionInstrument.getId()));
125
-                if (!dataAcquisitionInstrumentId.isEmpty()){
126
-                    analyticalInstrumentList.forEach(y->{
127
-                        detectMonitoringFactorService.remove(new QueryWrapper<DetectMonitoringFactor>().eq("analytical_instrument_id", y.getId()));
128
-                    });
129
-                    analyticalInstrumentsService.remove(new QueryWrapper<AnalyticalInstruments>().eq("data_acquisition_instrument_id", dataAcquisitionInstrument.getId()));
120
+                if (dataAcquisitionInstrument.getId() != null){
121
+                    List<AnalyticalInstruments> dataAcquisitionInstrumentId = analyticalInstrumentsService.getByDataAcquisitionInstrumentid(dataAcquisitionInstrument.getId());
122
+                    if (!dataAcquisitionInstrumentId.isEmpty()){
123
+                        analyticalInstrumentList.forEach(y->{
124
+                            detectMonitoringFactorService.remove(new QueryWrapper<DetectMonitoringFactor>().eq("analytical_instrument_id", y.getId()));
125
+                        });
126
+                        analyticalInstrumentsService.remove(new QueryWrapper<AnalyticalInstruments>().eq("data_acquisition_instrument_id", dataAcquisitionInstrument.getId()));
127
+                    }
130 128
                 }
131 129
             }
132 130
             // 新增子表
133 131
             analyticalInstrumentList.forEach(x->{
134 132
                 AnalyticalInstruments analyticalInstruments = new AnalyticalInstruments();
135
-                analyticalInstruments.setDataAcquisitionInstrumentId(dataAcquisitionInstrument.getId());
136 133
                 BeanUtils.copyProperties(x, analyticalInstruments);
134
+                analyticalInstruments.setDataAcquisitionInstrumentId(dataAcquisitionInstrument.getId());
137 135
                 boolean save1 = analyticalInstrumentsService.save(analyticalInstruments);
138 136
                 if (save1){
139 137
                     List<DetectMonitoringFactor> detectMonitoringFactors = x.getDetectMonitoringFactors();
140 138
                     detectMonitoringFactors.forEach(y->{
141
-                        y.setAnalytical_instrument_id(analyticalInstruments.getId());
139
+                        y.setAnalyticalInstrumentId(analyticalInstruments.getId());
142 140
                         boolean save2 = detectMonitoringFactorService.save(y);
143 141
                         if (!save2){
144 142
                             throw new RuntimeException("添加失败");

+ 1 - 1
src/main/java/com/cn/esermis/controller/PostMarkingController.java

@@ -16,7 +16,7 @@ import static com.cn.esermis.dpld.model.AjaxResult.success;
16 16
  * 事后标记
17 17
  */
18 18
 @RestController
19
-@RequestMapping("/post_markingC")
19
+@RequestMapping("/post_marking")
20 20
 public class PostMarkingController
21 21
 {
22 22
     @Resource

+ 25 - 12
src/main/java/com/cn/esermis/dpld/business/MonitorBusiness.java

@@ -95,11 +95,13 @@ public class MonitorBusiness {
95 95
                             airMonitorMinuteRecord.setIsLose(exceptionDataDispose.LoseData(x.getMax()!=null?x.getMax().doubleValue():0,
96 96
                                     x.getMin()!=null?x.getMin().doubleValue():0,
97 97
                                     x.getAvg()!=null?x.getAvg().doubleValue():0));
98
-                            if (!airMonitorMinuteRecord.getIsExceed().equals("Y") || !airMonitorMinuteRecord.getIsLose().equals("Y") || !airMonitorMinuteRecord.getIsSix().equals("Y")){
98
+                            if ((airMonitorMinuteRecord.getIsExceed()!=null && !airMonitorMinuteRecord.getIsExceed().equals("Y") )||
99
+                                    (airMonitorMinuteRecord.getIsLose()!=null && !airMonitorMinuteRecord.getIsLose().equals("Y") )||
100
+                                    (airMonitorMinuteRecord.getIsSix()!=null && !airMonitorMinuteRecord.getIsSix().equals("Y"))){
99 101
                                 saveExcepLog(x, airMonitorMinuteRecord);
100 102
                             }
101 103
                         } catch (Exception e) {
102
-                            log.error("调用 ExceptionDataDispose 方法异常{} 当前参数为:{}",e,airMonitorMinuteRecord);
104
+                            log.error("调用 ExceptionDataDispose1 方法异常{} 当前参数为:{}",e,airMonitorMinuteRecord);
103 105
                         }
104 106
                         listData.add(airMonitorMinuteRecord);
105 107
                     });
@@ -131,11 +133,13 @@ public class MonitorBusiness {
131 133
                             airMonitorMinuteRecord.setIsLose(exceptionDataDispose.LoseData(x.getMax()!=null?x.getMax().doubleValue():0,
132 134
                                     x.getMin()!=null?x.getMin().doubleValue():0,
133 135
                                     x.getAvg()!=null?x.getAvg().doubleValue():0));
134
-                            if (!airMonitorMinuteRecord.getIsExceed().equals("Y") || !airMonitorMinuteRecord.getIsLose().equals("Y") || !airMonitorMinuteRecord.getIsSix().equals("Y")){
136
+                            if ((airMonitorMinuteRecord.getIsExceed()!=null && !airMonitorMinuteRecord.getIsExceed().equals("Y") )||
137
+                                    (airMonitorMinuteRecord.getIsLose()!=null && !airMonitorMinuteRecord.getIsLose().equals("Y") )||
138
+                                    (airMonitorMinuteRecord.getIsSix()!=null && !airMonitorMinuteRecord.getIsSix().equals("Y"))){
135 139
                                 saveExcepLog(x, airMonitorMinuteRecord);
136 140
                             }
137 141
                         } catch (Exception e) {
138
-                            log.error("调用 ExceptionDataDispose 方法异常{} 当前参数为:{}",e,airMonitorMinuteRecord);
142
+                            log.error("调用 ExceptionDataDispose2 方法异常{} 当前参数为:{}",e,airMonitorMinuteRecord);
139 143
                         }
140 144
                         listData.add(airMonitorMinuteRecord);
141 145
                     });
@@ -170,11 +174,14 @@ public class MonitorBusiness {
170 174
                                     x.getMin()!=null?x.getMin().doubleValue():0,
171 175
                                     x.getAvg()!=null?x.getAvg().doubleValue():0));
172 176
                             airMonitorHourRecord.setIsSix(exceptionDataDispose.SixData(factorModel.getMN(), x.getFactor(),x.getAvg()!=null?x.getAvg().doubleValue():0, factorModel.getDataTime()));
173
-                            if (!airMonitorHourRecord.getIsExceed().equals("Y") || !airMonitorHourRecord.getIsLose().equals("Y") || !airMonitorHourRecord.getIsSix().equals("Y")){
177
+//                            if (!airMonitorHourRecord.getIsExceed().equals("Y") || !airMonitorHourRecord.getIsLose().equals("Y") || !airMonitorHourRecord.getIsSix().equals("Y")){
178
+                            if ((airMonitorHourRecord.getIsExceed()!=null && !airMonitorHourRecord.getIsExceed().equals("Y") )||
179
+                                    (airMonitorHourRecord.getIsLose()!=null && !airMonitorHourRecord.getIsLose().equals("Y") )||
180
+                                    (airMonitorHourRecord.getIsSix()!=null && !airMonitorHourRecord.getIsSix().equals("Y"))){
174 181
                                 saveExcepLog(x, airMonitorHourRecord);
175 182
                             }
176 183
                         } catch (Exception e) {
177
-                            log.error("调用 ExceptionDataDispose 方法异常{} 当前参数为:{}",e,airMonitorHourRecord);
184
+                            log.error("调用 ExceptionDataDispose3 方法异常{} 当前参数为:{}",e,airMonitorHourRecord);
178 185
                         }
179 186
                         listData.add(airMonitorHourRecord);
180 187
                     });
@@ -206,11 +213,13 @@ public class MonitorBusiness {
206 213
                             waterMonitorMinuteRecord.setIsLose(exceptionDataDispose.LoseData(x.getMax()!=null?x.getMax().doubleValue():0,
207 214
                                     x.getMin()!=null?x.getMin().doubleValue():0,
208 215
                                     x.getAvg()!=null?x.getAvg().doubleValue():0));
209
-                            if (!waterMonitorMinuteRecord.getIsExceed().equals("Y") || !waterMonitorMinuteRecord.getIsLose().equals("Y") || !waterMonitorMinuteRecord.getIsSix().equals("Y")){
216
+                            if ((waterMonitorMinuteRecord.getIsExceed()!=null && !waterMonitorMinuteRecord.getIsExceed().equals("Y") )||
217
+                                    (waterMonitorMinuteRecord.getIsLose()!=null && !waterMonitorMinuteRecord.getIsLose().equals("Y") )||
218
+                                    (waterMonitorMinuteRecord.getIsSix()!=null && !waterMonitorMinuteRecord.getIsSix().equals("Y"))){
210 219
                                 saveExcepLog(x, waterMonitorMinuteRecord);
211 220
                             }
212 221
                         } catch (Exception e) {
213
-                            log.error("调用 ExceptionDataDispose 方法异常{} 当前参数为:{}",e,waterMonitorMinuteRecord);
222
+                            log.error("调用 ExceptionDataDispose4 方法异常{} 当前参数为:{}",e,waterMonitorMinuteRecord);
214 223
                         }
215 224
                         listData.add(waterMonitorMinuteRecord);
216 225
                     });
@@ -239,11 +248,13 @@ public class MonitorBusiness {
239 248
                             waterMonitorMinuteRecord.setIsLose(exceptionDataDispose.LoseData(x.getMax()!=null?x.getMax().doubleValue():0,
240 249
                                     x.getMin()!=null?x.getMin().doubleValue():0,
241 250
                                     x.getAvg()!=null?x.getAvg().doubleValue():0));
242
-                            if (!waterMonitorMinuteRecord.getIsExceed().equals("Y") || !waterMonitorMinuteRecord.getIsLose().equals("Y") || !waterMonitorMinuteRecord.getIsSix().equals("Y")){
251
+                            if ((waterMonitorMinuteRecord.getIsExceed()!=null && !waterMonitorMinuteRecord.getIsExceed().equals("Y") )||
252
+                                    (waterMonitorMinuteRecord.getIsLose()!=null && !waterMonitorMinuteRecord.getIsLose().equals("Y") )||
253
+                                    (waterMonitorMinuteRecord.getIsSix()!=null && !waterMonitorMinuteRecord.getIsSix().equals("Y"))){
243 254
                                 saveExcepLog(x, waterMonitorMinuteRecord);
244 255
                             }
245 256
                         } catch (Exception e) {
246
-                            log.error("调用 ExceptionDataDispose 方法异常{} 当前参数为:{}",e,waterMonitorMinuteRecord);
257
+                            log.error("调用 ExceptionDataDispose5 方法异常{} 当前参数为:{}",e,waterMonitorMinuteRecord);
247 258
                         }
248 259
 
249 260
                         listData.add(waterMonitorMinuteRecord);
@@ -277,11 +288,13 @@ public class MonitorBusiness {
277 288
                                     x.getMin()!=null?x.getMin().doubleValue():0,
278 289
                                     x.getAvg()!=null?x.getAvg().doubleValue():0));
279 290
                             waterMonitorHourRecord.setIsSix(exceptionDataDispose.SixData(factorModel.getMN(), x.getFactor(),x.getAvg()!=null?x.getAvg().doubleValue():0, factorModel.getDataTime()));
280
-                            if (!waterMonitorHourRecord.getIsExceed().equals("Y") || !waterMonitorHourRecord.getIsLose().equals("Y") || !waterMonitorHourRecord.getIsSix().equals("Y")){
291
+                            if ((waterMonitorHourRecord.getIsExceed()!=null && !waterMonitorHourRecord.getIsExceed().equals("Y") )||
292
+                                    (waterMonitorHourRecord.getIsLose()!=null && !waterMonitorHourRecord.getIsLose().equals("Y") )||
293
+                                    (waterMonitorHourRecord.getIsSix()!=null && !waterMonitorHourRecord.getIsSix().equals("Y"))){
281 294
                                 saveExcepLog(x, waterMonitorHourRecord);
282 295
                             }
283 296
                         } catch (Exception e) {
284
-                            log.error("调用 ExceptionDataDispose 方法异常{} 当前参数为:{}",e,waterMonitorHourRecord);
297
+                            log.error("调用 ExceptionDataDispose6 方法异常{} 当前参数为:{}",e,waterMonitorHourRecord);
285 298
                         }
286 299
                         listData.add(waterMonitorHourRecord);
287 300
                     });

+ 5 - 5
src/main/java/com/cn/esermis/dpld/entity/AnalyticalInstruments.java

@@ -40,12 +40,12 @@ public class AnalyticalInstruments {
40 40
     /**
41 41
      *监测污染物因子及限值(小时均值、月排放总量、年排放总量)
42 42
      */
43
-    @TableField(value = "factorInfor")
44
-    private Date factorInfor;
43
+    @TableField(value = "factor_infor")
44
+    private String factorInfor;
45 45
     /**
46 46
      * 量程
47 47
      */
48
-    @TableField(value = "range")
48
+    @TableField(value = "range_str")
49 49
     private String range;
50 50
 
51 51
     /**
@@ -68,8 +68,8 @@ public class AnalyticalInstruments {
68 68
     /**
69 69
      * 皮托管系数
70 70
      */
71
-    @TableField(value = "pitotTubeCoefficient")
72
-    private String pitot_tube_coefficient;
71
+    @TableField(value = "pitot_tube_coefficient")
72
+    private String pitotTubeCoefficient;
73 73
     /**
74 74
      * k值
75 75
      */

+ 6 - 1
src/main/java/com/cn/esermis/dpld/entity/DataAcquisitionInstrument.java

@@ -42,7 +42,7 @@ public class DataAcquisitionInstrument {
42 42
      *建设投用日期
43 43
      */
44 44
     @TableField(value = "use_data")
45
-    private Date use_data;
45
+    private Date useData;
46 46
     /**
47 47
      * 是否完成验收备案(0否 1是)
48 48
      */
@@ -58,6 +58,11 @@ public class DataAcquisitionInstrument {
58 58
     /**
59 59
      * 数采仪品牌
60 60
      */
61
+    @TableField(value = "collection_name")
62
+    private String collectionName;
63
+    /**
64
+     * 数采仪品牌
65
+     */
61 66
     @TableField(value = "collection_brand")
62 67
     private String collectionBrand;
63 68
     /**

+ 3 - 3
src/main/java/com/cn/esermis/dpld/entity/DetectMonitoringFactor.java

@@ -12,7 +12,7 @@ import java.util.Date;
12 12
  * 监测因子表
13 13
  */
14 14
 @Data
15
-@TableName("analytical_instruments")
15
+@TableName("monitoring_factor")
16 16
 public class DetectMonitoringFactor {
17 17
 
18 18
     private static final long serialVersionUID = 8887499842971074427L;
@@ -26,7 +26,7 @@ public class DetectMonitoringFactor {
26 26
      * 分析仪主键ID
27 27
      */
28 28
     @TableField(value = "analytical_instrument_id")
29
-    private String analytical_instrument_id;
29
+    private String analyticalInstrumentId;
30 30
     /**
31 31
      * 检测因子编码
32 32
      */
@@ -68,7 +68,7 @@ public class DetectMonitoringFactor {
68 68
     /**
69 69
      * 量程
70 70
      */
71
-    @TableField(value = "range")
71
+    @TableField(value = "range_str")
72 72
     private String range;
73 73
     /**
74 74
      * 量程单位

+ 1 - 1
src/main/java/com/cn/esermis/dpld/entity/PostMarking.java

@@ -58,7 +58,7 @@ public class PostMarking {
58 58
      * 管理员核实状态  1属实、2不属实
59 59
      */
60 60
     @TableField(value = "verifies_status")
61
-    private String verifiesStatus;
61
+    private Integer verifiesStatus;
62 62
     /**
63 63
      * 管理员分类  1停炉、2故障
64 64
      */

+ 6 - 0
src/main/java/com/cn/esermis/dpld/mapper/AnalyticalInstrumentsMapper.java

@@ -3,9 +3,15 @@ package com.cn.esermis.dpld.mapper;
3 3
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4 4
 import com.cn.esermis.dpld.entity.AnalyticalInstruments;
5 5
 import org.apache.ibatis.annotations.Mapper;
6
+import org.apache.ibatis.annotations.Param;
7
+import org.apache.ibatis.annotations.Select;
8
+
9
+import java.util.List;
6 10
 
7 11
 @Mapper
8 12
 public interface AnalyticalInstrumentsMapper extends BaseMapper<AnalyticalInstruments> {
9 13
 
14
+    List<AnalyticalInstruments> getByDataAcquisitionInstrumentid(@Param("productId") String productId);
10 15
 
16
+    boolean saveOb(AnalyticalInstruments analyticalInstruments);
11 17
 }

+ 4 - 0
src/main/java/com/cn/esermis/dpld/mapper/DetectMonitoringFactorMapper.java

@@ -3,9 +3,13 @@ package com.cn.esermis.dpld.mapper;
3 3
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
4 4
 import com.cn.esermis.dpld.entity.DetectMonitoringFactor;
5 5
 import org.apache.ibatis.annotations.Mapper;
6
+import org.apache.ibatis.annotations.Param;
7
+
8
+import java.util.List;
6 9
 
7 10
 @Mapper
8 11
 public interface DetectMonitoringFactorMapper extends BaseMapper<DetectMonitoringFactor> {
9 12
 
10 13
 
14
+    List<DetectMonitoringFactor> listByParentId(@Param("parentId") String parentId);
11 15
 }

+ 5 - 0
src/main/java/com/cn/esermis/dpld/service/IAnalyticalInstrumentsService.java

@@ -4,6 +4,11 @@ import com.baomidou.mybatisplus.extension.service.IService;
4 4
 import com.cn.esermis.dpld.entity.AnalyticalInstruments;
5 5
 import org.springframework.stereotype.Service;
6 6
 
7
+import java.util.List;
8
+
7 9
 @Service
8 10
 public interface IAnalyticalInstrumentsService extends IService<AnalyticalInstruments> {
11
+    List<AnalyticalInstruments> getByDataAcquisitionInstrumentid(String id);
12
+
13
+    boolean saveOb(AnalyticalInstruments analyticalInstruments);
9 14
 }

+ 3 - 0
src/main/java/com/cn/esermis/dpld/service/IDetectMonitoringFactorService.java

@@ -4,6 +4,9 @@ import com.baomidou.mybatisplus.extension.service.IService;
4 4
 import com.cn.esermis.dpld.entity.DetectMonitoringFactor;
5 5
 import org.springframework.stereotype.Service;
6 6
 
7
+import java.util.List;
8
+
7 9
 @Service
8 10
 public interface IDetectMonitoringFactorService extends IService<DetectMonitoringFactor> {
11
+    List<DetectMonitoringFactor> listByParentId(String id);
9 12
 }

+ 17 - 0
src/main/java/com/cn/esermis/dpld/service/impl/AnalyticalInstrumentsServiceImpl.java

@@ -6,6 +6,23 @@ import com.cn.esermis.dpld.mapper.AnalyticalInstrumentsMapper;
6 6
 import com.cn.esermis.dpld.service.IAnalyticalInstrumentsService;
7 7
 import org.springframework.stereotype.Service;
8 8
 
9
+import javax.annotation.Resource;
10
+import java.util.Collections;
11
+import java.util.List;
12
+
9 13
 @Service
10 14
 public class AnalyticalInstrumentsServiceImpl extends ServiceImpl<AnalyticalInstrumentsMapper, AnalyticalInstruments> implements IAnalyticalInstrumentsService {
15
+
16
+
17
+    @Resource
18
+    private AnalyticalInstrumentsMapper analyticalInstrumentsMapper;
19
+    @Override
20
+    public List<AnalyticalInstruments> getByDataAcquisitionInstrumentid(String id) {
21
+        return analyticalInstrumentsMapper.getByDataAcquisitionInstrumentid(id);
22
+    }
23
+
24
+    @Override
25
+    public boolean saveOb(AnalyticalInstruments analyticalInstruments) {
26
+        return analyticalInstrumentsMapper.saveOb(analyticalInstruments);
27
+    }
11 28
 }

+ 12 - 0
src/main/java/com/cn/esermis/dpld/service/impl/DetectMonitoringFactorImpl.java

@@ -6,6 +6,18 @@ import com.cn.esermis.dpld.mapper.DetectMonitoringFactorMapper;
6 6
 import com.cn.esermis.dpld.service.IDetectMonitoringFactorService;
7 7
 import org.springframework.stereotype.Service;
8 8
 
9
+import javax.annotation.Resource;
10
+import java.util.Collections;
11
+import java.util.List;
12
+
9 13
 @Service
10 14
 public class DetectMonitoringFactorImpl extends ServiceImpl<DetectMonitoringFactorMapper, DetectMonitoringFactor> implements IDetectMonitoringFactorService {
15
+
16
+    @Resource
17
+    private DetectMonitoringFactorMapper detectMonitoringFactorMapper;
18
+
19
+    @Override
20
+    public List<DetectMonitoringFactor> listByParentId(String parentId) {
21
+        return detectMonitoringFactorMapper.listByParentId(parentId);
22
+    }
11 23
 }

+ 23 - 3
src/main/java/com/cn/esermis/model/FactorModel.java

@@ -1,5 +1,6 @@
1 1
 package com.cn.esermis.model;
2 2
 
3
+import com.alibaba.fastjson2.JSON;
3 4
 import com.alibaba.fastjson2.JSONObject;
4 5
 import lombok.Data;
5 6
 
@@ -9,11 +10,30 @@ import java.util.List;
9 10
 @Data
10 11
 public class FactorModel {
11 12
 
13
+    public static void main(String[] args) {
12 14
 
13
-    public FactorModel factorModel(JSONObject msg){
14
-        FactorModel javaObject = msg.toJavaObject(FactorModel.class);
15
-
15
+        String json = "{\n" +
16
+                "\t\"SIZE\": \"0114\",\n" +
17
+                "\t\"QN\": \"20241015151000142\",\n" +
18
+                "\t\"ST\": \"59\",\n" +
19
+                "\t\"CN\": \"2011\",\n" +
20
+                "\t\"PW\": \"123456\",\n" +
21
+                "\t\"MN\": \"399435X0017503\",\n" +
22
+                "\t\"Flag\": \"5\",\n" +
23
+                "\t\"DataTime\": \"20241015151000\",\n" +
24
+                "\t\"CP\": [{\n" +
25
+                "\t\t\"Rtd\": \"Fb\",\n" +
26
+                "\t\t\"factor\": \"p10103\"\n" +
27
+                "\t}],\n" +
28
+                "\t\"End\": \"4DC0\\r\\n\"\n" +
29
+                "}";
30
+        FactorModel javaObject = JSON.parseObject(JSON.toJSONString(json), FactorModel.class);
31
+        System.out.println(javaObject);
32
+    }
16 33
 
34
+    public FactorModel factorModel(JSONObject msg){
35
+//        FactorModel javaObject = msg.toJavaObject(FactorModel.class);
36
+        FactorModel javaObject = JSON.parseObject(JSON.toJSONString(msg), FactorModel.class);
17 37
         return javaObject;
18 38
     }
19 39
 

+ 7 - 4
src/main/resources/application.yml

@@ -44,7 +44,12 @@ spring:
44 44
 
45 45
 mybatis-plus:
46 46
   mapper-locations: classpath:static/**/*.xml
47
-
47
+  configuration:
48
+    log-impl: org.apache.ibatis.logging.slf4j.Slf4jImpl # 指定 MyBatis 使用 SLF4J 日志实现
49
+logging:
50
+  level:
51
+    cnooc.esermis: DEBUG
52
+    com.baomidou.mybatisplus.core.mapper: debug # 设置 Mapper 接口的日志级别为 DEBUG
48 53
   ## 工程设置
49 54
 #project:
50 55
 #  debug: false
@@ -86,9 +91,7 @@ mybatis-plus:
86 91
 #    cache-enabled: false
87 92
 
88 93
   ##日志配置
89
-logging:
90
-  level:
91
-    cnooc.esermis: DEBUG
94
+
92 95
 
93 96
 #线程池
94 97
 ##线程池维护线程的最少数量 -

+ 22 - 0
src/main/resources/static/mybatis/AnalyticalInstrumentsMapper.xml

@@ -0,0 +1,22 @@
1
+<?xml version="1.0" encoding="UTF-8" ?>
2
+<!DOCTYPE mapper
3
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
4
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
5
+<mapper namespace="com.cn.esermis.dpld.mapper.AnalyticalInstrumentsMapper">
6
+    <insert id="saveOb" parameterType="com.cn.esermis.dpld.entity.AnalyticalInstruments">
7
+        insert into analytical_instruments(id,brand,model,name,factorInfor,range,data_acquisition_instrument_id,reference_oxygen_content,velocity_field_coefficient,pitot_tube_coefficient,k_value,flue_area,dilution_ratio,type)
8
+        values(#{id},#{brand},#{model},#{name},#{factorInfor},#{range},#{dataAcquisitionInstrumentId},#{referenceOxygenContent},#{velocityFieldCoefficient},#{pitotTubeCoefficient},#{kValue},#{flueArea},#{dilutionRatio},#{type})
9
+
10
+    </insert>
11
+
12
+    <select id="getByDataAcquisitionInstrumentid" resultType="com.cn.esermis.dpld.entity.AnalyticalInstruments"
13
+            parameterType="java.lang.String">
14
+        select * from analytical_instruments
15
+            <where>
16
+            <if test="productId != null">
17
+                and data_acquisition_instrument_id = #{productId}
18
+            </if>
19
+            </where>
20
+    </select>
21
+</mapper>
22
+

+ 17 - 0
src/main/resources/static/mybatis/DetectMonitoringFactorMapper.xml

@@ -0,0 +1,17 @@
1
+<?xml version="1.0" encoding="UTF-8" ?>
2
+<!DOCTYPE mapper
3
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
4
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
5
+<mapper namespace="com.cn.esermis.dpld.mapper.DetectMonitoringFactorMapper">
6
+
7
+
8
+    <select id="listByParentId" resultType="com.cn.esermis.dpld.entity.DetectMonitoringFactor">
9
+        select * from monitoring_factor
10
+        <where>
11
+            <if test="parentId != null">
12
+                and analytical_instrument_id = #{parentId}
13
+            </if>
14
+        </where>
15
+    </select>
16
+</mapper>
17
+