设备信息定时查询

天气预警数据定时查询
This commit is contained in:
Alan-mx 2023-05-12 15:40:07 +08:00
parent 10b89f0da0
commit b4eb0d6a68
64 changed files with 3843 additions and 253 deletions

View File

@ -182,7 +182,7 @@
<module>ruoyi-common</module>
<module>ruoyi-pill</module>
<module>ruoyi-crops</module>
<module>01</module>
<!-- <module>01</module>-->
</modules>
<packaging>pom</packaging>

View File

@ -87,6 +87,12 @@
<artifactId>gson</artifactId>
<version>2.10.1</version>
</dependency>
<!-- geoserver-->
<dependency>
<groupId>nl.pdok</groupId>
<artifactId>geoserver-manager</artifactId>
<version>1.7.0-pdok2</version>
</dependency>
</dependencies>

View File

@ -0,0 +1,110 @@
package com.ruoyi.web.controller.crops;
import cn.hutool.http.HttpUtil;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.crops.domain.DeviceSense;
import com.ruoyi.crops.domain.gsonBean.GsonDeviceSenseBean;
import com.ruoyi.crops.service.IDeviceSenseService;
import com.ruoyi.crops.service.IWarningService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.web.bind.annotation.*;
import java.lang.reflect.Field;
import java.text.SimpleDateFormat;
import java.util.*;
@RestController
@RequestMapping("/crops/device")
public class DeviceSenseController {
private static final Logger logger = LoggerFactory.getLogger("scheduled");
@Value("${url.deviceSense}")
String url;//指定UR
@Autowired
private IDeviceSenseService iDeviceSenseService;
@Autowired
private IWarningService iWarningService;
/**
* 根据时间查询设备传感数据
*
* @param startTime
* @param endTime
* @return
*/
@GetMapping
public List<DeviceSense> selectBytime(@RequestParam String startTime, @RequestParam String endTime) {
return iDeviceSenseService.selectByTime(startTime, endTime);
}
/**
* 定时任务调用接口获取数据插入数据库
*
* @throws Exception
*/
@Scheduled(fixedDelay = 6 * 60 * 1000)
public void getsense() throws Exception {
String deviceId = "863070042491174-1-1";
Map<String, Object> map = new HashMap<>();//存放参数
map.put("deviceId", deviceId);
//发送get请求
String result = HttpUtil.createGet(url).form(map).execute().body();
//格式化json时间类型数据
Gson gson = new GsonBuilder().setDateFormat("yyyy/MM/dd HH:mm:ss").create();
//格式化json封装到GsonDeviceSenseBean类型
GsonDeviceSenseBean model = gson.fromJson(result, GsonDeviceSenseBean.class);
//创建DeviceSense对象设置deviceId
DeviceSense deviceSense = new DeviceSense();
deviceSense.setDeviceId(deviceId);
//通过反射获取成员变量name与json字段匹配入库
Class clazz = Class.forName("com.ruoyi.crops.domain.DeviceSense");
for (GsonDeviceSenseBean.AttDataList attDataList : model.data.attDataList) {
//2.获取成员变量
String attributeValue = attDataList.attributeValue;
Field field = clazz.getDeclaredField(attDataList.attributeName);
//设置私有变量也可访问
field.setAccessible(true);
//判断数据类型进行相应转换
if (attributeValue != null) {
switch (field.getType().getName()) {
case "java.lang.Double":
field.set(deviceSense, Double.valueOf(attributeValue));
break;
case "java.lang.Integer":
field.set(deviceSense, Integer.valueOf(attributeValue));
break;
case "java.lang.String":
field.set(deviceSense, attributeValue);
break;
case "java.util.Date":
field.set(deviceSense, new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(attributeValue));
}
}
}
//使用sql判断重复数据插入
iDeviceSenseService.dedupInsert(deviceSense);
//判断设备预警信息 插入异常数据库
iWarningService.insertWarning(deviceSense);
logger.info("每6分钟更新一次设备传感数据");
}
/**
* 根据小时获取其平均值数据
* @param type
* @return
*/
@GetMapping("/sense")
public AjaxResult averageList(@RequestParam String type) {
return AjaxResult.success(iDeviceSenseService.averageList(type));
}
}

View File

