|
|
|
@ -100,14 +100,17 @@ public class IdcServiceImpl implements IdcService {
|
|
|
|
|
public BaseResponse download(HttpServletRequest request, Map<String, Object> params) {
|
|
|
|
|
return statusFile(params, "basic_export_status");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public BaseResponse uploadStatus(HttpServletRequest request, Map<String, Object> params) {
|
|
|
|
|
return statusFile(params, "basic_upload_status");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public BaseResponse downloadStatus(HttpServletRequest request, Map<String, Object> params) {
|
|
|
|
|
return statusFile(params, "basic_download_status");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private BaseResponse statusFile(Map<String, Object> params, String tableName) {
|
|
|
|
|
String id = "";
|
|
|
|
|
if (params.containsKey("taskId") && params.get("taskId") != null) {
|
|
|
|
@ -119,9 +122,9 @@ public class IdcServiceImpl implements IdcService {
|
|
|
|
|
Map<String, Object> map = map = dbDao.get("select * from " + tableName + " where id='" + id + "'");
|
|
|
|
|
|
|
|
|
|
if (map == null)
|
|
|
|
|
return ResultVOUtils.error(9000, "下载任务不存在");
|
|
|
|
|
return ResultVOUtils.error(9000, "下载任务不存在" + tableName);
|
|
|
|
|
if (!(map.get("cacheFilePath") != null && FileUtils.isFileExist(map.get("cacheFilePath").toString())))
|
|
|
|
|
return ResultVOUtils.error(9000, "下载文件不存在");
|
|
|
|
|
return ResultVOUtils.error(9000, "下载文件不存在-" + tableName);
|
|
|
|
|
String json = FileUtils.readFileAll(map.get("cacheFilePath").toString());
|
|
|
|
|
|
|
|
|
|
JSONObject object = JSON.parseObject(json);
|
|
|
|
@ -211,8 +214,7 @@ public class IdcServiceImpl implements IdcService {
|
|
|
|
|
String[] syncTables = TableUtils.syncTables();
|
|
|
|
|
for (int i = 0; i < syncTables.length; i++) {
|
|
|
|
|
String[] tnames = syncTables[i].split("/");
|
|
|
|
|
boolean sync = ((tnames[0]==null||StringUtils.isEmpty(tnames[0])||(tnames[0]!=null&&tnames[0].equals("null")))&&
|
|
|
|
|
(tnames[1]==null||StringUtils.isEmpty(tnames[1])||(tnames[1]!=null&&tnames[1].equals("null"))))||
|
|
|
|
|
boolean sync = StringUtils.isEmpty(tnames[0]) ||
|
|
|
|
|
(!StringUtils.isEmpty(tnames[0]) && map != null && map.get(tnames[0]) != null && map.get(tnames[0]).toString().equals("1"));
|
|
|
|
|
saveIdcLog("---", "", map.get(tnames[0]) + syncTables[i], 0, 0);
|
|
|
|
|
if (sync) {
|
|
|
|
@ -360,7 +362,6 @@ public class IdcServiceImpl implements IdcService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public BaseResponse downlaodSuccess(HttpServletRequest request, Map<String, Object> params) {
|
|
|
|
|
String sql = "update basic_export_status set receiveStatus='1',endTime=now() where id='" + params.get("taskId") + "'";
|
|
|
|
|
dbDao.update(sql);
|
|
|
|
@ -373,11 +374,13 @@ public class IdcServiceImpl implements IdcService {
|
|
|
|
|
|
|
|
|
|
return ResultVOUtils.success();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public BaseResponse uploadFile(HttpServletRequest request,
|
|
|
|
|
String content, MultipartFile[] files) {
|
|
|
|
|
return ResultVOUtils.success();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/****/
|
|
|
|
|
@Override
|
|
|
|
|
public BaseResponse receive(HttpServletRequest request,
|
|
|
|
@ -682,7 +685,8 @@ public class IdcServiceImpl implements IdcService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*增加同步任务状态*/
|
|
|
|
|
private void syncAddTaskStatus(Map<String, Object> json, int scheduleType, boolean success, Date startTime, boolean isEnd) {
|
|
|
|
|
private void syncAddTaskStatus(Map<String, Object> json, int scheduleType, boolean success, Date startTime,
|
|
|
|
|
boolean isEnd) {
|
|
|
|
|
try {
|
|
|
|
|
String content = JSON.toJSONString(json);
|
|
|
|
|
String datePath = DateUtil.formatDate(new Date(), "yyyy-MM-dd");
|
|
|
|
@ -725,7 +729,8 @@ public class IdcServiceImpl implements IdcService {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private boolean analyMiddle(String host, JSONObject jsonObject, MultipartFile[] files, boolean isUpload, boolean isToDB) {
|
|
|
|
|
private boolean analyMiddle(String host, JSONObject jsonObject, MultipartFile[] files, boolean isUpload,
|
|
|
|
|
boolean isToDB) {
|
|
|
|
|
if (jsonObject.get("data") != null) {
|
|
|
|
|
String tableName = "";
|
|
|
|
|
String uniqueColumn = "";
|
|
|
|
@ -788,7 +793,9 @@ public class IdcServiceImpl implements IdcService {
|
|
|
|
|
/*解析到数据库*/
|
|
|
|
|
|
|
|
|
|
/*按表名解析数据到数据库,子表暂未处理*/
|
|
|
|
|
private boolean analyToDB(String host, String tableName, String uniqueColumn, String filePathColumn, List<Map<String, Object>> list, boolean isUpload) {
|
|
|
|
|
private boolean analyToDB(String host, String tableName, String uniqueColumn, String
|
|
|
|
|
filePathColumn, List<Map<String, Object>> list, boolean isUpload) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String tName = DBAUtils.tableRealName(tableName);
|
|
|
|
|
String sql = "replace " + tName + "(";
|
|
|
|
@ -804,7 +811,7 @@ public class IdcServiceImpl implements IdcService {
|
|
|
|
|
if (col > 0)
|
|
|
|
|
sql += ",";
|
|
|
|
|
columnList.get(i).put("attrName", columnList.get(i).get("columnName"));
|
|
|
|
|
sql += columnList.get(i).get("columnName").toString();
|
|
|
|
|
sql += "`"+columnList.get(i).get("columnName").toString()+"`";
|
|
|
|
|
col++;
|
|
|
|
|
if (uniqueColumn != null && columnList.get(i).get("columnKey") != null && ("," + uniqueColumn + ",").contains("," + columnList.get(i).get("columnName") + ",")) {
|
|
|
|
|
keyColumn[key] = columnList.get(i).get("columnName").toString();
|
|
|
|
@ -1075,7 +1082,8 @@ public class IdcServiceImpl implements IdcService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*由表名获取数据*/
|
|
|
|
|
private Map<String, Object> getData(String messageType, String tableName, Map<String, Object> params, Map<String, Object> whereParams) {
|
|
|
|
|
private Map<String, Object> getData(String messageType, String
|
|
|
|
|
tableName, Map<String, Object> params, Map<String, Object> whereParams) {
|
|
|
|
|
List<Map<String, Object>> list = getList(tableName, whereParams);
|
|
|
|
|
Map<String, Object> map = new HashMap<String, Object>();
|
|
|
|
|
map.put("messageId", CustomUtil.getId());
|
|
|
|
@ -1092,7 +1100,8 @@ public class IdcServiceImpl implements IdcService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private SystemParamConfigEntity getSystemParamConfig(String paramKey, String paramName, String defaultValue, String paramExplain) {
|
|
|
|
|
private SystemParamConfigEntity getSystemParamConfig(String paramKey, String paramName, String
|
|
|
|
|
defaultValue, String paramExplain) {
|
|
|
|
|
SystemParamConfigEntity systemParamConfigEntity = systemParamConfigService.selectByParamKey(paramKey);
|
|
|
|
|
if (systemParamConfigEntity == null || (systemParamConfigEntity != null && StringUtils.isEmpty(systemParamConfigEntity.getParamKey()))) {
|
|
|
|
|
systemParamConfigEntity = new SystemParamConfigEntity();
|
|
|
|
|