From 247a4a1f10f233c89a4bd054dee3cb9b7d4a76f1 Mon Sep 17 00:00:00 2001
From: heheng <475597332@qq.com>
Date: 星期三, 19 十一月 2025 08:40:12 +0800
Subject: [PATCH] 新增数据上传准东
---
src/main/java/com/ruoyi/project/tr/specialCheck/service/impl/SpecialCheckTaskServiceImpl.java | 451 ++++++++++++++++++++++++++++---------------------------
1 files changed, 230 insertions(+), 221 deletions(-)
diff --git a/src/main/java/com/ruoyi/project/tr/specialCheck/service/impl/SpecialCheckTaskServiceImpl.java b/src/main/java/com/ruoyi/project/tr/specialCheck/service/impl/SpecialCheckTaskServiceImpl.java
index 40bf246..6188db0 100644
--- a/src/main/java/com/ruoyi/project/tr/specialCheck/service/impl/SpecialCheckTaskServiceImpl.java
+++ b/src/main/java/com/ruoyi/project/tr/specialCheck/service/impl/SpecialCheckTaskServiceImpl.java
@@ -1,221 +1,230 @@
-package com.ruoyi.project.tr.specialCheck.service.impl;
-
-import com.github.pagehelper.Page;
-import com.github.pagehelper.PageHelper;
-import com.ruoyi.doublePrevention.entity.PreventRiskControlMeasure;
-import com.ruoyi.doublePrevention.enums.ErrorCodes;
-import com.ruoyi.doublePrevention.enums.ResultCodes;
-import com.ruoyi.doublePrevention.vo.ResultVO;
-import com.ruoyi.project.system.user.domain.User;
-import com.ruoyi.project.tr.riskList.domain.RiskList;
-import com.ruoyi.project.tr.riskList.service.IRiskListService;
-import com.ruoyi.project.tr.specialCheck.domin.BO.*;
-import com.ruoyi.project.tr.specialCheck.domin.TbSpecialCheckTaskLog;
-import com.ruoyi.project.tr.specialCheck.mapper.*;
-import com.ruoyi.project.tr.specialCheck.service.SpecialCheckTaskService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import org.springframework.util.ObjectUtils;
-
-import java.time.LocalDateTime;
-import java.util.Date;
-import java.util.List;
-import java.util.UUID;
-
-import static com.ruoyi.common.utils.security.ShiroUtils.getSysUser;
-
-@Service
-public class SpecialCheckTaskServiceImpl implements SpecialCheckTaskService {
-
- @Autowired
- private TbBaseCheckCompanyMapper companyTbRepository;
- @Autowired
- private TbBaseCheckItemMapper itemTbRepository;
- @Autowired
- private TbBaseCheckScoreMapper scoreTbRepository;
- @Autowired
- private TbBaseCheckTaskMapper taskTbRepository;
- @Autowired
- private TbSpecialCheckTaskLogMapper taskSpecialLogMapper;
- @Autowired
- private IRiskListService riskListService;
-
- @Override
- public ResultVO<List<TbSpecialCheckTaskLog>> selectSpecialCheckTaskLogPage(TbSpecialCheckTaskLogBO specialCheckTaskLogBO) {
- Integer pageIndex = specialCheckTaskLogBO.getPageNum();
- Integer pageSize = specialCheckTaskLogBO.getPageSize();
- if (pageIndex == 0 || pageSize == 0){
- return new ResultVO<>(ErrorCodes.REQUEST_PARAM_ERROR.getCode(),"当前页码或当前页显示数不能为0");
- }
-
- Page<TbSpecialCheckTaskLog> page = PageHelper.startPage(pageIndex, pageSize);
- taskSpecialLogMapper.selectSpecialCheckTaskLogPage(specialCheckTaskLogBO);
-
- Long total = page.getTotal();
- int count = total.intValue();
- List<TbSpecialCheckTaskLog> pageResult = null;
-
- ResultVO<List<TbSpecialCheckTaskLog>> resultVO = new ResultVO<>(ResultCodes.OK,pageResult);
-
- resultVO.setData(page.getResult());
- resultVO.setCount(count);
- resultVO.setCount((int) page.getTotal());
- resultVO.setPageNum(page.getPageNum());
- resultVO.setPageSize(page.getPageSize());
- return resultVO;
- }
-
- @Override
- public ResultVO<TbSpecialCheckTaskLog> addSpecialTask(TbSpecialCheckTaskLog tbSpecialCheckTaskLog) {
- User sysUser = getSysUser();
- ResultVO resultVO = new ResultVO<>();
- resultVO.setCode(ErrorCodes.REQUEST_PARAM_ERROR.getCode());
- if (tbSpecialCheckTaskLog.getHazardCode() == null){
- resultVO.setMsg("重大风险源不能为空");
- return resultVO;
- }
- RiskList infoByRiskListNum = riskListService.getInfoByRiskListNum(tbSpecialCheckTaskLog.getHazardCode());
- if (ObjectUtils.isEmpty(infoByRiskListNum)){
- resultVO.setMsg("请检查重大风险源是否存在");
- return resultVO;
- }
- if (tbSpecialCheckTaskLog.getTaskId() == null){
- resultVO.setMsg("专项任务不能为空");
- return resultVO;
- }
- if (tbSpecialCheckTaskLog.getCheckType() == null){
- resultVO.setMsg("检查类型不能为空");
- return resultVO;
- }
- if (tbSpecialCheckTaskLog.getResultStatus() == null){
- resultVO.setMsg("结果不能为空");
- return resultVO;
- }
- if (tbSpecialCheckTaskLog.getCheckDate() == null){
- resultVO.setMsg("检查日期不能为空");
- return resultVO;
- }
- LocalDateTime dateTime = LocalDateTime.now();
- String uuid = UUID.randomUUID().toString();
-
- tbSpecialCheckTaskLog.setId(uuid);
- tbSpecialCheckTaskLog.setHazardSource(infoByRiskListNum.getRiskListName());
- tbSpecialCheckTaskLog.setCompanyCode("652310082");
- tbSpecialCheckTaskLog.setCreateDate(dateTime);
- tbSpecialCheckTaskLog.setUpdateDate(dateTime);
- tbSpecialCheckTaskLog.setCreateBy(sysUser.getUserName());
- tbSpecialCheckTaskLog.setUpdateBy(sysUser.getUserName());
- tbSpecialCheckTaskLog.setReportStatus((byte) 1);
- tbSpecialCheckTaskLog.setReportTime(null);
- tbSpecialCheckTaskLog.setDeleted((byte) 0);
-
- int saveResult = taskSpecialLogMapper.save(tbSpecialCheckTaskLog);
- if (saveResult == 0){
- resultVO.setCode(ResultCodes.SERVER_ADD_ERROR.getCode());
- resultVO.setMsg(ResultCodes.SERVER_ADD_ERROR.getDesc());
- return resultVO;
- }
- resultVO.setCode(ResultCodes.OK.getCode());
- resultVO.setMsg("新增任务成功");
- return resultVO;
- }
-
- @Override
- public TbSpecialCheckTaskLog getSpecialCheckTaskLogByIndexId(Long id) {
- return taskSpecialLogMapper.getSpecialCheckTaskLogByIndexId(id);
- }
-
- @Override
- public ResultVO<TbSpecialCheckTaskLog> updateSpecialCheckTaskLog(TbSpecialCheckTaskLogUpdateBO updateBO) {
- User sysUser = getSysUser();
- ResultVO resultVO = new ResultVO<>();
- resultVO.setCode(ErrorCodes.REQUEST_PARAM_ERROR.getCode());
- if (updateBO.getIndexId() == null){
- resultVO.setMsg("任务不能为空");
- return resultVO;
- }
- TbSpecialCheckTaskLog specialCheckTaskLogByIndexId = taskSpecialLogMapper.getSpecialCheckTaskLogByIndexId(updateBO.getIndexId());
- if (ObjectUtils.isEmpty(specialCheckTaskLogByIndexId)){
- resultVO.setMsg("任务不存在");
- return resultVO;
- }
- if (updateBO.getHazardCode() == null){
- resultVO.setMsg("重大风险源不能为空");
- return resultVO;
- }
- RiskList infoByRiskListNum = riskListService.getInfoByRiskListNum(updateBO.getHazardCode());
- if (ObjectUtils.isEmpty(infoByRiskListNum)){
- resultVO.setMsg("请检查重大风险源是否存在");
- return resultVO;
- }
- if (updateBO.getTaskId() == null){
- resultVO.setMsg("专项任务不能为空");
- return resultVO;
- }
- if (updateBO.getCheckType() == null){
- resultVO.setMsg("检查类型不能为空");
- return resultVO;
- }
- if (updateBO.getResultStatus() == null){
- resultVO.setMsg("结果不能为空");
- return resultVO;
- }
- if (updateBO.getCheckDate() == null){
- resultVO.setMsg("检查日期不能为空");
- return resultVO;
- }
-
- LocalDateTime dateTime = LocalDateTime.now();
- updateBO.setHazardSource(infoByRiskListNum.getRiskListName());
- updateBO.setUpdateDate(dateTime);
- updateBO.setUpdateBy(sysUser.getUserName());
- updateBO.setReportStatus((byte) 1);
-
- int updateResult = taskSpecialLogMapper.updateSpecialCheckTaskLogById(updateBO);
- if (updateResult == 0){
- resultVO.setCode(ResultCodes.SERVER_UPDATE_ERROR.getCode());
- resultVO.setMsg(ResultCodes.SERVER_UPDATE_ERROR.getDesc());
- return resultVO;
- }
- resultVO.setCode(ResultCodes.OK.getCode());
- resultVO.setMsg("更新任务成功");
- return resultVO;
- }
-
- @Override
- public ResultVO<TbSpecialCheckTaskLog> deleteTbSpecialCheckTaskLog(TbSpecialCheckTaskLogUpdateBO updateBO) {
- User sysUser = getSysUser();
- ResultVO resultVO = new ResultVO<>();
- resultVO.setCode(ErrorCodes.REQUEST_PARAM_ERROR.getCode());
-
- if (updateBO.getIndexId() == null){
- resultVO.setMsg("任务为空,删除失败");
- return resultVO;
- }
- TbSpecialCheckTaskLog specialCheckTaskLogByIndexId = taskSpecialLogMapper.getSpecialCheckTaskLogByIndexId(updateBO.getIndexId());
- if (ObjectUtils.isEmpty(specialCheckTaskLogByIndexId)){
- resultVO.setMsg("任务不存在,删除失败");
- return resultVO;
- }
- TbSpecialCheckTaskLog tbSpecialCheckTaskLog = new TbSpecialCheckTaskLog();
- LocalDateTime dateTime = LocalDateTime.now();
-
- tbSpecialCheckTaskLog.setIndexId(updateBO.getIndexId());
- tbSpecialCheckTaskLog.setUpdateDate(dateTime);
- tbSpecialCheckTaskLog.setUpdateBy(sysUser.getUserName());
- tbSpecialCheckTaskLog.setReportStatus((byte) 1);
- tbSpecialCheckTaskLog.setDeleted((byte) 1);
-
- int deleteResult = taskSpecialLogMapper.deleteTbSpecialCheckTaskLog(tbSpecialCheckTaskLog);
- if (deleteResult == 0){
- resultVO.setCode(ResultCodes.SERVER_DEL_ERROR.getCode());
- resultVO.setMsg(ResultCodes.SERVER_DEL_ERROR.getDesc());
- return resultVO;
- }
- resultVO.setCode(ResultCodes.OK.getCode());
- resultVO.setMsg("删除成功");
- return resultVO;
- }
-
-
-}
+package com.ruoyi.project.tr.specialCheck.service.impl;
+
+import com.github.pagehelper.Page;
+import com.github.pagehelper.PageHelper;
+import com.ruoyi.common.utils.BeanCopyUtils;
+import com.ruoyi.doublePrevention.entity.PreventRiskControlMeasure;
+import com.ruoyi.doublePrevention.enums.ErrorCodes;
+import com.ruoyi.doublePrevention.enums.ResultCodes;
+import com.ruoyi.doublePrevention.vo.ResultVO;
+import com.ruoyi.project.system.user.domain.User;
+import com.ruoyi.project.tr.riskList.domain.RiskList;
+import com.ruoyi.project.tr.riskList.service.IRiskListService;
+import com.ruoyi.project.tr.specialCheck.domin.BO.*;
+import com.ruoyi.project.tr.specialCheck.domin.TbSpecialCheckTaskLog;
+import com.ruoyi.project.tr.specialCheck.mapper.*;
+import com.ruoyi.project.tr.specialCheck.service.SpecialCheckTaskService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.util.ObjectUtils;
+
+import java.time.LocalDateTime;
+import java.time.ZoneId;
+import java.util.Date;
+import java.util.List;
+import java.util.UUID;
+
+import static com.ruoyi.common.utils.security.ShiroUtils.getSysUser;
+
+@Service
+public class SpecialCheckTaskServiceImpl implements SpecialCheckTaskService {
+
+ @Autowired
+ private TbBaseCheckCompanyMapper companyTbRepository;
+ @Autowired
+ private TbBaseCheckItemMapper itemTbRepository;
+ @Autowired
+ private TbBaseCheckScoreMapper scoreTbRepository;
+ @Autowired
+ private TbBaseCheckTaskMapper taskTbRepository;
+ @Autowired
+ private TbSpecialCheckTaskLogMapper taskSpecialLogMapper;
+ @Autowired
+ private IRiskListService riskListService;
+
+ @Override
+ public ResultVO<List<TbSpecialCheckTaskLog>> selectSpecialCheckTaskLogPage(TbSpecialCheckTaskLogBO specialCheckTaskLogBO) {
+ Integer pageIndex = specialCheckTaskLogBO.getPageNum();
+ Integer pageSize = specialCheckTaskLogBO.getPageSize();
+ if (pageIndex == 0 || pageSize == 0){
+ return new ResultVO<>(ErrorCodes.REQUEST_PARAM_ERROR.getCode(),"当前页码或当前页显示数不能为0");
+ }
+
+ Page<TbSpecialCheckTaskLog> page = PageHelper.startPage(pageIndex, pageSize);
+ taskSpecialLogMapper.selectSpecialCheckTaskLogPage(specialCheckTaskLogBO);
+
+ Long total = page.getTotal();
+ int count = total.intValue();
+ List<TbSpecialCheckTaskLog> pageResult = null;
+
+ ResultVO<List<TbSpecialCheckTaskLog>> resultVO = new ResultVO<>(ResultCodes.OK,pageResult);
+
+ resultVO.setData(page.getResult());
+ resultVO.setCount(count);
+ resultVO.setCount((int) page.getTotal());
+ resultVO.setPageNum(page.getPageNum());
+ resultVO.setPageSize(page.getPageSize());
+ return resultVO;
+ }
+
+ @Override
+ public ResultVO<TbSpecialCheckTaskLog> addSpecialTask(TbSpecialCheckTaskLogEditBO taskLogEditBO) {
+ User sysUser = getSysUser();
+ ResultVO resultVO = new ResultVO<>();
+ resultVO.setCode(ErrorCodes.REQUEST_PARAM_ERROR.getCode());
+
+ TbSpecialCheckTaskLog tbSpecialCheckTaskLog = BeanCopyUtils.copyBean(taskLogEditBO, TbSpecialCheckTaskLog.class);
+ if (tbSpecialCheckTaskLog.getHazardCode() == null){
+ resultVO.setMsg("重大风险源不能为空");
+ return resultVO;
+ }
+ RiskList infoByRiskListNum = riskListService.getInfoByRiskListNum(tbSpecialCheckTaskLog.getHazardCode());
+ if (ObjectUtils.isEmpty(infoByRiskListNum)){
+ resultVO.setMsg("请检查重大风险源是否存在");
+ return resultVO;
+ }
+ if (tbSpecialCheckTaskLog.getTaskId() == null){
+ resultVO.setMsg("专项任务不能为空");
+ return resultVO;
+ }
+ if (tbSpecialCheckTaskLog.getCheckType() == null){
+ resultVO.setMsg("检查类型不能为空");
+ return resultVO;
+ }
+ if (tbSpecialCheckTaskLog.getResultStatus() == null){
+ resultVO.setMsg("结果不能为空");
+ return resultVO;
+ }
+ if (taskLogEditBO.getCheckDate() == null){
+ resultVO.setMsg("检查日期不能为空");
+ return resultVO;
+ }
+ LocalDateTime dateTime = LocalDateTime.now();
+ String uuid = UUID.randomUUID().toString();
+
+ tbSpecialCheckTaskLog.setId(uuid);
+ tbSpecialCheckTaskLog.setHazardSource(infoByRiskListNum.getRiskListName());
+ tbSpecialCheckTaskLog.setCompanyCode("652310082");
+ tbSpecialCheckTaskLog.setCreateDate(dateTime);
+ tbSpecialCheckTaskLog.setUpdateDate(dateTime);
+ tbSpecialCheckTaskLog.setCreateBy(sysUser.getUserName());
+ tbSpecialCheckTaskLog.setUpdateBy(sysUser.getUserName());
+ tbSpecialCheckTaskLog.setReportStatus((byte) 1);
+ tbSpecialCheckTaskLog.setReportTime(null);
+ tbSpecialCheckTaskLog.setDeleted((byte) 0);
+ tbSpecialCheckTaskLog.setCheckDate(LocalDateTime.ofInstant(taskLogEditBO.getCheckDate().toInstant(), ZoneId.systemDefault()));
+
+ int saveResult = taskSpecialLogMapper.save(tbSpecialCheckTaskLog);
+ if (saveResult == 0){
+ resultVO.setCode(ResultCodes.SERVER_ADD_ERROR.getCode());
+ resultVO.setMsg(ResultCodes.SERVER_ADD_ERROR.getDesc());
+ return resultVO;
+ }
+ resultVO.setCode(ResultCodes.OK.getCode());
+ resultVO.setMsg("新增任务成功");
+ return resultVO;
+ }
+
+ @Override
+ public TbSpecialCheckTaskLog getSpecialCheckTaskLogByIndexId(Long id) {
+ return taskSpecialLogMapper.getSpecialCheckTaskLogByIndexId(id);
+ }
+
+ @Override
+ public ResultVO<TbSpecialCheckTaskLog> updateSpecialCheckTaskLog(TbSpecialCheckTaskLogEditBO taskLogEditBO) {
+ User sysUser = getSysUser();
+ ResultVO resultVO = new ResultVO<>();
+ resultVO.setCode(ErrorCodes.REQUEST_PARAM_ERROR.getCode());
+
+ TbSpecialCheckTaskLogUpdateBO updateBO = BeanCopyUtils.copyBean(taskLogEditBO, TbSpecialCheckTaskLogUpdateBO.class);
+
+ if (updateBO.getIndexId() == null){
+ resultVO.setMsg("任务不能为空");
+ return resultVO;
+ }
+ TbSpecialCheckTaskLog specialCheckTaskLogByIndexId = taskSpecialLogMapper.getSpecialCheckTaskLogByIndexId(updateBO.getIndexId());
+ if (ObjectUtils.isEmpty(specialCheckTaskLogByIndexId)){
+ resultVO.setMsg("任务不存在");
+ return resultVO;
+ }
+ if (updateBO.getHazardCode() == null){
+ resultVO.setMsg("重大风险源不能为空");
+ return resultVO;
+ }
+ RiskList infoByRiskListNum = riskListService.getInfoByRiskListNum(updateBO.getHazardCode());
+ if (ObjectUtils.isEmpty(infoByRiskListNum)){
+ resultVO.setMsg("请检查重大风险源是否存在");
+ return resultVO;
+ }
+ if (updateBO.getTaskId() == null){
+ resultVO.setMsg("专项任务不能为空");
+ return resultVO;
+ }
+ if (updateBO.getCheckType() == null){
+ resultVO.setMsg("检查类型不能为空");
+ return resultVO;
+ }
+ if (updateBO.getResultStatus() == null){
+ resultVO.setMsg("结果不能为空");
+ return resultVO;
+ }
+ if (taskLogEditBO.getCheckDate() == null){
+ resultVO.setMsg("检查日期不能为空");
+ return resultVO;
+ }
+
+ LocalDateTime dateTime = LocalDateTime.now();
+ updateBO.setHazardSource(infoByRiskListNum.getRiskListName());
+ updateBO.setUpdateDate(dateTime);
+ updateBO.setUpdateBy(sysUser.getUserName());
+ updateBO.setReportStatus((byte) 1);
+ updateBO.setCheckDate(LocalDateTime.ofInstant(taskLogEditBO.getCheckDate().toInstant(), ZoneId.systemDefault()));
+
+ int updateResult = taskSpecialLogMapper.updateSpecialCheckTaskLogById(updateBO);
+ if (updateResult == 0){
+ resultVO.setCode(ResultCodes.SERVER_UPDATE_ERROR.getCode());
+ resultVO.setMsg(ResultCodes.SERVER_UPDATE_ERROR.getDesc());
+ return resultVO;
+ }
+ resultVO.setCode(ResultCodes.OK.getCode());
+ resultVO.setMsg("更新任务成功");
+ return resultVO;
+ }
+
+ @Override
+ public ResultVO<TbSpecialCheckTaskLog> deleteTbSpecialCheckTaskLog(TbSpecialCheckTaskLogUpdateBO updateBO) {
+ User sysUser = getSysUser();
+ ResultVO resultVO = new ResultVO<>();
+ resultVO.setCode(ErrorCodes.REQUEST_PARAM_ERROR.getCode());
+
+ if (updateBO.getIndexId() == null){
+ resultVO.setMsg("任务为空,删除失败");
+ return resultVO;
+ }
+ TbSpecialCheckTaskLog specialCheckTaskLogByIndexId = taskSpecialLogMapper.getSpecialCheckTaskLogByIndexId(updateBO.getIndexId());
+ if (ObjectUtils.isEmpty(specialCheckTaskLogByIndexId)){
+ resultVO.setMsg("任务不存在,删除失败");
+ return resultVO;
+ }
+ TbSpecialCheckTaskLog tbSpecialCheckTaskLog = new TbSpecialCheckTaskLog();
+ LocalDateTime dateTime = LocalDateTime.now();
+
+ tbSpecialCheckTaskLog.setIndexId(updateBO.getIndexId());
+ tbSpecialCheckTaskLog.setUpdateDate(dateTime);
+ tbSpecialCheckTaskLog.setUpdateBy(sysUser.getUserName());
+ tbSpecialCheckTaskLog.setReportStatus((byte) 1);
+ tbSpecialCheckTaskLog.setDeleted((byte) 1);
+
+ int deleteResult = taskSpecialLogMapper.deleteTbSpecialCheckTaskLog(tbSpecialCheckTaskLog);
+ if (deleteResult == 0){
+ resultVO.setCode(ResultCodes.SERVER_DEL_ERROR.getCode());
+ resultVO.setMsg(ResultCodes.SERVER_DEL_ERROR.getDesc());
+ return resultVO;
+ }
+ resultVO.setCode(ResultCodes.OK.getCode());
+ resultVO.setMsg("删除成功");
+ return resultVO;
+ }
+
+
+}
--
Gitblit v1.9.2