|
|
@ -10,6 +10,7 @@ import com.inspect.analysis.service.DefectListAggregator; |
|
|
import com.inspect.api.service.AlarmPublisher; |
|
|
import com.inspect.api.service.AlarmPublisher; |
|
|
import com.inspect.base.core.constant.AlgConstants; |
|
|
import com.inspect.base.core.constant.AlgConstants; |
|
|
import com.inspect.base.core.domain.Response; |
|
|
import com.inspect.base.core.domain.Response; |
|
|
|
|
|
import com.inspect.base.core.enums.DefectLevel; |
|
|
import com.inspect.base.core.enums.PointStatusEnum; |
|
|
import com.inspect.base.core.enums.PointStatusEnum; |
|
|
import com.inspect.base.core.utils.StringUtils; |
|
|
import com.inspect.base.core.utils.StringUtils; |
|
|
import com.inspect.base.core.utils.poi.ExcelUtil; |
|
|
import com.inspect.base.core.utils.poi.ExcelUtil; |
|
|
@ -33,18 +34,16 @@ import com.inspect.task.service.IPatrolTaskService; |
|
|
import com.inspect.taskinfo.domain.PatrolTaskInfo; |
|
|
import com.inspect.taskinfo.domain.PatrolTaskInfo; |
|
|
import com.inspect.taskinfo.service.IPatrolTaskInfoService; |
|
|
import com.inspect.taskinfo.service.IPatrolTaskInfoService; |
|
|
|
|
|
|
|
|
|
|
|
import java.time.LocalDate; |
|
|
|
|
|
import java.time.YearMonth; |
|
|
|
|
|
import java.time.format.DateTimeFormatter; |
|
|
import java.util.*; |
|
|
import java.util.*; |
|
|
import java.util.stream.Collectors; |
|
|
import java.util.stream.Collectors; |
|
|
import javax.annotation.Resource; |
|
|
import javax.annotation.Resource; |
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
|
|
|
|
|
import com.inspect.taskstatus.domain.PatrolTaskStatus; |
|
|
import com.inspect.taskstatus.domain.PatrolTaskStatus; |
|
|
import org.springframework.web.bind.annotation.GetMapping; |
|
|
|
|
|
import org.springframework.web.bind.annotation.PathVariable; |
|
|
|
|
|
import org.springframework.web.bind.annotation.PostMapping; |
|
|
|
|
|
import org.springframework.web.bind.annotation.RequestBody; |
|
|
|
|
|
import org.springframework.web.bind.annotation.RequestMapping; |
|
|
|
|
|
import org.springframework.web.bind.annotation.RestController; |
|
|
|
|
|
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
|
|
|
|
|
@RestController |
|
|
@RestController |
|
|
@RequestMapping({"/analysis"}) |
|
|
@RequestMapping({"/analysis"}) |
|
|
@ -300,6 +299,53 @@ public class ResultAnalysisController extends BaseController { |
|
|
return this.getDataTable(patrolResultList); |
|
|
return this.getDataTable(patrolResultList); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 汇聚专用:按时间范围分页查询 result_analysis 原始结果。 |
|
|
|
|
|
*/ |
|
|
|
|
|
@GetMapping({"/agg/list"}) |
|
|
|
|
|
public TableDataInfo aggList(@RequestParam(required = false) String beginTime, |
|
|
|
|
|
@RequestParam(required = false) String endTime, |
|
|
|
|
|
@RequestParam(required = false) String taskPatrolId) { |
|
|
|
|
|
this.startPage(); |
|
|
|
|
|
ResultAnalysis query = new ResultAnalysis(); |
|
|
|
|
|
query.setBeginTime(beginTime); |
|
|
|
|
|
query.setEndTime(endTime); |
|
|
|
|
|
query.setTaskPatrolId(taskPatrolId); |
|
|
|
|
|
List<ResultAnalysis> list = this.resultAnalysisService.selectResultAnalysisList(query); |
|
|
|
|
|
for (ResultAnalysis item : list) { |
|
|
|
|
|
item.setDefectLevel(resolveDefectLevel(item.getResultType())); |
|
|
|
|
|
} |
|
|
|
|
|
return this.getDataTable(list); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** 汇聚专用:按月份聚合 defect 统计结果。 */ |
|
|
|
|
|
@GetMapping({"/agg/defect/month"}) |
|
|
|
|
|
public AjaxResult aggDefectMonth(@RequestParam String beginMonth, @RequestParam String endMonth) { |
|
|
|
|
|
if (StringUtils.isEmpty(beginMonth) || StringUtils.isEmpty(endMonth)) { |
|
|
|
|
|
return AjaxResult.error("beginMonth / endMonth 不能为空"); |
|
|
|
|
|
} |
|
|
|
|
|
try { |
|
|
|
|
|
DateTimeFormatter month = DateTimeFormatter.ofPattern("yyyy-MM"); |
|
|
|
|
|
DateTimeFormatter datetime = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); |
|
|
|
|
|
LocalDate begin = YearMonth.parse(beginMonth, month).atDay(1); |
|
|
|
|
|
LocalDate end = YearMonth.parse(endMonth, month).plusMonths(1).atDay(1); |
|
|
|
|
|
List<Map<String, Object>> list = resultAnalysisService.selectAggDefectMonthStat( |
|
|
|
|
|
begin.atStartOfDay().format(datetime), end.atStartOfDay().format(datetime)); |
|
|
|
|
|
return AjaxResult.success(list); |
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
return AjaxResult.error("月度缺陷统计失败: " + e.getMessage()); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
private static Integer resolveDefectLevel(String resultType) { |
|
|
|
|
|
if ("0".equals(resultType)) { |
|
|
|
|
|
return DefectLevel.NORMAL.getCode(); |
|
|
|
|
|
} |
|
|
|
|
|
if ("2".equals(resultType)) { |
|
|
|
|
|
return DefectLevel.MINOR.getCode(); |
|
|
|
|
|
} |
|
|
|
|
|
return DefectLevel.NONE.getCode(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
@Log( |
|
|
@Log( |
|
|
title = "分析结果", |
|
|
title = "分析结果", |
|
|
businessType = BizType.EXPORT |
|
|
businessType = BizType.EXPORT |
|
|
|