|
|
|
@ -54,7 +54,6 @@ import okhttp3.Request;
|
|
|
|
|
import okhttp3.RequestBody;
|
|
|
|
|
import okhttp3.Response;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*数据中继数据中心(接收)*/
|
|
|
|
|
@Slf4j
|
|
|
|
|
@Service
|
|
|
|
@ -113,21 +112,31 @@ public class IdcServiceImpl implements IdcService {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public BaseResponse download(HttpServletRequest request,Map<String,Object> params) {
|
|
|
|
|
Map<String,Object> map = dbDao.get("select * from basic_export_status where id='"+params.get("taskId")+"'");
|
|
|
|
|
String id="";
|
|
|
|
|
String tableName = params.get("scheduleType")!=null&¶ms.get("scheduleType").equals("3") ? "basic_export_status" : "basic_export_status";
|
|
|
|
|
if(params.containsKey("taskId")&¶ms.get("taskId")!=null) {
|
|
|
|
|
id = params.get("taskId").toString();
|
|
|
|
|
} else {
|
|
|
|
|
id = params.get("id").toString();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Map<String,Object> map = map = dbDao.get("select * from "+tableName+" where id='"+id+"'");
|
|
|
|
|
|
|
|
|
|
if(map==null)
|
|
|
|
|
ResultVOUtils.error(9000, "下载任务不存在");
|
|
|
|
|
if(!FileUtils.isFileExist(map.get("cacheFilePath").toString()))
|
|
|
|
|
ResultVOUtils.error(9000, "下载文件不存在");
|
|
|
|
|
return ResultVOUtils.error(9000, "下载任务不存在");
|
|
|
|
|
if(!(map.get("cacheFilePath")!=null&&FileUtils.isFileExist(map.get("cacheFilePath").toString())))
|
|
|
|
|
return ResultVOUtils.error(9000, "下载文件不存在");
|
|
|
|
|
String json = FileUtils.readFileAll(map.get("cacheFilePath").toString());
|
|
|
|
|
|
|
|
|
|
JSONObject object = JSON.parseObject(json);
|
|
|
|
|
if(object==null)
|
|
|
|
|
ResultVOUtils.error(9000, "任务下载失败");
|
|
|
|
|
return ResultVOUtils.error(9000, "任务下载失败");
|
|
|
|
|
if(object!=null&&object.getInteger("code")!=null) {
|
|
|
|
|
BaseResponse response = JSON.parseObject(json,BaseResponse.class);
|
|
|
|
|
return response;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
logger.info("json-->"+json);
|
|
|
|
|
return ResultVOUtils.success(object);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -402,7 +411,7 @@ public class IdcServiceImpl implements IdcService {
|
|
|
|
|
boolean success = false;
|
|
|
|
|
if(isLastLevel()) {
|
|
|
|
|
success = analyMiddle("",json,files,true,true);
|
|
|
|
|
syncAddTaskStatus(json,2,success,startTime,true);
|
|
|
|
|
syncAddTaskStatus(json,3,success,startTime,true);
|
|
|
|
|
if(!success) {
|
|
|
|
|
|
|
|
|
|
return ResultVOUtils.error(9000, "解析失败");
|
|
|
|
@ -413,11 +422,11 @@ public class IdcServiceImpl implements IdcService {
|
|
|
|
|
String host = getNextHost();
|
|
|
|
|
String result = relay(request.getHeader("reqNo"),content,saveFiles,host);
|
|
|
|
|
if(IDCUtils.isJson(result)) {
|
|
|
|
|
syncAddTaskStatus(json,1,true,startTime,true);
|
|
|
|
|
syncAddTaskStatus(json,2,true,startTime,true);
|
|
|
|
|
BaseResponse object = JSON.parseObject(result,BaseResponse.class);
|
|
|
|
|
return object;
|
|
|
|
|
} else {
|
|
|
|
|
syncAddTaskStatus(json,1,false,startTime,false);
|
|
|
|
|
syncAddTaskStatus(json,2,false,startTime,false);
|
|
|
|
|
return ResultVOUtils.error(9000, "转发失败");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -513,7 +522,7 @@ public class IdcServiceImpl implements IdcService {
|
|
|
|
|
boolean success=false;
|
|
|
|
|
String tableName = params.get("tableName").toString();
|
|
|
|
|
String tableKey = params.get("tableKey").toString();
|
|
|
|
|
String[] childs = new String[10];
|
|
|
|
|
String[] childs = new String[30];
|
|
|
|
|
int childNum = -1;
|
|
|
|
|
/*子表*/
|
|
|
|
|
for(String str:SYNC_TABLES) {
|
|
|
|
@ -678,6 +687,7 @@ public class IdcServiceImpl implements IdcService {
|
|
|
|
|
map.put("status", success ? "1" : "0");
|
|
|
|
|
map.put("startTime", startTime!=null ? startTime : new Date());
|
|
|
|
|
map.put("updateTime", new Date());
|
|
|
|
|
map.put("remark", json.get("messageType")+": "+json.get("total")+"条");
|
|
|
|
|
if(isEnd)
|
|
|
|
|
map.put("endTime", new Date());
|
|
|
|
|
if(scheduleType==2) {
|
|
|
|
@ -1173,6 +1183,6 @@ public class IdcServiceImpl implements IdcService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|