kongdeqiang
2023-07-10 96f927cb94eec4a91df60973d4052cb812856e13
修改项目
8个文件已修改
2个文件已添加
156 ■■■■■ 已修改文件
src/main/java/com/wgcloud/entity/InspectionTask.java 5 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/wgcloud/filter/AuthRestFilter.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/wgcloud/mapper/InspectionTaskMapper.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/wgcloud/service/InspectionTaskService.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/wgcloud/service/TaskInfoService.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/wgcloud/util/CommonConstants.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/wgcloud/util/R.java 69 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/application.yml 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mybatis/mapper/InspectionTaskMapper.xml 35 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mybatis/mapper/TaskInfoMapper.xml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/wgcloud/entity/InspectionTask.java
@@ -53,4 +53,9 @@
     * 创建时间
     */
    private String createTime;
    /**
     * 是否全部完成
     */
    private String isOk;
}
src/main/java/com/wgcloud/filter/AuthRestFilter.java
@@ -33,7 +33,7 @@
            "/systemInfoOpen/", "/systemInfo/agentList", "/agentLogGo/minTask", "/agentGo/minTask", "/agentDiskGo/minTask", "/dceInfo/agentList",
            "/login/toLogin", "/login/login", "/appInfo/agentList", "/dockerInfo/agentList", "/portInfo/agentList", "/license/",
            "/static/", "/resources/", "/log/agentList", "/customInfo/agentList", "/agentCustomGo/minTask", "/dbInfo/agentList", "/agentDbTableGo/minTask",
            "/agentHeathMonitorGo/minTask", "/agentDceInfoGo/minTask", "/agentSnmpInfoGo/minTask", "/snmpInfo/agentList"};
            "/agentHeathMonitorGo/minTask", "/agentDceInfoGo/minTask", "/agentSnmpInfoGo/minTask", "/snmpInfo/agentList","/api/"};
    //公众看板URL
src/main/java/com/wgcloud/mapper/InspectionTaskMapper.java
@@ -37,4 +37,6 @@
    public int deleteById(String[] id) throws Exception;
    void updateById(InspectionTask inspectionTask);
    List<InspectionTask> selectByDate(Map<String, Object> params);
}
src/main/java/com/wgcloud/service/InspectionTaskService.java
@@ -46,6 +46,10 @@
        return pageInfo;
    }
    public List<InspectionTask> selectAllByParams(Map<String, Object> params)throws Exception  {
        return inspectionTaskMapper.selectAllByParams(params);
    }
    /**
     * 保存操作日志
     *
@@ -72,4 +76,8 @@
            throws Exception {
        inspectionTaskMapper.updateById(inspectionTask);
    }
    public List<InspectionTask> selectByDate(Map<String, Object> params) {
        return  inspectionTaskMapper.selectByDate(params);
    }
}
src/main/java/com/wgcloud/service/TaskInfoService.java
@@ -53,4 +53,8 @@
    public void updateById(TaskInfo taskInfo) {
        taskInfoMapper.updateById(taskInfo);
    }
    public List<TaskInfo> selectAllByParams(Map<String, Object> params) throws Exception {
        return taskInfoMapper.selectAllByParams(params);
    }
}
src/main/java/com/wgcloud/util/CommonConstants.java
New file
@@ -0,0 +1,13 @@
package com.wgcloud.util;
/**
 * @author kdq
 * @version 1.0.0
 * @ClassName CommonConstants.java
 * @Description TODO
 * @createTime 2023年05月11日 10:04:00
 */
public interface CommonConstants {
    Integer SUCCESS = 0;
    Integer FAIL = 1;
}
src/main/java/com/wgcloud/util/R.java
New file
@@ -0,0 +1,69 @@
package com.wgcloud.util;
import lombok.Data;
import java.io.Serializable;
/**
 * @author kdq
 * @version 1.0.0
 * @ClassName R.java
 * @Description TODO
 * @createTime 2023年05月11日 10:00:00
 */
@Data
public class R<T> implements Serializable {
    private static final long serialVersionUID = 1L;
    private int code;
    private String msg;
    private T data;
    public static <T> R<T> ok() {
        return restResult((T) null, CommonConstants.SUCCESS, (String)null);
    }
    public static <T> R<T> ok(T data) {
        return restResult(data, CommonConstants.SUCCESS, (String)null);
    }
    public static <T> R<T> ok(T data, String msg) {
        return restResult(data, CommonConstants.SUCCESS, msg);
    }
    public static <T> R<T> failed() {
        return restResult((T)null, CommonConstants.FAIL, (String)null);
    }
    public static <T> R<T> failed(String msg) {
        return restResult((T)null, CommonConstants.FAIL, msg);
    }
    public static <T> R<T> failed(T data) {
        return restResult(data, CommonConstants.FAIL, (String)null);
    }
    public static <T> R<T> failed(T data, String msg) {
        return restResult(data, CommonConstants.FAIL, msg);
    }
    static <T> R<T> restResult(T data, int code, String msg) {
        R<T> apiResult = new R();
        apiResult.setCode(code);
        apiResult.setData(data);
        apiResult.setMsg(msg);
        return apiResult;
    }
    public R() {
    }
    public R(int code, String msg, T data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }
}
src/main/resources/application.yml
@@ -191,4 +191,20 @@
  #是否将告警内容转为unicode,yes是,no否,在windows执行告警脚本时,一般需要转码,否则接受到会是乱码
  warnToUnicode: no
