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