From a0bdd0b6eeeb333cc295e3e2bb1a639c53eb9f08 Mon Sep 17 00:00:00 2001 From: huangfeng Date: Thu, 18 Apr 2024 13:33:10 +0800 Subject: [PATCH 1/6] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E4=B8=80=E5=A4=A9=E7=9A=84=E7=85=A7=E7=89=87=E4=BF=A1?= =?UTF-8?q?=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xymanager_common/model/PhotoDayModel.java | 18 +++++++++++++++++ .../impl/TerminalPhotoServiceImpl.java | 20 +++++++++++++++++++ .../service/TerminalPhotoService.java | 2 ++ 3 files changed, 40 insertions(+) create mode 100644 xymanager_common/src/main/java/com/shxy/xymanager_common/model/PhotoDayModel.java diff --git a/xymanager_common/src/main/java/com/shxy/xymanager_common/model/PhotoDayModel.java b/xymanager_common/src/main/java/com/shxy/xymanager_common/model/PhotoDayModel.java new file mode 100644 index 0000000..d12434c --- /dev/null +++ b/xymanager_common/src/main/java/com/shxy/xymanager_common/model/PhotoDayModel.java @@ -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; + +} diff --git a/xymanager_service/src/main/java/com/shxy/xymanager_service/impl/TerminalPhotoServiceImpl.java b/xymanager_service/src/main/java/com/shxy/xymanager_service/impl/TerminalPhotoServiceImpl.java index 153f92d..b7aca23 100644 --- a/xymanager_service/src/main/java/com/shxy/xymanager_service/impl/TerminalPhotoServiceImpl.java +++ b/xymanager_service/src/main/java/com/shxy/xymanager_service/impl/TerminalPhotoServiceImpl.java @@ -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,24 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService { } } + @Override + public PhotoDayModel getDayModel(Integer termid, Long start, Long end) { + TerminalPhotoExample example = new TerminalPhotoExample(); + TerminalPhotoExample.Criteria criteria = example.createCriteria(); + criteria.andTermIdEqualTo(termid); + criteria.andPhotoTimeBetween(start, end); + example.setOrderByClause("photo_time desc"); + List 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; + } + } diff --git a/xymanager_service/src/main/java/com/shxy/xymanager_service/service/TerminalPhotoService.java b/xymanager_service/src/main/java/com/shxy/xymanager_service/service/TerminalPhotoService.java index e37c09e..381d87e 100644 --- a/xymanager_service/src/main/java/com/shxy/xymanager_service/service/TerminalPhotoService.java +++ b/xymanager_service/src/main/java/com/shxy/xymanager_service/service/TerminalPhotoService.java @@ -108,4 +108,6 @@ public interface TerminalPhotoService { */ ServiceBody uploadPhoto(MultipartFile file, Integer termid, String cmdid, Integer channel, BigInteger phototime) throws IOException; + + PhotoDayModel getDayModel(Integer termid, Long start, Long end); } From 7938acef0831e8ba48ed2836baaf9f2adfbea320 Mon Sep 17 00:00:00 2001 From: huangfeng Date: Thu, 18 Apr 2024 13:40:23 +0800 Subject: [PATCH 2/6] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E8=A3=85=E7=BD=AE=E5=B9=B6=E9=99=84=E5=B8=A6=E9=A2=9D?= =?UTF-8?q?=E5=A4=96=E4=BF=A1=E6=81=AF=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/TerminalExtController.java | 125 ++++++++++++++++++ .../xymanager_common/base/BaseController.java | 20 +++ .../entity/View_Dy_Line_Tower_Terminals.java | 10 +- 3 files changed, 152 insertions(+), 3 deletions(-) create mode 100644 xymanager_admin/src/main/java/com/shxy/xymanager_admin/controller/TerminalExtController.java diff --git a/xymanager_admin/src/main/java/com/shxy/xymanager_admin/controller/TerminalExtController.java b/xymanager_admin/src/main/java/com/shxy/xymanager_admin/controller/TerminalExtController.java new file mode 100644 index 0000000..a05a4f4 --- /dev/null +++ b/xymanager_admin/src/main/java/com/shxy/xymanager_admin/controller/TerminalExtController.java @@ -0,0 +1,125 @@ +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> listWithGPS(Integer dyId, Integer lineId, Integer towerId, + Integer pageNum, Integer pageSize) { + pageNum = this.initPageNum(pageNum); + pageSize = this.initPageSize(pageSize); + TableDataInfo result = this.getTerminalPage(dyId, lineId, towerId, + 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> listWithPhoto(Integer dyId, Integer lineId, Integer towerId, + @NotNull(message = "start不能为空!") Long start, @NotNull(message = "end不能为空!") Long end, + Integer pageNum, Integer pageSize) { + pageNum = this.initPageNum(pageNum); + pageSize = this.initPageSize(pageSize); + TableDataInfo result = this.getTerminalPage(dyId, lineId, towerId, + pageNum, pageSize); + if (!CollectionUtils.isEmpty(result.getList())) { + for (View_Dy_Line_Tower_Terminals terminal : result.getList()) { + PhotoDayModel photoInfo = photoService.getDayModel(terminal.getId(), start, end); + terminal.setPhotoInfo(photoInfo); + } + } + return ResponseReult.success(result); + } + + @GetMapping("listWithWeather") + @ApiOperation("查询附带天气") + public ResponseReult> listWithWeather(Integer dyId, Integer lineId, Integer towerId, + Integer pageNum, Integer pageSize) { + pageNum = this.initPageNum(pageNum); + pageSize = this.initPageSize(pageSize); + TableDataInfo result = this.getTerminalPage(dyId, lineId, towerId, + 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> listWithLeadPull(Integer dyId, Integer lineId, Integer towerId, + Integer pageNum, Integer pageSize) { + pageNum = this.initPageNum(pageNum); + pageSize = this.initPageSize(pageSize); + TableDataInfo result = this.getTerminalPage(dyId, lineId, towerId, + 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 getTerminalPage(Integer dyId, Integer lineId, Integer towerId, + Integer pageNum, Integer pageSize) { + TerminalSelectVo vo = new TerminalSelectVo(); + vo.setDyId(dyId); + vo.setLineId(lineId); + vo.setTowerId(towerId); + vo.setPageindex(pageNum); + vo.setPagesize(pageSize); + TableDataInfo result = terminalService.getTerminalList(vo).getData(); + return result; + } +} diff --git a/xymanager_common/src/main/java/com/shxy/xymanager_common/base/BaseController.java b/xymanager_common/src/main/java/com/shxy/xymanager_common/base/BaseController.java index 1981ba1..c45aa07 100644 --- a/xymanager_common/src/main/java/com/shxy/xymanager_common/base/BaseController.java +++ b/xymanager_common/src/main/java/com/shxy/xymanager_common/base/BaseController.java @@ -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类型 */ diff --git a/xymanager_common/src/main/java/com/shxy/xymanager_common/entity/View_Dy_Line_Tower_Terminals.java b/xymanager_common/src/main/java/com/shxy/xymanager_common/entity/View_Dy_Line_Tower_Terminals.java index 362acf4..496f134 100644 --- a/xymanager_common/src/main/java/com/shxy/xymanager_common/entity/View_Dy_Line_Tower_Terminals.java +++ b/xymanager_common/src/main/java/com/shxy/xymanager_common/entity/View_Dy_Line_Tower_Terminals.java @@ -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; } \ No newline at end of file From 02c0c718f02c29181de2b1e57ed67a52bf3ab6b4 Mon Sep 17 00:00:00 2001 From: huangfeng Date: Thu, 18 Apr 2024 16:04:53 +0800 Subject: [PATCH 3/6] =?UTF-8?q?fix:=20=E6=9F=A5=E8=AF=A2=E5=8F=82=E6=95=B0?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E9=80=9A=E9=81=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xymanager_admin/controller/TerminalExtController.java | 3 ++- .../xymanager_service/impl/TerminalPhotoServiceImpl.java | 5 ++++- .../shxy/xymanager_service/service/TerminalPhotoService.java | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/xymanager_admin/src/main/java/com/shxy/xymanager_admin/controller/TerminalExtController.java b/xymanager_admin/src/main/java/com/shxy/xymanager_admin/controller/TerminalExtController.java index a05a4f4..38c7f8c 100644 --- a/xymanager_admin/src/main/java/com/shxy/xymanager_admin/controller/TerminalExtController.java +++ b/xymanager_admin/src/main/java/com/shxy/xymanager_admin/controller/TerminalExtController.java @@ -63,6 +63,7 @@ public class TerminalExtController extends BaseController { @ApiOperation("查询附带图片统计") public ResponseReult> listWithPhoto(Integer dyId, Integer lineId, Integer towerId, @NotNull(message = "start不能为空!") Long start, @NotNull(message = "end不能为空!") Long end, + Integer channelId, Integer pageNum, Integer pageSize) { pageNum = this.initPageNum(pageNum); pageSize = this.initPageSize(pageSize); @@ -70,7 +71,7 @@ public class TerminalExtController extends BaseController { pageNum, pageSize); if (!CollectionUtils.isEmpty(result.getList())) { for (View_Dy_Line_Tower_Terminals terminal : result.getList()) { - PhotoDayModel photoInfo = photoService.getDayModel(terminal.getId(), start, end); + PhotoDayModel photoInfo = photoService.getDayModel(terminal.getId(), channelId, start, end); terminal.setPhotoInfo(photoInfo); } } diff --git a/xymanager_service/src/main/java/com/shxy/xymanager_service/impl/TerminalPhotoServiceImpl.java b/xymanager_service/src/main/java/com/shxy/xymanager_service/impl/TerminalPhotoServiceImpl.java index b7aca23..41f5a66 100644 --- a/xymanager_service/src/main/java/com/shxy/xymanager_service/impl/TerminalPhotoServiceImpl.java +++ b/xymanager_service/src/main/java/com/shxy/xymanager_service/impl/TerminalPhotoServiceImpl.java @@ -795,11 +795,14 @@ public class TerminalPhotoServiceImpl implements TerminalPhotoService { } @Override - public PhotoDayModel getDayModel(Integer termid, Long start, Long end) { + 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 list = terminalPhotoDao.selectByExample(example); diff --git a/xymanager_service/src/main/java/com/shxy/xymanager_service/service/TerminalPhotoService.java b/xymanager_service/src/main/java/com/shxy/xymanager_service/service/TerminalPhotoService.java index 381d87e..7a7dcd2 100644 --- a/xymanager_service/src/main/java/com/shxy/xymanager_service/service/TerminalPhotoService.java +++ b/xymanager_service/src/main/java/com/shxy/xymanager_service/service/TerminalPhotoService.java @@ -109,5 +109,5 @@ public interface TerminalPhotoService { ServiceBody uploadPhoto(MultipartFile file, Integer termid, String cmdid, Integer channel, BigInteger phototime) throws IOException; - PhotoDayModel getDayModel(Integer termid, Long start, Long end); + PhotoDayModel getDayModel(Integer termid, Integer channelId, Long start, Long end); } From 8dbf4329a9e59afdae1b73769bfe6c65b1f24e1f Mon Sep 17 00:00:00 2001 From: huangfeng Date: Thu, 18 Apr 2024 16:19:13 +0800 Subject: [PATCH 4/6] =?UTF-8?q?fix:=20=E5=8E=BB=E6=8E=89=E5=B7=B2=E8=BD=AC?= =?UTF-8?q?=E7=A7=BB=E5=88=B0TerminalExtController=E7=9A=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/LeadPullsController.java | 27 ------------------- .../controller/WeatherController.java | 27 ------------------- 2 files changed, 54 deletions(-) diff --git a/xymanager_admin/src/main/java/com/shxy/xymanager_admin/controller/LeadPullsController.java b/xymanager_admin/src/main/java/com/shxy/xymanager_admin/controller/LeadPullsController.java index ff831d6..dd48bf6 100644 --- a/xymanager_admin/src/main/java/com/shxy/xymanager_admin/controller/LeadPullsController.java +++ b/xymanager_admin/src/main/java/com/shxy/xymanager_admin/controller/LeadPullsController.java @@ -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> 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 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); - } - } diff --git a/xymanager_admin/src/main/java/com/shxy/xymanager_admin/controller/WeatherController.java b/xymanager_admin/src/main/java/com/shxy/xymanager_admin/controller/WeatherController.java index 4bfae28..f52856c 100644 --- a/xymanager_admin/src/main/java/com/shxy/xymanager_admin/controller/WeatherController.java +++ b/xymanager_admin/src/main/java/com/shxy/xymanager_admin/controller/WeatherController.java @@ -3,16 +3,11 @@ 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_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; @@ -25,8 +20,6 @@ public class WeatherController extends BaseController { @Resource WeatherService service; - @Resource - TerminalService terminalService; @GetMapping("list") @ApiOperation("查询列表") @@ -38,24 +31,4 @@ public class WeatherController extends BaseController { return ResponseReult.success(result); } - @GetMapping("latest") - @ApiOperation("查询最新的") - public ResponseReult> 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 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); - } - } From 10bbc8dddb3680ec6651178e033479a87221864f Mon Sep 17 00:00:00 2001 From: huangfeng Date: Tue, 23 Apr 2024 11:32:02 +0800 Subject: [PATCH 5/6] =?UTF-8?q?feat:=20=E5=A2=9E=E5=8A=A0=E5=AF=BC?= =?UTF-8?q?=E5=87=BA=E5=A4=A9=E6=B0=94=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/WeatherController.java | 13 +++++ .../xymanager_common/entity/LeadPulls.java | 1 - .../xymanager_common/entity/Weathers.java | 53 +++++++++++++++++++ 3 files changed, 66 insertions(+), 1 deletion(-) diff --git a/xymanager_admin/src/main/java/com/shxy/xymanager_admin/controller/WeatherController.java b/xymanager_admin/src/main/java/com/shxy/xymanager_admin/controller/WeatherController.java index f52856c..0212b4d 100644 --- a/xymanager_admin/src/main/java/com/shxy/xymanager_admin/controller/WeatherController.java +++ b/xymanager_admin/src/main/java/com/shxy/xymanager_admin/controller/WeatherController.java @@ -4,6 +4,7 @@ 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.Weathers; +import com.shxy.xymanager_common.util.EasyExcelUtil; import com.shxy.xymanager_service.service.WeatherService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -11,6 +12,7 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; @RestController @Api(tags = {"气象相关接口"}) @@ -31,4 +33,15 @@ public class WeatherController extends BaseController { 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 result = service.list(lineId, towerId, termId, + start, end, pageNum, pageSize); + EasyExcelUtil.createExcel(response, "覆冰数据", result.getList(), Weathers.class); + } + } diff --git a/xymanager_common/src/main/java/com/shxy/xymanager_common/entity/LeadPulls.java b/xymanager_common/src/main/java/com/shxy/xymanager_common/entity/LeadPulls.java index 85be959..2013e56 100644 --- a/xymanager_common/src/main/java/com/shxy/xymanager_common/entity/LeadPulls.java +++ b/xymanager_common/src/main/java/com/shxy/xymanager_common/entity/LeadPulls.java @@ -38,7 +38,6 @@ public class LeadPulls { private Long updateTime; @ColumnWidth(20) @ExcelProperty(value = "时间", order = 2) - private Date updateDate; /** diff --git a/xymanager_common/src/main/java/com/shxy/xymanager_common/entity/Weathers.java b/xymanager_common/src/main/java/com/shxy/xymanager_common/entity/Weathers.java index edbf9a1..959ea5b 100644 --- a/xymanager_common/src/main/java/com/shxy/xymanager_common/entity/Weathers.java +++ b/xymanager_common/src/main/java/com/shxy/xymanager_common/entity/Weathers.java @@ -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; + } } \ No newline at end of file From e211a231d4fd3cd0e82a499513e07517f67523cf Mon Sep 17 00:00:00 2001 From: huangfeng Date: Tue, 23 Apr 2024 16:51:09 +0800 Subject: [PATCH 6/6] =?UTF-8?q?fix:=20=E5=A2=9E=E5=8A=A0=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E6=9D=A1=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/TerminalExtController.java | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/xymanager_admin/src/main/java/com/shxy/xymanager_admin/controller/TerminalExtController.java b/xymanager_admin/src/main/java/com/shxy/xymanager_admin/controller/TerminalExtController.java index 38c7f8c..59dea24 100644 --- a/xymanager_admin/src/main/java/com/shxy/xymanager_admin/controller/TerminalExtController.java +++ b/xymanager_admin/src/main/java/com/shxy/xymanager_admin/controller/TerminalExtController.java @@ -43,11 +43,11 @@ public class TerminalExtController extends BaseController { @GetMapping("listWithGPS") @ApiOperation("查询附带定位") - public ResponseReult> listWithGPS(Integer dyId, Integer lineId, Integer towerId, + public ResponseReult> listWithGPS(Integer dyId, Integer lineId, Integer towerId, String search, Integer pageNum, Integer pageSize) { pageNum = this.initPageNum(pageNum); pageSize = this.initPageSize(pageSize); - TableDataInfo result = this.getTerminalPage(dyId, lineId, towerId, + TableDataInfo result = this.getTerminalPage(dyId, lineId, towerId, search, pageNum, pageSize); if (!CollectionUtils.isEmpty(result.getList())) { for (View_Dy_Line_Tower_Terminals terminal : result.getList()) { @@ -61,13 +61,13 @@ public class TerminalExtController extends BaseController { @GetMapping("listWithPhoto") @ApiOperation("查询附带图片统计") - public ResponseReult> listWithPhoto(Integer dyId, Integer lineId, Integer towerId, + public ResponseReult> 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 result = this.getTerminalPage(dyId, lineId, towerId, + TableDataInfo result = this.getTerminalPage(dyId, lineId, towerId, search, pageNum, pageSize); if (!CollectionUtils.isEmpty(result.getList())) { for (View_Dy_Line_Tower_Terminals terminal : result.getList()) { @@ -80,11 +80,11 @@ public class TerminalExtController extends BaseController { @GetMapping("listWithWeather") @ApiOperation("查询附带天气") - public ResponseReult> listWithWeather(Integer dyId, Integer lineId, Integer towerId, + public ResponseReult> listWithWeather(Integer dyId, Integer lineId, Integer towerId, String search, Integer pageNum, Integer pageSize) { pageNum = this.initPageNum(pageNum); pageSize = this.initPageSize(pageSize); - TableDataInfo result = this.getTerminalPage(dyId, lineId, towerId, + TableDataInfo result = this.getTerminalPage(dyId, lineId, towerId, search, pageNum, pageSize); if (!CollectionUtils.isEmpty(result.getList())) { for (View_Dy_Line_Tower_Terminals terminal : result.getList()) { @@ -97,11 +97,11 @@ public class TerminalExtController extends BaseController { @GetMapping("listWithLeadPull") @ApiOperation("查询附带拉力") - public ResponseReult> listWithLeadPull(Integer dyId, Integer lineId, Integer towerId, + public ResponseReult> listWithLeadPull(Integer dyId, Integer lineId, Integer towerId, String search, Integer pageNum, Integer pageSize) { pageNum = this.initPageNum(pageNum); pageSize = this.initPageSize(pageSize); - TableDataInfo result = this.getTerminalPage(dyId, lineId, towerId, + TableDataInfo result = this.getTerminalPage(dyId, lineId, towerId, search, pageNum, pageSize); if (!CollectionUtils.isEmpty(result.getList())) { for (View_Dy_Line_Tower_Terminals terminal : result.getList()) { @@ -112,12 +112,13 @@ public class TerminalExtController extends BaseController { return ResponseReult.success(result); } - private TableDataInfo getTerminalPage(Integer dyId, Integer lineId, Integer towerId, + private TableDataInfo 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 result = terminalService.getTerminalList(vo).getData();