소스 검색

转圈粮预警

fanxw 1 년 전
부모
커밋
6ee2108f18

+ 25 - 0
src/main/java/com/chinaitop/depot/yjbj/controller/YjbjController.java

@@ -20,6 +20,7 @@ import com.chinaitop.depot.yjbj.model.StorageAlarmRecordWithBLOBs;
20 20
 import com.chinaitop.depot.yjbj.model.Thprkyj;
21 21
 import com.chinaitop.depot.yjbj.model.Zkycbj;
22 22
 import com.chinaitop.depot.yjbj.model.Zlbj;
23
+import com.chinaitop.depot.yjbj.model.Zqlyj;
23 24
 import com.chinaitop.depot.yjbj.service.StorageAlarmRecordService;
24 25
 import com.chinaitop.depot.yjbj.service.YjbjService;
25 26
 import com.github.pagehelper.PageHelper;
@@ -250,6 +251,30 @@ public class YjbjController {
250 251
 		}
251 252
 	}
252 253
 
254
+	@RequestMapping(value="/getZqlyjPageList", produces = MediaType.APPLICATION_JSON_VALUE, method = RequestMethod.GET)
255
+	@ApiOperation(value="查询转圈粮预警列表", notes = "支持分页")
256
+	@ApiImplicitParams({
257
+		@ApiImplicitParam(name = "pageNum", value = "页码", paramType = "query"),
258
+        @ApiImplicitParam(name = "pageSize", value = "每页条数", paramType = "query"),
259
+        @ApiImplicitParam(name = "bjrq", value = "报警日期", paramType = "query"),
260
+        @ApiImplicitParam(name = "orgId", value = "库ID", required=true, paramType = "query")
261
+	})
262
+	public ResponseEntity getZqlyjPageList(Integer pageNum, Integer pageSize, Integer orgId, String bjrq) {
263
+
264
+		PageInfo<Zqlyj> pageInfo = null;
265
+		try {
266
+			if (pageNum != null && pageSize != null) {
267
+	            PageHelper.startPage(pageNum, pageSize);
268
+	        }
269
+			List<Zqlyj> list = yjbjService.selectZqlyj(orgId, bjrq);
270
+			pageInfo = new PageInfo<>(list);
271
+			return ResponseEntity.ok(pageInfo);
272
+		} catch (Exception e) {
273
+			log.error(e.getMessage(), e);
274
+			return ResponseEntity.failed("查询失败:" + e.getMessage());
275
+		}
276
+	}
277
+
253 278
 	@RequestMapping(value="/getCljl", produces = MediaType.APPLICATION_JSON_VALUE, method = RequestMethod.GET)
254 279
 	@ApiOperation(value="查询处理记录", notes = "")
