fanxw 5 gadi atpakaļ
vecāks
revīzija
52a5424d86

+ 2 - 0
src/main/java/com/chinaitop/depot/DepotGrainAnalysisApplication.java

@@ -5,11 +5,13 @@ import org.springframework.boot.SpringApplication;
5 5
 import org.springframework.boot.autoconfigure.SpringBootApplication;
6 6
 import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
7 7
 import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
8
+import org.springframework.transaction.annotation.EnableTransactionManagement;
8 9
 
9 10
 
10 11
 @EnableEurekaClient
11 12
 @EnableDiscoveryClient
12 13
 @SpringBootApplication
14
+@EnableTransactionManagement
13 15
 @MapperScan(basePackages = {"com.chinaitop.depot.*.mapper"})
14 16
 public class DepotGrainAnalysisApplication {
15 17
 

+ 22 - 0
src/main/java/com/chinaitop/depot/grainAnalysis/controller/MonthStorageGrainAnalysisController.java

@@ -8,11 +8,15 @@ import java.util.Map;
8 8
 import javax.annotation.Resource;
9 9
 
10 10
 import com.chinaitop.utils.ParameterUtil;
11
+
12
+import org.apache.commons.lang3.StringUtils;
11 13
 import org.springframework.http.MediaType;
12 14
 import org.springframework.web.bind.annotation.RequestMapping;
13 15
 import org.springframework.web.bind.annotation.RequestMethod;
14 16
 import org.springframework.web.bind.annotation.RestController;
15 17
 import com.chinaitop.depot.grainAnalysis.service.StorageGrainAnalysisService;
18
+import com.alibaba.fastjson.JSON;
19
+import com.alibaba.fastjson.JSONObject;
16 20
 import com.chinaitop.depot.grainAnalysis.model.StorageExceptionAndOnfore;
17 21
 import com.chinaitop.depot.grainAnalysis.model.StorageGrainAnalysis;
18 22
 import com.chinaitop.depot.grainAnalysis.model.StorageGrainAnalysisExample;
@@ -115,6 +119,24 @@ public class MonthStorageGrainAnalysisController {
115 119
 		return map;
116 120
 	}
117 121
 
122
+	@RequestMapping(value = "/monthEditTwo", produces = MediaType.APPLICATION_JSON_VALUE, method = RequestMethod.GET)
123
+    @ApiOperation(value = "查询月粮情分析的三温数据", notes = "查询一条月粮情分析数据")
124
+    @ApiImplicitParams({
125
+            @ApiImplicitParam(name = "threeTempJson", value = "数据集合", paramType = "query")
126
+    })
127
+    public Map<String, Object> monthEditTwo(String threeTempJson) {
128
+
129
+        Map<String, Object> threeTempMap = null;
130
+
131
+        try {
132
+			threeTempMap = analysisService.getMonthThreeTempDateNews(threeTempJson);
133
+		} catch (Exception e) {
134
+			e.printStackTrace();
135
+		}
136
+
137
+        return threeTempMap;
138
+    }
139
+
118 140
 	/**
119 141
 	 * 查询三温检查数据
120 142
 	 *

+ 44 - 0
src/main/java/com/chinaitop/depot/grainAnalysis/controller/StorageGrainAnalysisController.java

@@ -13,6 +13,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
13 13
 import org.springframework.web.bind.annotation.RequestMethod;
14 14
 import org.springframework.web.bind.annotation.RestController;
15 15
 
16
+import com.alibaba.fastjson.JSON;
17
+import com.alibaba.fastjson.JSONObject;
16 18
 import com.chinaitop.depot.grainAnalysis.model.StorageExceptionAndOnfore;
17 19
 import com.chinaitop.depot.grainAnalysis.model.StorageGrainAnalysis;
18 20
 import com.chinaitop.depot.grainAnalysis.model.StorageGrainAnalysisExample;
@@ -107,6 +109,23 @@ public class StorageGrainAnalysisController {
107 109
 		return map;
108 110
 	}
109 111
 
112
+	@RequestMapping(value="/queryLqzkData", produces = MediaType.APPLICATION_JSON_VALUE, method=RequestMethod.GET)
113
+	@ApiOperation(value="查询一粮情专卡数据", notes = "")
114
+    @ApiImplicitParams({
115
+    	@ApiImplicitParam(name="orgId", value="单位ID", paramType="query"),
116
+    	@ApiImplicitParam(name="houseId", value="仓房ID", paramType="query"),
117
+    	@ApiImplicitParam(name="wareId", value="货位ID", paramType="query")
118
+    })
119
+	public Map<String, Object> queryLqzkData(Integer orgId, Integer houseId, Integer wareId) {
120
+		Map<String, Object> map = null;
121
+		try {
122
+			map = analysisService.queryLqzkData(orgId, houseId, wareId);
123
+		} catch (Exception e) {
124
+			e.printStackTrace();
125
+		}
126
+		return map;
127
+	}
128
+
110 129
 	@RequestMapping(value="/getThreeTempDate", produces = MediaType.APPLICATION_JSON_VALUE, method=RequestMethod.GET)
111 130
 	@ApiOperation(value="查询一条三温检查数据", notes = "查询一条三温检查数据")
112 131
     @ApiImplicitParams({
@@ -132,6 +151,31 @@ public class StorageGrainAnalysisController {
132 151
 		return map;
133 152
 	}
134 153
 
154
+	@RequestMapping(value = "/editTwo", produces = MediaType.APPLICATION_JSON_VALUE, method = RequestMethod.GET)
155
+    @ApiOperation(value = "查询周粮情分析", notes = "查询一条周粮情分析数据")
156
+    @ApiImplicitParams({
157
+        @ApiImplicitParam(name = "map", value = "参数数据集合", paramType = "query"),
158
+        @ApiImplicitParam(name = "weekParams", value = "查询的数据类型(1:周粮情)", paramType = "query")
159
+    })
160
+    public Map<String, Object> editTwo(String map, Integer weekParams) {
161
+
162
+        JSONObject jsonMap = JSON.parseObject(map, JSONObject.class);
163
+
164
+        if (jsonMap.size() == 0) {
165
+            return null;
166
+        }
167
+
168
+        Map<String, Object> threeTempMap = null;
169
+
170
+        try {
171
+			threeTempMap = analysisService.getWeekThreeTempDate(jsonMap, weekParams);
172
+		} catch (Exception e) {
173
+			e.printStackTrace();
174
+		}
175
+
176
+        return threeTempMap;
177
+    }
178
+
135 179
 	/**
136 180
 	 * 提交
137 181
 	 * 

+ 1 - 1
src/main/java/com/chinaitop/depot/grainAnalysis/controller/YearStorageGrainAnalysisController.java

@@ -138,7 +138,7 @@ public class YearStorageGrainAnalysisController {
138 138
 
139 139
 		List<StorageExceptionAndOnfore> exceptionAndOnforeList = new ArrayList<>();
140 140
 		StorageExceptionAndOnfore exceptionAndOnfore = new StorageExceptionAndOnfore();
141
-		exceptionAndOnfore.setCheckDate(ParameterUtil.stringTodatetime(jsonMap.getString("checkDate")));
141
+		exceptionAndOnfore.setCheckDate(ParameterUtil.string2date(jsonMap.getString("checkDate")));
142 142
 		exceptionAndOnforeList.add(exceptionAndOnfore);
143 143
 
144 144
 		map.put("exceptionAndOnforeList", exceptionAndOnforeList);

+ 15 - 0
src/main/java/com/chinaitop/depot/grainAnalysis/mapper/StorageGrainAnalysisMapper.java

@@ -37,4 +37,19 @@ public interface StorageGrainAnalysisMapper {
37 37
      * @return
38 38
      */
39 39
     Map<String, Object> selectStoreHouseObj(Map<String, Object> map);
40
+
41
+    /**
42
+     * 查询粮情专卡的数据
43
+     * 
44
+     * @param map
45
+     * @return
46
+     */
47
+    List<Map<String, Object>> queryLqzkData(Map<String, Object> map);
48
+
49
+    /**
50
+     * 获取智能仓房三温数据
51
+     * @param map
52
+     * @return
53
+     */
54
+    List<Map<String,Object>> getThreeTempData(Map<String, Object> map);
40 55
 }

