|
|
|
@ -2,6 +2,7 @@ package com.platform.controller;
|
|
|
|
|
|
|
|
|
|
import java.io.UnsupportedEncodingException;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
@ -11,11 +12,15 @@ import javax.annotation.Resource;
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
|
|
|
|
|
import net.sf.json.JSONArray;
|
|
|
|
|
import net.sf.json.JSONObject;
|
|
|
|
|
|
|
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
|
|
import org.apache.log4j.Logger;
|
|
|
|
|
import org.springframework.stereotype.Controller;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
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;
|
|
|
|
@ -25,20 +30,31 @@ import com.platform.entities.DataInfoEntity;
|
|
|
|
|
import com.platform.entities.DataInfoEntityMoveTmp;
|
|
|
|
|
import com.platform.entities.FolderNode;
|
|
|
|
|
import com.platform.entities.GatherOracleInfo;
|
|
|
|
|
import com.platform.entities.OracleConnectorParams;
|
|
|
|
|
import com.platform.entities.PagerOptions;
|
|
|
|
|
import com.platform.entities.VolumeEntity;
|
|
|
|
|
import com.platform.glusterfs.CheckoutMD5;
|
|
|
|
|
import com.platform.service.DataInfoService;
|
|
|
|
|
import com.platform.service.ICodeService;
|
|
|
|
|
import com.platform.service.IGfsService;
|
|
|
|
|
import com.platform.service.IMoveDataService;
|
|
|
|
|
import com.platform.service.IMySqlService;
|
|
|
|
|
import com.platform.service.IOracleExtractService;
|
|
|
|
|
import com.platform.service.OracleExtractHelper;
|
|
|
|
|
import com.platform.service.OracleStatusService;
|
|
|
|
|
import com.platform.service.impl.MySqlServiceImpl;
|
|
|
|
|
import com.platform.test.Brick;
|
|
|
|
|
import com.platform.test.FolderReader;
|
|
|
|
|
import com.platform.test.Volume;
|
|
|
|
|
import com.platform.utils.Bean2MapUtils;
|
|
|
|
|
import com.platform.utils.Configs;
|
|
|
|
|
import com.platform.utils.UtilsHelper;
|
|
|
|
|
|
|
|
|
|
@Controller
|
|
|
|
|
public class DataModelController extends BaseController{
|
|
|
|
|
|
|
|
|
|
public static Logger log = Logger.getLogger(DataModelController.class);
|
|
|
|
|
|
|
|
|
|
@Resource(name = "dataInfoService")
|
|
|
|
|
private DataInfoService dfs;
|
|
|
|
|
|
|
|
|
@ -54,6 +70,9 @@ public class DataModelController extends BaseController{
|
|
|
|
|
@Resource(name = "moveDataService")
|
|
|
|
|
private IMoveDataService moveDataService;
|
|
|
|
|
|
|
|
|
|
@Resource(name = "codeService")
|
|
|
|
|
private ICodeService codeService;
|
|
|
|
|
|
|
|
|
|
public void setDfsImp(DataInfoService dfs) {
|
|
|
|
|
this.dfs = dfs;
|
|
|
|
|
}
|
|
|
|
@ -119,9 +138,8 @@ public class DataModelController extends BaseController{
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@SuppressWarnings({ "unused", "rawtypes", "unchecked" })
|
|
|
|
|
@RequestMapping(value="/oracle/{name}/extract", method= RequestMethod.POST)
|
|
|
|
|
public void extractOracleData(HttpServletRequest res,
|
|
|
|
|
public void oracleExtract(HttpServletRequest res,
|
|
|
|
|
HttpServletResponse req, String name) throws Exception {
|
|
|
|
|
res.setCharacterEncoding("UTF-8");
|
|
|
|
|
System.out.println("------extract-------");
|
|
|
|
@ -147,24 +165,44 @@ public class DataModelController extends BaseController{
|
|
|
|
|
OracleExtract.extractOracle(name, colleclist, map);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
// public void oracleExtract(HttpServletRequest res,
|
|
|
|
|
// HttpServletResponse req, String name, @RequestBody GatherOracleInfo gather, @RequestBody List<OracleConnectorParams> collectOracles)
|
|
|
|
|
// throws Exception {
|
|
|
|
|
//// res.setCharacterEncoding("UTF-8");
|
|
|
|
|
// log.debug("------extract-------");
|
|
|
|
|
//// Map<String, String[]> paramMap = res.getParameterMap();
|
|
|
|
|
//// log.debug(paramMap);
|
|
|
|
|
//// //汇总库 对象信息--带有tableName-
|
|
|
|
|
//// String[] nodes = paramMap.get("target");
|
|
|
|
|
//// Map map = null;
|
|
|
|
|
//// for (String string : nodes) {
|
|
|
|
|
//// JSONObject jsonobject = JSONObject.fromObject(string);
|
|
|
|
|
//// map = jsonobject;
|
|
|
|
|
//// System.out.println(map);
|
|
|
|
|
//// }
|
|
|
|
|
////
|
|
|
|
|
//// // 采集库对象--(多个采集库抽取到1个汇总库的1个tableName下)
|
|
|
|
|
//// String[] inneed = paramMap.get("inneed");
|
|
|
|
|
//// List<Map<String, String>> colleclist = new ArrayList<Map<String,String>>();
|
|
|
|
|
//// for (String string : nodes) {
|
|
|
|
|
//// JSONObject jsonobject = JSONObject.fromObject(string);
|
|
|
|
|
//// Map inneedMap = jsonobject;
|
|
|
|
|
//// colleclist.add(inneedMap);
|
|
|
|
|
//// }
|
|
|
|
|
// OracleExtract.extractOracle(name, collectOracles, gather);
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value="/volume/list", method= RequestMethod.POST)
|
|
|
|
|
@ResponseBody
|
|
|
|
|
public List<VolumeEntity> getFolder(HttpServletRequest res, HttpServletResponse req) throws Exception {
|
|
|
|
|
System.out.println("get Request");
|
|
|
|
|
// Brick brick1 = new Brick("192.168.0.101", "D:/bootstrap");
|
|
|
|
|
// Brick brick2 = new Brick("192.168.0.103", "D:\book");
|
|
|
|
|
// List<Brick> bricks = new ArrayList<Brick>();
|
|
|
|
|
// bricks.add(brick1);
|
|
|
|
|
// bricks.add(brick2);
|
|
|
|
|
public List<VolumeEntity> volumeList() throws Exception {
|
|
|
|
|
log.debug("-----/volume/list------");
|
|
|
|
|
List<VolumeEntity> result = gfsService.getAllVolumes();
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@SuppressWarnings({ "unused", "rawtypes" })
|
|
|
|
|
@RequestMapping(value = "/volume/{name}/move", method= RequestMethod.POST)
|
|
|
|
|
@ResponseBody
|
|
|
|
|
public Object move(HttpServletRequest res, HttpServletResponse req, String name,
|
|
|
|
|
// @ResponseBody
|
|
|
|
|
public void volumeMove(HttpServletRequest res, HttpServletResponse req, String name,
|
|
|
|
|
FolderNode selectNode, DataInfoEntity selectItems) throws Exception {
|
|
|
|
|
res.setCharacterEncoding("UTF-8");
|
|
|
|
|
System.out.println("get Request");
|
|
|
|
@ -188,71 +226,95 @@ public class DataModelController extends BaseController{
|
|
|
|
|
System.out.println(string);
|
|
|
|
|
JSONObject jsobj = JSONObject.fromObject(string);
|
|
|
|
|
Map itemmap = jsobj;
|
|
|
|
|
if (null != itemmap.get("volume")) {
|
|
|
|
|
srcVolumes.add((String) itemmap.get("volume"));
|
|
|
|
|
}
|
|
|
|
|
DataInfoEntity data = (DataInfoEntity) Bean2MapUtils.convertMap(DataInfoEntity.class, itemmap);
|
|
|
|
|
datas.add(data);
|
|
|
|
|
}
|
|
|
|
|
System.out.println("------/volume/{name}/move--------");
|
|
|
|
|
boolean result = false ;
|
|
|
|
|
if (datas.size() >0) {
|
|
|
|
|
result = moveDataService.moveData(datas, (String)map.get("path"));
|
|
|
|
|
moveDataService.moveData(datas, (String)map.get("path"));
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
// public Object volumeMove(HttpServletRequest res, HttpServletResponse req, String name,
|
|
|
|
|
// @RequestBody FolderNode selectNode, @RequestBody List<DataInfoEntity> selectItems) throws Exception {
|
|
|
|
|
// log.debug("-----/volume/{name}/move------");
|
|
|
|
|
//// Map<String, String[]> paramMap = res.getParameterMap();
|
|
|
|
|
//// System.out.println(paramMap);
|
|
|
|
|
// Map<String, String[]> paramMap = res.getParameterMap();
|
|
|
|
|
// log.debug(paramMap);
|
|
|
|
|
// //汇总库 对象信息--带有tableName-
|
|
|
|
|
// String[] nodes = (String[]) paramMap.get("selectNode");
|
|
|
|
|
// Map map = null;
|
|
|
|
|
// JSONObject jsonobject = JSONObject.fromObject(string);
|
|
|
|
|
// map = jsonobject;
|
|
|
|
|
//
|
|
|
|
|
//
|
|
|
|
|
// log.debug(selectItems);
|
|
|
|
|
// log.debug(selectNode);
|
|
|
|
|
// boolean result = false ;
|
|
|
|
|
// if (selectItems.size() >0) {
|
|
|
|
|
// result = moveDataService.moveData(selectItems, selectNode.getPath());
|
|
|
|
|
// }
|
|
|
|
|
// return result;
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value="/oracle/list", method= RequestMethod.POST)
|
|
|
|
|
@ResponseBody
|
|
|
|
|
public List<GatherOracleInfo> getOracleInfo(HttpServletRequest res,
|
|
|
|
|
HttpServletResponse req) throws Exception {
|
|
|
|
|
|
|
|
|
|
public List<GatherOracleInfo> oracleList() throws Exception {
|
|
|
|
|
log.debug("----------getOracleInfo-----------------------");
|
|
|
|
|
List<GatherOracleInfo> result = mySqlService.findAllMySql();
|
|
|
|
|
System.out.println("----------getOracleInfo-----------------------");
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value="/oracle/{id}/delete", method= RequestMethod.POST)
|
|
|
|
|
@ResponseBody
|
|
|
|
|
public void deleteOracleInfo(HttpServletRequest res,
|
|
|
|
|
HttpServletResponse req, int id) throws Exception {
|
|
|
|
|
res.setCharacterEncoding("UTF-8");
|
|
|
|
|
public void oracleDelete(int id) throws Exception {
|
|
|
|
|
log.debug("----------deleteOracleInfo----------------");
|
|
|
|
|
mySqlService.deleteMySql(id);
|
|
|
|
|
System.out.println("----------deleteOracleInfo-----------------------");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value="/oracle/{id}/insert", method= RequestMethod.POST)
|
|
|
|
|
@ResponseBody
|
|
|
|
|
public void insertOracleInfo(HttpServletRequest res,
|
|
|
|
|
HttpServletResponse req, GatherOracleInfo oracle) throws Exception {
|
|
|
|
|
res.setCharacterEncoding("UTF-8");
|
|
|
|
|
public void oracleInsert(GatherOracleInfo oracle) throws Exception {
|
|
|
|
|
log.debug("----------insertOracleInfo----------------");
|
|
|
|
|
mySqlService.insertOracle(oracle);
|
|
|
|
|
System.out.println("----------insertOracleInfo-----------------------");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value="/oracle/{id}/update", method= RequestMethod.POST)
|
|
|
|
|
@ResponseBody
|
|
|
|
|
public void updateOracleInfo(HttpServletRequest res,
|
|
|
|
|
HttpServletResponse req, GatherOracleInfo oracle) throws Exception {
|
|
|
|
|
res.setCharacterEncoding("gb2312");
|
|
|
|
|
System.out.println(oracle.getName());
|
|
|
|
|
System.out.println(oracle);
|
|
|
|
|
|
|
|
|
|
public void oracleUpdate(@RequestBody GatherOracleInfo oracle) throws Exception {
|
|
|
|
|
log.debug("----------updateOracleInfo-----------------------");
|
|
|
|
|
log.debug(oracle);
|
|
|
|
|
mySqlService.updateOracle(oracle);
|
|
|
|
|
System.out.println("----------updateOracleInfo-----------------------");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value="/task/transfer/list", method= RequestMethod.POST)
|
|
|
|
|
@ResponseBody
|
|
|
|
|
public Object taskList() throws Exception {
|
|
|
|
|
public Object taskTransferList() throws Exception {
|
|
|
|
|
log.debug("----------/task/transfer/list-----------------------");
|
|
|
|
|
List<DataInfoEntityMoveTmp> result = moveDataService.findAll();
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value="/task/transfer/{id}/delete", method= RequestMethod.POST)
|
|
|
|
|
@RequestMapping(value="/task/transfer/delete", method= RequestMethod.POST)
|
|
|
|
|
@ResponseBody
|
|
|
|
|
public Object taskdeletes(DataInfoEntityMoveTmp move) throws Exception {
|
|
|
|
|
public Object taskTransferDelete(DataInfoEntityMoveTmp move) throws Exception {
|
|
|
|
|
log.debug("----------/task/transfer/delete-----------------------");
|
|
|
|
|
int result = moveDataService.delete(move);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value="/task/transfer/save", method= RequestMethod.POST)
|
|
|
|
|
@ResponseBody
|
|
|
|
|
public Object taskTransferSave(DataInfoEntity move) throws Exception {
|
|
|
|
|
log.debug("---------/task/transfer/save-----------------------");
|
|
|
|
|
int result = dfs.save(move);
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@RequestMapping(value="/code/list", method= RequestMethod.POST)
|
|
|
|
|
@ResponseBody
|
|
|
|
|
public Object findCodeList() throws Exception {
|
|
|
|
|
log.debug("---------/findSystemCode-----------------------");
|
|
|
|
|
Map<String, Object> result = codeService.findAll();
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|