|
|
|
@ -2,6 +2,7 @@ package com.hnac.hzims.operational.defect.controller;
|
|
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils; |
|
|
|
|
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; |
|
|
|
|
import com.hnac.hzims.common.invalid.DictInvalid; |
|
|
|
|
import com.hnac.hzims.common.invalid.ObjectRequiredInvalid; |
|
|
|
@ -19,6 +20,7 @@ import io.swagger.annotations.ApiParam;
|
|
|
|
|
import lombok.AllArgsConstructor; |
|
|
|
|
import org.springblade.core.boot.ctrl.BladeController; |
|
|
|
|
import org.springblade.core.log.annotation.ApiLog; |
|
|
|
|
import org.springblade.core.mp.base.BaseEntity; |
|
|
|
|
import org.springblade.core.mp.support.Condition; |
|
|
|
|
import org.springblade.core.mp.support.Query; |
|
|
|
|
import org.springblade.core.tool.api.R; |
|
|
|
@ -29,6 +31,7 @@ import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
|
import java.io.IOException; |
|
|
|
|
import java.time.YearMonth; |
|
|
|
|
import java.util.HashMap; |
|
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
|
@ -44,135 +47,140 @@ import java.util.Map;
|
|
|
|
|
@Validated |
|
|
|
|
public class OperDefectController extends BladeController { |
|
|
|
|
|
|
|
|
|
private final IOperDefectService defectService; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 详情 |
|
|
|
|
*/ |
|
|
|
|
@GetMapping("/detail") |
|
|
|
|
@ApiOperationSupport(order = 1) |
|
|
|
|
@ApiOperation(value = "详情", notes = "传入defect") |
|
|
|
|
public R<OperDefectVO> detail(OperDefectEntity defect) { |
|
|
|
|
return defectService.detail(defect); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 分页 代码自定义代号 |
|
|
|
|
*/ |
|
|
|
|
@ApiLog |
|
|
|
|
@GetMapping("/list") |
|
|
|
|
@ApiOperationSupport(order = 2) |
|
|
|
|
@ApiOperation(value = "分页", notes = "传入defect") |
|
|
|
|
@ApiImplicitParams({ |
|
|
|
|
}) |
|
|
|
|
@OperationAnnotation(moduleName = "缺陷管理", |
|
|
|
|
title = "缺陷库",operatorType = OperatorType.MOBILE,businessType = BusinessType.GENCODE,action |
|
|
|
|
= "分页") |
|
|
|
|
public R<IPage<OperDefectVO>> list(OperDefectEntity defect, Query query) { |
|
|
|
|
LambdaQueryWrapper<OperDefectEntity> queryWrapper = Condition.getQueryWrapper(new OperDefectEntity(), defect); |
|
|
|
|
if (defect.getActStartTime() != null) { |
|
|
|
|
queryWrapper.ge(OperDefectEntity::getActStartTime, defect.getActStartTime()); |
|
|
|
|
} |
|
|
|
|
if (defect.getActEndTime() != null) { |
|
|
|
|
queryWrapper.le(OperDefectEntity::getActEndTime, defect.getActEndTime()); |
|
|
|
|
} |
|
|
|
|
if (defect.getStartTime() != null) { |
|
|
|
|
queryWrapper.ge(OperDefectEntity::getCreateTime, defect.getStartTime()); |
|
|
|
|
} |
|
|
|
|
if (defect.getEndTime() != null) { |
|
|
|
|
queryWrapper.le(OperDefectEntity::getCreateTime, defect.getEndTime()); |
|
|
|
|
} |
|
|
|
|
queryWrapper.orderByDesc(OperDefectEntity::getActStartTime); |
|
|
|
|
IPage<OperDefectEntity> pages = defectService.page(Condition.getPage(query), queryWrapper); |
|
|
|
|
IPage<OperDefectVO> vos = OperDefectWrapper.build().pageVO(pages); |
|
|
|
|
return R.data(vos); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* |
|
|
|
|
*/ |
|
|
|
|
private final IOperDefectService defectService; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 详情 |
|
|
|
|
*/ |
|
|
|
|
@GetMapping("/detail") |
|
|
|
|
@ApiOperationSupport(order = 1) |
|
|
|
|
@ApiOperation(value = "详情", notes = "传入defect") |
|
|
|
|
public R<OperDefectVO> detail(OperDefectEntity defect) { |
|
|
|
|
return defectService.detail(defect); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 分页 代码自定义代号 |
|
|
|
|
*/ |
|
|
|
|
@ApiLog |
|
|
|
|
@GetMapping("/list") |
|
|
|
|
@ApiOperationSupport(order = 2) |
|
|
|
|
@ApiOperation(value = "分页", notes = "传入defect") |
|
|
|
|
@ApiImplicitParams({ |
|
|
|
|
}) |
|
|
|
|
@OperationAnnotation(moduleName = "缺陷管理", |
|
|
|
|
title = "缺陷库", operatorType = OperatorType.MOBILE, businessType = BusinessType.GENCODE, action |
|
|
|
|
= "分页") |
|
|
|
|
public R<IPage<OperDefectVO>> list(OperDefectEntity defect, Query query) { |
|
|
|
|
LambdaQueryWrapper<OperDefectEntity> queryWrapper = Condition.getQueryWrapper(new OperDefectEntity(), defect); |
|
|
|
|
if (defect.getActStartTime() != null) { |
|
|
|
|
queryWrapper.ge(OperDefectEntity::getActStartTime, defect.getActStartTime()); |
|
|
|
|
} |
|
|
|
|
if (defect.getActEndTime() != null) { |
|
|
|
|
queryWrapper.le(OperDefectEntity::getActEndTime, defect.getActEndTime()); |
|
|
|
|
} |
|
|
|
|
if (defect.getStartTime() != null) { |
|
|
|
|
queryWrapper.ge(OperDefectEntity::getCreateTime, defect.getStartTime()); |
|
|
|
|
} |
|
|
|
|
if (defect.getEndTime() != null) { |
|
|
|
|
queryWrapper.le(OperDefectEntity::getCreateTime, defect.getEndTime()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
queryWrapper.eq(StringUtils.isNotBlank(defect.getAreaId()), BaseEntity::getCreateDept, defect.getCreateDept()); |
|
|
|
|
|
|
|
|
|
queryWrapper.apply(defect.getYearMonth() != null,"date_format(CREATE_TIME,'%Y-%m')", defect.getYearMonth()); |
|
|
|
|
|
|
|
|
|
queryWrapper.orderByDesc(OperDefectEntity::getActStartTime); |
|
|
|
|
IPage<OperDefectEntity> pages = defectService.page(Condition.getPage(query), queryWrapper); |
|
|
|
|
IPage<OperDefectVO> vos = OperDefectWrapper.build().pageVO(pages); |
|
|
|
|
return R.data(vos); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* |
|
|
|
|
*/ |
|
|
|
|
/** |
|
|
|
|
* 新增 代码自定义代号 |
|
|
|
|
*//*
|
|
|
|
|
*/ /* |
|
|
|
|
|
|
|
|
|
@PostMapping("/save") |
|
|
|
|
@ApiOperationSupport(order = 4) |
|
|
|
|
@ApiOperation(value = "新增", notes = "传入defect") |
|
|
|
|
public R save(@Valid @RequestBody OperDefectEntity defect) { |
|
|
|
|
return R.status(defectService.save(defect)); |
|
|
|
|
} |
|
|
|
|
@PostMapping("/save") |
|
|
|
|
@ApiOperationSupport(order = 4) |
|
|
|
|
@ApiOperation(value = "新增", notes = "传入defect") |
|
|
|
|
public R save(@Valid @RequestBody OperDefectEntity defect) { |
|
|
|
|
return R.status(defectService.save(defect)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
*/ |
|
|
|
|
*/ |
|
|
|
|
/** |
|
|
|
|
* 修改 代码自定义代号 |
|
|
|
|
*//*
|
|
|
|
|
*/ /* |
|
|
|
|
|
|
|
|
|
@PostMapping("/update") |
|
|
|
|
@ApiOperationSupport(order = 5) |
|
|
|
|
@ApiOperation(value = "修改", notes = "传入defect") |
|
|
|
|
public R update(@Valid @RequestBody OperDefectEntity defect) { |
|
|
|
|
return R.status(defectService.updateById(defect)); |
|
|
|
|
} |
|
|
|
|
@PostMapping("/update") |
|
|
|
|
@ApiOperationSupport(order = 5) |
|
|
|
|
@ApiOperation(value = "修改", notes = "传入defect") |
|
|
|
|
public R update(@Valid @RequestBody OperDefectEntity defect) { |
|
|
|
|
return R.status(defectService.updateById(defect)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
*/ |
|
|
|
|
*/ |
|
|
|
|
/** |
|
|
|
|
* 新增或修改 代码自定义代号 |
|
|
|
|
*//*
|
|
|
|
|
|
|
|
|
|
@PostMapping("/submit") |
|
|
|
|
@ApiOperationSupport(order = 6) |
|
|
|
|
@ApiOperation(value = "新增或修改", notes = "传入defect") |
|
|
|
|
public R submit(@Valid @RequestBody OperDefectEntity defect) { |
|
|
|
|
return R.status(defectService.saveOrUpdate(defect)); |
|
|
|
|
} |
|
|
|
|
*/ /* |
|
|
|
|
|
|
|
|
|
@PostMapping("/submit") |
|
|
|
|
@ApiOperationSupport(order = 6) |
|
|
|
|
@ApiOperation(value = "新增或修改", notes = "传入defect") |
|
|
|
|
public R submit(@Valid @RequestBody OperDefectEntity defect) { |
|
|
|
|
return R.status(defectService.saveOrUpdate(defect)); |
|
|
|
|
} |
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* */ |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 删除 代码自定义代号 |
|
|
|
|
*//*
|
|
|
|
|
@PostMapping("/remove") |
|
|
|
|
@ApiOperationSupport(order = 7) |
|
|
|
|
@ApiOperation(value = "逻辑删除", notes = "传入ids") |
|
|
|
|
public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) { |
|
|
|
|
return R.status(defectService.deleteLogic(Func.toLongList(ids))); |
|
|
|
|
}*/ |
|
|
|
|
@PostMapping("/handleProcess") |
|
|
|
|
@ApiOperationSupport(order = 4) |
|
|
|
|
@ApiOperation(value = "执行问题处理流程", notes = "执行问题处理流程") |
|
|
|
|
public R<Void> handleProcess(@RequestBody @ObjectRequiredInvalid(attributes = {"taskId", "processInstanceId", "comment", "flag", |
|
|
|
|
"variables.pass", "variables.handleStatus", "variables.disposeDesc", "variables.actHours", "variables.actStartTime", "variables.actEndTime"}, message = "参数不能为空") @DictInvalid(dictKey = "defectHandleStatus",attribute = "variables.handleStatus") BladeFlow flow) { |
|
|
|
|
|
|
|
|
|
return R.status(defectService.handleProcess(flow)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 获取缺陷的统计月报 |
|
|
|
|
*/ |
|
|
|
|
@ApiLog |
|
|
|
|
@GetMapping("/getDefectStatistics") |
|
|
|
|
@ApiOperationSupport(order = 5) |
|
|
|
|
@ApiOperation(value = "获取缺陷的统计月报", notes = " month 格式:2021-01") |
|
|
|
|
@OperationAnnotation(moduleName = "缺陷管理",title = "缺陷月报表",operatorType = OperatorType.MOBILE,businessType = BusinessType.GENCODE, |
|
|
|
|
action = "获取缺陷的统计月报") |
|
|
|
|
public R<Map<String, Object>> getDefectStatistics(@ApiParam(value = "month 格式:2021-01", required = true) @RequestParam String month) { |
|
|
|
|
Map<String, Object> defectStatistics = defectService.getDefectStatistics(month); |
|
|
|
|
return R.data(defectStatistics); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ApiOperation(value = "缺陷月报表导出-Excel") |
|
|
|
|
@RequestMapping(value = "/exportFualtMonthExcel", method = {RequestMethod.GET, RequestMethod.POST}) |
|
|
|
|
public void exportFualtMonthExcel(HttpServletResponse response, @ApiParam(value = "month 格式:2021-01", required = true) @RequestParam String month) { |
|
|
|
|
Map<String, Object> result = new HashMap<>(); |
|
|
|
|
try { |
|
|
|
|
defectService.exportFualtMonthExcel(response, month); |
|
|
|
|
result.put("success", "true"); |
|
|
|
|
} catch (IOException e) { |
|
|
|
|
result.put("success", "false"); |
|
|
|
|
result.put("msg", "按月巡检详细信息导出失败-" + e.getMessage()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
/* */ |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 删除 代码自定义代号 |
|
|
|
|
*/ /* |
|
|
|
|
@PostMapping("/remove") |
|
|
|
|
@ApiOperationSupport(order = 7) |
|
|
|
|
@ApiOperation(value = "逻辑删除", notes = "传入ids") |
|
|
|
|
public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) { |
|
|
|
|
return R.status(defectService.deleteLogic(Func.toLongList(ids))); |
|
|
|
|
}*/ |
|
|
|
|
@PostMapping("/handleProcess") |
|
|
|
|
@ApiOperationSupport(order = 4) |
|
|
|
|
@ApiOperation(value = "执行问题处理流程", notes = "执行问题处理流程") |
|
|
|
|
public R<Void> handleProcess(@RequestBody @ObjectRequiredInvalid(attributes = {"taskId", "processInstanceId", "comment", "flag", |
|
|
|
|
"variables.pass", "variables.handleStatus", "variables.disposeDesc", "variables.actHours", "variables.actStartTime", "variables.actEndTime"}, message = "参数不能为空") @DictInvalid(dictKey = "defectHandleStatus", attribute = "variables.handleStatus") BladeFlow flow) { |
|
|
|
|
|
|
|
|
|
return R.status(defectService.handleProcess(flow)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 获取缺陷的统计月报 |
|
|
|
|
*/ |
|
|
|
|
@ApiLog |
|
|
|
|
@GetMapping("/getDefectStatistics") |
|
|
|
|
@ApiOperationSupport(order = 5) |
|
|
|
|
@ApiOperation(value = "获取缺陷的统计月报", notes = " month 格式:2021-01") |
|
|
|
|
@OperationAnnotation(moduleName = "缺陷管理", title = "缺陷月报表", operatorType = OperatorType.MOBILE, businessType = BusinessType.GENCODE, |
|
|
|
|
action = "获取缺陷的统计月报") |
|
|
|
|
public R<Map<String, Object>> getDefectStatistics(@ApiParam(value = "month 格式:2021-01", required = true) @RequestParam String month) { |
|
|
|
|
Map<String, Object> defectStatistics = defectService.getDefectStatistics(month); |
|
|
|
|
return R.data(defectStatistics); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@ApiOperation(value = "缺陷月报表导出-Excel") |
|
|
|
|
@RequestMapping(value = "/exportFualtMonthExcel", method = {RequestMethod.GET, RequestMethod.POST}) |
|
|
|
|
public void exportFualtMonthExcel(HttpServletResponse response, @ApiParam(value = "month 格式:2021-01", required = true) @RequestParam String month) { |
|
|
|
|
Map<String, Object> result = new HashMap<>(); |
|
|
|
|
try { |
|
|
|
|
defectService.exportFualtMonthExcel(response, month); |
|
|
|
|
result.put("success", "true"); |
|
|
|
|
} catch (IOException e) { |
|
|
|
|
result.put("success", "false"); |
|
|
|
|
result.put("msg", "按月巡检详细信息导出失败-" + e.getMessage()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|