diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/manager/CheckReportManager.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/manager/CheckReportManager.java index ee29f67..8b642ee 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/manager/CheckReportManager.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/manager/CheckReportManager.java @@ -51,6 +51,7 @@ public class CheckReportManager { .eq(TdCheckType::getCheckId, checkReportDTO.getCheckId()) .remove(); } else { + tdCheckReport.setCheckState("2"); tdCheckReport.setDepart(ShiroUtils.getSysUser().getDept().getDeptName()); tdCheckReport.setAdduser(ShiroUtils.getSysUser().getLoginName()); tdCheckReport.setCreateTime(new Date()); diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/check/TdCheckResultController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/check/TdCheckResultController.java index 2050ea6..a56b6a8 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/check/TdCheckResultController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/check/TdCheckResultController.java @@ -1,5 +1,6 @@ package com.ruoyi.web.controller.system.check; +import cn.hutool.core.collection.CollUtil; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.core.controller.BaseController; import com.ruoyi.common.core.domain.AjaxResult; @@ -7,7 +8,12 @@ import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.system.domain.TdCheck; +import com.ruoyi.system.domain.check.TdCheckReport; +import com.ruoyi.system.domain.check.TdCheckType; +import com.ruoyi.system.domain.check.dto.TdCheckReportDTO; import com.ruoyi.system.service.ITdCheckService; +import com.ruoyi.system.service.check.TdCheckTypeService; +import com.ruoyi.web.controller.manager.CheckReportManager; import com.ruoyi.web.controller.manager.SysAreaManager; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; @@ -23,16 +29,20 @@ import java.util.Objects; @RequestMapping("/system/checkresult") public class TdCheckResultController extends BaseController { private String prefix = "system/checkresult"; - @Autowired - private ITdCheckService tdCheckService; + + @Resource + private TdCheckTypeService checkTypeService; + + + @Resource + private CheckReportManager checkReportManager; @Resource private SysAreaManager sysAreaManager; @RequiresPermissions("system:checkresult:view") @GetMapping() - public String checkresult() - { + public String checkresult() { return prefix + "/checkresult"; } @@ -42,11 +52,10 @@ public class TdCheckResultController extends BaseController { @RequiresPermissions("system:checkresult:list") @PostMapping("/list") @ResponseBody - public TableDataInfo list(TdCheck tdCheck) - { + public TableDataInfo list(TdCheckReport tdCheckReport) { startPage(); - List list = tdCheckService.selectTdCheckList(tdCheck); - return getDataTable(list); + List tdCheckReports = checkReportManager.selectTdCheckReportList(tdCheckReport); + return getDataTable(tdCheckReports); } /** @@ -56,15 +65,14 @@ public class TdCheckResultController extends BaseController { @Log(title = "检查结果管理", businessType = BusinessType.EXPORT) @PostMapping("/export") @ResponseBody - public AjaxResult export(TdCheck tdCheck) - { - List list = tdCheckService.selectTdCheckList(tdCheck); - list.forEach(tdCheck1 -> { + public AjaxResult export(TdCheckReport tdCheckReport) { + List tdCheckReports = checkReportManager.selectTdCheckReportList(tdCheckReport); + tdCheckReports.forEach(tdCheck1 -> { tdCheck1.setFramework(sysAreaManager.getAreaName(tdCheck1.getFramework())); tdCheck1.setArea(sysAreaManager.getAreaName(tdCheck1.getArea())); }); - ExcelUtil util = new ExcelUtil(TdCheck.class); - return util.exportExcel(list, "检查结果管理数据"); + ExcelUtil util = new ExcelUtil<>(TdCheckReport.class); + return util.exportExcel(tdCheckReports, "检查结果管理数据"); } /** @@ -72,10 +80,9 @@ public class TdCheckResultController extends BaseController { */ @RequiresPermissions("system:checkresult:edit") @GetMapping("/edit/{checkId}") - public String edit(@PathVariable("checkId") Long checkId, ModelMap mmap) - { - TdCheck tdCheck = tdCheckService.selectTdCheckByCheckId(checkId); - mmap.put("tdCheck", tdCheck); + public String edit(@PathVariable("checkId") String checkId, ModelMap mmap) { + TdCheckReportDTO tdCheckReportDTO = checkReportManager.getTdCheckReportDTO(checkId); + mmap.put("tdCheckReportDTO", tdCheckReportDTO); return prefix + "/edit"; } @@ -86,9 +93,8 @@ public class TdCheckResultController extends BaseController { @Log(title = "检查结果管理", businessType = BusinessType.UPDATE) @PostMapping("/edit") @ResponseBody - public AjaxResult editSave(TdCheck tdCheck) - { - return toAjax(tdCheckService.updateTdCheck(tdCheck)); + public AjaxResult editSave(@RequestBody TdCheckReportDTO checkReportDTO) { + return toAjax(checkReportManager.saveOrUpdate(checkReportDTO)); } /** @@ -96,11 +102,10 @@ public class TdCheckResultController extends BaseController { */ @RequiresPermissions("system:checkresult:remove") @Log(title = "检查结果管理", businessType = BusinessType.DELETE) - @PostMapping( "/remove") + @PostMapping("/remove") @ResponseBody - public AjaxResult remove(String ids) - { - return toAjax(tdCheckService.deleteTdCheckByCheckIds(ids)); + public AjaxResult remove(String ids) { + return toAjax(checkReportManager.deletedTdCheckReportIds(ids)); } /** @@ -108,11 +113,10 @@ public class TdCheckResultController extends BaseController { */ @RequiresPermissions("system:checkresult:check") @GetMapping("/checkresult/{checkId}") - public String selfcheck(@PathVariable("checkId") Long checkId, ModelMap mmap) - { - TdCheck tdCheck = tdCheckService.selectTdCheckByCheckId(checkId); - mmap.put("sysuser",getSysUser()); - mmap.put("tdCheck", tdCheck); + public String selfcheck(@PathVariable("checkId") String checkId, ModelMap mmap) { + TdCheckReportDTO tdCheckReportDTO = checkReportManager.getTdCheckReportDTO(checkId); + mmap.put("tdCheckReportDTO", tdCheckReportDTO); + mmap.put("sysuser", getSysUser()); return prefix + "/docheck"; } @@ -123,19 +127,17 @@ public class TdCheckResultController extends BaseController { @Log(title = "检查结果管理", businessType = BusinessType.CHECK) @PostMapping("/checkresult") @ResponseBody - public AjaxResult selfcheckSave(TdCheck tdCheck) - { - if (Objects.equals(tdCheck.getCheckresult1(),"0") - && Objects.equals(tdCheck.getCheckresult2(),"0") - && Objects.equals(tdCheck.getCheckresult3(),"0") - && Objects.equals(tdCheck.getCheckresult4(),"0") - && Objects.equals(tdCheck.getCheckresult5(),"0") - && Objects.equals(tdCheck.getCheckresult6(),"0")){ - tdCheck.setCheckState("0"); - }else { - tdCheck.setCheckState("1"); + public AjaxResult selfcheckSave(@RequestBody TdCheckReportDTO checkReportDTO) { + List list = checkTypeService.lambdaQuery() + .eq(TdCheckType::getCheckId, checkReportDTO.getCheckId()) + .eq(TdCheckType::getResultStarts,"1") + .list(); + if (CollUtil.isNotEmpty(list)) { + checkReportDTO.setCheckState("1"); + } else { + checkReportDTO.setCheckState("0"); } - return toAjax(tdCheckService.updateTdCheck(tdCheck)); + return toAjax(checkReportManager.saveOrUpdate(checkReportDTO)); } /** @@ -143,10 +145,9 @@ public class TdCheckResultController extends BaseController { */ @RequiresPermissions("system:checkresult:print") @GetMapping("/checkprint/{checkId}") - public String checkresultPrint(@PathVariable("checkId") Long checkId, ModelMap mmap) - { - TdCheck tdCheckResult = tdCheckService.selectTdCheckByCheckId(checkId); - mmap.put("tdCheckResult", tdCheckResult); + public String checkresultPrint(@PathVariable("checkId") String checkId, ModelMap mmap) { + TdCheckReportDTO tdCheckReportDTO = checkReportManager.getTdCheckReportDTO(checkId); + mmap.put("tdCheckReportDTO", tdCheckReportDTO); return prefix + "/checkresultprint"; }