Authored by mlge

Revert "no message"

This reverts commit 4233b6ff.
@@ -6,8 +6,6 @@ import com.monitor.cmdb.service.IHostInfoService; @@ -6,8 +6,6 @@ import com.monitor.cmdb.service.IHostInfoService;
6 import com.monitor.model.request.HostInfoReq; 6 import com.monitor.model.request.HostInfoReq;
7 import com.monitor.model.response.BaseResponse; 7 import com.monitor.model.response.BaseResponse;
8 import com.monitor.model.response.PageResponse; 8 import com.monitor.model.response.PageResponse;
9 -import com.monitor.mysql.mapper.HostInfoMapper;  
10 -import org.codehaus.jackson.map.Serializers;  
11 import org.slf4j.Logger; 9 import org.slf4j.Logger;
12 import org.slf4j.LoggerFactory; 10 import org.slf4j.LoggerFactory;
13 import org.springframework.beans.factory.annotation.Autowired; 11 import org.springframework.beans.factory.annotation.Autowired;
@@ -19,15 +17,10 @@ import org.springframework.web.bind.annotation.RequestParam; @@ -19,15 +17,10 @@ import org.springframework.web.bind.annotation.RequestParam;
19 import org.springframework.web.bind.annotation.ResponseBody; 17 import org.springframework.web.bind.annotation.ResponseBody;
20 18
21 19
22 -import javax.xml.ws.Response;  
23 import java.util.HashSet; 20 import java.util.HashSet;
24 21
25 import java.util.List; 22 import java.util.List;
26 -import java.util.Map;  
27 import java.util.Set; 23 import java.util.Set;
28 -import java.util.concurrent.ExecutionException;  
29 -import java.util.concurrent.TimeUnit;  
30 -import java.util.concurrent.TimeoutException;  
31 24
32 25
33 /** 26 /**
@@ -43,8 +36,6 @@ public class HostInfoCtrl { @@ -43,8 +36,6 @@ public class HostInfoCtrl {
43 @Autowired 36 @Autowired
44 IHostInfoService hostInfoService; 37 IHostInfoService hostInfoService;
45 38
46 -  
47 -  
48 @RequestMapping("/getHostInfos") 39 @RequestMapping("/getHostInfos")
49 @ResponseBody 40 @ResponseBody
50 public BaseResponse<PageResponse<HostInfo>> getHostInfos(@RequestBody HostInfoReq req) throws Exception { 41 public BaseResponse<PageResponse<HostInfo>> getHostInfos(@RequestBody HostInfoReq req) throws Exception {
@@ -130,30 +121,5 @@ public class HostInfoCtrl { @@ -130,30 +121,5 @@ public class HostInfoCtrl {
130 return JSON.toJSONString(ips); 121 return JSON.toJSONString(ips);
131 } 122 }
132 123
133 - /**  
134 - * 更新主机tag信息为空  
135 - * @param ips  
136 - * @return  
137 - */  
138 - @RequestMapping("/updateHostInfoByIps")  
139 - @ResponseBody  
140 - public BaseResponse updateHostInfoByIps(String ips){  
141 - List<HostInfo> hostInfoList = JSON.parseArray(ips,HostInfo.class);  
142 - try{  
143 - hostInfoService.updateTagByIps(hostInfoList);  
144 - return new BaseResponse();  
145 - }catch(Exception e){  
146 - log.error("updateHostInfoByIps error",e);  
147 - return new BaseResponse("updateHostInfoByIps error");  
148 - }  
149 - }  
150 -  
151 - @RequestMapping("/saveHostListInfos")  
152 - @ResponseBody  
153 - public BaseResponse saveHostListInfos(String hosts){  
154 - List<HostInfo> hostInfos = JSON.parseArray(hosts,HostInfo.class);  
155 - return hostInfoService.saveHostListInfo(hostInfos);  
156 - }  
157 -  
158 } 124 }
159 125
@@ -6,6 +6,7 @@ import com.monitor.model.response.BaseResponse; @@ -6,6 +6,7 @@ import com.monitor.model.response.BaseResponse;
6 import com.monitor.model.response.PageResponse; 6 import com.monitor.model.response.PageResponse;
7 7
8 import java.util.List; 8 import java.util.List;
  9 +import java.util.Set;
