Browse Source

系统信息维护

yuhaitao14 7 years ago
parent
commit
1555386e73

+ 7 - 0
shop/src/main/java/com/zskk/shop/controller/admin/ShopConfigController.java

@@ -59,4 +59,11 @@ public class ShopConfigController extends AbstractController  {
 		shopConfigService.set(key, value);
 		shopConfigService.set(key, value);
 		return new ControllerResult(Boolean.TRUE);
 		return new ControllerResult(Boolean.TRUE);
 	}
 	}
+	
+	@RequestMapping("/release")
+	@ResponseBody
+	public ControllerResult release(@RequestParam("key") String key){
+		shopConfigService.release(key);
+		return new ControllerResult(Boolean.TRUE);
+	}
 }
 }

+ 45 - 0
shop/src/main/java/com/zskk/shop/controller/web/InfoController.java

@@ -0,0 +1,45 @@
+/**
+* @版权信息 (@copyright Copyright 2017-XXXX JDJR.COM All Right Reserved);
+* @see
+* @author 于海涛 京东金融【技术研发部-证券及营销平台研发部-营销平台研发部】
+* @version 1.0
+* @date 2018年6月21日
+*/
+
+package com.zskk.shop.controller.web;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import com.zskk.shop.controller.AbstractController;
+import com.zskk.shop.dao.entry.ShopConfig;
+import com.zskk.shop.service.ShopConfigService;
+
+@Controller
+@RequestMapping("/info")
+public class InfoController extends AbstractController {
+
+	@Autowired
+	private ShopConfigService shopConfigService;
+
+	@RequestMapping("/{key}")
+	public String info(Model model, @PathVariable("key") String key) {
+		ShopConfig config = shopConfigService.getOnline(key);
+
+		model.addAttribute("configBean", config);
+		this.initUser(model);
+		return "/info";
+	}
+
+	@RequestMapping("/preview/{key}")
+	public String preview(Model model, @PathVariable("key") String key) {
+		ShopConfig config = shopConfigService.getOnline(key);
+
+		model.addAttribute("configBean", config);
+		this.initUser(model);
+		return "/info";
+	}
+}

+ 4 - 0
shop/src/main/java/com/zskk/shop/dao/ShopConfigMapper.java

@@ -20,4 +20,8 @@ public interface ShopConfigMapper {
 	public ShopConfig query(String key);
 	public ShopConfig query(String key);
 	
 	
 	public List<ShopConfig> queryAll();
 	public List<ShopConfig> queryAll();
+	
+	public ShopConfig queryOnline(String key);
+	public void addOnline(ShopConfig shopConfig);
+	public int updateOnline(ShopConfig shopConfig);
 }
 }

+ 51 - 0
shop/src/main/java/com/zskk/shop/service/ShopConfigService.java

@@ -19,6 +19,8 @@ import org.springframework.stereotype.Service;
 
 
 import com.zskk.shop.dao.ShopConfigMapper;
 import com.zskk.shop.dao.ShopConfigMapper;
 import com.zskk.shop.dao.entry.ShopConfig;
 import com.zskk.shop.dao.entry.ShopConfig;
+import com.zskk.shop.exception.ErrorConstant;
+import com.zskk.shop.exception.ZSKKException;
 import com.zskk.shop.utils.ToolsUtil;
 import com.zskk.shop.utils.ToolsUtil;
 
 
 @Service
 @Service
@@ -28,11 +30,23 @@ public class ShopConfigService {
 	 */
 	 */
 	public static final String KEY_EQUIPMENT_INFO = "equipment_info";
 	public static final String KEY_EQUIPMENT_INFO = "equipment_info";
 	
 	
+	/**
+	 * KEY 中心专家
+	 */
+	public static final String KEY_DOCTOR_INFO = "doctor_info";
+	
+	/**
+	 * KEY 医技检查
+	 */
+	public static final String KEY_CHECK_INFO = "check_info";
+	
 	private Set<String> ALL_KEYS = new HashSet<>();
 	private Set<String> ALL_KEYS = new HashSet<>();
 	
 	
 	@PostConstruct
 	@PostConstruct
 	public void init(){
 	public void init(){
 		ALL_KEYS.add(KEY_EQUIPMENT_INFO);
 		ALL_KEYS.add(KEY_EQUIPMENT_INFO);
+		ALL_KEYS.add(KEY_DOCTOR_INFO);
+		ALL_KEYS.add(KEY_CHECK_INFO);
 	}
 	}
 	
 	
 	@Autowired
 	@Autowired
@@ -60,6 +74,16 @@ public class ShopConfigService {
 		return config != null? config.getValue(): null;
 		return config != null? config.getValue(): null;
 	}
 	}
 	
 	
