|
|
@@ -5,6 +5,8 @@ import com.sundot.airport.common.core.domain.entity.SysDept;
|
|
5
|
5
|
import com.sundot.airport.common.core.domain.entity.SysRole;
|
|
6
|
6
|
import com.sundot.airport.common.core.domain.model.LoginUser;
|
|
7
|
7
|
import com.sundot.airport.common.enums.RoleTypeEnum;
|
|
|
8
|
+import com.sundot.airport.common.core.domain.SysAnalysisReportParamDto;
|
|
|
9
|
+import com.sundot.airport.common.utils.DateRangeQueryUtils;
|
|
8
|
10
|
import com.sundot.airport.common.utils.SecurityUtils;
|
|
9
|
11
|
import com.sundot.airport.exam.common.HttpResult;
|
|
10
|
12
|
import com.sundot.airport.exam.common.service.QuesCatService;
|
|
|
@@ -73,19 +75,14 @@ public class DailyExamWrongAnalysisController {
|
|
73
|
75
|
* 总体问题分布(按大类统计错题数)
|
|
74
|
76
|
* 站长/管理员/质检科:全站;大队长:本大队;主管:本主管室;班组长:本班组
|
|
75
|
77
|
*
|
|
76
|
|
- * @param timeType year/month/custom,默认 month
|
|
77
|
|
- * @param startDate 自定义开始日期 yyyy-MM-dd
|
|
78
|
|
- * @param endDate 自定义结束日期 yyyy-MM-dd
|
|
|
78
|
+ * @param param dateRangeQueryType=YEAR|QUARTER|MONTH,year,quarter,month
|
|
79
|
79
|
*/
|
|
80
|
80
|
@GetMapping("/overview")
|
|
81
|
|
- public HttpResult<Map<String, Object>> getOverview(
|
|
82
|
|
- @RequestParam(required = false, defaultValue = "month") String timeType,
|
|
83
|
|
- @RequestParam(required = false) String startDate,
|
|
84
|
|
- @RequestParam(required = false) String endDate) {
|
|
|
81
|
+ public HttpResult<Map<String, Object>> getOverview(SysAnalysisReportParamDto param) {
|
|
85
|
82
|
|
|
86
|
83
|
try {
|
|
87
|
84
|
RoleInfo role = getRoleInfo();
|
|
88
|
|
- LocalDate[] range = resolveDateRange(timeType, startDate, endDate);
|
|
|
85
|
+ LocalDate[] range = resolveDateRange(param);
|
|
89
|
86
|
|
|
90
|
87
|
List<DailyTaskDetail> errorDetails = getErrorDetails(role, range[0], range[1]);
|
|
91
|
88
|
|
|
|
@@ -131,15 +128,10 @@ public class DailyExamWrongAnalysisController {
|
|
131
|
128
|
/**
|
|
132
|
129
|
* 问题分布对比雷达图(仅站长可见,各大队在各大类的错题数对比)
|
|
133
|
130
|
*
|
|
134
|
|
- * @param timeType year/month/custom,默认 month
|
|
135
|
|
- * @param startDate 自定义开始日期
|
|
136
|
|
- * @param endDate 自定义结束日期
|
|
|
131
|
+ * @param param dateRangeQueryType=YEAR|QUARTER|MONTH,year,quarter,month
|
|
137
|
132
|
*/
|
|
138
|
133
|
@GetMapping("/radar")
|
|
139
|
|
- public HttpResult<Map<String, Object>> getRadar(
|
|
140
|
|
- @RequestParam(required = false, defaultValue = "month") String timeType,
|
|
141
|
|
- @RequestParam(required = false) String startDate,
|
|
142
|
|
- @RequestParam(required = false) String endDate) {
|
|
|
134
|
+ public HttpResult<Map<String, Object>> getRadar(SysAnalysisReportParamDto param) {
|
|
143
|
135
|
|
|
144
|
136
|
try {
|
|
145
|
137
|
RoleInfo role = getRoleInfo();
|
|
|
@@ -149,7 +141,7 @@ public class DailyExamWrongAnalysisController {
|
|
149
|
141
|
return HttpResult.success(noShow);
|
|
150
|
142
|
}
|
|
151
|
143
|
|
|
152
|
|
- LocalDate[] range = resolveDateRange(timeType, startDate, endDate);
|
|
|
144
|
+ LocalDate[] range = resolveDateRange(param);
|
|
153
|
145
|
|
|
154
|
146
|
// 查询所有大类,作为雷达图的维度
|
|
155
|
147
|
BaseCheckCategory level1Query = new BaseCheckCategory();
|
|
|
@@ -220,16 +212,12 @@ public class DailyExamWrongAnalysisController {
|
|
220
|
212
|
* 班组长及以下:show=false
|
|
221
|
213
|
*
|
|
222
|
214
|
* @param categoryId 大类ID(base_check_category.id,level=1)
|
|
223
|
|
- * @param timeType year/month/custom,默认 month
|
|
224
|
|
- * @param startDate 自定义开始日期
|
|
225
|
|
- * @param endDate 自定义结束日期
|
|
|
215
|
+ * @param param dateRangeQueryType=YEAR|QUARTER|MONTH,year,quarter,month
|
|
226
|
216
|
*/
|
|
227
|
217
|
@GetMapping("/category-detail")
|
|
228
|
218
|
public HttpResult<Map<String, Object>> getCategoryDetail(
|
|
229
|
219
|
@RequestParam Long categoryId,
|
|
230
|
|
- @RequestParam(required = false, defaultValue = "month") String timeType,
|
|
231
|
|
- @RequestParam(required = false) String startDate,
|
|
232
|
|
- @RequestParam(required = false) String endDate) {
|
|
|
220
|
+ SysAnalysisReportParamDto param) {
|
|
233
|
221
|
|
|
234
|
222
|
try {
|
|
235
|
223
|
RoleInfo role = getRoleInfo();
|
|
|
@@ -240,7 +228,7 @@ public class DailyExamWrongAnalysisController {
|
|
240
|
228
|
return HttpResult.success(noShow);
|
|
241
|
229
|
}
|
|
242
|
230
|
|
|
243
|
|
- LocalDate[] range = resolveDateRange(timeType, startDate, endDate);
|
|
|
231
|
+ LocalDate[] range = resolveDateRange(param);
|
|
244
|
232
|
|
|
245
|
233
|
BaseCheckCategory level1Cat = baseCheckCategoryService.selectBaseCheckCategoryById(categoryId);
|
|
246
|
234
|
if (level1Cat == null) {
|
|
|
@@ -264,7 +252,7 @@ public class DailyExamWrongAnalysisController {
|
|
264
|
252
|
result.put("categoryId", categoryId);
|
|
265
|
253
|
result.put("categoryName", level1Cat.getName());
|
|
266
|
254
|
|
|
267
|
|
- boolean byMonth = "year".equals(timeType);
|
|
|
255
|
+ boolean byMonth = "YEAR".equals(param != null ? param.getDateRangeQueryType() : null);
|
|
268
|
256
|
List<String> xAxis = buildXAxis(range[0], range[1], byMonth);
|
|
269
|
257
|
SimpleDateFormat sdf = new SimpleDateFormat(byMonth ? "yyyy-MM" : "yyyy-MM-dd");
|
|
270
|
258
|
|
|
|
@@ -669,26 +657,31 @@ public class DailyExamWrongAnalysisController {
|
|
669
|
657
|
}
|
|
670
|
658
|
|
|
671
|
659
|
/**
|
|
672
|
|
- * 根据时间类型计算起止日期
|
|
|
660
|
+ * 根据 SysAnalysisReportParamDto 计算起止日期
|
|
|
661
|
+ * YEAR → 全年;QUARTER → 指定季度;MONTH → 指定月份;默认 → 当月
|
|
673
|
662
|
*/
|
|
674
|
|
- private LocalDate[] resolveDateRange(String timeType, String startDate, String endDate) {
|
|
|
663
|
+ private LocalDate[] resolveDateRange(SysAnalysisReportParamDto param) {
|
|
675
|
664
|
LocalDate today = LocalDate.now();
|
|
676
|
|
- LocalDate start;
|
|
677
|
|
- LocalDate end = today;
|
|
678
|
|
- switch (timeType == null ? "month" : timeType) {
|
|
679
|
|
- case "year":
|
|
680
|
|
- start = today.withDayOfYear(1);
|
|
681
|
|
- end = today.withMonth(12).withDayOfMonth(31);
|
|
|
665
|
+ int year = (param != null && param.getYear() != null) ? param.getYear() : today.getYear();
|
|
|
666
|
+ String type = (param != null && param.getDateRangeQueryType() != null) ? param.getDateRangeQueryType() : "MONTH";
|
|
|
667
|
+ com.sundot.airport.common.core.domain.SysAnalysisReportDateRangeDto range;
|
|
|
668
|
+ switch (type) {
|
|
|
669
|
+ case "YEAR":
|
|
|
670
|
+ range = DateRangeQueryUtils.getYearRange(year, null);
|
|
682
|
671
|
break;
|
|
683
|
|
- case "custom":
|
|
684
|
|
- start = (startDate != null) ? LocalDate.parse(startDate) : today.withDayOfMonth(1);
|
|
685
|
|
- end = (endDate != null) ? LocalDate.parse(endDate) : today;
|
|
|
672
|
+ case "QUARTER":
|
|
|
673
|
+ int quarter = (param.getQuarter() != null) ? param.getQuarter() : 1;
|
|
|
674
|
+ range = DateRangeQueryUtils.getQuarterRange(year, quarter, null);
|
|
686
|
675
|
break;
|
|
687
|
|
- default: // month
|
|
688
|
|
- start = today.withDayOfMonth(1);
|
|
|
676
|
+ default: // MONTH
|
|
|
677
|
+ int month = (param != null && param.getMonth() != null) ? param.getMonth() : today.getMonthValue();
|
|
|
678
|
+ range = DateRangeQueryUtils.getMonthRange(year, month, null);
|
|
689
|
679
|
break;
|
|
690
|
680
|
}
|
|
691
|
|
- return new LocalDate[]{start, end};
|
|
|
681
|
+ return new LocalDate[]{
|
|
|
682
|
+ ((java.sql.Date) range.getStartDate()).toLocalDate(),
|
|
|
683
|
+ ((java.sql.Date) range.getEndDate()).toLocalDate()
|
|
|
684
|
+ };
|
|
692
|
685
|
}
|
|
693
|
686
|
|
|
694
|
687
|
/**
|