|
@@ -43,6 +43,21 @@ public class AsyncTaskServiceImpl extends BaseService implements AsyncTaskServic
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ public AsyncTaskDTO updateAsyncTask(AsyncTaskDTO asyncTaskDTO) {
|
|
|
+ if(asyncTaskDTO.getId()==null){
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ RestTemplate rt = new RestTemplate();
|
|
|
+ HttpHeaders headers = MongoAPIUtils.createAuthHeaderForMongo();
|
|
|
+ headers.setContentType(MediaType.APPLICATION_JSON);
|
|
|
+ HttpEntity<AsyncTaskDTO> httpEntity = new HttpEntity<>(asyncTaskDTO, headers);
|
|
|
+ String url = MongoAPIUtils.generateUrlWithResourceId(mongoDBConfig.getDb(),
|
|
|
+ MongoAPIUtils.MONGODB_COLLECTION_ASYNC_TASK,asyncTaskDTO.getId());
|
|
|
+ rt.exchange(url, HttpMethod.PUT, httpEntity, String.class);
|
|
|
+ return asyncTaskDTO;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
public AsyncTaskDTO getAsyncTask(AsyncJobTool toolType, Long examId, Long caseId) {
|
|
|
HttpHeaders headers = MongoAPIUtils.createAuthHeaderForMongo();
|
|
|
HttpEntity<String> entity = new HttpEntity<>(headers);
|
|
@@ -79,6 +94,7 @@ public class AsyncTaskServiceImpl extends BaseService implements AsyncTaskServic
|
|
|
Gson gson = new Gson();
|
|
|
JSONObject result = resultArray.getJSONObject(0);
|
|
|
AsyncTaskDTO asyncTaskDTO = gson.fromJson(result.toString(), AsyncTaskDTO.class);
|
|
|
+ asyncTaskDTO.setId(result.getJSONObject("_id").getString("$oid"));
|
|
|
return asyncTaskDTO;
|
|
|
}
|
|
|
}
|