Compare commits

...

4 Commits

Author SHA1 Message Date
27c29fca42 庞家镇 2023-06-29 16:59:27 +08:00
3c7b59498c 庞家镇 2023-06-29 16:59:03 +08:00
a94bad2a78 设备信息定时查询
天气预警数据定时查询
2023-05-12 15:40:28 +08:00
b4eb0d6a68 设备信息定时查询
天气预警数据定时查询
2023-05-12 15:40:07 +08:00
224 changed files with 18938 additions and 4893 deletions

BIN
lib/javax.ejb.jar Normal file

Binary file not shown.

BIN
lib/javax.jms.jar Normal file

Binary file not shown.

BIN
lib/javax.persistence.jar Normal file

Binary file not shown.

BIN
lib/javax.resource.jar Normal file

Binary file not shown.

BIN
lib/javax.servlet.jsp.jar Normal file

Binary file not shown.

Binary file not shown.

BIN
lib/javax.transaction.jar Normal file

Binary file not shown.

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

@ -15,8 +15,13 @@
web服务入口
</description>
<dependencies>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<geotools.version>20.5</geotools.version>
<jts.version>1.16.1</jts.version>
</properties>
<dependencies>
<!-- spring-boot-devtools -->
<dependency>
<groupId>org.springframework.boot</groupId>
@ -87,8 +92,177 @@
<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>
<!-- 引入jsoup -->
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.16.1</version>
</dependency>
<!-- AOP -->
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
<version>1.9.4</version>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>1.9.4</version>
</dependency>
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib</artifactId>
<version>3.2.12</version>
</dependency>
<!-- geotools start -->
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-main</artifactId>
<version>${geotools.version}</version>
</dependency>
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-referencing</artifactId>
<version>${geotools.version}</version>
</dependency>
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-api</artifactId>
<version>${geotools.version}</version>
</dependency>
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-opengis</artifactId>
<version>${geotools.version}</version>
</dependency>
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-metadata</artifactId>
<version>${geotools.version}</version>
</dependency>
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-geometry</artifactId>
<version>${geotools.version}</version>
</dependency>
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-coverage</artifactId>
<version>${geotools.version}</version>
</dependency>
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-cql</artifactId>
<version>${geotools.version}</version>
</dependency>
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-data</artifactId>
<version>${geotools.version}</version>
</dependency>
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-epsg-wkt</artifactId>
<version>${geotools.version}</version>
</dependency>
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-jdbc</artifactId>
<version>${geotools.version}</version>
</dependency>
<dependency>
<groupId>org.geotools.jdbc</groupId>
<artifactId>gt-jdbc-postgis</artifactId>
<version>${geotools.version}</version>
</dependency>
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-shapefile</artifactId>
<version>${geotools.version}</version>
</dependency>
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-geojson</artifactId>
<version>${geotools.version}</version>
</dependency>
<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-swing</artifactId>
<version>${geotools.version}</version>
</dependency>
<dependency>
<groupId>org.locationtech.jts</groupId>
<artifactId>jts-core</artifactId>
<version>1.16.1</version>
</dependency>
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-wms</artifactId>
<version>${geotools.version}</version>
</dependency>
<!-- geotools end -->
<!--geotools-->
<!-- <dependency>-->
<!-- <groupId>org.geotools</groupId>-->
<!-- <artifactId>gt-shapefile</artifactId>-->
<!-- <version>${geotools.version}</version>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>org.geotools</groupId>-->
<!-- <artifactId>gt-swing</artifactId>-->
<!-- <version>${geotools.version}</version>-->
<!-- </dependency>-->
<!-- &lt;!&ndash; https://mvnrepository.com/artifact/org.locationtech.jts/jts-core &ndash;&gt;-->
<!-- <dependency>-->
<!-- <groupId>org.locationtech.jts</groupId>-->
<!-- <artifactId>jts-core</artifactId>-->
<!-- <version>1.16.1</version>-->
<!-- </dependency>-->
<!-- &lt;!&ndash; https://mvnrepository.com/artifact/org.geotools/gt-main &ndash;&gt;-->
<!-- <dependency>-->
<!-- <groupId>org.geotools</groupId>-->
<!-- <artifactId>gt-main</artifactId>-->
<!-- <version>22-RC</version>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>com.vividsolutions</groupId>-->
<!-- <artifactId>jts</artifactId>-->
<!-- <version>1.13</version>-->
<!-- </dependency>-->
</dependencies>
<repositories>
<repository>
<id>osgeo</id>
<name>OSGeo Release Repository</name>
<url>https://repo.osgeo.org/repository/release/</url>
<snapshots><enabled>false</enabled></snapshots>
<releases><enabled>true</enabled></releases>
</repository>
<repository>
<id>osgeo-snapshot</id>
<name>OSGeo Snapshot Repository</name>
<url>https://repo.osgeo.org/repository/snapshot/</url>
<snapshots><enabled>true</enabled></snapshots>
<releases><enabled>false</enabled></releases>
</repository>
</repositories>
<build>
<plugins>
@ -120,4 +294,5 @@
<finalName>${project.artifactId}</finalName>
</build>
</project>

View File

@ -3,6 +3,7 @@ package com.ruoyi;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.scheduling.annotation.EnableScheduling;
/**

View File

@ -0,0 +1,113 @@
package com.ruoyi.web.aop;
import com.ruoyi.common.utils.DateUtil;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.crops.domain.InterfaceStatistics;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component;
import java.lang.reflect.Array;
import java.time.Duration;
import java.util.*;
/**
* API访问历史统计
* @author yangjunqiang
*/
@Aspect
@Component
public class ApiVisitHistory {
private Logger log = LoggerFactory.getLogger(ApiVisitHistory.class);
private ThreadLocal<Long> startTime = new ThreadLocal<>();
private Set userIds = new HashSet();
@Autowired
private RedisTemplate redisTemplate;
/**
* 定义切面
* - 此处代表com.ruoyi.web.controller.crops包下的所有接口都会被统计
*/
@Pointcut("execution(* com.ruoyi.web.controller.crops..*.*(..))")
public void pointCut(){
}
@Before("pointCut()")
public void doBefore(JoinPoint joinPoint) {
startTime.set(System.currentTimeMillis());
//计数
AtomicCounter.getInstance().increase();
}
@AfterReturning(returning = "returnVal", pointcut = "pointCut()")
public void doAfterReturning(JoinPoint joinPoint, Object returnVal) {
//判断访问接口的用户数
try {
userIds.add(SecurityUtils.getUserId());
}catch (Exception e){}
//从redis中获取数据
InterfaceStatistics iS = (InterfaceStatistics) redisTemplate.opsForValue().get("interfaceStatistics");
//当前时间和今天24点相差毫秒数
long millis = DateUtil.dateDiff(new Date(), DateUtil.getDayEnd());
//如果redis中有数据
if (iS!=null){
Integer visits = iS.getVisits();
Integer dataEntries = iS.getDataEntries();
dataEntries +=getLength(returnVal);
Integer accessingUsers = iS.getAccessingUsers();
// log.info("耗费时间:[{}] ms,访问次数:{},交换数据总量:{}", System.currentTimeMillis() - startTime.get(),AtomicCounter.getInstance().getValue(),dataEntries);
InterfaceStatistics interfaceStatistics = new InterfaceStatistics();
//访问次数进行自增
interfaceStatistics.setVisits(++visits);
//数据总量
interfaceStatistics.setDataEntries(dataEntries);
//用户访问数只取最大
interfaceStatistics.setAccessingUsers((userIds.size()>accessingUsers)?userIds.size():accessingUsers);
redisTemplate.opsForValue().set("interfaceStatistics",interfaceStatistics, Duration.ofMillis(millis));
}else {
InterfaceStatistics interfaceStatistics = new InterfaceStatistics();
interfaceStatistics.setVisits(1);
interfaceStatistics.setDataEntries(1);
interfaceStatistics.setAccessingUsers(1);
redisTemplate.opsForValue().set("interfaceStatistics",interfaceStatistics, Duration.ofMillis(millis));
}
}
/**
* 当接口报错时执行此方法
*/
@AfterThrowing(pointcut = "pointCut()")
public void doAfterThrowing(JoinPoint joinPoint) {
log.info("接口访问失败");
}
//判断Object 的类型(map,set,list,array),并返回长度
private static int getLength(Object obj) {
if (obj == null) {
return 0;
}
if (obj.getClass().isArray()){
int length = Array.getLength(obj);
return length;
}if (obj instanceof List) {
return ((List) obj).size();
}if (obj instanceof Set) {
return ((Set) obj).size();
}if (obj instanceof Map) {
Object data = ((Map) obj).get("data");
getLength(data);
}
return 1;
}
}

View File

@ -0,0 +1,62 @@
package com.ruoyi.web.aop;
import java.util.concurrent.atomic.AtomicInteger;
/**
* 计数器统计当前执行的任务数
* @author yangjunqiang
*
*/
public class AtomicCounter {
/**
* 创建了一个私有静态的AtomicCounter对象作为单例模式的实例
*/
private static final AtomicCounter atomicCounter = new AtomicCounter();
/**
* 私有的构造函数用于限制类的实例化其他类无法直接实例化该类只能通过getInstance()方法获取单例对象
*/
private AtomicCounter() {
}
/**
* 公共静态方法getInstance()用于获取AtomicCounter类的单例对象
* @return 返回之前创建的静态atomicCounter对象
*/
public static AtomicCounter getInstance() {
return atomicCounter;
}
/**
* 创建了一个私有静态的AtomicInteger对象counter用于存储计数器的值
*/
private static AtomicInteger counter = new AtomicInteger();
/**
* 公共方法getValue()用于获取计数器的当前值
* @return 通过调用counter.get()来获取counter的当前值并返回
*/
public int getValue() {
return counter.get();
}
/**
* 公共方法increase()用于递增计数器的值
* @return 通过调用counter.incrementAndGet()来递增counter的值并返回递增后的新值
*/
public int increase() {
return counter.incrementAndGet();
}
/**
* 公共方法decrease()用于递减计数器的值
* 通过调用counter.decrementAndGet()来递减counter的值并返回递减后的新值
* @return
*/
public int decrease() {
return counter.decrementAndGet();
}
}

View File

