| | |
| | | import com.zt.common.validator.group.AddGroup; |
| | | import com.zt.common.validator.group.DefaultGroup; |
| | | import com.zt.common.validator.group.UpdateGroup; |
| | | import com.zt.life.modules.configAuditReport.dto.ConfigAuditDto; |
| | | import com.zt.life.modules.configAuditReport.model.ConfigAuditReport; |
| | | import com.zt.life.modules.configAuditReport.service.ConfigAuditReportService; |
| | | import com.zt.life.modules.project.service.ProjectService; |
| | | import com.zt.life.sys.dto.OssDto; |
| | | import com.zt.life.sys.service.SysOssConfigService; |
| | | import com.zt.modules.coderule.service.SysCodeRuleService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | import springfox.documentation.annotations.ApiIgnore; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | |
| | | /** |
| | |
| | | @Autowired |
| | | private ConfigAuditReportService configAuditReportService; |
| | | |
| | | @Autowired |
| | | private ProjectService projectService; |
| | | |
| | | @Autowired |
| | | private SysCodeRuleService sysCodeRuleService; |
| | | |
| | | @Autowired |
| | | private SysOssConfigService sysOssConfigService; |
| | | |
| | | @GetMapping("page") |
| | | @ApiOperation("分页") |
| | | @ApiImplicitParams({ |
| | |
| | | @ApiImplicitParam(name = Constant.Q.LIMIT, value = Constant.QV.LIMIT, required = true, dataType = Constant.QT.INT), |
| | | @ApiImplicitParam(name = Constant.Q.ORDER_FIELD, value = Constant.QV.ORDER_FIELD, dataType = Constant.QT.STRING), |
| | | @ApiImplicitParam(name = Constant.Q.ORDER, value = Constant.QV.ORDER, dataType = Constant.QT.STRING), |
| | | @ApiImplicitParam(name = "code", value = "编号", dataType = Constant.QT.STRING, format = "code^LK"), |
| | | @ApiImplicitParam(name = "libraryType", value = "库类型", dataType = Constant.QT.STRING, format = "a.library_type^EQ") |
| | | }) |
| | | @ApiImplicitParam(name = "code", value = "编号", dataType = Constant.QT.STRING, format = "a.code^LK"), |
| | | @ApiImplicitParam(name = "softwareIdentity", value = "项目标识", dataType = Constant.QT.STRING, format = "p.software_identity^LK"), |
| | | @ApiImplicitParam(name = "softwareName", value = "项目名称", dataType = Constant.QT.STRING, format = "p.software_name^LK"), |
| | | }) |
| | | public PageResult<ConfigAuditReport> page(@ApiIgnore @QueryParam QueryFilter queryFilter){ |
| | | |
| | | return PageResult.ok(configAuditReportService.page(queryFilter)); |
| | | } |
| | | |
| | | @GetMapping("{id}") |
| | | @GetMapping("getDto") |
| | | @ApiOperation("信息") |
| | | public Result<ConfigAuditReport> get(@PathVariable("id") Long id){ |
| | | ConfigAuditReport data = configAuditReportService.get(id); |
| | | |
| | | public Result<ConfigAuditDto> getDto(Long projectId, Long reportId) { |
| | | ConfigAuditDto data =configAuditReportService.getDto(projectId, reportId); |
| | | if (reportId!=null) { |
| | | OssDto ossDto = sysOssConfigService.getOssByBusiType(reportId, "config_audit_report"); |
| | | if (ossDto != null) { |
| | | data.setFiles(ossDto); |
| | | } |
| | | } |
| | | return Result.ok(data); |
| | | } |
| | | |
| | | @PostMapping |
| | | @ApiOperation("新增") |
| | | @LogOperation("新增") |
| | | public Result insert(@RequestBody ConfigAuditReport configAuditReport){ |
| | | public Result insert(@RequestBody ConfigAuditDto configAuditDto){ |
| | | //效验数据 |
| | | ValidatorUtils.validateEntity(configAuditReport, AddGroup.class, DefaultGroup.class); |
| | | configAuditReportService.insert(configAuditReport); |
| | | |
| | | ValidatorUtils.validateEntity(configAuditDto, AddGroup.class, DefaultGroup.class); |
| | | Map<String, String> map = new HashMap<>(); |
| | | map.put("funCode", "config_audit_report"); |
| | | map.put("projectId",configAuditDto.getProjectId().toString()); |
| | | configAuditDto.getAuditReport().setCode(sysCodeRuleService.getNewCode(map)); |
| | | Boolean result = configAuditReportService.save(configAuditDto); |
| | | return Result.ok(); |
| | | } |
| | | |
| | | @PutMapping |
| | | @ApiOperation("修改") |
| | | @LogOperation("修改") |
| | | public Result update(@RequestBody ConfigAuditReport configAuditReport){ |
| | | public Result update(@RequestBody ConfigAuditDto configAuditDto){ |
| | | //效验数据 |
| | | ValidatorUtils.validateEntity(configAuditReport, UpdateGroup.class, DefaultGroup.class); |
| | | configAuditReportService.update(configAuditReport); |
| | | |
| | | ValidatorUtils.validateEntity(configAuditDto, UpdateGroup.class, DefaultGroup.class); |
| | | Boolean result = configAuditReportService.save(configAuditDto); |
| | | return Result.ok(); |
| | | } |
| | | |
| | | @DeleteMapping |
| | | |
| | | @DeleteMapping("deleteConfigAudit") |
| | | @ApiOperation("删除") |
| | | @LogOperation("删除") |
| | | public Result delete(@RequestBody Long[] ids){ |
| | | //效验数据 |
| | | AssertUtils.isArrayEmpty(ids, "id"); |
| | | configAuditReportService.delete(ids); |
| | | |
| | | projectService.deleteItem(ids,"config_audit_report_content","report_id"); |
| | | projectService.deleteItem(ids,"config_audit_report_problem","report_id"); |
| | | return Result.ok(); |
| | | } |
| | | |
| | | @GetMapping("exportConfigAudit") |
| | | @ApiOperation("打印审核报告") |
| | | @LogOperation("打印审核报告") |
| | | public void exportConfigAudit(Long id, HttpServletRequest request, HttpServletResponse response) { |
| | | configAuditReportService.exportConfigAudit(id, request, response); |
| | | } |
| | | |
| | | } |