|
|
|
@ -107,12 +107,6 @@ public class OperDefectStatisticsController extends BladeController {
|
|
|
|
|
public void exportDefectList(HttpServletResponse response,@RequestBody OperDefectStatisticsVO entity) { |
|
|
|
|
try { |
|
|
|
|
long timeMillis = System.currentTimeMillis(); |
|
|
|
|
// if(ObjectUtil.isEmpty(entity.getCreateTime())&&ObjectUtil.isEmpty(entity.getCreateEndTime())){
|
|
|
|
|
// LocalDateTime date = LocalDateTime.now();
|
|
|
|
|
// LocalDateTime firstDay = date.with(TemporalAdjusters.firstDayOfMonth()).withHour(0).withMinute(0).withSecond(0);
|
|
|
|
|
// entity.setCreateTime(Date.from(firstDay.atZone(ZoneId.systemDefault()).toInstant()));
|
|
|
|
|
// entity.setCreateEndTime(new Date());
|
|
|
|
|
// }
|
|
|
|
|
response.setContentType("application/vnd.ms-excel"); |
|
|
|
|
response.setCharacterEncoding("UTF-8"); |
|
|
|
|
// 这里URLEncoder.encode可以防止中文乱码 当然和easyexcel没有关系
|
|
|
|
@ -121,18 +115,14 @@ public class OperDefectStatisticsController extends BladeController {
|
|
|
|
|
LambdaQueryWrapper<OperDefectStatisticsEntity> queryWrapper = statisticsService.getQueryWrapper(entity); |
|
|
|
|
List<OperDefectStatisticsEntity> list = statisticsService.list(queryWrapper); |
|
|
|
|
long timeMillis1 =System.currentTimeMillis()- timeMillis; |
|
|
|
|
System.out.println("查询对应实例类耗时============================"+ timeMillis1); |
|
|
|
|
List<OperDefectStatisticsExportVO> defectStatisticsExportVO = statisticsService.getDefectStatisticsExportVO(list); |
|
|
|
|
long timeMillis2 =System.currentTimeMillis()- timeMillis; |
|
|
|
|
System.out.println("参数转换耗时============================"+ timeMillis2); |
|
|
|
|
if(defectStatisticsExportVO!=null && defectStatisticsExportVO.size()>0){ |
|
|
|
|
System.out.println("---------------- size = " + defectStatisticsExportVO.size()); |
|
|
|
|
// 这里需要设置不关闭流
|
|
|
|
|
EasyExcel.write(response.getOutputStream(), OperDefectStatisticsExportVO.class).autoCloseStream(Boolean.FALSE).sheet("缺陷统计报表") |
|
|
|
|
.doWrite(defectStatisticsExportVO); |
|
|
|
|
} |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
System.out.println("exportExcel = " + e); |
|
|
|
|
// 重置response
|
|
|
|
|
response.reset(); |
|
|
|
|
response.setContentType("application/json"); |
|
|
|
@ -162,48 +152,6 @@ public class OperDefectStatisticsController extends BladeController {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 新增 代码自定义代号 |
|
|
|
|
*//*
|
|
|
|
|
@PostMapping("/save") |
|
|
|
|
@ApiOperationSupport(order = 4) |
|
|
|
|
@ApiOperation(value = "新增", notes = "传入statistics") |
|
|
|
|
public R save(@Valid @RequestBody OperDefectStatisticsEntity statistics) { |
|
|
|
|
return R.status(statisticsService.save(statistics)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
*//**
|
|
|
|
|
* 修改 代码自定义代号 |
|
|
|
|
*//*
|
|
|
|
|
@PostMapping("/update") |
|
|
|
|
@ApiOperationSupport(order = 5) |
|
|
|
|
@ApiOperation(value = "修改", notes = "传入statistics") |
|
|
|
|
public R update(@Valid @RequestBody OperDefectStatisticsEntity statistics) { |
|
|
|
|
return R.status(statisticsService.updateById(statistics)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
*//**
|
|
|
|
|
* 新增或修改 代码自定义代号 |
|
|
|
|
*//*
|
|
|
|
|
@PostMapping("/submit") |
|
|
|
|
@ApiOperationSupport(order = 6) |
|
|
|
|
@ApiOperation(value = "新增或修改", notes = "传入statistics") |
|
|
|
|
public R submit(@Valid @RequestBody OperDefectStatisticsEntity statistics) { |
|
|
|
|
return R.status(statisticsService.saveOrUpdate(statistics)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
*//**
|
|
|
|
|
* 删除 代码自定义代号 |
|
|
|
|
*//*
|
|
|
|
|
@PostMapping("/remove") |
|
|
|
|
@ApiOperationSupport(order = 7) |
|
|
|
|
@ApiOperation(value = "逻辑删除", notes = "传入ids") |
|
|
|
|
public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) { |
|
|
|
|
return R.status(statisticsService.deleteLogic(Func.toLongList(ids))); |
|
|
|
|
}*/ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 巡检任务统计 |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|