新增缓存

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

@ -28,7 +28,7 @@ public class GloableParamsController extends BaseController {
@ApiOperation(value = "查询图片绘制开关状态", notes = "查询图片绘制开关状态接口", httpMethod = "POST")
@ApiResponses({@ApiResponse(code = 200, message = "请求成功"), @ApiResponse(code = 400, message = "请求参数没填好"), @ApiResponse(code = 404, message = "请求路径没有或页面跳转路径不对")})
@RequestMapping("/getMarkEnableStatus")
@Log(title = "新增杆塔", type = "查询")
@Log(title = "查询图片绘制开关状态", type = "查询")
public ResponseReult<Integer> getMarkEnableStatus() {
ServiceBody<Integer> serviceBody = gloableParamsService.getMarkEnableStatus();
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 = "请求路径没有或页面跳转路径不对")})
@RequestMapping("/updateMarkEnableStatus")
@Log(title = "新增杆塔", type = "查询")
@Log(title = "修改图片绘制开关状态", type = "修改")
public ResponseReult<String> updateMarkEnableStatus(@RequestParam("status") Integer status) {
ServiceBody<String> serviceBody = gloableParamsService.updateMarkEnableStatus(status);
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.bean.ServiceBody;
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.LineListModel;
import com.shxy.xymanager_common.model.DyLineTreeListModel;
import com.shxy.xymanager_common.vo.*;
import com.shxy.xymanager_service.service.CacheService;
import com.shxy.xymanager_service.service.LineService;
import io.swagger.annotations.Api;
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.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@Api(value = "线路接口", tags = "线路相关")
@RestController
@ -30,6 +37,9 @@ public class LineController extends BaseController {
@Autowired
LineService lineService;
@Autowired
CacheService cacheService;
@ApiOperation(value = "获取线路列表", notes = "获取线路列表接口", httpMethod = "POST")
@ApiResponses({@ApiResponse(code = 200, message = "请求成功"), @ApiResponse(code = 400, message = "请求参数没填好"), @ApiResponse(code = 404, message = "请求路径没有或页面跳转路径不对")})
@RequestMapping("/getLineList")
@ -108,4 +118,34 @@ public class LineController extends BaseController {
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);
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;
@ApiModelProperty(value = "拍照时间", example = "123456")
private Date photoTime;
private String photoTime;
@ApiModelProperty(value = "照片路径", example = "123456")
private String path;

@ -17,6 +17,8 @@ public interface GlobalParamsDao {
List<GlobalParams> selectAll();
GlobalParams selectByParam(@Param("param") String param);
int updateByPrimaryKeySelective(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);
Lines selectByPrimaryKey(Integer id);
Lines selectById(Integer id);
List<Lines> selectLineByDyId(@Param("dyid")Integer dyid,@Param("status") Integer status);

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

@ -16,6 +16,8 @@ public interface TerminalsDao {
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<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<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);

@ -22,7 +22,13 @@
select
<include refid="Base_Column_List"/>
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>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
delete from global_params

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

@ -29,7 +29,7 @@
</sql>
<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 id="selectPages" resultMap="SysUserResult">
@ -41,7 +41,7 @@
</select>
<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 id="selectUserByUserName" parameterType="String" resultMap="SysUserResult">

@ -27,6 +27,13 @@
from terminal_channel_mapper
</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
<include refid="Base_Column_List"/>

@ -36,7 +36,8 @@
<result column="tower_id" jdbcType="INTEGER" property="towerid"/>
<result column="cmdid" jdbcType="VARCHAR" property="cmdid"/>
<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_name" jdbcType="VARCHAR" property="name"/>
<result column="schedule_id" jdbcType="INTEGER" property="scheduleid"/>
@ -52,7 +53,7 @@
select
<include refid="Base_Column_List"/>
from terminal_channels
where id = #{id,jdbcType=INTEGER}
where id = #{id} and status = #{status}
</select>
<select id="selectChannelList" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
@ -61,22 +62,25 @@
where status = #{status}
</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
count(1)
count(1)
from terminal_channels
where
id in
<foreach collection="list" item="item" index="index" open="(" close=")" separator=",">
#{item.id}
</foreach> or
</foreach>
or
channel_name in
<foreach collection="list" item="item" index="index" open="(" close=")" separator=",">
#{item.channelname}
</foreach>
</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
count(1)
from terminal_channels

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

@ -74,6 +74,13 @@
where status = #{status}
</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
a.id as term_id,
@ -99,16 +106,6 @@
</foreach>
</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 id="selectChannelAndTermList" resultMap="ChannelAndTerm">

@ -26,7 +26,6 @@
from towers t,
`lines` l
where t.line_id = l.id and t.status = #{status,jdbcType=INTEGER} order by t.`order` asc
</select>
<select id="selectAllByLineid" resultType="com.shxy.xymanager_common.entity.Towers">
@ -40,20 +39,6 @@
order by `order` asc
</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
t.id as id,

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

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

@ -1,7 +1,5 @@
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.enums.CommonStatus;
import com.shxy.xymanager_dao.dao.*;
@ -16,18 +14,13 @@ import java.util.Map;
@Component
public class XyCache {
public static Map<Integer, LineAndDyNameDto> lineMap = new HashMap<Integer, LineAndDyNameDto>();
public static Map<Integer, Terminals> terminalMap = new HashMap<Integer, Terminals>();
public static Map<Integer, TowerDto> towerMap = new HashMap<Integer, TowerDto>();
public static Map<Integer, TerminalChannels> termchannelMap = new HashMap<Integer, TerminalChannels>();
/*装置编号+#+通道编号 装置映射表*/
public static Map<String, TerminalChannelMapper> termchannelMapMap = new HashMap<String, TerminalChannelMapper>();
//告警类型
public static Map<Integer, TerminalImgAlarmParams> alarmParamMap = new HashMap<Integer, TerminalImgAlarmParams>();
// public static Map<Integer, Terminals> terminalMap = new HashMap<Integer, Terminals>();
// public static Map<Integer, TerminalChannels> termchannelMap = new HashMap<Integer, TerminalChannels>();
// /*装置编号+#+通道编号 装置映射表*/
// public static Map<String, TerminalChannelMapper> termchannelMapMap = new HashMap<String, TerminalChannelMapper>();
// //告警类型
// 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
private LinesDao linesDao;
@ -42,63 +35,39 @@ public class XyCache {
@Autowired
private TerminalImgAlarmParamsDao terminalImgAlarmParamsDao;
@Autowired
private GlobalParamsDao globalParamsDao;
@Autowired
private TerminalStatusDao terminalStatusDao;
@PostConstruct
public void init() {
//系统启动中。。。加载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;
import cn.hutool.core.util.StrUtil;
import com.shxy.xymanager_common.bean.ServiceBody;
import com.shxy.xymanager_common.entity.GlobalParams;
import com.shxy.xymanager_common.enums.GloableParamsType;
import com.shxy.xymanager_common.exception.Asserts;
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 lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.Map;
/**
*
*
*/
@Service
@Slf4j
@ -25,6 +24,10 @@ public class GloablParamsServiceImpl implements GloablParamsService {
@Autowired
GlobalParamsDao globalParamsDao;
@Autowired
CacheService cacheService;
/**
*
*
@ -32,12 +35,22 @@ public class GloablParamsServiceImpl implements GloablParamsService {
*/
@Override
public ServiceBody<Integer> getMarkEnableStatus() {
Map<String, String> globalParams = XyCache.globalParams;
String s = globalParams.get(GloableParamsType.ImgMark.value());
Integer integer = Integer.valueOf(s);
Integer integer;
GlobalParams globalParams = cacheService.getGlobalParams(GloableParamsType.ImgMark.value());
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);
}
/**
*
*
@ -48,12 +61,8 @@ public class GloablParamsServiceImpl implements GloablParamsService {
GlobalParams record = new GlobalParams();
record.setParamName(GloableParamsType.ImgMark.value());
record.setParamValue(String.valueOf(status));
int i = globalParamsDao.updateByParamName(record, new Date());
if (i != 0) {
XyCache.globalParams.put(GloableParamsType.ImgMark.value(), String.valueOf(status));
return Asserts.success("修改成功");
} else {
return Asserts.error("修改失败");
}
cacheService.updateGlobalParams(record);
return Asserts.success("修改成功");
}
}

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

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

@ -58,15 +58,11 @@ public class SysUserServiceImpl implements SysUserService {
return sysUserMapperDao.selectByUserAccount(userAccount);
}
@Override
public Boolean checkUserNameUnique(String userName) {
return sysUserMapperDao.checkUserNameUnique(userName) > 0 ? false : true;
}
@Override
public Integer insertUser(SysUser user) {
int flag = sysUserMapperDao.addUser(user);
@ -81,7 +77,6 @@ public class SysUserServiceImpl implements SysUserService {
return flag;
}
@Override
public SysUser selectUserById(Long userId) {
return sysUserMapperDao.selectUserById(userId);
@ -95,10 +90,6 @@ public class SysUserServiceImpl implements SysUserService {
SysUser sysUser = new SysUser();
String userName = vo.getUserName();
String nickName= userName;
// if(userName.length()>8)
// {
// nickName = userName.substring(0,7);
// }
sysUser.setUserName(userName);
sysUser.setNickName(nickName);
sysUser.setCreateTime(new DateTime());
@ -112,7 +103,6 @@ public class SysUserServiceImpl implements SysUserService {
return Asserts.success("新增成功");
}
@Override
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_dao.dao.*;
import com.shxy.xymanager_service.cache.XyCache;
import com.shxy.xymanager_service.service.CacheService;
import com.shxy.xymanager_service.service.TerminalAlarmService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
@ -57,6 +58,9 @@ public class TerminalAlarmServiceImpl implements TerminalAlarmService {
@Autowired
TowerDao towerDao;
@Autowired
CacheService cacheService;
@Value("${photo.address}")
private String photoaddress;
@ -72,7 +76,12 @@ public class TerminalAlarmServiceImpl implements TerminalAlarmService {
Integer towerid = vo.getTowerId();
Integer label = vo.getLabel();
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) {
alarmParamMap.forEach((key, value) -> {
labellist.add(value);
@ -117,24 +126,11 @@ public class TerminalAlarmServiceImpl implements TerminalAlarmService {
list = terminalImgAlarmsDao.selectAlarmsDetails(termidlist, labellist, BigInteger.valueOf(start), BigInteger.valueOf(end));
}
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);
Map<String, TerminalPhoto> map = new HashMap<>();
for (TerminalPhoto item : alarmphotolist) {
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<>();
for (TerminalImgAlarmsDto item : list) {
TerminalAlarmListModel.AlarmBean alarmBean = new TerminalAlarmListModel.AlarmBean();
@ -145,11 +141,11 @@ public class TerminalAlarmServiceImpl implements TerminalAlarmService {
alarmBean.setTermId(termId);
alarmBean.setChannelId(channelId);
Terminals terminals = terminalMap.get(termId);
Terminals terminals = cacheService.getTerminal(termId);
if (terminals != null) {
alarmBean.setDisplayName(terminals.getDisplayName());
Integer termtowerid = terminals.getTowerid();
TowerDto towerDto = towerMap.get(termtowerid);
TowerDto towerDto = cacheService.getTower(termtowerid);
if (towerDto != null) {
alarmBean.setTowerId(termtowerid);
alarmBean.setTowerName(towerDto.getName());
@ -157,11 +153,11 @@ public class TerminalAlarmServiceImpl implements TerminalAlarmService {
alarmBean.setLineName(towerDto.getLineName());
}
}
TerminalChannels terminalChannels = termchannelMap.get(channelId);
TerminalChannels terminalChannels = cacheService.getTermchannelMap(channelId);
if (terminalChannels != null) {
alarmBean.setChannnelName(terminalChannels.getChannelName());
}
TerminalChannelMapper terminalChannelMapper = termchannelMapMap.get(termId + "#" + channelId);
TerminalChannelMapper terminalChannelMapper = cacheService.getTermchannelMapMap(termId, channelId);
if (terminalChannelMapper != null) {
alarmBean.setAlias(terminalChannelMapper.getAlias());
}
@ -254,15 +250,21 @@ public class TerminalAlarmServiceImpl implements TerminalAlarmService {
public ServiceBody<TerminalImgAlarmParamsModel> getAlarmTypeList() {
TerminalImgAlarmParamsModel model = new TerminalImgAlarmParamsModel();
ArrayList<TerminalImgAlarmParamsModel.AlarmParamBean> list = new ArrayList<>();
Map<Integer, TerminalImgAlarmParams> beans = XyCache.alarmParamMap;
beans.forEach((key, value) -> {
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);
});
Map<Integer, TerminalImgAlarmParams> alarmParamMap = new HashMap<Integer, TerminalImgAlarmParams>();
List<TerminalImgAlarmParams> alarmParsms = cacheService.getAlarmParsms();
if (CollectionUtil.isNotEmpty(alarmParsms)) {
for (TerminalImgAlarmParams item : alarmParsms) {
alarmParamMap.put(item.getLabel(), item);
}
alarmParamMap.forEach((key, value) -> {
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);
return Asserts.success(model);
}
@ -288,14 +290,13 @@ public class TerminalAlarmServiceImpl implements TerminalAlarmService {
params.setName(item.getName());
record.add(params);
}
int i = terminalImgAlarmParamsDao.updateList(record, new Date());
List<TerminalImgAlarmParams> bean = cacheService.updateAlarmParsms(record);
Map<Integer, TerminalImgAlarmParams> alarmParamMap = new HashMap<>();
List<TerminalImgAlarmParams> terminalImgAlarmParams = terminalImgAlarmParamsDao.selectAll();
for (TerminalImgAlarmParams item : terminalImgAlarmParams) {
alarmParamMap.put(item.getLabel(), item);
}
XyCache.alarmParamMap = alarmParamMap;
if (i != 0) {
if (bean != null) {
return Asserts.success("修改成功");
} else {
return Asserts.error("修改失败");

@ -4,9 +4,9 @@ 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.DateUnit;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.setting.SettingUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
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.vo.*;
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.TerminalScheduleRuleService;
import lombok.extern.slf4j.Slf4j;
@ -64,6 +64,9 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
@Autowired
TerminalScheduleRuleService terminalScheduleRuleService;
@Autowired
CacheService cacheService;
@Value("${photo.address}")
private String photoaddress;
@ -101,8 +104,6 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
model.setList(new ArrayList<>());
} else {
List<TerminalPhotoListModel.PhotoBean> beans = new ArrayList<>();
Map<Integer, TerminalChannels> termchannelMap = XyCache.termchannelMap;
Map<String, TerminalChannelMapper> termchannelMapMap = XyCache.termchannelMapMap;
for (TerminalPhoto item : list) {
Integer mediaType = item.getMediaType();
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.setChannelName(termchannelMap.get(channelId).getChannelName());
photoBean.setChannelName(cacheService.getTermchannelMap(channelId).getChannelName());
TerminalChannelMapper termchannelMapMap = cacheService.getTermchannelMapMap(termId, channelId);
if (termchannelMapMap != null) {
TerminalChannelMapper terminalChannelMapper = termchannelMapMap.get(termId + "#" + channelId);
if (terminalChannelMapper != null) {
photoBean.setAlias(terminalChannelMapper.getAlias());
} else {
photoBean.setAlias("");
}
photoBean.setAlias(termchannelMapMap.getAlias());
} else {
photoBean.setAlias("");
}
@ -203,12 +200,10 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
}
}
if (channelid == null || channelid.intValue() == 0) {
} else {
channelidlist.add(channelid);
}
if (termidlist.size() == 0) {
} else {
PageUtils.SetPage(pageindex, pagesize);
list = terminalPhotoDao.selectPhotoListByTermList(termidlist, channelidlist, BigInteger.valueOf(start), BigInteger.valueOf(end));
@ -219,25 +214,26 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
if (empty) {
model.setList(new ArrayList<>());
} 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) {
TerminalPhotoSelectListModel.PhotoBean photoBean = new TerminalPhotoSelectListModel.PhotoBean();
photoBean.setTermid(item.getTermId());
Terminals terminals = terminalMap.get(item.getTermId());
Terminals terminals = cacheService.getTerminal(item.getTermId());
if (!BeanUtil.isEmpty(terminals)) {
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());
Lines line = cacheService.getLine(terminals.getLineid());
if (BeanUtil.isNotEmpty(line)) {
photoBean.setLinename(line.getName());
} else {
photoBean.setLinename("");
}
photoBean.setChannelid(item.getChannelId());
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.setOrginalid(item.getOrginalId());
if (mediaType.intValue() == 0) {
@ -295,10 +291,16 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
pagesize = 10;
}
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;
if (starttime != null) {
start = MyDateUtils.TimeMillSecond2Second(DateTime.of(starttime));
if (startDate != null) {
start = MyDateUtils.TimeMillSecond2Second(DateTime.of(startDate));
}
Date endtime = MyDateUtils.myparseDate(vo.getEndTime());
long end = 0;
@ -333,7 +335,7 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
}
photoBean.setPresetId(item.getPresetId());
long phototime = MyDateUtils.TimeSecond2MillSecond(item.getPhotoTime().longValue());
photoBean.setPhotoTime(MyDateUtils.date(phototime));
photoBean.setPhotoTime(MyDateUtils.formatDateTime(MyDateUtils.date(phototime)));
beans.add(photoBean);
}
}
@ -356,8 +358,7 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
public ServiceBody<Date> getLatestPhoto(TerminalPhotoVo vo) {
Integer termId = vo.getTermId();
DateTime now = DateTime.now();
Map<Integer, Terminals> terminalMap = XyCache.terminalMap;
Terminals terminals = terminalMap.get(termId);
Terminals terminals = cacheService.getTerminal(termId);
String cmdid = null;
if (terminals != null) {
cmdid = terminals.getCmdid();
@ -501,11 +502,6 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
for (TerminalChannelMapper item : list) {
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);
for (TerminalChannelMapper item : list) {
@ -515,7 +511,7 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
BigInteger photoId = item.getPhotoId();
Integer lineid = null;
photosBean.setTermid(termid);
Terminals terminals = terminalMap.get(termid);
Terminals terminals = cacheService.getTerminal(termid);
if (terminals != null) {
lineid = terminals.getLineid();
photosBean.setLineid(lineid);
@ -523,22 +519,18 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
photosBean.setCmdid(terminals.getCmdid());
}
photosBean.setChannelid(channelid);
photosBean.setChannnelname(termchannelMap.get(channelid).getChannelName());
photosBean.setChannnelname(cacheService.getTermchannelMap(channelid).getChannelName());
TerminalChannelMapper termchannelMapMap = cacheService.getTermchannelMapMap(termid, channelid);
if (termchannelMapMap != null) {
TerminalChannelMapper terminalChannelMapper = termchannelMapMap.get(termid + "#" + channelid);
if (terminalChannelMapper != null) {
photosBean.setAlias(terminalChannelMapper.getAlias());
} else {
photosBean.setAlias("");
}
photosBean.setAlias(termchannelMapMap.getAlias());
} else {
photosBean.setAlias("");
}
if (lineid != null) {
LineAndDyNameDto lineAndDyNameDto = lineMap.get(lineid);
if (lineAndDyNameDto != null) {
photosBean.setLinename(lineAndDyNameDto.getName());
Lines line = cacheService.getLine(lineid);
if (line != null) {
photosBean.setLinename(line.getName());
} else {
photosBean.setLinename("");
}
@ -686,25 +678,26 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
if (empty) {
model.setList(new ArrayList<>());
} 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) {
TerminalPhotoSelectListModel.PhotoBean photoBean = new TerminalPhotoSelectListModel.PhotoBean();
photoBean.setTermid(item.getTermId());
Terminals terminals = terminalMap.get(item.getTermId());
Terminals terminals = cacheService.getTerminal(item.getTermId());
if (!BeanUtil.isEmpty(terminals)) {
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());
Lines line = cacheService.getLine(terminals.getLineid());
if (BeanUtil.isNotEmpty(line)) {
photoBean.setLinename(line.getName());
} else {
photoBean.setLinename("");
}
photoBean.setChannelid(item.getChannelId());
photoBean.setCmdid(terminals.getCmdid());
photoBean.setChannnelname(termchannelMap.get(item.getChannelId()).getChannelName());
photoBean.setAlias(termchannelMapMap.get(item.getTermId() + "#" + item.getChannelId()).getAlias());
photoBean.setChannnelname(cacheService.getTermchannelMap(item.getChannelId()).getChannelName());
TerminalChannelMapper termchannelMapMap = cacheService.getTermchannelMapMap(item.getTermId(), item.getChannelId());
photoBean.setAlias(termchannelMapMap.getAlias());
photoBean.setMediaType(item.getMediaType());
photoBean.setOrginalid(item.getOrginalId());
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.TerminalInfoDto;
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.TerminalStatus;
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_dao.dao.*;
import com.shxy.xymanager_service.cache.XyCache;
import com.shxy.xymanager_service.service.CacheService;
import com.shxy.xymanager_service.service.TerminalService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
@ -68,6 +70,9 @@ public class TerminalServiceImpl implements TerminalService {
@Autowired
TerminalStatusDao terminalStatusDao;
@Autowired
CacheService cacheService;
@Value("${photo.address}")
private String photoaddress;
@ -379,13 +384,17 @@ public class TerminalServiceImpl implements TerminalService {
@Override
public ServiceBody<PhotoMarkModel> getCoordinate(String requestIp, MarkReqVo vo) {
Map<String, String> globalParams = XyCache.globalParams;
String s = globalParams.get(GloableParamsType.ImgMark.value());
GlobalParams globalParams = cacheService.getGlobalParams(GloableParamsType.ImgMark.value());
Integer integer = null;
if (StrUtil.isEmpty(s)) {
if (globalParams == null) {
integer = 0;
} else {
integer = Integer.valueOf(s);
String s = globalParams.getParamValue();
if (StrUtil.isEmpty(s)) {
integer = 0;
} else {
integer = Integer.valueOf(s);
}
}
PhotoMarkModel model = new PhotoMarkModel();
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.vo.*;
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 lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
@ -30,6 +30,7 @@ import java.util.List;
*
* @author
*/
@Slf4j
@Service
public class TowerServiceImpl implements TowerService {
@ -37,6 +38,9 @@ public class TowerServiceImpl implements TowerService {
@Autowired
private TowerDao towerDao;
@Autowired
private CacheService cacheService;
@Override
public ServiceBody addTower(TowersVo vo) {
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();
model.setTotalpage(pages);
return Asserts.success(model);
}
@Override
public ServiceBody<String> deleteTower(TowerIdVo vo) {
List<Towers> lines = BeanUtil.copyToList(vo.getList(), Towers.class);
Date date = new Date();
int i = towerDao.deleteById(lines, CommonStatus.DELETE.value(), date);
Integer i = cacheService.deleteTower(lines);
if (i != 0) {
return Asserts.success("删除成功");
} 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