新增规约

修改时间表
调整焦距
调整装置显示
dev
liuguijing 2 years ago
parent f5808d64db
commit d34288eb0f

@ -54,4 +54,18 @@ public class TermSetController extends BaseController {
return ResponseReult.error(serviceBody.getCode(), serviceBody.getMsg());
}
}
@ApiOperation(value = "调整装置焦距", notes = "调整装置焦距", httpMethod = "POST")
@ApiResponses({@ApiResponse(code = 200, message = "请求成功"), @ApiResponse(code = 400, message = "请求参数没填好"), @ApiResponse(code = 404, message = "请求路径没有或页面跳转路径不对")})
@RequestMapping("/updateTermCamera")
@Log(title = "调整装置焦距", type = "查询")
public ResponseReult<CmaRequestModel> updateTermCamera(UpdateCameraVo vo) {
ServiceBody<CmaRequestModel> serviceBody = termSetService.updateTermCamera(vo);
if (serviceBody.getCode() == ServiceStatus.SUCCESS) {
return ResponseReult.success(serviceBody.getData());
} else {
return ResponseReult.error(serviceBody.getCode(), serviceBody.getMsg());
}
}
}

@ -10,7 +10,7 @@ import java.util.concurrent.atomic.AtomicInteger;
/**
*
*
* @author xzg
* @author jingjing
*/
@Component
public class Constants
@ -34,6 +34,8 @@ public class Constants
server = cmServer;
port = cmaPort;
CMD = "/usr/local/bin/xympadmn --server="+server+" --port="+port+" --act=";
}

