| | |
| | | package com.ruoyi.doublePrevention.service.impl;
|
| | |
|
| | | import com.ruoyi.doublePrevention.entity.PreventRiskUnitUuid;
|
| | | import com.github.pagehelper.Page;
|
| | | import com.github.pagehelper.PageHelper;
|
| | | import com.ruoyi.common.constant.TrHiddenDangerCheckConstants;
|
| | | import com.ruoyi.common.utils.StringUtils;
|
| | | import com.ruoyi.common.utils.text.Convert;
|
| | | import com.ruoyi.doublePrevention.entity.*;
|
| | | import com.ruoyi.doublePrevention.entity.dto.req.*;
|
| | | import com.ruoyi.doublePrevention.entity.dto.resp.*;
|
| | | import com.ruoyi.doublePrevention.enums.ErrorCodes;
|
| | | import com.ruoyi.doublePrevention.enums.ResultCodes;
|
| | | import com.ruoyi.doublePrevention.enums.StatusEnum;
|
| | | import com.ruoyi.doublePrevention.enums.SyncEnum;
|
| | | import com.ruoyi.doublePrevention.repository.param.PreventPointAndMeasureParams;
|
| | | import com.ruoyi.doublePrevention.service.RiskService;
|
| | | import com.ruoyi.doublePrevention.service.baseService.PreventRiskUnitUuidService;
|
| | | import com.ruoyi.doublePrevention.service.baseService.*;
|
| | | import com.ruoyi.doublePrevention.vo.ResultVO;
|
| | | import com.ruoyi.project.system.user.domain.User;
|
| | | import com.ruoyi.project.tr.HiddenDangerCheckJob.domain.HiddenDangerCheckJob;
|
| | | import com.ruoyi.project.tr.HiddenDangerCheckJob.mapper.HiddenDangerCheckJobMapper;
|
| | | import com.ruoyi.project.tr.hiddenDangerCheck.domain.HiddenDangerCheck;
|
| | | import com.ruoyi.project.tr.hiddenDangerCheckPoint.domain.HiddenDangerCheckPoint;
|
| | | import org.apache.commons.lang3.ObjectUtils;
|
| | | import org.springframework.beans.BeanUtils;
|
| | | import org.springframework.beans.factory.annotation.Autowired;
|
| | | import org.springframework.stereotype.Service;
|
| | | import org.springframework.transaction.annotation.Transactional;
|
| | |
|
| | | import java.util.UUID;
|
| | | import java.util.*;
|
| | | import java.util.stream.Collectors;
|
| | |
|
| | | import static com.ruoyi.common.utils.security.ShiroUtils.getSysUser;
|
| | |
|
| | | @Service("RiskService")
|
| | | public class RiskServiceImpl implements RiskService {
|
| | |
|
| | | @Autowired
|
| | | private PreventRiskUnitUuidService preventRiskUnitUuidService;
|
| | |
|
| | | @Autowired
|
| | | private PreventRiskEventService preventRiskEventService;
|
| | | |
| | | @Autowired
|
| | | private PreventReportConfigService preventReportConfigService;
|
| | |
|
| | | @Autowired
|
| | | private PreventRiskListService preventRiskListService;
|
| | |
|
| | | @Autowired
|
| | | private PreventRiskControlTemplateService riskControlTemplateService;
|
| | |
|
| | | @Autowired
|
| | | private PreventRiskControlMeasureService riskControlMeasureService;
|
| | |
|
| | | @Autowired
|
| | | private PreventRiskCheckUnitService preventRiskCheckUnitService;
|
| | |
|
| | | @Autowired
|
| | | private PreventRiskJobAndMeasureService preventRiskJobAndMeasureService;
|
| | |
|
| | | @Autowired
|
| | | private HiddenDangerCheckJobMapper hiddenDangerCheckJobMapper;
|
| | |
|
| | | @Autowired
|
| | | private PreventRiskDangerCheckLogService preventRiskDangerCheckLogService;
|
| | |
|
| | | @Autowired
|
| | | private PreventRiskDangerCheckAndMeasureService preventRiskDangerCheckAndMeasureService;
|
| | |
|
| | | @Autowired
|
| | | private PreventRiskDangerInfoService preventRiskDangerInfoService;
|
| | |
|
| | | /**
|
| | | * 为设施设备清单附属表添加uuid
|
| | |
| | |
|
| | | String uuid = UUID.randomUUID().toString();
|
| | | PreventRiskUnitUuid riskUnitUuid = new PreventRiskUnitUuid();
|
| | | //封装参数 todo
|
| | | //封装参数
|
| | | riskUnitUuid.setRiskUnitId(id);
|
| | | riskUnitUuid.setRiskUnitUuid(uuid);
|
| | | riskUnitUuid.setDeleteStatus(StatusEnum.DELETE_STATUS_USE.getCode());
|
| | |
|
| | | //获取上报主配置信息
|
| | | PreventReportConfig reportConfigById = preventReportConfigService.getReportConfigById(SyncEnum.REPORT_CONFIG_RISK_ANA_UNIT.getCode());
|
| | | //设置本条数据上报更新时间
|
| | | riskUnitUuid.setUpdateReportDataTime(new Date());
|
| | | //读取上报主配置,进行任务记录上报配置,如果开启上报功能,且设置为自动上报,开启上报相关配置
|
| | | if (reportConfigById.getReportState() == SyncEnum.REPORT_ON.getCode()
|
| | | && reportConfigById.getReportType() == SyncEnum.REPORT_HAND_EXEC_CONFIG.getCode()){
|
| | | //设置上报状态为-等待上报
|
| | | riskUnitUuid.setReportStatus(SyncEnum.SYNC_WAIT_EXEC.getCode());
|
| | | //设置本条数据上报开关为-开启
|
| | | riskUnitUuid.setReportSwitch(SyncEnum.REPORT_ON.getCode());
|
| | | //其他情况默认不开启上报数据,如果是手动上报,可对单条数据进行操作
|
| | | }else {
|
| | | //设置上报状态为-不上报
|
| | | riskUnitUuid.setReportStatus(SyncEnum.SYNC_NOT_EXEC.getCode());
|
| | | //设置本条数据上报开关为-关闭
|
| | | riskUnitUuid.setReportSwitch(SyncEnum.REPORT_OFF.getCode());
|
| | | }
|
| | |
|
| | | return preventRiskUnitUuidService.insertRiskUnitUuid(riskUnitUuid);
|
| | | }
|
| | | }
|
| | |
|
| | | /**
|
| | | * 修改风险清单附属表
|
| | | */
|
| | | @Override
|
| | | public int updateRiskUnit(Long riskListId) {
|
| | |
|
| | | PreventRiskUnitUuid riskUnitUuid = new PreventRiskUnitUuid();
|
| | | //封装参数
|
| | | riskUnitUuid.setRiskUnitId(riskListId);
|
| | |
|
| | | //获取上报主配置信息
|
| | | PreventReportConfig reportConfigById = preventReportConfigService.getReportConfigById(SyncEnum.REPORT_CONFIG_RISK_ANA_UNIT.getCode());
|
| | | //设置本条数据上报更新时间
|
| | | riskUnitUuid.setUpdateReportDataTime(new Date());
|
| | | //读取上报主配置,进行任务记录上报配置,如果开启上报功能,且设置为自动上报,开启上报相关配置
|
| | | if (reportConfigById.getReportState() == SyncEnum.REPORT_ON.getCode()
|
| | | && reportConfigById.getReportType() == SyncEnum.REPORT_HAND_EXEC_CONFIG.getCode()){
|
| | | //设置上报状态为-等待上报
|
| | | riskUnitUuid.setReportStatus(SyncEnum.SYNC_WAIT_EXEC.getCode());
|
| | | //设置本条数据上报开关为-开启
|
| | | riskUnitUuid.setReportSwitch(SyncEnum.REPORT_ON.getCode());
|
| | | //其他情况默认不开启上报数据,如果是手动上报,可对单条数据进行操作
|
| | | }else {
|
| | | //设置上报状态为-不上报
|
| | | riskUnitUuid.setReportStatus(SyncEnum.SYNC_NOT_EXEC.getCode());
|
| | | //设置本条数据上报开关为-关闭
|
| | | riskUnitUuid.setReportSwitch(SyncEnum.REPORT_OFF.getCode());
|
| | | }
|
| | |
|
| | | return preventRiskUnitUuidService.updateRiskUnitUuid(riskUnitUuid);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 删除附属表信息
|
| | | */
|
| | | @Override
|
| | | public int deleteRiskUnit(String ids) {
|
| | | String[] riskIds = Convert.toStrArray(ids);
|
| | |
|
| | | return preventRiskUnitUuidService.deleteRiskUnit(riskIds);
|
| | | }
|
| | |
|
| | |
|
| | | /**
|
| | | * 风险事件-新增
|
| | | */
|
| | | @Override
|
| | | public ResultVO<PreventRiskEvent> saveRiskEvent(PreventRiskEventSaveReqDTO riskEventSaveReqDTO) {
|
| | | User sysUser = getSysUser();
|
| | | ResultVO resultVO = new ResultVO<>();
|
| | | resultVO.setCode(ErrorCodes.REQUEST_PARAM_ERROR.getCode());
|
| | | Long riskUnitId = riskEventSaveReqDTO.getRiskUnitId();
|
| | | String riskEventName = riskEventSaveReqDTO.getRiskEventName();
|
| | | String eventResult = riskEventSaveReqDTO.getEventResult();
|
| | |
|
| | | if (riskUnitId == null){
|
| | | resultVO.setMsg("安全风险分析单元名称不能为空");
|
| | | return resultVO;
|
| | | }
|
| | | PreventRiskUnitUuid riskUnit = preventRiskUnitUuidService.getRiskUnitUuidById(riskUnitId);
|
| | | if (riskUnit == null){
|
| | | resultVO.setMsg("安全风险分析单元名称不存在");
|
| | | return resultVO;
|
| | | }
|
| | | if (StringUtils.isEmpty(riskEventName)){
|
| | | resultVO.setMsg("安全风险事件名称不能为空");
|
| | | return resultVO;
|
| | | }
|
| | | PreventRiskEvent riskEventByEventName = preventRiskEventService.getPreventRiskEventByEventName(riskEventName);
|
| | | if (riskEventByEventName != null){
|
| | | resultVO.setMsg("安全风险事件名称已存在");
|
| | | return resultVO;
|
| | | }
|
| | | if (StringUtils.isEmpty(eventResult)){
|
| | | resultVO.setMsg("可能造成得后果不能为空");
|
| | | return resultVO;
|
| | | }
|
| | |
|
| | | Date date = new Date();
|
| | | String uuid = UUID.randomUUID().toString();
|
| | | PreventRiskEvent riskEvent = new PreventRiskEvent();
|
| | | riskEvent.setUuid(uuid);
|
| | | riskEvent.setEventResult(eventResult);
|
| | | riskEvent.setRiskEventName(riskEventName);
|
| | | riskEvent.setRiskUnitId(riskUnitId);
|
| | | riskEvent.setRiskUnitUuid(riskUnit.getRiskUnitUuid());
|
| | | riskEvent.setDeleteStatus(StatusEnum.DELETE_STATUS_USE.getCode());
|
| | | riskEvent.setGmtCreate(date);
|
| | | riskEvent.setGmtModitify(date);
|
| | | riskEvent.setCreateByUserName(sysUser.getUserName());
|
| | | riskEvent.setLastEditUserName(sysUser.getUserName());
|
| | | //todo 对所属企业id和uuid没有进行设置
|
| | | PreventReportConfig reportConfigById = preventReportConfigService.getReportConfigById(SyncEnum.REPORT_CONFIG_RISK_ANA_UNIT.getCode());
|
| | | //设置上报时间为空
|
| | | riskEvent.setReportTime(null);
|
| | | //设置本条数据上报更新时间
|
| | | riskEvent.setUpdateReportDataTime(date);
|
| | | //读取上报主配置,进行任务记录上报配置,如果开启上报功能,且设置为自动上报,开启上报相关配置
|
| | | if (reportConfigById.getReportState() == SyncEnum.REPORT_ON.getCode()
|
| | | && reportConfigById.getReportType() == SyncEnum.REPORT_HAND_EXEC_CONFIG.getCode()){
|
| | | //设置上报状态为-等待上报
|
| | | riskEvent.setReportStatus(SyncEnum.SYNC_WAIT_EXEC.getCode());
|
| | | //设置本条数据上报开关为-开启
|
| | | riskEvent.setReportSwitch(SyncEnum.REPORT_ON.getCode());
|
| | | //其他情况默认不开启上报数据,如果是手动上报,可对单条数据进行操作
|
| | | }else {
|
| | | //设置上报状态为-不上报
|
| | | riskEvent.setReportStatus(SyncEnum.SYNC_NOT_EXEC.getCode());
|
| | | //设置本条数据上报开关为-关闭
|
| | | riskEvent.setReportSwitch(SyncEnum.REPORT_OFF.getCode());
|
| | | }
|
| | | |
| | | int saveResult = preventRiskEventService.savePreventRiskEvent(riskEvent);
|
| | | 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;
|
| | | }
|
| | |
|
| | | /**
|
| | | * @description 风险事件-删除
|
| | | */
|
| | | @Override
|
| | | public ResultVO<PreventRiskEvent> deleteRiskEvent(PreventRiskEventDeleteReqDTO riskEventDeleteReqDTO) {
|
| | | User sysUser = getSysUser();
|
| | | ResultVO resultVO = new ResultVO<>();
|
| | | resultVO.setCode(ErrorCodes.REQUEST_PARAM_ERROR.getCode());
|
| | |
|
| | | Long eventId = riskEventDeleteReqDTO.getId();
|
| | | if (eventId == null){
|
| | | resultVO.setMsg("安全风险事件Id为空,删除失败");
|
| | | return resultVO;
|
| | | }
|
| | | PreventRiskEvent riskEvent = preventRiskEventService.getPreventRiskEventById(eventId);
|
| | | if (riskEvent == null){
|
| | | resultVO.setMsg("安全风险事件不存在,删除失败");
|
| | | return resultVO;
|
| | | }
|
| | | Date date = new Date();
|
| | | riskEvent.setGmtModitify(date);
|
| | | riskEvent.setLastEditUserName(sysUser.getUserName());
|
| | | riskEvent.setUpdateReportDataTime(date);
|
| | |
|
| | | int deleteResult = preventRiskEventService.deletePreventRiskEventById(riskEvent);
|
| | | 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 ResultVO<PreventRiskEvent> updateRiskEvent(PreventRiskEventUpdateReqDTO riskEventUpdateReqDTO) {
|
| | | User sysUser = getSysUser();
|
| | | ResultVO resultVO = new ResultVO<>();
|
| | | resultVO.setCode(ErrorCodes.REQUEST_PARAM_ERROR.getCode());
|
| | | Long riskEventId = riskEventUpdateReqDTO.getId();
|
| | | Long riskUnitId = riskEventUpdateReqDTO.getRiskUnitId();
|
| | | String riskEventName = riskEventUpdateReqDTO.getRiskEventName();
|
| | | String eventResult = riskEventUpdateReqDTO.getEventResult();
|
| | | if (riskEventId == null){
|
| | | resultVO.setMsg("安全风险事件ID不能为空");
|
| | | return resultVO;
|
| | | }
|
| | | if (riskUnitId == null){
|
| | | resultVO.setMsg("安全风险分析单元名称不能为空");
|
| | | return resultVO;
|
| | | }
|
| | | PreventRiskUnitUuid riskUnit = preventRiskUnitUuidService.getRiskUnitUuidById(riskUnitId);
|
| | | if (riskUnit == null){
|
| | | resultVO.setMsg("安全风险分析单元名称不存在");
|
| | | return resultVO;
|
| | | }
|
| | | if (StringUtils.isEmpty(riskEventName)){
|
| | | resultVO.setMsg("安全风险事件名称不能为空");
|
| | | return resultVO;
|
| | | }
|
| | | PreventRiskEvent riskEventByEventName = preventRiskEventService.getPreventRiskEventByEventName(riskEventName);
|
| | | if (riskEventByEventName != null){
|
| | | if (!riskEventId.equals(riskEventByEventName.getId())){
|
| | | resultVO.setMsg("安全风险事件名称已存在");
|
| | | return resultVO;
|
| | | }
|
| | | }
|
| | | if (StringUtils.isEmpty(eventResult)){
|
| | | resultVO.setMsg("可能造成得后果不能为空");
|
| | | return resultVO;
|
| | | }
|
| | |
|
| | | Date date = new Date();
|
| | | PreventRiskEvent preventRiskEvent = new PreventRiskEvent();
|
| | | BeanUtils.copyProperties(riskEventUpdateReqDTO,preventRiskEvent);
|
| | | preventRiskEvent.setGmtModitify(date);
|
| | | preventRiskEvent.setLastEditUserName(sysUser.getUserName());
|
| | | //获取上报主配置信息
|
| | | PreventReportConfig reportConfigById = preventReportConfigService.getReportConfigById(SyncEnum.REPORT_CONFIG_RISK_ANA_UNIT.getCode());
|
| | | //设置本条数据上报更新时间
|
| | | preventRiskEvent.setUpdateReportDataTime(date);
|
| | | //读取上报主配置,进行任务记录上报配置,如果开启上报功能,且设置为自动上报,开启上报相关配置
|
| | | if (reportConfigById.getReportState() == SyncEnum.REPORT_ON.getCode()
|
| | | && reportConfigById.getReportType() == SyncEnum.REPORT_HAND_EXEC_CONFIG.getCode()){
|
| | | //设置上报状态为-等待上报
|
| | | preventRiskEvent.setReportStatus(SyncEnum.SYNC_WAIT_EXEC.getCode());
|
| | | //设置本条数据上报开关为-开启
|
| | | preventRiskEvent.setReportSwitch(SyncEnum.REPORT_ON.getCode());
|
| | | //其他情况默认不开启上报数据,如果是手动上报,可对单条数据进行操作
|
| | | }else {
|
| | | //设置上报状态为-不上报
|
| | | preventRiskEvent.setReportStatus(SyncEnum.SYNC_NOT_EXEC.getCode());
|
| | | //设置本条数据上报开关为-关闭
|
| | | preventRiskEvent.setReportSwitch(SyncEnum.REPORT_OFF.getCode());
|
| | | }
|
| | |
|
| | | int updateResult = preventRiskEventService.updatePreventRiskEventById(preventRiskEvent);
|
| | |
|
| | | 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;
|
| | | }
|
| | |
|
| | | /**
|
| | | * @description 根据风险事件的id查询风险事件
|
| | | */
|
| | | @Override
|
| | | public ResultVO<PreventRiskEventRespDTO> getRiskEventById(PreventRiskEventGetReqDTO riskEventGetReqDTO) {
|
| | | Long eventId = riskEventGetReqDTO.getId();
|
| | | ResultVO resultVO = new ResultVO<>();
|
| | | resultVO.setCode(ErrorCodes.REQUEST_PARAM_ERROR.getCode());
|
| | | if (eventId == null){
|
| | | resultVO.setMsg("安全风险事件ID不能为空");
|
| | | return resultVO;
|
| | | }
|
| | | PreventRiskEvent riskEvent = preventRiskEventService.getPreventRiskEventById(eventId);
|
| | | if (riskEvent == null){
|
| | | resultVO.setMsg("安全风险事件不存在");
|
| | | return resultVO;
|
| | | }
|
| | | PreventRiskEventRespDTO respDTO = new PreventRiskEventRespDTO();
|
| | | BeanUtils.copyProperties(riskEvent,respDTO);
|
| | | resultVO.setCode(ResultCodes.OK.getCode());
|
| | | resultVO.setMsg(ResultCodes.OK.getDesc());
|
| | | resultVO.setData(respDTO);
|
| | | return resultVO;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 风险事件-分页查询
|
| | | * @return
|
| | | */
|
| | | @Override
|
| | | public ResultVO<List<PreventRiskEventPageQueryRespDTO>> listRiskEventPage(PreventRiskEventPageQueryReqDTO riskEventQueryReqDTO) {
|
| | | Integer pageIndex = riskEventQueryReqDTO.getPageIndex();
|
| | | Integer pageSize = riskEventQueryReqDTO.getPageSize();
|
| | | if (pageIndex == 0 || pageSize == 0){
|
| | | return new ResultVO<>(ErrorCodes.REQUEST_PARAM_ERROR.getCode(),"当前页码或当前页显示数不能为0");
|
| | | }
|
| | | Long riskUnitId = riskEventQueryReqDTO.getRiskUnitId();
|
| | | String riskEventName = riskEventQueryReqDTO.getRiskEventName();
|
| | | Page<PreventRiskEvent> page = PageHelper.startPage(pageIndex, pageSize);
|
| | | preventRiskEventService.listRiskEvenByCondition(riskUnitId,riskEventName);
|
| | |
|
| | | List<PreventRiskEvent> result = page.getResult();
|
| | | Long total = page.getTotal();
|
| | | int count = total.intValue();
|
| | | List<PreventRiskEventPageQueryRespDTO> pageResult = null;
|
| | | if (result != null) {
|
| | | pageResult = result.stream().map((preventRiskEvent) -> {
|
| | | PreventRiskEventPageQueryRespDTO dto = new PreventRiskEventPageQueryRespDTO();
|
| | | BeanUtils.copyProperties(preventRiskEvent, dto);
|
| | | Long unitId = dto.getRiskUnitId();
|
| | | if (unitId != null) {
|
| | | PreventRiskList riskList = preventRiskListService.getPreventRiskListById(unitId);
|
| | | if (riskList != null) {
|
| | | dto.setRiskUnitName(riskList.getRiskListName());
|
| | | }
|
| | | }
|
| | | return dto;
|
| | | }).collect(Collectors.toList());
|
| | | }
|
| | |
|
| | | ResultVO<List<PreventRiskEventPageQueryRespDTO>> resultVO = new ResultVO<>(ResultCodes.OK,pageResult);
|
| | | resultVO.setCount(count);
|
| | | return resultVO;
|
| | | }
|
| | |
|
| | | /**
|
| | | * @description 获取所有风险事件不分页
|
| | | */
|
| | | @Override
|
| | | public ResultVO<List<PreventRiskEventListQueryRespDTO>> listRiskEvent() {
|
| | | List<PreventRiskEvent> riskEvents = preventRiskEventService.listRiskEvenByCondition(null, null);
|
| | | List<PreventRiskEventListQueryRespDTO> riskEventList = null;
|
| | | if (riskEvents != null){
|
| | | riskEventList = riskEvents.stream().map((riskEvent)->{
|
| | | PreventRiskEventListQueryRespDTO dto = new PreventRiskEventListQueryRespDTO();
|
| | | BeanUtils.copyProperties(riskEvent,dto);
|
| | | return dto;
|
| | | }).collect(Collectors.toList());
|
| | | }
|
| | | return new ResultVO<>(ResultCodes.OK,riskEventList);
|
| | | }
|
| | |
|
| | | /**
|
| | | * @description 新增风险管控措施
|
| | | */
|
| | | @Override
|
| | | public ResultVO<PreventRiskControlMeasure> saveRiskControlMeasure(PreventRiskControlMeasureSaveReqDTO measureSaveReqDTO) {
|
| | | User sysUser = getSysUser();
|
| | | ResultVO resultVO = new ResultVO<>();
|
| | | resultVO.setCode(ErrorCodes.REQUEST_PARAM_ERROR.getCode());
|
| | | Long riskEventId = measureSaveReqDTO.getRiskEventId();
|
| | | if (riskEventId == null){
|
| | | resultVO.setMsg("安全风险事件ID不能为空");
|
| | | return resultVO;
|
| | | }
|
| | | PreventRiskEvent riskEvent = preventRiskEventService.getPreventRiskEventById(riskEventId);
|
| | | if (riskEvent == null){
|
| | | resultVO.setMsg("安全风险事件不存在");
|
| | | return resultVO;
|
| | | }
|
| | | String controlMeasureCode = measureSaveReqDTO.getControlMeasureCode();
|
| | | if (controlMeasureCode.isEmpty()){
|
| | | resultVO.setMsg("风险措施编码不能为空");
|
| | | return resultVO;
|
| | | }
|
| | | PreventRiskControlMeasure riskControlMeasure = riskControlMeasureService.getPreventRiskControlMeasureByControlMeasureCode(controlMeasureCode);
|
| | | if (riskControlMeasure != null){
|
| | | resultVO.setMsg("风险措施编码已存在");
|
| | | return resultVO;
|
| | | }
|
| | | if (measureSaveReqDTO.getControlType() == null){
|
| | | resultVO.setMsg("管控方式不能为空");
|
| | | return resultVO;
|
| | | }
|
| | | if (measureSaveReqDTO.getCheckContent().isEmpty()){
|
| | | resultVO.setMsg("管控内容不能为空");
|
| | | return resultVO;
|
| | | }
|
| | | if (measureSaveReqDTO.getClassify1() == null){
|
| | | resultVO.setMsg("管控措施分类1不能为空");
|
| | | return resultVO;
|
| | | }
|
| | | if (measureSaveReqDTO.getClassify2() == null){
|
| | | resultVO.setMsg("管控措施分类2不能为空");
|
| | | return resultVO;
|
| | | }
|
| | | if (measureSaveReqDTO.getMeasureDesc().isEmpty()){
|
| | | resultVO.setMsg("措施说明不能为空");
|
| | | return resultVO;
|
| | | }
|
| | | Date date = new Date();
|
| | | String uuid = UUID.randomUUID().toString();
|
| | | |
| | | PreventRiskControlMeasure controlMeasure = new PreventRiskControlMeasure();
|
| | | BeanUtils.copyProperties(measureSaveReqDTO,controlMeasure);
|
| | | controlMeasure.setUuid(uuid);
|
| | | controlMeasure.setDeleteStatus(StatusEnum.DELETE_STATUS_USE.getCode());
|
| | | controlMeasure.setGmtCreate(date);
|
| | | controlMeasure.setGmtModitify(date);
|
| | | controlMeasure.setLastEditUserName(sysUser.getUserName());
|
| | | controlMeasure.setCreateByUserName(sysUser.getUserName());
|
| | | controlMeasure.setRiskEventUuid(riskEvent.getUuid());
|
| | |
|
| | | //todo 对所属企业id和uuid没有进行设置
|
| | | PreventReportConfig reportConfigById = preventReportConfigService.getReportConfigById(SyncEnum.REPORT_CONFIG_RISK_ANA_UNIT.getCode());
|
| | | //设置上报时间为空
|
| | | controlMeasure.setReportTime(null);
|
| | | //设置本条数据上报更新时间
|
| | | controlMeasure.setUpdateReportDataTime(date);
|
| | | //读取上报主配置,进行任务记录上报配置,如果开启上报功能,且设置为自动上报,开启上报相关配置
|
| | | if (reportConfigById.getReportState() == SyncEnum.REPORT_ON.getCode()
|
| | | && reportConfigById.getReportType() == SyncEnum.REPORT_HAND_EXEC_CONFIG.getCode()){
|
| | | //设置上报状态为-等待上报
|
| | | controlMeasure.setReportStatus(SyncEnum.SYNC_WAIT_EXEC.getCode());
|
| | | //设置本条数据上报开关为-开启
|
| | | controlMeasure.setReportSwitch(SyncEnum.REPORT_ON.getCode());
|
| | | //其他情况默认不开启上报数据,如果是手动上报,可对单条数据进行操作
|
| | | }else {
|
| | | //设置上报状态为-不上报
|
| | | controlMeasure.setReportStatus(SyncEnum.SYNC_NOT_EXEC.getCode());
|
| | | //设置本条数据上报开关为-关闭
|
| | | controlMeasure.setReportSwitch(SyncEnum.REPORT_OFF.getCode());
|
| | | }
|
| | |
|
| | | int saveResult = riskControlMeasureService.savePreventRiskControlMeasure(controlMeasure);
|
| | | 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 ResultVO<List<PreventRiskMeasureTemplatesListQueryRespDTO>> listMeasureTemplates() {
|
| | | List<PreventRiskControlTemplate> riskControlTemplates = riskControlTemplateService.listMeasureTemplates();
|
| | |
|
| | | List<PreventRiskMeasureTemplatesListQueryRespDTO> listResult = null;
|
| | | if (riskControlTemplates != null){
|
| | | listResult = riskControlTemplates.stream().map((riskControlTemplate)->{
|
| | | PreventRiskMeasureTemplatesListQueryRespDTO dto = new PreventRiskMeasureTemplatesListQueryRespDTO();
|
| | | BeanUtils.copyProperties(riskControlTemplate,dto);
|
| | | return dto;
|
| | | }).collect(Collectors.toList());
|
| | | }
|
| | | return new ResultVO<>(ResultCodes.OK,listResult);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 管控措施-删除
|
| | | */
|
| | | @Override
|
| | | public ResultVO<PreventRiskControlMeasure> deleteRiskControlMeasure(PreventRiskControlMeasureDeleteReqDTO measureDeleteReqDTO) {
|
| | | User sysUser = getSysUser();
|
| | | ResultVO resultVO = new ResultVO<>();
|
| | | resultVO.setCode(ErrorCodes.REQUEST_PARAM_ERROR.getCode());
|
| | |
|
| | | Long measureId = measureDeleteReqDTO.getId();
|
| | | if (measureId == null){
|
| | | resultVO.setMsg("风险管控措施Id为空,删除失败");
|
| | | return resultVO;
|
| | | }
|
| | | PreventRiskControlMeasure controlMeasure = riskControlMeasureService.getPreventRiskControlMeasureById(measureId);
|
| | | if (controlMeasure == null){
|
| | | resultVO.setMsg("风险管控措施不存在,删除失败");
|
| | | return resultVO;
|
| | | }
|
| | | Date date = new Date();
|
| | | controlMeasure.setGmtModitify(date);
|
| | | controlMeasure.setLastEditUserName(sysUser.getUserName());
|
| | | controlMeasure.setUpdateReportDataTime(date);
|
| | |
|
| | | int deleteResult = riskControlMeasureService.deletePreventRiskControlMeasureById(controlMeasure);
|
| | | 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;
|
| | | }
|
| | |
|
| | | /**
|
| | | * @description 根据风险措施id查询风险措施
|
| | | */
|
| | | @Override
|
| | | public ResultVO<PreventRiskControlMeasureRespDTO> getRiskControlMeasure(PreventRiskControlMeasureGetReqDTO riskControlMeasureGetReqDTO) {
|
| | | ResultVO resultVO = new ResultVO<>();
|
| | | resultVO.setCode(ErrorCodes.REQUEST_PARAM_ERROR.getCode());
|
| | | Long measureId = riskControlMeasureGetReqDTO.getId();
|
| | | if (measureId == null){
|
| | | resultVO.setMsg("风险管控措施Id不能为空");
|
| | | return resultVO;
|
| | | }
|
| | | PreventRiskControlMeasure measure = riskControlMeasureService.getPreventRiskControlMeasureById(measureId);
|
| | | if (measure == null){
|
| | | resultVO.setMsg("风险管控措施不存在");
|
| | | return resultVO;
|
| | | }
|
| | | PreventRiskControlMeasureRespDTO dto = new PreventRiskControlMeasureRespDTO();
|
| | | BeanUtils.copyProperties(measure,dto);
|
| | | resultVO.setCode(ResultCodes.OK.getCode());
|
| | | resultVO.setMsg(ResultCodes.OK.getDesc());
|
| | | resultVO.setData(dto);
|
| | |
|
| | | return resultVO;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 管控措施-修改
|
| | | */
|
| | | @Override
|
| | | public ResultVO<PreventRiskControlMeasure> updateRiskControlMeasure(PreventRiskControlMeasureUpdateReqDTO measureUpdateReqDTO) {
|
| | | User sysUser = getSysUser();
|
| | | ResultVO resultVO = new ResultVO<>();
|
| | | resultVO.setCode(ErrorCodes.REQUEST_PARAM_ERROR.getCode());
|
| | | Long measureId = measureUpdateReqDTO.getId();
|
| | | Long riskEventId = measureUpdateReqDTO.getRiskEventId();
|
| | | if (measureId == null){
|
| | | resultVO.setMsg("风险管控措施ID不能为空");
|
| | | return resultVO;
|
| | | }
|
| | | if (riskEventId == null){
|
| | | resultVO.setMsg("安全风险事件ID不能为空");
|
| | | return resultVO;
|
| | | }
|
| | | PreventRiskEvent riskEvent = preventRiskEventService.getPreventRiskEventById(riskEventId);
|
| | | if (riskEvent == null){
|
| | | resultVO.setMsg("安全风险事件不存在");
|
| | | return resultVO;
|
| | | }
|
| | | String controlMeasureCode = measureUpdateReqDTO.getControlMeasureCode();
|
| | | if (controlMeasureCode.isEmpty()){
|
| | | resultVO.setMsg("风险措施编码不能为空");
|
| | | return resultVO;
|
| | | }
|
| | | PreventRiskControlMeasure riskControlMeasure = riskControlMeasureService.getPreventRiskControlMeasureByControlMeasureCode(controlMeasureCode);
|
| | | if (riskControlMeasure != null){
|
| | | if (!measureId.equals(riskControlMeasure.getId())){
|
| | | resultVO.setMsg("风险措施编码已存在");
|
| | | return resultVO;
|
| | | }
|
| | | }
|
| | | if (measureUpdateReqDTO.getControlType() == null){
|
| | | resultVO.setMsg("管控方式不能为空");
|
| | | return resultVO;
|
| | | }
|
| | | if (measureUpdateReqDTO.getCheckContent().isEmpty()){
|
| | | resultVO.setMsg("管控内容不能为空");
|
| | | return resultVO;
|
| | | }
|
| | | if (measureUpdateReqDTO.getClassify1() == null){
|
| | | resultVO.setMsg("管控措施分类1不能为空");
|
| | | return resultVO;
|
| | | }
|
| | | if (measureUpdateReqDTO.getClassify2() == null){
|
| | | resultVO.setMsg("管控措施分类2不能为空");
|
| | | return resultVO;
|
| | | }
|
| | | if (measureUpdateReqDTO.getMeasureDesc().isEmpty()){
|
| | | resultVO.setMsg("措施说明不能为空");
|
| | | return resultVO;
|
| | | }
|
| | |
|
| | | Date date = new Date();
|
| | | PreventRiskControlMeasure controlMeasure = new PreventRiskControlMeasure();
|
| | | BeanUtils.copyProperties(measureUpdateReqDTO,controlMeasure);
|
| | | controlMeasure.setRiskEventUuid(riskEvent.getUuid());
|
| | | controlMeasure.setGmtModitify(date);
|
| | | controlMeasure.setLastEditUserName(sysUser.getUserName());
|
| | | //获取上报主配置信息
|
| | | PreventReportConfig reportConfigById = preventReportConfigService.getReportConfigById(SyncEnum.REPORT_CONFIG_RISK_ANA_UNIT.getCode());
|
| | | //设置本条数据上报更新时间
|
| | | controlMeasure.setUpdateReportDataTime(date);
|
| | | //读取上报主配置,进行任务记录上报配置,如果开启上报功能,且设置为自动上报,开启上报相关配置
|
| | | if (reportConfigById.getReportState() == SyncEnum.REPORT_ON.getCode()
|
| | | && reportConfigById.getReportType() == SyncEnum.REPORT_HAND_EXEC_CONFIG.getCode()){
|
| | | //设置上报状态为-等待上报
|
| | | controlMeasure.setReportStatus(SyncEnum.SYNC_WAIT_EXEC.getCode());
|
| | | //设置本条数据上报开关为-开启
|
| | | controlMeasure.setReportSwitch(SyncEnum.REPORT_ON.getCode());
|
| | | //其他情况默认不开启上报数据,如果是手动上报,可对单条数据进行操作
|
| | | }else {
|
| | | //设置上报状态为-不上报
|
| | | controlMeasure.setReportStatus(SyncEnum.SYNC_NOT_EXEC.getCode());
|
| | | //设置本条数据上报开关为-关闭
|
| | | controlMeasure.setReportSwitch(SyncEnum.REPORT_OFF.getCode());
|
| | | }
|
| | |
|
| | | int updateResult = riskControlMeasureService.updatePreventRiskControlMeasureById(controlMeasure);
|
| | | 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<List<PreventRiskControlMeasurePageQueryRespDTO>> getRiskControlMeasurePage(PreventRiskControlMeasureQueryReqDTO measureQueryReqDTO) {
|
| | | Integer pageIndex = measureQueryReqDTO.getPageIndex();
|
| | | Integer pageSize = measureQueryReqDTO.getPageSize();
|
| | | if (pageIndex == 0 || pageSize == 0){
|
| | | return new ResultVO<>(ErrorCodes.REQUEST_PARAM_ERROR.getCode(),"当前页码或当前页显示数不能为0");
|
| | | }
|
| | | Byte controlType = measureQueryReqDTO.getControlType();
|
| | | Long riskEventId = measureQueryReqDTO.getRiskEventId();
|
| | |
|
| | | Page<PreventRiskControlMeasure> page = PageHelper.startPage(pageIndex, pageSize);
|
| | | riskControlMeasureService.listRiskEvenByCondition(controlType,riskEventId);
|
| | |
|
| | | List<PreventRiskControlMeasure> result = page.getResult();
|
| | | Long total = page.getTotal();
|
| | | int count = total.intValue();
|
| | | List<PreventRiskControlMeasurePageQueryRespDTO> pageResult = null;
|
| | | if (result != null) {
|
| | | pageResult = result.stream().map((preventRiskControlMeasure) -> {
|
| | | PreventRiskControlMeasurePageQueryRespDTO dto = new PreventRiskControlMeasurePageQueryRespDTO();
|
| | | BeanUtils.copyProperties(preventRiskControlMeasure, dto);
|
| | | Long eventId = dto.getRiskEventId();
|
| | | if (eventId != null) {
|
| | | PreventRiskEvent riskEvent = preventRiskEventService.getPreventRiskEventById(eventId);
|
| | | if (riskEvent != null) {
|
| | | dto.setRiskEventName(riskEvent.getRiskEventName());
|
| | | }
|
| | | }
|
| | | return dto;
|
| | | }).collect(Collectors.toList());
|
| | | }
|
| | |
|
| | | ResultVO<List<PreventRiskControlMeasurePageQueryRespDTO>> resultVO = new ResultVO<>(ResultCodes.OK,pageResult);
|
| | | resultVO.setCount(count);
|
| | | return resultVO;
|
| | | }
|
| | | /**
|
| | | * 查询管控措施 by 基础排查清单ID
|
| | | */
|
| | | @Override
|
| | | public List<PreventRiskControlMeasure> getRiskControlMeasureByRiskId(Long riskListId) {
|
| | | //获取管控措施list
|
| | | List<PreventRiskControlMeasure> controlMeasureList = new ArrayList<>();
|
| | |
|
| | | //通过riskListId ,查询对应的管控措施id
|
| | | List<PreventRiskCheckUnit> unitByRiskId = preventRiskCheckUnitService.getUnitByRiskId(riskListId.toString());
|
| | |
|
| | | //遍历集合,封装管控措施
|
| | | for (PreventRiskCheckUnit checkUnit : unitByRiskId) {
|
| | | PreventRiskControlMeasure controlMeasure = riskControlMeasureService.getPreventRiskControlMeasureById(checkUnit.getControlMeasureId());
|
| | | controlMeasureList.add(controlMeasure);
|
| | | }
|
| | | return controlMeasureList;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 保存原检查点与管控措施的对应关系
|
| | | */
|
| | | @Transactional
|
| | | @Override
|
| | | public int insertPointAndMeasure(PreventPointAndMeasureParams pointAndMeasureParams) {
|
| | |
|
| | | //参数校验-管控措施id
|
| | | if (pointAndMeasureParams.getControlMeasureId() == null){
|
| | | throw new RuntimeException("管控措施不能为空");
|
| | | }
|
| | | PreventRiskControlMeasure preventRiskControlMeasureById
|
| | | = riskControlMeasureService.getPreventRiskControlMeasureById(pointAndMeasureParams.getControlMeasureId());
|
| | | if (preventRiskControlMeasureById == null){
|
| | | throw new RuntimeException("管控措施不存在");
|
| | | }
|
| | | if (pointAndMeasureParams.getBaseCheckPointId() == null){
|
| | | throw new RuntimeException("检查点添加失败");
|
| | | }
|
| | |
|
| | | String uuid = UUID.randomUUID().toString();
|
| | | PreventRiskCheckUnit checkUnit = new PreventRiskCheckUnit();
|
| | | //封装数据
|
| | | checkUnit.setUuid(uuid);
|
| | | checkUnit.setRiskId(pointAndMeasureParams.getRiskId());
|
| | | checkUnit.setBaseCheckPointId(pointAndMeasureParams.getBaseCheckPointId());
|
| | | checkUnit.setControlMeasureId(pointAndMeasureParams.getControlMeasureId());
|
| | | //执行插入
|
| | | int result = preventRiskCheckUnitService.insertPointAndMeasure(checkUnit);
|
| | | if (result < 1){
|
| | | throw new RuntimeException("保存原检查点与管控措施的对应关系失败");
|
| | | }
|
| | |
|
| | | return result;
|
| | | }
|
| | | /**
|
| | | * 删除原检查点与管控措施的对应关系
|
| | | */
|
| | | @Override
|
| | | public int deletePointAndMeasure(String ids) {
|
| | |
|
| | | String[] idList = Convert.toStrArray(ids);
|
| | | for (String id : idList) {
|
| | | int result = preventRiskCheckUnitService.deletePointAndMeasure(id);
|
| | | if (result < 1){
|
| | | return StatusEnum.EXEC_FAIL.getCode();
|
| | | }
|
| | | }
|
| | |
|
| | | return StatusEnum.EXEC_SUCCESS.getCode();
|
| | | }
|
| | |
|
| | | /**
|
| | | * 保存job管控措施的附属表
|
| | | */
|
| | | @Override
|
| | | public int insertJobAndMeasure(Long jobId, HiddenDangerCheckJob hiddenDangerCheckJob) {
|
| | |
|
| | | String jobUuid = UUID.randomUUID().toString();
|
| | | PreventRiskJobAndMeasure jobAndMeasure = new PreventRiskJobAndMeasure();
|
| | |
|
| | | //根据RiskId查询对应的管控措施
|
| | | List<PreventRiskCheckUnit> unitByRiskId = preventRiskCheckUnitService.getUnitByRiskId(hiddenDangerCheckJob.getRiskId());
|
| | |
|
| | | //遍历管控措施集合
|
| | | for (PreventRiskCheckUnit checkUnit : unitByRiskId) {
|
| | | PreventRiskControlMeasure preventRiskControlMeasureById = riskControlMeasureService.getPreventRiskControlMeasureById(checkUnit.getControlMeasureId());
|
| | | //封装数据
|
| | | jobAndMeasure.setJobId(jobId);
|
| | | jobAndMeasure.setJobUuid(jobUuid);
|
| | | jobAndMeasure.setMeasureId(checkUnit.getControlMeasureId());
|
| | | jobAndMeasure.setMeasureUuid(preventRiskControlMeasureById.getUuid());//todo 如果删除了措施 此处可能为空,后续处理
|
| | | //获取上报主配置信息
|
| | | PreventReportConfig reportConfigById = preventReportConfigService.getReportConfigById(SyncEnum.REPORT_CONFIG_TASK_FROM_WORK.getCode());
|
| | | //设置上报时间为空
|
| | | jobAndMeasure.setReportTime(null);
|
| | | //设置本条数据上报更新时间
|
| | | jobAndMeasure.setUpdateReportDataTime(new Date());
|
| | | //读取上报主配置,进行任务记录上报配置,如果开启上报功能,且设置为自动上报,开启上报相关配置
|
| | | if (reportConfigById.getReportState() == SyncEnum.REPORT_ON.getCode()
|
| | | && reportConfigById.getReportType() == SyncEnum.REPORT_HAND_EXEC_CONFIG.getCode()){
|
| | | //设置上报状态为-等待上报
|
| | | jobAndMeasure.setReportStatus(SyncEnum.SYNC_WAIT_EXEC.getCode());
|
| | | //设置本条数据上报开关为-开启
|
| | | jobAndMeasure.setReportSwitch(SyncEnum.REPORT_ON.getCode());
|
| | | //其他情况默认不开启上报数据,如果是手动上报,可对单条数据进行操作
|
| | | }else {
|
| | | //设置上报状态为-不上报
|
| | | jobAndMeasure.setReportStatus(SyncEnum.SYNC_NOT_EXEC.getCode());
|
| | | //设置本条数据上报开关为-关闭
|
| | | jobAndMeasure.setReportSwitch(SyncEnum.REPORT_OFF.getCode());
|
| | | }
|
| | | int result = preventRiskJobAndMeasureService.insertJobAndMeasure(jobAndMeasure);
|
| | | if (result < 1 ){
|
| | | return StatusEnum.EXEC_FAIL.getCode();
|
| | | }
|
| | | }
|
| | |
|
| | | return StatusEnum.EXEC_SUCCESS.getCode();
|
| | | }
|
| | |
|
| | | /**
|
| | | * 修改job管控措施的附属表
|
| | | */
|
| | | @Transactional
|
| | | @Override
|
| | | public int updateJobAndMeasure(HiddenDangerCheckJob hiddenDangerCheckJob) {
|
| | | // 2、若有变更,需要预先读取jobAndMeasure的uuid,保存下来
|
| | | PreventRiskJobAndMeasure jobAndMeasureByJobId = preventRiskJobAndMeasureService.getJobAndMeasureByJobId(hiddenDangerCheckJob.getJobId());
|
| | | String jobUuid = jobAndMeasureByJobId.getJobUuid();
|
| | | Date reportTime = jobAndMeasureByJobId.getReportTime();
|
| | |
|
| | | if (jobAndMeasureByJobId != null){
|
| | | //3、删除库中原关联关系
|
| | | int deleteResult = preventRiskJobAndMeasureService.deleteJobAndMeasure(hiddenDangerCheckJob.getJobId());
|
| | | if(deleteResult < 1){
|
| | | throw new RuntimeException("清除job管控措施的附属表关联信息失败");
|
| | | }
|
| | | }
|
| | |
|
| | | //4根据RiskId查询对应的管控措施
|
| | | List<PreventRiskCheckUnit> unitByRiskId = preventRiskCheckUnitService.getUnitByRiskId(hiddenDangerCheckJob.getRiskId());
|
| | |
|
| | | //5封装数据,插入数据库,重新添加关联关系
|
| | | for (PreventRiskCheckUnit checkUnit : unitByRiskId) {
|
| | | PreventRiskControlMeasure preventRiskControlMeasureById = riskControlMeasureService.getPreventRiskControlMeasureById(checkUnit.getControlMeasureId());
|
| | | PreventRiskJobAndMeasure jobAndMeasure = new PreventRiskJobAndMeasure();
|
| | | //封装参数
|
| | | jobAndMeasure.setJobId(jobAndMeasureByJobId.getJobId());
|
| | | //使用保存下来的uuid,再次添加关联关系
|
| | | jobAndMeasure.setJobUuid(jobUuid);
|
| | | jobAndMeasure.setMeasureId(checkUnit.getControlMeasureId());
|
| | | jobAndMeasure.setMeasureUuid(preventRiskControlMeasureById.getUuid());//todo 如果删除了措施 此处可能为空,后续处理
|
| | |
|
| | | //获取上报主配置信息
|
| | | PreventReportConfig reportConfigById = preventReportConfigService.getReportConfigById(SyncEnum.REPORT_CONFIG_TASK_FROM_WORK.getCode());
|
| | | //设置上报时间
|
| | | jobAndMeasure.setReportTime(reportTime);
|
| | | //设置本条数据上报更新时间
|
| | | jobAndMeasure.setUpdateReportDataTime(new Date());
|
| | | //读取上报主配置,进行任务记录上报配置,如果开启上报功能,且设置为自动上报,开启上报相关配置
|
| | | if (reportConfigById.getReportState() == SyncEnum.REPORT_ON.getCode()
|
| | | && reportConfigById.getReportType() == SyncEnum.REPORT_HAND_EXEC_CONFIG.getCode()){
|
| | | //设置上报状态为-等待上报
|
| | | jobAndMeasure.setReportStatus(SyncEnum.SYNC_WAIT_EXEC.getCode());
|
| | | //设置本条数据上报开关为-开启
|
| | | jobAndMeasure.setReportSwitch(SyncEnum.REPORT_ON.getCode());
|
| | | //其他情况默认不开启上报数据,如果是手动上报,可对单条数据进行操作
|
| | | }else {
|
| | | //设置上报状态为-不上报
|
| | | jobAndMeasure.setReportStatus(SyncEnum.SYNC_NOT_EXEC.getCode());
|
| | | //设置本条数据上报开关为-关闭
|
| | | jobAndMeasure.setReportSwitch(SyncEnum.REPORT_OFF.getCode());
|
| | | }
|
| | | int result = preventRiskJobAndMeasureService.insertJobAndMeasure(jobAndMeasure);
|
| | | if (result < 1 ){
|
| | | return StatusEnum.EXEC_FAIL.getCode();
|
| | | }
|
| | | }
|
| | |
|
| | | return StatusEnum.EXEC_SUCCESS.getCode();
|
| | | }
|
| | |
|
| | | /**
|
| | | * 删除job管控措施的附属表关联信息
|
| | | */
|
| | | @Transactional
|
| | | @Override
|
| | | public int deleteJobAndMeasure(String ids) {
|
| | |
|
| | | Long[] jobIds = Convert.toLongArray(ids);
|
| | |
|
| | | for (Long jobId : jobIds)
|
| | | {
|
| | | int result = preventRiskJobAndMeasureService.deleteJobAndMeasure(jobId);
|
| | | if (result < 1 ){
|
| | | throw new RuntimeException("删除job管控措施的附属表关联信息失败");
|
| | | }
|
| | | }
|
| | | return StatusEnum.EXEC_SUCCESS.getCode();
|
| | | }
|
| | | /**
|
| | | * 查询Job与措施
|
| | | */
|
| | | @Override
|
| | | public PreventRiskJobAndMeasure getJobAndMeasure(Long jobId) {
|
| | | return preventRiskJobAndMeasureService.getJobAndMeasureByJobId(jobId);
|
| | | }
|
| | | /**
|
| | | * 定时生成排查任务记录时,
|
| | | * 插入排查记录附属表
|
| | | */
|
| | | @Override
|
| | | public int insertDangerCheckLog(Long checkId, HiddenDangerCheck hdc) {
|
| | |
|
| | | String dangerCheckUuid = UUID.randomUUID().toString();
|
| | | PreventRiskDangerCheckLog dangerCheck = new PreventRiskDangerCheckLog();
|
| | |
|
| | | dangerCheck.setUuid(dangerCheckUuid);
|
| | | dangerCheck.setCheckStatus(null);
|
| | | dangerCheck.setCheckId(checkId);
|
| | | dangerCheck.setJobId(hdc.getJobId());
|
| | | //获取上报主配置信息
|
| | | PreventReportConfig reportConfigById = preventReportConfigService.getReportConfigById(SyncEnum.REPORT_CONFIG__CHECK_RECORD.getCode());
|
| | | //设置上报时间为空
|
| | | dangerCheck.setReportTime(null);
|
| | | //设置本条数据上报更新时间
|
| | | dangerCheck.setUpdateReportDataTime(new Date());
|
| | | //读取上报主配置,进行任务记录上报配置,如果开启上报功能,且设置为自动上报,开启上报相关配置
|
| | | if (reportConfigById.getReportState() == SyncEnum.REPORT_ON.getCode()
|
| | | && reportConfigById.getReportType() == SyncEnum.REPORT_HAND_EXEC_CONFIG.getCode()){
|
| | | //设置上报状态为-等待上报
|
| | | dangerCheck.setReportStatus(SyncEnum.SYNC_WAIT_EXEC.getCode());
|
| | | //设置本条数据上报开关为-开启
|
| | | dangerCheck.setReportSwitch(SyncEnum.REPORT_ON.getCode());
|
| | | //其他情况默认不开启上报数据,如果是手动上报,可对单条数据进行操作
|
| | | }else {
|
| | | //设置上报状态为-不上报
|
| | | dangerCheck.setReportStatus(SyncEnum.SYNC_NOT_EXEC.getCode());
|
| | | //设置本条数据上报开关为-关闭
|
| | | dangerCheck.setReportSwitch(SyncEnum.REPORT_OFF.getCode());
|
| | | }
|
| | | return preventRiskDangerCheckLogService.insertDangerCheckLog(dangerCheck);
|
| | | }
|
| | | /**
|
| | | * 定时生成排查任务记录时,
|
| | | * 插入检查点附属表
|
| | | */
|
| | | @Override
|
| | | public int insertCheckAndMeasure(Long id, HiddenDangerCheckPoint hdcp) {
|
| | | System.out.println("进入核查点保存方法");
|
| | | PreventRiskDangerCheckAndMeasure checkAndMeasure = new PreventRiskDangerCheckAndMeasure();
|
| | |
|
| | | //根据检查点信息,查询对应管控措施
|
| | | PreventRiskCheckUnit checkUnit = preventRiskCheckUnitService.getUnitByBaseCheckPointId(hdcp.getCheckPointId());
|
| | | if (checkUnit == null){
|
| | | throw new RuntimeException("基础检查点不存在");
|
| | | }
|
| | | System.out.println("通过一次检验");
|
| | | PreventRiskControlMeasure controlMeasure = riskControlMeasureService.getPreventRiskControlMeasureById(checkUnit.getControlMeasureId());
|
| | | if (controlMeasure == null){
|
| | | throw new RuntimeException("管控措施已经被删除");
|
| | | }
|
| | | System.out.println("通过二次检验");
|
| | | //封装数据
|
| | | checkAndMeasure.setCheckId(hdcp.getCheckId());
|
| | | checkAndMeasure.setDangerCheckPointId(id);
|
| | | checkAndMeasure.setBaseCheckPointId(hdcp.getCheckPointId());
|
| | | checkAndMeasure.setControlMeasureId(controlMeasure.getId());
|
| | | checkAndMeasure.setCheckContent(controlMeasure.getCheckContent());
|
| | | checkAndMeasure.setCheckResult((byte) 4);
|
| | | System.out.println("数据封装完成");
|
| | | //写入核查任务检查点与管控措施信息
|
| | | int result = preventRiskDangerCheckAndMeasureService.insertCheckAndMeasure(checkAndMeasure);
|
| | | if (result <1){
|
| | | return StatusEnum.EXEC_FAIL.getCode();
|
| | | }
|
| | | return StatusEnum.EXEC_SUCCESS.getCode();
|
| | | }
|
| | | /**
|
| | | * todo-2022 填报时的操作
|
| | | */
|
| | |
|
| | | /**
|
| | | * 删除定时核查任务
|
| | | * */
|
| | | @Override
|
| | | @Transactional
|
| | | public int deleteDangerCheck(String ids) {
|
| | |
|
| | | Long[] dangerCheckIdList = Convert.toLongArray(ids);
|
| | |
|
| | | //1、删除核查任务附属表
|
| | | for (Long checkId : dangerCheckIdList) {
|
| | | int result = preventRiskDangerCheckLogService.deleteDangerCheck(checkId);
|
| | | if (result < 1){
|
| | | return StatusEnum.EXEC_FAIL.getCode();
|
| | | }
|
| | | }
|
| | | //2、删除核查任务-检查点的附属表----老代码未删除检查点信息,此处暂不做处理
|
| | |
|
| | | return StatusEnum.EXEC_SUCCESS.getCode();
|
| | | }
|
| | |
|
| | | /**
|
| | | * 新增隐患上报
|
| | | * */
|
| | | @Override
|
| | | public int insertDangerInfo(Long id, HiddenDangerCheckPoint hdcp) {
|
| | |
|
| | | String dangerInfoUuid = UUID.randomUUID().toString();
|
| | | PreventRiskDangerInfo dangerInfo = new PreventRiskDangerInfo();
|
| | |
|
| | | dangerInfo.setUuid(dangerInfoUuid);
|
| | | dangerInfo.setDangerCheckPointId(id);
|
| | | dangerInfo.setHazardCode(hdcp.getHazardCode());
|
| | | dangerInfo.setDangerSrc(hdcp.getDangerSrc());
|
| | | dangerInfo.setDangerDesc(hdcp.getDangerDescription());
|
| | | dangerInfo.setDangerReason(hdcp.getDangerReason());
|
| | | dangerInfo.setDangerResult(hdcp.getDangerResult());
|
| | | dangerInfo.setHazardDangerType(hdcp.getHazardDangerType());
|
| | | //隐患状态 0未验收 1验收通过 2验收未通过 ,新建时为空
|
| | | if (hdcp.getAcceptStatus() == null){
|
| | | //设置为 空
|
| | | dangerInfo.setDangerState(null);
|
| | | } else if (hdcp.getAcceptStatus().equals(0)){
|
| | | //设置为整改中
|
| | | dangerInfo.setDangerState(StatusEnum.RECTIFY_ING.getCode());
|
| | | } else if (hdcp.getAcceptStatus().equals(1)) {
|
| | | //设置为已验收
|
| | | dangerInfo.setDangerState(StatusEnum.ACCEPT_SUCCESS.getCode());
|
| | | }else if (hdcp.getAcceptStatus().equals(2)){
|
| | | //设置为超期未整改
|
| | | dangerInfo.setDangerState(StatusEnum.RECTIFY_TIMEOUT_AND_FAIL.getCode());
|
| | | }
|
| | | dangerInfo.setTimeoutFlag(null);//暂时不清楚是否需要此功能,先设为空
|
| | | //获取上报主配置信息
|
| | | PreventReportConfig reportConfigById = preventReportConfigService.getReportConfigById(SyncEnum.REPORT_CONFIG_DANGER_INFO.getCode());
|
| | | //设置上报时间为空
|
| | | dangerInfo.setReportTime(null);
|
| | | //设置本条数据上报更新时间
|
| | | dangerInfo.setUpdateReportDataTime(new Date());
|
| | | //读取上报主配置,进行任务记录上报配置,如果开启上报功能,且设置为自动上报,开启上报相关配置
|
| | | if (reportConfigById.getReportState() == SyncEnum.REPORT_ON.getCode()
|
| | | && reportConfigById.getReportType() == SyncEnum.REPORT_HAND_EXEC_CONFIG.getCode()){
|
| | | //设置上报状态为-等待上报
|
| | | dangerInfo.setReportStatus(SyncEnum.SYNC_WAIT_EXEC.getCode());
|
| | | //设置本条数据上报开关为-开启
|
| | | dangerInfo.setReportSwitch(SyncEnum.REPORT_ON.getCode());
|
| | | //其他情况默认不开启上报数据,如果是手动上报,可对单条数据进行操作
|
| | | }else {
|
| | | //设置上报状态为-不上报
|
| | | dangerInfo.setReportStatus(SyncEnum.SYNC_NOT_EXEC.getCode());
|
| | | //设置本条数据上报开关为-关闭
|
| | | dangerInfo.setReportSwitch(SyncEnum.REPORT_OFF.getCode());
|
| | | }
|
| | |
|
| | | return preventRiskDangerInfoService.insertDangerInfo(dangerInfo);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 修改隐患上报
|
| | | * */
|
| | | @Override
|
| | | public int updateDangerInfo(HiddenDangerCheckPoint hdcp) {
|
| | |
|
| | | //封装修改数据
|
| | | PreventRiskDangerInfo dangerInfo = new PreventRiskDangerInfo();
|
| | |
|
| | | dangerInfo.setDangerCheckPointId(hdcp.getId());
|
| | | dangerInfo.setHazardCode(hdcp.getHazardCode());
|
| | | dangerInfo.setDangerSrc(hdcp.getDangerSrc());
|
| | | dangerInfo.setDangerDesc(hdcp.getDangerDescription());
|
| | | dangerInfo.setDangerReason(hdcp.getDangerReason());
|
| | | dangerInfo.setDangerResult(hdcp.getDangerResult());
|
| | | dangerInfo.setHazardDangerType(hdcp.getHazardDangerType());
|
| | | //隐患状态 0未验收 1验收通过 2验收未通过 ,新建时为空
|
| | | if (hdcp.getAcceptStatus() == null){
|
| | | //设置为 空
|
| | | dangerInfo.setDangerState(null);
|
| | | } else if (hdcp.getAcceptStatus().equals(0)){
|
| | | //设置为整改中
|
| | | dangerInfo.setDangerState(StatusEnum.RECTIFY_ING.getCode());
|
| | | } else if (hdcp.getAcceptStatus().equals(1)) {
|
| | | //设置为已验收
|
| | | dangerInfo.setDangerState(StatusEnum.ACCEPT_SUCCESS.getCode());
|
| | | }else if (hdcp.getAcceptStatus().equals(2)){
|
| | | //设置为超期未整改
|
| | | dangerInfo.setDangerState(StatusEnum.RECTIFY_TIMEOUT_AND_FAIL.getCode());
|
| | | }
|
| | | dangerInfo.setTimeoutFlag(null);//暂时不清楚是否需要此功能,先设为空
|
| | | //获取上报主配置信息
|
| | | PreventReportConfig reportConfigById = preventReportConfigService.getReportConfigById(SyncEnum.REPORT_CONFIG_DANGER_INFO.getCode());
|
| | | //设置本条数据上报更新时间
|
| | | dangerInfo.setUpdateReportDataTime(new Date());
|
| | | //读取上报主配置,进行任务记录上报配置,如果开启上报功能,且设置为自动上报,开启上报相关配置
|
| | | if (reportConfigById.getReportState() == SyncEnum.REPORT_ON.getCode()
|
| | | && reportConfigById.getReportType() == SyncEnum.REPORT_HAND_EXEC_CONFIG.getCode()){
|
| | | //设置上报状态为-等待上报
|
| | | dangerInfo.setReportStatus(SyncEnum.SYNC_WAIT_EXEC.getCode());
|
| | | //设置本条数据上报开关为-开启
|
| | | dangerInfo.setReportSwitch(SyncEnum.REPORT_ON.getCode());
|
| | | //其他情况默认不开启上报数据,如果是手动上报,可对单条数据进行操作
|
| | | }else {
|
| | | //设置上报状态为-不上报
|
| | | dangerInfo.setReportStatus(SyncEnum.SYNC_NOT_EXEC.getCode());
|
| | | //设置本条数据上报开关为-关闭
|
| | | dangerInfo.setReportSwitch(SyncEnum.REPORT_OFF.getCode());
|
| | | }
|
| | |
|
| | | return preventRiskDangerInfoService.updateDangerInfo(dangerInfo);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 删除隐患上报
|
| | | */
|
| | | @Override
|
| | | public int deleteDangerInfo(Long id) {
|
| | |
|
| | | return preventRiskDangerInfoService.deleteDangerInfo(id);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 隐患判定,如果是隐患,修改为整改中
|
| | | */
|
| | | @Override
|
| | | public int updateDangerInfoJudge(HiddenDangerCheckPoint hdcp) {
|
| | |
|
| | | //封装修改数据
|
| | | PreventRiskDangerInfo dangerInfo = new PreventRiskDangerInfo();
|
| | |
|
| | | dangerInfo.setDangerCheckPointId(hdcp.getId());
|
| | | //需要根据条件,判断附属表隐患状态。
|
| | | //目前想法:认定后的隐患-0整改中;整改后的隐患-1待验收;验收后的隐患-9已验收。2,3状态暂时未使用
|
| | | //设置为整改中
|
| | | dangerInfo.setDangerState(StatusEnum.RECTIFY_ING.getCode());
|
| | | //获取上报主配置信息
|
| | | PreventReportConfig reportConfigById = preventReportConfigService.getReportConfigById(SyncEnum.REPORT_CONFIG_DANGER_INFO.getCode());
|
| | | //设置本条数据上报更新时间
|
| | | dangerInfo.setUpdateReportDataTime(new Date());
|
| | | //读取上报主配置,进行任务记录上报配置,如果开启上报功能,且设置为自动上报,开启上报相关配置
|
| | | if (reportConfigById.getReportState() == SyncEnum.REPORT_ON.getCode()
|
| | | && reportConfigById.getReportType() == SyncEnum.REPORT_HAND_EXEC_CONFIG.getCode()){
|
| | | //设置上报状态为-等待上报
|
| | | dangerInfo.setReportStatus(SyncEnum.SYNC_WAIT_EXEC.getCode());
|
| | | //设置本条数据上报开关为-开启
|
| | | dangerInfo.setReportSwitch(SyncEnum.REPORT_ON.getCode());
|
| | | //其他情况默认不开启上报数据,如果是手动上报,可对单条数据进行操作
|
| | | }else {
|
| | | //设置上报状态为-不上报
|
| | | dangerInfo.setReportStatus(SyncEnum.SYNC_NOT_EXEC.getCode());
|
| | | //设置本条数据上报开关为-关闭
|
| | | dangerInfo.setReportSwitch(SyncEnum.REPORT_OFF.getCode());
|
| | | }
|
| | |
|
| | | return preventRiskDangerInfoService.updateDangerInfoState(dangerInfo);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 隐患整改信息 - 修改
|
| | | */
|
| | | @Override
|
| | | public int updateDangerInfoRectify(HiddenDangerCheckPoint hdcp) {
|
| | |
|
| | | //封装修改数据
|
| | | PreventRiskDangerInfo dangerInfo = new PreventRiskDangerInfo();
|
| | |
|
| | | dangerInfo.setDangerCheckPointId(hdcp.getId());
|
| | | //需要根据条件,判断附属表隐患状态。
|
| | | //目前想法:认定后的隐患-0整改中;整改后的隐患-1待验收;验收后的隐患-9已验收。2,3状态暂时未使用
|
| | | //待验收验收
|
| | | dangerInfo.setDangerState(StatusEnum.RECTIFY_WAIT_ACCEPT.getCode());
|
| | |
|
| | | //获取上报主配置信息
|
| | | PreventReportConfig reportConfigById = preventReportConfigService.getReportConfigById(SyncEnum.REPORT_CONFIG_DANGER_INFO.getCode());
|
| | | //设置本条数据上报更新时间
|
| | | dangerInfo.setUpdateReportDataTime(new Date());
|
| | | //读取上报主配置,进行任务记录上报配置,如果开启上报功能,且设置为自动上报,开启上报相关配置
|
| | | if (reportConfigById.getReportState() == SyncEnum.REPORT_ON.getCode()
|
| | | && reportConfigById.getReportType() == SyncEnum.REPORT_HAND_EXEC_CONFIG.getCode()){
|
| | | //设置上报状态为-等待上报
|
| | | dangerInfo.setReportStatus(SyncEnum.SYNC_WAIT_EXEC.getCode());
|
| | | //设置本条数据上报开关为-开启
|
| | | dangerInfo.setReportSwitch(SyncEnum.REPORT_ON.getCode());
|
| | | //其他情况默认不开启上报数据,如果是手动上报,可对单条数据进行操作
|
| | | }else {
|
| | | //设置上报状态为-不上报
|
| | | dangerInfo.setReportStatus(SyncEnum.SYNC_NOT_EXEC.getCode());
|
| | | //设置本条数据上报开关为-关闭
|
| | | dangerInfo.setReportSwitch(SyncEnum.REPORT_OFF.getCode());
|
| | | }
|
| | |
|
| | | return preventRiskDangerInfoService.updateDangerInfoState(dangerInfo);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 隐患验收 - 保存验收信息
|
| | | */
|
| | | @Override
|
| | | public int updateDangerInfoAccept(HiddenDangerCheckPoint hdcp) {
|
| | |
|
| | | //封装修改数据
|
| | | PreventRiskDangerInfo dangerInfo = new PreventRiskDangerInfo();
|
| | |
|
| | | dangerInfo.setDangerCheckPointId(hdcp.getId());
|
| | |
|
| | | //如果验收通过,设置为验收成功;验收失败,打回上一级进行整改,设置为整改中
|
| | | if (hdcp.getAcceptStatus().equals(0)){
|
| | | dangerInfo.setDangerState(StatusEnum.RECTIFY_ING.getCode());
|
| | | }else if (hdcp.getAcceptStatus().equals(1)){
|
| | | dangerInfo.setDangerState(StatusEnum.ACCEPT_SUCCESS.getCode());
|
| | | }
|
| | |
|
| | | //获取上报主配置信息
|
| | | PreventReportConfig reportConfigById = preventReportConfigService.getReportConfigById(SyncEnum.REPORT_CONFIG_DANGER_INFO.getCode());
|
| | | //设置本条数据上报更新时间
|
| | | dangerInfo.setUpdateReportDataTime(new Date());
|
| | | //读取上报主配置,进行任务记录上报配置,如果开启上报功能,且设置为自动上报,开启上报相关配置
|
| | | if (reportConfigById.getReportState() == SyncEnum.REPORT_ON.getCode()
|
| | | && reportConfigById.getReportType() == SyncEnum.REPORT_HAND_EXEC_CONFIG.getCode()){
|
| | | //设置上报状态为-等待上报
|
| | | dangerInfo.setReportStatus(SyncEnum.SYNC_WAIT_EXEC.getCode());
|
| | | //设置本条数据上报开关为-开启
|
| | | dangerInfo.setReportSwitch(SyncEnum.REPORT_ON.getCode());
|
| | | //其他情况默认不开启上报数据,如果是手动上报,可对单条数据进行操作
|
| | | }else {
|
| | | //设置上报状态为-不上报
|
| | | dangerInfo.setReportStatus(SyncEnum.SYNC_NOT_EXEC.getCode());
|
| | | //设置本条数据上报开关为-关闭
|
| | | dangerInfo.setReportSwitch(SyncEnum.REPORT_OFF.getCode());
|
| | | }
|
| | | return preventRiskDangerInfoService.updateDangerInfoState(dangerInfo);
|
| | | }
|
| | |
|
| | | /**
|
| | | * @description 获取所有的风险分析单元的编码和姓名
|
| | | */
|
| | | @Override
|
| | | public List<PreventRiskUnitCodeAndNameListQueryRespDTO> listRiskUnitCodeAndName() {
|
| | | List<PreventRiskList> riskLists = preventRiskListService.listRiskUnitCodeAndName();
|
| | | if (riskLists == null){
|
| | | return null;
|
| | | }
|
| | | List<PreventRiskUnitCodeAndNameListQueryRespDTO> listQueryRespDTOs= riskLists.stream().map((riskList)->{
|
| | | PreventRiskUnitCodeAndNameListQueryRespDTO listQueryRespDTO = new PreventRiskUnitCodeAndNameListQueryRespDTO();
|
| | | BeanUtils.copyProperties(riskList,listQueryRespDTO);
|
| | | return listQueryRespDTO;
|
| | | }).collect(Collectors.toList());
|
| | | return listQueryRespDTOs;
|
| | | }
|
| | |
|
| | | // /**
|
| | | // * 全流程隐患上报-附属表信息插入
|
| | | // * */
|
| | | // @Override
|
| | | // public int insertAllDangerInfo(Long id, HiddenDangerCheckPoint hdcp) {
|
| | | //
|
| | | // String dangerInfoUuid = UUID.randomUUID().toString();
|
| | | // PreventRiskDangerInfo dangerInfo = new PreventRiskDangerInfo();
|
| | | //
|
| | | // dangerInfo.setUuid(dangerInfoUuid);
|
| | | // dangerInfo.setDangerCheckPointId(id);
|
| | | // dangerInfo.setHazardCode(hdcp.getHazardCode());
|
| | | // dangerInfo.setDangerSrc(hdcp.getDangerSrc());
|
| | | // dangerInfo.setDangerDesc(hdcp.getDangerDesc());
|
| | | // dangerInfo.setDangerReason(hdcp.getDangerReason());
|
| | | // dangerInfo.setDangerResult(hdcp.getDangerResult());
|
| | | // dangerInfo.setHazardDangerType(hdcp.getHazardDangerType());
|
| | | // dangerInfo.setDangerState(hdcp.getDangerState());
|
| | | // dangerInfo.setTimeoutFlag(null);//暂时不清楚是否需要此功能,先设为空
|
| | | //
|
| | | // //获取上报主配置信息
|
| | | // PreventReportConfig reportConfigById = preventReportConfigService.getReportConfigById(SyncEnum.REPORT_CONFIG_DANGER_INFO.getCode());
|
| | | // //设置上报时间为空
|
| | | // dangerInfo.setReportTime(null);
|
| | | // //设置本条数据上报更新时间
|
| | | // dangerInfo.setUpdateReportDataTime(new Date());
|
| | | // //读取上报主配置,进行任务记录上报配置,如果开启上报功能,且设置为自动上报,开启上报相关配置
|
| | | // if (reportConfigById.getReportState() == SyncEnum.REPORT_ON.getCode()
|
| | | // && reportConfigById.getReportType() == SyncEnum.REPORT_HAND_EXEC_CONFIG.getCode()){
|
| | | // //设置上报状态为-等待上报
|
| | | // dangerInfo.setReportStatus(SyncEnum.SYNC_WAIT_EXEC.getCode());
|
| | | // //设置本条数据上报开关为-开启
|
| | | // dangerInfo.setReportSwitch(SyncEnum.REPORT_ON.getCode());
|
| | | // //其他情况默认不开启上报数据,如果是手动上报,可对单条数据进行操作
|
| | | // }else {
|
| | | // //设置上报状态为-不上报
|
| | | // dangerInfo.setReportStatus(SyncEnum.SYNC_NOT_EXEC.getCode());
|
| | | // //设置本条数据上报开关为-关闭
|
| | | // dangerInfo.setReportSwitch(SyncEnum.REPORT_OFF.getCode());
|
| | | // }
|
| | | //
|
| | | // return preventRiskDangerInfoService.insertDangerInfo(dangerInfo);
|
| | | // }
|
| | | } |