|
|
@ -32,6 +32,7 @@ import com.hnac.hzinfo.inspect.task.vo.TaskObjectProjectOfflineVO; |
|
|
|
import com.hnac.hzinfo.inspect.task.vo.TaskOfflineVO; |
|
|
|
import com.hnac.hzinfo.inspect.task.vo.TaskOfflineVO; |
|
|
|
import com.hnac.hzinfo.inspect.utils.JsonFileUtil; |
|
|
|
import com.hnac.hzinfo.inspect.utils.JsonFileUtil; |
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
|
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.apache.commons.collections4.MapUtils; |
|
|
|
import org.apache.commons.collections4.MapUtils; |
|
|
|
import org.apache.commons.fileupload.FileItem; |
|
|
|
import org.apache.commons.fileupload.FileItem; |
|
|
|
import org.apache.commons.fileupload.FileItemFactory; |
|
|
|
import org.apache.commons.fileupload.FileItemFactory; |
|
|
@ -82,10 +83,9 @@ import java.util.stream.Collectors; |
|
|
|
@Service |
|
|
|
@Service |
|
|
|
@Primary |
|
|
|
@Primary |
|
|
|
@RequiredArgsConstructor |
|
|
|
@RequiredArgsConstructor |
|
|
|
|
|
|
|
@Slf4j |
|
|
|
public class InspectOfflineServiceImpl implements IOfflineDataService { |
|
|
|
public class InspectOfflineServiceImpl implements IOfflineDataService { |
|
|
|
|
|
|
|
|
|
|
|
private static Logger logger = LoggerFactory.getLogger(InspectOfflineServiceImpl.class); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private final ITaskUserService taskUserService; |
|
|
|
private final ITaskUserService taskUserService; |
|
|
|
|
|
|
|
|
|
|
|
private final ITaskService taskService; |
|
|
|
private final ITaskService taskService; |
|
|
@ -166,7 +166,6 @@ public class InspectOfflineServiceImpl implements IOfflineDataService { |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void syncOfflineDataToOnline(Map<String,Object> paramMap) { |
|
|
|
public void syncOfflineDataToOnline(Map<String,Object> paramMap) { |
|
|
|
logger.error("sync_offline_data_to_online : 进入离线结束方法"); |
|
|
|
|
|
|
|
String fileUrl = (String) paramMap.get("fileUrl"); |
|
|
|
String fileUrl = (String) paramMap.get("fileUrl"); |
|
|
|
if(StringUtil.isBlank(fileUrl)){ |
|
|
|
if(StringUtil.isBlank(fileUrl)){ |
|
|
|
return; |
|
|
|
return; |
|
|
@ -284,7 +283,7 @@ public class InspectOfflineServiceImpl implements IOfflineDataService { |
|
|
|
tableNames.forEach(table -> { |
|
|
|
tableNames.forEach(table -> { |
|
|
|
CreateTableVO item = new CreateTableVO(); |
|
|
|
CreateTableVO item = new CreateTableVO(); |
|
|
|
// 获取表结构sql语句
|
|
|
|
// 获取表结构sql语句
|
|
|
|
String show_table_sql = "show create table " + databaseName + "." + table; |
|
|
|
String show_table_sql = "show create table `" + databaseName + "`." + table; |
|
|
|
Map<String, Object> result = jdbcTemplate.queryForMap(show_table_sql); |
|
|
|
Map<String, Object> result = jdbcTemplate.queryForMap(show_table_sql); |
|
|
|
if (MapUtils.isEmpty(result)) { |
|
|
|
if (MapUtils.isEmpty(result)) { |
|
|
|
return; |
|
|
|
return; |
|
|
@ -413,7 +412,6 @@ public class InspectOfflineServiceImpl implements IOfflineDataService { |
|
|
|
for (int i=0; i < fileJson.size();i++){ |
|
|
|
for (int i=0; i < fileJson.size();i++){ |
|
|
|
TableJsonUtils.createJsonFile(fileJson.get(i), download, tableNames.get(i)); |
|
|
|
TableJsonUtils.createJsonFile(fileJson.get(i), download, tableNames.get(i)); |
|
|
|
} |
|
|
|
} |
|
|
|
logger.error("file_list: {}",fileList); |
|
|
|
|
|
|
|
// 视频、图片下载
|
|
|
|
// 视频、图片下载
|
|
|
|
if(CollectionUtil.isEmpty(fileList)){ |
|
|
|
if(CollectionUtil.isEmpty(fileList)){ |
|
|
|
return; |
|
|
|
return; |
|
|
@ -894,7 +892,6 @@ public class InspectOfflineServiceImpl implements IOfflineDataService { |
|
|
|
if (CollectionUtil.isEmpty(bo.getFiles())) { |
|
|
|
if (CollectionUtil.isEmpty(bo.getFiles())) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
logger.info(">>>>>>>>>>>>>>files: " + JSONObject.toJSONString(bo.getFiles())); |
|
|
|
|
|
|
|
List<String> urls = bo.getFiles().stream().map(o -> { |
|
|
|
List<String> urls = bo.getFiles().stream().map(o -> { |
|
|
|
if (StringUtils.isBlank(o) || o.contains("http")) { |
|
|
|
if (StringUtils.isBlank(o) || o.contains("http")) { |
|
|
|
return null; |
|
|
|
return null; |
|
|
@ -909,7 +906,6 @@ public class InspectOfflineServiceImpl implements IOfflineDataService { |
|
|
|
try { |
|
|
|
try { |
|
|
|
MultipartFile multipartFile = this.getMultipartFile(file); |
|
|
|
MultipartFile multipartFile = this.getMultipartFile(file); |
|
|
|
r = ossClient.putFile(multipartFile); |
|
|
|
r = ossClient.putFile(multipartFile); |
|
|
|
logger.info(">>>>>>>>>>>>>>上传文件返回结果:" + r.toString()); |
|
|
|
|
|
|
|
if (!r.isSuccess()) { |
|
|
|
if (!r.isSuccess()) { |
|
|
|
throw new RuntimeException("上传文件["+fileName+"]失败,bladex-resource报错:" + r.toString()); |
|
|
|
throw new RuntimeException("上传文件["+fileName+"]失败,bladex-resource报错:" + r.toString()); |
|
|
|
} |
|
|
|
} |
|
|
|