+ 49 - 0
src/main/java/com/chinaitop/depot/grainAnalysis/mapper/StorageGrainAnalysisMapper.xml

@@ -560,4 +560,53 @@
560 560
   <select id="selectStoreHouseObj" resultType="java.util.Map" parameterType="java.util.Map">
561 561
     SELECT * FROM basic_storehouse WHERE storehouse_id=#{house_id}
562 562
   </select>
563
+  <!-- 查询粮情专卡的数据 -->
564
+  <select id="queryLqzkData" resultType="java.util.Map" parameterType="java.util.Map">
565
+    SELECT house_type "houseType",sub_type "subType" ,recorder "recorder" FROM storage_foodbasicinfo 
566
+    WHERE 1=1 AND seal_status=1 AND history_status=0 
567
+    <if test="orgId != null">
568
+     and org_id=#{orgId}
569
+    </if>
570
+    <if test="houseId != null">
571
+     and house_id=#{houseId}
572
+    </if>
573
+    <if test="wareId != null">
574
+     and warehouse_id=#{wareId}
575
+    </if>
576
+    ORDER BY id DESC
577
+  </select>
578
+  <!-- 查询周粮情分析数据 -->
579
+  <select id="getThreeTempData" parameterType="java.util.Map" resultType="java.util.Map">
580
+    SELECT
581
+        id id,
582
+        org_id orgId,
583
+        storehouse houseId,
584
+        time checkDate,
585
+        inTemp inTemp,
586
+        outTemp outTemp,
587
+        inH inWater,
588
+        outH outWater,
589
+        max maxTemp,
590
+        min minTemp,
591
+        avg avgTemp,
592
+        avg lsTemp
593
+    FROM
594
+        t_testdata
595
+    <where>
596
+      iLq_yq = '0'
597
+      <if test="orgId != null">
598
+        AND org_id = #{orgId}
599
+      </if>
600
+      <if test="storehouse != null">
601
+        AND storehouse = #{storehouse}
602
+      </if>
603
+      <if test="startDate != null and endDate != null">
604
+        AND time BETWEEN #{startDate} AND #{endDate}
605
+      </if>
606
+    </where>
607
+      <if test="weekParams != null">
608
+         GROUP BY  DATE(checkDate)
609
+      </if>
610
+    ORDER BY time DESC
611
+  </select>
563 612
 </mapper>

