fanxw 2 年之前
父節點
當前提交
9aa7e17b3a

+ 32 - 40
src/main/java/com/chinaitop/depot/storage/controller/StorageQualitycheckController.java

@@ -20,19 +20,15 @@ import org.springframework.web.bind.annotation.RequestMapping;
20 20
 import org.springframework.web.bind.annotation.RequestMethod;
21 21
 import org.springframework.web.bind.annotation.RestController;
22 22
 
23
-import com.alibaba.fastjson.JSON;
24 23
 import com.alibaba.fastjson.JSONArray;
25 24
 import com.chinaitop.depot.storage.model.StorageFoodbasicinfo;
26 25
 import com.chinaitop.depot.storage.model.StorageQualitycheck;
27
-import com.chinaitop.depot.storage.model.StorageQualitycheckExample;
28
-import com.chinaitop.depot.storage.model.StorageQualitycheckExample.Criteria;
29 26
 import com.chinaitop.depot.storage.model.StorageQualitycheckInspectionExample;
30 27
 import com.chinaitop.depot.storage.model.StorageQualitycheckSonExample;
31 28
 import com.chinaitop.depot.storage.service.StorageQualitycheckService;
32 29
 import com.chinaitop.depot.storage.service.StorageQualitycheckSonService;
33 30
 import com.chinaitop.depot.storage.utils.DataSynchronization;
34 31
 import com.chinaitop.depot.storage.utils.ParameterUtil;
35
-import com.chinaitop.depot.utils.HttpUtil;
36 32
 import com.fasterxml.jackson.databind.ObjectMapper;
37 33
 import com.github.pagehelper.PageHelper;
38 34
 import com.github.pagehelper.PageInfo;
@@ -634,43 +630,19 @@ public class StorageQualitycheckController {
634 630
     })
635 631
     public PageInfo<StorageQualitycheck> newListPage(Integer pageNum, Integer pageSize, Integer houseId, Integer wareId,
636 632
                                                   String checkType, String checkResult, Integer historyStatus, Integer orgId) {
637
-    	StorageQualitycheckExample example = new StorageQualitycheckExample();
638
-    	Criteria criteria = example.createCriteria();
639 633
 
640
-        //根据后台传来的参数进行查找相应类型的类别0:初检 1:验收 2:质量普查 3:出库
641
-        if (StringUtils.isNotBlank(checkType)){
642
-        	//criteria.andTypeEqualTo(checkType);
643
-        	criteria.andCheckTypeEqualTo(checkType);
644
-        }
645
-        // 仓房id.
646
-        if (houseId != null) {
647
-        	criteria.andHouseIdEqualTo(houseId);
648
-        }
649
-        // 货位id.
650
-        if (wareId != null) {
651
-        	criteria.andWarehouseIdEqualTo(wareId);
652
-        }
653
-        // 粮库id.
654
-        if (orgId != null) {
655
-        	criteria.andOrgIdEqualTo(orgId);
656
-        }
657
-
658
-        //检验结果(0:合格 , 1 :不合格)
659
-        if (StringUtils.isNotBlank(checkResult)) {
660
-        	criteria.andCheckResultEqualTo(checkResult);
661
-        }
662
-        //数据状态
663
-        if (null != historyStatus) {
664
-        	//0:最新数据  1:历史数据
665
-        	criteria.andHistoryStatusEqualTo(historyStatus);
666
-        }
667
-
668
-        if (pageNum!=null && pageSize!=null) {
669
-            PageHelper.startPage(pageNum, pageSize);
670
-        }
671
-        List<StorageQualitycheck> list = storageQualitycheckService.findByCondition(example);
634
+        List<StorageQualitycheck> list = null;
635
+        PageInfo<StorageQualitycheck> pageInfo = null;
636
+        try {
637
+        	if (pageNum!=null && pageSize!=null) {
638
+        		PageHelper.startPage(pageNum, pageSize);
639
+        	}
640
+			list = storageQualitycheckService.getList(houseId, wareId, checkType, checkResult, historyStatus, orgId);
641
+			pageInfo = new PageInfo<StorageQualitycheck>(list);
642
+		} catch (Exception e) {
643
+			e.printStackTrace();
644
+		}
672 645
 
673
-        PageInfo<StorageQualitycheck> pageInfo = new PageInfo<StorageQualitycheck>(list);
674 646
         return pageInfo;
675 647
     }
