|
@@ -2,6 +2,7 @@ package edu.nju.controller;
|
|
|
|
|
|
import java.io.IOException;
|
|
import java.io.IOException;
|
|
import java.io.PrintWriter;
|
|
import java.io.PrintWriter;
|
|
|
|
+import java.net.URLDecoder;
|
|
import java.util.Arrays;
|
|
import java.util.Arrays;
|
|
import java.util.HashMap;
|
|
import java.util.HashMap;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
@@ -17,6 +18,7 @@ import org.json.JSONArray;
|
|
import org.json.JSONObject;
|
|
import org.json.JSONObject;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Controller;
|
|
import org.springframework.stereotype.Controller;
|
|
|
|
+import org.springframework.util.DigestUtils;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import edu.nju.service.AnalyzeService;
|
|
import edu.nju.service.AnalyzeService;
|
|
@@ -533,9 +535,9 @@ public class AnalyzeController {
|
|
* @param token
|
|
* @param token
|
|
* @param response
|
|
* @param response
|
|
*/
|
|
*/
|
|
- @RequestMapping(value = "/analyse/tokenToDetail", method = RequestMethod.GET)
|
|
|
|
|
|
+ @RequestMapping(value = "/tokenToDetail")
|
|
@ResponseBody
|
|
@ResponseBody
|
|
- public void tokenToDetailUrl(@RequestParam("token") String token ,HttpServletResponse response){
|
|
|
|
|
|
+ public void tokenToDetailUrl(String token ,HttpServletResponse response){
|
|
try {
|
|
try {
|
|
JSONObject result = new JSONObject();
|
|
JSONObject result = new JSONObject();
|
|
ShortToken shortToken=aservice.tokenToDetail(token);
|
|
ShortToken shortToken=aservice.tokenToDetail(token);
|
|
@@ -568,14 +570,15 @@ public class AnalyzeController {
|
|
* @param endTime
|
|
* @param endTime
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
- @RequestMapping(value = "/analyse/detailToToken")
|
|
|
|
|
|
+ @RequestMapping(value = "/detailToToken")
|
|
@ResponseBody
|
|
@ResponseBody
|
|
- public JSONObject detailToToken(String examId,String caseId,String userId,String beginTime,String endTime){
|
|
|
|
|
|
+ public String detailToToken(String examId,String caseId,String userId,String beginTime,String endTime){
|
|
JSONObject result = new JSONObject();
|
|
JSONObject result = new JSONObject();
|
|
try {
|
|
try {
|
|
ShortToken shortToken=aservice.findTokenByDetail(examId,caseId,userId);
|
|
ShortToken shortToken=aservice.findTokenByDetail(examId,caseId,userId);
|
|
if(shortToken==null){
|
|
if(shortToken==null){
|
|
- String token=AESUtil.encrypt(examId+"/"+caseId+"/"+userId);
|
|
|
|
|
|
+// String token=AESUtil.encrypt(examId+"/"+caseId+"/"+userId);
|
|
|
|
+ String token= DigestUtils.md5DigestAsHex((examId+"/"+caseId+"/"+userId).getBytes());
|
|
ShortToken newShortToken=new ShortToken(token,beginTime,endTime,caseId,examId,userId,true);
|
|
ShortToken newShortToken=new ShortToken(token,beginTime,endTime,caseId,examId,userId,true);
|
|
aservice.saveShortToken(newShortToken);
|
|
aservice.saveShortToken(newShortToken);
|
|
result.put("result","success");
|
|
result.put("result","success");
|
|
@@ -587,12 +590,12 @@ public class AnalyzeController {
|
|
result.put("result","success");
|
|
result.put("result","success");
|
|
result.put("token",shortToken.getToken());
|
|
result.put("token",shortToken.getToken());
|
|
}
|
|
}
|
|
- return result;
|
|
|
|
|
|
+ return result.toString();
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
}
|
|
}
|
|
result.put("result","fail");
|
|
result.put("result","fail");
|
|
- return result;
|
|
|
|
|
|
+ return result.toString();
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|