From 91733b612dff4dac4c47aae58a4917b065616c56 Mon Sep 17 00:00:00 2001 From: 16639036659 <577530412@qq.com> Date: 星期二, 06 九月 2022 14:27:27 +0800 Subject: [PATCH] 上报数据开关配置 --- src/main/java/com/ruoyi/doublePrevention/entity/PreventReportConfig.java | 94 +++++++++++++++ src/main/java/com/ruoyi/doublePrevention/enums/SyncEnum.java | 44 +++++++ src/main/java/com/ruoyi/doublePrevention/repository/PreventReportConfigRepository.java | 26 ++++ src/main/java/com/ruoyi/project/tr/HiddenDangerCheckJob/util/ScheduleUtils.java | 4 src/main/java/com/ruoyi/doublePrevention/repository/param/PreventReportConfigUpdateParams.java | 70 +++++++++++ src/main/java/com/ruoyi/project/tr/riskList/controller/BaseRiskController.java | 1 src/main/java/com/ruoyi/project/tr/riskList/controller/RiskListController.java | 2 src/main/java/com/ruoyi/doublePrevention/service/baseService/impl/PreventReportConfigServiceImpl.java | 43 +++++++ src/main/resources/mybatis/doublePrevention/PreventReportConfigMapper.xml | 35 +++++ src/main/java/com/ruoyi/doublePrevention/service/baseService/PreventReportConfigService.java | 23 +++ 10 files changed, 339 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/ruoyi/doublePrevention/entity/PreventReportConfig.java b/src/main/java/com/ruoyi/doublePrevention/entity/PreventReportConfig.java new file mode 100644 index 0000000..ba5df0a --- /dev/null +++ b/src/main/java/com/ruoyi/doublePrevention/entity/PreventReportConfig.java @@ -0,0 +1,94 @@ +package com.ruoyi.doublePrevention.entity; + +import com.baomidou.mybatisplus.annotation.TableName; + +import java.util.Date; + +@TableName("prevent_report_config") +public class PreventReportConfig { + + /** + * 主键 + */ + private Integer id; + /** + * 上报开关:0-开启;1-关闭 + */ + private Byte reportState; + /** + * 上报方式:0-手动;1-自动 + */ + private Byte reportType; + /** + * 上报数据 + */ + private String reportData; + /** + * 上报数据名称 + */ + private String reportDataName; + /** + * 最后修改时间 + */ + private Date gmtModitify; + /** + * 修改人 + */ + private String lastEditUserName; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Byte getReportState() { + return reportState; + } + + public void setReportState(Byte reportState) { + this.reportState = reportState; + } + + public Byte getReportType() { + return reportType; + } + + public void setReportType(Byte reportType) { + this.reportType = reportType; + } + + public String getReportData() { + return reportData; + } + + public void setReportData(String reportData) { + this.reportData = reportData; + } + + public String getReportDataName() { + return reportDataName; + } + + public void setReportDataName(String reportDataName) { + this.reportDataName = reportDataName; + } + + public Date getGmtModitify() { + return gmtModitify; + } + + public void setGmtModitify(Date gmtModitify) { + this.gmtModitify = gmtModitify; + } + + public String getLastEditUserName() { + return lastEditUserName; + } + + public void setLastEditUserName(String lastEditUserName) { + this.lastEditUserName = lastEditUserName; + } +} diff --git a/src/main/java/com/ruoyi/doublePrevention/enums/SyncEnum.java b/src/main/java/com/ruoyi/doublePrevention/enums/SyncEnum.java new file mode 100644 index 0000000..042c66a --- /dev/null +++ b/src/main/java/com/ruoyi/doublePrevention/enums/SyncEnum.java @@ -0,0 +1,44 @@ +package com.ruoyi.doublePrevention.enums; + +import com.fasterxml.jackson.annotation.JsonValue; + +public enum SyncEnum { + + SYNC_WAIT_EXEC((byte) 1, "待上报"), + SYNC_EXEC_SUCCESS((byte) 2, "已上报"), + SYNC_NOT_EXEC((byte) 3, "不上报"), + SYNC_EXEC_FAIL((byte) 8, "上报失败"), + + REPORT_ON((byte) 0, "开启"), + REPORT_OFF((byte) 1, "关闭"), + + CHOOSE_DATA_REPORT_ON((byte) 1, "上报"), + CHOOSE_DATA_REPORT_OFF((byte) 2, "不上报"), + + REPORT_AUTO_EXEC_CONFIG((byte) 0, "手动上报配置"), + REPORT_HAND_EXEC_CONFIG((byte) 1, "自动上报配置"), + + REPORT_CONFIG_RISK_ANA_UNIT((byte) 1, "风险分析单元"), + REPORT_CONFIG_RISK_EVENT((byte) 2, "安全风险分析事件"), + REPORT_CONFIG_RISK_MEASURE((byte) 3, "安全风险管控措施"), + REPORT_CONFIG_TASK_FROM_WORK((byte) 4, "隐患排查任务配置"), + REPORT_CONFIG__CHECK_RECORD((byte) 5, "隐患排查任务记录"), + REPORT_CONFIG_DANGER_INFO((byte) 6, "隐患信息"), + ; + byte code; + @JsonValue + String value; + + SyncEnum(byte code, String value) { + this.code = code; + this.value = value; + } + + public byte getCode() { + return code; + } + + public String getValue() { + return value; + } +} diff --git a/src/main/java/com/ruoyi/doublePrevention/repository/PreventReportConfigRepository.java b/src/main/java/com/ruoyi/doublePrevention/repository/PreventReportConfigRepository.java new file mode 100644 index 0000000..578060d --- /dev/null +++ b/src/main/java/com/ruoyi/doublePrevention/repository/PreventReportConfigRepository.java @@ -0,0 +1,26 @@ +package com.ruoyi.doublePrevention.repository; + + +import com.ruoyi.doublePrevention.entity.PreventReportConfig; +import com.ruoyi.doublePrevention.repository.param.PreventReportConfigUpdateParams; +import org.springframework.stereotype.Repository; + +import java.util.List; + +@Repository +public interface PreventReportConfigRepository { + + /** + * 数据上报配置-查询 + */ + List<PreventReportConfig> ListReportConfigs(); + + /** + * 数据上报配置-修改 + */ + int updateReportConfig(PreventReportConfigUpdateParams updateParams); + /** + * 数据上报配置-按照id查询 + */ + PreventReportConfig selectById(int id); +} diff --git a/src/main/java/com/ruoyi/doublePrevention/repository/param/PreventReportConfigUpdateParams.java b/src/main/java/com/ruoyi/doublePrevention/repository/param/PreventReportConfigUpdateParams.java new file mode 100644 index 0000000..706724b --- /dev/null +++ b/src/main/java/com/ruoyi/doublePrevention/repository/param/PreventReportConfigUpdateParams.java @@ -0,0 +1,70 @@ +package com.ruoyi.doublePrevention.repository.param; + +import com.baomidou.mybatisplus.annotation.TableName; + +import java.util.Date; + +@TableName("prevent_report_config") +public class PreventReportConfigUpdateParams { + + /** + * 主键 + */ + private Integer id; + /** + * 上报开关:1-开启;2-关闭 + */ + private Byte reportState; + /** + * 上报方式:0-手动;1-自动 + */ + private Byte reportType; + /** + * 最后修改时间 + */ + private Date gmtModitify; + /** + * 修改人 + */ + private String lastEditUserName; + + public String getLastEditUserName() { + return lastEditUserName; + } + + public void setLastEditUserName(String lastEditUserName) { + this.lastEditUserName = lastEditUserName; + } + + public Date getGmtModitify() { + return gmtModitify; + } + + public void setGmtModitify(Date gmtModitify) { + this.gmtModitify = gmtModitify; + } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Byte getReportState() { + return reportState; + } + + public void setReportState(Byte reportState) { + this.reportState = reportState; + } + + public Byte getReportType() { + return reportType; + } + + public void setReportType(Byte reportType) { + this.reportType = reportType; + } +} diff --git a/src/main/java/com/ruoyi/doublePrevention/service/baseService/PreventReportConfigService.java b/src/main/java/com/ruoyi/doublePrevention/service/baseService/PreventReportConfigService.java new file mode 100644 index 0000000..b2cd6a3 --- /dev/null +++ b/src/main/java/com/ruoyi/doublePrevention/service/baseService/PreventReportConfigService.java @@ -0,0 +1,23 @@ +package com.ruoyi.doublePrevention.service.baseService; + + +import com.ruoyi.doublePrevention.entity.PreventReportConfig; +import com.ruoyi.doublePrevention.repository.param.PreventReportConfigUpdateParams; + +import java.util.List; + +public interface PreventReportConfigService { + + /** + * 数据上报配置-查询 + */ + List<PreventReportConfig> ListReportConfigs(); + /** + * 数据上报配置-修改 + */ + int updateReportConfig(PreventReportConfigUpdateParams updateParams); + /** + * 数据上报配置-按照id查询 + */ + PreventReportConfig getReportConfigById(int Id); +} diff --git a/src/main/java/com/ruoyi/doublePrevention/service/baseService/impl/PreventReportConfigServiceImpl.java b/src/main/java/com/ruoyi/doublePrevention/service/baseService/impl/PreventReportConfigServiceImpl.java new file mode 100644 index 0000000..0c6dc49 --- /dev/null +++ b/src/main/java/com/ruoyi/doublePrevention/service/baseService/impl/PreventReportConfigServiceImpl.java @@ -0,0 +1,43 @@ +package com.ruoyi.doublePrevention.service.baseService.impl; + +import com.ruoyi.doublePrevention.entity.PreventReportConfig; +import com.ruoyi.doublePrevention.repository.PreventReportConfigRepository; +import com.ruoyi.doublePrevention.repository.param.PreventReportConfigUpdateParams; +import com.ruoyi.doublePrevention.service.baseService.PreventReportConfigService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service("PreventReportConfigService") +public class PreventReportConfigServiceImpl implements PreventReportConfigService { + + @Autowired + private PreventReportConfigRepository preventReportConfigRepository; + + /** + * 数据上报配置-查询 + */ + @Override + public List<PreventReportConfig> ListReportConfigs() { + return preventReportConfigRepository.ListReportConfigs(); + } + + /** + * 数据上报配置-修改 + */ + @Override + public int updateReportConfig(PreventReportConfigUpdateParams updateParams) { + return preventReportConfigRepository.updateReportConfig(updateParams); + } + + /** + * 数据上报配置-按照id查询 + */ + @Override + public PreventReportConfig getReportConfigById(int Id) { + return preventReportConfigRepository.selectById(Id); + } + + +} diff --git a/src/main/java/com/ruoyi/project/tr/HiddenDangerCheckJob/util/ScheduleUtils.java b/src/main/java/com/ruoyi/project/tr/HiddenDangerCheckJob/util/ScheduleUtils.java index 4ec5137..e2f1016 100644 --- a/src/main/java/com/ruoyi/project/tr/HiddenDangerCheckJob/util/ScheduleUtils.java +++ b/src/main/java/com/ruoyi/project/tr/HiddenDangerCheckJob/util/ScheduleUtils.java @@ -20,7 +20,7 @@ * @param sysJob 执行计划 * @return 具体执行任务类 */ - private static Class<? extends Job> getQuartzJobClass(HiddenDangerCheckJob job) + private static Class<? extends org.quartz.Job> getQuartzJobClass(HiddenDangerCheckJob job) { boolean isConcurrent = "0".equals(job.getConcurrent()); return isConcurrent ? QuartzJobExecution.class : QuartzDisallowConcurrentExecution.class; @@ -47,7 +47,7 @@ */ public static void createScheduleJob(Scheduler scheduler, HiddenDangerCheckJob job) throws SchedulerException, TaskException { - Class<? extends Job> jobClass = getQuartzJobClass(job); + Class<? extends org.quartz.Job> jobClass = getQuartzJobClass(job); // 构建job信息 Long jobId = job.getJobId(); String jobGroup = job.getJobGroup(); diff --git a/src/main/java/com/ruoyi/project/tr/riskList/controller/BaseRiskController.java b/src/main/java/com/ruoyi/project/tr/riskList/controller/BaseRiskController.java index fdc1ac9..fcb7d73 100644 --- a/src/main/java/com/ruoyi/project/tr/riskList/controller/BaseRiskController.java +++ b/src/main/java/com/ruoyi/project/tr/riskList/controller/BaseRiskController.java @@ -88,6 +88,7 @@ @PostMapping("/add") @ResponseBody public AjaxResult addSave(RiskList riskList) { + //老代码 //保存前获取用户名以及公司信息 User sysUser = getSysUser(); riskList.setCreateBy(sysUser.getUserName()); diff --git a/src/main/java/com/ruoyi/project/tr/riskList/controller/RiskListController.java b/src/main/java/com/ruoyi/project/tr/riskList/controller/RiskListController.java index aea4c26..95d0991 100644 --- a/src/main/java/com/ruoyi/project/tr/riskList/controller/RiskListController.java +++ b/src/main/java/com/ruoyi/project/tr/riskList/controller/RiskListController.java @@ -201,7 +201,7 @@ int result = riskListService.insertRiskList(riskList); riskList.getRiskListId(); - + //todo 判断是风先分析单元 ,还是任务单元,分别封装处理 //新代码,为设施设备清单附属表添加uuid int uuidResult = riskService.insertRiskUnitUuid(riskList.getRiskListId()); if (uuidResult < 0){ diff --git a/src/main/resources/mybatis/doublePrevention/PreventReportConfigMapper.xml b/src/main/resources/mybatis/doublePrevention/PreventReportConfigMapper.xml new file mode 100644 index 0000000..8c553bf --- /dev/null +++ b/src/main/resources/mybatis/doublePrevention/PreventReportConfigMapper.xml @@ -0,0 +1,35 @@ +<?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.PreventReportConfigRepository"> + + <resultMap id="BaseResultMap" type="com.ruoyi.doublePrevention.entity.PreventReportConfig"> + <id property="id" column="id"/> + <result property="reportState" column="report_state"/> + <result property="reportType" column="report_type"/> + <result property="reportData" column="report_data"/> + <result property="reportDataName" column="report_data_name"/> + <result property="gmtModitify" column="gmt_moditify"/> + <result property="lastEditUserName" column="last_edit_user_name"/> + </resultMap> + + <!--List<PreventReportConfig> ListReportConfigs();--> + <select id="ListReportConfigs" resultMap="BaseResultMap"> + select id, report_state, report_type, report_data_name, gmt_moditify, last_edit_user_name + from prevent_report_config + </select> + + <!--int updateReportConfig(PreventReportConfigUpdateParams updateParams);--> + <update id="updateReportConfig"> + update prevent_report_config set + report_state = #{reportState}, + report_type = #{reportType}, + last_edit_user_name = #{lastEditUserName}, + gmt_moditify = #{gmtModitify} + where id = #{id} + </update> +<!-- PreventReportConfig selectById(int id);--> + <select id="selectById" resultMap="BaseResultMap"> + select * from prevent_report_config + where id = #{id} + </select> +</mapper> -- Gitblit v1.9.2