|
|
@@ -101,18 +101,24 @@ public class ReportWeeklyController {
|
|
101
|
101
|
})
|
|
102
|
102
|
public Map<String,String> edit(String reportWeeklyJson,Integer orgId){
|
|
103
|
103
|
ObjectMapper mapper = new ObjectMapper();
|
|
|
104
|
+ Map<String,String> map = new HashMap<String, String>();
|
|
104
|
105
|
try {
|
|
105
|
106
|
ReportWeekly reportWeekly = (ReportWeekly) mapper.readValue(reportWeeklyJson, ReportWeekly.class);
|
|
106
|
107
|
reportWeekly.setOrgId(orgId);
|
|
107
|
108
|
|
|
108
|
109
|
if(ParameterUtil.isnotnull(reportWeekly.getId())){
|
|
109
|
110
|
reportWeeklyService.update(reportWeekly);
|
|
|
111
|
+ map.put("status","success");
|
|
|
112
|
+ map.put("infoCode","200");
|
|
110
|
113
|
}else{
|
|
111
|
114
|
reportWeekly.setStatus("0");
|
|
112
|
115
|
reportWeeklyService.add(reportWeekly);
|
|
|
116
|
+ map.put("status","success");
|
|
|
117
|
+ map.put("infoCode","200");
|
|
113
|
118
|
}
|
|
114
|
119
|
} catch (IOException e) {
|
|
115
|
|
- e.printStackTrace();
|
|
|
120
|
+ map.put("status","error");
|
|
|
121
|
+ map.put("infoCode","500");
|
|
116
|
122
|
}
|
|
117
|
123
|
return null;
|
|
118
|
124
|
}
|
|
|
@@ -129,8 +135,16 @@ public class ReportWeeklyController {
|
|
129
|
135
|
})
|
|
130
|
136
|
public Map<String,String> remove(Integer id){
|
|
131
|
137
|
Map<String,String> map = new HashMap<String, String>();
|
|
132
|
|
- reportWeeklyService.remove(id);
|
|
133
|
|
- map.put("status","success");
|
|
|
138
|
+ try {
|
|
|
139
|
+ reportWeeklyService.remove(id);
|
|
|
140
|
+ map.put("status","success");
|
|
|
141
|
+ map.put("infoCode","200");
|
|
|
142
|
+ }catch (Exception e){
|
|
|
143
|
+ map.put("status","error");
|
|
|
144
|
+ map.put("infoCode","500");
|
|
|
145
|
+ }
|
|
|
146
|
+
|
|
|
147
|
+
|
|
134
|
148
|
return map;
|
|
135
|
149
|
}
|
|
136
|
150
|
|
|
|
@@ -160,12 +174,18 @@ public class ReportWeeklyController {
|
|
160
|
174
|
System.out.println("上报周报表请求地址以及参数:--"+url+jsonObject);
|
|
161
|
175
|
if(count.contains("Success") || count.contains("200")){
|
|
162
|
176
|
modelMap.put("status", "success");
|
|
|
177
|
+ modelMap.put("infoCode", 200);
|
|
163
|
178
|
modelMap.put("msg", "成功!");
|
|
|
179
|
+ }else if(count.contains("Success") || count.contains("303")){
|
|
|
180
|
+ modelMap.put("status", "error");
|
|
|
181
|
+ modelMap.put("infoCode", 303);
|
|
|
182
|
+ modelMap.put("msg", "重复提交该报表!");
|
|
164
|
183
|
}
|
|
165
|
184
|
} catch (Exception e){
|
|
166
|
185
|
// req.append("?data=");
|
|
167
|
186
|
e.printStackTrace();
|
|
168
|
187
|
modelMap.put("status", "error");
|
|
|
188
|
+ modelMap.put("infoCode", 500);
|
|
169
|
189
|
modelMap.put("msg", "保存失败!");
|
|
170
|
190
|
}
|
|
171
|
191
|
|
|
|
@@ -193,6 +213,7 @@ public class ReportWeeklyController {
|
|
193
|
213
|
week.setStatus(String.valueOf(status));
|
|
194
|
214
|
reportWeeklyService.updateWeeklyStatus(week);
|
|
195
|
215
|
modelMap.put("week", week);
|
|
|
216
|
+ modelMap.put("infoCode", 200);
|
|
196
|
217
|
modelMap.put("status", "success");
|
|
197
|
218
|
}else{
|
|
198
|
219
|
throw new RuntimeException("id或status无值");
|
|
|
@@ -201,6 +222,7 @@ public class ReportWeeklyController {
|
|
201
|
222
|
// TODO Auto-generated catch block
|
|
202
|
223
|
e.printStackTrace();
|
|
203
|
224
|
modelMap.put("status", "error");
|
|
|
225
|
+ modelMap.put("infoCode", 500);
|
|
204
|
226
|
modelMap.put("msg", "保存失败!");
|
|
205
|
227
|
}
|
|
206
|
228
|
|