|
|
|
@ -110,7 +110,7 @@ public class IdcServiceImpl implements IdcService {
|
|
|
|
|
String json = FileUtils.readFileAll(map.get("cacheFilePath").toString());
|
|
|
|
|
logger.info("download-->"+json);
|
|
|
|
|
JSONObject object = JSON.parseObject(json);
|
|
|
|
|
if(object!=null&&object.getInteger("code")==20000) {
|
|
|
|
|
if(object!=null&&object.getInteger("code")!=null&&object.getInteger("code")==20000) {
|
|
|
|
|
BaseResponse response = JSON.parseObject(json,BaseResponse.class);
|
|
|
|
|
return response;
|
|
|
|
|
}
|
|
|
|
@ -274,6 +274,8 @@ public class IdcServiceImpl implements IdcService {
|
|
|
|
|
JSONObject json = JSONObject.parseObject(result);
|
|
|
|
|
if(isLastLevel()) {
|
|
|
|
|
success = analyToDB(json,files);
|
|
|
|
|
if(!success)
|
|
|
|
|
logger.info("fetchData-->解析失败");
|
|
|
|
|
} else {
|
|
|
|
|
syncAddTaskStatus(json,false,success);
|
|
|
|
|
}
|
|
|
|
@ -602,17 +604,19 @@ public class IdcServiceImpl implements IdcService {
|
|
|
|
|
|
|
|
|
|
/*解析到数据库*/
|
|
|
|
|
private boolean analyToDB(JSONObject jsonObject,MultipartFile[] files) {
|
|
|
|
|
if(!StringUtils.isEmpty(jsonObject.getString("tableName"))) {
|
|
|
|
|
if(jsonObject.getJSONObject("data")!=null) {
|
|
|
|
|
JSONObject object = jsonObject.getJSONObject("data");
|
|
|
|
|
List<Map<String,Object>> list = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
if(object instanceof List<?>) {
|
|
|
|
|
list = jsonObject.getObject("data", List.class);
|
|
|
|
|
} else {
|
|
|
|
|
object = jsonObject;
|
|
|
|
|
if(object.get("data")!=null)
|
|
|
|
|
list = object.getObject("data", List.class);
|
|
|
|
|
}
|
|
|
|
|
return analyData(jsonObject.getString("tableName"),jsonObject.getString("uniqueColumn"),list);
|
|
|
|
|
if(!StringUtils.isEmpty(object.getString("tableName")))
|
|
|
|
|
return analyData(object.getString("tableName"),jsonObject.getString("uniqueColumn"),list);
|
|
|
|
|
//图片处理
|
|
|
|
|
}
|
|
|
|
|
return false;
|
|
|
|
|