Authored by zhaoqi

降级服务页面后台接口

... ... @@ -34,6 +34,10 @@
<artifactId>bcprov-jdk16</artifactId>
<version>1.46</version>
</dependency>
<dependency>
<groupId>monitor-service</groupId>
<artifactId>monitor-service-cmdb</artifactId>
</dependency>
</dependencies>
... ...
package com.monitor.other.degrade.ctrl;
import com.monitor.model.page.PageResponse;
import com.monitor.other.degrade.model.DegradeConfig;
import com.monitor.other.degrade.model.DegradeReq;
import com.monitor.other.degrade.service.DegradeService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import javax.annotation.Resource;
/**
* Created by zhaoqi on 2016/8/26 0026.
*/
@Controller
@RequestMapping("/degrade")
public class DegradeController {
@Resource
private DegradeService degradeService;
private PageResponse<DegradeConfig> getDegradeConfigList(DegradeReq req){
PageResponse<DegradeConfig> pageResponse = new PageResponse<>();
pageResponse.setRows(degradeService.getDegradeConfigList(req));
return pageResponse;
}
}
... ...
package com.monitor.other.degrade.model;
import lombok.Data;
/**
* Created by zhaoqi on 2016/8/26 0026.
*/
@Data
public class DegradeConfig {
private String configName;
private String configDesc;
private String level;
private String imgUrl;
private String switcher;
}
... ...
package com.monitor.other.degrade.model;
/**
* Created by zhaoqi on 2016/8/26 0026.
*/
public class DegradeReq {
}
... ...
package com.monitor.other.degrade.service;
import com.monitor.other.degrade.model.DegradeConfig;
import com.monitor.other.degrade.model.DegradeReq;
import java.util.List;
/**
* Created by zhaoqi on 2016/8/26 0026.
*/
public interface DegradeService {
List<DegradeConfig> getDegradeConfigList(DegradeReq req);
}
... ...
package com.monitor.other.degrade.service.impl;
import com.monitor.cmdb.service.IZkMoitorService;
import com.monitor.other.degrade.model.DegradeConfig;
import com.monitor.other.degrade.model.DegradeReq;
import com.monitor.other.degrade.service.DegradeService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* Created by zhaoqi on 2016/8/26 0026.
*/
@Service
public class DegradeServiceImpl implements DegradeService {
@Resource
private IZkMoitorService zkMoitorService;
@Override
public List<DegradeConfig> getDegradeConfigList(DegradeReq req) {
// 从zk中获取降级开关信息
List<DegradeConfig> configListZk= getFromZk(req);
// 从数据库中获取附加信息
List<DegradeConfig> configListDb= getFromDatabase(req);
return mergeDegradeConfig(configListZk,configListDb);
}
/**
* 合并zk和数据库的结果
* @param configListZk
* @param configListDb
* @return
*/
private List<DegradeConfig> mergeDegradeConfig(List<DegradeConfig> configListZk, List<DegradeConfig> configListDb) {
return null;
}
private List<DegradeConfig> getFromDatabase(DegradeReq req) {
return null;
}
private List<DegradeConfig> getFromZk(DegradeReq req) {
return null;
}
}
... ...