donghuan:
  ip: ip:port
  loginUrl: /collect/api/login
  deviceClassUrl: /collect/api/deviceClass/findAll
  intelligentUrl: /collect/api/intelligent/findAll
  findDevice: /collect/api/device/findDevice
  findDeviceVar: /collect/api/device/findDeviceVar
  findControlByDeviceId: /collect/api/realData/findControlByDeviceId
  control: /collect/api/device/control
  findValueByDeviceId: /collect/api/realData/findValueByDeviceId
  findValueByIntelligentId: /collect/api/realData/findValueByIntelligentId
  findValueByStationId: /collect/api/realData/findValueByStationId
  meterDatas: /collect/api/realData/meterDatas
  varDatas: /collect/api/realData/varDatas
  alarm: /collect/api/alarm/findByPage
src/main/resources/mybatis/mapper/InspectionTaskMapper.xml
@@ -10,15 +10,19 @@
        <result column="START_DATE" property="startDate" jdbcType="CHAR" />
        <result column="END_DATE" property="endDate" jdbcType="CHAR" />
        <result column="CREATE_TIME" property="createTime" jdbcType="TIMESTAMP" />
        <result column="IS_OK" property="isOk" jdbcType="CHAR" />
    </resultMap>
    <sql id="tableColumnList">
        ID,TITLE, TYPE, PERIOD, SCOPE, START_DATE,END_DATE,CREATE_TIME
        ID,TITLE, TYPE, PERIOD, SCOPE, START_DATE,END_DATE,CREATE_TIME,IS_OK
    </sql>
    <sql id="queryByParams">
        <if test="TITLE != null">
        <if test="title != null">
            <![CDATA[ AND TITLE like '%'+#{title}+'%' ]]>
        </if>
        <if test="isOk != null">
            <![CDATA[ AND IS_OK = #{isOk}  ]]>
        </if>
    </sql>
@@ -45,6 +49,9 @@
            </if>
            <if test="createTime != null">
                CREATE_TIME = #{createTime},
            </if>
            <if test="isOk != null">
                IS_OK = #{isOk},
            </if>
        </set>
        WHERE ID = #{id}
@@ -81,9 +88,9 @@
    </delete>
    <insert id="insertList" parameterType="java.util.List" >
          INSERT INTO INSPECTION_TASK (ID,TITLE, TYPE, PERIOD, SCOPE, START_DATE,END_DATE,CREATE_TIME)  VALUES
          INSERT INTO INSPECTION_TASK (ID,TITLE, TYPE, PERIOD, SCOPE, START_DATE,END_DATE,CREATE_TIME,IS_OK)  VALUES
          <foreach collection="list" item="item" index="index" separator="," >
            (#{item.id},#{item.title},#{item.type},#{item.period},#{item.scope},#{item.startDate},#{item.endDate},#{item.createTime})
            (#{item.id},#{item.title},#{item.type},#{item.period},#{item.scope},#{item.startDate},#{item.endDate},#{item.createTime},#{item.isOk})
          </foreach>
     </insert>
@@ -98,6 +105,7 @@
              <if test="startDate != null" >START_DATE,</if>
              <if test="endDate != null" >END_DATE,</if>
              <if test="createTime != null" >CREATE_TIME</if>
              <if test="isOk != null" >IS_OK</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides="," >
              <if test="id != null" >#{id},</if>
@@ -108,12 +116,13 @@
              <if test="startDate != null" >#{startDate},</if>
              <if test="endDate != null" >#{endDate},</if>
              <if test="createTime != null" >#{createTime}</if>
              <if test="isOk != null" >#{isOk}</if>
        </trim>
    </insert>
    <select id="selectByAccountId" resultMap="resultMap" parameterType="java.lang.String">
        SELECT
            ID,TITLE, TYPE, PERIOD, SCOPE, START_DATE,END_DATE,CREATE_TIME
            ID,TITLE, TYPE, PERIOD, SCOPE, START_DATE,END_DATE,CREATE_TIME,IS_OK
        FROM INSPECTION_TASK
    </select>
@@ -137,4 +146,20 @@
         ORDER BY CREATE_TIME DESC
    </select>
    <select id="selectByDate" parameterType="map" resultType="com.wgcloud.entity.InspectionTask">
        SELECT
        <include refid="tableColumnList" />
        FROM INSPECTION_TASK
        <where>
        1=1
        <if test="startDate != null">
            AND START_DATE > #{startDate}+' 00:00:00',
        </if>
        <if test="endDate != null">
            <![CDATA[ and END_DATE < #{endDate}+' 23:59:59' ]]>
        </if>
        </where>
        ORDER BY CREATE_TIME DESC
    </select>
</mapper>
src/main/resources/mybatis/mapper/TaskInfoMapper.xml
@@ -14,7 +14,7 @@
    </sql>
    <sql id="queryByParams">
        <if test="hostname != null">
        <if test="taskId != null">
            <![CDATA[ AND TASK_ID = #{taskId} ]]>
        </if>
    </sql>