| | |
| | | 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.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.HttpServletResponse; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | |
| | | /** |
| | |
| | | @Autowired |
| | | private ConfigAuditReportService configAuditReportService; |
| | | |
| | | @Autowired |
| | | private SysCodeRuleService sysCodeRuleService; |
| | | |
| | | @Autowired |
| | | private SysOssConfigService sysOssConfigService; |
| | | |
| | | @GetMapping("page") |
| | | @ApiOperation("分页") |
| | | @ApiImplicitParams({ |
| | |
| | | |
| | | return PageResult.ok(configAuditReportService.page(queryFilter)); |
| | | } |
| | | |
| | | @GetMapping("{id}") |
| | | /* @GetMapping("getDto") |
| | | @ApiOperation("信息") |
| | | public Result<ConfigAuditReport> get(@PathVariable("id") Long id){ |
| | | ConfigAuditReport data = configAuditReportService.get(id); |
| | | |
| | | return Result.ok(data); |
| | | public Result<ConfigAuditDto> getDto(Long projectId, Long reportId) { |
| | | //ConfigAuditDto data =configAuditReportService.getDto(projectId, reportId); |
| | | if (reportId!=null) { |
| | | for (WarehouseConfigItem configItem : data.getConfigItemList()) { |
| | | Long configItemId = configItem.getId(); |
| | | OssDto ossDto = sysOssConfigService.getOssByBusiType(configItemId, "config_item_warehouse"); |
| | | if (ossDto != null) { |
| | | configItem.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); |
| | | |
| | | return Result.ok(); |
| | | } |
| | | |