@ -21,21 +21,23 @@ public class EnvironmentalController extends BaseController {
/**
* 根据大棚编号查询
*
* @param number
* @return
*/
@GetMapping("/{number}")
private List<EnvironmentalData> selectByNumber(@PathVariable Integer number){
private List<EnvironmentalData> selectByNumber(@PathVariable Integer number) {
return iEnvironmentalService.selectByNumber(number);
}
/**
* 新增单条数据
*
* @param environmentalData
* @return
*/
@PostMapping
private AjaxResult insert(@RequestBody EnvironmentalData environmentalData){
private AjaxResult insert(@RequestBody EnvironmentalData environmentalData) {
return toAjax(iEnvironmentalService.insert(environmentalData));
}
}

View File

@ -0,0 +1,81 @@
package com.ruoyi.web.controller.crops;
import cn.hutool.http.HttpUtil;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.ruoyi.crops.domain.DeviceSense;
import com.ruoyi.crops.domain.FertigationSense;
import com.ruoyi.crops.domain.gsonBean.GsonDeviceSenseBean;
import com.ruoyi.crops.service.IFertigationSenseService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.lang.reflect.Field;
import java.text.SimpleDateFormat;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static org.assertj.core.util.DateUtil.now;
@RestController
@RequestMapping
public class FertigationSenseController {
private static final Logger logger = LoggerFactory.getLogger("scheduled");
@Value("${url.deviceSense}")
String url;//指定UR
@Autowired
private IFertigationSenseService iFertigationSenseService;
@Scheduled(fixedDelay = 60 * 60 * 1000)
public void getsense() throws Exception {
String deviceId = "645281df92edbc7ee9427230_NHWL-MengLiangGu-Fertigation";
Map<String, Object> map = new HashMap<>();//存放参数
map.put("deviceId", deviceId);
//发送get请求
String result = HttpUtil.createGet(url).form(map).execute().body();
//格式化json时间类型数据
Gson gson = new GsonBuilder().setDateFormat("yyyy/MM/dd HH:mm:ss").create();
//格式化json封装到GsonDeviceSenseBean类型
GsonDeviceSenseBean model = gson.fromJson(result, GsonDeviceSenseBean.class);
//创建DeviceSense对象设置deviceId
FertigationSense fertigationSense = new FertigationSense();
fertigationSense.setDeviceId(deviceId);
fertigationSense.setTime(now());
//通过反射获取成员变量name与json字段匹配入库
Class clazz = Class.forName("com.ruoyi.crops.domain.FertigationSense");
for (GsonDeviceSenseBean.AttDataList attDataList : model.data.attDataList) {
//2.获取成员变量
String attributeValue = attDataList.attributeValue;
Field field = clazz.getDeclaredField(attDataList.attributeName);
//设置私有变量也可访问
field.setAccessible(true);
//判断数据类型进行相应转换
if (attributeValue != null) {
switch (field.getType().getName()) {
case "java.lang.Double":
field.set(fertigationSense, Double.valueOf(attributeValue));
break;
case "java.lang.Integer":
field.set(fertigationSense, Integer.valueOf(attributeValue));
break;
case "java.lang.String":
field.set(fertigationSense, attributeValue);
break;
// case "java.util.Date":
// field.set(fertigationSense, new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(attributeValue));
}
}
}
//使用sql判断重复数据插入
iFertigationSenseService.insert(fertigationSense);
logger.info("每小时更新一次水肥一体机设备传感数据");
}
}

View File

@ -1,22 +1,12 @@
package com.ruoyi.web.controller.crops;
import cn.hutool.http.HttpUtil;
import com.google.gson.Gson;
import com.ruoyi.crops.domain.GsonParseFoundationBean;
import com.ruoyi.crops.service.IFoundationService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.security.core.parameters.P;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
@RestController
@RequestMapping("/foundation")
public class FoundationController {
@ -24,7 +14,7 @@ public class FoundationController {
private IFoundationService foundationService;
@PostMapping("/{id}")
public String Foundation(@PathVariable String id){
public String Foundation(@PathVariable String id) {
return foundationService.getFoundation(id);
}
}

View File

@ -1,12 +0,0 @@
package com.ruoyi.web.controller.crops;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController("/workspaces/PJZ/coveragestores/")
@RequestMapping
public class Geoservercontroller {
// @PutMapping("/{store}/{method}.{format}")
}

View File

@ -20,12 +20,12 @@ public class GreenhouseController extends BaseController {
private IGreenhouseService iGreenhouseService;
@GetMapping("/{name}")
public List<GreenhouseInformation> selectByName(@PathVariable String name){
public List<GreenhouseInformation> selectByName(@PathVariable String name) {
return iGreenhouseService.selectByName(name);
}
@PostMapping
public AjaxResult insert(@RequestBody GreenhouseInformation greenhouseInformation){
public AjaxResult insert(@RequestBody GreenhouseInformation greenhouseInformation) {
return toAjax(iGreenhouseService.insert(greenhouseInformation));
}
}

View File

@ -21,25 +21,27 @@ public class IntelligentController extends BaseController {
/**
* 新增单条数据
*
* @param intelligentControl
* @return
*/
@PostMapping
public AjaxResult insert(@RequestBody IntelligentControl intelligentControl){
public AjaxResult insert(@RequestBody IntelligentControl intelligentControl) {
return toAjax(iIntelligentControlService.insert(intelligentControl));
}
/**
* 查询全部
*
* @return
*/
@GetMapping("/list")
public List<IntelligentControl> selectAll(){
public List<IntelligentControl> selectAll() {
return iIntelligentControlService.selectAll();
}
@PutMapping
public AjaxResult edit(@RequestBody IntelligentControl intelligentControl){
public AjaxResult edit(@RequestBody IntelligentControl intelligentControl) {
return toAjax(iIntelligentControlService.edit(intelligentControl));
}
}

View File

@ -21,21 +21,23 @@ public class MachineParameterController extends BaseController {
/**
* 根据大棚名称进行查询
*
* @param name
* @return
*/
@GetMapping("/{name}")
public List<MachineParameter> selectByName(@PathVariable String name){
public List<MachineParameter> selectByName(@PathVariable String name) {
return machineParameterService.selectByName(name);
}
/**
* 新增单条数据
*
* @param machineParameter
* @return
*/
@PostMapping
public AjaxResult insert(@RequestBody MachineParameter machineParameter){
public AjaxResult insert(@RequestBody MachineParameter machineParameter) {
return toAjax(machineParameterService.insert(machineParameter));
}
}

View File

@ -0,0 +1,101 @@
package com.ruoyi.web.controller.crops;
import cn.hutool.http.HttpUtil;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.crops.domain.gsonBean.GsonMeteorologicalBean;
import com.ruoyi.crops.domain.Meteorological;
import com.ruoyi.crops.service.IMeteorologicalService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.*;
@RestController
@RequestMapping("/crops")
public class MeteorologicalController {
private static final Logger logger = LoggerFactory.getLogger("scheduled");
@Value("${Meteorological.url}")
private String url;
@Value("${Meteorological.key}")
private String key;
@Value("${Meteorological.code}")
private String code;
@Autowired
private IMeteorologicalService iMeteorologicalService;
@GetMapping("/meterological")
public AjaxResult selectByTime() {
if (iMeteorologicalService.selectByTime().isEmpty()) {
return AjaxResult.warn("今日暂无数据");
}
return AjaxResult.success(iMeteorologicalService.selectByTime());
}
@Scheduled(fixedDelay = 60 * 60 * 1000)
public void MeteorologicalInfo() {
Map<String, Object> map = new HashMap<>();//存放参数
map.put("city_code", code);
map.put("key", key);
// HashMap<String, String> headers = new HashMap<>();//存放请求头可以存放多个请求头
// headers.put("xxx", xxx);
//发送get请求并接收响应数据
String result = HttpUtil.createGet(url).form(map).execute().body();
//格式化Json时间类型
Gson gson = new GsonBuilder().setDateFormat("yyyy-MM-dd HH:mm:ss").create();
//讲json转换成对应实体类
GsonMeteorologicalBean model = gson.fromJson(result, GsonMeteorologicalBean.class);
//判断json是否有数据
if (model.result != null) {
ArrayList<GsonMeteorologicalBean.Meteorological> meteorologicalArrayList = model.result;
//创建一个空的list集合存放json解析的Meteorological实体数据
List<Meteorological> list = new ArrayList<>();
//遍历json数组里的参数存入实体类
for (GsonMeteorologicalBean.Meteorological meteorological : meteorologicalArrayList) {
//新建实体类
Meteorological ml = new Meteorological();
ml.setWarnId(meteorological.id);
ml.setTitle(meteorological.title);
ml.setLevel(meteorological.level);
ml.setType(meteorological.type);
ml.setTime(meteorological.time);
ml.setProvince(meteorological.province);
ml.setCity(meteorological.city);
ml.setDistrict(meteorological.district);
ml.setContent(meteorological.content);
list.add(ml);
}
//从数据库查询出今日的预警信息
List<Meteorological> meteorologicals = iMeteorologicalService.selectByTime();
//剔除两个集合里面重复元素根据WarnId和Time
for (int i = 0; i < list.size(); i++) {
Meteorological me = list.get(i);
for (int j = 0; j < meteorologicals.size(); j++) {
Meteorological m = meteorologicals.get(j);
if (me.getWarnId().equals(m.getWarnId()) && me.getTime().equals(m.getTime())) {
list.remove(i);
i--;
}
}
}
//遍历去重集合插入数据库
for (Meteorological meteorological : list) {
iMeteorologicalService.insert(meteorological);
}
logger.info("每小时更新1次天气预警");
} else {
logger.info("今日暂无预警");
}
}
}

View File

@ -20,20 +20,22 @@ public class OperationRecordsController extends BaseController {
/**
* 查询全部记录
*
* @return
*/
@GetMapping("/list")
public List<OperationRecords> listAll (){
public List<OperationRecords> listAll() {
return iOperationRecordsService.selectAll();
}
/**
* 新增单条数据
*
* @param operationRecords
* @return
*/
@PostMapping
public AjaxResult insert(@RequestBody OperationRecords operationRecords){
public AjaxResult insert(@RequestBody OperationRecords operationRecords) {
return toAjax(iOperationRecordsService.insert(operationRecords));
}

View File

@ -20,40 +20,44 @@ public class ServiceTypeController extends BaseController {
/**
* 根据类型查询有参
*
* @param type
* @return
*/
@GetMapping("/{type}")
public List<ServiceType> selectByType(@PathVariable String type){
return typeService.selectByType(type);
public List<ServiceType> selectByType(@PathVariable String type) {
return typeService.selectByType(type);
}
/**
* 无参查询全部展示
*
* @return
*/
@GetMapping
public List<ServiceType> selectAll(){
public List<ServiceType> selectAll() {
return typeService.selectAll();
}
/**
* 新增单条数据
*
* @param serviceType
* @return
*/
@PostMapping("insert")
public AjaxResult insert(@RequestBody ServiceType serviceType){
public AjaxResult insert(@RequestBody ServiceType serviceType) {
return toAjax(typeService.insert(serviceType));
}
/**
* 根据数组批量删除数据
*
* @param ids
* @return
*/
@DeleteMapping("/{ids}")
private AjaxResult remove(@PathVariable Long[] ids){
private AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(typeService.deleteByIds(ids));
}
}

View File

@ -0,0 +1,102 @@
package com.ruoyi.web.controller.crops;
import cn.hutool.http.HttpUtil;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.BashUtils;
import com.ruoyi.crops.domain.ServiceType;
import com.ruoyi.crops.service.IGeoServer;
import com.ruoyi.crops.service.IUploadService;
import com.ruoyi.crops.service.IexeService;
import org.apache.commons.io.FileUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.ResourceUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import java.io.File;
import java.io.IOException;
import java.net.URL;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
@RestController
@RequestMapping("/crops")
public class UploadController {
@Value("${url.group1Upload}")
private String url;
private String workSpace = "PJZ";
@Value("${path.exepath}")
private String exePath;
private String imgDataPath;
@Value("${path.boundaryDataPath}")
private String boundaryDataPath;
@Autowired
private IUploadService iUploadService;
@Autowired
private IGeoServer iGeoServer;
@Autowired
private IexeService iexeService;
/**
* 上传TIFF文件
*
* @param type 服务类型
* @param file Tiff文件
* @return 文件状态
* @throws Exception
*/
@PostMapping("/upload")
@Transactional(rollbackFor = Exception.class)
public AjaxResult upload(@RequestParam("type") String type, @RequestParam("file") MultipartFile file) throws Exception {
//获得项目的static路径
String realPath = ResourceUtils.getURL("classpath:").getPath() + "static";
//获得文件路径
String filePath = iUploadService.upload(type, file, realPath);
//调用接口上传文件到服务器
Map<String, Object> map = new HashMap<>();//存放参数
File targetFile = new File(filePath);
map.put("file", targetFile);
map.put("path", "pjz/tif");
String result = HttpUtil.createPost(url).form(map).execute().body();
//获取文件信息
String name = targetFile.getName();
String[] n = name.split("\\.");
String time = n[0].substring(n[0].length() - 10);
String fileName = n[0];
String servieName = workSpace + ":" + fileName;
//封装成serviceType对象
ServiceType serviceType = new ServiceType();
serviceType.setServiceType(type);
Date date = new SimpleDateFormat("yyyy-MM-dd").parse(time);
serviceType.setTime(date);
serviceType.setServiceName(servieName);
serviceType.setFileName(name);
serviceType.setFilePath(result);
//发送地图服务
String pjz = iGeoServer.GeoServer(workSpace, fileName, filePath);
//调用exe批量导入数据
String res = iexeService.execCommand(type, targetFile.getAbsolutePath(), boundaryDataPath);
//插入数据库
iGeoServer.insert(serviceType);
return AjaxResult.success(pjz + res);
}
}

View File

@ -3,35 +3,40 @@ package com.ruoyi.web.controller.crops;
import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson2.JSONObject;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.crops.domain.User;
import com.ruoyi.crops.domain.UserInfo;
import com.ruoyi.crops.service.IUserInfoService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.time.Duration;
import java.util.HashMap;
import java.util.List;
@RestController
@RequestMapping("/user/info")
public class UserInfoController extends BaseController {
private static final Logger logger = LoggerFactory.getLogger("scheduled");
@Autowired
private IUserInfoService userInfoService;
// @Scheduled(fixedDelay = 30*1000)
@PostMapping
public String userInfo(@RequestBody User user){
return userInfoService.login(user);
// System.out.println("执行1次");
private RedisTemplate redisTemplate;
@Value("${url.userInfo}")
private String url;
@Scheduled(fixedDelay = 60 * 60 * 1000 * 10)
public void userInfo() {
HashMap<String, Object> paramMap = new HashMap<>();
paramMap.put("username", "18954905838");
paramMap.put("password", "112233");
String result = HttpUtil.post(url, paramMap);
UserInfo userInfo = JSONObject.parseObject(result, UserInfo.class);
redisTemplate.opsForValue().set("cropsUserInfo", userInfo, Duration.ofSeconds(userInfo.getExpire()));
logger.info("更新redis中session信息");
}
}

View File

@ -2,40 +2,61 @@ package com.ruoyi.web.controller.crops;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.DateUtil;
import com.ruoyi.crops.domain.WaringNumber;
import com.ruoyi.crops.domain.WarningInformation;
import com.ruoyi.crops.service.IWarningService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.Date;
import java.util.List;
/**
* 预警信息controller
*/
@RestController
@RequestMapping("warning/information")
@RequestMapping("/warning/information")
public class WarningController extends BaseController {
@Autowired
private IWarningService iWarningService;
/**
* 根据大棚编号查询
* @param number
* 根据时间查询
*
* @return
*/
@GetMapping("/{number}")
public List<WarningInformation> selectByNumber(@PathVariable Integer number){
return iWarningService.selectByNumber(number);
@GetMapping("/selectByTime")
public List<WarningInformation> selectBytTime(@RequestParam Date startTime, @RequestParam Date endTime) {
return iWarningService.selectByTime(startTime, endTime);
}
/**
* 新增单条数据
*
* @param warningInformation
* @return
*/
@PostMapping
public AjaxResult insert(@RequestBody WarningInformation warningInformation){
public AjaxResult insert(@RequestBody WarningInformation warningInformation) {
return toAjax(iWarningService.insert(warningInformation));
}
@GetMapping("/numberOfTimes")
public AjaxResult numberOfTimes() {
List<WarningInformation> daylist = iWarningService.selectByTime(DateUtil.getDayBegin(), DateUtil.getDayEnd());
int dayNumber = daylist.size();
List<WarningInformation> weeklist = iWarningService.selectByTime(DateUtil.getBeginDayOfWeek(), DateUtil.getEndDayOfWeek());
int weekNumber = weeklist.size();
List<WarningInformation> monthlist = iWarningService.selectByTime(DateUtil.getBeginDayOfMonth(), DateUtil.getEndDayOfMonth());
int monthNumber = monthlist.size();
WaringNumber waringNumber = new WaringNumber();
waringNumber.setDayNumber(dayNumber);
waringNumber.setWeekNumber(weekNumber);
waringNumber.setMonthNumber(monthNumber);
return AjaxResult.success(waringNumber);
}
}

View File

@ -57,11 +57,11 @@ spring:
active: druid
# 文件上传
servlet:
multipart:
# 单个文件大小
max-file-size: 10MB
# 设置总上传的文件大小
max-request-size: 20MB
multipart:
# 单个文件大小
max-file-size: 1024MB
# 设置总上传的文件大小
max-request-size: 2048MB
# 服务模块
devtools:
restart:
@ -92,21 +92,21 @@ spring:
# token配置
token:
# 令牌自定义标识
header: Authorization
# 令牌密钥
secret: abcdefghijklmnopqrstuvwxyz
# 令牌有效期默认30分钟
expireTime: 30
# 令牌自定义标识
header: Authorization
# 令牌密钥
secret: abcdefghijklmnopqrstuvwxyz
# 令牌有效期默认30分钟
expireTime: 30
# MyBatis配置
mybatis:
# 搜索指定包别名
typeAliasesPackage: com.ruoyi.**.domain
# 配置mapper的扫描找到所有的mapper.xml映射文件
mapperLocations: classpath*:mapper/**/*Mapper.xml
# 加载全局的配置文件
configLocation: classpath:mybatis/mybatis-config.xml
# 搜索指定包别名
typeAliasesPackage: com.ruoyi.**.domain
# 配置mapper的扫描找到所有的mapper.xml映射文件
mapperLocations: classpath*:mapper/**/*Mapper.xml
# 加载全局的配置文件
configLocation: classpath:mybatis/mybatis-config.xml
# PageHelper分页插件
pagehelper:
@ -133,3 +133,21 @@ xss:
url:
foundation: 'http://api.nonghaiiot.com/api/foundation/getFoundationByUserId.zzdy'
userInfo: 'http://api.nonghaiiot.com/admin/sys/login'
group1Upload: '192.168.2.20:4096/group1/upload'
deviceSense : 'http://admin.nonghaiiot.com/app/queryDataByPropertyAll'
geoserver:
url: 'http://192.168.2.20:9080/geoserver'
username: 'admin'
password: 'geoserver'
path:
exepath: 'E:/庞家镇农情统计分析脚本/'
imgDataPath:
boundaryDataPath: 'E:/庞家镇农情统计分析脚本/庞家镇村边界.tif'
Meteorological:
url: 'https://apis.juhe.cn/fapig/alarm/queryV2'
# key: 'f072a23affd5551ecd9ae3a98d703b1c'
key : '123'
code: '150700'

View File

@ -11,7 +11,7 @@
<pattern>${log.pattern}</pattern>
</encoder>
</appender>
<!-- 系统日志输出 -->
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/sys-info.log</file>
@ -34,7 +34,7 @@
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/sys-error.log</file>
<!-- 循环政策:基于时间创建日志文件 -->
@ -56,7 +56,7 @@
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!-- 用户访问日志输出 -->
<appender name="sys-user" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/sys-user.log</file>
@ -70,7 +70,7 @@
<pattern>${log.pattern}</pattern>
</encoder>
</appender>
<!-- 系统模块日志级别控制 -->
<logger name="com.ruoyi" level="info" />
<!-- Spring日志级别控制 -->
@ -79,15 +79,19 @@
<root level="info">
<appender-ref ref="console" />
</root>
<!--系统操作日志-->
<root level="info">
<appender-ref ref="file_info" />
<appender-ref ref="file_error" />
</root>
<!--系统用户操作日志-->
<logger name="sys-user" level="info">
<appender-ref ref="sys-user"/>
</logger>
</configuration>
<!--定时任务日志-->
<logger name="scheduled" level="info">
<appender-ref ref="sys-user"/>
</logger>
</configuration>

View File

@ -1,21 +1,77 @@
package com.ruoyi.web;
import com.ruoyi.pill.domain.PillFactory;
import com.ruoyi.pill.service.IPillFactoryService;
import cn.hutool.http.HttpUtil;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.ruoyi.crops.domain.DeviceSense;
import com.ruoyi.crops.domain.FertigationSense;
import com.ruoyi.crops.domain.WarningInformation;
import com.ruoyi.crops.domain.gsonBean.GsonDeviceSenseBean;
import com.ruoyi.crops.service.IFertigationSenseService;
import com.ruoyi.crops.service.IWarningService;
import it.geosolutions.geoserver.rest.GeoServerRESTManager;
import it.geosolutions.geoserver.rest.GeoServerRESTPublisher;
import it.geosolutions.geoserver.rest.encoder.GSLayerEncoder;
import it.geosolutions.geoserver.rest.encoder.feature.GSFeatureTypeEncoder;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.test.context.SpringBootTest;
import java.lang.reflect.Field;
import java.net.URL;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.HashMap;
import java.util.Map;
import static org.assertj.core.util.DateUtil.now;
@SpringBootTest
public class PssTest {
@Value("${geoserver.url}")
private String url;
@Value("${geoserver.username}")
private String username;
@Value("${geoserver.password}")
private String password;
@Autowired
private IPillFactoryService IpillFactoryService;
private IWarningService iWarningService;
@Test
public void testSelectFactory(){
PillFactory pillFactory = new PillFactory();
pillFactory.setFactoryName("云南");
IpillFactoryService.selectPillFactoryList(pillFactory);
public void test() throws Exception {
// publisherLayer("PJZ","zwhq_2023-05-11","zwhq","a","PJZ:zwcl_xm_2023-04-20","c",1);
getDayBegin();
}
public static java.util.Date getDayBegin() {
Calendar cal = new GregorianCalendar();
cal.set(Calendar.HOUR_OF_DAY, 0);
cal.set(Calendar.MINUTE, 0);
cal.set(Calendar.SECOND, 0);
cal.set(Calendar.MILLISECOND, 0);
System.out.println(cal.getTime());
return cal.getTime();
}
public boolean publisherLayer(String workspaceName,String dataStoreName,String styleName, String tableName,String layerName, String layerAlias, int crsCode) throws Exception {
URL u = new URL(url);
GeoServerRESTManager manager = new GeoServerRESTManager(u, username, password);
GeoServerRESTPublisher publisher = manager.getPublisher();
//图层设置
GSFeatureTypeEncoder gsFeatureTypeEncoder = new GSFeatureTypeEncoder();
gsFeatureTypeEncoder.setNativeName(tableName); //表名
gsFeatureTypeEncoder.setName(layerName); // 图层名称
gsFeatureTypeEncoder.setTitle(layerAlias);// 图层别名
gsFeatureTypeEncoder.setSRS("EPSG:" + crsCode); //坐标系
GSLayerEncoder styleEncoder = new GSLayerEncoder(); //设置样式
styleEncoder.setDefaultStyle(workspaceName,styleName);
boolean publishDBLayerResult = publisher.publishDBLayer(workspaceName, dataStoreName, gsFeatureTypeEncoder, styleEncoder);
return publishDBLayerResult;
}
}

View File

@ -52,13 +52,13 @@
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
<!-- JSON工具类 -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
<!-- 动态数据源 -->
<dependency>
<groupId>com.baomidou</groupId>
@ -125,7 +125,11 @@
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
</dependencies>
</project>
</project>

View File

@ -0,0 +1,121 @@
package com.ruoyi.common.utils;
import lombok.extern.slf4j.Slf4j;
import java.io.*;
import java.util.ArrayList;
import java.util.List;
@Slf4j
public class BashUtils {
/*public static final Integer SUCCESS_CODE = 0;
*//**
* 执行命令
*
* @param command
* @return
* @throws IOException
* @throws InterruptedException
*//*
public static int execCommand(String command, String dir) throws IOException, InterruptedException {
String[] commands = command.split(" ");
List<String> commandList = new ArrayList<>(commands.length);
for (String s : commands) {
if (StringUtils.isBlank(s)) {
continue;
}
commandList.add(s);
}
commands = new String[commandList.size()];
commands = commandList.toArray(commands);
ProcessBuilder processBuilder = new ProcessBuilder(commands);
if (StringUtils.isNotBlank(dir)) {
processBuilder.directory(new File(dir));
}
log.info("开始执行命令: {} ", command);
Process exec = processBuilder.start();
// 获取外部程序标准输出流
new Thread(new OutputHandlerRunnable(exec.getInputStream(), false)).start();
// 获取外部程序标准错误流
new Thread(new OutputHandlerRunnable(exec.getErrorStream(), true)).start();
int code = exec.waitFor();
log.info("命令: {} 执行结果: {}", command, code);
return code;
}
private static class OutputHandlerRunnable implements Runnable {
private InputStream in;
private boolean error;
public OutputHandlerRunnable(InputStream in, boolean error) {
this.in = in;
this.error = error;
}
@Override
public void run() {
try (BufferedReader bufr = new BufferedReader(new InputStreamReader(this.in))) {
String line = null;
while ((line = bufr.readLine()) != null) {
if (error) {
System.out.println(line);
}
}
} catch (IOException e) {
e.printStackTrace();
}
}
}*/
public static String execCommand(String command) {
BufferedReader bufferedReader = null;
StringBuilder stringBuilder = new StringBuilder();
String result = null;
try {
File file = new File("C:\\daemonTmp");
// 新建一个存储结果的缓存文件
File tmpFile = new File("C:\\daemonTmp\\temp.tmp");
if (!file.exists()) {
file.mkdirs();
}
if (!tmpFile.exists()) {
tmpFile.createNewFile();
}
ProcessBuilder processBuilder = new ProcessBuilder()
.command("cmd.exe", "/c", command).inheritIO();
// 把控制台中的红字变成了黑字用通常的方法其实获取不到控制台的结果是pb.start()方法内部输出的
processBuilder.redirectErrorStream(true);
// 输出执行结果
processBuilder.redirectOutput(tmpFile);
// 等待语句执行完成否则可能会读不到结果
processBuilder.start().waitFor();
InputStream inputStream = new FileInputStream(tmpFile);
//设置编码
bufferedReader = new BufferedReader(new InputStreamReader(inputStream, "GBK"));
String line = null;
while ((line = bufferedReader.readLine()) != null) {
stringBuilder.append(line + "\n");
}
bufferedReader.close();
bufferedReader = null;
result = stringBuilder.toString();
} catch(Exception e) {
e.printStackTrace();
} finally {
if (bufferedReader != null) {
try {
bufferedReader.close();
} catch(IOException e) {
e.printStackTrace();
}
}
}
return result;
}
}

View File

@ -0,0 +1,366 @@
package com.ruoyi.common.utils;
import java.sql.Timestamp;
import java.time.LocalDate;
import java.time.ZoneId;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.List;
/**
* 日期工具类
*
* @author 流光
* @since 2021/2/2
*/
public class DateUtil {
//Date转LocalDate
public static LocalDate dateToLocalDate(Date date) {
if(null == date) {
return null;
}
return date.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
}
// 获取当天的开始时间
public static java.util.Date getDayBegin() {
Calendar cal = new GregorianCalendar();
cal.set(Calendar.HOUR_OF_DAY, 0);
cal.set(Calendar.MINUTE, 0);
cal.set(Calendar.SECOND, 0);
cal.set(Calendar.MILLISECOND, 0);
return cal.getTime();
}
// 获取当天的结束时间
public static java.util.Date getDayEnd() {
Calendar cal = new GregorianCalendar();
cal.set(Calendar.HOUR_OF_DAY, 23);
cal.set(Calendar.MINUTE, 59);
cal.set(Calendar.SECOND, 59);
return cal.getTime();
}
// 获取昨天的开始时间
public static Date getBeginDayOfYesterday() {
Calendar cal = new GregorianCalendar();
cal.setTime(getDayBegin());
cal.add(Calendar.DAY_OF_MONTH, -1);
return cal.getTime();
}
// 获取昨天的结束时间
public static Date getEndDayOfYesterDay() {
Calendar cal = new GregorianCalendar();
cal.setTime(getDayEnd());
cal.add(Calendar.DAY_OF_MONTH, -1);
return cal.getTime();
}
// 获取明天的开始时间
public static Date getBeginDayOfTomorrow() {
Calendar cal = new GregorianCalendar();
cal.setTime(getDayBegin());
cal.add(Calendar.DAY_OF_MONTH, 1);
return cal.getTime();
}
// 获取明天的结束时间
public static Date getEndDayOfTomorrow() {
Calendar cal = new GregorianCalendar();
cal.setTime(getDayEnd());
cal.add(Calendar.DAY_OF_MONTH, 1);
return cal.getTime();
}
// 获取本周的开始时间
@SuppressWarnings("unused")
public static Date getBeginDayOfWeek() {
Date date = new Date();
if (date == null) {
return null;
}
Calendar cal = Calendar.getInstance();
cal.setTime(date);
int dayofweek = cal.get(Calendar.DAY_OF_WEEK);
if (dayofweek == 1) {
dayofweek += 7;
}
cal.add(Calendar.DATE, 2 - dayofweek);
return getDayStartTime(cal.getTime());
}
// 获取本周的结束时间
public static Date getEndDayOfWeek() {
Calendar cal = Calendar.getInstance();
cal.setTime(getBeginDayOfWeek());
cal.add(Calendar.DAY_OF_WEEK, 6);
Date weekEndSta = cal.getTime();
return getDayEndTime(weekEndSta);
}
// 获取上周的开始时间
@SuppressWarnings("unused")
public static Date getBeginDayOfLastWeek() {
Date date = new Date();
if (date == null) {
return null;
}
Calendar cal = Calendar.getInstance();
cal.setTime(date);
int dayofweek = cal.get(Calendar.DAY_OF_WEEK);
if (dayofweek == 1) {
dayofweek += 7;
}
cal.add(Calendar.DATE, 2 - dayofweek - 7);
return getDayStartTime(cal.getTime());
}
// 获取上周的结束时间
public static Date getEndDayOfLastWeek() {
Calendar cal = Calendar.getInstance();
cal.setTime(getBeginDayOfLastWeek());
cal.add(Calendar.DAY_OF_WEEK, 6);
Date weekEndSta = cal.getTime();
return getDayEndTime(weekEndSta);
}
// 获取本月的开始时间
public static Date getBeginDayOfMonth() {
Calendar calendar = Calendar.getInstance();
calendar.set(getNowYear(), getNowMonth() - 1, 1);
return getDayStartTime(calendar.getTime());
}
// 获取本月的结束时间
public static Date getEndDayOfMonth() {
Calendar calendar = Calendar.getInstance();
calendar.set(getNowYear(), getNowMonth() - 1, 1);
int day = calendar.getActualMaximum(5);
calendar.set(getNowYear(), getNowMonth() - 1, day);
return getDayEndTime(calendar.getTime());
}
// 获取上月的开始时间
public static Date getBeginDayOfLastMonth() {
Calendar calendar = Calendar.getInstance();
calendar.set(getNowYear(), getNowMonth() - 2, 1);
return getDayStartTime(calendar.getTime());
}
// 获取上月的结束时间
public static Date getEndDayOfLastMonth() {
Calendar calendar = Calendar.getInstance();
calendar.set(getNowYear(), getNowMonth() - 2, 1);
int day = calendar.getActualMaximum(5);
calendar.set(getNowYear(), getNowMonth() - 2, day);
return getDayEndTime(calendar.getTime());
}
// 获取本年的开始时间
public static Date getBeginDayOfYear() {
Calendar cal = Calendar.getInstance();
cal.set(Calendar.YEAR, getNowYear());
cal.set(Calendar.MONTH, Calendar.JANUARY);
cal.set(Calendar.DATE, 1);
return getDayStartTime(cal.getTime());
}
// 获取本年的结束时间
public static java.util.Date getEndDayOfYear() {
Calendar cal = Calendar.getInstance();
cal.set(Calendar.YEAR, getNowYear());
cal.set(Calendar.MONTH, Calendar.DECEMBER);
cal.set(Calendar.DATE, 31);
return getDayEndTime(cal.getTime());
}
// 获取某个日期的开始时间
public static Timestamp getDayStartTime(Date d) {
Calendar calendar = Calendar.getInstance();
if (null != d)
calendar.setTime(d);
calendar.set(calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH),
calendar.get(Calendar.DAY_OF_MONTH), 0, 0, 0);
calendar.set(Calendar.MILLISECOND, 0);
return new Timestamp(calendar.getTimeInMillis());
}
// 获取某个日期的结束时间
public static Timestamp getDayEndTime(Date d) {
Calendar calendar = Calendar.getInstance();
if (null != d)
calendar.setTime(d);
calendar.set(calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH),
calendar.get(Calendar.DAY_OF_MONTH), 23, 59, 59);
calendar.set(Calendar.MILLISECOND, 999);
return new Timestamp(calendar.getTimeInMillis());
}
// 获取今年是哪一年
public static Integer getNowYear() {
Date date = new Date();
GregorianCalendar gc = (GregorianCalendar) Calendar.getInstance();
gc.setTime(date);
return Integer.valueOf(gc.get(1));
}
// 获取本月是哪一月
public static int getNowMonth() {
Date date = new Date();
GregorianCalendar gc = (GregorianCalendar) Calendar.getInstance();
gc.setTime(date);
return gc.get(2) + 1;
}
// 两个日期相减得到的天数
public static int getDiffDays(Date beginDate, Date endDate) {
if (beginDate == null || endDate == null) {
throw new IllegalArgumentException("getDiffDays param is null!");
}
long diff = (endDate.getTime() - beginDate.getTime())
/ (1000 * 60 * 60 * 24);
int days = new Long(diff).intValue();
return days;
}
// 两个日期相减得到的毫秒数
public static long dateDiff(Date beginDate, Date endDate) {
long date1ms = beginDate.getTime();
long date2ms = endDate.getTime();
return date2ms - date1ms;
}
// 获取两个日期中的最大日期
public static Date max(Date beginDate, Date endDate) {
if (beginDate == null) {
return endDate;
}
if (endDate == null) {
return beginDate;
}
if (beginDate.after(endDate)) {
return beginDate;
}
return endDate;
}
// 获取两个日期中的最小日期
public static Date min(Date beginDate, Date endDate) {
if (beginDate == null) {
return endDate;
}
if (endDate == null) {
return beginDate;
}
if (beginDate.after(endDate)) {
return endDate;
}
return beginDate;
}
// 返回某月该季度的第一个月
public static Date getFirstSeasonDate(Date date) {
final int[] SEASON = { 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4 };
Calendar cal = Calendar.getInstance();
cal.setTime(date);
int sean = SEASON[cal.get(Calendar.MONTH)];
cal.set(Calendar.MONTH, sean * 3 - 3);
return cal.getTime();
}
// 返回某个日期下几天的日期
public static Date getNextDay(Date date, int i) {
Calendar cal = new GregorianCalendar();
cal.setTime(date);
cal.set(Calendar.DATE, cal.get(Calendar.DATE) + i);
return cal.getTime();
}
// 返回某个日期前几天的日期
public static Date getFrontDay(Date date, int i) {
Calendar cal = new GregorianCalendar();
cal.setTime(date);
cal.set(Calendar.DATE, cal.get(Calendar.DATE) - i);
return cal.getTime();
}
// 获取某年某月到某年某月按天的切片日期集合(间隔天数的集合)
@SuppressWarnings({ "rawtypes", "unchecked" })
public static List getTimeList(int beginYear, int beginMonth, int endYear,
int endMonth, int k) {
List list = new ArrayList();
if (beginYear == endYear) {
for (int j = beginMonth; j <= endMonth; j++) {
list.add(getTimeList(beginYear, j, k));
}
} else {
{
for (int j = beginMonth; j < 12; j++) {
list.add(getTimeList(beginYear, j, k));
}
for (int i = beginYear + 1; i < endYear; i++) {
for (int j = 0; j < 12; j++) {
list.add(getTimeList(i, j, k));
}
}
for (int j = 0; j <= endMonth; j++) {
list.add(getTimeList(endYear, j, k));
}
}
}
return list;
}
// 获取某年某月按天切片日期集合(某个月间隔多少天的日期集合)
@SuppressWarnings({ "unchecked", "rawtypes" })
public static List getTimeList(int beginYear, int beginMonth, int k) {
List list = new ArrayList();
Calendar begincal = new GregorianCalendar(beginYear, beginMonth, 1);
int max = begincal.getActualMaximum(Calendar.DATE);
for (int i = 1; i < max; i = i + k) {
list.add(begincal.getTime());
begincal.add(Calendar.DATE, k);
}
begincal = new GregorianCalendar(beginYear, beginMonth, max);
list.add(begincal.getTime());
return list;
}
//获取指定年指定季度开始日期
public static String getBeginDayOfSeason(int year,int i) {
if(i == 0) {
//第一季度
return year+"-01-01";
}else if(i == 1) {
//第二季度
return year+"-04-01";
}else if(i == 2) {
//第三季度
return year+"-07-01";
}else {
//第四季度
return year+"-10-01";
}
}
//获取指定年指定季度结束日期
public static String getEndDayOfSeason(int year,int i) {
if(i == 0) {
//第一季度
return year+"-03-31";
}else if(i == 1) {
//第二季度
return year+"-06-30";
}else if(i == 2) {
//第三季度
return year+"-09-30";
}else {
//第四季度
return year+"-12-31";
}
}
}

View File

@ -13,7 +13,7 @@ import org.apache.commons.lang3.time.DateFormatUtils;
/**
* 时间工具类
*
*
* @author ruoyi
*/
public class DateUtils extends org.apache.commons.lang3.time.DateUtils
@ -29,13 +29,13 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
public static String YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss";
private static String[] parsePatterns = {
"yyyy-MM-dd", "yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd HH:mm", "yyyy-MM",
"yyyy-MM-dd", "yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd HH:mm", "yyyy-MM",
"yyyy/MM/dd", "yyyy/MM/dd HH:mm:ss", "yyyy/MM/dd HH:mm", "yyyy/MM",
"yyyy.MM.dd", "yyyy.MM.dd HH:mm:ss", "yyyy.MM.dd HH:mm", "yyyy.MM"};
/**
* 获取当前Date型日期
*
*
* @return Date() 当前日期
*/
public static Date getNowDate()
@ -45,7 +45,7 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
/**
* 获取当前日期, 默认格式为yyyy-MM-dd
*
*
* @return String
*/
public static String getDate()
@ -188,4 +188,6 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
ZonedDateTime zdt = localDateTime.atZone(ZoneId.systemDefault());
return Date.from(zdt.toInstant());
}
}

View File

@ -25,6 +25,12 @@
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
</dependency>
<dependency>
<groupId>nl.pdok</groupId>
<artifactId>geoserver-manager</artifactId>
<version>1.7.0-pdok2</version>
<scope>compile</scope>
</dependency>
</dependencies>
<properties>

View File

@ -0,0 +1,429 @@
package com.ruoyi.crops.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Date;
/**
* 设备传感数据表;
* @author : http://www.chiner.pro
* @date : 2023-5-8
*/
public class DeviceSense {
/** id */
@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
private Integer id ;
private String DeviceId;
/** 光照强度[Lux] */
private Double Sunlight ;
/** 空气温度[°C] */
private Double AirTemp ;
/** 空气湿度[%] */
private Double AirHumidity ;
/** 土壤温度[°C] */
private Double SoilTemp ;
/** 土壤湿度[%] */
private Double SoilHumidity ;
/** 土壤电导率[uS/cm] */
private Integer SoilConduct ;
/** 二氧化碳浓度[ppm] */
private Double CO2_ ;
/** PH值 */
private Double PH ;
/** 设备1运行行程 */
private Integer position1 ;
/** 设备1运行状态 */
private String run_status1 ;
/** 设备1控制状态 */
private String control_status1 ;
/** 设备2运行行程 */
private Integer position2 ;
/** 设备2运行状态 */
private String run_status2 ;
/** 设备2控制状态 */
private String control_status2 ;
/** 设备3运行行程 */
private Integer position3 ;
/** 设备3运行状态 */
private String run_status3 ;
/** 设备3控制状态 */
private String control_status3 ;
/** 设备4运行行程 */
private Integer position4 ;
/** 设备4运行状态 */
private String run_status4 ;
/** 设备4控制状态 */
private String control_status4 ;
/** 设备5运行行程 */
private Integer position5 ;
/** 设备5运行状态 */
private String run_status5 ;
/** 设备5控制状态 */
private String control_status5 ;
/** 设备6运行行程 */
private Integer position6 ;
/** 设备6运行状态 */
private String run_status6 ;
/** 设备6控制状态 */
private String control_status6 ;
/** 设备7运行行程 */
private Integer position7 ;
/** 设备7运行状态 */
private String run_status7 ;
/** 设备7控制状态 */
private String control_status7 ;
/** 设备8运行行程 */
private Integer position8 ;
/** 设备8运行状态 */
private String run_status8 ;
/** 设备8控制状态 */
private String control_status8 ;
/** 备用1 */
private Integer BeiYong1 ;
/** 备用2 */
private Integer BeiYong2 ;
/** 上报时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date time ;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getDeviceId() {
return DeviceId;
}
public void setDeviceId(String deviceId) {
DeviceId = deviceId;
}
public Double getSunlight() {
return Sunlight;
}
public void setSunlight(Double sunlight) {
Sunlight = sunlight;
}
public Double getAirTemp() {
return AirTemp;
}
public void setAirTemp(Double airTemp) {
AirTemp = airTemp;
}
public Double getAirHumidity() {
return AirHumidity;
}
public void setAirHumidity(Double airHumidity) {
AirHumidity = airHumidity;
}
public Double getSoilTemp() {
return SoilTemp;
}
public void setSoilTemp(Double soilTemp) {
SoilTemp = soilTemp;
}
public Double getSoilHumidity() {
return SoilHumidity;
}
public void setSoilHumidity(Double soilHumidity) {
SoilHumidity = soilHumidity;
}
public Integer getSoilConduct() {
return SoilConduct;
}
public void setSoilConduct(Integer soilConduct) {
SoilConduct = soilConduct;
}
public Double getCO2_() {
return CO2_;
}
public void setCO2_(Double CO2_) {
this.CO2_ = CO2_;
}
public Double getPH() {
return PH;
}
public void setPH(Double PH) {
this.PH = PH;
}
public Integer getPosition1() {
return position1;
}
public void setPosition1(Integer position1) {
this.position1 = position1;
}
public String getRun_status1() {
return run_status1;
}
public void setRun_status1(String run_status1) {
this.run_status1 = run_status1;
}
public String getControl_status1() {
return control_status1;
}
public void setControl_status1(String control_status1) {
this.control_status1 = control_status1;
}
public Integer getPosition2() {
return position2;
}
public void setPosition2(Integer position2) {
this.position2 = position2;
}
public String getRun_status2() {
return run_status2;
}
public void setRun_status2(String run_status2) {
this.run_status2 = run_status2;
}
public String getControl_status2() {
return control_status2;
}
public void setControl_status2(String control_status2) {
this.control_status2 = control_status2;
}
public Integer getPosition3() {
return position3;
}
public void setPosition3(Integer position3) {
this.position3 = position3;
}
public String getRun_status3() {
return run_status3;
}
public void setRun_status3(String run_status3) {
this.run_status3 = run_status3;
}
public String getControl_status3() {
return control_status3;
}
public void setControl_status3(String control_status3) {
this.control_status3 = control_status3;
}
public Integer getPosition4() {
return position4;
}
public void setPosition4(Integer position4) {
this.position4 = position4;
}
public String getRun_status4() {
return run_status4;
}
public void setRun_status4(String run_status4) {
this.run_status4 = run_status4;
}
public String getControl_status4() {
return control_status4;
}
public void setControl_status4(String control_status4) {
this.control_status4 = control_status4;
}
public Integer getPosition5() {
return position5;
}
public void setPosition5(Integer position5) {
this.position5 = position5;
}
public String getRun_status5() {
return run_status5;
}
public void setRun_status5(String run_status5) {
this.run_status5 = run_status5;
}
public String getControl_status5() {
return control_status5;
}
public void setControl_status5(String control_status5) {
this.control_status5 = control_status5;
}
public Integer getPosition6() {
return position6;
}
public void setPosition6(Integer position6) {
this.position6 = position6;
}
public String getRun_status6() {
return run_status6;
}
public void setRun_status6(String run_status6) {
this.run_status6 = run_status6;
}
public String getControl_status6() {
return control_status6;
}
public void setControl_status6(String control_status6) {
this.control_status6 = control_status6;
}
public Integer getPosition7() {
return position7;
}
public void setPosition7(Integer position7) {
this.position7 = position7;
}
public String getRun_status7() {
return run_status7;
}
public void setRun_status7(String run_status7) {
this.run_status7 = run_status7;
}
public String getControl_status7() {
return control_status7;
}
public void setControl_status7(String control_status7) {
this.control_status7 = control_status7;
}
public Integer getPosition8() {
return position8;
}
public void setPosition8(Integer position8) {
this.position8 = position8;
}
public String getRun_status8() {
return run_status8;
}
public void setRun_status8(String run_status8) {
this.run_status8 = run_status8;
}
public String getControl_status8() {
return control_status8;
}
public void setControl_status8(String control_status8) {
this.control_status8 = control_status8;
}
public Integer getBeiYong1() {
return BeiYong1;
}
public void setBeiYong1(Integer beiYong1) {
this.BeiYong1 = beiYong1;
}
public Integer getBeiYong2() {
return BeiYong2;
}
public void setBeiYong2(Integer beiYong2) {
this.BeiYong2 = beiYong2;
}
public Date getTime() {
return time;
}
public void setTime(Date time) {
this.time = time;
}
@Override
public String toString() {
return "DeviceSense{" +
"id=" + id +
", DevicedId='" + DeviceId + '\'' +
", Sunlight=" + Sunlight +
", AirTemp=" + AirTemp +
", AirHumidity=" + AirHumidity +
", SoilTemp=" + SoilTemp +
", SoilHumidity=" + SoilHumidity +
", SoilConduct=" + SoilConduct +
", CO2_=" + CO2_ +
", PH=" + PH +
", position1=" + position1 +
", run_status1='" + run_status1 + '\'' +
", control_status1='" + control_status1 + '\'' +
", position2=" + position2 +
", run_status2='" + run_status2 + '\'' +
", control_status2='" + control_status2 + '\'' +
", position3=" + position3 +
", run_status3='" + run_status3 + '\'' +
", control_status3='" + control_status3 + '\'' +
", position4=" + position4 +
", run_status4='" + run_status4 + '\'' +
", control_status4='" + control_status4 + '\'' +
", position5=" + position5 +
", run_status5='" + run_status5 + '\'' +
", control_status5='" + control_status5 + '\'' +
", position6=" + position6 +
", run_status6='" + run_status6 + '\'' +
", control_status6='" + control_status6 + '\'' +
", position7=" + position7 +
", run_status7='" + run_status7 + '\'' +
", control_status7='" + control_status7 + '\'' +
", position8=" + position8 +
", run_status8='" + run_status8 + '\'' +
", control_status8='" + control_status8 + '\'' +
", BeiYong1=" + BeiYong1 +
", BeiYong2=" + BeiYong2 +
", time=" + time +
'}';
}
}

View File

@ -0,0 +1,879 @@
package com.ruoyi.crops.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.io.Serializable;
import java.util.Date;
/**
* 水肥机传感数据;
* @author : http://www.chiner.pro
* @date : 2023-5-10
*/
public class FertigationSense {
/** id */
private Integer id ;
private String DeviceId;
/** EC实际值mS/cm */
private Double EC ;
/** PH实际值 */
private Double pH ;
/** 水泵实际压力MP */
private Double PumpPressure ;
/** 1#吸肥通道累计肥量使用量L */
private Double AccumulativeInflow1 ;
/** 1#吸肥通道肥量瞬时流量L/H */
private Double InstantInflow1 ;
/** 2#吸肥通道累计肥量使用量L */
private Double AccumulativeInflow2 ;
/** 2#吸肥通道肥量瞬时流量L/H */
private Double InstantInflow2 ;
/** 3#吸肥通道累计肥量使用量L */
private Double AccumulativeInflow3 ;
/** 3#吸肥通道肥量瞬时流量L/H */
private Double InstantInflow3 ;
/** 4#吸肥通道累计肥量使用量L */
private Double AccumulativeInflow4 ;
/** 4#吸肥通道肥量瞬时流量L/H */
private Double InstantInflow4 ;
/** 酸吸肥通道累计肥量使用量L */
private Double AccumulativeInflowAcid ;
/** 酸吸肥通道肥量瞬时流量L/H */
private Double InstantInflowAcid ;
/** 肥量累计使用量清零 */
private Integer AccumulativeInflowClear ;
/** 设备云状态 */
private Integer CloudStatus ;
/** 工作状态 */
private Integer WorkStatus ;
/** 控制方式 */
private Integer ControlMode ;
/** 自动工作方式 */
private Integer AutoMode ;
/** 水泵状态 */
private Integer InflowPump ;
/** 吸肥泵状态 */
private Integer FeedingPump ;
/** 1#通道吸肥阀状态 */
private Integer FeedingPumpCH1 ;
/** 1#通道吸肥阀输出占空比% */
private Integer FeedingPumpCH1PWM ;
/** 2#通道吸肥阀状态 */
private Integer FeedingPumpCH2 ;
/** 2#通道吸肥阀输出占空比% */
private Integer FeedingPumpCH2PWM ;
/** 3#通道吸肥阀状态 */
private Integer FeedingPumpCH3 ;
/** 3#通道吸肥阀输出占空比% */
private Integer FeedingPumpCH3PWM ;
/** 4#通道吸肥阀状态 */
private Integer FeedingPumpCH4 ;
/** 4#通道吸肥阀输出占空比% */
private Integer FeedingPumpCH4PWM ;
/** 酸通道吸肥阀状态 */
private Integer FeedingPumpAcid ;
/** 酸通道吸肥阀输出占空比% */
private Integer FeedingPumpAcidPWM ;
/** 1#搅拌状态 */
private Integer Stir1 ;
/** 2#搅拌状态 */
private Integer Stir2 ;
/** 3#搅拌状态 */
private Integer Stir3 ;
/** 4#搅拌状态 */
private Integer Stir4 ;
/** 5#搅拌状态 */
private Integer Stir5 ;
/** 1#田间电磁阀状态 */
private Integer Valve1 ;
/** 2#田间电磁阀状态 */
private Integer Valve2 ;
/** 3#田间电磁阀状态 */
private Integer Valve3 ;
/** 4#田间电磁阀状态 */
private Integer Valve4 ;
/** 5#田间电磁阀状态 */
private Integer Valve5 ;
/** 6#田间电磁阀状态 */
private Integer Valve6 ;
/** 7#田间电磁阀状态 */
private Integer Valve7 ;
/** 8#田间电磁阀状态 */
private Integer Valve8 ;
/** 9#田间电磁阀状态 */
private Integer Valve9 ;
/** 10#田间电磁阀状态 */
private Integer Valve10 ;
/** 11#田间电磁阀状态 */
private Integer Valve11 ;
/** 12#田间电磁阀状态 */
private Integer Valve12 ;
/** 13#田间电磁阀状态 */
private Integer Valve13 ;
/** 14#田间电磁阀状态 */
private Integer Valve14 ;
/** 15#田间电磁阀状态 */
private Integer Valve15 ;
/** 16#田间电磁阀状态 */
private Integer Valve16 ;
/** 17#田间电磁阀状态 */
private Integer Valve17 ;
/** 18#田间电磁阀状态 */
private Integer Valve18 ;
/** 19#田间电磁阀状态 */
private Integer Valve19 ;
/** 20#田间电磁阀状态 */
private Integer Valve20 ;
/** 21#田间电磁阀状态 */
private Integer Valve21 ;
/** 22#田间电磁阀状态 */
private Integer Valve22 ;
/** 23#田间电磁阀状态 */
private Integer Valve23 ;
/** 24#田间电磁阀状态 */
private Integer Valve24 ;
/** 25#田间电磁阀状态 */
private Integer Valve25 ;
/** 26#田间电磁阀状态 */
private Integer Valve26 ;
/** 27#田间电磁阀状态 */
private Integer Valve27 ;
/** 28#田间电磁阀状态 */
private Integer Valve28 ;
/** 29#田间电磁阀状态 */
private Integer Valve29 ;
/** 30#田间电磁阀状态 */
private Integer Valve30 ;
/** 31#田间电磁阀状态 */
private Integer Valve31 ;
/** 32#田间电磁阀状态 */
private Integer Valve32 ;
/** 33#田间电磁阀状态 */
private Integer Valve33 ;
/** 34#田间电磁阀状态 */
private Integer Valve34 ;
/** 35#田间电磁阀状态 */
private Integer Valve35 ;
/** 36#田间电磁阀状态 */
private Integer Valve36 ;
/** 37#田间电磁阀状态 */
private Integer Valve37 ;
/** 38#田间电磁阀状态 */
private Integer Valve38 ;
/** 39#田间电磁阀状态 */
private Integer Valve39 ;
/** 40#田间电磁阀状态 */
private Integer Valve40 ;
/** 上报时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date time ;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getDeviceId() {
return DeviceId;
}
public void setDeviceId(String deviceId) {
DeviceId = deviceId;
}
public Double getEC() {
return EC;
}
public void setEC(Double EC) {
this.EC = EC;
}
public Double getpH() {
return pH;
}
public void setpH(Double pH) {
this.pH = pH;
}
public Double getPumpPressure() {
return PumpPressure;
}
public void setPumpPressure(Double pumpPressure) {
PumpPressure = pumpPressure;
}
public Double getAccumulativeInflow1() {
return AccumulativeInflow1;
}
public void setAccumulativeInflow1(Double accumulativeInflow1) {
AccumulativeInflow1 = accumulativeInflow1;
}
public Double getInstantInflow1() {
return InstantInflow1;
}
public void setInstantInflow1(Double instantInflow1) {
InstantInflow1 = instantInflow1;
}
public Double getAccumulativeInflow2() {
return AccumulativeInflow2;
}
public void setAccumulativeInflow2(Double accumulativeInflow2) {
AccumulativeInflow2 = accumulativeInflow2;
}
public Double getInstantInflow2() {
return InstantInflow2;
}
public void setInstantInflow2(Double instantInflow2) {
InstantInflow2 = instantInflow2;
}
public Double getAccumulativeInflow3() {
return AccumulativeInflow3;
}
public void setAccumulativeInflow3(Double accumulativeInflow3) {
AccumulativeInflow3 = accumulativeInflow3;
}
public Double getInstantInflow3() {
return InstantInflow3;
}
public void setInstantInflow3(Double instantInflow3) {
InstantInflow3 = instantInflow3;
}
public Double getAccumulativeInflow4() {
return AccumulativeInflow4;
}
public void setAccumulativeInflow4(Double accumulativeInflow4) {
AccumulativeInflow4 = accumulativeInflow4;
}
public Double getInstantInflow4() {
return InstantInflow4;
}
public void setInstantInflow4(Double instantInflow4) {
InstantInflow4 = instantInflow4;
}
public Double getAccumulativeInflowAcid() {
return AccumulativeInflowAcid;
}
public void setAccumulativeInflowAcid(Double accumulativeInflowAcid) {
AccumulativeInflowAcid = accumulativeInflowAcid;
}
public Double getInstantInflowAcid() {
return InstantInflowAcid;
}
public void setInstantInflowAcid(Double instantInflowAcid) {
InstantInflowAcid = instantInflowAcid;
}
public Integer getAccumulativeInflowClear() {
return AccumulativeInflowClear;
}
public void setAccumulativeInflowClear(Integer accumulativeInflowClear) {
AccumulativeInflowClear = accumulativeInflowClear;
}
public Integer getCloudStatus() {
return CloudStatus;
}
public void setCloudStatus(Integer cloudStatus) {
CloudStatus = cloudStatus;
}
public Integer getWorkStatus() {
return WorkStatus;
}
public void setWorkStatus(Integer workStatus) {
WorkStatus = workStatus;
}
public Integer getControlMode() {
return ControlMode;
}
public void setControlMode(Integer controlMode) {
ControlMode = controlMode;
}
public Integer getAutoMode() {
return AutoMode;
}
public void setAutoMode(Integer autoMode) {
AutoMode = autoMode;
}
public Integer getInflowPump() {
return InflowPump;
}
public void setInflowPump(Integer inflowPump) {
InflowPump = inflowPump;
}
public Integer getFeedingPump() {
return FeedingPump;
}
public void setFeedingPump(Integer feedingPump) {
FeedingPump = feedingPump;
}
public Integer getFeedingPumpCH1() {
return FeedingPumpCH1;
}
public void setFeedingPumpCH1(Integer feedingPumpCH1) {
FeedingPumpCH1 = feedingPumpCH1;
}
public Integer getFeedingPumpCH1PWM() {
return FeedingPumpCH1PWM;
}
public void setFeedingPumpCH1PWM(Integer feedingPumpCH1PWM) {
FeedingPumpCH1PWM = feedingPumpCH1PWM;
}
public Integer getFeedingPumpCH2() {
return FeedingPumpCH2;
}
public void setFeedingPumpCH2(Integer feedingPumpCH2) {
FeedingPumpCH2 = feedingPumpCH2;
}
public Integer getFeedingPumpCH2PWM() {
return FeedingPumpCH2PWM;
}
public void setFeedingPumpCH2PWM(Integer feedingPumpCH2PWM) {
FeedingPumpCH2PWM = feedingPumpCH2PWM;
}
public Integer getFeedingPumpCH3() {
return FeedingPumpCH3;
}
public void setFeedingPumpCH3(Integer feedingPumpCH3) {
FeedingPumpCH3 = feedingPumpCH3;
}
public Integer getFeedingPumpCH3PWM() {
return FeedingPumpCH3PWM;
}
public void setFeedingPumpCH3PWM(Integer feedingPumpCH3PWM) {
FeedingPumpCH3PWM = feedingPumpCH3PWM;
}
public Integer getFeedingPumpCH4() {
return FeedingPumpCH4;
}
public void setFeedingPumpCH4(Integer feedingPumpCH4) {
FeedingPumpCH4 = feedingPumpCH4;
}
public Integer getFeedingPumpCH4PWM() {
return FeedingPumpCH4PWM;
}
public void setFeedingPumpCH4PWM(Integer feedingPumpCH4PWM) {
FeedingPumpCH4PWM = feedingPumpCH4PWM;
}
public Integer getFeedingPumpAcid() {
return FeedingPumpAcid;
}
public void setFeedingPumpAcid(Integer feedingPumpAcid) {
FeedingPumpAcid = feedingPumpAcid;
}
public Integer getFeedingPumpAcidPWM() {
return FeedingPumpAcidPWM;
}
public void setFeedingPumpAcidPWM(Integer feedingPumpAcidPWM) {
FeedingPumpAcidPWM = feedingPumpAcidPWM;
}
public Integer getStir1() {
return Stir1;
}
public void setStir1(Integer stir1) {
Stir1 = stir1;
}
public Integer getStir2() {
return Stir2;
}
public void setStir2(Integer stir2) {
Stir2 = stir2;
}
public Integer getStir3() {
return Stir3;
}
public void setStir3(Integer stir3) {
Stir3 = stir3;
}
public Integer getStir4() {
return Stir4;
}
public void setStir4(Integer stir4) {
Stir4 = stir4;
}
public Integer getStir5() {
return Stir5;
}
public void setStir5(Integer stir5) {
Stir5 = stir5;
}
public Integer getValve1() {
return Valve1;
}
public void setValve1(Integer valve1) {
Valve1 = valve1;
}
public Integer getValve2() {
return Valve2;
}
public void setValve2(Integer valve2) {
Valve2 = valve2;
}
public Integer getValve3() {
return Valve3;
}
public void setValve3(Integer valve3) {
Valve3 = valve3;
}
public Integer getValve4() {
return Valve4;
}
public void setValve4(Integer valve4) {
Valve4 = valve4;
}
public Integer getValve5() {
return Valve5;
}
public void setValve5(Integer valve5) {
Valve5 = valve5;
}
public Integer getValve6() {
return Valve6;
}
public void setValve6(Integer valve6) {
Valve6 = valve6;
}
public Integer getValve7() {
return Valve7;
}
public void setValve7(Integer valve7) {
Valve7 = valve7;
}
public Integer getValve8() {
return Valve8;
}
public void setValve8(Integer valve8) {
Valve8 = valve8;
}
public Integer getValve9() {
return Valve9;
}
public void setValve9(Integer valve9) {
Valve9 = valve9;
}
public Integer getValve10() {
return Valve10;
}
public void setValve10(Integer valve10) {
Valve10 = valve10;
}
public Integer getValve11() {
return Valve11;
}
public void setValve11(Integer valve11) {
Valve11 = valve11;
}
public Integer getValve12() {
return Valve12;
}
public void setValve12(Integer valve12) {
Valve12 = valve12;
}
public Integer getValve13() {
return Valve13;
}
public void setValve13(Integer valve13) {
Valve13 = valve13;
}
public Integer getValve14() {
return Valve14;
}
public void setValve14(Integer valve14) {
Valve14 = valve14;
}
public Integer getValve15() {
return Valve15;
}
public void setValve15(Integer valve15) {
Valve15 = valve15;
}
public Integer getValve16() {
return Valve16;
}
public void setValve16(Integer valve16) {
Valve16 = valve16;
}
public Integer getValve17() {
return Valve17;
}
public void setValve17(Integer valve17) {
Valve17 = valve17;
}
public Integer getValve18() {
return Valve18;
}
public void setValve18(Integer valve18) {
Valve18 = valve18;
}
public Integer getValve19() {
return Valve19;
}
public void setValve19(Integer valve19) {
Valve19 = valve19;
}
public Integer getValve20() {
return Valve20;
}
public void setValve20(Integer valve20) {
Valve20 = valve20;
}
public Integer getValve21() {
return Valve21;
}
public void setValve21(Integer valve21) {
Valve21 = valve21;
}
public Integer getValve22() {
return Valve22;
}
public void setValve22(Integer valve22) {
Valve22 = valve22;
}
public Integer getValve23() {
return Valve23;
}
public void setValve23(Integer valve23) {
Valve23 = valve23;
}
public Integer getValve24() {
return Valve24;
}
public void setValve24(Integer valve24) {
Valve24 = valve24;
}
public Integer getValve25() {
return Valve25;
}
public void setValve25(Integer valve25) {
Valve25 = valve25;
}
public Integer getValve26() {
return Valve26;
}
public void setValve26(Integer valve26) {
Valve26 = valve26;
}
public Integer getValve27() {
return Valve27;
}
public void setValve27(Integer valve27) {
Valve27 = valve27;
}
public Integer getValve28() {
return Valve28;
}
public void setValve28(Integer valve28) {
Valve28 = valve28;
}
public Integer getValve29() {
return Valve29;
}
public void setValve29(Integer valve29) {
Valve29 = valve29;
}
public Integer getValve30() {
return Valve30;
}
public void setValve30(Integer valve30) {
Valve30 = valve30;
}
public Integer getValve31() {
return Valve31;
}
public void setValve31(Integer valve31) {
Valve31 = valve31;
}
public Integer getValve32() {
return Valve32;
}
public void setValve32(Integer valve32) {
Valve32 = valve32;
}
public Integer getValve33() {
return Valve33;
}
public void setValve33(Integer valve33) {
Valve33 = valve33;
}
public Integer getValve34() {
return Valve34;
}
public void setValve34(Integer valve34) {
Valve34 = valve34;
}
public Integer getValve35() {
return Valve35;
}
public void setValve35(Integer valve35) {
Valve35 = valve35;
}
public Integer getValve36() {
return Valve36;
}
public void setValve36(Integer valve36) {
Valve36 = valve36;
}
public Integer getValve37() {
return Valve37;
}
public void setValve37(Integer valve37) {
Valve37 = valve37;
}
public Integer getValve38() {
return Valve38;
}
public void setValve38(Integer valve38) {
Valve38 = valve38;
}
public Integer getValve39() {
return Valve39;
}
public void setValve39(Integer valve39) {
Valve39 = valve39;
}
public Integer getValve40() {
return Valve40;
}
public void setValve40(Integer valve40) {
Valve40 = valve40;
}
public Date getTime() {
return time;
}
public void setTime(Date time) {
this.time = time;
}
@Override
public String toString() {
return "FertigationSense{" +
"id=" + id +
", DeviceId='" + DeviceId + '\'' +
", EC=" + EC +
", pH=" + pH +
", PumpPressure=" + PumpPressure +
", AccumulativeInflow1=" + AccumulativeInflow1 +
", InstantInflow1=" + InstantInflow1 +
", AccumulativeInflow2=" + AccumulativeInflow2 +
", InstantInflow2=" + InstantInflow2 +
", AccumulativeInflow3=" + AccumulativeInflow3 +
", InstantInflow3=" + InstantInflow3 +
", AccumulativeInflow4=" + AccumulativeInflow4 +
", InstantInflow4=" + InstantInflow4 +
", AccumulativeInflowAcid=" + AccumulativeInflowAcid +
", InstantInflowAcid=" + InstantInflowAcid +
", AccumulativeInflowClear=" + AccumulativeInflowClear +
", CloudStatus=" + CloudStatus +
", WorkStatus=" + WorkStatus +
", ControlMode=" + ControlMode +
", AutoMode=" + AutoMode +
", InflowPump=" + InflowPump +
", FeedingPump=" + FeedingPump +
", FeedingPumpCH1=" + FeedingPumpCH1 +
", FeedingPumpCH1PWM=" + FeedingPumpCH1PWM +
", FeedingPumpCH2=" + FeedingPumpCH2 +
", FeedingPumpCH2PWM=" + FeedingPumpCH2PWM +
", FeedingPumpCH3=" + FeedingPumpCH3 +
", FeedingPumpCH3PWM=" + FeedingPumpCH3PWM +
", FeedingPumpCH4=" + FeedingPumpCH4 +
", FeedingPumpCH4PWM=" + FeedingPumpCH4PWM +
", FeedingPumpAcid=" + FeedingPumpAcid +
", FeedingPumpAcidPWM=" + FeedingPumpAcidPWM +
", Stir1=" + Stir1 +
", Stir2=" + Stir2 +
", Stir3=" + Stir3 +
", Stir4=" + Stir4 +
", Stir5=" + Stir5 +
", Valve1=" + Valve1 +
", Valve2=" + Valve2 +
", Valve3=" + Valve3 +
", Valve4=" + Valve4 +
", Valve5=" + Valve5 +
", Valve6=" + Valve6 +
", Valve7=" + Valve7 +
", Valve8=" + Valve8 +
", Valve9=" + Valve9 +
", Valve10=" + Valve10 +
", Valve11=" + Valve11 +
", Valve12=" + Valve12 +
", Valve13=" + Valve13 +
", Valve14=" + Valve14 +
", Valve15=" + Valve15 +
", Valve16=" + Valve16 +
", Valve17=" + Valve17 +
", Valve18=" + Valve18 +
", Valve19=" + Valve19 +
", Valve20=" + Valve20 +
", Valve21=" + Valve21 +
", Valve22=" + Valve22 +
", Valve23=" + Valve23 +
", Valve24=" + Valve24 +
", Valve25=" + Valve25 +
", Valve26=" + Valve26 +
", Valve27=" + Valve27 +
", Valve28=" + Valve28 +
", Valve29=" + Valve29 +
", Valve30=" + Valve30 +
", Valve31=" + Valve31 +
", Valve32=" + Valve32 +
", Valve33=" + Valve33 +
", Valve34=" + Valve34 +
", Valve35=" + Valve35 +
", Valve36=" + Valve36 +
", Valve37=" + Valve37 +
", Valve38=" + Valve38 +
", Valve39=" + Valve39 +
", Valve40=" + Valve40 +
", time=" + time +
'}';
}
}

View File

@ -0,0 +1,128 @@
package com.ruoyi.crops.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Date;
public class Meteorological {
/** ID */
@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
private Integer id ;
/** 预警消息ID */
private String warnId ;
/** 预警消息标题 */
private String title ;
/** 预警等级, 橙色/红色/蓝色/黄色/未知 */
private String level ;
/** 预警类型 */
private String type ;
/** 预警发布时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date time ;
/** 省份, 可能为空 */
private String province ;
/** 城市, 可能为空 */
private String city ;
/** 区域, 可能为空 */
private String district ;
/** 预警详细内容 */
private String content ;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getWarnId() {
return warnId;
}
public void setWarnId(String warnId) {
this.warnId = warnId;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getLevel() {
return level;
}
public void setLevel(String level) {
this.level = level;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public Date getTime() {
return time;
}
public void setTime(Date time) {
this.time = time;
}
public String getProvince() {
return province;
}
public void setProvince(String province) {
this.province = province;
}
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}
public String getDistrict() {
return district;
}
public void setDistrict(String district) {
this.district = district;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
@Override
public String toString() {
return "Meteorological{" +
"id=" + id +
", warnId='" + warnId + '\'' +
", title='" + title + '\'' +
", level='" + level + '\'' +
", type='" + type + '\'' +
", time=" + time +
", province='" + province + '\'' +
", city='" + city + '\'' +
", district='" + district + '\'' +
", content='" + content + '\'' +
'}';
}
}

View File

@ -20,6 +20,10 @@ public class ServiceType {
private String serviceName ;
/** 样式 */
private String style ;
/** 文件名称 */
private String fileName;
/** 文件路径 */
private String filePath;
public Integer getId() {
return id;
@ -61,6 +65,22 @@ public class ServiceType {
this.style = style;
}
public String getFileName() {
return fileName;
}
public void setFileName(String fileName) {
this.fileName = fileName;
}
public String getFilePath() {
return filePath;
}
public void setFilePath(String filePath) {
this.filePath = filePath;
}
@Override
public String toString() {
return "ServiceType{" +
@ -69,6 +89,8 @@ public class ServiceType {
", time=" + time +
", serviceName='" + serviceName + '\'' +
", style='" + style + '\'' +
", fileName='" + fileName + '\'' +
", filePath='" + filePath + '\'' +
'}';
}
}

View File

@ -1,30 +0,0 @@
package com.ruoyi.crops.domain;
public class User {
private String username;
private String password;
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
@Override
public String toString() {
return "User{" +
"username='" + username + '\'' +
", password='" + password + '\'' +
'}';
}
}

View File

@ -0,0 +1,40 @@
package com.ruoyi.crops.domain;
public class WaringNumber {
private int dayNumber;
private int weekNumber;
private int monthNumber;
public int getDayNumber() {
return dayNumber;
}
public void setDayNumber(int dayNumber) {
this.dayNumber = dayNumber;
}
public int getWeekNumber() {
return weekNumber;
}
public void setWeekNumber(int weekNumber) {
this.weekNumber = weekNumber;
}
public int getMonthNumber() {
return monthNumber;
}
public void setMonthNumber(int monthNumber) {
this.monthNumber = monthNumber;
}
@Override
public String toString() {
return "WaringNumber{" +
"dayNumber=" + dayNumber +
", weekNumber=" + weekNumber +
", monthNumber=" + monthNumber +
'}';
}
}

View File

@ -1,86 +1,112 @@
package com.ruoyi.crops.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.Date;
/**
/**
* 预警信息统计;
*
* @author : http://www.chiner.pro
* @date : 2023-4-27
*/
public class WarningInformation{
/** id */
private Integer id ;
/** 大棚编号 */
private Integer greenhouseNumber ;
/** 监测指标 */
private String monitoringIndicators ;
/** 监测数值 */
private Double monitoringValues ;
/** 异常原因 */
private String abnormalCause ;
/** 预警时间 */
@JsonFormat(pattern = "yyyy/MM/dd")
private Date warningTime ;
public class WarningInformation {
/**
* id
*/
@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
private Integer id;
/**
* 大棚编号
*/
private Integer greenhouseNumber;
/**
* 监测指标
*/
private String monitoringIndicators;
/**
* 监测数值
*/
private Double monitoringValues;
/**
* 异常原因
*/
private String abnormalCause;
/**
* 预警时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date warningTime;
public Integer getId() {
return id;
}
private String aaus;
public void setId(Integer id) {
this.id = id;
}
public Integer getId() {
return id;
}
public Integer getGreenhouseNumber() {
return greenhouseNumber;
}
public void setId(Integer id) {
this.id = id;
}
public void setGreenhouseName(Integer greenhouseNumber) {
this.greenhouseNumber = greenhouseNumber;
}
public Integer getGreenhouseNumber() {
return greenhouseNumber;
}
public String getMonitoringIndicators() {
return monitoringIndicators;
}
public void setGreenhouseNumber(Integer greenhouseNumber) {
this.greenhouseNumber = greenhouseNumber;
}
public void setMonitoringIndicators(String monitoringIndicators) {
this.monitoringIndicators = monitoringIndicators;
}
public String getMonitoringIndicators() {
return monitoringIndicators;
}
public Double getMonitoringValues() {
return monitoringValues;
}
public void setMonitoringIndicators(String monitoringIndicators) {
this.monitoringIndicators = monitoringIndicators;
}
public void setMonitoringValues(Double monitoringValues) {
this.monitoringValues = monitoringValues;
}
public Double getMonitoringValues() {
return monitoringValues;
}
public String getAbnormalCause() {
return abnormalCause;
}
public void setMonitoringValues(Double monitoringValues) {
this.monitoringValues = monitoringValues;
}
public void setAbnormalCause(String abnormalCause) {
this.abnormalCause = abnormalCause;
}
public String getAbnormalCause() {
return abnormalCause;
}
public Date getWarningTime() {
return warningTime;
}
public void setAbnormalCause(String abnormalCause) {
this.abnormalCause = abnormalCause;
}
public void setWarningTime(Date warningTime) {
this.warningTime = warningTime;
}
public Date getWarningTime() {
return warningTime;
}
@Override
public String toString() {
return "WarningInformation{" +
"id=" + id +
", greenhouseName=" + greenhouseNumber +
", monitoringIndicators='" + monitoringIndicators + '\'' +
", monitoringValues=" + monitoringValues +
", abnormalCause='" + abnormalCause + '\'' +
", warningTime=" + warningTime +
'}';
}
}
public void setWarningTime(Date warningTime) {
this.warningTime = warningTime;
}
public String getAaus() {
return aaus;
}
public void setAaus(String aaus) {
this.aaus = aaus;
}
@Override
public String toString() {
return "WarningInformation{" +
"id=" + id +
", greenhouseNumber=" + greenhouseNumber +
", monitoringIndicators='" + monitoringIndicators + '\'' +
", monitoringValues=" + monitoringValues +
", abnormalCause='" + abnormalCause + '\'' +
", warningTime=" + warningTime +
", numericalUnit='" + aaus + '\'' +
'}';
}
}

View File

@ -0,0 +1,31 @@
package com.ruoyi.crops.domain.gsonBean;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import org.apache.xmlbeans.impl.xb.xsdschema.Public;
import javax.xml.crypto.Data;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
public class GsonDeviceSenseBean {
public Boolean result;
public String msg;
public String mapData;
public Integer code;
public Data data;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
public Date time;
public class Data{
public ArrayList<AttDataList> attDataList;
}
public class AttDataList{
public String showName;
public String attributeValue;
public String attributeName;
}
}

View File

@ -0,0 +1,35 @@
package com.ruoyi.crops.domain.gsonBean;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.util.ArrayList;
import java.util.Date;
public class GsonMeteorologicalBean {
public String reason;
public ArrayList<Meteorological> result;
public String error_code;
public class Meteorological{
/** 预警消息ID */
public String id ;
/** 预警消息标题 */
public String title ;
/** 预警等级, 橙色/红色/蓝色/黄色/未知 */
public String level ;
/** 预警类型 */
public String type ;
/** 预警发布时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
public Date time ;
/** 省份, 可能为空 */
public String province ;
/** 城市, 可能为空 */
public String city ;
/** 区域, 可能为空 */
public String district ;
/** 预警详细内容 */
public String content ;
}
}

View File

@ -1,4 +1,4 @@
package com.ruoyi.crops.domain;
package com.ruoyi.crops.domain.gsonBean;
import javax.xml.crypto.Data;
import java.util.ArrayList;

View File

@ -0,0 +1,103 @@
package com.ruoyi.crops.domain.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.util.Date;
public class DeviceSenseVo {
/** 设备id */
private String Did;
/** 光照强度[Lux] */
private Double AvgSunlight ;
/** 空气温度[°C] */
private Double AvgAirTemp ;
/** 空气湿度[%] */
private Double AvgAirHumidity ;
/** 土壤温度[°C] */
private Double AvgSoilTemp ;
/** 土壤湿度[%] */
private Double AvgSoilHumidity ;
/** 二氧化碳浓度[ppm] */
private Double AvgCO2 ;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date time ;
public String getDid() {
return Did;
}
public void setDid(String did) {
Did = did;
}
public Double getAvgSunlight() {
return AvgSunlight;
}
public void setAvgSunlight(Double avgSunlight) {
AvgSunlight = avgSunlight;
}
public Double getAvgAirTemp() {
return AvgAirTemp;
}
public void setAvgAirTemp(Double avgAirTemp) {
AvgAirTemp = avgAirTemp;
}
public Double getAvgAirHumidity() {
return AvgAirHumidity;
}
public void setAvgAirHumidity(Double avgAirHumidity) {
AvgAirHumidity = avgAirHumidity;
}
public Double getAvgSoilTemp() {
return AvgSoilTemp;
}
public void setAvgSoilTemp(Double avgSoilTemp) {
AvgSoilTemp = avgSoilTemp;
}
public Double getAvgSoilHumidity() {
return AvgSoilHumidity;
}
public void setAvgSoilHumidity(Double avgSoilHumidity) {
AvgSoilHumidity = avgSoilHumidity;
}
public Double getAvgCO2() {
return AvgCO2;
}
public void setAvgCO2(Double avgCO2) {
AvgCO2 = avgCO2;
}
public Date getTime() {
return time;
}
public void setTime(Date time) {
this.time = time;
}
@Override
public String toString() {
return "DeviceSenseVo{" +
"Did='" + Did + '\'' +
", AvgSunlight=" + AvgSunlight +
", AvgAirTemp=" + AvgAirTemp +
", AvgAirHumidity=" + AvgAirHumidity +
", AvgSoilTemp=" + AvgSoilTemp +
", AvgSoilHumidity=" + AvgSoilHumidity +
", AvgCO2_=" + AvgCO2 +
", time='" + time + '\'' +
'}';
}
}

View File

@ -0,0 +1,24 @@
package com.ruoyi.crops.mapper;
import com.ruoyi.crops.domain.DeviceSense;
import com.ruoyi.crops.domain.vo.DeviceSenseVo;
import org.apache.ibatis.annotations.Param;
import java.util.Date;
import java.util.List;
public interface DeviceSenseMapper {
int insert(DeviceSense deviceSense);
//数据库判断重复数据后插入
void dedupInsert(DeviceSense deviceSense);
List<DeviceSense> selectById(String deviceId);
List<DeviceSense> selectByTime(@Param("startTime") String startTime, @Param("endTime") String endTime);
List<DeviceSenseVo> selecthours(@Param("startTime") String startTime, @Param("endTime") String endTime);
List<DeviceSenseVo> selectdays(@Param("startTime") String startTime, @Param("endTime") String endTime);
}

View File

@ -0,0 +1,10 @@
package com.ruoyi.crops.mapper;
import com.ruoyi.crops.domain.FertigationSense;
public interface FertigationSenseMapper {
void dedupInsert (FertigationSense fertigationSense);
int insert(FertigationSense fertigationSense);
}

View File

@ -0,0 +1,5 @@
package com.ruoyi.crops.mapper;
public interface FoundationMapper {
int insert(String id, Integer foundationId, String foundationName);
}

View File

@ -0,0 +1,14 @@
package com.ruoyi.crops.mapper;
import com.ruoyi.crops.domain.Meteorological;
import java.util.List;
public interface MeteorologicalMapper {
List<Meteorological> selectbyTime();
int insert(Meteorological ml);
// void insert2(Meteorological ml2);
}

View File

@ -13,4 +13,6 @@ public interface ServiceTypeMapper {
List<ServiceType> selectAll();
int deleteByIds(Long[] ids);
int selectByfile(String name);
}

View File

@ -1,11 +1,14 @@
package com.ruoyi.crops.mapper;
import com.ruoyi.crops.domain.WarningInformation;
import com.ruoyi.crops.domain.gsonBean.GsonDeviceSenseBean;
import org.apache.ibatis.annotations.Param;
import java.util.Date;
import java.util.List;
public interface WarningMapper {
List<WarningInformation> selectByNumber(Integer number);
List<WarningInformation> selectByTime(@Param("startTime") Date startTime,@Param("endTime") Date endTime);
int insert(WarningInformation warningInformation);

View File

@ -0,0 +1,20 @@
package com.ruoyi.crops.service;
import com.ruoyi.crops.domain.DeviceSense;
import com.ruoyi.crops.domain.vo.DeviceSenseVo;
import java.util.Date;
import java.util.List;
public interface IDeviceSenseService {
int insert(DeviceSense deviceSense);
//sql判断重复数据后插入
void dedupInsert(DeviceSense deviceSense);
List<DeviceSense> selectById(String deviceId);
List<DeviceSense> selectByTime(String startTime, String endTime);
List<DeviceSenseVo> averageList(String type);
}

View File

@ -0,0 +1,9 @@
package com.ruoyi.crops.service;
import com.ruoyi.crops.domain.DeviceSense;
import com.ruoyi.crops.domain.FertigationSense;
public interface IFertigationSenseService {
void dedupInsert(FertigationSense fertigationSense);
int insert(FertigationSense fertigationSense);
}

View File

@ -0,0 +1,9 @@
package com.ruoyi.crops.service;
import com.ruoyi.crops.domain.ServiceType;
public interface IGeoServer {
public String GeoServer(String workSpace, String storeName, String filePath) throws Exception;
int insert(ServiceType serviceType);
}

View File

@ -0,0 +1,12 @@
package com.ruoyi.crops.service;
import com.ruoyi.crops.domain.Meteorological;
import java.util.List;
public interface IMeteorologicalService {
List<Meteorological> selectByTime();
int insert(Meteorological ml);
}

View File

@ -0,0 +1,10 @@
package com.ruoyi.crops.service;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
public interface IUploadService {
String upload(String type,MultipartFile file, String fileRoot) throws IOException;
}

View File

@ -1,8 +0,0 @@
package com.ruoyi.crops.service;
import com.ruoyi.crops.domain.User;
public interface IUserInfoService {
String login(User user);
}

View File

@ -1,11 +1,16 @@
package com.ruoyi.crops.service;
import com.ruoyi.crops.domain.DeviceSense;
import com.ruoyi.crops.domain.WarningInformation;
import com.ruoyi.crops.domain.gsonBean.GsonDeviceSenseBean;
import java.util.Date;
import java.util.List;
public interface IWarningService {
List<WarningInformation> selectByNumber(Integer number);
List<WarningInformation> selectByTime(Date startTime,Date endTime);
int insert(WarningInformation warningInformation);
int insertWarning(DeviceSense deviceSense);
}

View File

@ -0,0 +1,5 @@
package com.ruoyi.crops.service;
public interface IexeService {
public String execCommand(String type,String filePath,String boundaryDataPath);
}

View File

@ -0,0 +1,67 @@
package com.ruoyi.crops.service.impl;
import com.ruoyi.common.utils.DateUtil;
import com.ruoyi.crops.domain.DeviceSense;
import com.ruoyi.crops.domain.vo.DeviceSenseVo;
import com.ruoyi.crops.mapper.DeviceSenseMapper;
import com.ruoyi.crops.service.IDeviceSenseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;
@Service
public class DeviceSenseServiceImpl implements IDeviceSenseService {
@Autowired
private DeviceSenseMapper deviceSenseMapper;
@Override
public int insert(DeviceSense deviceSense) {
return deviceSenseMapper.insert(deviceSense);
}
/**
* 数据库判断重复数据后插入
*
* @param deviceSense
*/
@Override
public void dedupInsert(DeviceSense deviceSense) {
deviceSenseMapper.dedupInsert(deviceSense);
}
@Override
public List<DeviceSense> selectById(String deviceId) {
return deviceSenseMapper.selectById(deviceId);
}
@Override
public List<DeviceSense> selectByTime(String startTime, String endTime) {
return deviceSenseMapper.selectByTime(startTime, endTime);
}
@Override
public List<DeviceSenseVo> averageList(String type) {
if (type.equals("hours")) {
String dayBegin = new SimpleDateFormat("yyyy-MM-dd").format(DateUtil.getBeginDayOfYesterday());
String dayend = new SimpleDateFormat("yyyy-MM-dd").format(DateUtil.getBeginDayOfTomorrow());
return deviceSenseMapper.selecthours(dayBegin, dayend);
} else if (type.equals("week")) {
String weekBegin = new SimpleDateFormat("yyyy-MM-dd").format(DateUtil.getBeginDayOfWeek());
String weekEnd = new SimpleDateFormat("yyyy-MM-dd").format(DateUtil.getEndDayOfWeek());
return deviceSenseMapper.selectdays(weekBegin, weekEnd);
} else if (type.equals("month")) {
String monthBegin = new SimpleDateFormat("yyyy-MM-dd").format(DateUtil.getBeginDayOfMonth());
String monthEnd = new SimpleDateFormat("yyyy-MM-dd").format(DateUtil.getEndDayOfMonth());
return deviceSenseMapper.selectdays(monthBegin, monthEnd);
}
return null;
}
}

View File

@ -0,0 +1,32 @@
package com.ruoyi.crops.service.impl;
import com.ruoyi.common.utils.BashUtils;
import com.ruoyi.crops.service.IexeService;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
@Service
public class ExeServiceImpl implements IexeService {
@Value("${path.exepath}")
private String exePath;
@Override
public String execCommand(String type, String filePath, String boundaryDataPath) {
String path;
if (type.equals("zzjg")) {
path = exePath + "农作物种植结构.exe ";
} else if (type.equals("zwzs")) {
path = exePath + "农作物长势.exe ";
} else if (type.equals("zwhq")) {
path = exePath + "农作物旱情.exe ";
} else if (type.equals("zyzd_hq")) {
path = exePath + "旱情指导.exe ";
} else if (type.equals("zyzd_zs")) {
path = exePath + "长势指导.exe ";
} else {
path = exePath + "农作物产量.exe ";
}
return BashUtils.execCommand(path + "\"" + filePath + "\"" + " \"" + boundaryDataPath + "\"");
}
}

View File

@ -0,0 +1,25 @@
package com.ruoyi.crops.service.impl;
import com.ruoyi.crops.domain.DeviceSense;
import com.ruoyi.crops.domain.FertigationSense;
import com.ruoyi.crops.mapper.FertigationSenseMapper;
import com.ruoyi.crops.service.IFertigationSenseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service;
@Service
public class FertigationSenseImpl implements IFertigationSenseService {
@Autowired
private FertigationSenseMapper fertigationSenseMapper;
@Override
public void dedupInsert(FertigationSense fertigationSense) {
fertigationSenseMapper.dedupInsert(fertigationSense);
}
@Override
public int insert(FertigationSense fertigationSense) {
return fertigationSenseMapper.insert(fertigationSense);
}
}

View File

@ -2,7 +2,9 @@ package com.ruoyi.crops.service.impl;
import cn.hutool.http.HttpUtil;
import com.google.gson.Gson;
import com.ruoyi.crops.domain.GsonParseFoundationBean;
import com.ruoyi.crops.domain.UserInfo;
import com.ruoyi.crops.domain.gsonBean.GsonParseFoundationBean;
import com.ruoyi.crops.mapper.FoundationMapper;
import com.ruoyi.crops.service.IFoundationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
@ -19,26 +21,32 @@ public class FoundationServiceImpl implements IFoundationService {
private RedisTemplate redisTemplate;
@Autowired
private Gson gson;
@Autowired
private FoundationMapper foundationMapper;
@Value("${url.foundation}")
private String url;
@Override
public String getFoundation(String id) {
Map<String, Object> map = new HashMap<>();//存放参数
map.put("id", id);
HashMap<String, String> headers = new HashMap<>();//存放请求头可以存放多个请求头
String token = (String) redisTemplate.opsForValue().get(id);
headers.put("token", token);
//从redis中获取token
UserInfo cropsUserInfo = (UserInfo) redisTemplate.opsForValue().get("cropsUserInfo");
headers.put("token", cropsUserInfo.getToken());
String result = HttpUtil.createPost(url).addHeaders(headers).form(map).execute().body();
GsonParseFoundationBean model = gson.fromJson(result, GsonParseFoundationBean.class);
ArrayList<GsonParseFoundationBean.Foundation> foundations = model.data;
for (GsonParseFoundationBean.Foundation Foundation : foundations) {
String userId = id;
Integer foundationId = Foundation.foundationId;
String foundationName = Foundation.foundationName;
// insert(foundationId,foundationName);
// foundationMapper.insert(id,foundationId,foundationName);
}
return token;
return null;
}
}

View File

@ -0,0 +1,74 @@
package com.ruoyi.crops.service.impl;
import com.ruoyi.crops.domain.ServiceType;
import com.ruoyi.crops.mapper.ServiceTypeMapper;
import com.ruoyi.crops.service.IGeoServer;
import it.geosolutions.geoserver.rest.GeoServerRESTManager;
import it.geosolutions.geoserver.rest.GeoServerRESTPublisher;
import it.geosolutions.geoserver.rest.decoder.RESTDataStore;
import it.geosolutions.geoserver.rest.encoder.GSLayerEncoder;
import it.geosolutions.geoserver.rest.encoder.GSResourceEncoder;
import it.geosolutions.geoserver.rest.encoder.datastore.GSGeoTIFFDatastoreEncoder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.io.File;
import java.net.URL;
import java.util.List;
@Service
public class GeoServerImpl implements IGeoServer {
//GeoServer的连接配置
@Value("${geoserver.url}")
private String url;
@Value("${geoserver.username}")
private String username;
@Value("${geoserver.password}")
private String password;
@Autowired
private ServiceTypeMapper serviceTypeMapper;
@Override
public String GeoServer(String workSpace, String storeName, String filePath) throws Exception {
//待创建和发布图层的工作区名称workspace
//待创建和发布图层的数据存储名称store
//判断工作区workspace是否存在不存在则创建
URL u = new URL(url);
GeoServerRESTManager manager = new GeoServerRESTManager(u, username, password);
GeoServerRESTPublisher publisher = manager.getPublisher();
List<String> workspaces = manager.getReader().getWorkspaceNames();
if (!workspaces.contains(workSpace)) {
boolean createws = publisher.createWorkspace(workSpace);
System.out.println("create ws : " + createws);
} else {
System.out.println("workspace已经存在了,ws :" + workSpace);
}
//判断数据存储datastore是否已经存在不存在则创建
RESTDataStore restStore = manager.getReader().getDatastore(workSpace, storeName);
if (restStore == null) {
GSGeoTIFFDatastoreEncoder gsGeoTIFFDatastoreEncoder = new GSGeoTIFFDatastoreEncoder(storeName);
gsGeoTIFFDatastoreEncoder.setWorkspaceName(workSpace);
gsGeoTIFFDatastoreEncoder.setUrl(new URL("file:" + filePath));
boolean createStore = manager.getStoreManager().create(workSpace, gsGeoTIFFDatastoreEncoder);
System.out.println("create store (TIFF文件创建状态) : " + createStore);
boolean publish = manager.getPublisher().publishGeoTIFF(workSpace, storeName, new File(filePath));
System.out.println("publish (TIFF文件发布状态) : " + publish);
return "create store (TIFF文件创建状态) : " + createStore + " publish (TIFF文件发布状态) : " + publish;
} else {
System.out.println("数据存储已经存在了,store:" + storeName);
}
return null;
}
@Override
public int insert(ServiceType serviceType) {
return serviceTypeMapper.insert(serviceType);
}
}

View File

@ -0,0 +1,26 @@
package com.ruoyi.crops.service.impl;
import com.ruoyi.crops.domain.Meteorological;
import com.ruoyi.crops.mapper.MeteorologicalMapper;
import com.ruoyi.crops.service.IMeteorologicalService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class MeteorologicalServiceImpl implements IMeteorologicalService {
@Autowired
private MeteorologicalMapper meteorologicalMapper;
@Override
public List<Meteorological> selectByTime() {
return meteorologicalMapper.selectbyTime();
}
@Override
public int insert(Meteorological ml) {
return meteorologicalMapper.insert(ml);
}
}

View File

@ -0,0 +1,65 @@
package com.ruoyi.crops.service.impl;
import com.ruoyi.crops.mapper.ServiceTypeMapper;
import com.ruoyi.crops.service.IUploadService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import java.io.File;
import java.io.IOException;
import java.util.regex.Matcher;
@Service
public class UploadServiceImpl implements IUploadService {
@Autowired
private ServiceTypeMapper serviceTypeMapper;
@Override
public String upload(String type,MultipartFile file, String fileRoot) throws IOException {
prepareFilePath(fileRoot);
// 获取上传文件的原文件名
String fileName = file.getOriginalFilename();
if (serviceTypeMapper.selectByfile(fileName)>0){
return "文件已存在";
}else {
// 规则化之后的文件上传根路径
String normalizeFileRoot = getNormalizeFileRoot(fileRoot);
// 根据路径和文件名创建目标文件
File targetFile = new File(normalizeFileRoot, fileName);
// 如果目标文件存在删除
if (targetFile.exists())
targetFile.delete();
// 将目标文件进行转移
file.transferTo(targetFile);
return String.format("%s\\%s", normalizeFileRoot, fileName);
}
}
/**
fileRoot上传文件保存的根路径
此方法是准备文件上传的路径如果路径不存在即创建
*/
private void prepareFilePath(String fileRoot) {
File file = new File(normalizePath(fileRoot));
if (!file.exists())
file.mkdirs();
}
/**
该方法主要对文件路径进行规则化D:\\\360Browser\///360Chrome\\//,
像这种路径就不正确此方法可以将路径规则化为D:\360Browser\360Chrome
*/
private String getNormalizeFileRoot(String fileRoot) {
return normalizePath(fileRoot);
}
public static String normalizePath(String path) {
String result = path.replaceAll("/+", Matcher.quoteReplacement(File.separator));
return result.replaceAll("\\\\+", Matcher.quoteReplacement(File.separator));
}
}

View File

@ -1,35 +0,0 @@
package com.ruoyi.crops.service.impl;
import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson2.JSONObject;
import com.ruoyi.crops.domain.User;
import com.ruoyi.crops.domain.UserInfo;
import com.ruoyi.crops.service.IUserInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;
import java.time.Duration;
import java.util.HashMap;
@Service
public class UserInfoServiceImpl implements IUserInfoService {
@Autowired
private RedisTemplate redisTemplate;
@Value("${url.userInfo}")
private String url;
@Override
public String login(User user) {
HashMap<String, Object> paramMap = new HashMap<>();
paramMap.put("username", user.getUsername());
paramMap.put("password", user.getPassword());
String result = HttpUtil.post(url, paramMap);
UserInfo userInfo = JSONObject.parseObject(result, UserInfo.class);
redisTemplate.opsForValue().set(userInfo.getId(), userInfo.getToken(), Duration.ofMillis(userInfo.getExpire()) );
return userInfo.toString();
}
}

View File

@ -1,23 +1,142 @@
package com.ruoyi.crops.service.impl;
import com.ruoyi.crops.domain.DeviceSense;
import com.ruoyi.crops.domain.WarningInformation;
import com.ruoyi.crops.mapper.WarningMapper;
import com.ruoyi.crops.service.IWarningService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
import static cn.hutool.core.date.DateTime.now;
@Service
public class WarningServiceImpl implements IWarningService {
@Autowired
private WarningMapper warningMapper;
@Override
public List<WarningInformation> selectByNumber(Integer number) {
return warningMapper.selectByNumber(number);
public List<WarningInformation> selectByTime(Date startTime,Date endTime) {
return warningMapper.selectByTime(startTime,endTime);
}
@Override
public int insert(WarningInformation warningInformation) {
return warningMapper.insert(warningInformation);
}
@Override
public int insertWarning(DeviceSense deviceSense) {
WarningInformation warningInformation = new WarningInformation();
Double sunlight = deviceSense.getSunlight();
if (sunlight > 2) {
warningInformation.setMonitoringIndicators("光照强度");
warningInformation.setMonitoringValues(sunlight);
warningInformation.setAbnormalCause("偏高");
warningInformation.setWarningTime(deviceSense.getTime());
warningInformation.setAaus("Lux");
warningMapper.insert(warningInformation);
} if (sunlight < 1) {
warningInformation.setMonitoringIndicators("光照强度");
warningInformation.setMonitoringValues(sunlight);
warningInformation.setAbnormalCause("偏低");
warningInformation.setWarningTime(deviceSense.getTime());
warningInformation.setAaus("Lux");
warningMapper.insert(warningInformation);
}
//空气温度[°C]
Double airTemp = deviceSense.getAirTemp();
if (airTemp>22.6){
warningInformation.setMonitoringIndicators("空气温度");
warningInformation.setMonitoringValues(airTemp);
warningInformation.setAbnormalCause("偏高");
warningInformation.setWarningTime(deviceSense.getTime());
warningInformation.setAaus("°C");
warningMapper.insert(warningInformation);
}
if (airTemp<22.2){
warningInformation.setMonitoringIndicators("空气温度");
warningInformation.setMonitoringValues(airTemp);
warningInformation.setAbnormalCause("偏低");
warningInformation.setWarningTime(deviceSense.getTime());
warningInformation.setAaus("°C");
warningMapper.insert(warningInformation);
}
//空气湿度[%]
Double airHumidity = deviceSense.getAirHumidity();
if (airHumidity>48){
warningInformation.setMonitoringIndicators("空气湿度");
warningInformation.setMonitoringValues(airHumidity);
warningInformation.setAbnormalCause("偏高");
warningInformation.setWarningTime(deviceSense.getTime());
warningInformation.setAaus("%");
warningMapper.insert(warningInformation);
}
if (airHumidity<45){
warningInformation.setMonitoringIndicators("空气湿度");
warningInformation.setMonitoringValues(airHumidity);
warningInformation.setAbnormalCause("偏低");
warningInformation.setWarningTime(deviceSense.getTime());
warningInformation.setAaus("%");
warningMapper.insert(warningInformation);
}
//土壤温度[°C]
Double soilTemp = deviceSense.getSoilTemp();
if (soilTemp>22.8){
warningInformation.setMonitoringIndicators("土壤温度");
warningInformation.setMonitoringValues(soilTemp);
warningInformation.setAbnormalCause("偏高");
warningInformation.setWarningTime(deviceSense.getTime());
warningInformation.setAaus("°C");
warningMapper.insert(warningInformation);
}
if (soilTemp<22.7){
warningInformation.setMonitoringIndicators("土壤温度");
warningInformation.setMonitoringValues(soilTemp);
warningInformation.setAbnormalCause("偏低");
warningInformation.setWarningTime(deviceSense.getTime());
warningInformation.setAaus("°C");
warningMapper.insert(warningInformation);
}
//土壤湿度[%]
Double soilHumidity = deviceSense.getSoilHumidity();
if (soilHumidity>3){
warningInformation.setMonitoringIndicators("土壤湿度");
warningInformation.setMonitoringValues(soilHumidity);
warningInformation.setAbnormalCause("偏高");
warningInformation.setWarningTime(deviceSense.getTime());
warningInformation.setAaus("%");
warningMapper.insert(warningInformation);
}
if (soilHumidity<1){
warningInformation.setMonitoringIndicators("土壤湿度");
warningInformation.setMonitoringValues(soilHumidity);
warningInformation.setAbnormalCause("偏低");
warningInformation.setWarningTime(deviceSense.getTime());
warningInformation.setAaus("%");
warningMapper.insert(warningInformation);
}
//二氧化碳浓度[ppm]
Double co2_ = deviceSense.getCO2_();
if (co2_>800){
warningInformation.setMonitoringIndicators("二氧化碳浓度");
warningInformation.setMonitoringValues(co2_);
warningInformation.setAbnormalCause("偏高");
warningInformation.setWarningTime(deviceSense.getTime());
warningInformation.setAaus("ppm");
warningMapper.insert(warningInformation);
}
if (co2_<530){
warningInformation.setMonitoringIndicators("二氧化碳浓度");
warningInformation.setMonitoringValues(co2_);
warningInformation.setAbnormalCause("偏低");
warningInformation.setWarningTime(deviceSense.getTime());
warningInformation.setAaus("ppm");
warningMapper.insert(warningInformation);
}
return 0;
}
}

View File

@ -0,0 +1,244 @@
<?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.ruoyi.crops.mapper.DeviceSenseMapper">
<resultMap type="com.ruoyi.crops.domain.DeviceSense" id="DeviceSenseMap">
<result property="id" column="id" jdbcType="INTEGER"/>
<result property="deviceId" column="deviceId" jdbcType="VARCHAR"/>
<result property="Sunlight" column="sunlight" jdbcType="DOUBLE"/>
<result property="AirTemp" column="air_temp" jdbcType="DOUBLE"/>
<result property="AirHumidity" column="air_humidity" jdbcType="INTEGER"/>
<result property="SoilTemp" column="soil_temp" jdbcType="DOUBLE"/>
<result property="SoilHumidity" column="soil_humidity" jdbcType="INTEGER"/>
<result property="SoilConduct" column="soil_conduct" jdbcType="INTEGER"/>
<result property="CO2_" column="co2" jdbcType="INTEGER"/>
<result property="PH" column="ph" jdbcType="DOUBLE"/>
<result property="position1" column="position1" jdbcType="INTEGER"/>
<result property="run_status1" column="run_status1" jdbcType="VARCHAR"/>
<result property="control_status1" column="control_status1" jdbcType="VARCHAR"/>
<result property="position2" column="position2" jdbcType="INTEGER"/>
<result property="run_status2" column="run_status2" jdbcType="VARCHAR"/>
<result property="control_status2" column="control_status2" jdbcType="VARCHAR"/>
<result property="position3" column="position3" jdbcType="INTEGER"/>
<result property="run_status3" column="run_status3" jdbcType="VARCHAR"/>
<result property="control_status3" column="control_status3" jdbcType="VARCHAR"/>
<result property="position4" column="position4" jdbcType="INTEGER"/>
<result property="run_status4" column="run_status4" jdbcType="VARCHAR"/>
<result property="control_status4" column="control_status4" jdbcType="VARCHAR"/>
<result property="position5" column="position5" jdbcType="INTEGER"/>
<result property="run_status5" column="run_status5" jdbcType="VARCHAR"/>
<result property="control_status5" column="control_status5" jdbcType="VARCHAR"/>
<result property="position6" column="position6" jdbcType="INTEGER"/>
<result property="run_status6" column="run_status6" jdbcType="VARCHAR"/>
<result property="control_status6" column="control_status6" jdbcType="VARCHAR"/>
<result property="position7" column="position7" jdbcType="INTEGER"/>
<result property="run_status7" column="run_status7" jdbcType="VARCHAR"/>
<result property="control_status7" column="control_status7" jdbcType="VARCHAR"/>
<result property="position8" column="position8" jdbcType="INTEGER"/>
<result property="run_status8" column="run_status8" jdbcType="VARCHAR"/>
<result property="control_status8" column="control_status8" jdbcType="VARCHAR"/>
<result property="BeiYong1" column="bei_yong1" jdbcType="INTEGER"/>
<result property="BeiYong2" column="bei_yong2" jdbcType="INTEGER"/>
<result property="time" column="time" jdbcType="VARCHAR"/>
</resultMap>
<insert id="insert">
insert into ruoyi.device_sense (deviceId, sunlight, air_temp, air_humidity, soil_temp, soil_humidity,
soil_conduct, co2, ph, position1, run_status1, control_status1, position2,
run_status2, control_status2, position3, run_status3, control_status3,
position4, run_status4, control_status4, position5, run_status5,
control_status5, position6, run_status6, control_status6, position7,
run_status7, control_status7, position8, run_status8, control_status8,
bei_yong1, bei_yong2, time)
value (#{deviceId}, #{Sunlight}, #{AirTemp}, #{AirHumidity}, #{SoilTemp}, #{SoilHumidity}, #{SoilConduct},
#{CO2_}, #{PH}, #{position1}, #{run_status1}, #{control_status1}, #{position2}, #{run_status2},
#{control_status2}, #{position3}, #{run_status3}, #{control_status3}, #{position4}, #{run_status4},
#{control_status4}, #{position5}, #{run_status5}, #{control_status5}, #{position6}, #{run_status6},
#{control_status6}, #{position7}, #{run_status7}, #{control_status7}, #{position8}, #{run_status8},
#{control_status8}, #{BeiYong1}, #{BeiYong2}, #{time})
</insert>
<!--sql语句直接去重-->
<insert id="dedupInsert">
insert into ruoyi.device_sense(deviceId, sunlight, air_temp, air_humidity, soil_temp, soil_humidity,
soil_conduct, co2, ph, position1, run_status1, control_status1, position2,
run_status2, control_status2, position3, run_status3, control_status3,
position4, run_status4, control_status4, position5, run_status5,
control_status5, position6, run_status6, control_status6, position7,
run_status7, control_status7, position8, run_status8, control_status8,
bei_yong1, bei_yong2, time)
select #{deviceId},
#{Sunlight},
#{AirTemp},
#{AirHumidity},
#{SoilTemp},
#{SoilHumidity},
#{SoilConduct},
#{CO2_},
#{PH},
#{position1},
#{run_status1},
#{control_status1},
#{position2},
#{run_status2},
#{control_status2},
#{position3},
#{run_status3},
#{control_status3},
#{position4},
#{run_status4},
#{control_status4},
#{position5},
#{run_status5},
#{control_status5},
#{position6},
#{run_status6},
#{control_status6},
#{position7},
#{run_status7},
#{control_status7},
#{position8},
#{run_status8},
#{control_status8},
#{BeiYong1},
#{BeiYong2},
#{time}
where not exists(select deviceId, time from ruoyi.device_sense where deviceId = #{deviceId} and time = #{time})
</insert>
<select id="selectById" resultMap="DeviceSenseMap">
select deviceId,
sunlight,
air_temp,
air_humidity,
soil_temp,
soil_humidity,
soil_conduct,
co2,
ph,
position1,
run_status1,
control_status1,
position2,
run_status2,
control_status2,
position3,
run_status3,
control_status3,
position4,
run_status4,
control_status4,
position5,
run_status5,
control_status5,
position6,
run_status6,
control_status6,
position7,
run_status7,
control_status7,
position8,
run_status8,
control_status8,
bei_yong1,
bei_yong2,
time
from ruoyi.device_sense
where deviceId = #{deviceId}
</select>
<select id="selectByTime" resultMap="DeviceSenseMap">
select deviceId,
sunlight,
air_temp,
air_humidity,
soil_temp,
soil_humidity,
soil_conduct,
co2,
ph,
position1,
run_status1,
control_status1,
position2,
run_status2,
control_status2,
position3,
run_status3,
control_status3,
position4,
run_status4,
control_status4,
position5,
run_status5,
control_status5,
position6,
run_status6,
control_status6,
position7,
run_status7,
control_status7,
position8,
run_status8,
control_status8,
bei_yong1,
bei_yong2,
time
from ruoyi.device_sense
where time between #{startTime} and #{endTime}
</select>
<select id="selecthours" resultType="com.ruoyi.crops.domain.vo.DeviceSenseVo">
select *
from (select did
, avg(sunlight) as AvgSunlight
, avg(air_temp) as AvgAirTemp
, avg(air_humidity) as AvgAirHumidity
, avg(soil_temp) as AvgSoilTemp
, avg(soil_humidity) as AvgSoilHumidity
, avg(co2) as AvgCO2
, DATE_FORMAT(time, '%Y-%m-%d %H:%m:%s') time
from (select ANY_VALUE(deviceId) as did,
sunlight,
air_temp,
air_humidity,
soil_temp,
soil_humidity,
co2,
DATE_FORMAT(time, '%Y-%m-%d %H') as time
from ruoyi.device_sense
GROUP BY DATE_FORMAT(time, '%Y-%m-%d %H'),
did, sunlight, air_temp, air_humidity, soil_temp, soil_humidity, co2
) as t
group by time) as tt
where time between #{startTime} and #{endTime}
</select>
<select id="selectdays" resultType="com.ruoyi.crops.domain.vo.DeviceSenseVo">
select *
from (select did
, avg(sunlight) as AvgSunlight
, avg(air_temp) as AvgAirTemp
, avg(air_humidity) as AvgAirHumidity
, avg(soil_temp) as AvgSoilTemp
, avg(soil_humidity) as AvgSoilHumidity
, avg(co2) as AvgCO2
, time
from (
select ANY_VALUE(deviceId) as did,
sunlight,
air_temp,
air_humidity,
soil_temp,
soil_humidity,
co2,
DATE_FORMAT(time, '%Y-%m-%d') as time
from ruoyi.device_sense
GROUP BY DATE_FORMAT(time, '%Y-%m-%d'),
did, sunlight, air_temp, air_humidity, soil_temp, soil_humidity, co2
) as t
group by time) as tt
where time between #{startTime} and #{endTime}
</select>
</mapper>

View File

@ -0,0 +1,129 @@
<?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.ruoyi.crops.mapper.FertigationSenseMapper">
<resultMap type="com.ruoyi.crops.domain.FertigationSense" id="FertigationSenseMap">
<result property="id" column="id" jdbcType="INTEGER"/>
<result property="DeviceId" column="DeviceId" jdbcType="VARCHAR"/>
<result property="EC" column="EC" jdbcType="DOUBLE"/>
<result property="pH" column="pH" jdbcType="DOUBLE"/>
<result property="PumpPressure" column="PumpPressure" jdbcType="DOUBLE"/>
<result property="AccumulativeInflow1" column="AccumulativeInflow1" jdbcType="DOUBLE"/>
<result property="InstantInflow1" column="InstantInflow1" jdbcType="DOUBLE"/>
<result property="AccumulativeInflow2" column="AccumulativeInflow2" jdbcType="DOUBLE"/>
<result property="InstantInflow2" column="InstantInflow2" jdbcType="DOUBLE"/>
<result property="AccumulativeInflow3" column="AccumulativeInflow3" jdbcType="DOUBLE"/>
<result property="InstantInflow3" column="InstantInflow3" jdbcType="DOUBLE"/>
<result property="AccumulativeInflow4" column="AccumulativeInflow4" jdbcType="DOUBLE"/>
<result property="InstantInflow4" column="InstantInflow4" jdbcType="DOUBLE"/>
<result property="AccumulativeInflowAcid" column="AccumulativeInflowAcid" jdbcType="DOUBLE"/>
<result property="InstantInflowAcid" column="InstantInflowAcid" jdbcType="DOUBLE"/>
<result property="AccumulativeInflowClear" column="AccumulativeInflowClear" jdbcType="INTEGER"/>
<result property="CloudStatus" column="CloudStatus" jdbcType="INTEGER"/>
<result property="WorkStatus" column="WorkStatus" jdbcType="INTEGER"/>
<result property="ControlMode" column="ControlMode" jdbcType="INTEGER"/>
<result property="AutoMode" column="AutoMode" jdbcType="INTEGER"/>
<result property="InflowPump" column="InflowPump" jdbcType="INTEGER"/>
<result property="FeedingPump" column="FeedingPump" jdbcType="INTEGER"/>
<result property="FeedingPumpCH1" column="FeedingPumpCH1" jdbcType="INTEGER"/>
<result property="FeedingPumpCH1PWM" column="FeedingPumpCH1PWM" jdbcType="INTEGER"/>
<result property="FeedingPumpCH2" column="FeedingPumpCH2" jdbcType="INTEGER"/>
<result property="FeedingPumpCH2PWM" column="FeedingPumpCH2PWM" jdbcType="INTEGER"/>
<result property="FeedingPumpCH3" column="FeedingPumpCH3" jdbcType="INTEGER"/>
<result property="FeedingPumpCH3PWM" column="FeedingPumpCH3PWM" jdbcType="INTEGER"/>
<result property="FeedingPumpCH4" column="FeedingPumpCH4" jdbcType="INTEGER"/>
<result property="FeedingPumpCH4PWM" column="FeedingPumpCH4PWM" jdbcType="INTEGER"/>
<result property="FeedingPumpAcid" column="FeedingPumpAcid" jdbcType="INTEGER"/>
<result property="FeedingPumpAcidPWM" column="FeedingPumpAcidPWM" jdbcType="INTEGER"/>
<result property="Stir1" column="Stir1" jdbcType="INTEGER"/>
<result property="Stir2" column="Stir2" jdbcType="INTEGER"/>
<result property="Stir3" column="Stir3" jdbcType="INTEGER"/>
<result property="Stir4" column="Stir4" jdbcType="INTEGER"/>
<result property="Stir5" column="Stir5" jdbcType="INTEGER"/>
<result property="Valve1" column="Valve1" jdbcType="INTEGER"/>
<result property="Valve2" column="Valve2" jdbcType="INTEGER"/>
<result property="Valve3" column="Valve3" jdbcType="INTEGER"/>
<result property="Valve4" column="Valve4" jdbcType="INTEGER"/>
<result property="Valve5" column="Valve5" jdbcType="INTEGER"/>
<result property="Valve6" column="Valve6" jdbcType="INTEGER"/>
<result property="Valve7" column="Valve7" jdbcType="INTEGER"/>
<result property="Valve8" column="Valve8" jdbcType="INTEGER"/>
<result property="Valve9" column="Valve9" jdbcType="INTEGER"/>
<result property="Valve10" column="Valve10" jdbcType="INTEGER"/>
<result property="Valve11" column="Valve11" jdbcType="INTEGER"/>
<result property="Valve12" column="Valve12" jdbcType="INTEGER"/>
<result property="Valve13" column="Valve13" jdbcType="INTEGER"/>
<result property="Valve14" column="Valve14" jdbcType="INTEGER"/>
<result property="Valve15" column="Valve15" jdbcType="INTEGER"/>
<result property="Valve16" column="Valve16" jdbcType="INTEGER"/>
<result property="Valve17" column="Valve17" jdbcType="INTEGER"/>
<result property="Valve18" column="Valve18" jdbcType="INTEGER"/>
<result property="Valve19" column="Valve19" jdbcType="INTEGER"/>
<result property="Valve20" column="Valve20" jdbcType="INTEGER"/>
<result property="Valve21" column="Valve21" jdbcType="INTEGER"/>
<result property="Valve22" column="Valve22" jdbcType="INTEGER"/>
<result property="Valve23" column="Valve23" jdbcType="INTEGER"/>
<result property="Valve24" column="Valve24" jdbcType="INTEGER"/>
<result property="Valve25" column="Valve25" jdbcType="INTEGER"/>
<result property="Valve26" column="Valve26" jdbcType="INTEGER"/>
<result property="Valve27" column="Valve27" jdbcType="INTEGER"/>
<result property="Valve28" column="Valve28" jdbcType="INTEGER"/>
<result property="Valve29" column="Valve29" jdbcType="INTEGER"/>
<result property="Valve30" column="Valve30" jdbcType="INTEGER"/>
<result property="Valve31" column="Valve31" jdbcType="INTEGER"/>
<result property="Valve32" column="Valve32" jdbcType="INTEGER"/>
<result property="Valve33" column="Valve33" jdbcType="INTEGER"/>
<result property="Valve34" column="Valve34" jdbcType="INTEGER"/>
<result property="Valve35" column="Valve35" jdbcType="INTEGER"/>
<result property="Valve36" column="Valve36" jdbcType="INTEGER"/>
<result property="Valve37" column="Valve37" jdbcType="INTEGER"/>
<result property="Valve38" column="Valve38" jdbcType="INTEGER"/>
<result property="Valve39" column="Valve39" jdbcType="INTEGER"/>
<result property="Valve40" column="Valve40" jdbcType="INTEGER"/>
<result property="time" column="time" jdbcType="VARCHAR"/>
</resultMap>
<insert id="dedupInsert">
insert into ruoyi.fertigation_sense(DeviceId,EC, pH, PumpPressure, AccumulativeInflow1, InstantInflow1,
AccumulativeInflow2, InstantInflow2, AccumulativeInflow3, InstantInflow3,
AccumulativeInflow4, InstantInflow4, AccumulativeInflowAcid,
InstantInflowAcid, AccumulativeInflowClear, CloudStatus, WorkStatus,
ControlMode, AutoMode, InflowPump, FeedingPump, FeedingPumpCH1,
FeedingPumpCH1PWM, FeedingPumpCH2, FeedingPumpCH2PWM, FeedingPumpCH3,
FeedingPumpCH3PWM, FeedingPumpCH4, FeedingPumpCH4PWM, FeedingPumpAcid,
FeedingPumpAcidPWM, Stir1, Stir2, Stir3, Stir4, Stir5, Valve1, Valve2,
Valve3, Valve4, Valve5, Valve6, Valve7, Valve8, Valve9, Valve10, Valve11,
Valve12, Valve13, Valve14, Valve15, Valve16, Valve17, Valve18, Valve19,
Valve20, Valve21, Valve22, Valve23, Valve24, Valve25, Valve26, Valve27,
Valve28, Valve29, Valve30, Valve31, Valve32, Valve33, Valve34, Valve35,
Valve36, Valve37, Valve38, Valve39, Valve40, time)
select #{DeviceId},#{EC}, #{pH}, #{PumpPressure}, #{AccumulativeInflow1},#{InstantInflow1},
#{AccumulativeInflow2}, #{InstantInflow2}, #{AccumulativeInflow3}, #{InstantInflow3},
#{AccumulativeInflow4}, #{InstantInflow4}, #{AccumulativeInflowAcid}, #{InstantInflowAcid},
#{AccumulativeInflowClear}, #{CloudStatus}, #{WorkStatus}, #{ControlMode}, #{AutoMode},
#{InflowPump}, #{FeedingPump}, #{FeedingPumpCH1}, #{FeedingPumpCH1PWM}, #{FeedingPumpCH2},
#{FeedingPumpCH2PWM}, #{FeedingPumpCH3}, #{FeedingPumpCH3PWM}, #{FeedingPumpCH4}, #{FeedingPumpCH4PWM},
#{FeedingPumpAcid}, #{FeedingPumpAcidPWM}, #{Stir1}, #{Stir2}, #{Stir3}, #{Stir4}, #{Stir5},
#{Valve1}, #{Valve2}, #{Valve3}, #{Valve4}, #{Valve5}, #{Valve6}, #{Valve7}, #{Valve8}, #{Valve9},
#{Valve10}, #{Valve11}, #{Valve12}, #{Valve13}, #{Valve14}, #{Valve15}, #{Valve16}, #{Valve17},
#{Valve18}, #{Valve19}, #{Valve20}, #{Valve21}, #{Valve22}, #{Valve23}, #{Valve24}, #{Valve25},
#{Valve26}, #{Valve27}, #{Valve28}, #{Valve29}, #{Valve30}, #{Valve31}, #{Valve32}, #{Valve33},
#{Valve34}, #{Valve35}, #{Valve36}, #{Valve37}, #{Valve38}, #{Valve39}, #{Valve40}, #{time}
where not exists (select DeviceId,time from ruoyi.fertigation_sense where DeviceId =#{DeviceId} and time = #{time})
</insert>
<insert id="insert">
insert into ruoyi.fertigation_sense (DeviceId, EC, pH, PumpPressure, AccumulativeInflow1, InstantInflow1, AccumulativeInflow2, InstantInflow2, AccumulativeInflow3, InstantInflow3, AccumulativeInflow4, InstantInflow4, AccumulativeInflowAcid, InstantInflowAcid, AccumulativeInflowClear, CloudStatus, WorkStatus, ControlMode, AutoMode, InflowPump, FeedingPump, FeedingPumpCH1, FeedingPumpCH1PWM, FeedingPumpCH2, FeedingPumpCH2PWM, FeedingPumpCH3, FeedingPumpCH3PWM, FeedingPumpCH4, FeedingPumpCH4PWM, FeedingPumpAcid, FeedingPumpAcidPWM, Stir1, Stir2, Stir3, Stir4, Stir5, Valve1, Valve2, Valve3, Valve4, Valve5, Valve6, Valve7, Valve8, Valve9, Valve10, Valve11, Valve12, Valve13, Valve14, Valve15, Valve16, Valve17, Valve18, Valve19, Valve20, Valve21, Valve22, Valve23, Valve24, Valve25, Valve26, Valve27, Valve28, Valve29, Valve30, Valve31, Valve32, Valve33, Valve34, Valve35, Valve36, Valve37, Valve38, Valve39, Valve40, time)
VALUE (#{DeviceId},#{EC}, #{pH}, #{PumpPressure}, #{AccumulativeInflow1},#{InstantInflow1},
#{AccumulativeInflow2}, #{InstantInflow2}, #{AccumulativeInflow3}, #{InstantInflow3},
#{AccumulativeInflow4}, #{InstantInflow4}, #{AccumulativeInflowAcid}, #{InstantInflowAcid},
#{AccumulativeInflowClear}, #{CloudStatus}, #{WorkStatus}, #{ControlMode}, #{AutoMode},
#{InflowPump}, #{FeedingPump}, #{FeedingPumpCH1}, #{FeedingPumpCH1PWM}, #{FeedingPumpCH2},
#{FeedingPumpCH2PWM}, #{FeedingPumpCH3}, #{FeedingPumpCH3PWM}, #{FeedingPumpCH4}, #{FeedingPumpCH4PWM},
#{FeedingPumpAcid}, #{FeedingPumpAcidPWM}, #{Stir1}, #{Stir2}, #{Stir3}, #{Stir4}, #{Stir5},
#{Valve1}, #{Valve2}, #{Valve3}, #{Valve4}, #{Valve5}, #{Valve6}, #{Valve7}, #{Valve8}, #{Valve9},
#{Valve10}, #{Valve11}, #{Valve12}, #{Valve13}, #{Valve14}, #{Valve15}, #{Valve16}, #{Valve17},
#{Valve18}, #{Valve19}, #{Valve20}, #{Valve21}, #{Valve22}, #{Valve23}, #{Valve24}, #{Valve25},
#{Valve26}, #{Valve27}, #{Valve28}, #{Valve29}, #{Valve30}, #{Valve31}, #{Valve32}, #{Valve33},
#{Valve34}, #{Valve35}, #{Valve36}, #{Valve37}, #{Valve38}, #{Valve39}, #{Valve40}, #{time})
</insert>
</mapper>

View File

@ -0,0 +1,15 @@
<?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.ruoyi.crops.mapper.FoundationMapper">
<resultMap type="com.ruoyi.crops.domain.gsonBean.GsonParseFoundationBean" id="GsonParseFoundationBeanMap">
<result property="id" column="id" jdbcType="INTEGER"/>
<result property="userId" column="user_id" jdbcType="VARCHAR"/>
<result property="foundationId" column="foundation_id" jdbcType="INTEGER"/>
<result property="foundationName" column="foundation_name" jdbcType="VARCHAR"/>
</resultMap>
<insert id="insert">
insert into ruoyi.foundation (user_id,foundation_id, foundation_name)
VALUE (#{userId},#{foundationId},#{foundationName})
</insert>
</mapper>

View File

@ -0,0 +1,36 @@
<?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.ruoyi.crops.mapper.MeteorologicalMapper">
<resultMap type="com.ruoyi.crops.domain.Meteorological" id="MeteorologicalMap">
<result property="id" column="id" jdbcType="INTEGER"/>
<result property="warnId" column="warn_id" jdbcType="VARCHAR"/>
<result property="title" column="title" jdbcType="VARCHAR"/>
<result property="level" column="level" jdbcType="VARCHAR"/>
<result property="type" column="type" jdbcType="VARCHAR"/>
<result property="time" column="time" jdbcType="VARCHAR"/>
<result property="province" column="province" jdbcType="VARCHAR"/>
<result property="city" column="city" jdbcType="VARCHAR"/>
<result property="district" column="district" jdbcType="VARCHAR"/>
<result property="content" column="content" jdbcType="VARCHAR"/>
</resultMap>
<select id="selectbyTime" resultMap="MeteorologicalMap">
select warn_id,title,level,type,time,province,city,district,content
from ruoyi.meteorological
where time BETWEEN CONCAT(CURDATE(),' 00:00:00') AND CONCAT(CURDATE(),' 23:59:59');
</select>
<insert id="insert">
insert into ruoyi.meteorological (warn_id, title, level, type, time, province, city, district, content)
VALUE (#{warnId},#{title},#{level},#{type},#{time},#{province},#{city},#{district},#{content})
</insert>
<!--sql语句直接去重-->
<select id="insert2">
insert into ruoyi.meteorological(warn_id, title, level, type, time, province, city, district, content)
select #{warnId},#{title},#{level},#{type},#{time},#{province},#{city},#{district},#{content}
where not exists(select warn_id ,time from ruoyi.meteorological where warn_id=#{warnId} and time=#{time})
</select>
</mapper>

View File

@ -7,10 +7,12 @@
<result property="time" column="time" jdbcType="DATE"/>
<result property="serviceName" column="service_name" jdbcType="VARCHAR"/>
<result property="style" column="style" jdbcType="VARCHAR"/>
<result property="fileName" column="file_name" jdbcType="VARCHAR"/>
<result property="filePath" column="file_path" jdbcType="VARCHAR"/>
</resultMap>
<sql id="selectServiceTypeVo">
select id,service_type,time,service_name,style from ruoyi.service_type
select id,service_type,time,service_name,style,file_name,file_path from ruoyi.service_type
</sql>
<select id="selectByType" resultMap="ServiceTypeMap">
<include refid="selectServiceTypeVo">
@ -19,8 +21,8 @@
</select>
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
insert into ruoyi.service_type(service_type, time, service_name, style)
value (#{serviceType},#{time},#{serviceName},#{style})
insert into ruoyi.service_type(service_type, time, service_name, style,file_name,file_path)
value (#{serviceType},#{time},#{serviceName},#{style},#{fileName},#{filePath})
</insert>
<select id="selectAll" resultMap="ServiceTypeMap">
@ -35,4 +37,7 @@
</foreach>
</delete>
<select id="selectByfile" resultType="java.lang.Integer">
select count(*) from ruoyi.service_type where file_name=#{name};
</select>
</mapper>

View File

@ -7,16 +7,20 @@
<result property="monitoringIndicators" column="monitoring_indicators" jdbcType="VARCHAR"/>
<result property="monitoringValues" column="monitoring_values" jdbcType="DOUBLE"/>
<result property="abnormalCause" column="abnormal_cause" jdbcType="VARCHAR"/>
<result property="warningTime" column="warning_time" jdbcType="DATE"/>
<result property="warningTime" column="warning_time" jdbcType="VARCHAR"/>
<result property="aaus" column="aaus" jdbcType="VARCHAR"/>
</resultMap>
<select id="selectByNumber" resultMap="WarningInformationMap">
<select id="selectByTime" resultMap="WarningInformationMap">
select * from ruoyi.warning_information
where greenhouse_number= #{number}
where warning_time between #{startTime} and #{endTime}
</select>
<insert id="insert">
insert into ruoyi.warning_information(greenhouse_number, monitoring_indicators, monitoring_values, abnormal_cause, warning_time)
VALUE(#{greenhouseNumber},#{monitoringIndicators},#{monitoringValues},#{abnormalCause},#{warningTime})
insert into ruoyi.warning_information(greenhouse_number, monitoring_indicators, monitoring_values, abnormal_cause ,warning_time,aaus)
VALUE(#{greenhouseNumber},#{monitoringIndicators},#{monitoringValues},#{abnormalCause},#{warningTime},#{aaus})
</insert>
</mapper>