fanxw 11 달 전
부모
커밋
7ea6596deb

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

@@ -48,7 +48,7 @@ public class TempWetTask {
48 48
 
49 49
     /**
50 50
      * 每日中午12点,定时任务全平台进行算法计算
51
-     * 储备年限报警
51
+     * 库内储存年限提醒
52 52
      */
53 53
 //    @Scheduled(cron = "0 0 0 11 * *") // 测试
54 54
     @Scheduled(cron = "0 0 0 1 * *") // 每月1号0点执行一次

+ 10 - 1
src/main/java/com/chinaitop/depot/tempWarn/controller/StorageThresholdAlarmController.java

@@ -3,14 +3,23 @@ package com.chinaitop.depot.tempWarn.controller;
3 3
 import com.chinaitop.depot.tempWarn.param.StorageThresholdAlarmPageParam;
4 4
 import com.chinaitop.depot.tempWarn.service.StorageThresholdAlarmService;
5 5
 import com.chinaitop.depot.unissoft.model.ResponseEntity;
6
+import com.chinaitop.depot.yjbj.model.StorageAlarmRecordWithBLOBs;
7
+import com.chinaitop.depot.yjbj.service.StorageAlarmRecordService;
6 8
 import com.github.pagehelper.PageHelper;
7 9
 import com.github.pagehelper.PageInfo;
8 10
 import io.swagger.annotations.Api;
11
+import io.swagger.annotations.ApiImplicitParam;
12
+import io.swagger.annotations.ApiImplicitParams;
9 13
 import io.swagger.annotations.ApiOperation;
14
+
15
+import org.springframework.http.MediaType;
10 16
 import org.springframework.web.bind.annotation.GetMapping;
11 17
 import org.springframework.web.bind.annotation.RequestMapping;
18
+import org.springframework.web.bind.annotation.RequestMethod;
12 19
 import org.springframework.web.bind.annotation.RestController;
13 20
 
21
+import java.util.List;
22
+
14 23
 import javax.annotation.Resource;
15 24
 
16 25
 /**
@@ -27,7 +36,7 @@ public class StorageThresholdAlarmController {
27 36
     private StorageThresholdAlarmService thresholdAlarmService;
28 37
 
29 38
     @GetMapping("/getPageList")
30
-    @ApiOperation(value = "储备年限预警列表", notes = "支持分页")
39
+    @ApiOperation(value = "库内储存年限提醒列表", notes = "支持分页")
31 40
     public ResponseEntity getPageList(StorageThresholdAlarmPageParam pageParam) {
32 41
         try {
33 42
             PageHelper.startPage(pageParam.getPageNum(), pageParam.getPageSize());

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

@@ -56,11 +56,11 @@ public class TTempWetAlarmController {
56 56
         }
57 57
     }
58 58
 
59
-    @GetMapping("/getRecordList/{alarmId}")
59
+    @GetMapping("/getRecordList/{alarmId}/{processType}")
60 60
     @ApiOperation(value = "处理记录", notes = "报警id查询")
61
-    public ResponseEntity getRecordList(@PathVariable("alarmId") String alarmId) {
61
+    public ResponseEntity getRecordList(@PathVariable("alarmId") String alarmId, @PathVariable("processType") Integer processType) {
62 62
         try {
63
-            return ResponseEntity.ok(tempWetAlarmService.getRecordList(alarmId));
63
+            return ResponseEntity.ok(tempWetAlarmService.getRecordList(alarmId, processType));
64 64
         } catch (Exception e) {
65 65
             e.printStackTrace();
66 66
             return ResponseEntity.failed("查询失败");

+ 35 - 5
src/main/java/com/chinaitop/depot/tempWarn/mapper/StorageThresholdAlarmMapper.xml

@@ -14,6 +14,8 @@
14 14
     <result column="bjsj" property="bjsj" jdbcType="TIMESTAMP" />
15 15
     <result column="org_id" property="orgId" jdbcType="INTEGER" />
16 16
     <result column="data_flag" property="dataFlag" jdbcType="INTEGER" />
17
+    <result column="approval_status" property="approvalStatus" jdbcType="VARCHAR" />
18
+    <result column="approval_status_name" property="approvalStatusName" jdbcType="VARCHAR" />
17 19
   </resultMap>
18 20
   <sql id="Example_Where_Clause" >
19 21
     <where >
@@ -74,7 +76,7 @@
74 76
     </where>
75 77
   </sql>
76 78
   <sql id="Base_Column_List" >
77
-    id, house_id, hwxz, pz, kcsl, scnf, knccnx, cccxsj, bjxx, bjsj, org_id, data_flag
79
+    id, house_id, hwxz, pz, kcsl, scnf, knccnx, cccxsj, bjxx, bjsj, org_id, data_flag, approval_status, approval_status_name
78 80
   </sql>
79 81
   <select id="selectByExample" resultMap="BaseResultMap" parameterType="com.chinaitop.depot.tempWarn.model.StorageThresholdAlarmExample" >
80 82
     select
@@ -110,11 +112,11 @@
110 112
     insert into storage_threshold_alarm (id, house_id, hwxz, 
111 113
       pz, kcsl, scnf, knccnx, 
112 114
       cccxsj, bjxx, bjsj, 
113
-      org_id, data_flag)
115
+      org_id, data_flag, approval_status, approval_status_name)
114 116
     values (#{id,jdbcType=VARCHAR}, #{houseId,jdbcType=INTEGER}, #{hwxz,jdbcType=INTEGER}, 
115 117
       #{pz,jdbcType=VARCHAR}, #{kcsl,jdbcType=VARCHAR}, #{scnf,jdbcType=VARCHAR}, #{knccnx,jdbcType=INTEGER}, 
116 118
       #{cccxsj,jdbcType=TIMESTAMP}, #{bjxx,jdbcType=VARCHAR}, #{bjsj,jdbcType=TIMESTAMP}, 
117
-      #{orgId,jdbcType=INTEGER}, #{dataFlag,jdbcType=INTEGER})
119
+      #{orgId,jdbcType=INTEGER}, #{dataFlag,jdbcType=INTEGER}, #{approvalStatus,jdbcType=VARCHAR}, #{approvalStatusName,jdbcType=VARCHAR})
118 120
   </insert>
119 121
   <insert id="insertSelective" parameterType="com.chinaitop.depot.tempWarn.model.StorageThresholdAlarm" >
120 122
     insert into storage_threshold_alarm
@@ -155,6 +157,12 @@
155 157
       <if test="dataFlag != null" >
156 158
         data_flag,
157 159
       </if>
160
+      <if test="approvalStatus != null" >
161
+        approval_status,
162
+      </if>
163
+      <if test="approvalStatusName != null" >
164
+        approval_status_name,
165
+      </if>
158 166
     </trim>
159 167
     <trim prefix="values (" suffix=")" suffixOverrides="," >
160 168
       <if test="id != null" >
@@ -193,6 +201,12 @@
193 201
       <if test="dataFlag != null" >
194 202
         #{dataFlag,jdbcType=INTEGER},
195 203
       </if>
204
+      <if test="approvalStatus != null" >
205
+        #{approvalStatus,jdbcType=VARCHAR},
206
+      </if>
207
+      <if test="approvalStatusName != null" >
208
+        #{approvalStatusName,jdbcType=VARCHAR},
209
+      </if>
196 210
     </trim>
197 211
   </insert>
198 212
   <select id="countByExample" parameterType="com.chinaitop.depot.tempWarn.model.StorageThresholdAlarmExample" resultType="java.lang.Integer" >
@@ -240,6 +254,12 @@
240 254
       <if test="record.dataFlag != null" >
241 255
         data_flag = #{record.dataFlag,jdbcType=INTEGER},
242 256
       </if>
257
+      <if test="record.approvalStatus != null" >
258
+        approval_status = #{record.approvalStatus,jdbcType=VARCHAR},
259
+      </if>
260
+      <if test="record.approvalStatusName != null" >
261
+        approval_status_name = #{record.approvalStatusName,jdbcType=VARCHAR},
262
+      </if>
243 263
     </set>
244 264
     <if test="_parameter != null" >
245 265
       <include refid="Update_By_Example_Where_Clause" />
@@ -258,7 +278,9 @@
258 278
       bjxx = #{record.bjxx,jdbcType=VARCHAR},
259 279
       bjsj = #{record.bjsj,jdbcType=TIMESTAMP},
260 280
       org_id = #{record.orgId,jdbcType=INTEGER},
261
-      data_flag = #{record.dataFlag,jdbcType=INTEGER}
281
+      data_flag = #{record.dataFlag,jdbcType=INTEGER},
282
+      approval_status = #{record.approvalStatus,jdbcType=VARCHAR},
283
+      approval_status_name = #{record.approvalStatusName,jdbcType=VARCHAR}
262 284
     <if test="_parameter != null" >
263 285
       <include refid="Update_By_Example_Where_Clause" />
264 286
     </if>
@@ -299,6 +321,12 @@
299 321
       <if test="dataFlag != null" >
300 322
         data_flag = #{dataFlag,jdbcType=INTEGER},
301 323
       </if>
324
+      <if test="approvalStatus != null" >
325
+        approval_status = #{approvalStatus,jdbcType=VARCHAR},
326
+      </if>
327
+      <if test="approvalStatusName != null" >
328
+        approval_status_name = #{approvalStatusName,jdbcType=VARCHAR},
329
+      </if>
302 330
     </set>
303 331
     where id = #{id,jdbcType=VARCHAR}
304 332
   </update>
@@ -314,7 +342,9 @@
314 342
       bjxx = #{bjxx,jdbcType=VARCHAR},
315 343
       bjsj = #{bjsj,jdbcType=TIMESTAMP},
316 344
       org_id = #{orgId,jdbcType=INTEGER},
317
-      data_flag = #{dataFlag,jdbcType=INTEGER}
345
+      data_flag = #{dataFlag,jdbcType=INTEGER},
346
+      approval_status = #{approvalStatus,jdbcType=VARCHAR},
347
+      approval_status_name = #{approvalStatusName,jdbcType=VARCHAR}
318 348
     where id = #{id,jdbcType=VARCHAR}
319 349
   </update>
320 350
 </mapper>

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

@@ -457,6 +457,9 @@
457 457
 	<if test="thresholdType != null">
458 458
 	and a.threshold_type=#{thresholdType}
459 459
 	</if>
460
+	<if test="houseId != null">
461
+	and a.house_id=#{houseId}
462
+	</if>
460 463
 	<if test="pz != null">
461 464
 	and a.pz=#{pz}
462 465
 	</if>

+ 4 - 0
src/main/java/com/chinaitop/depot/tempWarn/model/StorageThresholdAlarm.java

@@ -36,4 +36,8 @@ public class StorageThresholdAlarm {
36 36
 
37 37
     // 业务数据
38 38
     private String lypzmc;// 品种名称
39
+
40
+    private String approvalStatus;//状态编码
41
+
42
+    private String approvalStatusName;//状态名称
39 43
 }

+ 1 - 0
src/main/java/com/chinaitop/depot/tempWarn/param/StorageThresholdAlarmPageParam.java

@@ -15,4 +15,5 @@ public class StorageThresholdAlarmPageParam extends PageParam {
15 15
 
16 16
     private Integer orgId;// 机构id
17 17
     private Integer houseId;// 仓房id
18
+    private Integer dataFlag;// 0:市平台预警数据,1:库平台预警数据
18 19
 }

+ 3 - 2
src/main/java/com/chinaitop/depot/tempWarn/service/StorageThresholdAlarmService.java

@@ -1,10 +1,10 @@
1 1
 package com.chinaitop.depot.tempWarn.service;
2 2
 
3
+import java.util.List;
4
+
3 5
 import com.chinaitop.depot.tempWarn.model.StorageThresholdAlarm;
4 6
 import com.chinaitop.depot.tempWarn.param.StorageThresholdAlarmPageParam;
5 7
 
6
-import java.util.List;
7
-
8 8
 /**
9 9
  * @author qingsong.han
10 10
  * @description:
@@ -14,4 +14,5 @@ public interface StorageThresholdAlarmService {
14 14
     List<StorageThresholdAlarm> getPageList(StorageThresholdAlarmPageParam pageParam);
15 15
 
16 16
     void saveAgeWaring();
17
+
17 18
 }

+ 1 - 1
src/main/java/com/chinaitop/depot/tempWarn/service/TTempWetAlarmService.java

@@ -20,5 +20,5 @@ public interface TTempWetAlarmService {
20 20
 
21 21
     List<Map<String, Object>> getModalPageList(TempWetCheckRecordPageParam pageParam);
22 22
 
23
-    List<TTempWetAlarmRecordWithBLOBs> getRecordList(String alarmId);
23
+    List<TTempWetAlarmRecordWithBLOBs> getRecordList(String alarmId, Integer processType);
24 24
 }

+ 27 - 17
src/main/java/com/chinaitop/depot/tempWarn/service/impl/StorageThresholdAlarmServiceImpl.java

@@ -1,25 +1,27 @@
1 1
 package com.chinaitop.depot.tempWarn.service.impl;
2 2
 
3
+import java.time.LocalDate;
4
+import java.time.ZoneId;
5
+import java.util.Date;
6
+import java.util.List;
7
+import java.util.UUID;
8
+
9
+import javax.annotation.Resource;
10
+
11
+import org.springframework.stereotype.Service;
12
+import org.springframework.util.CollectionUtils;
13
+import org.springframework.util.ObjectUtils;
14
+
3 15
 import com.chinaitop.depot.tempWarn.mapper.StorageThresholdAlarmMapper;
4 16
 import com.chinaitop.depot.tempWarn.mapper.StorageThresholdSetMapper;
5 17
 import com.chinaitop.depot.tempWarn.model.StorageThresholdAlarm;
6 18
 import com.chinaitop.depot.tempWarn.model.StorageThresholdAlarmExample;
7 19
 import com.chinaitop.depot.tempWarn.model.StorageThresholdSet;
8
-import com.chinaitop.depot.tempWarn.model.StorageThresholdSetExample;
9 20
 import com.chinaitop.depot.tempWarn.param.StorageThresholdAlarmPageParam;
10 21
 import com.chinaitop.depot.tempWarn.service.StorageThresholdAlarmService;
11 22
 import com.chinaitop.depot.utils.DateUtil;
12
-import lombok.extern.slf4j.Slf4j;
13
-import org.springframework.stereotype.Service;
14
-import org.springframework.util.CollectionUtils;
15
-import org.springframework.util.ObjectUtils;
16 23
 
17
-import javax.annotation.Resource;
18
-import java.time.LocalDate;
19
-import java.time.ZoneId;
20
-import java.util.Date;
21
-import java.util.List;
22
-import java.util.UUID;
24
+import lombok.extern.slf4j.Slf4j;
23 25
 
24 26
 /**
25 27
  * @author qingsong.han
@@ -39,7 +41,7 @@ public class StorageThresholdAlarmServiceImpl implements StorageThresholdAlarmSe
39 41
         StorageThresholdAlarmExample example = new StorageThresholdAlarmExample();
40 42
         StorageThresholdAlarmExample.Criteria criteria = example.createCriteria();
41 43
         criteria.andOrgIdEqualTo(pageParam.getOrgId());
42
-        criteria.andDataFlagEqualTo(1);
44
+        criteria.andDataFlagEqualTo(pageParam.getDataFlag());
43 45
         if (!ObjectUtils.isEmpty(pageParam.getHouseId())) {
44 46
             criteria.andHouseIdEqualTo(pageParam.getHouseId());
45 47
         }
@@ -91,12 +93,20 @@ public class StorageThresholdAlarmServiceImpl implements StorageThresholdAlarmSe
91 93
                                                 alarm.setDataFlag(0);
92 94
                                                 alarm.setKnccnx(sptccnx);
93 95
                                                 alarm.setCccxsj(cccxsj);
94
-                                                alarm.setBjxx("已超过存储期限要求");
96
+                                                alarm.setBjxx("已超过储存年限");
95 97
                                                 alarm.setBjsj(nowDate);
98
+                                                if (null != alarm.getHwxz() && alarm.getHwxz().toString().equals("6877")) {//省级储备粮
99
+                                                	alarm.setApprovalStatus("120200");
100
+                                                	alarm.setApprovalStatusName("待市级管理单位处理");
101
+                                                }
102
+                                                if (null != alarm.getHwxz() && alarm.getHwxz().toString().equals("6878")) {//市级储备粮
103
+                                                	alarm.setApprovalStatus("140200");
104
+                                                	alarm.setApprovalStatusName("待区级管理单位处理");
105
+                                                }
96 106
                                                 thresholdAlarmMapper.insertSelective(alarm);
97 107
                                             }
98 108
                                         }
99
-                                        // 库平台报警
109
+                                        // 库平台预警提醒
100 110
                                         if (!ObjectUtils.isEmpty(knccnx)) {
101 111
                                             // 是否超限
102 112
                                             int knccnxPK = Integer.parseInt(scnf) + knccnx;
@@ -115,17 +125,17 @@ public class StorageThresholdAlarmServiceImpl implements StorageThresholdAlarmSe
115 125
                                             if (nowStr.equals(cccxsjStr)) {
116 126
                                                 Date cccxsj = DateUtil.stringToData(cccxsjStr, "yyyy-MM-dd");
117 127
                                                 alarm.setCccxsj(cccxsj);
118
-                                                alarm.setBjxx("已超过存期限要求");
128
+                                                alarm.setBjxx("已超过库内设置的储存期限要求");
119 129
                                                 thresholdAlarmMapper.insertSelective(alarm);
120 130
                                             } else if (localDate_3.equals(cccxsjStr)) {
121 131
                                                 Date cccxsj = DateUtil.stringToData(localDate_3, "yyyy-MM-dd");
122 132
                                                 alarm.setCccxsj(cccxsj);
123
-                                                alarm.setBjxx("距离超过储存期限还有3个月");
133
+                                                alarm.setBjxx("距离超过库内设置的储存年限还有3个月");
124 134
                                                 thresholdAlarmMapper.insertSelective(alarm);
125 135
                                             }  else if (localDate_1.equals(cccxsjStr)) {
126 136
                                                 Date cccxsj = DateUtil.stringToData(localDate_1, "yyyy-MM-dd");
127 137
                                                 alarm.setCccxsj(cccxsj);
128
-                                                alarm.setBjxx("距离超过储存期限还有1个月");
138
+                                                alarm.setBjxx("距离超过库内设置的储存年限还有1个月");
129 139
                                                 thresholdAlarmMapper.insertSelective(alarm);
130 140
                                             }
131 141
                                         }

+ 3 - 1
src/main/java/com/chinaitop/depot/tempWarn/service/impl/TTempWetAlarmServiceImpl.java

@@ -171,10 +171,12 @@ public class TTempWetAlarmServiceImpl implements TTempWetAlarmService {
171 171
     }
172 172
 
173 173
     @Override
174
-    public List<TTempWetAlarmRecordWithBLOBs> getRecordList(String alarmId) {
174
+    public List<TTempWetAlarmRecordWithBLOBs> getRecordList(String alarmId, Integer processType) {
175 175
         TTempWetAlarmRecordExample example = new TTempWetAlarmRecordExample();
176 176
         TTempWetAlarmRecordExample.Criteria criteria = example.createCriteria();
177 177
         criteria.andAlarmIdEqualTo(alarmId);
178
+        criteria.andProcessTypeEqualTo(processType);
179
+        example.setOrderByClause("process_time");
178 180
         return tempWetAlarmRecordMapper.selectByExampleWithBLOBs(example);
179 181
     }
180 182
 

+ 4 - 3
src/main/java/com/chinaitop/depot/yjbj/controller/YjbjController.java

@@ -353,11 +353,12 @@ public class YjbjController {
353 353
 	@RequestMapping(value="/getCljl", produces = MediaType.APPLICATION_JSON_VALUE, method = RequestMethod.GET)
354 354
 	@ApiOperation(value="查询处理记录", notes = "")
355 355
 	@ApiImplicitParams({
356
-        @ApiImplicitParam(name = "alarmId", value = "数据ID", required=true, paramType = "query")
356
+        @ApiImplicitParam(name = "alarmId", value = "数据ID", required=true, paramType = "query"),
357
+        @ApiImplicitParam(name = "type", value = "类型", paramType = "query")
357 358
 	})
358
-	public ResponseEntity getCljl(String alarmId) {
359
+	public ResponseEntity getCljl(String alarmId, String type) {
359 360
 		try {
360
-			List<StorageAlarmRecordWithBLOBs> list = storageAlarmRecordService.findByCondition(alarmId);
361
+			List<StorageAlarmRecordWithBLOBs> list = storageAlarmRecordService.findByCondition(alarmId, type);
361 362
 			return ResponseEntity.ok(list);
362 363
 		} catch (Exception e) {
363 364
 			log.error(e.getMessage(), e);

+ 2 - 1
src/main/java/com/chinaitop/depot/yjbj/service/StorageAlarmRecordService.java

@@ -9,8 +9,9 @@ public interface StorageAlarmRecordService {
9 9
 	/**
10 10
 	 * 查询处理记录数据
11 11
 	 * @param alarmId 业务数据主键ID
12
+	 * @param type 类型
12 13
 	 * @return
13 14
 	 * @throws Exception
14 15
 	 */
15
-	List<StorageAlarmRecordWithBLOBs> findByCondition(String alarmId) throws Exception;
16
+	List<StorageAlarmRecordWithBLOBs> findByCondition(String alarmId, String type) throws Exception;
16 17
 }

