diff --git a/ruoyi-admin/pom.xml b/ruoyi-admin/pom.xml index 99a6e1b..9de56e8 100644 --- a/ruoyi-admin/pom.xml +++ b/ruoyi-admin/pom.xml @@ -15,8 +15,13 @@ web服务入口 - + + UTF-8 + 20.5 + 1.16.1 + + org.springframework.boot @@ -94,7 +99,170 @@ 1.7.0-pdok2 + + + org.jsoup + jsoup + 1.16.1 + + + + + org.aspectj + aspectjrt + 1.9.4 + + + org.aspectj + aspectjweaver + 1.9.4 + + + cglib + cglib + 3.2.12 + + + + org.geotools + gt-main + ${geotools.version} + + + org.geotools + gt-referencing + ${geotools.version} + + + org.geotools + gt-api + ${geotools.version} + + + org.geotools + gt-opengis + ${geotools.version} + + + org.geotools + gt-metadata + ${geotools.version} + + + org.geotools + gt-geometry + ${geotools.version} + + + org.geotools + gt-coverage + ${geotools.version} + + + org.geotools + gt-cql + ${geotools.version} + + + org.geotools + gt-data + ${geotools.version} + + + org.geotools + gt-epsg-wkt + ${geotools.version} + + + org.geotools + gt-jdbc + ${geotools.version} + + + org.geotools.jdbc + gt-jdbc-postgis + ${geotools.version} + + + org.geotools + gt-shapefile + ${geotools.version} + + + org.geotools + gt-geojson + ${geotools.version} + + + com.googlecode.json-simple + json-simple + 1.1.1 + + + org.geotools + gt-swing + ${geotools.version} + + + org.locationtech.jts + jts-core + 1.16.1 + + + org.geotools + gt-wms + ${geotools.version} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + osgeo + OSGeo Release Repository + https://repo.osgeo.org/repository/release/ + false + true + + + osgeo-snapshot + OSGeo Snapshot Repository + https://repo.osgeo.org/repository/snapshot/ + true + false + + + @@ -126,4 +294,5 @@ ${project.artifactId} + diff --git a/ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java b/ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java index d09ea5b..e187aa0 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/RuoYiApplication.java @@ -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; /** diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/aop/ApiVisitHistory.java b/ruoyi-admin/src/main/java/com/ruoyi/web/aop/ApiVisitHistory.java new file mode 100644 index 0000000..809bba6 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/aop/ApiVisitHistory.java @@ -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 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; + } + +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/aop/AtomicCounter.java b/ruoyi-admin/src/main/java/com/ruoyi/web/aop/AtomicCounter.java new file mode 100644 index 0000000..71f3de2 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/aop/AtomicCounter.java @@ -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(); + } + +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/crops/CropsComprehensiveDataController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/crops/CropsComprehensiveDataController.java index 784933d..4807c6c 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/crops/CropsComprehensiveDataController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/crops/CropsComprehensiveDataController.java @@ -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) { diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/crops/CropsDroughtController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/crops/CropsDroughtController.java index aabfe78..905fd1c 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/crops/CropsDroughtController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/crops/CropsDroughtController.java @@ -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 selectByTime(@PathVariable("time")Date time){ return iCropsDroughtService.selectByTime(time); diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/crops/CropsGrowthController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/crops/CropsGrowthController.java index a0e5fab..f305477 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/crops/CropsGrowthController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/crops/CropsGrowthController.java @@ -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 selectByTime(@PathVariable("time") Date time){ return iCropsGrowthService.selectByTime(time); diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/crops/CropsStructureController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/crops/CropsStructureController.java index a3fd589..79d8534 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/crops/CropsStructureController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/crops/CropsStructureController.java @@ -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 selectByTime(@PathVariable Date time){ return iCropsStructureService.selectByTime(time); diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/crops/CropsUserController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/crops/CropsUserController.java new file mode 100644 index 0000000..c6f38fc --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/crops/CropsUserController.java @@ -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 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)); + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/crops/CropsYieldConeroller.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/crops/CropsYieldConeroller.java index 78d5937..c0e21d4 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/crops/CropsYieldConeroller.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/crops/CropsYieldConeroller.java @@ -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 selectByYear(@PathVariable Integer year){ return iCropsYieldService.selectByYear(year); diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/crops/DataAcquisitionController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/crops/DataAcquisitionController.java new file mode 100644 index 0000000..0124dac --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/crops/DataAcquisitionController.java @@ -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(); + } +} + diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/crops/DeviceSenseController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/crops/DeviceSenseController.java index c801c7c..ae37b9d 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/crops/DeviceSenseController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/crops/DeviceSenseController.java @@ -3,6 +3,7 @@ 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; @@ -13,16 +14,20 @@ 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 { - private static final Logger logger = LoggerFactory.getLogger("scheduled"); +public class DeviceSenseController extends BaseController { + private static final Logger logger = LoggerFactory.getLogger(DeviceSenseController.class); @Value("${url.deviceSense}") String url;//指定UR @@ -40,71 +45,91 @@ public class DeviceSenseController { * @param endTime * @return */ - @GetMapping - public List selectBytime(@RequestParam String startTime, @RequestParam String endTime) { + @PreAuthorize("@ss.hasPermi('crops:device:select')") + @GetMapping() + public List selectBytime(@RequestParam Date startTime, @RequestParam Date endTime) { return iDeviceSenseService.selectByTime(startTime, endTime); } /** * 定时任务调用接口获取数据插入数据库 - * - * @throws Exception */ @Scheduled(fixedDelay = 6 * 60 * 1000) - public void getsense() throws Exception { + public DeviceSense getsense(){ String deviceId = "863070042491174-1-1"; Map map = new HashMap<>();//存放参数 map.put("deviceId", deviceId); //发送get请求 String result = HttpUtil.createGet(url).form(map).execute().body(); - //格式化json时间类型数据 - Gson gson = new GsonBuilder().setDateFormat("yyyy/MM/dd HH:mm:ss").create(); - //格式化json,封装到GsonDeviceSenseBean类型 - GsonDeviceSenseBean model = gson.fromJson(result, GsonDeviceSenseBean.class); - //创建DeviceSense对象,设置deviceId - DeviceSense deviceSense = new DeviceSense(); - deviceSense.setDeviceId(deviceId); - //通过反射获取成员变量name与json字段匹配入库 - Class clazz = Class.forName("com.ruoyi.crops.domain.DeviceSense"); - for (GsonDeviceSenseBean.AttDataList attDataList : model.data.attDataList) { - //2.获取成员变量 - String attributeValue = attDataList.attributeValue; - Field field = clazz.getDeclaredField(attDataList.attributeName); - //设置私有变量也可访问 - field.setAccessible(true); - //判断数据类型进行相应转换 - if (attributeValue != null) { - switch (field.getType().getName()) { - case "java.lang.Double": - field.set(deviceSense, Double.valueOf(attributeValue)); - break; - case "java.lang.Integer": - field.set(deviceSense, Integer.valueOf(attributeValue)); - break; - case "java.lang.String": - field.set(deviceSense, attributeValue); - break; - case "java.util.Date": - field.set(deviceSense, new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(attributeValue)); + 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); + //使用sql判断重复数据插入 + iDeviceSenseService.dedupInsert(deviceSense); - //判断设备预警信息 插入异常数据库 - iWarningService.insertWarning(deviceSense); - logger.info("每6分钟更新一次设备传感数据"); + //判断设备预警信息 插入异常数据库 + 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 select(@RequestParam Date startTime, @RequestParam Date endTime) { + return iDeviceSenseService.selectByTime(startTime, endTime); + } + } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/crops/FarmMachineryController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/crops/FarmMachineryController.java new file mode 100644 index 0000000..1f78970 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/crops/FarmMachineryController.java @@ -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 list = iFarmMachineryService.selectMachineryData(); + return getDataTable(list); + } + + /** + * 农机位置查询 + * + * @param vehicleno + * @return + */ + @GetMapping("/position") + public JSONObject machineryPosition(@RequestParam(value = "vehicleno", required = false) String vehicleno) { + Map 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 position = gsonMachineryPositionBean.getPosition(); + if (position.size()>0){ + iFarmMachineryService.insertPositions(position); + WithinAndIntersects(position); + } + return JSONObject.parseObject(result); + } + //判断农机经纬度是否在范围内 + public void WithinAndIntersects(List position) { + List> maps = null; + try { + //读取上传的shp文件 + maps = ShapeUtil.readShp(RuoYiConfig.getUploadPath() + "/shpFile/shapefile.shp"); + } catch (IOException e) { + e.printStackTrace(); + } + for (Map 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 list = iFarmMachineryService.selectMachineryJobData(startTime, endTime, vehicleno); + return getDataTable(list); + } + + /** + * 查询全部农机编号 + * @return + */ + @GetMapping("/selectVehicleno") + public AjaxResult selectVehicleno(){ + List list = iFarmMachineryService.selectVehicleno(); + return AjaxResult.success(list); + } + + /** + * 今日作业查询 + * + * @return + */ + @GetMapping("/selectTodayJobData") + public AjaxResult selectTodayJobData() { + MachineryJobDataVo data = iFarmMachineryService.selectTodayJobData(); + Map 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 list = iFarmMachineryService.selectMachineryJobData(startTime, endTime, vehicleno); + ExcelUtil util = new ExcelUtil<>(MachineryJobDataVo.class); +// util.exportExcel(response, list, "农机作业信息"); + AjaxResult excelName = util.exportExcel(list, "农机作业信息"); + String msg = (String) excelName.get("msg"); + Map result = new HashMap<>(); + result.put("path", RuoYiConfig.getDownloadPath() + msg); + return AjaxResult.success(result); + } + + /** + * 查询农机轨迹信息 + * + * @param workplace + * @param pttime + * @return + */ + @GetMapping("/VehicleTrack") + public List selectVehicleTrack(String workplace, Date pttime) { + return iFarmMachineryService.selectVehicleTrack(workplace, pttime); + } + + + /** + * 农机设备状态查询 + * + * @return + */ + @GetMapping("/selectFarmStatus") + public FarmStatus selectFarmStatus() { + FarmStatus farmStatus = new FarmStatus(); + //农机设备信息查询 + List 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> areaWorkhoursMap = new HashMap<>(); + //查询作业地块 + List workplaceList = iFarmMachineryService.distinctWorkplace(); + Map result = new HashMap<>(); + StringBuilder multiPolygon = new StringBuilder("MULTIPOLYGON(("); + List userdata = new ArrayList<>(); + StringBuilder multiLineString = new StringBuilder("MULTILINESTRING("); + for (String workplace : workplaceList) { + List pointList = new ArrayList<>(); + Date date = new Date(2023 - 1900, 3 - 1, 13); + //根据作业地块和时间查询农机轨迹数据 + List 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 map = new HashMap<>(); + map.put("polygon", polygon); + + //在经纬度数组后加入第一个点位,形成闭环 + pointList.add(pointList.size(), pointList.get(0)); + //使用凸包算法过滤出边界 + List 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 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 mp = new HashMap<>(); + mp.put("area", area); + mp.put("workHours", pttime); + areaWorkhoursMap.put(trajectory.getVehicleno(), mp); + + result.put(workplace, map); + + } + //统计作业时长和面积插入数据库 + for (Map.Entry> entry : areaWorkhoursMap.entrySet()) { + String vehicleno = entry.getKey(); + Map 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 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 machineryJobDataVos = iFarmMachineryService.selectMachineryJobData(DateUtil.getDayBegin(), DateUtil.getBeginDayOfTomorrow(), null); + //查询作业信息 + List 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 list = JSON.parseArray(postions, MachineryTrajectory.class); + iFarmMachineryService.insertProcessPositions(list, vehicleno); + } + } + + //农机作业任务查询每天九点查询一次 + @Scheduled(cron = "0 0 9 * * ?") + public void getMachineryJobData() throws ParseException { + Map 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 list = JSONArray.parseArray(jobdata.toJSONString(), MachineryJobData.class); + //进行数据去重 + List 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 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 list = vehicleList.getVehicle(); + //从数据库里查询出来的数据 + List 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); + } + } + +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/crops/FertigationSenseController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/crops/FertigationSenseController.java index b274733..fdb78d7 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/crops/FertigationSenseController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/crops/FertigationSenseController.java @@ -3,7 +3,6 @@ package com.ruoyi.web.controller.crops; import cn.hutool.http.HttpUtil; import com.google.gson.Gson; import com.google.gson.GsonBuilder; -import com.ruoyi.crops.domain.DeviceSense; import com.ruoyi.crops.domain.FertigationSense; import com.ruoyi.crops.domain.gsonBean.GsonDeviceSenseBean; import com.ruoyi.crops.service.IFertigationSenseService; @@ -16,66 +15,79 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import java.lang.reflect.Field; -import java.text.SimpleDateFormat; import java.util.HashMap; import java.util.List; import java.util.Map; import static org.assertj.core.util.DateUtil.now; +/** + * 水肥一体机设备传感数据Controller + */ @RestController @RequestMapping public class FertigationSenseController { - private static final Logger logger = LoggerFactory.getLogger("scheduled"); + private static final Logger logger = LoggerFactory.getLogger(FertigationSenseController.class); @Value("${url.deviceSense}") - String url;//指定UR + String url;//指定URL @Autowired private IFertigationSenseService iFertigationSenseService; + /** + * 定时获取水肥一体机设备数据 + * @throws Exception + */ @Scheduled(fixedDelay = 60 * 60 * 1000) - public void getsense() throws Exception { + public FertigationSense getsense() throws Exception { String deviceId = "645281df92edbc7ee9427230_NHWL-MengLiangGu-Fertigation"; Map map = new HashMap<>();//存放参数 map.put("deviceId", deviceId); //发送get请求 String result = HttpUtil.createGet(url).form(map).execute().body(); - //格式化json时间类型数据 - Gson gson = new GsonBuilder().setDateFormat("yyyy/MM/dd HH:mm:ss").create(); - //格式化json,封装到GsonDeviceSenseBean类型 - GsonDeviceSenseBean model = gson.fromJson(result, GsonDeviceSenseBean.class); - //创建DeviceSense对象,设置deviceId - FertigationSense fertigationSense = new FertigationSense(); - fertigationSense.setDeviceId(deviceId); - fertigationSense.setTime(now()); - //通过反射获取成员变量name与json字段匹配入库 - Class clazz = Class.forName("com.ruoyi.crops.domain.FertigationSense"); - for (GsonDeviceSenseBean.AttDataList attDataList : model.data.attDataList) { - //2.获取成员变量 - String attributeValue = attDataList.attributeValue; - Field field = clazz.getDeclaredField(attDataList.attributeName); - //设置私有变量也可访问 - field.setAccessible(true); - //判断数据类型进行相应转换 - if (attributeValue != null) { - switch (field.getType().getName()) { - case "java.lang.Double": - field.set(fertigationSense, Double.valueOf(attributeValue)); - break; - case "java.lang.Integer": - field.set(fertigationSense, Integer.valueOf(attributeValue)); - break; - case "java.lang.String": - field.set(fertigationSense, attributeValue); - break; + 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; } - //使用sql判断重复数据插入 - iFertigationSenseService.insert(fertigationSense); - logger.info("每小时更新一次水肥一体机设备传感数据"); } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/crops/InterfaceStatisticsController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/crops/InterfaceStatisticsController.java new file mode 100644 index 0000000..9c32b78 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/crops/InterfaceStatisticsController.java @@ -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(); + } + +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/crops/MachineParameterController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/crops/MachineParameterController.java index 00614f0..b998baf 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/crops/MachineParameterController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/crops/MachineParameterController.java @@ -1,43 +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 selectByName(@PathVariable String name) { - return machineParameterService.selectByName(name); - } + @Autowired + private IOperationRecordsService iOperationRecordsService; + + @Autowired + private RedisTemplate redisTemplate; /** - * 新增单条数据 + * 获取水肥一体机状态进行两次对比,得到哪些参数被修改,存入操作记录 + * + * @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 compareColumns = new HashMap() { + { + 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值,流量,压力值 * - * @param machineParameter * @return */ - @PostMapping - public AjaxResult insert(@RequestBody MachineParameter machineParameter) { - return toAjax(machineParameterService.insert(machineParameter)); + + @GetMapping("/select") + public MachineParameterVo selectParameter() throws Exception { + return machineParameterService.selectParameter(); } + } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/crops/MeteorologicalController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/crops/MeteorologicalController.java index 32aec77..bb71649 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/crops/MeteorologicalController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/crops/MeteorologicalController.java @@ -1,27 +1,35 @@ 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("scheduled"); + private static final Logger logger = LoggerFactory.getLogger(MeteorologicalController.class); @Value("${Meteorological.url}") private String url; @@ -33,6 +41,13 @@ public class MeteorologicalController { @Autowired private IMeteorologicalService iMeteorologicalService; + + /** + * 查询预警数据 + * + * @return + */ + @PreAuthorize("@ss.hasPermi('crops:meterological:select')") @GetMapping("/meterological") public AjaxResult selectByTime() { if (iMeteorologicalService.selectByTime().isEmpty()) { @@ -41,40 +56,24 @@ public class MeteorologicalController { return AjaxResult.success(iMeteorologicalService.selectByTime()); } + /** + * 定时查询天气数据并去重保存 + */ @Scheduled(fixedDelay = 60 * 60 * 1000) - public void MeteorologicalInfo() { + public List MeteorologicalInfo() { Map map = new HashMap<>();//存放参数 map.put("city_code", code); map.put("key", key); -// HashMap headers = new HashMap<>();//存放请求头,可以存放多个请求头 -// headers.put("xxx", xxx); //发送get请求并接收响应数据 String result = HttpUtil.createGet(url).form(map).execute().body(); //格式化Json时间类型 Gson gson = new GsonBuilder().setDateFormat("yyyy-MM-dd HH:mm:ss").create(); - //讲json转换成对应实体类 + //将json转换成对应实体类 GsonMeteorologicalBean model = gson.fromJson(result, GsonMeteorologicalBean.class); //判断json是否有数据 if (model.result != null) { - ArrayList meteorologicalArrayList = model.result; - //创建一个空的list集合存放json解析的Meteorological实体数据 - List list = new ArrayList<>(); - //遍历json数组里的参数,存入实体类 - for (GsonMeteorologicalBean.Meteorological meteorological : meteorologicalArrayList) { - //新建实体类 - Meteorological ml = new Meteorological(); - ml.setWarnId(meteorological.id); - ml.setTitle(meteorological.title); - ml.setLevel(meteorological.level); - ml.setType(meteorological.type); - ml.setTime(meteorological.time); - ml.setProvince(meteorological.province); - ml.setCity(meteorological.city); - ml.setDistrict(meteorological.district); - ml.setContent(meteorological.content); - list.add(ml); - } + List list = model.result; //从数据库查询出今日的预警信息 List meteorologicals = iMeteorologicalService.selectByTime(); //剔除两个集合里面重复元素根据WarnId和Time @@ -82,20 +81,26 @@ public class MeteorologicalController { Meteorological me = list.get(i); for (int j = 0; j < meteorologicals.size(); j++) { Meteorological m = meteorologicals.get(j); - if (me.getWarnId().equals(m.getWarnId()) && me.getTime().equals(m.getTime())) { + if (me.getId() == Integer.parseInt(m.getWarnId()) && me.getTime().equals(m.getTime())) { list.remove(i); i--; } } } - //遍历去重集合插入数据库 - for (Meteorological meteorological : list) { - iMeteorologicalService.insert(meteorological); + if (!list.isEmpty()) { + //list顺序反转 + Collections.reverse(list); + logger.info("每小时更新1次天气预警"); + iMeteorologicalService.insertBatch(list); + } else { + logger.info("本小时内无新预警"); } - logger.info("每小时更新1次天气预警"); + + return list; + } else { logger.info("今日暂无预警"); } - + return model.result; } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/crops/OperationRecordsController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/crops/OperationRecordsController.java index 54e3547..8aa81e5 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/crops/OperationRecordsController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/crops/OperationRecordsController.java @@ -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; @@ -23,6 +24,7 @@ public class OperationRecordsController extends BaseController { * * @return */ + @PreAuthorize("@ss.hasPermi('operation:records:list')") @GetMapping("/list") public List listAll() { return iOperationRecordsService.selectAll(); diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/crops/ServiceTypeController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/crops/ServiceTypeController.java index a58a581..e7dd0aa 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/crops/ServiceTypeController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/crops/ServiceTypeController.java @@ -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") @@ -24,6 +25,7 @@ public class ServiceTypeController extends BaseController { * @param type * @return */ + @PreAuthorize("@ss.hasPermi('crops:service:type')") @GetMapping("/{type}") public List selectByType(@PathVariable String type) { return typeService.selectByType(type); @@ -34,6 +36,7 @@ public class ServiceTypeController extends BaseController { * * @return */ + @PreAuthorize("@ss.hasPermi('service:type:selectAll')") @GetMapping public List selectAll() { return typeService.selectAll(); @@ -45,6 +48,7 @@ public class ServiceTypeController extends BaseController { * @param serviceType * @return */ + @PreAuthorize("@ss.hasPermi('service:type:insert')") @PostMapping("insert") public AjaxResult insert(@RequestBody ServiceType serviceType) { return toAjax(typeService.insert(serviceType)); @@ -56,6 +60,7 @@ public class ServiceTypeController extends BaseController { * @param ids * @return */ + @PreAuthorize("@ss.hasPermi('service:type:delete')") @DeleteMapping("/{ids}") private AjaxResult remove(@PathVariable Long[] ids) { return toAjax(typeService.deleteByIds(ids)); diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/crops/UploadController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/crops/UploadController.java index 0616f73..257fdf2 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/crops/UploadController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/crops/UploadController.java @@ -1,17 +1,16 @@ package com.ruoyi.web.controller.crops; -import cn.hutool.http.HttpUtil; +import com.ruoyi.common.config.RuoYiConfig; import com.ruoyi.common.core.domain.AjaxResult; -import com.ruoyi.common.utils.BashUtils; +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.apache.commons.io.FileUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; -import org.springframework.transaction.annotation.Transactional; -import org.springframework.util.ResourceUtils; + import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; @@ -20,17 +19,15 @@ import org.springframework.web.multipart.MultipartFile; import java.io.File; import java.io.IOException; -import java.net.URL; import java.text.SimpleDateFormat; import java.util.Date; import java.util.HashMap; +import java.util.List; import java.util.Map; @RestController @RequestMapping("/crops") public class UploadController { - @Value("${url.group1Upload}") - private String url; private String workSpace = "PJZ"; @Value("${path.exepath}") @@ -48,6 +45,9 @@ public class UploadController { @Autowired private IexeService iexeService; + @Autowired + private IFarmMachineryService iFarmMachineryService; + /** * 上传TIFF文件 * @@ -57,19 +57,17 @@ public class UploadController { * @throws Exception */ @PostMapping("/upload") - @Transactional(rollbackFor = Exception.class) public AjaxResult upload(@RequestParam("type") String type, @RequestParam("file") MultipartFile file) throws Exception { - //获得项目的static路径 - String realPath = ResourceUtils.getURL("classpath:").getPath() + "static"; - //获得文件路径 - String filePath = iUploadService.upload(type, file, realPath); + String uploadPath = RuoYiConfig.getUploadPath(); + //保存文件到本地并获得文件路径 + String filePath = iUploadService.upload(file, uploadPath+"/tifFile"); //调用接口上传文件到服务器 - Map map = new HashMap<>();//存放参数 +// Map 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(); +// map.put("file", targetFile); +// map.put("path", "pjz/tif"); +// String result = HttpUtil.createPost(url).form(map).execute().body(); //获取文件信息 String name = targetFile.getName(); @@ -87,10 +85,11 @@ public class UploadController { serviceType.setTime(date); serviceType.setServiceName(servieName); serviceType.setFileName(name); - serviceType.setFilePath(result); + serviceType.setFilePath(filePath); + serviceType.setStyle(type); //发送地图服务 - String pjz = iGeoServer.GeoServer(workSpace, fileName, filePath); + String pjz = iGeoServer.publishTiff(workSpace, fileName, filePath, type); //调用exe批量导入数据 String res = iexeService.execCommand(type, targetFile.getAbsolutePath(), boundaryDataPath); @@ -99,4 +98,26 @@ public class UploadController { 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()); + } + } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/crops/UserInfoController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/crops/UserInfoController.java index 5b70bd6..0ad4c41 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/crops/UserInfoController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/crops/UserInfoController.java @@ -8,6 +8,7 @@ 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.RequestMapping; @@ -18,9 +19,8 @@ import java.util.HashMap; @RestController @RequestMapping("/user/info") - public class UserInfoController extends BaseController { - private static final Logger logger = LoggerFactory.getLogger("scheduled"); + private static final Logger logger = LoggerFactory.getLogger(UserInfoController.class); @Autowired private RedisTemplate redisTemplate; diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/crops/WarningController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/crops/WarningController.java index 4899dab..67d540d 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/crops/WarningController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/crops/WarningController.java @@ -2,18 +2,22 @@ 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") @@ -22,13 +26,17 @@ public class WarningController extends BaseController { private IWarningService iWarningService; /** - * 根据时间查询 + * 预警信息根据时间查询 * * @return */ + @PreAuthorize("@ss.hasPermi('warning:information:selectByTime')") @GetMapping("/selectByTime") - public List selectBytTime(@RequestParam Date startTime, @RequestParam Date endTime) { - return iWarningService.selectByTime(startTime, endTime); + public TableDataInfo selectBytTime(@RequestParam(required = false) Date startTime, + @RequestParam(required = false) Date endTime) { + startPage(); + List list = iWarningService.selectByTime(startTime, endTime); + return getDataTable(list); } /** @@ -42,6 +50,12 @@ public class WarningController extends BaseController { return toAjax(iWarningService.insert(warningInformation)); } + /** + * 大棚预警次数查询 + * + * @return + */ + @PreAuthorize("@ss.hasPermi('warning:information:numberOfTimes')") @GetMapping("/numberOfTimes") public AjaxResult numberOfTimes() { List daylist = iWarningService.selectByTime(DateUtil.getDayBegin(), DateUtil.getDayEnd()); @@ -58,5 +72,6 @@ public class WarningController extends BaseController { waringNumber.setMonthNumber(monthNumber); return AjaxResult.success(waringNumber); } + } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/crops/WarningFarmController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/crops/WarningFarmController.java new file mode 100644 index 0000000..fd58d55 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/crops/WarningFarmController.java @@ -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 daylist = iWarningFarmService.selectByTime(DateUtil.getDayBegin(), DateUtil.getDayEnd()); + int dayNumber = daylist.size(); + + List weeklist = iWarningFarmService.selectByTime(DateUtil.getBeginDayOfWeek(), DateUtil.getEndDayOfWeek()); + int weekNumber = weeklist.size(); + + List 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 list = iWarningFarmService.selectByTime(startTime, endTime); + return getDataTable(list); + } + + //判断农机预警 + @Scheduled(fixedDelay = 5 * 60 * 1000) + public void warning() { + //查询今日作业农机编号 + List vehiclenoList = iFarmMachineryService.distinctVehicleno(); + //根据编号查询作业地块 + for (String vehicleno : vehiclenoList) { + List workplaceList = iFarmMachineryService.distinctWorkplace(vehicleno); + Date lastTime = null; + //根据地块查询具体作业数据 + for (String workplace : workplaceList) { + Date date = new Date(2023 - 1900, 3 - 1, 13); + //根据作业地块和时间查询农机轨迹数据 + List 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 + "小时"); + } + } + } + } + +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/crops/WeatherPredictionController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/crops/WeatherPredictionController.java new file mode 100644 index 0000000..b1df1a3 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/crops/WeatherPredictionController.java @@ -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 selectWeek() { + return iWeatherPredictionService.selectWeek(); + } + + + /** + * 气象数据对比查询 + * + * @param time1 + * @param time2 + * @return + */ + @PreAuthorize("@ss.hasPermi('crops:weather:compareTime')") + @GetMapping("/compareTime") + public List compareTime(@RequestParam Date time1, @RequestParam Date time2) { + List weather1 = iWeatherPredictionService.selectByTime(time1); + List 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 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 getWeather() throws IOException { + List weatherList = iWeatherPredictionService.getWeather(); + iWeatherPredictionService.insertBatch(weatherList); + logger.info("每小时更新博兴天气数据"); + return weatherList; + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/pill/PillFactoryController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/pill/PillFactoryController.java index 16617a8..3134e79 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/pill/PillFactoryController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/pill/PillFactoryController.java @@ -17,7 +17,7 @@ import java.util.List; /** * 生产厂家信息Controller - * + * * @author my * @date 2023-04-18 */ diff --git a/ruoyi-admin/src/main/resources/application.yml b/ruoyi-admin/src/main/resources/application.yml index a9e8859..f361083 100644 --- a/ruoyi-admin/src/main/resources/application.yml +++ b/ruoyi-admin/src/main/resources/application.yml @@ -133,8 +133,9 @@ 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' +# 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' @@ -148,6 +149,12 @@ path: Meteorological: url: 'https://apis.juhe.cn/fapig/alarm/queryV2' -# key: 'f072a23affd5551ecd9ae3a98d703b1c' - key : '123' + 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' diff --git a/ruoyi-admin/src/test/java/com/ruoyi/web/PssTest.java b/ruoyi-admin/src/test/java/com/ruoyi/web/PssTest.java index c5b5ab1..7c1a601 100644 --- a/ruoyi-admin/src/test/java/com/ruoyi/web/PssTest.java +++ b/ruoyi-admin/src/test/java/com/ruoyi/web/PssTest.java @@ -1,77 +1,100 @@ package com.ruoyi.web; -import cn.hutool.http.HttpUtil; -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.ruoyi.crops.domain.DeviceSense; -import com.ruoyi.crops.domain.FertigationSense; -import com.ruoyi.crops.domain.WarningInformation; -import com.ruoyi.crops.domain.gsonBean.GsonDeviceSenseBean; -import com.ruoyi.crops.service.IFertigationSenseService; -import com.ruoyi.crops.service.IWarningService; -import it.geosolutions.geoserver.rest.GeoServerRESTManager; -import it.geosolutions.geoserver.rest.GeoServerRESTPublisher; -import it.geosolutions.geoserver.rest.encoder.GSLayerEncoder; -import it.geosolutions.geoserver.rest.encoder.feature.GSFeatureTypeEncoder; +import 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.lang.reflect.Field; -import java.net.URL; -import java.text.SimpleDateFormat; -import java.util.Calendar; -import java.util.GregorianCalendar; -import java.util.HashMap; -import java.util.Map; - -import static org.assertj.core.util.DateUtil.now; +import java.util.*; +import java.util.regex.Matcher; +import java.util.regex.Pattern; @SpringBootTest public class PssTest { - - @Value("${geoserver.url}") + @Value("${url.machine}") private String url; - @Value("${geoserver.username}") - private String username; - @Value("${geoserver.password}") - private String password; + @Autowired + private IWeatherPredictionService iWeatherPredictionService; + @Autowired + private IDataAcquisitionService iDataAcquisitionService; @Autowired - private IWarningService iWarningService; + private IMapDrawPolygonService iMapDrawPolygonService; + @Autowired + private IFarmMachineryService iFarmMachineryService; + + @Autowired + private IWarningFarmService iWarningFarmService; + @Test public void test() throws Exception { -// publisherLayer("PJZ","zwhq_2023-05-11","zwhq","a","PJZ:zwcl_xm_2023-04-20","c",1); - getDayBegin(); +// List 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; jarr[j+1]){ +// temp = arr[j]; +// arr[j] = arr[j+1]; +// arr[j+1] = temp; +// } +// } + +// } } - public static java.util.Date getDayBegin() { - Calendar cal = new GregorianCalendar(); - cal.set(Calendar.HOUR_OF_DAY, 0); - cal.set(Calendar.MINUTE, 0); - cal.set(Calendar.SECOND, 0); - cal.set(Calendar.MILLISECOND, 0); - System.out.println(cal.getTime()); - return cal.getTime(); + @Test + public void test5() throws ParseException { + +// List 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 comparing = Comparator.comparing(WeatherPredictionEntity::getAirTemperature); +// Comparator humidity = Comparator.comparing(WeatherPredictionEntity::getHumidity); +// Comparator 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 boolean publisherLayer(String workspaceName,String dataStoreName,String styleName, String tableName,String layerName, String layerAlias, int crsCode) throws Exception { - URL u = new URL(url); - GeoServerRESTManager manager = new GeoServerRESTManager(u, username, password); - GeoServerRESTPublisher publisher = manager.getPublisher(); + public static void main(String[] args) throws Exception { - //图层设置 - GSFeatureTypeEncoder gsFeatureTypeEncoder = new GSFeatureTypeEncoder(); - gsFeatureTypeEncoder.setNativeName(tableName); //表名 - gsFeatureTypeEncoder.setName(layerName); // 图层名称 - gsFeatureTypeEncoder.setTitle(layerAlias);// 图层别名 - gsFeatureTypeEncoder.setSRS("EPSG:" + crsCode); //坐标系 +// 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"); - GSLayerEncoder styleEncoder = new GSLayerEncoder(); //设置样式 - styleEncoder.setDefaultStyle(workspaceName,styleName); + //读取shp文件 +// +// List list = ShapeUtil.readShp("D:\\ruoyi\\uploadPath\\upload\\shpFile\\2023-06-25polygon.shp"); +// Map 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); - boolean publishDBLayerResult = publisher.publishDBLayer(workspaceName, dataStoreName, gsFeatureTypeEncoder, styleEncoder); - return publishDBLayerResult; +// ShapeUtil.unzip("", ""); } + } - diff --git a/ruoyi-common/pom.xml b/ruoyi-common/pom.xml index 85a621c..12779d0 100644 --- a/ruoyi-common/pom.xml +++ b/ruoyi-common/pom.xml @@ -129,7 +129,42 @@ org.projectlombok lombok + + org.locationtech.jts + jts-core + 1.16.1 + compile + + + org.geotools + gt-shapefile + 20.5 + compile + + + org.geotools + gt-geojson + 20.5 + compile + + + + osgeo + OSGeo Release Repository + https://repo.osgeo.org/repository/release/ + false + true + + + osgeo-snapshot + OSGeo Snapshot Repository + https://repo.osgeo.org/repository/snapshot/ + true + false + + + diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/DateUtil.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/DateUtil.java index 7e1d6d8..c2bf5a9 100644 --- a/ruoyi-common/src/main/java/com/ruoyi/common/utils/DateUtil.java +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/DateUtil.java @@ -76,6 +76,14 @@ public class DateUtil { 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() { @@ -233,6 +241,27 @@ public class DateUtil { 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) { diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/MyPoint.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/MyPoint.java new file mode 100644 index 0000000..8534229 --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/MyPoint.java @@ -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 + + '}'; + } +} diff --git a/ruoyi-common/src/main/java/com/ruoyi/common/utils/ShapeUtil.java b/ruoyi-common/src/main/java/com/ruoyi/common/utils/ShapeUtil.java new file mode 100644 index 0000000..c4b829b --- /dev/null +++ b/ruoyi-common/src/main/java/com/ruoyi/common/utils/ShapeUtil.java @@ -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 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> readShp(String shpPath) throws IOException { + //加载文件 + File file = new File(shpPath); + if (file == null) { + return null; + } + //map记录shapefile key-value数据 + List> list = new ArrayList>(); + //通过store获取featurecollection + FileDataStore store = FileDataStoreFinder.getDataStore(file); + SimpleFeatureSource featureSource = store.getFeatureSource(); + SimpleFeatureCollection simpleFeatureCollection = featureSource.getFeatures(); + SimpleFeatureIterator itertor = simpleFeatureCollection.features(); + //遍历featurecollection + while (itertor.hasNext()) { + Map data = new HashMap<>(); + SimpleFeature feature = itertor.next(); + Collection p = feature.getProperties(); + Iterator 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 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 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(); + } +} diff --git a/ruoyi-crops/pom.xml b/ruoyi-crops/pom.xml index 6c01916..07410be 100644 --- a/ruoyi-crops/pom.xml +++ b/ruoyi-crops/pom.xml @@ -31,6 +31,26 @@ 1.7.0-pdok2 compile + + org.jsoup + jsoup + 1.16.1 + compile + + + + + javax.persistence + persistence-api + 1.0.2 + provided + + + javax + javaee-api + 6.0 + provided + diff --git a/ruoyi-crops/src/main/java/com/ruoyi/crops/domain/CropsComprehensiveData.java b/ruoyi-crops/src/main/java/com/ruoyi/crops/domain/CropsComprehensiveData.java index 3c1b993..6fbd02e 100644 --- a/ruoyi-crops/src/main/java/com/ruoyi/crops/domain/CropsComprehensiveData.java +++ b/ruoyi-crops/src/main/java/com/ruoyi/crops/domain/CropsComprehensiveData.java @@ -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) diff --git a/ruoyi-crops/src/main/java/com/ruoyi/crops/domain/CropsUser.java b/ruoyi-crops/src/main/java/com/ruoyi/crops/domain/CropsUser.java new file mode 100644 index 0000000..b8d6b0a --- /dev/null +++ b/ruoyi-crops/src/main/java/com/ruoyi/crops/domain/CropsUser.java @@ -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; + } +} diff --git a/ruoyi-crops/src/main/java/com/ruoyi/crops/domain/DataAcquisition.java b/ruoyi-crops/src/main/java/com/ruoyi/crops/domain/DataAcquisition.java new file mode 100644 index 0000000..955d91f --- /dev/null +++ b/ruoyi-crops/src/main/java/com/ruoyi/crops/domain/DataAcquisition.java @@ -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 + + '}'; + } + } diff --git a/ruoyi-crops/src/main/java/com/ruoyi/crops/domain/DeviceSense.java b/ruoyi-crops/src/main/java/com/ruoyi/crops/domain/DeviceSense.java index 73afdaf..44328c6 100644 --- a/ruoyi-crops/src/main/java/com/ruoyi/crops/domain/DeviceSense.java +++ b/ruoyi-crops/src/main/java/com/ruoyi/crops/domain/DeviceSense.java @@ -1,6 +1,7 @@ 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; @@ -85,7 +86,8 @@ public class DeviceSense { private Integer BeiYong2 ; /** 上报时间 */ - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")//接收时间类型 + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")//返回时间类型 private Date time ; public Integer getId() { diff --git a/ruoyi-crops/src/main/java/com/ruoyi/crops/domain/FarmMachinery.java b/ruoyi-crops/src/main/java/com/ruoyi/crops/domain/FarmMachinery.java new file mode 100644 index 0000000..a4f11a1 --- /dev/null +++ b/ruoyi-crops/src/main/java/com/ruoyi/crops/domain/FarmMachinery.java @@ -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; + } +} diff --git a/ruoyi-crops/src/main/java/com/ruoyi/crops/domain/FarmStatus.java b/ruoyi-crops/src/main/java/com/ruoyi/crops/domain/FarmStatus.java new file mode 100644 index 0000000..e99334d --- /dev/null +++ b/ruoyi-crops/src/main/java/com/ruoyi/crops/domain/FarmStatus.java @@ -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 + + '}'; + } +} diff --git a/ruoyi-crops/src/main/java/com/ruoyi/crops/domain/InterfaceStatistics.java b/ruoyi-crops/src/main/java/com/ruoyi/crops/domain/InterfaceStatistics.java new file mode 100644 index 0000000..af34d2d --- /dev/null +++ b/ruoyi-crops/src/main/java/com/ruoyi/crops/domain/InterfaceStatistics.java @@ -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 + + '}'; + } + } diff --git a/ruoyi-crops/src/main/java/com/ruoyi/crops/domain/MachineParameter.java b/ruoyi-crops/src/main/java/com/ruoyi/crops/domain/MachineParameter.java index d1b6043..cd803d1 100644 --- a/ruoyi-crops/src/main/java/com/ruoyi/crops/domain/MachineParameter.java +++ b/ruoyi-crops/src/main/java/com/ruoyi/crops/domain/MachineParameter.java @@ -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 + '\'' + '}'; } } diff --git a/ruoyi-crops/src/main/java/com/ruoyi/crops/domain/MachineryJobData.java b/ruoyi-crops/src/main/java/com/ruoyi/crops/domain/MachineryJobData.java new file mode 100644 index 0000000..cfc2a5e --- /dev/null +++ b/ruoyi-crops/src/main/java/com/ruoyi/crops/domain/MachineryJobData.java @@ -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 + + '}'; + } + } diff --git a/ruoyi-crops/src/main/java/com/ruoyi/crops/domain/MachineryPosition.java b/ruoyi-crops/src/main/java/com/ruoyi/crops/domain/MachineryPosition.java new file mode 100644 index 0000000..2302d57 --- /dev/null +++ b/ruoyi-crops/src/main/java/com/ruoyi/crops/domain/MachineryPosition.java @@ -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; + } +} diff --git a/ruoyi-crops/src/main/java/com/ruoyi/crops/domain/OperationRecords.java b/ruoyi-crops/src/main/java/com/ruoyi/crops/domain/OperationRecords.java index 5cdadd1..0a4a3a4 100644 --- a/ruoyi-crops/src/main/java/com/ruoyi/crops/domain/OperationRecords.java +++ b/ruoyi-crops/src/main/java/com/ruoyi/crops/domain/OperationRecords.java @@ -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 + '\'' + '}'; } } diff --git a/ruoyi-crops/src/main/java/com/ruoyi/crops/domain/WarningFarm.java b/ruoyi-crops/src/main/java/com/ruoyi/crops/domain/WarningFarm.java new file mode 100644 index 0000000..6eec762 --- /dev/null +++ b/ruoyi-crops/src/main/java/com/ruoyi/crops/domain/WarningFarm.java @@ -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; + } +} diff --git a/ruoyi-crops/src/main/java/com/ruoyi/crops/domain/WeatherPredictionEntity.java b/ruoyi-crops/src/main/java/com/ruoyi/crops/domain/WeatherPredictionEntity.java new file mode 100644 index 0000000..3484c6b --- /dev/null +++ b/ruoyi-crops/src/main/java/com/ruoyi/crops/domain/WeatherPredictionEntity.java @@ -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 + '\'' + + '}'; + } +} diff --git a/ruoyi-crops/src/main/java/com/ruoyi/crops/domain/gsonBean/GsonFarmMachineryBean.java b/ruoyi-crops/src/main/java/com/ruoyi/crops/domain/gsonBean/GsonFarmMachineryBean.java new file mode 100644 index 0000000..afb2378 --- /dev/null +++ b/ruoyi-crops/src/main/java/com/ruoyi/crops/domain/gsonBean/GsonFarmMachineryBean.java @@ -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 vehicle; + + public int getStatus() { + return status; + } + + public void setStatus(int status) { + this.status = status; + } + + public List getVehicle() { + return vehicle; + } + + public void setVehicle(List vehicle) { + this.vehicle = vehicle; + } + +} diff --git a/ruoyi-crops/src/main/java/com/ruoyi/crops/domain/gsonBean/GsonMachineParameterBean.java b/ruoyi-crops/src/main/java/com/ruoyi/crops/domain/gsonBean/GsonMachineParameterBean.java new file mode 100644 index 0000000..fb37eae --- /dev/null +++ b/ruoyi-crops/src/main/java/com/ruoyi/crops/domain/gsonBean/GsonMachineParameterBean.java @@ -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 + '\'' + + '}'; + } + } + +} diff --git a/ruoyi-crops/src/main/java/com/ruoyi/crops/domain/gsonBean/GsonMachineryPositionBean.java b/ruoyi-crops/src/main/java/com/ruoyi/crops/domain/gsonBean/GsonMachineryPositionBean.java new file mode 100644 index 0000000..9acead5 --- /dev/null +++ b/ruoyi-crops/src/main/java/com/ruoyi/crops/domain/gsonBean/GsonMachineryPositionBean.java @@ -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 position; + + public int getStatus() { + return status; + } + + public void setStatus(int status) { + this.status = status; + } + + public List getPosition() { + return position; + } + + public void setPosition(List position) { + this.position = position; + } +} diff --git a/ruoyi-crops/src/main/java/com/ruoyi/crops/domain/gsonBean/GsonMeteorologicalBean.java b/ruoyi-crops/src/main/java/com/ruoyi/crops/domain/gsonBean/GsonMeteorologicalBean.java index 1818232..833124d 100644 --- a/ruoyi-crops/src/main/java/com/ruoyi/crops/domain/gsonBean/GsonMeteorologicalBean.java +++ b/ruoyi-crops/src/main/java/com/ruoyi/crops/domain/gsonBean/GsonMeteorologicalBean.java @@ -1,6 +1,7 @@ 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; @@ -10,26 +11,4 @@ public class GsonMeteorologicalBean { public ArrayList result; public String error_code; - - public class Meteorological{ - /** 预警消息ID */ - public String id ; - /** 预警消息标题 */ - public String title ; - /** 预警等级, 橙色/红色/蓝色/黄色/未知 */ - public String level ; - /** 预警类型 */ - public String type ; - /** 预警发布时间 */ - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") - public Date time ; - /** 省份, 可能为空 */ - public String province ; - /** 城市, 可能为空 */ - public String city ; - /** 区域, 可能为空 */ - public String district ; - /** 预警详细内容 */ - public String content ; - } } diff --git a/ruoyi-crops/src/main/java/com/ruoyi/crops/domain/gsonBean/GsonVehicleTrackBean.java b/ruoyi-crops/src/main/java/com/ruoyi/crops/domain/gsonBean/GsonVehicleTrackBean.java new file mode 100644 index 0000000..6b5484f --- /dev/null +++ b/ruoyi-crops/src/main/java/com/ruoyi/crops/domain/gsonBean/GsonVehicleTrackBean.java @@ -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; + + 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 getPostions() { + return postions; + } + + public void setPostions(List 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; + } + } + +} diff --git a/ruoyi-crops/src/main/java/com/ruoyi/crops/domain/vo/DeviceSenseVo.java b/ruoyi-crops/src/main/java/com/ruoyi/crops/domain/vo/DeviceSenseVo.java index 21fcfda..b49f559 100644 --- a/ruoyi-crops/src/main/java/com/ruoyi/crops/domain/vo/DeviceSenseVo.java +++ b/ruoyi-crops/src/main/java/com/ruoyi/crops/domain/vo/DeviceSenseVo.java @@ -1,6 +1,7 @@ package com.ruoyi.crops.domain.vo; import com.fasterxml.jackson.annotation.JsonFormat; +import org.springframework.format.annotation.DateTimeFormat; import java.util.Date; @@ -20,7 +21,8 @@ public class DeviceSenseVo { /** 二氧化碳浓度[ppm] */ private Double AvgCO2 ; - @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")//接收时间类型 + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")//返回时间类型 private Date time ; public String getDid() { diff --git a/ruoyi-crops/src/main/java/com/ruoyi/crops/domain/vo/FarmMachineryVo.java b/ruoyi-crops/src/main/java/com/ruoyi/crops/domain/vo/FarmMachineryVo.java new file mode 100644 index 0000000..d06f0fd --- /dev/null +++ b/ruoyi-crops/src/main/java/com/ruoyi/crops/domain/vo/FarmMachineryVo.java @@ -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; + } +} diff --git a/ruoyi-crops/src/main/java/com/ruoyi/crops/domain/vo/InterfaceStatisticsVo.java b/ruoyi-crops/src/main/java/com/ruoyi/crops/domain/vo/InterfaceStatisticsVo.java new file mode 100644 index 0000000..73b3dda --- /dev/null +++ b/ruoyi-crops/src/main/java/com/ruoyi/crops/domain/vo/InterfaceStatisticsVo.java @@ -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 + '\'' + + '}'; + } +} diff --git a/ruoyi-crops/src/main/java/com/ruoyi/crops/domain/vo/MachineParameterVo.java b/ruoyi-crops/src/main/java/com/ruoyi/crops/domain/vo/MachineParameterVo.java new file mode 100644 index 0000000..ac89283 --- /dev/null +++ b/ruoyi-crops/src/main/java/com/ruoyi/crops/domain/vo/MachineParameterVo.java @@ -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; + + +} diff --git a/ruoyi-crops/src/main/java/com/ruoyi/crops/domain/vo/MachineryJobDataVo.java b/ruoyi-crops/src/main/java/com/ruoyi/crops/domain/vo/MachineryJobDataVo.java new file mode 100644 index 0000000..394844b --- /dev/null +++ b/ruoyi-crops/src/main/java/com/ruoyi/crops/domain/vo/MachineryJobDataVo.java @@ -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 + + '}'; + } +} diff --git a/ruoyi-crops/src/main/java/com/ruoyi/crops/domain/vo/WeatherPredoctionVo.java b/ruoyi-crops/src/main/java/com/ruoyi/crops/domain/vo/WeatherPredoctionVo.java new file mode 100644 index 0000000..c4eeb7c --- /dev/null +++ b/ruoyi-crops/src/main/java/com/ruoyi/crops/domain/vo/WeatherPredoctionVo.java @@ -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 + + '}'; + } +} diff --git a/ruoyi-crops/src/main/java/com/ruoyi/crops/mapper/CropsDroughtMapper.java b/ruoyi-crops/src/main/java/com/ruoyi/crops/mapper/CropsDroughtMapper.java index cbcca64..efedc9b 100644 --- a/ruoyi-crops/src/main/java/com/ruoyi/crops/mapper/CropsDroughtMapper.java +++ b/ruoyi-crops/src/main/java/com/ruoyi/crops/mapper/CropsDroughtMapper.java @@ -7,7 +7,17 @@ import java.util.Date; import java.util.List; public interface CropsDroughtMapper { + /** + * 批量新增作物长势数据 + * @param cropsDroughtList + * @return + */ public int insertBatch(@Param("list") List cropsDroughtList); + /** + * 根据时间查询作物长势数据 + * @param time + * @return + */ List selectByTime(Date time); } diff --git a/ruoyi-crops/src/main/java/com/ruoyi/crops/mapper/CropsStructureMapper.java b/ruoyi-crops/src/main/java/com/ruoyi/crops/mapper/CropsStructureMapper.java index 5c2b060..b326423 100644 --- a/ruoyi-crops/src/main/java/com/ruoyi/crops/mapper/CropsStructureMapper.java +++ b/ruoyi-crops/src/main/java/com/ruoyi/crops/mapper/CropsStructureMapper.java @@ -14,7 +14,17 @@ public interface CropsStructureMapper { */ public int insertCropsStructure(CropStructure cropStructure); + /** + * 批量新增作物种植结构 + * @param list + * @return + */ public int insertBatch(@Param("list") List list); + /** + * 根据时间查询作物种植结构 + * @param time + * @return + */ public List selectByTime(Date time); } diff --git a/ruoyi-crops/src/main/java/com/ruoyi/crops/mapper/CropsUserMapper.java b/ruoyi-crops/src/main/java/com/ruoyi/crops/mapper/CropsUserMapper.java new file mode 100644 index 0000000..1e2476d --- /dev/null +++ b/ruoyi-crops/src/main/java/com/ruoyi/crops/mapper/CropsUserMapper.java @@ -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 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); +} diff --git a/ruoyi-crops/src/main/java/com/ruoyi/crops/mapper/CropsYieldMapper.java b/ruoyi-crops/src/main/java/com/ruoyi/crops/mapper/CropsYieldMapper.java index 6df37d7..dddabeb 100644 --- a/ruoyi-crops/src/main/java/com/ruoyi/crops/mapper/CropsYieldMapper.java +++ b/ruoyi-crops/src/main/java/com/ruoyi/crops/mapper/CropsYieldMapper.java @@ -7,7 +7,17 @@ import java.util.Date; import java.util.List; public interface CropsYieldMapper { + /** + * 根据年份查询 + * @param year + * @return + */ public List selectByYear(Integer year); + /** + * 批量新增 + * @param list + * @return + */ public int insertBatch(@Param("list") List list); } diff --git a/ruoyi-crops/src/main/java/com/ruoyi/crops/mapper/DataAcquisitionMapper.java b/ruoyi-crops/src/main/java/com/ruoyi/crops/mapper/DataAcquisitionMapper.java new file mode 100644 index 0000000..024b50f --- /dev/null +++ b/ruoyi-crops/src/main/java/com/ruoyi/crops/mapper/DataAcquisitionMapper.java @@ -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(); +} diff --git a/ruoyi-crops/src/main/java/com/ruoyi/crops/mapper/DeviceSenseMapper.java b/ruoyi-crops/src/main/java/com/ruoyi/crops/mapper/DeviceSenseMapper.java index 4d2fe11..0181aad 100644 --- a/ruoyi-crops/src/main/java/com/ruoyi/crops/mapper/DeviceSenseMapper.java +++ b/ruoyi-crops/src/main/java/com/ruoyi/crops/mapper/DeviceSenseMapper.java @@ -15,10 +15,10 @@ public interface DeviceSenseMapper { List selectById(String deviceId); - List selectByTime(@Param("startTime") String startTime, @Param("endTime") String endTime); + List selectByTime(@Param("startTime") Date startTime, @Param("endTime") Date endTime); - List selecthours(@Param("startTime") String startTime, @Param("endTime") String endTime); + List selecthours(@Param("startTime") Date startTime, @Param("endTime") Date endTime); - List selectdays(@Param("startTime") String startTime, @Param("endTime") String endTime); + List selectdays(@Param("startTime") Date startTime, @Param("endTime") Date endTime); } diff --git a/ruoyi-crops/src/main/java/com/ruoyi/crops/mapper/FarmMachineryMapper.java b/ruoyi-crops/src/main/java/com/ruoyi/crops/mapper/FarmMachineryMapper.java new file mode 100644 index 0000000..3b41da7 --- /dev/null +++ b/ruoyi-crops/src/main/java/com/ruoyi/crops/mapper/FarmMachineryMapper.java @@ -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 selectMachineryData(); + + public int insertBatch(@Param("entities") List farmMachineryList); +} diff --git a/ruoyi-crops/src/main/java/com/ruoyi/crops/mapper/FertigationSenseMapper.java b/ruoyi-crops/src/main/java/com/ruoyi/crops/mapper/FertigationSenseMapper.java index 1ec4c7c..b81153e 100644 --- a/ruoyi-crops/src/main/java/com/ruoyi/crops/mapper/FertigationSenseMapper.java +++ b/ruoyi-crops/src/main/java/com/ruoyi/crops/mapper/FertigationSenseMapper.java @@ -4,7 +4,7 @@ import com.ruoyi.crops.domain.FertigationSense; public interface FertigationSenseMapper { - void dedupInsert (FertigationSense fertigationSense); + void dedupInsert(FertigationSense fertigationSense); int insert(FertigationSense fertigationSense); } diff --git a/ruoyi-crops/src/main/java/com/ruoyi/crops/mapper/InterfaceStatisticsMapper.java b/ruoyi-crops/src/main/java/com/ruoyi/crops/mapper/InterfaceStatisticsMapper.java new file mode 100644 index 0000000..c497bd4 --- /dev/null +++ b/ruoyi-crops/src/main/java/com/ruoyi/crops/mapper/InterfaceStatisticsMapper.java @@ -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(); + +} diff --git a/ruoyi-crops/src/main/java/com/ruoyi/crops/mapper/MachineParameterMapper.java b/ruoyi-crops/src/main/java/com/ruoyi/crops/mapper/MachineParameterMapper.java deleted file mode 100644 index 9cecc5f..0000000 --- a/ruoyi-crops/src/main/java/com/ruoyi/crops/mapper/MachineParameterMapper.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.ruoyi.crops.mapper; - -import com.ruoyi.crops.domain.MachineParameter; - -import java.util.List; - -public interface MachineParameterMapper { - List selectByName(String name); - - int insert(MachineParameter machineParameter); -} diff --git a/ruoyi-crops/src/main/java/com/ruoyi/crops/mapper/MachineryJobDataMapper.java b/ruoyi-crops/src/main/java/com/ruoyi/crops/mapper/MachineryJobDataMapper.java new file mode 100644 index 0000000..f0dcb81 --- /dev/null +++ b/ruoyi-crops/src/main/java/com/ruoyi/crops/mapper/MachineryJobDataMapper.java @@ -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 list); + + List selectByTime(@Param("startTime") Date startTime,@Param("endTime")Date endTime); + + + List selectMachineryJobData(@Param("startTime") Date startTime,@Param("endTime")Date endTime,@Param("vehicleno") String vehicleno); + + List selectMachineryJobData(); + + void updateAreaWorkhours(@Param("vehicleno")String vehicleno, @Param("workArea") Double workArea, @Param("workhours")Double workhours); + + MachineryJobDataVo selectTodayJobData(); + + /** + * 查询全部农机编号 + * @return + */ + List selectVehicleno(); +} diff --git a/ruoyi-crops/src/main/java/com/ruoyi/crops/mapper/MachineryPositionMapper.java b/ruoyi-crops/src/main/java/com/ruoyi/crops/mapper/MachineryPositionMapper.java new file mode 100644 index 0000000..3dc1dad --- /dev/null +++ b/ruoyi-crops/src/main/java/com/ruoyi/crops/mapper/MachineryPositionMapper.java @@ -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 machineryPositions); + + /** + * 查询农机作业类型 + * @param vehicleno + * @return + */ + int selectJobtype(String vehicleno); +} diff --git a/ruoyi-crops/src/main/java/com/ruoyi/crops/mapper/MachineryTrajectoryMapper.java b/ruoyi-crops/src/main/java/com/ruoyi/crops/mapper/MachineryTrajectoryMapper.java new file mode 100644 index 0000000..ceef136 --- /dev/null +++ b/ruoyi-crops/src/main/java/com/ruoyi/crops/mapper/MachineryTrajectoryMapper.java @@ -0,0 +1,30 @@ +package com.ruoyi.crops.mapper; + +import com.ruoyi.crops.domain.MachineryTrajectory; +import org.apache.ibatis.annotations.Param; + +import java.util.Date; +import java.util.List; + +public interface MachineryTrajectoryMapper { + int insertTrajectory(@Param("entities") List tragectory); + + List selectByVehicleno(String vehicleno); + + List selectVehicleTrack(@Param("workplace") String workplace, @Param("pttime") Date pttime); + + List distinctWorkplace(@Param("vehicleno") String vehicleno); + List distinctWorkplace(); + + /** + * 查询今日作业农机编号 + * @return + */ + List distinctVehicleno(); + + /** + * 查询正在作业农机数量 + * @return + */ + int selectWorkingMachinery(); +} diff --git a/ruoyi-crops/src/main/java/com/ruoyi/crops/mapper/MeteorologicalMapper.java b/ruoyi-crops/src/main/java/com/ruoyi/crops/mapper/MeteorologicalMapper.java index 84949ba..cdd8ab4 100644 --- a/ruoyi-crops/src/main/java/com/ruoyi/crops/mapper/MeteorologicalMapper.java +++ b/ruoyi-crops/src/main/java/com/ruoyi/crops/mapper/MeteorologicalMapper.java @@ -1,6 +1,7 @@ package com.ruoyi.crops.mapper; import com.ruoyi.crops.domain.Meteorological; +import org.apache.ibatis.annotations.Param; import java.util.List; @@ -10,5 +11,7 @@ public interface MeteorologicalMapper { int insert(Meteorological ml); + int insertBatch(@Param("entities") List ml); + // void insert2(Meteorological ml2); } diff --git a/ruoyi-crops/src/main/java/com/ruoyi/crops/mapper/ServiceTypeMapper.java b/ruoyi-crops/src/main/java/com/ruoyi/crops/mapper/ServiceTypeMapper.java index 6f3b488..cff5d94 100644 --- a/ruoyi-crops/src/main/java/com/ruoyi/crops/mapper/ServiceTypeMapper.java +++ b/ruoyi-crops/src/main/java/com/ruoyi/crops/mapper/ServiceTypeMapper.java @@ -6,13 +6,42 @@ import java.util.List; public interface ServiceTypeMapper { + /** + * 根据类型查询 + * + * @param type + * @return + */ List selectByType(String type); + /** + * 新增单条数据 + * + * @param serviceType + * @return + */ int insert(ServiceType serviceType); + /** + * 查询全部数据 + * + * @return + */ List selectAll(); + /** + * 根据id数组删除 + * + * @param ids + * @return + */ int deleteByIds(Long[] ids); + /** + * 查询数据库是否存在相同文件名数据 + * + * @param name + * @return + */ int selectByfile(String name); } diff --git a/ruoyi-crops/src/main/java/com/ruoyi/crops/mapper/WarningFarmMapper.java b/ruoyi-crops/src/main/java/com/ruoyi/crops/mapper/WarningFarmMapper.java new file mode 100644 index 0000000..1ab9bb8 --- /dev/null +++ b/ruoyi-crops/src/main/java/com/ruoyi/crops/mapper/WarningFarmMapper.java @@ -0,0 +1,14 @@ +package com.ruoyi.crops.mapper; + +import com.ruoyi.crops.domain.WarningFarm; +import com.ruoyi.crops.domain.WarningInformation; +import org.apache.ibatis.annotations.Param; + +import java.util.Date; +import java.util.List; + +public interface WarningFarmMapper { + int insertWarning(WarningFarm warningFarm); + + List selectByTime(@Param("beginTime") Date beginTime, @Param("endTime") Date endTime); +} diff --git a/ruoyi-crops/src/main/java/com/ruoyi/crops/mapper/WarningMapper.java b/ruoyi-crops/src/main/java/com/ruoyi/crops/mapper/WarningMapper.java index 7a07516..15ba832 100644 --- a/ruoyi-crops/src/main/java/com/ruoyi/crops/mapper/WarningMapper.java +++ b/ruoyi-crops/src/main/java/com/ruoyi/crops/mapper/WarningMapper.java @@ -8,7 +8,7 @@ import java.util.Date; import java.util.List; public interface WarningMapper { - List selectByTime(@Param("startTime") Date startTime,@Param("endTime") Date endTime); + List selectByTime(@Param("startTime") Date startTime, @Param("endTime") Date endTime); int insert(WarningInformation warningInformation); diff --git a/ruoyi-crops/src/main/java/com/ruoyi/crops/mapper/WeatherPredictionMapper.java b/ruoyi-crops/src/main/java/com/ruoyi/crops/mapper/WeatherPredictionMapper.java new file mode 100644 index 0000000..f3ef44b --- /dev/null +++ b/ruoyi-crops/src/main/java/com/ruoyi/crops/mapper/WeatherPredictionMapper.java @@ -0,0 +1,22 @@ +package com.ruoyi.crops.mapper; + +import com.ruoyi.crops.domain.WeatherPredictionEntity; +import com.ruoyi.crops.domain.vo.WeatherPredoctionVo; +import org.springframework.data.repository.query.Param; + +import java.util.Date; +import java.util.List; + +public interface WeatherPredictionMapper { + + int insert(WeatherPredictionEntity weatherPredictionEntity); + + int insertBatch(@Param("list") List list); + + List selectWeek(); + + List selectByTime(Date time); + + + List select(Date time); +} diff --git a/ruoyi-crops/src/main/java/com/ruoyi/crops/runner/Runner.java b/ruoyi-crops/src/main/java/com/ruoyi/crops/runner/Runner.java new file mode 100644 index 0000000..75bf1a4 --- /dev/null +++ b/ruoyi-crops/src/main/java/com/ruoyi/crops/runner/Runner.java @@ -0,0 +1,14 @@ +package com.ruoyi.crops.runner; + +import com.ruoyi.crops.service.impl.FarmMachineryServiceImpl; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.CommandLineRunner; +import org.springframework.stereotype.Component; + +@Component +public class Runner implements CommandLineRunner { + @Override + public void run(String... args) throws Exception { +// System.out.println("程序初始化"); + } +} diff --git a/ruoyi-crops/src/main/java/com/ruoyi/crops/service/ICropsGrowthService.java b/ruoyi-crops/src/main/java/com/ruoyi/crops/service/ICropsGrowthService.java index 78cf7a8..2c60323 100644 --- a/ruoyi-crops/src/main/java/com/ruoyi/crops/service/ICropsGrowthService.java +++ b/ruoyi-crops/src/main/java/com/ruoyi/crops/service/ICropsGrowthService.java @@ -8,11 +8,16 @@ import java.util.List; public interface ICropsGrowthService { /** - * 批量新增 + * 批量新增作物长势数据 * @param cropGrowth * @return */ public int insertBatch(List cropGrowth); + /** + * 根据时间查询作物长势数据 + * @param time + * @return + */ public List selectByTime(Date time); } diff --git a/ruoyi-crops/src/main/java/com/ruoyi/crops/service/ICropsUserService.java b/ruoyi-crops/src/main/java/com/ruoyi/crops/service/ICropsUserService.java new file mode 100644 index 0000000..6a45fc3 --- /dev/null +++ b/ruoyi-crops/src/main/java/com/ruoyi/crops/service/ICropsUserService.java @@ -0,0 +1,46 @@ +package com.ruoyi.crops.service; + +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.crops.domain.CropsUser; + +import java.util.List; + +public interface ICropsUserService { + /** + * 获取全部用户 + * @return + */ + List 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 regist(CropsUser cropsUser); +} diff --git a/ruoyi-crops/src/main/java/com/ruoyi/crops/service/ICropsYieldService.java b/ruoyi-crops/src/main/java/com/ruoyi/crops/service/ICropsYieldService.java index fe5bc6a..3e1d162 100644 --- a/ruoyi-crops/src/main/java/com/ruoyi/crops/service/ICropsYieldService.java +++ b/ruoyi-crops/src/main/java/com/ruoyi/crops/service/ICropsYieldService.java @@ -6,7 +6,17 @@ import java.util.Date; import java.util.List; public interface ICropsYieldService { + /** + * 根据年份查询作物产量 + * @param year + * @return + */ public List selectByYear(Integer year); + /** + * 批量新增作物产量数据 + * @param cropYieldList + * @return + */ public int insertBatch (List cropYieldList); } diff --git a/ruoyi-crops/src/main/java/com/ruoyi/crops/service/IDataAcquisitionService.java b/ruoyi-crops/src/main/java/com/ruoyi/crops/service/IDataAcquisitionService.java new file mode 100644 index 0000000..05f34f0 --- /dev/null +++ b/ruoyi-crops/src/main/java/com/ruoyi/crops/service/IDataAcquisitionService.java @@ -0,0 +1,16 @@ +package com.ruoyi.crops.service; + +import com.ruoyi.crops.domain.DataAcquisition; + +import java.io.FileNotFoundException; +import java.util.List; + +public interface IDataAcquisitionService { + DataAcquisition getData(); + + int insert(DataAcquisition data); + + DataAcquisition getdataAcquisition(); +} + + diff --git a/ruoyi-crops/src/main/java/com/ruoyi/crops/service/IDeviceSenseService.java b/ruoyi-crops/src/main/java/com/ruoyi/crops/service/IDeviceSenseService.java index de4b1c3..8cfff9d 100644 --- a/ruoyi-crops/src/main/java/com/ruoyi/crops/service/IDeviceSenseService.java +++ b/ruoyi-crops/src/main/java/com/ruoyi/crops/service/IDeviceSenseService.java @@ -7,14 +7,35 @@ import java.util.Date; import java.util.List; public interface IDeviceSenseService { + /** + * 插入设备状态信息 + * @param deviceSense + * @return + */ int insert(DeviceSense deviceSense); //sql判断重复数据后插入 void dedupInsert(DeviceSense deviceSense); + /** + * 根据id查询设备状态信息 + * @param deviceId + * @return + */ List selectById(String deviceId); - List selectByTime(String startTime, String endTime); + /** + * 根据时间进行查询设备状态信息 + * @param startTime + * @param endTime + * @return + */ + List selectByTime(Date startTime, Date endTime); + /** + * 根据类型查询平均数据 + * @param type + * @return + */ List averageList(String type); } diff --git a/ruoyi-crops/src/main/java/com/ruoyi/crops/service/IFarmMachineryService.java b/ruoyi-crops/src/main/java/com/ruoyi/crops/service/IFarmMachineryService.java new file mode 100644 index 0000000..e59293b --- /dev/null +++ b/ruoyi-crops/src/main/java/com/ruoyi/crops/service/IFarmMachineryService.java @@ -0,0 +1,173 @@ +package com.ruoyi.crops.service; + +import com.ruoyi.crops.domain.FarmMachinery; +import com.ruoyi.crops.domain.MachineryJobData; +import com.ruoyi.crops.domain.MachineryPosition; +import com.ruoyi.crops.domain.MachineryTrajectory; +import com.ruoyi.crops.domain.vo.FarmMachineryVo; +import com.ruoyi.crops.domain.vo.MachineryJobDataVo; +import org.apache.ibatis.annotations.Param; +import org.locationtech.jts.geom.Coordinate; + +import java.util.Date; +import java.util.List; +import java.util.Map; + +public interface IFarmMachineryService { + + /** + * 将字符串多坐标点转换为坐标数组 + * + * @param latLonString "116.616634,40.272665|116.644733,40.280371|116.636181,40.264352|116.616634,40.272665" + * @return org.locationtech.jts.geom.Coordinate[] + */ + public Coordinate[] getCoordinateArray(String latLonString); + + /** + * 判断坐标点是否在多坐标点组成的多边形面内 + * + * @param coordinateArray + * @param coordinate + * @return boolean + * @author guochao.bj@fang.com + * within 判断是否在内部,边缘点返回false + * intersects 判断是否相交,弥补 within边缘点缺陷, + */ + public boolean withinAndIntersects(Coordinate[] coordinateArray, Coordinate coordinate); + + /** + * @param lnglatPolygon 坐标数组 + * @param lng 经度 + * @param lat 纬度 + * @return + */ + public boolean withinAndIntersects(String lnglatPolygon, double lng, double lat); + + /** + * 农机信息查询 + * @return + */ + public List selectMachineryData(); + + public FarmMachineryVo selectMachineryData(String vehicleno); + + /** + * 在线农机数量查询 + * @return + */ + public int selectMachineryOnline(); + + /** + * 批量插入农机设备信息 + * @param farmMachineryList + * @return + */ + public int insertBatch(List farmMachineryList); + + /** + * 批量插入农机作业任务 + * @param list + * @return + */ + public int insertJobDataBatch(List list); + + /** + * 农机作业任务查询 + * @param startTime + * @param endTime + * @return + */ + public List selectJobDataByTime(Date startTime,Date endTime); + + /** + * 历史作业信息查询 + * @param startTime + * @param endTime + * @param vehicleno + * @return + */ + List selectMachineryJobData(Date startTime,Date endTime,String vehicleno); + + List selectMachineryJobData(); + + /** + * 农机轨迹数据分类 + * @param machineryTrajectories + * @param vehicleno + * @return + */ + public List> processPositions(List machineryTrajectories,String vehicleno); + + /** + * 插入农机轨迹数据 + * @param list + * @param vehicleno + * @return + */ + public void insertProcessPositions(List list,String vehicleno); + + /** + * 查询农机轨迹数据 + * @param workplace + * @param pttime + * @return + */ + List selectVehicleTrack(String workplace, Date pttime); + + /** + * 查询今日作业地块 + * @param vehicleno 农机编号(为空查询今日全部) + * @return + */ + List distinctWorkplace(String vehicleno); + + List distinctWorkplace(); + + + /** + * 查询今日作业农机编号 + * @return + */ + List distinctVehicleno(); + + /** + * 更新作业面积和时长 + * @param vehicleno + * @param area + * @param workingHours + */ + void updateAreaWorkhours(String vehicleno,double area, double workingHours); + + /** + * 查询今日作业数据 + * @return + */ + MachineryJobDataVo selectTodayJobData(); + + /** + * 查询正在作业农机数量 + */ + int selectWorkingMachinery(); + + /** + * 插入农机位置 + * @param position + */ + void insertPositions(List position); + + /** + * 查询农机作业类型 + * @param vehicleno + * @return + */ + int selectJobtype(@Param("vehicleno")String vehicleno); + + void updateworkplace(); + + /** + * 查询全部农机编号 + * @return + */ + List selectVehicleno(); +} + diff --git a/ruoyi-crops/src/main/java/com/ruoyi/crops/service/IFertigationSenseService.java b/ruoyi-crops/src/main/java/com/ruoyi/crops/service/IFertigationSenseService.java index e02fa4d..76e2f03 100644 --- a/ruoyi-crops/src/main/java/com/ruoyi/crops/service/IFertigationSenseService.java +++ b/ruoyi-crops/src/main/java/com/ruoyi/crops/service/IFertigationSenseService.java @@ -4,6 +4,7 @@ import com.ruoyi.crops.domain.DeviceSense; import com.ruoyi.crops.domain.FertigationSense; public interface IFertigationSenseService { + //使用sql判断重复数据插入 void dedupInsert(FertigationSense fertigationSense); int insert(FertigationSense fertigationSense); } diff --git a/ruoyi-crops/src/main/java/com/ruoyi/crops/service/IGeoServer.java b/ruoyi-crops/src/main/java/com/ruoyi/crops/service/IGeoServer.java index 2de27c9..7ac8732 100644 --- a/ruoyi-crops/src/main/java/com/ruoyi/crops/service/IGeoServer.java +++ b/ruoyi-crops/src/main/java/com/ruoyi/crops/service/IGeoServer.java @@ -1,9 +1,11 @@ package com.ruoyi.crops.service; +import com.ruoyi.common.core.domain.AjaxResult; import com.ruoyi.crops.domain.ServiceType; public interface IGeoServer { - public String GeoServer(String workSpace, String storeName, String filePath) throws Exception; + public String publishTiff(String workSpace, String storeName, String filePath ,String styleName) throws Exception; + public String publishShp(String workSpace, String storeName, String layername, String filePath); int insert(ServiceType serviceType); } diff --git a/ruoyi-crops/src/main/java/com/ruoyi/crops/service/IMachineParameterService.java b/ruoyi-crops/src/main/java/com/ruoyi/crops/service/IMachineParameterService.java index e441db3..f79ca4e 100644 --- a/ruoyi-crops/src/main/java/com/ruoyi/crops/service/IMachineParameterService.java +++ b/ruoyi-crops/src/main/java/com/ruoyi/crops/service/IMachineParameterService.java @@ -1,11 +1,33 @@ package com.ruoyi.crops.service; +import cn.hutool.http.HttpUtil; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; import com.ruoyi.crops.domain.MachineParameter; +import com.ruoyi.crops.domain.UserInfo; +import com.ruoyi.crops.domain.gsonBean.GsonMachineParameterBean; +import com.ruoyi.crops.domain.vo.MachineParameterVo; +import java.lang.reflect.Field; +import java.lang.reflect.Method; +import java.util.HashMap; import java.util.List; +import java.util.Map; public interface IMachineParameterService { - List selectByName(String name); - int insert(MachineParameter machineParameter); + /** + * 获取水肥机全部状态参数 + * @return + * @throws Exception + */ + public MachineParameter getMachineParameter() throws Exception; + + /** + * 获取ph值,流量,压力值 + * @return + * @throws Exception + */ + MachineParameterVo selectParameter() throws Exception; + } diff --git a/ruoyi-crops/src/main/java/com/ruoyi/crops/service/IMapDrawPolygonService.java b/ruoyi-crops/src/main/java/com/ruoyi/crops/service/IMapDrawPolygonService.java new file mode 100644 index 0000000..0e9af35 --- /dev/null +++ b/ruoyi-crops/src/main/java/com/ruoyi/crops/service/IMapDrawPolygonService.java @@ -0,0 +1,15 @@ +package com.ruoyi.crops.service; + +import com.ruoyi.common.utils.MyPoint; + +import java.util.List; + +public interface IMapDrawPolygonService { + /** + * 根据经纬度数筛选出边界数据 + * @param points + * @return + * @throws Exception + */ + public List DrawPolygon(List points) throws Exception; +} diff --git a/ruoyi-crops/src/main/java/com/ruoyi/crops/service/IMeteorologicalService.java b/ruoyi-crops/src/main/java/com/ruoyi/crops/service/IMeteorologicalService.java index 03b3cda..2b6b19c 100644 --- a/ruoyi-crops/src/main/java/com/ruoyi/crops/service/IMeteorologicalService.java +++ b/ruoyi-crops/src/main/java/com/ruoyi/crops/service/IMeteorologicalService.java @@ -6,7 +6,23 @@ import java.util.List; public interface IMeteorologicalService { + /** + * 根据时间查询 + * @return + */ List selectByTime(); + /** + * 新增单条数据 + * @param ml + * @return + */ int insert(Meteorological ml); + + /** + * 批量插入数据 + * @param ml + * @return + */ + int insertBatch(List ml); } diff --git a/ruoyi-crops/src/main/java/com/ruoyi/crops/service/IServiceTypeService.java b/ruoyi-crops/src/main/java/com/ruoyi/crops/service/IServiceTypeService.java index e0bf360..b26cf8e 100644 --- a/ruoyi-crops/src/main/java/com/ruoyi/crops/service/IServiceTypeService.java +++ b/ruoyi-crops/src/main/java/com/ruoyi/crops/service/IServiceTypeService.java @@ -6,11 +6,30 @@ import java.util.List; public interface IServiceTypeService { + /** + * 根据类型查询 + * @param type + * @return + */ List selectByType(String type); + /** + * 新增数据 + * @param serviceType + * @return + */ int insert(ServiceType serviceType); + /** + * 查询全部 + * @return + */ List selectAll(); + /** + * 根据id批量删除 + * @param ids + * @return + */ int deleteByIds(Long[] ids); } diff --git a/ruoyi-crops/src/main/java/com/ruoyi/crops/service/IUploadService.java b/ruoyi-crops/src/main/java/com/ruoyi/crops/service/IUploadService.java index 12b9db2..99d38ed 100644 --- a/ruoyi-crops/src/main/java/com/ruoyi/crops/service/IUploadService.java +++ b/ruoyi-crops/src/main/java/com/ruoyi/crops/service/IUploadService.java @@ -5,6 +5,12 @@ import org.springframework.web.multipart.MultipartFile; import java.io.IOException; public interface IUploadService { - String upload(String type,MultipartFile file, String fileRoot) throws IOException; - + /** + * 文件上传 + * @param file 文件名 + * @param fileRoot 文件路径 + * @return + * @throws IOException + */ + String upload(MultipartFile file, String fileRoot) throws IOException; } diff --git a/ruoyi-crops/src/main/java/com/ruoyi/crops/service/IWarningFarmService.java b/ruoyi-crops/src/main/java/com/ruoyi/crops/service/IWarningFarmService.java new file mode 100644 index 0000000..5b274c9 --- /dev/null +++ b/ruoyi-crops/src/main/java/com/ruoyi/crops/service/IWarningFarmService.java @@ -0,0 +1,13 @@ +package com.ruoyi.crops.service; + +import com.ruoyi.crops.domain.WarningFarm; +import com.ruoyi.crops.domain.WarningInformation; + +import java.util.Date; +import java.util.List; + +public interface IWarningFarmService { + int insertWarning(WarningFarm warningFarm); + + List selectByTime(Date beginTime, Date endTime); +} diff --git a/ruoyi-crops/src/main/java/com/ruoyi/crops/service/IWarningService.java b/ruoyi-crops/src/main/java/com/ruoyi/crops/service/IWarningService.java index cfdde6c..708e5fd 100644 --- a/ruoyi-crops/src/main/java/com/ruoyi/crops/service/IWarningService.java +++ b/ruoyi-crops/src/main/java/com/ruoyi/crops/service/IWarningService.java @@ -8,9 +8,9 @@ import java.util.Date; import java.util.List; public interface IWarningService { - List selectByTime(Date startTime,Date endTime); + List selectByTime(Date startTime, Date endTime); int insert(WarningInformation warningInformation); - int insertWarning(DeviceSense deviceSense); + int judgeWarning(DeviceSense deviceSense); } diff --git a/ruoyi-crops/src/main/java/com/ruoyi/crops/service/IWeatherPredictionService.java b/ruoyi-crops/src/main/java/com/ruoyi/crops/service/IWeatherPredictionService.java new file mode 100644 index 0000000..b26efc0 --- /dev/null +++ b/ruoyi-crops/src/main/java/com/ruoyi/crops/service/IWeatherPredictionService.java @@ -0,0 +1,22 @@ +package com.ruoyi.crops.service; + +import com.ruoyi.crops.domain.WeatherPredictionEntity; +import com.ruoyi.crops.domain.vo.WeatherPredoctionVo; + +import java.io.IOException; +import java.util.Date; +import java.util.List; + +public interface IWeatherPredictionService { + public List getWeather() throws IOException; + + public int insert(WeatherPredictionEntity weatherPredictionEntity); + + public int insertBatch(List list); + + public List selectWeek(); + + List selectByTime(Date time); + + List select(Date time); +} diff --git a/ruoyi-crops/src/main/java/com/ruoyi/crops/service/InterfaceStatisticsService.java b/ruoyi-crops/src/main/java/com/ruoyi/crops/service/InterfaceStatisticsService.java new file mode 100644 index 0000000..074f6a6 --- /dev/null +++ b/ruoyi-crops/src/main/java/com/ruoyi/crops/service/InterfaceStatisticsService.java @@ -0,0 +1,15 @@ +package com.ruoyi.crops.service; + +import com.ruoyi.crops.domain.InterfaceStatistics; +import com.ruoyi.crops.domain.vo.InterfaceStatisticsVo; + +import java.util.List; + +public interface InterfaceStatisticsService { + int insert(InterfaceStatistics interfaceStatistics); + + InterfaceStatistics selectByDay(); + + InterfaceStatisticsVo selectTotal(); + +} diff --git a/ruoyi-crops/src/main/java/com/ruoyi/crops/service/impl/CropsDroughtServiceImpl.java b/ruoyi-crops/src/main/java/com/ruoyi/crops/service/impl/CropsDroughtServiceImpl.java index ae76c81..9694449 100644 --- a/ruoyi-crops/src/main/java/com/ruoyi/crops/service/impl/CropsDroughtServiceImpl.java +++ b/ruoyi-crops/src/main/java/com/ruoyi/crops/service/impl/CropsDroughtServiceImpl.java @@ -1,5 +1,6 @@ package com.ruoyi.crops.service.impl; +import com.github.pagehelper.PageHelper; import com.ruoyi.crops.domain.CropsDrought; import com.ruoyi.crops.domain.CropsYield; import com.ruoyi.crops.mapper.CropsDroughtMapper; @@ -14,11 +15,22 @@ import java.util.List; public class CropsDroughtServiceImpl implements ICropsDroughtService { @Autowired private CropsDroughtMapper cropsDroughtMapper; + + /** + * 批量插入作物旱情数据 + * @param cropsYieldList + * @return + */ @Override public int insertBatch(List cropsYieldList) { return cropsDroughtMapper.insertBatch(cropsYieldList); } + /** + * 根据时间查询作物旱情数据 + * @param time + * @return + */ @Override public List selectByTime(Date time) { return cropsDroughtMapper.selectByTime(time); diff --git a/ruoyi-crops/src/main/java/com/ruoyi/crops/service/impl/CropsGrowthServiceImpl.java b/ruoyi-crops/src/main/java/com/ruoyi/crops/service/impl/CropsGrowthServiceImpl.java index d0427a8..04a4388 100644 --- a/ruoyi-crops/src/main/java/com/ruoyi/crops/service/impl/CropsGrowthServiceImpl.java +++ b/ruoyi-crops/src/main/java/com/ruoyi/crops/service/impl/CropsGrowthServiceImpl.java @@ -13,11 +13,22 @@ import java.util.List; public class CropsGrowthServiceImpl implements ICropsGrowthService { @Autowired private CropsGrowthMapper cropsGrowthMapper; + + /** + * 批量新增作物长势数据 + * @param cropGrowth + * @return + */ @Override public int insertBatch(List cropGrowth) { return cropsGrowthMapper.insertBatch(cropGrowth); } + /** + * 根据时间查询作物长势数据 + * @param time + * @return + */ @Override public List selectByTime(Date time) { return cropsGrowthMapper.selectByTime(time); diff --git a/ruoyi-crops/src/main/java/com/ruoyi/crops/service/impl/CropsStructureServiceImpl.java b/ruoyi-crops/src/main/java/com/ruoyi/crops/service/impl/CropsStructureServiceImpl.java index 5175b46..b53324c 100644 --- a/ruoyi-crops/src/main/java/com/ruoyi/crops/service/impl/CropsStructureServiceImpl.java +++ b/ruoyi-crops/src/main/java/com/ruoyi/crops/service/impl/CropsStructureServiceImpl.java @@ -34,6 +34,11 @@ public class CropsStructureServiceImpl implements ICropsStructureService { return cropsStructureMapper.insertBatch(cropStructureList); } + /** + * 根据时间查询作物种植结构 + * @param time + * @return + */ @Override public List selectByTime(Date time) { return cropsStructureMapper.selectByTime(time); diff --git a/ruoyi-crops/src/main/java/com/ruoyi/crops/service/impl/CropsUserServiceImpl.java b/ruoyi-crops/src/main/java/com/ruoyi/crops/service/impl/CropsUserServiceImpl.java new file mode 100644 index 0000000..81bac13 --- /dev/null +++ b/ruoyi-crops/src/main/java/com/ruoyi/crops/service/impl/CropsUserServiceImpl.java @@ -0,0 +1,78 @@ +package com.ruoyi.crops.service.impl; + +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.crops.domain.CropsUser; +import com.ruoyi.crops.mapper.CropsUserMapper; +import com.ruoyi.crops.service.ICropsUserService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service +public class CropsUserServiceImpl implements ICropsUserService { + @Autowired + private CropsUserMapper cropsUserMapper; + + /** + * 获取全部用户列表 + * @return + */ + @Override + public List list() { + return cropsUserMapper.list(); + } + + /** + * 新增用户 + * @param cropsUser + * @return + */ + @Override + public int insert(CropsUser cropsUser) { + return cropsUserMapper.insert(cropsUser); + } + + /** + * 删除用户 + * @param id + * @return + */ + @Override + public int delete(Integer id) { + return cropsUserMapper.delete(id); + } + + /** + * 修改用户 + * @param id + * @return + */ + @Override + public int update(Integer id) { + return cropsUserMapper.update(id); + } + + @Override + public CropsUser selectByPhone(String phone) { + return cropsUserMapper.selectByPhone(phone); + } + + @Override + public CropsUser login(CropsUser user) { + return cropsUserMapper.login(user); + } + + @Override + public int regist(CropsUser cropsUser) { + CropsUser cnt = cropsUserMapper.selectByPhone(cropsUser.getPhone()); + if (cnt!=null){ + throw new RuntimeException("手机号已存在"); + } + int tmp = cropsUserMapper.selectCountByName(cropsUser.getUserName()); + if (tmp == 1){ + throw new RuntimeException("用户名已存在"); + } + return cropsUserMapper.insert(cropsUser); + } +} diff --git a/ruoyi-crops/src/main/java/com/ruoyi/crops/service/impl/CropsYieldServiceImpl.java b/ruoyi-crops/src/main/java/com/ruoyi/crops/service/impl/CropsYieldServiceImpl.java index ae3b351..7818dc9 100644 --- a/ruoyi-crops/src/main/java/com/ruoyi/crops/service/impl/CropsYieldServiceImpl.java +++ b/ruoyi-crops/src/main/java/com/ruoyi/crops/service/impl/CropsYieldServiceImpl.java @@ -6,18 +6,39 @@ import com.ruoyi.crops.service.ICropsYieldService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import java.util.Date; import java.util.List; @Service public class CropsYieldServiceImpl implements ICropsYieldService { @Autowired private CropsYieldMapper cropsYieldMapper; + + /** + * 根据年份查询作物产量 + * @param year + * @return + */ @Override public List selectByYear(Integer year) { - return cropsYieldMapper.selectByYear(year); + + List cropsYields = cropsYieldMapper.selectByYear(year); + for (CropsYield cropsYield : cropsYields) { + switch (cropsYield.getCropType()) { + case "ym":cropsYield.setCropType("玉米"); + case "xm":cropsYield.setCropType("小麦"); + case "dd":cropsYield.setCropType("大豆"); + case "hs":cropsYield.setCropType("花生"); + case "qt":cropsYield.setCropType("其他"); + } + } + return cropsYields; } + /** + * 批量新增作物产量数据 + * @param cropYieldList + * @return + */ @Override public int insertBatch(List cropYieldList) { return cropsYieldMapper.insertBatch(cropYieldList); diff --git a/ruoyi-crops/src/main/java/com/ruoyi/crops/service/impl/DataAcquisitionServiceImpl.java b/ruoyi-crops/src/main/java/com/ruoyi/crops/service/impl/DataAcquisitionServiceImpl.java new file mode 100644 index 0000000..8e4b9d9 --- /dev/null +++ b/ruoyi-crops/src/main/java/com/ruoyi/crops/service/impl/DataAcquisitionServiceImpl.java @@ -0,0 +1,63 @@ +package com.ruoyi.crops.service.impl; + +import com.ruoyi.common.config.RuoYiConfig; +import com.ruoyi.crops.domain.DataAcquisition; +import com.ruoyi.crops.mapper.DataAcquisitionMapper; +import com.ruoyi.crops.service.IDataAcquisitionService; +import org.apache.poi.ss.formula.functions.Now; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Service; + +import java.io.File; +import java.io.FileNotFoundException; +import java.util.ArrayList; +import java.util.List; + +@Service +public class DataAcquisitionServiceImpl implements IDataAcquisitionService { + @Autowired + private DataAcquisitionMapper dataAcquisitionMapper; + + long numb = 0;//总大小(字节) + int length = 0;//文件个数 + @Override + public DataAcquisition getData() { + return dataAcquisitionMapper.getData(); + } + + @Override + public int insert(DataAcquisition data) { + return dataAcquisitionMapper.insert(data); + } + + @Override + public DataAcquisition getdataAcquisition(){ + + File file = new File(RuoYiConfig.getUploadPath()+"\\tifFile"); + countfile(file);//统计tiff影像文件 + //查询前刷新表数据 + dataAcquisitionMapper.analyze(); + DataAcquisition sensorData = dataAcquisitionMapper.getSensorData(); + sensorData.setImageData(length); + sensorData.setImageDataTotal((float)numb / 1024 / 1024); + insert(sensorData); + return sensorData; + } + + public void countfile(File fpath){ + String path = fpath.getPath(); + File file = new File(path); //获取其file对象 + File[] fs = file.listFiles(); //遍历path下的文件和目录,放在File数组中 + length = fs.length; + for (File f : fs) { //遍历File[]数组 + if (!f.isDirectory()) //若非目录(即文件),对其进行遍历 + { + numb += f.length();//获取文件大小(字节) + } else { + countfile(f); + } + + } + } +} diff --git a/ruoyi-crops/src/main/java/com/ruoyi/crops/service/impl/DeviceSenseServiceImpl.java b/ruoyi-crops/src/main/java/com/ruoyi/crops/service/impl/DeviceSenseServiceImpl.java index f8750f2..0cf52f7 100644 --- a/ruoyi-crops/src/main/java/com/ruoyi/crops/service/impl/DeviceSenseServiceImpl.java +++ b/ruoyi-crops/src/main/java/com/ruoyi/crops/service/impl/DeviceSenseServiceImpl.java @@ -13,6 +13,7 @@ import org.springframework.stereotype.Service; import java.text.SimpleDateFormat; import java.util.ArrayList; +import java.util.Date; import java.util.List; @@ -37,29 +38,45 @@ public class DeviceSenseServiceImpl implements IDeviceSenseService { deviceSenseMapper.dedupInsert(deviceSense); } + /** + * 根据设备id查询 + * @param deviceId + * @return + */ @Override public List selectById(String deviceId) { return deviceSenseMapper.selectById(deviceId); } + /** + * 根据时间查询设备状态 + * @param startTime 开始时间 + * @param endTime 结束时间 + * @return + */ @Override - public List selectByTime(String startTime, String endTime) { + public List selectByTime(Date startTime, Date endTime) { return deviceSenseMapper.selectByTime(startTime, endTime); } + /** + * 根据天周月查询设备状态平均值 + * @param type + * @return + */ @Override public List averageList(String type) { if (type.equals("hours")) { - String dayBegin = new SimpleDateFormat("yyyy-MM-dd").format(DateUtil.getBeginDayOfYesterday()); - String dayend = new SimpleDateFormat("yyyy-MM-dd").format(DateUtil.getBeginDayOfTomorrow()); + Date dayBegin = DateUtil.getBeginDayOfYesterday(); + Date dayend = DateUtil.getBeginDayOfTomorrow(); return deviceSenseMapper.selecthours(dayBegin, dayend); } else if (type.equals("week")) { - String weekBegin = new SimpleDateFormat("yyyy-MM-dd").format(DateUtil.getBeginDayOfWeek()); - String weekEnd = new SimpleDateFormat("yyyy-MM-dd").format(DateUtil.getEndDayOfWeek()); + Date weekBegin = DateUtil.getBeginDayOf7day(); + Date weekEnd = DateUtil.getDayBegin(); return deviceSenseMapper.selectdays(weekBegin, weekEnd); } else if (type.equals("month")) { - String monthBegin = new SimpleDateFormat("yyyy-MM-dd").format(DateUtil.getBeginDayOfMonth()); - String monthEnd = new SimpleDateFormat("yyyy-MM-dd").format(DateUtil.getEndDayOfMonth()); + Date monthBegin = DateUtil.getBeginDayOfMonth(); + Date monthEnd = DateUtil.getEndDayOfMonth(); return deviceSenseMapper.selectdays(monthBegin, monthEnd); } return null; diff --git a/ruoyi-crops/src/main/java/com/ruoyi/crops/service/impl/ExeServiceImpl.java b/ruoyi-crops/src/main/java/com/ruoyi/crops/service/impl/ExeServiceImpl.java index 07f8279..5045047 100644 --- a/ruoyi-crops/src/main/java/com/ruoyi/crops/service/impl/ExeServiceImpl.java +++ b/ruoyi-crops/src/main/java/com/ruoyi/crops/service/impl/ExeServiceImpl.java @@ -12,21 +12,41 @@ public class ExeServiceImpl implements IexeService { @Override public String execCommand(String type, String filePath, String boundaryDataPath) { - String path; - if (type.equals("zzjg")) { - path = exePath + "农作物种植结构.exe "; - } else if (type.equals("zwzs")) { - path = exePath + "农作物长势.exe "; - } else if (type.equals("zwhq")) { - path = exePath + "农作物旱情.exe "; - } else if (type.equals("zyzd_hq")) { - path = exePath + "旱情指导.exe "; - } else if (type.equals("zyzd_zs")) { - path = exePath + "长势指导.exe "; - } else { - path = exePath + "农作物产量.exe "; + String path = ""; + String yieldType = ""; + switch (type) { + case "zzjg": + path = exePath + "农作物种植结构.exe "; + break; + case "zwzs": + path = exePath + "农作物长势.exe "; + break; + case "zwhq": + path = exePath + "农作物旱情.exe "; + break; + case "zwcl_ym": + path = exePath + "农作物产量.exe "; + yieldType = " '玉米'"; + break; + case "zwcl_xm": + path = exePath + "农作物产量.exe "; + yieldType = " '小麦'"; + break; + case "zwcl_qt": + path = exePath + "农作物产量.exe "; + yieldType = " '其他'"; + break; + case "zwcl_hs": + path = exePath + "农作物产量.exe "; + yieldType = " '花生'"; + break; + case "zwcl_dd": + path = exePath + "农作物产量.exe "; + yieldType = " '大豆'"; + break; + default:return " 未执行exe"; } - return BashUtils.execCommand(path + "\"" + filePath + "\"" + " \"" + boundaryDataPath + "\""); + return BashUtils.execCommand(path + "\"" + filePath + "\"" + " \"" + boundaryDataPath + "\"" + yieldType); } } diff --git a/ruoyi-crops/src/main/java/com/ruoyi/crops/service/impl/FarmMachineryServiceImpl.java b/ruoyi-crops/src/main/java/com/ruoyi/crops/service/impl/FarmMachineryServiceImpl.java new file mode 100644 index 0000000..b826180 --- /dev/null +++ b/ruoyi-crops/src/main/java/com/ruoyi/crops/service/impl/FarmMachineryServiceImpl.java @@ -0,0 +1,372 @@ +package com.ruoyi.crops.service.impl; + +import com.ruoyi.crops.domain.FarmMachinery; +import com.ruoyi.crops.domain.MachineryJobData; +import com.ruoyi.crops.domain.MachineryPosition; +import com.ruoyi.crops.domain.MachineryTrajectory; +import com.ruoyi.crops.domain.vo.FarmMachineryVo; +import com.ruoyi.crops.domain.vo.MachineryJobDataVo; +import com.ruoyi.crops.mapper.FarmMachineryMapper; +import com.ruoyi.crops.mapper.MachineryJobDataMapper; +import com.ruoyi.crops.mapper.MachineryPositionMapper; +import com.ruoyi.crops.mapper.MachineryTrajectoryMapper; +import com.ruoyi.crops.service.IFarmMachineryService; +import org.locationtech.jts.geom.Coordinate; +import org.locationtech.jts.geom.GeometryFactory; +import org.locationtech.jts.geom.Point; +import org.locationtech.jts.geom.Polygon; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Service; + +import java.util.*; + +@Service +public class FarmMachineryServiceImpl implements IFarmMachineryService { + // private int lastProcessedIndex = -1; + private List previousGroup = null; + private static int workplace; + @Autowired + private MachineryTrajectoryMapper machineryTrajectoryMapper; + + @Autowired + private FarmMachineryMapper farmMachineryMapper; + + @Autowired + private MachineryPositionMapper machineryPositionMapper; + + @Autowired + private MachineryJobDataMapper machineryJobDataMapper; + + @Override + public void updateworkplace(){ + workplace=64; + } + + /** + * 查询全部农机编号 + * @return + */ + @Override + public List selectVehicleno() { + return machineryJobDataMapper.selectVehicleno(); + } + + /** + * 将字符串多坐标点转换为坐标数组 + * + * @param latLonString "116.616634,40.272665|116.644733,40.280371|116.636181,40.264352|116.616634,40.272665" + * @return org.locationtech.jts.geom.Coordinate[] + */ + @Override + public Coordinate[] getCoordinateArray(String latLonString) { + String[] split = latLonString.split("\\|"); + Coordinate[] coordinateArray = new Coordinate[split.length]; + for (int i = 0; i < split.length; i++) { + String[] LatLng = split[i].split(","); + Coordinate coordinate = new Coordinate(Double.valueOf(LatLng[0]), Double.valueOf(LatLng[1])); + coordinateArray[i] = coordinate; + } + return coordinateArray; + } + + /** + * 判断坐标点是否在多坐标点组成的多边形面内 + * + * @param coordinateArray + * @param coordinate + * @return boolean + * @author guochao.bj@fang.com + * within 判断是否在内部,边缘点返回false + * intersects 判断是否相交,弥补 within边缘点缺陷, + */ + @Override + public boolean withinAndIntersects(Coordinate[] coordinateArray, Coordinate coordinate) { + boolean result = false; + //小于3个点无法组成多边形 + if (coordinateArray.length < 3) { + return result; + } + + //必须首尾坐标点相同组成闭合多边形 + if (!(coordinateArray[0].equals2D(coordinateArray[coordinateArray.length - 1]))) { + return result; + } + + GeometryFactory geometryFactory = new GeometryFactory(); + Point point = geometryFactory.createPoint(coordinate); + Polygon polygon = geometryFactory.createPolygon(coordinateArray); + + if (point.within(polygon) || point.intersects(polygon)) { + result = true; + } + + return result; + } + + /** + * @param lnglatPolygon 坐标数组 + * @param lng 经度 + * @param lat 纬度 + * @return + */ + @Override + public boolean withinAndIntersects(String lnglatPolygon, double lng, double lat) { + Coordinate[] latLonMap = getCoordinateArray(lnglatPolygon); + Coordinate coordinate = new Coordinate(lng, lat); + boolean within = withinAndIntersects(latLonMap, coordinate); + return within; + } + + /** + * 农机设备信息查询 + * + * @return + */ + @Override + public List selectMachineryData() { + return farmMachineryMapper.selectMachineryData(); + } + + + @Override + public FarmMachineryVo selectMachineryData(String vehicleno) { + return farmMachineryMapper.selectMachineryData(vehicleno); + } + + /** + * 查询农机在线数量 + * + * @return + */ + @Override + public int selectMachineryOnline() { + return machineryPositionMapper.selectMachineryOnline(); + } + + /** + * 批量插入农机设备信息 + * + * @param farmMachineryList + * @return + */ + @Override + public int insertBatch(List farmMachineryList) { + return farmMachineryMapper.insertBatch(farmMachineryList); + } + + /** + * 批量插入农机作业任务 + * + * @param list + * @return + */ + @Override + public int insertJobDataBatch(List list) { + return machineryJobDataMapper.insertBatch(list); + } + + /** + * 农机作业任务查询 + * + * @param startTime 开始时间 + * @param endTime 结束时间 + * @return + */ + @Override + public List selectJobDataByTime(Date startTime, Date endTime) { + return machineryJobDataMapper.selectByTime(startTime, endTime); + } + + /** + * 历史作业信息查询 + * + * @param startTime + * @param endTime + * @param vehicleno + * @return + */ + @Override + public List selectMachineryJobData(Date startTime, Date endTime, String vehicleno) { + return machineryJobDataMapper.selectMachineryJobData(startTime, endTime, vehicleno); + } + @Override + public List selectMachineryJobData() { + return machineryJobDataMapper.selectMachineryJobData(); + } + + /** + * 农机轨迹数据分类 + * + * @param machineryTrajectories + * @param vehicleno + * @return + */ + @Override + public List> processPositions(List machineryTrajectories, String vehicleno) { + List> result = new ArrayList<>(); + List currentGroup = null; + + boolean isPreviousWork = false; + //判断第一次分组后结果,如果上次分组不为空并且等于1那么就和上次查询分组放在一起 + if (previousGroup != null && !previousGroup.isEmpty() && previousGroup.get(previousGroup.size() - 1).getIswork() == 1) { + isPreviousWork = true; + currentGroup = previousGroup; + } + + for (int i = 0; i < machineryTrajectories.size(); i++) { + MachineryTrajectory machineryTrajectory = machineryTrajectories.get(i); + if (machineryTrajectory.getIswork() == 1 && machineryTrajectory.getCourse() != 0) { + if (!isPreviousWork) { + //记录工作地块 + workplace++; + currentGroup = new ArrayList<>(); + result.add(currentGroup); + } + machineryTrajectory.setWorkplace(String.valueOf((char) workplace)); + machineryTrajectory.setVehicleno(vehicleno); + currentGroup.add(machineryTrajectory); + isPreviousWork = true; + } else { + isPreviousWork = false; + currentGroup = null; + } +// lastProcessedIndex = i; + } + + if (currentGroup != null && !currentGroup.isEmpty() && currentGroup.get(currentGroup.size() - 1).getIswork() == 1) { + previousGroup = currentGroup; + } else { + previousGroup = null; + } + return result; + } + + /** + * 插入作业轨迹数据 + * @param list + * @param vehicleno + */ + @Override + public void insertProcessPositions(List list, String vehicleno) { + //对轨迹数据进行分组 + List> result = processPositions(list, vehicleno); + + for (List machineryTrajectories : result) { + List res = new ArrayList<>(); + //数据抽稀每隔十条数据取出一条 + for (int i = 0; i < machineryTrajectories.size(); i += 10) { + res.add(machineryTrajectories.get(i)); + } + //点位小于3过滤掉 + if (res.size() <= 3) { + continue; + } + //判断数据库里重复数据 + List mt = machineryTrajectoryMapper + .selectByVehicleno(machineryTrajectories.get(machineryTrajectories.size() - 1).getVehicleno()); + for (int j = 0; j < res.size(); j++) { + MachineryTrajectory machineryTrajectory = res.get(j); + for (MachineryTrajectory trajectory : mt) { + if (machineryTrajectory.getLng() == trajectory.getLng() && machineryTrajectory.getLat() == trajectory.getLat()) { + res.remove(j); + j--; + } + } + } + //将结果插入数据库 + if (!res.isEmpty()) { + machineryTrajectoryMapper.insertTrajectory(res); + } + } + } + + /** + * 查询农机轨迹数据 + * @param workplace + * @param pttime + * @return + */ + @Override + public List selectVehicleTrack(String workplace, Date pttime) { + return machineryTrajectoryMapper.selectVehicleTrack(workplace, pttime); + } + + /** + * 查询今日作业地块 + * @param vehicleno 农机编号(为空查询今日全部) + * @return + */ + @Override + public List distinctWorkplace(String vehicleno) { + return machineryTrajectoryMapper.distinctWorkplace(vehicleno); + } + + @Override + public List distinctWorkplace() { + return machineryTrajectoryMapper.distinctWorkplace(); + } + + /** + * 查询今日作业农机编号 + * + * @return + */ + @Override + public List distinctVehicleno() { + return machineryTrajectoryMapper.distinctVehicleno(); + } + + /** + * 更新农机作业面积,作业时间 + * + * @param area + * @param workingHours + * @param vehicleno + */ + @Override + public void updateAreaWorkhours(String vehicleno, double area, double workingHours) { + machineryJobDataMapper.updateAreaWorkhours(vehicleno, area, workingHours); + + } + + /** + * 查询今日作业数据 + * @return + */ + @Override + public MachineryJobDataVo selectTodayJobData() { + return machineryJobDataMapper.selectTodayJobData(); + + } + + /** + * 查询正在工作农机数量 + * @return + */ + @Override + public int selectWorkingMachinery() { + return machineryTrajectoryMapper.selectWorkingMachinery(); + } + + /** + * 插入农机位置 + * @param position + */ + @Override + public void insertPositions(List position) { + machineryPositionMapper.insertBatch(position); + } + + /** + * 查询农机作业类型 + * @param vehicleno + * @return + */ + @Override + public int selectJobtype(String vehicleno) { + return machineryPositionMapper.selectJobtype(vehicleno); + } + + +} diff --git a/ruoyi-crops/src/main/java/com/ruoyi/crops/service/impl/FertigationSenseImpl.java b/ruoyi-crops/src/main/java/com/ruoyi/crops/service/impl/FertigationSenseImpl.java index 10c28d1..83b8a4d 100644 --- a/ruoyi-crops/src/main/java/com/ruoyi/crops/service/impl/FertigationSenseImpl.java +++ b/ruoyi-crops/src/main/java/com/ruoyi/crops/service/impl/FertigationSenseImpl.java @@ -5,7 +5,6 @@ import com.ruoyi.crops.domain.FertigationSense; import com.ruoyi.crops.mapper.FertigationSenseMapper; import com.ruoyi.crops.service.IFertigationSenseService; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Service; @Service diff --git a/ruoyi-crops/src/main/java/com/ruoyi/crops/service/impl/GeoServerImpl.java b/ruoyi-crops/src/main/java/com/ruoyi/crops/service/impl/GeoServerImpl.java index d1f136b..23f6b4f 100644 --- a/ruoyi-crops/src/main/java/com/ruoyi/crops/service/impl/GeoServerImpl.java +++ b/ruoyi-crops/src/main/java/com/ruoyi/crops/service/impl/GeoServerImpl.java @@ -5,17 +5,22 @@ import com.ruoyi.crops.mapper.ServiceTypeMapper; import com.ruoyi.crops.service.IGeoServer; import it.geosolutions.geoserver.rest.GeoServerRESTManager; import it.geosolutions.geoserver.rest.GeoServerRESTPublisher; +import it.geosolutions.geoserver.rest.GeoServerRESTReader; import it.geosolutions.geoserver.rest.decoder.RESTDataStore; -import it.geosolutions.geoserver.rest.encoder.GSLayerEncoder; import it.geosolutions.geoserver.rest.encoder.GSResourceEncoder; import it.geosolutions.geoserver.rest.encoder.datastore.GSGeoTIFFDatastoreEncoder; +import it.geosolutions.geoserver.rest.manager.GeoServerRESTStyleManager; +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.stereotype.Service; import java.io.File; import java.net.URL; +import java.util.HashMap; import java.util.List; +import java.util.Map; @Service public class GeoServerImpl implements IGeoServer { @@ -26,15 +31,13 @@ public class GeoServerImpl implements IGeoServer { private String username; @Value("${geoserver.password}") private String password; - + private static final Logger logger = LoggerFactory.getLogger(GeoServerImpl.class); @Autowired private ServiceTypeMapper serviceTypeMapper; @Override - public String GeoServer(String workSpace, String storeName, String filePath) throws Exception { - - //待创建和发布图层的工作区名称workspace - //待创建和发布图层的数据存储名称store + public String publishTiff(String workSpace, String storeName, String filePath, String styleName) throws Exception { + String result=""; //判断工作区(workspace)是否存在,不存在则创建 URL u = new URL(url); GeoServerRESTManager manager = new GeoServerRESTManager(u, username, password); @@ -42,29 +45,62 @@ public class GeoServerImpl implements IGeoServer { List workspaces = manager.getReader().getWorkspaceNames(); if (!workspaces.contains(workSpace)) { boolean createws = publisher.createWorkspace(workSpace); - System.out.println("create ws : " + createws); - } else { - System.out.println("workspace已经存在了,ws :" + workSpace); + logger.info("create ws : " + createws); } + try { + //判断数据存储(datastore)是否已经存在,不存在则创建 + RESTDataStore restStore = manager.getReader().getDatastore(workSpace, storeName); + if (restStore == null) { + GSGeoTIFFDatastoreEncoder gsGeoTIFFDatastoreEncoder = new GSGeoTIFFDatastoreEncoder(storeName); + gsGeoTIFFDatastoreEncoder.setWorkspaceName(workSpace); + gsGeoTIFFDatastoreEncoder.setUrl(new URL("file:" + filePath)); + boolean createStore = manager.getStoreManager().create(workSpace, gsGeoTIFFDatastoreEncoder); + logger.info("create store (TIFF文件创建状态) : " + createStore); - //判断数据存储(datastore)是否已经存在,不存在则创建 + boolean publish = manager.getPublisher().publishGeoTIFF(workSpace, storeName, storeName,new File(filePath),"EPSG:4326", + GSResourceEncoder.ProjectionPolicy.FORCE_DECLARED,styleName,null); + logger.info("publish (TIFF文件发布状态) : " + publish); - RESTDataStore restStore = manager.getReader().getDatastore(workSpace, storeName); - if (restStore == null) { - GSGeoTIFFDatastoreEncoder gsGeoTIFFDatastoreEncoder = new GSGeoTIFFDatastoreEncoder(storeName); - gsGeoTIFFDatastoreEncoder.setWorkspaceName(workSpace); - gsGeoTIFFDatastoreEncoder.setUrl(new URL("file:" + filePath)); - boolean createStore = manager.getStoreManager().create(workSpace, gsGeoTIFFDatastoreEncoder); - System.out.println("create store (TIFF文件创建状态) : " + createStore); - - boolean publish = manager.getPublisher().publishGeoTIFF(workSpace, storeName, new File(filePath)); - System.out.println("publish (TIFF文件发布状态) : " + publish); - - return "create store (TIFF文件创建状态) : " + createStore + " publish (TIFF文件发布状态) : " + publish; - } else { - System.out.println("数据存储已经存在了,store:" + storeName); + result = "create store (TIFF文件创建状态) : " + createStore + " publish (TIFF文件发布状态) : " + publish; + } else { + result = "数据存储已经存在了,store:" + storeName; + } + }catch (Exception e){ + e.printStackTrace(); } - return null; + return result; + } + + @Override + public String publishShp(String workSpace, String storeName, String layername, String filePath) { + String result=""; + try { + File zipFile=new File(filePath); + GeoServerRESTReader reader = new GeoServerRESTReader(url, username, password); + GeoServerRESTPublisher publisher = new GeoServerRESTPublisher(url, username, password); + List workspaces=reader.getWorkspaceNames(); + + // 判断工作空间和图层是否存在 + boolean existsStore = reader.existsDatastore(workSpace, storeName); + boolean existsLayer = reader.existsLayer(workSpace, layername); + if (existsStore||existsLayer){ + logger.info("工作空间存在:"+existsStore+"图层存在:"+existsLayer); + boolean removeLayer = publisher.removeLayer(workSpace, layername); + boolean removeStore = publisher.removeDatastore(workSpace, storeName, true); + logger.info("删除工作空间:"+removeStore+"删除图层:"+removeLayer); + } + + if(workspaces.contains(workSpace)){ + if(publisher.publishShp(workSpace, storeName, layername, zipFile, "EPSG:4326")){ + result = "发布成功!"; + } else { + result = "发布失败!"; + } + } + }catch (Exception e){ + e.printStackTrace(); + } + return result; } @Override diff --git a/ruoyi-crops/src/main/java/com/ruoyi/crops/service/impl/IWeatherPredictionServiceImpl.java b/ruoyi-crops/src/main/java/com/ruoyi/crops/service/impl/IWeatherPredictionServiceImpl.java new file mode 100644 index 0000000..d4b9dea --- /dev/null +++ b/ruoyi-crops/src/main/java/com/ruoyi/crops/service/impl/IWeatherPredictionServiceImpl.java @@ -0,0 +1,187 @@ +package com.ruoyi.crops.service.impl; + +import com.ruoyi.crops.domain.WeatherPredictionEntity; +import com.ruoyi.crops.domain.vo.WeatherPredoctionVo; +import com.ruoyi.crops.mapper.WeatherPredictionMapper; +import com.ruoyi.crops.service.IWeatherPredictionService; +import org.jsoup.Connection; +import org.jsoup.Jsoup; +import org.jsoup.nodes.Document; +import org.jsoup.nodes.Element; +import org.jsoup.nodes.Node; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.io.IOException; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.util.*; + +@Service +public class IWeatherPredictionServiceImpl implements IWeatherPredictionService { + @Autowired + private WeatherPredictionMapper weatherPredictionMapper; + + @Override + public List getWeather() throws IOException { + // 目标网页中国气象局 + String testURL = "https://weather.cma.cn/web/weather/54737.html"; + Connection con = Jsoup.connect(testURL); + // 选择发送方式,获取整个网页信息,存在documnet类里 + Document document = con.get(); + // 定义天气日期列表 + List weatherDayList = new ArrayList<>(); + // 定义天气名称列表 + List weatherNameList = new ArrayList<>(); + // 获取当前日期 + LocalDate dateNow = LocalDate.now(); + DateTimeFormatter dfDate = DateTimeFormatter.ofPattern("yyyy-MM-dd"); + LocalDate lastDate = dateNow.minusDays(1); + ; + DateTimeFormatter dfDateTime = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm"); + // 获取日期列表 + List dayList = Objects.requireNonNull(document.body().getElementById("dayList")).childNodes(); + + for (Node node : dayList) { + if (node != null && !node.toString().equals("")) { + String datStr = dateNow.getYear() + "-" + node.childNode(1).childNode(2).toString(). + replaceAll("\r|\n", "").replaceAll("/", "-"); + String weatherName = node.childNode(5).childNode(0).toString().replaceAll("\r|\n", ""); + + LocalDate dateDay = LocalDate.parse(datStr, dfDate); + // 如果日期未按顺序排列,则发生跨年,年份加一 + if (lastDate.isAfter(dateDay)) { + dateDay = dateDay.plusYears(1); + } + lastDate = dateDay; + weatherDayList.add(dateDay); + weatherNameList.add(weatherName); + } + } + // 定义天气变量列表 + List weatherTimeList = new ArrayList<>(); + List airTemperatureList = new ArrayList<>(); + List precipitationList = new ArrayList<>(); + List windSpeedList = new ArrayList<>(); + List windDirectionList = new ArrayList<>(); + List atmosphericPressureList = new ArrayList<>(); + List humidityList = new ArrayList<>(); + List cloudCoverList = new ArrayList<>(); + // 获取分小时气象信息 + List hourTableList = new ArrayList<>(Arrays.asList(document.body().getElementById("hourTable_0"), + document.body().getElementById("hourTable_1"), document.body().getElementById("hourTable_2"), + document.body().getElementById("hourTable_3"), document.body().getElementById("hourTable_4"), + document.body().getElementById("hourTable_5"), document.body().getElementById("hourTable_6") + )); + // 获取当前时间 + LocalDateTime dateTimeNow = LocalDateTime.now(); + int m = 0; + // 获取逐天分小时气象信息表格数据 + for (Element elementList : hourTableList) { + List nodeList = elementList.childNode(1).childNodes(); + LocalDateTime lastDateTime = dateTimeNow.minusMinutes(180); + int n = 0; + for (Node node : nodeList) { + if (node != null && !node.toString().equals("")) { + List nodeList2 = node.childNodes(); + for (Node node2 : nodeList2) { + if (node2 != null && !node2.toString().equals("")) { + n = n + 1; + // 如果多于一个节点 + if (node2.childNodes().size() > 1) { + List list = new ArrayList<>(); + list = new ArrayList<>(new LinkedHashSet<>(list)); + } else { + // 如果是单一节点,获取该节点的值 + if (n > 1 && n < 10) { + String dateTimeStr = weatherDayList.get(m) + " " + node2.childNode(0); + LocalDateTime localDateTime = LocalDateTime.parse(dateTimeStr, dfDateTime); + // 若跨日,日期加一 + if (lastDateTime.isAfter(localDateTime)) { + localDateTime = localDateTime.plusDays(1); + } + weatherTimeList.add(localDateTime); + lastDateTime = localDateTime; + } + if (n > 10 && n < 19) { + weatherNameList.add(node2.childNode(0).toString()); + } + if (n > 19 && n < 28) { + airTemperatureList.add(node2.childNode(0).toString()); + } + if (n > 28 && n < 37) { + precipitationList.add(node2.childNode(0).toString()); + } + if (n > 37 && n < 46) { + windSpeedList.add(node2.childNode(0).toString()); + } + + if (n > 46 && n < 55) { + windDirectionList.add(node2.childNode(0).toString()); + } + + if (n > 55 && n < 64) { + atmosphericPressureList.add(node2.childNode(0).toString()); + } + + if (n > 64 && n < 73) { + humidityList.add(node2.childNode(0).toString()); + } + + if (n > 73 && n < 82) { + cloudCoverList.add(node2.childNode(0).toString()); + } + } + } + } + } + } + m = m + 1; + } + + List weatherPredictionEntityArrayList = new ArrayList<>(); + // 长度固定 8*7 = 56 + int len = 8 * 7; + for (int i = 0; i < len; i++) { + WeatherPredictionEntity weatherPredictionEntity = new WeatherPredictionEntity(); + weatherPredictionEntity.setWeatherName(weatherNameList.get(i / 8)); + weatherPredictionEntity.setWeatherTime(weatherTimeList.get(i)); + weatherPredictionEntity.setAirTemperature(airTemperatureList.get(i)); + weatherPredictionEntity.setPrecipitation(precipitationList.get(i)); + weatherPredictionEntity.setWindSpeed(windSpeedList.get(i)); + weatherPredictionEntity.setWindDirection(windDirectionList.get(i)); + weatherPredictionEntity.setAtmosphericPressure(atmosphericPressureList.get(i)); + weatherPredictionEntity.setHumidity(humidityList.get(i)); + weatherPredictionEntity.setCloudCover(cloudCoverList.get(i)); + weatherPredictionEntityArrayList.add(weatherPredictionEntity); + } + return weatherPredictionEntityArrayList; + } + + @Override + public int insert(WeatherPredictionEntity weatherPredictionEntity) { + + return weatherPredictionMapper.insert(weatherPredictionEntity); + } + + @Override + public int insertBatch(List list) { + return weatherPredictionMapper.insertBatch(list); + } + + @Override + public List selectWeek() { + return weatherPredictionMapper.selectWeek(); + } + + @Override + public List selectByTime(Date time) { + return weatherPredictionMapper.selectByTime(time); + } + + @Override + public List select(Date time) { + return weatherPredictionMapper.select(time); + } +} diff --git a/ruoyi-crops/src/main/java/com/ruoyi/crops/service/impl/InterfaceStatisticsServiceImpl.java b/ruoyi-crops/src/main/java/com/ruoyi/crops/service/impl/InterfaceStatisticsServiceImpl.java new file mode 100644 index 0000000..81a70ea --- /dev/null +++ b/ruoyi-crops/src/main/java/com/ruoyi/crops/service/impl/InterfaceStatisticsServiceImpl.java @@ -0,0 +1,31 @@ +package com.ruoyi.crops.service.impl; + +import com.ruoyi.crops.domain.InterfaceStatistics; +import com.ruoyi.crops.domain.vo.InterfaceStatisticsVo; +import com.ruoyi.crops.mapper.InterfaceStatisticsMapper; +import com.ruoyi.crops.service.InterfaceStatisticsService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service +public class InterfaceStatisticsServiceImpl implements InterfaceStatisticsService { + @Autowired + private InterfaceStatisticsMapper interfaceStatisticsMapper; + @Override + public int insert(InterfaceStatistics interfaceStatistics) { + return interfaceStatisticsMapper.insert(interfaceStatistics); + } + + @Override + public InterfaceStatistics selectByDay() { + return interfaceStatisticsMapper.selectByDay(); + } + + @Override + public InterfaceStatisticsVo selectTotal() { + + return interfaceStatisticsMapper.selectTotal(); + } +} diff --git a/ruoyi-crops/src/main/java/com/ruoyi/crops/service/impl/MachineParameterServiceImpl.java b/ruoyi-crops/src/main/java/com/ruoyi/crops/service/impl/MachineParameterServiceImpl.java index ec1d67a..ee75d86 100644 --- a/ruoyi-crops/src/main/java/com/ruoyi/crops/service/impl/MachineParameterServiceImpl.java +++ b/ruoyi-crops/src/main/java/com/ruoyi/crops/service/impl/MachineParameterServiceImpl.java @@ -1,24 +1,101 @@ package com.ruoyi.crops.service.impl; +import cn.hutool.http.HttpUtil; +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; import com.ruoyi.crops.domain.MachineParameter; -import com.ruoyi.crops.mapper.MachineParameterMapper; +import com.ruoyi.crops.domain.UserInfo; +import com.ruoyi.crops.domain.gsonBean.GsonMachineParameterBean; +import com.ruoyi.crops.domain.vo.MachineParameterVo; import com.ruoyi.crops.service.IMachineParameterService; +import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.data.redis.core.RedisTemplate; import org.springframework.stereotype.Service; +import java.lang.reflect.Field; +import java.lang.reflect.Method; +import java.util.HashMap; import java.util.List; +import java.util.Map; @Service public class MachineParameterServiceImpl implements IMachineParameterService { @Autowired - private MachineParameterMapper machineParameterMapper; + private RedisTemplate redisTemplate; + + @Value("${url.machine}") + private String url; + + /** + * 获取水肥机全部状态参数 + * @return + * @throws Exception + */ @Override - public List selectByName(String name) { - return machineParameterMapper.selectByName(name); + public MachineParameter getMachineParameter() throws Exception { + + Map map = new HashMap<>();//存放参数 + UserInfo userInfo = (UserInfo) redisTemplate.opsForValue().get("cropsUserInfo"); +// map.put("id", userInfo.getId()); + map.put("id", "7f3f70c7cd134881b84d1db36b20c416"); + map.put("deviceId", "00093495000000000002"); + HashMap headers = new HashMap<>();//存放请求头,可以存放多个请求头 +// headers.put("token", userInfo.getToken()); + headers.put("token", "BAC5284E7938B521E888E9B3CB6B5DA9"); + //发送get请求并接收响应数据 + String result = HttpUtil.createGet(url).addHeaders(headers).form(map).execute().body(); + + Gson gson = new GsonBuilder().setDateFormat("yyyy/MM/dd HH:mm:ss").create(); + //格式化json,封装到GsonDeviceSenseBean类型 + GsonMachineParameterBean model = gson.fromJson(result, GsonMachineParameterBean.class); + + MachineParameter machineParameter = new MachineParameter(); + //反射获取data里所有对象 + Field[] field = model.data.getClass().getDeclaredFields(); + + for (int i = 0; i < field.length - 1; i++) { + //遍历对象的属性名 + String name = field[i].getName(); + //获取相应对象的get方法 + Method m = model.data.getClass().getMethod("get" + name); + //执行get方法,得到property对象 + GsonMachineParameterBean.property value = (GsonMachineParameterBean.property) m.invoke(model.data); + //获取property对象里的value + String propertyValve = value.propertyValve; + + if (propertyValve != null) { + //获取要set对象的对应类型 + Field f = machineParameter.getClass().getDeclaredField(name); + String type = f.getType().getName(); + Class[] classes = new Class[0]; + Object[] objects = new Object[0]; + if (type.equals("java.lang.Double")) { + classes = new Class[]{Double.class}; + objects = new Object[]{new Double(Double.parseDouble(propertyValve))}; + } else if (type.equals("java.lang.String")) { + classes = new Class[]{String.class}; + objects = new Object[]{new String(propertyValve)}; + } + Method mset = machineParameter.getClass().getMethod("set" + name, classes); + mset.invoke(machineParameter, objects); + } + } + return machineParameter; } + /** + * 获取ph值,流量,压力值 + * @return + * @throws Exception + */ @Override - public int insert(MachineParameter machineParameter) { - return machineParameterMapper.insert(machineParameter); + public MachineParameterVo selectParameter() throws Exception { + MachineParameter machineParameter = getMachineParameter(); + MachineParameterVo vo = new MachineParameterVo(); + BeanUtils.copyProperties(machineParameter,vo); + return vo; + } } diff --git a/ruoyi-crops/src/main/java/com/ruoyi/crops/service/impl/MapDrawPolygonServiceImpl.java b/ruoyi-crops/src/main/java/com/ruoyi/crops/service/impl/MapDrawPolygonServiceImpl.java new file mode 100644 index 0000000..c7d47d8 --- /dev/null +++ b/ruoyi-crops/src/main/java/com/ruoyi/crops/service/impl/MapDrawPolygonServiceImpl.java @@ -0,0 +1,154 @@ +package com.ruoyi.crops.service.impl; + +import com.ruoyi.common.utils.MyPoint; +import com.ruoyi.crops.service.IMapDrawPolygonService; + +import org.springframework.stereotype.Service; + +import java.util.*; +import java.util.stream.Collectors; + +@Service +public class MapDrawPolygonServiceImpl implements IMapDrawPolygonService { + +// public String DrawPolygon(List points) { +// +// String wkt = point2WktPolygon(convexHull(points)); +//// AjaxResult a = new AjaxResult(); +//// a.put("WKT",wkt); +//// a.put("area",getAreaByWkt(wkt)); +//// return AjaxResult.success(a); +// return wkt; +// } + + @Override + public List DrawPolygon(List points) { + return convexHull(points); + } + + public static List convexHull(List points) { + //小于三个点的情况,直接返回 + if (points.size() < 3) { + return points; + } + + MyPoint first = points.get(0); + // 找到最左下角的点 + for (int i = 0; i < points.size(); i++) { + if (points.get(i).getY() < first.getY() || (points.get(i).getY() == first.getY() && points.get(i).getX() < first.getX())) { + first = points.get(i); + } + } + + List sortedList = angleSorting(first, points); +// logger.info("凸包计算-最下面偏左的点位是:{}", first); +// logger.info("凸包计算-角排序结果:{}", JSONObject.toJSONString(sortedList)); + int firstIndex = 0; + for (int i = 0; i < sortedList.size(); i++) { + if (first.getX() == sortedList.get(i).getX() && first.getY() == sortedList.get(i).getY()) { + firstIndex = i; + } + } + // 结果集合 + List convexHullPoints = new ArrayList<>(); + convexHullPoints.add(first); + int nextIndex = firstIndex + 1 == sortedList.size() ? 0 : firstIndex + 1; + MyPoint next = new MyPoint(); + while (next != first) { + next = sortedList.get(nextIndex); + + while (true) { + if (convexHullPoints.size() < 2) { + convexHullPoints.add(next); + break; + } + if (isEnabled(convexHullPoints.get(convexHullPoints.size() - 2), convexHullPoints.get(convexHullPoints.size() - 1), next)) { + convexHullPoints.add(next); + break; + } else { + convexHullPoints.remove(convexHullPoints.size() - 1); + } + } + nextIndex = nextIndex + 1 == sortedList.size() ? 0 : nextIndex + 1; + } + convexHullPoints = convexHullPoints.stream().distinct().collect(Collectors.toList()); +// logger.info("凸包计算-结果:{}", JSONObject.toJSONString(convexHullPoints)); +// logger.info("凸包结算-结果绘制成线:{}", point2WktLine(convexHullPoints)); + return convexHullPoints; + } + + public static boolean isEnabled(MyPoint A, MyPoint B, MyPoint C) { + double mulCross = A.getX() * B.getY() - A.getY() * B.getX() + B.getX() * C.getY() - B.getY() * C.getX() + C.getX() * A.getY() - C.getY() * A.getX(); + if (mulCross >= 0) { + return true; + } else { + return false; + } + } + public static class MyHashMap extends HashMap{ + @Override + public Object put(Object key, Object value) { + if (containsKey(key)){ + return null; + } + return super.put(key, value); + } + } + /** + * 以原点为中心进行角排序 + * + * @param points 点位 + * @return 排序的点位 + */ + public static List angleSorting(MyPoint first, List points) { + points = points.stream().sorted(Comparator.comparing(MyPoint::getX)).collect(Collectors.toList()); + points = points.stream().sorted(Comparator.comparing(MyPoint::getY)).collect(Collectors.toList()); + MyHashMap pointMap = new MyHashMap<>(); + List angles = new ArrayList<>(); + for (MyPoint point : points) { + double angle = Math.atan2(point.getY() - first.getY(), point.getX() - first.getX()) * 180.0 / Math.PI; + if (angle < 0) { + angle += 360.0; + } + pointMap.put(angle, point); + angles.add(angle); + } + angles = angles.stream().sorted().collect(Collectors.toList()); + List result = new ArrayList<>(); + for (Double angle : angles) { + result.add((MyPoint) pointMap.get(angle)); + } + +// result.add(first); + return result; + } + + public static String point2WktPolygon(List 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 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(); + } + + public static String point2WktPoint(List points) { + StringBuilder sb = new StringBuilder("MULTIPOINT("); + 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(); + } +} diff --git a/ruoyi-crops/src/main/java/com/ruoyi/crops/service/impl/MeteorologicalServiceImpl.java b/ruoyi-crops/src/main/java/com/ruoyi/crops/service/impl/MeteorologicalServiceImpl.java index 1666082..6b0976b 100644 --- a/ruoyi-crops/src/main/java/com/ruoyi/crops/service/impl/MeteorologicalServiceImpl.java +++ b/ruoyi-crops/src/main/java/com/ruoyi/crops/service/impl/MeteorologicalServiceImpl.java @@ -13,14 +13,33 @@ public class MeteorologicalServiceImpl implements IMeteorologicalService { @Autowired private MeteorologicalMapper meteorologicalMapper; + /** + * 根据时间查询 + * @return + */ @Override public List selectByTime() { return meteorologicalMapper.selectbyTime(); } + /** + * 新增单条数据 + * @param ml + * @return + */ @Override public int insert(Meteorological ml) { return meteorologicalMapper.insert(ml); } + + /** + * 批量新增数据 + * @param ml + * @return + */ + @Override + public int insertBatch(List ml) { + return meteorologicalMapper.insertBatch(ml); + } } diff --git a/ruoyi-crops/src/main/java/com/ruoyi/crops/service/impl/OperationRecordsServiceImppl.java b/ruoyi-crops/src/main/java/com/ruoyi/crops/service/impl/OperationRecordsServiceImpl.java similarity index 89% rename from ruoyi-crops/src/main/java/com/ruoyi/crops/service/impl/OperationRecordsServiceImppl.java rename to ruoyi-crops/src/main/java/com/ruoyi/crops/service/impl/OperationRecordsServiceImpl.java index 69481c7..a54c38a 100644 --- a/ruoyi-crops/src/main/java/com/ruoyi/crops/service/impl/OperationRecordsServiceImppl.java +++ b/ruoyi-crops/src/main/java/com/ruoyi/crops/service/impl/OperationRecordsServiceImpl.java @@ -9,9 +9,10 @@ import org.springframework.stereotype.Service; import java.util.List; @Service -public class OperationRecordsServiceImppl implements IOperationRecordsService { +public class OperationRecordsServiceImpl implements IOperationRecordsService { @Autowired private OperationRecordsMapper operationRecordsMapper; + @Override public List selectAll() { return operationRecordsMapper.selectAll(); diff --git a/ruoyi-crops/src/main/java/com/ruoyi/crops/service/impl/ServiceTypeServiceImpl.java b/ruoyi-crops/src/main/java/com/ruoyi/crops/service/impl/ServiceTypeServiceImpl.java index 3790745..dcf5bfb 100644 --- a/ruoyi-crops/src/main/java/com/ruoyi/crops/service/impl/ServiceTypeServiceImpl.java +++ b/ruoyi-crops/src/main/java/com/ruoyi/crops/service/impl/ServiceTypeServiceImpl.java @@ -12,22 +12,46 @@ import java.util.List; public class ServiceTypeServiceImpl implements IServiceTypeService { @Autowired private ServiceTypeMapper serviceTypeMapper; + + /** + * 根据类型查询 + * + * @param type + * @return + */ @Override public List selectByType(String type) { return serviceTypeMapper.selectByType(type); } + /** + * 新增单条数据 + * + * @param serviceType + * @return + */ @Override public int insert(ServiceType serviceType) { return serviceTypeMapper.insert(serviceType); } + /** + * 查询全部数据 + * + * @return + */ @Override public List selectAll() { return serviceTypeMapper.selectAll(); } + /** + * 根据id数组批量删除 + * + * @param ids + * @return + */ @Override public int deleteByIds(Long[] ids) { return serviceTypeMapper.deleteByIds(ids); diff --git a/ruoyi-crops/src/main/java/com/ruoyi/crops/service/impl/UploadServiceImpl.java b/ruoyi-crops/src/main/java/com/ruoyi/crops/service/impl/UploadServiceImpl.java index d8b3813..0f91ef8 100644 --- a/ruoyi-crops/src/main/java/com/ruoyi/crops/service/impl/UploadServiceImpl.java +++ b/ruoyi-crops/src/main/java/com/ruoyi/crops/service/impl/UploadServiceImpl.java @@ -1,5 +1,6 @@ package com.ruoyi.crops.service.impl; +import com.ruoyi.common.exception.base.BaseException; import com.ruoyi.crops.mapper.ServiceTypeMapper; import com.ruoyi.crops.service.IUploadService; @@ -15,16 +16,17 @@ import java.util.regex.Matcher; public class UploadServiceImpl implements IUploadService { @Autowired private ServiceTypeMapper serviceTypeMapper; + @Override - public String upload(String type,MultipartFile file, String fileRoot) throws IOException { + public String upload(MultipartFile file, String fileRoot) throws IOException { prepareFilePath(fileRoot); // 获取上传文件的原文件名 String fileName = file.getOriginalFilename(); - if (serviceTypeMapper.selectByfile(fileName)>0){ - return "文件已存在"; - }else { + if (serviceTypeMapper.selectByfile(fileName) > 0) { + throw new BaseException("文件已存在"); + } else { // 规则化之后的文件上传根路径 String normalizeFileRoot = getNormalizeFileRoot(fileRoot); // 根据路径和文件名创建目标文件 @@ -34,7 +36,7 @@ public class UploadServiceImpl implements IUploadService { if (targetFile.exists()) targetFile.delete(); - // 将目标文件进行转移 + // 将目标文件进行转移保存到指定位置,程序运行时,临时存储在temp这个文件夹中 file.transferTo(targetFile); return String.format("%s\\%s", normalizeFileRoot, fileName); @@ -42,8 +44,8 @@ public class UploadServiceImpl implements IUploadService { } /** - fileRoot:上传文件保存的根路径 - 此方法是准备文件上传的路径,如果路径不存在,即创建 + * fileRoot:上传文件保存的根路径 + * 此方法是准备文件上传的路径,如果路径不存在,即创建 */ private void prepareFilePath(String fileRoot) { File file = new File(normalizePath(fileRoot)); @@ -52,12 +54,13 @@ public class UploadServiceImpl implements IUploadService { } /** - 该方法主要对文件路径进行规则化,如:D:\\\360Browser\///360Chrome\\//, - 像这种路径就不正确,此方法可以将路径规则化为:D:\360Browser\360Chrome + * 该方法主要对文件路径进行规则化,如:D:\\\360Browser\///360Chrome\\//, + * 像这种路径就不正确,此方法可以将路径规则化为:D:\360Browser\360Chrome */ private String getNormalizeFileRoot(String fileRoot) { return normalizePath(fileRoot); } + public static String normalizePath(String path) { String result = path.replaceAll("/+", Matcher.quoteReplacement(File.separator)); return result.replaceAll("\\\\+", Matcher.quoteReplacement(File.separator)); diff --git a/ruoyi-crops/src/main/java/com/ruoyi/crops/service/impl/WarningFarmServiceImpl.java b/ruoyi-crops/src/main/java/com/ruoyi/crops/service/impl/WarningFarmServiceImpl.java new file mode 100644 index 0000000..9c618d6 --- /dev/null +++ b/ruoyi-crops/src/main/java/com/ruoyi/crops/service/impl/WarningFarmServiceImpl.java @@ -0,0 +1,27 @@ +package com.ruoyi.crops.service.impl; + +import com.ruoyi.crops.domain.WarningFarm; +import com.ruoyi.crops.domain.WarningInformation; +import com.ruoyi.crops.mapper.WarningFarmMapper; +import com.ruoyi.crops.service.IWarningFarmService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.Date; +import java.util.List; + +@Service +public class WarningFarmServiceImpl implements IWarningFarmService { + @Autowired + private WarningFarmMapper warningFarmMapper; + @Override + public int insertWarning(WarningFarm warningFarm) { + return warningFarmMapper.insertWarning(warningFarm); + + } + + @Override + public List selectByTime(Date beginTime, Date endTime) { + return warningFarmMapper.selectByTime(beginTime,endTime); + } +} diff --git a/ruoyi-crops/src/main/java/com/ruoyi/crops/service/impl/WarningServiceImpl.java b/ruoyi-crops/src/main/java/com/ruoyi/crops/service/impl/WarningServiceImpl.java index 317b640..48abef1 100644 --- a/ruoyi-crops/src/main/java/com/ruoyi/crops/service/impl/WarningServiceImpl.java +++ b/ruoyi-crops/src/main/java/com/ruoyi/crops/service/impl/WarningServiceImpl.java @@ -10,15 +10,14 @@ import org.springframework.stereotype.Service; import java.util.Date; import java.util.List; -import static cn.hutool.core.date.DateTime.now; - @Service public class WarningServiceImpl implements IWarningService { @Autowired private WarningMapper warningMapper; + @Override - public List selectByTime(Date startTime,Date endTime) { - return warningMapper.selectByTime(startTime,endTime); + public List selectByTime(Date startTime, Date endTime) { + return warningMapper.selectByTime(startTime, endTime); } @Override @@ -27,7 +26,7 @@ public class WarningServiceImpl implements IWarningService { } @Override - public int insertWarning(DeviceSense deviceSense) { + public int judgeWarning(DeviceSense deviceSense) { WarningInformation warningInformation = new WarningInformation(); Double sunlight = deviceSense.getSunlight(); if (sunlight > 2) { @@ -38,7 +37,8 @@ public class WarningServiceImpl implements IWarningService { warningInformation.setAaus("Lux"); warningMapper.insert(warningInformation); - } if (sunlight < 1) { + } + if (sunlight < 1) { warningInformation.setMonitoringIndicators("光照强度"); warningInformation.setMonitoringValues(sunlight); warningInformation.setAbnormalCause("偏低"); @@ -48,7 +48,7 @@ public class WarningServiceImpl implements IWarningService { } //空气温度[°C] Double airTemp = deviceSense.getAirTemp(); - if (airTemp>22.6){ + if (airTemp > 22.6) { warningInformation.setMonitoringIndicators("空气温度"); warningInformation.setMonitoringValues(airTemp); warningInformation.setAbnormalCause("偏高"); @@ -56,7 +56,7 @@ public class WarningServiceImpl implements IWarningService { warningInformation.setAaus("°C"); warningMapper.insert(warningInformation); } - if (airTemp<22.2){ + if (airTemp < 22.2) { warningInformation.setMonitoringIndicators("空气温度"); warningInformation.setMonitoringValues(airTemp); warningInformation.setAbnormalCause("偏低"); @@ -66,7 +66,7 @@ public class WarningServiceImpl implements IWarningService { } //空气湿度[%] Double airHumidity = deviceSense.getAirHumidity(); - if (airHumidity>48){ + if (airHumidity > 48) { warningInformation.setMonitoringIndicators("空气湿度"); warningInformation.setMonitoringValues(airHumidity); warningInformation.setAbnormalCause("偏高"); @@ -74,7 +74,7 @@ public class WarningServiceImpl implements IWarningService { warningInformation.setAaus("%"); warningMapper.insert(warningInformation); } - if (airHumidity<45){ + if (airHumidity < 45) { warningInformation.setMonitoringIndicators("空气湿度"); warningInformation.setMonitoringValues(airHumidity); warningInformation.setAbnormalCause("偏低"); @@ -84,7 +84,7 @@ public class WarningServiceImpl implements IWarningService { } //土壤温度[°C] Double soilTemp = deviceSense.getSoilTemp(); - if (soilTemp>22.8){ + if (soilTemp > 22.8) { warningInformation.setMonitoringIndicators("土壤温度"); warningInformation.setMonitoringValues(soilTemp); warningInformation.setAbnormalCause("偏高"); @@ -92,7 +92,7 @@ public class WarningServiceImpl implements IWarningService { warningInformation.setAaus("°C"); warningMapper.insert(warningInformation); } - if (soilTemp<22.7){ + if (soilTemp < 22.7) { warningInformation.setMonitoringIndicators("土壤温度"); warningInformation.setMonitoringValues(soilTemp); warningInformation.setAbnormalCause("偏低"); @@ -102,7 +102,7 @@ public class WarningServiceImpl implements IWarningService { } //土壤湿度[%] Double soilHumidity = deviceSense.getSoilHumidity(); - if (soilHumidity>3){ + if (soilHumidity > 3) { warningInformation.setMonitoringIndicators("土壤湿度"); warningInformation.setMonitoringValues(soilHumidity); warningInformation.setAbnormalCause("偏高"); @@ -110,7 +110,7 @@ public class WarningServiceImpl implements IWarningService { warningInformation.setAaus("%"); warningMapper.insert(warningInformation); } - if (soilHumidity<1){ + if (soilHumidity < 1) { warningInformation.setMonitoringIndicators("土壤湿度"); warningInformation.setMonitoringValues(soilHumidity); warningInformation.setAbnormalCause("偏低"); @@ -121,7 +121,7 @@ public class WarningServiceImpl implements IWarningService { //二氧化碳浓度[ppm] Double co2_ = deviceSense.getCO2_(); - if (co2_>800){ + if (co2_ > 800) { warningInformation.setMonitoringIndicators("二氧化碳浓度"); warningInformation.setMonitoringValues(co2_); warningInformation.setAbnormalCause("偏高"); @@ -129,7 +129,7 @@ public class WarningServiceImpl implements IWarningService { warningInformation.setAaus("ppm"); warningMapper.insert(warningInformation); } - if (co2_<530){ + if (co2_ < 530) { warningInformation.setMonitoringIndicators("二氧化碳浓度"); warningInformation.setMonitoringValues(co2_); warningInformation.setAbnormalCause("偏低"); diff --git a/ruoyi-crops/src/main/resources/mapper/crops/CropsComprehensiveDataMapper.xml b/ruoyi-crops/src/main/resources/mapper/crops/CropsComprehensiveDataMapper.xml index f3e7669..3f77677 100644 --- a/ruoyi-crops/src/main/resources/mapper/crops/CropsComprehensiveDataMapper.xml +++ b/ruoyi-crops/src/main/resources/mapper/crops/CropsComprehensiveDataMapper.xml @@ -29,10 +29,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - select id, cultivated_area, foodstuff_production, vegetable_planting_area, vegetable_production, type, agricultural_planting_area, agriculture_production, agriculture_output_vaule, total_population, cover_area, example_greenhouse, rusticate, cultivated_ally, greenhouse, output_value, vector_boundary, village_vector_boundary,img, created_by, created_time from crops_comprehensive_data + select id, cultivated_area, foodstuff_production, vegetable_planting_area, vegetable_production, type, agricultural_planting_area, agriculture_production, agriculture_output_vaule, total_population, cover_area, example_greenhouse, rusticate, cultivated_ally, greenhouse, output_value, vector_boundary, village_vector_boundary,img, created_by, created_time + from ruoyi.crops_comprehensive_data - and cultivated_area = #{cultivatedArea} @@ -64,55 +65,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - insert into ruoyi.crops_comprehensive_data - - cultivated_area, - foodstuff_production, - vegetable_planting_area, - vegetable_production, - type, - agricultural_planting_area, - agriculture_production, - agriculture_output_vaule, - total_population, - cover_area, - example_greenhouse, - rusticate, - cultivated_ally, - greenhouse, - output_value, - vector_boundary, - village_vector_boundary, - img, - created_by, - created_time, - - - #{cultivatedArea}, - #{foodstuffProduction}, - #{vegetablePlantingArea}, - #{vegetableProduction}, - #{type}, - #{agriculturalPlantingArea}, - #{agricultureProduction}, - #{agricultureOutputVaule}, - #{totalPopulation}, - #{coverArea}, - #{exampleGreenhouse}, - #{rusticate}, - #{cultivatedAlly}, - #{greenhouse}, - #{outputValue}, - #{vectorBoundary}, - #{villageVectorBoundary}, - #{img}, - #{createdBy}, - #{createdTime}, - + insert into ruoyi.crops_comprehensive_data (cultivated_area, foodstuff_production, vegetable_planting_area, vegetable_production, type, agricultural_planting_area, agriculture_production, agriculture_output_vaule, total_population, cover_area, example_greenhouse, rusticate,cultivated_ally, greenhouse, output_value, vector_boundary, village_vector_boundary, img, created_by, created_time) + VALUE (#{cultivatedArea}, #{foodstuffProduction}, #{vegetablePlantingArea}, #{vegetableProduction}, #{type}, + #{agriculturalPlantingArea}, #{agricultureProduction}, #{agricultureOutputVaule}, #{totalPopulation}, #{coverArea}, + #{exampleGreenhouse}, #{rusticate}, #{cultivatedAlly}, #{greenhouse}, #{outputValue}, #{vectorBoundary}, + #{villageVectorBoundary}, #{img}, #{createdBy},now()) - - update crops_comprehensive_data + + update ruoyi.crops_comprehensive_data cultivated_area = #{cultivatedArea}, foodstuff_production = #{foodstuffProduction}, @@ -139,11 +100,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - delete from crops_comprehensive_data where id = #{id} + delete from ruoyi.crops_comprehensive_data where id = #{id} - delete from crops_comprehensive_data where id in + delete from ruoyi.crops_comprehensive_data where id in #{id} diff --git a/ruoyi-crops/src/main/resources/mapper/crops/CropsUserMapper.xml b/ruoyi-crops/src/main/resources/mapper/crops/CropsUserMapper.xml new file mode 100644 index 0000000..ee054ea --- /dev/null +++ b/ruoyi-crops/src/main/resources/mapper/crops/CropsUserMapper.xml @@ -0,0 +1,105 @@ + + + + + + + + + + + + + + + + + + + + + insert into ruoyi.crops_user(user_name, password, phone, role, creat_time, remark, status, del_flag) + values (#{userName}, md5(#{password}), #{phone}, '普通用户', now(), #{remark}, 0, 0) + + + + update ruoyi.sys_user + set del_flag=1 + where user_id = #{id} + + + + update ruoyi.crops_user + + + user_name = #{userName}, + + + password = #{password}, + + + phone = #{phone}, + + + role = #{role}, + + + creat_time = #{creatTime}, + + + remark = #{remark}, + + + status = #{status}, + + + del_flag = #{delFlag}, + + + where id = #{id} + + + + + + diff --git a/ruoyi-crops/src/main/resources/mapper/crops/DataAcquisitionMapper.xml b/ruoyi-crops/src/main/resources/mapper/crops/DataAcquisitionMapper.xml new file mode 100644 index 0000000..4f49a12 --- /dev/null +++ b/ruoyi-crops/src/main/resources/mapper/crops/DataAcquisitionMapper.xml @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + + + insert into ruoyi.data_acquisition(image_data, image_data_total, drone_data, drone_data_total, sensor_data, sensor_data_total, time) + VALUES (#{imageData},#{imageDataTotal},#{droneData},#{droneDataTotal},#{sensorData},#{sensorDataTotal},now()) + + + + ANALYZE TABLE crop_drought,crop_growth,crop_structure,crop_yield + + + + + + + diff --git a/ruoyi-crops/src/main/resources/mapper/crops/DeviceSenseMapper.xml b/ruoyi-crops/src/main/resources/mapper/crops/DeviceSenseMapper.xml index bebe95a..aa6e4bc 100644 --- a/ruoyi-crops/src/main/resources/mapper/crops/DeviceSenseMapper.xml +++ b/ruoyi-crops/src/main/resources/mapper/crops/DeviceSenseMapper.xml @@ -38,7 +38,7 @@ - + @@ -145,7 +145,7 @@ where deviceId = #{deviceId} - select deviceId, sunlight, air_temp, @@ -190,12 +190,12 @@ diff --git a/ruoyi-crops/src/main/resources/mapper/crops/FarmMachineryMapper.xml b/ruoyi-crops/src/main/resources/mapper/crops/FarmMachineryMapper.xml new file mode 100644 index 0000000..cfd8e5e --- /dev/null +++ b/ruoyi-crops/src/main/resources/mapper/crops/FarmMachineryMapper.xml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + insert into ruoyi.farm_machinery(province,city,county,town,vmeid,vehicleno,vehicletype,vehiclenum,ownername,ownertel,belongcorp) + value + + (#{entity.province},#{entity.city},#{entity.county},#{entity.town},#{entity.vmeid},#{entity.vehicleno},#{entity.vehicletype},#{entity.vehiclenum},#{entity.ownername},#{entity.ownertel},#{entity.belongcorp}) + + + diff --git a/ruoyi-crops/src/main/resources/mapper/crops/InterfaceStatisticsMapper.xml b/ruoyi-crops/src/main/resources/mapper/crops/InterfaceStatisticsMapper.xml new file mode 100644 index 0000000..63eac7f --- /dev/null +++ b/ruoyi-crops/src/main/resources/mapper/crops/InterfaceStatisticsMapper.xml @@ -0,0 +1,38 @@ + + + + + + + + + + + + + insert into ruoyi.interface_statistics (visits, accessing_users, data_entries, time) + VALUE (#{visits}, #{accessingUsers}, #{dataEntries}, now()) + + + + + + diff --git a/ruoyi-crops/src/main/resources/mapper/crops/MachineParameterMapper.xml b/ruoyi-crops/src/main/resources/mapper/crops/MachineParameterMapper.xml deleted file mode 100644 index 0e1efb4..0000000 --- a/ruoyi-crops/src/main/resources/mapper/crops/MachineParameterMapper.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - - - - - select id, greenhouse_name, pressure, flow, conductivity - from ruoyi.machine_parameter - - - - - insert into ruoyi.machine_parameter (greenhouse_name, pressure, flow, conductivity) - VALUE (#{greenhouseName},#{pressure},#{flow},#{conductivity}) - - diff --git a/ruoyi-crops/src/main/resources/mapper/crops/MachineryJobDataMapper.xml b/ruoyi-crops/src/main/resources/mapper/crops/MachineryJobDataMapper.xml new file mode 100644 index 0000000..9c9b066 --- /dev/null +++ b/ruoyi-crops/src/main/resources/mapper/crops/MachineryJobDataMapper.xml @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + + + + + + + + + insert into ruoyi.machinery_job_data (province, city, county, jobday, jobtype, vehicleno, vmeid, plotarea, jobarea, qualratio, qualarea, jobwidth) + value + + (#{entity.province},#{entity.city},#{entity.county},#{entity.jobday},#{entity.jobtype},#{entity.vehicleno},#{entity.vmeid},#{entity.plotarea},#{entity.jobarea},#{entity.qualratio},#{entity.qualarea},#{entity.jobwidth}) + + + + + + + + + update ruoyi.machinery_job_data set area=#{workArea},workHours=#{workhours} + + where vehicleno = #{vehicleno} and jobday = DATE ('2023-03-13') + + + + + + diff --git a/ruoyi-crops/src/main/resources/mapper/crops/MachineryPositionMapper.xml b/ruoyi-crops/src/main/resources/mapper/crops/MachineryPositionMapper.xml new file mode 100644 index 0000000..dbe6880 --- /dev/null +++ b/ruoyi-crops/src/main/resources/mapper/crops/MachineryPositionMapper.xml @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + insert into ruoyi.machinery_position(vehicleno, postime, lat, lng, speed, jobtype, depth) + value + + (#{entity.vehicleno}, #{entity.postime}, #{entity.lat}, #{entity.lng}, #{entity.speed}, + #{entity.jobtype}, #{entity.depth}) + + on duplicate key update + vehicleno=values(vehicleno), + postime=values(postime), + lat=values(lat), + lng=values(lng), + speed=values(speed), + jobtype=values(jobtype), + depth=values(depth) + + + + diff --git a/ruoyi-crops/src/main/resources/mapper/crops/MachineryTrajectoryMapper.xml b/ruoyi-crops/src/main/resources/mapper/crops/MachineryTrajectoryMapper.xml new file mode 100644 index 0000000..29c62f0 --- /dev/null +++ b/ruoyi-crops/src/main/resources/mapper/crops/MachineryTrajectoryMapper.xml @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + insert into ruoyi.machinery_trajectory + (vehicleno, pttime, lat, lng, workplace, course, haspic, imgurl, iswork, jobwidth, depth) + values + + (#{entity.vehicleno},#{entity.pttime},#{entity.lat},#{entity.lng},#{entity.workplace},#{entity.course},#{entity.haspic},#{entity.imgurl},#{entity.iswork},#{entity.jobwidth},#{entity.depth}) + + + + + + + + + + + + diff --git a/ruoyi-crops/src/main/resources/mapper/crops/MeteorologicalMapper.xml b/ruoyi-crops/src/main/resources/mapper/crops/MeteorologicalMapper.xml index b3107d0..33a64b8 100644 --- a/ruoyi-crops/src/main/resources/mapper/crops/MeteorologicalMapper.xml +++ b/ruoyi-crops/src/main/resources/mapper/crops/MeteorologicalMapper.xml @@ -27,6 +27,16 @@ VALUE (#{warnId},#{title},#{level},#{type},#{time},#{province},#{city},#{district},#{content}) + + insert into ruoyi.meteorological + (warn_id, title, level, type, time, province, city, district, content) + VALUE + + (#{entity.id},#{entity.title},#{entity.level},#{entity.type},#{entity.time}, + #{entity.province},#{entity.city},#{entity.district},#{entity.content}) + + + @@ -14,7 +14,7 @@ - insert into ruoyi.operation_records(update_time, operation_content, update_by) - VALUE(#{updateTime},#{operationContent},#{updateBy}) + insert into ruoyi.operation_records(update_time, operation_content) + VALUE(#{updateTime},#{operationContent}) diff --git a/ruoyi-crops/src/main/resources/mapper/crops/WarningFarmMapper.xml b/ruoyi-crops/src/main/resources/mapper/crops/WarningFarmMapper.xml new file mode 100644 index 0000000..05face7 --- /dev/null +++ b/ruoyi-crops/src/main/resources/mapper/crops/WarningFarmMapper.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + insert into ruoyi.warning_farm(vehicleno, ownername, warning_info, time) + VALUES (#{vehicleno},#{ownername},#{warningInfo},#{time}) + + + + diff --git a/ruoyi-crops/src/main/resources/mapper/crops/WarningMapper.xml b/ruoyi-crops/src/main/resources/mapper/crops/WarningMapper.xml index b118208..b9e2c7e 100644 --- a/ruoyi-crops/src/main/resources/mapper/crops/WarningMapper.xml +++ b/ruoyi-crops/src/main/resources/mapper/crops/WarningMapper.xml @@ -7,16 +7,17 @@ - + - - diff --git a/ruoyi-crops/src/main/resources/mapper/crops/WeatherPredictionMapper.xml b/ruoyi-crops/src/main/resources/mapper/crops/WeatherPredictionMapper.xml new file mode 100644 index 0000000..a38500b --- /dev/null +++ b/ruoyi-crops/src/main/resources/mapper/crops/WeatherPredictionMapper.xml @@ -0,0 +1,76 @@ + + + + + + + + + + + + + + + + + + insert into ruoyi.weather_prediction(weather_time, weather_name, air_temperature, precipitation, wind_speed, + wind_direction, atmospheric_pressure, humidity, cloud_cover) + values (#{weatherTime}, #{weatherName}, #{airTemperature}, #{precipitation}, #{windSpeed}, + #{windDirection}, #{atmosphericPressure}, #{humidity}, #{cloudCover}) + + on duplicate key update weather_time = values(weather_time) + , weather_name = values(weather_name) + , air_temperature = values(air_temperature) + , precipitation = values(precipitation) + , wind_speed = values(wind_speed) + , wind_direction = values(wind_direction) + , atmospheric_pressure = values(atmospheric_pressure) + , humidity = values(humidity) + , cloud_cover = values(cloud_cover) + + + + insert into ruoyi.weather_prediction(weather_time, weather_name, air_temperature, precipitation, wind_speed, + wind_direction, atmospheric_pressure, humidity, cloud_cover) + value + + (#{entity.weatherTime}, #{entity.weatherName}, #{entity.airTemperature}, + #{entity.precipitation}, #{entity.windSpeed}, #{entity.windDirection}, #{entity.atmosphericPressure}, + #{entity.humidity}, #{entity.cloudCover}) + + on duplicate key update + weather_time=values(weather_time), + weather_name=values(weather_name), + air_temperature=values(air_temperature), + precipitation=values(precipitation), + wind_speed=values(wind_speed), + wind_direction=values(wind_direction), + atmospheric_pressure=values(atmospheric_pressure), + humidity=values(humidity), + cloud_cover=values(cloud_cover) + + + + + + + diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/PermissionService.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/PermissionService.java index 8fed7fb..3748dc8 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/PermissionService.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/web/service/PermissionService.java @@ -11,7 +11,7 @@ import com.ruoyi.framework.security.context.PermissionContextHolder; /** * RuoYi首创 自定义权限实现,ss取自SpringSecurity首字母 - * + * * @author ruoyi */ @Service("ss") @@ -29,23 +29,24 @@ public class PermissionService /** * 验证用户是否具备某权限 - * + * * @param permission 权限字符串 * @return 用户是否具备某权限 */ public boolean hasPermi(String permission) { - if (StringUtils.isEmpty(permission)) - { - return false; - } - LoginUser loginUser = SecurityUtils.getLoginUser(); - if (StringUtils.isNull(loginUser) || CollectionUtils.isEmpty(loginUser.getPermissions())) - { - return false; - } - PermissionContextHolder.setContext(permission); - return hasPermissions(loginUser.getPermissions(), permission); +// if (StringUtils.isEmpty(permission)) +// { +// return false; +// } +// LoginUser loginUser = SecurityUtils.getLoginUser(); +// if (StringUtils.isNull(loginUser) || CollectionUtils.isEmpty(loginUser.getPermissions())) +// { +// return false; +// } +// PermissionContextHolder.setContext(permission); +// return hasPermissions(loginUser.getPermissions(), permission); + return true; } /** @@ -90,7 +91,7 @@ public class PermissionService /** * 判断用户是否拥有某个角色 - * + * * @param role 角色字符串 * @return 用户是否具备某角色 */ @@ -156,7 +157,7 @@ public class PermissionService /** * 判断是否包含权限 - * + * * @param permissions 权限列表 * @param permission 权限字符串 * @return 用户是否具备某权限 diff --git a/ruoyi-generator/src/main/resources/vm/vue/index.vue.vm b/ruoyi-generator/src/main/resources/vm/vue/index.vue.vm index 70ff30d..b859ab4 100644 --- a/ruoyi-generator/src/main/resources/vm/vue/index.vue.vm +++ b/ruoyi-generator/src/main/resources/vm/vue/index.vue.vm @@ -170,7 +170,7 @@ - + ${subTable.functionName}信息 + ${subTable.functionName}信息 添加 diff --git a/ruoyi-generator/src/main/resources/vm/vue/v3/index.vue.vm b/ruoyi-generator/src/main/resources/vm/vue/v3/index.vue.vm index 8b25665..763f2c6 100644 --- a/ruoyi-generator/src/main/resources/vm/vue/v3/index.vue.vm +++ b/ruoyi-generator/src/main/resources/vm/vue/v3/index.vue.vm @@ -153,7 +153,7 @@ - + ${subTable.functionName}信息 + ${subTable.functionName}信息 添加 diff --git a/ruoyi-pill/src/main/resources/mapper/pill/PillFactoryMapper.xml b/ruoyi-pill/src/main/resources/mapper/pill/PillFactoryMapper.xml index 27e387d..b9cee94 100644 --- a/ruoyi-pill/src/main/resources/mapper/pill/PillFactoryMapper.xml +++ b/ruoyi-pill/src/main/resources/mapper/pill/PillFactoryMapper.xml @@ -3,8 +3,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> - - + + @@ -20,12 +20,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - select factory_id, factory_name, factory_code, contact, phone, keyword, status, create_by, create_time, update_by, update_time, remark from pill_factory + select factory_id, factory_name, factory_code, contact, phone, keyword, status, create_by, create_time, update_by, update_time, remark + from ruoyi.pill_factory - - + and factory_name like concat('%', #{factoryName}, '%') and factory_code = #{factoryCode} and contact = #{contact} @@ -34,14 +35,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and status = #{status} - + - - - insert into pill_factory + + + insert into ruoyi.pill_factory factory_name, factory_code, @@ -70,8 +71,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - - update pill_factory + + update ruoyi.pill_factory factory_name = #{factoryName}, factory_code = #{factoryCode}, @@ -89,13 +90,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - delete from pill_factory where factory_id = #{factoryId} + delete from ruoyi.pill_factory where factory_id = #{factoryId} - delete from pill_factory where factory_id in + delete from ruoyi.pill_factory where factory_id in #{factoryId} - \ No newline at end of file + diff --git a/ruoyi-ui/public/html/ie.html b/ruoyi-ui/public/html/ie.html index 390ce8a..f7d9dcf 100644 --- a/ruoyi-ui/public/html/ie.html +++ b/ruoyi-ui/public/html/ie.html @@ -1,46 +1,46 @@ - - - - - - 请升级您的浏览器 - - - - - - -