+ 31 - 2
src/main/java/com/chinaitop/depot/grainAnalysis/service/StorageGrainAnalysisService.java

@@ -3,8 +3,7 @@ package com.chinaitop.depot.grainAnalysis.service;
3 3
 import java.util.List;
4 4
 import java.util.Map;
5 5
 
6
-import javax.servlet.http.HttpServletRequest;
7
-
6
+import com.alibaba.fastjson.JSONObject;
8 7
 import com.chinaitop.depot.grainAnalysis.model.StorageGrainAnalysis;
9 8
 import com.chinaitop.depot.grainAnalysis.model.StorageGrainAnalysisExample;
10 9
 
@@ -91,4 +90,34 @@ public interface StorageGrainAnalysisService {
91 90
 	 */
92 91
 	Map<String, Object> getYearThreeTempDate(Integer houseId, Integer wareId, Integer year, Integer orgId,
93 92
 			Map<String, Object> map);
93
+
94
+	/**
95
+	 * 查询一条粮情专卡数据
96
+	 * 
97
+	 * @param orgId
98
+	 * @param houseId
99
+	 * @param wareId
100
+	 * @return
101
+	 * @throws Exception
102
+	 */
103
+	Map<String, Object> queryLqzkData(Integer orgId, Integer houseId, Integer wareId) throws Exception;
104
+
105
+	/**
106
+	 * 查询周粮情的三温数据
107
+	 * 
108
+	 * @param jsonMap
109
+	 * @param weekParams
110
+	 * @return
111
+	 * @throws Exception
112
+	 */
113
+	Map<String, Object> getWeekThreeTempDate(JSONObject jsonMap, Integer weekParams) throws Exception;
114
+
115
+	/**
116
+	 * 查询月粮情的三温数据
117
+	 * 
118
+	 * @param threeTempJson
119
+	 * @return
120
+	 * @throws Exception
121
+	 */
122
+	Map<String, Object> getMonthThreeTempDateNews(String threeTempJson) throws Exception;
94 123
 }