+ 14 - 1
src/main/java/com/chinaitop/depot/yjbj/service/impl/StorageAlarmRecordServiceImpl.java

@@ -1,5 +1,6 @@
1 1
 package com.chinaitop.depot.yjbj.service.impl;
2 2
 
3
+import java.util.ArrayList;
3 4
 import java.util.List;
4 5
 
5 6
 import javax.annotation.Resource;
@@ -31,10 +32,22 @@ public class StorageAlarmRecordServiceImpl implements StorageAlarmRecordService
31 32
     private FileUrlUtil fileUrlUtil;
32 33
 
33 34
 	@Override
34
-	public List<StorageAlarmRecordWithBLOBs> findByCondition(String alarmId) throws Exception {
35
+	public List<StorageAlarmRecordWithBLOBs> findByCondition(String alarmId, String type) throws Exception {
35 36
 		StorageAlarmRecordExample example = new StorageAlarmRecordExample();
36 37
 		StorageAlarmRecordExample.Criteria criteria = example.createCriteria();
37 38
 		criteria.andAlarmIdEqualTo(alarmId);
39
+		if ("2".equals(type)) {
40
+			List<Integer> processTypeList = new ArrayList<>();
41
+			processTypeList.add(15);
42
+			processTypeList.add(16);
43
+			criteria.andProcessTypeIn(processTypeList);
44
+		}
45
+		if ("3".equals(type)) {
46
+			List<Integer> processTypeList = new ArrayList<>();
47
+			processTypeList.add(13);
48
+			processTypeList.add(14);
49
+			criteria.andProcessTypeIn(processTypeList);
50
+		}
38 51
 		example.setOrderByClause("process_time");//按照处理时间排序
39 52
 		List<StorageAlarmRecordWithBLOBs> list = storageAlarmRecordMapper.selectByExampleWithBLOBs(example);
40 53
 		if (null != list && list.size() > 0) {