|
@@ -17,6 +17,7 @@ import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
+import java.io.UnsupportedEncodingException;
|
|
|
import java.net.URL;
|
|
|
import java.net.URLDecoder;
|
|
|
import java.net.URLEncoder;
|
|
@@ -46,28 +47,34 @@ public class ProjectSceneController extends BaseController{
|
|
|
}
|
|
|
|
|
|
@PostMapping("/createSceneShare")
|
|
|
- public Result createSceneShare(){
|
|
|
+ public Result createSceneShare() throws UnsupportedEncodingException {
|
|
|
SceneGpsParam param = new SceneGpsParam();
|
|
|
param.setUserId(getUser().getId());
|
|
|
param.setCompanyId(getUser().getCompanyId());
|
|
|
String jsonString = JSONObject.toJSONString(param);
|
|
|
String ciphertext = RsaUtils.encipher(jsonString, RsaUtils.publicKey);
|
|
|
- return Result.success("/service/manage_jp/projectScene/getSceneMap/"+ URLEncoder.encode(ciphertext)+"/1");
|
|
|
+ return Result.success("/service/manage_jp/projectScene/getSceneMap/"+ URLEncoder.encode(ciphertext,"utf-8")+"/1");
|
|
|
}
|
|
|
|
|
|
@GetMapping("/getSceneMap/{ciphertext}/{type}")
|
|
|
public Result getSceneMap(@PathVariable String ciphertext,
|
|
|
- @PathVariable Integer type){
|
|
|
+ @PathVariable Integer type) throws UnsupportedEncodingException {
|
|
|
if (StringUtils.isBlank(ciphertext)){
|
|
|
throw new BusinessException(ResultCode.PARAM_ERROR);
|
|
|
}
|
|
|
- ciphertext = URLDecoder.decode(ciphertext);
|
|
|
+ log.info(ciphertext);
|
|
|
+ ciphertext = URLDecoder.decode(ciphertext,"utf-8");
|
|
|
log.info("ciphertext:{},type:{}",ciphertext,type);
|
|
|
String deTxt = RsaUtils.decipher(ciphertext, RsaUtils.privateKey);
|
|
|
SceneGpsParam param = JSONObject.parseObject(deTxt, SceneGpsParam.class);
|
|
|
param.setType(type);
|
|
|
return Result.success(projectSceneGpsService.allSceneGps(param));
|
|
|
}
|
|
|
+
|
|
|
+ public static void main(String[] args) {
|
|
|
+ String ciphertext = URLDecoder.decode("YTpCgd1WVXGvu8SP7BggVQKWn9xb0lCOOaCJQWe6Irbwn0JAHru%2B0LbPAdTplJEEmUEbz7sdsKmcNeKxR%2Bv4nw%3D%3D");
|
|
|
+ System.out.println(RsaUtils.decipher(ciphertext, RsaUtils.privateKey));
|
|
|
+ }
|
|
|
|
|
|
}
|
|
|
|