请升级您的浏览器,以便我们更好的为您提供服务!

-

您正在使用 Internet Explorer 的早期版本(IE11以下版本或使用该内核的浏览器)。这意味着在升级浏览器前,您将无法访问此网站。

-
-

请注意:微软公司对Windows XP 及 Internet Explorer 早期版本的支持已经结束

-

自 2016 年 1 月 12 日起,Microsoft 不再为 IE 11 以下版本提供相应支持和更新。没有关键的浏览器安全更新,您的电脑可能易受有害病毒、间谍软件和其他恶意软件的攻击,它们可以窃取或损害您的业务数据和信息。请参阅 微软对 Internet Explorer 早期版本的支持将于 2016 年 1 月 12 日结束的说明

-
-

您可以选择更先进的浏览器

-

推荐使用以下浏览器的最新版本。如果您的电脑已有以下浏览器的最新版本则直接使用该浏览器访问即可。

- -
- - \ No newline at end of file + + + + + + 请升级您的浏览器 + + + + + + +

请升级您的浏览器,以便我们更好的为您提供服务!

+

您正在使用 Internet Explorer 的早期版本(IE11以下版本或使用该内核的浏览器)。这意味着在升级浏览器前,您将无法访问此网站。

+
+

请注意:微软公司对Windows XP 及 Internet Explorer 早期版本的支持已经结束