9 10
10 /** 11 /**
11 * Created by yoho on 2016/6/14. 12 * Created by yoho on 2016/6/14.
@@ -24,8 +25,4 @@ public interface IHostInfoService { @@ -24,8 +25,4 @@ public interface IHostInfoService {
24 List<HostInfo> getHostInfosByTag(String tag); 25 List<HostInfo> getHostInfosByTag(String tag);
25 26
26 List<HostInfo> getHostInfoByIps(List<String> ids); 27 List<HostInfo> getHostInfoByIps(List<String> ids);
27 -  
28 - void updateTagByIps(List<HostInfo> hostInfoList);  
29 -  
30 - BaseResponse saveHostListInfo(List<HostInfo> hostInfos);  
31 } 28 }
@@ -123,40 +123,4 @@ public class HostInfoServiceImpl implements IHostInfoService { @@ -123,40 +123,4 @@ public class HostInfoServiceImpl implements IHostInfoService {
123 return hostInfoMapper.selectHostInfosByIps(ips); 123 return hostInfoMapper.selectHostInfosByIps(ips);
124 } 124 }
125 125
126 - /**  
127 - * 将tag更新为空  
128 - * @param  
129 - */  
130 - @Override  
131 - public void updateTagByIps(List<HostInfo> hostInfoList){  
132 - if(hostInfoList != null && hostInfoList.size() > 0){  
133 - for(HostInfo host : hostInfoList)  
134 - hostInfoMapper.updateHostInfoByIp(host);  
135 - }  
136 -  
137 - }  
138 -  
139 - @Override  
140 - public BaseResponse saveHostListInfo(List<HostInfo> hostInfos) {  
141 - BaseResponse resp = new BaseResponse();  
142 - String message = "";  
143 - for(HostInfo host : hostInfos){  
144 - HostInfo h = hostInfoMapper.selectByHostIp(host.getHostIp());  
145 - try{  
146 - if(h != null){//存在则更新  
147 - hostInfoMapper.updateHostInfoByIp(host);  
148 - }else{  
149 - hostInfoMapper.insert(host);  
150 - }  
151 - }catch(Exception e){  
152 - logger.error("saveHostListInfo error: ",e);  
153 - message = message + "saveHostListInfo error --ip:" + host.getHostIp() + ";";  
154 - }  
155 - }  
156 - if(!"".equals(message)){  
157 - resp.setMessage(message);  
158 - }  
159 - return new BaseResponse();  
160 - }  
161 -  
162 } 126 }
@@ -30,8 +30,4 @@ public interface HostInfoMapper { @@ -30,8 +30,4 @@ public interface HostInfoMapper {
30 HostInfo selectByHostIp(@Param("hostIp") String hostIp); 30 HostInfo selectByHostIp(@Param("hostIp") String hostIp);
31 31
32 List<HostInfo> selectHostInfosByIps(@Param("hostIps") List<String> ips); 32 List<HostInfo> selectHostInfosByIps(@Param("hostIps") List<String> ips);
33 -  
34 - int updateTagByIps(HostInfo record);  
35 -  
36 - int updateHostInfoByIp(HostInfo record);  
37 } 33 }
@@ -199,24 +199,4 @@ @@ -199,24 +199,4 @@
199 #{hostIp} 199 #{hostIp}
200 </foreach> 200 </foreach>
201 </select> 201 </select>
202 -  
203 - <update id="updateTagByIps" >  
204 - update host_info  
205 - set tags = ""  
206 - where host_ip in  
207 - <foreach item="hostIp" index="index" collection="hostIps" open="("  
208 - separator="," close=")">  
209 - #{hostIp}  
210 - </foreach>  
211 - </update>  
212 -  
213 -  
214 - <update id="updateHostInfoByIp" parameterType="com.model.HostInfo" >  
215 - update host_info  
216 - set alias = #{alias,jdbcType=VARCHAR},  
217 - cloud_type = #{cloudType,jdbcType=BIT},  
218 - tags = #{tags,jdbcType=VARCHAR},  
219 - update_time = now()  
220 - where ip = #{hostIp,jdbcType=INTEGER}  
221 - </update>  
222 </mapper> 202 </mapper>
@@ -5,6 +5,5 @@ @@ -5,6 +5,5 @@
5 <configuration> 5 <configuration>
6 <settings> 6 <settings>
7 <setting name="defaultStatementTimeout" value="2"/> <!-- seconds --> 7 <setting name="defaultStatementTimeout" value="2"/> <!-- seconds -->
8 - <setting name="logImpl" value="STDOUT_LOGGING" />  
9 </settings> 8 </settings>
10 </configuration> 9 </configuration>
@@ -121,9 +121,9 @@ @@ -121,9 +121,9 @@
121 <properties> 121 <properties>
122 <package.environment>product</package.environment> 122 <package.environment>product</package.environment>
123 </properties> 123 </properties>
124 - <!-- <activation> 124 + <activation>
125 <activeByDefault>true</activeByDefault> 125 <activeByDefault>true</activeByDefault>
126 - </activation>--> 126 + </activation>
127 </profile> 127 </profile>
128 <profile> 128 <profile>
129 <id>qcloud</id> 129 <id>qcloud</id>
@@ -136,9 +136,6 @@ @@ -136,9 +136,6 @@
136 <properties> 136 <properties>
137 <package.environment>test</package.environment> 137 <package.environment>test</package.environment>
138 </properties> 138 </properties>
139 - <activation>  
140 - <activeByDefault>true</activeByDefault>  
141 - </activation>  
142 </profile> 139 </profile>
143 </profiles> 140 </profiles>
144 </project> 141 </project>
@@ -13,14 +13,6 @@ @@ -13,14 +13,6 @@
13 <!-- 日志最大的文件大小 10MB--> 13 <!-- 日志最大的文件大小 10MB-->
14 <property name="maxFileSize" value="100MB"/> 14 <property name="maxFileSize" value="100MB"/>
15 15
16 - <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">  
17 - <!-- 对日志进行格式化 -->  
18 - <encoder>  
19 - <pattern>%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger -%msg%n</pattern>  
20 - </encoder>  
21 - </appender>  
22 -  
23 -  
24 <appender name="WARN" class="ch.qos.logback.core.rolling.RollingFileAppender"> 16 <appender name="WARN" class="ch.qos.logback.core.rolling.RollingFileAppender">
25 <file>${catalina.home}/logs/warn.log</file> 17 <file>${catalina.home}/logs/warn.log</file>
26 <filter class="ch.qos.logback.classic.filter.ThresholdFilter"> 18 <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
@@ -218,17 +210,4 @@ @@ -218,17 +210,4 @@
218 <appender-ref ref="WARN"/> 210 <appender-ref ref="WARN"/>
219 </root> 211 </root>
220 212
221 - <logger name="org.apache.ibatis" additivity="false">  
222 - <level value="DEBUG"/>  
223 - <appender-ref ref="STDOUT"/>  
224 - </logger>  
225 -  
226 -  
227 - <logger name="com.monitor.mysql.mapper" additivity="false">  
228 - <level value="DEBUG"/>  
229 - <appender-ref ref="STDOUT"/>  
230 - <!--<appender-ref ref="FILE"/>-->  
231 - </logger>  
232 -  
233 -  
234 </configuration> 213 </configuration>