From b2f311d02b4ce8a1dc11a782f97297b1e1fbd28b Mon Sep 17 00:00:00 2001 From: 马宇豪 <978517621@qq.com> Date: 星期三, 19 六月 2024 09:15:50 +0800 Subject: [PATCH] 添加 --- src/main/java/com/ruoyi/project/tr/specialCheck/controller/TBSpecialCheckScoreAndDangerLogController.java | 71 +++++++++++++++++++++++++++++++++-- 1 files changed, 66 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/ruoyi/project/tr/specialCheck/controller/TBSpecialCheckScoreAndDangerLogController.java b/src/main/java/com/ruoyi/project/tr/specialCheck/controller/TBSpecialCheckScoreAndDangerLogController.java index 29cebe8..6bbc84c 100644 --- a/src/main/java/com/ruoyi/project/tr/specialCheck/controller/TBSpecialCheckScoreAndDangerLogController.java +++ b/src/main/java/com/ruoyi/project/tr/specialCheck/controller/TBSpecialCheckScoreAndDangerLogController.java @@ -1,5 +1,6 @@ package com.ruoyi.project.tr.specialCheck.controller; +import com.ruoyi.common.utils.BeanCopyUtils; import com.ruoyi.doublePrevention.entity.CJReport.PreventCJReportDangerInfo; import com.ruoyi.doublePrevention.service.baseService.PreventCJReportDangerInfoService; import com.ruoyi.doublePrevention.vo.ResultVO; @@ -10,6 +11,7 @@ import com.ruoyi.project.tr.riskList.service.IRiskListService; import com.ruoyi.project.tr.specialCheck.domin.BO.TbSpecialCheckItemDangerLogUpdateBO; import com.ruoyi.project.tr.specialCheck.domin.BO.TbSpecialCheckScoreAndDangerLogQueryBO; +import com.ruoyi.project.tr.specialCheck.domin.DTO.TbSpecialCheckScoreAndDangerLogDTO; import com.ruoyi.project.tr.specialCheck.domin.DTO.TbSpecialCheckScoreAndDangerLogRespDTO; import com.ruoyi.project.tr.specialCheck.domin.TbSpecialCheckItemDangerLog; import com.ruoyi.project.tr.specialCheck.domin.TbSpecialCheckScoreAndDangerLog; @@ -20,6 +22,9 @@ import org.springframework.ui.ModelMap; import org.springframework.web.bind.annotation.*; +import java.sql.Date; +import java.time.Instant; +import java.time.ZoneId; import java.util.List; /** @@ -31,7 +36,7 @@ @RequestMapping("/tr/TBSpecialCheckScoreAndDangerLog") public class TBSpecialCheckScoreAndDangerLogController extends BaseController { - private String prefix = "tr/specialCheckScoreAndDangerLog"; + private String prefix = "tr/TBSpecialCheckScoreAndDangerLog"; @Autowired private SpecialCheckScoreAndDangerDangerLogService scoreAndDangerDangerLogService; @@ -61,10 +66,26 @@ { ResultVO<List<TbSpecialCheckScoreAndDangerLog>> resultVO = scoreAndDangerDangerLogService.selectSpecialCheckScoreAndDangerLogPage(scoreAndDangerLogBO); + List<TbSpecialCheckScoreAndDangerLogRespDTO> data = (List<TbSpecialCheckScoreAndDangerLogRespDTO>) resultVO.getData(); + List<TbSpecialCheckScoreAndDangerLog> scoreList = (List<TbSpecialCheckScoreAndDangerLog>) resultVO.getData(); + List<TbSpecialCheckScoreAndDangerLogDTO> tbSpecialCheckScoreAndDangerLogDTOS = BeanCopyUtils.copyBeanList(data, TbSpecialCheckScoreAndDangerLogDTO.class); + for (TbSpecialCheckScoreAndDangerLogDTO score : tbSpecialCheckScoreAndDangerLogDTOS) { + for (TbSpecialCheckScoreAndDangerLog datum : scoreList) { + if (datum.getId().equals(score.getId())){ + Instant checkDate = datum.getCheckDate().atZone(ZoneId.systemDefault()).toInstant(); + score.setCheckDate(Date.from(checkDate)); + Instant createDate = datum.getCreateDate().atZone(ZoneId.systemDefault()).toInstant(); + score.setCreateDate(Date.from(createDate)); - TableDataInfo dataTable = getDataTable(data); + Instant updateDate = datum.getUpdateDate().atZone(ZoneId.systemDefault()).toInstant(); + score.setUpdateDate(Date.from(updateDate)); + } + } + } + + TableDataInfo dataTable = getDataTable(tbSpecialCheckScoreAndDangerLogDTOS); dataTable.setTotal(resultVO.getCount()); return dataTable; @@ -100,12 +121,25 @@ } } - @GetMapping("/edit/{id}") - public String edit(@PathVariable("id") Long indexId, ModelMap mmap) + @GetMapping("/edit/{indexId}") + public String edit(@PathVariable("indexId") Long indexId, ModelMap mmap) { TbSpecialCheckScoreAndDangerLog specialCheckItem = scoreAndDangerDangerLogService.getSpecialCheckScoreAndDangerLogByIndexId(indexId); - mmap.put("specialCheckItem",specialCheckItem); + TbSpecialCheckScoreAndDangerLogDTO data = BeanCopyUtils.copyBean(specialCheckItem, TbSpecialCheckScoreAndDangerLogDTO.class); + Instant checkDate = specialCheckItem.getCheckDate().atZone(ZoneId.systemDefault()).toInstant(); + data.setCheckDate(Date.from(checkDate)); + + Instant createDate = specialCheckItem.getCreateDate().atZone(ZoneId.systemDefault()).toInstant(); + data.setCreateDate(Date.from(createDate)); + + Instant updateDate = specialCheckItem.getUpdateDate().atZone(ZoneId.systemDefault()).toInstant(); + data.setUpdateDate(Date.from(updateDate)); + mmap.put("specialCheckItem",data); + List<RiskList> riskList = riskListService.listHazardSource(); + List<PreventCJReportDangerInfo> dangerList = preventCJReportDangerInfoService.getDangerListForCheckTask(); + mmap.put("hazardList", riskList); + mmap.put("dangerList", dangerList); // TbBaseCheckTaskBO tbBaseCheckTaskBO = new TbBaseCheckTaskBO(); // ResultVO<List<TbBaseCheckTask>> listResultVO = tbBaseCheckService.selectTbBaseCheckTaskPage(tbBaseCheckTaskBO); // Object data = listResultVO.getData(); @@ -113,6 +147,33 @@ return prefix + "/edit"; } + @GetMapping("/detail/{indexId}") + public String detail(@PathVariable("indexId") Long indexId, ModelMap mmap) + { + TbSpecialCheckScoreAndDangerLog specialCheckItem = scoreAndDangerDangerLogService.getSpecialCheckScoreAndDangerLogByIndexId(indexId); + TbSpecialCheckScoreAndDangerLogDTO data = BeanCopyUtils.copyBean(specialCheckItem, TbSpecialCheckScoreAndDangerLogDTO.class); + + Instant checkDate = specialCheckItem.getCheckDate().atZone(ZoneId.systemDefault()).toInstant(); + data.setCheckDate(Date.from(checkDate)); + + Instant createDate = specialCheckItem.getCreateDate().atZone(ZoneId.systemDefault()).toInstant(); + data.setCreateDate(Date.from(createDate)); + + Instant updateDate = specialCheckItem.getUpdateDate().atZone(ZoneId.systemDefault()).toInstant(); + data.setUpdateDate(Date.from(updateDate)); + mmap.put("specialCheckItem",data); + List<RiskList> riskList = riskListService.listHazardSource(); + List<PreventCJReportDangerInfo> dangerList = preventCJReportDangerInfoService.getDangerListForCheckTask(); + mmap.put("hazardList", riskList); + mmap.put("dangerList", dangerList); + +// TbBaseCheckTaskBO tbBaseCheckTaskBO = new TbBaseCheckTaskBO(); +// ResultVO<List<TbBaseCheckTask>> listResultVO = tbBaseCheckService.selectTbBaseCheckTaskPage(tbBaseCheckTaskBO); +// Object data = listResultVO.getData(); +// mmap.put("tbBaseCheckTask", data); + return prefix + "/detail"; + } + /** * 修改保存 */ -- Gitblit v1.9.2