线下版本维护

This commit is contained in:
songjinsheng
2022-08-23 15:39:06 +08:00
parent 873c24cae8
commit 45fbc8a501
31 changed files with 268 additions and 264 deletions

View File

@ -1,14 +1,18 @@
package com.ruoyi;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.file.WeatherUtils;
import com.fasterxml.jackson.datatype.jsr310.deser.InstantDeserializer;
import com.mysql.cj.x.protobuf.MysqlxDatatypes;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.util.ObjectUtils;
import org.springframework.util.ResourceUtils;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.List;
/**
@ -27,9 +31,13 @@ public class RuoYiApplication
SpringApplication.run(RuoYiApplication.class, args);
System.out.println();
System.out.println(" --->>>启动成功!<<<---");
}
}

View File

@ -56,8 +56,6 @@ public class DateUploadController
private String FilePaths;
private String ShpPaths;
@RequestMapping(value = "/SelectUpload",method = {RequestMethod.POST})
public AjaxResult SelectUpload(@RequestBody paging paging)
@ -70,19 +68,19 @@ public class DateUploadController
type2= paging.getType2().toUpperCase();
}
String date=paging.getUploadTime();
String dateTime=paging.getDateTime();
String name=paging.getType3();
String dateTime =paging.getDateTime();
if ( name!=null && name!="")
{
if (name.equals("1"))
{
name="M_Heal";
name="Medium%";
}
else if(name.equals("2"))
{
name="H_Heal%";
name="High%";
}
}
@ -103,6 +101,7 @@ public class DateUploadController
@RequestMapping(value = "/delUpload",method = {RequestMethod.POST})
public AjaxResult DelUpload(@RequestBody UplodFile uplodFile)
{
return delUploadFile(uplodFile.getId());
// List<Integer> ids=uplodFile.getId();
// Integer Seeding=0;
@ -123,7 +122,11 @@ public class DateUploadController
}
/**
* 删除
* @param id
* @return
*/
@RequestMapping(value = "/delUpload1",method = {RequestMethod.DELETE})
public AjaxResult DelUpload1(@RequestParam("id") List<Integer> id)
{
@ -139,20 +142,11 @@ public class DateUploadController
}
@RequestMapping(value = "/InitShp",method = {RequestMethod.POST})
public AjaxResult InitShp(@RequestBody UplodFile uplodFile)
{
List<DateUpload> dateUploads=infr(uplodFile.getDateUploads());
for (int i=0; i<dateUploads.size();i++)
{
Integer Seeding= service.IntoShp(dateUploads.get(i));
}
return AjaxResult.success("成功");
}
/**
* 添加
* @param uplodFile
* @return
*/
@RequestMapping(value = "/InitUpload",method = {RequestMethod.POST})
public AjaxResult InitUpload(@RequestBody UplodFile uplodFile)
{
@ -170,6 +164,11 @@ public class DateUploadController
return AjaxResult.success("成功");
}
/**
* 解析添加实体类
* @param dateUpload
* @return
*/
private List<DateUpload> infr(List<DateUpload> dateUpload)
{
for (int i=0;i<dateUpload.size();i++)
@ -221,12 +220,12 @@ public class DateUploadController
DateUpload uploadValue=service.selectShp(name1,type,"");
MyThread1 demo=new MyThread1(name.replace(".tif",""),
FilePaths+dateUpload.get(i).getData_id(),
ShpPaths+uploadValue.getData_id());
dateUpload.get(i).getRoute(),
uploadValue.getRoute());
demo.run();
}
else if(type1.equals("BOUNDARIES"))//Boundaries
else if(type1.equals("LANDUSE"))
{
String[] strs = dateUpload.get(i).getFileName().split("\\.");
@ -234,60 +233,37 @@ public class DateUploadController
String[] strs2=name.split("\\_");
String[] typeValue=name.split("2");
String type2=typeValue[0];
String name1=strs2[strs2.length-1];
String name2=strs2[strs2.length-2];
dateUpload.get(i).setDataTime(name2);
dateUpload.get(i).setZone(name1);
dateUpload.get(i).setCreatedTime(dateNowStr);
dateUpload.get(i).setYear(dateNowStr.substring(0,4));
dateUpload.get(i).setType(type);
dateUpload.get(i).setType1(type1);
dateUpload.get(i).setYear(name2.substring(0,4));
dateUpload.get(i).setType2(type2.substring(0,type2.length()-1).toUpperCase());
dateUpload.get(i).setExtent1(dateUpload.get(i).getExtent().toString());
DateUpload uploadValue=service.selectShp(name1,type,"");
MyThread1 demo=new MyThread1(name.replace(".tif",""),
dateUpload.get(i).getRoute(),
uploadValue.getRoute());
demo.run();
}
else if(type1.equals("LANDUSE"))
{
String[] strs = dateUpload.get(i).getFileName().split("\\.");
String name=strs[0];
String[] strs2=name.split("\\_");
String[] typeValue=name.split("2");
String type2=typeValue[0];
String name1=strs2[strs2.length-1];
String name2=strs2[strs2.length-2];
dateUpload.get(i).setDataTime(name2);
dateUpload.get(i).setZone(name1);
dateUpload.get(i).setCreatedTime(dateNowStr);
dateUpload.get(i).setType(type);
dateUpload.get(i).setType1(type1);
dateUpload.get(i).setYear(name2.substring(0,4));
dateUpload.get(i).setType2(type2.substring(0,type2.length()-1).toUpperCase());
dateUpload.get(i).setExtent1(dateUpload.get(i).getExtent().toString());
DateUpload uploadValue=service.selectShp(name1,type,"");
MyThread1 demo=new MyThread1(name.replace(".tif",""),
FilePaths+dateUpload.get(i).getData_id(),
ShpPaths+uploadValue.getData_id());
demo.run();
}
else if(type1.equals("SUITABILITY"))
{
String[] strs = dateUpload.get(i).getFileName().split("\\.");
@ -323,10 +299,34 @@ public class DateUploadController
DateUpload uploadValue=service.selectShp(name1,type,"");
MyThread1 demo=new MyThread1(name.replace(".tif",""),
FilePaths+dateUpload.get(i).getData_id(),
ShpPaths+uploadValue.getData_id());
dateUpload.get(i).getRoute(),
uploadValue.getRoute());
demo.run();
}
else if(type1.equals("BOUNDARIES"))//Boundaries
{
String[] strs = dateUpload.get(i).getFileName().split("\\.");
String name=strs[0];
String[] strs2=name.split("\\_");
String name1=strs2[strs2.length-1];
dateUpload.get(i).setZone(name1);
dateUpload.get(i).setCreatedTime(dateNowStr);
dateUpload.get(i).setYear(dateNowStr.substring(0,4));
dateUpload.get(i).setType(type);
dateUpload.get(i).setType1(type1);
dateUpload.get(i).setExtent1(dateUpload.get(i).getExtent().toString());
}
else
{
String[] strs = dateUpload.get(i).getFileName().split("\\.");
@ -360,8 +360,8 @@ public class DateUploadController
DateUpload uploadValue=service.selectShp(name1,type,"");
MyThread1 demo=new MyThread1(name.replace(".tif",""),
FilePaths+dateUpload.get(i).getData_id(),
ShpPaths+uploadValue.getData_id());
dateUpload.get(i).getRoute(),
uploadValue.getRoute());
demo.run();
}
@ -383,34 +383,39 @@ public class DateUploadController
Process proc=null;
try {
// String til = UrlFileUpload.fileUpload(filePath,FilePathName);
//
// String shp = UrlFileUpload.fileUpload(shpPath,FilePathName);
String til = UrlFileUpload.fileUpload(filePath,FilePathName);
String shp = UrlFileUpload.fileUpload(shpPath,FilePathName);
String[] cmd = {ExePathName,
fileName,
filePath+".tif",
shpPath+".zip"};
til.replace("\\","/"),
shp.replace("\\","/")};
System.out.println("调用exe执行算法");
ProcessBuilder pb = new ProcessBuilder();
pb.command(cmd);
proc=pb.start();
System.out.println("Start calling algorithm");
bufferedReader =new BufferedReader(new InputStreamReader(proc.getErrorStream()));
String aa=null;
String line=null;
while ((line=bufferedReader.readLine())!=null){
aa=aa+line;
}
// 打印错误日志
System.out.println(aa);
// Process process=Runtime.getRuntime().exec("cmd /c start"+" E:\\沙特\\~\\exe\\后台统计分析.exe \"Seed_Success_20220604_01\" \"E:\\沙特\\~\\temp\\Seed_Success_20220604_01.tif\" \"E:\\沙特\\~\\temp\\Seed_01.zip\"");
} catch (IOException e) {
e.printStackTrace();
System.out.println(e.getMessage());;
} catch (InterruptedException e) {
e.printStackTrace();
}
}
/**
* 执行地图数据解析
*/
public class MyThread1 extends Thread{
private String FileName;
@ -470,7 +475,7 @@ public class DateUploadController
{
String[] typeValue = value.getFileName().split("_");
String resolution=typeValue[0];
String type2 = "Heal";
String type2 = "Healthy";
file.UploadFile1(type2, value.getZone(), value.getDataTime(),service,resolution);
Seeding= service.DelUpload(ids.get(i));
if (Seeding==0){return AjaxResult.error("没有此id单据"+ids.get(i));}
@ -490,22 +495,20 @@ public class DateUploadController
return AjaxResult.success("成功!");
}
public void readXml() {
try {
// 创建解析器工厂
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder db = factory.newDocumentBuilder();
// 创建一个Document对象
String parent = new File(ResourceUtils.getURL("classpath:").getPath()).getParentFile().getParentFile().getParent();
File file = new File("route.xml");
Document doc =db.parse(file);
NodeList routeList = doc.getElementsByTagName("Rodel");
// 遍历每个book节点
for (int i = 0; i < routeList.getLength(); i++) {
System.out.println("*******************************");
// 索引从零开始
org.w3c.dom.Node book = routeList.item(i);
// 获取book节点所有属性集合
@ -523,11 +526,12 @@ public class DateUploadController
this.FilePathName=childNodes.item(3).getTextContent().trim();
this.FilePaths=childNodes.item(5).getTextContent().trim();
this.ShpPaths=childNodes.item(7).getTextContent().trim();
}
}
}
} catch (Exception e) {
e.printStackTrace();
}

