智能预警

This commit is contained in:
zhengqiaowen 2022-11-23 17:38:19 +08:00
parent 6f1e42009f
commit f049784fcf
10 changed files with 641 additions and 110 deletions

View File

@ -0,0 +1,51 @@
package com.rzyc.bean.task.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javax.validation.constraints.NotNull;
/**
* @Description:
* @Author: ZQW
* @CreateTime: 2022/11/23 16:26
*/
@ApiModel("分页请求参数")
public class PageDto {
@ApiModelProperty("关键字")
private String condition;
@NotNull(message = "页码不能为空")
@ApiModelProperty(value = "页码",required = true,example = "1")
private Integer page;//当前页
@NotNull(message = "每页条数不能为空")
@ApiModelProperty(value = "每页条数",required = true,example = "10")
private Integer pageSize;//每页显示多少条
public String getCondition() {
return condition;
}
public void setCondition(String condition) {
this.condition = condition;
}
public Integer getPage() {
return page;
}
public void setPage(Integer page) {
this.page = page;
}
public Integer getPageSize() {
return pageSize;
}
public void setPageSize(Integer pageSize) {
this.pageSize = pageSize;
}
}

View File

@ -0,0 +1,37 @@
package com.rzyc.bean.task.dto;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* @Description:
* @Author: ZQW
* @CreateTime: 2022/11/23 15:39
*/
@ApiModel("智能预警请求实体")
public class WarnDto {
@ApiModelProperty(value = "类型1.企业重大隐患 2.隐患未按期闭环 3.企业清单未落实 4.政府履职清单未履行 5.下级未履行上级任务",required = true)
private Integer type;
@ApiModelProperty(value = "预警1.当前预警 2.历史预警",required = true)
private Integer warnState;
public Integer getType() {
return type;
}
public void setType(Integer type) {
this.type = type;
}
public Integer getWarnState() {
return warnState;
}
public void setWarnState(Integer warnState) {
this.warnState = warnState;
}
}

View File

@ -0,0 +1,23 @@
package com.rzyc.bean.task.vo;
import io.swagger.annotations.ApiModelProperty;
/**
* @Description:
* @Author: ZQW
* @CreateTime: 2022/11/23 16:55
*/
public class NumVo {
@ApiModelProperty("未处理数量")
private Integer num;
public Integer getNum() {
return num;
}
public void setNum(Integer num) {
this.num = num;
}
}

View File

@ -0,0 +1,29 @@
package com.rzyc.mapper;
import com.github.pagehelper.Page;
import com.rzyc.bean.task.dto.WarnDto;
import com.rzyc.model.GovWarning;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* <p>
* 智能预警 Mapper 接口
* </p>
*
* @author
* @since 2022-11-23
*/
@Repository
public interface GovWarningMapper extends BaseMapper<GovWarning> {
List<GovWarning> selectAll(@Param("warnDto") WarnDto warnDto);
//只能预警分页
List<GovWarning> warnList(@Param("condition") String condition);
int countNum(@Param("type") Integer type);
}

View File

