|
@@ -1,126 +1,126 @@
|
|
|
package com.onemap.analyse.task;
|
|
|
|
|
|
-import com.onemap.analyse.domain.*;
|
|
|
-import com.onemap.analyse.mapper.*;
|
|
|
-import com.onemap.analyse.utils.CalculateShpArea;
|
|
|
-import com.onemap.common.core.utils.StringUtils;
|
|
|
-import com.onemap.common.core.utils.UnPackageUtils;
|
|
|
-import com.onemap.common.core.web.domain.RequestResult;
|
|
|
-import org.springframework.beans.factory.annotation.Value;
|
|
|
-import org.springframework.scheduling.annotation.Async;
|
|
|
-import org.springframework.scheduling.annotation.Scheduled;
|
|
|
-import org.springframework.stereotype.Component;
|
|
|
-
|
|
|
-import javax.annotation.Resource;
|
|
|
-import java.io.File;
|
|
|
-import java.util.Date;
|
|
|
+// import com.onemap.analyse.domain.*;
|
|
|
+// import com.onemap.analyse.mapper.*;
|
|
|
+// import com.onemap.analyse.utils.CalculateShpArea;
|
|
|
+// import com.onemap.common.core.utils.StringUtils;
|
|
|
+// import com.onemap.common.core.utils.UnPackageUtils;
|
|
|
+// import com.onemap.common.core.web.domain.RequestResult;
|
|
|
+// import org.springframework.beans.factory.annotation.Value;
|
|
|
+// import org.springframework.scheduling.annotation.Async;
|
|
|
+// import org.springframework.scheduling.annotation.Scheduled;
|
|
|
+// import org.springframework.stereotype.Component;
|
|
|
+//
|
|
|
+// import javax.annotation.Resource;
|
|
|
+// import java.io.File;
|
|
|
+// import java.util.Date;
|
|
|
|
|
|
/**
|
|
|
* 策划生成模块ftp文件夹定时刷新任务
|
|
|
*/
|
|
|
-@Component
|
|
|
-public class FtpSchedule {
|
|
|
- //间隔时间 单位ms
|
|
|
- public static final long TIME_INTERVAL = 1 * 15000;
|
|
|
- //任务状态标识码
|
|
|
-
|
|
|
- private RwztDTO rwztDTO = new RwztDTO();
|
|
|
- private XzlbDTO xzlbDTO = new XzlbDTO();
|
|
|
- private FxfwDictDTO fxfwDictDTO = new FxfwDictDTO();
|
|
|
- @Resource
|
|
|
- private HgxfxMapper hgxfxMapper;
|
|
|
- @Resource
|
|
|
- HgxfxHgscxMapper hgxfxHgscxMapper;
|
|
|
- @Resource
|
|
|
- HgxfxScxMapper hgxfxScxMapper;
|
|
|
- @Resource
|
|
|
- private FxrwrzMapper fxrwrzMapper;
|
|
|
- @Resource
|
|
|
- private FzssChscMapper fzssChscMapper;
|
|
|
- @Resource
|
|
|
- private FzssChscFileMapper fzssChscFileMapper;
|
|
|
- @Resource
|
|
|
- private HgxfxTemplateMapper hgxfxTemplateMapper;
|
|
|
- @Value("${Hgxfx.ftpIn}")
|
|
|
- private String ftpIn;
|
|
|
- @Value("${Hgxfx.ftpOut}")
|
|
|
- private String ftpOut;
|
|
|
-
|
|
|
- @Async("taskExecutor")
|
|
|
- //@Scheduled(fixedDelay = TIME_INTERVAL)
|
|
|
- public void FtpStatus() {
|
|
|
- try {
|
|
|
- //TODO 扫描未解压文件,进行数据加压
|
|
|
- File ftpdirectory = new File(ftpIn);
|
|
|
- if (!ftpdirectory.isDirectory()) {
|
|
|
- System.out.println("ftp文件夹配置怎么不是文件夹啊!!!!");
|
|
|
- return;
|
|
|
- }
|
|
|
- File[] filelist = ftpdirectory.listFiles();
|
|
|
- String unzippath = "";
|
|
|
- for (int i = 0; i < filelist.length; i++) {
|
|
|
- File cur = filelist[i];
|
|
|
- if(cur.isDirectory()){
|
|
|
- continue;
|
|
|
- }
|
|
|
- //获得文件名称
|
|
|
- String fileName = cur.getName();
|
|
|
- String fileRelName = fileName.substring(0, fileName.lastIndexOf("."));
|
|
|
- String type = fileName.substring(fileName.lastIndexOf(".") + 1).toLowerCase();
|
|
|
- if (type.contains("zip") || type.contains("rar")) {
|
|
|
- unzippath = ftpIn + "/" + fileRelName;
|
|
|
- File dest = new File(unzippath);
|
|
|
- //判断文件夹是否存在,存在则跳过,说明已经
|
|
|
- if (dest.exists()) {
|
|
|
- continue;
|
|
|
- }
|
|
|
- //解压zip格式
|
|
|
- if (type.equals("zip")) {
|
|
|
- new UnPackageUtils().unPackZip(cur, unzippath);
|
|
|
- } else {
|
|
|
- //解压rar格式
|
|
|
- new UnPackageUtils().unPackRar(cur, unzippath);
|
|
|
- }
|
|
|
- String shpPath = "";
|
|
|
- File[] files = new File(unzippath).listFiles();
|
|
|
- for (File file1 : files) {
|
|
|
- if (file1.getAbsolutePath().substring(file1.getAbsolutePath().lastIndexOf(".") + 1).equals("shp")) {
|
|
|
- shpPath = file1.getAbsolutePath();
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- if (!"".equals(shpPath)) {
|
|
|
- //计算shape面积
|
|
|
- double mj = CalculateShpArea.getShpArea(shpPath);
|
|
|
- String fileid = StringUtils.getUUID();
|
|
|
- //TODO 插入到T_FZSS_ZHXZ_FILE数据库表
|
|
|
- FzssChscFileDTO fileDTO = new FzssChscFileDTO();
|
|
|
- fileDTO.setBsm(fileid);
|
|
|
- fileDTO.setWj(shpPath);
|
|
|
- fileDTO.setYswj(cur.getAbsolutePath());
|
|
|
- fzssChscFileMapper.insert(fileDTO);
|
|
|
- //TODO 插入到T_FZSS_ZHXZ_CHSC数据库表
|
|
|
- FzxzChscDTO chscDto = new FzxzChscDTO();
|
|
|
- chscDto.setXzlb(1);//选址类别(0意向范围筛选,1指定空间位置)
|
|
|
- chscDto.setXzfw(fileid);//范围
|
|
|
- chscDto.setFwlx(2);//范围类型(0行政区 1绘制 2SHP文件)*当选址类别为1时,范围类型只能是2
|
|
|
- chscDto.setXmbm(fileRelName);//项目编码(工改系统)
|
|
|
- chscDto.setXmmc(fileRelName);//项目名称
|
|
|
- chscDto.setXmdm(fileRelName); //项目代码(建设项目审批管理系统)
|
|
|
- chscDto.setYwlx("划拨类");//划拨类/出让类
|
|
|
- String uuid = StringUtils.getUUID();
|
|
|
- chscDto.setBsm(uuid);
|
|
|
- chscDto.setNydmj(mj);
|
|
|
- chscDto.setRwzt(rwztDTO.getNoRes());
|
|
|
- chscDto.setCjsj(new Date());
|
|
|
- fzssChscMapper.insert(chscDto);
|
|
|
- } else {
|
|
|
- System.out.println("未检索到shp文件, 文件夹名称:" + unzippath);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
- }
|
|
|
-}
|
|
|
+// @Component
|
|
|
+// public class FtpSchedule {
|
|
|
+// //间隔时间 单位ms
|
|
|
+// public static final long TIME_INTERVAL = 1 * 15000;
|
|
|
+// //任务状态标识码
|
|
|
+//
|
|
|
+// private RwztDTO rwztDTO = new RwztDTO();
|
|
|
+// private XzlbDTO xzlbDTO = new XzlbDTO();
|
|
|
+// private FxfwDictDTO fxfwDictDTO = new FxfwDictDTO();
|
|
|
+// @Resource
|
|
|
+// private HgxfxMapper hgxfxMapper;
|
|
|
+// @Resource
|
|
|
+// HgxfxHgscxMapper hgxfxHgscxMapper;
|
|
|
+// @Resource
|
|
|
+// HgxfxScxMapper hgxfxScxMapper;
|
|
|
+// @Resource
|
|
|
+// private FxrwrzMapper fxrwrzMapper;
|
|
|
+// @Resource
|
|
|
+// private FzssChscMapper fzssChscMapper;
|
|
|
+// @Resource
|
|
|
+// private FzssChscFileMapper fzssChscFileMapper;
|
|
|
+// @Resource
|
|
|
+// private HgxfxTemplateMapper hgxfxTemplateMapper;
|
|
|
+// @Value("${Hgxfx.ftpIn}")
|
|
|
+// private String ftpIn;
|
|
|
+// @Value("${Hgxfx.ftpOut}")
|
|
|
+// private String ftpOut;
|
|
|
+//
|
|
|
+// @Async("taskExecutor")
|
|
|
+// //@Scheduled(fixedDelay = TIME_INTERVAL)
|
|
|
+// public void FtpStatus() {
|
|
|
+// try {
|
|
|
+// //TODO 扫描未解压文件,进行数据加压
|
|
|
+// File ftpdirectory = new File(ftpIn);
|
|
|
+// if (!ftpdirectory.isDirectory()) {
|
|
|
+// System.out.println("ftp文件夹配置怎么不是文件夹啊!!!!");
|
|
|
+// return;
|
|
|
+// }
|
|
|
+// File[] filelist = ftpdirectory.listFiles();
|
|
|
+// String unzippath = "";
|
|
|
+// for (int i = 0; i < filelist.length; i++) {
|
|
|
+// File cur = filelist[i];
|
|
|
+// if(cur.isDirectory()){
|
|
|
+// continue;
|
|
|
+// }
|
|
|
+// //获得文件名称
|
|
|
+// String fileName = cur.getName();
|
|
|
+// String fileRelName = fileName.substring(0, fileName.lastIndexOf("."));
|
|
|
+// String type = fileName.substring(fileName.lastIndexOf(".") + 1).toLowerCase();
|
|
|
+// if (type.contains("zip") || type.contains("rar")) {
|
|
|
+// unzippath = ftpIn + "/" + fileRelName;
|
|
|
+// File dest = new File(unzippath);
|
|
|
+// //判断文件夹是否存在,存在则跳过,说明已经
|
|
|
+// if (dest.exists()) {
|
|
|
+// continue;
|
|
|
+// }
|
|
|
+// //解压zip格式
|
|
|
+// if (type.equals("zip")) {
|
|
|
+// new UnPackageUtils().unPackZip(cur, unzippath);
|
|
|
+// } else {
|
|
|
+// //解压rar格式
|
|
|
+// new UnPackageUtils().unPackRar(cur, unzippath);
|
|
|
+// }
|
|
|
+// String shpPath = "";
|
|
|
+// File[] files = new File(unzippath).listFiles();
|
|
|
+// for (File file1 : files) {
|
|
|
+// if (file1.getAbsolutePath().substring(file1.getAbsolutePath().lastIndexOf(".") + 1).equals("shp")) {
|
|
|
+// shpPath = file1.getAbsolutePath();
|
|
|
+// break;
|
|
|
+// }
|
|
|
+// }
|
|
|
+// if (!"".equals(shpPath)) {
|
|
|
+// //计算shape面积
|
|
|
+// double mj = CalculateShpArea.getShpArea(shpPath);
|
|
|
+// String fileid = StringUtils.getUUID();
|
|
|
+// //TODO 插入到T_FZSS_ZHXZ_FILE数据库表
|
|
|
+// FzssChscFileDTO fileDTO = new FzssChscFileDTO();
|
|
|
+// fileDTO.setBsm(fileid);
|
|
|
+// fileDTO.setWj(shpPath);
|
|
|
+// fileDTO.setYswj(cur.getAbsolutePath());
|
|
|
+// fzssChscFileMapper.insert(fileDTO);
|
|
|
+// //TODO 插入到T_FZSS_ZHXZ_CHSC数据库表
|
|
|
+// FzxzChscDTO chscDto = new FzxzChscDTO();
|
|
|
+// chscDto.setXzlb(1);//选址类别(0意向范围筛选,1指定空间位置)
|
|
|
+// chscDto.setXzfw(fileid);//范围
|
|
|
+// chscDto.setFwlx(2);//范围类型(0行政区 1绘制 2SHP文件)*当选址类别为1时,范围类型只能是2
|
|
|
+// chscDto.setXmbm(fileRelName);//项目编码(工改系统)
|
|
|
+// chscDto.setXmmc(fileRelName);//项目名称
|
|
|
+// chscDto.setXmdm(fileRelName); //项目代码(建设项目审批管理系统)
|
|
|
+// chscDto.setYwlx("划拨类");//划拨类/出让类
|
|
|
+// String uuid = StringUtils.getUUID();
|
|
|
+// chscDto.setBsm(uuid);
|
|
|
+// chscDto.setNydmj(mj);
|
|
|
+// chscDto.setRwzt(rwztDTO.getNoRes());
|
|
|
+// chscDto.setCjsj(new Date());
|
|
|
+// fzssChscMapper.insert(chscDto);
|
|
|
+// } else {
|
|
|
+// System.out.println("未检索到shp文件, 文件夹名称:" + unzippath);
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+// } catch (Exception e) {
|
|
|
+// e.printStackTrace();
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|