+	/**
+	 * 获取配置
+	 * @param key
+	 * @return
+	 */
+	public ShopConfig getConfig(String key){
+		ShopConfig config = shopConfigMapper.query(key);
+		return config;
+	}
+	
 	/**
 	/**
 	 * 设置
 	 * 设置
 	 * @param key
 	 * @param key
@@ -80,4 +104,31 @@ public class ShopConfigService {
 			shopConfigMapper.add(config);
 			shopConfigMapper.add(config);
 		}
 		}
 	}
 	}
+	
+	/**
+	 * 发布配置
+	 * @param key
+	 */
+	public void release(String key){
+		ShopConfig from = getConfig(key);
+		if (from == null){
+			throw new ZSKKException(ErrorConstant.PARAM_ERROR);
+		}
+		
+		ShopConfig to = shopConfigMapper.queryOnline(key);
+		if (to == null){
+			shopConfigMapper.addOnline(from);
+		}else{
+			shopConfigMapper.updateOnline(from);
+		}
+	}
+	
+	/**
+	 * 查询上线配置数据
+	 * @param key
+	 * @return
+	 */
+	public ShopConfig getOnline(String key){
+		return shopConfigMapper.queryOnline(key);
+	}
 }
 }

+ 3 - 3
shop/src/main/resource/application-dev.properties

@@ -1,8 +1,8 @@
 server.port=10001
 server.port=10001
 
 
-spring.datasource.url=jdbc:mysql://localhost:3306/shop?allowMultiQueries=true&useSSL=false&characterEncoding=utf8
-spring.datasource.username=root
-spring.datasource.password=123456
+spring.datasource.url=jdbc:mysql://47.104.4.5:3306/tjshop?allowMultiQueries=true&useSSL=false&characterEncoding=utf8
+spring.datasource.username=pacs
+spring.datasource.password=ZSKK@2017~!@#
 spring.datasource.driverClassName=com.mysql.jdbc.Driver
 spring.datasource.driverClassName=com.mysql.jdbc.Driver
 spring.datasource.type=com.alibaba.druid.pool.DruidDataSource
 spring.datasource.type=com.alibaba.druid.pool.DruidDataSource
 
 

+ 14 - 0
shop/src/main/resource/mapper/ShopConfigMapper.xml

@@ -18,4 +18,18 @@
 		select *
 		select *
 		from shop_config
 		from shop_config
 	</select>
 	</select>
+	
+	<select id="queryOnline" resultType="com.zskk.shop.dao.entry.ShopConfig">
+		select *
+		from shop_config_online
+		where `key`=#{key}
+	</select>
+	<insert id="addOnline" parameterType="com.zskk.shop.dao.entry.ShopConfig">
+		insert into shop_config_online(`key`, description, `value`, ctime)
+		values(#{key}, #{description}, #{value}, #{ctime})
+	</insert>
+	<update id="updateOnline" parameterType="com.zskk.shop.dao.entry.ShopConfig">
+		update shop_config_online set`value`=#{value}
+		where `key`=#{key}
+	</update>
 </mapper>
 </mapper>

+ 3 - 3
shop/src/main/resource/templates/fragments.html

@@ -43,9 +43,9 @@
 					<ul>
 					<ul>
 						<li><a href="/">首页</a></li>
 						<li><a href="/">首页</a></li>
 						<li class="cli"><a href="/">体检套餐</a></li>
 						<li class="cli"><a href="/">体检套餐</a></li>
-						<li><a href="#">医技检查</a></li>
-						<li><a href="#">中心专家</a></li>
-						<li><a href="#">设备介绍</a></li>
+						<li><a href="/info/check_info">医技检查</a></li>
+						<li><a href="/info/doctor_info">中心专家</a></li>
+						<li><a href="/info/equipment_info">设备介绍</a></li>
 					</ul>
 					</ul>
 					<div class="search-box"></div>
 					<div class="search-box"></div>
 				</div>
 				</div>

+ 34 - 0
shop/src/main/resource/templates/info.html

@@ -0,0 +1,34 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<title>黑龙江昆仑盛和安体检中心</title>
+<link rel="stylesheet" type="text/css" href="/style/common.css" />
+<link rel="stylesheet" type="text/css" href="/style/shop.css" />
+<!--[if lt IE 9]> 
+<script src="http://css3-mediaqueries-js.googlecode.com/svn/trunk/css3-mediaqueries.js"></script> 
+<![endif]-->
+<!--窗口自适应适配低端IE-->
+<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
+
+<style type="text/css">
+.nodata {
+	color: #999;
+	text-align: center;
+	margin-top: 3rem;
+}
+</style>
+
+</head>
+
+<body>
+	<div th:include="/fragments :: header"></div>
+	<div class="wp">
+		<div class="main bgFF ov-h">
+			<div class="mt20" th:utext="${configBean.value}"></div>
+		</div>
+	</div>
+
+	<div th:replace="/fragments :: footer"></div>
+</body>
+</html>

+ 2 - 2
shop/src/main/resource/templates/shop.html

@@ -3,8 +3,8 @@
 <head>
 <head>
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 <title>黑龙江昆仑盛和安体检中心</title>
 <title>黑龙江昆仑盛和安体检中心</title>
-<link rel="stylesheet" type="text/css" href="../style/common.css" />
-<link rel="stylesheet" type="text/css" href="../style/shop.css" />
+<link rel="stylesheet" type="text/css" href="/style/common.css" />
+<link rel="stylesheet" type="text/css" href="/style/shop.css" />
 <!--[if lt IE 9]> 
 <!--[if lt IE 9]> 
 <script src="http://css3-mediaqueries-js.googlecode.com/svn/trunk/css3-mediaqueries.js"></script> 
 <script src="http://css3-mediaqueries-js.googlecode.com/svn/trunk/css3-mediaqueries.js"></script> 
 <![endif]-->
 <![endif]-->

+ 1 - 0
shop/static/manager/src/api/index.js

@@ -88,4 +88,5 @@ export default {
     getSysConfig: (params, vue) => post(`${serverPath}manage/config/get`, params, vue),
     getSysConfig: (params, vue) => post(`${serverPath}manage/config/get`, params, vue),
     saveSysConfig: (params, vue) => post(`${serverPath}manage/config/save`, params, vue),
     saveSysConfig: (params, vue) => post(`${serverPath}manage/config/save`, params, vue),
     getAllSysConfig: (params, vue) => post(`${serverPath}manage/config/getAll`, params, vue),
     getAllSysConfig: (params, vue) => post(`${serverPath}manage/config/getAll`, params, vue),
+    releaseSysConfig: (params, vue) => post(`${serverPath}manage/config/release`, params, vue),
 }
 }

