|
|
|
@ -97,33 +97,43 @@ public class IdcServiceImpl implements IdcService {
|
|
|
|
|
/*下载任务*/
|
|
|
|
|
@Override
|
|
|
|
|
public BaseResponse download(HttpServletRequest request, Map<String, Object> params) {
|
|
|
|
|
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)
|
|
|
|
|
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)
|
|
|
|
|
return ResultVOUtils.error(9000, "任务下载失败");
|
|
|
|
|
if (object != null && object.getInteger("code") != null) {
|
|
|
|
|
BaseResponse response = JSON.parseObject(json, BaseResponse.class);
|
|
|
|
|
return response;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return ResultVOUtils.success(object);
|
|
|
|
|
return statusFile(params,"basic_export_status");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public BaseResponse uploadStatus(HttpServletRequest request, Map<String, Object> params) {
|
|
|
|
|
return statusFile(params,"basic_upload_status");
|
|
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
public BaseResponse downloadStatus(HttpServletRequest request, Map<String, Object> params) {
|
|
|
|
|
return statusFile(params,"basic_download_status");
|
|
|
|
|
}
|
|
|
|
|
private BaseResponse statusFile(Map<String,Object> params,String tableName) {
|
|
|
|
|
String id = "";
|
|
|
|
|
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)
|
|
|
|
|
return ResultVOUtils.error(9000, "下载任务不存在"+tableName);
|
|
|
|
|
if (!(map.get("cacheFilePath") != null && FileUtils.isFileExist(map.get("cacheFilePath").toString())))
|
|
|
|
|
return ResultVOUtils.error(9000, "下载文件不存在-"+tableName);
|
|
|
|
|
String json = FileUtils.readFileAll(map.get("cacheFilePath").toString());
|
|
|
|
|
|
|
|
|
|
JSONObject object = JSON.parseObject(json);
|
|
|
|
|
if (object == null)
|
|
|
|
|
return ResultVOUtils.error(9000, "任务下载失败");
|
|
|
|
|
if (object != null && object.getInteger("code") != null) {
|
|
|
|
|
BaseResponse response = JSON.parseObject(json, BaseResponse.class);
|
|
|
|
|
return response;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return ResultVOUtils.success(object);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*UDI系统上传自助平台*/
|
|
|
|
|
@Override
|
|
|
|
|