+ 110 - 0
src/main/java/com/chinaitop/depot/grainAnalysis/service/impl/StorageGrainAnalysisServiceImpl.java

@@ -8,8 +8,12 @@ import java.util.Map;
8 8
 
9 9
 import javax.annotation.Resource;
10 10
 
11
+import org.apache.commons.lang3.StringUtils;
11 12
 import org.springframework.stereotype.Service;
13
+import org.springframework.transaction.annotation.Transactional;
12 14
 
15
+import com.alibaba.fastjson.JSON;
16
+import com.alibaba.fastjson.JSONObject;
13 17
 import com.chinaitop.depot.grainAnalysis.mapper.StorageExceptionAndOnforeMapper;
14 18
 import com.chinaitop.depot.grainAnalysis.mapper.StorageGrainAnalysisMapper;
15 19
 import com.chinaitop.depot.grainAnalysis.model.StorageExceptionAndOnfore;
@@ -22,6 +26,7 @@ import com.fasterxml.jackson.core.type.TypeReference;
22 26
 import com.fasterxml.jackson.databind.ObjectMapper;
23 27
 
24 28
 @Service
29
+@SuppressWarnings("all")
25 30
 public class StorageGrainAnalysisServiceImpl implements StorageGrainAnalysisService {
26 31
 
27 32
 	@Resource
@@ -263,4 +268,109 @@ public class StorageGrainAnalysisServiceImpl implements StorageGrainAnalysisServ
263 268
 		}
264 269
 	}
265 270
 
