feat: 增加把拍照时间表查询结果保存到专用表里的定时任务,以及查询接口

dev
huangfeng 2 months ago
parent fea13ffee7
commit d277a07bd6

@ -0,0 +1,42 @@
package com.shxy.xymanager_admin.controller;
import com.shxy.xymanager_common.annotation.Log;
import com.shxy.xymanager_common.base.BaseController;
import com.shxy.xymanager_common.base.ResponseReult;
import com.shxy.xymanager_common.entity.CameraSchedule;
import com.shxy.xymanager_service.service.CameraScheduleService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
@RestController
@Api(tags = {"活动相关接口"})
@RequestMapping("activity")
@Slf4j
public class CameraScheduleController extends BaseController {
@Resource
CameraScheduleService service;
@GetMapping("list")
@ApiOperation("查询")
@Log(title = "查询", type = "查询")
public ResponseReult<List<CameraSchedule>> list(@RequestParam(value = "termId", required = false) Integer termId) {
List<CameraSchedule> result = service.list(termId);
return ResponseReult.success(result);
}
@GetMapping("getOne")
@ApiOperation("查询")
@Log(title = "查询", type = "查询")
public ResponseReult<CameraSchedule> getOne(@RequestParam(value = "termId", required = true) Integer termId,
@RequestParam(value = "channel", required = true) Integer channel) {
CameraSchedule result = service.getOne(termId, channel);
return ResponseReult.success(result);
}
}