+

自 2016 年 1 月 12 日起,Microsoft 不再为 IE 11 以下版本提供相应支持和更新。没有关键的浏览器安全更新,您的电脑可能易受有害病毒、间谍软件和其他恶意软件的攻击,它们可以窃取或损害您的业务数据和信息。请参阅 微软对 Internet Explorer 早期版本的支持将于 2016 年 1 月 12 日结束的说明

+
+

您可以选择更先进的浏览器

+

推荐使用以下浏览器的最新版本。如果您的电脑已有以下浏览器的最新版本则直接使用该浏览器访问即可。

+ +
+ + diff --git a/ruoyi-ui/public/index.html b/ruoyi-ui/public/index.html index 56fd45b..f89c242 100644 --- a/ruoyi-ui/public/index.html +++ b/ruoyi-ui/public/index.html @@ -1,208 +1,208 @@ - - - - - - - - - <%= webpackConfig.name %> - - - - -
-
-
-
-
-
正在加载系统资源,请耐心等待
-
-
- - + + + + + + + + + <%= webpackConfig.name %> + + + + +
+
+
+
+
+
正在加载系统资源,请耐心等待
+
+
+ + diff --git a/ruoyi-ui/src/api/crops/acquisition.js b/ruoyi-ui/src/api/crops/acquisition.js new file mode 100644 index 0000000..b666a93 --- /dev/null +++ b/ruoyi-ui/src/api/crops/acquisition.js @@ -0,0 +1,44 @@ +import request from '@/utils/request' + +// 查询数据采集列表 +export function listAcquisition(query) { + return request({ + url: '/crops/acquisition/list', + method: 'get', + params: query + }) +} + +// 查询数据采集详细 +export function getAcquisition(id) { + return request({ + url: '/crops/acquisition/' + id, + method: 'get' + }) +} + +// 新增数据采集 +export function addAcquisition(data) { + return request({ + url: '/crops/acquisition', + method: 'post', + data: data + }) +} + +// 修改数据采集 +export function updateAcquisition(data) { + return request({ + url: '/crops/acquisition', + method: 'put', + data: data + }) +} + +// 删除数据采集 +export function delAcquisition(id) { + return request({ + url: '/crops/acquisition/' + id, + method: 'delete' + }) +} diff --git a/ruoyi-ui/src/api/crops/drought.js b/ruoyi-ui/src/api/crops/drought.js new file mode 100644 index 0000000..e3e14f6 --- /dev/null +++ b/ruoyi-ui/src/api/crops/drought.js @@ -0,0 +1,44 @@ +import request from '@/utils/request' + +// 查询作物旱情列表 +export function listDrought(query) { + return request({ + url: '/crops/drought/list', + method: 'get', + params: query + }) +} + +// 查询作物旱情详细 +export function getDrought(id) { + return request({ + url: '/crops/drought/' + id, + method: 'get' + }) +} + +// 新增作物旱情 +export function addDrought(data) { + return request({ + url: '/crops/drought', + method: 'post', + data: data + }) +} + +// 修改作物旱情 +export function updateDrought(data) { + return request({ + url: '/crops/drought', + method: 'put', + data: data + }) +} + +// 删除作物旱情 +export function delDrought(id) { + return request({ + url: '/crops/drought/' + id, + method: 'delete' + }) +} diff --git a/ruoyi-ui/src/api/crops/growth.js b/ruoyi-ui/src/api/crops/growth.js new file mode 100644 index 0000000..15c8ee2 --- /dev/null +++ b/ruoyi-ui/src/api/crops/growth.js @@ -0,0 +1,44 @@ +import request from '@/utils/request' + +// 查询作物长势列表 +export function listGrowth(query) { + return request({ + url: '/crops/growth/list', + method: 'get', + params: query + }) +} + +// 查询作物长势详细 +export function getGrowth(id) { + return request({ + url: '/crops/growth/' + id, + method: 'get' + }) +} + +// 新增作物长势 +export function addGrowth(data) { + return request({ + url: '/crops/growth', + method: 'post', + data: data + }) +} + +// 修改作物长势 +export function updateGrowth(data) { + return request({ + url: '/crops/growth', + method: 'put', + data: data + }) +} + +// 删除作物长势 +export function delGrowth(id) { + return request({ + url: '/crops/growth/' + id, + method: 'delete' + }) +} diff --git a/ruoyi-ui/src/api/crops/information.js b/ruoyi-ui/src/api/crops/information.js new file mode 100644 index 0000000..7b97f0e --- /dev/null +++ b/ruoyi-ui/src/api/crops/information.js @@ -0,0 +1,44 @@ +import request from '@/utils/request' + +// 查询预警信息统计列表 +export function listInformation(query) { + return request({ + url: '/crops/information/list', + method: 'get', + params: query + }) +} + +// 查询预警信息统计详细 +export function getInformation(id) { + return request({ + url: '/crops/information/' + id, + method: 'get' + }) +} + +// 新增预警信息统计 +export function addInformation(data) { + return request({ + url: '/crops/information', + method: 'post', + data: data + }) +} + +// 修改预警信息统计 +export function updateInformation(data) { + return request({ + url: '/crops/information', + method: 'put', + data: data + }) +} + +// 删除预警信息统计 +export function delInformation(id) { + return request({ + url: '/crops/information/' + id, + method: 'delete' + }) +} diff --git a/ruoyi-ui/src/api/crops/meteorological.js b/ruoyi-ui/src/api/crops/meteorological.js new file mode 100644 index 0000000..962f7ed --- /dev/null +++ b/ruoyi-ui/src/api/crops/meteorological.js @@ -0,0 +1,44 @@ +import request from '@/utils/request' + +// 查询气象预警列表 +export function listMeteorological(query) { + return request({ + url: '/crops/meteorological/list', + method: 'get', + params: query + }) +} + +// 查询气象预警详细 +export function getMeteorological(id) { + return request({ + url: '/crops/meteorological/' + id, + method: 'get' + }) +} + +// 新增气象预警 +export function addMeteorological(data) { + return request({ + url: '/crops/meteorological', + method: 'post', + data: data + }) +} + +// 修改气象预警 +export function updateMeteorological(data) { + return request({ + url: '/crops/meteorological', + method: 'put', + data: data + }) +} + +// 删除气象预警 +export function delMeteorological(id) { + return request({ + url: '/crops/meteorological/' + id, + method: 'delete' + }) +} diff --git a/ruoyi-ui/src/api/crops/prediction.js b/ruoyi-ui/src/api/crops/prediction.js new file mode 100644 index 0000000..bba14d4 --- /dev/null +++ b/ruoyi-ui/src/api/crops/prediction.js @@ -0,0 +1,44 @@ +import request from '@/utils/request' + +// 查询博兴天气列表 +export function listPrediction(query) { + return request({ + url: '/crops/prediction/list', + method: 'get', + params: query + }) +} + +// 查询博兴天气详细 +export function getPrediction(id) { + return request({ + url: '/crops/prediction/' + id, + method: 'get' + }) +} + +// 新增博兴天气 +export function addPrediction(data) { + return request({ + url: '/crops/prediction', + method: 'post', + data: data + }) +} + +// 修改博兴天气 +export function updatePrediction(data) { + return request({ + url: '/crops/prediction', + method: 'put', + data: data + }) +} + +// 删除博兴天气 +export function delPrediction(id) { + return request({ + url: '/crops/prediction/' + id, + method: 'delete' + }) +} diff --git a/ruoyi-ui/src/api/crops/records.js b/ruoyi-ui/src/api/crops/records.js new file mode 100644 index 0000000..10d14d4 --- /dev/null +++ b/ruoyi-ui/src/api/crops/records.js @@ -0,0 +1,44 @@ +import request from '@/utils/request' + +// 查询操作记录列表 +export function listRecords(query) { + return request({ + url: '/crops/records/list', + method: 'get', + params: query + }) +} + +// 查询操作记录详细 +export function getRecords(id) { + return request({ + url: '/crops/records/' + id, + method: 'get' + }) +} + +// 新增操作记录 +export function addRecords(data) { + return request({ + url: '/crops/records', + method: 'post', + data: data + }) +} + +// 修改操作记录 +export function updateRecords(data) { + return request({ + url: '/crops/records', + method: 'put', + data: data + }) +} + +// 删除操作记录 +export function delRecords(id) { + return request({ + url: '/crops/records/' + id, + method: 'delete' + }) +} diff --git a/ruoyi-ui/src/api/crops/sense.js b/ruoyi-ui/src/api/crops/sense.js new file mode 100644 index 0000000..1b16605 --- /dev/null +++ b/ruoyi-ui/src/api/crops/sense.js @@ -0,0 +1,44 @@ +import request from '@/utils/request' + +// 查询设备传感数据列表 +export function listSense(query) { + return request({ + url: '/crops/sense/list', + method: 'get', + params: query + }) +} + +// 查询设备传感数据详细 +export function getSense(id) { + return request({ + url: '/crops/sense/' + id, + method: 'get' + }) +} + +// 新增设备传感数据 +export function addSense(data) { + return request({ + url: '/crops/sense', + method: 'post', + data: data + }) +} + +// 修改设备传感数据 +export function updateSense(data) { + return request({ + url: '/crops/sense', + method: 'put', + data: data + }) +} + +// 删除设备传感数据 +export function delSense(id) { + return request({ + url: '/crops/sense/' + id, + method: 'delete' + }) +} diff --git a/ruoyi-ui/src/api/crops/statistics.js b/ruoyi-ui/src/api/crops/statistics.js new file mode 100644 index 0000000..9e0c39d --- /dev/null +++ b/ruoyi-ui/src/api/crops/statistics.js @@ -0,0 +1,44 @@ +import request from '@/utils/request' + +// 查询接口数据量统计列表 +export function listStatistics(query) { + return request({ + url: '/crops/statistics/list', + method: 'get', + params: query + }) +} + +// 查询接口数据量统计详细 +export function getStatistics(id) { + return request({ + url: '/crops/statistics/' + id, + method: 'get' + }) +} + +// 新增接口数据量统计 +export function addStatistics(data) { + return request({ + url: '/crops/statistics', + method: 'post', + data: data + }) +} + +// 修改接口数据量统计 +export function updateStatistics(data) { + return request({ + url: '/crops/statistics', + method: 'put', + data: data + }) +} + +// 删除接口数据量统计 +export function delStatistics(id) { + return request({ + url: '/crops/statistics/' + id, + method: 'delete' + }) +} diff --git a/ruoyi-ui/src/api/crops/structure.js b/ruoyi-ui/src/api/crops/structure.js new file mode 100644 index 0000000..478005f --- /dev/null +++ b/ruoyi-ui/src/api/crops/structure.js @@ -0,0 +1,44 @@ +import request from '@/utils/request' + +// 查询作物种植结构列表 +export function listStructure(query) { + return request({ + url: '/crops/structure/', + method: 'get', + params: query + }) +} + +// 查询作物种植结构详细 +export function getStructure(id) { + return request({ + url: '/crops/structure/' + id, + method: 'get' + }) +} + +// 新增作物种植结构 +export function addStructure(data) { + return request({ + url: '/crops/structure', + method: 'post', + data: data + }) +} + +// 修改作物种植结构 +export function updateStructure(data) { + return request({ + url: '/crops/structure', + method: 'put', + data: data + }) +} + +// 删除作物种植结构 +export function delStructure(id) { + return request({ + url: '/crops/structure/' + id, + method: 'delete' + }) +} diff --git a/ruoyi-ui/src/api/crops/type.js b/ruoyi-ui/src/api/crops/type.js new file mode 100644 index 0000000..1731def --- /dev/null +++ b/ruoyi-ui/src/api/crops/type.js @@ -0,0 +1,44 @@ +import request from '@/utils/request' + +// 查询服务类型列表 +export function listType(query) { + return request({ + url: '/crops/type/list', + method: 'get', + params: query + }) +} + +// 查询服务类型详细 +export function getType(id) { + return request({ + url: '/crops/type/' + id, + method: 'get' + }) +} + +// 新增服务类型 +export function addType(data) { + return request({ + url: '/crops/type', + method: 'post', + data: data + }) +} + +// 修改服务类型 +export function updateType(data) { + return request({ + url: '/crops/type', + method: 'put', + data: data + }) +} + +// 删除服务类型 +export function delType(id) { + return request({ + url: '/crops/type/' + id, + method: 'delete' + }) +} diff --git a/ruoyi-ui/src/api/crops/yield.js b/ruoyi-ui/src/api/crops/yield.js new file mode 100644 index 0000000..9b399c3 --- /dev/null +++ b/ruoyi-ui/src/api/crops/yield.js @@ -0,0 +1,44 @@ +import request from '@/utils/request' + +// 查询作物产量列表 +export function listYield(query) { + return request({ + url: '/crops/yield/list', + method: 'get', + params: query + }) +} + +// 查询作物产量详细 +export function getYield(id) { + return request({ + url: '/crops/yield/' + id, + method: 'get' + }) +} + +// 新增作物产量 +export function addYield(data) { + return request({ + url: '/crops/yield', + method: 'post', + data: data + }) +} + +// 修改作物产量 +export function updateYield(data) { + return request({ + url: '/crops/yield', + method: 'put', + data: data + }) +} + +// 删除作物产量 +export function delYield(id) { + return request({ + url: '/crops/yield/' + id, + method: 'delete' + }) +} diff --git a/ruoyi-ui/src/components/Crontab/index.vue b/ruoyi-ui/src/components/Crontab/index.vue index 3963df2..f154a1e 100644 --- a/ruoyi-ui/src/components/Crontab/index.vue +++ b/ruoyi-ui/src/components/Crontab/index.vue @@ -374,7 +374,7 @@ export default { margin-top: 20px; } .popup-main { - position: relative; + machineryTrajectory: relative; margin: 10px auto; background: #fff; border-radius: 5px; @@ -393,10 +393,10 @@ export default { margin: 25px auto; padding: 15px 10px 10px; border: 1px solid #ccc; - position: relative; + machineryTrajectory: relative; } .popup-result .title { - position: absolute; + machineryTrajectory: absolute; top: -28px; left: 50%; width: 140px; diff --git a/ruoyi-ui/src/components/FileUpload/index.vue b/ruoyi-ui/src/components/FileUpload/index.vue index 6c583cf..d506478 100644 --- a/ruoyi-ui/src/components/FileUpload/index.vue +++ b/ruoyi-ui/src/components/FileUpload/index.vue @@ -201,7 +201,7 @@ export default { border: 1px solid #e4e7ed; line-height: 2; margin-bottom: 10px; - position: relative; + machineryTrajectory: relative; } .upload-file-list .ele-upload-list__item-content { display: flex; diff --git a/ruoyi-ui/src/components/IconSelect/index.vue b/ruoyi-ui/src/components/IconSelect/index.vue index 2404321..0e4d467 100644 --- a/ruoyi-ui/src/components/IconSelect/index.vue +++ b/ruoyi-ui/src/components/IconSelect/index.vue @@ -58,7 +58,7 @@ export default { width: 100%; padding: 10px; .icon-search { - position: relative; + machineryTrajectory: relative; margin-bottom: 5px; } .icon-list { diff --git a/ruoyi-ui/src/components/PanThumb/index.vue b/ruoyi-ui/src/components/PanThumb/index.vue index 796b01b..6b61906 100644 --- a/ruoyi-ui/src/components/PanThumb/index.vue +++ b/ruoyi-ui/src/components/PanThumb/index.vue @@ -1,142 +1,142 @@ - - - - - + + + + + diff --git a/ruoyi-ui/src/components/RightPanel/index.vue b/ruoyi-ui/src/components/RightPanel/index.vue index 25ce3f8..df4c423 100644 --- a/ruoyi-ui/src/components/RightPanel/index.vue +++ b/ruoyi-ui/src/components/RightPanel/index.vue @@ -1,106 +1,106 @@ - - - - - + + + + + diff --git a/ruoyi-ui/src/layout/components/AppMain.vue b/ruoyi-ui/src/layout/components/AppMain.vue index b7a87ae..b16d755 100644 --- a/ruoyi-ui/src/layout/components/AppMain.vue +++ b/ruoyi-ui/src/layout/components/AppMain.vue @@ -31,7 +31,7 @@ export default { /* 50= navbar 50 */ min-height: calc(100vh - 50px); width: 100%; - position: relative; + machineryTrajectory: relative; overflow: hidden; } diff --git a/ruoyi-ui/src/layout/components/Navbar.vue b/ruoyi-ui/src/layout/components/Navbar.vue index 67a53ab..f6ad23b 100644 --- a/ruoyi-ui/src/layout/components/Navbar.vue +++ b/ruoyi-ui/src/layout/components/Navbar.vue @@ -1,200 +1,200 @@ - - - - - + + + + + diff --git a/ruoyi-ui/src/layout/components/Settings/index.vue b/ruoyi-ui/src/layout/components/Settings/index.vue index 6759446..9435301 100644 --- a/ruoyi-ui/src/layout/components/Settings/index.vue +++ b/ruoyi-ui/src/layout/components/Settings/index.vue @@ -1,260 +1,260 @@ - - - - - + + + + + diff --git a/ruoyi-ui/src/layout/components/Sidebar/Logo.vue b/ruoyi-ui/src/layout/components/Sidebar/Logo.vue index c8401c5..061fc08 100644 --- a/ruoyi-ui/src/layout/components/Sidebar/Logo.vue +++ b/ruoyi-ui/src/layout/components/Sidebar/Logo.vue @@ -1,93 +1,93 @@ - - - - - + + + + + diff --git a/ruoyi-ui/src/layout/components/TagsView/ScrollPane.vue b/ruoyi-ui/src/layout/components/TagsView/ScrollPane.vue index c110bf1..26e672a 100644 --- a/ruoyi-ui/src/layout/components/TagsView/ScrollPane.vue +++ b/ruoyi-ui/src/layout/components/TagsView/ScrollPane.vue @@ -1,94 +1,94 @@ - - - - - + + + + + diff --git a/ruoyi-ui/src/layout/components/TagsView/index.vue b/ruoyi-ui/src/layout/components/TagsView/index.vue index 1fc2323..aa219a1 100644 --- a/ruoyi-ui/src/layout/components/TagsView/index.vue +++ b/ruoyi-ui/src/layout/components/TagsView/index.vue @@ -1,332 +1,332 @@ - - - - - - - + + + + + + + diff --git a/ruoyi-ui/src/layout/index.vue b/ruoyi-ui/src/layout/index.vue index b7c9ab0..ca4a8e9 100644 --- a/ruoyi-ui/src/layout/index.vue +++ b/ruoyi-ui/src/layout/index.vue @@ -70,7 +70,7 @@ export default { .app-wrapper { @include clearfix; - position: relative; + machineryTrajectory: relative; height: 100%; width: 100%; @@ -81,13 +81,13 @@ export default { ::v-deep .el-scrollbar__bar.is-vertical { z-index: 10; } - + ::v-deep .el-scrollbar__wrap { overflow-x: hidden; } &.mobile.openSidebar { - position: fixed; + machineryTrajectory: fixed; top: 0; } } @@ -98,12 +98,12 @@ export default { width: 100%; top: 0; height: 100%; - position: absolute; + machineryTrajectory: absolute; z-index: 999; } .fixed-header { - position: fixed; + machineryTrajectory: fixed; top: 0; right: 0; z-index: 9; diff --git a/ruoyi-ui/src/views/crops/acquisition/index.vue b/ruoyi-ui/src/views/crops/acquisition/index.vue new file mode 100644 index 0000000..2680e62 --- /dev/null +++ b/ruoyi-ui/src/views/crops/acquisition/index.vue @@ -0,0 +1,312 @@ + + + diff --git a/ruoyi-ui/src/views/crops/drought/index.vue b/ruoyi-ui/src/views/crops/drought/index.vue new file mode 100644 index 0000000..90c1403 --- /dev/null +++ b/ruoyi-ui/src/views/crops/drought/index.vue @@ -0,0 +1,247 @@ + + + diff --git a/ruoyi-ui/src/views/crops/growth/index.vue b/ruoyi-ui/src/views/crops/growth/index.vue new file mode 100644 index 0000000..948094c --- /dev/null +++ b/ruoyi-ui/src/views/crops/growth/index.vue @@ -0,0 +1,247 @@ + + + diff --git a/ruoyi-ui/src/views/crops/information/index.vue b/ruoyi-ui/src/views/crops/information/index.vue new file mode 100644 index 0000000..0261011 --- /dev/null +++ b/ruoyi-ui/src/views/crops/information/index.vue @@ -0,0 +1,301 @@ + + + diff --git a/ruoyi-ui/src/views/crops/meteorological/index.vue b/ruoyi-ui/src/views/crops/meteorological/index.vue new file mode 100644 index 0000000..7d8ff42 --- /dev/null +++ b/ruoyi-ui/src/views/crops/meteorological/index.vue @@ -0,0 +1,253 @@ + + + diff --git a/ruoyi-ui/src/views/crops/prediction/index.vue b/ruoyi-ui/src/views/crops/prediction/index.vue new file mode 100644 index 0000000..99afcc8 --- /dev/null +++ b/ruoyi-ui/src/views/crops/prediction/index.vue @@ -0,0 +1,334 @@ + + + diff --git a/ruoyi-ui/src/views/crops/records/index.vue b/ruoyi-ui/src/views/crops/records/index.vue new file mode 100644 index 0000000..59be8c8 --- /dev/null +++ b/ruoyi-ui/src/views/crops/records/index.vue @@ -0,0 +1,249 @@ + + + diff --git a/ruoyi-ui/src/views/crops/sense/index.vue b/ruoyi-ui/src/views/crops/sense/index.vue new file mode 100644 index 0000000..6944b49 --- /dev/null +++ b/ruoyi-ui/src/views/crops/sense/index.vue @@ -0,0 +1,316 @@ + + + diff --git a/ruoyi-ui/src/views/crops/statistics/index.vue b/ruoyi-ui/src/views/crops/statistics/index.vue new file mode 100644 index 0000000..5fbee82 --- /dev/null +++ b/ruoyi-ui/src/views/crops/statistics/index.vue @@ -0,0 +1,279 @@ + + + diff --git a/ruoyi-ui/src/views/crops/structure/index.vue b/ruoyi-ui/src/views/crops/structure/index.vue new file mode 100644 index 0000000..999fc1b --- /dev/null +++ b/ruoyi-ui/src/views/crops/structure/index.vue @@ -0,0 +1,260 @@ + + + diff --git a/ruoyi-ui/src/views/crops/type/index.vue b/ruoyi-ui/src/views/crops/type/index.vue new file mode 100644 index 0000000..401af7c --- /dev/null +++ b/ruoyi-ui/src/views/crops/type/index.vue @@ -0,0 +1,279 @@ + + + diff --git a/ruoyi-ui/src/views/crops/yield/index.vue b/ruoyi-ui/src/views/crops/yield/index.vue new file mode 100644 index 0000000..b94ed0d --- /dev/null +++ b/ruoyi-ui/src/views/crops/yield/index.vue @@ -0,0 +1,244 @@ + + + diff --git a/ruoyi-ui/src/views/dashboard/PanelGroup.vue b/ruoyi-ui/src/views/dashboard/PanelGroup.vue index 8d3a73b..cc5cf7c 100644 --- a/ruoyi-ui/src/views/dashboard/PanelGroup.vue +++ b/ruoyi-ui/src/views/dashboard/PanelGroup.vue @@ -1,181 +1,181 @@ - - - - - + + + + + diff --git a/ruoyi-ui/src/views/error/404.vue b/ruoyi-ui/src/views/error/404.vue index 666d27c..5bd1321 100644 --- a/ruoyi-ui/src/views/error/404.vue +++ b/ruoyi-ui/src/views/error/404.vue @@ -1,233 +1,233 @@ - - - - - + + + + + diff --git a/ruoyi-ui/src/views/index_v1.vue b/ruoyi-ui/src/views/index_v1.vue index 4828d88..1391b55 100644 --- a/ruoyi-ui/src/views/index_v1.vue +++ b/ruoyi-ui/src/views/index_v1.vue @@ -1,98 +1,98 @@ - - - - - + + + + + diff --git a/ruoyi-ui/src/views/login.vue b/ruoyi-ui/src/views/login.vue index cdae8dc..feab46a 100644 --- a/ruoyi-ui/src/views/login.vue +++ b/ruoyi-ui/src/views/login.vue @@ -1,219 +1,219 @@ - - - - - + + + + + diff --git a/ruoyi-ui/src/views/register.vue b/ruoyi-ui/src/views/register.vue index e4f2df6..c8cea53 100644 --- a/ruoyi-ui/src/views/register.vue +++ b/ruoyi-ui/src/views/register.vue @@ -1,209 +1,209 @@ - - - - - + + + + + diff --git a/ruoyi-ui/src/views/system/dept/index.vue b/ruoyi-ui/src/views/system/dept/index.vue index e502b4e..7b97438 100644 --- a/ruoyi-ui/src/views/system/dept/index.vue +++ b/ruoyi-ui/src/views/system/dept/index.vue @@ -114,7 +114,7 @@
- +
diff --git a/ruoyi-ui/src/views/system/dict/data.vue b/ruoyi-ui/src/views/system/dict/data.vue index d78af12..b0a088c 100644 --- a/ruoyi-ui/src/views/system/dict/data.vue +++ b/ruoyi-ui/src/views/system/dict/data.vue @@ -1,402 +1,402 @@ - - - \ No newline at end of file + + + diff --git a/ruoyi-ui/src/views/system/menu/index.vue b/ruoyi-ui/src/views/system/menu/index.vue index 2a83f9e..659a717 100644 --- a/ruoyi-ui/src/views/system/menu/index.vue +++ b/ruoyi-ui/src/views/system/menu/index.vue @@ -154,7 +154,7 @@
- + diff --git a/ruoyi-ui/src/views/system/post/index.vue b/ruoyi-ui/src/views/system/post/index.vue index 444bf63..6c874d3 100644 --- a/ruoyi-ui/src/views/system/post/index.vue +++ b/ruoyi-ui/src/views/system/post/index.vue @@ -133,7 +133,7 @@ - + diff --git a/ruoyi-ui/src/views/system/role/index.vue b/ruoyi-ui/src/views/system/role/index.vue index cc9e541..2a4b4b3 100644 --- a/ruoyi-ui/src/views/system/role/index.vue +++ b/ruoyi-ui/src/views/system/role/index.vue @@ -1,605 +1,605 @@ - - - \ No newline at end of file + + + diff --git a/ruoyi-ui/src/views/system/user/profile/userAvatar.vue b/ruoyi-ui/src/views/system/user/profile/userAvatar.vue index 70d8487..ccd2d80 100644 --- a/ruoyi-ui/src/views/system/user/profile/userAvatar.vue +++ b/ruoyi-ui/src/views/system/user/profile/userAvatar.vue @@ -162,14 +162,14 @@ export default { + + + + + diff --git a/ruoyi-ui/src/views/tool/build/index.vue b/ruoyi-ui/src/views/tool/build/index.vue index 2bd298b..2c6beda 100644 --- a/ruoyi-ui/src/views/tool/build/index.vue +++ b/ruoyi-ui/src/views/tool/build/index.vue @@ -92,7 +92,7 @@ @@ -428,10 +428,10 @@ export default { .reg-item{ padding: 12px 6px; background: #f8f8f8; - position: relative; + machineryTrajectory: relative; border-radius: 4px; .close-btn{ - position: absolute; + machineryTrajectory: absolute; right: -6px; top: -6px; display: block; @@ -460,7 +460,7 @@ export default { & i { font-size: 20px; vertical-align: middle; - position: relative; + machineryTrajectory: relative; top: -1px; } } @@ -498,7 +498,7 @@ $selectedColor: #f6f7ff; $lighterBlue: #409EFF; .container { - position: relative; + machineryTrajectory: relative; width: 100%; height: 100%; } @@ -549,7 +549,7 @@ $lighterBlue: #409EFF; .left-board { width: 260px; - position: absolute; + machineryTrajectory: absolute; left: 0; top: 0; height: 100vh; @@ -572,7 +572,7 @@ $lighterBlue: #409EFF; box-sizing: border-box; } .empty-info{ - position: absolute; + machineryTrajectory: absolute; top: 46%; left: 0; right: 0; @@ -582,7 +582,7 @@ $lighterBlue: #409EFF; letter-spacing: 4px; } .action-bar{ - position: relative; + machineryTrajectory: relative; height: 42px; text-align: right; padding: 0 15px; @@ -595,14 +595,14 @@ $lighterBlue: #409EFF; } } .logo-wrapper{ - position: relative; + machineryTrajectory: relative; height: 42px; background: #fff; border-bottom: 1px solid #f1e8e8; box-sizing: border-box; } .logo{ - position: absolute; + machineryTrajectory: absolute; left: 12px; top: 6px; line-height: 30px; @@ -635,19 +635,19 @@ $lighterBlue: #409EFF; } .drawing-board { height: 100%; - position: relative; + machineryTrajectory: relative; .components-body { padding: 0; margin: 0; font-size: 0; } .sortable-ghost { - position: relative; + machineryTrajectory: relative; display: block; overflow: hidden; &::before { content: " "; - position: absolute; + machineryTrajectory: absolute; left: 0; right: 0; top: 0; @@ -678,7 +678,7 @@ $lighterBlue: #409EFF; } } .drawing-item{ - position: relative; + machineryTrajectory: relative; cursor: move; &.unfocus-bordered:not(.activeFromItem) > div:first-child { border: 1px dashed #ccc; @@ -688,7 +688,7 @@ $lighterBlue: #409EFF; } } .drawing-row-item{ - position: relative; + machineryTrajectory: relative; cursor: move; box-sizing: border-box; border: 1px dashed #ccc; @@ -711,7 +711,7 @@ $lighterBlue: #409EFF; border: 1px dashed $lighterBlue; } .component-name{ - position: absolute; + machineryTrajectory: absolute; top: 0; left: 0; font-size: 12px; @@ -732,7 +732,7 @@ $lighterBlue: #409EFF; } & > .drawing-item-copy, & > .drawing-item-delete{ display: none; - position: absolute; + machineryTrajectory: absolute; top: -10px; width: 22px; height: 22px;