diff --git a/WebContent/WEB-INF/config/mybatis-applicationConfig.xml b/WebContent/WEB-INF/config/mybatis-applicationConfig.xml index f1679b32..d7bc4f95 100644 --- a/WebContent/WEB-INF/config/mybatis-applicationConfig.xml +++ b/WebContent/WEB-INF/config/mybatis-applicationConfig.xml @@ -9,10 +9,14 @@ + + + + \ No newline at end of file diff --git a/src/com/dao/mapper/RegionalismMapper.xml b/src/com/dao/mapper/RegionalismMapper.xml new file mode 100644 index 00000000..eba66e4a --- /dev/null +++ b/src/com/dao/mapper/RegionalismMapper.xml @@ -0,0 +1,49 @@ + + + + + + + + + + + + code,city_name,district_name + + + + + + + + \ No newline at end of file diff --git a/src/com/dao/mapper/SystemCodeMapper.xml b/src/com/dao/mapper/SystemCodeMapper.xml new file mode 100644 index 00000000..10691fc0 --- /dev/null +++ b/src/com/dao/mapper/SystemCodeMapper.xml @@ -0,0 +1,48 @@ + + + + + + + + + + + code,system_name + + + + + + + + \ No newline at end of file diff --git a/src/com/dao/mapper/data-details-mapper.xml b/src/com/dao/mapper/data-details-mapper.xml index 5cd57968..969a97a0 100644 --- a/src/com/dao/mapper/data-details-mapper.xml +++ b/src/com/dao/mapper/data-details-mapper.xml @@ -34,6 +34,10 @@ PUBLIC "-//ibatis.apache.org//DTD Mapper 3.0//EN" javaType="string" jdbcType="VARCHAR" /> + + @@ -143,6 +147,12 @@ PUBLIC "-//ibatis.apache.org//DTD Mapper 3.0//EN" data_year + + start_year + + + end_year + ) VALUES( @@ -180,6 +190,12 @@ PUBLIC "-//ibatis.apache.org//DTD Mapper 3.0//EN" #{year} + + #{start_year} + + + #{end_year} + ) diff --git a/src/com/platform/controller/DataModelController.java b/src/com/platform/controller/DataModelController.java index 743b3bd3..2842812d 100644 --- a/src/com/platform/controller/DataModelController.java +++ b/src/com/platform/controller/DataModelController.java @@ -306,4 +306,11 @@ public class DataModelController extends BaseController{ return result; } + @RequestMapping(value="/findSystemCode", method= RequestMethod.POST) + @ResponseBody + public Object findSystemCode(DataInfoEntity move) throws Exception { + log.debug("---------/findSystemCode-----------------------"); + int result = dfs.save(move); + return result; + } } diff --git a/src/com/platform/dao/IRegionalismCodeDao.java b/src/com/platform/dao/IRegionalismCodeDao.java new file mode 100644 index 00000000..e89cd938 --- /dev/null +++ b/src/com/platform/dao/IRegionalismCodeDao.java @@ -0,0 +1,28 @@ +package com.platform.dao; + +import java.util.List; + +import org.apache.ibatis.annotations.Param; +import org.springframework.stereotype.Repository; + +import com.platform.entities.DataInfoEntity; +import com.platform.entities.DataInfoEntityMoveTmp; +import com.platform.entities.PagerOptions; +import com.platform.entities.RegionalismEntity; + +/** + * @author chen + * 数据迁移状态 临时 存放 , + */ +@Repository(value = "regionalismCodeDao") +public interface IRegionalismCodeDao { + + /** 查 + * @return + * @throws Exception + */ + List findAllRegionalism() throws Exception; + + List findSubRegionalism(RegionalismEntity region) throws Exception; + +} diff --git a/src/com/platform/dao/ISystemCodeDao.java b/src/com/platform/dao/ISystemCodeDao.java new file mode 100644 index 00000000..fde3b02f --- /dev/null +++ b/src/com/platform/dao/ISystemCodeDao.java @@ -0,0 +1,28 @@ +package com.platform.dao; + +import java.util.List; + +import org.apache.ibatis.annotations.Param; +import org.springframework.stereotype.Repository; + +import com.platform.entities.DataInfoEntity; +import com.platform.entities.DataInfoEntityMoveTmp; +import com.platform.entities.PagerOptions; +import com.platform.entities.RegionalismEntity; +import com.platform.entities.SystemEntity; + +/** + * @author chen + * 数据迁移状态 临时 存放 , + */ +@Repository(value = "systemCodeDao") +public interface ISystemCodeDao { + + /** 查 + * @return + * @throws Exception + */ + List findAllSystem() throws Exception; + + List findSubSystem(SystemEntity system) throws Exception; +} diff --git a/src/com/platform/entities/DataInfoEntity.java b/src/com/platform/entities/DataInfoEntity.java index 3db92f4a..ec453d8d 100644 --- a/src/com/platform/entities/DataInfoEntity.java +++ b/src/com/platform/entities/DataInfoEntity.java @@ -22,6 +22,10 @@ public class DataInfoEntity { private String charset; // 数据的字符编码 private String collectorName; // 采集人姓名 private String year; // 数据年度 + /** 数据年度起始 */ + private String startYear; + /** 数据年度结束 */ + private String endYear; public DataInfoEntity() { } @@ -169,6 +173,34 @@ public class DataInfoEntity { this.year = year; } + /** + * @return the startYear + */ + public String getStartYear() { + return startYear; + } + + /** + * @param startYear the startYear to set + */ + public void setStartYear(String startYear) { + this.startYear = startYear; + } + + /** + * @return the endYear + */ + public String getEndYear() { + return endYear; + } + + /** + * @param endYear the endYear to set + */ + public void setEndYear(String endYear) { + this.endYear = endYear; + } + @Override public String toString() { return "id=" + this.id + " ,regionalismCode=" + this.regionalismCode @@ -180,7 +212,8 @@ public class DataInfoEntity { + this.dataPath + " ,collectingTime=" + this.collectingTime + " ,collectorContacts=" + this.collectorContacts + " ,charset=" + this.charset + " ,collectorName=" - + this.collectorName + " ,year=" + this.year + ""; + + this.collectorName + " ,year=" + this.year + " startYear=" + +this.startYear +" endYear="+this.endYear; } } diff --git a/src/com/platform/entities/RegionalismEntity.java b/src/com/platform/entities/RegionalismEntity.java new file mode 100644 index 00000000..ba1b7f2b --- /dev/null +++ b/src/com/platform/entities/RegionalismEntity.java @@ -0,0 +1,53 @@ +package com.platform.entities; + +public class RegionalismEntity { + + private String code; + + private String cityName; + + private String districtName; + + /** + * @return the code + */ + public String getCode() { + return code; + } + + /** + * @param code the code to set + */ + public void setCode(String code) { + this.code = code; + } + + /** + * @return the cityName + */ + public String getCityName() { + return cityName; + } + + /** + * @param cityName the cityName to set + */ + public void setCityName(String cityName) { + this.cityName = cityName; + } + + /** + * @return the districtName + */ + public String getDistrictName() { + return districtName; + } + + /** + * @param districtName the districtName to set + */ + public void setDistrictName(String districtName) { + this.districtName = districtName; + } + +} diff --git a/src/com/platform/entities/SystemEntity.java b/src/com/platform/entities/SystemEntity.java new file mode 100644 index 00000000..6ac6cfb8 --- /dev/null +++ b/src/com/platform/entities/SystemEntity.java @@ -0,0 +1,37 @@ +package com.platform.entities; + +public class SystemEntity { + + private int code; + + private String systemName; + + /** + * @return the code + */ + public int getCode() { + return code; + } + + /** + * @param code the code to set + */ + public void setCode(int code) { + this.code = code; + } + + /** + * @return the systemName + */ + public String getSystemName() { + return systemName; + } + + /** + * @param systemName the systemName to set + */ + public void setSystemName(String systemName) { + this.systemName = systemName; + } + +} diff --git a/src/com/platform/service/ICodeService.java b/src/com/platform/service/ICodeService.java new file mode 100644 index 00000000..4f76bc75 --- /dev/null +++ b/src/com/platform/service/ICodeService.java @@ -0,0 +1,37 @@ + +/** + * 文件名 : IGfsService.java + * 版权 : <版权/公司名> + * 描述 : <描述> + * @author chen + * 版本 : <版本> + * 修改时间: 2016年9月8日 + * 修改内容: <修改内容> + */ +package com.platform.service; + + +import java.util.List; + +import com.platform.entities.FolderNode; +import com.platform.entities.RegionalismEntity; +import com.platform.entities.SystemEntity; +import com.platform.entities.VolumeEntity; + + +/** + * <一句话功能简述> + * <功能详细描述> + * @author chen + * @version [版本号,2016年9月8日] + * @see [相关类/方法] + * @since [产品/模块版本] + */ + +public interface ICodeService { + + public List findSystem(SystemEntity sys) throws Exception; + + public List findRegionalism(RegionalismEntity region) throws Exception; + +} diff --git a/src/com/platform/service/impl/CodeServiceImpl.java b/src/com/platform/service/impl/CodeServiceImpl.java new file mode 100644 index 00000000..65aacf40 --- /dev/null +++ b/src/com/platform/service/impl/CodeServiceImpl.java @@ -0,0 +1,37 @@ +package com.platform.service.impl; + +import java.util.ArrayList; +import java.util.List; + +import javax.annotation.Resource; + +import com.platform.dao.DataInfoDao; +import com.platform.dao.IRegionalismCodeDao; +import com.platform.dao.ISystemCodeDao; +import com.platform.entities.RegionalismEntity; +import com.platform.entities.SystemEntity; +import com.platform.service.ICodeService; + +public class CodeServiceImpl implements ICodeService { + + @Resource(name = "systemCodeDao") + private ISystemCodeDao systemCodeDao; + + @Resource(name = "regionalismCodeDao") + private IRegionalismCodeDao regionalismCodeDao; + + @Override + public List findSystem(SystemEntity sys) throws Exception { + List result = new ArrayList(); + result = systemCodeDao.findSubSystem(sys); + return result; + } + + @Override + public List findRegionalism(RegionalismEntity region) throws Exception { + List result = regionalismCodeDao.findSubRegionalism(region); + + return result; + } + +} diff --git a/src/com/platform/service/thread/ThreadMoveData.java b/src/com/platform/service/thread/ThreadMoveData.java index dc6b60ec..4b30c1d4 100644 --- a/src/com/platform/service/thread/ThreadMoveData.java +++ b/src/com/platform/service/thread/ThreadMoveData.java @@ -78,6 +78,7 @@ public class ThreadMoveData{ //该循环必须 循环每个,不能有 break; // rate:大小:假的,待换成真实比例 double realRate = 0.00; + int moveFileCurrNum = 0; for (int i = 0; i < rsize; i++) { DataInfoEntityMoveTmp dataMove = result.get(i); //如果拷贝进度超过20分钟未进行-- 判断为 迁移失败。 @@ -89,7 +90,11 @@ public class ThreadMoveData{ dataMove.setCompleteStatus("3"); dataInfoMoveTmpDao.update(dataMove); } - isNoMove = false; + //正在上传的个数。 + moveFileCurrNum++; + if (moveFileCurrNum >= Constant.moveFileMaxNum) { + isNoMove = false; + } // 查询大小:。//gfs 获取size, long srcSize = show.getFolderSize(dataMove.getDataPath()); long dstSize = show.getFolderSize(dataMove.getDstPath()); @@ -158,6 +163,7 @@ public class ThreadMoveData{ if (matcher2.find()) { dstPath = dstPath.substring(0, dstPath.length()-1); } + //数据迁移。 copy.copyFolder(dstPath+"/app", next2move.getDstPath()); // "1" :正在上传,0:等待 迁移, 2:成功 3:失败 next2move.setCompleteStatus("1"); diff --git a/src/com/platform/utils/Constant.java b/src/com/platform/utils/Constant.java index b1d439f6..4916f3db 100644 --- a/src/com/platform/utils/Constant.java +++ b/src/com/platform/utils/Constant.java @@ -30,7 +30,11 @@ public class Constant { + "echo \\$path \n fi\n done\n}\n\nIFS=\\$\\'\\n\\' " + "#这个必须要,否则会在文件名中有空格时出错\nINIT_PATH=\".\";\nergodic \\$1\n"; - + /** + * volume 获取的线程休眠时间 + */ + public final static int moveFileMaxNum = 1; + /**