255 280
 	@ApiImplicitParams({

+ 9 - 0
src/main/java/com/chinaitop/depot/yjbj/mapper/YjbjMapper.java

@@ -1,6 +1,7 @@
1 1
 package com.chinaitop.depot.yjbj.mapper;
2 2
 
3 3
 import java.util.List;
4
+import java.util.Map;
4 5
 
5 6
 import org.apache.ibatis.annotations.Param;
6 7
 
@@ -13,6 +14,7 @@ import com.chinaitop.depot.yjbj.model.Kjkcyj;
13 14
 import com.chinaitop.depot.yjbj.model.Thprkyj;
14 15
 import com.chinaitop.depot.yjbj.model.Zkycbj;
15 16
 import com.chinaitop.depot.yjbj.model.Zlbj;
17
+import com.chinaitop.depot.yjbj.model.Zqlyj;
16 18
 
17 19
 public interface YjbjMapper {
18 20
 
@@ -78,4 +80,11 @@ public interface YjbjMapper {
78 80
 	 * @return
79 81
 	 */
80 82
 	List<Dbtyj> selectDbtyj(@Param("obj") Dbtyj obj);
83
+
84
+	/**
85
+	 * 转圈粮预警查询
86
+	 * @param map
87
+	 * @return
88
+	 */
89
+	List<Zqlyj> selectZqlyj(@Param("obj") Map<String, Object> map);
81 90
 }

+ 21 - 0
src/main/java/com/chinaitop/depot/yjbj/mapper/YjbjMapper.xml

@@ -139,4 +139,25 @@
139 139
     </where>
140 140
     order by bjsj desc
141 141
   </select>
142
+  <!-- 转圈粮预警数据查询 -->
143
+  <select id="selectZqlyj" resultType="com.chinaitop.depot.yjbj.model.Zqlyj" parameterType="map">
144
+    select
145
+        id,
146
+		dispose_time as rmsj,
147
+		detail as bjxx,
148
+		1 as sfrmdj,
149
+		disposer as djr,
150
+		org_id as orgId,
151
+		create_time as bjsj
152
+	from storage_pre_violation
153
+    <where>
154
+      <if test="obj.cfmc != null">
155
+        and create_time between #{obj.startTime,jdbcType=VARCHAR} and #{obj.endTime,jdbcType=VARCHAR}
156
+      </if>
157
+      <if test="obj.orgId != null">
158
+        and org_id = #{obj.orgId,jdbcType=INTEGER}
159
+      </if>
160
+    </where>
161
+    order by create_time desc
162
+  </select>
142 163
 </mapper>

+ 28 - 0
src/main/java/com/chinaitop/depot/yjbj/model/Zqlyj.java

@@ -0,0 +1,28 @@
1
+package com.chinaitop.depot.yjbj.model;
2
+
3
+import java.util.Date;
4
+
5
+import com.fasterxml.jackson.annotation.JsonFormat;
6
+
7
+import lombok.Data;
8
+
9
+/**
10
+ * 转圈粮预警
11
+ * @author zhugong
12
+ *
13
+ */
14
+@Data
15
+public class Zqlyj {
16
+
17
+	private Integer id;//主键ID
18
+	private Integer orgId;//库ID
19
+	@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
20
+	private Date bjsj;//报警时间
21
+	private String rkcl;//入库车辆
22
+	private String pzmc;//品种名称
23
+	private String bjxx;//报警信息
24
+	private String sfrmdj;//是否入门登记
25
+	private String djr;//登记人
26
+	@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
27
+	private Date rmsj;//入门时间
28
+}

+ 10 - 0
src/main/java/com/chinaitop/depot/yjbj/service/YjbjService.java

@@ -11,6 +11,7 @@ import com.chinaitop.depot.yjbj.model.Kjkcyj;
11 11
 import com.chinaitop.depot.yjbj.model.Thprkyj;
12 12
 import com.chinaitop.depot.yjbj.model.Zkycbj;
13 13
 import com.chinaitop.depot.yjbj.model.Zlbj;
14
+import com.chinaitop.depot.yjbj.model.Zqlyj;
14 15
 
15 16
 public interface YjbjService {
16 17
 
@@ -94,4 +95,13 @@ public interface YjbjService {
94 95
 	 * @throws Exception
95 96
 	 */
96 97
 	List<Dbtyj> selectDbtyj(Integer orgId, String cfmc) throws Exception;
98
+
99
+	/**
100
+	 * 转圈粮预警
101
+	 * @param orgId 库ID
102
+	 * @param bjrq 报警日期
103
+	 * @return
104
+	 * @throws Exception
105
+	 */
106
+	List<Zqlyj> selectZqlyj(Integer orgId, String bjrq) throws Exception;
97 107
 }

+ 40 - 0
src/main/java/com/chinaitop/depot/yjbj/service/impl/YjbjServiceImpl.java

@@ -1,12 +1,15 @@
1 1
 package com.chinaitop.depot.yjbj.service.impl;
2 2
 
3
+import java.util.HashMap;
3 4
 import java.util.List;
5
+import java.util.Map;
4 6
 
5 7
 import javax.annotation.Resource;
6 8
 
7 9
 import org.apache.commons.lang3.StringUtils;
8 10
 import org.springframework.stereotype.Service;
9 11
 
12
+import com.chinaitop.depot.utils.DateUtil;
10 13
 import com.chinaitop.depot.yjbj.mapper.YjbjMapper;
11 14
 import com.chinaitop.depot.yjbj.model.Chbj;
12 15
 import com.chinaitop.depot.yjbj.model.Dbtyj;
@@ -17,6 +20,7 @@ import com.chinaitop.depot.yjbj.model.Kjkcyj;
17 20
 import com.chinaitop.depot.yjbj.model.Thprkyj;
18 21
 import com.chinaitop.depot.yjbj.model.Zkycbj;
19 22
 import com.chinaitop.depot.yjbj.model.Zlbj;
23
+import com.chinaitop.depot.yjbj.model.Zqlyj;
20 24
 import com.chinaitop.depot.yjbj.service.YjbjService;
21 25
 
22 26
 @Service
@@ -115,4 +119,40 @@ public class YjbjServiceImpl implements YjbjService {
115 119
 		return yjbjMapper.selectDbtyj(obj);
116 120
 	}
117 121
 
122
+	@Override
123
+	public List<Zqlyj> selectZqlyj(Integer orgId, String bjrq) throws Exception {
124
+		Map<String, Object> map = new HashMap<>();
125
+		map.put("orgId", orgId);
126
+		if (StringUtils.isNotBlank(bjrq)) {
127
+            map.put("startTime", String.format("%s%s", bjrq, DateUtil.startTime));
128
+            map.put("endTime", String.format("%s%s", bjrq, DateUtil.endTime));
129
+        }
130
+		List<Zqlyj> list = yjbjMapper.selectZqlyj(map);
131
+		for (Zqlyj grainRotationAlarmVO : list) {
132
+			if(!StringUtils.isEmpty(grainRotationAlarmVO.getBjxx())){
133
+				String rkcl = "";
134
+				//String sczykdmc = "";
135
+				String pzmc = "";
136
+				String yjxx = "";
137
+				String originYjxx = grainRotationAlarmVO.getBjxx();
138
+				if (originYjxx.startsWith("车牌号")) {
139
+					rkcl = originYjxx.substring(originYjxx.indexOf("车牌号")+3,originYjxx.indexOf("车辆"));
140
+					//sczykdmc = originYjxx.substring(originYjxx.indexOf("“")+1,originYjxx.lastIndexOf("”"));
141
+					pzmc = originYjxx.substring(originYjxx.indexOf("粮食品种:")+5,originYjxx.indexOf("、"));
142
+					yjxx = "上一次入库化验不合格再入库的同号牌同品种车辆";
143
+				} else if (originYjxx.startsWith("注意:")) {
144
+					rkcl = originYjxx.substring(originYjxx.indexOf("【")+1,originYjxx.indexOf("】"));
145
+					//sczykdmc = originYjxx.substring(originYjxx.indexOf("“")+1,originYjxx.lastIndexOf("”"));
146
+					pzmc = originYjxx.substring(originYjxx.indexOf("粮食品种:")+5,originYjxx.indexOf("、"));
147
+					yjxx = "3天内上一次为出库作业同号牌同品种的车辆";
148
+				}
149
+				grainRotationAlarmVO.setRkcl(rkcl);
150
+				grainRotationAlarmVO.setPzmc(pzmc);
151
+				grainRotationAlarmVO.setBjxx(yjxx);
152
+			}
153
+
154
+		}
155
+		return list;
156
+	}
157
+
118 158
 }