@ -1,10 +1,8 @@
package com.ruoyi.web.controller.crops;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.crops.domain.CropsComprehensiveData;
import com.ruoyi.crops.service.ICropsComprehensiveDataService;
@ -17,9 +15,6 @@ import java.util.List;
/**
* 作物综合数据Controller
*
* @author my
* @date 2023-04-19
*/
@RestController
@RequestMapping("/crops/data")
@ -31,7 +26,7 @@ public class CropsComprehensiveDataController extends BaseController
/**
* 查询作物综合数据列表
*/
@PreAuthorize("@ss.hasPermi('crops:data:list')")
@GetMapping("/list")
public TableDataInfo list(CropsComprehensiveData cropsComprehensiveData)
{
@ -44,7 +39,6 @@ public class CropsComprehensiveDataController extends BaseController
* 导出作物综合数据列表
*/
@Log(title = "作物综合数据", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, CropsComprehensiveData cropsComprehensiveData)
{
@ -67,7 +61,6 @@ public class CropsComprehensiveDataController extends BaseController
* 新增作物综合数据
*/
@Log(title = "作物综合数据", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody CropsComprehensiveData cropsComprehensiveData)
{
@ -78,7 +71,7 @@ public class CropsComprehensiveDataController extends BaseController
* 修改作物综合数据
*/
@Log(title = "作物综合数据", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody CropsComprehensiveData cropsComprehensiveData)
{
@ -89,7 +82,6 @@ public class CropsComprehensiveDataController extends BaseController
* 删除作物综合数据
*/
@Log(title = "作物综合数据", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{

View File

@ -1,10 +1,12 @@
package com.ruoyi.web.controller.crops;
import com.github.pagehelper.PageHelper;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.crops.domain.CropsDrought;
import com.ruoyi.crops.service.ICropsDroughtService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import java.util.Date;
@ -36,6 +38,7 @@ public class CropsDroughtController extends BaseController {
* @param time
* @return
*/
@PreAuthorize("@ss.hasPermi('crops:drought:list')")
@GetMapping("/{time}")
public List<CropsDrought> selectByTime(@PathVariable("time")Date time){
return iCropsDroughtService.selectByTime(time);

View File

@ -6,6 +6,7 @@ import com.ruoyi.crops.domain.CropStructure;
import com.ruoyi.crops.domain.CropsGrowth;
import com.ruoyi.crops.service.ICropsGrowthService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import java.util.Date;
@ -22,7 +23,7 @@ public class CropsGrowthController extends BaseController {
private ICropsGrowthService iCropsGrowthService;
/**
* 批量新增
* 批量新增作物长势数据
* @param map
* @return
*/
@ -33,10 +34,11 @@ public class CropsGrowthController extends BaseController {
}
/**
* 根据时间查询
* 根据时间查询作物长势数据
* @param time
* @return
*/
@PreAuthorize("@ss.hasPermi('crops:growth:list')")
@GetMapping("/{time}")
public List<CropsGrowth> selectByTime(@PathVariable("time") Date time){
return iCropsGrowthService.selectByTime(time);

View File

@ -7,6 +7,7 @@ import com.ruoyi.crops.service.ICropsStructureService;
import org.apache.ibatis.annotations.Param;
import org.aspectj.weaver.loadtime.Aj;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.security.core.parameters.P;
import org.springframework.web.bind.annotation.*;
@ -48,6 +49,7 @@ public class CropsStructureController extends BaseController {
* @param time
* @return
*/
@PreAuthorize("@ss.hasPermi('crops:structure:list')")
@GetMapping("/{time}")
public List<CropStructure> selectByTime(@PathVariable Date time){
return iCropsStructureService.selectByTime(time);

View File

@ -0,0 +1,112 @@
package com.ruoyi.web.controller.crops;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.crops.domain.CropsUser;
import com.ruoyi.crops.service.ICropsUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.Errors;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpSession;
import javax.validation.Valid;
import java.util.List;
/**
* 用户controller
*/
@RestController
@RequestMapping("/crops/user")
public class CropsUserController extends BaseController {
@Autowired
private ICropsUserService iCropsUserService;
/**
* 根据id查询用户
* @param phone
* @return
*/
@GetMapping("/{phone}")
public CropsUser selectByPhone(@PathVariable String phone) {
return iCropsUserService.selectByPhone(phone);
}
/**
* 获取所有用户列表
*
* @return
*/
@PreAuthorize("@ss.hasPermi('crops:user:list')")
@GetMapping()
public List<CropsUser> list() {
return iCropsUserService.list();
}
/**
* 删除用户
*
* @param id
* @return
*/
@PreAuthorize("@ss.hasPermi('crops:user:delete')")
@DeleteMapping("/{id}")
public AjaxResult delete(@PathVariable Integer id) {
return toAjax(iCropsUserService.delete(id));
}
/**
* 注册用户
*
* @param cropsUser
* @return
*/
@PostMapping("/register")
public AjaxResult register(@Valid CropsUser cropsUser, Errors errors, String psw2) {
if (errors.hasErrors()) {
return AjaxResult.error(errors.getAllErrors().get(0).getDefaultMessage());
} else if (!cropsUser.getPassword().equals(psw2)) {
return AjaxResult.error("两次密码不同");
} else {
try {
int ret = iCropsUserService.regist(cropsUser);
if (ret > 0) {
return AjaxResult.success(cropsUser);
} else {
return AjaxResult.error("注册失败");
}
} catch (Exception ex) {
return AjaxResult.error(ex.getMessage());
}
}
}
@PostMapping("/login")
public AjaxResult login(@Valid CropsUser cropsUser, Errors errors, HttpSession session) {
if (errors.hasErrors()) {
return AjaxResult.error(errors.getAllErrors().get(0).getDefaultMessage());
} else {
CropsUser user = iCropsUserService.login(cropsUser);
if (user != null) {
session.setAttribute("cropsUser", user);
return AjaxResult.success("登录成功");
} else {
return AjaxResult.error("用户不存在/密码错误");
}
}
}
/**
* 修改用户
*
* @param id
* @return
*/
@PutMapping("/{id}")
public AjaxResult update(@PathVariable Integer id) {
return toAjax(iCropsUserService.update(id));
}
}

View File

@ -5,6 +5,7 @@ import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.crops.domain.CropsYield;
import com.ruoyi.crops.service.ICropsYieldService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import java.util.Date;
@ -12,7 +13,7 @@ import java.util.List;
import java.util.Map;
/**
* 作物产量查询
* 作物产量Controller
*/
@RestController
@RequestMapping("/crops/yield")
@ -25,6 +26,7 @@ public class CropsYieldConeroller extends BaseController {
* @param year
* @return
*/
@PreAuthorize("@ss.hasPermi('crops:yield:list')")
@GetMapping("/{year}")
public List<CropsYield> selectByYear(@PathVariable Integer year){
return iCropsYieldService.selectByYear(year);

View File

@ -0,0 +1,41 @@
package com.ruoyi.web.controller.crops;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.crops.domain.DataAcquisition;
import com.ruoyi.crops.service.IDataAcquisitionService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.io.FileNotFoundException;
import java.util.List;
/**
* 数据采集Controller
*/
@RestController
@RequestMapping("/crops/acquisition")
public class DataAcquisitionController extends BaseController {
@Autowired
private IDataAcquisitionService iDataAcquisitionService;
private static final Logger logger = LoggerFactory.getLogger(DataAcquisition.class);
@GetMapping
@PreAuthorize("@ss.hasPermi('crops:acquisition:list')")
public DataAcquisition getData() {
return iDataAcquisitionService.getData();
}
@Scheduled(fixedDelay = 60 * 60 * 1000)
public DataAcquisition getdataAcquisition(){
logger.info("每小时更新天空地一体化农业检测数据");
return iDataAcquisitionService.getdataAcquisition();
}
}

View File

@ -0,0 +1,135 @@
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.controller.BaseController;
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.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import java.lang.reflect.Field;
import java.text.SimpleDateFormat;
import java.util.*;
/**
* 设备状态信息Controller
*/
@RestController
@RequestMapping("/crops/device")
public class DeviceSenseController extends BaseController {
private static final Logger logger = LoggerFactory.getLogger(DeviceSenseController.class);
@Value("${url.deviceSense}")
String url;//指定UR
@Autowired
private IDeviceSenseService iDeviceSenseService;
@Autowired
private IWarningService iWarningService;
/**
* 根据时间查询设备传感数据
*
* @param startTime
* @param endTime
* @return
*/
@PreAuthorize("@ss.hasPermi('crops:device:select')")
@GetMapping()
public List<DeviceSense> selectBytime(@RequestParam Date startTime, @RequestParam Date endTime) {
return iDeviceSenseService.selectByTime(startTime, endTime);
}
/**
* 定时任务调用接口获取数据插入数据库
*/
@Scheduled(fixedDelay = 6 * 60 * 1000)
public DeviceSense getsense(){
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();
try {
//格式化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.judgeWarning(deviceSense);
logger.info("每6分钟更新一次设备传感数据");
return deviceSense;
} catch (Exception e) {
logger.info(e.toString());
logger.info("获取传感设备数据失败");
return null;
}
}
/**
* 根据小时获取其平均值数据
*
* @param type
* @return
*/
@PreAuthorize("@ss.hasPermi('crops:device:sense')")
@GetMapping("/sense")
public AjaxResult averageList(@RequestParam String type) {
return AjaxResult.success(iDeviceSenseService.averageList(type));
}
/**
* 根据时间查询设备状态
* @param startTime
* @param endTime
* @return
*/
@GetMapping("/select")
public List<DeviceSense> select(@RequestParam Date startTime, @RequestParam Date endTime) {
return iDeviceSenseService.selectByTime(startTime, endTime);
}
}

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,447 @@
package com.ruoyi.web.controller.crops;
import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.ruoyi.common.config.RuoYiConfig;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.utils.DateUtil;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.ShapeUtil;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.crops.domain.*;
import com.ruoyi.common.utils.MyPoint;
import com.ruoyi.crops.domain.gsonBean.GsonFarmMachineryBean;
import com.ruoyi.crops.domain.gsonBean.GsonMachineryPositionBean;
import com.ruoyi.crops.domain.vo.FarmMachineryVo;
import com.ruoyi.crops.domain.vo.MachineryJobDataVo;
import com.ruoyi.crops.service.IFarmMachineryService;
import com.ruoyi.crops.service.IGeoServer;
import com.ruoyi.crops.service.IMapDrawPolygonService;
import com.ruoyi.crops.service.IWarningFarmService;
import org.apache.commons.collections.map.HashedMap;
import org.checkerframework.checker.units.qual.A;
import org.locationtech.jts.geom.Geometry;
import org.locationtech.jts.geom.GeometryFactory;
import org.locationtech.jts.geom.MultiPolygon;
import org.locationtech.jts.geom.Polygon;
import org.locationtech.jts.io.WKTReader;
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.io.File;
import java.io.IOException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.util.*;
@RestController
@RequestMapping("/farm/machinery")
public class FarmMachineryController extends BaseController {
private static final Logger logger = LoggerFactory.getLogger(FarmMachineryController.class);
@Autowired
private IFarmMachineryService iFarmMachineryService;
@Autowired
private IMapDrawPolygonService iMapDrawPolygonService;
@Autowired
private IWarningFarmService iWarningFarmService;
@Autowired
private IGeoServer iGeoServer;
@Value("${FarmMachinery.vehicleList}")
private String vehicleListUrl;
@Value("${FarmMachinery.vehiclePos}")
private String vehiclePosUrl;
@Value("${FarmMachinery.vehicleTrack}")
private String vehicleTrackUrl;
@Value("${FarmMachinery.vehicleJobData}")
private String vehicleJobDataUrl;
@Value("${FarmMachinery.clienttoken}")
private String clienttoken;
/**
* 农机设备信息查询
*
* @return
*/
@GetMapping("selectMachineryData")
public TableDataInfo selectMachineryData() {
startPage();
List<FarmMachineryVo> list = iFarmMachineryService.selectMachineryData();
return getDataTable(list);
}
/**
* 农机位置查询
*
* @param vehicleno
* @return
*/
@GetMapping("/position")
public JSONObject machineryPosition(@RequestParam(value = "vehicleno", required = false) String vehicleno) {
Map<String, Object> map = new HashMap<>();//存放参数
map.put("clienttoken", clienttoken);
if (vehicleno != null) {
map.put("vehicleno", vehicleno);
}
String result = HttpUtil.createPost(vehiclePosUrl).form(map).execute().body();
Gson gson = new GsonBuilder().setDateFormat("yyyy-MM-dd HH:mm:ss").create();
GsonMachineryPositionBean gsonMachineryPositionBean = gson.fromJson(result, GsonMachineryPositionBean.class);
List<MachineryPosition> position = gsonMachineryPositionBean.getPosition();
if (position.size()>0){
iFarmMachineryService.insertPositions(position);
WithinAndIntersects(position);
}
return JSONObject.parseObject(result);
}
//判断农机经纬度是否在范围内
public void WithinAndIntersects(List<MachineryPosition> position) {
List<Map<String, Object>> maps = null;
try {
//读取上传的shp文件
maps = ShapeUtil.readShp(RuoYiConfig.getUploadPath() + "/shpFile/shapefile.shp");
} catch (IOException e) {
e.printStackTrace();
}
for (Map<String, Object> map : maps) {
String wkt = (String) map.get("wkt");
//更改字符串格式 11,22|22,33|33,22|11,22
String substring = wkt.substring(16, wkt.length() - 3);
String replace = substring.replace(", ", "|").replace(" ", ",");
for (MachineryPosition machineryPosition : position) {
if (!iFarmMachineryService.withinAndIntersects(replace, machineryPosition.getLng(), machineryPosition.getLat())){
WarningFarm warningFarm = new WarningFarm();
String vehicleno = machineryPosition.getVehicleno();
warningFarm.setVehicleno(vehicleno);
FarmMachineryVo farmMachineryVos = iFarmMachineryService.selectMachineryData(vehicleno);
warningFarm.setOwnername(farmMachineryVos.getOwnername());
warningFarm.setTime(new Date());
warningFarm.setWarningInfo("作业范围超出");
iWarningFarmService.insertWarning(warningFarm);
}
}
}
}
/**
* 历史作业信息查询
*
* @return
*/
@GetMapping("/selectMachineryJobData")
public TableDataInfo selectMachineryJobData(@RequestParam(required = false, name = "startTime") Date startTime,
@RequestParam(required = false, name = "endTime") Date endTime,
@RequestParam(required = false, name = "vehicleno") String vehicleno) {
startPage();
List<MachineryJobDataVo> list = iFarmMachineryService.selectMachineryJobData(startTime, endTime, vehicleno);
return getDataTable(list);
}
/**
* 查询全部农机编号
* @return
*/
@GetMapping("/selectVehicleno")
public AjaxResult selectVehicleno(){
List<String> list = iFarmMachineryService.selectVehicleno();
return AjaxResult.success(list);
}
/**
* 今日作业查询
*
* @return
*/
@GetMapping("/selectTodayJobData")
public AjaxResult selectTodayJobData() {
MachineryJobDataVo data = iFarmMachineryService.selectTodayJobData();
Map<String, Double> map = new HashedMap();
map.put("area", data.getArea());
map.put("workhours", data.getWorkhours());
return AjaxResult.success(map);
}
/**
* 农机作业信息导出
*
* @param
*/
// @Log(title = "农机作业信息", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public AjaxResult export(@RequestParam("startTime") Date startTime,
@RequestParam("endTime") Date endTime,
@RequestParam("vehicleno") String vehicleno) {
List<MachineryJobDataVo> list = iFarmMachineryService.selectMachineryJobData(startTime, endTime, vehicleno);
ExcelUtil<MachineryJobDataVo> util = new ExcelUtil<>(MachineryJobDataVo.class);
// util.exportExcel(response, list, "农机作业信息");
AjaxResult excelName = util.exportExcel(list, "农机作业信息");
String msg = (String) excelName.get("msg");
Map<String, String> result = new HashMap<>();
result.put("path", RuoYiConfig.getDownloadPath() + msg);
return AjaxResult.success(result);
}
/**
* 查询农机轨迹信息
*
* @param workplace
* @param pttime
* @return
*/
@GetMapping("/VehicleTrack")
public List<MachineryTrajectory> selectVehicleTrack(String workplace, Date pttime) {
return iFarmMachineryService.selectVehicleTrack(workplace, pttime);
}
/**
* 农机设备状态查询
*
* @return
*/
@GetMapping("/selectFarmStatus")
public FarmStatus selectFarmStatus() {
FarmStatus farmStatus = new FarmStatus();
//农机设备信息查询
List<FarmMachineryVo> farmMachineryVos = iFarmMachineryService.selectMachineryData();
int total = farmMachineryVos.size();
farmStatus.setTotal(total);
int working = iFarmMachineryService.selectWorkingMachinery();
farmStatus.setWorking(working);
farmStatus.setUnwork(total - working);
int Online = iFarmMachineryService.selectMachineryOnline();
farmStatus.setOnline(Online);
farmStatus.setOffline(total - Online);
return farmStatus;
}
//定时获取数据库农机轨迹并发布服务
@Scheduled(fixedDelay = 10* 60 * 1000)
public AjaxResult Machinert() throws Exception {
Map<String, Map<String, String>> areaWorkhoursMap = new HashMap<>();
//查询作业地块
List<String> workplaceList = iFarmMachineryService.distinctWorkplace();
Map result = new HashMap<>();
StringBuilder multiPolygon = new StringBuilder("MULTIPOLYGON((");
List<String> userdata = new ArrayList<>();
StringBuilder multiLineString = new StringBuilder("MULTILINESTRING(");
for (String workplace : workplaceList) {
List<MyPoint> pointList = new ArrayList<>();
Date date = new Date(2023 - 1900, 3 - 1, 13);
//根据作业地块和时间查询农机轨迹数据
List<MachineryTrajectory> machineryTrajectories = iFarmMachineryService.selectVehicleTrack(workplace, date);
for (MachineryTrajectory machineryTrajectory : machineryTrajectories) {
pointList.add(new MyPoint(machineryTrajectory.getLng(), machineryTrajectory.getLat()));
}
//数据大于1000进行抽稀缩减
if (pointList.size() > 1000) {
for (int i = 0; i < pointList.size(); i += 3) {
pointList.remove(i);
}
}
String polygon = ShapeUtil.point2WktPolygon(pointList);
String line = ShapeUtil.point2WktLine(pointList);
Map<String, String> map = new HashMap<>();
map.put("polygon", polygon);
//在经纬度数组后加入第一个点位形成闭环
pointList.add(pointList.size(), pointList.get(0));
//使用凸包算法过滤出边界
List<MyPoint> myPoints = iMapDrawPolygonService.DrawPolygon(pointList);
//第二次过滤转换为wkt格式
String drawPolygon = ShapeUtil.point2WktPolygon(iMapDrawPolygonService.DrawPolygon(myPoints));
//userdata中添加农机编号
MachineryTrajectory trajectory = machineryTrajectories.get(0);
//查询农机编号
String vehicleno = trajectory.getVehicleno();
userdata.add(vehicleno);
userdata.add(trajectory.getWorkplace());
//通过农机编号查询作业类型
userdata.add(String.valueOf(iFarmMachineryService.selectJobtype(vehicleno)));
//截取wkt格式字符串改变为MULTIPOLYGON格式
String substring = drawPolygon.substring(8, drawPolygon.length() - 1);
String linestring = line.substring(10);
multiPolygon.append(substring).append("),(");
multiLineString.append(linestring).append(",");
//计算地块面积
String area = String.format("%.2f", ShapeUtil.getAreaByWkt(polygon) / 666.67);
map.put("area", area);
//计算作业时间
float workingHours = Float.parseFloat(DateUtil.dateDiffHours(trajectory.getPttime(),
machineryTrajectories.get(machineryTrajectories.size() - 1).getPttime()));
String pttime = String.valueOf(workingHours);
map.put("workHours", pttime);
if (areaWorkhoursMap.containsKey(trajectory.getVehicleno())) {
Map<String, String> sMap = areaWorkhoursMap.get(trajectory.getVehicleno());
float va = Float.parseFloat(area);
float fa = Float.parseFloat(sMap.get("area"));
area = String.format("%.2f", (va + fa));
float vw = Float.parseFloat(pttime);
float fw = Float.parseFloat(sMap.get("workHours"));
pttime = String.format("%.2f", (vw + fw));
}
Map<String, String> mp = new HashMap<>();
mp.put("area", area);
mp.put("workHours", pttime);
areaWorkhoursMap.put(trajectory.getVehicleno(), mp);
result.put(workplace, map);
}
//统计作业时长和面积插入数据库
for (Map.Entry<String, Map<String, String>> entry : areaWorkhoursMap.entrySet()) {
String vehicleno = entry.getKey();
Map<String, String> map = entry.getValue();
double area = Float.parseFloat(map.get("area"));
double workingHours = Float.parseFloat(map.get("workHours"));
iFarmMachineryService.updateAreaWorkhours(vehicleno, area, workingHours);
}
String mPolygon = multiPolygon.delete(multiPolygon.length() - 2,multiPolygon.length()).append(")").toString();
String mLineString = multiLineString.deleteCharAt(multiLineString.length() - 1).append(")").toString();
String polygonPath = RuoYiConfig.getUploadPath()+ "/shpFile/" + LocalDate.now() + "polygon.shp";
String lineStringPath = RuoYiConfig.getUploadPath()+ "/shpFile/lineString.shp";
// 生成shp文件
ShapeUtil.writeShape(mPolygon,"MultiPolygon",polygonPath,userdata);
ShapeUtil.writeShape(mLineString,"MultiLineString",lineStringPath,userdata) ;
String fileName = LocalDate.now() + "polygon";
String polygonZipPath = RuoYiConfig.getUploadPath()+ "/shpFile/" + LocalDate.now() + "polygon.zip";
String lineStringZipPath = RuoYiConfig.getUploadPath()+ "/shpFile/lineString.zip";
//发布shp服务
String polygonShpResult = iGeoServer.publishShp("PJZ", fileName, fileName, polygonZipPath);
String lineStringShpResult = iGeoServer.publishShp("PJZ", "lineString", "lineString", lineStringZipPath);
result.put("publishPolygonShp", polygonShpResult);
result.put("publishlineStringShp", lineStringShpResult);
return AjaxResult.success(result);
}
/**
* 物联网接口获取农机轨迹数据
*
* @param vehicleno
* @param jobday
* @param jobtype
* @return
*/
public String gettrack(String vehicleno, Date jobday, String jobtype) {
//格式化作业日期
String formatjobday = new SimpleDateFormat("yyyy-MM-dd").format(jobday);
Map<String, Object> map = new HashMap<>();//存放参数
map.put("clienttoken", clienttoken);
//农机编号
map.put("vehicleno", vehicleno);
//作业日期
map.put("jobday", formatjobday);
//作业类型码
map.put("jobtype", jobtype);
String result = HttpUtil.createPost(vehicleTrackUrl).form(map).execute().body();
return result;
}
//定时获取农机轨迹信息
@Scheduled(fixedDelay = 10 * 1000)
public void processPositions() {
// List<MachineryJobDataVo> machineryJobDataVos = iFarmMachineryService.selectMachineryJobData(DateUtil.getDayBegin(), DateUtil.getBeginDayOfTomorrow(), null);
//查询作业信息
List<MachineryJobDataVo> machineryJobDataVos = iFarmMachineryService.selectMachineryJobData();
iFarmMachineryService.updateworkplace();
//根据农机作业信息进行轨迹查询
for (MachineryJobDataVo machineryJobDataVo : machineryJobDataVos) {
// String json = gettrack(machineryJobDataVo.getVehicleno(), DateUtil.getDayBegin(), machineryJobDataVo.getJobtype());
String json = gettrack(machineryJobDataVo.getVehicleno(), machineryJobDataVo.getJobday(), machineryJobDataVo.getJobtype());
JSONObject jsonObject = JSONObject. parseObject(json);
String postions = jsonObject.getString("postions");
String vehicleno = jsonObject.getString("vehicleno");
List<MachineryTrajectory> list = JSON.parseArray(postions, MachineryTrajectory.class);
iFarmMachineryService.insertProcessPositions(list, vehicleno);
}
}
//农机作业任务查询每天九点查询一次
@Scheduled(cron = "0 0 9 * * ?")
public void getMachineryJobData() throws ParseException {
Map<String, Object> map = new HashMap<>();//存放参数
map.put("clienttoken", clienttoken);
//按要求格式化日期数据进行查询七天数据
Date beginDayOf7day = DateUtil.getBeginDayOf7day();
Date dayBegin = DateUtil.getDayBegin();
String startTime = DateUtils.parseDateToStr("yyyy/MM/dd", beginDayOf7day);
String endTime = DateUtils.parseDateToStr("yyyy/MM/dd", dayBegin);
map.put("jobday", "[\"" + startTime + "\",\"" + endTime + "\"]");
String result = HttpUtil.createPost(vehicleJobDataUrl).form(map).execute().body();
//解析json
JSONObject jsonObject = JSONObject.parseObject(result);
JSONArray jobdata = jsonObject.getJSONArray("jobdata");
//今日农机作业任务数据
List<MachineryJobData> list = JSONArray.parseArray(jobdata.toJSONString(), MachineryJobData.class);
//进行数据去重
List<MachineryJobData> machineryJobData = iFarmMachineryService.selectJobDataByTime(beginDayOf7day, dayBegin);
for (int i = 0; i < list.size(); i++) {
MachineryJobData mj = list.get(i);
for (MachineryJobData md : machineryJobData) {
if (mj.getJobday().equals(md.getJobday()) &&
mj.getVehicleno().equals(md.getVehicleno()) &&
mj.getJobarea().equals(md.getJobarea())) {
list.remove(i);
i--;
}
}
}
if (!list.isEmpty()) {
logger.info("更新农机作业任务");
iFarmMachineryService.insertJobDataBatch(list);
}
}
//每周一九点获取农机数据
@Scheduled(cron = " 0 0 9 ? * 2")
public void getMachineryData() {
Map<String, Object> map = new HashMap<>();//存放参数
map.put("clienttoken", clienttoken);
String result = HttpUtil.createPost(vehicleListUrl).form(map).execute().body();
Gson gson = new Gson();
GsonFarmMachineryBean vehicleList = gson.fromJson(result, GsonFarmMachineryBean.class);
//创建一个空的list集合存放json解析的Meteorological实体数据
List<FarmMachinery> list = vehicleList.getVehicle();
//从数据库里查询出来的数据
List<FarmMachineryVo> farmMachineryList = iFarmMachineryService.selectMachineryData();
//剔除两个集合里面重复元素根据Vmeid和Vehicleno
for (int i = 0; i < list.size(); i++) {
FarmMachinery fm = list.get(i);
for (FarmMachineryVo f : farmMachineryList) {
if (fm.getOwnername().equals(f.getOwnername()) && fm.getVehicleno().equals(f.getVehicleno())) {
list.remove(i);
i--;//不进行i--会数组下标越界异常
}
}
}
if (!list.isEmpty()) {
logger.info("更新农机数据");
iFarmMachineryService.insertBatch(list);
}
}
}

View File

@ -0,0 +1,93 @@
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.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.util.HashMap;
import java.util.List;
import java.util.Map;
import static org.assertj.core.util.DateUtil.now;
/**
* 水肥一体机设备传感数据Controller
*/
@RestController
@RequestMapping
public class FertigationSenseController {
private static final Logger logger = LoggerFactory.getLogger(FertigationSenseController.class);
@Value("${url.deviceSense}")
String url;//指定URL
@Autowired
private IFertigationSenseService iFertigationSenseService;
/**
* 定时获取水肥一体机设备数据
* @throws Exception
*/
@Scheduled(fixedDelay = 60 * 60 * 1000)
public FertigationSense 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();
try{
//格式化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));
}
}
}
iFertigationSenseService.insert(fertigationSense);
logger.info("每小时更新一次水肥一体机设备传感数据");
return fertigationSense;
}catch (Exception e){
logger.info(e.toString());
logger.info("获取水肥一体机设备传感数据失败");
return null;
}
}
}

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

@ -0,0 +1,50 @@
package com.ruoyi.web.controller.crops;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.crops.domain.InterfaceStatistics;
import com.ruoyi.crops.domain.vo.InterfaceStatisticsVo;
import com.ruoyi.crops.service.InterfaceStatisticsService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import static com.ruoyi.common.utils.Threads.sleep;
@RestController
@RequestMapping("/interface/statistics")
public class InterfaceStatisticsController extends BaseController {
private static final Logger logger = LoggerFactory.getLogger(InterfaceStatisticsController.class);
@Autowired
private RedisTemplate redisTemplate;
@Autowired
private InterfaceStatisticsService interfaceStatisticsService;
@Scheduled(fixedDelay = 60 * 60 * 1000)
public AjaxResult getStatistics(){
//启动时延时一秒其他定时任务先执行
sleep(1000);
InterfaceStatistics interfaceStatistics = (InterfaceStatistics) redisTemplate.opsForValue().get("interfaceStatistics");
logger.info("每小时更新接口访问数据");
return toAjax(interfaceStatisticsService.insert(interfaceStatistics));
}
@PreAuthorize("@ss.hasPermi('interface:statistics:day')")
@GetMapping("/day")
public InterfaceStatistics day(){
return interfaceStatisticsService.selectByDay();
}
@PreAuthorize("@ss.hasPermi('interface:statistics:total')")
@GetMapping("/total")
public InterfaceStatisticsVo total(){
return interfaceStatisticsService.selectTotal();
}
}

View File

@ -1,41 +1,152 @@
package com.ruoyi.web.controller.crops;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.crops.domain.MachineParameter;
import com.ruoyi.crops.domain.OperationRecords;
import com.ruoyi.crops.domain.vo.MachineParameterVo;
import com.ruoyi.crops.service.IMachineParameterService;
import com.ruoyi.crops.service.IOperationRecordsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import java.lang.reflect.Field;
import java.time.Duration;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import static org.assertj.core.util.DateUtil.now;
/**
* 水肥一体机参数controller
*/
@RestController
@RequestMapping("/machine/parameter")
public class MachineParameterController extends BaseController {
public class MachineParameterController extends BaseController {
@Autowired
private IMachineParameterService machineParameterService;
/**
* 根据大棚名称进行查询
* @param name
* @return
*/
@GetMapping("/{name}")
public List<MachineParameter> selectByName(@PathVariable String name){
return machineParameterService.selectByName(name);
}
@Autowired
private IOperationRecordsService iOperationRecordsService;
@Autowired
private RedisTemplate redisTemplate;
/**
* 新增单条数据
* @param machineParameter
* 获取水肥一体机状态进行两次对比得到哪些参数被修改存入操作记录
*
* @param type
* @return
* @throws Exception
*/
@GetMapping("/getcompare")
public String getMachineParameter(Integer type) throws Exception {
//判断是开启还是关闭界面
if (type == 0) {
//临时存入redis中和第二次做对比
MachineParameter machineParameter = machineParameterService.getMachineParameter();
redisTemplate.opsForValue().set("machineParameter", machineParameter, Duration.ofMinutes(10));
return machineParameter.toString();
} else if (type == 1) {
//操作好关闭界面再次发送请求
MachineParameter machineParameter = machineParameterService.getMachineParameter();
MachineParameter parameter = (MachineParameter) redisTemplate.opsForValue().get("machineParameter");
//记录修改了几个字段值
int count = 0;
StringBuilder sb = new StringBuilder();
//反射获取类对象
for (Field declaredField : MachineParameter.class.getDeclaredFields()) {
try {
//通过下面compareColumns里定义的字段名进行对比
if (compareColumns.containsKey(declaredField.getName())) {
declaredField.setAccessible(true);
// 转成string 比较字符串内容
Object obj1 = declaredField.get(parameter);
Object obj2 = declaredField.get(machineParameter);
if (Objects.nonNull(obj1) && !obj1.equals(obj2)) {
OperationRecords operationRecords = new OperationRecords();
//状态为0阀门关闭
if (obj2.equals("0")) {
operationRecords.setOperationContent(compareColumns.get(declaredField.getName()) + "关闭");
} else if (obj2.equals("1")) {
operationRecords.setOperationContent(compareColumns.get(declaredField.getName()) + "打开");
}
operationRecords.setUpdateTime(now());
//插入操作记录
iOperationRecordsService.insert(operationRecords);
if (count == 2) {
sb.append("等信息已更新");
break;
}
if (count > 0) {
sb.append(",");
}
sb.append(compareColumns.get(declaredField.getName()));
count++;
}
}
} catch (IllegalAccessException e) {
// log.info("initCustomerDetailCount:{}", e);
}
}
return ("compare result:" + sb.toString());
}
return "参数错误";
}
Map<String, String> compareColumns = new HashMap<String, String>() {
{
put("Valve1", "阀门1");
put("valve2", "阀门2");
put("Valve3", "阀门3");
put("Valve4", "阀门4");
put("Valve5", "阀门5");
put("Valve6", "阀门6");
put("Valve7", "阀门7");
put("Valve8", "阀门8");
put("Valve9", "阀门9");
put("Valve10", "阀门10");
put("Valve11", "阀门11");
put("Valve12", "阀门12");
put("Valve13", "阀门13");
put("Valve14", "阀门14");
put("Valve15", "阀门15");
put("Valve16", "阀门16");
put("Valve17", "阀门17");
put("Valve18", "阀门18");
put("Valve19", "阀门19");
put("Valve20", "阀门20");
put("JiaoBan1", "搅拌1");
put("JiaoBan2", "搅拌2");
put("JiaoBan3", "搅拌3");
put("JiaoBan4", "搅拌4");
put("PowerMode", "功率模式");
put("ControlMode", "控制模式");
}
};
/**
* 获取ph值流量压力值
*
* @return
*/
@PostMapping
public AjaxResult insert(@RequestBody MachineParameter machineParameter){
return toAjax(machineParameterService.insert(machineParameter));
@GetMapping("/select")
public MachineParameterVo selectParameter() throws Exception {
return machineParameterService.selectParameter();
}
}

View File

@ -0,0 +1,106 @@
package com.ruoyi.web.controller.crops;
import cn.hutool.core.util.ObjectUtil;
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.security.access.prepost.PreAuthorize;
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(MeteorologicalController.class);
@Value("${Meteorological.url}")
private String url;
@Value("${Meteorological.key}")
private String key;
@Value("${Meteorological.code}")
private String code;
@Autowired
private IMeteorologicalService iMeteorologicalService;
/**
* 查询预警数据
*
* @return
*/
@PreAuthorize("@ss.hasPermi('crops:meterological:select')")
@GetMapping("/meterological")
public AjaxResult selectByTime() {
if (iMeteorologicalService.selectByTime().isEmpty()) {
return AjaxResult.warn("今日暂无数据");
}
return AjaxResult.success(iMeteorologicalService.selectByTime());
}
/**
* 定时查询天气数据并去重保存
*/
@Scheduled(fixedDelay = 60 * 60 * 1000)
public List<Meteorological> MeteorologicalInfo() {
Map<String, Object> map = new HashMap<>();//存放参数
map.put("city_code", code);
map.put("key", key);
//发送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) {
List<Meteorological> list = model.result;
//从数据库查询出今日的预警信息
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.getId() == Integer.parseInt(m.getWarnId()) && me.getTime().equals(m.getTime())) {
list.remove(i);
i--;
}
}
}
if (!list.isEmpty()) {
//list顺序反转
Collections.reverse(list);
logger.info("每小时更新1次天气预警");
iMeteorologicalService.insertBatch(list);
} else {
logger.info("本小时内无新预警");
}
return list;
} else {
logger.info("今日暂无预警");
}
return model.result;
}
}

View File

@ -5,6 +5,7 @@ import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.crops.domain.OperationRecords;
import com.ruoyi.crops.service.IOperationRecordsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@ -20,20 +21,23 @@ public class OperationRecordsController extends BaseController {
/**
* 查询全部记录
*
* @return
*/
@PreAuthorize("@ss.hasPermi('operation:records:list')")
@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

@ -5,12 +5,13 @@ import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.crops.domain.ServiceType;
import com.ruoyi.crops.service.IServiceTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 服务类型controller
* 服务类型Controller
*/
@RestController
@RequestMapping("/service/type")
@ -20,40 +21,48 @@ public class ServiceTypeController extends BaseController {
/**
* 根据类型查询有参
*
* @param type
* @return
*/
@PreAuthorize("@ss.hasPermi('crops:service:type')")
@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
*/
@PreAuthorize("@ss.hasPermi('service:type:selectAll')")
@GetMapping
public List<ServiceType> selectAll(){
public List<ServiceType> selectAll() {
return typeService.selectAll();
}
/**
* 新增单条数据
*
* @param serviceType
* @return
*/
@PreAuthorize("@ss.hasPermi('service:type:insert')")
@PostMapping("insert")
public AjaxResult insert(@RequestBody ServiceType serviceType){
public AjaxResult insert(@RequestBody ServiceType serviceType) {
return toAjax(typeService.insert(serviceType));
}
/**
* 根据数组批量删除数据
*
* @param ids
* @return
*/
@PreAuthorize("@ss.hasPermi('service:type:delete')")
@DeleteMapping("/{ids}")
private AjaxResult remove(@PathVariable Long[] ids){
private AjaxResult remove(@PathVariable Long[] ids) {
return toAjax(typeService.deleteByIds(ids));
}
}

View File

@ -0,0 +1,123 @@
package com.ruoyi.web.controller.crops;
import com.ruoyi.common.config.RuoYiConfig;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.ShapeUtil;
import com.ruoyi.crops.domain.ServiceType;
import com.ruoyi.crops.service.IFarmMachineryService;
import com.ruoyi.crops.service.IGeoServer;
import com.ruoyi.crops.service.IUploadService;
import com.ruoyi.crops.service.IexeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
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.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@RestController
@RequestMapping("/crops")
public class UploadController {
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;
@Autowired
private IFarmMachineryService iFarmMachineryService;
/**
* 上传TIFF文件
*
* @param type 服务类型
* @param file Tiff文件
* @return 文件状态
* @throws Exception
*/
@PostMapping("/upload")
public AjaxResult upload(@RequestParam("type") String type, @RequestParam("file") MultipartFile file) throws Exception {
String uploadPath = RuoYiConfig.getUploadPath();
//保存文件到本地并获得文件路径
String filePath = iUploadService.upload(file, uploadPath+"/tifFile");
//调用接口上传文件到服务器
// 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(filePath);
serviceType.setStyle(type);
//发送地图服务
String pjz = iGeoServer.publishTiff(workSpace, fileName, filePath, type);
//调用exe批量导入数据
String res = iexeService.execCommand(type, targetFile.getAbsolutePath(), boundaryDataPath);
//插入数据库
iGeoServer.insert(serviceType);
return AjaxResult.success(pjz + res);
}
/**
* 上传shp.zip文件
* @param file
* @return
*/
@PostMapping("/uploadShp")
public AjaxResult uploadShp(@RequestParam("file") MultipartFile file){
String uploadPath = RuoYiConfig.getUploadPath();
//保存文件到本地并获得文件路径
String filePath = null;
try {
filePath = iUploadService.upload(file, uploadPath+"/shpFile");
//解压上传的shp.zip文件
String unzip = ShapeUtil.unzip(filePath, uploadPath + "/shpFile/");
return AjaxResult.success(unzip);
} catch (IOException e) {
e.printStackTrace();
return AjaxResult.error(e.getMessage());
}
}
}

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.boot.context.properties.ConfigurationProperties;
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(UserInfoController.class);
@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,76 @@ package com.ruoyi.web.controller.crops;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.utils.DateUtil;
import com.ruoyi.crops.domain.DeviceSense;
import com.ruoyi.crops.domain.WaringNumber;
import com.ruoyi.crops.domain.WarningInformation;
import com.ruoyi.crops.service.IDeviceSenseService;
import com.ruoyi.crops.service.IWarningService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import java.util.Date;
import java.util.List;
/**
* 预警信息controller
* 预警信息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);
@PreAuthorize("@ss.hasPermi('warning:information:selectByTime')")
@GetMapping("/selectByTime")
public TableDataInfo selectBytTime(@RequestParam(required = false) Date startTime,
@RequestParam(required = false) Date endTime) {
startPage();
List<WarningInformation> list = iWarningService.selectByTime(startTime, endTime);
return getDataTable(list);
}
/**
* 新增单条数据
*
* @param warningInformation
* @return
*/
@PostMapping
public AjaxResult insert(@RequestBody WarningInformation warningInformation){
public AjaxResult insert(@RequestBody WarningInformation warningInformation) {
return toAjax(iWarningService.insert(warningInformation));
}
/**
* 大棚预警次数查询
*
* @return
*/
@PreAuthorize("@ss.hasPermi('warning:information:numberOfTimes')")
@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

@ -0,0 +1,111 @@
package com.ruoyi.web.controller.crops;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.utils.DateUtil;
import com.ruoyi.crops.domain.MachineryTrajectory;
import com.ruoyi.crops.domain.WaringNumber;
import com.ruoyi.crops.domain.WarningFarm;
import com.ruoyi.crops.domain.vo.FarmMachineryVo;
import com.ruoyi.crops.service.IFarmMachineryService;
import com.ruoyi.crops.service.IWarningFarmService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.web.bind.annotation.*;
import java.util.Date;
import java.util.List;
@RestController
@RequestMapping("/warning/farm")
public class WarningFarmController extends BaseController {
@Autowired
private IFarmMachineryService iFarmMachineryService;
@Autowired
private IWarningFarmService iWarningFarmService;
private static final Logger logger = LoggerFactory.getLogger(WarningFarmController.class);
/**
* 农机预警次数查询
* @return
*/
@GetMapping("/numberOfTimes")
public AjaxResult numberOfTimes() {
List<WarningFarm> daylist = iWarningFarmService.selectByTime(DateUtil.getDayBegin(), DateUtil.getDayEnd());
int dayNumber = daylist.size();
List<WarningFarm> weeklist = iWarningFarmService.selectByTime(DateUtil.getBeginDayOfWeek(), DateUtil.getEndDayOfWeek());
int weekNumber = weeklist.size();
List<WarningFarm> monthlist = iWarningFarmService.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);
}
/**
* 农机预警信息根据时间查询
* @param startTime
* @param endTime
* @return
*/
@GetMapping("/selectByTime")
public TableDataInfo selectBytTime(@RequestParam(required = false) Date startTime,
@RequestParam(required = false) Date endTime) {
startPage();
List<WarningFarm> list = iWarningFarmService.selectByTime(startTime, endTime);
return getDataTable(list);
}
//判断农机预警
@Scheduled(fixedDelay = 5 * 60 * 1000)
public void warning() {
//查询今日作业农机编号
List<String> vehiclenoList = iFarmMachineryService.distinctVehicleno();
//根据编号查询作业地块
for (String vehicleno : vehiclenoList) {
List<String> workplaceList = iFarmMachineryService.distinctWorkplace(vehicleno);
Date lastTime = null;
//根据地块查询具体作业数据
for (String workplace : workplaceList) {
Date date = new Date(2023 - 1900, 3 - 1, 13);
//根据作业地块和时间查询农机轨迹数据
List<MachineryTrajectory> machineryTrajectories = iFarmMachineryService.selectVehicleTrack(workplace, date);
MachineryTrajectory trajectory = machineryTrajectories.get(0);
Date lastPttime = machineryTrajectories.get(machineryTrajectories.size() - 1).getPttime();
//农机此次作业时长
float workingHours = Float.parseFloat(DateUtil.dateDiffHours(trajectory.getPttime(), lastPttime));
WarningFarm warningFarm = new WarningFarm();
warningFarm.setVehicleno(vehicleno);
warningFarm.setTime(new Date());
FarmMachineryVo farmMachineryVos = iFarmMachineryService.selectMachineryData(vehicleno);
warningFarm.setOwnername(farmMachineryVos.getOwnername());
if (lastTime != null) {
float freeTime = Float.parseFloat(DateUtil.dateDiffHours(lastTime, trajectory.getPttime()));
if (freeTime > 0.1) {
//插入数据库预警
warningFarm.setWarningInfo("闲置时间过长");
iWarningFarmService.insertWarning(warningFarm);
logger.info("农机闲置时间预警更新:" + vehicleno +"-"+ freeTime + "小时");
}
}
lastTime = machineryTrajectories.get(machineryTrajectories.size() - 1).getPttime();
if (workingHours > 0.5) {
//预警
warningFarm.setWarningInfo("作业时间过长");
iWarningFarmService.insertWarning(warningFarm);
logger.info("农机作业时间预警更新:" + vehicleno +"-"+ workingHours + "小时");
}
}
}
}
}

View File

@ -0,0 +1,94 @@
package com.ruoyi.web.controller.crops;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.crops.domain.WeatherPredictionEntity;
import com.ruoyi.crops.domain.vo.WeatherPredoctionVo;
import com.ruoyi.crops.service.IWeatherPredictionService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.Date;
import java.util.List;
@RestController
@RequestMapping("/crops/weather")
public class WeatherPredictionController extends BaseController {
@Autowired
private IWeatherPredictionService iWeatherPredictionService;
private static final Logger logger = LoggerFactory.getLogger(WeatherPredictionController.class);
/**
* 查询一周的天气数据
*
* @return
*/
@PreAuthorize("@ss.hasPermi('crops:weather:selectWeek')")
@GetMapping("/selectWeek")
public List<WeatherPredictionEntity> selectWeek() {
return iWeatherPredictionService.selectWeek();
}
/**
* 气象数据对比查询
*
* @param time1
* @param time2
* @return
*/
@PreAuthorize("@ss.hasPermi('crops:weather:compareTime')")
@GetMapping("/compareTime")
public List<WeatherPredoctionVo> compareTime(@RequestParam Date time1, @RequestParam Date time2) {
List<WeatherPredoctionVo> weather1 = iWeatherPredictionService.selectByTime(time1);
List<WeatherPredoctionVo> weather2 = iWeatherPredictionService.selectByTime(time2);
for (WeatherPredoctionVo weatherPredoctopnVo : weather1) {
if (weatherPredoctopnVo != null) {
weatherPredoctopnVo.setWeatherTime(time1);
String windSpeed = String.format("%.2f", Double.parseDouble(weatherPredoctopnVo.getWindSpeed()));
String precipitation = String.format("%.2f", Double.parseDouble(weatherPredoctopnVo.getPrecipitation()));
weatherPredoctopnVo.setWindSpeed(windSpeed);
weatherPredoctopnVo.setPrecipitation(precipitation);
}
}
for (WeatherPredoctionVo weatherPredoctopnVo : weather2) {
if (weatherPredoctopnVo != null) {
weatherPredoctopnVo.setWeatherTime(time2);
String windSpeed = String.format("%.2f", Double.parseDouble(weatherPredoctopnVo.getWindSpeed()));
String precipitation = String.format("%.2f", Double.parseDouble(weatherPredoctopnVo.getPrecipitation()));
weatherPredoctopnVo.setWindSpeed(windSpeed);
weatherPredoctopnVo.setPrecipitation(precipitation);
}
}
List<WeatherPredoctionVo> list = new ArrayList<>();
list.addAll(weather1);
list.addAll(weather2);
return list;
}
/**
* 定时查询更新天气数据
*
* @throws IOException
*/
// @Scheduled(cron = "0 0 8,12,20 * * ?")
@Scheduled(fixedDelay = 60 * 60 * 1000)
public List<WeatherPredictionEntity> getWeather() throws IOException {
List<WeatherPredictionEntity> weatherList = iWeatherPredictionService.getWeather();
iWeatherPredictionService.insertBatch(weatherList);
logger.info("每小时更新博兴天气数据");
return weatherList;
}
}

View File

@ -17,7 +17,7 @@ import java.util.List;
/**
* 生产厂家信息Controller
*
*
* @author my
* @date 2023-04-18
*/

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,28 @@ 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'
machine: 'http://api.nonghaiiot.com/api/device/getFertigationProperty.zzdy'
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'
code: '150700'
FarmMachinery:
vehicleList: 'https://www.amtiot.cn/amapi/jzzy/VehicleList/query'
vehiclePos: 'https://www.amtiot.cn/amapi/jzzy/VehiclePos/query'
vehicleTrack: 'https://www.amtiot.cn/amapi/jzzy/VehicleTrack/query'
vehicleJobData: 'https://www.amtiot.cn/amapi/jzzy/VehicleJobData/query'
clienttoken: 'Ts7kePaCiWg+VRMrDkbdFnsY3TX0OaYckpC3eMV0Rvu01cuP9xeSBxbJYR5DnXUn1injVF36EopkBCiXYqteGpz1U/RpD2xs1vNoRenHE7tIPL0FK9gRTeLQCJm+d1AcH6uQBEmG+YiDrvanBSTnzdu2O61ZENEu4LZVQPZNsOENQfB8CRGvk1y9BKdf9uTj4d8Oaxwq4kpHegQSHReR9nylunAO1dN7NuX1mSzZ0sSyNcf43Nsrl/EMAJmA2V5lu2aSPZ455wmCbC7n2BSydRQp76thforrYM4SMKQ2i7u215e9S/A9Ll5syzyykwnkVlk2vfy9+U3fgG5ySeu6ITvkaLrk8tw3pI/sSWlajR9vyluJXmUlvgFeXfjSlcL6XfQcoSc5LaERZhn9e0GIczfpNDGrjvQgFgWB3E0y6WH5vU3Lr5AofbDnMceuY7wYefVcOtr+EOTB7f2p8aCPxZXWkSiN+WFWpuzLXCOkr1shAgMfGFARxHN/Zp8ABgc3aweVO29BFiv7PGgEc7mJ/w'

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>

Binary file not shown.

Binary file not shown.

View File

@ -0,0 +1 @@
GEOGCS["WGS 84", DATUM["World Geodetic System 1984", SPHEROID["WGS 84", 6378137.0, 298.257223563, AUTHORITY["EPSG","7030"]], AUTHORITY["EPSG","6326"]], PRIMEM["Greenwich", 0.0, AUTHORITY["EPSG","8901"]], UNIT["degree", 0.017453292519943295], AXIS["Geodetic longitude", EAST], AXIS["Geodetic latitude", NORTH], AUTHORITY["EPSG","4326"]]

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,21 +1,100 @@
package com.ruoyi.web;
import com.ruoyi.pill.domain.PillFactory;
import com.ruoyi.pill.service.IPillFactoryService;
import com.ruoyi.common.utils.ShapeUtil;
import com.ruoyi.crops.domain.WarningFarm;
import com.ruoyi.crops.service.*;
import org.geotools.geometry.jts.JTSFactoryFinder;
import org.junit.jupiter.api.Test;
import org.locationtech.jts.geom.Geometry;
import org.locationtech.jts.io.ParseException;
import org.locationtech.jts.io.WKTReader;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.test.context.SpringBootTest;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@SpringBootTest
public class PssTest {
@Value("${url.machine}")
private String url;
@Autowired
private IPillFactoryService IpillFactoryService;
private IWeatherPredictionService iWeatherPredictionService;
@Autowired
private IDataAcquisitionService iDataAcquisitionService;
@Autowired
private IMapDrawPolygonService iMapDrawPolygonService;
@Autowired
private IFarmMachineryService iFarmMachineryService;
@Autowired
private IWarningFarmService iWarningFarmService;
@Test
public void testSelectFactory(){
PillFactory pillFactory = new PillFactory();
pillFactory.setFactoryName("云南");
IpillFactoryService.selectPillFactoryList(pillFactory);
public void test() throws Exception {
// List<WeatherPredictionEntity> weatherPredictionEntities = weatherPredictionMapper.selectWeek();
// WeatherPredictionEntity weatherPredictionEntity = weatherPredictionEntities.get(0);
// String airTemperature = weatherPredictionEntity.getAirTemperature();
// for(int i = 0 ;i< arr.length -1; i++){
// for(int j = 0; j<arr.length-1-i; j++){
// if(arr[j]>arr[j+1]){
// temp = arr[j];
// arr[j] = arr[j+1];
// arr[j+1] = temp;
// }
// }
// }
}
@Test
public void test5() throws ParseException {
// List<WeatherPredictionEntity> weatherPredoction = iWeatherPredictionService.select(new SimpleDateFormat("yyyy-MM-dd").parse("2023-05-22"));
// weatherPredoction.sort(Comparator.comparing(WeatherPredictionEntity::getAirTemperature));
// String maxAirTemperature = weatherPredoction.get(0).getAirTemperature();
// String minAirTemperature = weatherPredoction.get(weatherPredoction.size()-1).getAirTemperature();
//比较器排序后的集合
// Comparator<WeatherPredictionEntity> comparing = Comparator.comparing(WeatherPredictionEntity::getAirTemperature);
// Comparator<WeatherPredictionEntity> humidity = Comparator.comparing(WeatherPredictionEntity::getHumidity);
// Comparator<WeatherPredictionEntity> windSpeed = Comparator.comparing(WeatherPredictionEntity::getWindSpeed);
// String maxAirTemperature = weatherPredoction.stream().max(comparing).get().getAirTemperature();
// String minAirTemperature = weatherPredoction.stream().min(comparing).get().getAirTemperature();
// String maxHumidity = weatherPredoction.stream().max(humidity).get().getHumidity();
// String minHumidity = weatherPredoction.stream().min(humidity).get().getHumidity();
// String awindSpeed = weatherPredoction.stream().(humidity).get().getWindSpeed();
//
// System.out.println(maxAirTemperature);
// System.out.println(minAirTemperature);
// System.out.println(maxHumidity);
// System.out.println(minHumidity);
}
public static void main(String[] args) throws Exception {
// String wkt = "MULTIPOLYGON ((30 20, 45 40, 10 40, 30 20), (15 5, 40 10, 10 20, 5 10, 15 5))";
// ShapeUtil.writeShape(wkt,"MultiPolygon","D:\\ruoyi\\uploadPath\\upload\\shpFile\\lineString.shp");
//读取shp文件
//
// List list = ShapeUtil.readShp("D:\\ruoyi\\uploadPath\\upload\\shpFile\\2023-06-25polygon.shp");
// Map<String,String> map =(Map) list.get(0);
// String wkt = map.get("wkt");
// System.out.println(wkt);
//
// WKTReader wktReader = new WKTReader();
// Geometry geometry = wktReader.read(wkt);
// test(geometry);
// ShapeUtil.unzip("", "");
}
}

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,46 @@
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
<dependency>
<groupId>org.locationtech.jts</groupId>
<artifactId>jts-core</artifactId>
<version>1.16.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-shapefile</artifactId>
<version>20.5</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.geotools</groupId>
<artifactId>gt-geojson</artifactId>
<version>20.5</version>
<scope>compile</scope>
</dependency>
</dependencies>
<repositories>
<repository>
<id>osgeo</id>
<name>OSGeo Release Repository</name>
<url>https://repo.osgeo.org/repository/release/</url>
<snapshots><enabled>false</enabled></snapshots>
<releases><enabled>true</enabled></releases>
</repository>
<repository>
<id>osgeo-snapshot</id>
<name>OSGeo Snapshot Repository</name>
<url>https://repo.osgeo.org/repository/snapshot/</url>
<snapshots><enabled>true</enabled></snapshots>
<releases><enabled>false</enabled></releases>
</repository>
</project>
</repositories>
</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,395 @@
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();
}
//获取七天前的开始时间
public static Date getBeginDayOf7day() {
Calendar cal = new GregorianCalendar();
cal.setTime(getDayBegin());
cal.add(Calendar.DAY_OF_MONTH, -7);
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 String dateDiffHours(Date beginDate,Date endDate){
long nd = 1000 * 24 * 60 * 60;
float nh = 1000 * 60 * 60;
long nm = 1000 * 60;
// long ns = 1000;
// 获得两个时间的毫秒时间差异
float diff = endDate.getTime() - beginDate.getTime();
// 计算差多少天
// long day = diff / nd;
// 计算差多少小时
// float hour = diff % nd / nh;
float hour = diff / nh;
String fhour = String.format("%.2f", hour);
// 计算差多少分钟
// long min = diff % nd % nh / nm;
// 计算差多少秒//输出结果
// long sec = diff % nd % nh % nm / ns;
// return day + "" + hour + "小时" + min + "分钟";
return fhour;
}
// 获取两个日期中的最大日期
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

@ -0,0 +1,38 @@
package com.ruoyi.common.utils;
public class MyPoint {
private double x;
private double y;
public double getX() {
return x;
}
public void setX(double x) {
this.x = x;
}
public double getY() {
return y;
}
public void setY(double y) {
this.y = y;
}
public MyPoint() {
}
public MyPoint(double x, double y) {
this.x = x;
this.y = y;
}
@Override
public String toString() {
return "MyPoint{" +
"x=" + x +
", y=" + y +
'}';
}
}

View File

@ -0,0 +1,414 @@
package com.ruoyi.common.utils;
import java.io.*;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.util.*;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
import java.util.zip.ZipOutputStream;
import org.geotools.data.DefaultTransaction;
import org.geotools.data.FileDataStore;
import org.geotools.data.FileDataStoreFinder;
import org.geotools.data.Transaction;
import org.geotools.data.shapefile.ShapefileDataStore;
import org.geotools.data.shapefile.ShapefileDataStoreFactory;
import org.geotools.data.simple.SimpleFeatureCollection;
import org.geotools.data.simple.SimpleFeatureIterator;
import org.geotools.data.simple.SimpleFeatureSource;
import org.geotools.data.simple.SimpleFeatureStore;
import org.geotools.feature.DefaultFeatureCollection;
import org.geotools.feature.simple.SimpleFeatureBuilder;
import org.geotools.feature.simple.SimpleFeatureTypeBuilder;
import org.geotools.geometry.jts.JTS;
import org.geotools.geometry.jts.JTSFactoryFinder;
import org.geotools.referencing.CRS;
import org.locationtech.jts.geom.*;
import org.locationtech.jts.io.ParseException;
import org.locationtech.jts.io.WKTReader;
import org.opengis.feature.Property;
import org.opengis.feature.simple.SimpleFeature;
import org.opengis.feature.simple.SimpleFeatureType;
import org.opengis.referencing.FactoryException;
import org.opengis.referencing.crs.CoordinateReferenceSystem;
import org.opengis.referencing.operation.MathTransform;
import org.opengis.referencing.operation.TransformException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class ShapeUtil {
private static final Logger logger = LoggerFactory.getLogger("ShapeUtil.class");
static class polygonPoint {
public double x;
public double y;
public polygonPoint(double x, double y) {
this.x = x;
this.y = y;
}
}
/**
* 生成shp文件
* @param wkt wkt格式 经纬度必须首尾相连
* @throws IOException
* @throws FactoryException
*/
public static String writeShape(String wkt,String geoType,String targetPath,List userdata) throws Exception {
SimpleFeatureTypeBuilder builder = new SimpleFeatureTypeBuilder();
builder.setName("Feature");
/**
* //方式一
* CRS.decode("EPSG:4326");
* //方式二
* DefaultGeographicCRS.WGS84;
*
* EPSG:4490为大地坐标系_国家2000大地坐标系CGCS2000
* EPSG:4326支持一种默认的定义方式, 坐标系WGS84
*/
// builder.setCRS(DefaultGeographicCRS.WGS84);
builder.setCRS(CRS.decode("EPSG:4326"));
//农机编号
builder.add("vehicleno", String.class);
//作业地块
builder.add("workplace", String.class);
//作业类型
builder.add("jobtype", String.class);
if ("Polygon".equals(geoType) || "polygon".equals(geoType)) {
builder.add("the_geom", Polygon.class);
} else if ("MultiPolygon".equals(geoType)) {
builder.add("the_geom", MultiPolygon.class);
} else if ("Point".equals(geoType) || "point".equals(geoType)) {
builder.add("the_geom", Point.class);
} else if ("MultiPoint".equals(geoType)) {
builder.add("the_geom", MultiPoint.class);
} else if ("LineString".equals(geoType)) {
builder.add("the_geom", LineString.class);
} else if ("MultiLineString".equals(geoType) || "Polyline".equals(geoType) || "polyline".equals(geoType)) {
builder.add("the_geom", MultiLineString.class);
} else {
throw new Exception("Geometry中没有该类型" + geoType);
}
SimpleFeatureType featureType = builder.buildFeatureType();
// DefaultFeatureCollection collection = new DefaultFeatureCollection();
GeometryFactory geometryFactory = JTSFactoryFinder.getGeometryFactory(null);
// SimpleFeature feature = (SimpleFeature) toFeature(wkt, featureType, geometryFactory,geoType);
DefaultFeatureCollection collection = toFeature(wkt, featureType, geometryFactory, geoType,userdata);
// collection.add(feature);
// collection.forEach(name -> System.out.println(name));
// File shapeFile = new File(new File("").getAbsolutePath() +
// "\\ruoyi-admin\\src\\main\\resources\\shp\\shapefile.shp");
File shapeFile = new File(targetPath);
// String fileName = RuoYiConfig.getUploadPath() + "/shpFile/" + LocalDate.now() + "shapefile.shp";
// File shapeFile = new File(fileName);
Map<String, Serializable> params = new HashMap<>();
params.put("url", shapeFile.toURI().toURL());
params.put("create spatial index", Boolean.TRUE);
ShapefileDataStoreFactory dataStoreFactory = new ShapefileDataStoreFactory();
ShapefileDataStore dataStore = (ShapefileDataStore) dataStoreFactory.createNewDataStore(params);
// dataStore.setCharset(StandardCharsets.UTF_8);
dataStore.createSchema(featureType);
Transaction transaction = new DefaultTransaction("create");
String typeName = dataStore.getTypeNames()[0];
SimpleFeatureSource featureSource = dataStore.getFeatureSource(typeName);
if (featureSource instanceof SimpleFeatureStore) {
SimpleFeatureStore featureStore = (SimpleFeatureStore) featureSource;
featureStore.setTransaction(transaction);
try {
featureStore.addFeatures(collection);
transaction.commit();
zipShapeFile(shapeFile.getPath());
} catch (Exception problem) {
transaction.rollback();
} finally {
transaction.close();
}
}
logger.info("生成shp文件成功"+shapeFile.getAbsolutePath());
return shapeFile.getAbsolutePath();
}
/**
* 创建要素
*
* @param wkt
* @param featureType
* @param geometryFactory
* @return
*/
public static DefaultFeatureCollection toFeature(String wkt, SimpleFeatureType featureType,
GeometryFactory geometryFactory, String geoType,List userdata) throws Exception {
//通过坐标对象Coordinate创建
// Coordinate[] coords = new Coordinate[locations.size()];
// int i = 0;
// for (MyPoint location : locations) {
// Coordinate coord = new Coordinate(location.getX(), location.getY(), 0);
// coords[i] = (coord);
// i++;
// }
// Polygon polygon = geometryFactory.createPolygon(coords);
//通过WKT创建
WKTReader reader = new WKTReader(geometryFactory);
SimpleFeatureBuilder featureBuilder = new SimpleFeatureBuilder(featureType);
DefaultFeatureCollection featureCollection = new DefaultFeatureCollection();
if ("Polygon".equals(geoType) || "polygon".equals(geoType)) {
Polygon polygon = (Polygon) reader.read(wkt);
featureBuilder.add(polygon);
} else if ("MultiPolygon".equals(geoType)) {
MultiPolygon multiPolygon = (MultiPolygon) reader.read(wkt);
int index = -1;
for (int i = 0; i < multiPolygon.getNumGeometries(); i++) {
Polygon polygon = (Polygon) multiPolygon.getGeometryN(i);
featureBuilder.add(userdata.get(++index));
featureBuilder.add(userdata.get(++index));
featureBuilder.add(userdata.get(++index));
featureBuilder.add(polygon);
SimpleFeature feature = featureBuilder.buildFeature(null);
featureCollection.add(feature);
}
return featureCollection;
} else if ("Point".equals(geoType) || "point".equals(geoType)) {
Point point = (Point) reader.read(wkt);
featureBuilder.add(point);
} else if ("MultiPoint".equals(geoType)) {
MultiPoint multiPoint = (MultiPoint) reader.read(wkt);
featureBuilder.add(multiPoint);
} else if ("LineString".equals(geoType)) {
LineString lineString = (LineString) reader.read(wkt);
featureBuilder.add(lineString);
} else if ("MultiLineString".equals(geoType) || "Polyline".equals(geoType) || "polyline".equals(geoType)) {
MultiLineString multiLineString = (MultiLineString) reader.read(wkt);
int index = -1;
for (int i = 0; i < multiLineString.getNumGeometries(); i++) {
LineString lineString = (LineString) multiLineString.getGeometryN(i);
featureBuilder.add(userdata.get(++index));
featureBuilder.add(userdata.get(++index));
featureBuilder.add(userdata.get(++index));
featureBuilder.add(lineString);
SimpleFeature feature = featureBuilder.buildFeature(null);
featureCollection.add(feature);
}
return featureCollection;
} else {
throw new Exception("Geometry中没有该类型" + geoType);
}
featureCollection.add(featureBuilder.buildFeature(null));
return featureCollection;
}
/**
* 读取shp文件
* @param shpPath
* @return
* @throws IOException
*/
public static List<Map<String, Object>> readShp(String shpPath) throws IOException {
//加载文件
File file = new File(shpPath);
if (file == null) {
return null;
}
//map记录shapefile key-value数据
List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
//通过store获取featurecollection
FileDataStore store = FileDataStoreFinder.getDataStore(file);
SimpleFeatureSource featureSource = store.getFeatureSource();
SimpleFeatureCollection simpleFeatureCollection = featureSource.getFeatures();
SimpleFeatureIterator itertor = simpleFeatureCollection.features();
//遍历featurecollection
while (itertor.hasNext()) {
Map<String, Object> data = new HashMap<>();
SimpleFeature feature = itertor.next();
Collection<Property> p = feature.getProperties();
Iterator<Property> it = p.iterator();
//遍历feature的properties
while (it.hasNext()) {
Property pro = it.next();
String field = pro.getName().toString();
String value = pro.getValue().toString();
field = field.equals("the_geom") ? "wkt" : field;
byte[] bytes = value.getBytes("iso8859-1");
value = new String(bytes, "gbk");
data.put(field, value);
}
list.add(data);
}
itertor.close();
return list;
}
/**
* 根据wkt计算多边形面积
* @param wkt 待计算wkt
* @return 面积数据
*/
public static double getAreaByWkt(String wkt){
Geometry geometry ;
WKTReader reader = new WKTReader();
try {
geometry = reader.read(wkt);
} catch (ParseException e) {
geometry = null;
e.printStackTrace();
}
return getArea(geometry);
}
/**
* 根据多边形类型计算出多边形面积单位平方米
* @param geometry 多边形对象
* @return 面积
*/
public static double getArea(Geometry geometry){
CoordinateReferenceSystem source = null;
try {
// WGS84(一般项目中常用的是CSR:84和EPSG:4326)
source = CRS.decode("EPSG:4326");
} catch (FactoryException e) {
e.printStackTrace();
}
CoordinateReferenceSystem target = null;
try {
target = CRS.decode("EPSG:3857");
// target = CRS.decode("EPSG:3005");
} catch (FactoryException e) {
e.printStackTrace();
}
MathTransform transform = null;
try {
transform = CRS.findMathTransform(source, target, true);
} catch (FactoryException e) {
e.printStackTrace();
}
Geometry transform1 = null;
try {
transform1 = JTS.transform(geometry, transform);
} catch (TransformException e) {
e.printStackTrace();
}
double area = transform1.getArea();
//周长
double length = transform1.getLength();
return area;
}
/**
* 压缩shape文件
*
* @param shpPath shape文件路径包含shape文件名称
*/
public static void zipShapeFile(String shpPath) {
try {
File shpFile = new File(shpPath);
String shpRoot = shpFile.getParentFile().getPath();
String shpName = shpFile.getName().substring(0, shpFile.getName().lastIndexOf("."));
String zipPath = shpRoot + File.separator + shpName + ".zip";
File zipFile = new File(zipPath);
InputStream input = null;
ZipOutputStream zipOut = new ZipOutputStream(new FileOutputStream(zipFile));
// zip的名称为
zipOut.setComment(shpName);
String[] shpFiles = new String[]{
shpRoot + File.separator + shpName + ".dbf",
shpRoot + File.separator + shpName + ".prj",
shpRoot + File.separator + shpName + ".shp",
shpRoot + File.separator + shpName + ".shx",
shpRoot + File.separator + shpName + ".fix"
};
for (int i = 0; i < shpFiles.length; i++) {
File file = new File(shpFiles[i]);
input = new FileInputStream(file);
zipOut.putNextEntry(new ZipEntry(file.getName()));
int temp = 0;
while ((temp = input.read()) != -1) {
zipOut.write(temp);
}
input.close();
}
zipOut.close();
} catch (Exception e) {
e.printStackTrace();
}
}
/**
*文件解压缩
* @param zipfile 要解压缩的zip文件
* @param destpath 解压后文件所放的目录需要"D:\\""D:\\test\"格式
* @throws FileNotFoundException
* @throws IOException
*/
public static String unzip(String zipfile, String destpath) throws IOException {
try {
File zipFile = new File(zipfile);
if (!zipFile.exists()) {
throw new IOException("要解压的压缩文件不存在");
}
File pathFile = new File(destpath);
if (!pathFile.exists()) {
pathFile.mkdirs();
}
FileInputStream fis = new FileInputStream(zipfile);
ZipInputStream zis = new ZipInputStream(fis);
ZipEntry z1 = null;
while ((z1 = zis.getNextEntry()) != null) {
if (z1.isDirectory()) {
File f = new File("D:\\" + z1.getName());
f.mkdirs();
} else {
String fileName = z1.getName();
FileOutputStream fos = new FileOutputStream(destpath + fileName);
int tmp = -1;
while ((tmp = zis.read()) != -1) {
/*写入到目标文件中*/
fos.write(tmp);
}
zis.closeEntry();
fos.close();
}
}
zis.close();
} catch (Exception e) {
throw new IOException(e);
}
return "解压成功!文件路径:"+destpath;
}
//将经纬度数组转换为wkt格式
public static String point2WktPolygon(List<MyPoint> points) {
StringBuilder sb = new StringBuilder("POLYGON((");
for (MyPoint point : points) {
sb.append(point.getX()).append(" ").append(point.getY()).append(",");
}
sb.append(points.get(0).getX()).append(" ").append(points.get(0).getY()).append("))");
return sb.toString();
}
public static String point2WktLine(List<MyPoint> points) {
StringBuilder sb = new StringBuilder("LINESTRING(");
for (MyPoint point : points) {
sb.append(point.getX()).append(" ").append(point.getY()).append(", ");
}
sb.append(points.get(0).getX()).append(" ").append(points.get(0).getY()).append(")");
return sb.toString();
}
}

View File

@ -25,6 +25,32 @@
<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>
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.16.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>javax.persistence</groupId>
<artifactId>persistence-api</artifactId>
<version>1.0.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>6.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
<properties>

View File

@ -14,7 +14,7 @@ import com.ruoyi.common.core.domain.BaseEntity;
* @author my
* @date 2023-04-20
*/
public class CropsComprehensiveData extends BaseEntity
public class CropsComprehensiveData
{
private static final long serialVersionUID = 1L;
@ -22,83 +22,65 @@ public class CropsComprehensiveData extends BaseEntity
private Long id;
/** 镇耕地面积(万亩) */
@Excel(name = "镇耕地面积(万亩)")
private Float cultivatedArea;
/** 粮食总产(万吨) */
@Excel(name = "粮食总产(万吨)")
private Float foodstuffProduction;
/** 蔬菜种植面积(亩) */
@Excel(name = "蔬菜种植面积(亩)")
private Long vegetablePlantingArea;
/** 蔬菜总产(吨) */
@Excel(name = "蔬菜总产(吨)")
private Long vegetableProduction;
/** 农产品种类 */
@Excel(name = "农产品种类")
private Long type;
/** 农产品种植面积(亩) */
@Excel(name = "农产品种植面积(亩)")
private Long agriculturalPlantingArea;
/** 特色农业总产量(吨) */
@Excel(name = "特色农业总产量(吨)")
private Long agricultureProduction;
/** 特色农业年产值(万元) */
@Excel(name = "特色农业年产值(万元)")
private Long agricultureOutputVaule;
/** 总人口(人) */
@Excel(name = "总人口(人)")
private Long totalPopulation;
/** 占地面积(平方公里) */
@Excel(name = "占地面积(平方公里)")
private Float coverArea;
/** 示范大棚数量(个) */
@Excel(name = "示范大棚数量(个)")
private Long exampleGreenhouse;
/** 村居数量(个) */
@Excel(name = "村居数量(个)")
private Long rusticate;
/** 联合社耕地面积(万亩) */
@Excel(name = "联合社耕地面积(万亩)")
private Float cultivatedAlly;
/** 大棚数量(个) */
@Excel(name = "大棚数量(个)")
private Long greenhouse;
/** 农产品产值(万元) */
@Excel(name = "农产品产值(万元)")
private Long outputValue;
/** 庞家镇矢量边界 */
@Excel(name = "庞家镇矢量边界")
private String vectorBoundary;
/** 庞家镇村庄矢量边界 */
@Excel(name = "庞家镇村庄矢量边界")
private String villageVectorBoundary;
/** 图片 */
private String img;
/** 创建人 */
@Excel(name = "创建人")
private String createdBy;
/** 创建时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date createdTime;
public void setId(Long id)

View File

@ -0,0 +1,123 @@
package com.ruoyi.crops.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import javax.persistence.*;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import java.io.Serializable;
import java.util.Date;
/**
* 用户表;
* @author : http://www.chiner.pro
* @date : 2023-5-19
*/
@Entity
@Table(name = "crops_user")
public class CropsUser implements Serializable{
/** id */
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "crops_user_seq_gen")
@SequenceGenerator(name = "crops_user_seq_gen", sequenceName = "crops_user_seq")
private Integer id ;
/** 用户名 */
@NotNull()
private String userName ;
/** 密码 */
@JsonInclude(JsonInclude.Include.NON_EMPTY)
@NotBlank(message = "密码不能为空")
private String password ;
/** 联系方式 */
@Pattern(regexp = "1[3457][0-9]{9}",message = "请输入正确的手机号")
@NotBlank(message = "手机号不能为空")
private String phone ;
/** 角色 */
private String role ;
/** 创建时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private Date creatTime ;
/** 备注 */
private String remark ;
/** 帐号状态0正常 1停用 */
private Integer status ;
/** 删除标志0存在 1删除 */
@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
private Integer delFlag ;
/** id */
public Integer getId(){
return this.id;
}
/** id */
public void setId(Integer id){
this.id=id;
}
/** 用户名 */
public String getUserName(){
return this.userName;
}
/** 用户名 */
public void setUserName(String userName){
this.userName=userName;
}
/** 密码 */
public String getPassword(){
return this.password;
}
/** 密码 */
public void setPassword(String password){
this.password=password;
}
/** 联系方式 */
public String getPhone(){
return this.phone;
}
/** 联系方式 */
public void setPhone(String phone){
this.phone=phone;
}
/** 角色 */
public String getRole(){
return this.role;
}
/** 角色 */
public void setRole(String role){
this.role=role;
}
/** 创建时间 */
public Date getCreatTime(){
return this.creatTime;
}
/** 创建时间 */
public void setCreatTime(Date creatTime){
this.creatTime=creatTime;
}
/** 备注 */
public String getRemark(){
return this.remark;
}
/** 备注 */
public void setRemark(String remark){
this.remark=remark;
}
/** 帐号状态0正常 1停用 */
public Integer getStatus(){
return this.status;
}
/** 帐号状态0正常 1停用 */
public void setStatus(Integer status){
this.status=status;
}
/** 删除标志0存在 1删除 */
public Integer getDelFlag(){
return this.delFlag;
}
/** 删除标志0存在 1删除 */
public void setDelFlag(Integer delFlag){
this.delFlag=delFlag;
}
}

View File

@ -0,0 +1,113 @@
package com.ruoyi.crops.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.Date;
/**
* 数据采集表;
* @author : http://www.chiner.pro
* @date : 2023-5-23
*/
public class DataAcquisition{
/** id */
@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
private Integer id ;
/** 影像数据条数 */
private Integer imageData ;
/** 影像数据总量 */
private Float imageDataTotal ;
/** 无人机数据条数 */
private Integer droneData ;
/** 无人机数据总量 */
private Float droneDataTotal ;
/** 传感器数据条数 */
private Integer sensorData ;
/** 传感器数据总量 */
private Float sensorDataTotal ;
/** 时间 */
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")//接收时间类型
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")//返回时间类型
private Date time ;
/** id */
public Integer getId(){
return this.id;
}
/** id */
public void setId(Integer id){
this.id=id;
}
/** 影像数据条数 */
public Integer getImageData(){
return this.imageData;
}
/** 影像数据条数 */
public void setImageData(Integer imageData){
this.imageData=imageData;
}
/** 影像数据总量 */
public Float getImageDataTotal(){
return this.imageDataTotal;
}
/** 影像数据总量 */
public void setImageDataTotal(Float imageDataTotal){
this.imageDataTotal=imageDataTotal;
}
/** 无人机数据条数 */
public Integer getDroneData(){
return this.droneData;
}
/** 无人机数据条数 */
public void setDroneData(Integer droneData){
this.droneData=droneData;
}
/** 无人机数据总量 */
public Float getDroneDataTotal(){
return this.droneDataTotal;
}
/** 无人机数据总量 */
public void setDroneDataTotal(Float droneDataTotal){
this.droneDataTotal=droneDataTotal;
}
/** 传感器数据条数 */
public Integer getSensorData(){
return this.sensorData;
}
/** 传感器数据条数 */
public void setSensorData(Integer sensorData){
this.sensorData=sensorData;
}
/** 传感器数据总量 */
public Float getSensorDataTotal(){
return this.sensorDataTotal;
}
/** 传感器数据总量 */
public void setSensorDataTotal(Float sensorDataTotal){
this.sensorDataTotal=sensorDataTotal;
}
/** 时间 */
public Date getTime(){
return this.time;
}
/** 时间 */
public void setTime(Date time){
this.time=time;
}
@Override
public String toString() {
return "DataAcquisition{" +
"id=" + id +
", imageData=" + imageData +
", imageDataTotal='" + imageDataTotal + '\'' +
", droneData=" + droneData +
", droneDataTotal='" + droneDataTotal + '\'' +
", sensorData=" + sensorData +
", sensorDataTotal='" + sensorDataTotal + '\'' +
", time=" + time +
'}';
}
}

View File

@ -0,0 +1,431 @@
package com.ruoyi.crops.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.springframework.format.annotation.DateTimeFormat;
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 ;
/** 上报时间 */
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")//接收时间类型
@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,130 @@
package com.ruoyi.crops.domain;
/**
* 农机设备信息表;
* @author : http://www.chiner.pro
* @date : 2023-6-6
*/
public class FarmMachinery{
/** id */
private Integer id ;
/** 农机所属省 */
private String province ;
/** 农机所属市 */
private String city ;
/** 农机所属县 */
private String county ;
/** 农机所属乡镇 */
private String town ;
/** 终端编号 */
private String vmeid ;
/** 农机编号 */
private String vehicleno ;
/** 农机类型 */
private String vehicletype ;
/** 农机型号 */
private String vehiclenum ;
/** 车主姓名 */
private String ownername ;
/** 车主电话 */
private String ownertel ;
/** 归属合作社 */
private String belongcorp ;
/** id */
public Integer getId(){
return this.id;
}
/** id */
public void setId(Integer id){
this.id=id;
}
/** 农机所属省 */
public String getProvince(){
return this.province;
}
/** 农机所属省 */
public void setProvince(String province){
this.province=province;
}
/** 农机所属市 */
public String getCity(){
return this.city;
}
/** 农机所属市 */
public void setCity(String city){
this.city=city;
}
/** 农机所属县 */
public String getCounty(){
return this.county;
}
/** 农机所属县 */
public void setCounty(String county){
this.county=county;
}
/** 农机所属乡镇 */
public String getTown(){
return this.town;
}
/** 农机所属乡镇 */
public void setTown(String town){
this.town=town;
}
/** 终端编号 */
public String getVmeid(){
return this.vmeid;
}
/** 终端编号 */
public void setVmeid(String vmeid){
this.vmeid=vmeid;
}
/** 农机编号 */
public String getVehicleno(){
return this.vehicleno;
}
/** 农机编号 */
public void setVehicleno(String vehicleno){
this.vehicleno=vehicleno;
}
/** 农机类型 */
public String getVehicletype(){
return this.vehicletype;
}
/** 农机类型 */
public void setVehicletype(String vehicletype){
this.vehicletype=vehicletype;
}
/** 农机型号 */
public String getVehiclenum(){
return this.vehiclenum;
}
/** 农机型号 */
public void setVehiclenum(String vehiclenum){
this.vehiclenum=vehiclenum;
}
/** 车主姓名 */
public String getOwnername(){
return this.ownername;
}
/** 车主姓名 */
public void setOwnername(String ownername){
this.ownername=ownername;
}
/** 车主电话 */
public String getOwnertel(){
return this.ownertel;
}
/** 车主电话 */
public void setOwnertel(String ownertel){
this.ownertel=ownertel;
}
/** 归属合作社 */
public String getBelongcorp(){
return this.belongcorp;
}
/** 归属合作社 */
public void setBelongcorp(String belongcorp){
this.belongcorp=belongcorp;
}
}

View File

@ -0,0 +1,75 @@
package com.ruoyi.crops.domain;
public class FarmStatus {
/**
* 农机总量
*/
private int total;
/**
* 在线机器数量
*/
private int online;
/**
* 离线机器数量
*/
private int offline;
/**
* 作业机器数量
*/
private int working;
/**
* 未作业机器数量
*/
private int unwork;
public int getTotal() {
return total;
}
public void setTotal(int total) {
this.total = total;
}
public int getOnline() {
return online;
}
public void setOnline(int online) {
this.online = online;
}
public int getOffline() {
return offline;
}
public void setOffline(int offline) {
this.offline = offline;
}
public int getWorking() {
return working;
}
public void setWorking(int working) {
this.working = working;
}
public int getUnwork() {
return unwork;
}
public void setUnwork(int unwork) {
this.unwork = unwork;
}
@Override
public String toString() {
return "FarmStatus{" +
"total=" + total +
", online=" + online +
", offline=" + offline +
", working=" + working +
", unwork=" + unwork +
'}';
}
}

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,81 @@
package com.ruoyi.crops.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonProperty;
import javax.persistence.*;
import java.util.Date;
/**
* 接口数据量统计;
* @author : http://www.chiner.pro
* @date : 2023-5-24
*/
@Table(name="interface_statistics")
public class InterfaceStatistics{
/** id */
@Id
@GeneratedValue
@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
private Integer id ;
/** 访问次数 */
private Integer visits ;
/** 访问用户量 */
private Integer accessingUsers ;
/** 交换数据量 */
private Integer dataEntries ;
/** 时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private Date time ;
/** id */
public Integer getId(){
return this.id;
}
/** id */
public void setId(Integer id){
this.id=id;
}
/** 访问次数 */
public Integer getVisits(){
return this.visits;
}
/** 访问次数 */
public void setVisits(Integer visits){
this.visits=visits;
}
/** 访问用户量 */
public Integer getAccessingUsers(){
return this.accessingUsers;
}
/** 访问用户量 */
public void setAccessingUsers(Integer accessingUsers){
this.accessingUsers=accessingUsers;
}
/** 交换数据量 */
public Integer getDataEntries(){
return this.dataEntries;
}
/** 交换数据量 */
public void setDataEntries(Integer dataEntries){
this.dataEntries=dataEntries;
}
/** 时间 */
public Date getTime(){
return this.time;
}
/** 时间 */
public void setTime(Date time){
this.time=time;
}
@Override
public String toString() {
return "InterfaceStatistics{" +
"id=" + id +
", visits=" + visits +
", accessingUsers=" + accessingUsers +
", dataEntries=" + dataEntries +
", time=" + time +
'}';
}
}

View File

@ -1,70 +1,378 @@
package com.ruoyi.crops.domain;
/**
* 水肥一体机参数;
* 水肥一体机状态表;
* @author : http://www.chiner.pro
* @date : 2023-4-27
* @date : 2023-5-18
*/
public class MachineParameter{
/** id */
private String id ;
/** 大棚名称 */
private String greenhouseName ;
/** 压力 */
private Double pressure ;
/** 流量 */
private Double flow ;
// /** id */
// private Integer id ;
/** 阀门1 */
private String Valve1 ;
/** 阀门2 */
private String valve2 ;
/** 阀门3 */
private String Valve3 ;
/** 阀门4 */
private String Valve4 ;
/** 阀门5 */
private String Valve5 ;
/** 阀门6 */
private String Valve6 ;
/** 阀门7 */
private String Valve7 ;
/** 阀门8 */
private String Valve8 ;
/** 阀门9 */
private String Valve9 ;
/** 阀门10 */
private String Valve10 ;
/** 阀门11 */
private String Valve11 ;
/** 阀门12 */
private String Valve12 ;
/** 阀门13 */
private String Valve13 ;
/** 阀门14 */
private String Valve14 ;
/** 阀门15 */
private String Valve15 ;
/** 阀门16 */
private String Valve16 ;
/** 阀门17 */
private String Valve17 ;
/** 阀门18 */
private String Valve18 ;
/** 阀门19 */
private String Valve19 ;
/** 阀门20 */
private String Valve20 ;
/** 进水泵 */
private String InflowPump ;
/** 出料泵 */
private String FeedingPump ;
/** 搅拌1 */
private String JiaoBan1 ;
/** 搅拌2 */
private String JiaoBan2 ;
/** 搅拌3 */
private String JiaoBan3 ;
/** 搅拌4 */
private String JiaoBan4 ;
/** pH值 */
private Double pH ;
/** 电导率 */
private Double conductivity ;
private Double Conduct ;
/** 进水流量 */
private Double Inflow ;
/** 进水压力 */
private Double InflowPressure ;
/** 功率模式 */
private String PowerMode ;
/** 控制模式 */
private String ControlMode ;
public String getId() {
return id;
/** id */
// public Integer getId(){
// return this.id;
// }
/** id */
// public void setId(Integer id){
// this.id=id;
// }
public String getValve1() {
return Valve1;
}
public void setId(String id) {
this.id = id;
public void setValve1(String valve1) {
Valve1 = valve1;
}
public String getGreenhouseName() {
return greenhouseName;
public String getvalve2() {
return valve2;
}
public void setGreenhouseName(String greenhouseName) {
this.greenhouseName = greenhouseName;
public void setvalve2(String valve2) {
this.valve2 = valve2;
}
public Double getPressure() {
return pressure;
public String getValve3() {
return Valve3;
}
public void setPressure(Double pressure) {
this.pressure = pressure;
public void setValve3(String valve3) {
Valve3 = valve3;
}
public Double getFlow() {
return flow;
public String getValve4() {
return Valve4;
}
public void setFlow(Double flow) {
this.flow = flow;
public void setValve4(String valve4) {
Valve4 = valve4;
}
public Double getConductivity() {
return conductivity;
public String getValve5() {
return Valve5;
}
public void setConductivity(Double conductivity) {
this.conductivity = conductivity;
public void setValve5(String valve5) {
Valve5 = valve5;
}
public String getValve6() {
return Valve6;
}
public void setValve6(String valve6) {
Valve6 = valve6;
}
public String getValve7() {
return Valve7;
}
public void setValve7(String valve7) {
Valve7 = valve7;
}
public String getValve8() {
return Valve8;
}
public void setValve8(String valve8) {
Valve8 = valve8;
}
public String getValve9() {
return Valve9;
}
public void setValve9(String valve9) {
Valve9 = valve9;
}
public String getValve10() {
return Valve10;
}
public void setValve10(String valve10) {
Valve10 = valve10;
}
public String getValve11() {
return Valve11;
}
public void setValve11(String valve11) {
Valve11 = valve11;
}
public String getValve12() {
return Valve12;
}
public void setValve12(String valve12) {
Valve12 = valve12;
}
public String getValve13() {
return Valve13;
}
public void setValve13(String valve13) {
Valve13 = valve13;
}
public String getValve14() {
return Valve14;
}
public void setValve14(String valve14) {
Valve14 = valve14;
}
public String getValve15() {
return Valve15;
}
public void setValve15(String valve15) {
Valve15 = valve15;
}
public String getValve16() {
return Valve16;
}
public void setValve16(String valve16) {
Valve16 = valve16;
}
public String getValve17() {
return Valve17;
}
public void setValve17(String valve17) {
Valve17 = valve17;
}
public String getValve18() {
return Valve18;
}
public void setValve18(String valve18) {
Valve18 = valve18;
}
public String getValve19() {
return Valve19;
}
public void setValve19(String valve19) {
Valve19 = valve19;
}
public String getValve20() {
return Valve20;
}
public void setValve20(String valve20) {
Valve20 = valve20;
}
public String getInflowPump() {
return InflowPump;
}
public void setInflowPump(String inflowPump) {
InflowPump = inflowPump;
}
public String getFeedingPump() {
return FeedingPump;
}
public void setFeedingPump(String feedingPump) {
FeedingPump = feedingPump;
}
public String getJiaoBan1() {
return JiaoBan1;
}
public void setJiaoBan1(String jiaoBan1) {
JiaoBan1 = jiaoBan1;
}
public String getJiaoBan2() {
return JiaoBan2;
}
public void setJiaoBan2(String jiaoBan2) {
JiaoBan2 = jiaoBan2;
}
public String getJiaoBan3() {
return JiaoBan3;
}
public void setJiaoBan3(String jiaoBan3) {
JiaoBan3 = jiaoBan3;
}
public String getJiaoBan4() {
return JiaoBan4;
}
public void setJiaoBan4(String jiaoBan4) {
JiaoBan4 = jiaoBan4;
}
public Double getpH() {
return pH;
}
public void setpH(Double pH) {
this.pH = pH;
}
public Double getConduct() {
return Conduct;
}
public void setConduct(Double conduct) {
Conduct = conduct;
}
public Double getInflow() {
return Inflow;
}
public void setInflow(Double inflow) {
Inflow = inflow;
}
public Double getInflowPressure() {
return InflowPressure;
}
public void setInflowPressure(Double inflowPressure) {
InflowPressure = inflowPressure;
}
public String getPowerMode() {
return PowerMode;
}
public void setPowerMode(String powerMode) {
PowerMode = powerMode;
}
public String getControlMode() {
return ControlMode;
}
public void setControlMode(String controlMode) {
ControlMode = controlMode;
}
@Override
public String toString() {
return "MachineParameter{" +
"id='" + id + '\'' +
", greenhouseName='" + greenhouseName + '\'' +
", pressure=" + pressure +
", flow=" + flow +
", conductivity=" + conductivity +
"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 + '\'' +
", InflowPump='" + InflowPump + '\'' +
", FeedingPump='" + FeedingPump + '\'' +
", JiaoBan1='" + JiaoBan1 + '\'' +
", JiaoBan2='" + JiaoBan2 + '\'' +
", JiaoBan3='" + JiaoBan3 + '\'' +
", JiaoBan4='" + JiaoBan4 + '\'' +
", pH=" + pH +
", Conduct=" + Conduct +
", Inflow=" + Inflow +
", InflowPressure=" + InflowPressure +
", PowerMode='" + PowerMode + '\'' +
", ControlMode='" + ControlMode + '\'' +
'}';
}
}

View File

@ -0,0 +1,188 @@
package com.ruoyi.crops.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
/**
* 农机作业任务表;
* @author : http://www.chiner.pro
* @date : 2023-6-7
*/
public class MachineryJobData {
/** id */
private Integer id ;
/** 归属省 */
private String province ;
/** 归属地市 */
private String city ;
/** 归属区县 */
private String county ;
/** 作业日期 */
@DateTimeFormat(pattern="yyyy-MM-dd")
@JsonFormat(pattern="yyyy-MM-dd")
private Date jobday ;
/** 作业类型码 */
private Integer jobtype ;
/** 农机编号 */
private String vehicleno ;
/** 终端编号 */
private String vmeid ;
/** 作业地块面积(单位:亩) */
private Double plotarea ;
/** 作业面积(单位:亩) */
private Double jobarea ;
/** 达标比() */
private Double qualratio ;
/** 达标面积(单位:亩) */
private Double qualarea ;
/** 作业幅宽(单位:米) */
private Double jobwidth ;
/** 面积(单位:亩) */
private Double area ;
/** 时长(单位:小时) */
private Double workhours ;
/** id */
public Integer getId(){
return this.id;
}
/** id */
public void setId(Integer id){
this.id=id;
}
/** 归属省 */
public String getProvince(){
return this.province;
}
/** 归属省 */
public void setProvince(String province){
this.province=province;
}
/** 归属地市 */
public String getCity(){
return this.city;
}
/** 归属地市 */
public void setCity(String city){
this.city=city;
}
/** 归属区县 */
public String getCounty(){
return this.county;
}
/** 归属区县 */
public void setCounty(String county){
this.county=county;
}
/** 作业日期 */
public Date getJobday(){
return this.jobday;
}
/** 作业日期 */
public void setJobday(Date jobday){
this.jobday=jobday;
}
/** 作业类型码 */
public Integer getJobtype(){
return this.jobtype;
}
/** 作业类型码 */
public void setJobtype(Integer jobtype){
this.jobtype=jobtype;
}
/** 农机编号 */
public String getVehicleno(){
return this.vehicleno;
}
/** 农机编号 */
public void setVehicleno(String vehicleno){
this.vehicleno=vehicleno;
}
/** 终端编号 */
public String getVmeid(){
return this.vmeid;
}
/** 终端编号 */
public void setVmeid(String vmeid){
this.vmeid=vmeid;
}
/** 作业地块面积(单位:亩) */
public Double getPlotarea(){
return this.plotarea;
}
/** 作业地块面积(单位:亩) */
public void setPlotarea(Double plotarea){
this.plotarea=plotarea;
}
/** 作业面积(单位:亩) */
public Double getJobarea(){
return this.jobarea;
}
/** 作业面积(单位:亩) */
public void setJobarea(Double jobarea){
this.jobarea=jobarea;
}
/** 达标比() */
public Double getQualratio(){
return this.qualratio;
}
/** 达标比() */
public void setQualratio(Double qualratio){
this.qualratio=qualratio;
}
/** 达标面积(单位:亩) */
public Double getQualarea(){
return this.qualarea;
}
/** 达标面积(单位:亩) */
public void setQualarea(Double qualarea){
this.qualarea=qualarea;
}
/** 作业幅宽(单位:米) */
public Double getJobwidth(){
return this.jobwidth;
}
/** 作业幅宽(单位:米) */
public void setJobwidth(Double jobwidth){
this.jobwidth=jobwidth;
}
public Double getArea() {
return area;
}
public void setArea(Double area) {
this.area = area;
}
public Double getWorkhours() {
return workhours;
}
public void setWorkhours(Double workhours) {
this.workhours = workhours;
}
@Override
public String toString() {
return "MachineryJobData{" +
"id=" + id +
", province='" + province + '\'' +
", city='" + city + '\'' +
", county='" + county + '\'' +
", jobday=" + jobday +
", jobtype=" + jobtype +
", vehicleno='" + vehicleno + '\'' +
", vmeid='" + vmeid + '\'' +
", plotarea=" + plotarea +
", jobarea=" + jobarea +
", qualratio=" + qualratio +
", qualarea=" + qualarea +
", jobwidth=" + jobwidth +
", area=" + area +
", workhours=" + workhours +
'}';
}
}

View File

@ -0,0 +1,92 @@
package com.ruoyi.crops.domain;
import java.util.Date;
/**
* 农机位置表;
* @author : http://www.chiner.pro
* @date : 2023-6-6
*/
public class MachineryPosition {
/** id */
private Integer id ;
/** 农机编号 */
private String vehicleno ;
/** 时间(北京时间) */
private Date postime ;
/** 纬度值(WGS84 坐标系) */
private Double lat ;
/** 经度值(WGS84 坐标系) */
private Double lng ;
/** 速度km/h */
private Double speed ;
/** 作业类型代码 */
private Integer jobtype ;
/** 作业深度cm */
private Double depth ;
/** id */
public Integer getId(){
return this.id;
}
/** id */
public void setId(Integer id){
this.id=id;
}
/** 农机编号 */
public String getVehicleno(){
return this.vehicleno;
}
/** 农机编号 */
public void setVehicleno(String vehicleno){
this.vehicleno=vehicleno;
}
/** 时间(北京时间) */
public Date getPostime(){
return this.postime;
}
/** 时间(北京时间) */
public void setPostime(Date postime){
this.postime=postime;
}
/** 纬度值(WGS84 坐标系) */
public Double getLat(){
return this.lat;
}
/** 纬度值(WGS84 坐标系) */
public void setLat(Double lat){
this.lat=lat;
}
/** 经度值(WGS84 坐标系) */
public Double getLng(){
return this.lng;
}
/** 经度值(WGS84 坐标系) */
public void setLng(Double lng){
this.lng=lng;
}
/** 速度km/h */
public Double getSpeed(){
return this.speed;
}
/** 速度km/h */
public void setSpeed(Double speed){
this.speed=speed;
}
/** 作业类型代码 */
public Integer getJobtype(){
return this.jobtype;
}
/** 作业类型代码 */
public void setJobtype(Integer jobtype){
this.jobtype=jobtype;
}
/** 作业深度cm */
public Double getDepth(){
return this.depth;
}
/** 作业深度cm */
public void setDepth(Double depth){
this.depth=depth;
}
}

View File

@ -0,0 +1,134 @@
package com.ruoyi.crops.domain;
import java.util.Date;
public class MachineryTrajectory {
private Integer id;
private Date pttime;
private float lat;
private float lng;
private float course;
private int haspic;
private int iswork;
private float jobwidth;
private String imgurl;
private float depth;
//农机编号
private String vehicleno;
//地块编号
private String workplace;
public Date getPttime() {
return pttime;
}
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public void setPttime(Date pttime) {
this.pttime = pttime;
}
public float getLat() {
return lat;
}
public void setLat(float lat) {
this.lat = lat;
}
public float getLng() {
return lng;
}
public void setLng(float lng) {
this.lng = lng;
}
public float getCourse() {
return course;
}
public void setCourse(float course) {
this.course = course;
}
public int getHaspic() {
return haspic;
}
public void setHaspic(int haspic) {
this.haspic = haspic;
}
public int getIswork() {
return iswork;
}
public void setIswork(int iswork) {
this.iswork = iswork;
}
public float getJobwidth() {
return jobwidth;
}
public void setJobwidth(float jobwidth) {
this.jobwidth = jobwidth;
}
public String getImgurl() {
return imgurl;
}
public void setImgurl(String imgurl) {
this.imgurl = imgurl;
}
public float getDepth() {
return depth;
}
public void setDepth(float depth) {
this.depth = depth;
}
public String getVehicleno() {
return vehicleno;
}
public void setVehicleno(String vehicleno) {
this.vehicleno = vehicleno;
}
public String getWorkplace() {
return workplace;
}
public void setWorkplace(String workplace) {
this.workplace = workplace;
}
@Override
public String toString() {
return "MachineryTrajectory{" +
"id=" + id +
", pttime=" + pttime +
", lat=" + lat +
", lng=" + lng +
", course=" + course +
", haspic=" + haspic +
", iswork=" + iswork +
", jobwidth=" + jobwidth +
", imgurl='" + imgurl + '\'' +
", depth=" + depth +
", vehicleno='" + vehicleno + '\'' +
", workplace='" + workplace + '\'' +
'}';
}
}

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

@ -17,8 +17,6 @@ public class OperationRecords {
private Date updateTime ;
/** 操作内容 */
private String operationContent ;
/** 更新人 */
private String updateBy ;
public String getId() {
return id;
@ -44,21 +42,12 @@ public class OperationRecords {
this.operationContent = operationContent;
}
public String getUpdateBy() {
return updateBy;
}
public void setUpdateBy(String updateBy) {
this.updateBy = updateBy;
}
@Override
public String toString() {
return "OperationRecords{" +
"id='" + id + '\'' +
", updateTime=" + updateTime +
", operationContent='" + operationContent + '\'' +
", updateBy='" + updateBy + '\'' +
'}';
}
}

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

@ -0,0 +1,65 @@
package com.ruoyi.crops.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.util.Date;
/**
* 农机信息预警表;
* @author : http://www.chiner.pro
* @date : 2023-6-15
*/
public class WarningFarm{
/** id */
private Integer id ;
/** 农机名称 */
private String vehicleno ;
/** 车主姓名 */
private String ownername ;
/** 异常类型 */
private String warningInfo ;
/** 预警时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private Date time ;
/** id */
public Integer getId(){
return this.id;
}
/** id */
public void setId(Integer id){
this.id=id;
}
/** 农机名称 */
public String getVehicleno(){
return this.vehicleno;
}
/** 农机名称 */
public void setVehicleno(String vehicleno){
this.vehicleno=vehicleno;
}
/** 车主姓名 */
public String getOwnername(){
return this.ownername;
}
/** 车主姓名 */
public void setOwnername(String ownername){
this.ownername=ownername;
}
/** 异常类型 */
public String getWarningInfo(){
return this.warningInfo;
}
/** 异常类型 */
public void setWarningInfo(String warningInfo){
this.warningInfo=warningInfo;
}
/** 预警时间 */
public Date getTime(){
return this.time;
}
/** 预警时间 */
public void setTime(Date time){
this.time=time;
}
}

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,154 @@
package com.ruoyi.crops.domain;
import javax.persistence.*;
import java.io.Serializable;
import java.time.LocalDateTime;
/**
* 气象预报
* @author tajochen
*/
@Entity
@Table(name="weather_prediction")
public class WeatherPredictionEntity implements Serializable {
/**
* 指定主键建立自增序列主键值取自序列
*/
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "weather_prediction_seq_gen")
@SequenceGenerator(name = "weather_prediction_seq_gen", sequenceName = "weather_prediction_seq")
private Integer id;
// 气象时间
private LocalDateTime weatherTime;
// 气象名称
@Column(length = 16, columnDefinition = "varchar(16)")
private String weatherName;
// 气温
@Column(length = 16, columnDefinition = "varchar(16)")
private String airTemperature;
// 降水量
@Column(length = 16, columnDefinition = "varchar(16)")
private String precipitation;
// 风速
@Column(length = 16, columnDefinition = "varchar(16)")
private String windSpeed;
// 风向
@Column(length = 16, columnDefinition = "varchar(16)")
private String windDirection;
// 气压
@Column(length = 16, columnDefinition = "varchar(16)")
private String atmosphericPressure;
// 湿度
@Column(length = 16, columnDefinition = "varchar(16)")
private String humidity;
// 云量
@Column(length = 16, columnDefinition = "varchar(16)")
private String cloudCover;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public LocalDateTime getWeatherTime() {
return weatherTime;
}
public void setWeatherTime(LocalDateTime weatherTime) {
this.weatherTime = weatherTime;
}
public String getWeatherName() {
return weatherName;
}
public void setWeatherName(String weatherName) {
this.weatherName = weatherName;
}
public String getAirTemperature() {
return airTemperature;
}
public void setAirTemperature(String airTemperature) {
this.airTemperature = airTemperature;
}
public String getPrecipitation() {
return precipitation;
}
public void setPrecipitation(String precipitation) {
this.precipitation = precipitation;
}
public String getWindSpeed() {
return windSpeed;
}
public void setWindSpeed(String windSpeed) {
this.windSpeed = windSpeed;
}
public String getWindDirection() {
return windDirection;
}
public void setWindDirection(String windDirection) {
this.windDirection = windDirection;
}
public String getAtmosphericPressure() {
return atmosphericPressure;
}
public void setAtmosphericPressure(String atmosphericPressure) {
this.atmosphericPressure = atmosphericPressure;
}
public String getHumidity() {
return humidity;
}
public void setHumidity(String humidity) {
this.humidity = humidity;
}
public String getCloudCover() {
return cloudCover;
}
public void setCloudCover(String cloudCover) {
this.cloudCover = cloudCover;
}
@Override
public String toString() {
return "WeatherPredictionEntity{" +
"id=" + id +
", weatherTime=" + weatherTime +
", weatherName='" + weatherName + '\'' +
", airTemperature='" + airTemperature + '\'' +
", precipitation='" + precipitation + '\'' +
", windSpeed='" + windSpeed + '\'' +
", windDirection='" + windDirection + '\'' +
", atmosphericPressure='" + atmosphericPressure + '\'' +
", humidity='" + humidity + '\'' +
", cloudCover='" + cloudCover + '\'' +
'}';
}
}

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,27 @@
package com.ruoyi.crops.domain.gsonBean;
import com.ruoyi.crops.domain.FarmMachinery;
import java.util.List;
public class GsonFarmMachineryBean {
public int status;
public List<FarmMachinery> vehicle;
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public List<FarmMachinery> getVehicle() {
return vehicle;
}
public void setVehicle(List<FarmMachinery> vehicle) {
this.vehicle = vehicle;
}
}

View File

@ -0,0 +1,353 @@
package com.ruoyi.crops.domain.gsonBean;
public class GsonMachineParameterBean {
public GsonMachineParameterBean() {
}
public String msg;
public MachineParameter data;
public Integer code;
public Boolean result;
public String time;
public class MachineParameter{
/** 阀门1 */
public property Valve1 ;
/** 阀门2 */
public property valve2 ;
/** 阀门3 */
public property Valve3 ;
/** 阀门4 */
public property Valve4 ;
/** 阀门5 */
public property Valve5 ;
/** 阀门6 */
public property Valve6 ;
/** 阀门7 */
public property Valve7 ;
/** 阀门8 */
public property Valve8 ;
/** 阀门9 */
public property Valve9 ;
/** 阀门10 */
public property Valve10 ;
/** 阀门11 */
public property Valve11 ;
/** 阀门12 */
public property Valve12 ;
/** 阀门13 */
public property Valve13 ;
/** 阀门14 */
public property Valve14 ;
/** 阀门15 */
public property Valve15 ;
/** 阀门16 */
public property Valve16 ;
/** 阀门17 */
public property Valve17 ;
/** 阀门18 */
public property Valve18 ;
/** 阀门19 */
public property Valve19 ;
/** 阀门20 */
public property Valve20 ;
/** 进水泵 */
public property InflowPump ;
/** 出料泵 */
public property FeedingPump ;
/** 搅拌1 */
public property JiaoBan1 ;
/** 搅拌2 */
public property JiaoBan2 ;
/** 搅拌3 */
public property JiaoBan3 ;
/** 搅拌4 */
public property JiaoBan4 ;
/** pH值 */
public property pH ;
/** 电导率 */
public property Conduct ;
/** 进水流量 */
public property Inflow ;
/** 进水压力 */
public property InflowPressure ;
/** 功率模式 */
public property PowerMode ;
/** 控制模式 */
public property ControlMode ;
public property getValve1() {
return Valve1;
}
public void setValve1(property valve1) {
Valve1 = valve1;
}
public property getvalve2() {
return valve2;
}
public void setvalve2(property valve2) {
this.valve2 = valve2;
}
public property getValve3() {
return Valve3;
}
public void setValve3(property valve3) {
Valve3 = valve3;
}
public property getValve4() {
return Valve4;
}
public void setValve4(property valve4) {
Valve4 = valve4;
}
public property getValve5() {
return Valve5;
}
public void setValve5(property valve5) {
Valve5 = valve5;
}
public property getValve6() {
return Valve6;
}
public void setValve6(property valve6) {
Valve6 = valve6;
}
public property getValve7() {
return Valve7;
}
public void setValve7(property valve7) {
Valve7 = valve7;
}
public property getValve8() {
return Valve8;
}
public void setValve8(property valve8) {
Valve8 = valve8;
}
public property getValve9() {
return Valve9;
}
public void setValve9(property valve9) {
Valve9 = valve9;
}
public property getValve10() {
return Valve10;
}
public void setValve10(property valve10) {
Valve10 = valve10;
}
public property getValve11() {
return Valve11;
}
public void setValve11(property valve11) {
Valve11 = valve11;
}
public property getValve12() {
return Valve12;
}
public void setValve12(property valve12) {
Valve12 = valve12;
}
public property getValve13() {
return Valve13;
}
public void setValve13(property valve13) {
Valve13 = valve13;
}
public property getValve14() {
return Valve14;
}
public void setValve14(property valve14) {
Valve14 = valve14;
}
public property getValve15() {
return Valve15;
}
public void setValve15(property valve15) {
Valve15 = valve15;
}
public property getValve16() {
return Valve16;
}
public void setValve16(property valve16) {
Valve16 = valve16;
}
public property getValve17() {
return Valve17;
}
public void setValve17(property valve17) {
Valve17 = valve17;
}
public property getValve18() {
return Valve18;
}
public void setValve18(property valve18) {
Valve18 = valve18;
}
public property getValve19() {
return Valve19;
}
public void setValve19(property valve19) {
Valve19 = valve19;
}
public property getValve20() {
return Valve20;
}
public void setValve20(property valve20) {
Valve20 = valve20;
}
public property getInflowPump() {
return InflowPump;
}
public void setInflowPump(property inflowPump) {
InflowPump = inflowPump;
}
public property getFeedingPump() {
return FeedingPump;
}
public void setFeedingPump(property feedingPump) {
FeedingPump = feedingPump;
}
public property getJiaoBan1() {
return JiaoBan1;
}
public void setJiaoBan1(property jiaoBan1) {
JiaoBan1 = jiaoBan1;
}
public property getJiaoBan2() {
return JiaoBan2;
}
public void setJiaoBan2(property jiaoBan2) {
JiaoBan2 = jiaoBan2;
}
public property getJiaoBan3() {
return JiaoBan3;
}
public void setJiaoBan3(property jiaoBan3) {
JiaoBan3 = jiaoBan3;
}
public property getJiaoBan4() {
return JiaoBan4;
}
public void setJiaoBan4(property jiaoBan4) {
JiaoBan4 = jiaoBan4;
}
public property getpH() {
return pH;
}
public void setpH(property pH) {
this.pH = pH;
}
public property getConduct() {
return Conduct;
}
public void setConduct(property conduct) {
Conduct = conduct;
}
public property getInflow() {
return Inflow;
}
public void setInflow(property inflow) {
Inflow = inflow;
}
public property getInflowPressure() {
return InflowPressure;
}
public void setInflowPressure(property inflowPressure) {
InflowPressure = inflowPressure;
}
public property getPowerMode() {
return PowerMode;
}
public void setPowerMode(property powerMode) {
PowerMode = powerMode;
}
public property getControlMode() {
return ControlMode;
}
public void setControlMode(property controlMode) {
ControlMode = controlMode;
}
}
public class property{
public String propertyName;
public String dataType;
public String propertyNameShow;
public String propertyValve;
@Override
public String toString() {
return "property{" +
"propertyName='" + propertyName + '\'' +
", dataType='" + dataType + '\'' +
", propertyNameShow='" + propertyNameShow + '\'' +
", propertyValve='" + propertyValve + '\'' +
'}';
}
}
}

View File

@ -0,0 +1,26 @@
package com.ruoyi.crops.domain.gsonBean;
import com.ruoyi.crops.domain.MachineryPosition;
import java.util.List;
public class GsonMachineryPositionBean {
public int status;
public List<MachineryPosition> position;
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public List<MachineryPosition> getPosition() {
return position;
}
public void setPosition(List<MachineryPosition> position) {
this.position = position;
}
}

View File

@ -0,0 +1,14 @@
package com.ruoyi.crops.domain.gsonBean;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.crops.domain.Meteorological;
import java.util.ArrayList;
import java.util.Date;
public class GsonMeteorologicalBean {
public String reason;
public ArrayList<Meteorological> result;
public String error_code;
}

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,119 @@
package com.ruoyi.crops.domain.gsonBean;
import java.util.Date;
import java.util.List;
public class GsonVehicleTrackBean {
private int status;
private String vehicleno;
private List<postions> postions;
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public String getVehicleno() {
return vehicleno;
}
public void setVehicleno(String vehicleno) {
this.vehicleno = vehicleno;
}
public List<GsonVehicleTrackBean.postions> getPostions() {
return postions;
}
public void setPostions(List<GsonVehicleTrackBean.postions> postions) {
this.postions = postions;
}
public class postions{
private Date pttime;
private float lat;
private float lng;
private float course;
private int haspic;
private String imgurl;
private int iswork;
private double jobwidth;
private float depth;
public Date getPttime() {
return pttime;
}
public void setPttime(Date pttime) {
this.pttime = pttime;
}
public float getLat() {
return lat;
}
public void setLat(float lat) {
this.lat = lat;
}
public float getLng() {
return lng;
}
public void setLng(float lng) {
this.lng = lng;
}
public float getCourse() {
return course;
}
public void setCourse(float course) {
this.course = course;
}
public int getHaspic() {
return haspic;
}
public void setHaspic(int haspic) {
this.haspic = haspic;
}
public String getImgurl() {
return imgurl;
}
public void setImgurl(String imgurl) {
this.imgurl = imgurl;
}
public int getIswork() {
return iswork;
}
public void setIswork(int iswork) {
this.iswork = iswork;
}
public double getJobwidth() {
return jobwidth;
}
public void setJobwidth(double jobwidth) {
this.jobwidth = jobwidth;
}
public float getDepth() {
return depth;
}
public void setDepth(float depth) {
this.depth = depth;
}
}
}

View File

@ -0,0 +1,105 @@
package com.ruoyi.crops.domain.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
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 ;
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")//接收时间类型
@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,44 @@
package com.ruoyi.crops.domain.vo;
public class FarmMachineryVo {
/** id */
private Integer id ;
/** 农机编号 */
private String vehicleno ;
/** 农机类型 */
private String vehicletype ;
/** 车主姓名 */
private String ownername ;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getVehicleno() {
return vehicleno;
}
public void setVehicleno(String vehicleno) {
this.vehicleno = vehicleno;
}
public String getVehicletype() {
return vehicletype;
}
public void setVehicletype(String vehicletype) {
this.vehicletype = vehicletype;
}
public String getOwnername() {
return ownername;
}
public void setOwnername(String ownername) {
this.ownername = ownername;
}
}

View File

@ -0,0 +1,54 @@
package com.ruoyi.crops.domain.vo;
public class InterfaceStatisticsVo {
/** 访问次数 */
private Integer visits ;
/** 访问用户量 */
private Integer accessingUsers ;
/** 交换数据量 */
private Integer dataEntries ;
/** 数据库总量 */
private Float volume;
public Integer getVisits() {
return visits;
}
public void setVisits(Integer visits) {
this.visits = visits;
}
public Integer getAccessingUsers() {
return accessingUsers;
}
public void setAccessingUsers(Integer accessingUsers) {
this.accessingUsers = accessingUsers;
}
public Integer getDataEntries() {
return dataEntries;
}
public void setDataEntries(Integer dataEntries) {
this.dataEntries = dataEntries;
}
public Float getVolume() {
return volume;
}
public void setVolume(Float volume) {
this.volume = volume;
}
@Override
public String toString() {
return "InterfaceStatisticsVo{" +
"visits=" + visits +
", accessingUsers=" + accessingUsers +
", dataEntries=" + dataEntries +
", volume='" + volume + '\'' +
'}';
}
}

View File

@ -0,0 +1,15 @@
package com.ruoyi.crops.domain.vo;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
@Data
public class MachineParameterVo {
private Double pH;
private Double Conduct;
private Double Inflow;
private Double InflowPressure;
}

View File

@ -0,0 +1,143 @@
package com.ruoyi.crops.domain.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
public class MachineryJobDataVo {
/** 作业类型码 */
private String jobtype ;
/** 农机编号 */
@Excel(name = "设备编号")
private String vehicleno ;
/** 农机类型 */
@Excel(name = "设备类型")
private String vehicletype ;
/** 终端编号 */
@Excel(name = "机器码")
private String vmeid ;
/** 作业日期 */
@Excel(name = "作业日期",dateFormat = "yyyy-MM-dd")
@DateTimeFormat(pattern="yyyy-MM-dd")
@JsonFormat(pattern="yyyy-MM-dd")
private Date jobday ;
@Excel(name = "作业面积(亩)")
/** 作业面积(单位:亩) */
private Double jobarea ;
/** 车主姓名 */
@Excel(name = "用户名")
private String ownername ;
/** 车主电话 */
@Excel(name = "联系方式")
private String ownertel ;
/** 面积(单位:亩) */
private Double area ;
/** 时长(单位:小时) */
private Double workhours ;
public String getVehicletype() {
return vehicletype;
}
public void setVehicletype(String vehicletype) {
this.vehicletype = vehicletype;
}
public String getVehicleno() {
return vehicleno;
}
public void setVehicleno(String vehicleno) {
this.vehicleno = vehicleno;
}
public String getVmeid() {
return vmeid;
}
public void setVmeid(String vmeid) {
this.vmeid = vmeid;
}
public Date getJobday() {
return jobday;
}
public void setJobday(Date jobday) {
this.jobday = jobday;
}
public Double getJobarea() {
return jobarea;
}
public void setJobarea(Double jobarea) {
this.jobarea = jobarea;
}
public String getOwnername() {
return ownername;
}
public void setOwnername(String ownername) {
this.ownername = ownername;
}
public String getOwnertel() {
return ownertel;
}
public void setOwnertel(String ownertel) {
this.ownertel = ownertel;
}
public String getJobtype() {
return jobtype;
}
public void setJobtype(String jobtype) {
this.jobtype = jobtype;
}
public Double getArea() {
return area;
}
public void setArea(Double area) {
this.area = area;
}
public Double getWorkhours() {
return workhours;
}
public void setWorkhours(Double workhours) {
this.workhours = workhours;
}
@Override
public String toString() {
return "MachineryJobDataVo{" +
"jobtype='" + jobtype + '\'' +
", vehicleno='" + vehicleno + '\'' +
", vehicletype='" + vehicletype + '\'' +
", vmeid='" + vmeid + '\'' +
", jobday=" + jobday +
", jobarea=" + jobarea +
", ownername='" + ownername + '\'' +
", ownertel='" + ownertel + '\'' +
", area=" + area +
", workhours=" + workhours +
'}';
}
}

View File

@ -0,0 +1,88 @@
package com.ruoyi.crops.domain.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
public class WeatherPredoctionVo {
private String maxAirTemperature;
private String minAirTemperature;
private String maxHumidity;
private String minHumidity;
private String windSpeed;
private String precipitation;
@DateTimeFormat(pattern = "yyyy-MM-dd")//接收时间类型
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")//返回时间类型
private Date weatherTime;
public String getMaxAirTemperature() {
return maxAirTemperature;
}
public void setMaxAirTemperature(String maxAirTemperature) {
this.maxAirTemperature = maxAirTemperature;
}
public String getMinAirTemperature() {
return minAirTemperature;
}
public void setMinAirTemperature(String minAirTemperature) {
this.minAirTemperature = minAirTemperature;
}
public String getMaxHumidity() {
return maxHumidity;
}
public void setMaxHumidity(String maxHumidity) {
this.maxHumidity = maxHumidity;
}
public String getMinHumidity() {
return minHumidity;
}
public void setMinHumidity(String minHumidity) {
this.minHumidity = minHumidity;
}
public String getWindSpeed() {
return windSpeed;
}
public void setWindSpeed(String windSpeed) {
this.windSpeed = windSpeed;
}
public String getPrecipitation() {
return precipitation;
}
public void setPrecipitation(String precipitation) {
this.precipitation = precipitation;
}
public Date getWeatherTime() {
return weatherTime;
}
public void setWeatherTime(Date weatherTime) {
this.weatherTime = weatherTime;
}
@Override
public String toString() {
return "WeatherPredoctionVo{" +
"maxAirTemperature='" + maxAirTemperature + '\'' +
", minAirTemperature='" + minAirTemperature + '\'' +
", maxHumidity='" + maxHumidity + '\'' +
", minHumidity='" + minHumidity + '\'' +
", windSpeed='" + windSpeed + '\'' +
", precipitation='" + precipitation + '\'' +
", weatherTime=" + weatherTime +
'}';
}
}

View File

@ -7,7 +7,17 @@ import java.util.Date;
import java.util.List;
public interface CropsDroughtMapper {
/**
* 批量新增作物长势数据
* @param cropsDroughtList
* @return
*/
public int insertBatch(@Param("list") List<CropsDrought> cropsDroughtList);
/**
* 根据时间查询作物长势数据
* @param time
* @return
*/
List<CropsDrought> selectByTime(Date time);
}

View File

@ -14,7 +14,17 @@ public interface CropsStructureMapper {
*/
public int insertCropsStructure(CropStructure cropStructure);
/**
* 批量新增作物种植结构
* @param list
* @return
*/
public int insertBatch(@Param("list") List<CropStructure> list);
/**
* 根据时间查询作物种植结构
* @param time
* @return
*/
public List<CropStructure> selectByTime(Date time);
}

View File

@ -0,0 +1,47 @@
package com.ruoyi.crops.mapper;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.crops.domain.CropsUser;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface CropsUserMapper {
/**
* 获取用户列表
* @return
*/
List<CropsUser> list();
/**
* 新增用户
* @param cropsUser
* @return
*/
int insert(CropsUser cropsUser);
/**
* 删除用户
* @param id
* @return
*/
int delete(Integer id);
/**
* 修改用户
* @param id
* @return
*/
int update(Integer id);
/**
* 根据id查询用户
* @param phone
* @return
*/
CropsUser selectByPhone(String phone);
CropsUser login(CropsUser user);
int selectCountByName(String userName);
}

View File

@ -7,7 +7,17 @@ import java.util.Date;
import java.util.List;
public interface CropsYieldMapper {
/**
* 根据年份查询
* @param year
* @return
*/
public List<CropsYield> selectByYear(Integer year);
/**
* 批量新增
* @param list
* @return
*/
public int insertBatch(@Param("list") List<CropsYield> list);
}

View File

@ -0,0 +1,15 @@
package com.ruoyi.crops.mapper;
import com.ruoyi.crops.domain.DataAcquisition;
import java.util.List;
public interface DataAcquisitionMapper {
DataAcquisition getData();
int insert(DataAcquisition data);
void analyze();
DataAcquisition getSensorData();
}

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") Date startTime, @Param("endTime") Date endTime);
List<DeviceSenseVo> selecthours(@Param("startTime") Date startTime, @Param("endTime") Date endTime);
List<DeviceSenseVo> selectdays(@Param("startTime") Date startTime, @Param("endTime") Date endTime);
}

View File

@ -0,0 +1,15 @@
package com.ruoyi.crops.mapper;
import com.ruoyi.crops.domain.FarmMachinery;
import com.ruoyi.crops.domain.vo.FarmMachineryVo;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface FarmMachineryMapper {
public FarmMachineryVo selectMachineryData(@Param("vehicleno") String vehicleno);
public List<FarmMachineryVo> selectMachineryData();
public int insertBatch(@Param("entities") List<FarmMachinery> farmMachineryList);
}

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,15 @@
package com.ruoyi.crops.mapper;
import com.ruoyi.crops.domain.InterfaceStatistics;
import com.ruoyi.crops.domain.vo.InterfaceStatisticsVo;
import java.util.List;
public interface InterfaceStatisticsMapper {
int insert(InterfaceStatistics interfaceStatistics);
InterfaceStatistics selectByDay();
InterfaceStatisticsVo selectTotal();
}

View File

@ -1,11 +0,0 @@
package com.ruoyi.crops.mapper;
import com.ruoyi.crops.domain.MachineParameter;
import java.util.List;
public interface MachineParameterMapper {
List<MachineParameter> selectByName(String name);
int insert(MachineParameter machineParameter);
}

View File

@ -0,0 +1,31 @@
package com.ruoyi.crops.mapper;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.crops.domain.MachineryJobData;
import com.ruoyi.crops.domain.vo.MachineryJobDataVo;
import org.apache.ibatis.annotations.Param;
import java.util.Date;
import java.util.List;
import java.util.Map;
public interface MachineryJobDataMapper {
int insertBatch(@Param("entities") List<MachineryJobData> list);
List<MachineryJobData> selectByTime(@Param("startTime") Date startTime,@Param("endTime")Date endTime);
List<MachineryJobDataVo> selectMachineryJobData(@Param("startTime") Date startTime,@Param("endTime")Date endTime,@Param("vehicleno") String vehicleno);
List<MachineryJobDataVo> selectMachineryJobData();
void updateAreaWorkhours(@Param("vehicleno")String vehicleno, @Param("workArea") Double workArea, @Param("workhours")Double workhours);
MachineryJobDataVo selectTodayJobData();
/**
* 查询全部农机编号
* @return
*/
List<String> selectVehicleno();
}

View File

@ -0,0 +1,28 @@
package com.ruoyi.crops.mapper;
import com.ruoyi.crops.domain.MachineryPosition;
import org.apache.ibatis.annotations.Param;
import java.util.List;
public interface MachineryPositionMapper {
/**
* 查询农机在线数量
* @return
*/
public int selectMachineryOnline();
/**
* 插入农机位置
* @param machineryPositions
* @return
*/
public int insertBatch(@Param("entities")List<MachineryPosition> machineryPositions);
/**
* 查询农机作业类型
* @param vehicleno
* @return
*/
int selectJobtype(String vehicleno);
}

Some files were not shown because too many files have changed in this diff Show More