Browse Source

修改查询粮油情三温sql

fanxw 5 years ago
parent
commit
155c3a9404

+ 52 - 10
src/main/java/com/chinaitop/depot/storage/controller/StorageThreetempCheckController.java

@@ -5,6 +5,7 @@ import java.util.*;
5 5
 import javax.annotation.Resource;
6 6
 import javax.servlet.http.HttpServletRequest;
7 7
 
8
+import org.apache.commons.lang.ObjectUtils;
8 9
 import org.apache.commons.lang3.StringUtils;
9 10
 import org.springframework.http.MediaType;
10 11
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -98,8 +99,18 @@ public class StorageThreetempCheckController {
98 99
         // 查询条件map
99 100
         Map<String, Object> map = new HashMap<>();
100 101
         // 仓房编码
101
-        if (ParameterUtil.isnotnull(houseId))
102
-            map.put("storehouse", houseId);
102
+        if (ParameterUtil.isnotnull(houseId)) {
103
+        	map.put("storehouse", houseId);
104
+        	if (!"".equals(houseId)) {
105
+        		String str = houseId.substring(0, 2).toString();
106
+        		if ("YG".equals(str)) {
107
+        			map.put("iLq_yq", "1");
108
+        		} else {
109
+        			map.put("iLq_yq", "0");
110
+        		}
111
+        	}
112
+        }
113
+        
103 114
         // 查询开始时间
104 115
         if (StringUtils.isNotBlank(searchStartDate))
105 116
             map.put("startDate", ParameterUtil.string2datetime(searchStartDate + " 00:00:00"));
@@ -183,8 +194,18 @@ public class StorageThreetempCheckController {
183 194
     })
184 195
     public List<Map<String, Object>> chartData(String houseId, String checkDate) {
185 196
         Map<String, Object> map = new HashMap<>();
186
-        if (StringUtils.isNotBlank(houseId))
187
-            map.put("storehouse", houseId);
197
+        if (StringUtils.isNotBlank(houseId)) {
198
+        	map.put("storehouse", houseId);
199
+        	if (!"".equals(houseId)) {
200
+        		String str = houseId.substring(0, 2).toString();
201
+        		if ("YG".equals(str)) {
202
+        			map.put("iLq_yq", "1");
203
+        		} else {
204
+        			map.put("iLq_yq", "0");
205
+        		}
206
+        	}
207
+        }
208
+        
188 209
         if(StringUtils.isNotBlank(checkDate)) {
189 210
             // 开始时间前推三天
190 211
             Date startDate = new Date((ParameterUtil.string2datetime(checkDate + " 00:00:00").getTime()/1000-3600*24*2)*1000);
@@ -252,13 +273,23 @@ public class StorageThreetempCheckController {
252 273
         Map<String, Object> threeTempMap = new HashMap<>();
253 274
         /* 参数对象 */
254 275
         Map<String, Object> parementMap = new HashMap<>();
255
-        if (StringUtils.isNotBlank(jsonMap.getString("houseId")))
256
-        	parementMap.put("storehouse", jsonMap.getString("houseId"));
276
+        if (StringUtils.isNotBlank(jsonMap.getString("houseId"))) {
277
+        	String store_code = ObjectUtils.toString(jsonMap.getString("houseId"), "");
278
+        	parementMap.put("storehouse", store_code);
279
+        	if (!"".equals(store_code)) {
280
+        		String str = store_code.substring(0, 2).toString();
281
+        		if ("YG".equals(str)) {
282
+        			parementMap.put("iLq_yq", "1");
283
+        		} else {
284
+        			parementMap.put("iLq_yq", "0");
285
+        		}
286
+        	}
287
+        }
257 288
         if(StringUtils.isNotBlank(jsonMap.getString("startDate"))) {
258
-        	parementMap.put("startDate", ParameterUtil.string2date(jsonMap.getString("startDate") + " 00:00:00"));
289
+        	parementMap.put("startDate", ParameterUtil.string2datetime(jsonMap.getString("startDate") + " 00:00:00"));
259 290
         }
260 291
         if(StringUtils.isNotBlank(jsonMap.getString("endDate"))) {
261
-        	parementMap.put("endDate", ParameterUtil.string2date(jsonMap.getString("endDate") + " 23:59:59"));
292
+        	parementMap.put("endDate", ParameterUtil.string2datetime(jsonMap.getString("endDate") + " 23:59:59"));
262 293
         }
263 294
         if(null != weekParams){
264 295
         	parementMap.put("weekParams",weekParams); //用于周粮情的判断,以区分智能仓房的三温检查
@@ -317,8 +348,19 @@ public class StorageThreetempCheckController {
317 348
             
318 349
             /* 参数对象 */
319 350
             Map<String, Object> parementMap = new HashMap<>();
320
-            if (StringUtils.isNotBlank(obj.getString("houseId")))
321
-            	parementMap.put("storehouse", obj.getString("houseId"));
351
+            if (StringUtils.isNotBlank(obj.getString("houseId"))) {
352
+            	String store_code = ObjectUtils.toString(obj.getString("houseId"), "");
353
+            	parementMap.put("storehouse", store_code);
354
+            	if (!"".equals(store_code)) {
355
+            		String str = store_code.substring(0, 2).toString();
356
+            		if ("YG".equals(str)) {
357
+            			parementMap.put("iLq_yq", "1");
358
+            		} else {
359
+            			parementMap.put("iLq_yq", "0");
360
+            		}
361
+            	}
362
+            }
363
+            
322 364
             if(StringUtils.isNotBlank(obj.getString("startDate"))) {
323 365
             	parementMap.put("startDate", ParameterUtil.string2date(obj.getString("startDate") + " 00:00:00"));
324 366
             }

+ 4 - 1
src/main/java/com/chinaitop/depot/storage/mapper/StorageThreetempcheckMapper.xml

@@ -507,7 +507,10 @@
507 507
     FROM
508 508
         t_testdata
509 509
     <where>
510
-      iLq_yq = '0'
510
+      1=1 
511
+      <if test="iLq_yq != null">
512
+        AND iLq_yq = #{iLq_yq}
513
+      </if>
511 514
       <if test="storehouse != null">
512 515
         AND storehouse = #{storehouse}
513 516
       </if>