@ -41,6 +41,8 @@ public class TerminalsAndStatusDto implements Serializable {
private Integer status;
private Integer protocol;
private Short signalStrength4g;
private BigInteger bootTime;

@ -0,0 +1,17 @@
package com.shxy.xymanager_common.entity;
import lombok.Data;
import java.io.Serializable;
@Data
public class Protocols implements Serializable {
private Integer id;
private String name;
private String version;
private static final long serialVersionUID = 1L;
}

@ -17,7 +17,7 @@ public class TerminalScheduleDetails implements Serializable {
private Integer minute;
private Integer span;
private Integer preset;
private Date createTime;

@ -21,6 +21,12 @@ public class TerminalSchedulesTemp implements Serializable {
private Integer offset;
private Integer hour;
private Integer minute;
private Integer preset;
private Date createTime;
private Date updateTime;

@ -46,6 +46,8 @@ public class Terminals implements Serializable {
private Integer onlinestatus;
private Integer protocol;
/*展示名字 等价与displayname 用于方便*/
private String name;

@ -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.Date;
/**
* cma
*/
@Data
@ApiModel(value = "cma请求返回对象", description = "cma请求返回对象")
public class CmaRequestModel implements Serializable {
@ApiModelProperty(value = "请求编号", example = "123456")
private Integer requestId;
}

@ -64,6 +64,9 @@ public class DyLineAndTermModel implements Serializable {
@ApiModelProperty(value = "显示名", example = "名称名称")
private String name;
@ApiModelProperty(value = "规约编号", example = "65286")
private Integer protocol;
@ApiModelProperty(value = "在线状态", example = "0--掉线1--在线")
private Integer onlinestatus;

@ -101,6 +101,12 @@ public class TerminalListModel implements Serializable {
@ApiModelProperty(value = "是否删除", example = "0--删除1--未删除")
private Integer status;
@ApiModelProperty(value = "规约编号", example = "21223")
private Integer protocol;
@ApiModelProperty(value = "规约名称", example = "21223")
private String protocolName;
@ApiModelProperty(value = "通道编号和名称", example = "213")
private List<ChannelBeans> list;

@ -2,6 +2,7 @@ package com.shxy.xymanager_common.util;
import com.shxy.xymanager_common.constant.Constants;
import com.shxy.xymanager_common.dto.ScheduleDetailsDto;
import com.shxy.xymanager_common.vo.ScheduleRuleVo;
import java.util.List;
@ -97,7 +98,7 @@ public class CmaUtil {
*
* @return
*/
public static String relateSchelduleRule(List<ScheduleDetailsDto> dtoList, String cmdid, Integer requestId, Integer channel, String timestr) {
public static String relateSchelduleRule(List<ScheduleRuleVo> dtoList, String cmdid, Integer requestId, Integer channel, String timestr) {
String cmd = Constants.CMD + "schedule --group=" + dtoList.size() + " --flag=1 --clientid=10 --cmdid="
+ cmdid + " --reqid=" + requestId + " --channel=" + channel + " " +
timestr;
@ -212,5 +213,17 @@ public class CmaUtil {
return cmd;
}
/**
*
*
* @param cmdid
* @param requestId
* @return
*/
public static String cameractrl(String cmdid, Integer channel, Integer requestId, Integer ctrl) {
String cmd = Constants.CMD + "cameractrl --clientid=10 --preset=0 --cmdid=" + cmdid + " --channel=" + channel + " --ctrl=" + ctrl + " --reqid=" + requestId;
return cmd;
}
}

@ -41,6 +41,7 @@ public class ScheduleListUtils {
// spanrule.setPreset(255);
// list.add(spanrule);
//
// ScheduleDetails startrule = new ScheduleDetails();
// startrule.setScheduleId(scheduleid);
// Time startTime = item.getStartTime();
@ -52,6 +53,7 @@ public class ScheduleListUtils {
// ScheduleDetails endrule = new ScheduleDetails();
// endrule.setScheduleId(scheduleid);
// Time endTime = item.getEndTime();
// endrule.setHour(MyDateUtils.hour(endTime, true));
// endrule.setMinute(MyDateUtils.minute(endTime));
// endrule.setPreset(255);
@ -75,70 +77,86 @@ public class ScheduleListUtils {
* CMA
*
* @param dtoList
* @param offset
* @return
*/
public static String relateTime(List<ScheduleDetailsDto> dtoList, int offset) {
public static String relateTime(List<ScheduleRuleVo> dtoList) {
StringBuffer timestr = new StringBuffer();
short perset = dtoList.get(0).getPreset().shortValue();
int index = 0;
String startstring = "";
String endstring = "";
String spanstring = "";
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) == 0) {
if (CollectionUtil.isNotEmpty(dtoList)) {
short perset = dtoList.get(0).getPreset().shortValue();
int index = 0;
String spanstring = "";
for (int i = 0; i < dtoList.size(); i++) {
index = i + 1;
spanHour = dtoList.get(i).getHour().shortValue();
spanMin = dtoList.get(i).getMinute().shortValue();
short spanHour = dtoList.get(i).getHour().shortValue();
short spanMin = dtoList.get(i).getMinute().shortValue();
spanstring = " --hour" + index + "=" + spanHour + " --min" + index + "=" + spanMin + " --preset" + index + "=" + perset;
} else if (XyNumberUtils.remainder(i, 3) == 1) {
index = i + 1;
Number add = XyNumberUtils.add((Number) dtoList.get(i).getMinute(), offset);
if (add.intValue() >= 60) {
Number add1 = XyNumberUtils.add((Number) dtoList.get(i).getHour(), 1);
if (add1.intValue() >= 24) {
startHour = Integer.valueOf(24).shortValue();
startMin = Integer.valueOf(0).shortValue();
} else {
startHour = XyNumberUtils.add((Number) dtoList.get(i).getHour(), 1).shortValue();
startMin = XyNumberUtils.sub(add, 60).shortValue();
}
} else {
startHour = dtoList.get(i).getHour().shortValue();
startMin = add.shortValue();
}
startstring = " --hour" + index + "=" + startHour + " --min" + index + "=" + startMin + " --preset" + index + "=" + perset;
} else if (XyNumberUtils.remainder(i, 3) == 2) {
index = i + 1;
Number add = XyNumberUtils.add((Number) dtoList.get(i).getMinute(), offset);
if (add.intValue() >= 60) {
Number add1 = XyNumberUtils.add((Number) dtoList.get(i).getHour(), 1);
if (add1.intValue() >= 24) {
endHour = Integer.valueOf(24).shortValue();
endMin = Integer.valueOf(0).shortValue();
} else {
endHour = add1.shortValue();
endMin = XyNumberUtils.sub(add, 60).shortValue();
}
} else {
endHour = dtoList.get(i).getHour().shortValue();
endMin = add.shortValue();
}
endstring = " --hour" + index + "=" + endHour + " --min" + index + "=" + endMin + " --preset" + index + "=" + perset;
if (StrUtil.isNotEmpty(spanstring) && StrUtil.isNotEmpty(startstring) && StrUtil.isNotEmpty(endstring)) {
timestr.append(spanstring).append(startstring).append(endstring);
}
timestr.append(spanstring);
}
}
return timestr.toString();
}
// public static String relateTime(List<ScheduleDetailsDto> dtoList, int offset) {
// StringBuffer timestr = new StringBuffer();
// short perset = dtoList.get(0).getPreset().shortValue();
// int index = 0;
// String startstring = "";
// String endstring = "";
// String spanstring = "";
// 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) == 0) {
// index = i + 1;
// spanHour = dtoList.get(i).getHour().shortValue();
// spanMin = dtoList.get(i).getMinute().shortValue();
// spanstring = " --hour" + index + "=" + spanHour + " --min" + index + "=" + spanMin + " --preset" + index + "=" + perset;
// } else if (XyNumberUtils.remainder(i, 3) == 1) {
// index = i + 1;
// Number add = XyNumberUtils.add((Number) dtoList.get(i).getMinute(), offset);
// if (add.intValue() >= 60) {
// Number add1 = XyNumberUtils.add((Number) dtoList.get(i).getHour(), 1);
// if (add1.intValue() >= 24) {
// startHour = Integer.valueOf(24).shortValue();
// startMin = Integer.valueOf(0).shortValue();
// } else {
// startHour = XyNumberUtils.add((Number) dtoList.get(i).getHour(), 1).shortValue();
// startMin = XyNumberUtils.sub(add, 60).shortValue();
// }
// } else {
// startHour = dtoList.get(i).getHour().shortValue();
// startMin = add.shortValue();
// }
// startstring = " --hour" + index + "=" + startHour + " --min" + index + "=" + startMin + " --preset" + index + "=" + perset;
// } else if (XyNumberUtils.remainder(i, 3) == 2) {
// index = i + 1;
// Number add = XyNumberUtils.add((Number) dtoList.get(i).getMinute(), offset);
// if (add.intValue() >= 60) {
// Number add1 = XyNumberUtils.add((Number) dtoList.get(i).getHour(), 1);
// if (add1.intValue() >= 24) {
// endHour = Integer.valueOf(24).shortValue();
// endMin = Integer.valueOf(0).shortValue();
// } else {
// endHour = add1.shortValue();
// endMin = XyNumberUtils.sub(add, 60).shortValue();
// }
// } else {
// endHour = dtoList.get(i).getHour().shortValue();
// endMin = add.shortValue();
// }
// endstring = " --hour" + index + "=" + endHour + " --min" + index + "=" + endMin + " --preset" + index + "=" + perset;
// if (StrUtil.isNotEmpty(spanstring) && StrUtil.isNotEmpty(startstring) && StrUtil.isNotEmpty(endstring)) {
// timestr.append(spanstring).append(startstring).append(endstring);
// }
// }
// }
// return timestr.toString();
// }
// /**
// * 将数据库标准转为前端的时间列表
@ -193,7 +211,8 @@ public class ScheduleListUtils {
// scheduleDetailsBean.setScheduleId(dto.getScheduleId());
// scheduleDetailsBean.setSpan(add.intValue());
// } else if (XyNumberUtils.remainder(i, 3) == 1) {
// Integer hour = dto.getHour();
// Integer hour = dto
// .getHour();
// Integer minute = dto.getMinute();
// Time time = MyDateUtils.HHMMToTime(hour, minute);
// scheduleDetailsBean.setStartTime(time);

@ -302,8 +302,14 @@ public class TerminalUtils {
Integer mediaType = item.getMediaType();
if (mediaType != null && (mediaType.intValue() == 0 || mediaType.intValue() == 1)) {
photoBean.setDisplayname(terminals.getDisplayName());
photoBean.setLineid(terminals.getLineid());
photoBean.setLinename(lineMap.get(terminals.getLineid()).getName());
Integer lineid = terminals.getLineid();
photoBean.setLineid(lineid);
if (lineMap != null) {
LineAndDyNameDto lineAndDyNameDto = lineMap.get(lineid);
if (lineAndDyNameDto != null) {
photoBean.setLinename(lineAndDyNameDto.getName());
}
}
Integer channelId = item.getChannelId();
photoBean.setChannelid(channelId);
photoBean.setCmdid(terminals.getCmdid());

@ -31,10 +31,15 @@ public class RelateTerminalListRuleIdVo {
@NotNull(message = "通道编号列表不能缺少")
@ApiModelProperty(value = "通道编号列表", example = "123455")
private List<Integer> channelidlist;
private Integer channelid;
@ApiModelProperty(value = "偏移量", example = "123455")
private Integer offset;
@NotNull(message = "不能传入空值")
@ApiModelProperty(value = "任务规则对象数组", required = true, example = "A0001")
private List<ScheduleRuleVo> list;
}
}

@ -0,0 +1,21 @@
package com.shxy.xymanager_common.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.Min;
@Data
@ApiModel(value = "修改焦距对象", description = "修改焦距对象描述")
public class UpdateCameraVo {
@ApiModelProperty(value = "装置编号", required = true, example = "1")
private Integer termId;
@ApiModelProperty(value = "通道编号", required = true, example = "1")
private Integer channelId;
@ApiModelProperty(value = "类型", required = true, example = "1")
private Integer type;
}

@ -22,5 +22,4 @@ public class VoiceCtrlVo {
@ApiModelProperty(value = "声光报警开关", example = "0:关闭 1:开启")
private Integer ctrl;
}

@ -0,0 +1,9 @@
package com.shxy.xymanager_dao.dao;
import com.shxy.xymanager_common.entity.Protocols;
import java.util.List;
public interface ProtocolsDao {
List<Protocols> selectAll();
}

@ -9,10 +9,6 @@ import java.util.List;
public interface TerminalScheduleDetailsDao {
int deleteByTermiAndChannel(Integer id);
int deleteByTermidAndChannelIdList(@Param("list") List<TerminalSchedule> lsit);
int insert(TerminalScheduleDetails record);
int insertList(@Param("list") List<TerminalScheduleDetails> record, @Param("createat") Date createat, @Param("updateat") Date updateat);
@ -21,6 +17,8 @@ public interface TerminalScheduleDetailsDao {
TerminalScheduleDetails selectByPrimaryKey(Integer id);
List<TerminalScheduleDetails> selectByTermidAndChannelid(@Param("termid") Integer termid, @Param("channelid") Integer channelid);
int updateByPrimaryKeySelective(TerminalScheduleDetails record);
int updateByPrimaryKey(TerminalScheduleDetails record);

@ -14,6 +14,7 @@ public interface TerminalSchedulesTempDao {
List<TerminalSchedulesTemp> selectByRequestId(@Param("list") List<Integer> id, @Param("status") Integer status);
int deleteByPrimaryKey(Integer id);
int deleteByTermidAndChannelid(@Param("list") List<TerminalSchedulesTemp> record);
int insert(TerminalSchedulesTemp record);

@ -245,9 +245,17 @@
<!-- &lt;!&ndash; <property name="useActualColumnNames" value="false"/>&ndash;&gt;-->
<!-- </table>-->
<table tableName="global_params"
domainObjectName="GlobalParams"
mapperName="GlobalParamsDao"
<!-- <table tableName="global_params"-->
<!-- domainObjectName="GlobalParams"-->
<!-- mapperName="GlobalParamsDao"-->
<!-- enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false"-->
<!-- enableSelectByExample="false" selectByExampleQueryId="false">-->
<!-- &lt;!&ndash; <property name="useActualColumnNames" value="false"/>&ndash;&gt;-->
<!-- </table>-->
<table tableName="protocols"
domainObjectName="Protocols"
mapperName="ProtocolsDao"
enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false"
enableSelectByExample="false" selectByExampleQueryId="false">
<!-- <property name="useActualColumnNames" value="false"/>-->

@ -45,6 +45,7 @@
<collection property="list" javaType="list" ofType="com.shxy.xymanager_common.entity.Terminals">
<result column="term_id" jdbcType="INTEGER" property="id"/>
<result column="tower_id" jdbcType="INTEGER" property="towerid"/>
<result column="protocol" jdbcType="INTEGER" property="protocol"/>
<result column="cmdid" jdbcType="VARCHAR" property="cmdid"/>
<result column="last_heartbeat" jdbcType="BIGINT" property="lastheartbeat"/>
<result column="display_name" jdbcType="VARCHAR" property="name"/>
@ -66,6 +67,7 @@
<result column="tower_name" jdbcType="VARCHAR" property="name"/>
<collection property="list" javaType="list" ofType="com.shxy.xymanager_common.entity.Terminals">
<result column="term_id" jdbcType="INTEGER" property="id"/>
<result column="protocol" jdbcType="INTEGER" property="protocol"/>
<result column="cmdid" jdbcType="VARCHAR" property="cmdid"/>
<result column="equip_name" jdbcType="VARCHAR" property="equipName"/>
<result column="display_name" jdbcType="VARCHAR" property="displayName"/>
@ -208,6 +210,7 @@
c.id AS term_id,
c.tower_id AS tower_id,
c.cmdid AS cmdid,
c.protocol AS protocol,
ts.last_heartbeat as last_heartbeat,
c.display_name AS display_name
FROM

@ -0,0 +1,17 @@
<?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.ProtocolsDao">
<resultMap id="BaseResultMap" type="com.shxy.xymanager_common.entity.Protocols">
<id column="id" jdbcType="INTEGER" property="id"/>
<result column="name" jdbcType="VARCHAR" property="name"/>
<result column="version" jdbcType="VARCHAR" property="version"/>
</resultMap>
<sql id="Base_Column_List">
id, name, version
</sql>
<select id="selectAll" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from protocols
</select>
</mapper>

@ -7,12 +7,12 @@
<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="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,term_id, channel_id, start_time, end_time, span, create_time, update_time
id,term_id, channel_id, `hour`, `minute`, preset, create_time, update_time
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
@ -20,6 +20,13 @@
from terminal_schedule_details
where id = #{id,jdbcType=INTEGER}
</select>
<select id="selectByTermidAndChannelid" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from terminal_schedule_details
where term_id = #{termid} and channel_id = #{channelid}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from terminal_schedule_details
where id = #{id,jdbcType=INTEGER}

@ -59,6 +59,14 @@
delete from terminal_schedule_temp
where id = #{id,jdbcType=INTEGER}
</delete>
<delete id="deleteByTermidAndChannelid">
delete from terminal_schedule_temp
where
<foreach collection="list" item="item" index="index" separator="or" open="(" close=")">
term_id = #{item.termId} and channel_id = #{item.channelId}
</foreach>
</delete>
<insert id="insert" parameterType="com.shxy.xymanager_common.entity.TerminalSchedulesTemp">
insert into terminal_schedule_temp (id, term_id, channel_id,
schedule_id, create_time, update_time
@ -71,10 +79,10 @@
<insert id="insertList" parameterType="com.shxy.xymanager_common.entity.TerminalSchedulesTemp">
insert into terminal_schedule_temp
(term_id, channel_id,
schedule_id, request_id,status,create_time, update_time)
schedule_id, request_id,`hour`,`minute`,preset,`offset`,status,create_time, update_time)
values
<foreach collection="list" item="item" separator=",">
(#{item.termId},#{item.channelId},#{item.scheduleId},#{item.requestId},#{status},#{createat},#{updateat})
(#{item.termId},#{item.channelId},#{item.scheduleId},#{item.requestId},#{item.hour},#{item.minute},#{item.preset},#{item.offset},#{status},#{createat},#{updateat})
</foreach>
</insert>
<insert id="insertSelective" parameterType="com.shxy.xymanager_common.entity.TerminalSchedulesTemp">

@ -7,6 +7,7 @@
<result column="tower_id" jdbcType="INTEGER" property="towerid"/>
<result column="cmdid" jdbcType="VARCHAR" property="cmdid"/>
<result column="org_id" jdbcType="SMALLINT" property="orgId"/>
<result column="protocol" jdbcType="INTEGER" property="protocol"/>
<result column="equip_name" jdbcType="VARCHAR" property="equipName"/>
<result column="display_name" jdbcType="VARCHAR" property="displayName"/>
<result column="model" jdbcType="VARCHAR" property="model"/>
@ -39,6 +40,7 @@
<result column="latitude" jdbcType="DOUBLE" property="latitude"/>
<result column="longitude" jdbcType="DOUBLE" property="longitude"/>
<result column="status" jdbcType="INTEGER" property="status"/>
<result column="protocol" jdbcType="INTEGER" property="protocol"/>
<result column="signal_strength_4g" jdbcType="TINYINT" property="signalStrength4g"/>
<result column="boot_time" jdbcType="BIGINT" property="bootTime"/>
<result column="battery_capacity" jdbcType="REAL" property="batteryCapacity"/>
@ -120,11 +122,8 @@
and
<foreach collection="list" item="item" index="index" open="(" close=")" separator="or">
a.id = #{item.termid}
<if test="item.channelidlist != null and item.channelidlist.size>0">
and c.id in
<foreach collection="item.channelidlist" item="id" index="index" open="(" close=")" separator=",">
#{id}
</foreach>
<if test="item.channelid != null">
and c.id = #{item.channelid}
</if>
</foreach>
</if>
@ -149,6 +148,7 @@
d.latitude as latitude,
d.longitude as longitude,
d.status as status,
d.protocol as protocol,
e.last_heartbeat as last_heartbeat,
e.signal_strength_4g as signal_strength_4g,
e.boot_time as boot_time,

@ -74,7 +74,6 @@ public class JwtInterceptor implements HandlerInterceptor {
Asserts.fail(401, "登录过期");
}
}
return true;
}

@ -32,6 +32,8 @@ public class XyCache {
cacheService.updateGolobalMap();
cacheService.updateProtocolMap();
}

@ -4,18 +4,14 @@ import com.shxy.xymanager_common.dto.LineAndDyNameDto;
import com.shxy.xymanager_common.dto.TermAndChannelDto;
import com.shxy.xymanager_common.dto.TowerDto;
import com.shxy.xymanager_common.entity.*;
import com.shxy.xymanager_common.enums.CommonStatus;
import com.shxy.xymanager_dao.dao.*;
import com.shxy.xymanager_service.service.CacheService;
import io.swagger.models.auth.In;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.CachePut;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -50,6 +46,9 @@ public class CacheServiceImpl implements CacheService {
@Autowired
TerminalImgAlarmParamsDao terminalImgAlarmParamsDao;
@Autowired
ProtocolsDao protocolsDao;
// @Override
// @Cacheable(value = "globalParams", key = "#param")
// public GlobalParams getGlobalParams(String param) {
@ -290,6 +289,28 @@ public class CacheServiceImpl implements CacheService {
return lineMap;
}
@Override
@Cacheable(value = "protocolMap")
public Map<Integer, Protocols> getProtocolMap() {
Map<Integer, Protocols> Map = new HashMap<Integer, Protocols>();
List<Protocols> protocols = protocolsDao.selectAll();
for (Protocols lineitem : protocols) {
Map.put(lineitem.getId(), lineitem);
}
return Map;
}
@Override
@Cacheable(value = "protocolMap")
public Map<Integer, Protocols> updateProtocolMap() {
Map<Integer, Protocols> Map = new HashMap<Integer, Protocols>();
List<Protocols> protocols = protocolsDao.selectAll();
for (Protocols lineitem : protocols) {
Map.put(lineitem.getId(), lineitem);
}
return Map;
}
@Override
@CachePut(value = "globalMap")

@ -4,19 +4,25 @@ import cn.hutool.core.bean.BeanUtil;
import com.shxy.xymanager_common.bean.ServiceBody;
import com.shxy.xymanager_common.constant.Constants;
import com.shxy.xymanager_common.entity.Resolution;
import com.shxy.xymanager_common.entity.Terminals;
import com.shxy.xymanager_common.exception.Asserts;
import com.shxy.xymanager_common.model.CmaRequestModel;
import com.shxy.xymanager_common.model.ResolutionModel;
import com.shxy.xymanager_common.util.CmaUtil;
import com.shxy.xymanager_common.util.MyDateUtils;
import com.shxy.xymanager_common.util.xinyin.ProcessExecUtils;
import com.shxy.xymanager_common.vo.TerminalIdVo;
import com.shxy.xymanager_common.vo.UpdateCameraVo;
import com.shxy.xymanager_common.vo.VoiceCtrlVo;
import com.shxy.xymanager_dao.dao.TerminalResolutionDao;
import com.shxy.xymanager_service.service.CacheService;
import com.shxy.xymanager_service.service.TermSetService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
/**
@ -31,6 +37,9 @@ public class TermSetServiceImpl implements TermSetService {
@Autowired
private TerminalResolutionDao terminalResolutionDao;
@Autowired
private CacheService cacheService;
@Override
public ServiceBody<String> alarmMark(VoiceCtrlVo vo) {
String cmd = CmaUtil.alarmMark(vo.getCmdId(), vo.getCtrl());
@ -53,5 +62,30 @@ public class TermSetServiceImpl implements TermSetService {
return Asserts.success(model);
}
/**
*
*
* @param vo
* @return
*/
@Override
public ServiceBody<CmaRequestModel> updateTermCamera(UpdateCameraVo vo) {
CmaRequestModel model = new CmaRequestModel();
Integer termId = vo.getTermId();
Integer channelId = vo.getChannelId();
Integer type = vo.getType();
Map<Integer, Terminals> terminalMap = cacheService.getTerminalMap();
Terminals terminals = terminalMap.get(termId);
String cmdid = null;
if (terminals != null) {
cmdid = terminals.getCmdid();
}
int requestId = Constants.REQUEST_ID.addAndGet(1);
String cmd = CmaUtil.cameractrl(cmdid, channelId,requestId, type);
ProcessExecUtils.exec(cmd);
model.setRequestId(requestId);
return Asserts.success(model);
}
}

@ -2,9 +2,7 @@ package com.shxy.xymanager_service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DateField;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageInfo;
@ -24,6 +22,7 @@ import com.shxy.xymanager_common.util.xinyin.ProcessExecUtils;
import com.shxy.xymanager_common.util.xinyin.ScheduleListUtils;
import com.shxy.xymanager_common.vo.*;
import com.shxy.xymanager_dao.dao.*;
import com.shxy.xymanager_service.service.CacheService;
import com.shxy.xymanager_service.service.TerminalScheduleRuleService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
@ -31,9 +30,9 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.util.*;
/**
*
@ -63,13 +62,15 @@ public class TerminalScheduleRuleServiceImpl implements TerminalScheduleRuleServ
@Autowired
TerminalScheduleDetailsDao terminalScheduleDetailsDao;
@Autowired
CacheService cacheService;
@Value("${cma.clientid}")
public int clientid;
@Value("${cma.scheduletype}")
public int scheduletype;
/**
*
*
@ -182,6 +183,7 @@ public class TerminalScheduleRuleServiceImpl implements TerminalScheduleRuleServ
}
Date date = new Date();
Schedules schedule = new Schedules();
schedule.setId(scheduleid);
schedule.setName(vo.getName());
schedule.setRemark(vo.getRemark());
schedule.setUpdateTime(date);
@ -236,48 +238,68 @@ public class TerminalScheduleRuleServiceImpl implements TerminalScheduleRuleServ
return Asserts.error("没有该装置");
}
ScheduleAndRuleDto dto = schedulesDao.selectSingleScheduleAndDetailsList(scheduleid, CommonStatus.EFFECTIVE.value());
if (BeanUtil.isEmpty(dto)) {
return Asserts.error("没有该拍照时间规则");
}
List<ScheduleDetailsDto> dtoList = dto.getList();
if (CollectionUtil.isEmpty(dtoList)) {
return Asserts.error("没有该拍照时间规则");
}
// ScheduleAndRuleDto dto = schedulesDao.selectSingleScheduleAndDetailsList(scheduleid, CommonStatus.EFFECTIVE.value());
// if (BeanUtil.isEmpty(dto)) {
// return Asserts.error("没有该拍照时间规则");
// }
// List<ScheduleDetailsDto> dtoList = dto.getList();
// if (CollectionUtil.isEmpty(dtoList)) {
// return Asserts.error("没有该拍照时间规则");
// }
Map<Integer, Terminals> terminalMap = cacheService.getTerminalMap();
ArrayList<GetScheduleRequestIdListModel.RequestBean> requestIdList = new ArrayList<>();
for (int x = 0; x < terminalsList.size(); x++) {
ChannelAndTermDto channelAndTermDto = terminalsList.get(x);
int requestId = Constants.REQUEST_ID.addAndGet(1);
int offset = 0;
for (int i = 0; i < termlist.size(); i++) {
if (channelAndTermDto.getTermid().intValue() == termlist.get(i).getTermid().intValue()) {
offset = termlist.get(i).getOffset();
}
ArrayList<TerminalSchedulesTemp> templist = new ArrayList<>();
for (int i = 0; i < termlist.size(); i++) {
String cmdid = null;
RelateTerminalListRuleIdVo.Items items = termlist.get(i);
Integer termid = items.getTermid();
Integer channelid = items.getChannelid();
Integer offset = items.getOffset();
if (terminalMap != null && termid != null) {
Terminals terminals = terminalMap.get(termid);
cmdid = terminals.getCmdid();
}
if (StrUtil.isEmpty(cmdid)) {
continue;
}
String timestr = ScheduleListUtils.relateTime(dtoList, offset);
List<ScheduleRuleVo> timelist = items.getList();
if (CollectionUtil.isEmpty(timelist)) {
continue;
}
String timestr = ScheduleListUtils.relateTime(timelist);
int requestId = Constants.REQUEST_ID.addAndGet(1);
String cmd = CmaUtil.relateSchelduleRule(dtoList, channelAndTermDto.getCmdid(), requestId, channelAndTermDto.getChannelid(), timestr);
String cmd = CmaUtil.relateSchelduleRule(timelist, cmdid, requestId, channelid, timestr);
ProcessExecUtils.exec(cmd);
log.info("cma下发时间表命令", cmd);
GetScheduleRequestIdListModel.RequestBean requestBean = new GetScheduleRequestIdListModel.RequestBean();
requestBean.setTermid(channelAndTermDto.getTermid());
requestBean.setChannelid(channelAndTermDto.getChannelid());
requestBean.setTermid(termid);
requestBean.setChannelid(channelid);
requestBean.setRequestid(requestId);
requestIdList.add(requestBean);
for (int j = 0; j < timelist.size(); j++) {
ScheduleRuleVo scheduleRuleVo = timelist.get(j);
Integer hour = scheduleRuleVo.getHour();
Integer minute = scheduleRuleVo.getMinute();
Integer preset = scheduleRuleVo.getPreset();
TerminalSchedulesTemp temp = new TerminalSchedulesTemp();
temp.setTermId(termid);
temp.setChannelId(channelid);
temp.setScheduleId(scheduleid);
temp.setRequestId(requestId);
temp.setHour(hour);
temp.setMinute(minute);
temp.setPreset(preset);
temp.setOffset(offset);
templist.add(temp);
}
}
if (CollectionUtil.isNotEmpty(templist)) {
terminalSchedulesTempDao.deleteByTermidAndChannelid(templist);
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.setOffset(offset);
temp.setCreateTime(date);
temp.setUpdateTime(date);
terminalSchedulesTempDao.insertSelective(temp);
terminalSchedulesTempDao.insertList(templist, CommonStatus.DELETE.value(), date, date);
}
model.setList(requestIdList);
return Asserts.success(model);
@ -321,16 +343,19 @@ public class TerminalScheduleRuleServiceImpl implements TerminalScheduleRuleServ
model.setList(modellist);
return Asserts.success(model);
} else {
HashMap<Integer, Integer> map = new HashMap<>();
for (TerminalSchedulesTemp item : resultsList) {
map.put(item.getRequestId(), CommonStatus.EFFECTIVE.value());
}
for (RequestIdListVo.RequestBean it : list) {
ScheduleRequestIdListModel.RequestStatusBean requestBean = new ScheduleRequestIdListModel.RequestStatusBean();
requestBean.setRequestid(it.getRequestid());
requestBean.setChannelid(it.getChannelid());
requestBean.setTermid(it.getTermid());
requestBean.setStatus(CommonStatus.DELETE.value());
for (int i = 0; i < resultsList.size(); i++) {
if (it.getRequestid().intValue() == requestidlist.get(i).intValue()) {
requestBean.setStatus(CommonStatus.EFFECTIVE.value());
}
if (map.get(it.getRequestid()) != null) {
requestBean.setStatus(CommonStatus.EFFECTIVE.value());
} else {
requestBean.setStatus(CommonStatus.DELETE.value());
}
modellist.add(requestBean);
}
@ -349,7 +374,9 @@ public class TerminalScheduleRuleServiceImpl implements TerminalScheduleRuleServ
@Override
public ServiceBody<TerminalScheduleRuleTimeListModel> getChannelSchelduleRule(TerminalAndChannelIdVo vo) {
TerminalScheduleRuleTimeListModel model = new TerminalScheduleRuleTimeListModel();
TerminalSchedule mapper = terminalScheduleDao.selectByChannelId(vo.getChannelid(), vo.getTerminalid());
Integer channelid = vo.getChannelid();
Integer terminalid = vo.getTerminalid();
TerminalSchedule mapper = terminalScheduleDao.selectByChannelId(channelid, terminalid);
if (BeanUtil.isEmpty(mapper)) {
model.setList(new ArrayList<>());
return Asserts.success(model);
@ -362,28 +389,22 @@ public class TerminalScheduleRuleServiceImpl implements TerminalScheduleRuleServ
if (mapper == null) {
model.setList(new ArrayList<>());
} else {
Integer scheduleId = mapper.getScheduleId();
ScheduleAndRuleDto bean = schedulesDao.selectSingleScheduleAndDetailsList(scheduleId, CommonStatus.EFFECTIVE.value());
if (BeanUtil.isEmpty(bean)) {
List<TerminalScheduleDetails> list = terminalScheduleDetailsDao.selectByTermidAndChannelid(terminalid, channelid);
if (CollectionUtil.isEmpty(list)) {
model.setList(new ArrayList<>());
} else {
List<ScheduleDetailsDto> list = bean.getList();
if (CollectionUtil.isEmpty(list)) {
model.setList(new ArrayList<>());
} else {
ArrayList<TerminalScheduleRuleTimeListModel.ScheduleRuleBean> timestrlist = new ArrayList<>();
for (ScheduleDetailsDto item : list) {
TerminalScheduleRuleTimeListModel.ScheduleRuleBean scheduleRuleBean = new TerminalScheduleRuleTimeListModel.ScheduleRuleBean();
Integer hour = item.getHour();
Integer minute = item.getMinute();
Integer preset = item.getPreset();
scheduleRuleBean.setHour(hour);
scheduleRuleBean.setMinute(minute);
scheduleRuleBean.setPreset(preset);
timestrlist.add(scheduleRuleBean);
}
model.setList(timestrlist);
ArrayList<TerminalScheduleRuleTimeListModel.ScheduleRuleBean> timestrlist = new ArrayList<>();
for (TerminalScheduleDetails item : list) {
TerminalScheduleRuleTimeListModel.ScheduleRuleBean scheduleRuleBean = new TerminalScheduleRuleTimeListModel.ScheduleRuleBean();
Integer hour = item.getHour();
Integer minute = item.getMinute();
Integer preset = item.getPreset();
scheduleRuleBean.setHour(hour);
scheduleRuleBean.setMinute(minute);
scheduleRuleBean.setPreset(preset);
timestrlist.add(scheduleRuleBean);
}
model.setList(timestrlist);
}
}
return Asserts.success(model);

@ -10,6 +10,7 @@ import com.github.pagehelper.PageInfo;
import com.shxy.xymanager_common.bean.ServiceBody;
import com.shxy.xymanager_common.constant.Constants;
import com.shxy.xymanager_common.dto.*;
import com.shxy.xymanager_common.entity.Protocols;
import com.shxy.xymanager_common.entity.TerminalChannelMapper;
import com.shxy.xymanager_common.entity.TerminalStatus;
import com.shxy.xymanager_common.entity.Terminals;
@ -86,6 +87,7 @@ public class TerminalServiceImpl implements TerminalService {
public ServiceBody<TerminalListModel> getTerminalList(TerminalSelectVo vo) {
Map<Integer, TowerDto> towerMap = cacheService.getTowerMap();
Map<Integer, TermAndChannelDto> termAndChannelMap = cacheService.getTermAndChannelMap();
Map<Integer, Protocols> protocolMap = cacheService.getProtocolMap();
Integer dyid = vo.getDyId();
Integer lineid = vo.getLineId();
Integer tower = vo.getTowerId();
@ -116,6 +118,16 @@ public class TerminalServiceImpl implements TerminalService {
terminalsBean.setLineId(towerDto.getLineId());
terminalsBean.setLineName(towerDto.getLineName());
}
if (protocolMap != null) {
Integer protocol = item.getProtocol();
if (protocol != null) {
terminalsBean.setProtocol(protocol);
Protocols protocols = protocolMap.get(protocol);
if (protocols != null) {
terminalsBean.setProtocolName(protocols.getName());
}
}
}
terminalsBean.setCmdId(item.getCmdid());
terminalsBean.setOrgId(item.getOrgId());
terminalsBean.setEquipName(item.getEquipName());

@ -4,11 +4,8 @@ import com.shxy.xymanager_common.dto.LineAndDyNameDto;
import com.shxy.xymanager_common.dto.TermAndChannelDto;
import com.shxy.xymanager_common.dto.TowerDto;
import com.shxy.xymanager_common.entity.*;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.CachePut;
import org.springframework.cache.annotation.Cacheable;
import java.util.List;
import java.util.Map;
@ -83,6 +80,10 @@ public interface CacheService {
Map<String, String> getGolobalMap();
Map<Integer, Protocols> getProtocolMap();
Map<Integer, Protocols> updateProtocolMap();
Map<String, String> updateGolobalMap();
Map<Integer, TerminalImgAlarmParams> getAlarmParamMap();

@ -25,4 +25,11 @@ public interface TermSetService {
* @return
*/
ServiceBody<ResolutionModel> getResolutionList(Integer type);
/**
*
* @param vo
* @return
*/
ServiceBody<CmaRequestModel> updateTermCamera(UpdateCameraVo vo);
}

Loading…
Cancel
Save