Merge branch 'schedule' of http://192.168.111.189:80/git/xymp/backend into schedule

dev
liuguijing 1 year ago
commit e7b92c9d64

@ -4,16 +4,11 @@ import com.github.pagehelper.PageInfo;
import com.shxy.xymanager_common.base.BaseController;
import com.shxy.xymanager_common.base.ResponseReult;
import com.shxy.xymanager_common.entity.LeadPulls;
import com.shxy.xymanager_common.entity.View_Dy_Line_Tower_Terminals;
import com.shxy.xymanager_common.page.TableDataInfo;
import com.shxy.xymanager_common.util.EasyExcelUtil;
import com.shxy.xymanager_common.vo.TerminalSelectVo;
import com.shxy.xymanager_service.service.LeadPullsService;
import com.shxy.xymanager_service.service.TerminalService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@ -29,8 +24,6 @@ public class LeadPullsController extends BaseController {
@Resource
LeadPullsService service;
@Resource
TerminalService terminalService;
@GetMapping("list")
@ApiOperation("查询列表")
@ -53,24 +46,4 @@ public class LeadPullsController extends BaseController {
EasyExcelUtil.createExcel(response, "覆冰数据", result.getList(), LeadPulls.class);
}
@GetMapping("latest")
@ApiOperation("查询最新的")
public ResponseReult<TableDataInfo<View_Dy_Line_Tower_Terminals>> latest(Integer dyId, Integer lineId, Integer towerId,
int pageNum, int pageSize) {
TerminalSelectVo vo = new TerminalSelectVo();
vo.setDyId(dyId);
vo.setLineId(lineId);
vo.setTowerId(towerId);
vo.setPageindex(pageNum);
vo.setPagesize(pageSize);
TableDataInfo<View_Dy_Line_Tower_Terminals> result = terminalService.getTerminalList(vo).getData();
if (!CollectionUtils.isEmpty(result.getList())) {
for (View_Dy_Line_Tower_Terminals terminals : result.getList()) {
LeadPulls last = service.getLast(terminals.getId());
terminals.setLastLeadPulls(last);
}
}
return ResponseReult.success(result);
}
}

