parent
1a2cffab4d
commit
f6ec25e494
11
.classpath
11
.classpath
|
@ -4,13 +4,10 @@
|
|||
<classpathentry kind="src" path="test"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jst.server.core.container/org.eclipse.jst.server.tomcat.runtimeTarget/Apache Tomcat v7.0"/>
|
||||
<classpathentry kind="con" path="com.genuitec.runtime.library/com.genuitec.generic_6.0">
|
||||
<attributes>
|
||||
<attribute name="owner.project.facets" value="jst.web"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/userLiabrary"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jst.server.core.container/org.eclipse.jst.server.tomcat.runtimeTarget/Apache Tomcat v8.0"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
|
||||
<attributes>
|
||||
<attribute name="owner.project.facets" value="java"/>
|
||||
</attributes>
|
||||
|
|
5
.project
5
.project
|
@ -30,6 +30,11 @@
|
|||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jst.j2ee.ejb.annotations.xdoclet.xdocletbuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
jdbc.mysql.driver=com.mysql.jdbc.Driver
|
||||
# 连接url
|
||||
|
||||
jdbc.mysql.url=jdbc:mysql://192.168.0.110:3306/ftpdata?useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true&autoReconnect=true&failOverReadOnly=false
|
||||
jdbc.mysql.url=jdbc:mysql://192.168.191.120:3306/ftpdata?useUnicode=true&characterEncoding=UTF-8&allowMultiQueries=true&autoReconnect=true&failOverReadOnly=false
|
||||
|
||||
# 用户名
|
||||
jdbc.mysql.username=root
|
||||
|
@ -55,9 +55,9 @@ gather-tablespace-path=/opt/oracle/app/oradata/orcl/
|
|||
gather-table-user-password=user
|
||||
|
||||
#kuber's url must exist
|
||||
kubeMasterUrl=http://192.168.0.110:8080/
|
||||
kubeMasterUrl=http://192.168.191.120:8080/
|
||||
|
||||
kubeMasterAddress=192.168.0.110:8080
|
||||
kubeMasterAddress=192.168.191.120:8080
|
||||
|
||||
collect-user-name=system
|
||||
collect-password=oracle
|
||||
|
@ -67,12 +67,12 @@ collect-service-name=orcl
|
|||
collect-user-table=U_BZBJY
|
||||
collect-exec-table=KZXZB
|
||||
collect-pay-table=ZFXXB
|
||||
#gfs web's IP
|
||||
gfs_control_ip=192.168.0.110
|
||||
#gfs cluster master IP
|
||||
gfs_control_ip=192.168.191.120
|
||||
#gfs web password of root
|
||||
gfs_control_rootPassWd=root
|
||||
#url of gfs web
|
||||
HttpClientConstant_URL_IP_PORT=http://192.168.0.110:9001/
|
||||
HttpClientConstant_URL_IP_PORT=http://192.168.191.120:9002/glusterfs_restful/
|
||||
#data between 6 month ago and now
|
||||
dataBefore=6
|
||||
#move a data once
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
<!-- 输出到控制台 -->
|
||||
<appender name="console" class="org.apache.log4j.ConsoleAppender">
|
||||
<param name="Threshold" value="info"></param>
|
||||
<layout class="org.apache.log4j.TTCCLayout">
|
||||
<param name="ConversionPattern" value="TTCCLayout"></param>
|
||||
<layout class="org.apache.log4j.PatternLayout">
|
||||
<param name="ConversionPattern" value="[%d{yyyy-MM-dd HH:mm:ss\} %-5p] [%t] {%c:%L}-%m%n"></param>
|
||||
</layout>
|
||||
<filter class="org.apache.log4j.varia.LevelRangeFilter">
|
||||
<param name="LevelMin" value="DEBUG" />
|
||||
|
|
|
@ -19,7 +19,7 @@ package com.base;
|
|||
* @since [产品/模块版本]
|
||||
*/
|
||||
|
||||
public class MyException {
|
||||
public class MyException extends Exception{
|
||||
private String mess;
|
||||
|
||||
public MyException() {
|
||||
|
|
|
@ -14,6 +14,7 @@ import org.springframework.ui.ModelMap;
|
|||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.base.BaseController;
|
||||
import com.platform.entities.CheckoutEntity;
|
||||
|
@ -26,7 +27,7 @@ import com.platform.utils.CacheSetCantDelete;
|
|||
* @author chen
|
||||
*
|
||||
*/
|
||||
@Controller
|
||||
@RestController
|
||||
@RequestMapping("/checkout")
|
||||
public class CheckoutController extends BaseController {
|
||||
//日志
|
||||
|
|
|
@ -13,7 +13,6 @@ import javax.servlet.http.HttpServletResponse;
|
|||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
@ -21,6 +20,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.base.BaseController;
|
||||
import com.platform.entities.BasedTask;
|
||||
|
@ -53,7 +53,7 @@ import com.platform.utils.UtilsHelper;
|
|||
* @author chen
|
||||
*
|
||||
*/
|
||||
@Controller
|
||||
@RestController
|
||||
public class DataModelController extends BaseController {
|
||||
|
||||
public static Logger log = Logger.getLogger(DataModelController.class);
|
||||
|
|
|
@ -10,15 +10,12 @@ import javax.servlet.http.HttpServletRequest;
|
|||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.platform.utils.Configs;
|
||||
|
||||
@Controller
|
||||
@RestController
|
||||
public class DefaultController {
|
||||
|
||||
public final static Logger log = Logger.getLogger(DefaultController.class);
|
||||
|
@ -29,12 +26,17 @@ public class DefaultController {
|
|||
* @return
|
||||
*/
|
||||
@RequestMapping("/")
|
||||
public ModelAndView defaultHandler(HttpServletRequest req, HttpServletResponse res){
|
||||
public String defaultHandler(HttpServletRequest req, HttpServletResponse res){
|
||||
//处理不匹配的请求
|
||||
log.info("hello");
|
||||
return "hello";
|
||||
}
|
||||
@RequestMapping("/index")
|
||||
public String defaultHandlerIndex(HttpServletRequest req, HttpServletResponse res){
|
||||
//处理不匹配的请求
|
||||
log.info("index");
|
||||
return new ModelAndView("index");
|
||||
return "index";
|
||||
}
|
||||
|
||||
/** 测试
|
||||
* @param req
|
||||
* @param res
|
||||
|
|
|
@ -23,12 +23,12 @@ import org.springframework.http.HttpHeaders;
|
|||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||
import org.springframework.web.multipart.commons.CommonsMultipartResolver;
|
||||
|
@ -51,7 +51,7 @@ import com.platform.utils.UtilsHelper;
|
|||
* @author chen
|
||||
*
|
||||
*/
|
||||
@Controller
|
||||
@RestController
|
||||
@RequestMapping("/fileOperation")
|
||||
public class ExcelController extends BaseController{
|
||||
|
||||
|
|
|
@ -14,13 +14,13 @@ import org.springframework.http.HttpHeaders;
|
|||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.base.BaseController;
|
||||
import com.platform.entities.SqlFileInfoEntity;
|
||||
|
@ -33,7 +33,7 @@ import com.platform.utils.ZipCompressUtils;
|
|||
* @author chen
|
||||
*
|
||||
*/
|
||||
@Controller
|
||||
@RestController
|
||||
@RequestMapping("/filePackage")
|
||||
public class FilePackageController extends BaseController {
|
||||
|
||||
|
|
|
@ -5,9 +5,9 @@ package com.platform.controller;
|
|||
import javax.annotation.Resource;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.base.BaseController;
|
||||
import com.platform.entities.VolumeDataEntity;
|
||||
|
@ -22,8 +22,8 @@ import com.platform.service.IGfsService;
|
|||
* @see [相关类/方法]
|
||||
* @since [产品/模块版本]
|
||||
*/
|
||||
@Controller
|
||||
|
||||
@RestController
|
||||
@RequestMapping("")
|
||||
public class FolderController extends BaseController {
|
||||
|
||||
|
|
|
@ -9,12 +9,12 @@ import javax.servlet.http.HttpServletRequest;
|
|||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.base.BaseController;
|
||||
import com.platform.dao.GatherOracleDao;
|
||||
|
@ -31,7 +31,7 @@ import com.platform.utils.Constant;
|
|||
* @author chen
|
||||
*
|
||||
*/
|
||||
@Controller
|
||||
@RestController
|
||||
public class OracleController extends BaseController {
|
||||
|
||||
/**
|
||||
|
|
|
@ -14,8 +14,8 @@ import javax.servlet.http.HttpServletRequest;
|
|||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
|
||||
|
@ -30,7 +30,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|||
* @see [相关类/方法]
|
||||
* @since [产品/模块版本]
|
||||
*/
|
||||
@Controller
|
||||
@RestController
|
||||
public class SetGlusterfsController {
|
||||
|
||||
public final static Logger log = Logger.getLogger(SetGlusterfsController.class);
|
||||
|
|
|
@ -10,16 +10,14 @@
|
|||
*/
|
||||
package com.platform.controller;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.platform.glusterfs.ClusterInfo;
|
||||
import com.platform.glusterfs.VolumeInfo;
|
||||
import com.platform.utils.Configs;
|
||||
|
||||
/**
|
||||
|
@ -31,7 +29,7 @@ import com.platform.utils.Configs;
|
|||
* @see [相关类/方法]
|
||||
* @since [产品/模块版本]
|
||||
*/
|
||||
@Controller
|
||||
@RestController
|
||||
public class ShowGlusterfsController {
|
||||
|
||||
public static Logger log = Configs.DAILY_ROLLING_LOGGER.getLogger(ShowGlusterfsController.class);
|
||||
|
@ -45,6 +43,7 @@ public class ShowGlusterfsController {
|
|||
* @see [类、类#方法、类#成员]
|
||||
*/
|
||||
@RequestMapping("/showPeerStatus")
|
||||
@ResponseBody
|
||||
public Map<String,String> showPeerStatus(){
|
||||
Map<String, String> peer_status=new ClusterInfo().showClusterInfo();
|
||||
return peer_status;
|
||||
|
|
|
@ -7,13 +7,13 @@ import javax.servlet.http.HttpServletRequest;
|
|||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.base.BaseController;
|
||||
|
||||
@Controller
|
||||
@RestController
|
||||
public class TaskModelController extends BaseController{
|
||||
|
||||
public static Logger log = Logger.getLogger(TaskModelController.class);
|
||||
|
|
|
@ -5,15 +5,14 @@ import javax.servlet.http.HttpServletRequest;
|
|||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.base.BaseController;
|
||||
import com.platform.entities.VolumeDataEntity;
|
||||
import com.platform.http.gfs.SetVolume;
|
||||
import com.platform.service.IVolumeService;
|
||||
import com.platform.utils.ThreadVolumeImm;
|
||||
|
||||
|
@ -21,7 +20,7 @@ import com.platform.utils.ThreadVolumeImm;
|
|||
* @author chen
|
||||
*
|
||||
*/
|
||||
@Controller
|
||||
@RestController
|
||||
public class VolumeController extends BaseController{
|
||||
|
||||
public static Logger log = Logger.getLogger(VolumeController.class);
|
||||
|
|
|
@ -46,7 +46,7 @@ public interface IScriptMakeService {
|
|||
* @param form 当前是那个系统
|
||||
* @return
|
||||
*/
|
||||
public Map<String, Object> handleSqlFile(String type, String opt, String content, SqlFileInfoEntity form);
|
||||
public Map<String, Object> handleSqlFile(String type, String opt, String content, SqlFileInfoEntity form) throws Exception;
|
||||
|
||||
/** 一键审核
|
||||
* @param forms
|
||||
|
|
|
@ -153,20 +153,20 @@ public class OracleExtractHelper {
|
|||
*/
|
||||
public boolean createStardardTableSpace(Connection conn,
|
||||
OracleConnectorParams collectOracle, GatherOracleInfo oc) {
|
||||
// String tmpSql = "select TABLESPACE_NAME from dba_tablespaces where TABLESPACE_NAME = '"
|
||||
// + oc.getTableName().toUpperCase() + "'";
|
||||
// // 存在 表空间
|
||||
// if (OracleConnector.execUpdateOracleSQL(conn, tmpSql,
|
||||
// Configs.EXTRACT_STANDARD_LOG_LOCALTION + collectOracle.getName())) {
|
||||
// return true;
|
||||
// } else {
|
||||
String tmpSql = "select TABLESPACE_NAME from dba_tablespaces where TABLESPACE_NAME = '"
|
||||
+ oc.getTableName().toUpperCase() + "'";
|
||||
// 存在 表空间
|
||||
if (OracleConnector.execUpdateOracleSQL(conn, tmpSql,
|
||||
Configs.EXTRACT_STANDARD_LOG_LOCALTION + collectOracle.getName())) {
|
||||
return true;
|
||||
} else {
|
||||
String sql = "create tablespace " + oc.getTableName().toUpperCase()
|
||||
+ " datafile '" + Configs.GATHER_TABLESPACE_PATH
|
||||
+ oc.getTableName().toUpperCase() + ".dbf"
|
||||
+ "' size 512M autoextend on next 512M maxsize unlimited";
|
||||
return OracleConnector.execOracleSQL(conn, sql,
|
||||
Configs.EXTRACT_STANDARD_LOG_LOCALTION + collectOracle.getName());
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -13,6 +13,7 @@ import javax.annotation.Resource;
|
|||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.base.MyException;
|
||||
import com.platform.dao.PreDataInfoDao;
|
||||
import com.platform.entities.DefaultDataDescription;
|
||||
import com.platform.entities.PreDataInfo;
|
||||
|
@ -31,8 +32,7 @@ import com.platform.utils.XmlOperationByDom4j;
|
|||
public class ScriptMakeService implements IScriptMakeService {
|
||||
|
||||
@SuppressWarnings("static-access")
|
||||
public static Logger log = Configs.DAILY_ROLLING_LOGGER
|
||||
.getLogger(ScriptMakeService.class);
|
||||
public static Logger log = Configs.DAILY_ROLLING_LOGGER.getLogger(ScriptMakeService.class);
|
||||
|
||||
@Resource(name = "preDataInfoDao")
|
||||
private PreDataInfoDao preDataInfoDao;
|
||||
|
@ -41,8 +41,7 @@ public class ScriptMakeService implements IScriptMakeService {
|
|||
public int makeCfg() throws Exception {
|
||||
log.info("makeCfg");
|
||||
List<PreDataInfo> systemInfoList = preDataInfoDao.findAll();
|
||||
String path = FileOperateHelper
|
||||
.addLastSeparator(Configs.SQL_SCRIPT_PATH_STANDARD);
|
||||
String path = FileOperateHelper.addLastSeparator(Configs.SQL_SCRIPT_PATH_STANDARD);
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append("市\t县(市、区)\t行政区划代码\r\n");
|
||||
Map<String, Object> startData = new HashMap<String, Object>();
|
||||
|
@ -60,8 +59,7 @@ public class ScriptMakeService implements IScriptMakeService {
|
|||
sb.append(preDataInfo.getAreaCode().toLowerCase());
|
||||
sb.append("\r\n");
|
||||
}
|
||||
FileOperateHelper.fileReWriteGBK(path + Constant.cfgFileName,
|
||||
sb.toString());
|
||||
FileOperateHelper.fileReWriteGBK(path + Constant.cfgFileName, sb.toString());
|
||||
log.info("makeCfg--end");
|
||||
return 1;
|
||||
}
|
||||
|
@ -70,16 +68,14 @@ public class ScriptMakeService implements IScriptMakeService {
|
|||
public int makeXml() throws Exception {
|
||||
log.info("makeXml");
|
||||
List<PreDataInfo> systemInfoList = preDataInfoDao.findAll();
|
||||
String dirpath = FileOperateHelper
|
||||
.addLastSeparator(Configs.SQL_SCRIPT_PATH_STANDARD);
|
||||
String dirpath = FileOperateHelper.addLastSeparator(Configs.SQL_SCRIPT_PATH_STANDARD);
|
||||
Map<String, List<Object>> map = new HashMap<String, List<Object>>();
|
||||
for (PreDataInfo preDataInfo : systemInfoList) {
|
||||
putSystemByAreaCode(map, preDataInfo.getAreaCode().toLowerCase(), preDataInfo);
|
||||
}
|
||||
//TODO 新建 空 xml
|
||||
XmlOperationByDom4j
|
||||
.createNullXml(FileOperateHelper.addLastSeparator(dirpath)
|
||||
+ "data_description_initialized.xml", "Data_info");
|
||||
// TODO 新建 空 xml
|
||||
XmlOperationByDom4j.createNullXml(
|
||||
FileOperateHelper.addLastSeparator(dirpath) + "data_description_initialized.xml", "Data_info");
|
||||
// 一个地区一个xml
|
||||
for (String key : map.keySet()) {
|
||||
String areaPath = dirpath + key;
|
||||
|
@ -93,9 +89,10 @@ public class ScriptMakeService implements IScriptMakeService {
|
|||
defList.add(defaul);
|
||||
}
|
||||
|
||||
XmlOperationByDom4j
|
||||
.createXml(FileOperateHelper.addLastSeparator(areaPath)
|
||||
+ key + ".xml", defList, "Data_info", "id", "dataId","workRange","sysCode","updateTime","userTablespaceStatus", "checkoutIndicateStatus", "checkoutPayStatus", "userTablespacePath", "checkoutIndicatePath", "checkoutPayPath", "sqlList", "dataVersion", "collectingTime", "collUpdate");
|
||||
XmlOperationByDom4j.createXml(FileOperateHelper.addLastSeparator(areaPath) + key + ".xml", defList,
|
||||
"Data_info", "id", "dataId", "workRange", "sysCode", "updateTime", "userTablespaceStatus",
|
||||
"checkoutIndicateStatus", "checkoutPayStatus", "userTablespacePath", "checkoutIndicatePath",
|
||||
"checkoutPayPath", "sqlList", "dataVersion", "collectingTime", "collUpdate");
|
||||
}
|
||||
log.info("makeXml--end");
|
||||
return 1;
|
||||
|
@ -107,16 +104,14 @@ public class ScriptMakeService implements IScriptMakeService {
|
|||
// 查找 Configs.SQL_SCRIPT_PATH_LAST 路径下的 所有的文件:路径
|
||||
Map<String, String> sqlFilePathsLast = new HashMap<String, String>();
|
||||
Map<String, String> timeMapLast = new HashMap<String, String>();
|
||||
sqlFilePathsLast = getAllFile(sqlFilePathsLast,timeMapLast,
|
||||
Configs.SQL_SCRIPT_PATH_LAST);
|
||||
sqlFilePathsLast = getAllFile(sqlFilePathsLast, timeMapLast, Configs.SQL_SCRIPT_PATH_LAST);
|
||||
// 遍历 查找 Configs.SQL_SCRIPT_PATH_STANDARD 脚本文件 放入集合中
|
||||
Map<String, String> sqlFilePathsStandard = new HashMap<String, String>();
|
||||
Map<String, String> timeMapStandard = new HashMap<String, String>();
|
||||
sqlFilePathsStandard = getAllFile(sqlFilePathsStandard,timeMapStandard,
|
||||
Configs.SQL_SCRIPT_PATH_STANDARD);
|
||||
sqlFilePathsStandard = getAllFile(sqlFilePathsStandard, timeMapStandard, Configs.SQL_SCRIPT_PATH_STANDARD);
|
||||
// 填充 脚本状态、位置的信息
|
||||
List<SqlFileInfoEntity> result = setScript(systemDataInfo,
|
||||
sqlFilePathsStandard, sqlFilePathsLast, timeMapLast, timeMapStandard);
|
||||
List<SqlFileInfoEntity> result = setScript(systemDataInfo, sqlFilePathsStandard, sqlFilePathsLast, timeMapLast,
|
||||
timeMapStandard);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -126,32 +121,32 @@ public class ScriptMakeService implements IScriptMakeService {
|
|||
String path1 = "";
|
||||
String path2 = "";
|
||||
switch (name) {
|
||||
case "userTableStatus":
|
||||
path1 = form.getUserTableStatusPathStandard();
|
||||
map.put("data1Path", path1);
|
||||
map.put("data1", fileReader(path1));
|
||||
path2 = form.getUserTableStatusPathLast();
|
||||
map.put("data2Path", path2);
|
||||
map.put("data2", fileReader(path2));
|
||||
break;
|
||||
case "ckIndicateStatus":
|
||||
path1 = form.getCkIndicateStatusPathStandard();
|
||||
map.put("data1Path", path1);
|
||||
map.put("data1", fileReader(path1));
|
||||
path2 = form.getCkIndicateStatusPathLast();
|
||||
map.put("data2Path", path2);
|
||||
map.put("data2", fileReader(path2));
|
||||
break;
|
||||
case "ckPayStatus":
|
||||
path1 = form.getCkPayStatusPathStandard();
|
||||
map.put("data1Path", path1);
|
||||
map.put("data1", fileReader(path1));
|
||||
path2 = form.getCkPayStatusPathLast();
|
||||
map.put("data2Path", path2);
|
||||
map.put("data2", fileReader(path2));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
case "userTableStatus":
|
||||
path1 = form.getUserTableStatusPathStandard();
|
||||
map.put("data1Path", path1);
|
||||
map.put("data1", fileReader(path1));
|
||||
path2 = form.getUserTableStatusPathLast();
|
||||
map.put("data2Path", path2);
|
||||
map.put("data2", fileReader(path2));
|
||||
break;
|
||||
case "ckIndicateStatus":
|
||||
path1 = form.getCkIndicateStatusPathStandard();
|
||||
map.put("data1Path", path1);
|
||||
map.put("data1", fileReader(path1));
|
||||
path2 = form.getCkIndicateStatusPathLast();
|
||||
map.put("data2Path", path2);
|
||||
map.put("data2", fileReader(path2));
|
||||
break;
|
||||
case "ckPayStatus":
|
||||
path1 = form.getCkPayStatusPathStandard();
|
||||
map.put("data1Path", path1);
|
||||
map.put("data1", fileReader(path1));
|
||||
path2 = form.getCkPayStatusPathLast();
|
||||
map.put("data2Path", path2);
|
||||
map.put("data2", fileReader(path2));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
@ -163,7 +158,8 @@ public class ScriptMakeService implements IScriptMakeService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> handleSqlFile(String type, String opt, String content, SqlFileInfoEntity form) {
|
||||
public Map<String, Object> handleSqlFile(String type, String opt, String content, SqlFileInfoEntity form)
|
||||
throws Exception {
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
String standardPath = "";
|
||||
String lastPath = "";
|
||||
|
@ -171,66 +167,79 @@ public class ScriptMakeService implements IScriptMakeService {
|
|||
map.put("err", "请选择信息系统!");
|
||||
return map;
|
||||
}
|
||||
// 选择哪种类型的 脚本 path 可能 = null
|
||||
// 选择哪种类型的 脚本 path 可能 = null
|
||||
switch (type) {
|
||||
case "userTableStatus":
|
||||
standardPath = form.getUserTableStatusPathStandard();
|
||||
if (null == standardPath || standardPath.isEmpty()) {
|
||||
String spath = FileOperateHelper.addLastSeparator(Configs.SQL_SCRIPT_PATH_STANDARD) + form.getAreaCode().toLowerCase();
|
||||
File file = new File(spath);
|
||||
file.mkdir();
|
||||
standardPath = spath + File.separator + Constant.UserTablespace + form.getAreaCode().toLowerCase() + "_" + form.getSysCode() + ".sql";
|
||||
case "userTableStatus":
|
||||
standardPath = form.getUserTableStatusPathStandard();
|
||||
if (null == standardPath || standardPath.isEmpty()) {
|
||||
String spath = FileOperateHelper.addLastSeparator(Configs.SQL_SCRIPT_PATH_STANDARD)
|
||||
+ form.getAreaCode().toLowerCase();
|
||||
|
||||
File file = new File(spath);
|
||||
if (!file.exists()) {
|
||||
if (!file.mkdirs()) {
|
||||
throw new MyException("文件夹创建失败");
|
||||
}
|
||||
}else {
|
||||
log.info("文件夹已经存在");
|
||||
}
|
||||
lastPath = form.getUserTableStatusPathLast();
|
||||
break;
|
||||
case "ckIndicateStatus":
|
||||
standardPath = form.getCkIndicateStatusPathStandard();
|
||||
if (null == standardPath || standardPath.isEmpty()) {
|
||||
String spath = FileOperateHelper.addLastSeparator(Configs.SQL_SCRIPT_PATH_STANDARD) + form.getAreaCode().toLowerCase();
|
||||
File file = new File(spath);
|
||||
file.mkdir();
|
||||
standardPath = spath + File.separator + Constant.Checkout_Indicate + form.getAreaCode().toLowerCase() + "_" + form.getSysCode() + ".sql";
|
||||
}
|
||||
lastPath = form.getCkIndicateStatusPathLast();
|
||||
break;
|
||||
case "ckPayStatus":
|
||||
standardPath = form.getCkPayStatusPathStandard();
|
||||
if (null == standardPath || standardPath.isEmpty()) {
|
||||
String spath = FileOperateHelper.addLastSeparator(Configs.SQL_SCRIPT_PATH_STANDARD) + form.getAreaCode().toLowerCase();
|
||||
File file = new File(spath);
|
||||
file.mkdir();
|
||||
standardPath = spath + File.separator + Constant.Checkout_Pay + form.getAreaCode().toLowerCase() + "_" + form.getSysCode() + ".sql";
|
||||
}
|
||||
lastPath = form.getCkPayStatusPathLast();
|
||||
break;
|
||||
default:
|
||||
map.put("err", "请选择脚本类型!");
|
||||
break;
|
||||
standardPath = spath + File.separator + Constant.UserTablespace + form.getAreaCode().toLowerCase() + "_"
|
||||
+ form.getSysCode() + ".sql";
|
||||
}
|
||||
lastPath = form.getUserTableStatusPathLast();
|
||||
break;
|
||||
case "ckIndicateStatus":
|
||||
standardPath = form.getCkIndicateStatusPathStandard();
|
||||
if (null == standardPath || standardPath.isEmpty()) {
|
||||
String spath = FileOperateHelper.addLastSeparator(Configs.SQL_SCRIPT_PATH_STANDARD)
|
||||
+ form.getAreaCode().toLowerCase();
|
||||
File file = new File(spath);
|
||||
file.mkdir();
|
||||
standardPath = spath + File.separator + Constant.Checkout_Indicate + form.getAreaCode().toLowerCase()
|
||||
+ "_" + form.getSysCode() + ".sql";
|
||||
}
|
||||
lastPath = form.getCkIndicateStatusPathLast();
|
||||
break;
|
||||
case "ckPayStatus":
|
||||
standardPath = form.getCkPayStatusPathStandard();
|
||||
if (null == standardPath || standardPath.isEmpty()) {
|
||||
String spath = FileOperateHelper.addLastSeparator(Configs.SQL_SCRIPT_PATH_STANDARD)
|
||||
+ form.getAreaCode().toLowerCase();
|
||||
File file = new File(spath);
|
||||
file.mkdir();
|
||||
standardPath = spath + File.separator + Constant.Checkout_Pay + form.getAreaCode().toLowerCase() + "_"
|
||||
+ form.getSysCode() + ".sql";
|
||||
}
|
||||
lastPath = form.getCkPayStatusPathLast();
|
||||
break;
|
||||
default:
|
||||
map.put("err", "请选择脚本类型!");
|
||||
break;
|
||||
}
|
||||
if (map.containsKey("err_opt")) {
|
||||
return map;
|
||||
}
|
||||
switch (opt) {
|
||||
// 删除 最新的 脚本 (审核-保留)
|
||||
case "delete":
|
||||
fileDelete(lastPath);
|
||||
break;
|
||||
// 最新脚本 替换 标准脚本(即 以最新脚本为准 )(归档 或审核-替换)
|
||||
case "replace":
|
||||
FileOperateHelper.fileReWriteGBK(standardPath, fileReader(lastPath));
|
||||
fileDelete(lastPath);
|
||||
break;
|
||||
//新增 标准的脚本(注意 造出 对应的 standardPath standardPath不能 = null '')(上传)
|
||||
case "add":
|
||||
FileOperateHelper.fileReWriteGBK(standardPath,content);
|
||||
break;
|
||||
// (查看)
|
||||
case "read":
|
||||
map = readSql(type, form);
|
||||
break;
|
||||
default:
|
||||
map.put("err", "请选择操作选项!");
|
||||
break;
|
||||
// 删除 最新的 脚本 (审核-保留)
|
||||
case "delete":
|
||||
fileDelete(lastPath);
|
||||
break;
|
||||
// 最新脚本 替换 标准脚本(即 以最新脚本为准 )(归档 或审核-替换)
|
||||
case "replace":
|
||||
FileOperateHelper.fileReWriteGBK(standardPath, fileReader(lastPath));
|
||||
fileDelete(lastPath);
|
||||
break;
|
||||
// 新增 标准的脚本(注意 造出 对应的 standardPath standardPath不能 = null '')(上传)
|
||||
case "add":
|
||||
FileOperateHelper.fileReWriteGBK(standardPath, content);
|
||||
break;
|
||||
// (查看)
|
||||
case "read":
|
||||
map = readSql(type, form);
|
||||
break;
|
||||
default:
|
||||
map.put("err", "请选择操作选项!");
|
||||
break;
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
@ -241,8 +250,8 @@ public class ScriptMakeService implements IScriptMakeService {
|
|||
* @param data
|
||||
* @return
|
||||
*/
|
||||
private Map<String, List<Object>> putSystemByAreaCode(
|
||||
Map<String, List<Object>> map, String code, PreDataInfo data) {
|
||||
private Map<String, List<Object>> putSystemByAreaCode(Map<String, List<Object>> map, String code,
|
||||
PreDataInfo data) {
|
||||
List<Object> list = map.get(code);
|
||||
if (null == list) {
|
||||
list = new ArrayList<Object>();
|
||||
|
@ -255,15 +264,16 @@ public class ScriptMakeService implements IScriptMakeService {
|
|||
/**
|
||||
* 遍历文件
|
||||
*
|
||||
* @param ps must not null
|
||||
* @param ps
|
||||
* must not null
|
||||
* @param path
|
||||
* @return
|
||||
*/
|
||||
public Map<String, String> getAllFile(Map<String, String> ps, Map<String, String> timeMap,String path) {
|
||||
public Map<String, String> getAllFile(Map<String, String> ps, Map<String, String> timeMap, String path) {
|
||||
File f = new File(path);
|
||||
String name = f.getName();
|
||||
// 如果是 sql文件
|
||||
if (name.endsWith(".sql") || name.endsWith(".SQL")){
|
||||
if (name.endsWith(".sql") || name.endsWith(".SQL")) {
|
||||
ps.put(name.toLowerCase(), f.getAbsolutePath());
|
||||
timeMap.put(name.toLowerCase(), DateForm.date2StringBysecond(new Date(f.lastModified())));
|
||||
}
|
||||
|
@ -288,101 +298,84 @@ public class ScriptMakeService implements IScriptMakeService {
|
|||
* @return
|
||||
*/
|
||||
private List<SqlFileInfoEntity> setScript(List<PreDataInfo> systemDataInfo,
|
||||
Map<String, String> sqlFilePathsStandard,
|
||||
Map<String, String> sqlFilePathsLast,Map<String, String> timeMapLast,
|
||||
Map<String, String> timeMapStandard) {
|
||||
Map<String, String> sqlFilePathsStandard, Map<String, String> sqlFilePathsLast,
|
||||
Map<String, String> timeMapLast, Map<String, String> timeMapStandard) {
|
||||
List<SqlFileInfoEntity> fileEntitys = new ArrayList<SqlFileInfoEntity>();
|
||||
for (PreDataInfo preDataInfo : systemDataInfo) {
|
||||
SqlFileInfoEntity myfile = new SqlFileInfoEntity();
|
||||
// 复制
|
||||
BeanCopy.copyBean(preDataInfo, myfile);
|
||||
//---------- 脚本的位置 ------
|
||||
// ---------- 脚本的位置 ------
|
||||
// 归档表空间脚本的位置-
|
||||
String TablePathStandard = getFilePath(Constant.UserTablespace,
|
||||
sqlFilePathsStandard, myfile, ".sql");
|
||||
String TablePathStandard = getFilePath(Constant.UserTablespace, sqlFilePathsStandard, myfile, ".sql");
|
||||
myfile.setUserTableStatusPathStandard(TablePathStandard);
|
||||
// 归档预算 脚本的位置-
|
||||
String indicatePathStandard = getFilePath(Constant.Checkout_Indicate,
|
||||
sqlFilePathsStandard, myfile, ".sql");
|
||||
String indicatePathStandard = getFilePath(Constant.Checkout_Indicate, sqlFilePathsStandard, myfile, ".sql");
|
||||
myfile.setCkIndicateStatusPathStandard(indicatePathStandard);
|
||||
// 归档表空间脚本的位置-
|
||||
String payPathStandard = getFilePath(Constant.Checkout_Pay,
|
||||
sqlFilePathsStandard, myfile, ".sql");
|
||||
String payPathStandard = getFilePath(Constant.Checkout_Pay, sqlFilePathsStandard, myfile, ".sql");
|
||||
myfile.setCkPayStatusPathStandard(payPathStandard);
|
||||
// 最新表空间脚本的位置-
|
||||
String TablePathLast = getFilePath(Constant.UserTablespace,
|
||||
sqlFilePathsLast, myfile, ".sql");
|
||||
String TablePathLast = getFilePath(Constant.UserTablespace, sqlFilePathsLast, myfile, ".sql");
|
||||
myfile.setUserTableStatusPathLast(TablePathLast);
|
||||
// 最新预算 脚本的位置-
|
||||
String indicatePathLast = getFilePath(Constant.Checkout_Indicate,
|
||||
sqlFilePathsLast, myfile, ".sql");
|
||||
String indicatePathLast = getFilePath(Constant.Checkout_Indicate, sqlFilePathsLast, myfile, ".sql");
|
||||
myfile.setCkIndicateStatusPathLast(indicatePathLast);
|
||||
// 最新表空间脚本的位置-
|
||||
String payPathLast = getFilePath(Constant.Checkout_Pay, sqlFilePathsLast,
|
||||
myfile, ".sql");
|
||||
String payPathLast = getFilePath(Constant.Checkout_Pay, sqlFilePathsLast, myfile, ".sql");
|
||||
myfile.setCkPayStatusPathLast(payPathLast);
|
||||
|
||||
//-------文件最后更新-时间-------
|
||||
// 时间
|
||||
String uttimeStandard = getFilePath(Constant.UserTablespace,
|
||||
timeMapStandard, myfile, ".sql");
|
||||
|
||||
// -------文件最后更新-时间-------
|
||||
// 时间
|
||||
String uttimeStandard = getFilePath(Constant.UserTablespace, timeMapStandard, myfile, ".sql");
|
||||
myfile.setUserTableStatusStandardModified(uttimeStandard);
|
||||
// 归档预算 脚本的时间-
|
||||
String indicateTimeStandard = getFilePath(Constant.Checkout_Indicate,
|
||||
timeMapStandard, myfile, ".sql");
|
||||
String indicateTimeStandard = getFilePath(Constant.Checkout_Indicate, timeMapStandard, myfile, ".sql");
|
||||
myfile.setCkIndicateStatusStandardModified(indicateTimeStandard);
|
||||
// 归档表空间脚本的时间-
|
||||
String payTimeStandard = getFilePath(Constant.Checkout_Pay,
|
||||
timeMapStandard, myfile, ".sql");
|
||||
String payTimeStandard = getFilePath(Constant.Checkout_Pay, timeMapStandard, myfile, ".sql");
|
||||
myfile.setCkPayStatusStandardModified(payTimeStandard);
|
||||
// 最新表空间脚本的时间-
|
||||
String utTimeLast = getFilePath(Constant.UserTablespace,
|
||||
timeMapLast, myfile, ".sql");
|
||||
String utTimeLast = getFilePath(Constant.UserTablespace, timeMapLast, myfile, ".sql");
|
||||
myfile.setUserTableStatusLastModified(utTimeLast);
|
||||
// 最新预算 脚本的时间-
|
||||
String indicateTimeLast = getFilePath(Constant.Checkout_Indicate,
|
||||
timeMapLast, myfile, ".sql");
|
||||
String indicateTimeLast = getFilePath(Constant.Checkout_Indicate, timeMapLast, myfile, ".sql");
|
||||
myfile.setCkIndicateStatusLastModified(indicateTimeLast);
|
||||
// 最新表空间脚本的时间-
|
||||
String payTimeLast = getFilePath(Constant.Checkout_Pay, timeMapLast,
|
||||
myfile, ".sql");
|
||||
String payTimeLast = getFilePath(Constant.Checkout_Pay, timeMapLast, myfile, ".sql");
|
||||
myfile.setCkPayStatusLastModified(payTimeLast);
|
||||
// 设置 状态
|
||||
if (null != myfile.getDataBaseType()) {
|
||||
if ("ORACLE".equals(myfile.getDataBaseType().toUpperCase())) {
|
||||
myfile.setUserTableStatus(getStatus(
|
||||
myfile.getUserTableStatusPathStandard(),
|
||||
myfile.getUserTableStatusPathLast()));
|
||||
myfile.setUserTableStatus(
|
||||
getStatus(myfile.getUserTableStatusPathStandard(), myfile.getUserTableStatusPathLast()));
|
||||
} else {
|
||||
myfile.setUserTableStatus(4);
|
||||
}
|
||||
}
|
||||
myfile.setCkIndicateStatus(getStatus(
|
||||
myfile.getCkIndicateStatusPathStandard(),
|
||||
myfile.getCkIndicateStatusPathLast()));
|
||||
myfile.setCkPayStatus(getStatus(
|
||||
myfile.getCkPayStatusPathStandard(),
|
||||
myfile.getCkPayStatusPathLast()));
|
||||
myfile.setCkIndicateStatus(
|
||||
getStatus(myfile.getCkIndicateStatusPathStandard(), myfile.getCkIndicateStatusPathLast()));
|
||||
myfile.setCkPayStatus(getStatus(myfile.getCkPayStatusPathStandard(), myfile.getCkPayStatusPathLast()));
|
||||
myfile.setSysStatus(getTotalStatus(myfile));
|
||||
fileEntitys.add(myfile);
|
||||
}
|
||||
// Compare4SqlFilesEntity com = new Compare4SqlFilesEntity();
|
||||
// System.setProperty("java.util.Arrays.useLegacyMergeSort", "true");
|
||||
// Collections.sort(fileEntitys, com);
|
||||
// Collections.sort(fileEntitys);
|
||||
// Compare4SqlFilesEntity com = new Compare4SqlFilesEntity();
|
||||
// System.setProperty("java.util.Arrays.useLegacyMergeSort", "true");
|
||||
// Collections.sort(fileEntitys, com);
|
||||
// Collections.sort(fileEntitys);
|
||||
List<ArrayList<SqlFileInfoEntity>> tmpList = new ArrayList<ArrayList<SqlFileInfoEntity>>();
|
||||
for (int i = 0; i < 4; i++) {
|
||||
tmpList.add(new ArrayList<SqlFileInfoEntity>());
|
||||
}
|
||||
|
||||
|
||||
for (SqlFileInfoEntity sqlFileInfoEntity : fileEntitys) {
|
||||
tmpList.get(sqlFileInfoEntity.getSysStatus()).add(sqlFileInfoEntity);
|
||||
}
|
||||
ArrayList<SqlFileInfoEntity> result = new ArrayList<SqlFileInfoEntity>();
|
||||
for (int i = (tmpList.size()-1); i >= 0; i--) {
|
||||
for (int i = (tmpList.size() - 1); i >= 0; i--) {
|
||||
result.addAll(tmpList.get(i));
|
||||
}
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -395,11 +388,9 @@ public class ScriptMakeService implements IScriptMakeService {
|
|||
* @param affix
|
||||
* @return
|
||||
*/
|
||||
private String getFilePath(String prefix, Map<String, String> map,
|
||||
SqlFileInfoEntity myf, String affix) {
|
||||
private String getFilePath(String prefix, Map<String, String> map, SqlFileInfoEntity myf, String affix) {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
sb.append(prefix).append(myf.getAreaCode().toLowerCase()).append("_")
|
||||
.append(myf.getSysCode()).append(affix);
|
||||
sb.append(prefix).append(myf.getAreaCode().toLowerCase()).append("_").append(myf.getSysCode()).append(affix);
|
||||
String fileName = sb.toString().toLowerCase();
|
||||
if (!map.containsKey(fileName)) {
|
||||
return null;
|
||||
|
@ -441,13 +432,12 @@ public class ScriptMakeService implements IScriptMakeService {
|
|||
Integer result = 1;
|
||||
if ("ORACLE".equals(myfile.getDataBaseType().toUpperCase())) {
|
||||
numArr = new Integer[3];
|
||||
numArr[2]= myfile.getUserTableStatus();
|
||||
}
|
||||
else {
|
||||
numArr[2] = myfile.getUserTableStatus();
|
||||
} else {
|
||||
numArr = new Integer[2];
|
||||
}
|
||||
numArr[0]= myfile.getCkPayStatus();
|
||||
numArr[1]= myfile.getCkIndicateStatus();
|
||||
numArr[0] = myfile.getCkPayStatus();
|
||||
numArr[1] = myfile.getCkIndicateStatus();
|
||||
for (Integer integer : numArr) {
|
||||
if (integer != 1) {
|
||||
result = integer;
|
||||
|
@ -491,19 +481,21 @@ public class ScriptMakeService implements IScriptMakeService {
|
|||
public Map<String, Object> totalOnholeSqlFile(List<SqlFileInfoEntity> forms) {
|
||||
Map<String, Object> errMap = new HashMap<String, Object>();
|
||||
List<String> errlist = new ArrayList<String>();
|
||||
//待归档 status = 2
|
||||
// 待归档 status = 2
|
||||
for (SqlFileInfoEntity sqlFile : forms) {
|
||||
// 用户表空间脚本
|
||||
if (sqlFile.getUserTableStatus() == 2) {
|
||||
String standardPath = sqlFile.getUserTableStatusPathStandard();
|
||||
if (null == standardPath || standardPath.isEmpty()) {
|
||||
String spath = FileOperateHelper.addLastSeparator(Configs.SQL_SCRIPT_PATH_STANDARD) + sqlFile.getAreaCode().toLowerCase();
|
||||
String spath = FileOperateHelper.addLastSeparator(Configs.SQL_SCRIPT_PATH_STANDARD)
|
||||
+ sqlFile.getAreaCode().toLowerCase();
|
||||
File file = new File(spath);
|
||||
file.mkdir();
|
||||
standardPath = spath + File.separator + Constant.UserTablespace + sqlFile.getAreaCode().toLowerCase() + "_" + sqlFile.getSysCode() + ".sql";
|
||||
standardPath = spath + File.separator + Constant.UserTablespace
|
||||
+ sqlFile.getAreaCode().toLowerCase() + "_" + sqlFile.getSysCode() + ".sql";
|
||||
}
|
||||
String lastPath = sqlFile.getUserTableStatusPathLast();
|
||||
if(!FileOperateHelper.singleFileMove(lastPath, standardPath)){
|
||||
if (!FileOperateHelper.singleFileMove(lastPath, standardPath)) {
|
||||
errlist.add(lastPath);
|
||||
}
|
||||
}
|
||||
|
@ -511,27 +503,31 @@ public class ScriptMakeService implements IScriptMakeService {
|
|||
if (sqlFile.getCkPayStatus() == 2) {
|
||||
String standardPath = sqlFile.getCkPayStatusPathStandard();
|
||||
if (null == standardPath || standardPath.isEmpty()) {
|
||||
String spath = FileOperateHelper.addLastSeparator(Configs.SQL_SCRIPT_PATH_STANDARD) + sqlFile.getAreaCode().toLowerCase();
|
||||
String spath = FileOperateHelper.addLastSeparator(Configs.SQL_SCRIPT_PATH_STANDARD)
|
||||
+ sqlFile.getAreaCode().toLowerCase();
|
||||
File file = new File(spath);
|
||||
file.mkdir();
|
||||
standardPath = spath + File.separator + Constant.Checkout_Pay + sqlFile.getAreaCode().toLowerCase() + "_" + sqlFile.getSysCode() + ".sql";
|
||||
standardPath = spath + File.separator + Constant.Checkout_Pay + sqlFile.getAreaCode().toLowerCase()
|
||||
+ "_" + sqlFile.getSysCode() + ".sql";
|
||||
}
|
||||
String lastPath = sqlFile.getCkPayStatusPathLast();
|
||||
if(!FileOperateHelper.singleFileMove(lastPath, standardPath)){
|
||||
if (!FileOperateHelper.singleFileMove(lastPath, standardPath)) {
|
||||
errlist.add(lastPath);
|
||||
}
|
||||
}
|
||||
// 可执行脚本
|
||||
// 可执行脚本
|
||||
if (sqlFile.getCkIndicateStatus() == 2) {
|
||||
String standardPath = sqlFile.getCkIndicateStatusPathStandard();
|
||||
if (null == standardPath || standardPath.isEmpty()) {
|
||||
String spath = FileOperateHelper.addLastSeparator(Configs.SQL_SCRIPT_PATH_STANDARD) + sqlFile.getAreaCode().toLowerCase();
|
||||
String spath = FileOperateHelper.addLastSeparator(Configs.SQL_SCRIPT_PATH_STANDARD)
|
||||
+ sqlFile.getAreaCode().toLowerCase();
|
||||
File file = new File(spath);
|
||||
file.mkdir();
|
||||
standardPath = spath + File.separator + Constant.Checkout_Indicate + sqlFile.getAreaCode().toLowerCase() + "_" + sqlFile.getSysCode() + ".sql";
|
||||
standardPath = spath + File.separator + Constant.Checkout_Indicate
|
||||
+ sqlFile.getAreaCode().toLowerCase() + "_" + sqlFile.getSysCode() + ".sql";
|
||||
}
|
||||
String lastPath = sqlFile.getCkIndicateStatusPathLast();
|
||||
if(!FileOperateHelper.singleFileMove(lastPath, standardPath)){
|
||||
if (!FileOperateHelper.singleFileMove(lastPath, standardPath)) {
|
||||
errlist.add(lastPath);
|
||||
}
|
||||
}
|
||||
|
@ -546,19 +542,21 @@ public class ScriptMakeService implements IScriptMakeService {
|
|||
public Map<String, Object> totalVerifySqlFile(List<SqlFileInfoEntity> forms) {
|
||||
Map<String, Object> errMap = new HashMap<String, Object>();
|
||||
List<String> errlist = new ArrayList<String>();
|
||||
//待归档 status = 2
|
||||
// 待归档 status = 2
|
||||
for (SqlFileInfoEntity sqlFile : forms) {
|
||||
// 用户表空间脚本
|
||||
if (sqlFile.getUserTableStatus() == 3) {
|
||||
String standardPath = sqlFile.getUserTableStatusPathStandard();
|
||||
if (null == standardPath || standardPath.isEmpty()) {
|
||||
String spath = FileOperateHelper.addLastSeparator(Configs.SQL_SCRIPT_PATH_STANDARD) + sqlFile.getAreaCode().toLowerCase();
|
||||
String spath = FileOperateHelper.addLastSeparator(Configs.SQL_SCRIPT_PATH_STANDARD)
|
||||
+ sqlFile.getAreaCode().toLowerCase();
|
||||
File file = new File(spath);
|
||||
file.mkdir();
|
||||
standardPath = spath + File.separator + Constant.UserTablespace + sqlFile.getAreaCode().toLowerCase() + "_" + sqlFile.getSysCode() + ".sql";
|
||||
standardPath = spath + File.separator + Constant.UserTablespace
|
||||
+ sqlFile.getAreaCode().toLowerCase() + "_" + sqlFile.getSysCode() + ".sql";
|
||||
}
|
||||
String lastPath = sqlFile.getUserTableStatusPathLast();
|
||||
if(!FileOperateHelper.singleFileMove(lastPath, standardPath)){
|
||||
if (!FileOperateHelper.singleFileMove(lastPath, standardPath)) {
|
||||
errlist.add(lastPath);
|
||||
}
|
||||
}
|
||||
|
@ -566,27 +564,31 @@ public class ScriptMakeService implements IScriptMakeService {
|
|||
if (sqlFile.getCkPayStatus() == 3) {
|
||||
String standardPath = sqlFile.getCkPayStatusPathStandard();
|
||||
if (null == standardPath || standardPath.isEmpty()) {
|
||||
String spath = FileOperateHelper.addLastSeparator(Configs.SQL_SCRIPT_PATH_STANDARD) + sqlFile.getAreaCode().toLowerCase();
|
||||
String spath = FileOperateHelper.addLastSeparator(Configs.SQL_SCRIPT_PATH_STANDARD)
|
||||
+ sqlFile.getAreaCode().toLowerCase();
|
||||
File file = new File(spath);
|
||||
file.mkdir();
|
||||
standardPath = spath + File.separator + Constant.Checkout_Pay + sqlFile.getAreaCode().toLowerCase() + "_" + sqlFile.getSysCode() + ".sql";
|
||||
standardPath = spath + File.separator + Constant.Checkout_Pay + sqlFile.getAreaCode().toLowerCase()
|
||||
+ "_" + sqlFile.getSysCode() + ".sql";
|
||||
}
|
||||
String lastPath = sqlFile.getCkPayStatusPathLast();
|
||||
if(!FileOperateHelper.singleFileMove(lastPath, standardPath)){
|
||||
if (!FileOperateHelper.singleFileMove(lastPath, standardPath)) {
|
||||
errlist.add(lastPath);
|
||||
}
|
||||
}
|
||||
// 可执行脚本
|
||||
// 可执行脚本
|
||||
if (sqlFile.getCkIndicateStatus() == 3) {
|
||||
String standardPath = sqlFile.getCkIndicateStatusPathStandard();
|
||||
if (null == standardPath || standardPath.isEmpty()) {
|
||||
String spath = FileOperateHelper.addLastSeparator(Configs.SQL_SCRIPT_PATH_STANDARD) + sqlFile.getAreaCode().toLowerCase();
|
||||
String spath = FileOperateHelper.addLastSeparator(Configs.SQL_SCRIPT_PATH_STANDARD)
|
||||
+ sqlFile.getAreaCode().toLowerCase();
|
||||
File file = new File(spath);
|
||||
file.mkdir();
|
||||
standardPath = spath + File.separator + Constant.Checkout_Indicate + sqlFile.getAreaCode().toLowerCase() + "_" + sqlFile.getSysCode() + ".sql";
|
||||
standardPath = spath + File.separator + Constant.Checkout_Indicate
|
||||
+ sqlFile.getAreaCode().toLowerCase() + "_" + sqlFile.getSysCode() + ".sql";
|
||||
}
|
||||
String lastPath = sqlFile.getCkIndicateStatusPathLast();
|
||||
if(!FileOperateHelper.singleFileMove(lastPath, standardPath)){
|
||||
if (!FileOperateHelper.singleFileMove(lastPath, standardPath)) {
|
||||
errlist.add(lastPath);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,6 +31,10 @@ public class FileOperateHelper {
|
|||
}
|
||||
try {
|
||||
File file = new File(path);
|
||||
File fileParent = file.getParentFile();
|
||||
if (!fileParent.exists()) {
|
||||
fileParent.mkdirs();
|
||||
}
|
||||
if (!file.exists()) {
|
||||
file.createNewFile();
|
||||
}
|
||||
|
|
|
@ -36,7 +36,13 @@ public class FileOperationTest {
|
|||
f3.mkdir();
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void fileCreate2() {
|
||||
File f = new File("\\DefaultDescription\\320282");
|
||||
|
||||
System.out.println(f.mkdir());
|
||||
|
||||
}
|
||||
@Test
|
||||
public void reWriteFile() {
|
||||
|
||||
|
|
Loading…
Reference in New Issue