增加download_status,uplaod_status文件下载

version1
chengqf 2 years ago
parent 247d1a2020
commit e3dd8a0067

@ -93,6 +93,18 @@ public class IdcController {
return idcService.download(request, params);
}
@RequestMapping(value = "/spssync/common/uploadStatus")
@ResponseBody
public BaseResponse uploadStatus(HttpServletRequest request, @RequestBody Map<String, Object> params) {
return idcService.uploadStatus(request, params);
}
@RequestMapping(value = "/spssync/common/downloadStatus")
@ResponseBody
public BaseResponse downloadStatus(HttpServletRequest request, @RequestBody Map<String, Object> params) {
return idcService.downloadStatus(request, params);
}
//@Log("数据同步任务根据任务ID,返回下载成功标记")
@RequestMapping(value = "/spssync/common/success")
@ResponseBody

@ -25,7 +25,8 @@ public interface IdcService {
BaseResponse taskList(HttpServletRequest request,Map<String,Object> params);
BaseResponse download(HttpServletRequest request,Map<String,Object> params);
BaseResponse uploadStatus(HttpServletRequest request,Map<String,Object> params);
BaseResponse downloadStatus(HttpServletRequest request,Map<String,Object> params);
public void asyncFetchTask();
public void asyncFetchUdiTask();

@ -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

Loading…
Cancel
Save