|
|
@@ -183,23 +183,34 @@ public class WorkReportController extends BaseController {
|
|
183
|
183
|
{
|
|
184
|
184
|
var table = ReportBaseService.selectRecordReport(input);
|
|
185
|
185
|
if (table != null && table.size() > 0) {
|
|
|
186
|
+ RecordReport totalReport = new RecordReport();
|
|
|
187
|
+ totalReport.setUserCode("");
|
|
|
188
|
+ totalReport.setUserName("合计");
|
|
|
189
|
+
|
|
186
|
190
|
for (RecordReport report : table) {
|
|
|
191
|
+ totalReport.setLdCount(totalReport.getLdCount() + report.getLdCount());
|
|
|
192
|
+ totalReport.setAnswer(totalReport.getAnswer() + report.getAnswer());
|
|
|
193
|
+ totalReport.setNoAnswer(totalReport.getNoAnswer() + report.getNoAnswer());
|
|
|
194
|
+ totalReport.setSatisfied(totalReport.getSatisfied() + report.getSatisfied());
|
|
|
195
|
+ totalReport.setSatisfactory(totalReport.getSatisfactory() + report.getSatisfactory());
|
|
|
196
|
+ totalReport.setNoSatisfied(totalReport.getNoSatisfied() + report.getNoSatisfied());
|
|
|
197
|
+ totalReport.setAllAnswerTime(totalReport.getAllAnswerTime() + report.getAllAnswerTime());
|
|
187
|
198
|
report.setAnswerRate("100.00%");
|
|
188
|
199
|
report.setMydRate("100.00%");
|
|
|
200
|
+ if (report.getAnswer() > 0){
|
|
|
201
|
+ report.setAvgAnswerTime((long) (report.getAllAnswerTime() / report.getAnswer()));
|
|
|
202
|
+ } else {
|
|
|
203
|
+ report.setAvgAnswerTime(0);
|
|
|
204
|
+ }
|
|
189
|
205
|
if (report.getLdCount()>0)
|
|
190
|
206
|
{
|
|
191
|
207
|
double Answer = ((double)report.getAnswer() / report.getLdCount());//结果的百分比
|
|
192
|
|
- report.setAnswerRate(String.format("%.2f", Answer*100)+ "%"); ;
|
|
|
208
|
+ report.setAnswerRate(String.format("%.2f", Answer*100)+ "%");
|
|
193
|
209
|
if ((report.getSatisfied()+report.getNoSatisfied()+ report.getSatisfactory())>0)
|
|
194
|
210
|
{
|
|
195
|
|
-// double myd = ((double)report.getSatisfied()+report.getSatisfactory()/(report.getSatisfied()+report.getNoSatisfied()+report.getSatisfactory()));//结果的百分比
|
|
196
|
|
-// report.setMydRate(String.format("%.2f", myd*100)+ "%");
|
|
197
|
211
|
|
|
198
|
212
|
long total = report.getSatisfied() + report.getNoSatisfied() + report.getSatisfactory();
|
|
199
|
213
|
|
|
200
|
|
-
|
|
201
|
|
-
|
|
202
|
|
-// 3. 正确计算分子和分母
|
|
203
|
214
|
double numerator = report.getSatisfied() + report.getSatisfactory();
|
|
204
|
215
|
double myd = numerator / total; // 自动转换为浮点除法
|
|
205
|
216
|
|
|
|
@@ -209,6 +220,33 @@ public class WorkReportController extends BaseController {
|
|
209
|
220
|
}
|
|
210
|
221
|
}
|
|
211
|
222
|
}
|
|
|
223
|
+
|
|
|
224
|
+ if (totalReport.getAnswer() > 0){
|
|
|
225
|
+ totalReport.setAvgAnswerTime((long) (totalReport.getAllAnswerTime() / totalReport.getAnswer()));
|
|
|
226
|
+ } else {
|
|
|
227
|
+ totalReport.setAvgAnswerTime(0);
|
|
|
228
|
+ }
|
|
|
229
|
+ if (totalReport.getLdCount()>0)
|
|
|
230
|
+ {
|
|
|
231
|
+ //结果的百分比
|
|
|
232
|
+ double answer = ((double)totalReport.getAnswer() / totalReport.getLdCount());
|
|
|
233
|
+ totalReport.setAnswerRate(String.format("%.2f", answer*100)+ "%");
|
|
|
234
|
+ if ((totalReport.getSatisfied()+totalReport.getNoSatisfied()+ totalReport.getSatisfactory())>0)
|
|
|
235
|
+ {
|
|
|
236
|
+
|
|
|
237
|
+ long total = totalReport.getSatisfied() + totalReport.getNoSatisfied() + totalReport.getSatisfactory();
|
|
|
238
|
+
|
|
|
239
|
+ double numerator = totalReport.getSatisfied() + totalReport.getSatisfactory();
|
|
|
240
|
+ // 自动转换为浮点除法
|
|
|
241
|
+ double myd = numerator / total;
|
|
|
242
|
+
|
|
|
243
|
+ // 4. 格式化输出(直接使用%%表示百分号)
|
|
|
244
|
+ totalReport.setMydRate(String.format("%.2f%%", myd * 100));
|
|
|
245
|
+
|
|
|
246
|
+ }
|
|
|
247
|
+ }
|
|
|
248
|
+
|
|
|
249
|
+ table.add(totalReport);
|
|
212
|
250
|
}
|
|
213
|
251
|
|
|
214
|
252
|
return Success("成功",table);
|
|
|
@@ -219,20 +257,69 @@ public class WorkReportController extends BaseController {
|
|
219
|
257
|
public void RecordExportExcel(ScreenReport input) {
|
|
220
|
258
|
var table = ReportBaseService.selectRecordReport(input);
|
|
221
|
259
|
if (table != null && table.size() > 0) {
|
|
|
260
|
+ RecordReport totalReport = new RecordReport();
|
|
|
261
|
+ totalReport.setUserCode("");
|
|
|
262
|
+ totalReport.setUserName("合计");
|
|
222
|
263
|
for (RecordReport report : table) {
|
|
|
264
|
+ totalReport.setLdCount(totalReport.getLdCount() + report.getLdCount());
|
|
|
265
|
+ totalReport.setAnswer(totalReport.getAnswer() + report.getAnswer());
|
|
|
266
|
+ totalReport.setNoAnswer(totalReport.getNoAnswer() + report.getNoAnswer());
|
|
|
267
|
+ totalReport.setSatisfied(totalReport.getSatisfied() + report.getSatisfied());
|
|
|
268
|
+ totalReport.setSatisfactory(totalReport.getSatisfactory() + report.getSatisfactory());
|
|
|
269
|
+ totalReport.setNoSatisfied(totalReport.getNoSatisfied() + report.getNoSatisfied());
|
|
|
270
|
+ totalReport.setAllAnswerTime(totalReport.getAllAnswerTime() + report.getAllAnswerTime());
|
|
223
|
271
|
report.setAnswerRate("100.00%");
|
|
224
|
272
|
report.setMydRate("100.00%");
|
|
|
273
|
+ if (report.getAnswer() > 0){
|
|
|
274
|
+ report.setAvgAnswerTime((long) (report.getAllAnswerTime() / report.getAnswer()));
|
|
|
275
|
+ } else {
|
|
|
276
|
+ report.setAvgAnswerTime(0);
|
|
|
277
|
+ }
|
|
225
|
278
|
if (report.getLdCount()>0)
|
|
226
|
279
|
{
|
|
227
|
280
|
double Answer = ((double)report.getAnswer() / report.getLdCount());//结果的百分比
|
|
228
|
|
- report.setAnswerRate(String.format("%.2f", Answer*100)+ "%"); ;
|
|
229
|
|
- if ((report.getSatisfied()+report.getNoSatisfied())>0)
|
|
|
281
|
+ report.setAnswerRate(String.format("%.2f", Answer*100)+ "%");
|
|
|
282
|
+ if ((report.getSatisfied()+report.getNoSatisfied()+ report.getSatisfactory())>0)
|
|
230
|
283
|
{
|
|
231
|
|
- double myd = ((double)report.getSatisfied()/(report.getSatisfied()+report.getNoSatisfied()));//结果的百分比
|
|
232
|
|
- report.setMydRate(String.format("%.2f", myd*100)+ "%");
|
|
|
284
|
+
|
|
|
285
|
+ long total = report.getSatisfied() + report.getNoSatisfied() + report.getSatisfactory();
|
|
|
286
|
+
|
|
|
287
|
+ double numerator = report.getSatisfied() + report.getSatisfactory();
|
|
|
288
|
+ double myd = numerator / total; // 自动转换为浮点除法
|
|
|
289
|
+
|
|
|
290
|
+ // 4. 格式化输出(直接使用%%表示百分号)
|
|
|
291
|
+ report.setMydRate(String.format("%.2f%%", myd * 100));
|
|
|
292
|
+
|
|
233
|
293
|
}
|
|
234
|
294
|
}
|
|
235
|
295
|
}
|
|
|
296
|
+
|
|
|
297
|
+ if (totalReport.getAnswer() > 0){
|
|
|
298
|
+ totalReport.setAvgAnswerTime((long) (totalReport.getAllAnswerTime() / totalReport.getAnswer()));
|
|
|
299
|
+ } else {
|
|
|
300
|
+ totalReport.setAvgAnswerTime(0);
|
|
|
301
|
+ }
|
|
|
302
|
+ if (totalReport.getLdCount()>0)
|
|
|
303
|
+ {
|
|
|
304
|
+ //结果的百分比
|
|
|
305
|
+ double answer = ((double)totalReport.getAnswer() / totalReport.getLdCount());
|
|
|
306
|
+ totalReport.setAnswerRate(String.format("%.2f", answer*100)+ "%");
|
|
|
307
|
+ if ((totalReport.getSatisfied()+totalReport.getNoSatisfied()+ totalReport.getSatisfactory())>0)
|
|
|
308
|
+ {
|
|
|
309
|
+
|
|
|
310
|
+ long total = totalReport.getSatisfied() + totalReport.getNoSatisfied() + totalReport.getSatisfactory();
|
|
|
311
|
+
|
|
|
312
|
+ double numerator = totalReport.getSatisfied() + totalReport.getSatisfactory();
|
|
|
313
|
+ // 自动转换为浮点除法
|
|
|
314
|
+ double myd = numerator / total;
|
|
|
315
|
+
|
|
|
316
|
+ // 4. 格式化输出(直接使用%%表示百分号)
|
|
|
317
|
+ totalReport.setMydRate(String.format("%.2f%%", myd * 100));
|
|
|
318
|
+
|
|
|
319
|
+ }
|
|
|
320
|
+ }
|
|
|
321
|
+
|
|
|
322
|
+ table.add(totalReport);
|
|
236
|
323
|
}
|
|
237
|
324
|
ExcelHelper<RecordReport> excel = new ExcelHelper<>(RecordReport.class);
|
|
238
|
325
|
|