缓存优化和查询优化

master
liuguijing 2 years ago
parent fb21540494
commit e1add5849e

@ -123,7 +123,7 @@ public class TerminalController extends BaseController {
@ApiOperation(value = "获取装置触发", notes = "获取装置信息接口", httpMethod = "POST")
@ApiResponses({@ApiResponse(code = 200, message = "请求成功"), @ApiResponse(code = 400, message = "请求参数没填好"), @ApiResponse(code = 404, message = "请求路径没有或页面跳转路径不对")})
@RequestMapping("/getTerminalStatus")
@Log(title = "获取装置触发", type = "修改")
@Log(title = "获取装置触发", type = "查询")
public ResponseReult<TerminalStatusModel> getTerminalStatus(@RequestParam("termId") Integer termId) {
ServiceBody<TerminalStatusModel> serviceBody = terminalService.getTerminalStatus(termId);
if (serviceBody.getCode() == ServiceStatus.SUCCESS) {
@ -137,8 +137,8 @@ public class TerminalController extends BaseController {
@ApiResponses({@ApiResponse(code = 200, message = "请求成功"), @ApiResponse(code = 400, message = "请求参数没填好"), @ApiResponse(code = 404, message = "请求路径没有或页面跳转路径不对")})
@RequestMapping("/getLastedTerminalStatus")
@Log(title = "获取最新装置运行状态", type = "修改")
public ResponseReult<TerminalModel> getLastedTerminalStatus(@RequestBody @Validated TerminalStatusVo vo) {
ServiceBody<TerminalModel> serviceBody = terminalService.getLastedTerminalStatus(vo);
public ResponseReult<TerminalStatusInfoModel> getLastedTerminalStatus(@RequestBody @Validated TerminalStatusVo vo) {
ServiceBody<TerminalStatusInfoModel> serviceBody = terminalService.getLastedTerminalStatus(vo);
if (serviceBody.getCode() == ServiceStatus.SUCCESS) {
return ResponseReult.success(serviceBody.getData());
} else {
@ -211,5 +211,17 @@ public class TerminalController extends BaseController {
}
}
@ApiOperation(value = "获取装置数据库信息", notes = "获取装置数据库信息", httpMethod = "POST")
@ApiResponses({@ApiResponse(code = 200, message = "请求成功"), @ApiResponse(code = 400, message = "请求参数没填好"), @ApiResponse(code = 404, message = "请求路径没有或页面跳转路径不对")})
@RequestMapping("/getLastTermInfo")
@Log(title = "获取装置数据库信息", type = "查询")
public ResponseReult<TerminalStatusInfoModel> getLastTermInfo(@RequestParam("termId") @Validated Integer termId) {
ServiceBody<TerminalStatusInfoModel> serviceBody = terminalService.getLastTermInfo(termId);
if (serviceBody.getCode() == ServiceStatus.SUCCESS) {
return ResponseReult.success(serviceBody.getData());
} else {
return ResponseReult.error(serviceBody.getCode(), serviceBody.getMsg());
}
}
}

@ -19,6 +19,7 @@ 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;
@ -70,4 +71,17 @@ public class TerminalGPSController extends BaseController {
}
}
@ApiOperation(value = "获取数据库GPS位置数据", notes = "获取数据库GPS位置数据", httpMethod = "POST")
@ApiResponses({@ApiResponse(code = 200, message = "请求成功"), @ApiResponse(code = 400, message = "请求参数没填好"), @ApiResponse(code = 404, message = "请求路径没有或页面跳转路径不对")})
@RequestMapping("/getTermLastGPSPosition")
@Log(title = "获取数据库GPS位置数据", type = "查询")
public ResponseReult<TerminalGpsModel> getTermLastGPSPosition(@RequestParam("termId") @Validated Integer termId) {
ServiceBody<TerminalGpsModel> serviceBody = terminalGpsService.getTermLastGPSPosition(termId);
if (serviceBody.getCode() == ServiceStatus.SUCCESS) {
return ResponseReult.success(serviceBody.getData());
} else {
return ResponseReult.error(serviceBody.getCode(), serviceBody.getMsg());
}
}
}

@ -12,7 +12,11 @@ public class TerminalStatus implements Serializable {
private BigInteger lastHeartbeat;
private Short lastFrameNo;
private String lastHeartbeatIp;
private Integer lastHeartbeatPort;
private Integer lastFrameNo;
private Float batteryVoltage;
@ -30,6 +34,10 @@ public class TerminalStatus implements Serializable {
private Integer connectionState;
private BigInteger sendFlow;
private BigInteger recvFlow;
private Integer signalStrength4g;
private Integer signalStrength2g;
@ -38,6 +46,8 @@ public class TerminalStatus implements Serializable {
private Integer remainingRom;
private BigInteger wsUpdateTime;
private BigInteger bootTime;
private BigInteger updateTime;

@ -1,36 +1,33 @@
package com.shxy.xymanager_common.model;
import cn.hutool.core.date.DateTime;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.math.BigInteger;
import java.util.Date;
import java.util.List;
/**
*
*
*/
@Data
@ApiModel(value = "获取设备状态信息", description = "获取设备状态信息")
public class TerminalModel implements Serializable {
@ApiModel(value = "设备状态信息", description = "设备状态信息")
public class TerminalStatusInfoModel implements Serializable {
@ApiModelProperty(value = "装置编号", example = "123456")
private Integer termId;
@ApiModelProperty(value = "电池电量", example = "123456")
private Integer batteryCapacity;
private Float batteryCapacity;
@ApiModelProperty(value = "电池电压", example = "123456")
private Integer batteryVoltage;
private Float batteryVoltage;
@ApiModelProperty(value = "本次连续工作时间(小时)", example = "12345678")
private Integer workingTime;
@ApiModelProperty(value = "浮充状态:充电 放电", example = "12345678")
private Integer floatingCharge;
private Byte floatingCharge;
@ApiModelProperty(value = "工作总时间(小时)", example = "名称名称")
private Integer totalWorkingTime;

@ -1,6 +1,5 @@
package com.shxy.xymanager_common.vo;
import cn.hutool.core.date.DateTime;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ -12,7 +11,7 @@ import javax.validation.constraints.NotNull;
public class ReturnedPhotoParamsGetVo {
@NotNull(message = "不能传入空值")
@ApiModelProperty(value = "监测装置id", required = true, example = "A0001")
private String cmdId;
private Integer termId;
@ApiModelProperty(value = "通道ID", required = true, example = "A0001")

@ -18,11 +18,11 @@ public class TerminalChannelVo {
@Data
public static class ChannelItem {
@NotNull(message = "通道编号")
@ApiModelProperty(value = "装置编号", example = "123455")
@ApiModelProperty(value = "通道编号", example = "123455")
private Integer id;
@NotNull(message = "通道编号不能缺少")
@ApiModelProperty(value = "通道编号", example = "123455")
@NotNull(message = "通道名称不能缺少")
@ApiModelProperty(value = "通道名称", example = "123455")
private String channelname;
@ApiModelProperty(value = "分辨率W", example = "123456")

@ -1,6 +1,5 @@
package com.shxy.xymanager_common.vo;
import cn.hutool.core.date.DateTime;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

@ -6,6 +6,4 @@ import java.math.BigInteger;
public interface TerminalPositionsDao {
TerminalPositions selectByPrimaryKey(Integer termId);
BigInteger getUpdateTime(Integer termId);
}

@ -1,5 +1,6 @@
package com.shxy.xymanager_dao.dao;
import com.shxy.xymanager_common.dto.TerminalInfoDto;
import com.shxy.xymanager_common.dto.TerminalsWithHeart;
import com.shxy.xymanager_common.entity.TerminalStatus;
import org.apache.ibatis.annotations.Param;

@ -42,8 +42,6 @@ public interface TerminalsDao {
String getCmdIdByTermId(Integer termId);
TerminalInfoDto getTerminalInfo(@Param("termId") Integer termId);
BigInteger getUpdateTime(@Param("termId") Integer termId);
int updateCmd(TerminalIdUpdateVo vo);

@ -19,10 +19,4 @@
where term_id = #{termId,jdbcType=INTEGER}
</select>
<select id="getUpdateTime" resultType="java.math.BigInteger">
select
update_time updateTime
from terminal_positions
where term_id = #{termId,jdbcType=INTEGER}
</select>
</mapper>

@ -4,6 +4,8 @@
<resultMap id="BaseResultMap" type="com.shxy.xymanager_common.entity.TerminalStatus">
<id column="term_id" jdbcType="INTEGER" property="termId"/>
<result column="last_heartbeat" jdbcType="BIGINT" property="lastHeartbeat"/>
<result column="last_heartbeat_ip" jdbcType="VARCHAR" property="lastHeartbeatIp"/>
<result column="last_heartbeat_port" jdbcType="SMALLINT" property="lastHeartbeatPort"/>
<result column="last_frame_no" jdbcType="SMALLINT" property="lastFrameNo"/>
<result column="battery_voltage" jdbcType="REAL" property="batteryVoltage"/>
<result column="op_temperature" jdbcType="REAL" property="opTemperature"/>
@ -11,14 +13,17 @@
<result column="floating_charge" jdbcType="TINYINT" property="floatingCharge"/>
<result column="total_working_time" jdbcType="INTEGER" property="totalWorkingTime"/>
<result column="working_time" jdbcType="INTEGER" property="workingTime"/>
<result column="gps_status" jdbcType="INTEGER" property="gpsStatus"/>
<result column="connection_state" jdbcType="TINYINT" property="connectionState"/>
<result column="signal_strength_4g" jdbcType="TINYINT" property="signalStrength4g"/>
<result column="signal_strength_2g" jdbcType="TINYINT" property="signalStrength2g"/>
<result column="send_flow" jdbcType="BIGINT" property="sendFlow"/>
<result column="recv_flow" jdbcType="BIGINT" property="recvFlow"/>
<result column="ws_update_time" jdbcType="BIGINT" property="wsUpdateTime"/>
<result column="remaining_ram" jdbcType="TINYINT" property="remainingRam"/>
<result column="remaining_rom" jdbcType="TINYINT" property="remainingRom"/>
<result column="boot_time" jdbcType="BIGINT" property="bootTime"/>
<result column="rs_update_time" jdbcType="BIGINT" property="updateTime"/>
<result column="gps_status" jdbcType="INTEGER" property="gpsStatus"/>
</resultMap>
<resultMap id="heartResultMap" type="com.shxy.xymanager_common.dto.TerminalsWithHeart">
@ -31,9 +36,9 @@
<result column="last_heartbeat" jdbcType="BIGINT" property="lastheartbeat"/>
</resultMap>
<sql id="Base_Column_List">
term_id, last_heartbeat, last_frame_no, battery_voltage, op_temperature, battery_capacity,
floating_charge, total_working_time, working_time, gps_status,connection_state, signal_strength_4g,
signal_strength_2g, remaining_ram, remaining_rom, boot_time, rs_update_time
term_id, last_heartbeat,last_heartbeat_ip,last_heartbeat_port, last_frame_no, battery_voltage, op_temperature, battery_capacity,
floating_charge, total_working_time, working_time,connection_state, signal_strength_4g,
signal_strength_2g,send_flow, recv_flow,ws_update_time,remaining_ram, remaining_rom, boot_time, rs_update_time, gps_status
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select
@ -62,6 +67,14 @@
from terminal_status
</select>
<select id="selectTerminalInfo" resultType="com.shxy.xymanager_common.dto.TerminalInfoDto">
select
ts.term_id termId, ts.battery_voltage batteryVoltage, ts.battery_capacity batteryCapacity, ts.floating_charge floatingCharge, ts.total_working_time totalWorkingTime,
ts.working_time workingTime, ts.connection_state connectionState, ts.ws_update_time wsUpdateTime,t.cmdid cmId
from terminal_status ts left join terminals t on ts.term_id = t.id
where ts.term_id = #{termId,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
delete from terminal_status
where term_id = #{termId,jdbcType=INTEGER}

@ -165,7 +165,7 @@
</if>
</where>
order by a.create_time desc
order by d.create_time desc
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
@ -489,14 +489,6 @@
where id = #{id,jdbcType=INTEGER}
</update>
<select id="getTerminalInfo" resultType="com.shxy.xymanager_common.dto.TerminalInfoDto">
select
ts.term_id termId, ts.battery_voltage batteryVoltage, ts.battery_capacity batteryCapacity, ts.floating_charge floatingCharge, ts.total_working_time totalWorkingTime,
ts.working_time workingTime, ts.connection_state connectionState, ts.ws_update_time wsUpdateTime,t.cmdid cmId
from terminal_status ts left join terminals t on ts.term_id = t.id
where ts.term_id = #{termId,jdbcType=INTEGER}
</select>
<select id="getCmdIdByTermId" resultType="java.lang.String">
select
cmdid

@ -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;
@ -42,13 +43,18 @@ public class LineServiceImpl implements LineService {
@Autowired
private DyLevelDao dyLevelDao;
@Autowired
private TowerDao towerDao;
@Autowired
private TerminalsDao terminalsDao;
@Autowired
private TerminalChannelsDao terminalChannelsDao;
@Autowired
private CacheService cacheService;
/**
* 线
@ -96,6 +102,7 @@ public class LineServiceImpl implements LineService {
Date date = new Date();
int i = linesDao.insertList(lines, CommonStatus.EFFECTIVE.value(), date, date);
if (i != 0) {
cacheService.updateLineMap();
return Asserts.success("录入成功");
} else {
return Asserts.error("录入失败");
@ -114,6 +121,7 @@ public class LineServiceImpl implements LineService {
Date date = new Date();
int i = linesDao.deleteById(lines, CommonStatus.DELETE.value(), date);
if (i != 0) {
cacheService.updateLineMap();
return Asserts.success("删除成功");
} else {
return Asserts.error("删除失败");
@ -133,6 +141,7 @@ public class LineServiceImpl implements LineService {
BeanUtil.copyProperties(vo, lines, true);
int i = linesDao.updateByPrimaryKeySelective(lines, new Date());
if (i != 0) {
cacheService.updateLineMap();
return Asserts.success("修改成功");
} else {
return Asserts.error("修改失败");

@ -66,8 +66,6 @@ public class TerminalChannelServiceImpl implements TerminalChannelService {
return Asserts.error("通道重复");
}
int i = terminalChannelsDao.insertList(list, CommonStatus.EFFECTIVE.value(), date, date);
if (i != 0) {
return Asserts.success("录入成功");
} else {
@ -83,10 +81,10 @@ public class TerminalChannelServiceImpl implements TerminalChannelService {
*/
@Override
public ServiceBody<String> updateChannelList(UpdateTerminalChannelVo vo) {
int count = terminalChannelsDao.selectChannelCountById(vo);
if(count>0){
return Asserts.success("通道重复");
}
// int count = terminalChannelsDao.selectChannelCountById(vo);
// if(count>0){
// return Asserts.success("通道重复");
// }
TerminalChannels bean = new TerminalChannels();
BeanUtil.copyProperties(vo, bean, CopyOptions.create().ignoreCase());
int i = terminalChannelsDao.updateByPrimaryKeySelective(bean, new Date());

@ -47,16 +47,12 @@ import java.util.List;
@Service
public class TerminalGpsServiceImpl implements TerminalGpsService {
@Autowired
private TerminalStatusDao terminalStatusDao;
@Autowired
private TerminalPositionsDao terminalPositionsDao;
@Autowired
TerminalPhotoDao terminalPhotoDao;
// @Autowired
// private Cma cma;
/**
@ -123,5 +119,28 @@ public class TerminalGpsServiceImpl implements TerminalGpsService {
return Asserts.success(now);
}
@Override
public ServiceBody<TerminalGpsModel> getTermLastGPSPosition(Integer termid) {
TerminalGpsModel model = new TerminalGpsModel();
TerminalPositions bean = terminalPositionsDao.selectByPrimaryKey(termid);
if (BeanUtil.isEmpty(bean)) {
model.setTermid(termid);
model.setLatitude(0);
model.setLongitude(0);
model.setRadius(0);
model.setUpdatetime(new Date());
} else {
model.setTermid(termid);
model.setLatitude(bean.getLatitude());
model.setLongitude(bean.getLongitude());
model.setRadius(bean.getRadius());
Long updateTime = bean.getUpdateTime();
long l = MyDateUtils.TimeSecond2MillSecond(updateTime);
model.setUpdatetime(MyDateUtils.date(l));
}
return Asserts.success(model);
}
}

@ -578,9 +578,12 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
@Override
public ServiceBody<GetModel> getPhotoQueryParam(ReturnedPhotoParamsGetVo vo) {
Map<Integer, Terminals> terminalMap = cacheService.getTerminalMap();
Terminals terminals = terminalMap.get(vo.getTermId());
String cmdid = terminals.getCmdid();
GetModel model = new GetModel();
int requestId = Constants.REQUEST_ID.addAndGet(1);
String cmd = Constants.CMD + "imgparams --cmdid=" + vo.getCmdId() + " --clientid=10 --reqid=" + requestId + " --flag=0 --rf=7 --channel=" + vo.getChannelId();
String cmd = Constants.CMD + "imgparams --cmdid=" + cmdid + " --clientid=10 --reqid=" + requestId + " --flag=0 --rf=7 --channel=" + vo.getChannelId();
ProcessExecUtils.exec(cmd);
model.setRequestId(requestId);
/*

@ -24,16 +24,16 @@ import com.shxy.xymanager_common.util.StringUtils;
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;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import cn.hutool.core.date.DateUnit;
import javax.validation.constraints.NotNull;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Date;
@ -146,7 +146,7 @@ public class TerminalServiceImpl implements TerminalService {
for (TermChannelAndMapperDto dto : channellist) {
TerminalListModel.ChannelBeans e = new TerminalListModel.ChannelBeans();
e.setAlias(dto.getAlias());
e.setId(dto.getId());
e.setId(dto.getChannelid());
e.setName(dto.getChannelname());
list.add(e);
}
@ -201,7 +201,11 @@ public class TerminalServiceImpl implements TerminalService {
}
Date date = new Date();
int i1 = terminalChannelMapperDao.insertList(list, date, date);
}
cacheService.updateTerminalMap();
cacheService.updateTermAndChannelMap();
cacheService.updateTermChannelMapMap();
if (i != 0) {
return Asserts.success("录入成功");
} else {
@ -235,6 +239,9 @@ public class TerminalServiceImpl implements TerminalService {
Date date = new Date();
terminalChannelMapperDao.insertList(list, date, date);
}
cacheService.updateTerminalMap();
cacheService.updateTermAndChannelMap();
cacheService.updateTermChannelMapMap();
if (i != 0) {
return Asserts.success("修改成功");
} else {
@ -258,6 +265,7 @@ public class TerminalServiceImpl implements TerminalService {
list.add(terminals);
}
int i = terminalsDao.deleteById(list, CommonStatus.DELETE.value(), new Date());
cacheService.updateTerminalMap();
if (i != 0) {
return Asserts.success("删除成功");
} else {
@ -307,29 +315,31 @@ public class TerminalServiceImpl implements TerminalService {
}
@Override
public ServiceBody<TerminalModel> getLastedTerminalStatus(TerminalStatusVo vo) {
/* String result = terminalPhotoDao.getRequestResult(5);//待修改
TerminalModel model = new TerminalModel();
if (StringUtils.isNotBlank(result)) {
model = JSONObject.parseObject(result, TerminalModel.class);
model.setIsNew(true);
} else {*/
TerminalModel model = new TerminalModel();
TerminalInfoDto dto = terminalsDao.getTerminalInfo(vo.getTermId());
public ServiceBody<TerminalStatusInfoModel> getLastedTerminalStatus(TerminalStatusVo vo) {
TerminalStatusInfoModel model = new TerminalStatusInfoModel();
Integer termId = vo.getTermId();
TerminalStatus bean = terminalStatusDao.selectByPrimaryKey(termId);
Boolean hasNew = false;
if (null != dto) {
BeanUtils.copyProperties(dto, model);
BigInteger wsUpdateTime = dto.getWsUpdateTime();
if (BeanUtil.isNotEmpty(bean)) {
Map<Integer, Terminals> terminalMap = cacheService.getTerminalMap();
Terminals terminals = terminalMap.get(termId);
if (BeanUtil.isNotEmpty(terminals)) {
model.setCmId(terminals.getCmdid());
}
model.setBatteryCapacity(bean.getBatteryCapacity());
model.setBatteryVoltage(bean.getBatteryVoltage());
model.setConnectionState(bean.getConnectionState());
model.setFloatingCharge(bean.getFloatingCharge());
model.setTermId(termId);
model.setTotalWorkingTime(bean.getTotalWorkingTime());
model.setWorkingTime(bean.getWorkingTime());
model.setWsUpdateTime(bean.getWsUpdateTime());
BigInteger wsUpdateTime = bean.getWsUpdateTime();
long queryTime = MyDateUtils.TimeMillSecond2Second(vo.getQueryTime());
hasNew = wsUpdateTime.longValue() < queryTime ? false : true;
}
model.setIsNew(hasNew);
/* if (dto != null) {
BeanUtils.copyProperties(dto, model);
}
model.setWsUpdateTime(MyDateUtils.TimeSecond2MillSecond(dto.getWsUpdateTime().longValue()));
}*/
return Asserts.success(model);
}
@ -342,9 +352,9 @@ public class TerminalServiceImpl implements TerminalService {
int result = terminalsDao.updateCmd(vo);
if (result > 0) {
cacheService.updateTerminalMap();
return Asserts.success(model);
}
return Asserts.error("装置ID修改失败");
}
@ -471,5 +481,33 @@ public class TerminalServiceImpl implements TerminalService {
return Asserts.success(model);
}
/**
*
*
* @param termId
* @return
*/
@Override
public ServiceBody<TerminalStatusInfoModel> getLastTermInfo(Integer termId) {
TerminalStatusInfoModel model = new TerminalStatusInfoModel();
TerminalStatus bean = terminalStatusDao.selectByPrimaryKey(termId);
if (!BeanUtil.isEmpty(bean)) {
Map<Integer, Terminals> terminalMap = cacheService.getTerminalMap();
Terminals terminals = terminalMap.get(termId);
if (BeanUtil.isNotEmpty(terminals)) {
model.setCmId(terminals.getCmdid());
}
model.setBatteryCapacity(bean.getBatteryCapacity());
model.setBatteryVoltage(bean.getBatteryVoltage());
model.setConnectionState(bean.getConnectionState());
model.setFloatingCharge(bean.getFloatingCharge());
model.setTermId(termId);
model.setTotalWorkingTime(bean.getTotalWorkingTime());
model.setWorkingTime(bean.getWorkingTime());
model.setWsUpdateTime(bean.getWsUpdateTime());
}
return Asserts.success(model);
}
}

@ -15,6 +15,7 @@ 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;
@ -37,12 +38,16 @@ 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());
Date date = new Date();
int i = towerDao.addTower(towersLst,CommonStatus.EFFECTIVE.value(), date);
if (i != 0) {
cacheService.updateTowerMap();
return Asserts.success("录入成功");
} else {
return Asserts.error("录入失败");
@ -84,6 +89,7 @@ public class TowerServiceImpl implements TowerService {
Date date = new Date();
int i = towerDao.deleteById(lines, CommonStatus.DELETE.value(), date);
if (i != 0) {
cacheService.updateTowerMap();
return Asserts.success("删除成功");
} else {
return Asserts.error("删除失败");
@ -96,6 +102,7 @@ public class TowerServiceImpl implements TowerService {
BeanUtil.copyProperties(vo, towers, true);
int i = towerDao.updateByPrimaryKeySelective(towers, new Date());
if (i != 0) {
cacheService.updateTowerMap();
return Asserts.success("修改成功");
} else {
return Asserts.error("修改失败");

@ -31,4 +31,10 @@ public interface TerminalGpsService {
ServiceBody<DateTime> getReturnedGPS(TerminalGpsVo vo);
/**
* gps
* @param termId
* @return
*/
ServiceBody<TerminalGpsModel> getTermLastGPSPosition( Integer termId);
}

@ -51,7 +51,7 @@ public interface TerminalService {
ServiceBody<TerminalStatusModel> getTerminalStatus(Integer termId);
ServiceBody<TerminalModel> getLastedTerminalStatus(TerminalStatusVo vo);
ServiceBody<TerminalStatusInfoModel> getLastedTerminalStatus(TerminalStatusVo vo);
/**
* ID
@ -92,9 +92,17 @@ public interface TerminalService {
/**
* 线
*
* @param termId
* @return
*/
ServiceBody<TermStatusModel> getTermStatus(Integer termId);
/**
*
*
* @param termId
* @return
*/
ServiceBody<TerminalStatusInfoModel> getLastTermInfo(Integer termId);
}

Loading…
Cancel
Save