|
@@ -185,10 +185,10 @@ public class ExtraService {
|
|
|
|
|
|
public String reportsToReviewPaper(String case_take_id){
|
|
public String reportsToReviewPaper(String case_take_id){
|
|
int[]options={0,1,2,3,4,5,6,7,8,9,10};
|
|
int[]options={0,1,2,3,4,5,6,7,8,9,10};
|
|
|
|
+ String url="http://mooctest-site.oss-cn-shanghai.aliyuncs.com/paperjson/"+case_take_id+".json";
|
|
try {
|
|
try {
|
|
- CrowdSourceToReviewPaper crowdSourceToReviewPaper=crowdSourceToReviewPaperDao.getByCaseTakeId(case_take_id);
|
|
|
|
- if(crowdSourceToReviewPaper!=null){
|
|
|
|
- String url=crowdSourceToReviewPaper.getUrl();
|
|
|
|
|
|
+ boolean isExist=OssAliyun.existFile("paperjson/"+case_take_id+".json");
|
|
|
|
+ if(isExist){
|
|
return url;
|
|
return url;
|
|
}
|
|
}
|
|
JSONObject result=new JSONObject();
|
|
JSONObject result=new JSONObject();
|
|
@@ -210,14 +210,17 @@ public class ExtraService {
|
|
description+=bug.getSeverity()+"\n";
|
|
description+=bug.getSeverity()+"\n";
|
|
description+=bug.getRecurrent()+"\n";
|
|
description+=bug.getRecurrent()+"\n";
|
|
description+=bug.getCreate_time_millis()+"\n";
|
|
description+=bug.getCreate_time_millis()+"\n";
|
|
- description+=mirror.getGood().size()+"\n";
|
|
|
|
- description+=mirror.getBad().size();
|
|
|
|
|
|
+ if(mirror==null){
|
|
|
|
+ description+="0\n";
|
|
|
|
+ description+="0\n";
|
|
|
|
+ }
|
|
|
|
+ else {
|
|
|
|
+ description += mirror.getGood().size() + "\n";
|
|
|
|
+ description += mirror.getBad().size();
|
|
|
|
+ }
|
|
jsonObject.put("description",description);
|
|
jsonObject.put("description",description);
|
|
- //JSONArray urlArray=new JSONArray();
|
|
|
|
String[]urlArray=new String[1];
|
|
String[]urlArray=new String[1];
|
|
urlArray[0]=bug.getImg_url();
|
|
urlArray[0]=bug.getImg_url();
|
|
- //JSONObject temp=new JSONObject(bug.getImg_url());
|
|
|
|
- //urlArray.put(temp);
|
|
|
|
jsonObject.put("img_url",urlArray);
|
|
jsonObject.put("img_url",urlArray);
|
|
JSONArray fileArray=new JSONArray();
|
|
JSONArray fileArray=new JSONArray();
|
|
jsonObject.put("file_url",fileArray);
|
|
jsonObject.put("file_url",fileArray);
|
|
@@ -244,19 +247,16 @@ public class ExtraService {
|
|
itemGroupObject.put("item_list",itemArray);
|
|
itemGroupObject.put("item_list",itemArray);
|
|
itemGroupArray.put(itemGroupObject);
|
|
itemGroupArray.put(itemGroupObject);
|
|
result.put("item_group_list",itemGroupArray);
|
|
result.put("item_group_list",itemGroupArray);
|
|
- String jsonString = FormatJson.formatJson(result.toString());
|
|
|
|
- // 将格式化后的字符串写入文件
|
|
|
|
String fileName=case_take_id+".json";
|
|
String fileName=case_take_id+".json";
|
|
File file=new File(fileName);
|
|
File file=new File(fileName);
|
|
Writer write = new OutputStreamWriter(new FileOutputStream(file), "UTF-8");
|
|
Writer write = new OutputStreamWriter(new FileOutputStream(file), "UTF-8");
|
|
- write.write(jsonString);
|
|
|
|
|
|
+ write.write(result.toString());
|
|
write.flush();
|
|
write.flush();
|
|
write.close();
|
|
write.close();
|
|
- //OssAliyun.uploadFile("paperjson/"+case_take_id,file);
|
|
|
|
- JSONObject jsonObject=reviewPaperService.uploadPaper(result.toString());
|
|
|
|
- String paperId=jsonObject.getString("paperId");
|
|
|
|
- String url="http://mooctest-site.oss-cn-shanghai.aliyuncs.com/paperjson/"+case_take_id;
|
|
|
|
- crowdSourceToReviewPaperDao.save(new CrowdSourceToReviewPaper(paperId,case_take_id,url));
|
|
|
|
|
|
+ OssAliyun.uploadFile("paperjson/"+case_take_id+".json",file);
|
|
|
|
+ //JSONObject jsonObject=reviewPaperService.uploadPaper(result.toString());
|
|
|
|
+ //String paperId=jsonObject.getString("paperId");
|
|
|
|
+ //crowdSourceToReviewPaperDao.save(new CrowdSourceToReviewPaper(paperId,case_take_id,url));
|
|
return url;
|
|
return url;
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|