| | |
| | | |
| | | import java.util.*; |
| | | import java.io.IOException; |
| | | import java.time.LocalDateTime; |
| | | |
| | | import cn.lihu.jh.framework.common.pojo.PageParam; |
| | | import cn.lihu.jh.framework.common.pojo.PageResult; |
| | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import javax.validation.Valid; |
| | | |
| | | import static cn.lihu.jh.framework.common.exception.util.ServiceExceptionUtil.exception; |
| | | import static cn.lihu.jh.module.ecg.enums.ErrorCodeConstants.JOB_STATISTIC_TIME_REQUIRED; |
| | | |
| | | @Tag(name = "管理后台 - 工作记录") |
| | | @RestController |
| | |
| | | @Operation(summary = "工作量统计") |
| | | @PreAuthorize("@ss.hasPermission('ecg:job-record:statistic')") |
| | | public CommonResult<List<JobRecordStatisticVO>> getJobStatistic(@Valid JobRecordPageReqVO pageReqVO) { |
| | | List<JobRecordStatisticDO> statisticDOList = jobRecordService.getJobStatistic(pageReqVO.getJobTime()[0], pageReqVO.getJobTime()[1]); |
| | | // 作业时间范围必填:原实现直接取 jobTime[0]/[1],缺参时 ArrayIndexOutOfBounds/NullPointer → 前端只看到“系统异常” |
| | | LocalDateTime[] jobTime = pageReqVO.getJobTime(); |
| | | if (jobTime == null || jobTime.length < 2 || jobTime[0] == null || jobTime[1] == null) { |
| | | throw exception(JOB_STATISTIC_TIME_REQUIRED); |
| | | } |
| | | List<JobRecordStatisticDO> statisticDOList = jobRecordService.getJobStatistic(jobTime[0], jobTime[1]); |
| | | return success(BeanUtils.toBean(statisticDOList, JobRecordStatisticVO.class)); |
| | | } |
| | | } |