注释,修改抽取连接未关闭的bug,任务增加可批量删除

web_backend_develope
chenlw 8 years ago
parent ddfa02a55f
commit 26c34ebfc0

@ -58,7 +58,7 @@ public class CheckoutController extends BaseController {
} }
/** /**
* ---- * ----
* @return * @return
* @throws Exception * @throws Exception
*/ */
@ -95,7 +95,7 @@ public class CheckoutController extends BaseController {
} }
/** /**
* ---- * ----
* @return * @return
* @throws Exception * @throws Exception
*/ */
@ -116,7 +116,7 @@ public class CheckoutController extends BaseController {
} }
/** /**
* ---- -> * ----( )
* @return * @return
* @throws Exception * @throws Exception
*/ */

@ -381,7 +381,7 @@ public class DataModelController extends BaseController {
} }
/** /**
* *
* *
* @return * @return
* @throws Exception * @throws Exception
@ -414,6 +414,32 @@ public class DataModelController extends BaseController {
req.setStatus(200); req.setStatus(200);
return result; return result;
} }
/**
*
*
* @param res
* @param req
* @param id
* @return
* @throws Exception
*/
@RequestMapping(value = "/task/transfer/deletes", method = RequestMethod.POST)
@ResponseBody
public Object taskTransferDeletes(HttpServletRequest res,
HttpServletResponse req, @RequestBody String[] ids) throws Exception {
log.info("---------/task/transfer/deletes----------------------");
req.setStatus(200);
int result = 0;
if (ids != null ) {
// String[] ids = idsString.split(",");
result = moveDataService.delete(ids);
}
else {
req.setStatus(500);
}
return result;
}
/** /**
* *

@ -39,13 +39,13 @@ public class PagerOptions extends Page{
private Integer offset; // 查询偏移量起始id private Integer offset; // 查询偏移量起始id
private String keyQuery; private String keyQuery;//模糊查询字段
//模糊查询字段
private List<String> array;
private String volumeType; private List<String> array;//模糊查询字段数组
//冷热区字段
private String mark; private String volumeType;//冷热区字段
private String mark;//冷热区字段
public String getDataType() { public String getDataType() {
return dataType; return dataType;

@ -5,10 +5,20 @@ import java.util.Properties;
import com.platform.entities.SqlFileInfoEntity; import com.platform.entities.SqlFileInfoEntity;
/**
* @author chen
*
*/
public class ScriptForm { public class ScriptForm {
/**
*
*/
private String content; private String content;
/**
*
*/
private SqlFileInfoEntity item; private SqlFileInfoEntity item;
/** /**

@ -29,9 +29,9 @@ public class VolumeForm {
/** 挂载点 */ /** 挂载点 */
private String path; private String path;
/** * exist正常返回状态Started,Stopped,Created */
private boolean status; private boolean status;
/** * exist正常返回状态Started,Stopped,Created */
private String type; private String type;
/** volume树形目录 */ /** volume树形目录 */

@ -5,16 +5,25 @@ import java.util.List;
import com.platform.entities.DataInfoEntity; import com.platform.entities.DataInfoEntity;
import com.platform.entities.FolderNode; import com.platform.entities.FolderNode;
/**--volume /**--
* @author chen * @author chen
* *
*/ */
public class volumeMoveForm { public class volumeMoveForm {
/**
* volume
*/
private String name; private String name;
/**
*
*/
private FolderNode selectNode; private FolderNode selectNode;
/**
*
*/
private List<DataInfoEntity> selectItems; private List<DataInfoEntity> selectItems;
/** /**

@ -32,6 +32,12 @@ public interface IMoveDataService {
*/ */
public int delete(DataInfoEntityMoveTmp dataMove) throws Exception; public int delete(DataInfoEntityMoveTmp dataMove) throws Exception;
/**
* @return
* @throws Exception
*/
public int delete(String... ids) throws Exception;
/** -- /** --
* @param data * @param data
* @return * @return

@ -210,11 +210,14 @@ public class MoveDataServiceImpl implements IMoveDataService {
} }
} }
int result = 0;
//迁移失败 //迁移失败
if ("3".equals(dataMove.getCompleteStatus())) { if ("3".equals(dataMove.getCompleteStatus())) {
removeservice.deleteFolder(dataMove.getDstPath()); int code = removeservice.deleteFolder(dataMove.getDstPath());
if (code == -100) {
return result;
}
} }
int result = 0;
//是正则迁移时: //是正则迁移时:
if ("1".equals(dataMove.getCompleteStatus())) { if ("1".equals(dataMove.getCompleteStatus())) {
if(1 != removeservice.abortcopyFolder(dataMove.getDataPath(), makeDstPath(dataMove.getDstPath()))){ if(1 != removeservice.abortcopyFolder(dataMove.getDataPath(), makeDstPath(dataMove.getDstPath()))){
@ -263,4 +266,42 @@ public class MoveDataServiceImpl implements IMoveDataService {
} }
return dstPath; return dstPath;
} }
@Override
public int delete(String... ids) throws Exception {
List<DataInfoEntityMoveTmp> list = dataInfoMoveTmpDao.findAll();
List<DataInfoEntityMoveTmp> dellist = new ArrayList<DataInfoEntityMoveTmp>();
if (null != list) {
for (DataInfoEntityMoveTmp dataInfoEntityMoveTmp : list) {
for (String id : ids) {
if (Integer.valueOf(id) == dataInfoEntityMoveTmp.getId()) {
dellist.add(dataInfoEntityMoveTmp);
}
}
}
}
int result = 0;
for (DataInfoEntityMoveTmp dataMove : dellist) {
//迁移失败
if ("3".equals(dataMove.getCompleteStatus())) {
int code = removeservice.deleteFolder(dataMove.getDstPath());
if (code == -100) {
continue;
}
}
//是正则迁移时:
if ("1".equals(dataMove.getCompleteStatus())) {
if(1 != removeservice.abortcopyFolder(dataMove.getDataPath(), makeDstPath(dataMove.getDstPath()))){
try{
removeservice.deleteFolder(dataMove.getDstPath());
}catch(Exception e){
log.error(e);
}
}
}
result = dataInfoMoveTmpDao.remove(dataMove.getId());
}
return result;
}
} }

@ -331,6 +331,7 @@ public class OracleExtractServiceImpl implements IOracleExtractService {
dataInfoDao.update(data); dataInfoDao.update(data);
log.error(Custom4exception.OracleSQL_Except, e); log.error(Custom4exception.OracleSQL_Except, e);
} finally { } finally {
conn.close();
// 去掉保存的当前数据id, // 去掉保存的当前数据id,
CacheSetCantDelete.removeStandardId(collectOracle.getDataId()); CacheSetCantDelete.removeStandardId(collectOracle.getDataId());
String msg = "抽取标准表结束"; String msg = "抽取标准表结束";

@ -8,6 +8,7 @@ import java.io.IOException;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.sql.Connection; import java.sql.Connection;
import java.sql.SQLException;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
@ -154,10 +155,11 @@ public class ThreadExtractStandardSqlServer extends Thread{
// TODO Auto-generated catch block // TODO Auto-generated catch block
e.printStackTrace(); e.printStackTrace();
} }
Connection conn = null;
try { try {
File execSql = new File(execFilePath); conn = OracleConnector.connectionBuilder("jdbc:oracle:thin:@" + oracleConnect.getIp() + ":" + oracleConnect.getPort() + ":"
Connection conn = OracleConnector.connectionBuilder("jdbc:oracle:thin:@" + oracleConnect.getIp() + ":" + oracleConnect.getPort() + ":"
+ oracleConnect.getDatabaseName(), oracleConnect.getUser(), oracleConnect.getPassword(), null); + oracleConnect.getDatabaseName(), oracleConnect.getUser(), oracleConnect.getPassword(), null);
File execSql = new File(execFilePath);
// 创建表空间 创建 抽取标准表的 用户并授权 // 创建表空间 创建 抽取标准表的 用户并授权
oracleExtract.createTableSpace(conn, collectOracle , oracleConnect); // oracleExtract.createTableSpace(conn, collectOracle , oracleConnect); //
oracleExtract.createOnlyUser(conn, collectOracle, oracleConnect);// oracleExtract.createOnlyUser(conn, collectOracle, oracleConnect);//
@ -199,8 +201,17 @@ public class ThreadExtractStandardSqlServer extends Thread{
// TODO Auto-generated catch block // TODO Auto-generated catch block
e.printStackTrace(); e.printStackTrace();
} }
finally{
try {
conn.close();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
} }
//删除保存过的id //删除保存过的id
CacheSetCantDelete.removeStandardId(String.valueOf(element.getDataId())); CacheSetCantDelete.removeStandardId(String.valueOf(element.getDataId()));
// sql日志记录时间 // sql日志记录时间

Loading…
Cancel
Save