@ -0,0 +1,127 @@
package com.shxy.xymanager_admin.controller;
import com.shxy.xymanager_common.base.BaseController;
import com.shxy.xymanager_common.base.ResponseReult;
import com.shxy.xymanager_common.entity.LeadPulls;
import com.shxy.xymanager_common.entity.View_Dy_Line_Tower_Terminals;
import com.shxy.xymanager_common.entity.Weathers;
import com.shxy.xymanager_common.model.PhotoDayModel;
import com.shxy.xymanager_common.model.TerminalGpsModel;
import com.shxy.xymanager_common.page.TableDataInfo;
import com.shxy.xymanager_common.vo.TerminalSelectVo;
import com.shxy.xymanager_service.service.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.util.CollectionUtils;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import javax.validation.constraints.NotNull;
@RestController
@Api(tags = {"装置附带额外信息接口"})
@RequestMapping("terminal")
@Slf4j
@Validated
public class TerminalExtController extends BaseController {
@Resource
TerminalService terminalService;
@Resource
TerminalGpsService gpsService;
@Resource
WeatherService weatherService;
@Resource
LeadPullsService leadPullsService;
@Resource
TerminalPhotoService photoService;
@GetMapping("listWithGPS")
@ApiOperation("查询附带定位")
public ResponseReult<TableDataInfo<View_Dy_Line_Tower_Terminals>> listWithGPS(Integer dyId, Integer lineId, Integer towerId, String search,
Integer pageNum, Integer pageSize) {
pageNum = this.initPageNum(pageNum);
pageSize = this.initPageSize(pageSize);
TableDataInfo<View_Dy_Line_Tower_Terminals> result = this.getTerminalPage(dyId, lineId, towerId, search,
pageNum, pageSize);
if (!CollectionUtils.isEmpty(result.getList())) {
for (View_Dy_Line_Tower_Terminals terminal : result.getList()) {
TerminalGpsModel last = gpsService.getTermLastGPSPosition(terminal.getId())
.getData();
terminal.setLastGps(last);
}
}
return ResponseReult.success(result);
}
@GetMapping("listWithPhoto")
@ApiOperation("查询附带图片统计")
public ResponseReult<TableDataInfo<View_Dy_Line_Tower_Terminals>> listWithPhoto(Integer dyId, Integer lineId, Integer towerId, String search,
@NotNull(message = "start不能为空!") Long start, @NotNull(message = "end不能为空!") Long end,
Integer channelId,
Integer pageNum, Integer pageSize) {
pageNum = this.initPageNum(pageNum);
pageSize = this.initPageSize(pageSize);
TableDataInfo<View_Dy_Line_Tower_Terminals> result = this.getTerminalPage(dyId, lineId, towerId, search,
pageNum, pageSize);
if (!CollectionUtils.isEmpty(result.getList())) {
for (View_Dy_Line_Tower_Terminals terminal : result.getList()) {
PhotoDayModel photoInfo = photoService.getDayModel(terminal.getId(), channelId, start, end);
terminal.setPhotoInfo(photoInfo);
}
}
return ResponseReult.success(result);
}
@GetMapping("listWithWeather")
@ApiOperation("查询附带天气")
public ResponseReult<TableDataInfo<View_Dy_Line_Tower_Terminals>> listWithWeather(Integer dyId, Integer lineId, Integer towerId, String search,
Integer pageNum, Integer pageSize) {
pageNum = this.initPageNum(pageNum);
pageSize = this.initPageSize(pageSize);
TableDataInfo<View_Dy_Line_Tower_Terminals> result = this.getTerminalPage(dyId, lineId, towerId, search,
pageNum, pageSize);
if (!CollectionUtils.isEmpty(result.getList())) {
for (View_Dy_Line_Tower_Terminals terminal : result.getList()) {
Weathers last = weatherService.getLast(terminal.getId());
terminal.setLastWeathers(last);
}
}
return ResponseReult.success(result);
}
@GetMapping("listWithLeadPull")
@ApiOperation("查询附带拉力")
public ResponseReult<TableDataInfo<View_Dy_Line_Tower_Terminals>> listWithLeadPull(Integer dyId, Integer lineId, Integer towerId, String search,
Integer pageNum, Integer pageSize) {
pageNum = this.initPageNum(pageNum);
pageSize = this.initPageSize(pageSize);
TableDataInfo<View_Dy_Line_Tower_Terminals> result = this.getTerminalPage(dyId, lineId, towerId, search,
pageNum, pageSize);
if (!CollectionUtils.isEmpty(result.getList())) {
for (View_Dy_Line_Tower_Terminals terminal : result.getList()) {
LeadPulls last = leadPullsService.getLast(terminal.getId());
terminal.setLastLeadPulls(last);
}
}
return ResponseReult.success(result);
}
private TableDataInfo<View_Dy_Line_Tower_Terminals> getTerminalPage(Integer dyId, Integer lineId, Integer towerId, String search,
Integer pageNum, Integer pageSize) {
TerminalSelectVo vo = new TerminalSelectVo();
vo.setDyId(dyId);
vo.setLineId(lineId);
vo.setTowerId(towerId);
vo.setSearch(search);
vo.setPageindex(pageNum);
vo.setPagesize(pageSize);
TableDataInfo<View_Dy_Line_Tower_Terminals> result = terminalService.getTerminalList(vo).getData();
return result;
}
}

