Merge remote-tracking branch 'origin/master'

# Conflicts:
#	xymanager_admin/src/test/java/com/shxy/xymanager_admin/XymanagerAdminApplicationTests.java
master
18616268358 2 years ago
commit 91b62b03d4

@ -5,10 +5,7 @@ import com.shxy.xymanager_common.base.BaseController;
import com.shxy.xymanager_common.base.ResponseReult; import com.shxy.xymanager_common.base.ResponseReult;
import com.shxy.xymanager_common.bean.ServiceBody; import com.shxy.xymanager_common.bean.ServiceBody;
import com.shxy.xymanager_common.bean.ServiceStatus; import com.shxy.xymanager_common.bean.ServiceStatus;
import com.shxy.xymanager_common.model.GetModel; import com.shxy.xymanager_common.model.*;
import com.shxy.xymanager_common.model.TerminalScheduleRuleListModel;
import com.shxy.xymanager_common.model.TerminalScheduleRuleModel;
import com.shxy.xymanager_common.model.TerminalScheduleRuleTimeListModel;
import com.shxy.xymanager_common.vo.*; import com.shxy.xymanager_common.vo.*;
import com.shxy.xymanager_service.service.TerminalScheduleRuleService; import com.shxy.xymanager_service.service.TerminalScheduleRuleService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
@ -100,8 +97,8 @@ public class TerminalScheduleRuleController extends BaseController {
@ApiResponses({@ApiResponse(code = 200, message = "请求成功"), @ApiResponse(code = 400, message = "请求参数没填好"), @ApiResponse(code = 404, message = "请求路径没有或页面跳转路径不对")}) @ApiResponses({@ApiResponse(code = 200, message = "请求成功"), @ApiResponse(code = 400, message = "请求参数没填好"), @ApiResponse(code = 404, message = "请求路径没有或页面跳转路径不对")})
@RequestMapping("/relateSchelduleRule") @RequestMapping("/relateSchelduleRule")
@Log(title = "关联任务规则", type = "修改") @Log(title = "关联任务规则", type = "修改")
public ResponseReult<GetModel> relateSchelduleRule(@RequestBody @Validated RelateTerminalListRuleIdVo vo) { public ResponseReult<GetListModel> relateSchelduleRule(@RequestBody @Validated RelateTerminalListRuleIdVo vo) {
ServiceBody<GetModel> serviceBody = terminalScheduleRuleService.relateSchelduleRule(vo); ServiceBody<GetListModel> serviceBody = terminalScheduleRuleService.relateSchelduleRule(vo);
if (serviceBody.getCode() == ServiceStatus.SUCCESS) { if (serviceBody.getCode() == ServiceStatus.SUCCESS) {
return ResponseReult.success(serviceBody.getData()); return ResponseReult.success(serviceBody.getData());
} else { } else {

@ -1,5 +1,9 @@
package com.shxy.xymanager_admin; package com.shxy.xymanager_admin;
import cn.hutool.core.collection.CollectionUtil;
import com.shxy.xymanager_common.entity.TerminalSchedule;
import com.shxy.xymanager_common.entity.Terminals;
import com.shxy.xymanager_common.enums.CommonStatus;
import com.shxy.xymanager_dao.dao.*; import com.shxy.xymanager_dao.dao.*;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -26,6 +30,9 @@ class XymanagerAdminApplicationTests {
@Autowired @Autowired
private TerminalSchedulesTempDao terminalSchedulesTempDao; private TerminalSchedulesTempDao terminalSchedulesTempDao;
@Autowired
private TerminalScheduleDao terminalScheduleDao;
@Test @Test
void contextLoads() { void contextLoads() {
@ -121,8 +128,17 @@ class XymanagerAdminApplicationTests {
requestidlist.add(3); requestidlist.add(3);
// TerminalSchedule terminalSchedule = terminalScheduleDao.selectByPrimaryKey(1);
// System.out.println(terminalSchedule.toString());
ArrayList<Integer> list = new ArrayList<>();
list.add(1);
list.add(1);
list.add(2);
list.add(3);
System.out.println(list.toArray());
ArrayList<Integer> distinct = CollectionUtil.distinct(list);
System.out.println(distinct.toArray());
} }
} }

@ -6,7 +6,7 @@ import java.io.Serializable;
import java.util.Date; import java.util.Date;
@Data @Data
public class TerminalSchedules implements Serializable { public class TerminalSchedule implements Serializable {
private Integer id; private Integer id;
private Integer termId; private Integer termId;

@ -1,12 +1,17 @@
package com.shxy.xymanager_common.entity; package com.shxy.xymanager_common.entity;
import lombok.Data;
import java.io.Serializable; import java.io.Serializable;
import java.util.Date; import java.util.Date;
@Data
public class TerminalScheduleDetails implements Serializable { public class TerminalScheduleDetails implements Serializable {
private Integer id; private Integer id;
private Integer scheduleId; private Integer termId;
private Integer channelId;
private Date startTime; private Date startTime;
@ -20,59 +25,4 @@ public class TerminalScheduleDetails implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getScheduleId() {
return scheduleId;
}
public void setScheduleId(Integer scheduleId) {
this.scheduleId = scheduleId;
}
public Date getStartTime() {
return startTime;
}
public void setStartTime(Date startTime) {
this.startTime = startTime;
}
public Date getEndTime() {
return endTime;
}
public void setEndTime(Date endTime) {
this.endTime = endTime;
}
public Integer getSpan() {
return span;
}
public void setSpan(Integer span) {
this.span = span;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
} }

@ -0,0 +1,21 @@
package com.shxy.xymanager_common.model;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* ID
*/
@Data
@ApiModel(value = "触发查询信息列表", description = "触发查询信息列表")
public class GetListModel implements Serializable {
@ApiModelProperty(value = "请求ID", example = "123456")
private List<Integer> list;
}

@ -8,11 +8,11 @@ import javax.validation.constraints.NotNull;
import java.util.List; import java.util.List;
@Data @Data
@ApiModel(value = "查询Cma结果requestid的Vo", description = "查询Cma结果requestid的Vo") @ApiModel(value = "查询Cma结果requestid的list", description = "查询Cma结果requestid的list")
public class RequestIdListVo { public class RequestIdListVo {
@NotNull(message = "查询编号不能缺少") @NotNull(message = "查询编号列表不能缺少")
@ApiModelProperty(value = "查询编号", example = "123455") @ApiModelProperty(value = "查询编号列表", example = "123455")
private List<Integer> list; private List<Integer> list;
} }

@ -15,7 +15,8 @@ public interface RequestResultsDao {
int updateByPrimaryKeySelective(RequestResults record); int updateByPrimaryKeySelective(RequestResults record);
int updateByPrimaryKeyWithBLOBs(RequestResults record);
int updateByPrimaryKey(RequestResults record); int updateByPrimaryKey(RequestResults record);
int updateByRequestIdList(@Param("list") List<Integer> requestidlist, @Param("status") Integer status);
} }

@ -1,8 +1,10 @@
package com.shxy.xymanager_dao.dao; package com.shxy.xymanager_dao.dao;
import com.shxy.xymanager_common.entity.ScheduleDetails; import com.shxy.xymanager_common.entity.ScheduleDetails;
import com.shxy.xymanager_common.entity.TerminalSchedule;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
@ -16,11 +18,14 @@ public interface ScheduleDetailsDao {
List<ScheduleDetails> selectAll(@Param("status") Integer status); List<ScheduleDetails> selectAll(@Param("status") Integer status);
List<ScheduleDetails> selectAllByList(@Param("list") List<TerminalSchedule> list);
int deleteById(@Param("scheduleid") Integer id); int deleteById(@Param("scheduleid") Integer id);
int updateByPrimaryKeySelective(@Param("data") ScheduleDetails record, @Param("updateat") Date update); int updateByPrimaryKeySelective(@Param("data") ScheduleDetails record, @Param("updateat") Date update);
int updateByPrimaryKey(ScheduleDetails record); int updateByPrimaryKey(ScheduleDetails record);
List<ScheduleDetails> selectAllBySceduleidList(@Param("list") List<Integer> distinct);
} }

@ -0,0 +1,30 @@
package com.shxy.xymanager_dao.dao;
import com.shxy.xymanager_common.entity.TerminalSchedule;
import com.shxy.xymanager_common.vo.RelateTerminalListRuleIdVo;
import org.apache.ibatis.annotations.Param;
import java.util.Date;
import java.util.List;
public interface TerminalScheduleDao {
int deleteByChannelId(@Param("list") List<TerminalSchedule> list);
int insert(TerminalSchedule record);
int insertSelective(TerminalSchedule record);
int insertList(@Param("list") List<TerminalSchedule> record, @Param("createat") Date create, @Param("updateat") Date update);
TerminalSchedule selectByPrimaryKey(Integer id);
TerminalSchedule selectByChannelId(@Param("channelid") Integer list, @Param("termid") Integer termid);
List<TerminalSchedule> selectByTerminalBean(@Param("list") List<RelateTerminalListRuleIdVo.Items> list);
int insertOrUpdate(@Param("list") List<TerminalSchedule> record, @Param("createat") Date create, @Param("updateat") Date update);
int updateByPrimaryKeySelective(TerminalSchedule record);
int updateByPrimaryKey(TerminalSchedule record);
}

@ -1,16 +1,22 @@
package com.shxy.xymanager_dao.dao; package com.shxy.xymanager_dao.dao;
import com.shxy.xymanager_common.entity.TerminalSchedule;
import com.shxy.xymanager_common.entity.TerminalScheduleDetails; import com.shxy.xymanager_common.entity.TerminalScheduleDetails;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import javax.xml.crypto.Data;
import java.util.Date;
import java.util.List; import java.util.List;
public interface TerminalScheduleDetailsDao { public interface TerminalScheduleDetailsDao {
int deleteByPrimaryKey(Integer id);
int deleteByTermiAndChannel(Integer id);
int deleteByTermidAndChannelIdList(@Param("list") List<TerminalSchedule> lsit);
int insert(TerminalScheduleDetails record); int insert(TerminalScheduleDetails record);
int insertList(@Param("list") List<TerminalScheduleDetails> record); int insertList(@Param("list") List<TerminalScheduleDetails> record, @Param("createat") Date createat, @Param("updateat") Date updateat);
int insertSelective(TerminalScheduleDetails record); int insertSelective(TerminalScheduleDetails record);

@ -1,30 +0,0 @@
package com.shxy.xymanager_dao.dao;
import com.shxy.xymanager_common.entity.TerminalSchedules;
import com.shxy.xymanager_common.vo.RelateTerminalListRuleIdVo;
import org.apache.ibatis.annotations.Param;
import java.util.Date;
import java.util.List;
public interface TerminalSchedulesDao {
int deleteByChannelId(@Param("list") List<TerminalSchedules> list);
int insert(TerminalSchedules record);
int insertSelective(TerminalSchedules record);
int insertList(@Param("list") List<TerminalSchedules> record, @Param("createat") Date create, @Param("updateat") Date update);
TerminalSchedules selectByPrimaryKey(Integer id);
TerminalSchedules selectByChannelId(@Param("channelid") Integer list, @Param("termid") Integer termid);
List<TerminalSchedules> selectByTerminalBean(@Param("list") List<RelateTerminalListRuleIdVo.Items> list);
int updateList(List<TerminalSchedules> record);
int updateByPrimaryKeySelective(TerminalSchedules record);
int updateByPrimaryKey(TerminalSchedules record);
}

@ -77,18 +77,13 @@
</set> </set>
where id = #{id,jdbcType=INTEGER} where id = #{id,jdbcType=INTEGER}
</update> </update>
<update id="updateByPrimaryKeyWithBLOBs" parameterType="com.shxy.xymanager_common.entity.RequestResults"> <update id="updateByRequestIdList">
update request_results update request_results
set term_id = #{termId,jdbcType=INTEGER}, set request_schedule_status = #{status}
request_type = #{requestType,jdbcType=TINYINT}, where request_id in
frame_no = #{frameNo,jdbcType=TINYINT}, <foreach collection="list" item="id" index="index" separator="," open="(" close=")">
client_id = #{clientId,jdbcType=TINYINT}, #{id}
request_id = #{requestId,jdbcType=INTEGER}, </foreach>
result = #{result,jdbcType=TINYINT},
request_time = #{requestTime,jdbcType=BIGINT},
create_time = #{createTime,jdbcType=BIGINT},
data = #{data,jdbcType=LONGVARCHAR}
where id = #{id,jdbcType=INTEGER}
</update> </update>
<update id="updateByPrimaryKey" parameterType="com.shxy.xymanager_common.entity.RequestResults"> <update id="updateByPrimaryKey" parameterType="com.shxy.xymanager_common.entity.RequestResults">
update request_results update request_results

@ -13,6 +13,13 @@
<sql id="Base_Column_List"> <sql id="Base_Column_List">
id, schedule_id, start_time, end_time, span, create_time, update_time id, schedule_id, start_time, end_time, span, create_time, update_time
</sql> </sql>
<select id="selectByScheduleId" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from schedule_details
where id = #{id,jdbcType=INTEGER}
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap"> <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select select
<include refid="Base_Column_List"/> <include refid="Base_Column_List"/>
@ -26,6 +33,20 @@
from schedule_details from schedule_details
where status = #{status} where status = #{status}
</select> </select>
<select id="selectAllBySceduleidList" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from schedule_details
<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 id="insert" parameterType="com.shxy.xymanager_common.entity.ScheduleDetails">
insert into schedule_details (id, name, start_time, insert into schedule_details (id, name, start_time,
end_time, span, remark, end_time, span, remark,

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?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"> <!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.TerminalSchedulesDao"> <mapper namespace="com.shxy.xymanager_dao.dao.TerminalScheduleDao">
<resultMap id="BaseResultMap" type="com.shxy.xymanager_common.entity.TerminalSchedules"> <resultMap id="BaseResultMap" type="com.shxy.xymanager_common.entity.TerminalSchedule">
<id column="id" jdbcType="INTEGER" property="id"/> <id column="id" jdbcType="INTEGER" property="id"/>
<result column="term_id" jdbcType="INTEGER" property="termId"/> <result column="term_id" jdbcType="INTEGER" property="termId"/>
<result column="channel_id" jdbcType="TINYINT" property="channelId"/> <result column="channel_id" jdbcType="TINYINT" property="channelId"/>
@ -58,7 +58,7 @@
</insert> </insert>
<insert id="insert" parameterType="com.shxy.xymanager_common.entity.TerminalSchedules"> <insert id="insert" parameterType="com.shxy.xymanager_common.entity.TerminalSchedule">
insert into terminal_schedule (id, term_id, channel_id, insert into terminal_schedule (id, term_id, channel_id,
schedule_id, create_time, update_time schedule_id, create_time, update_time
) )
@ -66,7 +66,7 @@
#{scheduleId,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP} #{scheduleId,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}
) )
</insert> </insert>
<insert id="insertSelective" parameterType="com.shxy.xymanager_common.entity.TerminalSchedules"> <insert id="insertSelective" parameterType="com.shxy.xymanager_common.entity.TerminalSchedule">
insert into terminal_schedule insert into terminal_schedule
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null"> <if test="id != null">
@ -109,7 +109,7 @@
</if> </if>
</trim> </trim>
</insert> </insert>
<update id="updateByPrimaryKeySelective" parameterType="com.shxy.xymanager_common.entity.TerminalSchedules"> <update id="updateByPrimaryKeySelective" parameterType="com.shxy.xymanager_common.entity.TerminalSchedule">
update terminal_schedule update terminal_schedule
<set> <set>
<if test="termId != null"> <if test="termId != null">
@ -131,16 +131,29 @@
where id = #{id,jdbcType=INTEGER} where id = #{id,jdbcType=INTEGER}
</update> </update>
<update id="updateList"> <update id="updateList">
<foreach collection="list" index="index" item="item" separator=";">
update terminal_schedule update terminal_schedule
set term_id = #{termId,jdbcType=INTEGER}, set term_id = #{item.termId},
channel_id = #{channelId,jdbcType=TINYINT}, channel_id = #{item.channelId},
schedule_id = #{scheduleId,jdbcType=INTEGER}, schedule_id = #{item.scheduleId},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP} update_time = #{updateTime,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=INTEGER} where term_id = #{id,jdbcType=INTEGER}
</foreach>
</update> </update>
<update id="updateByPrimaryKey" parameterType="com.shxy.xymanager_common.entity.TerminalSchedules"> <insert id="insertOrUpdate">
insert into terminal_schedule (id,term_id,channel_id,schedule_id,create_time,update_time)
values
<foreach collection="list" index="index" item="item" separator="," >
(#{item.id} ,#{item.termId}, #{item.channelId},#{item.scheduleId},#{createat},#{updateat})
</foreach>
ON DUPLICATE KEY UPDATE
term_id = values(term_id),
channel_id = values(channel_id),
schedule_id = values(schedule_id)
</insert>
<update id="updateByPrimaryKey" parameterType="com.shxy.xymanager_common.entity.TerminalSchedule">
update terminal_schedule update terminal_schedule
set term_id = #{termId,jdbcType=INTEGER}, set term_id = #{termId,jdbcType=INTEGER},
channel_id = #{channelId,jdbcType=TINYINT}, channel_id = #{channelId,jdbcType=TINYINT},

@ -3,7 +3,8 @@
<mapper namespace="com.shxy.xymanager_dao.dao.TerminalScheduleDetailsDao"> <mapper namespace="com.shxy.xymanager_dao.dao.TerminalScheduleDetailsDao">
<resultMap id="BaseResultMap" type="com.shxy.xymanager_common.entity.TerminalScheduleDetails"> <resultMap id="BaseResultMap" type="com.shxy.xymanager_common.entity.TerminalScheduleDetails">
<id column="id" jdbcType="INTEGER" property="id"/> <id column="id" jdbcType="INTEGER" property="id"/>
<result column="schedule_id" jdbcType="INTEGER" property="scheduleId"/> <result column="term_id" jdbcType="INTEGER" property="termId"/>
<result column="channel_id" jdbcType="INTEGER" property="channelId"/>
<result column="start_time" jdbcType="TIME" property="startTime"/> <result column="start_time" jdbcType="TIME" property="startTime"/>
<result column="end_time" jdbcType="TIME" property="endTime"/> <result column="end_time" jdbcType="TIME" property="endTime"/>
<result column="span" jdbcType="INTEGER" property="span"/> <result column="span" jdbcType="INTEGER" property="span"/>
@ -11,7 +12,7 @@
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/> <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
</resultMap> </resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
id, schedule_id, start_time, end_time, span, create_time, update_time id,term_id, channel_id, start_time, end_time, span, create_time, update_time
</sql> </sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap"> <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select select
@ -36,11 +37,9 @@
<insert id="insertList"> <insert id="insertList">
insert into terminal_schedule_details insert into terminal_schedule_details
(term_id, channel_id,start_time, end_time, span, create_time, update_time) (term_id, channel_id,start_time, end_time, span, create_time, update_time)
values (#{id,jdbcType=INTEGER}, #{scheduleId,jdbcType=INTEGER}, #{startTime,jdbcType=TIME}, values
#{endTime,jdbcType=TIME}, #{span,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP},
#{updateTime,jdbcType=TIMESTAMP})
<foreach collection="list" item="item" separator=","> <foreach collection="list" item="item" separator=",">
(#{item.termId},#{item.channelId},#{item.startTime},#{item.endTime},#{span},#{createat},#{updateat}) (#{item.termId},#{item.channelId},#{item.startTime},#{item.endTime},#{item.span},#{createat},#{updateat})
</foreach> </foreach>
</insert> </insert>
<insert id="insertSelective" parameterType="com.shxy.xymanager_common.entity.TerminalScheduleDetails"> <insert id="insertSelective" parameterType="com.shxy.xymanager_common.entity.TerminalScheduleDetails">
@ -126,4 +125,11 @@
update_time = #{updateTime,jdbcType=TIMESTAMP} update_time = #{updateTime,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=INTEGER} where id = #{id,jdbcType=INTEGER}
</update> </update>
<delete id="deleteByTermidAndChannelIdList">
delete from terminal_schedule_details
where
<foreach collection="list" item="item" index="index" separator="or" open="(" close=")">
term_id = #{item.termId} and channel_id = #{item.channelId}
</foreach>
</delete>
</mapper> </mapper>

@ -21,7 +21,7 @@
where status = #{status} where status = #{status}
<if test="list != null and list.size>0"> <if test="list != null and list.size>0">
and and
<foreach collection="list" item="item" index="index" open="(" close=")" separator=","> <foreach collection="list" item="item" index="index" open="(" close=")" separator="or">
term_id = #{item.termid} term_id = #{item.termid}
<if test="item.channelidlist != null and item.channelidlist.size>0"> <if test="item.channelidlist != null and item.channelidlist.size>0">
and channel_id in and channel_id in
@ -39,9 +39,9 @@
from terminal_schedules_temp from terminal_schedules_temp
where status = #{status} where status = #{status}
<if test="list != null and list.size>0"> <if test="list != null and list.size>0">
and and request_id in
<foreach collection="list" item="item" index="index" open="(" close=")" separator=","> <foreach collection="list" item="item" index="index" open="(" close=")" separator=",">
request_id = #{item} #{item}
</foreach> </foreach>
</if> </if>
</select> </select>
@ -78,9 +78,6 @@
<insert id="insertSelective" parameterType="com.shxy.xymanager_common.entity.TerminalSchedulesTemp"> <insert id="insertSelective" parameterType="com.shxy.xymanager_common.entity.TerminalSchedulesTemp">
insert into terminal_schedules_temp insert into terminal_schedules_temp
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">
id,
</if>
<if test="termId != null"> <if test="termId != null">
term_id, term_id,
</if> </if>
@ -90,6 +87,12 @@
<if test="scheduleId != null"> <if test="scheduleId != null">
schedule_id, schedule_id,
</if> </if>
<if test="requestId != null">
request_id,
</if>
<if test="status != null">
status,
</if>
<if test="createTime != null"> <if test="createTime != null">
create_time, create_time,
</if> </if>
@ -98,9 +101,6 @@
</if> </if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">
#{id,jdbcType=INTEGER},
</if>
<if test="termId != null"> <if test="termId != null">
#{termId,jdbcType=INTEGER}, #{termId,jdbcType=INTEGER},
</if> </if>
@ -110,6 +110,12 @@
<if test="scheduleId != null"> <if test="scheduleId != null">
#{scheduleId,jdbcType=INTEGER}, #{scheduleId,jdbcType=INTEGER},
</if> </if>
<if test="requestId != null">
#{requestId},
</if>
<if test="status != null">
#{status},
</if>
<if test="createTime != null"> <if test="createTime != null">
#{createTime,jdbcType=TIMESTAMP}, #{createTime,jdbcType=TIMESTAMP},
</if> </if>

@ -82,7 +82,7 @@
where status = #{status} where status = #{status}
</select> </select>
<select id="selectByIdList" resultMap="BaseResultMap"> <select id="selectByIdList" resultMap="ChannelAndTerm">
select select
a.id as term_id, a.id as term_id,
a.line_id as line_id, a.line_id as line_id,
@ -96,7 +96,7 @@
where a.status = #{status} where a.status = #{status}
<if test="list != null and list.size>0"> <if test="list != null and list.size>0">
and and
<foreach collection="list" item="item" index="index" open="(" close=")" separator=","> <foreach collection="list" item="item" index="index" open="(" close=")" separator="or">
a.id = #{item.termid} a.id = #{item.termid}
<if test="item.channelidlist != null and item.channelidlist.size>0"> <if test="item.channelidlist != null and item.channelidlist.size>0">
and c.id in and c.id in

@ -301,6 +301,7 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
public ServiceBody<Boolean> getReturnedPhoto(ReturnedPhotoVo vo) { public ServiceBody<Boolean> getReturnedPhoto(ReturnedPhotoVo vo) {
Boolean hasNew = false; Boolean hasNew = false;
TerminalPhoto photo = terminalPhotoDao.getLatestPhoto(vo.getTermId()); TerminalPhoto photo = terminalPhotoDao.getLatestPhoto(vo.getTermId());
if (photo != null) {
BigInteger localPhotoTime = MyDateUtils.TimeMillSecond2Second(vo.getPhotoTime()); BigInteger localPhotoTime = MyDateUtils.TimeMillSecond2Second(vo.getPhotoTime());
log.info("请求时间:{}", localPhotoTime); log.info("请求时间:{}", localPhotoTime);
log.info("装置凯斯处理时间:{}", photo.getRecvTime()); log.info("装置凯斯处理时间:{}", photo.getRecvTime());
@ -310,6 +311,10 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
hasNew = false; hasNew = false;
} }
} }
}else {
hasNew = false;
}
return Asserts.success(hasNew); return Asserts.success(hasNew);
} }

@ -28,13 +28,10 @@ import com.shxy.xymanager_common.vo.*;
import com.shxy.xymanager_dao.dao.*; import com.shxy.xymanager_dao.dao.*;
import com.shxy.xymanager_service.service.TerminalScheduleRuleService; import com.shxy.xymanager_service.service.TerminalScheduleRuleService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.omg.PortableInterceptor.INACTIVE;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import javax.validation.constraints.NotNull;
import java.sql.Time; import java.sql.Time;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
@ -54,7 +51,7 @@ public class TerminalScheduleRuleServiceImpl implements TerminalScheduleRuleServ
ScheduleDetailsDao scheduleDetailsDao; ScheduleDetailsDao scheduleDetailsDao;
@Autowired @Autowired
TerminalSchedulesDao terminalSchedulesDao; TerminalScheduleDao terminalScheduleDao;
@Autowired @Autowired
TerminalSchedulesTempDao terminalSchedulesTempDao; TerminalSchedulesTempDao terminalSchedulesTempDao;
@ -222,83 +219,73 @@ public class TerminalScheduleRuleServiceImpl implements TerminalScheduleRuleServ
*/ */
@Override @Override
@Transactional @Transactional
public ServiceBody<GetModel> relateSchelduleRule(RelateTerminalListRuleIdVo vo) { public ServiceBody<GetListModel> relateSchelduleRule(RelateTerminalListRuleIdVo vo) {
GetListModel model = new GetListModel();
List<TerminalSchedulesTemp> list = terminalSchedulesTempDao.selectByTermAndChannel(vo.getList(), CommonStatus.DELETE.value());
if (CollectionUtil.isNotEmpty(list)) {
GetModel model = new GetModel(); return Asserts.error("有装置时间尚未下发成功");
// List<TerminalSchedulesTemp> list = terminalSchedulesTempDao.selectByTermAndChannel(vo.getList(), CommonStatus.DELETE.value()); }
// if (CollectionUtil.isNotEmpty(list)) { List<RelateTerminalListRuleIdVo.Items> termlist = vo.getList();
// Integer scheduleid = vo.getScheduleid();
// return Asserts.error("有装置时间尚未下发成功");
// } List<ChannelAndTermDto> terminalsList = terminalsDao.selectByIdList(termlist, CommonStatus.EFFECTIVE.value());
// List<RelateTerminalListRuleIdVo.Items> termlist = vo.getList(); if (CollectionUtil.isEmpty(terminalsList)) {
// return Asserts.error("没有该装置");
// Integer scheduleid = vo.getScheduleid(); }
// List<TerminalSchedulesTemp> temps = new ArrayList<>(); ScheduleAndRuleDto dto = schedulesDao.selectSingle(scheduleid, CommonStatus.EFFECTIVE.value());
// List<Integer> termidlist = new ArrayList<>(); if (BeanUtil.isEmpty(dto)) {
// for (RelateTerminalListRuleIdVo.Items item : termlist) { return Asserts.error("没有该拍照时间规则");
// termidlist.add(item.getTermid()); }
// List<Integer> channelidlist = item.getChannelidlist(); List<ScheduleRuleDto> dtoList = dto.getList();
// for (Integer it : channelidlist) { if (CollectionUtil.isEmpty(dtoList)) {
// TerminalSchedulesTemp temp = new TerminalSchedulesTemp(); return Asserts.error("没有该拍照时间规则");
// temp.setTermId(item.getTermid()); }
// temp.setScheduleId(scheduleid); StringBuffer timestr = new StringBuffer();
// temp.setChannelId(it); for (int j = 0; j < dtoList.size(); j++) {
// temps.add(temp); Integer span = dtoList.get(j).getSpan();
// } Date startTime = dtoList.get(j).getStartTime();
// } Short startHour = Short.parseShort(MyDateUtils.parseHourAndMinute(startTime).split("/")[0]);
// Date date = new Date(); Short startMin = Short.parseShort(MyDateUtils.parseHourAndMinute(startTime).split("/")[1]);
// int i = terminalSchedulesTempDao.insertList(temps, CommonStatus.EFFECTIVE.value(), date, date); Date endTime = dtoList.get(j).getEndTime();
// Short endTimeHour = Short.parseShort(MyDateUtils.parseHourAndMinute(endTime).split("/")[0]);
// List<ChannelAndTermDto> terminalsList = terminalsDao.selectByIdList(vo.getList(), CommonStatus.EFFECTIVE.value()); Short endTimeMin = Short.parseShort(MyDateUtils.parseHourAndMinute(endTime).split("/")[1]);
// Integer span1 = -1;
// if (CollectionUtil.isEmpty(termidlist)) { Integer span2 = -1;
// return Asserts.error("没有该装置"); if (span / 60 > 0) {
// } span1 = (span / 60);
// ScheduleAndRuleDto dto = schedulesDao.selectSingle(scheduleid, CommonStatus.EFFECTIVE.value()); span2 = (span % 60);
// List<ScheduleRuleDto> dtoList = dto.getList(); } else if (span < 60) {
// if (CollectionUtil.isEmpty(dtoList)) { span1 = 0;
// return Asserts.error("没有该拍照时间规则"); span2 = span;
// } }
// String string = "--hour1=" + startHour + "\t" + "--min1=" + startMin + "\t" + "--preset1=255 --hour2=" + endTimeHour + "\t" + "--min2=" + endTimeMin + "\t"
// StringBuffer timestr = new StringBuffer(); + "--preset2=255 --hour3=" + span1 + "\t" + "--min3=" + span2 + "\t" + "--preset3=255";
// for (int j = 0; j < dtoList.size(); j++) { timestr.append(string);
// TerminalPhotosTimeModel.PhotosTimeBean bean = new TerminalPhotosTimeModel.PhotosTimeBean(); }
// Integer span = dtoList.get(j).getSpan();
// Date startTime = dtoList.get(j).getStartTime(); ArrayList<Integer> requestIdList = new ArrayList<>();
// Short startHour = Short.parseShort(MyDateUtils.parseHourAndMinute(startTime).split("/")[0]); for (int x = 0; x < terminalsList.size(); x++) {
// Short startMin = Short.parseShort(MyDateUtils.parseHourAndMinute(startTime).split("/")[1]); ChannelAndTermDto channelAndTermDto = terminalsList.get(x);
// String cmd = Constants.CMD + "schedule --flag=1 --cmdid=" + channelAndTermDto.getCmdid() + "\t" + "--channel=" + channelAndTermDto.getChannelid() + "\t" +
// timestr.toString();
// Date endTime = dtoList.get(j).getEndTime();
// Short endTimeHour = Short.parseShort(MyDateUtils.parseHourAndMinute(endTime).split("/")[0]);
// Short endTimeMin = Short.parseShort(MyDateUtils.parseHourAndMinute(endTime).split("/")[1]);
//
// Integer span1 = -1;
// Integer span2 = -1;
// if (span / 60 > 0) {
// span1 = (span / 60);
// span2 = (span % 60);
// } else if (span < 60) {
// span1 = 0;
// span2 = span;
// }
// String string = "--hour1=" + startHour + "\t" + "--min1=" + startMin + "\t" + "--preset1=255 --hour2=" + endTimeHour + "\t" + "--min2=" + endTimeMin + "\t"
// + "--preset2=255 --hour3=" + span1 + "\t" + "--min3=" + span2 + "\t" + "--preset3=255";
// timestr.append(string);
// }
// for (int x = 0; x < terminalsList.size(); x++) {
// ChannelAndTermDto channelAndTermDto = terminalsList.get(x);
// String cmd = Constants.CMD + "schedule --flag=1 --cmdid=" + channelAndTermDto.getCmdid() + "\t" + "--channel=" + channelAndTermDto.getChannelid() + "\t" +
// timestr.toString();
// ProcessExecUtils.exec(cmd); // ProcessExecUtils.exec(cmd);
// } int requestId = Integer.parseInt(Constants.REQUEST_ID.toString());
model.setRequestId(Integer.parseInt(Constants.REQUEST_ID.toString()));
Constants.REQUEST_ID.addAndGet(1); Constants.REQUEST_ID.addAndGet(1);
// if (i != 0) { requestIdList.add(requestId);
Date date = new Date();
TerminalSchedulesTemp temp = new TerminalSchedulesTemp();
temp.setTermId(channelAndTermDto.getTermid());
temp.setChannelId(channelAndTermDto.getChannelid());
temp.setScheduleId(scheduleid);
temp.setRequestId(requestId);
temp.setStatus(CommonStatus.DELETE.value());
temp.setCreateTime(date);
temp.setUpdateTime(date);
terminalSchedulesTempDao.insertSelective(temp);
}
model.setList(requestIdList);
return Asserts.success(model); return Asserts.success(model);
// } else {
// return Asserts.error("关联失败");
// }
} }
@ -311,48 +298,64 @@ public class TerminalScheduleRuleServiceImpl implements TerminalScheduleRuleServ
@Override @Override
@Transactional @Transactional
public ServiceBody<String> checkScheldule(RequestIdListVo vo) { public ServiceBody<String> checkScheldule(RequestIdListVo vo) {
// /* /*
// * 当定时任务或者用户主动查询下发状态时 *
// * */ * */
// List<Integer> requestidlist = vo.getList(); List<Integer> requestidlist = vo.getList();
// List<RequestResults> resultsList = requestResultsDao.selectByRequestIdList(requestidlist); List<RequestResults> resultsList = requestResultsDao.selectByRequestIdList(requestidlist);
// /* /*
// * 如果下发成功 *
// * 1,将临时表中的数据状态改成1下发成功状态 * 1,1
// * 2将装置关联拍照时间正式表改为临时表的对应状态 * 2
// * 3将装置自身detial表插入新数据 * 3detial
// * */ * */
// if (CollectionUtil.isEmpty(resultsList)) { if (CollectionUtil.isEmpty(resultsList)) {
// return Asserts.success("尚未查询到下发数据"); return Asserts.success("尚未查询到下发数据");
// } }
// terminalSchedulesTempDao.updateStatusByRequestIdList(requestidlist, CommonStatus.EFFECTIVE.value(), new Date()); terminalSchedulesTempDao.updateStatusByRequestIdList(requestidlist, CommonStatus.EFFECTIVE.value(), new Date());
//
// List<TerminalSchedulesTemp> terminalSchedulesTemps = terminalSchedulesTempDao.selectByRequestId(requestidlist, CommonStatus.EFFECTIVE.value()); List<TerminalSchedulesTemp> terminalSchedulesTemps = terminalSchedulesTempDao.selectByRequestId(requestidlist, CommonStatus.EFFECTIVE.value());
//
// ArrayList<TerminalSchedules> terminalSchedules = new ArrayList<>(); ArrayList<TerminalSchedule> terminalSchedules = new ArrayList<>();
// for (TerminalSchedulesTemp item : terminalSchedulesTemps) { ArrayList<Integer> scheduleidlist = new ArrayList<>();
// TerminalSchedules record = new TerminalSchedules(); for (TerminalSchedulesTemp item : terminalSchedulesTemps) {
// record.setChannelId(item.getChannelId()); TerminalSchedule record = new TerminalSchedule();
// record.setScheduleId(item.getScheduleId()); record.setChannelId(item.getChannelId());
// record.setTermId(item.getTermId()); record.setScheduleId(item.getScheduleId());
// } record.setTermId(item.getTermId());
// terminalSchedulesDao.updateList(terminalSchedules);//将实际的拍照时间表规则从临时表更新到正式表中 scheduleidlist.add(item.getScheduleId());
// terminalSchedules.add(record);
//// terminalScheduleDetailsDao.deleteByPrimaryKey();//根据装置编号和通道编号删除之前对应的实际拍照时间表详情 }
// Date date = new Date();
// ArrayList<TerminalScheduleDetails> record1 = new ArrayList<>(); terminalScheduleDao.insertOrUpdate(terminalSchedules, date, date);//将实际的拍照时间表规则从临时表更新到正式表中
// terminalScheduleDetailsDao.insertList(record1);//插入新的对应的拍照时间表规则详情
// ArrayList<Integer> distinct = CollectionUtil.distinct(scheduleidlist);
// int i = requestResultsDao.updateByPrimaryKey(new RequestResults());//根据requestid将结果表中的状态修改为已下发 List<ScheduleDetails> scheduleDetails = scheduleDetailsDao.selectAllBySceduleidList(distinct);
////end ArrayList<TerminalScheduleDetails> terminalScheduleDetails = new ArrayList<>();
for (int i = 0; i < terminalSchedules.size(); i++) {
// if (i != 0) { for (int j = 0; j < scheduleDetails.size(); j++) {
TerminalSchedule terminalSchedule = terminalSchedules.get(i);
ScheduleDetails scheduleDetailsbean = scheduleDetails.get(j);
if (scheduleDetailsbean.getScheduleId().intValue() == terminalSchedule.getScheduleId().intValue()) {
TerminalScheduleDetails bean = new TerminalScheduleDetails();
bean.setTermId(terminalSchedule.getTermId());
bean.setChannelId(terminalSchedule.getChannelId());
bean.setStartTime(scheduleDetailsbean.getStartTime());
bean.setEndTime(scheduleDetailsbean.getEndTime());
bean.setSpan(scheduleDetailsbean.getSpan());
terminalScheduleDetails.add(bean);
}
}
}
terminalScheduleDetailsDao.deleteByTermidAndChannelIdList(terminalSchedules);
terminalScheduleDetailsDao.insertList(terminalScheduleDetails, date, date);
int i = requestResultsDao.updateByRequestIdList(requestidlist, CommonStatus.EFFECTIVE.value());//根据requestid将结果表中的状态修改为已下发
if (i != 0) {
return Asserts.success("下发成功"); return Asserts.success("下发成功");
// } else { } else {
// return Asserts.error("关联失败"); return Asserts.error("关联失败");
// } }
} }
/** /**
* *
@ -362,10 +365,10 @@ public class TerminalScheduleRuleServiceImpl implements TerminalScheduleRuleServ
*/ */
@Transactional @Transactional
public ServiceBody<GetModel> getSchedule(RelateTerminalListRuleIdVo vo) { public ServiceBody<GetModel> getSchedule(RelateTerminalListRuleIdVo vo) {
// GetModel model = new GetModel(); GetModel model = new GetModel();
// Integer requestid = 0; Integer requestid = 0;
// ArrayList<Integer> intlist = new ArrayList<>(); ArrayList<Integer> intlist = new ArrayList<>();
// RequestResults results = requestResultsDao.selectByRequestId(1); RequestResults results = requestResultsDao.selectByRequestId(1);
// /* // /*
// * 如果下发成功 // * 如果下发成功
// * 1,将临时表中的数据状态改成1下发成功状态 // * 1,将临时表中的数据状态改成1下发成功状态
@ -412,7 +415,7 @@ public class TerminalScheduleRuleServiceImpl implements TerminalScheduleRuleServ
@Override @Override
public ServiceBody<TerminalScheduleRuleTimeListModel> getChannelSchelduleRule(TerminalAndChannelIdVo vo) { public ServiceBody<TerminalScheduleRuleTimeListModel> getChannelSchelduleRule(TerminalAndChannelIdVo vo) {
TerminalScheduleRuleTimeListModel model = new TerminalScheduleRuleTimeListModel(); TerminalScheduleRuleTimeListModel model = new TerminalScheduleRuleTimeListModel();
TerminalSchedules mapper = terminalSchedulesDao.selectByChannelId(vo.getChannelid(), vo.getTerminalid()); TerminalSchedule mapper = terminalScheduleDao.selectByChannelId(vo.getChannelid(), vo.getTerminalid());
if (mapper == null) { if (mapper == null) {
model.setList(new ArrayList<>()); model.setList(new ArrayList<>());
} else { } else {

@ -1,10 +1,7 @@
package com.shxy.xymanager_service.service; package com.shxy.xymanager_service.service;
import com.shxy.xymanager_common.bean.ServiceBody; import com.shxy.xymanager_common.bean.ServiceBody;
import com.shxy.xymanager_common.model.GetModel; import com.shxy.xymanager_common.model.*;
import com.shxy.xymanager_common.model.TerminalScheduleRuleListModel;
import com.shxy.xymanager_common.model.TerminalScheduleRuleModel;
import com.shxy.xymanager_common.model.TerminalScheduleRuleTimeListModel;
import com.shxy.xymanager_common.vo.*; import com.shxy.xymanager_common.vo.*;
/** /**
@ -57,7 +54,7 @@ public interface TerminalScheduleRuleService {
* @param vo * @param vo
* @return * @return
*/ */
ServiceBody<GetModel> relateSchelduleRule(RelateTerminalListRuleIdVo vo); ServiceBody<GetListModel> relateSchelduleRule(RelateTerminalListRuleIdVo vo);
/** /**
* *

Loading…
Cancel
Save