图片轮询和装置导出修改

dev
liuguijing 2 years ago
parent 7e28d3ceb7
commit b48d21ae83

@ -17,6 +17,7 @@ import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpHeaders;
import org.springframework.validation.annotation.Validated;
@ -257,8 +258,8 @@ public class TerminalController extends BaseController {
@ApiResponses({@ApiResponse(code = 200, message = "请求成功"), @ApiResponse(code = 400, message = "请求参数没填好"), @ApiResponse(code = 404, message = "请求路径没有或页面跳转路径不对")})
@RequestMapping("/getOnlineTerminalList")
@Log(title = "获取设备列表", type = "查询")
public ResponseReult<List<TerminalAndLastPicListExcelModel>> getOnlineTerminalList() {
ServiceBody<List<TerminalAndLastPicListExcelModel>> serviceBody = terminalService.getOnlineTerminalList();
public ResponseReult<List<TerminalAndLastPicListExcelModel>> getOnlineTerminalList(@Param("type") Integer type) {
ServiceBody<List<TerminalAndLastPicListExcelModel>> serviceBody = terminalService.getOnlineTerminalList(type);
if (serviceBody.getCode() == ServiceStatus.SUCCESS) {
return ResponseReult.success(serviceBody.getData());
} else {
@ -270,8 +271,8 @@ public class TerminalController extends BaseController {
@ApiResponses({@ApiResponse(code = 200, message = "请求成功"), @ApiResponse(code = 400, message = "请求参数没填好"), @ApiResponse(code = 404, message = "请求路径没有或页面跳转路径不对")})
@RequestMapping("/getOnlineTerminalListExcel")
@Log(title = "导出设备在线和心跳时间和照片时间列表Excel", type = "查询")
public void getOnlineTerminalListExcel(HttpServletResponse response) throws IOException {
ServiceBody<List<TerminalAndLastPicListExcelModel>> serviceBody = terminalService.getOnlineTerminalList();
public void getOnlineTerminalListExcel(HttpServletResponse response,@Param("type") Integer type) throws IOException {
ServiceBody<List<TerminalAndLastPicListExcelModel>> serviceBody = terminalService.getOnlineTerminalList(type);
EasyExcelUtil.createExcel(response,"设备在线表",serviceBody.getData(), TerminalAndLastPicListExcelModel.class);
}

@ -29,6 +29,12 @@ public class TerminalsAndStatusAndLastPicDto implements Serializable {
private BigInteger lastHeartbeat;
private Double latitude;
private Double longitude;
private Integer radius;
private List<LastPicTimeDto> list;
private static final long serialVersionUID = 1L;

@ -45,4 +45,19 @@ public class TerminalAndLastPicListExcelModel implements Serializable {
@ApiModelProperty(value = "最新照片上传时间", example = "123456")
private String pictime;
@ColumnWidth(20)
@ExcelProperty("纬度")
@ApiModelProperty(value = "纬度", example = "21321")
private Double latitude;
@ColumnWidth(20)
@ExcelProperty("经度")
@ApiModelProperty(value = "经度", example = "213")
private Double longitude;
@ColumnWidth(20)
@ExcelProperty("半径")
@ApiModelProperty(value = "经度", example = "123456")
private Integer radius;
}

@ -76,7 +76,6 @@ public class TerminalUtils {
/**
*
*
*/
public static BigInteger generateOnlineTime() {
DateTime offset = MyDateUtils.offset(new Date(), DateField.MINUTE, -hearttime);
@ -177,7 +176,7 @@ public class TerminalUtils {
for (int y = 0; y < photoList.size(); y++) {
TerminalPhoto terminalPhoto = photoList.get(y);
if (BeanUtil.isNotEmpty(terminalPhoto)) {
if (terminalPhoto.getId() != null) {
if (terminalPhoto.getId() != null && photoId != null) {
if (terminalPhoto.getId().longValue() == photoId.longValue()) {
Integer mediatype = terminalPhoto.getMediaType();
if (mediatype != null && (mediatype.intValue() == 0 || mediatype.intValue() == 1)) {

@ -26,7 +26,8 @@ public interface TerminalChannelMapperDao {
List<TerminalChannelMapper> selectAll();
List<TerminalChannelMapper> selectAllByPhotoTime(@Param("time") BigInteger time);
// List<TerminalChannelMapper> selectAllByPhotoTime(@Param("time") BigInteger time);
List<TerminalChannelMapper> selectAllByPhotoTime(@Param("status") Integer status);
int updateByPrimaryKeySelective(TerminalChannelMapper record);

@ -35,13 +35,21 @@
</select>
<select id="selectAllByPhotoTime" resultMap="BaseResultMap">
<!-- select-->
<!-- from terminal_channel_mapper-->
<!-- <if test="time != null">-->
<!-- where photo_time > #{time}-->
<!-- </if>-->
<!-- group by term_id,channel_id-->
select
<include refid="Base_Column_List"/>
from terminal_channel_mapper
<if test="time != null">
where photo_time > #{time}
</if>
group by term_id,channel_id
a.id as term_id,
b.channel_id as channel_id,
b.photo_id as photo_id,
b.photo_time as photo_time,
b.alias as alias
from (terminals a left join
terminal_channel_mapper b on a.id = b.term_id)
where a.status = #{status}
</select>
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
select

@ -84,6 +84,9 @@
<result column="battery_capacity" jdbcType="REAL" property="batteryCapacity"/>
<result column="battery_voltage" jdbcType="REAL" property="batteryVoltage"/>
<result column="last_heartbeat" jdbcType="BIGINT" property="lastHeartbeat"/>
<result column="latitude" jdbcType="DOUBLE" property="latitude"/>
<result column="longitude" jdbcType="DOUBLE" property="longitude"/>
<result column="radius" jdbcType="INTEGER" property="radius"/>
<collection property="list" javaType="list" ofType="com.shxy.xymanager_common.dto.LastPicTimeDto">
<result column="photo_time" jdbcType="BIGINT" property="photoTime"/>
</collection>
@ -237,6 +240,9 @@
a.tower_id as tower_id,
a.cmdid as cmdid,
a.display_name as display_name,
d.latitude as latitude,
d.longitude as longitude,
d.radius as radius,
a.status as status,
b.last_heartbeat as last_heartbeat,
b.signal_strength_4g as signal_strength_4g,
@ -244,7 +250,7 @@
b.battery_capacity as battery_capacity,
b.battery_voltage as battery_voltage,
c.photo_time as photo_time
from ((terminals a left join terminal_status b on b.term_id = a.id)
from (((terminals a left join terminal_status b on b.term_id = a.id)left join terminal_positions d on a.id = d.term_id)
left join terminal_channel_mapper c on a.id = c.term_id)
<where>
true

@ -474,9 +474,10 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
int pagesize = vo.getPagesize();
PageUtils.SetPage(pageindex, pagesize);
DateTime dateTime = MyDateUtils.offsetDay(new Date(), -1);
long l = MyDateUtils.TimeMillSecond2Second(dateTime);
List<TerminalChannelMapper> list = terminalChannelMapperDao.selectAllByPhotoTime(BigInteger.valueOf(l));
// DateTime dateTime = MyDateUtils.offsetDay(new Date(), -1);
// long l = MyDateUtils.TimeMillSecond2Second(dateTime);
// List<TerminalChannelMapper> list = terminalChannelMapperDao.selectAllByPhotoTime(BigInteger.valueOf(l));
List<TerminalChannelMapper> list = terminalChannelMapperDao.selectAllByPhotoTime(CommonStatus.EFFECTIVE.value());
ArrayList<BigInteger> photolist = new ArrayList<>();
List<TerminalPhotosModel.PhotosBean> beans = new ArrayList<>();
if (CollectionUtil.isNotEmpty(list)) {

@ -101,7 +101,7 @@ public class TerminalScheduleRuleServiceImpl implements TerminalScheduleRuleServ
}
model.setList(beans);
}
PageInfo pageData = PageUtils.getPageData(list);
PageInfo pageData = PageUtils.getPageData(schedules);
int currentpage = pageData.getPageNum();
model.setCurrentpage(currentpage);
long total = pageData.getTotal();

@ -610,7 +610,7 @@ public class TerminalServiceImpl implements TerminalService {
* @return
*/
@Override
public ServiceBody<List<TerminalAndLastPicListExcelModel>> getOnlineTerminalList() {
public ServiceBody<List<TerminalAndLastPicListExcelModel>> getOnlineTerminalList(Integer type) {
List<TerminalAndLastPicListExcelModel> modellist = new ArrayList<>();
Map<Integer, TowerDto> towerMap = cacheService.getTowerMap();
List<TerminalsAndStatusAndLastPicDto> list = terminalsDao.selectTermAndStatusAndLastPicList(CommonStatus.EFFECTIVE.value());
@ -636,6 +636,12 @@ public class TerminalServiceImpl implements TerminalService {
String s = MyDateUtils.TimeSecondToDate(lastheartbeat);
model.setHearttime(s);
}
Double latitude = item.getLatitude();
model.setLatitude(latitude);
Double longitude = item.getLongitude();
model.setLongitude(longitude);
Integer radius = item.getRadius();
model.setRadius(radius);
boolean b = TerminalUtils.judgeTerminalStatus(lastheartbeat);
if (b) {
model.setIsonline("是");
@ -660,10 +666,21 @@ public class TerminalServiceImpl implements TerminalService {
model.setPictime(s);
}
}
if (type == null || type == -1) {
modellist.add(model);
} else if (type == 0) {
if (!b) {
modellist.add(model);
}
} else if (type == 1) {
if (b) {
modellist.add(model);
}
}
}
}
}
return Asserts.success(modellist);
}

@ -128,7 +128,7 @@ public interface TerminalService {
* 线
* @return
*/
ServiceBody<List<TerminalAndLastPicListExcelModel>> getOnlineTerminalList();
ServiceBody<List<TerminalAndLastPicListExcelModel>> getOnlineTerminalList(Integer type);
/**
*

Loading…
Cancel
Save