@ -0,0 +1,164 @@
package com.rzyc.model;
import com.baomidou.mybatisplus.annotation.TableName;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableField;
import java.io.Serializable;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* <p>
* 智能预警
* </p>
*
* @author
* @since 2022-11-23
*/
@TableName("gov_warning")
@ApiModel(value="GovWarning对象", description="智能预警")
public class GovWarning implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "预警id")
@TableId("warn_id")
private String warnId;
@ApiModelProperty(value = "预警内容")
@TableField("content")
private String content;
@ApiModelProperty(value = "目标id")
@TableField("target_id")
private String targetId;
@ApiModelProperty(value = "类型1.企业重大隐患 2.隐患未按期闭环 3.企业清单未落实 4.政府履职清单未履行 5.下级未履行上级任务")
@TableField("type")
private Integer type;
@ApiModelProperty(value = "预警1.当前预警 2.历史预警")
@TableField("warn_state")
private Integer warnState;
@ApiModelProperty(value = "处理状态 1.未处理 2.已处理")
@TableField("solve_state")
private Integer solveState;
@ApiModelProperty(value = "预警时间")
@TableField("warn_time")
private Date warnTime;
@ApiModelProperty(value = "创建时间")
@TableField("create_time")
private Date createTime;
@ApiModelProperty(value = "创建人")
@TableField("create_by")
private String createBy;
@ApiModelProperty(value = "修改时间")
@TableField("modify_time")
private Date modifyTime;
@ApiModelProperty(value = "修改人")
@TableField("modify_by")
private String modifyBy;
public Integer getSolveState() {
return solveState;
}
public void setSolveState(Integer solveState) {
this.solveState = solveState;
}
public String getWarnId() {
return warnId;
}
public void setWarnId(String warnId) {
this.warnId = warnId;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public String getTargetId() {
return targetId;
}
public void setTargetId(String targetId) {
this.targetId = targetId;
}
public Integer getType() {
return type;
}
public void setType(Integer type) {
this.type = type;
}
public Date getWarnTime() {
return warnTime;
}
public void setWarnTime(Date warnTime) {
this.warnTime = warnTime;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public String getCreateBy() {
return createBy;
}
public void setCreateBy(String createBy) {
this.createBy = createBy;
}
public Date getModifyTime() {
return modifyTime;
}
public void setModifyTime(Date modifyTime) {
this.modifyTime = modifyTime;
}
public String getModifyBy() {
return modifyBy;
}
public void setModifyBy(String modifyBy) {
this.modifyBy = modifyBy;
}
public Integer getWarnState() {
return warnState;
}
public void setWarnState(Integer warnState) {
this.warnState = warnState;
}
@Override
public String toString() {
return "GovWarning{" +
"warnId='" + warnId + '\'' +
", content='" + content + '\'' +
", targetId='" + targetId + '\'' +
", type=" + type +
", warnState=" + warnState +
", warnTime=" + warnTime +
", createTime=" + createTime +
", createBy='" + createBy + '\'' +
", modifyTime=" + modifyTime +
", modifyBy='" + modifyBy + '\'' +
'}';
}
}

View File

@ -0,0 +1,43 @@
<?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.rzyc.mapper.GovWarningMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="com.rzyc.model.GovWarning">
<id column="warn_id" property="warnId" />
<result column="content" property="content" />
<result column="target_id" property="targetId" />
<result column="type" property="type" />
<result column="warn_state" property="warnState" />
<result column="warn_time" property="warnTime" />
<result column="solve_state" property="solveState" />
<result column="create_time" property="createTime" />
<result column="create_by" property="createBy" />
<result column="modify_time" property="modifyTime" />
<result column="modify_by" property="modifyBy" />
</resultMap>
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
warn_id, content, target_id, type, warn_time, create_time, create_by, modify_time, modify_by
</sql>
<select id="selectAll" resultMap="BaseResultMap">
select gw.* from gov_warning gw where gw.type = #{warnDto.type} and gw.warn_state = #{warnDto.warnState}
</select>
<select id="warnList" resultMap="BaseResultMap">
SELECT * FROM gov_warning gw
<where>
<if test="condition != null and condition != ''">
and gw.content like concat('%',#{condition},'%')
</if>
</where>
ORDER BY gw.warn_time asc
</select>
<select id="countNum" resultType="int" parameterType="Integer">
select count(gw.warn_id) from gov_warning gw where gw.type = #{type} and gw.solve_state = '1'
</select>
</mapper>

View File

@ -68,7 +68,6 @@ public class EmergencyEquipmentController {
String resourceType)throws Exception{
return pcBusinessService.entEmEquipmentList(enterpriseId,page,pageSize,resourceType);
}
/**
* 应急资源修改
* @return list

View File

@ -334,6 +334,10 @@ public class BaseController {
@Autowired
protected IndustryWorkMapper industryWorkMapper;
//企业应急资源
@Autowired
protected EntEmEquipmentMapper entEmEquipmentMapper;
// //企业监管用户
// @Autowired
// protected EntUserMapper entUserMapper;
@ -470,8 +474,13 @@ public class BaseController {
@Autowired
protected InEntListMapper inEntListMapper;
//企业应急预案
@Autowired
protected EntEmReservePlanMapper entEmReservePlanMapper;
//政府智能预警
@Autowired
protected GovWarningMapper govWarningMapper;
/**
* 岗位不需要的字符串
*/
@ -841,6 +850,17 @@ public class BaseController {
}
}
/**
* 统一处理分页
* @param pager api返回的对象
* @param page 分页插件对象
* @throws Exception
*/
protected void getDatePage(Pager pager, Page page)throws Exception{
pager.setTotal(page.getTotal());
pager.setRows(page.getResult());
}
/**
* 履职任务
* @param receiveId
@ -1668,10 +1688,10 @@ public class BaseController {
* @param page 分页插件对象
* @throws Exception
*/
protected void getDatePage(Pager pager, Page page)throws Exception{
/* protected void getDatePage(Pager pager, Page page)throws Exception{
pager.setTotal(page.getTotal());
pager.setRows(page.getResult());
}
}*/
/**
* 获取用户职务

View File

@ -3,21 +3,19 @@ package com.rzyc.controller;
import com.common.utils.RandomNumber;
import com.common.utils.StringUtils;
import com.common.utils.model.MultiResult;
import com.common.utils.model.Pager;
import com.common.utils.model.SingleResult;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.rzyc.bean.task.dto.*;
import com.rzyc.bean.task.vo.*;
import com.rzyc.config.MethodAnnotation;
import com.rzyc.mapper.OATaskMapper;
import com.rzyc.model.OADistribution;
import com.rzyc.model.OATask;
import com.rzyc.model.OaTaskType;
import com.rzyc.model.OaTaskUser;
import com.rzyc.model.*;
import com.rzyc.model.task.dto.TaskAddOrUpdateDto;
import com.rzyc.model.user.SysUser;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import com.rzyc.service.PcBusinessService;
import io.swagger.annotations.*;
import org.apache.commons.beanutils.BeanUtils;
import org.apache.commons.beanutils.ConvertUtils;
import org.apache.commons.beanutils.converters.DateConverter;
@ -52,6 +50,8 @@ import java.util.List;
public class WorkController extends BaseController {
PcBusinessService pcBusinessService;
/**
* @Description: 新增任务
* @Author ZQW
@ -227,7 +227,6 @@ public class WorkController extends BaseController{
}
/**
* @return: 完成任务
* @Author: ZQW
@ -514,4 +513,107 @@ public class WorkController extends BaseController{
}
/**
* 应急资源列表
*
* @return list
* @throws Exception
*/
@ApiOperation(value = "应急资源列表", notes = "应急资源列表")
@GetMapping(value = "/entEmEquipmentList")
@PreAuthorize("hasAnyAuthority('entEmEquipmentList','entEmEquipmentList:update')")
@MethodAnnotation(authorizations = {"entEmEquipmentList", "entEmEquipmentList:update"}, name = "应急资源列表")
@ApiImplicitParams({
@ApiImplicitParam(name = "enterpriseId", value = "企业id", required = true, dataType = "string"),
@ApiImplicitParam(name = "page", value = "page", required = true, dataType = "string"),
@ApiImplicitParam(name = "pageSize", value = "pageSize", required = true, dataType = "string"),
@ApiImplicitParam(name = "resourceType", value = "物质类型", required = false, dataType = "string"),
})
@ResponseBody
public SingleResult<List<EntEmEquipment>> entEmEquipmentList(@RequestParam(required = true) String enterpriseId,
@RequestParam(required = true) Integer page,
@RequestParam(required = true) Integer pageSize,
String resourceType) throws Exception {
return pcBusinessService.entEmEquipmentList(enterpriseId, page, pageSize, resourceType);
}
/**
* 应急预案
*
* @return list
* @throws Exception
*/
@ApiOperation(value = "应急预案列表", notes = "应急预案列表")
@GetMapping(value = "/entEmReservePlanList")
@PreAuthorize("hasAnyAuthority('entEmReservePlanList','entEmReservePlanList:update')")
@MethodAnnotation(authorizations = {"entEmReservePlanList", "entEmReservePlanList:update"}, name = "应急预案列表")
@ApiImplicitParams({
@ApiImplicitParam(name = "enterpriseId", value = "企业id", required = true, dataType = "string"),
@ApiImplicitParam(name = "page", value = "page", required = true, dataType = "string"),
@ApiImplicitParam(name = "pageSize", value = "pageSize", required = true, dataType = "string"),
@ApiImplicitParam(name = "entEmReservePlanName", value = "预案名", required = false, dataType = "string")
})
@ResponseBody
public SingleResult<List<EntEmReservePlan>> entEmReservePlanList(@RequestParam(required = true) String enterpriseId,
@RequestParam(required = true) Integer page,
@RequestParam(required = true) Integer pageSize,
String entEmReservePlanName) throws Exception {
return pcBusinessService.entEmReservePlanList(enterpriseId, page, pageSize, entEmReservePlanName);
}
/**
* @Description: 查询智能预警
* @Author ZQW
* @CreateTime 2022/11/23 15:15
*/
@ApiOperation(value = "查询智能预警", position = 30)
@GetMapping("selectWarn")
@PreAuthorize("hasAnyAuthority('selectWarn','selectWarn:update')")
@MethodAnnotation(authorizations = {"selectWarn", "selectWarn:update"}, name = "查询智能预警")
public MultiResult<GovWarning> selectWarn(@Valid WarnDto warnDto) {
MultiResult<GovWarning> result = new MultiResult();
List<GovWarning> list = govWarningMapper.selectAll(warnDto);
result.setData(list);
return result;
}
/**
* @Description: 智能预警分页
* @Author ZQW
* @CreateTime 2022/11/23 16:35
*/
@ApiOperation(value = "智能预警分页", notes = "智能预警分页", position = 31)
@GetMapping("/WarnList")
@PreAuthorize("hasAnyAuthority('WarnList','WarnList:update')")
@MethodAnnotation(authorizations = {"WarnList", "WarnList:update"}, name = "智能预警分页")
public SingleResult<Pager<GovWarning>> WarnList(@Valid PageDto pageDto) throws Exception {
SingleResult<Pager<GovWarning>> result = new SingleResult<>();
PageHelper.startPage(pageDto.getPage(), pageDto.getPageSize());
Page<GovWarning> page = (Page<GovWarning>) govWarningMapper.warnList(pageDto.getCondition());
Pager<GovWarning> pager = new Pager<>();
getDatePage(pager, page);
result.setData(pager);
return result;
}
/**
* @Description: 计算未处理数量值
* @Author ZQW
* @CreateTime 2022/11/23 16:48
*/
@ApiOperation(value = "计算未处理数量值", position = 32)
@PostMapping("countWarnNum")
@ApiImplicitParam(name = "type", value = "类型1.企业重大隐患 2.隐患未按期闭环 3.企业清单未落实 4.政府履职清单未履行 5.下级未履行上级任务", required = true)
@PreAuthorize("hasAnyAuthority('countWarnNum','countWarnNum:update')")
@MethodAnnotation(authorizations = {"countWarnNum", "countWarnNum:update"}, name = "计算未处理数量值")
public SingleResult<NumVo> countWarnNum(@Valid Integer type){
SingleResult<NumVo> result = new SingleResult<>();
NumVo vo = new NumVo();
int totalNum = govWarningMapper.countNum(type);
System.err.println("数量=====" + totalNum);
vo.setNum(totalNum);
result.setData(vo);
return result;
}
}

View File

@ -0,0 +1,63 @@
package com.rzyc.service;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.common.utils.Arith;
import com.common.utils.RandomNumber;
import com.common.utils.StringUtils;
import com.common.utils.TypeConversion;
import com.common.utils.encryption.MD5;
import com.common.utils.model.Code;
import com.common.utils.model.Message;
import com.common.utils.model.SingleResult;
import com.common.utils.pager.PageOperation;
import com.github.pagehelper.Page;
import com.rzyc.advice.CustomException;
import com.rzyc.config.RedisUtil;
import com.rzyc.controller.BaseController;
import com.rzyc.enums.DelState;
import com.rzyc.enums.RedisKeys;
import com.rzyc.model.*;
import com.rzyc.model.dto.*;
import com.rzyc.model.ent.EntPost;
import com.rzyc.model.ent.EntUser;
import com.rzyc.model.ent.InEntList;
import com.rzyc.model.ent.SysEnterprise;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* 企业端pc业务 Service
* @author Xuwanxin
* @date 2022/9/29
* */
@Service
public class PcBusinessService extends BaseController {
RedisUtil redisUtil;
@PageOperation
public SingleResult entEmEquipmentList(String enterpriseId,Integer page,Integer pageSize,String resourceType){
SingleResult singleResult = new SingleResult();
Page<EntEmEquipment> entEmEquipments = (Page<EntEmEquipment>) entEmEquipmentMapper.selectEntEmEquipmentList(enterpriseId,resourceType);
singleResult.setDataPager(entEmEquipments);
return singleResult;
}
@PageOperation
public SingleResult entEmReservePlanList(String enterpriseId,Integer page,Integer pageSize,String entEmReservePlanName){
SingleResult singleResult = new SingleResult();
Page<EntEmReservePlan>list = (Page<EntEmReservePlan>) entEmReservePlanMapper.selectEntEmReservePlanList(enterpriseId,entEmReservePlanName);
singleResult.setDataPager(list);
return singleResult;
}
}