Commit 97979645 authored by 周昊's avatar 周昊

1、修改固有风险字段

parent 90797942
......@@ -328,10 +328,10 @@ public class RiskPlanAppController extends BaseController {
* 添加固有风险
*
* @param saveDto 固有风险表单
* @real_return {@link R<Integer>}
* @real_return {@link R<Boolean>}
*/
@PostMapping("/inherent")
public R<Integer> saveRiskInherentListSaveDto(RiskInherentListSaveDto saveDto
public R<Boolean> saveRiskInherentListSaveDto(RiskInherentListSaveDto saveDto
, @RequestParam(value = "pictureFile[]", required = false) MultipartFile[] pictureFile
, @RequestParam(value = "measuresProjectFile[]", required = false) MultipartFile[] measuresProjectFile
, @RequestParam(value = "measuresAdministrationFile[]", required = false) MultipartFile[] measuresAdministrationFile
......
package com.censoft.censoftrongtong.domain.dto;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
/**
......@@ -9,74 +12,135 @@ import lombok.Data;
* @date 2023-06-26
*/
@Data
public class RiskInherentListSaveDto{
public class RiskInherentListSaveDto {
/** id */
/**
* id
*/
private Long id;
/** 评估人id */
/**
* 评估人id
*/
private Long userId;
/** 房间id */
/**
* 房间id
*/
private Long roomId;
/** 计划id */
/**
* 计划id
*/
private Long planId;
/** 风险源名称 */
/**
* 风险源名称
*/
private String name;
/** 风险因素 */
/**
* 风险点类型
*/
private String pointType;
/**
* 安全警示标志
*/
private String safetyWarningSigns;
/**
* 风险因素
*/
private String factor;
/** 事故类型 */
/**
* 准事故类型
*/
private String type;
/** 风险等级 */
/**
* 风险等级
*/
private String level;
/** 存在部位 */
/**
* 风险可能性
*/
private String riskLikelihood;
/**
* 后果严重性
*/
private String riskSeverity;
/**
* 存在部位
*/
private String presenceLocation;
/** 风险源照片id */
/**
* 风险源照片id
*/
private String pictureFileIds;
/** 工程技术措施 */
/**
* 工程技术措施
*/
private String measuresProject;
/** 工程技术措施附件 */
/**
* 工程技术措施附件
*/
private String measuresProjectFileIds;
/** 应采取的管理措施 */
/**
* 应采取的管理措施
*/
private String measuresAdministration;
/** 已采取的管理措施 */
private String takenMeasuresAdministration;
/** 管控责任单位id */
/**
* 管控责任单位id
*/
private Long measuresDeptId;
/** 管控责任人id */
private String measuresUserId;
/**
* 管控责任人id
*/
private Long measuresUserId;
/** 管理措施附件 */
/**
* 已采取的管理措施
*/
private String measuresAdministrationFileIds;
/** 危险源名称 */
/**
* 危险源名称
*/
private String hazardSourceName;
/** 是否存在重大危险源 */
/**
* 是否存在重大危险源
*/
private Boolean majorHazardSource;
/** 重大危险源描述 */
private Boolean majorHazardSourceDescription;
/**
* 重大危险源描述
*/
private String majorHazardSourceDescription;
/** 应急处置措施 */
/**
* 应急措施
*/
private String measuresEmergency;
/** 应急处置措施附件 */
/**
* 应急处置措施附件
*/
private String measuresEmergencyFileIds;
/** 参考依据 */
/**
* 参考依据
*/
private String referenceBasis;
}
package com.censoft.censoftrongtong.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.censoft.censoftrongtong.domain.RiskPlanInherentList;
import com.censoft.censoftrongtong.domain.dto.RiskPlanAppExistingListDto;
import com.censoft.censoftrongtong.domain.dto.RiskPlanAppInherentListDetailsDto;
......@@ -14,56 +15,8 @@ import java.util.List;
* @author ruoyi
* @date 2023-06-26
*/
public interface RiskPlanInherentListMapper
public interface RiskPlanInherentListMapper extends BaseMapper<RiskPlanInherentList>
{
/**
* 查询固有风险清单库
*
* @param id 固有风险清单库主键
* @return 固有风险清单库
*/
public RiskPlanInherentList selectRiskPlanInherentListById(Long id);
/**
* 查询固有风险清单库列表
*
* @param riskPlanInherentList 固有风险清单库
* @return 固有风险清单库集合
*/
public List<RiskPlanInherentList> selectRiskPlanInherentListList(RiskPlanInherentList riskPlanInherentList);
/**
* 新增固有风险清单库
*
* @param riskPlanInherentList 固有风险清单库
* @return 结果
*/
public int insertRiskPlanInherentList(RiskPlanInherentList riskPlanInherentList);
/**
* 修改固有风险清单库
*
* @param riskPlanInherentList 固有风险清单库
* @return 结果
*/
public int updateRiskPlanInherentList(RiskPlanInherentList riskPlanInherentList);
/**
* 删除固有风险清单库
*
* @param id 固有风险清单库主键
* @return 结果
*/
public int deleteRiskPlanInherentListById(Long id);
/**
* 批量删除固有风险清单库
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteRiskPlanInherentListByIds(Long[] ids);
List<RiskPlanAppInherentListDto> getInherentListByPlanId(@Param("projectId") Long projectId, @Param("buildingId") Long buildingId, @Param("floorId") Long floorId, @Param("roomId") Long roomId);
RiskPlanAppInherentListDetailsDto getRiskPlanAppInherentListDetailsDtoByInherentId(@Param("inherentId") Long inherentId);
......
package com.censoft.censoftrongtong.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.censoft.censoftrongtong.domain.RiskPlanInherentList;
import com.censoft.censoftrongtong.domain.dto.RiskInherentListSaveDto;
import com.censoft.censoftrongtong.domain.dto.RiskPlanAppExistingListDto;
......@@ -14,59 +15,12 @@ import java.util.List;
* @author ruoyi
* @date 2023-06-26
*/
public interface IRiskPlanInherentListService
public interface IRiskPlanInherentListService extends IService<RiskPlanInherentList>
{
/**
* 查询固有风险清单库
*
* @param id 固有风险清单库主键
* @return 固有风险清单库
*/
public RiskPlanInherentList selectRiskPlanInherentListById(Long id);
/**
* 查询固有风险清单库列表
*
* @param riskPlanInherentList 固有风险清单库
* @return 固有风险清单库集合
*/
public List<RiskPlanInherentList> selectRiskPlanInherentListList(RiskPlanInherentList riskPlanInherentList);
/**
* 新增固有风险清单库
*
* @param riskPlanInherentList 固有风险清单库
* @return 结果
*/
public int insertRiskPlanInherentList(RiskPlanInherentList riskPlanInherentList);
/**
* 修改固有风险清单库
*
* @param riskPlanInherentList 固有风险清单库
* @return 结果
*/
public int updateRiskPlanInherentList(RiskPlanInherentList riskPlanInherentList);
/**
* 批量删除固有风险清单库
*
* @param ids 需要删除的固有风险清单库主键集合
* @return 结果
*/
public int deleteRiskPlanInherentListByIds(Long[] ids);
/**
* 删除固有风险清单库信息
*
* @param id 固有风险清单库主键
* @return 结果
*/
public int deleteRiskPlanInherentListById(Long id);
List<RiskPlanAppInherentListDto> getInherentListByPlanId(Long projectId, Long buildingId, Long floorId, Long roomId);
Integer saveRiskInherentListSaveDto(RiskInherentListSaveDto saveDto);
Boolean saveRiskInherentListSaveDto(RiskInherentListSaveDto saveDto);
RiskPlanAppInherentListDetailsDto getRiskPlanAppInherentListDetailsDtoByInherentId(Long inherentId);
......
package com.censoft.censoftrongtong.service.impl;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.censoft.censoftrongtong.domain.RiskPlan;
import com.censoft.censoftrongtong.domain.RiskPlanInherentList;
import com.censoft.censoftrongtong.domain.RiskPlanTask;
......@@ -25,10 +20,12 @@ import com.ruoyi.system.service.ISysUploadFileService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import cn.hutool.core.date.DateUnit;
import org.springframework.util.StringUtils;
import javax.annotation.Resource;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;
/**
* 固有风险清单库Service业务层处理
......@@ -37,7 +34,9 @@ import javax.annotation.Resource;
* @date 2023-06-26
*/
@Service
public class RiskPlanInherentListServiceImpl implements IRiskPlanInherentListService {
public class RiskPlanInherentListServiceImpl
extends ServiceImpl<RiskPlanInherentListMapper, RiskPlanInherentList>
implements IRiskPlanInherentListService {
@Autowired
private RiskPlanInherentListMapper riskPlanInherentListMapper;
@Autowired
......@@ -52,28 +51,6 @@ public class RiskPlanInherentListServiceImpl implements IRiskPlanInherentListSer
@Resource
private IRiskPlanTaskService riskPlanTaskService;
/**
* 查询固有风险清单库
*
* @param id 固有风险清单库主键
* @return 固有风险清单库
*/
@Override
public RiskPlanInherentList selectRiskPlanInherentListById(Long id) {
return riskPlanInherentListMapper.selectRiskPlanInherentListById(id);
}
/**
* 查询固有风险清单库列表
*
* @param riskPlanInherentList 固有风险清单库
* @return 固有风险清单库
*/
@Override
public List<RiskPlanInherentList> selectRiskPlanInherentListList(RiskPlanInherentList riskPlanInherentList) {
return riskPlanInherentListMapper.selectRiskPlanInherentListList(riskPlanInherentList);
}
/**
* 新增固有风险清单库
*
......@@ -81,7 +58,7 @@ public class RiskPlanInherentListServiceImpl implements IRiskPlanInherentListSer
* @return 结果
*/
@Override
public int insertRiskPlanInherentList(RiskPlanInherentList riskPlanInherentList) {
public boolean save(RiskPlanInherentList riskPlanInherentList) {
/**
* 解题思路
* 1.判断当前任务状态是否待执行状态
......@@ -114,7 +91,7 @@ public class RiskPlanInherentListServiceImpl implements IRiskPlanInherentListSer
riskPlanInherentList.setCreateTime(DateUtils.getNowDate());
return riskPlanInherentListMapper.insertRiskPlanInherentList(riskPlanInherentList);
return riskPlanInherentListMapper.insert(riskPlanInherentList)>0;
}
/**
......@@ -124,7 +101,7 @@ public class RiskPlanInherentListServiceImpl implements IRiskPlanInherentListSer
* @return 结果
*/
@Override
public int updateRiskPlanInherentList(RiskPlanInherentList riskPlanInherentList) {
public boolean updateById(RiskPlanInherentList riskPlanInherentList) {
/**
* 解题思路
* 1.判断当前任务状态是否待执行状态
......@@ -155,65 +132,24 @@ public class RiskPlanInherentListServiceImpl implements IRiskPlanInherentListSer
}
}
riskPlanInherentList.setUpdateTime(DateUtils.getNowDate());
return riskPlanInherentListMapper.updateRiskPlanInherentList(riskPlanInherentList);
}
/**
* 批量删除固有风险清单库
*
* @param ids 需要删除的固有风险清单库主键
* @return 结果
*/
@Override
public int deleteRiskPlanInherentListByIds(Long[] ids) {
/**
* 解题思路
* 1.判断当前任务状态是否待执行状态
* 2.待执行修改执行状态变为已完成否则不操作
* 3.改为已完成添加任务执行记录
*/
RiskPlanInherentList riskPlanInherentList=riskPlanInherentListMapper.selectRiskPlanInherentListById(ids[0]);
RiskPlanTask riskPlanTask=riskPlanTaskMapper.getLastRiskPlanTaskByPlanId(riskPlanInherentList.getPlanId());
//计划
RiskPlan riskPlan = riskPlanMapper.selectRiskPlanById(riskPlanTask.getPlanId());
if (riskPlanTask!=null) {
if (riskPlanTask.getTaskKey().equals("WAIT_START")&&riskPlanTask.getStatus().equals("running")) {
//修改任务状态
riskPlanTask.setStatus("completed");
riskPlanTask.setCompletedTime(new Date());
int rs=riskPlanTaskMapper.updateRiskPlanTask(riskPlanTask);
if (rs>-1) {//修改状态成功
System.out.println("修改状态成功");
}
//创建任务执行状态
RiskPlanTask riskPlanTask1 = new RiskPlanTask();
riskPlanTask1.setPlanId(riskPlanTask.getPlanId());
riskPlanTask1.setApprovalUserId(riskPlan.getLeaderUserId());
riskPlanTask1.setTaskKey(RiskPlanStatusType.RUNNING.getStatus());
riskPlanTask1.setTaskName(RiskPlanStatusType.RUNNING.getTitle());
riskPlanTask1.setStatus("running");
riskPlanTask1.setStartTime(new Date());
riskPlanTaskService.insertRiskPlanTask(riskPlanTask1);
}
}
return riskPlanInherentListMapper.deleteRiskPlanInherentListByIds(ids);
return riskPlanInherentListMapper.updateById(riskPlanInherentList)>0;
}
/**
* 删除固有风险清单库信息
*
* @param id 固有风险清单库主键
* @param entity 固有风险清单库主键
* @return 结果
*/
@Override
public int deleteRiskPlanInherentListById(Long id) {
public boolean removeById(RiskPlanInherentList entity) {
/**
* 解题思路
* 1.判断当前任务状态是否待执行状态
* 2.待执行修改执行状态变为已完成否则不操作
* 3.改为已完成添加任务执行记录
*/
RiskPlanInherentList riskPlanInherentList=riskPlanInherentListMapper.selectRiskPlanInherentListById(id);
RiskPlanInherentList riskPlanInherentList=riskPlanInherentListMapper.selectById(entity.getId());
RiskPlanTask riskPlanTask=riskPlanTaskMapper.getLastRiskPlanTaskByPlanId(riskPlanInherentList.getPlanId());
//计划
RiskPlan riskPlan = riskPlanMapper.selectRiskPlanById(riskPlanTask.getPlanId());
......@@ -237,7 +173,7 @@ public class RiskPlanInherentListServiceImpl implements IRiskPlanInherentListSer
riskPlanTaskService.insertRiskPlanTask(riskPlanTask1);
}
}
return riskPlanInherentListMapper.deleteRiskPlanInherentListById(id);
return riskPlanInherentListMapper.deleteById(entity.getId())>0;
}
@Override
......@@ -246,10 +182,10 @@ public class RiskPlanInherentListServiceImpl implements IRiskPlanInherentListSer
}
@Override
public Integer saveRiskInherentListSaveDto(RiskInherentListSaveDto saveDto) {
public Boolean saveRiskInherentListSaveDto(RiskInherentListSaveDto saveDto) {
RiskPlanInherentList inherentList = new RiskPlanInherentList();
BeanUtils.copyProperties(saveDto, inherentList);
return insertRiskPlanInherentList(inherentList);
return save(inherentList);
}
@Override
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment