| | |
| | | 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.CJReport.PreventCJReportDangerInfo;
|
| | | import com.ruoyi.doublePrevention.enums.ErrorCodes;
|
| | | import com.ruoyi.doublePrevention.enums.ResultCodes;
|
| | | import com.ruoyi.doublePrevention.repository.PreventCJReportDangerInfoRepository;
|
| | | import com.ruoyi.doublePrevention.vo.ResultVO;
|
| | | import com.ruoyi.project.system.user.domain.User;
|
| | | import com.ruoyi.project.tr.specialCheck.domin.*;
|
| | | import com.ruoyi.project.tr.specialCheck.domin.BO.HandlerSpecialCheckReportParam;
|
| | | import com.ruoyi.project.tr.specialCheck.domin.BO.TbSpecialCheckScoreAndDangerLogEditBO;
|
| | | import com.ruoyi.project.tr.specialCheck.domin.BO.TbSpecialCheckScoreAndDangerLogQueryBO;
|
| | | import com.ruoyi.project.tr.specialCheck.mapper.*;
|
| | | import com.ruoyi.project.tr.specialCheck.service.SpecialCheckScoreAndDangerDangerLogService;
|
| | | 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.List;
|
| | | import java.util.UUID;
|
| | |
|
| | | import static com.ruoyi.common.utils.security.ShiroUtils.getSysUser;
|
| | |
|
| | | @Service
|
| | | public class SpecialCheckScoreAndDangerLogServiceImpl implements SpecialCheckScoreAndDangerDangerLogService {
|
| | |
|
| | | @Autowired
|
| | | private TbSpecialCheckScoreAndDangerLogMapper scoreAndDangerLogMapper;
|
| | |
|
| | | @Autowired
|
| | | private TbBaseCheckTaskMapper baseCheckTaskMapper;
|
| | |
|
| | | @Autowired
|
| | | private TbBaseCheckItemMapper baseCheckItemMapper;
|
| | |
|
| | | @Autowired
|
| | | private TbBaseCheckScoreMapper baseCheckScoreMapper;
|
| | |
|
| | | @Autowired
|
| | | private PreventCJReportDangerInfoRepository preventCJReportDangerInfoRepository;
|
| | |
|
| | | @Autowired
|
| | | private TbSpecialCheckItemLogMapper specialCheckItemLogMapper;
|
| | |
|
| | |
|
| | |
|
| | | @Override
|
| | | public ResultVO<List<TbSpecialCheckScoreAndDangerLog>> selectSpecialCheckScoreAndDangerLogPage(TbSpecialCheckScoreAndDangerLogQueryBO scoreAndDangerLogBO) {
|
| | | Integer pageIndex = scoreAndDangerLogBO.getPageNum();
|
| | | Integer pageSize = scoreAndDangerLogBO.getPageSize();
|
| | | if (pageIndex == 0 || pageSize == 0){
|
| | | return new ResultVO<>(ErrorCodes.REQUEST_PARAM_ERROR.getCode(),"当前页码或当前页显示数不能为0");
|
| | | }
|
| | |
|
| | | Page<TbSpecialCheckScoreAndDangerLog> page = PageHelper.startPage(pageIndex, pageSize);
|
| | | scoreAndDangerLogMapper.selectSpecialCheckScoreAndDangerLogPage(scoreAndDangerLogBO);
|
| | |
|
| | | Long total = page.getTotal();
|
| | | int count = total.intValue();
|
| | | List<TbSpecialCheckScoreAndDangerLog> pageResult = null;
|
| | |
|
| | | ResultVO<List<TbSpecialCheckScoreAndDangerLog>> 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<TbSpecialCheckScoreAndDangerLog> addSpecialScoreAndDanger(TbSpecialCheckScoreAndDangerLogEditBO scoreAndDangerEditLog) {
|
| | | User sysUser = getSysUser();
|
| | | ResultVO resultVO = new ResultVO<>();
|
| | | resultVO.setCode(ErrorCodes.REQUEST_PARAM_ERROR.getCode());
|
| | | TbSpecialCheckScoreAndDangerLog scoreAndDangerLog = BeanCopyUtils.copyBean(scoreAndDangerEditLog, TbSpecialCheckScoreAndDangerLog.class);
|
| | |
|
| | | if (scoreAndDangerLog.getCheckItemId() == null){
|
| | | resultVO.setMsg("检查项不能为空");
|
| | | return resultVO;
|
| | | }
|
| | | TbBaseCheckItem baseCheckItemByItemId = baseCheckItemMapper.getBaseCheckItemByItemId(scoreAndDangerLog.getCheckItemId());
|
| | | if (ObjectUtils.isEmpty(baseCheckItemByItemId)){
|
| | | resultVO.setMsg("检查项不存在");
|
| | | return resultVO;
|
| | | }
|
| | | if (scoreAndDangerLog.getCheckScoreId() == null){
|
| | | resultVO.setMsg("评分不能为空");
|
| | | return resultVO;
|
| | | }
|
| | | TbBaseCheckScore baseCheckScoreByScoreId = baseCheckScoreMapper.getBaseCheckScoreByScoreId(scoreAndDangerLog.getCheckScoreId());
|
| | | if (ObjectUtils.isEmpty(baseCheckScoreByScoreId)){
|
| | | resultVO.setMsg("评分标准不存在");
|
| | | return resultVO;
|
| | | }
|
| | | if (scoreAndDangerLog.getDangerId() == null){
|
| | | resultVO.setMsg("关联隐患不能为空");
|
| | | return resultVO;
|
| | | }
|
| | | PreventCJReportDangerInfo dangerById = preventCJReportDangerInfoRepository.getDangerById(scoreAndDangerLog.getDangerId());
|
| | | if (ObjectUtils.isEmpty(dangerById)){
|
| | | resultVO.setMsg("隐患不存在");
|
| | | return resultVO;
|
| | | }
|
| | | if (scoreAndDangerEditLog.getCheckDate() == null){
|
| | | resultVO.setMsg("检查时间不能为空");
|
| | | return resultVO;
|
| | | }
|
| | | if (scoreAndDangerLog.getCheckType() == null){
|
| | | resultVO.setMsg("检查类型不能为空");
|
| | | return resultVO;
|
| | | }
|
| | | TbBaseCheckTask baseCheckTaskByTaskId = baseCheckTaskMapper.getBaseCheckTaskByTaskId(baseCheckItemByItemId.getTaskId());
|
| | | if (ObjectUtils.isEmpty(baseCheckTaskByTaskId)){
|
| | | resultVO.setMsg("专项任务不存在");
|
| | | return resultVO;
|
| | | }
|
| | |
|
| | | LocalDateTime dateTime = LocalDateTime.now();
|
| | | String uuid = UUID.randomUUID().toString();
|
| | |
|
| | | scoreAndDangerLog.setId(uuid);
|
| | | scoreAndDangerLog.setCompanyCode("652310082");
|
| | | scoreAndDangerLog.setCreateDate(dateTime);
|
| | | scoreAndDangerLog.setUpdateDate(dateTime);
|
| | | scoreAndDangerLog.setCreateBy(sysUser.getUserName());
|
| | | scoreAndDangerLog.setUpdateBy(sysUser.getUserName());
|
| | | scoreAndDangerLog.setReportStatus((byte) 1);
|
| | | scoreAndDangerLog.setReportTime(null);
|
| | | scoreAndDangerLog.setDeleted((byte) 0);
|
| | | scoreAndDangerLog.setDangerName(dangerById.getDangerName());
|
| | | scoreAndDangerLog.setIsReject(baseCheckScoreByScoreId.getIsReject());
|
| | | scoreAndDangerLog.setDeductPoint(baseCheckScoreByScoreId.getDeductPoint());
|
| | | scoreAndDangerLog.setDeductIllustrate(baseCheckScoreByScoreId.getDeductIllustrate());
|
| | | scoreAndDangerLog.setTaskId(baseCheckItemByItemId.getTaskId());
|
| | | scoreAndDangerLog.setCheckDate(LocalDateTime.ofInstant(scoreAndDangerEditLog.getCheckDate().toInstant(), ZoneId.systemDefault()));
|
| | |
|
| | |
|
| | |
|
| | |
|
| | | int saveResult = scoreAndDangerLogMapper.save(scoreAndDangerLog);
|
| | | if (saveResult == 0){
|
| | | resultVO.setCode(ResultCodes.SERVER_ADD_ERROR.getCode());
|
| | | resultVO.setMsg(ResultCodes.SERVER_ADD_ERROR.getDesc());
|
| | | return resultVO;
|
| | | }
|
| | | HandlerSpecialCheckReportParam specialCheckItemLog = new HandlerSpecialCheckReportParam();
|
| | | specialCheckItemLog.setReportStatus((byte) 2);
|
| | | specialCheckItemLog.setReportTime(dateTime);
|
| | | int i = specialCheckItemLogMapper.updateItemDangerReportStatusById(specialCheckItemLog);
|
| | | if (i == 0){
|
| | | resultVO.setCode(ResultCodes.SERVER_ADD_ERROR.getCode());
|
| | | resultVO.setMsg("修改检查项状态失败");
|
| | | return resultVO;
|
| | | }
|
| | | resultVO.setCode(ResultCodes.OK.getCode());
|
| | | resultVO.setMsg("新增检查成功");
|
| | | return resultVO;
|
| | | }
|
| | |
|
| | | @Override
|
| | | public TbSpecialCheckScoreAndDangerLog getSpecialCheckScoreAndDangerLogByIndexId(Long indexId) {
|
| | | return scoreAndDangerLogMapper.getSpecialCheckScoreAndDangerLogByIndexId(indexId);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public ResultVO<TbSpecialCheckScoreAndDangerLog> updateSpecialCheckScoreAndDangerLog(TbSpecialCheckScoreAndDangerLogEditBO scoreAndDangerEditLog) {
|
| | | User sysUser = getSysUser();
|
| | | ResultVO resultVO = new ResultVO<>();
|
| | | resultVO.setCode(ErrorCodes.REQUEST_PARAM_ERROR.getCode());
|
| | |
|
| | | TbSpecialCheckScoreAndDangerLog scoreAndDangerLog = BeanCopyUtils.copyBean(scoreAndDangerEditLog, TbSpecialCheckScoreAndDangerLog.class);
|
| | |
|
| | | if (scoreAndDangerLog.getCheckItemId() == null){
|
| | | resultVO.setMsg("检查项不能为空");
|
| | | return resultVO;
|
| | | }
|
| | | TbBaseCheckItem baseCheckItemByItemId = baseCheckItemMapper.getBaseCheckItemByItemId(scoreAndDangerLog.getCheckItemId());
|
| | | if (ObjectUtils.isEmpty(baseCheckItemByItemId)){
|
| | | resultVO.setMsg("检查项不存在");
|
| | | return resultVO;
|
| | | }
|
| | | if (scoreAndDangerLog.getCheckScoreId() == null){
|
| | | resultVO.setMsg("评分不能为空");
|
| | | return resultVO;
|
| | | }
|
| | | TbBaseCheckScore baseCheckScoreByScoreId = baseCheckScoreMapper.getBaseCheckScoreByScoreId(scoreAndDangerLog.getCheckScoreId());
|
| | | if (ObjectUtils.isEmpty(baseCheckScoreByScoreId)){
|
| | | resultVO.setMsg("评分标准不存在");
|
| | | return resultVO;
|
| | | }
|
| | | if (scoreAndDangerLog.getDangerId() == null){
|
| | | resultVO.setMsg("关联隐患不能为空");
|
| | | return resultVO;
|
| | | }
|
| | | PreventCJReportDangerInfo dangerById = preventCJReportDangerInfoRepository.getDangerById(scoreAndDangerLog.getDangerId());
|
| | | if (ObjectUtils.isEmpty(dangerById)){
|
| | | resultVO.setMsg("隐患不存在");
|
| | | return resultVO;
|
| | | }
|
| | | if (scoreAndDangerEditLog.getCheckDate() == null){
|
| | | resultVO.setMsg("检查时间不能为空");
|
| | | return resultVO;
|
| | | }
|
| | | if (scoreAndDangerLog.getCheckType() == null){
|
| | | resultVO.setMsg("检查类型不能为空");
|
| | | return resultVO;
|
| | | }
|
| | | TbBaseCheckTask baseCheckTaskByTaskId = baseCheckTaskMapper.getBaseCheckTaskByTaskId(baseCheckItemByItemId.getTaskId());
|
| | | if (ObjectUtils.isEmpty(baseCheckTaskByTaskId)){
|
| | | resultVO.setMsg("专项任务不存在");
|
| | | return resultVO;
|
| | | }
|
| | |
|
| | | LocalDateTime dateTime = LocalDateTime.now();
|
| | |
|
| | | scoreAndDangerLog.setUpdateDate(dateTime);
|
| | | scoreAndDangerLog.setUpdateBy(sysUser.getUserName());
|
| | | scoreAndDangerLog.setReportStatus((byte) 1);
|
| | |
|
| | | scoreAndDangerLog.setDangerName(dangerById.getDangerName());
|
| | | scoreAndDangerLog.setIsReject(baseCheckScoreByScoreId.getIsReject());
|
| | | scoreAndDangerLog.setDeductPoint(baseCheckScoreByScoreId.getDeductPoint());
|
| | | scoreAndDangerLog.setDeductIllustrate(baseCheckScoreByScoreId.getDeductIllustrate());
|
| | | scoreAndDangerLog.setCheckDate(LocalDateTime.ofInstant(scoreAndDangerEditLog.getCheckDate().toInstant(), ZoneId.systemDefault()));
|
| | |
|
| | | int updateResult = scoreAndDangerLogMapper.updateSpecialCheckScoreAndDangerLogById(scoreAndDangerLog);
|
| | | 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<TbSpecialCheckScoreAndDangerLog> deleteTbSpecialScoreAndDangerLog(TbSpecialCheckScoreAndDangerLog scoreAndDangerLog) {
|
| | | User sysUser = getSysUser();
|
| | | ResultVO resultVO = new ResultVO<>();
|
| | | resultVO.setCode(ErrorCodes.REQUEST_PARAM_ERROR.getCode());
|
| | |
|
| | | if (scoreAndDangerLog.getIndexId() == null){
|
| | | resultVO.setMsg("评分项为空");
|
| | | return resultVO;
|
| | | }
|
| | | TbSpecialCheckScoreAndDangerLog specialCheckScoreAndDangerLogByIndexId = scoreAndDangerLogMapper.getSpecialCheckScoreAndDangerLogByIndexId(scoreAndDangerLog.getIndexId());
|
| | | if (ObjectUtils.isEmpty(specialCheckScoreAndDangerLogByIndexId)){
|
| | | resultVO.setMsg("评分项不存在,删除失败");
|
| | | return resultVO;
|
| | | }
|
| | |
|
| | | TbSpecialCheckScoreAndDangerLog tbSpecialCheckItemDangerLog = new TbSpecialCheckScoreAndDangerLog();
|
| | | LocalDateTime dateTime = LocalDateTime.now();
|
| | |
|
| | | tbSpecialCheckItemDangerLog.setIndexId(scoreAndDangerLog.getIndexId());
|
| | | tbSpecialCheckItemDangerLog.setUpdateDate(dateTime);
|
| | | tbSpecialCheckItemDangerLog.setUpdateBy(sysUser.getUserName());
|
| | | tbSpecialCheckItemDangerLog.setReportStatus((byte) 1);
|
| | | tbSpecialCheckItemDangerLog.setDeleted((byte) 1);
|
| | |
|
| | | int deleteResult = scoreAndDangerLogMapper.deleteTbSpecialCheckScoreAndDangerLog(tbSpecialCheckItemDangerLog);
|
| | | 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;
|
| | | }
|
| | |
|
| | | @Override
|
| | | public TbSpecialCheckScoreAndDangerLog getSpecialCheckScoreAndDangerLogById(String id) {
|
| | | return scoreAndDangerLogMapper.getSpecialCheckScoreAndDangerLogById(id);
|
| | | }
|
| | |
|
| | |
|
| | | }
|
| | | 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.CJReport.PreventCJReportDangerInfo; |
| | | import com.ruoyi.doublePrevention.enums.ErrorCodes; |
| | | import com.ruoyi.doublePrevention.enums.ResultCodes; |
| | | import com.ruoyi.doublePrevention.repository.PreventCJReportDangerInfoRepository; |
| | | import com.ruoyi.doublePrevention.vo.ResultVO; |
| | | import com.ruoyi.project.system.user.domain.User; |
| | | import com.ruoyi.project.tr.specialCheck.domin.*; |
| | | import com.ruoyi.project.tr.specialCheck.domin.BO.HandlerSpecialCheckReportParam; |
| | | import com.ruoyi.project.tr.specialCheck.domin.BO.TbSpecialCheckScoreAndDangerLogEditBO; |
| | | import com.ruoyi.project.tr.specialCheck.domin.BO.TbSpecialCheckScoreAndDangerLogQueryBO; |
| | | import com.ruoyi.project.tr.specialCheck.mapper.*; |
| | | import com.ruoyi.project.tr.specialCheck.service.SpecialCheckScoreAndDangerDangerLogService; |
| | | 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.List; |
| | | import java.util.UUID; |
| | | |
| | | import static com.ruoyi.common.utils.security.ShiroUtils.getSysUser; |
| | | |
| | | @Service |
| | | public class SpecialCheckScoreAndDangerLogServiceImpl implements SpecialCheckScoreAndDangerDangerLogService { |
| | | |
| | | @Autowired |
| | | private TbSpecialCheckScoreAndDangerLogMapper scoreAndDangerLogMapper; |
| | | |
| | | @Autowired |
| | | private TbBaseCheckTaskMapper baseCheckTaskMapper; |
| | | |
| | | @Autowired |
| | | private TbBaseCheckItemMapper baseCheckItemMapper; |
| | | |
| | | @Autowired |
| | | private TbBaseCheckScoreMapper baseCheckScoreMapper; |
| | | |
| | | @Autowired |
| | | private PreventCJReportDangerInfoRepository preventCJReportDangerInfoRepository; |
| | | |
| | | @Autowired |
| | | private TbSpecialCheckItemLogMapper specialCheckItemLogMapper; |
| | | |
| | | |
| | | |
| | | @Override |
| | | public ResultVO<List<TbSpecialCheckScoreAndDangerLog>> selectSpecialCheckScoreAndDangerLogPage(TbSpecialCheckScoreAndDangerLogQueryBO scoreAndDangerLogBO) { |
| | | Integer pageIndex = scoreAndDangerLogBO.getPageNum(); |
| | | Integer pageSize = scoreAndDangerLogBO.getPageSize(); |
| | | if (pageIndex == 0 || pageSize == 0){ |
| | | return new ResultVO<>(ErrorCodes.REQUEST_PARAM_ERROR.getCode(),"当前页码或当前页显示数不能为0"); |
| | | } |
| | | |
| | | Page<TbSpecialCheckScoreAndDangerLog> page = PageHelper.startPage(pageIndex, pageSize); |
| | | scoreAndDangerLogMapper.selectSpecialCheckScoreAndDangerLogPage(scoreAndDangerLogBO); |
| | | |
| | | Long total = page.getTotal(); |
| | | int count = total.intValue(); |
| | | List<TbSpecialCheckScoreAndDangerLog> pageResult = null; |
| | | |
| | | ResultVO<List<TbSpecialCheckScoreAndDangerLog>> 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<TbSpecialCheckScoreAndDangerLog> addSpecialScoreAndDanger(TbSpecialCheckScoreAndDangerLogEditBO scoreAndDangerEditLog) { |
| | | User sysUser = getSysUser(); |
| | | ResultVO resultVO = new ResultVO<>(); |
| | | resultVO.setCode(ErrorCodes.REQUEST_PARAM_ERROR.getCode()); |
| | | TbSpecialCheckScoreAndDangerLog scoreAndDangerLog = BeanCopyUtils.copyBean(scoreAndDangerEditLog, TbSpecialCheckScoreAndDangerLog.class); |
| | | |
| | | if (scoreAndDangerLog.getCheckItemId() == null){ |
| | | resultVO.setMsg("检查项不能为空"); |
| | | return resultVO; |
| | | } |
| | | TbBaseCheckItem baseCheckItemByItemId = baseCheckItemMapper.getBaseCheckItemByItemId(scoreAndDangerLog.getCheckItemId()); |
| | | if (ObjectUtils.isEmpty(baseCheckItemByItemId)){ |
| | | resultVO.setMsg("检查项不存在"); |
| | | return resultVO; |
| | | } |
| | | if (scoreAndDangerLog.getCheckScoreId() == null){ |
| | | resultVO.setMsg("评分不能为空"); |
| | | return resultVO; |
| | | } |
| | | TbBaseCheckScore baseCheckScoreByScoreId = baseCheckScoreMapper.getBaseCheckScoreByScoreId(scoreAndDangerLog.getCheckScoreId()); |
| | | if (ObjectUtils.isEmpty(baseCheckScoreByScoreId)){ |
| | | resultVO.setMsg("评分标准不存在"); |
| | | return resultVO; |
| | | } |
| | | if (scoreAndDangerLog.getDangerId() == null){ |
| | | resultVO.setMsg("关联隐患不能为空"); |
| | | return resultVO; |
| | | } |
| | | PreventCJReportDangerInfo dangerById = preventCJReportDangerInfoRepository.getDangerById(scoreAndDangerLog.getDangerId()); |
| | | if (ObjectUtils.isEmpty(dangerById)){ |
| | | resultVO.setMsg("隐患不存在"); |
| | | return resultVO; |
| | | } |
| | | if (scoreAndDangerEditLog.getCheckDate() == null){ |
| | | resultVO.setMsg("检查时间不能为空"); |
| | | return resultVO; |
| | | } |
| | | if (scoreAndDangerLog.getCheckType() == null){ |
| | | resultVO.setMsg("检查类型不能为空"); |
| | | return resultVO; |
| | | } |
| | | TbBaseCheckTask baseCheckTaskByTaskId = baseCheckTaskMapper.getBaseCheckTaskByTaskId(baseCheckItemByItemId.getTaskId()); |
| | | if (ObjectUtils.isEmpty(baseCheckTaskByTaskId)){ |
| | | resultVO.setMsg("专项任务不存在"); |
| | | return resultVO; |
| | | } |
| | | |
| | | LocalDateTime dateTime = LocalDateTime.now(); |
| | | String uuid = UUID.randomUUID().toString(); |
| | | |
| | | scoreAndDangerLog.setId(uuid); |
| | | scoreAndDangerLog.setCompanyCode("652310082"); |
| | | scoreAndDangerLog.setCreateDate(dateTime); |
| | | scoreAndDangerLog.setUpdateDate(dateTime); |
| | | scoreAndDangerLog.setCreateBy(sysUser.getUserName()); |
| | | scoreAndDangerLog.setUpdateBy(sysUser.getUserName()); |
| | | scoreAndDangerLog.setReportStatus((byte) 1); |
| | | scoreAndDangerLog.setReportTime(null); |
| | | scoreAndDangerLog.setDeleted((byte) 0); |
| | | scoreAndDangerLog.setDangerName(dangerById.getDangerName()); |
| | | scoreAndDangerLog.setIsReject(baseCheckScoreByScoreId.getIsReject()); |
| | | scoreAndDangerLog.setDeductPoint(baseCheckScoreByScoreId.getDeductPoint()); |
| | | scoreAndDangerLog.setDeductIllustrate(baseCheckScoreByScoreId.getDeductIllustrate()); |
| | | scoreAndDangerLog.setTaskId(baseCheckItemByItemId.getTaskId()); |
| | | scoreAndDangerLog.setCheckDate(LocalDateTime.ofInstant(scoreAndDangerEditLog.getCheckDate().toInstant(), ZoneId.systemDefault())); |
| | | |
| | | |
| | | |
| | | |
| | | int saveResult = scoreAndDangerLogMapper.save(scoreAndDangerLog); |
| | | if (saveResult == 0){ |
| | | resultVO.setCode(ResultCodes.SERVER_ADD_ERROR.getCode()); |
| | | resultVO.setMsg(ResultCodes.SERVER_ADD_ERROR.getDesc()); |
| | | return resultVO; |
| | | } |
| | | // HandlerSpecialCheckReportParam specialCheckItemLog = new HandlerSpecialCheckReportParam(); |
| | | // specialCheckItemLog.setId(); |
| | | // specialCheckItemLog.setReportStatus((byte) 2); |
| | | // specialCheckItemLog.setReportTime(dateTime); |
| | | // int i = specialCheckItemLogMapper.updateItemDangerReportStatusById(specialCheckItemLog); |
| | | // if (i == 0){ |
| | | // resultVO.setCode(ResultCodes.SERVER_ADD_ERROR.getCode()); |
| | | // resultVO.setMsg("修改检查项状态失败"); |
| | | // return resultVO; |
| | | // } |
| | | resultVO.setCode(ResultCodes.OK.getCode()); |
| | | resultVO.setMsg("新增检查成功"); |
| | | return resultVO; |
| | | } |
| | | |
| | | @Override |
| | | public TbSpecialCheckScoreAndDangerLog getSpecialCheckScoreAndDangerLogByIndexId(Long indexId) { |
| | | return scoreAndDangerLogMapper.getSpecialCheckScoreAndDangerLogByIndexId(indexId); |
| | | } |
| | | |
| | | @Override |
| | | public ResultVO<TbSpecialCheckScoreAndDangerLog> updateSpecialCheckScoreAndDangerLog(TbSpecialCheckScoreAndDangerLogEditBO scoreAndDangerEditLog) { |
| | | User sysUser = getSysUser(); |
| | | ResultVO resultVO = new ResultVO<>(); |
| | | resultVO.setCode(ErrorCodes.REQUEST_PARAM_ERROR.getCode()); |
| | | |
| | | TbSpecialCheckScoreAndDangerLog scoreAndDangerLog = BeanCopyUtils.copyBean(scoreAndDangerEditLog, TbSpecialCheckScoreAndDangerLog.class); |
| | | |
| | | if (scoreAndDangerLog.getCheckItemId() == null){ |
| | | resultVO.setMsg("检查项不能为空"); |
| | | return resultVO; |
| | | } |
| | | TbBaseCheckItem baseCheckItemByItemId = baseCheckItemMapper.getBaseCheckItemByItemId(scoreAndDangerLog.getCheckItemId()); |
| | | if (ObjectUtils.isEmpty(baseCheckItemByItemId)){ |
| | | resultVO.setMsg("检查项不存在"); |
| | | return resultVO; |
| | | } |
| | | if (scoreAndDangerLog.getCheckScoreId() == null){ |
| | | resultVO.setMsg("评分不能为空"); |
| | | return resultVO; |
| | | } |
| | | TbBaseCheckScore baseCheckScoreByScoreId = baseCheckScoreMapper.getBaseCheckScoreByScoreId(scoreAndDangerLog.getCheckScoreId()); |
| | | if (ObjectUtils.isEmpty(baseCheckScoreByScoreId)){ |
| | | resultVO.setMsg("评分标准不存在"); |
| | | return resultVO; |
| | | } |
| | | if (scoreAndDangerLog.getDangerId() == null){ |
| | | resultVO.setMsg("关联隐患不能为空"); |
| | | return resultVO; |
| | | } |
| | | PreventCJReportDangerInfo dangerById = preventCJReportDangerInfoRepository.getDangerById(scoreAndDangerLog.getDangerId()); |
| | | if (ObjectUtils.isEmpty(dangerById)){ |
| | | resultVO.setMsg("隐患不存在"); |
| | | return resultVO; |
| | | } |
| | | if (scoreAndDangerEditLog.getCheckDate() == null){ |
| | | resultVO.setMsg("检查时间不能为空"); |
| | | return resultVO; |
| | | } |
| | | if (scoreAndDangerLog.getCheckType() == null){ |
| | | resultVO.setMsg("检查类型不能为空"); |
| | | return resultVO; |
| | | } |
| | | TbBaseCheckTask baseCheckTaskByTaskId = baseCheckTaskMapper.getBaseCheckTaskByTaskId(baseCheckItemByItemId.getTaskId()); |
| | | if (ObjectUtils.isEmpty(baseCheckTaskByTaskId)){ |
| | | resultVO.setMsg("专项任务不存在"); |
| | | return resultVO; |
| | | } |
| | | |
| | | LocalDateTime dateTime = LocalDateTime.now(); |
| | | |
| | | scoreAndDangerLog.setUpdateDate(dateTime); |
| | | scoreAndDangerLog.setUpdateBy(sysUser.getUserName()); |
| | | scoreAndDangerLog.setReportStatus((byte) 1); |
| | | |
| | | scoreAndDangerLog.setDangerName(dangerById.getDangerName()); |
| | | scoreAndDangerLog.setIsReject(baseCheckScoreByScoreId.getIsReject()); |
| | | scoreAndDangerLog.setDeductPoint(baseCheckScoreByScoreId.getDeductPoint()); |
| | | scoreAndDangerLog.setDeductIllustrate(baseCheckScoreByScoreId.getDeductIllustrate()); |
| | | scoreAndDangerLog.setCheckDate(LocalDateTime.ofInstant(scoreAndDangerEditLog.getCheckDate().toInstant(), ZoneId.systemDefault())); |
| | | |
| | | int updateResult = scoreAndDangerLogMapper.updateSpecialCheckScoreAndDangerLogById(scoreAndDangerLog); |
| | | 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<TbSpecialCheckScoreAndDangerLog> deleteTbSpecialScoreAndDangerLog(TbSpecialCheckScoreAndDangerLog scoreAndDangerLog) { |
| | | User sysUser = getSysUser(); |
| | | ResultVO resultVO = new ResultVO<>(); |
| | | resultVO.setCode(ErrorCodes.REQUEST_PARAM_ERROR.getCode()); |
| | | |
| | | if (scoreAndDangerLog.getIndexId() == null){ |
| | | resultVO.setMsg("评分项为空"); |
| | | return resultVO; |
| | | } |
| | | TbSpecialCheckScoreAndDangerLog specialCheckScoreAndDangerLogByIndexId = scoreAndDangerLogMapper.getSpecialCheckScoreAndDangerLogByIndexId(scoreAndDangerLog.getIndexId()); |
| | | if (ObjectUtils.isEmpty(specialCheckScoreAndDangerLogByIndexId)){ |
| | | resultVO.setMsg("评分项不存在,删除失败"); |
| | | return resultVO; |
| | | } |
| | | |
| | | TbSpecialCheckScoreAndDangerLog tbSpecialCheckItemDangerLog = new TbSpecialCheckScoreAndDangerLog(); |
| | | LocalDateTime dateTime = LocalDateTime.now(); |
| | | |
| | | tbSpecialCheckItemDangerLog.setIndexId(scoreAndDangerLog.getIndexId()); |
| | | tbSpecialCheckItemDangerLog.setUpdateDate(dateTime); |
| | | tbSpecialCheckItemDangerLog.setUpdateBy(sysUser.getUserName()); |
| | | tbSpecialCheckItemDangerLog.setReportStatus((byte) 1); |
| | | tbSpecialCheckItemDangerLog.setDeleted((byte) 1); |
| | | |
| | | int deleteResult = scoreAndDangerLogMapper.deleteTbSpecialCheckScoreAndDangerLog(tbSpecialCheckItemDangerLog); |
| | | 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; |
| | | } |
| | | |
| | | @Override |
| | | public TbSpecialCheckScoreAndDangerLog getSpecialCheckScoreAndDangerLogById(String id) { |
| | | return scoreAndDangerLogMapper.getSpecialCheckScoreAndDangerLogById(id); |
| | | } |
| | | |
| | | |
| | | } |