@ -3,19 +3,16 @@ package com.shxy.xymanager_admin.controller;
import com.github.pagehelper.PageInfo;
import com.shxy.xymanager_common.base.BaseController;
import com.shxy.xymanager_common.base.ResponseReult;
import com.shxy.xymanager_common.entity.View_Dy_Line_Tower_Terminals;
import com.shxy.xymanager_common.entity.Weathers;
import com.shxy.xymanager_common.page.TableDataInfo;
import com.shxy.xymanager_common.vo.TerminalSelectVo;
import com.shxy.xymanager_service.service.TerminalService;
import com.shxy.xymanager_common.util.EasyExcelUtil;
import com.shxy.xymanager_service.service.WeatherService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
@RestController
@Api(tags = {"气象相关接口"})
@ -25,8 +22,6 @@ public class WeatherController extends BaseController {
@Resource
WeatherService service;
@Resource
TerminalService terminalService;
@GetMapping("list")
@ApiOperation("查询列表")
@ -38,24 +33,15 @@ public class WeatherController extends BaseController {
return ResponseReult.success(result);
}
@GetMapping("latest")
@ApiOperation("查询最新的")
public ResponseReult<TableDataInfo<View_Dy_Line_Tower_Terminals>> latest(Integer dyId, Integer lineId, Integer towerId,
int pageNum, int pageSize) {
TerminalSelectVo vo = new TerminalSelectVo();
vo.setDyId(dyId);
vo.setLineId(lineId);
vo.setTowerId(towerId);
vo.setPageindex(pageNum);
vo.setPagesize(pageSize);
TableDataInfo<View_Dy_Line_Tower_Terminals> result = terminalService.getTerminalList(vo).getData();
if (!CollectionUtils.isEmpty(result.getList())) {
for (View_Dy_Line_Tower_Terminals terminals : result.getList()) {
Weathers last = service.getLast(terminals.getId());
terminals.setLastWeathers(last);
}
}
return ResponseReult.success(result);
@GetMapping("export")
@ApiOperation("导出")
public void export(Integer lineId, Integer towerId, Integer termId,
Long start, Long end,
Integer pageNum, Integer pageSize,
HttpServletResponse response) throws Exception {
PageInfo<Weathers> result = service.list(lineId, towerId, termId,
start, end, pageNum, pageSize);
EasyExcelUtil.createExcel(response, "覆冰数据", result.getList(), Weathers.class);
}
}

@ -20,6 +20,26 @@ import java.util.List;
*/
public class BaseController {
protected Integer initPageNum(Integer pageNum) {
if (pageNum == null) {
pageNum = 1;
}
if (pageNum < 0) {
pageNum = 1;
}
return pageNum;
}
protected Integer initPageSize(Integer pageSize) {
if (pageSize == null) {
pageSize = 10;
}
if (pageSize < 1) {
pageSize = 1;
}
return pageSize;
}
/**
* Date
*/

@ -38,7 +38,6 @@ public class LeadPulls {
private Long updateTime;
@ColumnWidth(20)
@ExcelProperty(value = "时间", order = 2)
private Date updateDate;
/**

@ -3,6 +3,8 @@ package com.shxy.xymanager_common.entity;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUnit;
import com.shxy.xymanager_common.enums.CommonStatus;
import com.shxy.xymanager_common.model.PhotoDayModel;
import com.shxy.xymanager_common.model.TerminalGpsModel;
import com.shxy.xymanager_common.util.MyDateUtils;
import com.shxy.xymanager_common.util.xinyin.TerminalUtils;
import io.swagger.annotations.ApiModel;
@ -79,11 +81,11 @@ public class View_Dy_Line_Tower_Terminals implements Serializable {
@ApiModelProperty(value = "sim卡号", example = "123456")
private String sim;
@ApiModelProperty(value = "网络类型", example = "网络类型")
@ApiModelProperty(value = "网络类型", example = "1")
private Integer netType;
@ApiModelProperty(value = "网络类型", example = "网络类型")
@ApiModelProperty(value = "网络类型", example = "1")
private Integer devType;
@ApiModelProperty(value = "设备名称", example = "123456")
@ -96,7 +98,7 @@ public class View_Dy_Line_Tower_Terminals implements Serializable {
@ApiModelProperty(value = "最后一次心跳时间", example = "213")
private BigInteger lastHeartbeat;
@ApiModelProperty(value = "在线状态", example = "0--掉线1--在线")
@ApiModelProperty(value = "在线状态", example = "1")
private Integer onlinestatus;
private Integer termcount;
@ -120,4 +122,6 @@ public class View_Dy_Line_Tower_Terminals implements Serializable {
private Weathers lastWeathers;
private LeadPulls lastLeadPulls;
private TerminalGpsModel lastGps;
private PhotoDayModel photoInfo;
}

@ -1,5 +1,11 @@
package com.shxy.xymanager_common.entity;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import java.util.Date;
public class Weathers {
/**
*
@ -8,6 +14,7 @@ public class Weathers {
*
* @mbg.generated
*/
@ExcelIgnore
private Long id;
/**
@ -17,6 +24,7 @@ public class Weathers {
*
* @mbg.generated
*/
@ExcelIgnore
private Integer termId;
/**
@ -26,8 +34,13 @@ public class Weathers {
*
* @mbg.generated
*/
@ExcelIgnore
private Long updateTime;
@ColumnWidth(20)
@ExcelProperty(value = "时间", order = 2)
private Date updateDate;
/**
*
* This field was generated by MyBatis Generator.
@ -35,6 +48,7 @@ public class Weathers {
*
* @mbg.generated
*/
@ExcelIgnore
private String compId;
/**
@ -44,6 +58,8 @@ public class Weathers {
*
* @mbg.generated
*/
@ColumnWidth(16)
@ExcelProperty(value = "10 分钟平均风速精确到小数点后1位单位m/s)", order = 3)
private Float avgWindSpeed10min;
/**
@ -53,6 +69,8 @@ public class Weathers {
*
* @mbg.generated
*/
@ColumnWidth(16)
@ExcelProperty(value = "10 分钟平均风向(单位:°)", order = 4)
private Integer avgWindDir10min;
/**
@ -62,6 +80,8 @@ public class Weathers {
*
* @mbg.generated
*/
@ColumnWidth(16)
@ExcelProperty(value = "1分钟平均风速精确到小数点后1位单位m/s)", order = 5)
private Float avgWindSpeed1min;
/**
@ -71,6 +91,8 @@ public class Weathers {
*
* @mbg.generated
*/
@ColumnWidth(16)
@ExcelProperty(value = "1 分钟平均风向(单位:°)", order = 6)
private Float avgWindDir1min;
/**
@ -80,6 +102,8 @@ public class Weathers {
*
* @mbg.generated
*/
@ColumnWidth(16)
@ExcelProperty(value = "最大风速精确到小数点后1位单位m/s) 南网规约 10分钟最大风速", order = 7)
private Float maxWindSpeed;
/**
@ -89,6 +113,7 @@ public class Weathers {
*
* @mbg.generated
*/
@ExcelIgnore
private Float extremeWindSpeed;
/**
@ -98,6 +123,8 @@ public class Weathers {
*
* @mbg.generated
*/
@ColumnWidth(16)
@ExcelProperty(value = "标准风速精确到小数点后1位单位m/s) 南网规约瞬时风速", order = 8)
private Float standardWindSpeed;
/**
@ -107,6 +134,8 @@ public class Weathers {
*
* @mbg.generated
*/
@ColumnWidth(16)
@ExcelProperty(value = "瞬时风向", order = 9)
private Float windDirection;
/**
@ -116,6 +145,8 @@ public class Weathers {
*
* @mbg.generated
*/
@ColumnWidth(16)
@ExcelProperty(value = "气温精确到小数点后1位单位", order = 10)
private Float airTemperature;
/**
@ -125,6 +156,8 @@ public class Weathers {
*
* @mbg.generated
*/
@ColumnWidth(16)
@ExcelProperty(value = "湿度(单位:%RH", order = 11)
private Integer humidity;
/**
@ -134,6 +167,8 @@ public class Weathers {
*
* @mbg.generated
*/
@ColumnWidth(16)
@ExcelProperty(value = "气压精确到小数点后1位单位hPa", order = 12)
private Float airPressure;
/**
@ -143,6 +178,8 @@ public class Weathers {
*
* @mbg.generated
*/
@ColumnWidth(16)
@ExcelProperty(value = "降雨量精确到小数点后1位单位mm", order = 13)
private Float precipitation;
/**
@ -152,6 +189,7 @@ public class Weathers {
*
* @mbg.generated
*/
@ExcelIgnore
private Float precipitationIntensity;
/**
@ -161,6 +199,8 @@ public class Weathers {
*
* @mbg.generated
*/
@ColumnWidth(16)
@ExcelProperty(value = "光辐射强度单位W/m2)", order = 14)
private Integer radiationIntensity;
/**
@ -233,6 +273,7 @@ public class Weathers {
*/
public void setUpdateTime(Long updateTime) {
this.updateTime = updateTime;
this.updateDate = new Date(updateTime*1000);
}
/**
@ -595,7 +636,11 @@ public class Weathers {
this.radiationIntensity = radiationIntensity;
}
@ColumnWidth(15)
@ExcelProperty(value = "监测终端编号", order = 1)
private String cmdid;
@ExcelIgnore
private String phase;
public String getCmdid() {
@ -613,4 +658,12 @@ public class Weathers {
public void setPhase(String phase) {
this.phase = phase;
}
public Date getUpdateDate() {
return updateDate;
}
public void setUpdateDate(Date updateDate) {
this.updateDate = updateDate;
}
}

@ -0,0 +1,18 @@
package com.shxy.xymanager_common.model;
import lombok.Data;
import java.io.Serializable;
@Data
public class PhotoDayModel implements Serializable {
private long firstPhotoTime;
private long lastRecvTime;
private long photoCount;
}

@ -27,6 +27,7 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.web.multipart.MultipartFile;
import java.io.File;
@ -793,5 +794,27 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService {
}
}
@Override
public PhotoDayModel getDayModel(Integer termid, Integer channelId, Long start, Long end) {
TerminalPhotoExample example = new TerminalPhotoExample();
TerminalPhotoExample.Criteria criteria = example.createCriteria();
criteria.andTermIdEqualTo(termid);
criteria.andPhotoTimeBetween(start, end);
if (channelId != null){
criteria.andChannelIdEqualTo(channelId);
}
example.setOrderByClause("photo_time desc");
List<TerminalPhoto> list = terminalPhotoDao.selectByExample(example);
PhotoDayModel result = new PhotoDayModel();
if (!CollectionUtils.isEmpty(list)) {
int count = list.size();
result.setPhotoCount(count);
result.setLastRecvTime(list.get(0).getRecvTime().longValue());
result.setFirstPhotoTime(list.get(count - 1).getPhotoTime().longValue());
}
return result;
}
}

@ -108,4 +108,6 @@ public interface TerminalPhotoService {
*/
ServiceBody<String> uploadPhoto(MultipartFile file, Integer termid, String cmdid, Integer channel, BigInteger phototime) throws IOException;
PhotoDayModel getDayModel(Integer termid, Integer channelId, Long start, Long end);
}

Loading…
Cancel
Save