Merge branch 'dev_degrade'
Showing
7 changed files
with
75 additions
and
13 deletions
@@ -9,9 +9,10 @@ | @@ -9,9 +9,10 @@ | ||
9 | <result column="config_desc" property="configDesc" jdbcType="VARCHAR" /> | 9 | <result column="config_desc" property="configDesc" jdbcType="VARCHAR" /> |
10 | <result column="level" property="level" jdbcType="TINYINT" /> | 10 | <result column="level" property="level" jdbcType="TINYINT" /> |
11 | <result column="img_url" property="imgUrl" jdbcType="VARCHAR" /> | 11 | <result column="img_url" property="imgUrl" jdbcType="VARCHAR" /> |
12 | + <result column="function_point_name" property="functionPointName" jdbcType="VARCHAR" /> | ||
12 | </resultMap> | 13 | </resultMap> |
13 | <sql id="Base_Column_List" > | 14 | <sql id="Base_Column_List" > |
14 | - id, config_name, config_show_name, switch_on, config_desc, level, img_url | 15 | + id, config_name, config_show_name, switch_on, config_desc, level, img_url,function_point_name |
15 | </sql> | 16 | </sql> |
16 | <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" > | 17 | <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" > |
17 | select | 18 | select |
@@ -19,7 +20,7 @@ | @@ -19,7 +20,7 @@ | ||
19 | from degrade_info | 20 | from degrade_info |
20 | where id = #{id,jdbcType=INTEGER} | 21 | where id = #{id,jdbcType=INTEGER} |
21 | </select> | 22 | </select> |
22 | - <select id="selectByCondition" resultMap="BaseResultMap" > | 23 | + <select id="selectByCondition" resultMap="BaseResultMap" parameterType="com.monitor.model.request.DegradeInfoReq"> |
23 | select | 24 | select |
24 | <include refid="Base_Column_List" /> | 25 | <include refid="Base_Column_List" /> |
25 | from degrade_info | 26 | from degrade_info |
@@ -31,16 +32,22 @@ | @@ -31,16 +32,22 @@ | ||
31 | and level = #{level} | 32 | and level = #{level} |
32 | </if> | 33 | </if> |
33 | </select> | 34 | </select> |
35 | + | ||
36 | + <select id="selectAllFunction" resultType="java.lang.String"> | ||
37 | + select function_point_name | ||
38 | + from degrade_info WHERE function_point_name IS NOT NULL AND function_point_name !='' group by function_point_name | ||
39 | + </select> | ||
40 | + | ||
34 | <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" > | 41 | <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" > |
35 | delete from degrade_info | 42 | delete from degrade_info |
36 | where id = #{id,jdbcType=INTEGER} | 43 | where id = #{id,jdbcType=INTEGER} |
37 | </delete> | 44 | </delete> |
38 | <insert id="insert" parameterType="com.monitor.model.domain.DegradeConfig" > | 45 | <insert id="insert" parameterType="com.monitor.model.domain.DegradeConfig" > |
39 | insert into degrade_info (id, config_name, config_show_name, switch_on, | 46 | insert into degrade_info (id, config_name, config_show_name, switch_on, |
40 | - config_desc, level, img_url | 47 | + config_desc, level, img_url,function_point_name |
41 | ) | 48 | ) |
42 | values (#{id,jdbcType=INTEGER}, #{configName,jdbcType=VARCHAR}, #{configShowName,jdbcType=VARCHAR}, #{switchOn,jdbcType=CHAR}, | 49 | values (#{id,jdbcType=INTEGER}, #{configName,jdbcType=VARCHAR}, #{configShowName,jdbcType=VARCHAR}, #{switchOn,jdbcType=CHAR}, |
43 | - #{configDesc,jdbcType=VARCHAR}, #{level,jdbcType=TINYINT}, #{imgUrl,jdbcType=VARCHAR} | 50 | + #{configDesc,jdbcType=VARCHAR}, #{level,jdbcType=TINYINT}, #{imgUrl,jdbcType=VARCHAR},#{functionPointName,jdbcType=VARCHAR} |
44 | ) | 51 | ) |
45 | </insert> | 52 | </insert> |
46 | <insert id="insertSelective" parameterType="com.monitor.model.domain.DegradeConfig" > | 53 | <insert id="insertSelective" parameterType="com.monitor.model.domain.DegradeConfig" > |
@@ -64,6 +71,9 @@ | @@ -64,6 +71,9 @@ | ||
64 | <if test="imgUrl != null" > | 71 | <if test="imgUrl != null" > |
65 | img_url, | 72 | img_url, |
66 | </if> | 73 | </if> |
74 | + <if test="functionPointName != null" > | ||
75 | + function_point_name, | ||
76 | + </if> | ||
67 | </trim> | 77 | </trim> |
68 | <trim prefix="values (" suffix=")" suffixOverrides="," > | 78 | <trim prefix="values (" suffix=")" suffixOverrides="," > |
69 | <if test="configName != null" > | 79 | <if test="configName != null" > |
@@ -84,6 +94,9 @@ | @@ -84,6 +94,9 @@ | ||
84 | <if test="imgUrl != null" > | 94 | <if test="imgUrl != null" > |
85 | #{imgUrl,jdbcType=VARCHAR}, | 95 | #{imgUrl,jdbcType=VARCHAR}, |
86 | </if> | 96 | </if> |
97 | + <if test="functionPointName != null" > | ||
98 | + #{functionPointName,jdbcType=VARCHAR}, | ||
99 | + </if> | ||
87 | </trim> | 100 | </trim> |
88 | </insert> | 101 | </insert> |
89 | <update id="updateByPrimaryKeySelective" parameterType="com.monitor.model.domain.DegradeConfig" > | 102 | <update id="updateByPrimaryKeySelective" parameterType="com.monitor.model.domain.DegradeConfig" > |
@@ -104,6 +117,9 @@ | @@ -104,6 +117,9 @@ | ||
104 | <if test="imgUrl != null" > | 117 | <if test="imgUrl != null" > |
105 | img_url = #{imgUrl,jdbcType=VARCHAR}, | 118 | img_url = #{imgUrl,jdbcType=VARCHAR}, |
106 | </if> | 119 | </if> |
120 | + <if test="functionPointName != null" > | ||
121 | + function_point_name = #{functionPointName,jdbcType=VARCHAR}, | ||
122 | + </if> | ||
107 | </set> | 123 | </set> |
108 | where id = #{id,jdbcType=INTEGER} | 124 | where id = #{id,jdbcType=INTEGER} |
109 | </update> | 125 | </update> |
@@ -114,7 +130,8 @@ | @@ -114,7 +130,8 @@ | ||
114 | switch_on = #{switchOn,jdbcType=CHAR}, | 130 | switch_on = #{switchOn,jdbcType=CHAR}, |
115 | config_desc = #{configDesc,jdbcType=VARCHAR}, | 131 | config_desc = #{configDesc,jdbcType=VARCHAR}, |
116 | level = #{level,jdbcType=TINYINT}, | 132 | level = #{level,jdbcType=TINYINT}, |
117 | - img_url = #{imgUrl,jdbcType=VARCHAR} | 133 | + img_url = #{imgUrl,jdbcType=VARCHAR}, |
134 | + function_point_name = #{functionPointName,jdbcType=VARCHAR} | ||
118 | where id = #{id,jdbcType=INTEGER} | 135 | where id = #{id,jdbcType=INTEGER} |
119 | </update> | 136 | </update> |
120 | </mapper> | 137 | </mapper> |
@@ -34,7 +34,7 @@ public class DegradeController { | @@ -34,7 +34,7 @@ public class DegradeController { | ||
34 | @RequestMapping("/change") | 34 | @RequestMapping("/change") |
35 | @ResponseBody | 35 | @ResponseBody |
36 | public BaseResponse addDegradeConfig(@RequestBody DegradeInfoReq req){ | 36 | public BaseResponse addDegradeConfig(@RequestBody DegradeInfoReq req){ |
37 | - BaseResponse<Integer> baseResponse = new BaseResponse(); | 37 | + BaseResponse<Integer> baseResponse = new BaseResponse<>(); |
38 | if (req.getId()>0) { | 38 | if (req.getId()>0) { |
39 | baseResponse.setData(degradeService.updateDegradeConfig(req)); | 39 | baseResponse.setData(degradeService.updateDegradeConfig(req)); |
40 | } else { | 40 | } else { |
@@ -44,4 +44,13 @@ public class DegradeController { | @@ -44,4 +44,13 @@ public class DegradeController { | ||
44 | return baseResponse; | 44 | return baseResponse; |
45 | } | 45 | } |
46 | 46 | ||
47 | + @RequestMapping("/getFunction") | ||
48 | + @ResponseBody | ||
49 | + public BaseResponse getFunction(){ | ||
50 | + BaseResponse<List> baseResponse = new BaseResponse<>(); | ||
51 | + List<String> functions = degradeService.getFunction(); | ||
52 | + baseResponse.setData(functions); | ||
53 | + return baseResponse; | ||
54 | + } | ||
55 | + | ||
47 | } | 56 | } |
@@ -4,6 +4,8 @@ import com.monitor.model.domain.DegradeConfig; | @@ -4,6 +4,8 @@ import com.monitor.model.domain.DegradeConfig; | ||
4 | import com.monitor.model.response.PageResponse; | 4 | import com.monitor.model.response.PageResponse; |
5 | import com.monitor.model.request.DegradeInfoReq; | 5 | import com.monitor.model.request.DegradeInfoReq; |
6 | 6 | ||
7 | +import java.util.List; | ||
8 | + | ||
7 | /** | 9 | /** |
8 | * Created by zhaoqi on 2016/8/26 0026. | 10 | * Created by zhaoqi on 2016/8/26 0026. |
9 | */ | 11 | */ |
@@ -14,4 +16,6 @@ public interface DegradeService { | @@ -14,4 +16,6 @@ public interface DegradeService { | ||
14 | int addDegradeConfig(DegradeInfoReq config); | 16 | int addDegradeConfig(DegradeInfoReq config); |
15 | 17 | ||
16 | int updateDegradeConfig(DegradeInfoReq config); | 18 | int updateDegradeConfig(DegradeInfoReq config); |
19 | + | ||
20 | + List<String> getFunction(); | ||
17 | } | 21 | } |
@@ -13,9 +13,7 @@ import org.springframework.beans.BeanUtils; | @@ -13,9 +13,7 @@ import org.springframework.beans.BeanUtils; | ||
13 | import org.springframework.stereotype.Service; | 13 | import org.springframework.stereotype.Service; |
14 | 14 | ||
15 | import javax.annotation.Resource; | 15 | import javax.annotation.Resource; |
16 | -import java.util.ArrayList; | ||
17 | -import java.util.List; | ||
18 | -import java.util.Objects; | 16 | +import java.util.*; |
19 | import java.util.regex.Matcher; | 17 | import java.util.regex.Matcher; |
20 | import java.util.regex.Pattern; | 18 | import java.util.regex.Pattern; |
21 | 19 | ||
@@ -38,7 +36,8 @@ public class DegradeServiceImpl implements DegradeService { | @@ -38,7 +36,8 @@ public class DegradeServiceImpl implements DegradeService { | ||
38 | private static String QQ = "zookeeper_qq"; | 36 | private static String QQ = "zookeeper_qq"; |
39 | 37 | ||
40 | // 测试用 | 38 | // 测试用 |
41 | -// private static String TEST = "zookeeper_205"; | 39 | +// private static String TEST205 = "zookeeper_205"; |
40 | +// private static String TEST211 = "zookeeper_211"; | ||
42 | 41 | ||
43 | @Override | 42 | @Override |
44 | public PageResponse<DegradeConfig> getDegradeConfigList(DegradeInfoReq req) { | 43 | public PageResponse<DegradeConfig> getDegradeConfigList(DegradeInfoReq req) { |
@@ -71,6 +70,11 @@ public class DegradeServiceImpl implements DegradeService { | @@ -71,6 +70,11 @@ public class DegradeServiceImpl implements DegradeService { | ||
71 | return degradeConfigMapper.updateByPrimaryKeySelective(degradeConfig); | 70 | return degradeConfigMapper.updateByPrimaryKeySelective(degradeConfig); |
72 | } | 71 | } |
73 | 72 | ||
73 | + @Override | ||
74 | + public List<String> getFunction() { | ||
75 | + return degradeConfigMapper.selectAllFunction(); | ||
76 | + } | ||
77 | + | ||
74 | private void modifyZkConfig(DegradeInfoReq req) { | 78 | private void modifyZkConfig(DegradeInfoReq req) { |
75 | ZkTreeAllReq zkTreeAllReq = new ZkTreeAllReq(); | 79 | ZkTreeAllReq zkTreeAllReq = new ZkTreeAllReq(); |
76 | 80 | ||
@@ -85,9 +89,14 @@ public class DegradeServiceImpl implements DegradeService { | @@ -85,9 +89,14 @@ public class DegradeServiceImpl implements DegradeService { | ||
85 | zkMoitorService.editZkMonitorDetail(zkTreeAllReq); | 89 | zkMoitorService.editZkMonitorDetail(zkTreeAllReq); |
86 | return ; | 90 | return ; |
87 | } | 91 | } |
92 | + | ||
88 | zkTreeAllReq.setIp(req.getCloudType()); | 93 | zkTreeAllReq.setIp(req.getCloudType()); |
89 | - // test | ||
90 | -// zkTreeAllReq.setIp(TEST); | 94 | +// // test |
95 | +// if (req.getCloudType().equals(AWS)) { | ||
96 | +// zkTreeAllReq.setIp(TEST205); | ||
97 | +// } else { | ||
98 | +// zkTreeAllReq.setIp(TEST211); | ||
99 | +// } | ||
91 | zkMoitorService.editZkMonitorDetail(zkTreeAllReq); | 100 | zkMoitorService.editZkMonitorDetail(zkTreeAllReq); |
92 | } | 101 | } |
93 | 102 | ||
@@ -112,6 +121,7 @@ public class DegradeServiceImpl implements DegradeService { | @@ -112,6 +121,7 @@ public class DegradeServiceImpl implements DegradeService { | ||
112 | config.setImgUrl(configDb.getImgUrl()); | 121 | config.setImgUrl(configDb.getImgUrl()); |
113 | config.setId(configDb.getId()); | 122 | config.setId(configDb.getId()); |
114 | config.setLevel(configDb.getLevel()); | 123 | config.setLevel(configDb.getLevel()); |
124 | + config.setFunctionPointName(configDb.getFunctionPointName()); | ||
115 | break; | 125 | break; |
116 | } | 126 | } |
117 | } | 127 | } |
@@ -149,6 +159,11 @@ public class DegradeServiceImpl implements DegradeService { | @@ -149,6 +159,11 @@ public class DegradeServiceImpl implements DegradeService { | ||
149 | continue; | 159 | continue; |
150 | } | 160 | } |
151 | } | 161 | } |
162 | + if (StringUtils.isNotBlank(req.getFunctionPointName())) { | ||
163 | + if (!Objects.equals(degradeConfig.getFunctionPointName(), req.getFunctionPointName())) { | ||
164 | + continue; | ||
165 | + } | ||
166 | + } | ||
152 | // 名称没有degrade的配置也不要 | 167 | // 名称没有degrade的配置也不要 |
153 | if (!degradeConfig.getConfigName().contains("degrade")) { | 168 | if (!degradeConfig.getConfigName().contains("degrade")) { |
154 | continue; | 169 | continue; |
@@ -187,8 +202,20 @@ public class DegradeServiceImpl implements DegradeService { | @@ -187,8 +202,20 @@ public class DegradeServiceImpl implements DegradeService { | ||
187 | // 默认查询aws | 202 | // 默认查询aws |
188 | cloudType = AWS; | 203 | cloudType = AWS; |
189 | } | 204 | } |
205 | + | ||
190 | // test | 206 | // test |
191 | -// cloudType = TEST; | 207 | +// if (StringUtils.isNotBlank(req.getCloudType())) { |
208 | +// if (req.getCloudType().equals(AWS)) { | ||
209 | +// cloudType = TEST205; | ||
210 | +// } else { | ||
211 | +// cloudType = TEST211; | ||
212 | +// } | ||
213 | +// } else { | ||
214 | +// cloudType = TEST205; | ||
215 | +// } | ||
216 | + | ||
217 | + | ||
218 | + | ||
192 | return zkMoitorService.getAllChildren(cloudType,ZK_PATH); | 219 | return zkMoitorService.getAllChildren(cloudType,ZK_PATH); |
193 | } | 220 | } |
194 | } | 221 | } |
-
Please register or login to post a comment