commit
983a2ce749
@ -0,0 +1,4 @@
|
||||
3001001001=ThreadVolume\u7C7B\u67E5\u8BE2 volume\u5F02\u5E38
|
||||
3001001002=ThreadVolume\u7C7B\u7EBF\u7A0B\u4F11\u7720\u5F02\u5E38
|
||||
3002001002= \u62BD\u53D6\u6C47\u603B--\u7684-\u83B7\u53D6\u62BD\u53D6\u52A8\u4F5C\u5F02\u5E38
|
||||
3002001002=SQL\u6267\u884C\u9519\u8BEF
|
@ -1,327 +1,278 @@
|
||||
package com.platform.controller;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import net.sf.json.JSONObject;
|
||||
|
||||
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;
|
||||
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;
|
||||
import com.platform.entities.DataInfoEntity;
|
||||
import com.platform.entities.DataInfoEntityMoveTmp;
|
||||
import com.platform.entities.FolderNode;
|
||||
import com.platform.entities.GatherOracleInfo;
|
||||
import com.platform.entities.PagerOptions;
|
||||
import com.platform.entities.VolumeEntity;
|
||||
import com.platform.entities.oracleForm;
|
||||
import com.platform.entities.volumeMoveForm;
|
||||
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.OracleStatusService;
|
||||
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;
|
||||
|
||||
@Resource(name = "gfsService")
|
||||
private IGfsService gfsService;
|
||||
|
||||
@Resource(name = "mySqlService")
|
||||
private IMySqlService mySqlService;
|
||||
|
||||
@Resource(name = "OracleExtract")
|
||||
private IOracleExtractService OracleExtract;
|
||||
|
||||
@Resource(name = "moveDataService")
|
||||
private IMoveDataService moveDataService;
|
||||
|
||||
@Resource(name = "codeService")
|
||||
private ICodeService codeService;
|
||||
|
||||
public void setDfsImp(DataInfoService dfs) {
|
||||
this.dfs = dfs;
|
||||
}
|
||||
|
||||
@RequestMapping("/data.json")
|
||||
@ResponseBody
|
||||
public ModelMap getAllDataToJson(HttpServletRequest res,
|
||||
HttpServletResponse req) throws UnsupportedEncodingException {
|
||||
res.setCharacterEncoding("UTF-8");
|
||||
Map<String, String[]> paramMap = res.getParameterMap();
|
||||
Set<String> keySet = paramMap.keySet();
|
||||
Map<String, String> params = new HashMap<String, String>();
|
||||
StringBuffer sb = new StringBuffer().append("当前的请求参数:{");
|
||||
for (String str : keySet) {
|
||||
String value = paramMap.get(str)[0];
|
||||
if (StringUtils.isNotEmpty(value)) {
|
||||
params.put(str, value);
|
||||
sb.append(str).append(":").append(value).append(",");
|
||||
} else {
|
||||
sb.append(str).append(":").append("null").append(",");
|
||||
}
|
||||
}
|
||||
Configs.CONSOLE_LOGGER.info(sb.deleteCharAt(sb.length() - 1)
|
||||
.append("}").toString());
|
||||
PagerOptions pagerOptions = (PagerOptions) UtilsHelper
|
||||
.newObjAndSetAttrsByClass(PagerOptions.class, params);
|
||||
|
||||
return dfs.getPagerTableData(pagerOptions);
|
||||
}
|
||||
|
||||
@RequestMapping(value="/delete/data", method= RequestMethod.POST)
|
||||
public void deleteData(HttpServletRequest res, HttpServletResponse req) throws Exception {
|
||||
res.setCharacterEncoding("UTF-8");
|
||||
Map<String, String[]> paramMap = res.getParameterMap();
|
||||
String[] data = paramMap.get("data");
|
||||
dfs.deleteData(data);
|
||||
req.setStatus(200);
|
||||
}
|
||||
|
||||
@RequestMapping("/connectOracle")
|
||||
public void connectOracle(HttpServletRequest res, HttpServletResponse req) throws UnsupportedEncodingException {
|
||||
res.setCharacterEncoding("UTF-8");
|
||||
Map<String, String[]> paramMap = res.getParameterMap();
|
||||
String[] oraclesName = paramMap.get("oracleName");
|
||||
if (oraclesName != null)
|
||||
for (String rcName : oraclesName) {
|
||||
Configs.CONSOLE_LOGGER.info("执行连接\t" + rcName);
|
||||
new OracleStatusService().connectToOracle(rcName);
|
||||
}
|
||||
req.setStatus(200);
|
||||
}
|
||||
|
||||
@RequestMapping("/cancelOracleConection")
|
||||
public void cancelOracleConnection(HttpServletRequest res,
|
||||
HttpServletResponse req) throws UnsupportedEncodingException {
|
||||
res.setCharacterEncoding("UTF-8");
|
||||
Map<String, String[]> paramMap = res.getParameterMap();
|
||||
String[] oraclesName = paramMap.get("oracleName");
|
||||
String operate = paramMap.get("operation")[0];
|
||||
if (null != oraclesName) {
|
||||
for (String rcName : oraclesName) {
|
||||
Configs.CONSOLE_LOGGER.info("取消连接:\t" + rcName);
|
||||
new OracleStatusService().cancelToOracle(rcName, operate);
|
||||
}
|
||||
}
|
||||
req.setStatus(200);
|
||||
}
|
||||
|
||||
@RequestMapping(value="/oracle/{name}/extract", method= RequestMethod.POST)
|
||||
public void oracleExtract(HttpServletRequest res,
|
||||
HttpServletResponse req,@RequestBody oracleForm form) throws Exception {
|
||||
res.setCharacterEncoding("UTF-8");
|
||||
if (null != form.getInneed() && form.getInneed().size() > 0) {
|
||||
OracleExtract.extractOracle(form.getName(), form.getInneed(), form.getTarget());
|
||||
}
|
||||
req.setStatus(200);
|
||||
}
|
||||
// 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> volumeList() throws Exception {
|
||||
log.debug("-----/volume/list------");
|
||||
List<VolumeEntity> result = gfsService.getAllVolumes();
|
||||
return result;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/volume/{name}/move", method= RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public void volumeMove(HttpServletRequest res, HttpServletResponse req,@RequestBody volumeMoveForm form) throws Exception {
|
||||
// res.setCharacterEncoding("UTF-8");
|
||||
// System.out.println("get Request");
|
||||
// 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);
|
||||
// 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");
|
||||
List<DataInfoEntity> datas = new ArrayList<DataInfoEntity>();
|
||||
// List<String> srcVolumes = new ArrayList<String>();
|
||||
// for (String string : items) {
|
||||
// System.out.println(string);
|
||||
// JSONObject jsobj = JSONObject.fromObject(string);
|
||||
// Map itemmap = jsobj;
|
||||
// DataInfoEntity data = (DataInfoEntity) Bean2MapUtils.convertMap(DataInfoEntity.class, itemmap);
|
||||
// datas.add(data);
|
||||
// }
|
||||
List<DataInfoEntity> selectItems = form.getSelectItems();
|
||||
if (null == selectItems) {
|
||||
req.setStatus(200);
|
||||
return;
|
||||
}
|
||||
datas.addAll(selectItems);
|
||||
|
||||
System.out.println("------/volume/{name}/move--------");
|
||||
if (datas.size() >0) {
|
||||
moveDataService.moveData(datas, form.getSelectNode());
|
||||
}
|
||||
req.setStatus(200);
|
||||
}
|
||||
// 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> oracleList() throws Exception {
|
||||
log.debug("----------getOracleInfo-----------------------");
|
||||
List<GatherOracleInfo> result = mySqlService.findAllMySql();
|
||||
return result;
|
||||
}
|
||||
|
||||
@RequestMapping(value="/oracle/{id}/delete", method= RequestMethod.POST)
|
||||
public void oracleDelete(HttpServletRequest req, HttpServletResponse res, @PathVariable String id) throws Exception {
|
||||
log.debug("----------deleteOracleInfo----------------");
|
||||
Integer num = Integer.valueOf(id);
|
||||
Integer result = mySqlService.deleteMySql(num);
|
||||
log.info("oracleDelete : " + result);
|
||||
res.setStatus(200);
|
||||
}
|
||||
|
||||
@RequestMapping(value="/oracle/{id}/insert", method= RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public void oracleInsert(HttpServletRequest res, HttpServletResponse req, @PathVariable String id, @RequestBody GatherOracleInfo oracle) throws Exception {
|
||||
log.debug("----------insertOracleInfo----------------");
|
||||
oracle.setId(Integer.valueOf(id));
|
||||
mySqlService.insertOracle(oracle);
|
||||
req.setStatus(200);
|
||||
}
|
||||
|
||||
@RequestMapping(value="/oracle/{id}/update", method= RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public void oracleUpdate(HttpServletRequest res, HttpServletResponse req, @PathVariable("id") String id, @RequestBody GatherOracleInfo oracle) throws Exception {
|
||||
log.debug("----------updateOracleInfo-----------------------");
|
||||
log.debug(oracle);
|
||||
mySqlService.updateOracle(oracle);
|
||||
req.setStatus(200);
|
||||
}
|
||||
|
||||
@RequestMapping(value="/task/transfer/list", method= RequestMethod.POST)
|
||||
@ResponseBody
|
||||
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)
|
||||
@ResponseBody
|
||||
public Object taskTransferDelete(HttpServletRequest res, HttpServletResponse req, @PathVariable String id) throws Exception {
|
||||
log.debug("----------/task/transfer/{id}/delete-----------------------");
|
||||
DataInfoEntityMoveTmp move = new DataInfoEntityMoveTmp();
|
||||
move.setId(Integer.valueOf(id));
|
||||
int result = moveDataService.delete(move );
|
||||
req.setStatus(200);
|
||||
return result;
|
||||
}
|
||||
|
||||
@RequestMapping(value="/task/transfer/save", method= RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object taskTransferSave(HttpServletRequest res, HttpServletResponse req, @RequestBody DataInfoEntity move) throws Exception {
|
||||
log.debug("---------/task/transfer/save-----------------------");
|
||||
int result = dfs.save(move);
|
||||
req.setStatus(200);
|
||||
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;
|
||||
}
|
||||
|
||||
@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;
|
||||
}
|
||||
}
|
||||
package com.platform.controller;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
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;
|
||||
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;
|
||||
import com.platform.entities.DataInfoEntity;
|
||||
import com.platform.entities.DataInfoEntityMoveTmp;
|
||||
import com.platform.entities.GatherOracleInfo;
|
||||
import com.platform.entities.PagerOptions;
|
||||
import com.platform.entities.VolumeEntity;
|
||||
import com.platform.entities.oracleForm;
|
||||
import com.platform.entities.volumeMoveForm;
|
||||
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.OracleStatusService;
|
||||
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;
|
||||
|
||||
@Resource(name = "gfsService")
|
||||
private IGfsService gfsService;
|
||||
|
||||
@Resource(name = "mySqlService")
|
||||
private IMySqlService mySqlService;
|
||||
|
||||
@Resource(name = "OracleExtract")
|
||||
private IOracleExtractService OracleExtract;
|
||||
|
||||
@Resource(name = "moveDataService")
|
||||
private IMoveDataService moveDataService;
|
||||
|
||||
@Resource(name = "codeService")
|
||||
private ICodeService codeService;
|
||||
|
||||
public void setDfsImp(DataInfoService dfs) {
|
||||
this.dfs = dfs;
|
||||
}
|
||||
|
||||
@RequestMapping("/data.json")
|
||||
@ResponseBody
|
||||
public ModelMap getAllDataToJson(HttpServletRequest res,
|
||||
HttpServletResponse req) throws UnsupportedEncodingException {
|
||||
res.setCharacterEncoding("UTF-8");
|
||||
Map<String, String[]> paramMap = res.getParameterMap();
|
||||
Set<String> keySet = paramMap.keySet();
|
||||
Map<String, String> params = new HashMap<String, String>();
|
||||
StringBuffer sb = new StringBuffer().append("当前的请求参数:{");
|
||||
for (String str : keySet) {
|
||||
String value = paramMap.get(str)[0];
|
||||
if (StringUtils.isNotEmpty(value)) {
|
||||
params.put(str, value);
|
||||
sb.append(str).append(":").append(value).append(",");
|
||||
} else {
|
||||
sb.append(str).append(":").append("null").append(",");
|
||||
}
|
||||
}
|
||||
Configs.CONSOLE_LOGGER.info(sb.deleteCharAt(sb.length() - 1)
|
||||
.append("}").toString());
|
||||
PagerOptions pagerOptions = (PagerOptions) UtilsHelper
|
||||
.newObjAndSetAttrsByClass(PagerOptions.class, params);
|
||||
|
||||
return dfs.getPagerTableData(pagerOptions);
|
||||
}
|
||||
|
||||
@RequestMapping(value="/delete/data", method= RequestMethod.POST)
|
||||
public void deleteData(HttpServletRequest res, HttpServletResponse req) throws Exception {
|
||||
res.setCharacterEncoding("UTF-8");
|
||||
Map<String, String[]> paramMap = res.getParameterMap();
|
||||
String[] data = paramMap.get("data");
|
||||
dfs.deleteData(data);
|
||||
req.setStatus(200);
|
||||
}
|
||||
|
||||
@RequestMapping("/connectOracle")
|
||||
public void connectOracle(HttpServletRequest res, HttpServletResponse req) throws UnsupportedEncodingException {
|
||||
res.setCharacterEncoding("UTF-8");
|
||||
Map<String, String[]> paramMap = res.getParameterMap();
|
||||
String[] oraclesName = paramMap.get("oracleName");
|
||||
if (oraclesName != null)
|
||||
for (String rcName : oraclesName) {
|
||||
Configs.CONSOLE_LOGGER.info("连接成功\t" + rcName);
|
||||
new OracleStatusService().connectToOracle(rcName);
|
||||
}
|
||||
req.setStatus(200);
|
||||
}
|
||||
|
||||
@RequestMapping("/cancelOracleConection")
|
||||
public void cancelOracleConnection(HttpServletRequest res,
|
||||
HttpServletResponse req) throws UnsupportedEncodingException {
|
||||
res.setCharacterEncoding("UTF-8");
|
||||
Map<String, String[]> paramMap = res.getParameterMap();
|
||||
String[] oraclesName = paramMap.get("oracleName");
|
||||
String operate = paramMap.get("operation")[0];
|
||||
if (null != oraclesName) {
|
||||
for (String rcName : oraclesName) {
|
||||
Configs.CONSOLE_LOGGER.info("取消连接:\t" + rcName);
|
||||
new OracleStatusService().cancelToOracle(rcName, operate);
|
||||
}
|
||||
}
|
||||
req.setStatus(200);
|
||||
}
|
||||
|
||||
@RequestMapping(value="/oracle/{name}/extract", method= RequestMethod.POST)
|
||||
public void oracleExtract(HttpServletRequest res,
|
||||
HttpServletResponse req,@RequestBody oracleForm form) throws Exception {
|
||||
Configs.CONSOLE_LOGGER.error("/oracle/{name}/extract");
|
||||
res.setCharacterEncoding("UTF-8");
|
||||
if (null != form.getInneed() && form.getInneed().size() > 0) {
|
||||
OracleExtract.extractOracle(form.getName(), form.getInneed(), form.getTarget());
|
||||
}
|
||||
req.setStatus(200);
|
||||
}
|
||||
// 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> volumeList() throws Exception {
|
||||
log.debug("-----/volume/list------");
|
||||
List<VolumeEntity> result = gfsService.getAllVolumes();
|
||||
return result;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/volume/{name}/move", method= RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public void volumeMove(HttpServletRequest res, HttpServletResponse req,@RequestBody volumeMoveForm form) throws Exception {
|
||||
List<DataInfoEntity> datas = new ArrayList<DataInfoEntity>();
|
||||
List<DataInfoEntity> selectItems = form.getSelectItems();
|
||||
if (null == selectItems) {
|
||||
req.setStatus(200);
|
||||
return;
|
||||
}
|
||||
datas.addAll(selectItems);
|
||||
|
||||
System.out.println("------/volume/{name}/move--------");
|
||||
if (datas.size() >0) {
|
||||
moveDataService.moveData(datas, form.getSelectNode());
|
||||
}
|
||||
req.setStatus(200);
|
||||
}
|
||||
|
||||
@RequestMapping(value="/oracle/list", method= RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public List<GatherOracleInfo> oracleList() throws Exception {
|
||||
log.debug("----------getOracleInfo-----------------------");
|
||||
List<GatherOracleInfo> result = mySqlService.findAllMySql();
|
||||
return result;
|
||||
}
|
||||
|
||||
@RequestMapping(value="/oracle/{id}/delete", method= RequestMethod.POST)
|
||||
public void oracleDelete(HttpServletRequest req, HttpServletResponse res, @PathVariable String id) throws Exception {
|
||||
log.debug("----------deleteOracleInfo----------------");
|
||||
Integer num = Integer.valueOf(id);
|
||||
Integer result = mySqlService.deleteMySql(num);
|
||||
log.info("oracleDelete : " + result);
|
||||
res.setStatus(200);
|
||||
}
|
||||
|
||||
@RequestMapping(value="/oracle/{id}/insert", method= RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public void oracleInsert(HttpServletRequest res, HttpServletResponse req, @PathVariable String id, @RequestBody GatherOracleInfo oracle) throws Exception {
|
||||
log.debug("----------insertOracleInfo----------------");
|
||||
oracle.setId(Integer.valueOf(id));
|
||||
mySqlService.insertOracle(oracle);
|
||||
req.setStatus(200);
|
||||
}
|
||||
|
||||
@RequestMapping(value="/oracle/{id}/update", method= RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public void oracleUpdate(HttpServletRequest res, HttpServletResponse req, @PathVariable("id") String id, @RequestBody GatherOracleInfo oracle) throws Exception {
|
||||
log.debug("----------updateOracleInfo-----------------------");
|
||||
log.debug(oracle);
|
||||
mySqlService.updateOracle(oracle);
|
||||
req.setStatus(200);
|
||||
}
|
||||
|
||||
@RequestMapping(value="/task/transfer/list", method= RequestMethod.POST)
|
||||
@ResponseBody
|
||||
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)
|
||||
@ResponseBody
|
||||
public Object taskTransferDelete(HttpServletRequest res, HttpServletResponse req, @PathVariable String id) throws Exception {
|
||||
log.debug("----------/task/transfer/{id}/delete-----------------------");
|
||||
DataInfoEntityMoveTmp move = new DataInfoEntityMoveTmp();
|
||||
move.setId(Integer.valueOf(id));
|
||||
int result = moveDataService.delete(move );
|
||||
req.setStatus(200);
|
||||
return result;
|
||||
}
|
||||
|
||||
@RequestMapping(value="/task/transfer/save", method= RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public Object taskTransferSave(HttpServletRequest res, HttpServletResponse req, @RequestBody DataInfoEntity move) throws Exception {
|
||||
log.debug("---------/task/transfer/save-----------------------");
|
||||
int result = dfs.save(move);
|
||||
req.setStatus(200);
|
||||
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;
|
||||
}
|
||||
|
||||
@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;
|
||||
}
|
||||
}
|
||||
|
@ -1,37 +1,55 @@
|
||||
package com.platform.entities;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class oracleForm {
|
||||
|
||||
private GatherOracleInfo target;
|
||||
|
||||
private List<OracleConnectorParams> inneed;
|
||||
|
||||
private String name;
|
||||
|
||||
public GatherOracleInfo getTarget() {
|
||||
return target;
|
||||
}
|
||||
|
||||
public void setTarget(GatherOracleInfo target) {
|
||||
this.target = target;
|
||||
}
|
||||
|
||||
public List<OracleConnectorParams> getInneed() {
|
||||
return inneed;
|
||||
}
|
||||
|
||||
public void setInneed(List<OracleConnectorParams> inneed) {
|
||||
this.inneed = inneed;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
}
|
||||
package com.platform.entities;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class oracleForm {
|
||||
|
||||
private GatherOracleInfo target;
|
||||
|
||||
private List<OracleConnectorParams> inneed;
|
||||
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* @return the totalOracle
|
||||
*/
|
||||
public GatherOracleInfo getTarget() {
|
||||
return target;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param totalOracle the totalOracle to set
|
||||
*/
|
||||
public void setTarget(GatherOracleInfo target) {
|
||||
this.target = target;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the collOracle
|
||||
*/
|
||||
public List<OracleConnectorParams> getInneed() {
|
||||
return inneed;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param collOracle the collOracle to set
|
||||
*/
|
||||
public void setInneed(List<OracleConnectorParams> inneed) {
|
||||
this.inneed = inneed;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the totalOracleName
|
||||
*/
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param totalOracleName the totalOracleName to set
|
||||
*/
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,90 +1,90 @@
|
||||
package com.platform.oracle;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.DriverManager;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
|
||||
import com.platform.utils.Configs;
|
||||
|
||||
public class OracleConnector {
|
||||
static {
|
||||
try {
|
||||
Class.forName("oracle.jdbc.driver.OracleDriver");
|
||||
Configs.CONSOLE_LOGGER.info("Oracle驱动加载成功");
|
||||
} catch (ClassNotFoundException e) {
|
||||
// TODO Auto-generated catch block
|
||||
Configs.CONSOLE_LOGGER.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public static Connection ConnectionBuilder(String url, String user,
|
||||
String password) {
|
||||
Connection conn = null;
|
||||
try {
|
||||
conn = DriverManager.getConnection(url, user, password);
|
||||
} catch (SQLException e) {
|
||||
Configs.CONSOLE_LOGGER.info("创建oracle连接失败: [" + e.getMessage()
|
||||
+ "]");
|
||||
}
|
||||
return conn;
|
||||
}
|
||||
|
||||
public static boolean canConnect(String url, String user, String password) {
|
||||
return (null != ConnectionBuilder(url, user, password));
|
||||
}
|
||||
|
||||
public static ResultSet getSQLExecResultSet(Connection conn, String sql) {
|
||||
ResultSet resultSet = null;
|
||||
try {
|
||||
Statement statement = conn
|
||||
.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,
|
||||
ResultSet.CONCUR_UPDATABLE);
|
||||
resultSet = statement.executeQuery(sql);
|
||||
} catch (SQLException e) {
|
||||
Configs.CONSOLE_LOGGER.error(e.getMessage());
|
||||
}
|
||||
return resultSet;
|
||||
}
|
||||
|
||||
public static ResultSet getSQLExecResultSet(String url, String user,
|
||||
String password, String sql) {
|
||||
return getSQLExecResultSet(ConnectionBuilder(url, user, password), sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行对oracle数据库的增、删
|
||||
*
|
||||
* @param conn
|
||||
* @param sql
|
||||
* @return 是否执行成功
|
||||
*/
|
||||
public static boolean execOracleSQL(Connection conn, String sql) {
|
||||
boolean flag = false;
|
||||
try {
|
||||
Statement statement = conn.createStatement();
|
||||
//ResultSet set = statement.execute(sql);
|
||||
flag = true;
|
||||
} catch (SQLException e) {
|
||||
// TODO Auto-generated catch block
|
||||
Configs.CONSOLE_LOGGER.error(e.getMessage());
|
||||
flag = false;
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
public static boolean execUpdateOracleSQL(Connection conn, String sql) {
|
||||
boolean flag = false;
|
||||
try {
|
||||
Statement statement = conn.createStatement();
|
||||
statement.execute(sql);
|
||||
flag = true;
|
||||
} catch (SQLException e) {
|
||||
// TODO Auto-generated catch block
|
||||
Configs.CONSOLE_LOGGER.error(e.getMessage());
|
||||
flag = false;
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
package com.platform.oracle;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.DriverManager;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
|
||||
import com.base.Custom4exception;
|
||||
import com.base.CustomException;
|
||||
import com.platform.utils.Configs;
|
||||
|
||||
public class OracleConnector {
|
||||
static {
|
||||
try {
|
||||
Class.forName("oracle.jdbc.driver.OracleDriver");
|
||||
Configs.CONSOLE_LOGGER.info("Oracle驱动加载成功");
|
||||
} catch (ClassNotFoundException e) {
|
||||
// TODO Auto-generated catch block
|
||||
new CustomException(Custom4exception.OracleSQL_Except, e);
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized static Connection ConnectionBuilder(String url, String user,
|
||||
String password) {
|
||||
Connection conn = null;
|
||||
try {
|
||||
conn = DriverManager.getConnection(url, user, password);
|
||||
} catch (SQLException e) {
|
||||
new CustomException(Custom4exception.OracleSQL_Except, e);
|
||||
Configs.CONSOLE_LOGGER.info("创建oracle连接失败: [" + e.getMessage() + "]");
|
||||
}
|
||||
return conn;
|
||||
}
|
||||
|
||||
public synchronized static boolean canConnect(String url, String user, String password) {
|
||||
return (null != ConnectionBuilder(url, user, password));
|
||||
}
|
||||
|
||||
public synchronized static ResultSet getSQLExecResultSet(Connection conn, String sql) {
|
||||
ResultSet resultSet = null;
|
||||
try {
|
||||
Statement statement = conn
|
||||
.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,
|
||||
ResultSet.CONCUR_UPDATABLE);
|
||||
resultSet = statement.executeQuery(sql);
|
||||
} catch (SQLException e) {
|
||||
new CustomException(Custom4exception.OracleSQL_Except, e);
|
||||
}
|
||||
return resultSet;
|
||||
}
|
||||
|
||||
public synchronized static ResultSet getSQLExecResultSet(String url, String user,
|
||||
String password, String sql) {
|
||||
return getSQLExecResultSet(ConnectionBuilder(url, user, password), sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行对oracle数据库的增、删
|
||||
*
|
||||
* @param conn
|
||||
* @param sql
|
||||
* @return 是否执行成功
|
||||
*/
|
||||
public synchronized static boolean execOracleSQL(Connection conn, String sql) {
|
||||
boolean flag = false;
|
||||
try {
|
||||
Statement statement = conn.createStatement();
|
||||
statement.execute(sql);
|
||||
flag = true;
|
||||
} catch (SQLException e) {
|
||||
// TODO Auto-generated catch block
|
||||
new CustomException(Custom4exception.OracleSQL_Except, e);
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
public synchronized static boolean execUpdateOracleSQL(Connection conn, String sql) {
|
||||
boolean flag = false;
|
||||
try {
|
||||
Statement statement = conn.createStatement();
|
||||
if(statement.executeUpdate(sql) > 0)
|
||||
flag = true;
|
||||
} catch (SQLException e) {
|
||||
// TODO Auto-generated catch block
|
||||
new CustomException(Custom4exception.OracleSQL_Except, e, sql);
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
}
|
@ -1,52 +1,52 @@
|
||||
package com.platform.utils;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
public class Configs {
|
||||
|
||||
/** 全局自定义异常--编码 */
|
||||
public static final String GLOBAL_EXP_CUSTOM = "3001001001";
|
||||
|
||||
/** 全局非自定义异常--编码 */
|
||||
public static final String GLOBAL_EXP_NOT_CUSTOM = "3001001002";
|
||||
|
||||
public static final String CONFIG_LOCALTION = "WebContent/WEB-INF/config/config.properties";
|
||||
|
||||
public static final Logger CONSOLE_LOGGER = Logger.getLogger("console");
|
||||
|
||||
public static final Logger DAILY_ROLLING_LOGGER = Logger
|
||||
.getLogger("dailyRollingFile");
|
||||
|
||||
public static final Logger DAILY_LOGGER = Logger.getLogger("railyFile");
|
||||
|
||||
public static final Logger LOGGER = Logger.getLogger(Configs.class);
|
||||
|
||||
public static String KUBE_MASTER_URL = "http://192.168.0.110:8080/"; // kubernetes集群的maser
|
||||
// URl
|
||||
|
||||
public static int ORACLE_DEFAULT_PORT = 1521; // oracle的默认端口号
|
||||
|
||||
public static String COLLECT_USER_NAME = "system"; //采集统一的登入用户名
|
||||
|
||||
public static String COLLECT_PASSWORD = "oracle"; //采集统一的登入密码
|
||||
|
||||
public static String COLLECT_SERVICE_NAME = "orcl"; //采集库统一的服务名
|
||||
|
||||
public static String GATHER_PORT ="1521"; //汇总库的端口号
|
||||
|
||||
public static String GATHER_USER_NAME = "system"; //汇总库的登入用户名
|
||||
|
||||
public static String GATHER_USER_PASSWORD = "1"; //汇总库的登入密码
|
||||
|
||||
public static String GATHER_SERVICE_NAME = "orcl"; //汇总库的服务名
|
||||
|
||||
public static String TABLE_SUFFIX = "_20152016"; //汇总库汇总表的后缀名
|
||||
|
||||
public static String EXTRACT_LOG_LOCALTION = "D:\\log"; //数据汇总日志保存位置
|
||||
|
||||
public static String GATHER_TABLESPACE_NAME=""; //表空间名
|
||||
|
||||
public static String GATHER_TABLESPACE_PATH=""; //表空间路径
|
||||
|
||||
public static String GATHER_TABLE_PASSWORD=""; //登入密码
|
||||
}
|
||||
package com.platform.utils;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
public class Configs {
|
||||
|
||||
/** 全局自定义异常--编码 */
|
||||
public static final String GLOBAL_EXP_CUSTOM = "3001001001";
|
||||
|
||||
/** 全局非自定义异常--编码 */
|
||||
public static final String GLOBAL_EXP_NOT_CUSTOM = "3001001002";
|
||||
|
||||
public static final String CONFIG_LOCALTION = "WebContent/WEB-INF/config/config.properties";
|
||||
|
||||
public static final Logger CONSOLE_LOGGER = Logger.getLogger("console");
|
||||
|
||||
public static final Logger DAILY_ROLLING_LOGGER = Logger
|
||||
.getLogger("dailyRollingFile");
|
||||
|
||||
public static final Logger DAILY_LOGGER = Logger.getLogger("railyFile");
|
||||
|
||||
public static final Logger LOGGER = Logger.getLogger(Configs.class);
|
||||
|
||||
public static String KUBE_MASTER_URL = "http://192.168.0.110:8080/"; // kubernetes集群的maser
|
||||
// URl
|
||||
|
||||
public static int ORACLE_DEFAULT_PORT = 1521; // oracle的默认端口号
|
||||
|
||||
public static String COLLECT_USER_NAME = "system"; //采集统一的登入用户名
|
||||
|
||||
public static String COLLECT_PASSWORD = "oracle"; //采集统一的登入密码
|
||||
|
||||
public static String COLLECT_SERVICE_NAME = "orcl"; //采集库统一的服务名
|
||||
|
||||
public static String GATHER_PORT ="1521"; //汇总库的端口号
|
||||
|
||||
public static String GATHER_USER_NAME = "system"; //汇总库的登入用户名
|
||||
|
||||
public static String GATHER_USER_PASSWORD = "1"; //汇总库的登入密码
|
||||
|
||||
public static String GATHER_SERVICE_NAME = "orcl"; //汇总库的服务名
|
||||
|
||||
public static String TABLE_SUFFIX = "_20152016"; //汇总库汇总表的后缀名
|
||||
|
||||
public static String EXTRACT_LOG_LOCALTION = "D:\\log"; //数据汇总日志保存位置
|
||||
|
||||
public static String GATHER_TABLESPACE_NAME=""; //表空间名
|
||||
|
||||
public static String GATHER_TABLESPACE_PATH=""; //表空间路径
|
||||
|
||||
public static String GATHER_TABLE_PASSWORD="1"; //登入密码
|
||||
}
|
||||
|
@ -0,0 +1,16 @@
|
||||
package com.platform.test;
|
||||
|
||||
import com.platform.utils.Configs;
|
||||
import com.platform.utils.FileOperateHelper;
|
||||
|
||||
public class TestWriteFile {
|
||||
|
||||
public static void main(String[] args) {
|
||||
FileOperateHelper
|
||||
.fileWrite(
|
||||
Configs.EXTRACT_LOG_LOCALTION +"\\test.log",
|
||||
"Hello! \r\n");
|
||||
System.out.println("Hello!");
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in new issue