fix:检查报告导出接口提交

pg_adapter
wangxy 8 months ago
parent 4a9d0397c6
commit 7f7c9e3315

@ -51,6 +51,7 @@ public class CheckReportManager {
.eq(TdCheckType::getCheckId, checkReportDTO.getCheckId()) .eq(TdCheckType::getCheckId, checkReportDTO.getCheckId())
.remove(); .remove();
} else { } else {
tdCheckReport.setCheckState("2");
tdCheckReport.setDepart(ShiroUtils.getSysUser().getDept().getDeptName()); tdCheckReport.setDepart(ShiroUtils.getSysUser().getDept().getDeptName());
tdCheckReport.setAdduser(ShiroUtils.getSysUser().getLoginName()); tdCheckReport.setAdduser(ShiroUtils.getSysUser().getLoginName());
tdCheckReport.setCreateTime(new Date()); tdCheckReport.setCreateTime(new Date());

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

Loading…
Cancel
Save