设备厂家信息表
This commit is contained in:
parent
56e1c37852
commit
087e975490
@ -0,0 +1,25 @@
|
||||
package com.fastbee.data.controller.renKe;
|
||||
|
||||
import com.fastbee.common.core.domain.AjaxResult;
|
||||
import com.fastbee.deviceData.api.renke.service.RenKeUserDeviceOverview;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/renke")
|
||||
public class RenKeUserDeviceOverviewController {
|
||||
@Autowired
|
||||
private RenKeUserDeviceOverview renkeUserDeviceOverview;
|
||||
|
||||
/**
|
||||
* 统计全部设备数量,并且按照不同设备分类统计
|
||||
*/
|
||||
@GetMapping (value = "/all/device")
|
||||
public AjaxResult getsysAllUserDevice(){
|
||||
return AjaxResult.success(renkeUserDeviceOverview.getsysAllUserDevice());
|
||||
}
|
||||
}
|
@ -6,4 +6,10 @@ package com.fastbee.deviceData.api.renke.constant;
|
||||
public class RenKeDeviceTypeConstant {
|
||||
public static final String MET = "met";//气象设备
|
||||
public static final String WORM = "wormFlagship";//虫情设备
|
||||
public static final String Irrigation = "irrigation";//灌溉
|
||||
public static final String Worm = "worm";//蠕虫
|
||||
public static final String Soil = "soil";//土
|
||||
public static final String Spore = "spore";//孢子
|
||||
public static final String Camera = "camera";//照相机
|
||||
|
||||
}
|
||||
|
@ -14,6 +14,7 @@ import com.fastbee.common.utils.file.FileUploadUtils;
|
||||
import com.fastbee.common.utils.poi.ExcelUtil;
|
||||
import com.fastbee.deviceData.api.renke.domin.*;
|
||||
import com.fastbee.deviceData.api.renke.service.RenKeAuthorizationService;
|
||||
import com.fastbee.deviceData.api.renke.service.RenKeUserDeviceOverview;
|
||||
import com.fastbee.deviceData.api.renke.service.RenkeMetDeviceService;
|
||||
import com.fastbee.deviceData.api.renke.service.RenkeWormSituationDeviceService;
|
||||
import io.swagger.annotations.Api;
|
||||
@ -51,6 +52,8 @@ public class test extends BaseController {
|
||||
@Autowired
|
||||
private RenkeMetDeviceService renkeMetDeviceService;
|
||||
|
||||
@Autowired
|
||||
private RenKeUserDeviceOverview renKeUserDeviceOverview;
|
||||
|
||||
/**
|
||||
* 查询设备告警上传列表
|
||||
@ -68,7 +71,8 @@ public class test extends BaseController {
|
||||
Integer limit = 1;
|
||||
String nodeId = "1";
|
||||
String enable = "1";
|
||||
return renkeMetDeviceService.getWormDataList(deviceAddr,nodeId,beginTime,endTime,pages,limit);
|
||||
return renKeUserDeviceOverview.getsysAllUserDevice();
|
||||
// return renkeMetDeviceService.getWormDataList(deviceAddr,nodeId,beginTime,endTime,pages,limit);
|
||||
}
|
||||
@PostMapping("/testJosn")
|
||||
public Object testJosn(@RequestBody UpdateNodeInfo json) {
|
||||
|
@ -1,6 +0,0 @@
|
||||
package com.fastbee.deviceData.api.renke.domin;
|
||||
|
||||
public class GetWormHistoryData {
|
||||
public String deviceAddr;
|
||||
|
||||
}
|
@ -3,15 +3,21 @@ package com.fastbee.deviceData.api.renke.domin;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
/**
|
||||
* 修改虫情设备自动模式时间
|
||||
*/
|
||||
public class ModWormAutoMode {
|
||||
public String deviceAddr;
|
||||
public String beginTime;
|
||||
public String endtime;
|
||||
public String beginTime2;
|
||||
public String endtime2;
|
||||
public Integer runHour;
|
||||
public Integer dryingHum;
|
||||
public Integer dryingHumHystersis;
|
||||
public Integer delayAfterRain;
|
||||
public Integer openingTimeOfTrapLamp;
|
||||
public String deviceAddr;//设备地址
|
||||
public String beginTime;//开始时间
|
||||
public String endtime;//结束时间
|
||||
public String beginTime2;//开始时间2
|
||||
public String endtime2;//结束时间2
|
||||
public Integer runHour;//工作时长(H)
|
||||
public Integer attractWormTime;//引虫时长(min)
|
||||
public Integer insecticideHum;//杀虫温度
|
||||
public Integer insecticideHumHystersis;//杀虫温度回差
|
||||
public Integer dryingHum;//烘干温度
|
||||
public Integer dryingHumHystersis;//烘干温度回差
|
||||
public Integer delayAfterRain;//雨后延迟工作时间,单位分钟
|
||||
public Integer openingTimeOfTrapLamp;//诱虫灯开启时长,单位分钟
|
||||
}
|
||||
|
@ -2,14 +2,17 @@ package com.fastbee.deviceData.api.renke.domin;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 修改设备信息
|
||||
*/
|
||||
@Data
|
||||
public class UpdateDevice {
|
||||
|
||||
public String deviceAddr;
|
||||
public String deviceName;
|
||||
public Double lng;
|
||||
public Double lat;
|
||||
public String saveDateInterval;
|
||||
public String offlineInterval;
|
||||
public String deviceAddr;//设备地址(多个用英文逗号分隔)
|
||||
public String deviceName;//设备名称
|
||||
public Double lng;//经度
|
||||
public Double lat;//纬度
|
||||
public String saveDateInterval;//数据保存时间
|
||||
public String offlineInterval;//离线判断时间
|
||||
|
||||
}
|
||||
|
@ -2,29 +2,32 @@ package com.fastbee.deviceData.api.renke.domin;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
*更新气象节点信息
|
||||
*/
|
||||
@Data
|
||||
public class UpdateNodeInfo {
|
||||
private String deviceAddr;
|
||||
private Integer nodeId;
|
||||
private Integer nodeType;
|
||||
private Integer nodeMold;
|
||||
private Integer digits;
|
||||
private Integer enable;
|
||||
private Number humLowerLimit;
|
||||
private String humName;
|
||||
private Number humOffset;
|
||||
private Number humRatio;
|
||||
private String humUnit;
|
||||
private Number humUpperLimit;
|
||||
private String nodeName;
|
||||
private Integer priority;
|
||||
private Integer switchAlarmType;
|
||||
private String switchOffContent;
|
||||
private String switchOnContent;
|
||||
private Number temLowerLimit;
|
||||
private String temName;
|
||||
private Number temOffset;
|
||||
private Number temRatio;
|
||||
private String temUnit;
|
||||
private Number temUpperLimit;
|
||||
private String deviceAddr;//设备地址
|
||||
private Integer nodeId;//节点编号
|
||||
private Integer nodeType;//节点类型
|
||||
private Integer nodeMold;//0常规;1雨量;2蒸发量
|
||||
private Integer digits;//小数位数
|
||||
private Integer enable;//节点是否开启0:关闭1:开启
|
||||
private Number humLowerLimit;//模拟量2下限
|
||||
private String humName;//模拟量2名称
|
||||
private Number humOffset;//模拟量2偏差
|
||||
private Number humRatio;//模拟量2系数
|
||||
private String humUnit;//模拟量2单位
|
||||
private Number humUpperLimit;//模拟量2上限
|
||||
private String nodeName;//节点名称
|
||||
private Integer priority;//优先级
|
||||
private Integer switchAlarmType;//开关量报警类型
|
||||
private String switchOffContent;//开关量断开显示内容
|
||||
private String switchOnContent;//开关量闭合显示内容
|
||||
private Number temLowerLimit;//模拟量1下限
|
||||
private String temName;//模拟量1名称
|
||||
private Number temOffset;//模拟量1偏差
|
||||
private Number temRatio;//模拟量1系数
|
||||
private String temUnit;//模拟量1单位
|
||||
private Number temUpperLimit;//模拟量1上限
|
||||
}
|
||||
|
@ -2,8 +2,11 @@ package com.fastbee.deviceData.api.renke.domin;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 虫情设备手自动模式切换
|
||||
*/
|
||||
@Data
|
||||
public class WormMode {
|
||||
public String deviceAddr;
|
||||
public String mode;
|
||||
public String deviceAddr;//设备地址
|
||||
public String mode;// 1自动0手动
|
||||
}
|
||||
|
@ -2,11 +2,26 @@ package com.fastbee.deviceData.api.renke.domin;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
*虫情设备下发命令
|
||||
*/
|
||||
@Data
|
||||
public class WormOper {
|
||||
|
||||
public String deviceAddr;
|
||||
public String deviceAddr;//设备地址
|
||||
/**
|
||||
* attractWorm诱虫灯;
|
||||
* rainFlap虫雨挡板;
|
||||
* wormFlap杀虫挡板;
|
||||
* dryingFlap烘干挡板;
|
||||
* moveWorm移虫装置;
|
||||
* shake震动装置;
|
||||
* fillLight补光灯;
|
||||
* insecticide杀虫控制;
|
||||
* drying烘干控制;
|
||||
* camera拍照;
|
||||
*/
|
||||
public String module;
|
||||
public String opt;
|
||||
public String opt;//0关闭1开启
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,73 @@
|
||||
package com.fastbee.deviceData.api.renke.service;
|
||||
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import cn.hutool.http.HttpResponse;
|
||||
import cn.hutool.json.JSONArray;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.fastbee.deviceData.api.renke.constant.RenKeDeviceTypeConstant;
|
||||
import com.fastbee.deviceData.domain.DeviceRealtimedataMeteorology;
|
||||
import com.fastbee.deviceData.domain.DeviceRealtimedataWorms;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.lang.reflect.Array;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collector;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
public class RenKeUserDeviceOverview {
|
||||
@Autowired
|
||||
private RenKeAuthorizationService authorizationService;
|
||||
public Map getsysAllUserDevice() {
|
||||
HttpResponse response = HttpRequest.get("http://api.farm.0531yun.cn/api/v2.0/entrance/device/getsysUserDevice")
|
||||
.header("token", authorizationService.getToken())
|
||||
.execute();
|
||||
String resultObjectStr = response.body();
|
||||
if (StringUtils.isBlank(response.toString())) {
|
||||
throw new RuntimeException("获取token失败!");
|
||||
}
|
||||
JSONObject respBody = JSONUtil.parseObj(resultObjectStr);
|
||||
JSONArray realtimeDataList = JSONUtil.parseArray(respBody.get("data"));
|
||||
Map<String,Integer> map = new HashMap<>();
|
||||
//map = realtimeDataList.stream().collect(Collectors.groupingBy(obj -> ((JSONObject) obj).getStr("deviceType")));
|
||||
Integer MET = 0;
|
||||
Integer WORM = 0;
|
||||
Integer Irrigation = 0;
|
||||
Integer Worm = 0;
|
||||
Integer Soil =0;
|
||||
Integer Spore = 0;
|
||||
Integer Camera = 0;
|
||||
for (Object jsonObject : realtimeDataList) {
|
||||
JSONObject josnConversion = (JSONObject) jsonObject;
|
||||
if (RenKeDeviceTypeConstant.WORM.equals(josnConversion.get("deviceType"))) {
|
||||
WORM=WORM+1;
|
||||
} else if (RenKeDeviceTypeConstant.MET.equals(josnConversion.get("deviceType"))) {
|
||||
MET=MET+1;
|
||||
}else if (RenKeDeviceTypeConstant.Irrigation.equals(josnConversion.get("deviceType"))) {
|
||||
Irrigation=Irrigation+1;
|
||||
} else if (RenKeDeviceTypeConstant.Camera.equals(josnConversion.get("deviceType"))) {
|
||||
Camera=Camera+1;
|
||||
} else if (RenKeDeviceTypeConstant.Worm.equals(josnConversion.get("deviceType"))) {
|
||||
Worm=Worm+1;
|
||||
} else if (RenKeDeviceTypeConstant.Soil.equals(josnConversion.get("deviceType"))) {
|
||||
Soil=Soil+1;
|
||||
} else if (RenKeDeviceTypeConstant.Spore.equals(josnConversion.get("deviceType"))) {
|
||||
Spore=Spore+1;
|
||||
}
|
||||
}
|
||||
map.put("MET",MET);
|
||||
map.put("Worm",Worm);
|
||||
map.put("Irrigation",Irrigation);
|
||||
map.put("Camera",Camera);
|
||||
map.put("wormFlagship",WORM);
|
||||
map.put("Soil",Soil);
|
||||
map.put("Spore",Spore);
|
||||
return map;
|
||||
}
|
||||
}
|
@ -14,6 +14,7 @@ import com.fastbee.deviceData.api.renke.domin.UpdateDevice;
|
||||
import com.fastbee.deviceData.api.renke.domin.WormMode;
|
||||
import com.fastbee.deviceData.api.renke.domin.WormOper;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
@ -22,18 +23,19 @@ import org.springframework.stereotype.Service;
|
||||
@Service
|
||||
public class RenkeWormSituationDeviceService {
|
||||
|
||||
@Autowired
|
||||
private RenKeAuthorizationService authorizationService;
|
||||
/**
|
||||
* 批量获取设备详情
|
||||
* @param deviceAddr
|
||||
* @param token
|
||||
* @return
|
||||
*/
|
||||
public JSONObject getAllInsectEquipmentInformation(String deviceAddr,String token){
|
||||
public JSONObject getAllInsectEquipmentInformation(String deviceAddr){
|
||||
|
||||
//获取设备实时数据
|
||||
//请求参数
|
||||
HttpResponse response = HttpRequest.get("http://api.farm.0531yun.cn/api/v2.0/worm/device/getBtchDeviceDO?deviceAddr="+deviceAddr)
|
||||
.header("token", token)
|
||||
.header("token", authorizationService.getToken())
|
||||
.execute();
|
||||
String respBodyStr = response.body();
|
||||
if(StringUtils.isBlank(respBodyStr)) {
|
||||
@ -45,13 +47,12 @@ public class RenkeWormSituationDeviceService {
|
||||
/**
|
||||
* 修改虫情设备信息
|
||||
* @param updateDevice
|
||||
* @param token
|
||||
* @return
|
||||
*/
|
||||
public JSONObject updateDevice(UpdateDevice updateDevice, String token){
|
||||
public JSONObject updateDevice(UpdateDevice updateDevice){
|
||||
//获取设备实时数据
|
||||
HttpResponse response = HttpRequest.post("http://api.farm.0531yun.cn/api/v2.0/worm/device/updateDevice")
|
||||
.header("token", token).body(JSONUtil.toJsonStr(updateDevice))
|
||||
.header("token", authorizationService.getToken()).body(JSONUtil.toJsonStr(updateDevice))
|
||||
.execute();
|
||||
String respBodyStr = response.body();
|
||||
if(StringUtils.isBlank(respBodyStr)) {
|
||||
@ -64,12 +65,11 @@ public class RenkeWormSituationDeviceService {
|
||||
/**
|
||||
* 获取设备自动模式时间
|
||||
* @param deviceAddr
|
||||
* @param token
|
||||
* @return
|
||||
*/
|
||||
public JSONObject getWormAutoMode(String deviceAddr,String token){
|
||||
public JSONObject getWormAutoMode(String deviceAddr){
|
||||
HttpResponse response = HttpRequest.get("http://api.farm.0531yun.cn/api/v2.0/worm/device/getWormAutoMode?deviceAddr="+deviceAddr)
|
||||
.header("token", token)
|
||||
.header("token", authorizationService.getToken())
|
||||
.execute();
|
||||
String respBodyStr = response.body();
|
||||
if(StringUtils.isBlank(respBodyStr)) {
|
||||
@ -82,15 +82,14 @@ public class RenkeWormSituationDeviceService {
|
||||
/**
|
||||
* 修改设备自动模式时间
|
||||
* @param modWormAutoMode
|
||||
* @param token
|
||||
* @return
|
||||
*/
|
||||
public JSONObject updateWormAutoMode(ModWormAutoMode modWormAutoMode,String token){
|
||||
public JSONObject updateWormAutoMode(ModWormAutoMode modWormAutoMode){
|
||||
//获取设备实时数据
|
||||
//请求参数
|
||||
Map<String,Object> reqBody =getObjectProperties(modWormAutoMode);
|
||||
HttpResponse response = HttpRequest.post("http://api.farm.0531yun.cn/api/v2.0/worm/device/modWormAutoMode")
|
||||
.header("token", token).body(JSONUtil.toJsonStr(reqBody))
|
||||
.header("token", authorizationService.getToken()).body(JSONUtil.toJsonStr(reqBody))
|
||||
.execute();
|
||||
String respBodyStr = response.body();
|
||||
if(StringUtils.isBlank(respBodyStr)) {
|
||||
@ -102,15 +101,14 @@ public class RenkeWormSituationDeviceService {
|
||||
/**
|
||||
* 手自动模式切换
|
||||
* @param wormMode
|
||||
* @param token
|
||||
* @return
|
||||
*/
|
||||
public JSONObject updateWormMode(WormMode wormMode, String token){
|
||||
public JSONObject updateWormMode(WormMode wormMode){
|
||||
//获取设备实时数据
|
||||
//请求参数
|
||||
Map<String,Object> reqBody =getObjectProperties(wormMode);
|
||||
HttpResponse response = HttpRequest.post("http://api.farm.0531yun.cn/api/v2.0/worm/device/modWormAutoMode")
|
||||
.header("token", token).body(JSONUtil.toJsonStr(reqBody))
|
||||
.header("token", authorizationService.getToken()).body(JSONUtil.toJsonStr(reqBody))
|
||||
.execute();
|
||||
String respBodyStr = response.body();
|
||||
if(StringUtils.isBlank(respBodyStr)) {
|
||||
@ -122,15 +120,14 @@ public class RenkeWormSituationDeviceService {
|
||||
/**
|
||||
* 虫情设备下发命令
|
||||
* @param wormOper
|
||||
* @param token
|
||||
* @return
|
||||
*/
|
||||
public JSONObject updateWormOper(WormOper wormOper, String token){
|
||||
public JSONObject updateWormOper(WormOper wormOper){
|
||||
//获取设备实时数据
|
||||
//请求参数
|
||||
Map<String,Object> reqBody =getObjectProperties(wormOper);
|
||||
HttpResponse response = HttpRequest.post("http://api.farm.0531yun.cn/api/v2.0/worm/device/deviceOper/wormOper")
|
||||
.header("token", token).body(JSONUtil.toJsonStr(reqBody))
|
||||
.header("token", authorizationService.getToken()).body(JSONUtil.toJsonStr(reqBody))
|
||||
.execute();
|
||||
String respBodyStr = response.body();
|
||||
if(StringUtils.isBlank(respBodyStr)) {
|
||||
@ -141,10 +138,9 @@ public class RenkeWormSituationDeviceService {
|
||||
}
|
||||
/**
|
||||
* 虫情设备历史记录
|
||||
* @param token
|
||||
* @return
|
||||
*/
|
||||
public JSONObject getWormHistoryData(String deviceAddr,String beginTime,String endTime,Integer pages,Integer limit,String token){
|
||||
public JSONObject getWormHistoryData(String deviceAddr,String beginTime,String endTime,Integer pages,Integer limit){
|
||||
// 请求基础URL
|
||||
String baseUrl = "http://api.farm.0531yun.cn/api/v2.0/worm/deviceData/getWormHistoryData";
|
||||
|
||||
@ -170,7 +166,7 @@ public class RenkeWormSituationDeviceService {
|
||||
}
|
||||
String fullUrl = baseUrl + "?" + queryParams.toString();
|
||||
HttpResponse response = HttpRequest.get(fullUrl)
|
||||
.header("token", token)
|
||||
.header("token", authorizationService.getToken())
|
||||
.execute();
|
||||
String respBodyStr = response.body();
|
||||
if(StringUtils.isBlank(respBodyStr)) {
|
||||
@ -181,10 +177,9 @@ public class RenkeWormSituationDeviceService {
|
||||
}
|
||||
/**
|
||||
* 虫情区域统计
|
||||
* @param token
|
||||
* @return
|
||||
*/
|
||||
public JSONObject getWormStatisticsByGroup(String groupId,String beginTime,String endTime,String token){
|
||||
public JSONObject getWormStatisticsByGroup(String groupId,String beginTime,String endTime){
|
||||
// 请求基础URL
|
||||
String baseUrl = "http://api.farm.0531yun.cn/api/v2.0/worm/deviceData/getWormStatisticsByGroup";
|
||||
|
||||
@ -203,7 +198,7 @@ public class RenkeWormSituationDeviceService {
|
||||
|
||||
String fullUrl = baseUrl + "?" + queryParams.toString();
|
||||
HttpResponse response = HttpRequest.get(fullUrl)
|
||||
.header("token", token)
|
||||
.header("token", authorizationService.getToken())
|
||||
.execute();
|
||||
String respBodyStr = response.body();
|
||||
if(StringUtils.isBlank(respBodyStr)) {
|
||||
@ -214,10 +209,9 @@ public class RenkeWormSituationDeviceService {
|
||||
}
|
||||
/**
|
||||
* 虫情设备分析报表
|
||||
* @param token
|
||||
* @return
|
||||
*/
|
||||
public JSONObject getWormDataList(String deviceAddr,String beginTime,String endTime,Integer pages,Integer limit,String token){
|
||||
public JSONObject getWormDataList(String deviceAddr,String beginTime,String endTime,Integer pages,Integer limit){
|
||||
// 请求基础URL
|
||||
String baseUrl = "http://api.farm.0531yun.cn/api/v2.0/worm/deviceData/getWormDataList";
|
||||
|
||||
@ -243,7 +237,7 @@ public class RenkeWormSituationDeviceService {
|
||||
}
|
||||
String fullUrl = baseUrl + "?" + queryParams.toString();
|
||||
HttpResponse response = HttpRequest.get(fullUrl)
|
||||
.header("token", token)
|
||||
.header("token", authorizationService.getToken())
|
||||
.execute();
|
||||
String respBodyStr = response.body();
|
||||
if(StringUtils.isBlank(respBodyStr)) {
|
||||
@ -256,15 +250,14 @@ public class RenkeWormSituationDeviceService {
|
||||
/**
|
||||
* 虫情设备分析报表记录(最新一条记录)
|
||||
* @param deviceAddr
|
||||
* @param token
|
||||
* @return
|
||||
*/
|
||||
public JSONObject getWormDataAndWormDataAIBy(String deviceAddr,String token){
|
||||
public JSONObject getWormDataAndWormDataAIBy(String deviceAddr){
|
||||
|
||||
//获取设备实时数据
|
||||
//请求参数
|
||||
HttpResponse response = HttpRequest.get("http://api.farm.0531yun.cn/api/v2.0/worm/deviceData/getWormDataAndWormDataAIBy?deviceAddr="+deviceAddr)
|
||||
.header("token", token)
|
||||
.header("token", authorizationService.getToken())
|
||||
.execute();
|
||||
String respBodyStr = response.body();
|
||||
if(StringUtils.isBlank(respBodyStr)) {
|
||||
@ -276,15 +269,14 @@ public class RenkeWormSituationDeviceService {
|
||||
/**
|
||||
* 害虫自动识别
|
||||
* @param recordId
|
||||
* @param token
|
||||
* @return
|
||||
*/
|
||||
public JSONObject analysistWorm(String recordId,String token){
|
||||
public JSONObject analysistWorm(String recordId){
|
||||
|
||||
//获取设备实时数据
|
||||
//请求参数
|
||||
HttpResponse response = HttpRequest.get("http://api.farm.0531yun.cn/api/v2.0/worm/deviceData/analysistWorm?recordId="+recordId)
|
||||
.header("token", token)
|
||||
.header("token", authorizationService.getToken())
|
||||
.execute();
|
||||
String respBodyStr = response.body();
|
||||
if(StringUtils.isBlank(respBodyStr)) {
|
||||
@ -295,10 +287,9 @@ public class RenkeWormSituationDeviceService {
|
||||
}
|
||||
/**
|
||||
* 根据ID获取虫情设备分析报表记录
|
||||
* @param token
|
||||
* @return
|
||||
*/
|
||||
public JSONObject getDeviceAnalysisReportRecordAccordingIdList(String deviceAddr,String recordIds,String token){
|
||||
public JSONObject getDeviceAnalysisReportRecordAccordingIdList(String deviceAddr,String recordIds){
|
||||
// 请求基础URL
|
||||
String baseUrl = "http://api.farm.0531yun.cn/api/v2.0/worm/deviceData/getDeviceAnalysisReportRecordAccordingIdList";
|
||||
|
||||
@ -313,7 +304,7 @@ public class RenkeWormSituationDeviceService {
|
||||
}
|
||||
String fullUrl = baseUrl + "?" + queryParams.toString();
|
||||
HttpResponse response = HttpRequest.get(fullUrl)
|
||||
.header("token", token)
|
||||
.header("token", authorizationService.getToken())
|
||||
.execute();
|
||||
String respBodyStr = response.body();
|
||||
if(StringUtils.isBlank(respBodyStr)) {
|
||||
@ -324,10 +315,9 @@ public class RenkeWormSituationDeviceService {
|
||||
}
|
||||
/**
|
||||
* 虫情设备操作记录
|
||||
* @param token
|
||||
* @return
|
||||
*/
|
||||
public JSONObject getWormOperationLog(String deviceAddr,String beginTime,String endTime,String token){
|
||||
public JSONObject getWormOperationLog(String deviceAddr,String beginTime,String endTime){
|
||||
// 请求基础URL
|
||||
String baseUrl = "http://api.farm.0531yun.cn/api/v2.0/worm/deviceData/getWormOperationLog";
|
||||
|
||||
@ -345,7 +335,7 @@ public class RenkeWormSituationDeviceService {
|
||||
}
|
||||
String fullUrl = baseUrl + "?" + queryParams.toString();
|
||||
HttpResponse response = HttpRequest.get(fullUrl)
|
||||
.header("token", token)
|
||||
.header("token", authorizationService.getToken())
|
||||
.execute();
|
||||
String respBodyStr = response.body();
|
||||
if(StringUtils.isBlank(respBodyStr)) {
|
||||
|
@ -0,0 +1,76 @@
|
||||
package com.fastbee.deviceData.domain;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.fastbee.common.annotation.Excel;
|
||||
import com.fastbee.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 设备厂家信息对象 iot_device_manufacturers
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2024-11-13
|
||||
*/
|
||||
@ApiModel(value = "DeviceManufacturers",description = "设备厂家信息 iot_device_manufacturers")
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class DeviceManufacturers extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键 */
|
||||
private Long id;
|
||||
|
||||
/** 厂家链接,接口基地址 */
|
||||
@Excel(name = "厂家链接,接口基地址")
|
||||
@ApiModelProperty("厂家链接,接口基地址")
|
||||
private String endpoint;
|
||||
|
||||
/** 厂名称 */
|
||||
@Excel(name = "厂名称")
|
||||
@ApiModelProperty("厂名称")
|
||||
private String manufacturerName;
|
||||
|
||||
/** 帐户 */
|
||||
@Excel(name = "帐户")
|
||||
@ApiModelProperty("帐户")
|
||||
private String account;
|
||||
|
||||
/** 密码 */
|
||||
@Excel(name = "密码")
|
||||
@ApiModelProperty("密码")
|
||||
private String password;
|
||||
|
||||
/** 接口文档 */
|
||||
@Excel(name = "接口文档")
|
||||
@ApiModelProperty("接口文档")
|
||||
private String interfaceDocumentation;
|
||||
|
||||
/** api-key */
|
||||
@Excel(name = "api-key")
|
||||
@ApiModelProperty("api-key")
|
||||
private String apiKey;
|
||||
|
||||
/** authId */
|
||||
@Excel(name = "authId")
|
||||
@ApiModelProperty("authId")
|
||||
private String authid;
|
||||
|
||||
/** secret-key */
|
||||
@Excel(name = "secret-key")
|
||||
@ApiModelProperty("secret-key")
|
||||
private String secretKey;
|
||||
|
||||
/** 厂家鉴权接口地址 */
|
||||
@Excel(name = "厂家鉴权接口地址")
|
||||
@ApiModelProperty("厂家鉴权接口地址")
|
||||
private String tokenendpoint;
|
||||
|
||||
/** 删除标志(0代表存在,2代表删除) */
|
||||
private Integer delFlag;
|
||||
|
||||
}
|
@ -0,0 +1,63 @@
|
||||
package com.fastbee.deviceData.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.fastbee.deviceData.domain.DeviceManufacturers;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 设备厂家信息Mapper接口
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2024-11-13
|
||||
*/
|
||||
@Mapper
|
||||
public interface DeviceManufacturersMapper
|
||||
{
|
||||
/**
|
||||
* 查询设备厂家信息
|
||||
*
|
||||
* @param id 设备厂家信息主键
|
||||
* @return 设备厂家信息
|
||||
*/
|
||||
public DeviceManufacturers selectDeviceManufacturersById(Long id);
|
||||
|
||||
/**
|
||||
* 查询设备厂家信息列表
|
||||
*
|
||||
* @param deviceManufacturers 设备厂家信息
|
||||
* @return 设备厂家信息集合
|
||||
*/
|
||||
public List<DeviceManufacturers> selectDeviceManufacturersList(DeviceManufacturers deviceManufacturers);
|
||||
|
||||
/**
|
||||
* 新增设备厂家信息
|
||||
*
|
||||
* @param deviceManufacturers 设备厂家信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertDeviceManufacturers(DeviceManufacturers deviceManufacturers);
|
||||
|
||||
/**
|
||||
* 修改设备厂家信息
|
||||
*
|
||||
* @param deviceManufacturers 设备厂家信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateDeviceManufacturers(DeviceManufacturers deviceManufacturers);
|
||||
|
||||
/**
|
||||
* 删除设备厂家信息
|
||||
*
|
||||
* @param id 设备厂家信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteDeviceManufacturersById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除设备厂家信息
|
||||
*
|
||||
* @param ids 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteDeviceManufacturersByIds(Long[] ids);
|
||||
}
|
@ -0,0 +1,62 @@
|
||||
package com.fastbee.deviceData.service;
|
||||
|
||||
import com.fastbee.deviceData.domain.DeviceManufacturers;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 设备厂家信息Service接口
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2024-11-13
|
||||
*/
|
||||
public interface IDeviceManufacturersService
|
||||
{
|
||||
/**
|
||||
* 查询设备厂家信息
|
||||
*
|
||||
* @param id 设备厂家信息主键
|
||||
* @return 设备厂家信息
|
||||
*/
|
||||
public DeviceManufacturers selectDeviceManufacturersById(Long id);
|
||||
|
||||
/**
|
||||
* 查询设备厂家信息列表
|
||||
*
|
||||
* @param deviceManufacturers 设备厂家信息
|
||||
* @return 设备厂家信息集合
|
||||
*/
|
||||
public List<DeviceManufacturers> selectDeviceManufacturersList(DeviceManufacturers deviceManufacturers);
|
||||
|
||||
/**
|
||||
* 新增设备厂家信息
|
||||
*
|
||||
* @param deviceManufacturers 设备厂家信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertDeviceManufacturers(DeviceManufacturers deviceManufacturers);
|
||||
|
||||
/**
|
||||
* 修改设备厂家信息
|
||||
*
|
||||
* @param deviceManufacturers 设备厂家信息
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateDeviceManufacturers(DeviceManufacturers deviceManufacturers);
|
||||
|
||||
/**
|
||||
* 批量删除设备厂家信息
|
||||
*
|
||||
* @param ids 需要删除的设备厂家信息主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteDeviceManufacturersByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 删除设备厂家信息信息
|
||||
*
|
||||
* @param id 设备厂家信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteDeviceManufacturersById(Long id);
|
||||
}
|
@ -0,0 +1,96 @@
|
||||
package com.fastbee.deviceData.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import com.fastbee.common.utils.DateUtils;
|
||||
import com.fastbee.deviceData.domain.DeviceManufacturers;
|
||||
import com.fastbee.deviceData.mapper.DeviceManufacturersMapper;
|
||||
import com.fastbee.deviceData.service.IDeviceManufacturersService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* 设备厂家信息Service业务层处理
|
||||
*
|
||||
* @author kerwincui
|
||||
* @date 2024-11-13
|
||||
*/
|
||||
@Service
|
||||
public class DeviceManufacturersServiceImpl implements IDeviceManufacturersService
|
||||
{
|
||||
@Autowired
|
||||
private DeviceManufacturersMapper deviceManufacturersMapper;
|
||||
|
||||
/**
|
||||
* 查询设备厂家信息
|
||||
*
|
||||
* @param id 设备厂家信息主键
|
||||
* @return 设备厂家信息
|
||||
*/
|
||||
@Override
|
||||
public DeviceManufacturers selectDeviceManufacturersById(Long id)
|
||||
{
|
||||
return deviceManufacturersMapper.selectDeviceManufacturersById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询设备厂家信息列表
|
||||
*
|
||||
* @param deviceManufacturers 设备厂家信息
|
||||
* @return 设备厂家信息
|
||||
*/
|
||||
@Override
|
||||
public List<DeviceManufacturers> selectDeviceManufacturersList(DeviceManufacturers deviceManufacturers)
|
||||
{
|
||||
return deviceManufacturersMapper.selectDeviceManufacturersList(deviceManufacturers);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增设备厂家信息
|
||||
*
|
||||
* @param deviceManufacturers 设备厂家信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertDeviceManufacturers(DeviceManufacturers deviceManufacturers)
|
||||
{
|
||||
deviceManufacturers.setCreateTime(DateUtils.getNowDate());
|
||||
return deviceManufacturersMapper.insertDeviceManufacturers(deviceManufacturers);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改设备厂家信息
|
||||
*
|
||||
* @param deviceManufacturers 设备厂家信息
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateDeviceManufacturers(DeviceManufacturers deviceManufacturers)
|
||||
{
|
||||
deviceManufacturers.setUpdateTime(DateUtils.getNowDate());
|
||||
return deviceManufacturersMapper.updateDeviceManufacturers(deviceManufacturers);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除设备厂家信息
|
||||
*
|
||||
* @param ids 需要删除的设备厂家信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteDeviceManufacturersByIds(Long[] ids)
|
||||
{
|
||||
return deviceManufacturersMapper.deleteDeviceManufacturersByIds(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除设备厂家信息信息
|
||||
*
|
||||
* @param id 设备厂家信息主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteDeviceManufacturersById(Long id)
|
||||
{
|
||||
return deviceManufacturersMapper.deleteDeviceManufacturersById(id);
|
||||
}
|
||||
}
|
@ -0,0 +1,116 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.fastbee.deviceData.mapper.DeviceManufacturersMapper">
|
||||
|
||||
<resultMap type="DeviceManufacturers" id="DeviceManufacturersResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="endpoint" column="endpoint" />
|
||||
<result property="manufacturerName" column="manufacturer_name" />
|
||||
<result property="account" column="account" />
|
||||
<result property="password" column="password" />
|
||||
<result property="interfaceDocumentation" column="interface_documentation" />
|
||||
<result property="apiKey" column="api_key" />
|
||||
<result property="authid" column="authId" />
|
||||
<result property="secretKey" column="secret_key" />
|
||||
<result property="tokenendpoint" column="tokenEndpoint" />
|
||||
<result property="delFlag" column="del_flag" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectDeviceManufacturersVo">
|
||||
select id, endpoint, manufacturer_name, account, password, interface_documentation, api_key, authId, secret_key, tokenEndpoint, del_flag, create_time, create_by, update_time, update_by from iot_device_manufacturers
|
||||
</sql>
|
||||
|
||||
<select id="selectDeviceManufacturersList" parameterType="DeviceManufacturers" resultMap="DeviceManufacturersResult">
|
||||
<include refid="selectDeviceManufacturersVo"/>
|
||||
<where>
|
||||
<if test="endpoint != null and endpoint != ''"> and endpoint = #{endpoint}</if>
|
||||
<if test="manufacturerName != null and manufacturerName != ''"> and manufacturer_name like concat('%', #{manufacturerName}, '%')</if>
|
||||
<if test="account != null and account != ''"> and account = #{account}</if>
|
||||
<if test="password != null and password != ''"> and password = #{password}</if>
|
||||
<if test="interfaceDocumentation != null and interfaceDocumentation != ''"> and interface_documentation = #{interfaceDocumentation}</if>
|
||||
<if test="apiKey != null and apiKey != ''"> and api_key = #{apiKey}</if>
|
||||
<if test="authid != null and authid != ''"> and authId = #{authid}</if>
|
||||
<if test="secretKey != null and secretKey != ''"> and secret_key = #{secretKey}</if>
|
||||
<if test="tokenendpoint != null and tokenendpoint != ''"> and tokenEndpoint = #{tokenendpoint}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectDeviceManufacturersById" parameterType="Long" resultMap="DeviceManufacturersResult">
|
||||
<include refid="selectDeviceManufacturersVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertDeviceManufacturers" parameterType="DeviceManufacturers" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into iot_device_manufacturers
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="endpoint != null">endpoint,</if>
|
||||
<if test="manufacturerName != null">manufacturer_name,</if>
|
||||
<if test="account != null">account,</if>
|
||||
<if test="password != null">password,</if>
|
||||
<if test="interfaceDocumentation != null">interface_documentation,</if>
|
||||
<if test="apiKey != null">api_key,</if>
|
||||
<if test="authid != null">authId,</if>
|
||||
<if test="secretKey != null">secret_key,</if>
|
||||
<if test="tokenendpoint != null">tokenEndpoint,</if>
|
||||
<if test="delFlag != null">del_flag,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="endpoint != null">#{endpoint},</if>
|
||||
<if test="manufacturerName != null">#{manufacturerName},</if>
|
||||
<if test="account != null">#{account},</if>
|
||||
<if test="password != null">#{password},</if>
|
||||
<if test="interfaceDocumentation != null">#{interfaceDocumentation},</if>
|
||||
<if test="apiKey != null">#{apiKey},</if>
|
||||
<if test="authid != null">#{authid},</if>
|
||||
<if test="secretKey != null">#{secretKey},</if>
|
||||
<if test="tokenendpoint != null">#{tokenendpoint},</if>
|
||||
<if test="delFlag != null">#{delFlag},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateDeviceManufacturers" parameterType="DeviceManufacturers">
|
||||
update iot_device_manufacturers
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="endpoint != null">endpoint = #{endpoint},</if>
|
||||
<if test="manufacturerName != null">manufacturer_name = #{manufacturerName},</if>
|
||||
<if test="account != null">account = #{account},</if>
|
||||
<if test="password != null">password = #{password},</if>
|
||||
<if test="interfaceDocumentation != null">interface_documentation = #{interfaceDocumentation},</if>
|
||||
<if test="apiKey != null">api_key = #{apiKey},</if>
|
||||
<if test="authid != null">authId = #{authid},</if>
|
||||
<if test="secretKey != null">secret_key = #{secretKey},</if>
|
||||
<if test="tokenendpoint != null">tokenEndpoint = #{tokenendpoint},</if>
|
||||
<if test="delFlag != null">del_flag = #{delFlag},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
</trim>
|
||||
where id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteDeviceManufacturersById" parameterType="Long">
|
||||
delete from iot_device_manufacturers where id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteDeviceManufacturersByIds" parameterType="String">
|
||||
delete from iot_device_manufacturers where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
Loading…
x
Reference in New Issue
Block a user