+ 1 - 1
shop/static/manager/src/components/page/config/EditShopConfig.vue

@@ -34,7 +34,7 @@ export default {
             type: 'success',
             type: 'success',
             duration: 1000,
             duration: 1000,
             onClose: function() {
             onClose: function() {
-              that.$router.push('/sysLabelManager')
+              that.$router.push('/sysConfig')
             }
             }
           })
           })
         }
         }

+ 26 - 9
shop/static/manager/src/components/page/config/ShopConfigManager.vue

@@ -6,8 +6,10 @@
         <el-table-column label="操作">
         <el-table-column label="操作">
             <template slot-scope="scope">
             <template slot-scope="scope">
                 <el-button type="text" size="small" @click="goEdit(scope.row)">编辑</el-button>
                 <el-button type="text" size="small" @click="goEdit(scope.row)">编辑</el-button>
-                <el-button type="text" size="small" @click="goEdit(scope.row)">预览</el-button>
-                <el-button type="text" size="small" @click="goEdit(scope.row)">发布</el-button>
+                <a :href="serverPath + 'info/preview/' + scope.row.key" target="_black">
+                    <el-button type="text" size="small">预览</el-button>
+                </a>
+                <el-button type="text" size="small" @click="release(scope.row)">发布</el-button>
             </template>
             </template>
         </el-table-column>
         </el-table-column>
     </el-table>
     </el-table>
@@ -16,12 +18,27 @@
 export default {
 export default {
   data: function() {
   data: function() {
     return {
     return {
-      items: []
+      items: [],
+      serverPath: process.env.SERVER_PATH
     }
     }
   },
   },
   methods: {
   methods: {
     goEdit: function(row) {
     goEdit: function(row) {
       this.$router.push({ path: '/editSysConfig', query: { key: row.key } })
       this.$router.push({ path: '/editSysConfig', query: { key: row.key } })
+    },
+    release: function(row) {
+      this.$confirm('您确定要发布配置信息吗 , 是否继续?', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning'
+      }).then(() => {
+        this.$http.releaseSysConfig({ key: row.key }, this).then(res => {
+          this.$message({
+            message: '操作成功',
+            type: 'success'
+          })
+        })
+      })
     }
     }
   },
   },
   mounted: function() {
   mounted: function() {
@@ -35,11 +52,11 @@ export default {
 </script>
 </script>
 
 
 <style>
 <style>
-    .online {
-        color: #67c23a
-    }
-    .offline {
-        color: #f56c6c;
-    }
+.online {
+  color: #67c23a;
+}
+.offline {
+  color: #f56c6c;
+}
 </style>
 </style>