676 648
 
@@ -832,6 +804,26 @@ public class StorageQualitycheckController {
832 804
         }
833 805
         return modelMap;
834 806
     }
835
-    
836 807
 
808
+    @RequestMapping(value="/queryCheckDataDetail", produces = MediaType.APPLICATION_JSON_VALUE, method = RequestMethod.GET)
809
+    @ApiOperation(value="根据条件查找一条质检数据详情", notes = "")
810
+    @ApiImplicitParams({
811
+            @ApiImplicitParam(name = "houseId", value = "仓房ID", paramType = "query"),
812
+            @ApiImplicitParam(name = "wareId", value = "货位ID", paramType = "query"),
813
+            @ApiImplicitParam(name = "checkType", value = "检验类型(0:自检,3:出库检验,4:春秋普查,5:第三方检查)", paramType = "query"),
814
+            @ApiImplicitParam(name = "historyStatus", value = "数据状态(0:新数据,1:已归档数据)", paramType = "query"),
815
+            @ApiImplicitParam(name = "orgId", value = "组织机构ID", paramType = "query")
816
+    })
817
+    public  Map<String, Object> queryCheckDataDetail(Integer houseId, Integer wareId, String checkType, 
818
+			Integer historyStatus, Integer orgId){
819
+
820
+    	Map<String, Object> retMap = null;
821
+    	try {
822
+			retMap = storageQualitycheckService.queryCheckDataDetail(houseId, wareId, checkType, historyStatus, orgId);
823
+		} catch (Exception e) {
824
+			e.printStackTrace();
825
+		}
826
+
827
+        return retMap;
828
+    }
837 829
 }

+ 1 - 1
src/main/java/com/chinaitop/depot/storage/controller/XwkZljcController.java

@@ -24,7 +24,7 @@ import java.util.concurrent.ConcurrentHashMap;
24 24
  */
25 25
 @RestController
26 26
 @RequestMapping(value = {"/xwkZljc"})
27
-@Api(value= "XwkZljcController", description = "质量管理控制类")
27
+@Api(value= "XwkZljcController", description = "质量管理-第三方质检控制类")
28 28
 public class XwkZljcController {
29 29
     @Resource
30 30
     private XwkZljcServiceImpl xwkZljcServiceImpl;

+ 29 - 4
src/main/java/com/chinaitop/depot/storage/service/StorageQualitycheckService.java

@@ -1,15 +1,14 @@
1 1
 package com.chinaitop.depot.storage.service;
2 2
 
3
+import java.util.List;
4
+import java.util.Map;
5
+
3 6
 import com.alibaba.fastjson.JSONArray;
4 7
 import com.chinaitop.depot.storage.model.StorageQualitycheck;
5 8
 import com.chinaitop.depot.storage.model.StorageQualitycheckExample;
6 9
 import com.chinaitop.depot.storage.model.StorageQualitycheckInspectionExample;
7 10
 import com.chinaitop.depot.storage.model.StorageQualitycheckSon;
8 11
 
9
-import javax.servlet.http.HttpServletRequest;
10
-import java.util.List;
11
-import java.util.Map;
12
-
13 12
 public interface StorageQualitycheckService {
14 13
 
15 14
 	/**
@@ -145,4 +144,30 @@ public interface StorageQualitycheckService {
145 144
 	Map<String, Object> getcheckByIds(Integer id);
146 145
 
147 146
 	int deleteStorageQualitycheckInspection(StorageQualitycheckInspectionExample example);
147
+
148
+	/**
149
+	 * 按条件查询质检数据列表
150
+	 * @param houseId 仓房ID
151
+	 * @param wareId 货位ID
152
+	 * @param checkType 检验类型(0:自检,3:出库检验,4:春秋普查,5:第三方检查)
153
+	 * @param historyStatus 数据状态(0:新数据,1:已归档数据)
154
+	 * @param orgId 组织机构ID
155
+	 * @return
156
+	 * @throws Exception
157
+	 */
158
+	List<StorageQualitycheck> getList(Integer houseId, Integer wareId, String checkType, String checkResult,
159
+			Integer historyStatus, Integer orgId) throws Exception;
160
+
161
+	/**
162
+	 * 按条件查询质检数据详情
163
+	 * @param houseId 仓房ID
164
+	 * @param wareId 货位ID
165
+	 * @param checkType 检验类型(0:自检,3:出库检验,4:春秋普查,5:第三方检查)
166
+	 * @param historyStatus 数据状态(0:新数据,1:已归档数据)
167
+	 * @param orgId 组织机构ID
168
+	 * @return
169
+	 * @throws Exception 
170
+	 */
171
+	Map<String, Object> queryCheckDataDetail(Integer houseId, Integer wareId, String checkType, 
172
+			Integer historyStatus, Integer orgId) throws Exception;
148 173
 }

+ 51 - 0
src/main/java/com/chinaitop/depot/storage/service/impl/StorageQualitycheckServiceImpl.java

@@ -23,6 +23,7 @@ import com.chinaitop.depot.storage.mapper.StorageQualitycheckMapper;
23 23
 import com.chinaitop.depot.storage.mapper.StorageQualitycheckSonMapper;
24 24
 import com.chinaitop.depot.storage.model.StorageQualitycheck;
25 25
 import com.chinaitop.depot.storage.model.StorageQualitycheckExample;
26
+import com.chinaitop.depot.storage.model.StorageQualitycheckExample.Criteria;
26 27
 import com.chinaitop.depot.storage.model.StorageQualitycheckInspection;
27 28
 import com.chinaitop.depot.storage.model.StorageQualitycheckInspectionExample;
28 29
 import com.chinaitop.depot.storage.model.StorageQualitycheckSon;
@@ -425,4 +426,54 @@ public class StorageQualitycheckServiceImpl implements StorageQualitycheckServic
425 426
 			}
