Przeglądaj źródła

新增功能文件

lvzhikai 4 lat temu
rodzic
commit
1d90eeab57

+ 212 - 0
src/main/java/com/chinaitop/depot/grainAnalysis/controller/halfMonthStorageGrainAnalysisController.java

@@ -0,0 +1,212 @@
1
+package com.chinaitop.depot.grainAnalysis.controller;
2
+
3
+import java.util.ArrayList;
4
+import java.util.Date;
5
+import java.util.HashMap;
6
+import java.util.List;
7
+import java.util.Map;
8
+
9
+import javax.annotation.Resource;
10
+
11
+import org.apache.commons.lang.ObjectUtils;
12
+import org.apache.commons.lang3.StringUtils;
13
+import org.springframework.http.MediaType;
14
+import org.springframework.web.bind.annotation.RequestMapping;
15
+import org.springframework.web.bind.annotation.RequestMethod;
16
+import org.springframework.web.bind.annotation.RestController;
17
+
18
+import com.alibaba.fastjson.JSON;
19
+import com.alibaba.fastjson.JSONObject;
20
+import com.chinaitop.depot.grainAnalysis.model.StorageExceptionAndOnfore;
21
+import com.chinaitop.depot.grainAnalysis.model.StorageGrainAnalysis;
22
+import com.chinaitop.depot.grainAnalysis.model.StorageGrainAnalysisExample;
23
+import com.chinaitop.depot.grainAnalysis.service.StorageGrainAnalysisService;
24
+import com.chinaitop.utils.ParameterUtil;
25
+import com.fasterxml.jackson.databind.ObjectMapper;
26
+import com.github.pagehelper.PageHelper;
27
+import com.github.pagehelper.PageInfo;
28
+
29
+import io.swagger.annotations.Api;
30
+import io.swagger.annotations.ApiImplicitParam;
31
+import io.swagger.annotations.ApiImplicitParams;
32
+import io.swagger.annotations.ApiOperation;
33
+
34
+/**
35
+ * 半月粮情分析controller
36
+ * @author User
37
+ */
38
+@RestController
39
+@SuppressWarnings("all")
40
+@RequestMapping(value = "/halfMonthStorageGrainAnalysis")
41
+@Api(value= "halfMonthStorageGrainAnalysisController", description = "半月粮情分析控制类")
42
+public class halfMonthStorageGrainAnalysisController {
43
+
44
+	@Resource
45
+	private StorageGrainAnalysisService analysisService;
46
+
47
+	@RequestMapping(value="/getList", produces = MediaType.APPLICATION_JSON_VALUE, method=RequestMethod.GET)
48
+	@ApiOperation(value="半月粮情分析列表", notes = "支持分页")
49
+    @ApiImplicitParams({
50
+    	@ApiImplicitParam(name="pageNum", value="页数", paramType="query"),
51
+    	@ApiImplicitParam(name="pageSize", value="每页显示条数", paramType="query"),
52
+    	@ApiImplicitParam(name="storehouseId", value="仓房ID", paramType="query"),
53
+    	@ApiImplicitParam(name="storehouseCode", value="仓房编码", paramType="query"),
54
+    	@ApiImplicitParam(name="startTime", value="起始时间", paramType="query"),
55
+    	@ApiImplicitParam(name="endTime", value="结束时间", paramType="query")
56
+    })
57
+	public PageInfo<StorageGrainAnalysis> getList(Integer pageNum, Integer pageSize, String storehouseId,
58
+			String storehouseCode, String startTime, String endTime) {
59
+
60
+		StorageGrainAnalysisExample analysisExample = new StorageGrainAnalysisExample();
61
+		StorageGrainAnalysisExample.Criteria analysisCriteria = analysisExample.createCriteria();
62
+
63
+		if (null != storehouseId && !"".equals(storehouseId)) {
64
+			analysisCriteria.andStorehouseIdEqualTo(storehouseId);
65
+		}
66
+
67
+		if (null != storehouseCode && !"".equals(storehouseCode)) {
68
+			analysisCriteria.andStorehouseCodeLike("%"+storehouseCode+"%");
69
+		}
70
+
71
+		if (ParameterUtil.isnotnull(startTime)) {
72
+			Date starDate = ParameterUtil.string2datetime(startTime + " 00:00:00");
73
+			analysisCriteria.andCheckDateStartGreaterThanOrEqualTo(starDate);
74
+		}
75
+
76
+		if (ParameterUtil.isnotnull(endTime)) {
77
+			Date endDate = ParameterUtil.string2datetime(endTime + " 23:59:59");
78
+			analysisCriteria.andCheckDateStartLessThanOrEqualTo(endDate);
79
+		}
80
+
81
+		if (null != pageNum && null != pageSize) {
82
+			PageHelper.startPage(pageNum, pageSize);
83
+		}
84
+
85
+		analysisCriteria.andAnalysisTypeEqualTo(3); //只查询半月粮情分析
86
+
87
+		analysisExample.setOrderByClause(" id desc");
88
+
89
+		List<StorageGrainAnalysis> list = analysisService.findByCondition(analysisExample);
90
+		PageInfo<StorageGrainAnalysis> pageInfo = new PageInfo<StorageGrainAnalysis>(list);
91
+
92
+		return pageInfo;
93
+	}
94
+	
95
+	@RequestMapping(value="/edit", produces = MediaType.APPLICATION_JSON_VALUE, method=RequestMethod.GET)
96
+	@ApiOperation(value="查询一条半月粮情分析数据", notes = "查询一条半月粮情分析数据")
97
+    @ApiImplicitParams({
98
+    	@ApiImplicitParam(name="id", value="数据ID", paramType="query"),
99
+    	@ApiImplicitParam(name="analysisType", value="粮情分析类型数据", paramType="query")
100
+    })
101
+	public Map<String, Object> edit(Integer id, Integer analysisType) {
102
+
103
+		Map<String, Object> map = new HashMap<>();
104
+
105
+		if (null != id && !"".equals(id)) {
106
+			map = analysisService.findByIdAnalysisObj(id, analysisType, map);
107
+		} else {
108
+			StorageGrainAnalysis grain = new StorageGrainAnalysis();
109
+			map.put("grain", grain);
110
+		}
111
+
112
+		return map;
113
+	}
114
+
115
+	@RequestMapping(value="/getThreeTempDate", produces = MediaType.APPLICATION_JSON_VALUE, method=RequestMethod.GET)
116
+	@ApiOperation(value="查询一条三温检查数据", notes = "查询一条三温检查数据")
117
+    @ApiImplicitParams({
118
+    	@ApiImplicitParam(name="threeTempList", value="温度数组", paramType="query")
119
+    })
120
+	public Map<String, Object> getThreeTempDate(String[] threeTempList) {
121
+		Map<String, Object> map = new HashMap<>();
122
+
123
+		if (null != threeTempList && threeTempList.length > 0) {
124
+			List<StorageExceptionAndOnfore> exceptionAndOnforeList = new ArrayList<>();
125
+			StorageExceptionAndOnfore exceptionAndOnfore = new StorageExceptionAndOnfore();
126
+			for (Object obj : threeTempList) {
127
+				exceptionAndOnforeList.add(exceptionAndOnfore);
128
+
129
+				if(ParameterUtil.isnull(threeTempList[1])){
130
+					break;
131
+				}
132
+			}
133
+			map.put("exceptionAndOnforeList", exceptionAndOnforeList);
134
+		}
135
+
136
+		return map;
137
+	}
138
+
139
+	/**
140
+	 * 提交
141
+	 * 
142
+	 * @param grainJson 主表数据
143
+	 * @param exceptionJson 从表数据
144
+	 * @param type 分析类型
145
+	 * @param orgId 组织机构ID
146
+	 * @param userId 用户ID
147
+	 * @return
148
+	 */
149
+	@RequestMapping(value="/update", produces = MediaType.APPLICATION_JSON_VALUE, method=RequestMethod.POST)
150
+	@ApiOperation(value="保存半月粮情分析数据", notes = "保存半月粮情分析数据")
151
+    @ApiImplicitParams({
152
+    	@ApiImplicitParam(name="grainJson", value="主表数据", paramType="form"),
153
+    	@ApiImplicitParam(name="exceptionJson", value="字表数据", paramType="form"),
154
+    	@ApiImplicitParam(name="type", value="分析类型", paramType="form"),
155
+    	@ApiImplicitParam(name="orgId", value="组织机构ID", paramType="form"),
156
+    	@ApiImplicitParam(name="userId", value="用户ID", paramType="form")
157
+    })
158
+	public Map<String, Object> update( String grainJson, String exceptionJson, Integer type, Integer orgId, Integer userId) {
159
+		Map<String, Object> map = new HashMap<>();
160
+		
161
+		map = analysisService.updateGrainAndException(grainJson, exceptionJson, map, type, orgId, userId);
162
+		
163
+		return map;
164
+	}
165
+
166
+	/**
167
+	 * 审核提交
168
+	 * 
169
+	 * @param grainJson
170
+	 * @return
171
+	 */
172
+	@RequestMapping(value="/auditor_submit", produces = MediaType.APPLICATION_JSON_VALUE, method=RequestMethod.POST)
173
+	@ApiOperation(value="审核提交", notes = "审核提交")
174
+    @ApiImplicitParams({
175
+    	@ApiImplicitParam(name="grainJson", value="主表数据", paramType="form")
176
+    })
177
+	public Map<String, Object> auditor_submit(String grainJson) {
178
+		Map<String, Object> map = new HashMap<>();
179
+		
180
+		ObjectMapper mappers = new ObjectMapper();
181
+		try {
182
+			StorageGrainAnalysis grain = mappers.readValue(grainJson, StorageGrainAnalysis.class);
183
+			grain.setAuditorStatus(1); // 新数据设置为已审核状态
184
+			analysisService.update(grain);
185
+		} catch (Exception e) {
186
+			e.printStackTrace();
187
+		}
188
+		map.put("status", "success");
189
+		map.put("msg", "审核成功!");
190
+		
191
+		return map;
192
+	}
193
+
194
+	@RequestMapping(value = "/editTwo", produces = MediaType.APPLICATION_JSON_VALUE, method = RequestMethod.GET)
195
+    @ApiOperation(value = "查询半月粮情分析", notes = "查询一条半月粮情分析数据")
196
+    @ApiImplicitParams({
197
+            @ApiImplicitParam(name = "map", value = "数据集合", paramType = "query")
198
+    })
199
+    public Map<String, Object> editTwo(String map, Integer weekParams) {
200
+
201
+        Map<String, Object> threeTempMap = null;
202
+		try {
203
+			threeTempMap = analysisService.getThreeTempData(map, weekParams);
204
+		} catch (Exception e) {
205
+			threeTempMap = new HashMap<String, Object>();
206
+			e.printStackTrace();
207
+		} finally {
208
+			return threeTempMap;
209
+		}
210
+    }
211
+
212
+}

