时间表下发修改 历史图片查询修改 定时任务缓存新增
parent
d35ae04832
commit
7ccf413015
@ -1 +1 @@
|
||||
org.springframework.boot.env.EnvironmentPostProcessor=com.shxy.xymanager_framework.config.MyEnvironmentPostProcessor
|
||||
#org.springframework.boot.env.EnvironmentPostProcessor=com.shxy.xymanager_framework.config.MyEnvironmentPostProcessor
|
||||
|
@ -0,0 +1,28 @@
|
||||
package com.shxy.xymanager_common.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.sql.Time;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
public class ScheduleDetailss implements Serializable {
|
||||
|
||||
private Integer id;
|
||||
|
||||
private Integer scheduleId;
|
||||
|
||||
private Integer hour;
|
||||
|
||||
private Integer minute;
|
||||
|
||||
private Integer preset;
|
||||
|
||||
private Date createTime;
|
||||
|
||||
private Date updateTime;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
package com.shxy.xymanager_common.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
public class TerminalScheduleDetailss implements Serializable {
|
||||
private Integer id;
|
||||
|
||||
private Integer termId;
|
||||
|
||||
private Integer channelId;
|
||||
|
||||
private Integer hour;
|
||||
|
||||
private Integer minute;
|
||||
|
||||
private Integer span;
|
||||
|
||||
private Date createTime;
|
||||
|
||||
private Date updateTime;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
}
|
@ -0,0 +1,131 @@
|
||||
package com.shxy.xymanager_common.util;
|
||||
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import com.shxy.xymanager_common.dto.ScheduleDetailsDto;
|
||||
import com.shxy.xymanager_common.entity.ScheduleDetailss;
|
||||
import com.shxy.xymanager_common.entity.Schedules;
|
||||
import com.shxy.xymanager_common.model.TerminalScheduleRuleModel;
|
||||
import com.shxy.xymanager_common.vo.ScheduleListVo;
|
||||
import com.shxy.xymanager_common.vo.ScheduleRuleVo;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import java.sql.Time;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 拍照时间表工具类
|
||||
* jingjing
|
||||
*/
|
||||
public class ScheduleListUtils {
|
||||
/**
|
||||
* 将前端时间格式转换为湖南规约标准的数据库格式
|
||||
*
|
||||
* @param beans 规则列表
|
||||
* @param scheduleid 规则编号
|
||||
* @return
|
||||
*/
|
||||
public static ArrayList<ScheduleDetailss> getScheduleDetailsses(List<ScheduleRuleVo> beans, Integer scheduleid) {
|
||||
ArrayList<ScheduleDetailss> list = new ArrayList<>();
|
||||
for (ScheduleRuleVo item : beans) {
|
||||
|
||||
ScheduleDetailss startrule = new ScheduleDetailss();
|
||||
startrule.setScheduleId(scheduleid);
|
||||
Time startTime = item.getStartTime();
|
||||
startrule.setHour(MyDateUtils.hour(startTime, true));
|
||||
startrule.setMinute(MyDateUtils.minute(startTime));
|
||||
startrule.setPreset(255);
|
||||
list.add(startrule);
|
||||
|
||||
ScheduleDetailss endrule = new ScheduleDetailss();
|
||||
endrule.setScheduleId(scheduleid);
|
||||
Time endTime = item.getEndTime();
|
||||
endrule.setHour(MyDateUtils.hour(endTime, true));
|
||||
endrule.setMinute(MyDateUtils.minute(endTime));
|
||||
endrule.setPreset(255);
|
||||
list.add(endrule);
|
||||
|
||||
Integer span = item.getSpan();
|
||||
ScheduleDetailss spanrule = new ScheduleDetailss();
|
||||
spanrule.setScheduleId(scheduleid);
|
||||
spanrule.setHour(XyNumberUtils.delivery(span, 60));
|
||||
spanrule.setMinute(XyNumberUtils.remainder(span, 60));
|
||||
spanrule.setPreset(255);
|
||||
list.add(spanrule);
|
||||
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 将前端时间格式转换为CMA时间表下发标准的字符串
|
||||
*
|
||||
* @param dtoList
|
||||
* @param offset
|
||||
* @return
|
||||
*/
|
||||
public static String relateTime(List<ScheduleDetailsDto> dtoList, int offset) {
|
||||
StringBuffer timestr = new StringBuffer();
|
||||
short perset = dtoList.get(0).getPreset().shortValue();
|
||||
for (int i = 0; i < dtoList.size(); i++) {
|
||||
short startHour = 0;
|
||||
short startMin= 0;
|
||||
short endHour= 0;
|
||||
short endMin= 0;
|
||||
short spanHour= 0;
|
||||
short spanMin= 0;
|
||||
if (XyNumberUtils.remainder(i, 3) == 1) {
|
||||
startHour = dtoList.get(i).getHour().shortValue();
|
||||
startMin = dtoList.get(i).getMinute().shortValue();
|
||||
} else if (XyNumberUtils.remainder(i, 3) == 2) {
|
||||
endHour = dtoList.get(i).getHour().shortValue();
|
||||
endMin = dtoList.get(i).getMinute().shortValue();
|
||||
} else if (XyNumberUtils.remainder(i, 3) == 0) {
|
||||
spanHour = dtoList.get(i).getHour().shortValue();
|
||||
spanMin = dtoList.get(i).getMinute().shortValue();
|
||||
}
|
||||
int spanindex = i+1;
|
||||
int endindex = i+2;
|
||||
int startindex = i+3;
|
||||
|
||||
String string = " --hour" + startindex + "=" + startHour + "\t" + "--min" + startindex + "=" + startMin + "\t" + "--preset" + startindex + "=" + perset + " --hour" + endindex + "=" + endHour + "\t" + "--min" + endindex + "=" + endMin + "\t"
|
||||
+ "--preset" + endindex + "=" + perset +"--hour" + spanindex + "=" + spanHour + "\t" + "--min" + spanindex + "=" + spanMin + "\t" + "--preset" + spanindex + "=" + perset ;
|
||||
timestr.append(string);
|
||||
}
|
||||
return timestr.toString();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 将数据库标准转为前端的时间列表
|
||||
* @param details
|
||||
* @return
|
||||
*/
|
||||
public static ArrayList<TerminalScheduleRuleModel.ScheduleRuleBean> getScheduleRuleBeans(List<ScheduleDetailsDto> details) {
|
||||
ArrayList<TerminalScheduleRuleModel.ScheduleRuleBean> detailsBeans = new ArrayList<>();
|
||||
for (int i = 0; i < details.size(); i++) {
|
||||
TerminalScheduleRuleModel.ScheduleRuleBean scheduleDetailsBean = new TerminalScheduleRuleModel.ScheduleRuleBean();
|
||||
if (XyNumberUtils.remainder(i, 3) == 1) {
|
||||
Integer hour = details.get(i).getHour();
|
||||
Integer minute = details.get(i).getMinute();
|
||||
Time time = MyDateUtils.HHMMToTime(hour, minute);
|
||||
scheduleDetailsBean.setStartTime(time);
|
||||
} else if (XyNumberUtils.remainder(i, 3) == 2) {
|
||||
Integer hour = details.get(i).getHour();
|
||||
Integer minute = details.get(i).getMinute();
|
||||
Time time = MyDateUtils.HHMMToTime(hour, minute);
|
||||
scheduleDetailsBean.setEndTime(time);
|
||||
} else if (XyNumberUtils.remainder(i, 3) == 0) {
|
||||
Integer hour = details.get(i).getHour();
|
||||
Integer minute = details.get(i).getMinute();
|
||||
Number mul = XyNumberUtils.mul((Number) hour, 60);
|
||||
Number add = XyNumberUtils.add(mul, minute);
|
||||
scheduleDetailsBean.setSpan(add.intValue());
|
||||
}
|
||||
detailsBeans.add(scheduleDetailsBean);
|
||||
}
|
||||
return detailsBeans;
|
||||
}
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
package com.shxy.xymanager_common.util;
|
||||
|
||||
import cn.hutool.core.lang.Assert;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
|
||||
/**
|
||||
* 算数类
|
||||
*
|
||||
* @author 晶晶
|
||||
*/
|
||||
public class XyNumberUtils extends NumberUtil {
|
||||
|
||||
/*取余*/
|
||||
public static int remainder(int a, int b) {
|
||||
return a % b;
|
||||
}
|
||||
|
||||
/*取模*/
|
||||
public static int delivery(int a, int b) {
|
||||
return a / b;
|
||||
}
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
package com.shxy.xymanager_dao.dao;
|
||||
|
||||
import com.shxy.xymanager_common.entity.ScheduleDetails;
|
||||
import com.shxy.xymanager_common.entity.ScheduleDetailss;
|
||||
import com.shxy.xymanager_common.entity.TerminalSchedule;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
public interface ScheduleDetailssDao {
|
||||
|
||||
int insertSelective(ScheduleDetailss record);
|
||||
|
||||
int insertList(@Param("list") List<ScheduleDetailss> record, @Param("createat") Date create, @Param("updateat") Date update);
|
||||
|
||||
ScheduleDetails selectByPrimaryKey(Integer id);
|
||||
|
||||
List<ScheduleDetailss> selectAll(@Param("status") Integer status);
|
||||
|
||||
List<ScheduleDetailss> selectAllByList(@Param("list") List<TerminalSchedule> list);
|
||||
|
||||
int deleteById(@Param("scheduleid") Integer id);
|
||||
|
||||
|
||||
int updateByPrimaryKeySelective(@Param("data") ScheduleDetailss record, @Param("updateat") Date update);
|
||||
|
||||
int updateByPrimaryKey(ScheduleDetailss record);
|
||||
|
||||
List<ScheduleDetailss> selectAllBySceduleidList(@Param("list") List<Integer> distinct);
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package com.shxy.xymanager_dao.dao;
|
||||
|
||||
import com.shxy.xymanager_common.entity.TerminalSchedule;
|
||||
import com.shxy.xymanager_common.entity.TerminalScheduleDetailss;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
public interface TerminalScheduleDetailssDao {
|
||||
|
||||
int deleteByTermiAndChannel(Integer id);
|
||||
|
||||
int deleteByTermidAndChannelIdList(@Param("list") List<TerminalSchedule> lsit);
|
||||
|
||||
int insert(TerminalScheduleDetailss record);
|
||||
|
||||
int insertList(@Param("list") List<TerminalScheduleDetailss> record, @Param("createat") Date createat, @Param("updateat") Date updateat);
|
||||
|
||||
int insertSelective(TerminalScheduleDetailss record);
|
||||
|
||||
TerminalScheduleDetailss selectByPrimaryKey(Integer id);
|
||||
|
||||
int updateByPrimaryKeySelective(TerminalScheduleDetailss record);
|
||||
|
||||
int updateByPrimaryKey(TerminalScheduleDetailss record);
|
||||
}
|
@ -0,0 +1,157 @@
|
||||
<?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.shxy.xymanager_dao.dao.ScheduleDetailssDao">
|
||||
<resultMap id="BaseResultMap" type="com.shxy.xymanager_common.entity.ScheduleDetailss">
|
||||
<id column="id" jdbcType="INTEGER" property="id"/>
|
||||
<result column="schedule_id" jdbcType="INTEGER" property="scheduleId"/>
|
||||
<result column="hour" jdbcType="INTEGER" property="hour"/>
|
||||
<result column="minute" jdbcType="INTEGER" property="minute"/>
|
||||
<result column="preset" jdbcType="INTEGER" property="preset"/>
|
||||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
|
||||
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
id, schedule_id, start_time, end_time, create_time, update_time
|
||||
</sql>
|
||||
<select id="selectByScheduleId" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="Base_Column_List"/>
|
||||
from schedule_detailss
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</select>
|
||||
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="Base_Column_List"/>
|
||||
from schedule_detailss
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</select>
|
||||
|
||||
<select id="selectAll" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="Base_Column_List"/>
|
||||
from schedule_detailss
|
||||
where status = #{status}
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectAllBySceduleidList" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="Base_Column_List"/>
|
||||
from schedule_detailss
|
||||
<if test="list != null and list.size > 0">
|
||||
where schedule_id in
|
||||
<foreach collection="list" item="id" index="index" separator="," open="(" close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<insert id="insert" parameterType="com.shxy.xymanager_common.entity.ScheduleDetails">
|
||||
insert into schedule_detailss (id, name, start_time,
|
||||
end_time, span, remark,
|
||||
create_time, update_time)
|
||||
values (#{id,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR}, #{startTime,jdbcType=TIME},
|
||||
#{endTime,jdbcType=TIME}, #{span,jdbcType=INTEGER}, #{remark,jdbcType=VARCHAR},
|
||||
#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP})
|
||||
</insert>
|
||||
|
||||
<insert id="insertList" parameterType="java.util.List">
|
||||
insert into schedule_detailss
|
||||
(schedule_id,`hour`,`minute`,preset,create_time,update_time)
|
||||
VALUES
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(#{item.scheduleId},#{item.hour},#{item.minute},#{item.preset},#{createat},#{updateat})
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
|
||||
<insert id="insertSelective" parameterType="com.shxy.xymanager_common.entity.ScheduleDetails">
|
||||
insert into schedule_detailss
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
id,
|
||||
</if>
|
||||
<if test="name != null">
|
||||
name,
|
||||
</if>
|
||||
<if test="startTime != null">
|
||||
start_time,
|
||||
</if>
|
||||
<if test="endTime != null">
|
||||
end_time,
|
||||
</if>
|
||||
<if test="span != null">
|
||||
span,
|
||||
</if>
|
||||
<if test="remark != null">
|
||||
remark,
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time,
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
#{id,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="name != null">
|
||||
#{name,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="startTime != null">
|
||||
#{startTime,jdbcType=TIME},
|
||||
</if>
|
||||
<if test="endTime != null">
|
||||
#{endTime,jdbcType=TIME},
|
||||
</if>
|
||||
<if test="span != null">
|
||||
#{span,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="remark != null">
|
||||
#{remark,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
#{createTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
#{updateTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
|
||||
<delete id="deleteById">
|
||||
delete from schedule_detailss
|
||||
where schedule_id = #{scheduleid}
|
||||
</delete>
|
||||
|
||||
<update id="updateByPrimaryKeySelective" parameterType="com.shxy.xymanager_common.entity.ScheduleDetails">
|
||||
update schedules
|
||||
<set>
|
||||
<if test="data.name != null">
|
||||
name = #{data.name,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="data.remark != null">
|
||||
remark = #{data.remark,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="updateat != null">
|
||||
update_time = #{updateat,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{data.id,jdbcType=INTEGER}
|
||||
</update>
|
||||
<update id="updateByPrimaryKey" parameterType="com.shxy.xymanager_common.entity.ScheduleDetails">
|
||||
update schedule_detailss
|
||||
set name = #{name,jdbcType=VARCHAR},
|
||||
start_time = #{startTime,jdbcType=TIME},
|
||||
end_time = #{endTime,jdbcType=TIME},
|
||||
span = #{span,jdbcType=INTEGER},
|
||||
remark = #{remark,jdbcType=VARCHAR},
|
||||
create_time = #{createTime,jdbcType=TIMESTAMP},
|
||||
update_time = #{updateTime,jdbcType=TIMESTAMP}
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</update>
|
||||
</mapper>
|
@ -0,0 +1,135 @@
|
||||
<?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.shxy.xymanager_dao.dao.TerminalScheduleDetailssDao">
|
||||
<resultMap id="BaseResultMap" type="com.shxy.xymanager_common.entity.TerminalScheduleDetailss">
|
||||
<id column="id" jdbcType="INTEGER" property="id"/>
|
||||
<result column="term_id" jdbcType="INTEGER" property="termId"/>
|
||||
<result column="channel_id" jdbcType="INTEGER" property="channelId"/>
|
||||
<result column="hour" jdbcType="INTEGER" property="hour"/>
|
||||
<result column="minute" jdbcType="INTEGER" property="minute"/>
|
||||
<result column="span" jdbcType="INTEGER" property="span"/>
|
||||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
|
||||
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
id,term_id, channel_id, start_time, end_time, span, create_time, update_time
|
||||
</sql>
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="Base_Column_List"/>
|
||||
from terminal_schedule_detailss
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</select>
|
||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
|
||||
delete from terminal_schedule_detailss
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</delete>
|
||||
<insert id="insert" parameterType="com.shxy.xymanager_common.entity.TerminalScheduleDetails">
|
||||
insert into terminal_schedule_detailss (id, schedule_id, start_time,
|
||||
end_time, span, create_time,
|
||||
update_time)
|
||||
values (#{id,jdbcType=INTEGER}, #{scheduleId,jdbcType=INTEGER}, #{startTime,jdbcType=TIME},
|
||||
#{endTime,jdbcType=TIME}, #{span,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP},
|
||||
#{updateTime,jdbcType=TIMESTAMP})
|
||||
</insert>
|
||||
|
||||
|
||||
<insert id="insertList">
|
||||
insert into terminal_schedule_detailss
|
||||
(term_id, channel_id,start_time, end_time, span, create_time, update_time)
|
||||
values
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(#{item.termId},#{item.channelId},#{item.startTime},#{item.endTime},#{item.span},#{createat},#{updateat})
|
||||
</foreach>
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="com.shxy.xymanager_common.entity.TerminalScheduleDetails">
|
||||
insert into terminal_schedule_detailss
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
id,
|
||||
</if>
|
||||
<if test="scheduleId != null">
|
||||
schedule_id,
|
||||
</if>
|
||||
<if test="startTime != null">
|
||||
start_time,
|
||||
</if>
|
||||
<if test="endTime != null">
|
||||
end_time,
|
||||
</if>
|
||||
<if test="span != null">
|
||||
span,
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time,
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
#{id,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="scheduleId != null">
|
||||
#{scheduleId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="startTime != null">
|
||||
#{startTime,jdbcType=TIME},
|
||||
</if>
|
||||
<if test="endTime != null">
|
||||
#{endTime,jdbcType=TIME},
|
||||
</if>
|
||||
<if test="span != null">
|
||||
#{span,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
#{createTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
#{updateTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<update id="updateByPrimaryKeySelective" parameterType="com.shxy.xymanager_common.entity.TerminalScheduleDetails">
|
||||
update terminal_schedule_detailss
|
||||
<set>
|
||||
<if test="scheduleId != null">
|
||||
schedule_id = #{scheduleId,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="startTime != null">
|
||||
start_time = #{startTime,jdbcType=TIME},
|
||||
</if>
|
||||
<if test="endTime != null">
|
||||
end_time = #{endTime,jdbcType=TIME},
|
||||
</if>
|
||||
<if test="span != null">
|
||||
span = #{span,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time = #{createTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time = #{updateTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</update>
|
||||
<update id="updateByPrimaryKey" parameterType="com.shxy.xymanager_common.entity.TerminalScheduleDetails">
|
||||
update terminal_schedule_detailss
|
||||
set schedule_id = #{scheduleId,jdbcType=INTEGER},
|
||||
start_time = #{startTime,jdbcType=TIME},
|
||||
end_time = #{endTime,jdbcType=TIME},
|
||||
span = #{span,jdbcType=INTEGER},
|
||||
create_time = #{createTime,jdbcType=TIMESTAMP},
|
||||
update_time = #{updateTime,jdbcType=TIMESTAMP}
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</update>
|
||||
<delete id="deleteByTermidAndChannelIdList">
|
||||
delete from terminal_schedule_detailss
|
||||
where
|
||||
<foreach collection="list" item="item" index="index" separator="or" open="(" close=")">
|
||||
term_id = #{item.termId} and channel_id = #{item.channelId}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
@ -0,0 +1,74 @@
|
||||
package com.shxy.xymanager_service.cache;
|
||||
|
||||
import com.shxy.xymanager_common.dto.LineAndDyNameDto;
|
||||
import com.shxy.xymanager_common.dto.TowerDto;
|
||||
import com.shxy.xymanager_common.entity.TerminalChannels;
|
||||
import com.shxy.xymanager_common.entity.Terminals;
|
||||
import com.shxy.xymanager_common.enums.CommonStatus;
|
||||
import com.shxy.xymanager_dao.dao.LinesDao;
|
||||
import com.shxy.xymanager_dao.dao.TerminalChannelsDao;
|
||||
import com.shxy.xymanager_dao.dao.TerminalsDao;
|
||||
import com.shxy.xymanager_dao.dao.TowerDao;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import javax.annotation.PreDestroy;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Component
|
||||
public class XyCache {
|
||||
public static Map<Integer, LineAndDyNameDto> lineMap = new HashMap<Integer, LineAndDyNameDto>();
|
||||
public static Map<Integer, Terminals> terminalMap = new HashMap<Integer, Terminals>();
|
||||
public static Map<Integer, TowerDto> towerMap = new HashMap<Integer, TowerDto>();
|
||||
public static Map<Integer, TerminalChannels> termchannelMap = new HashMap<Integer, TerminalChannels>();
|
||||
|
||||
@Autowired
|
||||
private LinesDao linesDao;
|
||||
@Autowired
|
||||
private TerminalsDao terminalsDao;
|
||||
@Autowired
|
||||
private TowerDao towerDao;
|
||||
@Autowired
|
||||
private TerminalChannelsDao terminalChannelsDao;
|
||||
|
||||
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
//系统启动中。。。加载codeMap
|
||||
List<LineAndDyNameDto> lineAndDyNameDtos = linesDao.selectAll(CommonStatus.EFFECTIVE.value());
|
||||
for (LineAndDyNameDto lineitem : lineAndDyNameDtos) {
|
||||
lineMap.put(lineitem.getId(), lineitem);
|
||||
}
|
||||
|
||||
List<Terminals> termslist = terminalsDao.selectAll(CommonStatus.EFFECTIVE.value());
|
||||
for (Terminals item : termslist) {
|
||||
terminalMap.put(item.getId(), item);
|
||||
}
|
||||
|
||||
List<TowerDto> towerlist = towerDao.selectAll(CommonStatus.EFFECTIVE.value());
|
||||
for (TowerDto item : towerlist) {
|
||||
towerMap.put(item.getId(), item);
|
||||
}
|
||||
|
||||
List<TerminalChannels> channelslist = terminalChannelsDao.selectChannelList(CommonStatus.EFFECTIVE.value());
|
||||
for (TerminalChannels item : channelslist) {
|
||||
termchannelMap.put(item.getId(), item);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@PreDestroy
|
||||
public void destroy() {
|
||||
//系统运行结束
|
||||
}
|
||||
|
||||
// @Scheduled(cron = "0 0 0/2 * * ?")
|
||||
// public void testOne() {
|
||||
// //每2小时执行一次缓存
|
||||
// init();
|
||||
// }
|
||||
|
||||
}
|
Loading…
Reference in New Issue