Pārlūkot izejas kodu

Merge branch 'dev-2.2.0' of depot-qinghai/depot-storage-qinghai into dev

fanxw 1 gadu atpakaļ
vecāks
revīzija
3bd99c649e

+ 9 - 1
src/main/java/com/chinaitop/depot/SwaggerConfig.java

@@ -31,6 +31,7 @@ public class SwaggerConfig {
31 31
     private static final String risk = "com.chinaitop.depot.risk.controller;";
32 32
     private static final String fumigation = "com.chinaitop.depot.fumigation.controller;";
33 33
     private static final String spt = "com.chinaitop.depot.sptData.controller;";
34
+    private static final String warningAndAlarm = "com.chinaitop.depot.warningAndAlarm.controller;";
34 35
     /**
35 36
      * 1.添加包path
36 37
      * 2.append(静态变量)
@@ -39,7 +40,14 @@ public class SwaggerConfig {
39 40
      */
40 41
     private static String addPackage() {
41 42
         StringBuilder countServer = new StringBuilder();
42
-        countServer.append(business).append(safeProduce).append(storage).append(registration).append(risk).append(fumigation).append(spt);
43
+        countServer.append(business)
44
+        			.append(safeProduce)
45
+        			.append(storage)
46
+        			.append(registration)
47
+        			.append(risk)
48
+        			.append(fumigation)
49
+        			.append(spt)
50
+        			.append(warningAndAlarm);
43 51
         return countServer.toString();
44 52
     }
45 53
 

+ 46 - 0
src/main/java/com/chinaitop/depot/warningAndAlarm/controller/TimedTaskController.java

@@ -0,0 +1,46 @@
1
+package com.chinaitop.depot.warningAndAlarm.controller;
2
+
3
+import javax.annotation.Resource;
4
+
5
+import org.springframework.scheduling.annotation.Scheduled;
6
+import org.springframework.web.bind.annotation.RequestMapping;
7
+import org.springframework.web.bind.annotation.RequestMethod;
8
+import org.springframework.web.bind.annotation.RestController;
9
+
10
+import com.chinaitop.depot.warningAndAlarm.service.TimedTaskService;
11
+
12
+import io.swagger.annotations.Api;
13
+import io.swagger.annotations.ApiOperation;
14
+import lombok.extern.slf4j.Slf4j;
15
+
16
+@RequestMapping(value="/timesTask")
17
+@Api(value= "TimedTaskController", description="预警报警数据定时任务检测控制类")
18
+@RestController
19
+@Slf4j
20
+public class TimedTaskController {
21
+
22
+	@Resource
23
+	private TimedTaskService timeTaskService;
24
+
25
+	@Scheduled(cron = "0 0 1 * * ?")
26
+	@RequestMapping(value="/checkYlwl", method = RequestMethod.GET)
27
+	@ApiOperation(value="检测应轮未轮报警数据", notes = "定时任务检测,每天凌晨1点执行")
28
+	public void checkYlwl() {
29
+		try {
30
+			timeTaskService.insertYlwl();
31
+		} catch (Exception e) {
32
+			log.error(e.getMessage(), e);
33
+		}
34
+	}
35
+
36
+	@Scheduled(cron = "0 30 1 * * ?")
37
+	@RequestMapping(value="/checkLhyj", method = RequestMethod.GET)
38
+	@ApiOperation(value="检测轮换预警数据", notes = "定时任务检测,每天凌晨1:30点执行")
39
+	public void checkLhyj() {
40
+		try {
41
+			timeTaskService.insertLhyj();
42
+		} catch (Exception e) {
43
+			log.error(e.getMessage(), e);
44
+		}
45
+	}
46
+}

+ 107 - 0
src/main/java/com/chinaitop/depot/warningAndAlarm/controller/YjBjController.java

@@ -0,0 +1,107 @@
1
+package com.chinaitop.depot.warningAndAlarm.controller;
2
+
3
+import java.util.List;
4
+
5
+import javax.annotation.Resource;
6
+
7
+import org.apache.commons.lang.StringUtils;
8
+import org.springframework.web.bind.annotation.RequestMapping;
9
+import org.springframework.web.bind.annotation.RequestMethod;
10
+import org.springframework.web.bind.annotation.RestController;
11
+
12
+import com.alibaba.fastjson.JSONObject;
13
+import com.chinaitop.depot.unissoft.model.ResponseEntity;
14
+import com.chinaitop.depot.warningAndAlarm.model.StorageRotationWarning;
15
+import com.chinaitop.depot.warningAndAlarm.model.StorageRotationWarningWithBLOBs;
16
+import com.chinaitop.depot.warningAndAlarm.service.YjbjService;
17
+import com.github.pagehelper.PageHelper;
18
+import com.github.pagehelper.PageInfo;
19
+
20
+import io.swagger.annotations.Api;
21
+import io.swagger.annotations.ApiImplicitParam;
22
+import io.swagger.annotations.ApiImplicitParams;
23
+import io.swagger.annotations.ApiOperation;
24
+import lombok.extern.slf4j.Slf4j;
25
+
26
+@RequestMapping(value="/yjbj")
27
+@Api(value= "YjBjController", description="预警报警功能控制类")
28
+@RestController
29
+@Slf4j
30
+@SuppressWarnings("all")
31
+public class YjBjController {
32
+
33
+	@Resource
34
+	private YjbjService yjbjService;
35
+
36
+	@RequestMapping(value="/getLhyjPageInfoList", method = RequestMethod.GET)
37
+	@ApiOperation(value="轮换预警列表", notes = "支持分页")
38
+	@ApiImplicitParams({
39
+		@ApiImplicitParam(name = "pageNum", value = "页码", paramType = "query"),
40
+        @ApiImplicitParam(name = "pageSize", value = "每页条数", paramType = "query"),
41
+        @ApiImplicitParam(name = "orgId", value = "库ID", paramType = "query"),
42
+        @ApiImplicitParam(name = "ch", value = "仓房ID", paramType = "query"),
43
+        @ApiImplicitParam(name = "hwh", value = "货位ID", paramType = "query"),
44
+        @ApiImplicitParam(name = "lspz", value = "粮食品种ID", paramType = "query")
45
+	})
46
+	public ResponseEntity<PageInfo<StorageRotationWarning>> getLhyjPageInfoList(Integer pageNum, Integer pageSize, Integer orgId, Integer ch, Integer hwh, Integer lspz) {
47
+		PageInfo<StorageRotationWarning> pageInfo = null;
48
+		try {
49
+			if (pageNum != null && pageSize != null) {
50
+	            PageHelper.startPage(pageNum, pageSize);
51
+	        }
52
+			List<StorageRotationWarning> list = yjbjService.queryLhyjList(orgId, ch, hwh, lspz);
53
+			pageInfo = new PageInfo<>(list);
54
+		} catch (Exception e) {
55
+			log.error(e.getMessage(), e);
56
+		}
57
+		return ResponseEntity.ok(pageInfo);
58
+	}
59
+
60
+	@RequestMapping(value="/getYlwlPageInfoList", method = RequestMethod.GET)
61
+	@ApiOperation(value="应轮未轮报警列表", notes = "支持分页")
62
+	@ApiImplicitParams({
63
+		@ApiImplicitParam(name = "pageNum", value = "页码", paramType = "query"),
64
+        @ApiImplicitParam(name = "pageSize", value = "每页条数", paramType = "query"),
65
+        @ApiImplicitParam(name = "orgId", value = "库ID", paramType = "query"),
66
+        @ApiImplicitParam(name = "ch", value = "仓房ID", paramType = "query"),
67
+        @ApiImplicitParam(name = "hwh", value = "货位ID", paramType = "query"),
68
+        @ApiImplicitParam(name = "lspz", value = "粮食品种ID", paramType = "query")
69
+	})
70
+	public ResponseEntity<PageInfo<StorageRotationWarning>> getYlwlPageInfoList(Integer pageNum, Integer pageSize, Integer orgId, Integer ch, Integer hwh, Integer lspz) {
71
+		PageInfo<StorageRotationWarning> pageInfo = null;
72
+		try {
73
+			if (pageNum != null && pageSize != null) {
74
+	            PageHelper.startPage(pageNum, pageSize);
75
+	        }
76
+			List<StorageRotationWarning> list = yjbjService.queryYlwlList(orgId, ch, hwh, lspz);
77
+			pageInfo = new PageInfo<>(list);
78
+		} catch (Exception e) {
79
+			log.error(e.getMessage(), e);
80
+		}
81
+		return ResponseEntity.ok(pageInfo);
82
+	}
83
+
84
+	@RequestMapping(value="/editLhyj", method = RequestMethod.GET)
85
+	@ApiOperation(value="预警报警数据更新", notes = "")
86
+	@ApiImplicitParams({
87
+        @ApiImplicitParam(name = "lhyjJson", value = "数据对象", paramType = "query")
88
+	})
89
+	public ResponseEntity editLhyj(String lhyjJson) {
90
+		PageInfo<StorageRotationWarning> pageInfo = null;
91
+		try {
92
+			if (StringUtils.isNotBlank(lhyjJson)) {
93
+				StorageRotationWarningWithBLOBs storageRotationWarningWithBLOBs = JSONObject.parseObject(lhyjJson, StorageRotationWarningWithBLOBs.class);
94
+                if (storageRotationWarningWithBLOBs.getId() == null) {
95
+                    return ResponseEntity.failed("数据ID不能为空!");
96
+                }
97
+
98
+                yjbjService.updateDate(storageRotationWarningWithBLOBs);
99
+
100
+                return ResponseEntity.ok();
101
+            }
102
+		} catch (Exception e) {
103
+			log.error(e.getMessage(), e);
104
+		}
105
+		return ResponseEntity.ok(pageInfo);
106
+	}
107
+}

+ 37 - 0
src/main/java/com/chinaitop/depot/warningAndAlarm/mapper/StorageRotationWarningMapper.java

@@ -0,0 +1,37 @@
1
+package com.chinaitop.depot.warningAndAlarm.mapper;
2
+
3
+import com.chinaitop.depot.warningAndAlarm.model.StorageRotationWarning;
4
+import com.chinaitop.depot.warningAndAlarm.model.StorageRotationWarningExample;
5
+import com.chinaitop.depot.warningAndAlarm.model.StorageRotationWarningWithBLOBs;
6
+import java.util.List;
7
+import org.apache.ibatis.annotations.Param;
8
+
9
+public interface StorageRotationWarningMapper {
10
+    int countByExample(StorageRotationWarningExample example);
11
+
12
+    int deleteByExample(StorageRotationWarningExample example);
13
+
14
+    int deleteByPrimaryKey(String id);
15
+
16
+    int insert(StorageRotationWarningWithBLOBs record);
17
+
18
+    int insertSelective(StorageRotationWarningWithBLOBs record);
19
+
20
+    List<StorageRotationWarningWithBLOBs> selectByExampleWithBLOBs(StorageRotationWarningExample example);
21
+
22
+    List<StorageRotationWarning> selectByExample(StorageRotationWarningExample example);
23
+
24
+    StorageRotationWarningWithBLOBs selectByPrimaryKey(String id);
25
+
26
+    int updateByExampleSelective(@Param("record") StorageRotationWarningWithBLOBs record, @Param("example") StorageRotationWarningExample example);
27
+
28
+    int updateByExampleWithBLOBs(@Param("record") StorageRotationWarningWithBLOBs record, @Param("example") StorageRotationWarningExample example);
29
+
30
+    int updateByExample(@Param("record") StorageRotationWarning record, @Param("example") StorageRotationWarningExample example);
31
+
32
+    int updateByPrimaryKeySelective(StorageRotationWarningWithBLOBs record);
33
+
34
+    int updateByPrimaryKeyWithBLOBs(StorageRotationWarningWithBLOBs record);
35
+
36
+    int updateByPrimaryKey(StorageRotationWarning record);
37
+}

+ 516 - 0
src/main/java/com/chinaitop/depot/warningAndAlarm/mapper/StorageRotationWarningMapper.xml

@@ -0,0 +1,516 @@
1
+<?xml version="1.0" encoding="UTF-8"?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
3
+<mapper namespace="com.chinaitop.depot.warningAndAlarm.mapper.StorageRotationWarningMapper">
4
+  <resultMap id="BaseResultMap" type="com.chinaitop.depot.warningAndAlarm.model.StorageRotationWarning">
5
+    <id column="id" jdbcType="VARCHAR" property="id" />
6
+    <result column="ch" jdbcType="INTEGER" property="ch" />
7
+    <result column="hwh" jdbcType="INTEGER" property="hwh" />
8
+    <result column="lspz" jdbcType="INTEGER" property="lspz" />
9
+    <result column="lsxz" jdbcType="INTEGER" property="lsxz" />
10
+    <result column="kcsl" jdbcType="DECIMAL" property="kcsl" />
11
+    <result column="scnf" jdbcType="INTEGER" property="scnf" />
12
+    <result column="zhycrq" jdbcType="VARCHAR" property="zhycrq" />
13
+    <result column="cbnx" jdbcType="VARCHAR" property="cbnx" />
14
+    <result column="cccxrq" jdbcType="VARCHAR" property="cccxrq" />
15
+    <result column="bjrq" jdbcType="VARCHAR" property="bjrq" />
16
+    <result column="bjlx" jdbcType="VARCHAR" property="bjlx" />
17
+    <result column="clzt" jdbcType="VARCHAR" property="clzt" />
18
+    <result column="clr" jdbcType="VARCHAR" property="clr" />
19
+    <result column="clsj" jdbcType="TIMESTAMP" property="clsj" />
20
+    <result column="org_id" jdbcType="INTEGER" property="orgId" />
21
+    <result column="scsj" jdbcType="TIMESTAMP" property="scsj" />
22
+    <result column="updatetime" jdbcType="TIMESTAMP" property="updatetime" />
23
+  </resultMap>
24
+  <resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.chinaitop.depot.warningAndAlarm.model.StorageRotationWarningWithBLOBs">
25
+    <result column="remark" jdbcType="LONGVARCHAR" property="remark" />
26
+    <result column="clyj" jdbcType="LONGVARCHAR" property="clyj" />
27
+  </resultMap>
28
+  <sql id="Example_Where_Clause">
29
+    <where>
30
+      <foreach collection="oredCriteria" item="criteria" separator="or">
31
+        <if test="criteria.valid">
32
+          <trim prefix="(" prefixOverrides="and" suffix=")">
33
+            <foreach collection="criteria.criteria" item="criterion">
34
+              <choose>
35
+                <when test="criterion.noValue">
36
+                  and ${criterion.condition}
37
+                </when>
38
+                <when test="criterion.singleValue">
39
+                  and ${criterion.condition} #{criterion.value}
40
+                </when>
41
+                <when test="criterion.betweenValue">
42
+                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
43
+                </when>
44
+                <when test="criterion.listValue">
45
+                  and ${criterion.condition}
46
+                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
47
+                    #{listItem}
48
+                  </foreach>
49
+                </when>
50
+              </choose>
51
+            </foreach>
52
+          </trim>
53
+        </if>
54
+      </foreach>
55
+    </where>
56
+  </sql>
57
+  <sql id="Update_By_Example_Where_Clause">
58
+    <where>
59
+      <foreach collection="example.oredCriteria" item="criteria" separator="or">
60
+        <if test="criteria.valid">
61
+          <trim prefix="(" prefixOverrides="and" suffix=")">
62
+            <foreach collection="criteria.criteria" item="criterion">
63
+              <choose>
64
+                <when test="criterion.noValue">
65
+                  and ${criterion.condition}
66
+                </when>
67
+                <when test="criterion.singleValue">
68
+                  and ${criterion.condition} #{criterion.value}
69
+                </when>
70
+                <when test="criterion.betweenValue">
71
+                  and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
72
+                </when>
73
+                <when test="criterion.listValue">
74
+                  and ${criterion.condition}
75
+                  <foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
76
+                    #{listItem}
77
+                  </foreach>
78
+                </when>
79
+              </choose>
80
+            </foreach>
81
+          </trim>
82
+        </if>
83
+      </foreach>
84
+    </where>
85
+  </sql>
86
+  <sql id="Base_Column_List">
87
+    id, ch, hwh, lspz, lsxz, kcsl, scnf, zhycrq, cbnx, cccxrq, bjrq, bjlx, clzt, clr, 
88
+    clsj, org_id, scsj, updatetime
89
+  </sql>
90
+  <sql id="Blob_Column_List">
91
+    remark, clyj
92
+  </sql>
93
+  <select id="selectByExampleWithBLOBs" parameterType="com.chinaitop.depot.warningAndAlarm.model.StorageRotationWarningExample" resultMap="ResultMapWithBLOBs">
94
+    select
95
+    <if test="distinct">
96
+      distinct
97
+    </if>
98
+    <include refid="Base_Column_List" />
99
+    ,
100
+    <include refid="Blob_Column_List" />
101
+    from storage_rotation_warning
102
+    <if test="_parameter != null">
103
+      <include refid="Example_Where_Clause" />
104
+    </if>
105
+    <if test="orderByClause != null">
106
+      order by ${orderByClause}
107
+    </if>
108
+  </select>
109
+  <select id="selectByExample" parameterType="com.chinaitop.depot.warningAndAlarm.model.StorageRotationWarningExample" resultMap="BaseResultMap">
110
+    select
111
+    <if test="distinct">
112
+      distinct
113
+    </if>
114
+    <include refid="Base_Column_List" />
115
+    from storage_rotation_warning
116
+    <if test="_parameter != null">
117
+      <include refid="Example_Where_Clause" />
118
+    </if>
119
+    <if test="orderByClause != null">
120
+      order by ${orderByClause}
121
+    </if>
122
+  </select>
123
+  <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="ResultMapWithBLOBs">
124
+    select 
125
+    <include refid="Base_Column_List" />
126
+    ,
127
+    <include refid="Blob_Column_List" />
128
+    from storage_rotation_warning
129
+    where id = #{id,jdbcType=VARCHAR}
130
+  </select>
131
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.String">
132
+    delete from storage_rotation_warning
133
+    where id = #{id,jdbcType=VARCHAR}
134
+  </delete>
135
+  <delete id="deleteByExample" parameterType="com.chinaitop.depot.warningAndAlarm.model.StorageRotationWarningExample">
136
+    delete from storage_rotation_warning
137
+    <if test="_parameter != null">
138
+      <include refid="Example_Where_Clause" />
139
+    </if>
140
+  </delete>
141
+  <insert id="insert" parameterType="com.chinaitop.depot.warningAndAlarm.model.StorageRotationWarningWithBLOBs">
142
+    insert into storage_rotation_warning (id, ch, hwh, 
143
+      lspz, lsxz, kcsl, scnf, 
144
+      zhycrq, cbnx, cccxrq, 
145
+      bjrq, bjlx, clzt, clr, 
146
+      clsj, org_id, scsj, 
147
+      updatetime, remark, clyj
148
+      )
149
+    values (#{id,jdbcType=VARCHAR}, #{ch,jdbcType=INTEGER}, #{hwh,jdbcType=INTEGER}, 
150
+      #{lspz,jdbcType=INTEGER}, #{lsxz,jdbcType=INTEGER}, #{kcsl,jdbcType=DECIMAL}, #{scnf,jdbcType=INTEGER}, 
151
+      #{zhycrq,jdbcType=VARCHAR}, #{cbnx,jdbcType=VARCHAR}, #{cccxrq,jdbcType=VARCHAR}, 
152
+      #{bjrq,jdbcType=VARCHAR}, #{bjlx,jdbcType=VARCHAR}, #{clzt,jdbcType=VARCHAR}, #{clr,jdbcType=VARCHAR}, 
153
+      #{clsj,jdbcType=TIMESTAMP}, #{orgId,jdbcType=INTEGER}, #{scsj,jdbcType=TIMESTAMP}, 
154
+      #{updatetime,jdbcType=TIMESTAMP}, #{remark,jdbcType=LONGVARCHAR}, #{clyj,jdbcType=LONGVARCHAR}
155
+      )
156
+  </insert>
157
+  <insert id="insertSelective" parameterType="com.chinaitop.depot.warningAndAlarm.model.StorageRotationWarningWithBLOBs">
158
+    insert into storage_rotation_warning
159
+    <trim prefix="(" suffix=")" suffixOverrides=",">
160
+      <if test="id != null">
161
+        id,
162
+      </if>
163
+      <if test="ch != null">
164
+        ch,
165
+      </if>
166
+      <if test="hwh != null">
167
+        hwh,
168
+      </if>
169
+      <if test="lspz != null">
170
+        lspz,
171
+      </if>
172
+      <if test="lsxz != null">
173
+        lsxz,
174
+      </if>
175
+      <if test="kcsl != null">
176
+        kcsl,
177
+      </if>
178
+      <if test="scnf != null">
179
+        scnf,
180
+      </if>
181
+      <if test="zhycrq != null">
182
+        zhycrq,
183
+      </if>
184
+      <if test="cbnx != null">
185
+        cbnx,
186
+      </if>
187
+      <if test="cccxrq != null">
188
+        cccxrq,
189
+      </if>
190
+      <if test="bjrq != null">
191
+        bjrq,
192
+      </if>
193
+      <if test="bjlx != null">
194
+        bjlx,
195
+      </if>
196
+      <if test="clzt != null">
197
+        clzt,
198
+      </if>
199
+      <if test="clr != null">
200
+        clr,
201
+      </if>
202
+      <if test="clsj != null">
203
+        clsj,
204
+      </if>
205
+      <if test="orgId != null">
206
+        org_id,
207
+      </if>
208
+      <if test="scsj != null">
209
+        scsj,
210
+      </if>
211
+      <if test="updatetime != null">
212
+        updatetime,
213
+      </if>
214
+      <if test="remark != null">
215
+        remark,
216
+      </if>
217
+      <if test="clyj != null">
218
+        clyj,
219
+      </if>
220
+    </trim>
221
+    <trim prefix="values (" suffix=")" suffixOverrides=",">
222
+      <if test="id != null">
223
+        #{id,jdbcType=VARCHAR},
224
+      </if>
225
+      <if test="ch != null">
226
+        #{ch,jdbcType=INTEGER},
227
+      </if>
228
+      <if test="hwh != null">
229
+        #{hwh,jdbcType=INTEGER},
230
+      </if>
231
+      <if test="lspz != null">
232
+        #{lspz,jdbcType=INTEGER},
233
+      </if>
234
+      <if test="lsxz != null">
235
+        #{lsxz,jdbcType=INTEGER},
236
+      </if>
237
+      <if test="kcsl != null">
238
+        #{kcsl,jdbcType=DECIMAL},
239
+      </if>
240
+      <if test="scnf != null">
241
+        #{scnf,jdbcType=INTEGER},
242
+      </if>
243
+      <if test="zhycrq != null">
244
+        #{zhycrq,jdbcType=VARCHAR},
245
+      </if>
246
+      <if test="cbnx != null">
247
+        #{cbnx,jdbcType=VARCHAR},
248
+      </if>
249
+      <if test="cccxrq != null">
250
+        #{cccxrq,jdbcType=VARCHAR},
251
+      </if>
252
+      <if test="bjrq != null">
253
+        #{bjrq,jdbcType=VARCHAR},
254
+      </if>
255
+      <if test="bjlx != null">
256
+        #{bjlx,jdbcType=VARCHAR},
257
+      </if>
258
+      <if test="clzt != null">
259
+        #{clzt,jdbcType=VARCHAR},
260
+      </if>
261
+      <if test="clr != null">
262
+        #{clr,jdbcType=VARCHAR},
263
+      </if>
264
+      <if test="clsj != null">
265
+        #{clsj,jdbcType=TIMESTAMP},
266
+      </if>
267
+      <if test="orgId != null">
268
+        #{orgId,jdbcType=INTEGER},
269
+      </if>
270
+      <if test="scsj != null">
271
+        #{scsj,jdbcType=TIMESTAMP},
272
+      </if>
273
+      <if test="updatetime != null">
274
+        #{updatetime,jdbcType=TIMESTAMP},
275
+      </if>
276
+      <if test="remark != null">
277
+        #{remark,jdbcType=LONGVARCHAR},
278
+      </if>
279
+      <if test="clyj != null">
280
+        #{clyj,jdbcType=LONGVARCHAR},
281
+      </if>
282
+    </trim>
283
+  </insert>
284
+  <select id="countByExample" parameterType="com.chinaitop.depot.warningAndAlarm.model.StorageRotationWarningExample" resultType="java.lang.Integer">
285
+    select count(*) from storage_rotation_warning
286
+    <if test="_parameter != null">
287
+      <include refid="Example_Where_Clause" />
288
+    </if>
289
+  </select>
290
+  <update id="updateByExampleSelective" parameterType="map">
291
+    update storage_rotation_warning
292
+    <set>
293
+      <if test="record.id != null">
294
+        id = #{record.id,jdbcType=VARCHAR},
295
+      </if>
296
+      <if test="record.ch != null">
297
+        ch = #{record.ch,jdbcType=INTEGER},
298
+      </if>
299
+      <if test="record.hwh != null">
300
+        hwh = #{record.hwh,jdbcType=INTEGER},
301
+      </if>
302
+      <if test="record.lspz != null">
303
+        lspz = #{record.lspz,jdbcType=INTEGER},
304
+      </if>
305
+      <if test="record.lsxz != null">
306
+        lsxz = #{record.lsxz,jdbcType=INTEGER},
307
+      </if>
308
+      <if test="record.kcsl != null">
309
+        kcsl = #{record.kcsl,jdbcType=DECIMAL},
310
+      </if>
311
+      <if test="record.scnf != null">
312
+        scnf = #{record.scnf,jdbcType=INTEGER},
313
+      </if>
314
+      <if test="record.zhycrq != null">
315
+        zhycrq = #{record.zhycrq,jdbcType=VARCHAR},
316
+      </if>
317
+      <if test="record.cbnx != null">
318
+        cbnx = #{record.cbnx,jdbcType=VARCHAR},
319
+      </if>
320
+      <if test="record.cccxrq != null">
321
+        cccxrq = #{record.cccxrq,jdbcType=VARCHAR},
322
+      </if>
323
+      <if test="record.bjrq != null">
324
+        bjrq = #{record.bjrq,jdbcType=VARCHAR},
325
+      </if>
326
+      <if test="record.bjlx != null">
327
+        bjlx = #{record.bjlx,jdbcType=VARCHAR},
328
+      </if>
329
+      <if test="record.clzt != null">
330
+        clzt = #{record.clzt,jdbcType=VARCHAR},
331
+      </if>
332
+      <if test="record.clr != null">
333
+        clr = #{record.clr,jdbcType=VARCHAR},
334
+      </if>
335
+      <if test="record.clsj != null">
336
+        clsj = #{record.clsj,jdbcType=TIMESTAMP},
337
+      </if>
338
+      <if test="record.orgId != null">
339
+        org_id = #{record.orgId,jdbcType=INTEGER},
340
+      </if>
341
+      <if test="record.scsj != null">
342
+        scsj = #{record.scsj,jdbcType=TIMESTAMP},
343
+      </if>
344
+      <if test="record.updatetime != null">
345
+        updatetime = #{record.updatetime,jdbcType=TIMESTAMP},
346
+      </if>
347
+      <if test="record.remark != null">
348
+        remark = #{record.remark,jdbcType=LONGVARCHAR},
349
+      </if>
350
+      <if test="record.clyj != null">
351
+        clyj = #{record.clyj,jdbcType=LONGVARCHAR},
352
+      </if>
353
+    </set>
354
+    <if test="_parameter != null">
355
+      <include refid="Update_By_Example_Where_Clause" />
356
+    </if>
357
+  </update>
358
+  <update id="updateByExampleWithBLOBs" parameterType="map">
359
+    update storage_rotation_warning
360
+    set id = #{record.id,jdbcType=VARCHAR},
361
+      ch = #{record.ch,jdbcType=INTEGER},
362
+      hwh = #{record.hwh,jdbcType=INTEGER},
363
+      lspz = #{record.lspz,jdbcType=INTEGER},
364
+      lsxz = #{record.lsxz,jdbcType=INTEGER},
365
+      kcsl = #{record.kcsl,jdbcType=DECIMAL},
366
+      scnf = #{record.scnf,jdbcType=INTEGER},
367
+      zhycrq = #{record.zhycrq,jdbcType=VARCHAR},
368
+      cbnx = #{record.cbnx,jdbcType=VARCHAR},
369
+      cccxrq = #{record.cccxrq,jdbcType=VARCHAR},
370
+      bjrq = #{record.bjrq,jdbcType=VARCHAR},
371
+      bjlx = #{record.bjlx,jdbcType=VARCHAR},
372
+      clzt = #{record.clzt,jdbcType=VARCHAR},
373
+      clr = #{record.clr,jdbcType=VARCHAR},
374
+      clsj = #{record.clsj,jdbcType=TIMESTAMP},
375
+      org_id = #{record.orgId,jdbcType=INTEGER},
376
+      scsj = #{record.scsj,jdbcType=TIMESTAMP},
377
+      updatetime = #{record.updatetime,jdbcType=TIMESTAMP},
378
+      remark = #{record.remark,jdbcType=LONGVARCHAR},
379
+      clyj = #{record.clyj,jdbcType=LONGVARCHAR}
380
+    <if test="_parameter != null">
381
+      <include refid="Update_By_Example_Where_Clause" />
382
+    </if>
383
+  </update>
384
+  <update id="updateByExample" parameterType="map">
385
+    update storage_rotation_warning
386
+    set id = #{record.id,jdbcType=VARCHAR},
387
+      ch = #{record.ch,jdbcType=INTEGER},
388
+      hwh = #{record.hwh,jdbcType=INTEGER},
389
+      lspz = #{record.lspz,jdbcType=INTEGER},
390
+      lsxz = #{record.lsxz,jdbcType=INTEGER},
391
+      kcsl = #{record.kcsl,jdbcType=DECIMAL},
392
+      scnf = #{record.scnf,jdbcType=INTEGER},
393
+      zhycrq = #{record.zhycrq,jdbcType=VARCHAR},
394
+      cbnx = #{record.cbnx,jdbcType=VARCHAR},
395
+      cccxrq = #{record.cccxrq,jdbcType=VARCHAR},
396
+      bjrq = #{record.bjrq,jdbcType=VARCHAR},
397
+      bjlx = #{record.bjlx,jdbcType=VARCHAR},
398
+      clzt = #{record.clzt,jdbcType=VARCHAR},
399
+      clr = #{record.clr,jdbcType=VARCHAR},
400
+      clsj = #{record.clsj,jdbcType=TIMESTAMP},
401
+      org_id = #{record.orgId,jdbcType=INTEGER},
402
+      scsj = #{record.scsj,jdbcType=TIMESTAMP},
403
+      updatetime = #{record.updatetime,jdbcType=TIMESTAMP}
404
+    <if test="_parameter != null">
405
+      <include refid="Update_By_Example_Where_Clause" />
406
+    </if>
407
+  </update>
408
+  <update id="updateByPrimaryKeySelective" parameterType="com.chinaitop.depot.warningAndAlarm.model.StorageRotationWarningWithBLOBs">
409
+    update storage_rotation_warning
410
+    <set>
411
+      <if test="ch != null">
412
+        ch = #{ch,jdbcType=INTEGER},
413
+      </if>
414
+      <if test="hwh != null">
415
+        hwh = #{hwh,jdbcType=INTEGER},
416
+      </if>
417
+      <if test="lspz != null">
418
+        lspz = #{lspz,jdbcType=INTEGER},
419
+      </if>
420
+      <if test="lsxz != null">
421
+        lsxz = #{lsxz,jdbcType=INTEGER},
422
+      </if>
423
+      <if test="kcsl != null">
424
+        kcsl = #{kcsl,jdbcType=DECIMAL},
425
+      </if>
426
+      <if test="scnf != null">
427
+        scnf = #{scnf,jdbcType=INTEGER},
428
+      </if>
429
+      <if test="zhycrq != null">
430
+        zhycrq = #{zhycrq,jdbcType=VARCHAR},
431
+      </if>
432
+      <if test="cbnx != null">
433
+        cbnx = #{cbnx,jdbcType=VARCHAR},
434
+      </if>
435
+      <if test="cccxrq != null">
436
+        cccxrq = #{cccxrq,jdbcType=VARCHAR},
437
+      </if>
438
+      <if test="bjrq != null">
439
+        bjrq = #{bjrq,jdbcType=VARCHAR},
440
+      </if>
441
+      <if test="bjlx != null">
442
+        bjlx = #{bjlx,jdbcType=VARCHAR},
443
+      </if>
444
+      <if test="clzt != null">
445
+        clzt = #{clzt,jdbcType=VARCHAR},
446
+      </if>
447
+      <if test="clr != null">
448
+        clr = #{clr,jdbcType=VARCHAR},
449
+      </if>
450
+      <if test="clsj != null">
451
+        clsj = #{clsj,jdbcType=TIMESTAMP},
452
+      </if>
453
+      <if test="orgId != null">
454
+        org_id = #{orgId,jdbcType=INTEGER},
455
+      </if>
456
+      <if test="scsj != null">
457
+        scsj = #{scsj,jdbcType=TIMESTAMP},
458
+      </if>
459
+      <if test="updatetime != null">
460
+        updatetime = #{updatetime,jdbcType=TIMESTAMP},
461
+      </if>
462
+      <if test="remark != null">
463
+        remark = #{remark,jdbcType=LONGVARCHAR},
464
+      </if>
465
+      <if test="clyj != null">
466
+        clyj = #{clyj,jdbcType=LONGVARCHAR},
467
+      </if>
468
+    </set>
469
+    where id = #{id,jdbcType=VARCHAR}
470
+  </update>
471
+  <update id="updateByPrimaryKeyWithBLOBs" parameterType="com.chinaitop.depot.warningAndAlarm.model.StorageRotationWarningWithBLOBs">
472
+    update storage_rotation_warning
473
+    set ch = #{ch,jdbcType=INTEGER},
474
+      hwh = #{hwh,jdbcType=INTEGER},
475
+      lspz = #{lspz,jdbcType=INTEGER},
476
+      lsxz = #{lsxz,jdbcType=INTEGER},
477
+      kcsl = #{kcsl,jdbcType=DECIMAL},
478
+      scnf = #{scnf,jdbcType=INTEGER},
479
+      zhycrq = #{zhycrq,jdbcType=VARCHAR},
480
+      cbnx = #{cbnx,jdbcType=VARCHAR},
481
+      cccxrq = #{cccxrq,jdbcType=VARCHAR},
482
+      bjrq = #{bjrq,jdbcType=VARCHAR},
483
+      bjlx = #{bjlx,jdbcType=VARCHAR},
484
+      clzt = #{clzt,jdbcType=VARCHAR},
485
+      clr = #{clr,jdbcType=VARCHAR},
486
+      clsj = #{clsj,jdbcType=TIMESTAMP},
487
+      org_id = #{orgId,jdbcType=INTEGER},
488
+      scsj = #{scsj,jdbcType=TIMESTAMP},
489
+      updatetime = #{updatetime,jdbcType=TIMESTAMP},
490
+      remark = #{remark,jdbcType=LONGVARCHAR},
491
+      clyj = #{clyj,jdbcType=LONGVARCHAR}
492
+    where id = #{id,jdbcType=VARCHAR}
493
+  </update>
494
+  <update id="updateByPrimaryKey" parameterType="com.chinaitop.depot.warningAndAlarm.model.StorageRotationWarning">
495
+    update storage_rotation_warning
496
+    set ch = #{ch,jdbcType=INTEGER},
497
+      hwh = #{hwh,jdbcType=INTEGER},
498
+      lspz = #{lspz,jdbcType=INTEGER},
499
+      lsxz = #{lsxz,jdbcType=INTEGER},
500
+      kcsl = #{kcsl,jdbcType=DECIMAL},
501
+      scnf = #{scnf,jdbcType=INTEGER},
502
+      zhycrq = #{zhycrq,jdbcType=VARCHAR},
503
+      cbnx = #{cbnx,jdbcType=VARCHAR},
504
+      cccxrq = #{cccxrq,jdbcType=VARCHAR},
505
+      bjrq = #{bjrq,jdbcType=VARCHAR},
506
+      bjlx = #{bjlx,jdbcType=VARCHAR},
507
+      clzt = #{clzt,jdbcType=VARCHAR},
508
+      clr = #{clr,jdbcType=VARCHAR},
509
+      clsj = #{clsj,jdbcType=TIMESTAMP},
510
+      org_id = #{orgId,jdbcType=INTEGER},
511
+      scsj = #{scsj,jdbcType=TIMESTAMP},
512
+      updatetime = #{updatetime,jdbcType=TIMESTAMP}
513
+    where id = #{id,jdbcType=VARCHAR}
514
+  </update>
515
+  
516
+</mapper>

+ 18 - 0
src/main/java/com/chinaitop/depot/warningAndAlarm/mapper/TimedTaskMapper.java

@@ -0,0 +1,18 @@
1
+package com.chinaitop.depot.warningAndAlarm.mapper;
2
+
3
+import java.util.List;
4
+
5
+import com.chinaitop.depot.warningAndAlarm.model.StorageRotationWarningWithBLOBs;
6
+
7
+public interface TimedTaskMapper {
8
+
9
+	/**
10
+	 * 检查应轮未轮的数据
11
+	 */
12
+	List<StorageRotationWarningWithBLOBs> selectYlwl();
13
+
14
+	/**
15
+	 * 检查轮换预警的数据
16
+	 */
17
+	List<StorageRotationWarningWithBLOBs> selectLhyj();
18
+}

+ 61 - 0
src/main/java/com/chinaitop/depot/warningAndAlarm/mapper/TimedTaskMapper.xml

@@ -0,0 +1,61 @@
1
+<?xml version="1.0" encoding="UTF-8" ?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
3
+<mapper namespace="com.chinaitop.depot.warningAndAlarm.mapper.TimedTaskMapper" >
4
+
5
+  <select id="selectYlwl" resultType="com.chinaitop.depot.warningAndAlarm.model.StorageRotationWarningWithBLOBs">
6
+    select * from (
7
+       SELECT 
8
+         REPLACE(UUID(), '-', '') id,a.UnitID orgId,a.ch, a.hwh, a.pz lspz, a.hwxz lsxz, a.kcsl, e1.enumName scnf,
9
+         DATE_FORMAT(a.rq, '%Y-%m-%d') zhycrq,
10
+         CASE a.pz 
11
+    	   WHEN '3164' THEN '5年' 
12
+    	   WHEN '3166' THEN '3年' 
13
+    	   WHEN '3170' THEN '3年' 
14
+    	   ELSE NULL 
15
+  	     END cbnx,
16
+  	     CASE a.pz 
17
+    	   WHEN '3164' THEN CONCAT(SUBSTR(a.rq,1,4)+5,'-12-31') 
18
+    	   WHEN '3166' THEN CONCAT(SUBSTR(a.rq,1,4)+3,'-12-31') 
19
+    	   WHEN '3170' THEN CONCAT(SUBSTR(a.rq,1,4)+3,'-12-31') 
20
+    	   ELSE NULL 
21
+  	     END cccxrq,
22
+         '1' bjlx,
23
+         DATE_FORMAT(NOW(), '%Y-%m-%d') bjrq
24
+	   FROM crk_qh.data_kcgl_kcsw_default a 
25
+	   LEFT JOIN basic_enum e1 on e1.enumId=a.scnf
26
+    ) datas
27
+    WHERE 1=1 
28
+    and DATE_FORMAT(NOW(), '%Y-%m-%d') > DATE_FORMAT(datas.cccxrq, '%Y-%m-%d')
29
+  </select>
30
+
31
+  <select id="selectLhyj" resultType="com.chinaitop.depot.warningAndAlarm.model.StorageRotationWarningWithBLOBs">
32
+    select * from (
33
+       SELECT 
34
+         REPLACE(UUID(), '-', '') id,a.UnitID orgId,a.ch, a.hwh, a.pz lspz, a.hwxz lsxz, a.kcsl, e1.enumName scnf, 
35
+         DATE_FORMAT(a.rq, '%Y-%m-%d') zhycrq,
36
+         CASE a.pz 
37
+    	   WHEN '3164' THEN '5年' 
38
+    	   WHEN '3166' THEN '3年' 
39
+    	   WHEN '3170' THEN '3年' 
40
+    	   ELSE NULL 
41
+  	     END cbnx,
42
+  	     CASE a.pz 
43
+    	   WHEN '3164' THEN CONCAT(SUBSTR(a.rq,1,4)+5,'-12-31') 
44
+    	   WHEN '3166' THEN CONCAT(SUBSTR(a.rq,1,4)+3,'-12-31') 
45
+    	   WHEN '3170' THEN CONCAT(SUBSTR(a.rq,1,4)+3,'-12-31') 
46
+    	   ELSE NULL 
47
+  	     END cccxrq,
48
+         '0' bjlx,
49
+         CASE a.pz 
50
+    	   WHEN '3164' THEN CONCAT(SUBSTR(a.rq,1,4)+5,'-09-30') 
51
+    	   WHEN '3166' THEN CONCAT(SUBSTR(a.rq,1,4)+3,'-09-30') 
52
+    	   WHEN '3170' THEN CONCAT(SUBSTR(a.rq,1,4)+3,'-09-30') 
53
+    	   ELSE NULL 
54
+  	     END bjrq
55
+	   FROM crk_qh.data_kcgl_kcsw_default a 
56
+	   LEFT JOIN basic_enum e1 on e1.enumId=a.scnf
57
+    ) datas
58
+    WHERE 1=1 
59
+    and DATE_FORMAT(NOW(), '%Y-%m-%d') >= DATE_FORMAT(datas.bjrq, '%Y-%m-%d')
60
+  </select>
61
+</mapper>

+ 335 - 0
src/main/java/com/chinaitop/depot/warningAndAlarm/model/StorageRotationWarning.java

@@ -0,0 +1,335 @@
1
+package com.chinaitop.depot.warningAndAlarm.model;
2
+
3
+import java.math.BigDecimal;
4
+import java.util.Date;
5
+
6
+import com.fasterxml.jackson.annotation.JsonFormat;
7
+
8
+public class StorageRotationWarning {
9
+    private String id;
10
+
11
+    private Integer ch;
12
+
13
+    private Integer hwh;
14
+
15
+    private Integer lspz;
16
+
17
+    private Integer lsxz;
18
+
19
+    private BigDecimal kcsl;
20
+
21
+    private Integer scnf;
22
+
23
+    private String zhycrq;
24
+
25
+    private String cbnx;
26
+
27
+    private String cccxrq;
28
+
29
+    private String bjrq;
30
+
31
+    private String bjlx;
32
+
33
+    private String clzt;
34
+
35
+    private String clr;
36
+
37
+    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
38
+    private Date clsj;
39
+
40
+    private Integer orgId;
41
+
42
+    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
43
+    private Date scsj;
44
+
45
+    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
46
+    private Date updatetime;
47
+
48
+    /**
49
+     * 主键uuid
50
+     * @return id 主键uuid
51
+     */
52
+    public String getId() {
53
+        return id;
54
+    }
55
+
56
+    /**
57
+     * 主键uuid
58
+     * @param id 主键uuid
59
+     */
60
+    public void setId(String id) {
61
+        this.id = id == null ? null : id.trim();
62
+    }
63
+
64
+    /**
65
+     * 仓房号
66
+     * @return ch 仓房号
67
+     */
68
+    public Integer getCh() {
69
+        return ch;
70
+    }
71
+
72
+    /**
73
+     * 仓房号
74
+     * @param ch 仓房号
75
+     */
76
+    public void setCh(Integer ch) {
77
+        this.ch = ch;
78
+    }
79
+
80
+    /**
81
+     * 货位号
82
+     * @return hwh 货位号
83
+     */
84
+    public Integer getHwh() {
85
+        return hwh;
86
+    }
87
+
88
+    /**
89
+     * 货位号
90
+     * @param hwh 货位号
91
+     */
92
+    public void setHwh(Integer hwh) {
93
+        this.hwh = hwh;
94
+    }
95
+
96
+    /**
97
+     * 粮食品种
98
+     * @return lspz 粮食品种
99
+     */
100
+    public Integer getLspz() {
101
+        return lspz;
102
+    }
103
+
104
+    /**
105
+     * 粮食品种
106
+     * @param lspz 粮食品种
107
+     */
108
+    public void setLspz(Integer lspz) {
109
+        this.lspz = lspz;
110
+    }
111
+
112
+    /**
113
+     * 粮食性质
114
+     * @return lsxz 粮食性质
115
+     */
116
+    public Integer getLsxz() {
117
+        return lsxz;
118
+    }
119
+
120
+    /**
121
+     * 粮食性质
122
+     * @param lsxz 粮食性质
123
+     */
124
+    public void setLsxz(Integer lsxz) {
125
+        this.lsxz = lsxz;
126
+    }
127
+
128
+    /**
129
+     * 库存数量
130
+     * @return kcsl 库存数量
131
+     */
132
+    public BigDecimal getKcsl() {
133
+        return kcsl;
134
+    }
135
+
136
+    /**
137
+     * 库存数量
138
+     * @param kcsl 库存数量
139
+     */
140
+    public void setKcsl(BigDecimal kcsl) {
141
+        this.kcsl = kcsl;
142
+    }
143
+
144
+    /**
145
+     * 生产年份
146
+     * @return scnf 生产年份
147
+     */
148
+    public Integer getScnf() {
149
+        return scnf;
150
+    }
151
+
152
+    /**
153
+     * 生产年份
154
+     * @param scnf 生产年份
155
+     */
156
+    public void setScnf(Integer scnf) {
157
+        this.scnf = scnf;
158
+    }
159
+
160
+    /**
161
+     * 最后一车作业日期
162
+     * @return zhycrq 最后一车作业日期
163
+     */
164
+    public String getZhycrq() {
165
+        return zhycrq;
166
+    }
167
+
168
+    /**
169
+     * 最后一车作业日期
170
+     * @param zhycrq 最后一车作业日期
171
+     */
172
+    public void setZhycrq(String zhycrq) {
173
+        this.zhycrq = zhycrq == null ? null : zhycrq.trim();
174
+    }
175
+
176
+    /**
177
+     * 储备年限
178
+     * @return cbnx 储备年限
179
+     */
180
+    public String getCbnx() {
181
+        return cbnx;
182
+    }
183
+
184
+    /**
185
+     * 储备年限
186
+     * @param cbnx 储备年限
187
+     */
188
+    public void setCbnx(String cbnx) {
189
+        this.cbnx = cbnx == null ? null : cbnx.trim();
190
+    }
191
+
192
+    /**
193
+     * 储存超限时间
194
+     * @return cccxrq 储存超限时间
195
+     */
196
+    public String getCccxrq() {
197
+        return cccxrq;
198
+    }
199
+
200
+    /**
201
+     * 储存超限时间
202
+     * @param cccxrq 储存超限时间
203
+     */
204
+    public void setCccxrq(String cccxrq) {
205
+        this.cccxrq = cccxrq == null ? null : cccxrq.trim();
206
+    }
207
+
208
+    /**
209
+     * 报警日期
210
+     * @return bjrq 报警日期
211
+     */
212
+    public String getBjrq() {
213
+        return bjrq;
214
+    }
215
+
216
+    /**
217
+     * 报警日期
218
+     * @param bjrq 报警日期
219
+     */
220
+    public void setBjrq(String bjrq) {
221
+        this.bjrq = bjrq == null ? null : bjrq.trim();
222
+    }
223
+
224
+    /**
225
+     * 报警类型(0:轮换预警,1:应轮未轮)
226
+     * @return bjlx 报警类型(0:轮换预警,1:应轮未轮)
227
+     */
228
+    public String getBjlx() {
229
+        return bjlx;
230
+    }
231
+
232
+    /**
233
+     * 报警类型(0:轮换预警,1:应轮未轮)
234
+     * @param bjlx 报警类型(0:轮换预警,1:应轮未轮)
235
+     */
236
+    public void setBjlx(String bjlx) {
237
+        this.bjlx = bjlx == null ? null : bjlx.trim();
238
+    }
239
+
240
+    /**
241
+     * 处理状态(0:未处理,1:已处理)
242
+     * @return clzt 处理状态(0:未处理,1:已处理)
243
+     */
244
+    public String getClzt() {
245
+        return clzt;
246
+    }
247
+
248
+    /**
249
+     * 处理状态(0:未处理,1:已处理)
250
+     * @param clzt 处理状态(0:未处理,1:已处理)
251
+     */
252
+    public void setClzt(String clzt) {
253
+        this.clzt = clzt == null ? null : clzt.trim();
254
+    }
255
+
256
+    /**
257
+     * 处理人
258
+     * @return clr 处理人
259
+     */
260
+    public String getClr() {
261
+        return clr;
262
+    }
263
+
264
+    /**
265
+     * 处理人
266
+     * @param clr 处理人
267
+     */
268
+    public void setClr(String clr) {
269
+        this.clr = clr == null ? null : clr.trim();
270
+    }
271
+
272
+    /**
273
+     * 处理时间
274
+     * @return clsj 处理时间
275
+     */
276
+    public Date getClsj() {
277
+        return clsj;
278
+    }
279
+
280
+    /**
281
+     * 处理时间
282
+     * @param clsj 处理时间
283
+     */
284
+    public void setClsj(Date clsj) {
285
+        this.clsj = clsj;
286
+    }
287
+
288
+    /**
289
+     * 库ID
290
+     * @return org_id 库ID
291
+     */
292
+    public Integer getOrgId() {
293
+        return orgId;
294
+    }
295
+
296
+    /**
297
+     * 库ID
298
+     * @param orgId 库ID
299
+     */
300
+    public void setOrgId(Integer orgId) {
301
+        this.orgId = orgId;
302
+    }
303
+
304
+    /**
305
+     * 生成时间
306
+     * @return scsj 生成时间
307
+     */
308
+    public Date getScsj() {
309
+        return scsj;
310
+    }
311
+
312
+    /**
313
+     * 生成时间
314
+     * @param scsj 生成时间
315
+     */
316
+    public void setScsj(Date scsj) {
317
+        this.scsj = scsj;
318
+    }
319
+
320
+    /**
321
+     * 最后修改时间
322
+     * @return updatetime 最后修改时间
323
+     */
324
+    public Date getUpdatetime() {
325
+        return updatetime;
326
+    }
327
+
328
+    /**
329
+     * 最后修改时间
330
+     * @param updatetime 最后修改时间
331
+     */
332
+    public void setUpdatetime(Date updatetime) {
333
+        this.updatetime = updatetime;
334
+    }
335
+}

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 1380 - 0
src/main/java/com/chinaitop/depot/warningAndAlarm/model/StorageRotationWarningExample.java


+ 39 - 0
src/main/java/com/chinaitop/depot/warningAndAlarm/model/StorageRotationWarningWithBLOBs.java

@@ -0,0 +1,39 @@
1
+package com.chinaitop.depot.warningAndAlarm.model;
2
+
3
+public class StorageRotationWarningWithBLOBs extends StorageRotationWarning {
4
+    private String remark;
5
+
6
+    private String clyj;
7
+
8
+    /**
9
+     * 备注
10
+     * @return remark 备注
11
+     */
12
+    public String getRemark() {
13
+        return remark;
14
+    }
15
+
16
+    /**
17
+     * 备注
18
+     * @param remark 备注
19
+     */
20
+    public void setRemark(String remark) {
21
+        this.remark = remark == null ? null : remark.trim();
22
+    }
23
+
24
+    /**
25
+     * 处理意见
26
+     * @return clyj 处理意见
27
+     */
28
+    public String getClyj() {
29
+        return clyj;
30
+    }
31
+
32
+    /**
33
+     * 处理意见
34
+     * @param clyj 处理意见
35
+     */
36
+    public void setClyj(String clyj) {
37
+        this.clyj = clyj == null ? null : clyj.trim();
38
+    }
39
+}

+ 15 - 0
src/main/java/com/chinaitop/depot/warningAndAlarm/service/TimedTaskService.java

@@ -0,0 +1,15 @@
1
+package com.chinaitop.depot.warningAndAlarm.service;
2
+
3
+public interface TimedTaskService {
4
+
5
+	/**
6
+	 * 检查应轮未轮的预警数据并保存
7
+	 * @throws Exception
8
+	 */
9
+	void insertYlwl() throws Exception;
10
+
11
+	/**
12
+	 * 检测达到轮换预警的数据并保存
13
+	 */
14
+	void insertLhyj();
15
+}

+ 38 - 0
src/main/java/com/chinaitop/depot/warningAndAlarm/service/YjbjService.java

@@ -0,0 +1,38 @@
1
+package com.chinaitop.depot.warningAndAlarm.service;
2
+
3
+import java.util.List;
4
+
5
+import com.chinaitop.depot.warningAndAlarm.model.StorageRotationWarning;
6
+import com.chinaitop.depot.warningAndAlarm.model.StorageRotationWarningWithBLOBs;
7
+
8
+public interface YjbjService {
9
+
10
+	/**
11
+	 * 查询轮换预警列表
12
+	 * @param orgId 库ID
13
+	 * @param ch 仓房ID
14
+	 * @param hwh 货位ID
15
+	 * @param lspz 粮食品种ID
16
+	 * @return
17
+	 * @throws Exception
18
+	 */
19
+	public List<StorageRotationWarning> queryLhyjList(Integer orgId, Integer ch, Integer hwh, Integer lspz) throws Exception;
20
+
21
+	/**
22
+	 * 查询应轮未轮报警列表
23
+	 * @param orgId 库ID
24
+	 * @param ch 仓房ID
25
+	 * @param hwh 货位ID
26
+	 * @param lspz 粮食品种ID
27
+	 * @return
28
+	 * @throws Exception
29
+	 */
30
+	public List<StorageRotationWarning> queryYlwlList(Integer orgId, Integer ch, Integer hwh, Integer lspz) throws Exception;
31
+
32
+	/**
33
+	 * 更新轮换预警报警数据的处理结果信息
34
+	 * @param storageRotationWarningWithBLOBs
35
+	 * @throws Exception
36
+	 */
37
+	public void updateDate(StorageRotationWarningWithBLOBs storageRotationWarningWithBLOBs) throws Exception;
38
+}

+ 90 - 0
src/main/java/com/chinaitop/depot/warningAndAlarm/service/impl/TimedTaskServiceImpl.java

@@ -0,0 +1,90 @@
1
+package com.chinaitop.depot.warningAndAlarm.service.impl;
2
+
3
+import java.util.Date;
4
+import java.util.List;
5
+
6
+import javax.annotation.Resource;
7
+
8
+import org.springframework.stereotype.Service;
9
+
10
+import com.chinaitop.depot.warningAndAlarm.mapper.StorageRotationWarningMapper;
11
+import com.chinaitop.depot.warningAndAlarm.mapper.TimedTaskMapper;
12
+import com.chinaitop.depot.warningAndAlarm.model.StorageRotationWarning;
13
+import com.chinaitop.depot.warningAndAlarm.model.StorageRotationWarningExample;
14
+import com.chinaitop.depot.warningAndAlarm.model.StorageRotationWarningExample.Criteria;
15
+import com.chinaitop.depot.warningAndAlarm.model.StorageRotationWarningWithBLOBs;
16
+import com.chinaitop.depot.warningAndAlarm.service.TimedTaskService;
17
+
18
+@Service
19
+public class TimedTaskServiceImpl implements TimedTaskService {
20
+
21
+	@Resource
22
+	private TimedTaskMapper timedTaskMapper;
23
+
24
+	@Resource
25
+	private StorageRotationWarningMapper storageRotationWarningMapper;
26
+
27
+	@Override
28
+	public void insertYlwl() throws Exception {
29
+
30
+		List<StorageRotationWarningWithBLOBs> list = timedTaskMapper.selectYlwl();
31
+		
32
+		if (null != list && list.size() > 0) {
33
+			StorageRotationWarningWithBLOBs s = null;
34
+			for (int i = 0; i < list.size(); i++) {
35
+				s = list.get(i);
36
+				boolean k = checkData(s, "1");
37
+				if (!k) {//如果有了,那就不在增加了,否则就重复报警了
38
+					Date date = new Date();
39
+					s.setScsj(date);
40
+					s.setClzt("0");
41
+					s.setUpdatetime(date);
42
+					storageRotationWarningMapper.insert(s);
43
+				}
44
+			}
45
+		}
46
+	}
47
+
48
+	/**
49
+	 * 检查一条轮换预警数据是否已经存在
50
+	 * @param rotationWarning 
51
+	 * @param bjlx 报警类型(0:轮换预警,1:应轮未轮)
52
+	 * @return
53
+	 */
54
+	private boolean checkData(StorageRotationWarningWithBLOBs rotationWarning, String bjlx) {
55
+		boolean b = false;
56
+		StorageRotationWarningExample example = new StorageRotationWarningExample();
57
+		Criteria criteria = example.createCriteria();
58
+		criteria.andHwhEqualTo(rotationWarning.getHwh());
59
+		criteria.andChEqualTo(rotationWarning.getCh());
60
+		criteria.andZhycrqEqualTo(rotationWarning.getZhycrq());
61
+		criteria.andBjlxEqualTo(bjlx);
62
+		List<StorageRotationWarning> list = storageRotationWarningMapper.selectByExample(example);
63
+		if (null != list && list.size() > 0) {
64
+			b = true;
65
+		}
66
+		return b;
67
+	}
68
+
69
+	@Override
70
+	public void insertLhyj() {
71
+
72
+		List<StorageRotationWarningWithBLOBs> list = timedTaskMapper.selectLhyj();
73
+		
74
+		if (null != list && list.size() > 0) {
75
+			StorageRotationWarningWithBLOBs s = null;
76
+			for (int i = 0; i < list.size(); i++) {
77
+				s = list.get(i);
78
+				boolean k = checkData(s, "0");
79
+				if (!k) {//如果有了,那就不在增加了,否则就重复报警了
80
+					Date date = new Date();
81
+					s.setScsj(date);
82
+					s.setClzt("0");
83
+					s.setUpdatetime(date);
84
+					storageRotationWarningMapper.insert(s);
85
+				}
86
+			}
87
+		}
88
+	}
89
+
90
+}

+ 88 - 0
src/main/java/com/chinaitop/depot/warningAndAlarm/service/impl/YjbjServiceImpl.java

@@ -0,0 +1,88 @@
1
+package com.chinaitop.depot.warningAndAlarm.service.impl;
2
+
3
+import java.util.Date;
4
+import java.util.List;
5
+
6
+import javax.annotation.Resource;
7
+
8
+import org.springframework.stereotype.Service;
9
+
10
+import com.chinaitop.depot.warningAndAlarm.mapper.StorageRotationWarningMapper;
11
+import com.chinaitop.depot.warningAndAlarm.model.StorageRotationWarning;
12
+import com.chinaitop.depot.warningAndAlarm.model.StorageRotationWarningExample;
13
+import com.chinaitop.depot.warningAndAlarm.model.StorageRotationWarningExample.Criteria;
14
+import com.chinaitop.depot.warningAndAlarm.model.StorageRotationWarningWithBLOBs;
15
+import com.chinaitop.depot.warningAndAlarm.service.YjbjService;
16
+
17
+@Service
18
+public class YjbjServiceImpl implements YjbjService {
19
+
20
+	@Resource
21
+	private StorageRotationWarningMapper storageRotationWarningMapper;
22
+
23
+	@Override
24
+	public List<StorageRotationWarning> queryLhyjList(Integer orgId, Integer ch, Integer hwh, Integer lspz)
25
+			throws Exception {
26
+
27
+		StorageRotationWarningExample example = new StorageRotationWarningExample();
28
+		Criteria criteria = example.createCriteria();
29
+
30
+		if (null != orgId) {
31
+			criteria.andOrgIdEqualTo(orgId); //库ID
32
+		}
33
+		if (null != ch) {
34
+			criteria.andChEqualTo(ch);  //仓房ID
35
+		}
36
+		if (null != hwh) {
37
+			criteria.andHwhEqualTo(hwh);  //货位ID
38
+		}
39
+		if (null != lspz) {
40
+			criteria.andLspzEqualTo(lspz);  //粮食品种ID
41
+		}
42
+
43
+		criteria.andBjlxEqualTo("0"); //查询轮换预警的数据
44
+
45
+		example.setOrderByClause("scsj desc"); //按照数据的生成时间倒序排序
46
+
47
+		List<StorageRotationWarning> list = storageRotationWarningMapper.selectByExample(example);
48
+
49
+		return list;
50
+	}
51
+
52
+	@Override
53
+	public List<StorageRotationWarning> queryYlwlList(Integer orgId, Integer ch, Integer hwh, Integer lspz)
54
+			throws Exception {
55
+
56
+		StorageRotationWarningExample example = new StorageRotationWarningExample();
57
+		Criteria criteria = example.createCriteria();
58
+
59
+		if (null != orgId) {
60
+			criteria.andOrgIdEqualTo(orgId); //库ID
61
+		}
62
+		if (null != ch) {
63
+			criteria.andChEqualTo(ch);  //仓房ID
64
+		}
65
+		if (null != hwh) {
66
+			criteria.andHwhEqualTo(hwh);  //货位ID
67
+		}
68
+		if (null != lspz) {
69
+			criteria.andLspzEqualTo(lspz);  //粮食品种ID
70
+		}
71
+
72
+		criteria.andBjlxEqualTo("1"); //查询应轮未轮报警的数据
73
+
74
+		example.setOrderByClause("scsj desc"); //按照数据的生成时间倒序排序
75
+
76
+		List<StorageRotationWarning> list = storageRotationWarningMapper.selectByExample(example);
77
+
78
+		return list;
79
+	}
80
+
81
+	@Override
82
+	public void updateDate(StorageRotationWarningWithBLOBs storageRotationWarningWithBLOBs) throws Exception {
83
+		storageRotationWarningWithBLOBs.setUpdatetime(new Date());
84
+		storageRotationWarningWithBLOBs.setClzt("1"); //设置为已处理
85
+		storageRotationWarningMapper.updateByPrimaryKeyWithBLOBs(storageRotationWarningWithBLOBs);
86
+	}
87
+
88
+}

+ 8 - 8
src/main/resources/generatorConfig.xml

@@ -13,10 +13,10 @@
13 13
 		
14 14
 		<!--数据库连接的信息:驱动类、连接地址、用户名、密码 -->
15 15
 		<jdbcConnection 
16
-			driverClass="com.gbasedbt.jdbc.IfxDriver"
17
-			connectionURL="jdbc:gbasedbt-sqli://101.36.160.140:19089/base:INFORMIXSERVER=ol_gbasedbt1210;NEWCODESET=GB18030,GB18030-2000,5488;DB_LOCALE=zh_cn.GB18030-2000;GL_USEGLU=1;IFX_USE_STRENC=true;characterEncoding=utf8" 
18
-			userId="gbasedbt"
19
-			password="cDbK2S0go8">
16
+			driverClass="com.mysql.jdbc.Driver"
17
+			connectionURL="jdbc:mysql://172.16.0.36:3306/depot_qh?useUnicode=true&amp;characterEncoding=utf-8" 
18
+			userId="root"
19
+			password="admin@1234">
20 20
 		</jdbcConnection>
21 21
 		
22 22
 		<!-- 默认false,把JDBC DECIMAL 和 NUMERIC 类型解析为 Integer,为 true时把JDBC DECIMAL 和 
@@ -26,7 +26,7 @@
26 26
 		</javaTypeResolver>
27 27
 
28 28
 		<!-- targetProject:生成PO类的位置 -->
29
-		<javaModelGenerator targetPackage="com.chinaitop.depot.sptData.model"
29
+		<javaModelGenerator targetPackage="com.chinaitop.depot.warningAndAlarm.model"
30 30
 			targetProject=".\src\main\java">
31 31
 			<!-- enableSubPackages:是否让schema作为包的后缀 -->
32 32
 			<property name="enableSubPackages" value="false" />
@@ -35,7 +35,7 @@
35 35
 		</javaModelGenerator>
36 36
 		
37 37
         <!-- targetProject:mapper映射文件生成的位置 -->
38
-		<sqlMapGenerator targetPackage="com.chinaitop.depot.sptData.mapper" 
38
+		<sqlMapGenerator targetPackage="com.chinaitop.depot.warningAndAlarm.mapper" 
39 39
 			targetProject=".\src\main\java">
40 40
 			<!-- enableSubPackages:是否让schema作为包的后缀 -->
41 41
 			<property name="enableSubPackages" value="false" />
@@ -43,13 +43,13 @@
43 43
 		
44 44
 		<!-- targetPackage:mapper接口生成的位置 -->
45 45
 		<javaClientGenerator type="XMLMAPPER"
46
-			targetPackage="com.chinaitop.depot.sptData.mapper" 
46
+			targetPackage="com.chinaitop.depot.warningAndAlarm.mapper" 
47 47
 			targetProject=".\src\main\java">
48 48
 			<!-- enableSubPackages:是否让schema作为包的后缀 -->
49 49
 			<property name="enableSubPackages" value="false" />
50 50
 		</javaClientGenerator>
51 51
 		
52 52
 		<!-- 指定要反向生成的数据库表 -->
53
-		<table schema="" tableName="ty_chubeilyynbao"></table>
53
+		<table schema="" tableName="storage_rotation_warning"></table>
54 54
 	</context>
55 55
 </generatorConfiguration>