+ 254 - 0
src/main/java/com/chinaitop/depot/grainAnalysis/controller/quarterStorageGrainAnalysisController.java

@@ -0,0 +1,254 @@
1
+package com.chinaitop.depot.grainAnalysis.controller;
2
+
3
+import java.util.ArrayList;
4
+import java.util.HashMap;
5
+import java.util.List;
6
+import java.util.Map;
7
+
8
+import javax.annotation.Resource;
9
+
10
+import com.chinaitop.utils.ParameterUtil;
11
+import org.springframework.http.MediaType;
12
+import org.springframework.web.bind.annotation.RequestMapping;
13
+import org.springframework.web.bind.annotation.RequestMethod;
14
+import org.springframework.web.bind.annotation.RestController;
15
+import com.chinaitop.depot.grainAnalysis.service.StorageGrainAnalysisService;
16
+import com.chinaitop.depot.grainAnalysis.model.StorageExceptionAndOnfore;
17
+import com.chinaitop.depot.grainAnalysis.model.StorageGrainAnalysis;
18
+import com.chinaitop.depot.grainAnalysis.model.StorageGrainAnalysisExample;
19
+import com.fasterxml.jackson.databind.ObjectMapper;
20
+import com.github.pagehelper.PageHelper;
21
+import com.github.pagehelper.PageInfo;
22
+
23
+import io.swagger.annotations.Api;
24
+import io.swagger.annotations.ApiImplicitParam;
25
+import io.swagger.annotations.ApiImplicitParams;
26
+import io.swagger.annotations.ApiOperation;
27
+
28
+/**
29
+ * 季度粮情分析controller
30
+ * @author User
31
+ */
32
+@RestController
33
+@RequestMapping(value = "/quarterStorageGrainAnalysis")
34
+@Api(value= "quarterStorageGrainAnalysisController", description = "季度粮情分析控制类")
35
+public class quarterStorageGrainAnalysisController {
36
+
37
+	@Resource
38
+	private StorageGrainAnalysisService analysisService;
39
+
40
+	/**
41
+	 * 季度分析查询列表
42
+	 * 
43
+	 * @param pageNum
44
+	 * @param pageSize
45
+	 * @param storehouseId
46
+	 * @param year
47
+	 * @param month
48
+	 * @return
49
+	 */
50
+	@RequestMapping(value="/getList", produces = MediaType.APPLICATION_JSON_VALUE, method=RequestMethod.GET)
51
+	@ApiOperation(value="季度粮情分析列表", notes = "支持分页")
52
+    @ApiImplicitParams({
53
+    	@ApiImplicitParam(name="pageNum", value="页数", paramType="query"),
54
+    	@ApiImplicitParam(name="pageSize", value="每页显示条数", paramType="query"),
55
+    	@ApiImplicitParam(name="storehouseId", value="仓房ID", paramType="query"),
56
+    	@ApiImplicitParam(name="year", value="年份", paramType="query"),
57
+    	@ApiImplicitParam(name="quarter", value="季度", paramType="query")
58
+    })
59
+	public PageInfo<StorageGrainAnalysis> getList(Integer pageNum, Integer pageSize, String storehouseId,
60
+			Integer year, Integer quarter) {
61
+
62
+		StorageGrainAnalysisExample analysisExample = new StorageGrainAnalysisExample();
63
+		StorageGrainAnalysisExample.Criteria analysisCriteria = analysisExample.createCriteria();
64
+
65
+		if (null != storehouseId && !"".equals(storehouseId)) {
66
+			analysisCriteria.andStorehouseIdEqualTo(storehouseId);
67
+		}
68
+
69
+		if (null != year && !"".equals(year)) {
70
+			analysisCriteria.andYearEqualTo(year);
71
+		}
72
+
73
+		if (null != quarter && !"".equals(quarter)) {
74
+			analysisCriteria.andMonthEqualTo(quarter);
75
+		}
76
+
77
+		if (null != pageNum && null != pageSize) {
78
+			PageHelper.startPage(pageNum, pageSize);
79
+		}
80
+
81
+		analysisCriteria.andAnalysisTypeEqualTo(4); //只查询季度粮情分析
82
+		
83
+		analysisExample.setOrderByClause(" id desc");
84
+
85
+		List<StorageGrainAnalysis> list = analysisService.findByCondition(analysisExample);
86
+		PageInfo<StorageGrainAnalysis> pageInfo = new PageInfo<StorageGrainAnalysis>(list);
87
+
88
+		return pageInfo;
89
+	}
90
+
91
+	/**
92
+	 * 查询季度粮情详细数据
93
+	 *
94
+	 * @param id
95
+	 * @param analysisType
96
+	 * @return
97
+	 */
98
+	@RequestMapping(value="/edit", produces = MediaType.APPLICATION_JSON_VALUE, method=RequestMethod.GET)
99
+	@ApiOperation(value="查询一条季度粮情分析数据", notes = "查询一条季度粮情详细的分析数据")
100
+    @ApiImplicitParams({
101
+    	@ApiImplicitParam(name="id", value="数据ID", paramType="query"),
102
+    	@ApiImplicitParam(name="analysisType", value="数据类型", paramType="query")
103
+    })
104
+	public Map<String, Object> edit(Integer id, Integer analysisType) {
105
+
106
+		Map<String, Object> map = new HashMap<>();
107
+
108
+		if (null != id && !"".equals(id)) {
109
+			map = analysisService.findByIdAnalysisObj(id, analysisType, map);
110
+		} else {
111
+			StorageGrainAnalysis grain = new StorageGrainAnalysis();
112
+			map.put("grain", grain);
113
+		}
114
+
115
+		return map;
116
+	}
117
+
118
+	/**
119
+	 * 查询三温检查数据
120
+	 *
121
+	 * @param houseId
122
+	 * @param wareId
123
+	 * @return
124
+	 */
125
+	@RequestMapping(value="/getThreeTempDate", produces = MediaType.APPLICATION_JSON_VALUE, method=RequestMethod.GET)
126
+	@ApiOperation(value="查询一条三温检查数据", notes = "查询一条三温检查数据")
127
+    @ApiImplicitParams({
128
+    	@ApiImplicitParam(name="houseId", value="仓房ID", paramType="query"),
129
+    	@ApiImplicitParam(name="wareId", value="货位ID", paramType="query"),
130
+    	@ApiImplicitParam(name="year", value="年份", paramType="query"),
131
+    	@ApiImplicitParam(name="month", value="季度", paramType="query"),
132
+		@ApiImplicitParam(name="orgId", value="组织机构ID", paramType="query")
133
+    })
134
+	public Map<String, Object> getThreeTempDate(String houseId, String wareId, Integer year, Integer month, Integer orgId) {
135
+		Map<String, Object> map = new HashMap<>();
136
+		map = analysisService.getQuarterThreeTempDate(houseId, wareId, year, month, orgId, map);
137
+		return map;
138
+	}
139
+
140
+	/**
141
+	 * 查询三温检查数据
142
+	 *
143
+	 * @param threeList
144
+	 * @return
145
+	 */
146
+	@RequestMapping(value="/getThreeTempDateTwo", produces = MediaType.APPLICATION_JSON_VALUE, method=RequestMethod.GET)
147
+	@ApiOperation(value="查询一条三温检查数据", notes = "查询一条三温检查数据")
148
+	@ApiImplicitParams({
149
+			@ApiImplicitParam(name="threeList", value="需要查询三温的集合", paramType="query")
150
+	})
151
+	public Map<String, Object> getThreeTempDateTwo(String[] threeList) {
152
+		Map<String, Object> map = new HashMap<>();
153
+
154
+		if (null != threeList && threeList.length > 0) {
155
+			List<StorageExceptionAndOnfore> exceptionAndOnforeList = new ArrayList<>();
156
+			StorageExceptionAndOnfore exceptionAndOnfore = new StorageExceptionAndOnfore();
157
+			for (Object obj : threeList) {
158
+//				exceptionAndOnfore.setCheckDate(ParameterUtil.string2date(obj + " 00:00:00"));
159
+				exceptionAndOnforeList.add(exceptionAndOnfore);
160
+
161
+				if(ParameterUtil.isnull(threeList[1])){
162
+					break;
163
+				}
164
+			}
165
+			map.put("exceptionAndOnforeList", exceptionAndOnforeList);
166
+		}
167
+
168
+		return map;
169
+	}
170
+
171
+	/**
172
+	 * 提交
173
+	 * 
174
+	 * @param grainJson 主表数据
175
+	 * @param exceptionJson 从表数据
176
+	 * @param type 分析类型
177
+	 * @param orgId 组织机构ID
178
+	 * @param userId 用户ID
179
+	 * @return
180
+	 */
181
+	@RequestMapping(value="/update", produces = MediaType.APPLICATION_JSON_VALUE, method=RequestMethod.POST)
182
+	@ApiOperation(value="保存季度粮情分析数据", notes = "保存季度粮情分析数据")
183
+    @ApiImplicitParams({
184
+    	@ApiImplicitParam(name="grainJson", value="主表数据", paramType="form"),
185
+    	@ApiImplicitParam(name="exceptionJson", value="字表数据", paramType="form"),
186
+    	@ApiImplicitParam(name="type", value="分析类型", paramType="form"),
187
+		@ApiImplicitParam(name="orgId", value="组织机构ID", paramType="form"),
188
+		@ApiImplicitParam(name="userId", value="用户ID", paramType="form")
189
+    })
190
+	public Map<String, Object> update(String grainJson, String exceptionJson, Integer type, Integer orgId, Integer userId) {
191
+		Map<String, Object> map = new HashMap<>();
192
+		
193
+		map = analysisService.updateGrainAndException(grainJson, exceptionJson, map, type, orgId, userId);
194
+		
195
+		return map;
196
+	}
197
+
198
+	/**
199
+	 * 审核提交
200
+	 * 
201
+	 * @param grainJson
202
+	 * @return
203
+	 */
204
+	@RequestMapping(value="/auditor_submit", produces = MediaType.APPLICATION_JSON_VALUE, method=RequestMethod.POST)
205
+	@ApiOperation(value="审核提交", notes = "审核提交")
206
+    @ApiImplicitParams({
207
+    	@ApiImplicitParam(name="grainJson", value="主表数据", paramType="form")
208
+    })
209
+	public Map<String, Object> auditor_submit(String grainJson) {
210
+		Map<String, Object> map = new HashMap<>();
211
+
212
+		try {
213
+			ObjectMapper mappers = new ObjectMapper();
214
+			StorageGrainAnalysis grain = mappers.readValue(grainJson, StorageGrainAnalysis.class);
215
+			grain.setAuditorStatus(1); // 新数据设置为已审核状态
216
+			analysisService.update(grain);
217
+		} catch (Exception e) {
218
+			e.printStackTrace();
219
+		}
220
+		map.put("status", "success");
221
+		map.put("msg", "审核成功!");
222
+		
223
+		return map;
224
+	}
225
+
226
+	/**
227
+	 * 以季度份为条件查询三温数据
228
+	 *
229
+	 * @param houseId 仓房ID
230
+	 * @param wareId 货位ID
231
+	 * @param year 年
232
+	 * @param month 季度
233
+	 * @param orgId 粮库ID
234
+	 * @return
235
+	 */
236
+	@RequestMapping(value="/getMonithThreeTempDate", produces = MediaType.APPLICATION_JSON_VALUE, method=RequestMethod.GET)
237
+	@ApiOperation(value="查询三温数据", notes = "以季度为条件查询三温数据")
238
+	@ApiImplicitParams({
239
+			@ApiImplicitParam(name="houseId", value="仓房ID", paramType="query"),
240
+			@ApiImplicitParam(name="wareId", value="货位ID", paramType="query"),
241
+			@ApiImplicitParam(name="year", value="年份", paramType="query"),
242
+			@ApiImplicitParam(name="month", value="季度", paramType="query"),
243
+			@ApiImplicitParam(name="orgId", value="组织机构ID", paramType="query")
244
+	})
245
+	public Map<String, Object> getMonithThreeTempDate(String houseId, String wareId, Integer year, Integer month,Integer orgId) {
246
+
247
+		Map<String, Object> map = new HashMap<>();
248
+
249
+		map = analysisService.getQuarterThreeTempDate(houseId, wareId, year, month, orgId, map);
250
+
251
+		return map;
252
+	}
253
+}
254
+