271
+	@SuppressWarnings("null")
272
+	@Override
273
+	@Transactional
274
+	public Map<String, Object> queryLqzkData(Integer orgId, Integer houseId, Integer wareId) throws Exception {
275
+		Map<String, Object> param_map = new HashMap<>();
276
+
277
+        if(null != houseId){
278
+        	param_map.put("houseId", houseId);
279
+        }
280
+        if(null != wareId){
281
+        	param_map.put("wareId", wareId);
282
+        }
283
+        if(null != orgId){
284
+        	param_map.put("wareId", wareId);
285
+        }
286
+
287
+        List<Map<String, Object>> basicInfo = analysisMapper.queryLqzkData(param_map);
288
+
289
+        Map<String, Object> rtn_map = null;
290
+        if (null != basicInfo && basicInfo.size() > 0) {
291
+        	Map<String, Object> obj = basicInfo.get(0);
292
+        	rtn_map = new HashMap<String, Object>();
293
+        	rtn_map.put("houseType", Integer.parseInt(obj.get("houseType")+""));
294
+        	rtn_map.put("subType", Integer.parseInt(obj.get("subType")+""));
295
+        	rtn_map.put("recorder", obj.get("recorder")+"");
296
+        }
297
+        return rtn_map;
298
+	}
299
+
300
+	@Override
301
+	@Transactional
302
+	public Map<String, Object> getWeekThreeTempDate(JSONObject jsonMap, Integer weekParams) throws Exception {
303
+
304
+		Map<String, Object> threeTempMap = new HashMap<>();
305
+
306
+		/* 参数对象 */
307
+        Map<String, Object> parementMap = new HashMap<>();
308
+        if (StringUtils.isNotBlank(jsonMap.getString("houseId")))
309
+        	parementMap.put("storehouse", jsonMap.getString("houseId"));
310
+        if(StringUtils.isNotBlank(jsonMap.getString("startDate"))) {
311
+        	parementMap.put("startDate", ParameterUtil.string2date(jsonMap.getString("startDate") + " 00:00:00"));
312
+        }
313
+        if(StringUtils.isNotBlank(jsonMap.getString("endDate"))) {
314
+        	parementMap.put("endDate", ParameterUtil.string2date(jsonMap.getString("endDate") + " 23:59:59"));
315
+        }
316
+        if(null != weekParams){
317
+        	parementMap.put("weekParams",weekParams); //用于周粮情的判断,以区分智能仓房的三温检查
318
+        }
319
+        parementMap.put("orders", " time asc");
320
+        List<Map<String, Object>> list = analysisMapper.getThreeTempData(parementMap);
321
+        
322
+
323
+//        StorageThreetempcheckExample example = new StorageThreetempcheckExample();
324
+//        StorageThreetempcheckExample.Criteria criteria = example.createCriteria();
325
+//        criteria.andHouseIdEqualTo(Integer.parseInt(jsonMap.getString("houseId")));
326
+//        criteria.andCheckDateGreaterThanOrEqualTo(ParameterUtil.string2date(jsonMap.getString("startDate") + " 00:00:00"));
327
+//        criteria.andCheckDateLessThanOrEqualTo(ParameterUtil.string2date(jsonMap.getString("endDate") + " 23:59:59"));
328
+//        criteria.andOrgIdEqualTo(Integer.parseInt(jsonMap.getString("orgId")));
329
+//        example.setOrderByClause("check_date asc");
330
+//
331
+//        List<StorageThreetempcheck> threeTempList = threetempCheckService.selectByExample(example);
332
+
333
+        threeTempMap.put("threeTempCheckList", list);
334
+		return threeTempMap;
335
+	}
336
+
337
+	@Override
338
+	@Transactional
339
+	public Map<String, Object> getMonthThreeTempDateNews(String threeTempJson) throws Exception {
340
+
341
+		if (threeTempJson.length() == 0) {
342
+            return null;
343
+        }
344
+
345
+        Map<String, Object> threeTempMap = new HashMap<String, Object>();
346
+        List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
347
+
348
+
349
+        List<JSONObject> array = JSON.parseArray(threeTempJson, JSONObject.class);
350
+        for (JSONObject obj : array) {
351
+
352
+            /* 参数对象 */
353
+            Map<String, Object> parementMap = new HashMap<>();
354
+            if (StringUtils.isNotBlank(obj.getString("houseId")))
355
+            	parementMap.put("storehouse", obj.getString("houseId"));
356
+            if(StringUtils.isNotBlank(obj.getString("startDate"))) {
357
+            	parementMap.put("startDate", ParameterUtil.string2date(obj.getString("startDate") + " 00:00:00"));
358
+            }
359
+            if(StringUtils.isNotBlank(obj.getString("endDate"))) {
360
+            	parementMap.put("endDate", ParameterUtil.string2date(obj.getString("endDate") + " 23:59:59"));
361
+            }
362
+            parementMap.put("orders", " time asc");
363
+            List<Map<String, Object>> threeTempList = analysisMapper.getThreeTempData(parementMap);
364
+            list.add(threeTempList.get(0));
365
+        }
366
+
367
+        if (null == list || list.size() == 0) {
368
+            list = new ArrayList<Map<String, Object>>();
369
+        }
370
+
371
+        threeTempMap.put("threeTempCheckList", list);
372
+
373
+		return threeTempMap;
374
+	}
375
+
266 376
 }