Merge branch 'web_backend_develope' of https://git.trustie.net/fhx569287825/aggregation-platform into develope
commit
bf3fcb267f
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,8 +1,11 @@
|
||||
package com.platform.entities;
|
||||
package com.platform.form;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.platform.entities.Brick;
|
||||
import com.platform.entities.FolderNode;
|
||||
|
||||
public class VolumeForm {
|
||||
//
|
||||
// List<VolumeEntity> volumes;
|
@ -1,7 +1,10 @@
|
||||
package com.platform.entities;
|
||||
package com.platform.form;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.platform.entities.GatherOracleInfo;
|
||||
import com.platform.entities.OracleConnectorParams;
|
||||
|
||||
public class oracleForm {
|
||||
|
||||
private GatherOracleInfo target;
|
@ -0,0 +1,14 @@
|
||||
package com.platform.http;
|
||||
|
||||
/** http请求常量
|
||||
* @author chen
|
||||
*
|
||||
*/
|
||||
public class HttpClientConstant {
|
||||
|
||||
/**
|
||||
* gfs的 web 服务的 IP、端口
|
||||
*/
|
||||
public static String URL_IP_PORT = "http://192.168.0.110:9001/";
|
||||
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
package com.platform.http.gfs;
|
||||
|
||||
public class HttpClientConstant {
|
||||
|
||||
public static String URL_IP_PORT = "http://192.168.0.110:8088/jfinal/";
|
||||
|
||||
}
|
@ -1,90 +0,0 @@
|
||||
package com.platform.http.gfs;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import net.sf.json.JSONObject;
|
||||
|
||||
import org.apache.http.HttpEntity;
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.apache.http.NameValuePair;
|
||||
import org.apache.http.client.HttpClient;
|
||||
import org.apache.http.client.entity.UrlEncodedFormEntity;
|
||||
import org.apache.http.client.methods.HttpPost;
|
||||
import org.apache.http.impl.client.DefaultHttpClient;
|
||||
import org.apache.http.message.BasicNameValuePair;
|
||||
import org.apache.http.util.EntityUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.platform.controller.DataModelController;
|
||||
import com.platform.utils.Bean2MapUtils;
|
||||
import com.platform.utils.Configs;
|
||||
|
||||
public class HttpUtils {
|
||||
|
||||
public static Logger log = Configs.DAILY_ROLLING_LOGGER.getLogger(HttpUtils.class);
|
||||
|
||||
public String sendPost(String subUrl, Object data) {
|
||||
String resultStr = "";
|
||||
HttpClient client = new DefaultHttpClient();
|
||||
HttpPost post = new HttpPost(HttpClientConstant.URL_IP_PORT + subUrl);
|
||||
try {
|
||||
// 传参
|
||||
List<NameValuePair> parameters = new ArrayList<NameValuePair>();
|
||||
|
||||
if (null != data) {
|
||||
// 转 map
|
||||
Map<String, Object> map = Bean2MapUtils.convertBean(data);
|
||||
// 转json
|
||||
JSONObject jsondata = JSONObject.fromObject(map);
|
||||
// 封装数据
|
||||
parameters.add(new BasicNameValuePair("jsondata", jsondata
|
||||
.toString()));
|
||||
parameters.add(new BasicNameValuePair("type", data.getClass()
|
||||
.getName()));
|
||||
// 传参 放入 url的 form中
|
||||
UrlEncodedFormEntity entity = new UrlEncodedFormEntity(parameters,
|
||||
"UTF-8");
|
||||
post.setEntity(entity);
|
||||
}
|
||||
|
||||
// 发送
|
||||
HttpResponse respone = client.execute(post);
|
||||
HttpEntity result = respone.getEntity();
|
||||
if (null != result) {
|
||||
resultStr = EntityUtils.toString(result);
|
||||
}
|
||||
// resultMap = Bean2MapUtils.convertBean(result);
|
||||
} catch (Exception e) {
|
||||
System.out.println(e);
|
||||
}
|
||||
return resultStr;
|
||||
}
|
||||
|
||||
// public static void main(String[] args) {
|
||||
// Date d = new Date();
|
||||
// HttpUtils ht = new HttpUtils();
|
||||
// BaseForm1 bas = new BaseForm1();
|
||||
// bas.setId("12");
|
||||
// bas.setName("n12");
|
||||
// String rest = ht.sendPost("gfs/getAllvolume", null);
|
||||
// if (null != rest) {
|
||||
// System.out.println(rest);
|
||||
// JSONArray jsondata = JSONArray.fromObject(rest);
|
||||
// ArrayList<VolumeEntity> fo = (ArrayList<VolumeEntity>) JSONArray.toCollection(jsondata, VolumeEntity.class);
|
||||
// System.err.println(fo);
|
||||
// try {
|
||||
// System.err.println(Bean2MapUtils.convertBean(fo));
|
||||
// } catch (IllegalAccessException | InvocationTargetException
|
||||
// | IntrospectionException e) {
|
||||
// // TODO Auto-generated catch block
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// Date r = new Date();
|
||||
// System.err.println(r.getTime() - d.getTime());
|
||||
// }
|
||||
|
||||
}
|
@ -0,0 +1,84 @@
|
||||
package com.platform.http.gfs;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.base.MyException;
|
||||
import com.base.PostData;
|
||||
import com.google.gson.Gson;
|
||||
import com.platform.http.HttpUtils;
|
||||
|
||||
/** 迁移数据
|
||||
* @author chen
|
||||
*
|
||||
*/
|
||||
public class RemoveData {
|
||||
|
||||
public static Logger log = Logger.getLogger ( RemoveData.class);
|
||||
HttpUtils ht = new HttpUtils();
|
||||
|
||||
/**
|
||||
* -1 :error; 0: the filename is not exists ; 1: right
|
||||
* @param folderName
|
||||
* @param fileName
|
||||
* @return
|
||||
*/
|
||||
public int deleteFolder(String folderName) throws Exception{
|
||||
int reslut = 0;
|
||||
log.info("start delete "+folderName);
|
||||
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
map.put("removePath", folderName);
|
||||
//请求 web sendPost
|
||||
String rest = ht.sendPost("data/removeData", map);
|
||||
if (null == rest || "".equals(rest)) {
|
||||
log.error(" --- gluster is disconnect ! \n");
|
||||
return 0;
|
||||
}
|
||||
Gson gs = new Gson();
|
||||
PostData data = gs.fromJson(rest, PostData.class);
|
||||
// 1 : 成功
|
||||
double copyResult = (double) data.getData();
|
||||
reslut = (int) copyResult;
|
||||
getExcept(data);
|
||||
return reslut;
|
||||
}
|
||||
|
||||
public int abortcopyFolder(String sourceFolderName, String destFolderName) throws Exception{
|
||||
int reslut = 0;
|
||||
log.info(" abortcopyFolder " + sourceFolderName + " --> " + destFolderName);
|
||||
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
map.put("sourcePath", sourceFolderName);
|
||||
map.put("destPath", destFolderName);
|
||||
//请求web
|
||||
String rest = ht.sendPost("data/abortCopyData", map);
|
||||
if (null == rest || "".equals(rest)) {
|
||||
log.error(" --- gluster is disconnect ! \n");
|
||||
return 0;
|
||||
}
|
||||
Gson gs = new Gson();
|
||||
PostData data = gs.fromJson(rest, PostData.class);
|
||||
// 1 : 成功
|
||||
double copyResult = (double) data.getData();
|
||||
reslut = (int) copyResult;
|
||||
getExcept(data);
|
||||
return reslut;
|
||||
}
|
||||
|
||||
/** 记录异常信息
|
||||
* @param pd
|
||||
*/
|
||||
private void getExcept(PostData pd) {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
for ( MyException object : pd.getExceptionsStack()) {
|
||||
sb.append(object.getMess()).append(",");
|
||||
}
|
||||
if (!"".equals(sb.toString())) {
|
||||
log.error(sb.toString());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -1,16 +1,41 @@
|
||||
|
||||
package com.platform.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.ui.ModelMap;
|
||||
|
||||
import com.platform.dao.DataInfoDao;
|
||||
import com.platform.entities.DataInfoEntity;
|
||||
import com.platform.entities.PagerOptions;
|
||||
import com.platform.form.PagerOptions;
|
||||
|
||||
/** 数据管理
|
||||
* @author chen
|
||||
*
|
||||
*/
|
||||
public interface DataInfoService {
|
||||
|
||||
/** 分页查询数据
|
||||
* @param pagerOptions
|
||||
* @return
|
||||
*/
|
||||
public ModelMap getPagerTableData(PagerOptions pagerOptions);
|
||||
|
||||
/** 删除数据
|
||||
* @param id
|
||||
* @throws Exception
|
||||
*/
|
||||
void deleteData(String[] id) throws Exception;
|
||||
|
||||
/** 删除数据
|
||||
* @param ids
|
||||
* @throws Exception
|
||||
*/
|
||||
void deleteData(List<Integer> ids) throws Exception;
|
||||
|
||||
/** 新增数据
|
||||
* @param data
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
int save(DataInfoEntity data) throws Exception;
|
||||
}
|
||||
|
@ -0,0 +1,35 @@
|
||||
package com.platform.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.platform.entities.GatherOracleInfo;
|
||||
|
||||
public interface IGatherOracleService {
|
||||
|
||||
/**
|
||||
* @return 查询 所有 oracle 总库
|
||||
* @throws Exception
|
||||
*/
|
||||
public List<GatherOracleInfo> findAllOracle() throws Exception;
|
||||
|
||||
/** 删除 oracle 总库
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public int deleteOracle(int id) throws Exception;
|
||||
|
||||
/** 新增 oracle 总库
|
||||
* @param oracle
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public int insertOracle(GatherOracleInfo oracle) throws Exception;
|
||||
|
||||
/** 更新 oracle 总库
|
||||
* @param oracle
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public int updateOracle(GatherOracleInfo oracle) throws Exception;
|
||||
|
||||
}
|
@ -1,25 +0,0 @@
|
||||
package com.platform.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.platform.entities.GatherOracleInfo;
|
||||
|
||||
public interface IMySqlService {
|
||||
|
||||
/**
|
||||
* @return 查询
|
||||
* @throws Exception
|
||||
*/
|
||||
public List<GatherOracleInfo> findAllMySql() throws Exception;
|
||||
|
||||
/** 删除
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public int deleteMySql(int id) throws Exception;
|
||||
|
||||
public int insertOracle(GatherOracleInfo oracle) throws Exception;
|
||||
|
||||
public int updateOracle(GatherOracleInfo oracle) throws Exception;
|
||||
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
package com.platform.service.thread;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.base.Custom4exception;
|
||||
import com.platform.form.oracleForm;
|
||||
import com.platform.service.IOracleExtractService;
|
||||
import com.platform.service.impl.CheckoutServiceImpl;
|
||||
|
||||
/** 抽取标准表线程
|
||||
* @author chen
|
||||
*
|
||||
*/
|
||||
public class ThreadExtractStandardOracle extends Thread {
|
||||
|
||||
/**
|
||||
* 日志
|
||||
*/
|
||||
public static Logger log = Logger.getLogger(CheckoutServiceImpl.class);
|
||||
|
||||
/**
|
||||
* 抽取实现
|
||||
*/
|
||||
private IOracleExtractService OracleExtract;
|
||||
|
||||
private oracleForm form;
|
||||
|
||||
/** oracle汇总库抽取
|
||||
* @param form
|
||||
* @param OracleExtract
|
||||
*/
|
||||
public ThreadExtractStandardOracle(oracleForm form, IOracleExtractService OracleExtract) {
|
||||
this.OracleExtract = OracleExtract;
|
||||
this.form = form;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
OracleExtract.extractStandardTable(form.getName(), form.getInneed(),form.getTarget());
|
||||
} catch (Exception e) {
|
||||
log.error(Custom4exception.threadVolume_Oracle_Except,e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,69 @@
|
||||
package com.platform.utils;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import com.platform.entities.CheckoutEntity;
|
||||
|
||||
/** 存储 进行校验的 oracle服务
|
||||
* @author chen
|
||||
*
|
||||
*/
|
||||
public class CacheOracleCheckoutEntity {
|
||||
|
||||
/**
|
||||
* 正则校验的 oracle
|
||||
*/
|
||||
private static Map<String, CheckoutEntity> checkMap = new HashMap<String, CheckoutEntity>();
|
||||
|
||||
/**
|
||||
* 正则抽取的 oracle--(暂未使用该变量)
|
||||
*/
|
||||
private static Map<String, CheckoutEntity> extractStandardMap = new HashMap<String, CheckoutEntity>();
|
||||
|
||||
/**
|
||||
* @return the checkMap
|
||||
*/
|
||||
public static Set<String> getCheckKeys() {
|
||||
return checkMap.keySet();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param checkMap the checkMap to set
|
||||
*/
|
||||
public static CheckoutEntity putCheck(String key, CheckoutEntity data) {
|
||||
return checkMap.put(key, data);
|
||||
}
|
||||
|
||||
public static CheckoutEntity getCheck(String key){
|
||||
return checkMap.get(key);
|
||||
}
|
||||
|
||||
public static CheckoutEntity checkRemove(String key){
|
||||
return checkMap.remove(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the extractStandardMap
|
||||
*/
|
||||
public static Set<String> getExtractKeys() {
|
||||
return extractStandardMap.keySet();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param extractStandardMap the extractStandardMap to set
|
||||
*/
|
||||
public static CheckoutEntity putExtract(String key, CheckoutEntity data) {
|
||||
return extractStandardMap.put(key, data);
|
||||
}
|
||||
|
||||
public static CheckoutEntity getExtract(String key){
|
||||
return extractStandardMap.get(key);
|
||||
}
|
||||
|
||||
public static CheckoutEntity extractRemove(String key){
|
||||
return extractStandardMap.remove(key);
|
||||
}
|
||||
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue