|
@@ -9,13 +9,11 @@ import com.lightinit.hsdataportal.model.*;
|
|
|
import com.lightinit.hsdataportal.service.IMicroappService;
|
|
|
import com.lightinit.hsdataportal.service.IMyDataService;
|
|
|
import com.lightinit.hsdataportal.service.IResourceCatelogService;
|
|
|
-import com.sun.deploy.net.HttpUtils;
|
|
|
import org.apache.http.NameValuePair;
|
|
|
import org.apache.http.message.BasicNameValuePair;
|
|
|
import org.apache.shiro.authz.annotation.RequiresAuthentication;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.context.annotation.Configuration;
|
|
|
import org.springframework.stereotype.Controller;
|
|
|
import org.springframework.validation.BindingResult;
|
|
@@ -32,13 +30,12 @@ import javax.servlet.http.HttpSession;
|
|
|
import javax.validation.Valid;
|
|
|
import java.io.UnsupportedEncodingException;
|
|
|
import java.net.URLDecoder;
|
|
|
-import java.util.*;
|
|
|
-
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.Date;
|
|
|
+import java.util.List;
|
|
|
@RequestMapping(value = "/open/microapp")
|
|
|
@Controller
|
|
|
public class MicroappOpenController extends BaseController {
|
|
|
- @Value("${applicationId}")
|
|
|
- private String appId;
|
|
|
@Autowired
|
|
|
private IMicroappService microappService;
|
|
|
@Autowired
|
|
@@ -46,6 +43,7 @@ public class MicroappOpenController extends BaseController {
|
|
|
@Autowired
|
|
|
private IMyDataService myDataService;
|
|
|
@RequestMapping(value = "openList.action")
|
|
|
+ @ResponseBody
|
|
|
public ModelAndView openList(MicroappSearchModel inputModel, @RequestParam(defaultValue = "1") int pageNo) {
|
|
|
ModelAndView modelAndView = new ModelAndView("/open/microapp/index");
|
|
|
BaseExample.Page pager = new BaseExample.Page();
|
|
@@ -118,28 +116,26 @@ public class MicroappOpenController extends BaseController {
|
|
|
* @param id
|
|
|
* @return
|
|
|
*/
|
|
|
+// @RequestMapping(value = "openDemo.action/{id}")
|
|
|
@RequestMapping(value = "openDemo.action/{id}/{flag}", produces = "text/html; charset=UTF-8")
|
|
|
@RequiresAuthentication
|
|
|
@ResponseBody
|
|
|
- public String openDemo(@PathVariable long id,@PathVariable int flag,HttpSession session) throws Exception {
|
|
|
- LoginUser loginUser =(LoginUser) session.getAttribute(LoginUser.SESSION_KEY_LOGIN_USER);
|
|
|
+ public String openDemo(@PathVariable long id,@PathVariable int flag) {
|
|
|
ResourceMicroappWithBLOBs outputModel=microappService.demo(id);
|
|
|
- ApiEncryptUtil apiEncryptUtil = new ApiEncryptUtil();
|
|
|
- long userId = loginUser.getId();
|
|
|
- String publicKey = microappService.getPublicKey(userId);
|
|
|
- String username = loginUser.getUsername();
|
|
|
- Long date = new Date().getTime();
|
|
|
- String version = "1.0";
|
|
|
- String timestamp = date.toString();
|
|
|
- String summary = apiEncryptUtil.encrypt(appId+username+timestamp,apiEncryptUtil.getPublicKey(publicKey));
|
|
|
String html ="";
|
|
|
if(flag==1) {
|
|
|
- html = HttpTookitUtils.doGet(outputModel.getUrl(),CharEncoding.UTF8,appId,username,version,timestamp,summary);
|
|
|
-// html = HttpTookitUtils.doGet(outputModel.getUrl(),null, CharEncoding.UTF8);
|
|
|
+ html = HttpTookitUtils.doGet(outputModel.getUrl(),null, CharEncoding.UTF8);
|
|
|
}else {
|
|
|
- html = HttpTookitUtils.doGet(outputModel.getDemoUrl(),CharEncoding.UTF8,appId,username,version,timestamp,summary);
|
|
|
-
|
|
|
+ html = HttpTookitUtils.doGet(outputModel.getDemoUrl(),null, CharEncoding.UTF8);
|
|
|
}
|
|
|
+
|
|
|
+// String html = HttpTookitUtils.doGet("http://127.0.0.1:8080/hsdatashowapi/app/cockpit/jmxfzs.htm",null, CharEncoding.UTF8);
|
|
|
+// String str="";
|
|
|
+// try {
|
|
|
+// str = new String(html.getBytes("utf-8"),"iso8859-1");
|
|
|
+// } catch (UnsupportedEncodingException e) {
|
|
|
+// e.printStackTrace();
|
|
|
+// }
|
|
|
return html;
|
|
|
}
|
|
|
|