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