From 83c80c4be845c6ddb5f1385201e74289d0262598 Mon Sep 17 00:00:00 2001
From: wuxw7 <wuxw7@asiainfo.com>
Date: 星期三, 09 五月 2018 22:39:55 +0800
Subject: [PATCH] 完成 配置方式 页面数据显示
---
ConsoleService/src/main/java/com/java110/console/controller/ConsoleController.java | 40 ++++++++++++++++++++++++++++++++++------
1 files changed, 34 insertions(+), 6 deletions(-)
diff --git a/ConsoleService/src/main/java/com/java110/console/controller/ConsoleController.java b/ConsoleService/src/main/java/com/java110/console/controller/ConsoleController.java
index 2616c3b..cb3f07b 100644
--- a/ConsoleService/src/main/java/com/java110/console/controller/ConsoleController.java
+++ b/ConsoleService/src/main/java/com/java110/console/controller/ConsoleController.java
@@ -1,8 +1,10 @@
package com.java110.console.controller;
+import com.alibaba.fastjson.JSONObject;
import com.java110.common.exception.NoAuthorityException;
import com.java110.common.exception.SMOException;
import com.java110.common.util.Assert;
+import com.java110.common.util.StringUtil;
import com.java110.console.smo.IConsoleServiceSMO;
import com.java110.core.base.controller.BaseController;
import com.java110.entity.service.PageData;
@@ -35,6 +37,7 @@
PageData pd = this.getPageData(request);
// 鍒ゆ柇鐢ㄦ埛鏄惁鐧诲綍
checkLogin(pd);
+ model.addAttribute("templateName","鎺у埗涓績棣栭〉");
//2.0 鏌ヨ鑿滃崟淇℃伅
getMenus(model,pd,consoleServiceSMOImpl.getMenuItemsByManageId(pd.getUserId()));
//3.0 鏌ヨ鍚勪釜绯荤粺璋冪敤閲�
@@ -61,20 +64,26 @@
*/
@RequestMapping(path = "/console/list")
public String listData(Model model, HttpServletRequest request){
- String template = "list_template";
+ String template = "";
try {
- String templateCode = request.getParameter("templateCode");
- Assert.hasLength(templateCode,"璇锋眰鍙傛暟templateCode 涓嶈兘涓虹┖锛�");
-
- model.addAttribute("templateCode",templateCode);
//1.0 鑾峰彇瀵硅薄
PageData pd = this.getPageData(request);
+
+ Assert.hasLength(pd.getParam().getString("templateCode"),"璇锋眰鍙傛暟templateCode 涓嶈兘涓虹┖锛�");
// 鍒ゆ柇鐢ㄦ埛鏄惁鐧诲綍
checkLogin(pd);
- //2.0 鏌ヨ鑿滃崟淇℃伅
+ //2.0 鏌ヨ妯℃澘淇℃伅
+ checkTemplate(pd,model);
+ //3.0 鏌ヨ鑿滃崟淇℃伅
getMenus(model,pd,consoleServiceSMOImpl.getMenuItemsByManageId(pd.getUserId()));
//3.0 鏌ヨ鍚勪釜绯荤粺璋冪敤閲�
+
+ template = pd.getData().getJSONObject("template").containsKey("htmlName")
+ && !StringUtil.isNullOrNone( pd.getData().getJSONObject("template").getString("htmlName")) ?
+ pd.getData().getJSONObject("template").getString("htmlName"):
+ "list_template";
+
}catch (NoAuthorityException e){
//璺宠浆鍒扮櫥褰曢〉闈�
template = "redirect:/login";
@@ -92,6 +101,25 @@
}
+ /**
+ * 妯℃澘鏍¢獙骞跺皢妯℃澘鍐欏叆鍒� model 瀵硅薄涓� 鍓嶅彴椤甸潰灞曠ず鐢�
+ * @param pd
+ * @param model
+ */
+ private void checkTemplate(PageData pd,Model model) throws IllegalArgumentException{
+ try {
+ consoleServiceSMOImpl.getTemplate(pd);
+ JSONObject template = pd.getData().getJSONObject("template");
+ model.addAttribute("templateCode",template.getString("templateCode"));
+ model.addAttribute("templateName",template.getString("templateName"));
+ }catch (Exception e){
+ logger.error("鏌ヨ寮傚父",e);
+ throw new IllegalArgumentException("閰嶇疆閿欒锛屾病鏈夊綋鍓嶆ā鏉裤��"+pd.getParam().getString("templateCode")+"銆�");
+ }
+
+ }
+
+
public IConsoleServiceSMO getConsoleServiceSMOImpl() {
return consoleServiceSMOImpl;
--
Gitblit v1.8.0