diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/controller/DeviceInfoController.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/controller/DeviceInfoController.java index 47293b9..9981990 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/controller/DeviceInfoController.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/controller/DeviceInfoController.java @@ -8,11 +8,8 @@ import com.newfiber.common.log.annotation.Log; import com.newfiber.common.log.enums.BusinessType; import com.newfiber.termite.domain.DeviceInfo; -import com.newfiber.termite.domain.request.deviceInfo.DeviceInfoBatchSaveRequest; -import com.newfiber.termite.domain.request.deviceInfo.DeviceInfoImportRequest; -import com.newfiber.termite.domain.request.deviceInfo.DeviceInfoQueryRequest; -import com.newfiber.termite.domain.request.deviceInfo.DeviceInfoSaveRequest; -import com.newfiber.termite.domain.request.deviceInfo.DeviceInfoUpdateRequest; +import com.newfiber.termite.domain.SnDeviceInfo; +import com.newfiber.termite.domain.request.deviceInfo.*; import com.newfiber.termite.service.IDeviceInfoService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -105,10 +102,10 @@ /** * 详细查询设备信息 */ - @GetMapping(value = "/{id}") + @GetMapping(value = "/{sn}") @ApiOperation(value = "详细查询设备信息", position = 40) - public Result detail(@PathVariable("id") Long id) { - return success(deviceInfoService.selectDetail(id)); + public Result detail(@PathVariable("sn") String sn) { + return success(deviceInfoService.selectDetail(sn)); } /** @@ -132,4 +129,39 @@ return success(list); } + +// /** +// * 列表查询当前用户设备sn信息 +// */ +// @GetMapping("/snList") +// @ApiOperation(value = "列表查询当前用户设备信息", position = 60) +// public Result> snlist(DeviceSnInfoQueryRequest request) { +// List list = deviceInfoService.selectSnList(request); +// return success(list); +// } +// +// +// /** +// * 分页查询当前用户设备sn信息 +// */ +// @GetMapping("/snPage") +// @ApiOperation(value = "列表查询当前用户设备信息", position = 60) +// public Result> snPage(DeviceInfoQueryRequest request) { +// startPage(); +// List list = deviceInfoService.selectSnPage(request); +// return pageResult(list); +// } +// +// /** +// * SN编号查询监测记录 +// */ +// @GetMapping("/snQuerMonitoryList") +// @ApiOperation(value = "SN编号查询用户设备监测信息", position = 60) +// public Result> snQuerMonitoryList(DeviceInfoQueryRequest request) { +// List list = deviceInfoService.snQuerMonitoryList(request); +// return success(list); +// +// } + + } diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/controller/DeviceInfoController.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/controller/DeviceInfoController.java index 47293b9..9981990 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/controller/DeviceInfoController.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/controller/DeviceInfoController.java @@ -8,11 +8,8 @@ import com.newfiber.common.log.annotation.Log; import com.newfiber.common.log.enums.BusinessType; import com.newfiber.termite.domain.DeviceInfo; -import com.newfiber.termite.domain.request.deviceInfo.DeviceInfoBatchSaveRequest; -import com.newfiber.termite.domain.request.deviceInfo.DeviceInfoImportRequest; -import com.newfiber.termite.domain.request.deviceInfo.DeviceInfoQueryRequest; -import com.newfiber.termite.domain.request.deviceInfo.DeviceInfoSaveRequest; -import com.newfiber.termite.domain.request.deviceInfo.DeviceInfoUpdateRequest; +import com.newfiber.termite.domain.SnDeviceInfo; +import com.newfiber.termite.domain.request.deviceInfo.*; import com.newfiber.termite.service.IDeviceInfoService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -105,10 +102,10 @@ /** * 详细查询设备信息 */ - @GetMapping(value = "/{id}") + @GetMapping(value = "/{sn}") @ApiOperation(value = "详细查询设备信息", position = 40) - public Result detail(@PathVariable("id") Long id) { - return success(deviceInfoService.selectDetail(id)); + public Result detail(@PathVariable("sn") String sn) { + return success(deviceInfoService.selectDetail(sn)); } /** @@ -132,4 +129,39 @@ return success(list); } + +// /** +// * 列表查询当前用户设备sn信息 +// */ +// @GetMapping("/snList") +// @ApiOperation(value = "列表查询当前用户设备信息", position = 60) +// public Result> snlist(DeviceSnInfoQueryRequest request) { +// List list = deviceInfoService.selectSnList(request); +// return success(list); +// } +// +// +// /** +// * 分页查询当前用户设备sn信息 +// */ +// @GetMapping("/snPage") +// @ApiOperation(value = "列表查询当前用户设备信息", position = 60) +// public Result> snPage(DeviceInfoQueryRequest request) { +// startPage(); +// List list = deviceInfoService.selectSnPage(request); +// return pageResult(list); +// } +// +// /** +// * SN编号查询监测记录 +// */ +// @GetMapping("/snQuerMonitoryList") +// @ApiOperation(value = "SN编号查询用户设备监测信息", position = 60) +// public Result> snQuerMonitoryList(DeviceInfoQueryRequest request) { +// List list = deviceInfoService.snQuerMonitoryList(request); +// return success(list); +// +// } + + } diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/SnDeviceInfo.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/SnDeviceInfo.java new file mode 100644 index 0000000..0cb05d0 --- /dev/null +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/SnDeviceInfo.java @@ -0,0 +1,216 @@ +package com.newfiber.termite.domain; + + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.newfiber.common.core.web.domain.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +@Data +@TableName("ter_device_info") +@EqualsAndHashCode(callSuper = true) +@ApiModel(value = "设备信息", description = "设备信息") +public class SnDeviceInfo extends BaseEntity { + private static final long serialVersionUID = 1L; + + /** + * 分类(生产 production | 项目 project) + */ + @ApiModelProperty(value = "分类(生产 production | 项目 project)") + private String category; + + /** + * 项目编号 + */ + @ApiModelProperty(value = "项目编号") + private String projectCode; + + /** + * 设备编号 + */ + @ApiModelProperty(value = "设备编号") + private String sn; + + /** + * 设备类型(4G/WiFi) + */ + @ApiModelProperty(value = "设备类型(4G/WiFi)") + private String deviceType; + + /** + * 位置类型(内圈 inner | 外圈 outer) + */ + @ApiModelProperty(value = "位置类型(内圈 inner | 外圈 outer)") + private String locationType; + + /** + * 设备地址 + */ + @ApiModelProperty(value = "设备地址") + private String location; + + /** + * 初始照片 + */ + @ApiModelProperty(value = "初始照片") + private String initialpictu; + + /** + * 经纬度 + */ + @ApiModelProperty(value = "经纬度") + private String lonandlat; + + /** + * 扩展配置(JSON) + */ + @ApiModelProperty(value = "扩展配置(JSON)") + private String extendConfig; + + /** + * + */ + @ApiModelProperty(value = "") + private Date lastPicTime; + + /** + * 上次加热时间 + */ + @ApiModelProperty(value = "上次加热时间") + private Date lastHeatTime; + + /** + * 上次投药时间 + */ + @ApiModelProperty(value = "上次投药时间") + private Date lastMedicateTime; + + /** + * 首次报警时间(连续3次手动确认则报警) + */ + @ApiModelProperty(value = "首次报警时间(连续3次手动确认则报警)") + private Date firstWarnDatetime; + + /** + * 是否投过药(1是 | 2 否) + */ + @ApiModelProperty(value = "是否投过药(1是 | 2 否)") + private String druging; + + /** + *同步状态(成功 success | 失败 fail) + */ + @ApiModelProperty(value = "同步状态(成功 success | 失败 fail)") + private String syncState; + + /** + * + */ + @ApiModelProperty(value = "软件版本") + private String software; + + /** + * + */ + @ApiModelProperty(value = "硬件版本") + private String hardware; + + /** + * + */ + @ApiModelProperty(value = "电压") + private String voltage; + + /** + * + */ + @ApiModelProperty(value = "温度") + private String temperature; + + /** + * + */ + @ApiModelProperty(value = "信号质量") + private String rssi; + + /** + * + */ + @ApiModelProperty(value = "中继名称") + private String ap; + + /** + * + */ + @ApiModelProperty(value = "摄像头") + private String camera; + + /** + * + */ + @ApiModelProperty(value = "模块厂商") + private String lteManufactor; + + /** + * + */ + @ApiModelProperty(value = "模块型号") + private String lteModel; + + /** + * + */ + @ApiModelProperty(value = "固件版本") + private String lteFirmware; + + /** + * + */ + @ApiModelProperty(value = "IMEI") + private String lteImei; + + /** + * + */ + @ApiModelProperty(value = "ICCID") + private String lteIccid; + + /** + * + */ + @ApiModelProperty(value = "服务商") + private String lteCpos; + + // DB Property + + /** + * 上传地址 + */ + @TableField(exist = false) + @ApiModelProperty(value = "上传地址") + private String uploadApi; + + /** + * 项目名称 + */ + @TableField(exist = false) + @ApiModelProperty(value = "项目名称") + private String projectName; + + + + @ApiModelProperty(value = "是否在线") + private String isOnline; + + + @ApiModelProperty(value = "有无白蚁") + private String yesnoant; + + @ApiModelProperty(value = "告警时间") + private String snDate; +} diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/controller/DeviceInfoController.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/controller/DeviceInfoController.java index 47293b9..9981990 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/controller/DeviceInfoController.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/controller/DeviceInfoController.java @@ -8,11 +8,8 @@ import com.newfiber.common.log.annotation.Log; import com.newfiber.common.log.enums.BusinessType; import com.newfiber.termite.domain.DeviceInfo; -import com.newfiber.termite.domain.request.deviceInfo.DeviceInfoBatchSaveRequest; -import com.newfiber.termite.domain.request.deviceInfo.DeviceInfoImportRequest; -import com.newfiber.termite.domain.request.deviceInfo.DeviceInfoQueryRequest; -import com.newfiber.termite.domain.request.deviceInfo.DeviceInfoSaveRequest; -import com.newfiber.termite.domain.request.deviceInfo.DeviceInfoUpdateRequest; +import com.newfiber.termite.domain.SnDeviceInfo; +import com.newfiber.termite.domain.request.deviceInfo.*; import com.newfiber.termite.service.IDeviceInfoService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -105,10 +102,10 @@ /** * 详细查询设备信息 */ - @GetMapping(value = "/{id}") + @GetMapping(value = "/{sn}") @ApiOperation(value = "详细查询设备信息", position = 40) - public Result detail(@PathVariable("id") Long id) { - return success(deviceInfoService.selectDetail(id)); + public Result detail(@PathVariable("sn") String sn) { + return success(deviceInfoService.selectDetail(sn)); } /** @@ -132,4 +129,39 @@ return success(list); } + +// /** +// * 列表查询当前用户设备sn信息 +// */ +// @GetMapping("/snList") +// @ApiOperation(value = "列表查询当前用户设备信息", position = 60) +// public Result> snlist(DeviceSnInfoQueryRequest request) { +// List list = deviceInfoService.selectSnList(request); +// return success(list); +// } +// +// +// /** +// * 分页查询当前用户设备sn信息 +// */ +// @GetMapping("/snPage") +// @ApiOperation(value = "列表查询当前用户设备信息", position = 60) +// public Result> snPage(DeviceInfoQueryRequest request) { +// startPage(); +// List list = deviceInfoService.selectSnPage(request); +// return pageResult(list); +// } +// +// /** +// * SN编号查询监测记录 +// */ +// @GetMapping("/snQuerMonitoryList") +// @ApiOperation(value = "SN编号查询用户设备监测信息", position = 60) +// public Result> snQuerMonitoryList(DeviceInfoQueryRequest request) { +// List list = deviceInfoService.snQuerMonitoryList(request); +// return success(list); +// +// } + + } diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/SnDeviceInfo.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/SnDeviceInfo.java new file mode 100644 index 0000000..0cb05d0 --- /dev/null +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/SnDeviceInfo.java @@ -0,0 +1,216 @@ +package com.newfiber.termite.domain; + + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.newfiber.common.core.web.domain.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +@Data +@TableName("ter_device_info") +@EqualsAndHashCode(callSuper = true) +@ApiModel(value = "设备信息", description = "设备信息") +public class SnDeviceInfo extends BaseEntity { + private static final long serialVersionUID = 1L; + + /** + * 分类(生产 production | 项目 project) + */ + @ApiModelProperty(value = "分类(生产 production | 项目 project)") + private String category; + + /** + * 项目编号 + */ + @ApiModelProperty(value = "项目编号") + private String projectCode; + + /** + * 设备编号 + */ + @ApiModelProperty(value = "设备编号") + private String sn; + + /** + * 设备类型(4G/WiFi) + */ + @ApiModelProperty(value = "设备类型(4G/WiFi)") + private String deviceType; + + /** + * 位置类型(内圈 inner | 外圈 outer) + */ + @ApiModelProperty(value = "位置类型(内圈 inner | 外圈 outer)") + private String locationType; + + /** + * 设备地址 + */ + @ApiModelProperty(value = "设备地址") + private String location; + + /** + * 初始照片 + */ + @ApiModelProperty(value = "初始照片") + private String initialpictu; + + /** + * 经纬度 + */ + @ApiModelProperty(value = "经纬度") + private String lonandlat; + + /** + * 扩展配置(JSON) + */ + @ApiModelProperty(value = "扩展配置(JSON)") + private String extendConfig; + + /** + * + */ + @ApiModelProperty(value = "") + private Date lastPicTime; + + /** + * 上次加热时间 + */ + @ApiModelProperty(value = "上次加热时间") + private Date lastHeatTime; + + /** + * 上次投药时间 + */ + @ApiModelProperty(value = "上次投药时间") + private Date lastMedicateTime; + + /** + * 首次报警时间(连续3次手动确认则报警) + */ + @ApiModelProperty(value = "首次报警时间(连续3次手动确认则报警)") + private Date firstWarnDatetime; + + /** + * 是否投过药(1是 | 2 否) + */ + @ApiModelProperty(value = "是否投过药(1是 | 2 否)") + private String druging; + + /** + *同步状态(成功 success | 失败 fail) + */ + @ApiModelProperty(value = "同步状态(成功 success | 失败 fail)") + private String syncState; + + /** + * + */ + @ApiModelProperty(value = "软件版本") + private String software; + + /** + * + */ + @ApiModelProperty(value = "硬件版本") + private String hardware; + + /** + * + */ + @ApiModelProperty(value = "电压") + private String voltage; + + /** + * + */ + @ApiModelProperty(value = "温度") + private String temperature; + + /** + * + */ + @ApiModelProperty(value = "信号质量") + private String rssi; + + /** + * + */ + @ApiModelProperty(value = "中继名称") + private String ap; + + /** + * + */ + @ApiModelProperty(value = "摄像头") + private String camera; + + /** + * + */ + @ApiModelProperty(value = "模块厂商") + private String lteManufactor; + + /** + * + */ + @ApiModelProperty(value = "模块型号") + private String lteModel; + + /** + * + */ + @ApiModelProperty(value = "固件版本") + private String lteFirmware; + + /** + * + */ + @ApiModelProperty(value = "IMEI") + private String lteImei; + + /** + * + */ + @ApiModelProperty(value = "ICCID") + private String lteIccid; + + /** + * + */ + @ApiModelProperty(value = "服务商") + private String lteCpos; + + // DB Property + + /** + * 上传地址 + */ + @TableField(exist = false) + @ApiModelProperty(value = "上传地址") + private String uploadApi; + + /** + * 项目名称 + */ + @TableField(exist = false) + @ApiModelProperty(value = "项目名称") + private String projectName; + + + + @ApiModelProperty(value = "是否在线") + private String isOnline; + + + @ApiModelProperty(value = "有无白蚁") + private String yesnoant; + + @ApiModelProperty(value = "告警时间") + private String snDate; +} diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/deviceInfo/DeviceInfoQueryRequest.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/deviceInfo/DeviceInfoQueryRequest.java index 1c8a2d3..39512dc 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/deviceInfo/DeviceInfoQueryRequest.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/deviceInfo/DeviceInfoQueryRequest.java @@ -37,4 +37,7 @@ private String warnFlag; private List projectCodeList; + + //用户id + private Long userId; } diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/controller/DeviceInfoController.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/controller/DeviceInfoController.java index 47293b9..9981990 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/controller/DeviceInfoController.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/controller/DeviceInfoController.java @@ -8,11 +8,8 @@ import com.newfiber.common.log.annotation.Log; import com.newfiber.common.log.enums.BusinessType; import com.newfiber.termite.domain.DeviceInfo; -import com.newfiber.termite.domain.request.deviceInfo.DeviceInfoBatchSaveRequest; -import com.newfiber.termite.domain.request.deviceInfo.DeviceInfoImportRequest; -import com.newfiber.termite.domain.request.deviceInfo.DeviceInfoQueryRequest; -import com.newfiber.termite.domain.request.deviceInfo.DeviceInfoSaveRequest; -import com.newfiber.termite.domain.request.deviceInfo.DeviceInfoUpdateRequest; +import com.newfiber.termite.domain.SnDeviceInfo; +import com.newfiber.termite.domain.request.deviceInfo.*; import com.newfiber.termite.service.IDeviceInfoService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -105,10 +102,10 @@ /** * 详细查询设备信息 */ - @GetMapping(value = "/{id}") + @GetMapping(value = "/{sn}") @ApiOperation(value = "详细查询设备信息", position = 40) - public Result detail(@PathVariable("id") Long id) { - return success(deviceInfoService.selectDetail(id)); + public Result detail(@PathVariable("sn") String sn) { + return success(deviceInfoService.selectDetail(sn)); } /** @@ -132,4 +129,39 @@ return success(list); } + +// /** +// * 列表查询当前用户设备sn信息 +// */ +// @GetMapping("/snList") +// @ApiOperation(value = "列表查询当前用户设备信息", position = 60) +// public Result> snlist(DeviceSnInfoQueryRequest request) { +// List list = deviceInfoService.selectSnList(request); +// return success(list); +// } +// +// +// /** +// * 分页查询当前用户设备sn信息 +// */ +// @GetMapping("/snPage") +// @ApiOperation(value = "列表查询当前用户设备信息", position = 60) +// public Result> snPage(DeviceInfoQueryRequest request) { +// startPage(); +// List list = deviceInfoService.selectSnPage(request); +// return pageResult(list); +// } +// +// /** +// * SN编号查询监测记录 +// */ +// @GetMapping("/snQuerMonitoryList") +// @ApiOperation(value = "SN编号查询用户设备监测信息", position = 60) +// public Result> snQuerMonitoryList(DeviceInfoQueryRequest request) { +// List list = deviceInfoService.snQuerMonitoryList(request); +// return success(list); +// +// } + + } diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/SnDeviceInfo.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/SnDeviceInfo.java new file mode 100644 index 0000000..0cb05d0 --- /dev/null +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/SnDeviceInfo.java @@ -0,0 +1,216 @@ +package com.newfiber.termite.domain; + + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.newfiber.common.core.web.domain.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +@Data +@TableName("ter_device_info") +@EqualsAndHashCode(callSuper = true) +@ApiModel(value = "设备信息", description = "设备信息") +public class SnDeviceInfo extends BaseEntity { + private static final long serialVersionUID = 1L; + + /** + * 分类(生产 production | 项目 project) + */ + @ApiModelProperty(value = "分类(生产 production | 项目 project)") + private String category; + + /** + * 项目编号 + */ + @ApiModelProperty(value = "项目编号") + private String projectCode; + + /** + * 设备编号 + */ + @ApiModelProperty(value = "设备编号") + private String sn; + + /** + * 设备类型(4G/WiFi) + */ + @ApiModelProperty(value = "设备类型(4G/WiFi)") + private String deviceType; + + /** + * 位置类型(内圈 inner | 外圈 outer) + */ + @ApiModelProperty(value = "位置类型(内圈 inner | 外圈 outer)") + private String locationType; + + /** + * 设备地址 + */ + @ApiModelProperty(value = "设备地址") + private String location; + + /** + * 初始照片 + */ + @ApiModelProperty(value = "初始照片") + private String initialpictu; + + /** + * 经纬度 + */ + @ApiModelProperty(value = "经纬度") + private String lonandlat; + + /** + * 扩展配置(JSON) + */ + @ApiModelProperty(value = "扩展配置(JSON)") + private String extendConfig; + + /** + * + */ + @ApiModelProperty(value = "") + private Date lastPicTime; + + /** + * 上次加热时间 + */ + @ApiModelProperty(value = "上次加热时间") + private Date lastHeatTime; + + /** + * 上次投药时间 + */ + @ApiModelProperty(value = "上次投药时间") + private Date lastMedicateTime; + + /** + * 首次报警时间(连续3次手动确认则报警) + */ + @ApiModelProperty(value = "首次报警时间(连续3次手动确认则报警)") + private Date firstWarnDatetime; + + /** + * 是否投过药(1是 | 2 否) + */ + @ApiModelProperty(value = "是否投过药(1是 | 2 否)") + private String druging; + + /** + *同步状态(成功 success | 失败 fail) + */ + @ApiModelProperty(value = "同步状态(成功 success | 失败 fail)") + private String syncState; + + /** + * + */ + @ApiModelProperty(value = "软件版本") + private String software; + + /** + * + */ + @ApiModelProperty(value = "硬件版本") + private String hardware; + + /** + * + */ + @ApiModelProperty(value = "电压") + private String voltage; + + /** + * + */ + @ApiModelProperty(value = "温度") + private String temperature; + + /** + * + */ + @ApiModelProperty(value = "信号质量") + private String rssi; + + /** + * + */ + @ApiModelProperty(value = "中继名称") + private String ap; + + /** + * + */ + @ApiModelProperty(value = "摄像头") + private String camera; + + /** + * + */ + @ApiModelProperty(value = "模块厂商") + private String lteManufactor; + + /** + * + */ + @ApiModelProperty(value = "模块型号") + private String lteModel; + + /** + * + */ + @ApiModelProperty(value = "固件版本") + private String lteFirmware; + + /** + * + */ + @ApiModelProperty(value = "IMEI") + private String lteImei; + + /** + * + */ + @ApiModelProperty(value = "ICCID") + private String lteIccid; + + /** + * + */ + @ApiModelProperty(value = "服务商") + private String lteCpos; + + // DB Property + + /** + * 上传地址 + */ + @TableField(exist = false) + @ApiModelProperty(value = "上传地址") + private String uploadApi; + + /** + * 项目名称 + */ + @TableField(exist = false) + @ApiModelProperty(value = "项目名称") + private String projectName; + + + + @ApiModelProperty(value = "是否在线") + private String isOnline; + + + @ApiModelProperty(value = "有无白蚁") + private String yesnoant; + + @ApiModelProperty(value = "告警时间") + private String snDate; +} diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/deviceInfo/DeviceInfoQueryRequest.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/deviceInfo/DeviceInfoQueryRequest.java index 1c8a2d3..39512dc 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/deviceInfo/DeviceInfoQueryRequest.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/deviceInfo/DeviceInfoQueryRequest.java @@ -37,4 +37,7 @@ private String warnFlag; private List projectCodeList; + + //用户id + private Long userId; } diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/deviceInfo/DeviceSnInfoQueryRequest.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/deviceInfo/DeviceSnInfoQueryRequest.java new file mode 100644 index 0000000..021a977 --- /dev/null +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/deviceInfo/DeviceSnInfoQueryRequest.java @@ -0,0 +1,45 @@ +package com.newfiber.termite.domain.request.deviceInfo; + + +import com.newfiber.common.core.web.request.BaseQueryRequest; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.List; + + +/** + * sn设备信息对象 ter_device_info + * + */ +@Data +@EqualsAndHashCode(callSuper = true) +public class DeviceSnInfoQueryRequest extends BaseQueryRequest { + /** + * 分类(生产 production | 项目 project) + */ + @ApiModelProperty(value = "分类(生产 production | 项目 project)") + private String category; + + /** + * 项目编号 + */ + @ApiModelProperty(value = "项目编号") + private String projectCode; + + /** + * 设备编号 + */ + @ApiModelProperty(value = "设备编号") + private String sn; + + private String warnFlag; + + private List projectCodeList; + + //用户id + private Long userId; + + +} diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/controller/DeviceInfoController.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/controller/DeviceInfoController.java index 47293b9..9981990 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/controller/DeviceInfoController.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/controller/DeviceInfoController.java @@ -8,11 +8,8 @@ import com.newfiber.common.log.annotation.Log; import com.newfiber.common.log.enums.BusinessType; import com.newfiber.termite.domain.DeviceInfo; -import com.newfiber.termite.domain.request.deviceInfo.DeviceInfoBatchSaveRequest; -import com.newfiber.termite.domain.request.deviceInfo.DeviceInfoImportRequest; -import com.newfiber.termite.domain.request.deviceInfo.DeviceInfoQueryRequest; -import com.newfiber.termite.domain.request.deviceInfo.DeviceInfoSaveRequest; -import com.newfiber.termite.domain.request.deviceInfo.DeviceInfoUpdateRequest; +import com.newfiber.termite.domain.SnDeviceInfo; +import com.newfiber.termite.domain.request.deviceInfo.*; import com.newfiber.termite.service.IDeviceInfoService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -105,10 +102,10 @@ /** * 详细查询设备信息 */ - @GetMapping(value = "/{id}") + @GetMapping(value = "/{sn}") @ApiOperation(value = "详细查询设备信息", position = 40) - public Result detail(@PathVariable("id") Long id) { - return success(deviceInfoService.selectDetail(id)); + public Result detail(@PathVariable("sn") String sn) { + return success(deviceInfoService.selectDetail(sn)); } /** @@ -132,4 +129,39 @@ return success(list); } + +// /** +// * 列表查询当前用户设备sn信息 +// */ +// @GetMapping("/snList") +// @ApiOperation(value = "列表查询当前用户设备信息", position = 60) +// public Result> snlist(DeviceSnInfoQueryRequest request) { +// List list = deviceInfoService.selectSnList(request); +// return success(list); +// } +// +// +// /** +// * 分页查询当前用户设备sn信息 +// */ +// @GetMapping("/snPage") +// @ApiOperation(value = "列表查询当前用户设备信息", position = 60) +// public Result> snPage(DeviceInfoQueryRequest request) { +// startPage(); +// List list = deviceInfoService.selectSnPage(request); +// return pageResult(list); +// } +// +// /** +// * SN编号查询监测记录 +// */ +// @GetMapping("/snQuerMonitoryList") +// @ApiOperation(value = "SN编号查询用户设备监测信息", position = 60) +// public Result> snQuerMonitoryList(DeviceInfoQueryRequest request) { +// List list = deviceInfoService.snQuerMonitoryList(request); +// return success(list); +// +// } + + } diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/SnDeviceInfo.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/SnDeviceInfo.java new file mode 100644 index 0000000..0cb05d0 --- /dev/null +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/SnDeviceInfo.java @@ -0,0 +1,216 @@ +package com.newfiber.termite.domain; + + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.newfiber.common.core.web.domain.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +@Data +@TableName("ter_device_info") +@EqualsAndHashCode(callSuper = true) +@ApiModel(value = "设备信息", description = "设备信息") +public class SnDeviceInfo extends BaseEntity { + private static final long serialVersionUID = 1L; + + /** + * 分类(生产 production | 项目 project) + */ + @ApiModelProperty(value = "分类(生产 production | 项目 project)") + private String category; + + /** + * 项目编号 + */ + @ApiModelProperty(value = "项目编号") + private String projectCode; + + /** + * 设备编号 + */ + @ApiModelProperty(value = "设备编号") + private String sn; + + /** + * 设备类型(4G/WiFi) + */ + @ApiModelProperty(value = "设备类型(4G/WiFi)") + private String deviceType; + + /** + * 位置类型(内圈 inner | 外圈 outer) + */ + @ApiModelProperty(value = "位置类型(内圈 inner | 外圈 outer)") + private String locationType; + + /** + * 设备地址 + */ + @ApiModelProperty(value = "设备地址") + private String location; + + /** + * 初始照片 + */ + @ApiModelProperty(value = "初始照片") + private String initialpictu; + + /** + * 经纬度 + */ + @ApiModelProperty(value = "经纬度") + private String lonandlat; + + /** + * 扩展配置(JSON) + */ + @ApiModelProperty(value = "扩展配置(JSON)") + private String extendConfig; + + /** + * + */ + @ApiModelProperty(value = "") + private Date lastPicTime; + + /** + * 上次加热时间 + */ + @ApiModelProperty(value = "上次加热时间") + private Date lastHeatTime; + + /** + * 上次投药时间 + */ + @ApiModelProperty(value = "上次投药时间") + private Date lastMedicateTime; + + /** + * 首次报警时间(连续3次手动确认则报警) + */ + @ApiModelProperty(value = "首次报警时间(连续3次手动确认则报警)") + private Date firstWarnDatetime; + + /** + * 是否投过药(1是 | 2 否) + */ + @ApiModelProperty(value = "是否投过药(1是 | 2 否)") + private String druging; + + /** + *同步状态(成功 success | 失败 fail) + */ + @ApiModelProperty(value = "同步状态(成功 success | 失败 fail)") + private String syncState; + + /** + * + */ + @ApiModelProperty(value = "软件版本") + private String software; + + /** + * + */ + @ApiModelProperty(value = "硬件版本") + private String hardware; + + /** + * + */ + @ApiModelProperty(value = "电压") + private String voltage; + + /** + * + */ + @ApiModelProperty(value = "温度") + private String temperature; + + /** + * + */ + @ApiModelProperty(value = "信号质量") + private String rssi; + + /** + * + */ + @ApiModelProperty(value = "中继名称") + private String ap; + + /** + * + */ + @ApiModelProperty(value = "摄像头") + private String camera; + + /** + * + */ + @ApiModelProperty(value = "模块厂商") + private String lteManufactor; + + /** + * + */ + @ApiModelProperty(value = "模块型号") + private String lteModel; + + /** + * + */ + @ApiModelProperty(value = "固件版本") + private String lteFirmware; + + /** + * + */ + @ApiModelProperty(value = "IMEI") + private String lteImei; + + /** + * + */ + @ApiModelProperty(value = "ICCID") + private String lteIccid; + + /** + * + */ + @ApiModelProperty(value = "服务商") + private String lteCpos; + + // DB Property + + /** + * 上传地址 + */ + @TableField(exist = false) + @ApiModelProperty(value = "上传地址") + private String uploadApi; + + /** + * 项目名称 + */ + @TableField(exist = false) + @ApiModelProperty(value = "项目名称") + private String projectName; + + + + @ApiModelProperty(value = "是否在线") + private String isOnline; + + + @ApiModelProperty(value = "有无白蚁") + private String yesnoant; + + @ApiModelProperty(value = "告警时间") + private String snDate; +} diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/deviceInfo/DeviceInfoQueryRequest.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/deviceInfo/DeviceInfoQueryRequest.java index 1c8a2d3..39512dc 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/deviceInfo/DeviceInfoQueryRequest.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/deviceInfo/DeviceInfoQueryRequest.java @@ -37,4 +37,7 @@ private String warnFlag; private List projectCodeList; + + //用户id + private Long userId; } diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/deviceInfo/DeviceSnInfoQueryRequest.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/deviceInfo/DeviceSnInfoQueryRequest.java new file mode 100644 index 0000000..021a977 --- /dev/null +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/deviceInfo/DeviceSnInfoQueryRequest.java @@ -0,0 +1,45 @@ +package com.newfiber.termite.domain.request.deviceInfo; + + +import com.newfiber.common.core.web.request.BaseQueryRequest; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.List; + + +/** + * sn设备信息对象 ter_device_info + * + */ +@Data +@EqualsAndHashCode(callSuper = true) +public class DeviceSnInfoQueryRequest extends BaseQueryRequest { + /** + * 分类(生产 production | 项目 project) + */ + @ApiModelProperty(value = "分类(生产 production | 项目 project)") + private String category; + + /** + * 项目编号 + */ + @ApiModelProperty(value = "项目编号") + private String projectCode; + + /** + * 设备编号 + */ + @ApiModelProperty(value = "设备编号") + private String sn; + + private String warnFlag; + + private List projectCodeList; + + //用户id + private Long userId; + + +} diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/mapper/DeviceInfoMapper.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/mapper/DeviceInfoMapper.java index b16357f..ba8e7b5 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/mapper/DeviceInfoMapper.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/mapper/DeviceInfoMapper.java @@ -2,6 +2,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.newfiber.termite.domain.DeviceInfo; +import com.newfiber.termite.domain.SnDeviceInfo; import com.newfiber.termite.domain.request.deviceInfo.DeviceInfoQueryRequest; import java.util.List; import org.apache.ibatis.annotations.Mapper; @@ -32,5 +33,12 @@ */ DeviceInfo selectOneById(@Param("id") Long id); + List selectSnByCondition(@Param("request") DeviceInfoQueryRequest request); + + + //List snQuerMonitoryList(@Param("request") DeviceInfoQueryRequest request); + + + } diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/controller/DeviceInfoController.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/controller/DeviceInfoController.java index 47293b9..9981990 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/controller/DeviceInfoController.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/controller/DeviceInfoController.java @@ -8,11 +8,8 @@ import com.newfiber.common.log.annotation.Log; import com.newfiber.common.log.enums.BusinessType; import com.newfiber.termite.domain.DeviceInfo; -import com.newfiber.termite.domain.request.deviceInfo.DeviceInfoBatchSaveRequest; -import com.newfiber.termite.domain.request.deviceInfo.DeviceInfoImportRequest; -import com.newfiber.termite.domain.request.deviceInfo.DeviceInfoQueryRequest; -import com.newfiber.termite.domain.request.deviceInfo.DeviceInfoSaveRequest; -import com.newfiber.termite.domain.request.deviceInfo.DeviceInfoUpdateRequest; +import com.newfiber.termite.domain.SnDeviceInfo; +import com.newfiber.termite.domain.request.deviceInfo.*; import com.newfiber.termite.service.IDeviceInfoService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -105,10 +102,10 @@ /** * 详细查询设备信息 */ - @GetMapping(value = "/{id}") + @GetMapping(value = "/{sn}") @ApiOperation(value = "详细查询设备信息", position = 40) - public Result detail(@PathVariable("id") Long id) { - return success(deviceInfoService.selectDetail(id)); + public Result detail(@PathVariable("sn") String sn) { + return success(deviceInfoService.selectDetail(sn)); } /** @@ -132,4 +129,39 @@ return success(list); } + +// /** +// * 列表查询当前用户设备sn信息 +// */ +// @GetMapping("/snList") +// @ApiOperation(value = "列表查询当前用户设备信息", position = 60) +// public Result> snlist(DeviceSnInfoQueryRequest request) { +// List list = deviceInfoService.selectSnList(request); +// return success(list); +// } +// +// +// /** +// * 分页查询当前用户设备sn信息 +// */ +// @GetMapping("/snPage") +// @ApiOperation(value = "列表查询当前用户设备信息", position = 60) +// public Result> snPage(DeviceInfoQueryRequest request) { +// startPage(); +// List list = deviceInfoService.selectSnPage(request); +// return pageResult(list); +// } +// +// /** +// * SN编号查询监测记录 +// */ +// @GetMapping("/snQuerMonitoryList") +// @ApiOperation(value = "SN编号查询用户设备监测信息", position = 60) +// public Result> snQuerMonitoryList(DeviceInfoQueryRequest request) { +// List list = deviceInfoService.snQuerMonitoryList(request); +// return success(list); +// +// } + + } diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/SnDeviceInfo.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/SnDeviceInfo.java new file mode 100644 index 0000000..0cb05d0 --- /dev/null +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/SnDeviceInfo.java @@ -0,0 +1,216 @@ +package com.newfiber.termite.domain; + + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.newfiber.common.core.web.domain.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +@Data +@TableName("ter_device_info") +@EqualsAndHashCode(callSuper = true) +@ApiModel(value = "设备信息", description = "设备信息") +public class SnDeviceInfo extends BaseEntity { + private static final long serialVersionUID = 1L; + + /** + * 分类(生产 production | 项目 project) + */ + @ApiModelProperty(value = "分类(生产 production | 项目 project)") + private String category; + + /** + * 项目编号 + */ + @ApiModelProperty(value = "项目编号") + private String projectCode; + + /** + * 设备编号 + */ + @ApiModelProperty(value = "设备编号") + private String sn; + + /** + * 设备类型(4G/WiFi) + */ + @ApiModelProperty(value = "设备类型(4G/WiFi)") + private String deviceType; + + /** + * 位置类型(内圈 inner | 外圈 outer) + */ + @ApiModelProperty(value = "位置类型(内圈 inner | 外圈 outer)") + private String locationType; + + /** + * 设备地址 + */ + @ApiModelProperty(value = "设备地址") + private String location; + + /** + * 初始照片 + */ + @ApiModelProperty(value = "初始照片") + private String initialpictu; + + /** + * 经纬度 + */ + @ApiModelProperty(value = "经纬度") + private String lonandlat; + + /** + * 扩展配置(JSON) + */ + @ApiModelProperty(value = "扩展配置(JSON)") + private String extendConfig; + + /** + * + */ + @ApiModelProperty(value = "") + private Date lastPicTime; + + /** + * 上次加热时间 + */ + @ApiModelProperty(value = "上次加热时间") + private Date lastHeatTime; + + /** + * 上次投药时间 + */ + @ApiModelProperty(value = "上次投药时间") + private Date lastMedicateTime; + + /** + * 首次报警时间(连续3次手动确认则报警) + */ + @ApiModelProperty(value = "首次报警时间(连续3次手动确认则报警)") + private Date firstWarnDatetime; + + /** + * 是否投过药(1是 | 2 否) + */ + @ApiModelProperty(value = "是否投过药(1是 | 2 否)") + private String druging; + + /** + *同步状态(成功 success | 失败 fail) + */ + @ApiModelProperty(value = "同步状态(成功 success | 失败 fail)") + private String syncState; + + /** + * + */ + @ApiModelProperty(value = "软件版本") + private String software; + + /** + * + */ + @ApiModelProperty(value = "硬件版本") + private String hardware; + + /** + * + */ + @ApiModelProperty(value = "电压") + private String voltage; + + /** + * + */ + @ApiModelProperty(value = "温度") + private String temperature; + + /** + * + */ + @ApiModelProperty(value = "信号质量") + private String rssi; + + /** + * + */ + @ApiModelProperty(value = "中继名称") + private String ap; + + /** + * + */ + @ApiModelProperty(value = "摄像头") + private String camera; + + /** + * + */ + @ApiModelProperty(value = "模块厂商") + private String lteManufactor; + + /** + * + */ + @ApiModelProperty(value = "模块型号") + private String lteModel; + + /** + * + */ + @ApiModelProperty(value = "固件版本") + private String lteFirmware; + + /** + * + */ + @ApiModelProperty(value = "IMEI") + private String lteImei; + + /** + * + */ + @ApiModelProperty(value = "ICCID") + private String lteIccid; + + /** + * + */ + @ApiModelProperty(value = "服务商") + private String lteCpos; + + // DB Property + + /** + * 上传地址 + */ + @TableField(exist = false) + @ApiModelProperty(value = "上传地址") + private String uploadApi; + + /** + * 项目名称 + */ + @TableField(exist = false) + @ApiModelProperty(value = "项目名称") + private String projectName; + + + + @ApiModelProperty(value = "是否在线") + private String isOnline; + + + @ApiModelProperty(value = "有无白蚁") + private String yesnoant; + + @ApiModelProperty(value = "告警时间") + private String snDate; +} diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/deviceInfo/DeviceInfoQueryRequest.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/deviceInfo/DeviceInfoQueryRequest.java index 1c8a2d3..39512dc 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/deviceInfo/DeviceInfoQueryRequest.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/deviceInfo/DeviceInfoQueryRequest.java @@ -37,4 +37,7 @@ private String warnFlag; private List projectCodeList; + + //用户id + private Long userId; } diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/deviceInfo/DeviceSnInfoQueryRequest.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/deviceInfo/DeviceSnInfoQueryRequest.java new file mode 100644 index 0000000..021a977 --- /dev/null +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/deviceInfo/DeviceSnInfoQueryRequest.java @@ -0,0 +1,45 @@ +package com.newfiber.termite.domain.request.deviceInfo; + + +import com.newfiber.common.core.web.request.BaseQueryRequest; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.List; + + +/** + * sn设备信息对象 ter_device_info + * + */ +@Data +@EqualsAndHashCode(callSuper = true) +public class DeviceSnInfoQueryRequest extends BaseQueryRequest { + /** + * 分类(生产 production | 项目 project) + */ + @ApiModelProperty(value = "分类(生产 production | 项目 project)") + private String category; + + /** + * 项目编号 + */ + @ApiModelProperty(value = "项目编号") + private String projectCode; + + /** + * 设备编号 + */ + @ApiModelProperty(value = "设备编号") + private String sn; + + private String warnFlag; + + private List projectCodeList; + + //用户id + private Long userId; + + +} diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/mapper/DeviceInfoMapper.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/mapper/DeviceInfoMapper.java index b16357f..ba8e7b5 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/mapper/DeviceInfoMapper.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/mapper/DeviceInfoMapper.java @@ -2,6 +2,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.newfiber.termite.domain.DeviceInfo; +import com.newfiber.termite.domain.SnDeviceInfo; import com.newfiber.termite.domain.request.deviceInfo.DeviceInfoQueryRequest; import java.util.List; import org.apache.ibatis.annotations.Mapper; @@ -32,5 +33,12 @@ */ DeviceInfo selectOneById(@Param("id") Long id); + List selectSnByCondition(@Param("request") DeviceInfoQueryRequest request); + + + //List snQuerMonitoryList(@Param("request") DeviceInfoQueryRequest request); + + + } diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/IDeviceInfoService.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/IDeviceInfoService.java index 9c03500..3a9614e 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/IDeviceInfoService.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/IDeviceInfoService.java @@ -1,12 +1,9 @@ package com.newfiber.termite.service; import com.newfiber.termite.domain.DeviceInfo; +import com.newfiber.termite.domain.SnDeviceInfo; import com.newfiber.termite.domain.dto.TermiteDataUpRequest; -import com.newfiber.termite.domain.request.deviceInfo.DeviceInfoBatchSaveRequest; -import com.newfiber.termite.domain.request.deviceInfo.DeviceInfoQueryRequest; -import com.newfiber.termite.domain.request.deviceInfo.DeviceInfoSaveRequest; -import com.newfiber.termite.domain.request.deviceInfo.DeviceInfoStateSyncRequest; -import com.newfiber.termite.domain.request.deviceInfo.DeviceInfoUpdateRequest; +import com.newfiber.termite.domain.request.deviceInfo.*; import com.newfiber.termite.enums.EDeviceSyncState; import java.util.List; @@ -113,4 +110,19 @@ */ List selectList(String projectCode); + + List selectSnList(DeviceSnInfoQueryRequest request); + + + /** + * 分页查询设备信息 + * + * @param request 分页参数 + * @return 设备信息集合 +// */ +// List selectSnPage(DeviceInfoQueryRequest request); +// +// +// List snQuerMonitoryList(DeviceInfoQueryRequest request); + } diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/controller/DeviceInfoController.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/controller/DeviceInfoController.java index 47293b9..9981990 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/controller/DeviceInfoController.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/controller/DeviceInfoController.java @@ -8,11 +8,8 @@ import com.newfiber.common.log.annotation.Log; import com.newfiber.common.log.enums.BusinessType; import com.newfiber.termite.domain.DeviceInfo; -import com.newfiber.termite.domain.request.deviceInfo.DeviceInfoBatchSaveRequest; -import com.newfiber.termite.domain.request.deviceInfo.DeviceInfoImportRequest; -import com.newfiber.termite.domain.request.deviceInfo.DeviceInfoQueryRequest; -import com.newfiber.termite.domain.request.deviceInfo.DeviceInfoSaveRequest; -import com.newfiber.termite.domain.request.deviceInfo.DeviceInfoUpdateRequest; +import com.newfiber.termite.domain.SnDeviceInfo; +import com.newfiber.termite.domain.request.deviceInfo.*; import com.newfiber.termite.service.IDeviceInfoService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -105,10 +102,10 @@ /** * 详细查询设备信息 */ - @GetMapping(value = "/{id}") + @GetMapping(value = "/{sn}") @ApiOperation(value = "详细查询设备信息", position = 40) - public Result detail(@PathVariable("id") Long id) { - return success(deviceInfoService.selectDetail(id)); + public Result detail(@PathVariable("sn") String sn) { + return success(deviceInfoService.selectDetail(sn)); } /** @@ -132,4 +129,39 @@ return success(list); } + +// /** +// * 列表查询当前用户设备sn信息 +// */ +// @GetMapping("/snList") +// @ApiOperation(value = "列表查询当前用户设备信息", position = 60) +// public Result> snlist(DeviceSnInfoQueryRequest request) { +// List list = deviceInfoService.selectSnList(request); +// return success(list); +// } +// +// +// /** +// * 分页查询当前用户设备sn信息 +// */ +// @GetMapping("/snPage") +// @ApiOperation(value = "列表查询当前用户设备信息", position = 60) +// public Result> snPage(DeviceInfoQueryRequest request) { +// startPage(); +// List list = deviceInfoService.selectSnPage(request); +// return pageResult(list); +// } +// +// /** +// * SN编号查询监测记录 +// */ +// @GetMapping("/snQuerMonitoryList") +// @ApiOperation(value = "SN编号查询用户设备监测信息", position = 60) +// public Result> snQuerMonitoryList(DeviceInfoQueryRequest request) { +// List list = deviceInfoService.snQuerMonitoryList(request); +// return success(list); +// +// } + + } diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/SnDeviceInfo.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/SnDeviceInfo.java new file mode 100644 index 0000000..0cb05d0 --- /dev/null +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/SnDeviceInfo.java @@ -0,0 +1,216 @@ +package com.newfiber.termite.domain; + + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.newfiber.common.core.web.domain.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +@Data +@TableName("ter_device_info") +@EqualsAndHashCode(callSuper = true) +@ApiModel(value = "设备信息", description = "设备信息") +public class SnDeviceInfo extends BaseEntity { + private static final long serialVersionUID = 1L; + + /** + * 分类(生产 production | 项目 project) + */ + @ApiModelProperty(value = "分类(生产 production | 项目 project)") + private String category; + + /** + * 项目编号 + */ + @ApiModelProperty(value = "项目编号") + private String projectCode; + + /** + * 设备编号 + */ + @ApiModelProperty(value = "设备编号") + private String sn; + + /** + * 设备类型(4G/WiFi) + */ + @ApiModelProperty(value = "设备类型(4G/WiFi)") + private String deviceType; + + /** + * 位置类型(内圈 inner | 外圈 outer) + */ + @ApiModelProperty(value = "位置类型(内圈 inner | 外圈 outer)") + private String locationType; + + /** + * 设备地址 + */ + @ApiModelProperty(value = "设备地址") + private String location; + + /** + * 初始照片 + */ + @ApiModelProperty(value = "初始照片") + private String initialpictu; + + /** + * 经纬度 + */ + @ApiModelProperty(value = "经纬度") + private String lonandlat; + + /** + * 扩展配置(JSON) + */ + @ApiModelProperty(value = "扩展配置(JSON)") + private String extendConfig; + + /** + * + */ + @ApiModelProperty(value = "") + private Date lastPicTime; + + /** + * 上次加热时间 + */ + @ApiModelProperty(value = "上次加热时间") + private Date lastHeatTime; + + /** + * 上次投药时间 + */ + @ApiModelProperty(value = "上次投药时间") + private Date lastMedicateTime; + + /** + * 首次报警时间(连续3次手动确认则报警) + */ + @ApiModelProperty(value = "首次报警时间(连续3次手动确认则报警)") + private Date firstWarnDatetime; + + /** + * 是否投过药(1是 | 2 否) + */ + @ApiModelProperty(value = "是否投过药(1是 | 2 否)") + private String druging; + + /** + *同步状态(成功 success | 失败 fail) + */ + @ApiModelProperty(value = "同步状态(成功 success | 失败 fail)") + private String syncState; + + /** + * + */ + @ApiModelProperty(value = "软件版本") + private String software; + + /** + * + */ + @ApiModelProperty(value = "硬件版本") + private String hardware; + + /** + * + */ + @ApiModelProperty(value = "电压") + private String voltage; + + /** + * + */ + @ApiModelProperty(value = "温度") + private String temperature; + + /** + * + */ + @ApiModelProperty(value = "信号质量") + private String rssi; + + /** + * + */ + @ApiModelProperty(value = "中继名称") + private String ap; + + /** + * + */ + @ApiModelProperty(value = "摄像头") + private String camera; + + /** + * + */ + @ApiModelProperty(value = "模块厂商") + private String lteManufactor; + + /** + * + */ + @ApiModelProperty(value = "模块型号") + private String lteModel; + + /** + * + */ + @ApiModelProperty(value = "固件版本") + private String lteFirmware; + + /** + * + */ + @ApiModelProperty(value = "IMEI") + private String lteImei; + + /** + * + */ + @ApiModelProperty(value = "ICCID") + private String lteIccid; + + /** + * + */ + @ApiModelProperty(value = "服务商") + private String lteCpos; + + // DB Property + + /** + * 上传地址 + */ + @TableField(exist = false) + @ApiModelProperty(value = "上传地址") + private String uploadApi; + + /** + * 项目名称 + */ + @TableField(exist = false) + @ApiModelProperty(value = "项目名称") + private String projectName; + + + + @ApiModelProperty(value = "是否在线") + private String isOnline; + + + @ApiModelProperty(value = "有无白蚁") + private String yesnoant; + + @ApiModelProperty(value = "告警时间") + private String snDate; +} diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/deviceInfo/DeviceInfoQueryRequest.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/deviceInfo/DeviceInfoQueryRequest.java index 1c8a2d3..39512dc 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/deviceInfo/DeviceInfoQueryRequest.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/deviceInfo/DeviceInfoQueryRequest.java @@ -37,4 +37,7 @@ private String warnFlag; private List projectCodeList; + + //用户id + private Long userId; } diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/deviceInfo/DeviceSnInfoQueryRequest.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/deviceInfo/DeviceSnInfoQueryRequest.java new file mode 100644 index 0000000..021a977 --- /dev/null +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/deviceInfo/DeviceSnInfoQueryRequest.java @@ -0,0 +1,45 @@ +package com.newfiber.termite.domain.request.deviceInfo; + + +import com.newfiber.common.core.web.request.BaseQueryRequest; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.List; + + +/** + * sn设备信息对象 ter_device_info + * + */ +@Data +@EqualsAndHashCode(callSuper = true) +public class DeviceSnInfoQueryRequest extends BaseQueryRequest { + /** + * 分类(生产 production | 项目 project) + */ + @ApiModelProperty(value = "分类(生产 production | 项目 project)") + private String category; + + /** + * 项目编号 + */ + @ApiModelProperty(value = "项目编号") + private String projectCode; + + /** + * 设备编号 + */ + @ApiModelProperty(value = "设备编号") + private String sn; + + private String warnFlag; + + private List projectCodeList; + + //用户id + private Long userId; + + +} diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/mapper/DeviceInfoMapper.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/mapper/DeviceInfoMapper.java index b16357f..ba8e7b5 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/mapper/DeviceInfoMapper.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/mapper/DeviceInfoMapper.java @@ -2,6 +2,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.newfiber.termite.domain.DeviceInfo; +import com.newfiber.termite.domain.SnDeviceInfo; import com.newfiber.termite.domain.request.deviceInfo.DeviceInfoQueryRequest; import java.util.List; import org.apache.ibatis.annotations.Mapper; @@ -32,5 +33,12 @@ */ DeviceInfo selectOneById(@Param("id") Long id); + List selectSnByCondition(@Param("request") DeviceInfoQueryRequest request); + + + //List snQuerMonitoryList(@Param("request") DeviceInfoQueryRequest request); + + + } diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/IDeviceInfoService.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/IDeviceInfoService.java index 9c03500..3a9614e 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/IDeviceInfoService.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/IDeviceInfoService.java @@ -1,12 +1,9 @@ package com.newfiber.termite.service; import com.newfiber.termite.domain.DeviceInfo; +import com.newfiber.termite.domain.SnDeviceInfo; import com.newfiber.termite.domain.dto.TermiteDataUpRequest; -import com.newfiber.termite.domain.request.deviceInfo.DeviceInfoBatchSaveRequest; -import com.newfiber.termite.domain.request.deviceInfo.DeviceInfoQueryRequest; -import com.newfiber.termite.domain.request.deviceInfo.DeviceInfoSaveRequest; -import com.newfiber.termite.domain.request.deviceInfo.DeviceInfoStateSyncRequest; -import com.newfiber.termite.domain.request.deviceInfo.DeviceInfoUpdateRequest; +import com.newfiber.termite.domain.request.deviceInfo.*; import com.newfiber.termite.enums.EDeviceSyncState; import java.util.List; @@ -113,4 +110,19 @@ */ List selectList(String projectCode); + + List selectSnList(DeviceSnInfoQueryRequest request); + + + /** + * 分页查询设备信息 + * + * @param request 分页参数 + * @return 设备信息集合 +// */ +// List selectSnPage(DeviceInfoQueryRequest request); +// +// +// List snQuerMonitoryList(DeviceInfoQueryRequest request); + } diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/DeviceInfoServiceImpl.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/DeviceInfoServiceImpl.java index 0e46e76..4c1fa11 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/DeviceInfoServiceImpl.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/DeviceInfoServiceImpl.java @@ -5,25 +5,23 @@ import com.newfiber.common.core.web.domain.BaseEntity; import com.newfiber.common.core.web.service.BaseServiceImpl; import com.newfiber.termite.domain.DeviceInfo; +import com.newfiber.termite.domain.ProjectInfo; +import com.newfiber.termite.domain.SnDeviceInfo; +import com.newfiber.termite.domain.dto.SnAlarmStatisticDto; import com.newfiber.termite.domain.dto.TermiteDataUpRequest; -import com.newfiber.termite.domain.request.deviceInfo.DeviceInfoBatchSaveRequest; -import com.newfiber.termite.domain.request.deviceInfo.DeviceInfoImportRequest; -import com.newfiber.termite.domain.request.deviceInfo.DeviceInfoQueryRequest; -import com.newfiber.termite.domain.request.deviceInfo.DeviceInfoSaveRequest; -import com.newfiber.termite.domain.request.deviceInfo.DeviceInfoStateSyncRequest; -import com.newfiber.termite.domain.request.deviceInfo.DeviceInfoUpdateRequest; +import com.newfiber.termite.domain.request.deviceInfo.*; import com.newfiber.termite.enums.EDeviceCategory; import com.newfiber.termite.enums.EDeviceSyncState; import com.newfiber.termite.mapper.DeviceInfoMapper; import com.newfiber.termite.service.IDeviceInfoService; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Map; + +import java.util.*; import java.util.Map.Entry; -import java.util.Optional; +import java.util.concurrent.atomic.AtomicInteger; import java.util.stream.Collectors; import javax.annotation.Resource; + +import com.newfiber.termite.service.IProjectInfoService; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.BeanUtils; @@ -42,6 +40,9 @@ @Resource private DeviceInfoMapper deviceInfoMapper; + @Resource + private IProjectInfoService projectInfoService; + @Override public long insert(DeviceInfoSaveRequest request) { DeviceInfo deviceInfo = new DeviceInfo(); @@ -197,4 +198,45 @@ return deviceInfoMapper.selectByCondition(request); } + @Override + public List selectSnList(DeviceSnInfoQueryRequest request) { + // 项目信息 + Set projectInfoSet = projectInfoService.getUserProjectList(request.getUserId()); + List projectCodeList = projectInfoSet.stream().map(ProjectInfo::getProjectCode).collect(Collectors.toList()); + //设备列表 + DeviceInfoQueryRequest deviceInfoQueryRequest = new DeviceInfoQueryRequest(); + deviceInfoQueryRequest.setProjectCodeList(projectCodeList); + List deviceInfoList = deviceInfoMapper.selectSnByCondition(deviceInfoQueryRequest); + //设备在线离线状态判断 + deviceInfoList.forEach(e->{ + Date date1 = new Date(); + if(e.getLastPicTime() != null){ + Date date2 =e.getLastPicTime(); + double diff = Math.abs(date1.getTime()-date2.getTime()); + double diffdays = diff/(1000l*60l*60l*24l); + if(diffdays>1){ + e.setIsOnline("2"); + }else{ + e.setIsOnline("1"); + } + }else { + e.setIsOnline("2"); + } + }); + return deviceInfoList; + } + + + +// @Override +// public List selectSnPage(DeviceInfoQueryRequest request) { +// List deviceInfoList = new ArrayList<>(); +// return deviceInfoList; +// } +// +// @Override +// public List snQuerMonitoryList(DeviceInfoQueryRequest request) { +// return deviceInfoMapper.snQuerMonitoryList(request); +// } + } diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/controller/DeviceInfoController.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/controller/DeviceInfoController.java index 47293b9..9981990 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/controller/DeviceInfoController.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/controller/DeviceInfoController.java @@ -8,11 +8,8 @@ import com.newfiber.common.log.annotation.Log; import com.newfiber.common.log.enums.BusinessType; import com.newfiber.termite.domain.DeviceInfo; -import com.newfiber.termite.domain.request.deviceInfo.DeviceInfoBatchSaveRequest; -import com.newfiber.termite.domain.request.deviceInfo.DeviceInfoImportRequest; -import com.newfiber.termite.domain.request.deviceInfo.DeviceInfoQueryRequest; -import com.newfiber.termite.domain.request.deviceInfo.DeviceInfoSaveRequest; -import com.newfiber.termite.domain.request.deviceInfo.DeviceInfoUpdateRequest; +import com.newfiber.termite.domain.SnDeviceInfo; +import com.newfiber.termite.domain.request.deviceInfo.*; import com.newfiber.termite.service.IDeviceInfoService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -105,10 +102,10 @@ /** * 详细查询设备信息 */ - @GetMapping(value = "/{id}") + @GetMapping(value = "/{sn}") @ApiOperation(value = "详细查询设备信息", position = 40) - public Result detail(@PathVariable("id") Long id) { - return success(deviceInfoService.selectDetail(id)); + public Result detail(@PathVariable("sn") String sn) { + return success(deviceInfoService.selectDetail(sn)); } /** @@ -132,4 +129,39 @@ return success(list); } + +// /** +// * 列表查询当前用户设备sn信息 +// */ +// @GetMapping("/snList") +// @ApiOperation(value = "列表查询当前用户设备信息", position = 60) +// public Result> snlist(DeviceSnInfoQueryRequest request) { +// List list = deviceInfoService.selectSnList(request); +// return success(list); +// } +// +// +// /** +// * 分页查询当前用户设备sn信息 +// */ +// @GetMapping("/snPage") +// @ApiOperation(value = "列表查询当前用户设备信息", position = 60) +// public Result> snPage(DeviceInfoQueryRequest request) { +// startPage(); +// List list = deviceInfoService.selectSnPage(request); +// return pageResult(list); +// } +// +// /** +// * SN编号查询监测记录 +// */ +// @GetMapping("/snQuerMonitoryList") +// @ApiOperation(value = "SN编号查询用户设备监测信息", position = 60) +// public Result> snQuerMonitoryList(DeviceInfoQueryRequest request) { +// List list = deviceInfoService.snQuerMonitoryList(request); +// return success(list); +// +// } + + } diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/SnDeviceInfo.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/SnDeviceInfo.java new file mode 100644 index 0000000..0cb05d0 --- /dev/null +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/SnDeviceInfo.java @@ -0,0 +1,216 @@ +package com.newfiber.termite.domain; + + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.newfiber.common.core.web.domain.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +@Data +@TableName("ter_device_info") +@EqualsAndHashCode(callSuper = true) +@ApiModel(value = "设备信息", description = "设备信息") +public class SnDeviceInfo extends BaseEntity { + private static final long serialVersionUID = 1L; + + /** + * 分类(生产 production | 项目 project) + */ + @ApiModelProperty(value = "分类(生产 production | 项目 project)") + private String category; + + /** + * 项目编号 + */ + @ApiModelProperty(value = "项目编号") + private String projectCode; + + /** + * 设备编号 + */ + @ApiModelProperty(value = "设备编号") + private String sn; + + /** + * 设备类型(4G/WiFi) + */ + @ApiModelProperty(value = "设备类型(4G/WiFi)") + private String deviceType; + + /** + * 位置类型(内圈 inner | 外圈 outer) + */ + @ApiModelProperty(value = "位置类型(内圈 inner | 外圈 outer)") + private String locationType; + + /** + * 设备地址 + */ + @ApiModelProperty(value = "设备地址") + private String location; + + /** + * 初始照片 + */ + @ApiModelProperty(value = "初始照片") + private String initialpictu; + + /** + * 经纬度 + */ + @ApiModelProperty(value = "经纬度") + private String lonandlat; + + /** + * 扩展配置(JSON) + */ + @ApiModelProperty(value = "扩展配置(JSON)") + private String extendConfig; + + /** + * + */ + @ApiModelProperty(value = "") + private Date lastPicTime; + + /** + * 上次加热时间 + */ + @ApiModelProperty(value = "上次加热时间") + private Date lastHeatTime; + + /** + * 上次投药时间 + */ + @ApiModelProperty(value = "上次投药时间") + private Date lastMedicateTime; + + /** + * 首次报警时间(连续3次手动确认则报警) + */ + @ApiModelProperty(value = "首次报警时间(连续3次手动确认则报警)") + private Date firstWarnDatetime; + + /** + * 是否投过药(1是 | 2 否) + */ + @ApiModelProperty(value = "是否投过药(1是 | 2 否)") + private String druging; + + /** + *同步状态(成功 success | 失败 fail) + */ + @ApiModelProperty(value = "同步状态(成功 success | 失败 fail)") + private String syncState; + + /** + * + */ + @ApiModelProperty(value = "软件版本") + private String software; + + /** + * + */ + @ApiModelProperty(value = "硬件版本") + private String hardware; + + /** + * + */ + @ApiModelProperty(value = "电压") + private String voltage; + + /** + * + */ + @ApiModelProperty(value = "温度") + private String temperature; + + /** + * + */ + @ApiModelProperty(value = "信号质量") + private String rssi; + + /** + * + */ + @ApiModelProperty(value = "中继名称") + private String ap; + + /** + * + */ + @ApiModelProperty(value = "摄像头") + private String camera; + + /** + * + */ + @ApiModelProperty(value = "模块厂商") + private String lteManufactor; + + /** + * + */ + @ApiModelProperty(value = "模块型号") + private String lteModel; + + /** + * + */ + @ApiModelProperty(value = "固件版本") + private String lteFirmware; + + /** + * + */ + @ApiModelProperty(value = "IMEI") + private String lteImei; + + /** + * + */ + @ApiModelProperty(value = "ICCID") + private String lteIccid; + + /** + * + */ + @ApiModelProperty(value = "服务商") + private String lteCpos; + + // DB Property + + /** + * 上传地址 + */ + @TableField(exist = false) + @ApiModelProperty(value = "上传地址") + private String uploadApi; + + /** + * 项目名称 + */ + @TableField(exist = false) + @ApiModelProperty(value = "项目名称") + private String projectName; + + + + @ApiModelProperty(value = "是否在线") + private String isOnline; + + + @ApiModelProperty(value = "有无白蚁") + private String yesnoant; + + @ApiModelProperty(value = "告警时间") + private String snDate; +} diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/deviceInfo/DeviceInfoQueryRequest.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/deviceInfo/DeviceInfoQueryRequest.java index 1c8a2d3..39512dc 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/deviceInfo/DeviceInfoQueryRequest.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/deviceInfo/DeviceInfoQueryRequest.java @@ -37,4 +37,7 @@ private String warnFlag; private List projectCodeList; + + //用户id + private Long userId; } diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/deviceInfo/DeviceSnInfoQueryRequest.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/deviceInfo/DeviceSnInfoQueryRequest.java new file mode 100644 index 0000000..021a977 --- /dev/null +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/deviceInfo/DeviceSnInfoQueryRequest.java @@ -0,0 +1,45 @@ +package com.newfiber.termite.domain.request.deviceInfo; + + +import com.newfiber.common.core.web.request.BaseQueryRequest; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.List; + + +/** + * sn设备信息对象 ter_device_info + * + */ +@Data +@EqualsAndHashCode(callSuper = true) +public class DeviceSnInfoQueryRequest extends BaseQueryRequest { + /** + * 分类(生产 production | 项目 project) + */ + @ApiModelProperty(value = "分类(生产 production | 项目 project)") + private String category; + + /** + * 项目编号 + */ + @ApiModelProperty(value = "项目编号") + private String projectCode; + + /** + * 设备编号 + */ + @ApiModelProperty(value = "设备编号") + private String sn; + + private String warnFlag; + + private List projectCodeList; + + //用户id + private Long userId; + + +} diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/mapper/DeviceInfoMapper.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/mapper/DeviceInfoMapper.java index b16357f..ba8e7b5 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/mapper/DeviceInfoMapper.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/mapper/DeviceInfoMapper.java @@ -2,6 +2,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.newfiber.termite.domain.DeviceInfo; +import com.newfiber.termite.domain.SnDeviceInfo; import com.newfiber.termite.domain.request.deviceInfo.DeviceInfoQueryRequest; import java.util.List; import org.apache.ibatis.annotations.Mapper; @@ -32,5 +33,12 @@ */ DeviceInfo selectOneById(@Param("id") Long id); + List selectSnByCondition(@Param("request") DeviceInfoQueryRequest request); + + + //List snQuerMonitoryList(@Param("request") DeviceInfoQueryRequest request); + + + } diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/IDeviceInfoService.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/IDeviceInfoService.java index 9c03500..3a9614e 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/IDeviceInfoService.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/IDeviceInfoService.java @@ -1,12 +1,9 @@ package com.newfiber.termite.service; import com.newfiber.termite.domain.DeviceInfo; +import com.newfiber.termite.domain.SnDeviceInfo; import com.newfiber.termite.domain.dto.TermiteDataUpRequest; -import com.newfiber.termite.domain.request.deviceInfo.DeviceInfoBatchSaveRequest; -import com.newfiber.termite.domain.request.deviceInfo.DeviceInfoQueryRequest; -import com.newfiber.termite.domain.request.deviceInfo.DeviceInfoSaveRequest; -import com.newfiber.termite.domain.request.deviceInfo.DeviceInfoStateSyncRequest; -import com.newfiber.termite.domain.request.deviceInfo.DeviceInfoUpdateRequest; +import com.newfiber.termite.domain.request.deviceInfo.*; import com.newfiber.termite.enums.EDeviceSyncState; import java.util.List; @@ -113,4 +110,19 @@ */ List selectList(String projectCode); + + List selectSnList(DeviceSnInfoQueryRequest request); + + + /** + * 分页查询设备信息 + * + * @param request 分页参数 + * @return 设备信息集合 +// */ +// List selectSnPage(DeviceInfoQueryRequest request); +// +// +// List snQuerMonitoryList(DeviceInfoQueryRequest request); + } diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/DeviceInfoServiceImpl.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/DeviceInfoServiceImpl.java index 0e46e76..4c1fa11 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/DeviceInfoServiceImpl.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/DeviceInfoServiceImpl.java @@ -5,25 +5,23 @@ import com.newfiber.common.core.web.domain.BaseEntity; import com.newfiber.common.core.web.service.BaseServiceImpl; import com.newfiber.termite.domain.DeviceInfo; +import com.newfiber.termite.domain.ProjectInfo; +import com.newfiber.termite.domain.SnDeviceInfo; +import com.newfiber.termite.domain.dto.SnAlarmStatisticDto; import com.newfiber.termite.domain.dto.TermiteDataUpRequest; -import com.newfiber.termite.domain.request.deviceInfo.DeviceInfoBatchSaveRequest; -import com.newfiber.termite.domain.request.deviceInfo.DeviceInfoImportRequest; -import com.newfiber.termite.domain.request.deviceInfo.DeviceInfoQueryRequest; -import com.newfiber.termite.domain.request.deviceInfo.DeviceInfoSaveRequest; -import com.newfiber.termite.domain.request.deviceInfo.DeviceInfoStateSyncRequest; -import com.newfiber.termite.domain.request.deviceInfo.DeviceInfoUpdateRequest; +import com.newfiber.termite.domain.request.deviceInfo.*; import com.newfiber.termite.enums.EDeviceCategory; import com.newfiber.termite.enums.EDeviceSyncState; import com.newfiber.termite.mapper.DeviceInfoMapper; import com.newfiber.termite.service.IDeviceInfoService; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Map; + +import java.util.*; import java.util.Map.Entry; -import java.util.Optional; +import java.util.concurrent.atomic.AtomicInteger; import java.util.stream.Collectors; import javax.annotation.Resource; + +import com.newfiber.termite.service.IProjectInfoService; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.BeanUtils; @@ -42,6 +40,9 @@ @Resource private DeviceInfoMapper deviceInfoMapper; + @Resource + private IProjectInfoService projectInfoService; + @Override public long insert(DeviceInfoSaveRequest request) { DeviceInfo deviceInfo = new DeviceInfo(); @@ -197,4 +198,45 @@ return deviceInfoMapper.selectByCondition(request); } + @Override + public List selectSnList(DeviceSnInfoQueryRequest request) { + // 项目信息 + Set projectInfoSet = projectInfoService.getUserProjectList(request.getUserId()); + List projectCodeList = projectInfoSet.stream().map(ProjectInfo::getProjectCode).collect(Collectors.toList()); + //设备列表 + DeviceInfoQueryRequest deviceInfoQueryRequest = new DeviceInfoQueryRequest(); + deviceInfoQueryRequest.setProjectCodeList(projectCodeList); + List deviceInfoList = deviceInfoMapper.selectSnByCondition(deviceInfoQueryRequest); + //设备在线离线状态判断 + deviceInfoList.forEach(e->{ + Date date1 = new Date(); + if(e.getLastPicTime() != null){ + Date date2 =e.getLastPicTime(); + double diff = Math.abs(date1.getTime()-date2.getTime()); + double diffdays = diff/(1000l*60l*60l*24l); + if(diffdays>1){ + e.setIsOnline("2"); + }else{ + e.setIsOnline("1"); + } + }else { + e.setIsOnline("2"); + } + }); + return deviceInfoList; + } + + + +// @Override +// public List selectSnPage(DeviceInfoQueryRequest request) { +// List deviceInfoList = new ArrayList<>(); +// return deviceInfoList; +// } +// +// @Override +// public List snQuerMonitoryList(DeviceInfoQueryRequest request) { +// return deviceInfoMapper.snQuerMonitoryList(request); +// } + } diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/StatisticsServiceImpl.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/StatisticsServiceImpl.java index 6db0ce6..fd4501c 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/StatisticsServiceImpl.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/StatisticsServiceImpl.java @@ -237,10 +237,16 @@ sortedEntries.sort(Map.Entry.comparingByValue(Comparator.reverseOrder())); if (sortedEntries.size() >= 2) { long sumOfTopTwo = sortedEntries.get(0).getValue() + sortedEntries.get(1).getValue(); - BigDecimal percentage = new BigDecimal(((double) sumOfTopTwo) / totalSnCount) - .multiply(BigDecimal.valueOf(100)) - .setScale(2, RoundingMode.HALF_UP); - warnMonthAlarmsResponse.setDeviceCountProportion(percentage.doubleValue()); + BigDecimal percentage; + if(totalSnCount==0){ + percentage = BigDecimal.ZERO; + warnMonthAlarmsResponse.setDeviceCountProportion(percentage.doubleValue()); + }else{ + percentage = new BigDecimal(((double) sumOfTopTwo) / totalSnCount) + .multiply(BigDecimal.valueOf(100)) + .setScale(2, RoundingMode.HALF_UP); + warnMonthAlarmsResponse.setDeviceCountProportion(percentage.doubleValue()); + } warnMonthAlarmsResponse.setWarnDeviceCount(sumOfTopTwo); warnMonthAlarmsResponse.setEndMonth(sortedEntries.get(1).getKey()); warnMonthAlarmsResponse.setMaxStartMonth(sortedEntries.get(0).getKey()); @@ -293,18 +299,21 @@ }); List warnMonitoringResponseDaysInfoList = new ArrayList(); - // 计算百分比并添加到结果列表中 durationToSnCount.forEach((durationRange, count) -> { - BigDecimal percentage = new BigDecimal(((double) count) / totalCount) - .multiply(BigDecimal.valueOf(100)) - .setScale(2, RoundingMode.HALF_UP); - warnMonitoringResponseDaysInfoList.add(new WarnMonitoringResponseDaysInfo(durationRange,percentage.doubleValue())); - + BigDecimal percentage; + if(totalCount==0){ + percentage = BigDecimal.ZERO; + warnMonitoringResponseDaysInfoList.add(new WarnMonitoringResponseDaysInfo(durationRange,percentage.doubleValue())); + }else{ + percentage = new BigDecimal(((double) count) / totalCount) + .multiply(BigDecimal.valueOf(100)) + .setScale(2, RoundingMode.HALF_UP); + warnMonitoringResponseDaysInfoList.add(new WarnMonitoringResponseDaysInfo(durationRange,percentage.doubleValue())); + } }); warnMonitoringResponse.setWarnmoitoringDaysListInfo(warnMonitoringResponseDaysInfoList); - System.out.println(warnMonitoringResponseDaysInfoList); - return new WarnMonitoringResponse(); + return warnMonitoringResponse; } @Override diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/controller/DeviceInfoController.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/controller/DeviceInfoController.java index 47293b9..9981990 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/controller/DeviceInfoController.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/controller/DeviceInfoController.java @@ -8,11 +8,8 @@ import com.newfiber.common.log.annotation.Log; import com.newfiber.common.log.enums.BusinessType; import com.newfiber.termite.domain.DeviceInfo; -import com.newfiber.termite.domain.request.deviceInfo.DeviceInfoBatchSaveRequest; -import com.newfiber.termite.domain.request.deviceInfo.DeviceInfoImportRequest; -import com.newfiber.termite.domain.request.deviceInfo.DeviceInfoQueryRequest; -import com.newfiber.termite.domain.request.deviceInfo.DeviceInfoSaveRequest; -import com.newfiber.termite.domain.request.deviceInfo.DeviceInfoUpdateRequest; +import com.newfiber.termite.domain.SnDeviceInfo; +import com.newfiber.termite.domain.request.deviceInfo.*; import com.newfiber.termite.service.IDeviceInfoService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -105,10 +102,10 @@ /** * 详细查询设备信息 */ - @GetMapping(value = "/{id}") + @GetMapping(value = "/{sn}") @ApiOperation(value = "详细查询设备信息", position = 40) - public Result detail(@PathVariable("id") Long id) { - return success(deviceInfoService.selectDetail(id)); + public Result detail(@PathVariable("sn") String sn) { + return success(deviceInfoService.selectDetail(sn)); } /** @@ -132,4 +129,39 @@ return success(list); } + +// /** +// * 列表查询当前用户设备sn信息 +// */ +// @GetMapping("/snList") +// @ApiOperation(value = "列表查询当前用户设备信息", position = 60) +// public Result> snlist(DeviceSnInfoQueryRequest request) { +// List list = deviceInfoService.selectSnList(request); +// return success(list); +// } +// +// +// /** +// * 分页查询当前用户设备sn信息 +// */ +// @GetMapping("/snPage") +// @ApiOperation(value = "列表查询当前用户设备信息", position = 60) +// public Result> snPage(DeviceInfoQueryRequest request) { +// startPage(); +// List list = deviceInfoService.selectSnPage(request); +// return pageResult(list); +// } +// +// /** +// * SN编号查询监测记录 +// */ +// @GetMapping("/snQuerMonitoryList") +// @ApiOperation(value = "SN编号查询用户设备监测信息", position = 60) +// public Result> snQuerMonitoryList(DeviceInfoQueryRequest request) { +// List list = deviceInfoService.snQuerMonitoryList(request); +// return success(list); +// +// } + + } diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/SnDeviceInfo.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/SnDeviceInfo.java new file mode 100644 index 0000000..0cb05d0 --- /dev/null +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/SnDeviceInfo.java @@ -0,0 +1,216 @@ +package com.newfiber.termite.domain; + + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.newfiber.common.core.web.domain.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +@Data +@TableName("ter_device_info") +@EqualsAndHashCode(callSuper = true) +@ApiModel(value = "设备信息", description = "设备信息") +public class SnDeviceInfo extends BaseEntity { + private static final long serialVersionUID = 1L; + + /** + * 分类(生产 production | 项目 project) + */ + @ApiModelProperty(value = "分类(生产 production | 项目 project)") + private String category; + + /** + * 项目编号 + */ + @ApiModelProperty(value = "项目编号") + private String projectCode; + + /** + * 设备编号 + */ + @ApiModelProperty(value = "设备编号") + private String sn; + + /** + * 设备类型(4G/WiFi) + */ + @ApiModelProperty(value = "设备类型(4G/WiFi)") + private String deviceType; + + /** + * 位置类型(内圈 inner | 外圈 outer) + */ + @ApiModelProperty(value = "位置类型(内圈 inner | 外圈 outer)") + private String locationType; + + /** + * 设备地址 + */ + @ApiModelProperty(value = "设备地址") + private String location; + + /** + * 初始照片 + */ + @ApiModelProperty(value = "初始照片") + private String initialpictu; + + /** + * 经纬度 + */ + @ApiModelProperty(value = "经纬度") + private String lonandlat; + + /** + * 扩展配置(JSON) + */ + @ApiModelProperty(value = "扩展配置(JSON)") + private String extendConfig; + + /** + * + */ + @ApiModelProperty(value = "") + private Date lastPicTime; + + /** + * 上次加热时间 + */ + @ApiModelProperty(value = "上次加热时间") + private Date lastHeatTime; + + /** + * 上次投药时间 + */ + @ApiModelProperty(value = "上次投药时间") + private Date lastMedicateTime; + + /** + * 首次报警时间(连续3次手动确认则报警) + */ + @ApiModelProperty(value = "首次报警时间(连续3次手动确认则报警)") + private Date firstWarnDatetime; + + /** + * 是否投过药(1是 | 2 否) + */ + @ApiModelProperty(value = "是否投过药(1是 | 2 否)") + private String druging; + + /** + *同步状态(成功 success | 失败 fail) + */ + @ApiModelProperty(value = "同步状态(成功 success | 失败 fail)") + private String syncState; + + /** + * + */ + @ApiModelProperty(value = "软件版本") + private String software; + + /** + * + */ + @ApiModelProperty(value = "硬件版本") + private String hardware; + + /** + * + */ + @ApiModelProperty(value = "电压") + private String voltage; + + /** + * + */ + @ApiModelProperty(value = "温度") + private String temperature; + + /** + * + */ + @ApiModelProperty(value = "信号质量") + private String rssi; + + /** + * + */ + @ApiModelProperty(value = "中继名称") + private String ap; + + /** + * + */ + @ApiModelProperty(value = "摄像头") + private String camera; + + /** + * + */ + @ApiModelProperty(value = "模块厂商") + private String lteManufactor; + + /** + * + */ + @ApiModelProperty(value = "模块型号") + private String lteModel; + + /** + * + */ + @ApiModelProperty(value = "固件版本") + private String lteFirmware; + + /** + * + */ + @ApiModelProperty(value = "IMEI") + private String lteImei; + + /** + * + */ + @ApiModelProperty(value = "ICCID") + private String lteIccid; + + /** + * + */ + @ApiModelProperty(value = "服务商") + private String lteCpos; + + // DB Property + + /** + * 上传地址 + */ + @TableField(exist = false) + @ApiModelProperty(value = "上传地址") + private String uploadApi; + + /** + * 项目名称 + */ + @TableField(exist = false) + @ApiModelProperty(value = "项目名称") + private String projectName; + + + + @ApiModelProperty(value = "是否在线") + private String isOnline; + + + @ApiModelProperty(value = "有无白蚁") + private String yesnoant; + + @ApiModelProperty(value = "告警时间") + private String snDate; +} diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/deviceInfo/DeviceInfoQueryRequest.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/deviceInfo/DeviceInfoQueryRequest.java index 1c8a2d3..39512dc 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/deviceInfo/DeviceInfoQueryRequest.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/deviceInfo/DeviceInfoQueryRequest.java @@ -37,4 +37,7 @@ private String warnFlag; private List projectCodeList; + + //用户id + private Long userId; } diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/deviceInfo/DeviceSnInfoQueryRequest.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/deviceInfo/DeviceSnInfoQueryRequest.java new file mode 100644 index 0000000..021a977 --- /dev/null +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/domain/request/deviceInfo/DeviceSnInfoQueryRequest.java @@ -0,0 +1,45 @@ +package com.newfiber.termite.domain.request.deviceInfo; + + +import com.newfiber.common.core.web.request.BaseQueryRequest; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.List; + + +/** + * sn设备信息对象 ter_device_info + * + */ +@Data +@EqualsAndHashCode(callSuper = true) +public class DeviceSnInfoQueryRequest extends BaseQueryRequest { + /** + * 分类(生产 production | 项目 project) + */ + @ApiModelProperty(value = "分类(生产 production | 项目 project)") + private String category; + + /** + * 项目编号 + */ + @ApiModelProperty(value = "项目编号") + private String projectCode; + + /** + * 设备编号 + */ + @ApiModelProperty(value = "设备编号") + private String sn; + + private String warnFlag; + + private List projectCodeList; + + //用户id + private Long userId; + + +} diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/mapper/DeviceInfoMapper.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/mapper/DeviceInfoMapper.java index b16357f..ba8e7b5 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/mapper/DeviceInfoMapper.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/mapper/DeviceInfoMapper.java @@ -2,6 +2,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.newfiber.termite.domain.DeviceInfo; +import com.newfiber.termite.domain.SnDeviceInfo; import com.newfiber.termite.domain.request.deviceInfo.DeviceInfoQueryRequest; import java.util.List; import org.apache.ibatis.annotations.Mapper; @@ -32,5 +33,12 @@ */ DeviceInfo selectOneById(@Param("id") Long id); + List selectSnByCondition(@Param("request") DeviceInfoQueryRequest request); + + + //List snQuerMonitoryList(@Param("request") DeviceInfoQueryRequest request); + + + } diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/IDeviceInfoService.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/IDeviceInfoService.java index 9c03500..3a9614e 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/IDeviceInfoService.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/IDeviceInfoService.java @@ -1,12 +1,9 @@ package com.newfiber.termite.service; import com.newfiber.termite.domain.DeviceInfo; +import com.newfiber.termite.domain.SnDeviceInfo; import com.newfiber.termite.domain.dto.TermiteDataUpRequest; -import com.newfiber.termite.domain.request.deviceInfo.DeviceInfoBatchSaveRequest; -import com.newfiber.termite.domain.request.deviceInfo.DeviceInfoQueryRequest; -import com.newfiber.termite.domain.request.deviceInfo.DeviceInfoSaveRequest; -import com.newfiber.termite.domain.request.deviceInfo.DeviceInfoStateSyncRequest; -import com.newfiber.termite.domain.request.deviceInfo.DeviceInfoUpdateRequest; +import com.newfiber.termite.domain.request.deviceInfo.*; import com.newfiber.termite.enums.EDeviceSyncState; import java.util.List; @@ -113,4 +110,19 @@ */ List selectList(String projectCode); + + List selectSnList(DeviceSnInfoQueryRequest request); + + + /** + * 分页查询设备信息 + * + * @param request 分页参数 + * @return 设备信息集合 +// */ +// List selectSnPage(DeviceInfoQueryRequest request); +// +// +// List snQuerMonitoryList(DeviceInfoQueryRequest request); + } diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/DeviceInfoServiceImpl.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/DeviceInfoServiceImpl.java index 0e46e76..4c1fa11 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/DeviceInfoServiceImpl.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/DeviceInfoServiceImpl.java @@ -5,25 +5,23 @@ import com.newfiber.common.core.web.domain.BaseEntity; import com.newfiber.common.core.web.service.BaseServiceImpl; import com.newfiber.termite.domain.DeviceInfo; +import com.newfiber.termite.domain.ProjectInfo; +import com.newfiber.termite.domain.SnDeviceInfo; +import com.newfiber.termite.domain.dto.SnAlarmStatisticDto; import com.newfiber.termite.domain.dto.TermiteDataUpRequest; -import com.newfiber.termite.domain.request.deviceInfo.DeviceInfoBatchSaveRequest; -import com.newfiber.termite.domain.request.deviceInfo.DeviceInfoImportRequest; -import com.newfiber.termite.domain.request.deviceInfo.DeviceInfoQueryRequest; -import com.newfiber.termite.domain.request.deviceInfo.DeviceInfoSaveRequest; -import com.newfiber.termite.domain.request.deviceInfo.DeviceInfoStateSyncRequest; -import com.newfiber.termite.domain.request.deviceInfo.DeviceInfoUpdateRequest; +import com.newfiber.termite.domain.request.deviceInfo.*; import com.newfiber.termite.enums.EDeviceCategory; import com.newfiber.termite.enums.EDeviceSyncState; import com.newfiber.termite.mapper.DeviceInfoMapper; import com.newfiber.termite.service.IDeviceInfoService; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Map; + +import java.util.*; import java.util.Map.Entry; -import java.util.Optional; +import java.util.concurrent.atomic.AtomicInteger; import java.util.stream.Collectors; import javax.annotation.Resource; + +import com.newfiber.termite.service.IProjectInfoService; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.BeanUtils; @@ -42,6 +40,9 @@ @Resource private DeviceInfoMapper deviceInfoMapper; + @Resource + private IProjectInfoService projectInfoService; + @Override public long insert(DeviceInfoSaveRequest request) { DeviceInfo deviceInfo = new DeviceInfo(); @@ -197,4 +198,45 @@ return deviceInfoMapper.selectByCondition(request); } + @Override + public List selectSnList(DeviceSnInfoQueryRequest request) { + // 项目信息 + Set projectInfoSet = projectInfoService.getUserProjectList(request.getUserId()); + List projectCodeList = projectInfoSet.stream().map(ProjectInfo::getProjectCode).collect(Collectors.toList()); + //设备列表 + DeviceInfoQueryRequest deviceInfoQueryRequest = new DeviceInfoQueryRequest(); + deviceInfoQueryRequest.setProjectCodeList(projectCodeList); + List deviceInfoList = deviceInfoMapper.selectSnByCondition(deviceInfoQueryRequest); + //设备在线离线状态判断 + deviceInfoList.forEach(e->{ + Date date1 = new Date(); + if(e.getLastPicTime() != null){ + Date date2 =e.getLastPicTime(); + double diff = Math.abs(date1.getTime()-date2.getTime()); + double diffdays = diff/(1000l*60l*60l*24l); + if(diffdays>1){ + e.setIsOnline("2"); + }else{ + e.setIsOnline("1"); + } + }else { + e.setIsOnline("2"); + } + }); + return deviceInfoList; + } + + + +// @Override +// public List selectSnPage(DeviceInfoQueryRequest request) { +// List deviceInfoList = new ArrayList<>(); +// return deviceInfoList; +// } +// +// @Override +// public List snQuerMonitoryList(DeviceInfoQueryRequest request) { +// return deviceInfoMapper.snQuerMonitoryList(request); +// } + } diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/StatisticsServiceImpl.java b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/StatisticsServiceImpl.java index 6db0ce6..fd4501c 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/StatisticsServiceImpl.java +++ b/newfiber-termites/newfiber-termites-dataup/src/main/java/com/newfiber/termite/service/impl/StatisticsServiceImpl.java @@ -237,10 +237,16 @@ sortedEntries.sort(Map.Entry.comparingByValue(Comparator.reverseOrder())); if (sortedEntries.size() >= 2) { long sumOfTopTwo = sortedEntries.get(0).getValue() + sortedEntries.get(1).getValue(); - BigDecimal percentage = new BigDecimal(((double) sumOfTopTwo) / totalSnCount) - .multiply(BigDecimal.valueOf(100)) - .setScale(2, RoundingMode.HALF_UP); - warnMonthAlarmsResponse.setDeviceCountProportion(percentage.doubleValue()); + BigDecimal percentage; + if(totalSnCount==0){ + percentage = BigDecimal.ZERO; + warnMonthAlarmsResponse.setDeviceCountProportion(percentage.doubleValue()); + }else{ + percentage = new BigDecimal(((double) sumOfTopTwo) / totalSnCount) + .multiply(BigDecimal.valueOf(100)) + .setScale(2, RoundingMode.HALF_UP); + warnMonthAlarmsResponse.setDeviceCountProportion(percentage.doubleValue()); + } warnMonthAlarmsResponse.setWarnDeviceCount(sumOfTopTwo); warnMonthAlarmsResponse.setEndMonth(sortedEntries.get(1).getKey()); warnMonthAlarmsResponse.setMaxStartMonth(sortedEntries.get(0).getKey()); @@ -293,18 +299,21 @@ }); List warnMonitoringResponseDaysInfoList = new ArrayList(); - // 计算百分比并添加到结果列表中 durationToSnCount.forEach((durationRange, count) -> { - BigDecimal percentage = new BigDecimal(((double) count) / totalCount) - .multiply(BigDecimal.valueOf(100)) - .setScale(2, RoundingMode.HALF_UP); - warnMonitoringResponseDaysInfoList.add(new WarnMonitoringResponseDaysInfo(durationRange,percentage.doubleValue())); - + BigDecimal percentage; + if(totalCount==0){ + percentage = BigDecimal.ZERO; + warnMonitoringResponseDaysInfoList.add(new WarnMonitoringResponseDaysInfo(durationRange,percentage.doubleValue())); + }else{ + percentage = new BigDecimal(((double) count) / totalCount) + .multiply(BigDecimal.valueOf(100)) + .setScale(2, RoundingMode.HALF_UP); + warnMonitoringResponseDaysInfoList.add(new WarnMonitoringResponseDaysInfo(durationRange,percentage.doubleValue())); + } }); warnMonitoringResponse.setWarnmoitoringDaysListInfo(warnMonitoringResponseDaysInfoList); - System.out.println(warnMonitoringResponseDaysInfoList); - return new WarnMonitoringResponse(); + return warnMonitoringResponse; } @Override diff --git a/newfiber-termites/newfiber-termites-dataup/src/main/resources/mapper/termite/DeviceInfoMapper.xml b/newfiber-termites/newfiber-termites-dataup/src/main/resources/mapper/termite/DeviceInfoMapper.xml index cd7e1a2..8a20b67 100644 --- a/newfiber-termites/newfiber-termites-dataup/src/main/resources/mapper/termite/DeviceInfoMapper.xml +++ b/newfiber-termites/newfiber-termites-dataup/src/main/resources/mapper/termite/DeviceInfoMapper.xml @@ -30,6 +30,8 @@ + + @@ -90,6 +92,34 @@ left join ter_project_info tpi on t.project_code = tpi.project_code + + + + + + + + + + + + + + + + + + select + , + md.yesnoant AS yesnoant, + md.date AS snDate + from ter_device_info t + JOIN ter_device_monitoring_data md ON t.sn = md.sn + + where t.del_flag = 0 + + order by t.${request.orderBy} + + + + + + + + + + + + + + + + + SELECT di.sn, + di.location, DATE_FORMAT(MIN(di.first_warn_datetime), '%Y-%m-%d') AS dailyFirstWarnDatetime, COUNT(DISTINCT DATE(dm.date)) AS countDays FROM