View File

@ -0,0 +1,14 @@
package com.ruoyi.web.controller.shate;
import com.alibaba.fastjson.JSON;
import java.util.Dictionary;
/**
* @Author: JinSheng Song
* @Date: 2022/8/5 15:21
*/
public class JsonUnits {
}

View File

@ -4,6 +4,7 @@ import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.system.domain_shate.LandUse;
import com.ruoyi.system.domain_shate.PlantingSuitability;
import com.ruoyi.system.domain_shate.UplodFile;
import com.ruoyi.system.domain_shate.VegetationHealth;
import com.ruoyi.system.service_shate.ILandUseServices;
import com.ruoyi.system.service_shate.IPlantingSuitabilityService;
import io.swagger.annotations.Api;
@ -56,12 +57,10 @@ public class PlantingSuitabilityController
@RequestMapping(value = "/InsertSuitability",method = {RequestMethod.POST})
public AjaxResult InsertSuitability(@RequestBody UplodFile uplodFile) {
List<PlantingSuitability> value=uplodFile.getPlantingSuitabilities();
for (int i=0;i<value.size();i++){
String year=value.get(i).getImageDate().substring(0,4);
value.get(i).setYear(year);
value.get(i).setImageDate(value.get(i).getImageDate().replace("-",""));
Integer Seeding =Service.InsertSeeding(value.get(i));
for (int i=0;i<uplodFile.getPlantingSuitabilities().size();i++){
uplodFile.getPlantingSuitabilities().get(i).setYear(uplodFile.getPlantingSuitabilities().get(i).getImageDate().substring(0,4));
uplodFile.getPlantingSuitabilities().get(i).setImageDate(uplodFile.getPlantingSuitabilities().get(i).getImageDate().replace("-",""));
Integer Seeding =Service.InsertSeeding(uplodFile.getPlantingSuitabilities().get(i));
}
return AjaxResult.success("成功!");
}

View File

@ -104,7 +104,6 @@ public class RegionalFactorController
/**
* 道路指数查询
* @return 实体类
@ -153,8 +152,7 @@ public class RegionalFactorController
public AjaxResult InsertWater(@RequestBody UplodFile uplodFile) {
List<WaterFactor> value=uplodFile.getWaterFactors();
for (int i=0;i<value.size();i++){
String year=value.get(i).getImageDate().substring(0,4);
value.get(i).setYear(year);
value.get(i).setYear(value.get(i).getImageDate().substring(0,4));
value.get(i).setImageDate(value.get(i).getImageDate().replace("-",""));
Integer Seeding = service.InsertWater(value.get(i));
}
@ -171,8 +169,7 @@ public class RegionalFactorController
List<RegionIndex> indices=uplodFile.getRegionIndexs();
for (int i=0;i<indices.size();i++){
String year=indices.get(i).getImageDate().substring(0,4);
indices.get(i).setYear(year);
indices.get(i).setYear(indices.get(i).getImageDate().substring(0,4));
indices.get(i).setImageDate(indices.get(i).getImageDate().replace("-",""));
Integer Seeding = service.InsertWaterArea(indices.get(i));
}
@ -188,8 +185,7 @@ public class RegionalFactorController
List<RegionIndex> indices=uplodFile.getRegionIndexs();
for (int i=0;i<indices.size();i++){
String year=indices.get(i).getImageDate().substring(0,4);
indices.get(i).setYear(year);
indices.get(i).setYear(indices.get(i).getImageDate().substring(0,4));
indices.get(i).setImageDate(indices.get(i).getImageDate().replace("-",""));
Integer Seeding = service.InsertRoadLength(indices.get(i));
}
@ -204,8 +200,6 @@ public class RegionalFactorController
public AjaxResult InsertRoad(@RequestBody UplodFile uplodFile) {
for (int i=0;i<uplodFile.getRoadFactors().size();i++){
String year=uplodFile.getRoadFactors().get(i).getImageDate().substring(0,4);
uplodFile.getRoadFactors().get(i).setYear(year);
uplodFile.getRoadFactors().get(i).setImageDate(uplodFile.getRoadFactors().get(i).getImageDate().replace("-",""));
Integer Seeding = service.InsertRoad(uplodFile.getRoadFactors().get(i));

View File

@ -65,8 +65,7 @@ public class SoilFactorController
public AjaxResult InsertDesert(@RequestBody UplodFile uplodFile) {
List<SoilDesertification> value=uplodFile.getSoilDesertifications();
for (int i=0;i<value.size();i++){
String year=value.get(i).getImageDate().substring(0,4);
value.get(i).setYear(year);
value.get(i).setYear(value.get(i).getImageDate().substring(0,4));
value.get(i).setImageDate(value.get(i).getImageDate().replace("-",""));
Integer Seeding = service.InsertDesert(value.get(i));
}
@ -82,8 +81,7 @@ public class SoilFactorController
public AjaxResult InsertSalin(@RequestBody UplodFile uplodFile) {
List<SoilSalinization> value=uplodFile.getSoilSalinizations();
for (int i=0;i<value.size();i++){
String year=value.get(i).getImageDate().substring(0,4);
value.get(i).setYear(year);
value.get(i).setYear(value.get(i).getImageDate().substring(0,4));
value.get(i).setImageDate(value.get(i).getImageDate().replace("-",""));
Integer Seeding = service.InsertSalin(value.get(i));
}
@ -99,8 +97,7 @@ public class SoilFactorController
List<SoilMoisture> value=uplodFile.getSoilMoistures();
for (int i=0;i<value.size();i++){
String year=value.get(i).getImageDate().substring(0,4);
value.get(i).setYear(year);
value.get(i).setYear(value.get(i).getImageDate().substring(0,4));
value.get(i).setImageDate(value.get(i).getImageDate().replace("-",""));
Integer Seeding = service.InsertMoisture(value.get(i));
}

View File

@ -37,26 +37,26 @@ public class TopographicFactorController {
Double Max=0.0;
for (Altitude ce : Seeding)
{
if (Max<ce.getLevel1())
{
Max= ce.getLevel1();
}
if (Max<ce.getLevel2())
{
Max=ce.getLevel2();
}
if (Max<ce.getLevel1())
{
Max= ce.getLevel1();
}
if (Max<ce.getLevel2())
{
Max=ce.getLevel2();
}
if (Max<ce.getLevel3())
{
Max=ce.getLevel3();
}
{
Max=ce.getLevel3();
}
if (Max<ce.getLevel4())
{
Max=ce.getLevel4();
}
if (Max<ce.getLevel5())
{
Max=ce.getLevel5();
}
{
Max=ce.getLevel4();
}
if (Max<ce.getLevel5())
{
Max=ce.getLevel5();
}
}
for (int i=0;i<Seeding.size();i++)
@ -136,8 +136,7 @@ public class TopographicFactorController {
public AjaxResult InsertAltitude(@RequestBody UplodFile uplodFile) {
List<Altitude> value=uplodFile.getAltitudes();
for (int i=0;i<value.size();i++){
String year=value.get(i).getImageDate().substring(0,4);
value.get(i).setYear(year);
value.get(i).setYear(value.get(i).getImageDate().substring(0,4));
value.get(i).setImageDate(value.get(i).getImageDate().replace("-",""));
Integer Seeding = service.InsertAltitude(value.get(i));
}
@ -153,8 +152,7 @@ public class TopographicFactorController {
public AjaxResult InsertAspect(@RequestBody UplodFile uplodFile) {
List<Aspect> value=uplodFile.getAspects();
for (int i=0;i<value.size();i++){
String year=value.get(i).getImageDate().substring(0,4);
value.get(i).setYear(year);
value.get(i).setYear(value.get(i).getImageDate().substring(0,4));
value.get(i).setImageDate(value.get(i).getImageDate().replace("-",""));
Integer Seeding = service.InsertAspect(value.get(i));
}
@ -170,8 +168,7 @@ public class TopographicFactorController {
List<Slope> value = uplodFile.getSlopes();
for (int i = 0; i < value.size(); i++) {
String year=value.get(i).getImageDate().substring(0,4);
value.get(i).setYear(year);
value.get(i).setYear(value.get(i).getImageDate().substring(0,4));
value.get(i).setImageDate(value.get(i).getImageDate().replace("-",""));
Integer Seeding = service.InsertSlope(value.get(i));
}

View File

@ -33,23 +33,23 @@ public class UploadFile
Integer num=0;
switch (Uplod)
{
case "Alt":
case "Altitude":
//海拔
num=seedingService.altitude(zone,imageDate);
break;
case "Asp":
case "Aspect":
//坡向
num=seedingService.aspect(zone,imageDate);
break;
case "Land":
case "Landuse":
//土地利用类型1
num=seedingService.landuse(zone,imageDate);
break;
case "Land_Plant":
case "Landuse_Planting":
//土地利用类型2
num=seedingService.landuse(zone,imageDate);
break;
case "Suit":
case "Suitability":
//种植适宜性
num=seedingService.suitability(zone,imageDate);
break;
@ -57,11 +57,11 @@ public class UploadFile
//道路指数
num=seedingService.road(zone,imageDate);
break;
case "Seed":
case "Seed_Success":
//种植适应性1
num=seedingService.seedSuccess(zone,imageDate);
break;
case "Veg":
case "Vegetation_Distribution":
//种植适宜性
num=seedingService.vegetationDistribution(zone,imageDate);
break;
@ -69,7 +69,7 @@ public class UploadFile
//坡度
num=seedingService.slope(zone,imageDate);
break;
case "Desert":
case "Desertification":
//土壤沙化指数
num=seedingService.desertification(zone,imageDate);
break;
@ -77,11 +77,11 @@ public class UploadFile
//土壤湿度指数
num=seedingService.moisture(zone,imageDate);
break;
case "Salt":
case "Salinization":
//土壤盐渍化指数
num=seedingService.salinization(zone,imageDate);
break;
case "Heal":
case "Healthy":
//植被健康状况
num=seedingService.healthy(zone,imageDate,resolution);
break;
@ -94,9 +94,8 @@ public class UploadFile
//土壤盐渍化指数
num=seedingService.waterArea(zone,imageDate);
break;
case "Road_len":
case "Road_length":
//植被健康状况
num=seedingService.roadLength(zone,imageDate);
break;
case "Climate_index":
//水分因素

View File

@ -1,5 +1,6 @@
package com.ruoyi.web.controller.shate;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.system.domain_shate.SeedingSuccessRate;
import com.ruoyi.system.domain_shate.UplodFile;
@ -38,13 +39,11 @@ public class VegetationHealthController {
{
String name="";
if (type!=null && type !=""){
if (name.equals("1"))
{
name="M_Heal%";
if (type.equals("1")){
name="Medium%";
}
else if(name.equals("2"))
{
name="H_Heal%";
else if(type.equals("2")){
name="High%";
}
}
List<VegetationHealth> Seeding= VegetationService.sqlSeeding(zone,name,year);
@ -68,7 +67,6 @@ public class VegetationHealthController {
@RequestMapping(value = "/InsertVegetation",method = {RequestMethod.POST})
public AjaxResult InsertVegetation(@RequestBody UplodFile uplodFile) {
List<VegetationHealth> value=uplodFile.getVegetationHealths();
for (int i=0;i<value.size();i++){
String year=value.get(i).getImageDate().substring(0,4);

View File

@ -6,15 +6,11 @@ spring:
driver-class-name: org.postgresql.Driver
druid:
master:
url: jdbc:postgresql://rs-middleware-postgres:5432/itba?useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true&serverTimezone=Asia/Shanghai
username: gis
password: AQBSdU5bT27AKxAAvKoWQdGpSuNRCHjC4B8DVA
#url: jdbc:postgresql://172.16.123.212:5433/itba?useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true&serverTimezone=Asia/Shanghai
#url: jdbc:postgresql://192.168.2.9:5432/saudiArabia?useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true&serverTimezone=Asia/Shanghai
#url: jdbc:postgresql://121.36.229.60:5432/saudiArabia?useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true&serverTimezone=Asia/Shanghai
#username: sjs
#password: song5325
url: jdbc:postgresql://121.36.229.60:5432/saudiArabia?useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true&serverTimezone=Asia/Shanghai
username: sjs
password: song5325
# 从库数据源
slave:
# 从数据源开关/默认关闭

View File

@ -9,7 +9,7 @@ ruoyi:
# 实例演示开关
demoEnabled: true
# 文件路径 示例( Windows配置D:/ruoyi/uploadPathLinux配置 /home/ruoyi/uploadPath
profile: /home/ruoyi/uploadPath
profile: /home/sjs/ruoyi/uploadPath
# 获取ip地址开关
addressEnabled: false
# 验证码类型 math 数组计算 char 字符验证
@ -18,8 +18,8 @@ ruoyi:
# 开发环境配置
server:
# 服务器的HTTP端口默认为8080
#port: 6051
port: 9800
port: 6051
#port: 9800
servlet:
# 应用的访问路径
context-path: /
@ -60,16 +60,16 @@ spring:
# redis 配置
redis:
# 地址
host: rs-middleware-redis
#host: localhost
#host: 172.16.123.212
host: localhost
# 端口默认为6379
#port: 14096
port: 6379
# 数据库索引
database: 0
# 密码
password: SenseTime@2019
#password: sdust2020
#password: SenseTime@2019
password: sdust2020
# 连接超时时间
timeout: 10s
lettuce: