fanxw пре 11 месеци
родитељ
комит
c22e3529a2

+ 5 - 1
src/main/java/com/chinaitop/depot/tasks/TempWetTask.java

@@ -26,8 +26,10 @@ public class TempWetTask {
26 26
 
27 27
     /**
28 28
      * 每年12月1日进行增一条下一年的设置数据,默认值与上一年保持一致
29
+     * 生成温湿度报警配置设置数据
29 30
      */
30 31
     @Scheduled(cron = "0 0 0 1 12 ?") // 每年12月1号0点0分0秒触发任务
32
+//    @Scheduled(cron = "0 22 16 * * ?") // 测试
31 33
     public void tempWetYear() {
32 34
         log.info("----每年12月1号0点0分0秒触发任务----");
33 35
         tempWetThresholdService.saveNextYear();
@@ -35,8 +37,9 @@ public class TempWetTask {
35 37
 
36 38
     /**
37 39
      * 每日中午12点,定时任务全平台进行算法计算
40
+     * 生成温湿度报警数据
38 41
      */
39
-//    @Scheduled(cron = "0 45 14 * * ?") // 测试
42
+//    @Scheduled(cron = "0 31 16 * * ?") // 测试
40 43
     @Scheduled(cron = "0 0 12 * * ?") // 每天中午12点触发任务
41 44
     public void tempWetWarning() {
42 45
         log.info("----每天中午12点触发任务----");
@@ -45,6 +48,7 @@ public class TempWetTask {
45 48
 
46 49
     /**
47 50
      * 每日中午12点,定时任务全平台进行算法计算
51
+     * 储备年限报警
48 52
      */
49 53
 //    @Scheduled(cron = "0 0 0 11 * *") // 测试
50 54
     @Scheduled(cron = "0 0 0 1 * *") // 每月1号0点执行一次

+ 13 - 1
src/main/java/com/chinaitop/depot/tempWarn/controller/TTempWetAlarmController.java

@@ -34,7 +34,9 @@ public class TTempWetAlarmController {
34 34
     @ApiOperation(value = "温湿度报警列表", notes = "支持分页")
35 35
     public ResponseEntity getPageList(TTempWetAlarmPageParam pageParam) {
36 36
         try {
37
-            PageHelper.startPage(pageParam.getPageNum(), pageParam.getPageSize());
37
+        	if (null != pageParam.getPageNum() && null != pageParam.getPageSize()) {
38
+        		PageHelper.startPage(pageParam.getPageNum(), pageParam.getPageSize());
39
+        	}
38 40
             return ResponseEntity.ok(new PageInfo<>(tempWetAlarmService.getPageList(pageParam)));
39 41
         } catch (Exception e) {
40 42
             e.printStackTrace();
@@ -64,4 +66,14 @@ public class TTempWetAlarmController {
64 66
             return ResponseEntity.failed("查询失败");
65 67
         }
66 68
     }
69
+    
70
+    @GetMapping("/tempWetWarning")
71
+    @ApiOperation(value = "手动生成温湿度数据", notes = "")
72
+    public void tempWetWarning() {
73
+        try {
74
+        	tempWetAlarmService.saveTempWetWarning();
75
+        } catch (Exception e) {
76
+            e.printStackTrace();
77
+        }
78
+    }
67 79
 }

+ 3 - 0
src/main/java/com/chinaitop/depot/tempWarn/mapper/TTempWetAlarmMapper.java

@@ -5,6 +5,7 @@ import com.chinaitop.depot.tempWarn.model.TTempWetAlarmExample;
5 5
 import java.util.List;
6 6
 import java.util.Map;
7 7
 
8
+import com.chinaitop.depot.tempWarn.param.TTempWetAlarmPageParam;
8 9
 import com.chinaitop.depot.tempWarn.param.TempWetCheckRecordPageParam;
9 10
 import org.apache.ibatis.annotations.Param;
10 11
 import org.springframework.stereotype.Repository;
@@ -41,4 +42,6 @@ public interface TTempWetAlarmMapper {
41 42
     List<TTempWetAlarm> selectAllByRestoreTimeIsNull(String yesterday);
42 43
 
43 44
     List<Map<String,Object>> getModalPageList(TempWetCheckRecordPageParam pageParam);
45
+
46
+    List<TTempWetAlarm> selectList(TTempWetAlarmPageParam pageParam);
44 47
 }

+ 49 - 0
src/main/java/com/chinaitop/depot/tempWarn/mapper/TTempWetAlarmMapper.xml

@@ -17,6 +17,9 @@
17 17
     <result column="temp_value" property="tempValue" jdbcType="DECIMAL" />
18 18
     <result column="process_status" property="processStatus" jdbcType="VARCHAR" />
19 19
     <result column="supervision_status" property="supervisionStatus" jdbcType="VARCHAR" />
20
+    <!-- 下面是业务字段 -->
21
+    <result column="yjzt" property="yjzt" jdbcType="VARCHAR" />
22
+    <result column="clordbzt" property="clordbzt" jdbcType="VARCHAR" />
20 23
   </resultMap>
21 24
   <sql id="Example_Where_Clause" >
22 25
     <where >
@@ -424,4 +427,50 @@
424 427
         and storehouse = #{houseCode}
425 428
         and t_time between #{startTime} and #{endTime}
426 429
   </select>
430
+  <select id="selectList" parameterType="com.chinaitop.depot.tempWarn.param.TTempWetAlarmPageParam" resultMap="BaseResultMap">
431
+    select 
432
+ 	    *
433
+	from (
434
+  		select 
435
+		    id, house_id, house_code, hwxz, pz, threshold_value, alarm_time, 
436
+		    restore_time, duration_days, approval_status, org_id, threshold_type,
437
+		    temp_value, process_status, supervision_status, 
438
+		    case approval_status 
439
+		        when '900000' then '待处理'
440
+		        when '900001' then '处理中'
441
+		        when '900002' then '待处理 督办中'
442
+		        when '900003' then '处理中 督办中'
443
+		        when '900004' then '督办中'
444
+		        when '900005' then '二次督办中'
445
+		        when '900006' then '二次督办完成'
446
+		        when '900007' then '待督办'
447
+		        when '999999' then '处理完成'
448
+		        else ''
449
+		    end clordbzt,
450
+		    case when (restore_time is not null) and (approval_status = '999999' or approval_status = '900086') then '已解决' else'未解决' end yjzt
451
+		from t_temp_wet_alarm
452
+	) a 
453
+	where 1=1 
454
+	<if test="orgId != null">
455
+	and a.org_id=#{orgId}
456
+	</if>
457
+	<if test="thresholdType != null">
458
+	and a.threshold_type=#{thresholdType}
459
+	</if>
460
+	<if test="pz != null">
461
+	and a.pz=#{pz}
462
+	</if>
463
+	<if test="hwxz != null">
464
+	and a.hwxz=#{hwxz}
465
+	</if>
466
+	<if test="alarmTime != null">
467
+	and a.alarm_time=#{alarmTime}
468
+	</if>
469
+	<if test="clordbzt != null">
470
+	and a.clordbzt=#{clordbzt}
471
+	</if>
472
+	<if test="yjzt != null">
473
+	and a.yjzt=#{yjzt}
474
+	</if>
475
+  </select>
427 476
 </mapper>

+ 2 - 0
src/main/java/com/chinaitop/depot/tempWarn/model/TTempWetAlarm.java

@@ -44,4 +44,6 @@ public class TTempWetAlarm {
44 44
     // 业务数据
45 45
     private BigDecimal inH;// 内湿
46 46
     private BigDecimal tMax;// 粮温-最高温
47
+    private String yjzt;//预警状态
48
+    private String clordbzt;//(处理/督办)状态
47 49
 }

+ 20 - 3
src/main/java/com/chinaitop/depot/tempWarn/param/TTempWetAlarmPageParam.java

@@ -1,13 +1,15 @@
1 1
 package com.chinaitop.depot.tempWarn.param;
2 2
 
3
+import java.io.Serializable;
4
+
5
+import javax.validation.constraints.NotNull;
6
+
3 7
 import com.chinaitop.depot.common.PageParam;
8
+
4 9
 import io.swagger.annotations.ApiModelProperty;
5 10
 import lombok.Getter;
6 11
 import lombok.Setter;
7 12
 
8
-import javax.validation.constraints.NotNull;
9
-import java.io.Serializable;
10
-
11 13
 /**
12 14
  * @author qingsong.han
13 15
  * @description:
@@ -27,4 +29,19 @@ public class TTempWetAlarmPageParam extends PageParam implements Serializable {
27 29
 
28 30
     @ApiModelProperty(value = "仓号(basic_storehouse.storehouse_id)")
29 31
     private Integer houseId;
32
+
33
+    @ApiModelProperty(value = "粮食品种")
34
+    private Integer pz;
35
+
36
+    @ApiModelProperty(value = "粮食性质")
37
+    private Integer hwxz;
38
+
39
+    @ApiModelProperty(value = "预警日期")
40
+    private String alarmTime;
41
+
42
+    @ApiModelProperty(value = "预警状态")
43
+    private String yjzt;
44
+
45
+    @ApiModelProperty(value = "(处理/督办)状态")
46
+    private String clordbzt;
30 47
 }

+ 27 - 9
src/main/java/com/chinaitop/depot/tempWarn/service/impl/TTempWetAlarmServiceImpl.java

@@ -7,6 +7,8 @@ import com.chinaitop.depot.tempWarn.model.*;
7 7
 import com.chinaitop.depot.tempWarn.param.TTempWetAlarmPageParam;
8 8
 import com.chinaitop.depot.tempWarn.param.TempWetCheckRecordPageParam;
9 9
 import com.chinaitop.depot.tempWarn.service.TTempWetAlarmService;
10
+import com.chinaitop.depot.utils.ParameterUtil;
11
+
10 12
 import lombok.extern.slf4j.Slf4j;
11 13
 import org.springframework.stereotype.Service;
12 14
 import org.springframework.util.CollectionUtils;
@@ -38,14 +40,28 @@ public class TTempWetAlarmServiceImpl implements TTempWetAlarmService {
38 40
 
39 41
     @Override
40 42
     public List<TTempWetAlarm> getPageList(TTempWetAlarmPageParam pageParam) {
41
-        TTempWetAlarmExample example = new TTempWetAlarmExample();
42
-        TTempWetAlarmExample.Criteria criteria = example.createCriteria();
43
-        criteria.andOrgIdEqualTo(pageParam.getOrgId());
44
-        criteria.andThresholdTypeEqualTo(pageParam.getThresholdType());
45
-        if (!ObjectUtils.isEmpty(pageParam.getHouseId())) {
46
-            criteria.andHouseIdEqualTo(pageParam.getHouseId());
43
+    	/*TTempWetAlarm t = new TTempWetAlarm();
44
+    	t.setOrgId(pageParam.getOrgId());
45
+        t.setThresholdType(pageParam.getThresholdType());
46
+        if (!ObjectUtils.isEmpty(pageParam.getHouseId())) {//仓号
47
+        	t.setHouseId(pageParam.getHouseId());
48
+        }
49
+        if (!ObjectUtils.isEmpty(pageParam.getPz())) {//粮食品种
50
+        	t.setPz(pageParam.getPz());
51
+        }
52
+        if (!ObjectUtils.isEmpty(pageParam.getHwxz())) {//粮食性质
53
+            t.setHwxz(pageParam.getHwxz());
54
+        }
55
+        if (!ObjectUtils.isEmpty(pageParam.getAlarmTime())) {//预警日期
56
+            t.setAlarmTime(ParameterUtil.string2date(pageParam.getAlarmTime()));
57
+        }
58
+        if (!ObjectUtils.isEmpty(pageParam.getClordbzt())) {//(处理/督办)状态
59
+            t.setClordbzt(pageParam.getClordbzt());
47 60
         }
48
-        return tempWetAlarmMapper.selectByExample(example);
61
+        if (!ObjectUtils.isEmpty(pageParam.getYjzt())) {//预警状态
62
+        	t.setYjzt(pageParam.getYjzt());
63
+        }*/
64
+        return tempWetAlarmMapper.selectList(pageParam);
49 65
     }
50 66
 
51 67
     @Override
@@ -86,7 +102,8 @@ public class TTempWetAlarmServiceImpl implements TTempWetAlarmService {
86 102
                                     t.setThresholdValue(currentMonthTemp);
87 103
                                     t.setAlarmTime(new Date());
88 104
                                     t.setDurationDays(1);
89
-                                    t.setApprovalStatus("100201"); // 审批流程初始化
105
+                                    t.setProcessStatus("100201");
106
+                                    t.setApprovalStatus("900000"); // 审批流程初始化
90 107
                                     tempWetAlarmMapper.insertSelective(t);
91 108
                                 } else {
92 109
                                     Integer durationDays = alarm.getDurationDays();
@@ -119,7 +136,8 @@ public class TTempWetAlarmServiceImpl implements TTempWetAlarmService {
119 136
                                     t.setThresholdValue(currentMonthWet);
120 137
                                     t.setAlarmTime(new Date());
121 138
                                     t.setDurationDays(1);
122
-                                    t.setApprovalStatus("100201"); // 审批流程初始化
139
+                                    t.setProcessStatus("100201");
140
+                                    t.setApprovalStatus("900000"); // 审批流程初始化
123 141
                                     tempWetAlarmMapper.insertSelective(t);
124 142
                                 } else {
125 143
                                     Integer durationDays = alarm.getDurationDays();

+ 25 - 0
src/main/java/com/chinaitop/depot/tempWarn/service/impl/TTempWetThresholdServiceImpl.java

@@ -61,6 +61,7 @@ public class TTempWetThresholdServiceImpl implements TTempWetThresholdService {
61 61
         // 查询当前年设置数据
62 62
         Calendar calendar = Calendar.getInstance();
63 63
         Integer year = calendar.get(Calendar.YEAR);
64
+//        Integer year = 2024;
64 65
         log.info("当前年份: {}", year);
65 66
         List<TTempWetThreshold> list = tempWetThresholdMapper.getList(year);
66 67
         // 为空初始化
@@ -70,6 +71,18 @@ public class TTempWetThresholdServiceImpl implements TTempWetThresholdService {
70 71
                 TTempWetThreshold threshold = new TTempWetThreshold();
71 72
                 threshold.setDifferentYears(year + 1);// 加一年
72 73
                 threshold.setThresholdType(0);// 阀值类型(0:温度报警设置,1:湿度报警设置)
74
+                threshold.setThresholdJanuary(10);//1
75
+                threshold.setThresholdFebruary(10);//2
76
+                threshold.setThresholdMarch(10);//3
77
+                threshold.setThresholdApril(10);//4
78
+                threshold.setThresholdMay(10);//5
79
+                threshold.setThresholdJune(10);//6
80
+                threshold.setThresholdJuly(10);//7
81
+                threshold.setThresholdAugust(10);//8
82
+                threshold.setThresholdSeptember(10);//9
83
+                threshold.setThresholdOctober(10);//10
84
+                threshold.setThresholdNovember(10);//11
85
+                threshold.setThresholdDecember(10);//12
73 86
                 threshold.setOrgId(org);
74 87
                 this.saveData(threshold);
75 88
             });
@@ -78,6 +91,18 @@ public class TTempWetThresholdServiceImpl implements TTempWetThresholdService {
78 91
                 threshold.setDifferentYears(year + 1);// 加一年
79 92
                 threshold.setThresholdType(1);// 阀值类型(0:温度报警设置,1:湿度报警设置)
80 93
                 threshold.setOrgId(org);
94
+                threshold.setThresholdJanuary(30);//1
95
+                threshold.setThresholdFebruary(30);//2
96
+                threshold.setThresholdMarch(30);//3
97
+                threshold.setThresholdApril(30);//4
98
+                threshold.setThresholdMay(30);//5
99
+                threshold.setThresholdJune(30);//6
100
+                threshold.setThresholdJuly(30);//7
101
+                threshold.setThresholdAugust(30);//8
102
+                threshold.setThresholdSeptember(30);//9
103
+                threshold.setThresholdOctober(30);//10
104
+                threshold.setThresholdNovember(30);//11
105
+                threshold.setThresholdDecember(30);//12
81 106
                 this.saveData(threshold);
82 107
             });
83 108
         } else {