新增缓存

master
liuguijing 2 years ago
parent e34e1f1474
commit 11c75d7aac

@ -8,6 +8,7 @@ import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.EnableAspectJAutoProxy; import org.springframework.context.annotation.EnableAspectJAutoProxy;
@ -19,6 +20,7 @@ import org.springframework.core.env.Environment;
@Slf4j @Slf4j
@EnableConfigurationProperties @EnableConfigurationProperties
@ComponentScan(basePackages = {"com.shxy"}) @ComponentScan(basePackages = {"com.shxy"})
@EnableCaching
public class XymanagerAdminApplication extends SpringBootServletInitializer{ public class XymanagerAdminApplication extends SpringBootServletInitializer{
public static void main(String[] args) { public static void main(String[] args) {

@ -28,7 +28,7 @@ public class GloableParamsController extends BaseController {
@ApiOperation(value = "查询图片绘制开关状态", notes = "查询图片绘制开关状态接口", httpMethod = "POST") @ApiOperation(value = "查询图片绘制开关状态", notes = "查询图片绘制开关状态接口", httpMethod = "POST")
@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("/getMarkEnableStatus") @RequestMapping("/getMarkEnableStatus")
@Log(title = "新增杆塔", type = "查询") @Log(title = "查询图片绘制开关状态", type = "查询")
public ResponseReult<Integer> getMarkEnableStatus() { public ResponseReult<Integer> getMarkEnableStatus() {
ServiceBody<Integer> serviceBody = gloableParamsService.getMarkEnableStatus(); ServiceBody<Integer> serviceBody = gloableParamsService.getMarkEnableStatus();
if (serviceBody.getCode() == ServiceStatus.SUCCESS) { if (serviceBody.getCode() == ServiceStatus.SUCCESS) {
@ -38,10 +38,10 @@ public class GloableParamsController extends BaseController {
} }
} }
@ApiOperation(value = "新增杆塔", notes = "新增杆塔接口", httpMethod = "POST") @ApiOperation(value = "修改图片绘制开关状态", notes = "修改图片绘制开关状态接口", httpMethod = "POST")
@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("/updateMarkEnableStatus") @RequestMapping("/updateMarkEnableStatus")
@Log(title = "新增杆塔", type = "查询") @Log(title = "修改图片绘制开关状态", type = "修改")
public ResponseReult<String> updateMarkEnableStatus(@RequestParam("status") Integer status) { public ResponseReult<String> updateMarkEnableStatus(@RequestParam("status") Integer status) {
ServiceBody<String> serviceBody = gloableParamsService.updateMarkEnableStatus(status); ServiceBody<String> serviceBody = gloableParamsService.updateMarkEnableStatus(status);
if (serviceBody.getCode() == ServiceStatus.SUCCESS) { if (serviceBody.getCode() == ServiceStatus.SUCCESS) {

@ -5,10 +5,12 @@ 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.entity.Lines;
import com.shxy.xymanager_common.model.LineAndGtAndChannelListModel; import com.shxy.xymanager_common.model.LineAndGtAndChannelListModel;
import com.shxy.xymanager_common.model.LineListModel; import com.shxy.xymanager_common.model.LineListModel;
import com.shxy.xymanager_common.model.DyLineTreeListModel; import com.shxy.xymanager_common.model.DyLineTreeListModel;
import com.shxy.xymanager_common.vo.*; import com.shxy.xymanager_common.vo.*;
import com.shxy.xymanager_service.service.CacheService;
import com.shxy.xymanager_service.service.LineService; import com.shxy.xymanager_service.service.LineService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
@ -19,8 +21,13 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@Api(value = "线路接口", tags = "线路相关") @Api(value = "线路接口", tags = "线路相关")
@RestController @RestController
@ -30,6 +37,9 @@ public class LineController extends BaseController {
@Autowired @Autowired
LineService lineService; LineService lineService;
@Autowired
CacheService cacheService;
@ApiOperation(value = "获取线路列表", notes = "获取线路列表接口", httpMethod = "POST") @ApiOperation(value = "获取线路列表", notes = "获取线路列表接口", httpMethod = "POST")
@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("/getLineList") @RequestMapping("/getLineList")
@ -108,4 +118,34 @@ public class LineController extends BaseController {
return ResponseReult.error(serviceBody.getCode(), serviceBody.getMsg()); return ResponseReult.error(serviceBody.getCode(), serviceBody.getMsg());
} }
} }
@ApiOperation(value = "测试测试测试", notes = "teer", httpMethod = "POST")
@ApiResponses({@ApiResponse(code = 200, message = "请求成功"), @ApiResponse(code = 400, message = "请求参数没填好"), @ApiResponse(code = 404, message = "请求路径没有或页面跳转路径不对")})
@RequestMapping("/teer")
@Log(title = "teer", type = "查询")
public ResponseReult<Lines> teer(@RequestParam("id") Integer id) {
Lines line = cacheService.getLine(id);
return ResponseReult.success(line);
}
// @ApiOperation(value = "怎怎怎", notes = "teer", httpMethod = "POST")
// @ApiResponses({@ApiResponse(code = 200, message = "请求成功"), @ApiResponse(code = 400, message = "请求参数没填好"), @ApiResponse(code = 404, message = "请求路径没有或页面跳转路径不对")})
// @RequestMapping("/insertLine")
// @Log(title = "怎怎怎", type = "查询")
// public ResponseReult<List<Lines>> insertLine(@RequestParam("id") Integer id) {
// ArrayList<Lines> list = new ArrayList<>();
// Lines lines1 = new Lines();
// lines1.setStatus(1);
// lines1.setName("dsafsadf");
// lines1.setBsManufacturer("33333");
// Lines lines2 = new Lines();
// lines2.setStatus(2);
// lines2.setName("dsafsadf");
// lines2.setBsManufacturer("33333");
// list.add(lines1);
// list.add(lines2);
// List<Lines> lines = cacheService.insertLine(list, new Date());
// return ResponseReult.success(lines);
// }
} }

@ -77,4 +77,15 @@ public class OpenController extends BaseController {
JSONObject serviceBody = openService.cmaDeviceStatus(vo); JSONObject serviceBody = openService.cmaDeviceStatus(vo);
return serviceBody; return serviceBody;
} }
@ApiOperation(value = "第三方调试", notes = "第三方调试接口", httpMethod = "POST")
@ApiResponses({@ApiResponse(code = 0, message = "请求成功"), @ApiResponse(code = 1, message = "用户名错误"), @ApiResponse(code = 2, message = "密码错误")})
@RequestMapping("/testConnect")
@Log(title = "查询装置状态接口", type = "查询")
public JSONObject testConnect() {
JSONObject serviceBody = new JSONObject();
serviceBody.set("errcode", 1);
serviceBody.set("errmsg", "OK");
return serviceBody;
}
} }

@ -1 +1 @@
org.springframework.boot.env.EnvironmentPostProcessor=com.shxy.xymanager_framework.config.MyEnvironmentPostProcessor #org.springframework.boot.env.EnvironmentPostProcessor=com.shxy.xymanager_framework.config.MyEnvironmentPostProcessor

@ -50,7 +50,7 @@ public class TerminalPhotoListForOpenModel implements Serializable {
private String name; private String name;
@ApiModelProperty(value = "拍照时间", example = "123456") @ApiModelProperty(value = "拍照时间", example = "123456")
private Date photoTime; private String photoTime;
@ApiModelProperty(value = "照片路径", example = "123456") @ApiModelProperty(value = "照片路径", example = "123456")
private String path; private String path;

@ -17,6 +17,8 @@ public interface GlobalParamsDao {
List<GlobalParams> selectAll(); List<GlobalParams> selectAll();
GlobalParams selectByParam(@Param("param") String param);
int updateByPrimaryKeySelective(GlobalParams record); int updateByPrimaryKeySelective(GlobalParams record);
int updateByPrimaryKey(GlobalParams record); int updateByPrimaryKey(GlobalParams record);

@ -15,7 +15,7 @@ public interface LinesDao {
int deleteById(@Param("list") List<Lines> record, @Param("status") Integer status,@Param("updateat") Date update); int deleteById(@Param("list") List<Lines> record, @Param("status") Integer status,@Param("updateat") Date update);
Lines selectByPrimaryKey(Integer id); Lines selectById(Integer id);
List<Lines> selectLineByDyId(@Param("dyid")Integer dyid,@Param("status") Integer status); List<Lines> selectLineByDyId(@Param("dyid")Integer dyid,@Param("status") Integer status);

@ -1,6 +1,7 @@
package com.shxy.xymanager_dao.dao; package com.shxy.xymanager_dao.dao;
import com.shxy.xymanager_common.entity.TerminalChannelMapper; import com.shxy.xymanager_common.entity.TerminalChannelMapper;
import com.shxy.xymanager_common.entity.TerminalChannels;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.math.BigInteger; import java.math.BigInteger;
@ -20,6 +21,8 @@ public interface TerminalChannelMapperDao {
TerminalChannelMapper selectByPrimaryKey(Integer id); TerminalChannelMapper selectByPrimaryKey(Integer id);
TerminalChannelMapper selectByTermidAndChannelid(@Param("termid") Integer termid, @Param("channelid")Integer channelid, @Param("status") Integer status);
List<TerminalChannelMapper> selectAll(); List<TerminalChannelMapper> selectAll();
List<TerminalChannelMapper> selectAllByPhotoTime(@Param("time") BigInteger time); List<TerminalChannelMapper> selectAllByPhotoTime(@Param("time") BigInteger time);

@ -23,8 +23,7 @@ public interface TerminalChannelsDao {
List<TermChannelAndMapperDto> selectByTermid(@Param("termid") Integer termid, @Param("status") Integer status); List<TermChannelAndMapperDto> selectByTermid(@Param("termid") Integer termid, @Param("status") Integer status);
TerminalChannels selectByPrimaryKey(Integer id); TerminalChannels selectByPrimaryKey(@Param("id") Integer id, @Param("status") Integer status);
List<DyLineAndTerminalAndChannelDto> selectAllAndChannelByTermid(@Param("termid") Integer termid, @Param("status") Integer status); List<DyLineAndTerminalAndChannelDto> selectAllAndChannelByTermid(@Param("termid") Integer termid, @Param("status") Integer status);

@ -16,6 +16,8 @@ public interface TerminalsDao {
List<Terminals> selectAll(@Param("status") Integer status); List<Terminals> selectAll(@Param("status") Integer status);
Terminals selectById(@Param("id") Integer id, @Param("status") Integer status);
List<ChannelAndTermDto> selectChannelAndTermList(@Param("status") Integer status); List<ChannelAndTermDto> selectChannelAndTermList(@Param("status") Integer status);
List<TerminalsAndLineAndChannelDto> selectTermAndLineList(@Param("termidlist") List<Integer> termidlist, @Param("status") Integer status); List<TerminalsAndLineAndChannelDto> selectTermAndLineList(@Param("termidlist") List<Integer> termidlist, @Param("status") Integer status);

@ -14,9 +14,8 @@ public interface TowerDao {
List<TowerDto> selectAll(@Param("status") Integer status); List<TowerDto> selectAll(@Param("status") Integer status);
List<Towers> selectAllByLineid(@Param("lineid") Integer id, @Param("status") Integer status);
List<Towers> selectAllByLineidList(@Param("lineidlist") List<Integer> id, @Param("status") Integer status); List<Towers> selectAllByLineid(@Param("lineid") Integer id, @Param("status") Integer status);
int deleteById(@Param("list") List<Towers> record, @Param("status") Integer status, @Param("update") Date update); int deleteById(@Param("list") List<Towers> record, @Param("status") Integer status, @Param("update") Date update);

@ -22,7 +22,13 @@
select select
<include refid="Base_Column_List"/> <include refid="Base_Column_List"/>
from global_params from global_params
</select>
<select id="selectByParam" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from global_params
where param_name = #{param} limit 1;
</select> </select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long"> <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from global_params delete from global_params

@ -35,7 +35,7 @@
dy_level y dy_level y
where x.dy_level_id = y.id and x.status = #{status} order by x.create_time desc where x.dy_level_id = y.id and x.status = #{status} order by x.create_time desc
</select> </select>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap"> <select id="selectById" resultMap="BaseResultMap">
select select
<include refid="Base_Column_List"/> <include refid="Base_Column_List"/>
from `lines` from `lines`

@ -29,7 +29,7 @@
</sql> </sql>
<select id="selectByUserAccount" resultMap="SysUserResult"> <select id="selectByUserAccount" resultMap="SysUserResult">
SELECT * FROM sys_users WHERE user_name = #{userName} SELECT * FROM sys_users WHERE user_name = #{userName} and status = 1
</select> </select>
<select id="selectPages" resultMap="SysUserResult"> <select id="selectPages" resultMap="SysUserResult">
@ -41,7 +41,7 @@
</select> </select>
<select id="checkUserNameUnique" parameterType="String" resultType="java.lang.Integer"> <select id="checkUserNameUnique" parameterType="String" resultType="java.lang.Integer">
select count(1) from sys_users where user_name = #{userName} select count(1) from sys_users where user_name = #{userName} and status = 1
</select> </select>
<select id="selectUserByUserName" parameterType="String" resultMap="SysUserResult"> <select id="selectUserByUserName" parameterType="String" resultMap="SysUserResult">

@ -27,6 +27,13 @@
from terminal_channel_mapper from terminal_channel_mapper
</select> </select>
<select id="selectByTermidAndChannelid" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from terminal_channel_mapper
where term_id = #{termid} and channel_id = #{channelid}
</select>
<select id="selectAllByPhotoTime" resultMap="BaseResultMap"> <select id="selectAllByPhotoTime" resultMap="BaseResultMap">
select select
<include refid="Base_Column_List"/> <include refid="Base_Column_List"/>

@ -36,7 +36,8 @@
<result column="tower_id" jdbcType="INTEGER" property="towerid"/> <result column="tower_id" jdbcType="INTEGER" property="towerid"/>
<result column="cmdid" jdbcType="VARCHAR" property="cmdid"/> <result column="cmdid" jdbcType="VARCHAR" property="cmdid"/>
<result column="display_name" jdbcType="VARCHAR" property="name"/> <result column="display_name" jdbcType="VARCHAR" property="name"/>
<collection property="list" javaType="list" ofType="com.shxy.xymanager_common.dto.TerminalChannelsAndScheduleDto"> <collection property="list" javaType="list"
ofType="com.shxy.xymanager_common.dto.TerminalChannelsAndScheduleDto">
<result column="channel_id" jdbcType="INTEGER" property="id"/> <result column="channel_id" jdbcType="INTEGER" property="id"/>
<result column="channel_name" jdbcType="VARCHAR" property="name"/> <result column="channel_name" jdbcType="VARCHAR" property="name"/>
<result column="schedule_id" jdbcType="INTEGER" property="scheduleid"/> <result column="schedule_id" jdbcType="INTEGER" property="scheduleid"/>
@ -52,7 +53,7 @@
select select
<include refid="Base_Column_List"/> <include refid="Base_Column_List"/>
from terminal_channels from terminal_channels
where id = #{id,jdbcType=INTEGER} where id = #{id} and status = #{status}
</select> </select>
<select id="selectChannelList" parameterType="java.lang.Integer" resultMap="BaseResultMap"> <select id="selectChannelList" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select select
@ -61,22 +62,25 @@
where status = #{status} where status = #{status}
</select> </select>
<select id="selectChannelCount" parameterType="com.shxy.xymanager_common.vo.TerminalChannelVo" resultType="java.lang.Integer"> <select id="selectChannelCount" parameterType="com.shxy.xymanager_common.vo.TerminalChannelVo"
resultType="java.lang.Integer">
select select
count(1) count(1)
from terminal_channels from terminal_channels
where where
id in id in
<foreach collection="list" item="item" index="index" open="(" close=")" separator=","> <foreach collection="list" item="item" index="index" open="(" close=")" separator=",">
#{item.id} #{item.id}
</foreach> or </foreach>
or
channel_name in channel_name in
<foreach collection="list" item="item" index="index" open="(" close=")" separator=","> <foreach collection="list" item="item" index="index" open="(" close=")" separator=",">
#{item.channelname} #{item.channelname}
</foreach> </foreach>
</select> </select>
<select id="selectChannelCountById" parameterType="com.shxy.xymanager_common.vo.UpdateTerminalChannelVo" resultType="java.lang.Integer"> <select id="selectChannelCountById" parameterType="com.shxy.xymanager_common.vo.UpdateTerminalChannelVo"
resultType="java.lang.Integer">
select select
count(1) count(1)
from terminal_channels from terminal_channels

@ -74,7 +74,7 @@
<if test="item.label != null"> <if test="item.label != null">
label = #{item.label} label = #{item.label}
</if> </if>
<if test="item.prob != null and item.prob lte 100"> <if test="item.prob != null">
and prob >= #{item.prob} and prob >= #{item.prob}
</if> </if>
) )

@ -74,6 +74,13 @@
where status = #{status} where status = #{status}
</select> </select>
<select id="selectById" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from terminals
where status = #{status} and id = #{id}
</select>
<select id="selectByIdList" resultMap="ChannelAndTerm"> <select id="selectByIdList" resultMap="ChannelAndTerm">
select select
a.id as term_id, a.id as term_id,
@ -99,16 +106,6 @@
</foreach> </foreach>
</if> </if>
<!-- select-->
<!-- <include refid="Base_Column_List"/>-->
<!-- from terminals-->
<!-- where status = #{status}-->
<!-- <if test="list != null and list.size>0">-->
<!-- and id in-->
<!-- <foreach collection="list" item="id" index="index" open="(" close=")" separator=",">-->
<!-- #{id}-->
<!-- </foreach>-->
<!-- </if>-->
</select> </select>
<select id="selectChannelAndTermList" resultMap="ChannelAndTerm"> <select id="selectChannelAndTermList" resultMap="ChannelAndTerm">

@ -26,7 +26,6 @@
from towers t, from towers t,
`lines` l `lines` l
where t.line_id = l.id and t.status = #{status,jdbcType=INTEGER} order by t.`order` asc where t.line_id = l.id and t.status = #{status,jdbcType=INTEGER} order by t.`order` asc
</select> </select>
<select id="selectAllByLineid" resultType="com.shxy.xymanager_common.entity.Towers"> <select id="selectAllByLineid" resultType="com.shxy.xymanager_common.entity.Towers">
@ -40,20 +39,6 @@
order by `order` asc order by `order` asc
</select> </select>
<select id="selectAllByLineidList" resultType="com.shxy.xymanager_common.entity.Towers">
select
id, name, line_id,`order`,status
from towers
where status = #{status}
<if test="lineidlist != null and lineidlist.size>0">
and line_id in
<foreach collection="lineidlist" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
order by `order` asc
</select>
<select id="getInfoByPrimaryKey" resultType="com.shxy.xymanager_common.dto.TowerDto"> <select id="getInfoByPrimaryKey" resultType="com.shxy.xymanager_common.dto.TowerDto">
select select
t.id as id, t.id as id,

@ -40,10 +40,10 @@
<groupId>ch.qos.logback</groupId> <groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId> <artifactId>logback-classic</artifactId>
</exclusion> </exclusion>
<exclusion> <!-- <exclusion>-->
<groupId>org.springframework.boot</groupId> <!-- <groupId>org.springframework.boot</groupId>-->
<artifactId>spring-boot-starter-tomcat</artifactId> <!-- <artifactId>spring-boot-starter-tomcat</artifactId>-->
</exclusion> <!-- </exclusion>-->
</exclusions> </exclusions>
</dependency> </dependency>
@ -76,6 +76,12 @@
<optional>true</optional> <optional>true</optional>
</dependency> </dependency>
<!--缓存-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-cache</artifactId>
</dependency>
<dependency> <dependency>
<groupId>com.shxy</groupId> <groupId>com.shxy</groupId>
<artifactId>xymanager_common</artifactId> <artifactId>xymanager_common</artifactId>

@ -21,7 +21,6 @@ public class CustomSecurityConfig implements WebMvcConfigurer {
public void addInterceptors(InterceptorRegistry registry) { public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(this.jwtInterceptor) registry.addInterceptor(this.jwtInterceptor)
.excludePathPatterns("/swagger-ui.html") .excludePathPatterns("/swagger-ui.html")
.excludePathPatterns("/getPhotoListForOpen")
.excludePathPatterns("/api/login") .excludePathPatterns("/api/login")
.excludePathPatterns("/login") .excludePathPatterns("/login")
.excludePathPatterns("/doc.html") .excludePathPatterns("/doc.html")

@ -1,7 +1,5 @@
package com.shxy.xymanager_service.cache; package com.shxy.xymanager_service.cache;
import com.shxy.xymanager_common.dto.LineAndDyNameDto;
import com.shxy.xymanager_common.dto.TowerDto;
import com.shxy.xymanager_common.entity.*; import com.shxy.xymanager_common.entity.*;
import com.shxy.xymanager_common.enums.CommonStatus; import com.shxy.xymanager_common.enums.CommonStatus;
import com.shxy.xymanager_dao.dao.*; import com.shxy.xymanager_dao.dao.*;
@ -16,18 +14,13 @@ import java.util.Map;
@Component @Component
public class XyCache { public class XyCache {
public static Map<Integer, LineAndDyNameDto> lineMap = new HashMap<Integer, LineAndDyNameDto>(); // public static Map<Integer, Terminals> terminalMap = new HashMap<Integer, Terminals>();
public static Map<Integer, Terminals> terminalMap = new HashMap<Integer, Terminals>(); // public static Map<Integer, TerminalChannels> termchannelMap = new HashMap<Integer, TerminalChannels>();
public static Map<Integer, TowerDto> towerMap = new HashMap<Integer, TowerDto>(); // /*装置编号+#+通道编号 装置映射表*/
public static Map<Integer, TerminalChannels> termchannelMap = new HashMap<Integer, TerminalChannels>(); // public static Map<String, TerminalChannelMapper> termchannelMapMap = new HashMap<String, TerminalChannelMapper>();
/*装置编号+#+通道编号 装置映射表*/ // //告警类型
public static Map<String, TerminalChannelMapper> termchannelMapMap = new HashMap<String, TerminalChannelMapper>(); // public static Map<Integer, TerminalImgAlarmParams> alarmParamMap = new HashMap<Integer, TerminalImgAlarmParams>();
//告警类型
public static Map<Integer, TerminalImgAlarmParams> alarmParamMap = new HashMap<Integer, TerminalImgAlarmParams>();
public static Map<String, String> globalParams = new HashMap<String, String>();
public static Map<Integer, TerminalStatus> terminalStatusMap = new HashMap<Integer, TerminalStatus>();
@Autowired @Autowired
private LinesDao linesDao; private LinesDao linesDao;
@ -42,63 +35,39 @@ public class XyCache {
@Autowired @Autowired
private TerminalImgAlarmParamsDao terminalImgAlarmParamsDao; private TerminalImgAlarmParamsDao terminalImgAlarmParamsDao;
@Autowired @Autowired
private GlobalParamsDao globalParamsDao;
@Autowired
private TerminalStatusDao terminalStatusDao; private TerminalStatusDao terminalStatusDao;
@PostConstruct @PostConstruct
public void init() { public void init() {
//系统启动中。。。加载codeMap //系统启动中。。。加载codeMap
//
// terminalMap.clear();
// termchannelMap.clear();
// termchannelMapMap.clear();
// alarmParamMap.clear();
//
//
// List<Terminals> termslist = terminalsDao.selectAll(CommonStatus.EFFECTIVE.value());
// for (Terminals item : termslist) {
// terminalMap.put(item.getId(), item);
// }
//
// List<TerminalChannels> channelslist = terminalChannelsDao.selectChannelList(CommonStatus.EFFECTIVE.value());
// for (TerminalChannels item : channelslist) {
// termchannelMap.put(item.getId(), item);
// }
//
// List<TerminalChannelMapper> terminalChannelMapperlist = terminalChannelMapperDao.selectAll();
// for (TerminalChannelMapper item : terminalChannelMapperlist) {
// String s = item.getTermId() + "#" + item.getChannelId();
// termchannelMapMap.put(s, item);
// }
//
// List<TerminalImgAlarmParams> terminalImgAlarmParams = terminalImgAlarmParamsDao.selectAll();
// for (TerminalImgAlarmParams item : terminalImgAlarmParams) {
// alarmParamMap.put(item.getLabel(), item);
// }
lineMap.clear();
terminalMap.clear();
towerMap.clear();
termchannelMap.clear();
termchannelMapMap.clear();
alarmParamMap.clear();
globalParams.clear();
terminalStatusMap.clear();
List<LineAndDyNameDto> lineAndDyNameDtos = linesDao.selectAll(CommonStatus.EFFECTIVE.value());
for (LineAndDyNameDto lineitem : lineAndDyNameDtos) {
lineMap.put(lineitem.getId(), lineitem);
}
List<Terminals> termslist = terminalsDao.selectAll(CommonStatus.EFFECTIVE.value());
for (Terminals item : termslist) {
terminalMap.put(item.getId(), item);
}
List<TowerDto> towerlist = towerDao.selectAll(CommonStatus.EFFECTIVE.value());
for (TowerDto item : towerlist) {
towerMap.put(item.getId(), item);
}
List<TerminalChannels> channelslist = terminalChannelsDao.selectChannelList(CommonStatus.EFFECTIVE.value());
for (TerminalChannels item : channelslist) {
termchannelMap.put(item.getId(), item);
}
List<TerminalChannelMapper> terminalChannelMapperlist = terminalChannelMapperDao.selectAll();
for (TerminalChannelMapper item : terminalChannelMapperlist) {
String s = item.getTermId() + "#" + item.getChannelId();
termchannelMapMap.put(s, item);
}
List<TerminalImgAlarmParams> terminalImgAlarmParams = terminalImgAlarmParamsDao.selectAll();
for (TerminalImgAlarmParams item : terminalImgAlarmParams) {
alarmParamMap.put(item.getLabel(), item);
}
List<GlobalParams> globalParamslist = globalParamsDao.selectAll();
for (GlobalParams item : globalParamslist) {
globalParams.put(item.getParamName(), item.getParamValue());
}
List<TerminalStatus> terminalStatuses = terminalStatusDao.selectAll();
for (TerminalStatus item : terminalStatuses) {
terminalStatusMap.put(item.getTermId(), item);
}
} }

@ -0,0 +1,201 @@
package com.shxy.xymanager_service.impl;
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.List;
/**
*
*/
@Service
@Slf4j
public class CacheServiceImpl implements CacheService {
@Autowired
GlobalParamsDao globalParamsDao;
@Autowired
LinesDao linesDao;
@Autowired
TowerDao towerDao;
@Autowired
TerminalsDao terminalsDao;
@Autowired
TerminalChannelsDao terminalChannelsDao;
@Autowired
TerminalChannelMapperDao terminalChannelMapperDao;
@Autowired
TerminalImgAlarmParamsDao terminalImgAlarmParamsDao;
@Override
@Cacheable(value = "globalParams", key = "#param")
public GlobalParams getGlobalParams(String param) {
System.out.println("测试缓存:" + param);
return globalParamsDao.selectByParam(param);
}
@Override
@CachePut(value = "globalParams", key = "#result.paramName")
public GlobalParams updateGlobalParams(GlobalParams record) {
globalParamsDao.updateByParamName(record, new Date());
return record;
}
@Override
@Cacheable(value = "linesMap", key = "#id")
public Lines getLine(Integer id) {
Lines lines = linesDao.selectById(id);
return lines;
}
@Override
@CacheEvict(value = "linesMap", allEntries = true)
public Integer deleteLine(List<Lines> lines) {
int i = linesDao.deleteById(lines, CommonStatus.DELETE.value(), new Date());
return i;
}
@Override
@CachePut(value = "linesMap", key = "#result.id")
public Lines updateLine(Lines lines) {
int i = linesDao.updateByPrimaryKeySelective(lines, new Date());
if (i == 0) {
return null;
} else {
return lines;
}
}
@Override
@Cacheable(value = "towerMap", key = "#id")
public TowerDto getTower(Integer id) {
TowerDto dto = towerDao.getInfoByPrimaryKey(id, CommonStatus.EFFECTIVE.value());
return dto;
}
@Override
@CacheEvict(value = "towerMap", allEntries = true)
public Integer deleteTower(List<Towers> list) {
int i = towerDao.deleteById(list, CommonStatus.DELETE.value(), new Date());
return i;
}
@Override
@CachePut(value = "towerMap", key = "#result.id")
public Towers updateTower(Towers towers) {
int i = towerDao.updateByPrimaryKeySelective(towers, new Date());
if (i == 0) {
return null;
} else {
return towers;
}
}
@Override
@Cacheable(value = "terminalMap", key = "#id")
public Terminals getTerminal(Integer id) {
Terminals terminals = terminalsDao.selectById(id, CommonStatus.EFFECTIVE.value());
return terminals;
}
@Override
@CacheEvict(value = "terminalMap", allEntries = true)
public Integer deleteTerminal(List<Terminals> list) {
int i = terminalsDao.deleteById(list, CommonStatus.DELETE.value(), new Date());
return i;
}
@Override
@CachePut(value = "terminalMap", key = "#result.id")
public Towers updateTerminal(Towers towers) {
int i = towerDao.updateByPrimaryKeySelective(towers, new Date());
if (i == 0) {
return null;
} else {
return towers;
}
}
@Override
@Cacheable(value = "termchannelMap", key = "#id")
public TerminalChannels getTermchannelMap(Integer id) {
TerminalChannels terminalChannels = terminalChannelsDao.selectByPrimaryKey(id, CommonStatus.EFFECTIVE.value());
return terminalChannels;
}
@Override
@CacheEvict(value = "termchannelMap", allEntries = true)
public Integer deleteTermchannelMap(List<TerminalChannels> list) {
int i = terminalChannelsDao.deleteList(list, CommonStatus.DELETE.value(), new Date());
return i;
}
@Override
@CachePut(value = "termchannelMap", key = "#result.id")
public TerminalChannels updateTermchannelMap(TerminalChannels terminalChannels) {
int i = terminalChannelsDao.updateByPrimaryKeySelective(terminalChannels, new Date());
if (i == 0) {
return null;
} else {
return terminalChannels;
}
}
@Override
@Cacheable(value = "termchannelMapMap", key = "#id")
public TerminalChannelMapper getTermchannelMapMap(Integer id, Integer channelid) {
TerminalChannelMapper terminalChannels = terminalChannelMapperDao.selectByTermidAndChannelid(id, channelid,CommonStatus.EFFECTIVE.value());
return terminalChannels;
}
@Override
@CacheEvict(value = "termchannelMapMap", allEntries = true)
public Integer deleteTermchannelMapMap(Integer id) {
int i = terminalChannelMapperDao.deleteByTermId(id);
return i;
}
@Override
@Cacheable(value = "alarmParamMap")
public List<TerminalImgAlarmParams> getAlarmParsms() {
List<TerminalImgAlarmParams> terminalImgAlarmParams = terminalImgAlarmParamsDao.selectAll();
return terminalImgAlarmParams;
}
@Override
@CacheEvict(value = "alarmParamMap", allEntries = true)
public List<TerminalImgAlarmParams> updateAlarmParsms(List<TerminalImgAlarmParams> list) {
int i = terminalImgAlarmParamsDao.updateList(list, new Date());
if (i == 0) {
return null;
} else {
return list;
}
}
}

@ -1,22 +1,21 @@
package com.shxy.xymanager_service.impl; package com.shxy.xymanager_service.impl;
import cn.hutool.core.util.StrUtil;
import com.shxy.xymanager_common.bean.ServiceBody; import com.shxy.xymanager_common.bean.ServiceBody;
import com.shxy.xymanager_common.entity.GlobalParams; import com.shxy.xymanager_common.entity.GlobalParams;
import com.shxy.xymanager_common.enums.GloableParamsType; import com.shxy.xymanager_common.enums.GloableParamsType;
import com.shxy.xymanager_common.exception.Asserts; import com.shxy.xymanager_common.exception.Asserts;
import com.shxy.xymanager_dao.dao.GlobalParamsDao; import com.shxy.xymanager_dao.dao.GlobalParamsDao;
import com.shxy.xymanager_service.cache.XyCache; import com.shxy.xymanager_service.service.CacheService;
import com.shxy.xymanager_service.service.GloablParamsService; import com.shxy.xymanager_service.service.GloablParamsService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
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 java.util.Date;
import java.util.Map;
/** /**
* *
*/ */
@Service @Service
@Slf4j @Slf4j
@ -25,6 +24,10 @@ public class GloablParamsServiceImpl implements GloablParamsService {
@Autowired @Autowired
GlobalParamsDao globalParamsDao; GlobalParamsDao globalParamsDao;
@Autowired
CacheService cacheService;
/** /**
* *
* *
@ -32,12 +35,22 @@ public class GloablParamsServiceImpl implements GloablParamsService {
*/ */
@Override @Override
public ServiceBody<Integer> getMarkEnableStatus() { public ServiceBody<Integer> getMarkEnableStatus() {
Map<String, String> globalParams = XyCache.globalParams; Integer integer;
String s = globalParams.get(GloableParamsType.ImgMark.value()); GlobalParams globalParams = cacheService.getGlobalParams(GloableParamsType.ImgMark.value());
Integer integer = Integer.valueOf(s); if (globalParams == null) {
integer = 0;
} else {
String paramValue = globalParams.getParamValue();
if (StrUtil.isNotEmpty(paramValue)) {
integer = Integer.valueOf(paramValue);
} else {
integer = 0;
}
}
return Asserts.success(integer); return Asserts.success(integer);
} }
/** /**
* *
* *
@ -48,12 +61,8 @@ public class GloablParamsServiceImpl implements GloablParamsService {
GlobalParams record = new GlobalParams(); GlobalParams record = new GlobalParams();
record.setParamName(GloableParamsType.ImgMark.value()); record.setParamName(GloableParamsType.ImgMark.value());
record.setParamValue(String.valueOf(status)); record.setParamValue(String.valueOf(status));
int i = globalParamsDao.updateByParamName(record, new Date()); cacheService.updateGlobalParams(record);
if (i != 0) { return Asserts.success("修改成功");
XyCache.globalParams.put(GloableParamsType.ImgMark.value(), String.valueOf(status));
return Asserts.success("修改成功");
} else {
return Asserts.error("修改失败");
}
} }
} }

@ -18,6 +18,7 @@ import com.shxy.xymanager_common.model.LineListModel;
import com.shxy.xymanager_common.page.PageUtils; import com.shxy.xymanager_common.page.PageUtils;
import com.shxy.xymanager_common.vo.*; import com.shxy.xymanager_common.vo.*;
import com.shxy.xymanager_dao.dao.*; import com.shxy.xymanager_dao.dao.*;
import com.shxy.xymanager_service.service.CacheService;
import com.shxy.xymanager_service.service.LineService; import com.shxy.xymanager_service.service.LineService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -49,6 +50,9 @@ public class LineServiceImpl implements LineService {
@Autowired @Autowired
private TerminalChannelsDao terminalChannelsDao; private TerminalChannelsDao terminalChannelsDao;
@Autowired
private CacheService cacheService;
/** /**
* 线 * 线
@ -111,8 +115,7 @@ public class LineServiceImpl implements LineService {
@Override @Override
public ServiceBody<String> deleteLine(LineIdVo vo) { public ServiceBody<String> deleteLine(LineIdVo vo) {
List<Lines> lines = BeanUtil.copyToList(vo.getList(), Lines.class); List<Lines> lines = BeanUtil.copyToList(vo.getList(), Lines.class);
Date date = new Date(); int i = cacheService.deleteLine(lines);
int i = linesDao.deleteById(lines, CommonStatus.DELETE.value(), date);
if (i != 0) { if (i != 0) {
return Asserts.success("删除成功"); return Asserts.success("删除成功");
} else { } else {
@ -131,8 +134,8 @@ public class LineServiceImpl implements LineService {
public ServiceBody<String> updateLine(UpdateLineVo vo) { public ServiceBody<String> updateLine(UpdateLineVo vo) {
Lines lines = new Lines(); Lines lines = new Lines();
BeanUtil.copyProperties(vo, lines, true); BeanUtil.copyProperties(vo, lines, true);
int i = linesDao.updateByPrimaryKeySelective(lines, new Date()); Lines bean = cacheService.updateLine(lines);
if (i != 0) { if (bean != null) {
return Asserts.success("修改成功"); return Asserts.success("修改成功");
} else { } else {
return Asserts.error("修改失败"); return Asserts.error("修改失败");

@ -74,17 +74,20 @@ public class OpenServiceImpl implements OpenService {
if (BeanUtil.isEmpty(sysUser)) { if (BeanUtil.isEmpty(sysUser)) {
jsonObject.putOpt("errcode", 1); jsonObject.putOpt("errcode", 1);
jsonObject.putOpt("errmsg", "用户不存在"); jsonObject.putOpt("errmsg", "用户不存在");
return jsonObject;
} }
// 判断密码是否存在 // 判断密码是否存在
String password = vo.getPassWord(); String password = vo.getPassWord();
if (BeanUtil.isEmpty(password)) { if (BeanUtil.isEmpty(password)) {
jsonObject.putOpt("errcode", 2); jsonObject.putOpt("errcode", 2);
jsonObject.putOpt("errmsg", "密码错误"); jsonObject.putOpt("errmsg", "密码错误");
return jsonObject;
} }
// 密码对比 // 密码对比
if (!sysUser.getPassword().equals(userPassword)) { if (!sysUser.getPassword().equals(userPassword)) {
jsonObject.putOpt("errcode", 2); jsonObject.putOpt("errcode", 2);
jsonObject.putOpt("errmsg", "密码错误"); jsonObject.putOpt("errmsg", "密码错误");
return jsonObject;
} }
Date date = new Date(); Date date = new Date();

@ -58,15 +58,11 @@ public class SysUserServiceImpl implements SysUserService {
return sysUserMapperDao.selectByUserAccount(userAccount); return sysUserMapperDao.selectByUserAccount(userAccount);
} }
@Override @Override
public Boolean checkUserNameUnique(String userName) { public Boolean checkUserNameUnique(String userName) {
return sysUserMapperDao.checkUserNameUnique(userName) > 0 ? false : true; return sysUserMapperDao.checkUserNameUnique(userName) > 0 ? false : true;
} }
@Override @Override
public Integer insertUser(SysUser user) { public Integer insertUser(SysUser user) {
int flag = sysUserMapperDao.addUser(user); int flag = sysUserMapperDao.addUser(user);
@ -81,7 +77,6 @@ public class SysUserServiceImpl implements SysUserService {
return flag; return flag;
} }
@Override @Override
public SysUser selectUserById(Long userId) { public SysUser selectUserById(Long userId) {
return sysUserMapperDao.selectUserById(userId); return sysUserMapperDao.selectUserById(userId);
@ -95,10 +90,6 @@ public class SysUserServiceImpl implements SysUserService {
SysUser sysUser = new SysUser(); SysUser sysUser = new SysUser();
String userName = vo.getUserName(); String userName = vo.getUserName();
String nickName= userName; String nickName= userName;
// if(userName.length()>8)
// {
// nickName = userName.substring(0,7);
// }
sysUser.setUserName(userName); sysUser.setUserName(userName);
sysUser.setNickName(nickName); sysUser.setNickName(nickName);
sysUser.setCreateTime(new DateTime()); sysUser.setCreateTime(new DateTime());
@ -112,7 +103,6 @@ public class SysUserServiceImpl implements SysUserService {
return Asserts.success("新增成功"); return Asserts.success("新增成功");
} }
@Override @Override
public void checkUserAllowed(SysUser user) { public void checkUserAllowed(SysUser user) {

@ -17,6 +17,7 @@ import com.shxy.xymanager_common.vo.TerminalAlarmSelectVo;
import com.shxy.xymanager_common.vo.UpdateTerminalAlarmParamsVo; import com.shxy.xymanager_common.vo.UpdateTerminalAlarmParamsVo;
import com.shxy.xymanager_dao.dao.*; import com.shxy.xymanager_dao.dao.*;
import com.shxy.xymanager_service.cache.XyCache; import com.shxy.xymanager_service.cache.XyCache;
import com.shxy.xymanager_service.service.CacheService;
import com.shxy.xymanager_service.service.TerminalAlarmService; import com.shxy.xymanager_service.service.TerminalAlarmService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -57,6 +58,9 @@ public class TerminalAlarmServiceImpl implements TerminalAlarmService {
@Autowired @Autowired
TowerDao towerDao; TowerDao towerDao;
@Autowired
CacheService cacheService;
@Value("${photo.address}") @Value("${photo.address}")
private String photoaddress; private String photoaddress;
@ -72,7 +76,12 @@ public class TerminalAlarmServiceImpl implements TerminalAlarmService {
Integer towerid = vo.getTowerId(); Integer towerid = vo.getTowerId();
Integer label = vo.getLabel(); Integer label = vo.getLabel();
List<TerminalImgAlarmParams> labellist = new ArrayList<>(); List<TerminalImgAlarmParams> labellist = new ArrayList<>();
Map<Integer, TerminalImgAlarmParams> alarmParamMap = XyCache.alarmParamMap; Map<Integer, TerminalImgAlarmParams> alarmParamMap = new HashMap<Integer, TerminalImgAlarmParams>();
List<TerminalImgAlarmParams> alarmParsms = cacheService.getAlarmParsms();
for (TerminalImgAlarmParams item : alarmParsms) {
alarmParamMap.put(item.getLabel(), item);
}
if (label == null || label == -1) { if (label == null || label == -1) {
alarmParamMap.forEach((key, value) -> { alarmParamMap.forEach((key, value) -> {
labellist.add(value); labellist.add(value);
@ -117,24 +126,11 @@ public class TerminalAlarmServiceImpl implements TerminalAlarmService {
list = terminalImgAlarmsDao.selectAlarmsDetails(termidlist, labellist, BigInteger.valueOf(start), BigInteger.valueOf(end)); list = terminalImgAlarmsDao.selectAlarmsDetails(termidlist, labellist, BigInteger.valueOf(start), BigInteger.valueOf(end));
} }
if (CollectionUtil.isNotEmpty(list)) { if (CollectionUtil.isNotEmpty(list)) {
Map<Integer, Terminals> terminalMap = XyCache.terminalMap;
Map<Integer, TowerDto> towerMap = XyCache.towerMap;
Map<Integer, TerminalChannels> termchannelMap = XyCache.termchannelMap;
Map<String, TerminalChannelMapper> termchannelMapMap = XyCache.termchannelMapMap;
// ArrayList<BigInteger> originidlist = new ArrayList<>();
// for (TerminalImgAlarmsDto item : list) {
// originidlist.add(item.getPhotoOrgId());
// }
List<TerminalPhoto> alarmphotolist = terminalPhotoDao.selectPhotoListByOrginIdAndTermList(list); List<TerminalPhoto> alarmphotolist = terminalPhotoDao.selectPhotoListByOrginIdAndTermList(list);
Map<String, TerminalPhoto> map = new HashMap<>(); Map<String, TerminalPhoto> map = new HashMap<>();
for (TerminalPhoto item : alarmphotolist) { for (TerminalPhoto item : alarmphotolist) {
map.put(item.getTermId() + "#" + item.getOrginalId(), item); map.put(item.getTermId() + "#" + item.getOrginalId(), item);
} }
// List<TerminalAlarmListModel.AlarmBean> alarmBeans = BeanUtil.copyToList(list, TerminalAlarmListModel.AlarmBean.class, CopyOptions.create().ignoreCase());
List<TerminalAlarmListModel.AlarmBean> alarmBeans = new ArrayList<>(); List<TerminalAlarmListModel.AlarmBean> alarmBeans = new ArrayList<>();
for (TerminalImgAlarmsDto item : list) { for (TerminalImgAlarmsDto item : list) {
TerminalAlarmListModel.AlarmBean alarmBean = new TerminalAlarmListModel.AlarmBean(); TerminalAlarmListModel.AlarmBean alarmBean = new TerminalAlarmListModel.AlarmBean();
@ -145,11 +141,11 @@ public class TerminalAlarmServiceImpl implements TerminalAlarmService {
alarmBean.setTermId(termId); alarmBean.setTermId(termId);
alarmBean.setChannelId(channelId); alarmBean.setChannelId(channelId);
Terminals terminals = terminalMap.get(termId); Terminals terminals = cacheService.getTerminal(termId);
if (terminals != null) { if (terminals != null) {
alarmBean.setDisplayName(terminals.getDisplayName()); alarmBean.setDisplayName(terminals.getDisplayName());
Integer termtowerid = terminals.getTowerid(); Integer termtowerid = terminals.getTowerid();
TowerDto towerDto = towerMap.get(termtowerid); TowerDto towerDto = cacheService.getTower(termtowerid);
if (towerDto != null) { if (towerDto != null) {
alarmBean.setTowerId(termtowerid); alarmBean.setTowerId(termtowerid);
alarmBean.setTowerName(towerDto.getName()); alarmBean.setTowerName(towerDto.getName());
@ -157,11 +153,11 @@ public class TerminalAlarmServiceImpl implements TerminalAlarmService {
alarmBean.setLineName(towerDto.getLineName()); alarmBean.setLineName(towerDto.getLineName());
} }
} }
TerminalChannels terminalChannels = termchannelMap.get(channelId); TerminalChannels terminalChannels = cacheService.getTermchannelMap(channelId);
if (terminalChannels != null) { if (terminalChannels != null) {
alarmBean.setChannnelName(terminalChannels.getChannelName()); alarmBean.setChannnelName(terminalChannels.getChannelName());
} }
TerminalChannelMapper terminalChannelMapper = termchannelMapMap.get(termId + "#" + channelId); TerminalChannelMapper terminalChannelMapper = cacheService.getTermchannelMapMap(termId, channelId);
if (terminalChannelMapper != null) { if (terminalChannelMapper != null) {
alarmBean.setAlias(terminalChannelMapper.getAlias()); alarmBean.setAlias(terminalChannelMapper.getAlias());
} }
@ -254,15 +250,21 @@ public class TerminalAlarmServiceImpl implements TerminalAlarmService {
public ServiceBody<TerminalImgAlarmParamsModel> getAlarmTypeList() { public ServiceBody<TerminalImgAlarmParamsModel> getAlarmTypeList() {
TerminalImgAlarmParamsModel model = new TerminalImgAlarmParamsModel(); TerminalImgAlarmParamsModel model = new TerminalImgAlarmParamsModel();
ArrayList<TerminalImgAlarmParamsModel.AlarmParamBean> list = new ArrayList<>(); ArrayList<TerminalImgAlarmParamsModel.AlarmParamBean> list = new ArrayList<>();
Map<Integer, TerminalImgAlarmParams> beans = XyCache.alarmParamMap; Map<Integer, TerminalImgAlarmParams> alarmParamMap = new HashMap<Integer, TerminalImgAlarmParams>();
beans.forEach((key, value) -> { List<TerminalImgAlarmParams> alarmParsms = cacheService.getAlarmParsms();
TerminalImgAlarmParamsModel.AlarmParamBean alarmBean = new TerminalImgAlarmParamsModel.AlarmParamBean(); if (CollectionUtil.isNotEmpty(alarmParsms)) {
alarmBean.setId(value.getId()); for (TerminalImgAlarmParams item : alarmParsms) {
alarmBean.setLabel(value.getLabel()); alarmParamMap.put(item.getLabel(), item);
alarmBean.setName(value.getName()); }
alarmBean.setProb(value.getProb()); alarmParamMap.forEach((key, value) -> {
list.add(alarmBean); TerminalImgAlarmParamsModel.AlarmParamBean alarmBean = new TerminalImgAlarmParamsModel.AlarmParamBean();
}); alarmBean.setId(value.getId());
alarmBean.setLabel(value.getLabel());
alarmBean.setName(value.getName());
alarmBean.setProb(value.getProb());
list.add(alarmBean);
});
}
model.setList(list); model.setList(list);
return Asserts.success(model); return Asserts.success(model);
} }
@ -288,14 +290,13 @@ public class TerminalAlarmServiceImpl implements TerminalAlarmService {
params.setName(item.getName()); params.setName(item.getName());
record.add(params); record.add(params);
} }
int i = terminalImgAlarmParamsDao.updateList(record, new Date()); List<TerminalImgAlarmParams> bean = cacheService.updateAlarmParsms(record);
Map<Integer, TerminalImgAlarmParams> alarmParamMap = new HashMap<>(); Map<Integer, TerminalImgAlarmParams> alarmParamMap = new HashMap<>();
List<TerminalImgAlarmParams> terminalImgAlarmParams = terminalImgAlarmParamsDao.selectAll(); List<TerminalImgAlarmParams> terminalImgAlarmParams = terminalImgAlarmParamsDao.selectAll();
for (TerminalImgAlarmParams item : terminalImgAlarmParams) { for (TerminalImgAlarmParams item : terminalImgAlarmParams) {
alarmParamMap.put(item.getLabel(), item); alarmParamMap.put(item.getLabel(), item);
} }
XyCache.alarmParamMap = alarmParamMap; if (bean != null) {
if (i != 0) {
return Asserts.success("修改成功"); return Asserts.success("修改成功");
} else { } else {
return Asserts.error("修改失败"); return Asserts.error("修改失败");

@ -4,9 +4,9 @@ import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DateField; import cn.hutool.core.date.DateField;
import cn.hutool.core.date.DateTime; import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUnit;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import cn.hutool.setting.SettingUtil;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
@ -22,7 +22,7 @@ import com.shxy.xymanager_common.page.PageUtils;
import com.shxy.xymanager_common.util.*; import com.shxy.xymanager_common.util.*;
import com.shxy.xymanager_common.vo.*; import com.shxy.xymanager_common.vo.*;
import com.shxy.xymanager_dao.dao.*; import com.shxy.xymanager_dao.dao.*;
import com.shxy.xymanager_service.cache.XyCache; import com.shxy.xymanager_service.service.CacheService;
import com.shxy.xymanager_service.service.TerminalPhotoService; import com.shxy.xymanager_service.service.TerminalPhotoService;
import com.shxy.xymanager_service.service.TerminalScheduleRuleService; import com.shxy.xymanager_service.service.TerminalScheduleRuleService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@ -64,6 +64,9 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
@Autowired @Autowired
TerminalScheduleRuleService terminalScheduleRuleService; TerminalScheduleRuleService terminalScheduleRuleService;
@Autowired
CacheService cacheService;
@Value("${photo.address}") @Value("${photo.address}")
private String photoaddress; private String photoaddress;
@ -101,8 +104,6 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
model.setList(new ArrayList<>()); model.setList(new ArrayList<>());
} else { } else {
List<TerminalPhotoListModel.PhotoBean> beans = new ArrayList<>(); List<TerminalPhotoListModel.PhotoBean> beans = new ArrayList<>();
Map<Integer, TerminalChannels> termchannelMap = XyCache.termchannelMap;
Map<String, TerminalChannelMapper> termchannelMapMap = XyCache.termchannelMapMap;
for (TerminalPhoto item : list) { for (TerminalPhoto item : list) {
Integer mediaType = item.getMediaType(); Integer mediaType = item.getMediaType();
if (mediaType != null && (mediaType.intValue() == 0 || mediaType.intValue() == 1)) { if (mediaType != null && (mediaType.intValue() == 0 || mediaType.intValue() == 1)) {
@ -122,14 +123,10 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
photoBean.setThumb(requestIp + videoaddress + item.getThumb()); photoBean.setThumb(requestIp + videoaddress + item.getThumb());
} }
} }
photoBean.setChannelName(termchannelMap.get(channelId).getChannelName()); photoBean.setChannelName(cacheService.getTermchannelMap(channelId).getChannelName());
TerminalChannelMapper termchannelMapMap = cacheService.getTermchannelMapMap(termId, channelId);
if (termchannelMapMap != null) { if (termchannelMapMap != null) {
TerminalChannelMapper terminalChannelMapper = termchannelMapMap.get(termId + "#" + channelId); photoBean.setAlias(termchannelMapMap.getAlias());
if (terminalChannelMapper != null) {
photoBean.setAlias(terminalChannelMapper.getAlias());
} else {
photoBean.setAlias("");
}
} else { } else {
photoBean.setAlias(""); photoBean.setAlias("");
} }
@ -203,12 +200,10 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
} }
} }
if (channelid == null || channelid.intValue() == 0) { if (channelid == null || channelid.intValue() == 0) {
} else { } else {
channelidlist.add(channelid); channelidlist.add(channelid);
} }
if (termidlist.size() == 0) { if (termidlist.size() == 0) {
} else { } else {
PageUtils.SetPage(pageindex, pagesize); PageUtils.SetPage(pageindex, pagesize);
list = terminalPhotoDao.selectPhotoListByTermList(termidlist, channelidlist, BigInteger.valueOf(start), BigInteger.valueOf(end)); list = terminalPhotoDao.selectPhotoListByTermList(termidlist, channelidlist, BigInteger.valueOf(start), BigInteger.valueOf(end));
@ -219,25 +214,26 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
if (empty) { if (empty) {
model.setList(new ArrayList<>()); model.setList(new ArrayList<>());
} else { } else {
Map<Integer, Terminals> terminalMap = XyCache.terminalMap;
Map<Integer, LineAndDyNameDto> lineMap = XyCache.lineMap;
Map<Integer, TerminalChannels> termchannelMap = XyCache.termchannelMap;
Map<String, TerminalChannelMapper> termchannelMapMap = XyCache.termchannelMapMap;
for (TerminalPhoto item : list) { for (TerminalPhoto item : list) {
TerminalPhotoSelectListModel.PhotoBean photoBean = new TerminalPhotoSelectListModel.PhotoBean(); TerminalPhotoSelectListModel.PhotoBean photoBean = new TerminalPhotoSelectListModel.PhotoBean();
photoBean.setTermid(item.getTermId()); photoBean.setTermid(item.getTermId());
Terminals terminals = terminalMap.get(item.getTermId()); Terminals terminals = cacheService.getTerminal(item.getTermId());
if (!BeanUtil.isEmpty(terminals)) { if (!BeanUtil.isEmpty(terminals)) {
Integer mediaType = item.getMediaType(); Integer mediaType = item.getMediaType();
if (mediaType != null && (mediaType.intValue() == 0 || mediaType.intValue() == 1)) { if (mediaType != null && (mediaType.intValue() == 0 || mediaType.intValue() == 1)) {
photoBean.setDisplayname(terminals.getDisplayName()); photoBean.setDisplayname(terminals.getDisplayName());
photoBean.setLineid(terminals.getLineid()); photoBean.setLineid(terminals.getLineid());
photoBean.setLinename(lineMap.get(terminals.getLineid()).getName()); Lines line = cacheService.getLine(terminals.getLineid());
if (BeanUtil.isNotEmpty(line)) {
photoBean.setLinename(line.getName());
} else {
photoBean.setLinename("");
}
photoBean.setChannelid(item.getChannelId()); photoBean.setChannelid(item.getChannelId());
photoBean.setCmdid(terminals.getCmdid()); photoBean.setCmdid(terminals.getCmdid());
photoBean.setChannnelname(termchannelMap.get(item.getChannelId()).getChannelName()); photoBean.setChannnelname(cacheService.getTermchannelMap(item.getChannelId()).getChannelName());
photoBean.setAlias(termchannelMapMap.get(item.getTermId() + "#" + item.getChannelId()).getAlias()); photoBean.setAlias(cacheService.getTermchannelMapMap(item.getTermId(), item.getChannelId()).getAlias());
photoBean.setMediaType(item.getMediaType()); photoBean.setMediaType(item.getMediaType());
photoBean.setOrginalid(item.getOrginalId()); photoBean.setOrginalid(item.getOrginalId());
if (mediaType.intValue() == 0) { if (mediaType.intValue() == 0) {
@ -295,10 +291,16 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
pagesize = 10; pagesize = 10;
} }
PageUtils.SetPage(pageindex, pagesize); PageUtils.SetPage(pageindex, pagesize);
Date starttime = MyDateUtils.myparseDate(vo.getStartTime()); String startTime = vo.getStartTime();
Date startDate = null;
if (StrUtil.isEmpty(startTime)) {
startDate = MyDateUtils.getNowDate();
} else {
startDate = MyDateUtils.myparseDate(startTime);
}
long start = 0; long start = 0;
if (starttime != null) { if (startDate != null) {
start = MyDateUtils.TimeMillSecond2Second(DateTime.of(starttime)); start = MyDateUtils.TimeMillSecond2Second(DateTime.of(startDate));
} }
Date endtime = MyDateUtils.myparseDate(vo.getEndTime()); Date endtime = MyDateUtils.myparseDate(vo.getEndTime());
long end = 0; long end = 0;
@ -333,7 +335,7 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
} }
photoBean.setPresetId(item.getPresetId()); photoBean.setPresetId(item.getPresetId());
long phototime = MyDateUtils.TimeSecond2MillSecond(item.getPhotoTime().longValue()); long phototime = MyDateUtils.TimeSecond2MillSecond(item.getPhotoTime().longValue());
photoBean.setPhotoTime(MyDateUtils.date(phototime)); photoBean.setPhotoTime(MyDateUtils.formatDateTime(MyDateUtils.date(phototime)));
beans.add(photoBean); beans.add(photoBean);
} }
} }
@ -356,8 +358,7 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
public ServiceBody<Date> getLatestPhoto(TerminalPhotoVo vo) { public ServiceBody<Date> getLatestPhoto(TerminalPhotoVo vo) {
Integer termId = vo.getTermId(); Integer termId = vo.getTermId();
DateTime now = DateTime.now(); DateTime now = DateTime.now();
Map<Integer, Terminals> terminalMap = XyCache.terminalMap; Terminals terminals = cacheService.getTerminal(termId);
Terminals terminals = terminalMap.get(termId);
String cmdid = null; String cmdid = null;
if (terminals != null) { if (terminals != null) {
cmdid = terminals.getCmdid(); cmdid = terminals.getCmdid();
@ -501,11 +502,6 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
for (TerminalChannelMapper item : list) { for (TerminalChannelMapper item : list) {
photolist.add(item.getPhotoId()); photolist.add(item.getPhotoId());
} }
Map<Integer, LineAndDyNameDto> lineMap = XyCache.lineMap;
Map<String, TerminalChannelMapper> termchannelMapMap = XyCache.termchannelMapMap;
Map<Integer, TowerDto> towerMap = XyCache.towerMap;
Map<Integer, Terminals> terminalMap = XyCache.terminalMap;
Map<Integer, TerminalChannels> termchannelMap = XyCache.termchannelMap;
List<TerminalPhoto> photoList = terminalPhotoDao.selectPhotosByIdList(photolist); List<TerminalPhoto> photoList = terminalPhotoDao.selectPhotosByIdList(photolist);
for (TerminalChannelMapper item : list) { for (TerminalChannelMapper item : list) {
@ -515,7 +511,7 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
BigInteger photoId = item.getPhotoId(); BigInteger photoId = item.getPhotoId();
Integer lineid = null; Integer lineid = null;
photosBean.setTermid(termid); photosBean.setTermid(termid);
Terminals terminals = terminalMap.get(termid); Terminals terminals = cacheService.getTerminal(termid);
if (terminals != null) { if (terminals != null) {
lineid = terminals.getLineid(); lineid = terminals.getLineid();
photosBean.setLineid(lineid); photosBean.setLineid(lineid);
@ -523,22 +519,18 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
photosBean.setCmdid(terminals.getCmdid()); photosBean.setCmdid(terminals.getCmdid());
} }
photosBean.setChannelid(channelid); photosBean.setChannelid(channelid);
photosBean.setChannnelname(termchannelMap.get(channelid).getChannelName()); photosBean.setChannnelname(cacheService.getTermchannelMap(channelid).getChannelName());
TerminalChannelMapper termchannelMapMap = cacheService.getTermchannelMapMap(termid, channelid);
if (termchannelMapMap != null) { if (termchannelMapMap != null) {
TerminalChannelMapper terminalChannelMapper = termchannelMapMap.get(termid + "#" + channelid); photosBean.setAlias(termchannelMapMap.getAlias());
if (terminalChannelMapper != null) {
photosBean.setAlias(terminalChannelMapper.getAlias());
} else {
photosBean.setAlias("");
}
} else { } else {
photosBean.setAlias(""); photosBean.setAlias("");
} }
if (lineid != null) { if (lineid != null) {
LineAndDyNameDto lineAndDyNameDto = lineMap.get(lineid); Lines line = cacheService.getLine(lineid);
if (lineAndDyNameDto != null) { if (line != null) {
photosBean.setLinename(lineAndDyNameDto.getName()); photosBean.setLinename(line.getName());
} else { } else {
photosBean.setLinename(""); photosBean.setLinename("");
} }
@ -686,25 +678,26 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
if (empty) { if (empty) {
model.setList(new ArrayList<>()); model.setList(new ArrayList<>());
} else { } else {
Map<Integer, Terminals> terminalMap = XyCache.terminalMap;
Map<Integer, LineAndDyNameDto> lineMap = XyCache.lineMap;
Map<Integer, TerminalChannels> termchannelMap = XyCache.termchannelMap;
Map<String, TerminalChannelMapper> termchannelMapMap = XyCache.termchannelMapMap;
for (TerminalPhoto item : list) { for (TerminalPhoto item : list) {
TerminalPhotoSelectListModel.PhotoBean photoBean = new TerminalPhotoSelectListModel.PhotoBean(); TerminalPhotoSelectListModel.PhotoBean photoBean = new TerminalPhotoSelectListModel.PhotoBean();
photoBean.setTermid(item.getTermId()); photoBean.setTermid(item.getTermId());
Terminals terminals = terminalMap.get(item.getTermId()); Terminals terminals = cacheService.getTerminal(item.getTermId());
if (!BeanUtil.isEmpty(terminals)) { if (!BeanUtil.isEmpty(terminals)) {
Integer mediaType = item.getMediaType(); Integer mediaType = item.getMediaType();
if (mediaType != null && (mediaType.intValue() == 0 || mediaType.intValue() == 1)) { if (mediaType != null && (mediaType.intValue() == 0 || mediaType.intValue() == 1)) {
photoBean.setDisplayname(terminals.getDisplayName()); photoBean.setDisplayname(terminals.getDisplayName());
photoBean.setLineid(terminals.getLineid()); photoBean.setLineid(terminals.getLineid());
photoBean.setLinename(lineMap.get(terminals.getLineid()).getName()); Lines line = cacheService.getLine(terminals.getLineid());
if (BeanUtil.isNotEmpty(line)) {
photoBean.setLinename(line.getName());
} else {
photoBean.setLinename("");
}
photoBean.setChannelid(item.getChannelId()); photoBean.setChannelid(item.getChannelId());
photoBean.setCmdid(terminals.getCmdid()); photoBean.setCmdid(terminals.getCmdid());
photoBean.setChannnelname(termchannelMap.get(item.getChannelId()).getChannelName()); photoBean.setChannnelname(cacheService.getTermchannelMap(item.getChannelId()).getChannelName());
TerminalChannelMapper termchannelMapMap = cacheService.getTermchannelMapMap(item.getTermId(), item.getChannelId());
photoBean.setAlias(termchannelMapMap.get(item.getTermId() + "#" + item.getChannelId()).getAlias()); photoBean.setAlias(termchannelMapMap.getAlias());
photoBean.setMediaType(item.getMediaType()); photoBean.setMediaType(item.getMediaType());
photoBean.setOrginalid(item.getOrginalId()); photoBean.setOrginalid(item.getOrginalId());
if (mediaType.intValue() == 0) { if (mediaType.intValue() == 0) {

@ -13,6 +13,7 @@ import com.shxy.xymanager_common.dto.DyLineAndTerminalNoHeartDto;
import com.shxy.xymanager_common.dto.PhotoMarkDto; import com.shxy.xymanager_common.dto.PhotoMarkDto;
import com.shxy.xymanager_common.dto.TerminalInfoDto; import com.shxy.xymanager_common.dto.TerminalInfoDto;
import com.shxy.xymanager_common.dto.TerminalsAndLineAndChannelDto; import com.shxy.xymanager_common.dto.TerminalsAndLineAndChannelDto;
import com.shxy.xymanager_common.entity.GlobalParams;
import com.shxy.xymanager_common.entity.TerminalChannelMapper; import com.shxy.xymanager_common.entity.TerminalChannelMapper;
import com.shxy.xymanager_common.entity.TerminalStatus; import com.shxy.xymanager_common.entity.TerminalStatus;
import com.shxy.xymanager_common.entity.Terminals; import com.shxy.xymanager_common.entity.Terminals;
@ -28,6 +29,7 @@ import com.shxy.xymanager_common.util.TerminalUtils;
import com.shxy.xymanager_common.vo.*; import com.shxy.xymanager_common.vo.*;
import com.shxy.xymanager_dao.dao.*; import com.shxy.xymanager_dao.dao.*;
import com.shxy.xymanager_service.cache.XyCache; import com.shxy.xymanager_service.cache.XyCache;
import com.shxy.xymanager_service.service.CacheService;
import com.shxy.xymanager_service.service.TerminalService; import com.shxy.xymanager_service.service.TerminalService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
@ -68,6 +70,9 @@ public class TerminalServiceImpl implements TerminalService {
@Autowired @Autowired
TerminalStatusDao terminalStatusDao; TerminalStatusDao terminalStatusDao;
@Autowired
CacheService cacheService;
@Value("${photo.address}") @Value("${photo.address}")
private String photoaddress; private String photoaddress;
@ -379,13 +384,17 @@ public class TerminalServiceImpl implements TerminalService {
@Override @Override
public ServiceBody<PhotoMarkModel> getCoordinate(String requestIp, MarkReqVo vo) { public ServiceBody<PhotoMarkModel> getCoordinate(String requestIp, MarkReqVo vo) {
Map<String, String> globalParams = XyCache.globalParams; GlobalParams globalParams = cacheService.getGlobalParams(GloableParamsType.ImgMark.value());
String s = globalParams.get(GloableParamsType.ImgMark.value());
Integer integer = null; Integer integer = null;
if (StrUtil.isEmpty(s)) { if (globalParams == null) {
integer = 0; integer = 0;
} else { } else {
integer = Integer.valueOf(s); String s = globalParams.getParamValue();
if (StrUtil.isEmpty(s)) {
integer = 0;
} else {
integer = Integer.valueOf(s);
}
} }
PhotoMarkModel model = new PhotoMarkModel(); PhotoMarkModel model = new PhotoMarkModel();
model.setMarkEnable(integer); model.setMarkEnable(integer);

@ -1,73 +0,0 @@
package com.shxy.xymanager_service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import cn.hutool.core.collection.CollectionUtil;
import com.shxy.xymanager_common.bean.ServiceBody;
import com.shxy.xymanager_common.entity.Terminals;
import com.shxy.xymanager_common.enums.CommonStatus;
import com.shxy.xymanager_common.exception.Asserts;
import com.shxy.xymanager_common.model.TerminalListModel;
import com.shxy.xymanager_common.vo.TerminalIdListVo;
import com.shxy.xymanager_dao.dao.TerminalsDao;
import com.shxy.xymanager_service.service.TerminalStatusService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
*
*
* @author
*/
@Slf4j
@Service
public class TerminalStatusServiceImpl implements TerminalStatusService {
@Autowired
private TerminalsDao terminalsDao;
/**
*
*
* @return
*/
@Override
public ServiceBody<TerminalListModel> getTerminalList() {
TerminalListModel terminalListModel = new TerminalListModel();
List<Terminals> terminals = terminalsDao.selectAll(CommonStatus.EFFECTIVE.value());
boolean empty = CollectionUtil.isEmpty(terminals);
if (empty) {
terminalListModel.setList(new ArrayList<>());
} else {
List<TerminalListModel.TerminalsBean> list = BeanUtil.copyToList(terminals, TerminalListModel.TerminalsBean.class, CopyOptions.create().ignoreCase());
terminalListModel.setList(list);
}
return Asserts.success(terminalListModel);
}
/**
*
*
* @param vo
* @return
*/
@Override
public ServiceBody<String> deleteLine(TerminalIdListVo vo) {
List<Terminals> list = BeanUtil.copyToList(vo.getList(), Terminals.class);
int i = terminalsDao.deleteById(list,CommonStatus.DELETE.value(),new Date());
if (i != 0) {
return Asserts.success("删除成功");
} else {
return Asserts.error("删除失败");
}
}
}

@ -14,7 +14,7 @@ import com.shxy.xymanager_common.model.TowerListModel;
import com.shxy.xymanager_common.page.PageUtils; import com.shxy.xymanager_common.page.PageUtils;
import com.shxy.xymanager_common.vo.*; import com.shxy.xymanager_common.vo.*;
import com.shxy.xymanager_dao.dao.TowerDao; import com.shxy.xymanager_dao.dao.TowerDao;
import com.shxy.xymanager_service.cache.XyCache; import com.shxy.xymanager_service.service.CacheService;
import com.shxy.xymanager_service.service.TowerService; import com.shxy.xymanager_service.service.TowerService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -30,6 +30,7 @@ import java.util.List;
* *
* @author * @author
*/ */
@Slf4j @Slf4j
@Service @Service
public class TowerServiceImpl implements TowerService { public class TowerServiceImpl implements TowerService {
@ -37,6 +38,9 @@ public class TowerServiceImpl implements TowerService {
@Autowired @Autowired
private TowerDao towerDao; private TowerDao towerDao;
@Autowired
private CacheService cacheService;
@Override @Override
public ServiceBody addTower(TowersVo vo) { public ServiceBody addTower(TowersVo vo) {
List<Towers> towersLst = BeanUtil.copyToList(vo.getList(), Towers.class, CopyOptions.create().ignoreCase()); List<Towers> towersLst = BeanUtil.copyToList(vo.getList(), Towers.class, CopyOptions.create().ignoreCase());
@ -74,15 +78,13 @@ public class TowerServiceImpl implements TowerService {
int pages = pageData.getPages(); int pages = pageData.getPages();
model.setTotalpage(pages); model.setTotalpage(pages);
return Asserts.success(model); return Asserts.success(model);
} }
@Override @Override
public ServiceBody<String> deleteTower(TowerIdVo vo) { public ServiceBody<String> deleteTower(TowerIdVo vo) {
List<Towers> lines = BeanUtil.copyToList(vo.getList(), Towers.class); List<Towers> lines = BeanUtil.copyToList(vo.getList(), Towers.class);
Date date = new Date(); Integer i = cacheService.deleteTower(lines);
int i = towerDao.deleteById(lines, CommonStatus.DELETE.value(), date);
if (i != 0) { if (i != 0) {
return Asserts.success("删除成功"); return Asserts.success("删除成功");
} else { } else {

@ -0,0 +1,79 @@
package com.shxy.xymanager_service.service;
import com.shxy.xymanager_common.dto.TowerDto;
import com.shxy.xymanager_common.entity.*;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import java.util.List;
/**
*
*
* @author jingjing
*/
public interface CacheService {
/**
*
*
* @return
*/
GlobalParams getGlobalParams(String param);
/**
*
*
* @return
*/
GlobalParams updateGlobalParams(GlobalParams record);
/**
* 线
*
* @return
*/
Lines getLine(Integer id);
/**
* 线
*
* @return
*/
Integer deleteLine(List<Lines> lines);
/**
* 线
*
* @return
*/
Lines updateLine(Lines lines);
TowerDto getTower(Integer id);
Integer deleteTower(List<Towers> list);
Towers updateTower(Towers towers);
Terminals getTerminal(Integer id);
Integer deleteTerminal(List<Terminals> list);
Towers updateTerminal(Towers towers);
TerminalChannels getTermchannelMap(Integer id);
Integer deleteTermchannelMap(List<TerminalChannels> list);
TerminalChannels updateTermchannelMap(TerminalChannels terminalChannels);
TerminalChannelMapper getTermchannelMapMap(Integer id, Integer channelid);
Integer deleteTermchannelMapMap(Integer id);
List<TerminalImgAlarmParams> getAlarmParsms();
List<TerminalImgAlarmParams> updateAlarmParsms(List<TerminalImgAlarmParams> list);
}

@ -1,26 +0,0 @@
package com.shxy.xymanager_service.service;
import com.shxy.xymanager_common.bean.ServiceBody;
import com.shxy.xymanager_common.model.TerminalListModel;
import com.shxy.xymanager_common.vo.TerminalIdListVo;
/**
*
*
* @author
*/
public interface TerminalStatusService {
/**
*
*
* @return
*/
ServiceBody<TerminalListModel> getTerminalList();
/**
*
* @param vo
* @return
*/
ServiceBody<String> deleteLine(TerminalIdListVo vo);
}
Loading…
Cancel
Save