新增风险时间、管控措施的增删改查基础代码;新增统一返回值、异常码
| | |
| | | package com.ruoyi.doublePrevention.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | |
| | | import java.util.Date; |
| | |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | |
对比新文件 |
| | |
| | | package com.ruoyi.doublePrevention.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | /** |
| | | * (PreventRiskControlTemplate)实体类 |
| | | * |
| | | * @author makejava |
| | | * @since 2022-06-25 10:40:17 |
| | | */ |
| | | @TableName("prevent_risk_control_template") |
| | | public class PreventRiskControlTemplate implements Serializable { |
| | | /** |
| | | * 主键 |
| | | */ |
| | | private Long id; |
| | | |
| | | private String uuid; |
| | | /** |
| | | * 删除标志:0-有效,1-删除 |
| | | */ |
| | | private Integer deleteStatus; |
| | | /** |
| | | * 排序字段 |
| | | */ |
| | | private Integer orderIndex; |
| | | /** |
| | | * 父级别措施id |
| | | */ |
| | | private Long parentId; |
| | | /** |
| | | * |
| | | 风控措施名称 : |
| | | 管控措施分类1:1-工程技术,2-维护保养,3-操作行为,4-应急设施; |
| | | 管控措施分类2 子级目录: |
| | | 1、工程技术:1-工艺控制,2-关键设备/部件,3-安全附件,4-安全仪表,5-其他; |
| | | 2、维护保养:1-动设备,2-静设备; |
| | | 3、操作行为:1-人员资质,2-操作记录,3-交接班; |
| | | 4、应急设施:1-应急设施,2-个体防护,3-消防设施,4-应急预案 |
| | | */ |
| | | private String riskMeasureName; |
| | | |
| | | |
| | | public Long getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(Long id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getUuid() { |
| | | return uuid; |
| | | } |
| | | |
| | | public void setUuid(String uuid) { |
| | | this.uuid = uuid; |
| | | } |
| | | |
| | | public Integer getDeleteStatus() { |
| | | return deleteStatus; |
| | | } |
| | | |
| | | public void setDeleteStatus(Integer deleteStatus) { |
| | | this.deleteStatus = deleteStatus; |
| | | } |
| | | |
| | | public Integer getOrderIndex() { |
| | | return orderIndex; |
| | | } |
| | | |
| | | public void setOrderIndex(Integer orderIndex) { |
| | | this.orderIndex = orderIndex; |
| | | } |
| | | |
| | | public Long getParentId() { |
| | | return parentId; |
| | | } |
| | | |
| | | public void setParentId(Long parentId) { |
| | | this.parentId = parentId; |
| | | } |
| | | |
| | | public String getRiskMeasureName() { |
| | | return riskMeasureName; |
| | | } |
| | | |
| | | public void setRiskMeasureName(String riskMeasureName) { |
| | | this.riskMeasureName = riskMeasureName; |
| | | } |
| | | } |
| | | |
| | |
| | | package com.ruoyi.doublePrevention.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.IdType; |
| | | import com.baomidou.mybatisplus.annotation.TableId; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | |
| | | import java.io.Serializable; |
| | |
| | | /** |
| | | * 主键 |
| | | */ |
| | | @TableId(type = IdType.AUTO) |
| | | private Long id; |
| | | |
| | | private String uuid; |
对比新文件 |
| | |
| | | package com.ruoyi.doublePrevention.entity.dto.req; |
| | | |
| | | |
| | | public class PreventRiskEventPageQueryReqDTO { |
| | | |
| | | private Integer pageIndex; |
| | | |
| | | private Integer pageSize; |
| | | /** |
| | | * 所属安全风险分析单元Id |
| | | */ |
| | | private Long riskUnitId; |
| | | /** |
| | | * 安全风险事件名称 |
| | | */ |
| | | private String riskEventName; |
| | | |
| | | public Integer getPageIndex() { |
| | | return pageIndex; |
| | | } |
| | | |
| | | public void setPageIndex(Integer pageIndex) { |
| | | this.pageIndex = pageIndex; |
| | | } |
| | | |
| | | public Integer getPageSize() { |
| | | return pageSize; |
| | | } |
| | | |
| | | public void setPageSize(Integer pageSize) { |
| | | this.pageSize = pageSize; |
| | | } |
| | | |
| | | public Long getRiskUnitId() { |
| | | return riskUnitId; |
| | | } |
| | | |
| | | public void setRiskUnitId(Long riskUnitId) { |
| | | this.riskUnitId = riskUnitId; |
| | | } |
| | | |
| | | public String getRiskEventName() { |
| | | return riskEventName; |
| | | } |
| | | |
| | | public void setRiskEventName(String riskEventName) { |
| | | this.riskEventName = riskEventName; |
| | | } |
| | | } |
对比新文件 |
| | |
| | | package com.ruoyi.doublePrevention.entity.dto.req; |
| | | |
| | | public class PreventRiskEventSaveReqDTO { |
| | | |
| | | /** |
| | | * 风险分析单元id |
| | | */ |
| | | private Long riskUnitId; |
| | | /** |
| | | * 安全风险事件名称 |
| | | */ |
| | | private String riskEventName; |
| | | /** |
| | | * 安全风险结果 |
| | | */ |
| | | private String eventResult; |
| | | |
| | | public String getEventResult() { |
| | | return eventResult; |
| | | } |
| | | |
| | | public void setEventResult(String eventResult) { |
| | | this.eventResult = eventResult; |
| | | } |
| | | |
| | | public Long getRiskUnitId() { |
| | | return riskUnitId; |
| | | } |
| | | |
| | | public void setRiskUnitId(Long riskUnitId) { |
| | | this.riskUnitId = riskUnitId; |
| | | } |
| | | |
| | | public String getRiskEventName() { |
| | | return riskEventName; |
| | | } |
| | | |
| | | public void setRiskEventName(String riskEventName) { |
| | | this.riskEventName = riskEventName; |
| | | } |
| | | } |
对比新文件 |
| | |
| | | package com.ruoyi.doublePrevention.enums; |
| | | |
| | | public enum ErrorCodes { |
| | | |
| | | //正常 |
| | | OK("200","一切 ok"), |
| | | |
| | | //请求参数错误 |
| | | REQUEST_PARAM_ERROR("501","请求参数错误"), |
| | | |
| | | //接口权限错误 |
| | | API_PERMISSION_ERROR("502","无接口访问权限"), |
| | | |
| | | //数据库错误 |
| | | DATABASE_ERROR("401","数据库错误"), |
| | | |
| | | //业务权限错误 |
| | | BUSINESS_PERMISSION_ERROR("503","无业务权限"), |
| | | |
| | | //接口签名错误 |
| | | REQUEST_SIGN_ERROR("504","签名错误"), |
| | | |
| | | //系统错误 |
| | | SERVER_ERROR("403","系统执行出错"), |
| | | |
| | | //业务超时 |
| | | BUSINESS_TIME_OUT("505","操作超时"), |
| | | |
| | | ; |
| | | |
| | | |
| | | |
| | | ErrorCodes(String code, String desc) { |
| | | this.code = code; |
| | | this.desc = desc; |
| | | } |
| | | |
| | | private String code; |
| | | private String desc; |
| | | |
| | | public String getCode() { |
| | | return code; |
| | | } |
| | | |
| | | public void setCode(String code) { |
| | | this.code = code; |
| | | } |
| | | |
| | | public String getDesc() { |
| | | return desc; |
| | | } |
| | | |
| | | public void setDesc(String desc) { |
| | | this.desc = desc; |
| | | } |
| | | } |
对比新文件 |
| | |
| | | package com.ruoyi.doublePrevention.enums; |
| | | |
| | | public enum ResultCodes { |
| | | OK("200","一切 ok"), |
| | | CLIENT_ERROR("A0001","用户端错误"), |
| | | CLIENT_REGEISTER_ERROR_("A0100","用户注册错误"), |
| | | CLIENT_NOT_ALLOW_PRIVACY_AGREEMENT("A0101","用户未同意隐私协议"), |
| | | CLIENT_REGEISTER_AREA_NOT_SUPPORT("A0102","注册国家或地区受限"), |
| | | CLIENT_USERNAME_ERROR("A0110","用户名校验失败"), |
| | | CLIENT_USERNAME_EXIST("A0111","用户名已存在"), |
| | | CLIENT_USERNAME_CONTAINS_SENSITIVE_WORD("A0112","用户名包含敏感词"), |
| | | CLIENT_USERNAME_CONTAINS_INVALID_SYMBOL("A0113","用户名包含特殊字符"), |
| | | CLIENT_PASSWORD_CHECK_ERROR("A0120","密码校验失败"), |
| | | CLIENT_PASSWORD_LENGTH_ERROR("A0121","密码长度错误"), |
| | | CLIENT_PASSWORD_RULE_ERROR("A0122","密码强度不够"), |
| | | CLIENT_CHECK_CODE_ERROR("A0130","校验码错误"), |
| | | CLIENT_CHECK_CODE_SMS_ERROR("A0131","短信校验码错误"), |
| | | CLIENT_CHECK_CODE_EMAIL_ERROR("A0132","邮件校验码错误"), |
| | | CLIENT_CHECK_CODE_AUDIO_ERROR("A0133","语音校验码错误"), |
| | | CLIENT_LICENSE_ERROR("A0140","用户证件异常"), |
| | | |
| | | CLIENT_USER_INFO_ERROR("A0150","用户基本信息校验失败"), |
| | | CLIENT_USER_PHONE_RULE_ERROR("A0151","手机格式校验失败"), |
| | | CLIENT_USER_ADDRESS_RULE_ERROR("A0152","地址格式校验失败"), |
| | | CLIENT_USER_MAIL_RULE_ERROR("A0153","邮箱格式校验失败"), |
| | | |
| | | CLIENT_LOGIN_ABNORMAL("A0200","用户登陆异常"), |
| | | CLIENT_PASSWORD_NULL("A0209","用户密码不可为空"), |
| | | CLIENT_PASSWORD_ERROR("A0210","用户密码错误"), |
| | | CLIENT_PASSWORD_INPUT_LIMIT_ERROR("A0211","用户输入密码次数超限"), |
| | | CLIENT_CREDENTIALS_EXPIRED("A0212","用户认证过期"), |
| | | CLIENT_CREDENTIALS_LACK("A0213","用户认证标识缺少"), |
| | | CLIENT_CREDENTIALS_TOKEN_INVALID("A0215","用户认证token无效"), |
| | | CLIENT_IDENTITY_CHECK_ERROR("A0220","用户身份校验失败"), |
| | | |
| | | CLIENT_LOGIN_OUTTIME("A0230","用户登陆已过期"), |
| | | |
| | | CLIENT_PERMISSION_ERROR("A0300","访问权限异常"), |
| | | CLIENT_PERMISSION_NOT_ALLOW("A0301","访问未授权"), |
| | | CLIENT_PERMISSION_AUTH_APPLY("A0302","正在授权中"), |
| | | CLIENT_PERMISSION_AUTH_REJECT("A0303","用户授权申请被拒绝"), |
| | | CLIENT_PERMISSION_AUTH_INTERCEPT("A0310","因访问对象隐私设置被拦截"), |
| | | CLIENT_PERMISSION_AUTH_EXPIRED("A0311","授权已过期"), |
| | | CLIENT_PERMISSION_API_NOAUTH("A0312","无权限使用API"), |
| | | CLIENT_PERMISSION_API_INTERCEPT("A0320","用户访问被拦截"), |
| | | |
| | | CLIENT_SIGN_ERROR("A0340","用户签名异常"), |
| | | CLIENT_SIGN_RSA_ERROR("A0341","RSA 签名错误"), |
| | | CLIENT_PARAM_ERROR("A0400","用户请求参数错误"), |
| | | CLIENT_PARAM_INVALID("A0402","参数无效"), |
| | | CLIENT_PARAM_REQUIRED_EMPTY("A0410","请求必填参数为空"), |
| | | CLIENT_PARAM_FORMAT_ERROR("A0421","参数格式不匹配"), |
| | | CLIENT_PARAM_BATCH_OVER_LIMIT("A0426","请求批量处理总个数超出限制"), |
| | | CLIENT_PARAM_JSON_PRASE_ERROR("A0427","请求 JSON 解析失败"), |
| | | CLIENT_PARAM_ILLEGAL("A0430","参数非法"), |
| | | CLIENT_ORDER_OVERTIME("A0444","订单已超时"), |
| | | CLIENT_ORDER_CLOSE("A0443","订单已关闭"), |
| | | |
| | | // 项目 |
| | | CLIENT_PROJECT_NOT_EXIST("A0450","项目不存在"), |
| | | // 菜单 |
| | | CLIENT_MENU_NOT_EXIST("A0460", "菜单不存在"), |
| | | CLIENT_MENU_PARENT_NOT_EXIST("A0461", "父菜单不存在"), |
| | | |
| | | // 用户 |
| | | CLIENT_ACCOUNT_USERNAME_EXISTED("A0480","账户名已存在"), |
| | | CLIENT_ACCOUNT_USERNAME_NULL("A0480","账户名不可为空"), |
| | | CLIENT_ACCOUNT_PASSWORD_NULL("A0481","账户密码不可为空"), |
| | | CLIENT_ACCOUNT_NOT_EXIST("A0201","用户账户不存在"), |
| | | CLIENT_ACCOUNT_FROZEN("A0202","用户账户被冻结"), |
| | | CLIENT_ACCOUNT_DELETE("A0203","用户账户已作废"), |
| | | CLIENT_ACCOUNT_DISABLED("A0204","用户账户不可用"), |
| | | CLIENT_ACCOUNT_ALREADY_ABANDON("A0205","用户账户已经弃用"), |
| | | CLIENT_ACCOUNT_HAS_NO_ROLE("A0206","用户账户未分配角色"), |
| | | CLIENT_ACCOUNT_ONLY_ONE_ROLE("A0207","用户账户只能拥有一个角色"), |
| | | |
| | | // |
| | | |
| | | // 角色 |
| | | CLIENT_ROLE_NOT_EXIST("A0250","角色不存在"), |
| | | CLIENT_ROLE_CODE_NOT_ON("A0251","角色未启用"), |
| | | CLIENT_ROLE_HAS_NO_PROJECT("A0252","角色未分配项目"), |
| | | CLIENT_ROLE_CODE_NOT_EXIST("A0253","角色code不存在"), |
| | | CLIENT_ROLE_DISABLED("A0253","角色未启用"), |
| | | |
| | | // 部门 |
| | | CLIENT_DEP_NOT_EXIST("A0270","部门不存在"), |
| | | CLIENT_DEP_NAME_EXIST("A0271","部门名称已存在"), |
| | | CLIENT_DEP_DISABLED("A0272","部门未启用"), |
| | | |
| | | // 权限 |
| | | CLIENT_PERMISSION_NOT_EXIST("A0280","权限不存在"), |
| | | |
| | | |
| | | |
| | | // 前端 |
| | | CLIENT_PARAM_NULL("C0001","请求关键参数为空"), |
| | | |
| | | // Redis |
| | | REDIS_KEY_NULL("R0001","系统redis入参为空"), |
| | | |
| | | |
| | | // 业务错误 |
| | | BUSINESS_ERROR("Y0001", "业务错误"), |
| | | |
| | | // 系统 |
| | | SERVER_ERROR("B0001","系统执行出错"), |
| | | SERVER_UPDATE_ERROR("B0002","数据更新失败"), |
| | | SERVER_ADD_ERROR("B00003","数据新增失败"), |
| | | SERVER_DEL_ERROR("B00004","数据删除失败"), |
| | | SERVER_PARAM_NULL("B00005","系统入参为空"), |
| | | SERVER_BATCH_ADD_ERROR("B00006","数据批量新增失败"), |
| | | SERVER_BATCH_UPDATE_ERROR("B00007","数据批量修改失败"), |
| | | SERVER_DATABASE_DATA_DUPLICATED("B00008","数据库内部记录重复"), |
| | | SERVER_UPDATE_DATA_NO_CHANGE("B00009","更新数据没有发生变化"), |
| | | SERVER_DEL_OVER_SIZE("B00010","批量删除个数过多"), |
| | | SERVER_SELECT_OVER_SIZE("B00011","批量查询个数过多"), |
| | | SERVER_EXEC_OUTTIME("B0100","系统执行超时"), |
| | | |
| | | |
| | | // RPC |
| | | RPC_RESULT_NULL("R0001","RPC没有返回"), |
| | | RPC_DATA_NULL("R0002","RPC数据为空"), |
| | | RPC_DATA_TYPE_NOT_MATCH("R0003","RPC数据返回类型不匹配"), |
| | | |
| | | // 请求 |
| | | CLIENT_METHOD_NOT_MATCH("M0001","请求方法不匹配"), |
| | | CLIENT_REQUEST_MESSAGE_NOT_READABLE("M0002","请求消息非法") |
| | | ; |
| | | |
| | | |
| | | |
| | | ResultCodes(String code, String desc) { |
| | | this.code = code; |
| | | this.desc = desc; |
| | | } |
| | | |
| | | private String code; |
| | | private String desc; |
| | | |
| | | public String getCode() { |
| | | return code; |
| | | } |
| | | |
| | | public void setCode(String code) { |
| | | this.code = code; |
| | | } |
| | | |
| | | public String getDesc() { |
| | | return desc; |
| | | } |
| | | |
| | | public void setDesc(String desc) { |
| | | this.desc = desc; |
| | | } |
| | | } |
| | |
| | | @Repository |
| | | public interface PreventRiskControlMeasureRepository{ |
| | | |
| | | /** |
| | | * @description 新增风险控制措施 |
| | | */ |
| | | int savePreventRiskControlMeasure(PreventRiskControlMeasure preventRiskControlMeasure); |
| | | |
| | | |
| | | /** |
| | | * @description 根据主键id删除风险控制措施 |
| | | */ |
| | | int deletePreventRiskControlMeasureById(PreventRiskControlMeasure preventRiskControlMeasure); |
| | | |
| | | /** |
| | | * @description 根据主键id对风险控制措施进行修改 |
| | | */ |
| | | int updatePreventRiskControlMeasureById(PreventRiskControlMeasure preventRiskControlMeasure); |
| | | |
| | | /** |
| | | * @description 根据主键id查询风险控制措施 |
| | | */ |
| | | PreventRiskControlMeasure getPreventRiskControlMeasureById(Long id); |
| | | |
| | | } |
对比新文件 |
| | |
| | | package com.ruoyi.doublePrevention.repository; |
| | | |
| | | |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Repository |
| | | public interface PreventRiskControlTemplateRepository{ |
| | | |
| | | } |
| | |
| | | @Repository |
| | | public interface PreventRiskEventRepository{ |
| | | |
| | | /** |
| | | * @description 新增风险控制事件 |
| | | */ |
| | | int savePreventRiskEvent(PreventRiskEvent preventRiskEvent); |
| | | |
| | | |
| | | /** |
| | | * @description 根据主键id查询风险控制事件 |
| | | */ |
| | | PreventRiskEvent getPreventRiskEventById(Long id); |
| | | |
| | | |
| | | /** |
| | | * @description 根据主键id删除风险控制事件 |
| | | */ |
| | | int deletePreventRiskEventById(PreventRiskEvent preventRiskEvent); |
| | | |
| | | /** |
| | | * @description 根据主键id对风险控制事件进行修改 |
| | | */ |
| | | int updatePreventRiskEventById(PreventRiskEvent preventRiskEvent); |
| | | } |
| | |
| | | package com.ruoyi.doublePrevention.service;
|
| | |
|
| | | import com.ruoyi.doublePrevention.entity.PreventRiskEvent;
|
| | | import com.ruoyi.doublePrevention.entity.dto.req.PreventRiskEventSaveReqDTO;
|
| | | import com.ruoyi.doublePrevention.vo.ResultVO;
|
| | | import com.ruoyi.project.tr.riskList.domain.RiskList;
|
| | |
|
| | | public interface RiskService {
|
| | |
| | | * */
|
| | | int insertRiskUnitUuid(Long id);
|
| | |
|
| | | /**
|
| | | * 风险事件-新增
|
| | | */
|
| | | ResultVO<PreventRiskEvent> saveRiskEvent(PreventRiskEventSaveReqDTO riskEventSaveReqDTO);
|
| | | }
|
| | |
| | | |
| | | public interface PreventRiskControlMeasureService { |
| | | |
| | | |
| | | /** |
| | | * @description 新增风险控制措施 |
| | | */ |
| | | int savePreventRiskControlMeasure(PreventRiskControlMeasure preventRiskControlMeasure); |
| | | |
| | | /** |
| | | * @description 根据主键id查询风险控制措施 |
| | | */ |
| | | PreventRiskControlMeasure getPreventRiskControlMeasureById(Long id); |
| | | |
| | | /** |
| | | * @description 根据主键id删除风险控制措施 |
| | | */ |
| | | int deletePreventRiskControlMeasureById(PreventRiskControlMeasure preventRiskControlMeasure); |
| | | |
| | | /** |
| | | * @description 根据主键id对风险控制措施进行修改 |
| | | */ |
| | | int updatePreventRiskControlMeasureById(PreventRiskControlMeasure preventRiskControlMeasure); |
| | | |
| | | } |
| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.doublePrevention.entity.PreventRiskControlMeasure; |
| | | import com.ruoyi.doublePrevention.entity.PreventRiskEvent; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface PreventRiskEventService { |
| | | |
| | | /** |
| | | * @description 新增风险控制事件 |
| | | */ |
| | | int savePreventRiskEvent(PreventRiskEvent preventRiskEvent); |
| | | |
| | | /** |
| | | * @description 根据主键id查询风险控制事件 |
| | | */ |
| | | PreventRiskEvent getPreventRiskEventById(Long id); |
| | | |
| | | /** |
| | | * @description 根据主键id删除风险控制事件 |
| | | */ |
| | | int deletePreventRiskEventById(PreventRiskEvent preventRiskEvent); |
| | | |
| | | /** |
| | | * @description 根据主键id对风险控制事件进行修改 |
| | | */ |
| | | int updatePreventRiskEventById(PreventRiskEvent preventRiskEvent); |
| | | |
| | | |
| | | } |
| | |
| | | import com.ruoyi.doublePrevention.entity.PreventRiskControlMeasure; |
| | | import com.ruoyi.doublePrevention.repository.PreventRiskControlMeasureRepository; |
| | | import com.ruoyi.doublePrevention.service.baseService.PreventRiskControlMeasureService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Service("PreventRiskControlMeasureService") |
| | | public class PreventRiskControlMeasureServiceImpl implements PreventRiskControlMeasureService { |
| | | |
| | | @Autowired |
| | | private PreventRiskControlMeasureRepository preventRiskControlMeasureRepository; |
| | | |
| | | |
| | | /** |
| | | * @description 新增风险控制措施 |
| | | */ |
| | | @Override |
| | | public int savePreventRiskControlMeasure(PreventRiskControlMeasure preventRiskControlMeasure) { |
| | | return preventRiskControlMeasureRepository.savePreventRiskControlMeasure(preventRiskControlMeasure); |
| | | } |
| | | |
| | | /** |
| | | * @description 根据主键id查询风险控制措施 |
| | | */ |
| | | @Override |
| | | public PreventRiskControlMeasure getPreventRiskControlMeasureById(Long id) { |
| | | return preventRiskControlMeasureRepository.getPreventRiskControlMeasureById(id); |
| | | } |
| | | |
| | | /** |
| | | * @description 根据主键id删除风险控制措施 |
| | | */ |
| | | @Override |
| | | public int deletePreventRiskControlMeasureById(PreventRiskControlMeasure preventRiskControlMeasure) { |
| | | int deleteResult = preventRiskControlMeasureRepository.deletePreventRiskControlMeasureById(preventRiskControlMeasure); |
| | | return deleteResult; |
| | | } |
| | | |
| | | /** |
| | | * @description 根据主键id对风险控制措施进行修改 |
| | | */ |
| | | @Override |
| | | public int updatePreventRiskControlMeasureById(PreventRiskControlMeasure preventRiskControlMeasure) { |
| | | int updateResult = preventRiskControlMeasureRepository.updatePreventRiskControlMeasureById(preventRiskControlMeasure); |
| | | return updateResult; |
| | | } |
| | | } |
| | |
| | | import com.ruoyi.doublePrevention.entity.PreventRiskEvent; |
| | | import com.ruoyi.doublePrevention.repository.PreventRiskEventRepository; |
| | | import com.ruoyi.doublePrevention.service.baseService.PreventRiskEventService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | //@Service("PreventRiskEventService") |
| | | @Service("PreventRiskEventService") |
| | | public class PreventRiskEventServiceImpl implements PreventRiskEventService { |
| | | |
| | | @Autowired |
| | | private PreventRiskEventRepository preventRiskEventRepository; |
| | | |
| | | /** |
| | | * @description 新增风险控制事件 |
| | | */ |
| | | @Override |
| | | public int savePreventRiskEvent(PreventRiskEvent preventRiskEvent) { |
| | | return preventRiskEventRepository.savePreventRiskEvent(preventRiskEvent); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * @description 根据主键id查询风险控制事件 |
| | | */ |
| | | @Override |
| | | public PreventRiskEvent getPreventRiskEventById(Long id) { |
| | | return preventRiskEventRepository.getPreventRiskEventById(id); |
| | | } |
| | | |
| | | /** |
| | | * @description 根据主键id删除风险控制事件 |
| | | */ |
| | | @Override |
| | | public int deletePreventRiskEventById(PreventRiskEvent preventRiskEvent) { |
| | | int deleteResult = preventRiskEventRepository.deletePreventRiskEventById(preventRiskEvent); |
| | | return deleteResult; |
| | | } |
| | | |
| | | /** |
| | | * @description 根据主键id对风险控制事件进行修改 |
| | | */ |
| | | @Override |
| | | public int updatePreventRiskEventById(PreventRiskEvent preventRiskEvent) { |
| | | int updateResult = preventRiskEventRepository.updatePreventRiskEventById(preventRiskEvent); |
| | | return updateResult; |
| | | } |
| | | } |
| | |
| | | package com.ruoyi.doublePrevention.service.impl;
|
| | |
|
| | | import com.ruoyi.common.utils.StringUtils;
|
| | | import com.ruoyi.doublePrevention.entity.PreventRiskEvent;
|
| | | import com.ruoyi.doublePrevention.entity.PreventRiskUnitUuid;
|
| | | import com.ruoyi.doublePrevention.entity.dto.req.PreventRiskEventSaveReqDTO;
|
| | | import com.ruoyi.doublePrevention.enums.StatusEnum;
|
| | | import com.ruoyi.doublePrevention.service.RiskService;
|
| | | import com.ruoyi.doublePrevention.service.baseService.PreventRiskUnitUuidService;
|
| | | import com.ruoyi.doublePrevention.vo.ResultVO;
|
| | | import org.springframework.beans.factory.annotation.Autowired;
|
| | | import org.springframework.stereotype.Service;
|
| | |
|
| | |
| | | riskUnitUuid.setDeleteStatus(StatusEnum.DELETE_STATUS_USE.getCode());
|
| | | return preventRiskUnitUuidService.insertRiskUnitUuid(riskUnitUuid);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 风险事件-新增
|
| | | */
|
| | | @Override
|
| | | public ResultVO<PreventRiskEvent> saveRiskEvent(PreventRiskEventSaveReqDTO riskEventSaveReqDTO) {
|
| | | ResultVO resultVO = new ResultVO<>();
|
| | | resultVO.setCode("200");
|
| | | resultVO.setMsg("新增成功");
|
| | | Long riskUnitId = riskEventSaveReqDTO.getRiskUnitId();
|
| | | String riskEventName = riskEventSaveReqDTO.getRiskEventName();
|
| | | String eventResult = riskEventSaveReqDTO.getEventResult();
|
| | | if (riskUnitId == null){
|
| | | resultVO.setMsg("安全风险分析单元名称不能为空");
|
| | | return resultVO;
|
| | | }
|
| | | if (StringUtils.isEmpty(riskEventName)){
|
| | | resultVO.setMsg("安全风险事件名称");
|
| | | return resultVO;
|
| | | }
|
| | | if (StringUtils.isEmpty(eventResult)){
|
| | | resultVO.setMsg("可能造成得后果");
|
| | | return resultVO;
|
| | | }
|
| | |
|
| | | return null;
|
| | | }
|
| | | }
|
对比新文件 |
| | |
| | | package com.ruoyi.doublePrevention.vo; |
| | | |
| | | |
| | | import com.ruoyi.doublePrevention.enums.ResultCodes; |
| | | |
| | | import java.io.Serializable; |
| | | |
| | | public class ResultVO<T> implements Serializable { |
| | | |
| | | private String code; |
| | | |
| | | private Integer count; |
| | | |
| | | private String msg; |
| | | |
| | | private T data; |
| | | |
| | | public static ResultVO success(){ |
| | | ResultVO resultVO = new ResultVO(); |
| | | resultVO.setCode(ResultCodes.OK.getCode()); |
| | | return resultVO; |
| | | } |
| | | |
| | | public ResultVO() { |
| | | } |
| | | |
| | | |
| | | public ResultVO(String code, String msg) { |
| | | this.code = code; |
| | | this.msg = msg; |
| | | } |
| | | |
| | | public ResultVO(ResultCodes code, T data) { |
| | | this.code = code.getCode(); |
| | | this.msg = code.getDesc(); |
| | | this.data = data; |
| | | } |
| | | |
| | | |
| | | public ResultVO(ResultCodes code) { |
| | | this.code = code.getCode(); |
| | | this.msg = code.getDesc(); |
| | | } |
| | | |
| | | |
| | | |
| | | public String getCode() { |
| | | return code; |
| | | } |
| | | |
| | | public void setCode(String code) { |
| | | this.code = code; |
| | | } |
| | | |
| | | public Integer getCount() { |
| | | return count; |
| | | } |
| | | |
| | | public void setCount(Integer count) { |
| | | this.count = count; |
| | | } |
| | | |
| | | public String getMsg() { |
| | | return msg; |
| | | } |
| | | |
| | | public void setMsg(String msg) { |
| | | this.msg = msg; |
| | | } |
| | | |
| | | public Object getData() { |
| | | return data; |
| | | } |
| | | |
| | | public void setData(T data) { |
| | | this.data = data; |
| | | } |
| | | } |
| | |
| | | <result column="check_content" property="checkContent"/> |
| | | </resultMap> |
| | | |
| | | <insert id="savePreventRiskControlMeasure" parameterType="com.ruoyi.doublePrevention.entity.PreventRiskControlMeasure"> |
| | | insert into prevent_risk_control_measure |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="uuid != null ">uuid,</if> |
| | | <if test="deleteStatus != null ">delete_status,</if> |
| | | <if test="gmtCreate != null ">gmt_create,</if> |
| | | <if test="gmtModitify != null ">gmt_moditify,</if> |
| | | <if test="controlType != null ">control_type,</if> |
| | | <if test="classify1 != null and classify1 != ''">classify1,</if> |
| | | <if test="classify2 != null and classify2 != '' ">classify2,</if> |
| | | <if test="riskEventId != null ">risk_event_id,</if> |
| | | <if test="enterpriseId != null ">enterprise_id,</if> |
| | | <if test="riskEventUuid != null ">risk_event_uuid,</if> |
| | | <if test="enterpriseUuid != null ">enterprise_uuid,</if> |
| | | <if test="classify3 != null and classify3 != '' ">classify3,</if> |
| | | <if test="controlMeasureCode != null ">control_measure_code,</if> |
| | | <if test="createByUserName != null and createByUserName != '' ">create_by_user_name,</if> |
| | | <if test="lastEditUserName != null and lastEditUserName != '' ">last_edit_user_name,</if> |
| | | <if test="measureDesc != null and measureDesc != '' ">measure_desc,</if> |
| | | <if test="reportStatus != null ">report_status,</if> |
| | | <if test="reportTime != null ">report_time,</if> |
| | | <if test="updateReportDataTime != null ">update_report_data_time,</if> |
| | | <if test="reportSwitch != null ">report_switch,</if> |
| | | <if test="checkContent != null ">check_content,</if> |
| | | </trim> |
| | | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| | | <if test="uuid != null ">#{uuid},</if> |
| | | <if test="deleteStatus != null ">#{deleteStatus},</if> |
| | | <if test="gmtCreate != null ">#{gmtCreate},</if> |
| | | <if test="gmtModitify != null ">#{gmtModitify},</if> |
| | | <if test="controlType != null ">#{controlType},</if> |
| | | <if test="classify1 != null and classify1 != ''">#{classify1},</if> |
| | | <if test="classify2 != null and classify2 != '' ">#{classify2},</if> |
| | | <if test="riskEventId != null ">#{riskEventId},</if> |
| | | <if test="enterpriseId != null ">#{enterpriseId},</if> |
| | | <if test="riskEventUuid != null ">#{riskEventUuid},</if> |
| | | <if test="enterpriseUuid != null ">#{enterpriseUuid},</if> |
| | | <if test="classify3 != null and classify3 != '' ">#{classify3},</if> |
| | | <if test="controlMeasureCode != null ">#{controlMeasureCode},</if> |
| | | <if test="createByUserName != null and createByUserName != '' ">#{createByUserName},</if> |
| | | <if test="lastEditUserName != null and lastEditUserName != '' ">#{lastEditUserName},</if> |
| | | <if test="measureDesc != null and measureDesc != '' ">#{measureDesc},</if> |
| | | <if test="reportStatus != null ">#{reportStatus},</if> |
| | | <if test="reportTime != null ">#{reportTime},</if> |
| | | <if test="updateReportDataTime != null ">#{updateReportDataTime},</if> |
| | | <if test="reportSwitch != null ">#{reportSwitch},</if> |
| | | <if test="checkContent != null ">#{checkContent},</if> |
| | | </trim> |
| | | </insert> |
| | | |
| | | |
| | | <update id="updatePreventRiskControlMeasureById" parameterType="com.ruoyi.doublePrevention.entity.PreventRiskControlMeasure"> |
| | | update prevent_risk_control_measure |
| | | <set> |
| | | <if test="gmtModitify != null "> |
| | | gmt_moditify = #{gmtModitify} |
| | | </if> |
| | | <if test="controlType != null"> |
| | | control_type = #{controlType} |
| | | </if> |
| | | <if test="classify1 != null"> |
| | | classify1 = #{classify1} |
| | | </if> |
| | | <if test="classify2 != null"> |
| | | classify2 = #{classify2} |
| | | </if> |
| | | <if test="controlMeasureCode != null"> |
| | | control_measure_code = #{controlMeasureCode} |
| | | </if> |
| | | <if test="measureDesc != null"> |
| | | measure_desc = #{measureDesc} |
| | | </if> |
| | | <if test="riskEventId != null"> |
| | | risk_event_id = #{riskEventId} |
| | | </if> |
| | | <if test="riskEventUuid != null"> |
| | | risk_event_uuid = #{riskEventUuid} |
| | | </if> |
| | | <if test="classify3 != null"> |
| | | classify3 = #{classify3} |
| | | </if> |
| | | <if test="lastEditUserName != null"> |
| | | last_edit_user_name = #{lastEditUserName} |
| | | </if> |
| | | <if test="reportTime != null"> |
| | | report_time = #{reportTime} |
| | | </if> |
| | | <if test="updateReportDataTime != null"> |
| | | update_report_data_time = #{updateReportDataTime} |
| | | </if> |
| | | <if test="reportStatus != null"> |
| | | report_status = #{reportStatus} |
| | | </if> |
| | | <if test="reportSwitch != null"> |
| | | report_switch = #{reportSwitch} |
| | | </if> |
| | | <if test="checkContent != null"> |
| | | check_content = #{checkContent} |
| | | </if> |
| | | where id = #{id} and delete_status = 0 |
| | | </set> |
| | | </update> |
| | | |
| | | <update id="deletePreventRiskControlMeasureById"> |
| | | update prevent_risk_control_measure |
| | | <set> |
| | | <if test="preventRiskControlMeasure.gmtModitify != null "> |
| | | gmt_moditify = #{preventRiskControlMeasure.gmtModitify}, |
| | | </if> |
| | | <if test="preventRiskControlMeasure.lastEditUserName != null "> |
| | | last_edit_user_name = #{preventRiskControlMeasure.lastEditUserName}, |
| | | </if> |
| | | delete_status = 1 where id = #{id} |
| | | </set> |
| | | </update> |
| | | |
| | | |
| | | <select id="getPreventRiskControlMeasureById" |
| | | resultType="com.ruoyi.doublePrevention.entity.PreventRiskControlMeasure"> |
| | | select * from prevent_risk_control_measure |
| | | where id = #{id} and delete_status = 0 |
| | | </select> |
| | | |
| | | </mapper> |
对比新文件 |
| | |
| | | <?xml version="1.0" encoding="UTF-8" ?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" > |
| | | <mapper namespace="com.ruoyi.doublePrevention.repository.PreventRiskControlTemplateRepository"> |
| | | |
| | | <resultMap id="BaseResultMap" type="com.ruoyi.doublePrevention.entity.PreventRiskControlTemplate"> |
| | | <id property="id" column="id"/> |
| | | <result property="uuid" column="uuid"/> |
| | | <result property="deleteStatus" column="delete_status"/> |
| | | <result property="orderIndex" column="order_index"/> |
| | | <result property="parentId" column="parent_id"/> |
| | | <result property="riskMeasureName" column="risk_measure_name"/> |
| | | </resultMap> |
| | | |
| | | |
| | | </mapper> |
| | |
| | | <result column="update_report_data_time" property="updateReportDataTime"/> |
| | | <result column="report_switch" property="reportSwitch"/> |
| | | </resultMap> |
| | | <update id="deletePreventRiskEventById"> |
| | | update prevent_risk_event |
| | | <set> |
| | | <if test="preventRiskEvent.gmtModitify != null "> |
| | | gmt_moditify = #{preventRiskEvent.gmtModitify}, |
| | | </if> |
| | | <if test="preventRiskEvent.lastEditUserName != null "> |
| | | last_edit_user_name = #{preventRiskEvent.lastEditUserName}, |
| | | </if> |
| | | delete_status = 1 where id = #{id} |
| | | </set> |
| | | </update> |
| | | |
| | | <!--IPage<PreventRiskEvent> getRiskUnitPage(PreventRiskEventQueryReqDTO riskEventQueryReqDTO);--> |
| | | <select id="getRiskEventPage" resultMap="BaseResultMap"> |
| | | |
| | | <update id="updatePreventRiskEventById"> |
| | | update prevent_risk_event |
| | | <trim prefix="SET" suffixOverrides=","> |
| | | <if test="deleteStatus != null ">delete_status = #{deleteStatus},</if> |
| | | <if test="riskUnitId != null ">risk_unit_id = #{riskUnitId},</if> |
| | | <if test="enterpriseId != null ">enterprise_id = #{enterpriseId},</if> |
| | | <if test="enterpriseUuid != null ">enterprise_uuid = #{enterpriseUuid},</if> |
| | | <if test="riskUnitUuid != null ">risk_unit_uuid = #{riskUnitUuid},</if> |
| | | <if test="createByUserName != null and createByUserName != '' ">create_by_user_name = #{createByUserName},</if> |
| | | <if test="lastEditUserName != null and lastEditUserName != ''">last_edit_user_name = #{lastEditUserName},</if> |
| | | <if test="eventResult != null and eventResult != '' ">event_result = #{eventResult},</if> |
| | | <if test="riskEventName != null and riskEventName != ''">risk_event_name = #{riskEventName},</if> |
| | | <if test="reportStatus != null ">report_status = #{reportStatus},</if> |
| | | <if test="reportTime != null ">report_time = #{reportTime},</if> |
| | | <if test="updateReportDataTime != null ">update_report_data_time = #{updateReportDataTime},</if> |
| | | <if test="reportSwitch != null ">report_switch = #{reportSwitch},</if> |
| | | </trim> |
| | | </update> |
| | | |
| | | |
| | | <insert id="savePreventRiskEvent" parameterType="com.ruoyi.doublePrevention.entity.PreventRiskEvent"> |
| | | insert into prevent_risk_event |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="uuid != null ">uuid,</if> |
| | | <if test="deleteStatus != null ">delete_status,</if> |
| | | <if test="riskUnitId != null ">risk_unit_id,</if> |
| | | <if test="enterpriseId != null ">enterprise_id,</if> |
| | | <if test="enterpriseUuid != null ">enterprise_uuid,</if> |
| | | <if test="riskUnitUuid != null ">risk_unit_uuid,</if> |
| | | <if test="gmtCreate != null ">gmt_create,</if> |
| | | <if test="gmtModitify != null ">gmt_moditify,</if> |
| | | <if test="createByUserName != null and createByUserName != '' ">create_by_user_name,</if> |
| | | <if test="lastEditUserName != null and lastEditUserName != ''">last_edit_user_name,</if> |
| | | <if test="eventResult != null and eventResult != '' ">event_result,</if> |
| | | <if test="riskEventName != null and riskEventName != ''">risk_event_name,</if> |
| | | <if test="reportStatus != null ">report_status,</if> |
| | | <if test="reportTime != null ">report_time,</if> |
| | | <if test="updateReportDataTime != null ">update_report_data_time,</if> |
| | | <if test="reportSwitch != null ">report_switch,</if> |
| | | </trim> |
| | | <trim prefix="values (" suffix=")" suffixOverrides=","> |
| | | <if test="uuid != null ">uuid,</if> |
| | | <if test="deleteStatus != null ">#{deleteStatus},</if> |
| | | <if test="riskUnitId != null ">#{riskUnitId},</if> |
| | | <if test="enterpriseId != null ">#{enterpriseId},</if> |
| | | <if test="enterpriseUuid != null ">#{enterpriseUuid},</if> |
| | | <if test="riskUnitUuid != null ">#{riskUnitUuid},</if> |
| | | <if test="gmtCreate != null ">#{gmtCreate},</if> |
| | | <if test="gmtModitify != null ">#{gmtModitify},</if> |
| | | <if test="createByUserName != null and createByUserName != '' ">#{createByUserName},</if> |
| | | <if test="lastEditUserName != null and lastEditUserName != ''">#{lastEditUserName},</if> |
| | | <if test="eventResult != null and eventResult != '' ">#{eventResult},</if> |
| | | <if test="riskEventName != null and riskEventName != ''">#{riskEventName},</if> |
| | | <if test="reportStatus != null ">#{reportStatus},</if> |
| | | <if test="reportTime != null ">#{reportTime},</if> |
| | | <if test="updateReportDataTime != null ">#{updateReportDataTime},</if> |
| | | <if test="reportSwitch != null ">#{reportSwitch},</if> |
| | | </trim> |
| | | </insert> |
| | | |
| | | <select id="getPreventRiskEventById" resultType="com.ruoyi.doublePrevention.entity.PreventRiskEvent"> |
| | | select * from prevent_risk_event |
| | | <where> |
| | | delete_status = 0 |
| | | <if test="queryParams.riskEventName != null"> |
| | | and risk_event_name like '%' #{queryParams.riskEventName} '%' |
| | | </if> |
| | | <if test="queryParams.riskUnitId != null"> |
| | | and risk_unit_id = #{queryParams.riskUnitId} |
| | | </if> |
| | | </where> |
| | | order by gmt_create desc |
| | | </select> |
| | | |
| | | <!--PreventRiskEvent getRiskEventByName(String riskEventName);--> |
| | | <select id="getRiskEventByName" resultType="com.ruoyi.doublePrevention.entity.PreventRiskEvent"> |
| | | select |
| | | id, |
| | | uuid, |
| | | risk_event_name |
| | | from prevent_risk_event |
| | | where delete_status = 0 and risk_event_name = #{riskEventName} |
| | | </select> |
| | | |
| | | <!--PreventRiskEvent getRiskEventNameById(Long id);--> |
| | | <select id="getRiskEventNameById" resultType="com.ruoyi.doublePrevention.entity.PreventRiskEvent"> |
| | | select |
| | | id, |
| | | uuid, |
| | | risk_event_name, |
| | | report_switch |
| | | from prevent_risk_event |
| | | where delete_status = 0 and id = #{id} |
| | | </select> |
| | | <!--List<PreventRiskEvent> getRiskEventNameByRiskUnitId(Long riskUnitId);--> |
| | | <select id="getRiskEventNameByRiskUnitId" resultMap="BaseResultMap"> |
| | | select |
| | | id, |
| | | risk_event_name |
| | | from prevent_risk_event |
| | | where delete_status = 0 and risk_unit_id = #{riskUnitId} |
| | | </select> |
| | | |
| | | <!--List<PreventRiskEvent> getListEvents();--> |
| | | <select id="getListEvents" resultMap="BaseResultMap"> |
| | | select |
| | | id, |
| | | uuid, |
| | | risk_event_name |
| | | from prevent_risk_event |
| | | where delete_status = 0 |
| | | </select> |
| | | |
| | | <!--int updateRiskEventReport(PreventHandReportConfigReqDTO preventHandReportConfigReqDTO);--> |
| | | <update id="updateRiskEventReport"> |
| | | update prevent_risk_ana_unit set |
| | | report_switch = #{reportSwitch} |
| | | where id = #{id} |
| | | </update> |
| | | |
| | | <!--int updateRiskEvent(PreventRiskEventUpdateParams updateParams);--> |
| | | <update id="updateRiskEvent"> |
| | | update prevent_risk_event set |
| | | risk_event_name = #{riskEventName}, |
| | | risk_unit_id = #{riskUnitId}, |
| | | risk_unit_uuid = #{riskUnitUuid}, |
| | | event_result = #{eventResult}, |
| | | gmt_moditify = #{gmtModitify}, |
| | | last_edit_user_name = #{lastEditUserName}, |
| | | update_report_data_time = #{updateReportDataTime}, |
| | | report_status = #{reportStatus}, |
| | | report_switch = #{reportSwitch} |
| | | where delete_status = 0 and id = #{id} |
| | | </update> |
| | | |
| | | <!--int deleteRiskEventById(PreventRiskEventDeleteReqDTO riskEventDeleteReqDTO);--> |
| | | <update id="deleteRiskEventById"> |
| | | update prevent_risk_event set |
| | | delete_status = 1, |
| | | last_edit_user_name = #{lastEditUserName}, |
| | | gmt_moditify = #{gmtModitify}, |
| | | update_report_data_time = #{updateReportDataTime} |
| | | where delete_status = 0 and id = #{id} |
| | | </update> |
| | | |
| | | <!--int updateEventReportStatus(Long id, byte code);--> |
| | | <update id="updateEventReportStatus"> |
| | | update prevent_risk_event set |
| | | report_status = #{reportStatus}, |
| | | report_time = #{reportTime} |
| | | where id = #{id} |
| | | </update> |
| | | |
| | | |
| | | |
| | | |
| | | <!--List<PreventRiskEvent> listReportEvent();--> |
| | | <select id="listReportEvent" resultMap="BaseResultMap"> |
| | | select * from prevent_risk_event |
| | | where report_switch = 1 and (update_report_data_time > report_time or report_time is null) |
| | | where id = #{id} and delete_status = 0 |
| | | </select> |
| | | |
| | | |