426 427
 		}
427 428
 	}
429
+
430
+	@Override
431
+	public List<StorageQualitycheck> getList(Integer houseId, Integer wareId, String checkType, String checkResult,
432
+			Integer historyStatus, Integer orgId) throws Exception {
433
+		StorageQualitycheckExample example = new StorageQualitycheckExample();
434
+    	Criteria criteria = example.createCriteria();
435
+
436
+        //根据后台传来的参数进行查找相应类型的类别0:初检 1:验收 2:质量普查 3:出库
437
+        if (StringUtils.isNotBlank(checkType)){
438
+        	//criteria.andTypeEqualTo(checkType);
439
+        	criteria.andCheckTypeEqualTo(checkType);
440
+        }
441
+        // 仓房id.
442
+        if (houseId != null) {
443
+        	criteria.andHouseIdEqualTo(houseId);
444
+        }
445
+        // 货位id.
446
+        if (wareId != null) {
447
+        	criteria.andWarehouseIdEqualTo(wareId);
448
+        }
449
+        // 粮库id.
450
+        if (orgId != null) {
451
+        	criteria.andOrgIdEqualTo(orgId);
452
+        }
453
+
454
+        //检验结果(0:合格 , 1 :不合格)
455
+        if (StringUtils.isNotBlank(checkResult)) {
456
+        	criteria.andCheckResultEqualTo(checkResult);
457
+        }
458
+        //数据状态
459
+        if (null != historyStatus) {
460
+        	//0:最新数据  1:历史数据
461
+        	criteria.andHistoryStatusEqualTo(historyStatus);
462
+        }
463
+        List<StorageQualitycheck> list = qualitycheckMapper.selectByExample(example);
464
+
465
+		return list;
466
+	}
467
+
468
+	@Override
469
+	public Map<String, Object> queryCheckDataDetail(Integer houseId, Integer wareId, String checkType,
470
+			Integer historyStatus, Integer orgId) throws Exception {
471
+		List<StorageQualitycheck> list = getList(houseId, wareId, checkType, null, historyStatus, orgId);
472
+		Map<String, Object> retMap = null;
473
+		if (null != list && list.size() > 0) {
474
+			Integer id = list.get(0).getId();
475
+			retMap = loadDataById(id);
476
+		}
477
+		return retMap;
478
+	}
428 479
 }