@ -5,6 +5,7 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct; import javax.annotation.PostConstruct;
import java.util.HashMap;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
/** /**
@ -213,4 +214,7 @@ public class Constants {
public static final Integer NetType_M2M10086 = 3; public static final Integer NetType_M2M10086 = 3;
public static final Integer NetType_LWWLKJ = 4; public static final Integer NetType_LWWLKJ = 4;
public static HashMap<Integer, Integer> scheduleRequestMap = new HashMap<>();
public static HashMap<Integer, String> scheduleRequestDoneMap = new HashMap<>();
} }

@ -0,0 +1,135 @@
package com.shxy.xymanager_common.entity;
public class CameraSchedule {
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column camera_schedule.id
*
* @mbg.generated
*/
private Integer id;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column camera_schedule.term_id
*
* @mbg.generated
*/
private Integer termId;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column camera_schedule.channel_id
*
* @mbg.generated
*/
private Integer channelId;
/**
*
* This field was generated by MyBatis Generator.
* This field corresponds to the database column camera_schedule.data
*
* @mbg.generated
*/
private String data;
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column camera_schedule.id
*
* @return the value of camera_schedule.id
*
* @mbg.generated
*/
public Integer getId() {
return id;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column camera_schedule.id
*
* @param id the value for camera_schedule.id
*
* @mbg.generated
*/
public void setId(Integer id) {
this.id = id;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column camera_schedule.term_id
*
* @return the value of camera_schedule.term_id
*
* @mbg.generated
*/
public Integer getTermId() {
return termId;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column camera_schedule.term_id
*
* @param termId the value for camera_schedule.term_id
*
* @mbg.generated
*/
public void setTermId(Integer termId) {
this.termId = termId;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column camera_schedule.channel_id
*
* @return the value of camera_schedule.channel_id
*
* @mbg.generated
*/
public Integer getChannelId() {
return channelId;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column camera_schedule.channel_id
*
* @param channelId the value for camera_schedule.channel_id
*
* @mbg.generated
*/
public void setChannelId(Integer channelId) {
this.channelId = channelId;
}
/**
* This method was generated by MyBatis Generator.
* This method returns the value of the database column camera_schedule.data
*
* @return the value of camera_schedule.data
*
* @mbg.generated
*/
public String getData() {
return data;
}
/**
* This method was generated by MyBatis Generator.
* This method sets the value of the database column camera_schedule.data
*
* @param data the value for camera_schedule.data
*
* @mbg.generated
*/
public void setData(String data) {
this.data = data;
}
}

@ -0,0 +1,481 @@
package com.shxy.xymanager_common.entity;
import java.util.ArrayList;
import java.util.List;
public class CameraScheduleExample {
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table camera_schedule
*
* @mbg.generated
*/
protected String orderByClause;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table camera_schedule
*
* @mbg.generated
*/
protected boolean distinct;
/**
* This field was generated by MyBatis Generator.
* This field corresponds to the database table camera_schedule
*
* @mbg.generated
*/
protected List<Criteria> oredCriteria;
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table camera_schedule
*
* @mbg.generated
*/
public CameraScheduleExample() {
oredCriteria = new ArrayList<>();
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table camera_schedule
*
* @mbg.generated
*/
public void setOrderByClause(String orderByClause) {
this.orderByClause = orderByClause;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table camera_schedule
*
* @mbg.generated
*/
public String getOrderByClause() {
return orderByClause;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table camera_schedule
*
* @mbg.generated
*/
public void setDistinct(boolean distinct) {
this.distinct = distinct;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table camera_schedule
*
* @mbg.generated
*/
public boolean isDistinct() {
return distinct;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table camera_schedule
*
* @mbg.generated
*/
public List<Criteria> getOredCriteria() {
return oredCriteria;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table camera_schedule
*
* @mbg.generated
*/
public void or(Criteria criteria) {
oredCriteria.add(criteria);
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table camera_schedule
*
* @mbg.generated
*/
public Criteria or() {
Criteria criteria = createCriteriaInternal();
oredCriteria.add(criteria);
return criteria;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table camera_schedule
*
* @mbg.generated
*/
public Criteria createCriteria() {
Criteria criteria = createCriteriaInternal();
if (oredCriteria.size() == 0) {
oredCriteria.add(criteria);
}
return criteria;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table camera_schedule
*
* @mbg.generated
*/
protected Criteria createCriteriaInternal() {
Criteria criteria = new Criteria();
return criteria;
}
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table camera_schedule
*
* @mbg.generated
*/
public void clear() {
oredCriteria.clear();
orderByClause = null;
distinct = false;
}
/**
* This class was generated by MyBatis Generator.
* This class corresponds to the database table camera_schedule
*
* @mbg.generated
*/
protected abstract static class GeneratedCriteria {
protected List<Criterion> criteria;
protected GeneratedCriteria() {
super();
criteria = new ArrayList<>();
}
public boolean isValid() {
return criteria.size() > 0;
}
public List<Criterion> getAllCriteria() {
return criteria;
}
public List<Criterion> getCriteria() {
return criteria;
}
protected void addCriterion(String condition) {
if (condition == null) {
throw new RuntimeException("Value for condition cannot be null");
}
criteria.add(new Criterion(condition));
}
protected void addCriterion(String condition, Object value, String property) {
if (value == null) {
throw new RuntimeException("Value for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value));
}
protected void addCriterion(String condition, Object value1, Object value2, String property) {
if (value1 == null || value2 == null) {
throw new RuntimeException("Between values for " + property + " cannot be null");
}
criteria.add(new Criterion(condition, value1, value2));
}
public Criteria andIdIsNull() {
addCriterion("id is null");
return (Criteria) this;
}
public Criteria andIdIsNotNull() {
addCriterion("id is not null");
return (Criteria) this;
}
public Criteria andIdEqualTo(Integer value) {
addCriterion("id =", value, "id");
return (Criteria) this;
}
public Criteria andIdNotEqualTo(Integer value) {
addCriterion("id <>", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThan(Integer value) {
addCriterion("id >", value, "id");
return (Criteria) this;
}
public Criteria andIdGreaterThanOrEqualTo(Integer value) {
addCriterion("id >=", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThan(Integer value) {
addCriterion("id <", value, "id");
return (Criteria) this;
}
public Criteria andIdLessThanOrEqualTo(Integer value) {
addCriterion("id <=", value, "id");
return (Criteria) this;
}
public Criteria andIdIn(List<Integer> values) {
addCriterion("id in", values, "id");
return (Criteria) this;
}
public Criteria andIdNotIn(List<Integer> values) {
addCriterion("id not in", values, "id");
return (Criteria) this;
}
public Criteria andIdBetween(Integer value1, Integer value2) {
addCriterion("id between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andIdNotBetween(Integer value1, Integer value2) {
addCriterion("id not between", value1, value2, "id");
return (Criteria) this;
}
public Criteria andTermIdIsNull() {
addCriterion("term_id is null");
return (Criteria) this;
}
public Criteria andTermIdIsNotNull() {
addCriterion("term_id is not null");
return (Criteria) this;
}
public Criteria andTermIdEqualTo(Integer value) {
addCriterion("term_id =", value, "termId");
return (Criteria) this;
}
public Criteria andTermIdNotEqualTo(Integer value) {
addCriterion("term_id <>", value, "termId");
return (Criteria) this;
}
public Criteria andTermIdGreaterThan(Integer value) {
addCriterion("term_id >", value, "termId");
return (Criteria) this;
}
public Criteria andTermIdGreaterThanOrEqualTo(Integer value) {
addCriterion("term_id >=", value, "termId");
return (Criteria) this;
}
public Criteria andTermIdLessThan(Integer value) {
addCriterion("term_id <", value, "termId");
return (Criteria) this;
}
public Criteria andTermIdLessThanOrEqualTo(Integer value) {
addCriterion("term_id <=", value, "termId");
return (Criteria) this;
}
public Criteria andTermIdIn(List<Integer> values) {
addCriterion("term_id in", values, "termId");
return (Criteria) this;
}
public Criteria andTermIdNotIn(List<Integer> values) {
addCriterion("term_id not in", values, "termId");
return (Criteria) this;
}
public Criteria andTermIdBetween(Integer value1, Integer value2) {
addCriterion("term_id between", value1, value2, "termId");
return (Criteria) this;
}
public Criteria andTermIdNotBetween(Integer value1, Integer value2) {
addCriterion("term_id not between", value1, value2, "termId");
return (Criteria) this;
}
public Criteria andChannelIdIsNull() {
addCriterion("channel_id is null");
return (Criteria) this;
}
public Criteria andChannelIdIsNotNull() {
addCriterion("channel_id is not null");
return (Criteria) this;
}
public Criteria andChannelIdEqualTo(Integer value) {
addCriterion("channel_id =", value, "channelId");
return (Criteria) this;
}
public Criteria andChannelIdNotEqualTo(Integer value) {
addCriterion("channel_id <>", value, "channelId");
return (Criteria) this;
}
public Criteria andChannelIdGreaterThan(Integer value) {
addCriterion("channel_id >", value, "channelId");
return (Criteria) this;
}
public Criteria andChannelIdGreaterThanOrEqualTo(Integer value) {
addCriterion("channel_id >=", value, "channelId");
return (Criteria) this;
}
public Criteria andChannelIdLessThan(Integer value) {
addCriterion("channel_id <", value, "channelId");
return (Criteria) this;
}
public Criteria andChannelIdLessThanOrEqualTo(Integer value) {
addCriterion("channel_id <=", value, "channelId");
return (Criteria) this;
}
public Criteria andChannelIdIn(List<Integer> values) {
addCriterion("channel_id in", values, "channelId");
return (Criteria) this;
}
public Criteria andChannelIdNotIn(List<Integer> values) {
addCriterion("channel_id not in", values, "channelId");
return (Criteria) this;
}
public Criteria andChannelIdBetween(Integer value1, Integer value2) {
addCriterion("channel_id between", value1, value2, "channelId");
return (Criteria) this;
}
public Criteria andChannelIdNotBetween(Integer value1, Integer value2) {
addCriterion("channel_id not between", value1, value2, "channelId");
return (Criteria) this;
}
}
/**
* This class was generated by MyBatis Generator.
* This class corresponds to the database table camera_schedule
*
* @mbg.generated do_not_delete_during_merge
*/
public static class Criteria extends GeneratedCriteria {
protected Criteria() {
super();
}
}
/**
* This class was generated by MyBatis Generator.
* This class corresponds to the database table camera_schedule
*
* @mbg.generated
*/
public static class Criterion {
private String condition;
private Object value;
private Object secondValue;
private boolean noValue;
private boolean singleValue;
private boolean betweenValue;
private boolean listValue;
private String typeHandler;
public String getCondition() {
return condition;
}
public Object getValue() {
return value;
}
public Object getSecondValue() {
return secondValue;
}
public boolean isNoValue() {
return noValue;
}
public boolean isSingleValue() {
return singleValue;
}
public boolean isBetweenValue() {
return betweenValue;
}
public boolean isListValue() {
return listValue;
}
public String getTypeHandler() {
return typeHandler;
}
protected Criterion(String condition) {
super();
this.condition = condition;
this.typeHandler = null;
this.noValue = true;
}
protected Criterion(String condition, Object value, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.typeHandler = typeHandler;
if (value instanceof List<?>) {
this.listValue = true;
} else {
this.singleValue = true;
}
}
protected Criterion(String condition, Object value) {
this(condition, value, null);
}
protected Criterion(String condition, Object value, Object secondValue, String typeHandler) {
super();
this.condition = condition;
this.value = value;
this.secondValue = secondValue;
this.typeHandler = typeHandler;
this.betweenValue = true;
}
protected Criterion(String condition, Object value, Object secondValue) {
this(condition, value, secondValue, null);
}
}
}

@ -0,0 +1,121 @@
package com.shxy.xymanager_dao.dao;
import com.shxy.xymanager_common.entity.CameraSchedule;
import com.shxy.xymanager_common.entity.CameraScheduleExample;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface CameraScheduleMapper {
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table camera_schedule
*
* @mbg.generated
*/
long countByExample(CameraScheduleExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table camera_schedule
*
* @mbg.generated
*/
int deleteByExample(CameraScheduleExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table camera_schedule
*
* @mbg.generated
*/
int deleteByPrimaryKey(Integer id);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table camera_schedule
*
* @mbg.generated
*/
int insert(CameraSchedule row);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table camera_schedule
*
* @mbg.generated
*/
int insertSelective(CameraSchedule row);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table camera_schedule
*
* @mbg.generated
*/
List<CameraSchedule> selectByExampleWithBLOBs(CameraScheduleExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table camera_schedule
*
* @mbg.generated
*/
List<CameraSchedule> selectByExample(CameraScheduleExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table camera_schedule
*
* @mbg.generated
*/
CameraSchedule selectByPrimaryKey(Integer id);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table camera_schedule
*
* @mbg.generated
*/
int updateByExampleSelective(@Param("row") CameraSchedule row, @Param("example") CameraScheduleExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table camera_schedule
*
* @mbg.generated
*/
int updateByExampleWithBLOBs(@Param("row") CameraSchedule row, @Param("example") CameraScheduleExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table camera_schedule
*
* @mbg.generated
*/
int updateByExample(@Param("row") CameraSchedule row, @Param("example") CameraScheduleExample example);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table camera_schedule
*
* @mbg.generated
*/
int updateByPrimaryKeySelective(CameraSchedule row);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table camera_schedule
*
* @mbg.generated
*/
int updateByPrimaryKeyWithBLOBs(CameraSchedule row);
/**
* This method was generated by MyBatis Generator.
* This method corresponds to the database table camera_schedule
*
* @mbg.generated
*/
int updateByPrimaryKey(CameraSchedule row);
}

@ -0,0 +1,314 @@
<?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.CameraScheduleMapper">
<resultMap id="BaseResultMap" type="com.shxy.xymanager_common.entity.CameraSchedule">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<id column="id" jdbcType="INTEGER" property="id" />
<result column="term_id" jdbcType="INTEGER" property="termId" />
<result column="channel_id" jdbcType="INTEGER" property="channelId" />
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="com.shxy.xymanager_common.entity.CameraSchedule">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<result column="data" jdbcType="LONGVARCHAR" property="data" />
</resultMap>
<sql id="Example_Where_Clause">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<where>
<foreach collection="oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Update_By_Example_Where_Clause">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<where>
<foreach collection="example.oredCriteria" item="criteria" separator="or">
<if test="criteria.valid">
<trim prefix="(" prefixOverrides="and" suffix=")">
<foreach collection="criteria.criteria" item="criterion">
<choose>
<when test="criterion.noValue">
and ${criterion.condition}
</when>
<when test="criterion.singleValue">
and ${criterion.condition} #{criterion.value}
</when>
<when test="criterion.betweenValue">
and ${criterion.condition} #{criterion.value} and #{criterion.secondValue}
</when>
<when test="criterion.listValue">
and ${criterion.condition}
<foreach close=")" collection="criterion.value" item="listItem" open="(" separator=",">
#{listItem}
</foreach>
</when>
</choose>
</foreach>
</trim>
</if>
</foreach>
</where>
</sql>
<sql id="Base_Column_List">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
id, term_id, channel_id
</sql>
<sql id="Blob_Column_List">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
`data`
</sql>
<select id="selectByExampleWithBLOBs" parameterType="com.shxy.xymanager_common.entity.CameraScheduleExample" resultMap="ResultMapWithBLOBs">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from camera_schedule
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByExample" parameterType="com.shxy.xymanager_common.entity.CameraScheduleExample" resultMap="BaseResultMap">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
select
<if test="distinct">
distinct
</if>
<include refid="Base_Column_List" />
from camera_schedule
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
<if test="orderByClause != null">
order by ${orderByClause}
</if>
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="ResultMapWithBLOBs">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
select
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from camera_schedule
where id = #{id,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
delete from camera_schedule
where id = #{id,jdbcType=INTEGER}
</delete>
<delete id="deleteByExample" parameterType="com.shxy.xymanager_common.entity.CameraScheduleExample">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
delete from camera_schedule
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="com.shxy.xymanager_common.entity.CameraSchedule">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
SELECT LAST_INSERT_ID()
</selectKey>
insert into camera_schedule (term_id, channel_id, `data`
)
values (#{termId,jdbcType=INTEGER}, #{channelId,jdbcType=INTEGER}, #{data,jdbcType=LONGVARCHAR}
)
</insert>
<insert id="insertSelective" parameterType="com.shxy.xymanager_common.entity.CameraSchedule">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
<selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">
SELECT LAST_INSERT_ID()
</selectKey>
insert into camera_schedule
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="termId != null">
term_id,
</if>
<if test="channelId != null">
channel_id,
</if>
<if test="data != null">
`data`,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="termId != null">
#{termId,jdbcType=INTEGER},
</if>
<if test="channelId != null">
#{channelId,jdbcType=INTEGER},
</if>
<if test="data != null">
#{data,jdbcType=LONGVARCHAR},
</if>
</trim>
</insert>
<select id="countByExample" parameterType="com.shxy.xymanager_common.entity.CameraScheduleExample" resultType="java.lang.Long">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
select count(*) from camera_schedule
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update camera_schedule
<set>
<if test="row.id != null">
id = #{row.id,jdbcType=INTEGER},
</if>
<if test="row.termId != null">
term_id = #{row.termId,jdbcType=INTEGER},
</if>
<if test="row.channelId != null">
channel_id = #{row.channelId,jdbcType=INTEGER},
</if>
<if test="row.data != null">
`data` = #{row.data,jdbcType=LONGVARCHAR},
</if>
</set>
<if test="example != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExampleWithBLOBs" parameterType="map">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update camera_schedule
set id = #{row.id,jdbcType=INTEGER},
term_id = #{row.termId,jdbcType=INTEGER},
channel_id = #{row.channelId,jdbcType=INTEGER},
`data` = #{row.data,jdbcType=LONGVARCHAR}
<if test="example != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByExample" parameterType="map">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update camera_schedule
set id = #{row.id,jdbcType=INTEGER},
term_id = #{row.termId,jdbcType=INTEGER},
channel_id = #{row.channelId,jdbcType=INTEGER}
<if test="example != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="com.shxy.xymanager_common.entity.CameraSchedule">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update camera_schedule
<set>
<if test="termId != null">
term_id = #{termId,jdbcType=INTEGER},
</if>
<if test="channelId != null">
channel_id = #{channelId,jdbcType=INTEGER},
</if>
<if test="data != null">
`data` = #{data,jdbcType=LONGVARCHAR},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKeyWithBLOBs" parameterType="com.shxy.xymanager_common.entity.CameraSchedule">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update camera_schedule
set term_id = #{termId,jdbcType=INTEGER},
channel_id = #{channelId,jdbcType=INTEGER},
`data` = #{data,jdbcType=LONGVARCHAR}
where id = #{id,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.shxy.xymanager_common.entity.CameraSchedule">
<!--
WARNING - @mbg.generated
This element is automatically generated by MyBatis Generator, do not modify.
-->
update camera_schedule
set term_id = #{termId,jdbcType=INTEGER},
channel_id = #{channelId,jdbcType=INTEGER}
where id = #{id,jdbcType=INTEGER}
</update>
</mapper>

@ -0,0 +1,68 @@
package com.shxy.xymanager_framework.timeTask;
import com.shxy.xymanager_common.constant.Constants;
import com.shxy.xymanager_common.entity.CameraSchedule;
import com.shxy.xymanager_common.entity.CameraScheduleExample;
import com.shxy.xymanager_common.entity.RequestResults;
import com.shxy.xymanager_dao.dao.CameraScheduleMapper;
import com.shxy.xymanager_dao.dao.RequestResultsDao;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
import java.util.Iterator;
import java.util.List;
@Service
@Slf4j
public class StoreCameraScheduleTask {
@Resource
RequestResultsDao requestResultsDao;
@Resource
CameraScheduleMapper cameraScheduleMapper;
@Scheduled(initialDelay = 60000, fixedDelay = 60000)
private void store() {
Iterator<Integer> it = Constants.scheduleRequestMap.keySet().iterator();
while (it.hasNext()) {
Integer requestid = it.next();
RequestResults results = requestResultsDao.selectByRequestId(requestid);
if (results != null) {
Integer channel = Constants.scheduleRequestMap.get(requestid);
Constants.scheduleRequestMap.remove(requestid);
CameraScheduleExample example = new CameraScheduleExample();
CameraScheduleExample.Criteria criteria = example.createCriteria();
criteria.andTermIdEqualTo(results.getTermId());
criteria.andChannelIdEqualTo(channel);
List<CameraSchedule> list = cameraScheduleMapper.selectByExample(example);
if (CollectionUtils.isEmpty(list)) {
CameraSchedule record = new CameraSchedule();
record.setTermId(results.getTermId());
record.setChannelId(channel);
record.setData(results.getData());
cameraScheduleMapper.insert(record);
} else {
CameraSchedule record = list.get(0);
record.setData(results.getData());
cameraScheduleMapper.updateByPrimaryKeyWithBLOBs(record);
}
} else {
if (Constants.scheduleRequestDoneMap.containsKey(requestid)) {
Constants.scheduleRequestDoneMap.remove(requestid);
Constants.scheduleRequestMap.remove(requestid);
} else {
Constants.scheduleRequestDoneMap.put(requestid, "");
}
}
}
}
@Scheduled(cron = "0 1 3 * * ?")
private void search() {
}
}

@ -0,0 +1,49 @@
package com.shxy.xymanager_service.impl;
import com.shxy.xymanager_common.entity.CameraSchedule;
import com.shxy.xymanager_common.entity.CameraScheduleExample;
import com.shxy.xymanager_dao.dao.CameraScheduleMapper;
import com.shxy.xymanager_service.service.CameraScheduleService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
import java.util.List;
@Service
@Slf4j
@Transactional(rollbackFor = Exception.class)
public class CameraScheduleServiceImpl implements CameraScheduleService {
@Resource
CameraScheduleMapper mapper;
@Override
public CameraSchedule getOne(Integer termId, Integer channel) {
CameraSchedule result = null;
CameraScheduleExample example = new CameraScheduleExample();
CameraScheduleExample.Criteria criteria = example.createCriteria();
criteria.andTermIdEqualTo(termId);
criteria.andChannelIdEqualTo(channel);
List<CameraSchedule> list = mapper.selectByExample(example);
if (!CollectionUtils.isEmpty(list)) {
result = list.get(0);
}
return result;
}
@Override
public List<CameraSchedule> list(Integer termId) {
CameraScheduleExample example = new CameraScheduleExample();
CameraScheduleExample.Criteria criteria = example.createCriteria();
if (termId != null) {
criteria.andTermIdEqualTo(termId);
}
List<CameraSchedule> list = mapper.selectByExample(example);
return list;
}
}

@ -175,6 +175,14 @@ public class TermSetServiceImpl implements TermSetService {
model.setRequestId(requestId); model.setRequestId(requestId);
DateTime now = DateTime.now(); DateTime now = DateTime.now();
model.setDate(now); model.setDate(now);
String act = ctrlBeanMap.get("act");
if ("schedule".equals(act)) {
String flag = ctrlBeanMap.get("flag");
if ("0".equals(flag)) {
Integer channel = Integer.parseInt(ctrlBeanMap.get("channel"));
Constants.scheduleRequestMap.put(requestId, channel);
}
}
return Asserts.success(model); return Asserts.success(model);
} }

@ -0,0 +1,13 @@
package com.shxy.xymanager_service.service;
import com.shxy.xymanager_common.entity.CameraSchedule;
import java.util.List;
public interface CameraScheduleService {
CameraSchedule getOne(Integer termId, Integer channel);
List<CameraSchedule> list(Integer termId);
}
Loading…
Cancel
Save