--完善功能

This commit is contained in:
wu ming 2016-09-20 18:52:11 +08:00
parent e42e9b9554
commit faadafadfd
6 changed files with 47 additions and 40 deletions

View File

@ -2,7 +2,7 @@
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="test"/>
<classpathentry kind="con" path="org.eclipse.jst.server.core.container/org.eclipse.jst.server.tomcat.runtimeTarget/Apache Tomcat v7.0">
<classpathentry kind="con" path="org.eclipse.jst.server.core.container/org.eclipse.jst.server.tomcat.runtimeTarget/Apache Tomcat v8.5">
<attributes>
<attribute name="owner.project.facets" value="jst.web"/>
</attributes>

View File

@ -44,7 +44,7 @@ public class BaseController {
public Object exp(HttpServletRequest request, HttpServletResponse response,Exception ex) {
System.out.println("URI"+request.getRequestURI());
request.setAttribute("ex", ex);
System.err.println("BaseController --exp ");
System.err.println("BaseController --exp " + ex);
// 根据不同错误转向不同页面
if(ex instanceof CustomException) {
CustomException cuse = (CustomException) ex;

View File

@ -21,6 +21,7 @@ import org.springframework.web.bind.annotation.PathVariable;
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 com.base.BaseController;
@ -132,17 +133,14 @@ public class DataModelController extends BaseController{
@RequestMapping(value="/oracle/{name}/extract", method= RequestMethod.POST)
public void oracleExtract(HttpServletRequest res,
HttpServletResponse req,@PathVariable String name) throws Exception {
res.setCharacterEncoding("UTF-8");
System.out.println("------extract-------");
System.out.println(name);
res.setCharacterEncoding("UTF-8");
Map<String, String[]> paramMap = res.getParameterMap();
//汇总库 对象信息--带有tableName-
String[] nodes = paramMap.get("target");
Map map = null;
for (String string : nodes) {
JSONObject jsonobject = JSONObject.fromObject(string);
map = jsonobject;
System.out.println(map);
map = jsonobject;
}
// 采集库对象--(多个采集库抽取到1个汇总库的1个tableName下)
@ -194,35 +192,32 @@ public class DataModelController extends BaseController{
@RequestMapping(value = "/volume/{name}/move", method= RequestMethod.POST)
public void volumeMove(HttpServletRequest res, HttpServletResponse req,@PathVariable String name,
FolderNode selectNode, DataInfoEntity selectItems) throws Exception {
res.setCharacterEncoding("UTF-8");
System.out.println("get Request");
res.setCharacterEncoding("UTF-8");
Map<String, String[]> paramMap = res.getParameterMap();
// System.out.println(paramMap);
String[] nodes = paramMap.get("selectNode");
Map map = null;
for (String string : nodes) {
System.out.println(string);
for (String string : nodes) {
JSONObject jsonobject = JSONObject.fromObject(string);
map = jsonobject;
}
String dstVolume = (String) map.get("volume");
List<String> listItemPath = new ArrayList<String>();
String[] items = paramMap.get("selectItems");
System.out.println("selectItems");
String[] items = paramMap.get("selectItems");
List<DataInfoEntity> datas = new ArrayList<DataInfoEntity>();
List<String> srcVolumes = new ArrayList<String>();
for (String string : items) {
System.out.println(string);
for (String string : items) {
JSONObject jsobj = JSONObject.fromObject(string);
Map itemmap = jsobj;
DataInfoEntity data = (DataInfoEntity) Bean2MapUtils.convertMap(DataInfoEntity.class, itemmap);
datas.add(data);
}
System.out.println("------/volume/{name}/move--------");
}
if (datas.size() >0) {
moveDataService.moveData(datas, (String)map.get("path"));
}
req.setStatus(200);
}
// public Object volumeMove(HttpServletRequest res, HttpServletResponse req, String name,
// @RequestBody FolderNode selectNode, @RequestBody List<DataInfoEntity> selectItems) throws Exception {
@ -250,22 +245,23 @@ public class DataModelController extends BaseController{
@RequestMapping(value="/oracle/list", method= RequestMethod.POST)
@ResponseBody
public List<GatherOracleInfo> oracleList() throws Exception {
log.debug("----------getOracleInfo-----------------------");
log.info("----------getOracleInfo-----------------------");
List<GatherOracleInfo> result = mySqlService.findAllMySql();
return result;
}
@RequestMapping(value="/oracle/{id}/delete", method= RequestMethod.POST)
public void oracleDelete(@PathVariable String id) throws Exception {
log.debug("----------deleteOracleInfo----------------");
public void oracleDelete(@PathVariable String id, HttpServletRequest res, HttpServletResponse req) throws Exception {
log.info("----------deleteOracleInfo----------------");
Integer num = Integer.valueOf(id);
mySqlService.deleteMySql(num);
req.setStatus(200);
}
@RequestMapping(value="/oracle/{id}/insert", method= RequestMethod.POST)
@ResponseBody
public void oracleInsert(@PathVariable String id, @RequestBody GatherOracleInfo oracle) throws Exception {
log.debug("----------insertOracleInfo----------------");
log.info("----------insertOracleInfo----------------");
oracle.setId(Integer.valueOf(id));
mySqlService.insertOracle(oracle);
}
@ -273,7 +269,7 @@ public class DataModelController extends BaseController{
@RequestMapping(value="/oracle/{id}/update", method= RequestMethod.POST)
@ResponseBody
public void oracleUpdate(@PathVariable("id") String id, @RequestBody GatherOracleInfo oracle) throws Exception {
log.debug("----------updateOracleInfo-----------------------");
log.info("----------updateOracleInfo-----------------------");
log.debug(oracle);
mySqlService.updateOracle(oracle);
}
@ -281,7 +277,7 @@ public class DataModelController extends BaseController{
@RequestMapping(value="/task/transfer/list", method= RequestMethod.POST)
@ResponseBody
public Object taskTransferList() throws Exception {
log.debug("----------/task/transfer/list-----------------------");
//log.info("----------/task/transfer/list-----------------------");
List<DataInfoEntityMoveTmp> result = moveDataService.findAll();
return result;
}
@ -289,7 +285,7 @@ public class DataModelController extends BaseController{
@RequestMapping(value="/task/transfer/{id}/delete", method= RequestMethod.POST)
@ResponseBody
public Object taskTransferDelete(@PathVariable String id) throws Exception {
log.debug("----------/task/transfer/{id}/delete-----------------------");
log.info("----------/task/transfer/{id}/delete-----------------------");
DataInfoEntityMoveTmp move = new DataInfoEntityMoveTmp();
move.setId(Integer.valueOf(id));
int result = moveDataService.delete(move );
@ -299,7 +295,7 @@ public class DataModelController extends BaseController{
@RequestMapping(value="/task/transfer/save", method= RequestMethod.POST)
@ResponseBody
public Object taskTransferSave(@RequestBody DataInfoEntity move) throws Exception {
log.debug("---------/task/transfer/save-----------------------");
log.info("---------/task/transfer/save-----------------------");
int result = dfs.save(move);
return result;
}
@ -307,8 +303,19 @@ public class DataModelController extends BaseController{
@RequestMapping(value="/code/list", method= RequestMethod.POST)
@ResponseBody
public Object findCodeList() throws Exception {
log.debug("---------/findSystemCode-----------------------");
log.info("---------/findSystemCode-----------------------");
Map<String, Object> result = codeService.findAll();
return result;
}
@RequestMapping(value = "/oracle/extract/log", method= RequestMethod.POST )
@ResponseBody
public Object getExtractLog(@RequestParam("rcName") String name, HttpServletRequest res, HttpServletResponse req){
log.info("---------/oracle/extract/log-------------------");
StringBuilder sb = new StringBuilder();
sb.append("查看相应日志").append("\n").append("看到了");
Map<String, String> log = new HashMap<>();
log.put(name, sb.toString());
return log;
}
}

View File

@ -8,7 +8,6 @@ import java.util.regex.Pattern;
import javax.annotation.Resource;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
@ -21,8 +20,6 @@ import com.platform.glusterfs.CopyData;
import com.platform.glusterfs.RemoveData;
import com.platform.glusterfs.ShowData;
import com.platform.service.IMoveDataService;
import com.platform.utils.Bean2MapUtils;
import com.platform.utils.Constant;
import com.platform.utils.DateForm;
@Component

View File

@ -7,9 +7,9 @@ import java.util.Map;
import org.springframework.stereotype.Service;
import com.platform.entities.DataInfoEntity;
import com.platform.entities.GatherOracleInfo;
import com.platform.entities.OracleConnectorParams;
import com.platform.kubernetes.SimpleKubeClient;
import com.platform.oracle.OracleConnector;
import com.platform.service.IOracleExtractService;
import com.platform.service.OracleExtractHelper;
@ -17,7 +17,10 @@ import com.platform.utils.Bean2MapUtils;
@Service(value = "OracleExtract")
public class OracleExtractServiceImpl implements IOracleExtractService {
/**
* kubernetes client
*/
private SimpleKubeClient client = new SimpleKubeClient();
/**
* 抽取
*/
@ -44,14 +47,14 @@ public class OracleExtractServiceImpl implements IOracleExtractService {
}
Connection conn = OracleConnector.ConnectionBuilder("jdbc:oracle:thin:@" + oracleModel.getIp() + ":" + oracleModel.getPort() + "/"
+ oracleModel.getDatabaseName(), oracleModel.getUser(), oracleModel.getPassword());
for (OracleConnectorParams collectOracle : datainfos) {
oracleExtract.createDBLink(conn, collectOracle);
oracleExtract.createTableSpace(conn, oracleModel);
oracleExtract.createUser(conn, oracleModel);
oracleExtract.extractColleDB(conn, collectOracle);
+ oracleModel.getDatabaseName(), oracleModel.getUser(), oracleModel.getPassword());
for (OracleConnectorParams collectOracle : datainfos) {
client.updateOrAddReplicasLabelById(collectOracle.getName(), "isExtract", "1"); //更新oracle汇总状态0标示为未汇总1标示汇总中2标示汇总完成
oracleExtract.createDBLink(conn, collectOracle); //创建dblink
oracleExtract.createTableSpace(conn, oracleModel); //创建表空间
oracleExtract.createUser(conn, oracleModel);//创建用户并授权
oracleExtract.extractColleDB(conn, collectOracle);//执行抽取
client.updateOrAddReplicasLabelById(collectOracle.getName(), "isExtract", "2"); //更新oracle汇总状态0标示为未汇总1标示汇总中2标示汇总完成
}
isSuccess = true;
}catch(Exception e){

View File

@ -5,7 +5,7 @@ package com.platform.utils;
public class Constant {
public static String rootUser = "root";
public static String rootPasswd = "root";
public static String hostIp = "192.168.0.116";
public static String hostIp = "192.168.0.110";
// public static String hostIp = "192.168.1.105";
public static int port = 22;
public static String glusterPeerStatus = "gluster peer status";