|
|
@@ -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
|
}
|