Merge remote-tracking branch 'origin/master'

master
anthonywj 2 years ago
commit 5cbc4877b5

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

Loading…
Cancel
Save