|
|
|
@ -301,11 +301,11 @@ public class IdcServiceImpl implements IdcService {
|
|
|
|
|
} else {
|
|
|
|
|
success = false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
syncAddTaskStatus(json.getJSONObject("data"),3,success);
|
|
|
|
|
} else {
|
|
|
|
|
if(json.get("code")!=null&&json.get("data")!=null) {
|
|
|
|
|
logger.info("res1-->"+JSON.toJSONString(json));
|
|
|
|
|
syncAddTaskStatus(json.getJSONObject("data"),false,success);
|
|
|
|
|
syncAddTaskStatus(json.getJSONObject("data"),0,success);
|
|
|
|
|
analyMiddle(host,json.getJSONObject("data"),files,false,false);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -396,20 +396,27 @@ public class IdcServiceImpl implements IdcService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
syncAddTaskStatus(json,true,true);
|
|
|
|
|
|
|
|
|
|
/*解析入库*/
|
|
|
|
|
boolean success = false;
|
|
|
|
|
if(isLastLevel()) {
|
|
|
|
|
if(!analyMiddle("",json,files,true,true))
|
|
|
|
|
success = analyMiddle("",json,files,true,true);
|
|
|
|
|
syncAddTaskStatus(json,2,success);
|
|
|
|
|
if(!success) {
|
|
|
|
|
|
|
|
|
|
return ResultVOUtils.error(9000, "解析失败");
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
//需要转发
|
|
|
|
|
if(isRelay()) {
|
|
|
|
|
String host = getNextHost();
|
|
|
|
|
String result = relay(request.getHeader("reqNo"),content,saveFiles,host);
|
|
|
|
|
if(IDCUtils.isJson(result)) {
|
|
|
|
|
syncAddTaskStatus(json,1,true);
|
|
|
|
|
BaseResponse object = JSON.parseObject(result,BaseResponse.class);
|
|
|
|
|
return object;
|
|
|
|
|
} else {
|
|
|
|
|
syncAddTaskStatus(json,1,false);
|
|
|
|
|
return ResultVOUtils.error(9000, "转发失败");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -438,7 +445,9 @@ public class IdcServiceImpl implements IdcService {
|
|
|
|
|
public void downloadFile(String fileName,HttpServletResponse response) {
|
|
|
|
|
OutputStream os;
|
|
|
|
|
String filePathSlash = filePath.substring(filePath.length() -1).equals("/") ? "" : fileName.substring(0,1).equals("/") ? "" : "/";
|
|
|
|
|
|
|
|
|
|
if(!FileUtils.isFileExist(filePath+filePathSlash+fileName))
|
|
|
|
|
fileName = "11.jpg";
|
|
|
|
|
logger.info(filePath+filePathSlash+fileName);
|
|
|
|
|
try {
|
|
|
|
|
if(FileUtils.isFileExist(filePath+filePathSlash+fileName)) {
|
|
|
|
|
byte[] bytes = FileUtils.readFileByBytes(filePath+filePathSlash+fileName);
|
|
|
|
@ -475,14 +484,12 @@ public class IdcServiceImpl implements IdcService {
|
|
|
|
|
|
|
|
|
|
dbDao.save(sql);
|
|
|
|
|
}
|
|
|
|
|
private void saveDownloadStatus(String messageType,String taskId,String remark) {
|
|
|
|
|
private void saveDownloadStatus(Map<String,Object> params) {
|
|
|
|
|
Map<String,Object> map = new HashMap<String,Object>();
|
|
|
|
|
map.put("receiveStatus", "0");
|
|
|
|
|
map.putAll(params);
|
|
|
|
|
map.put("id", CustomUtil.getId());
|
|
|
|
|
map.put("taskId", taskId);
|
|
|
|
|
map.put("status", "0");
|
|
|
|
|
map.put("type", messageType);
|
|
|
|
|
map.put("updateTime", new Date());
|
|
|
|
|
map.put("remark", remark);
|
|
|
|
|
Map<String,Object> columns = getColumn("basic_download_status");
|
|
|
|
|
String sql = "insert into basic_download_status "+DBAUtils.parseInsert(map, columns);
|
|
|
|
|
|
|
|
|
@ -616,24 +623,24 @@ public class IdcServiceImpl implements IdcService {
|
|
|
|
|
if(!StringUtils.isEmpty(recordSql)) {
|
|
|
|
|
dbDao.save("insert into idc_record (id,type,fkId,isEnd,createTime) values "+recordSql);
|
|
|
|
|
}
|
|
|
|
|
saveDownloadStatus(messageType,json.getString("reqNo"),messageType+" 记录数:"+list.size()+"/"+total);
|
|
|
|
|
saveIdcLog(messageType,"",tableName +">success",i *limit,total);
|
|
|
|
|
} else {
|
|
|
|
|
success = false;
|
|
|
|
|
logger.error(result);
|
|
|
|
|
|
|
|
|
|
saveIdcLog(messageType,"",tableName +">"+result,i *limit,total);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
success = false;
|
|
|
|
|
saveIdcLog(messageType,"",syncIp+":"+tableName +">fail:上传地址未连通",i *limit,total);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
if(!StringUtils.isEmpty(recordSql)) {
|
|
|
|
|
dbDao.save("insert into idc_record (id,type,fkId,isEnd,createTime) values "+recordSql);
|
|
|
|
|
}
|
|
|
|
|
saveIdcLog(messageType,"",tableName +">success",i *limit,total);
|
|
|
|
|
}
|
|
|
|
|
syncAddTaskStatus(data,isUpload,success);
|
|
|
|
|
syncAddTaskStatus(data,isUpload ? 1 : 0 ,success);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -644,7 +651,7 @@ public class IdcServiceImpl implements IdcService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*增加同步任务状态*/
|
|
|
|
|
private void syncAddTaskStatus(Map<String,Object> json,boolean isUpload,boolean success) {
|
|
|
|
|
private void syncAddTaskStatus(Map<String,Object> json,int scheduleType,boolean success) {
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
String content = JSON.toJSONString(json);
|
|
|
|
@ -662,13 +669,18 @@ public class IdcServiceImpl implements IdcService {
|
|
|
|
|
//type,transportType,superiorService,subordinateService,cacheFilePath
|
|
|
|
|
Map<String,Object> map = new HashMap<>();
|
|
|
|
|
map.put("type", json.get("messageType"));
|
|
|
|
|
map.put("transportType", isUpload ? "1" : "2");
|
|
|
|
|
map.put("scheduleType", isUpload ? "1" : "0");
|
|
|
|
|
map.put("transportType", scheduleType == 0 ? "1" : "2");
|
|
|
|
|
map.put("scheduleType", scheduleType);
|
|
|
|
|
map.put("taskId", json.get("messageId"));
|
|
|
|
|
map.put("cacheFilePath", fileName);
|
|
|
|
|
map.put("status", success ? "1" : "0");
|
|
|
|
|
|
|
|
|
|
saveExportStatus(map);
|
|
|
|
|
if(scheduleType==2) {
|
|
|
|
|
saveUploadStatus(map);
|
|
|
|
|
} else if (scheduleType==3) {
|
|
|
|
|
saveDownloadStatus(map);
|
|
|
|
|
} else {
|
|
|
|
|
saveExportStatus(map);
|
|
|
|
|
}
|
|
|
|
|
} catch (Exception ex) {
|
|
|
|
|
logger.error(ex.getMessage());
|
|
|
|
|
}
|
|
|
|
|