新增覆冰主站查询

dev
liuguijing 1 year ago
parent 1072fa672e
commit 95bf609fbf

@ -145,6 +145,18 @@
<version>5.9.0</version>
</dependency>
<!-- <dependency>-->
<!-- <groupId>com.squareup.okhttp3</groupId>-->
<!-- <artifactId>okhttp</artifactId>-->
<!-- <version>3.14.9</version>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>io.github.admin4j</groupId>-->
<!-- <artifactId>http</artifactId>-->
<!-- <version>0.4.0</version>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>javax.servlet</groupId>-->

@ -9,6 +9,7 @@ import com.shxy.xymanager_common.model.DyLineTreeListModel;
import com.shxy.xymanager_common.model.DyListModel;
import com.shxy.xymanager_common.model.TerminalPhotosModel;
import com.shxy.xymanager_common.util.xinyin.HeaderUtil;
import com.shxy.xymanager_common.vo.DyListVo;
import com.shxy.xymanager_common.vo.LastTowerVo;
import com.shxy.xymanager_service.service.DyLevelService;
import io.swagger.annotations.Api;
@ -19,6 +20,7 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpHeaders;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
@ -50,9 +52,9 @@ public class DyLevelController extends BaseController {
@ApiOperation(value = "郑州测试获取电压等级树状列表接口", notes = "郑州测试获取电压等级树状列表接口", httpMethod = "POST")
@ApiResponses({@ApiResponse(code = 200, message = "请求成功"), @ApiResponse(code = 400, message = "请求参数没填好"), @ApiResponse(code = 404, message = "请求路径没有或页面跳转路径不对")})
@RequestMapping("/getzzdyTreeList")
@Log(title = "获取电压等级树状列表接口", type = "查询")
public ResponseReult<DyLineTreeListModel> getzzdyTreeList(@Param("type") Integer type,@Param("lineid") Integer lineid) {
ServiceBody<DyLineTreeListModel> serviceBody = dyLevelService.getdyTreeList(type,lineid);
@Log(title = "郑州测试获取电压等级树状列表接口", type = "查询")
public ResponseReult<DyLineTreeListModel> getzzdyTreeList(@RequestBody @Validated DyListVo vo) {
ServiceBody<DyLineTreeListModel> serviceBody = dyLevelService.getzzdyTreeList(vo.getType(),vo.getLineid());
if (serviceBody.getCode() == ServiceStatus.SUCCESS) {
return ResponseReult.success(serviceBody.getData());
} else {
@ -60,6 +62,19 @@ public class DyLevelController extends BaseController {
}
}
// @ApiOperation(value = "郑州测试获取电压等级树状列表接口", notes = "郑州测试获取电压等级树状列表接口", httpMethod = "POST")
// @ApiResponses({@ApiResponse(code = 200, message = "请求成功"), @ApiResponse(code = 400, message = "请求参数没填好"), @ApiResponse(code = 404, message = "请求路径没有或页面跳转路径不对")})
// @RequestMapping("/getzzdyTreeList")
// @Log(title = "获取电压等级树状列表接口", type = "查询")
// public ResponseReult<DyLineTreeListModel> getzzdyTreeList(@Param("type") Integer type,@Param("lineid") Integer lineid) {
// ServiceBody<DyLineTreeListModel> serviceBody = dyLevelService.getdyTreeList(type,lineid);
// if (serviceBody.getCode() == ServiceStatus.SUCCESS) {
// return ResponseReult.success(serviceBody.getData());
// } else {
// return ResponseReult.error(serviceBody.getCode(), serviceBody.getMsg());
// }
// }
@ApiOperation(value = "获取电压等级列表", notes = "获取电压等级列表", httpMethod = "POST")
@ApiResponses({@ApiResponse(code = 200, message = "请求成功"), @ApiResponse(code = 400, message = "请求参数没填好"), @ApiResponse(code = 404, message = "请求路径没有或页面跳转路径不对")})
@RequestMapping("/getdyList")

@ -133,6 +133,17 @@
<artifactId>easyexcel</artifactId>
</dependency>
<!-- <dependency>-->
<!-- <groupId>com.squareup.okhttp3</groupId>-->
<!-- <artifactId>okhttp</artifactId>-->
<!-- </dependency>-->
<!-- <dependency>-->
<!-- <groupId>io.github.admin4j</groupId>-->
<!-- <artifactId>http</artifactId>-->
<!-- </dependency>-->
<!-- &lt;!&ndash;shiro&ndash;&gt;-->
<!-- <dependency>-->
<!-- <groupId>org.apache.shiro</groupId>-->

@ -0,0 +1,48 @@
//package com.shxy.xymanager_common.entity;
//
//import java.io.Serializable;
//import java.util.Date;
//
//public class ThirdUser implements Serializable {
// private Integer name;
//
// private String password;
//
// private Date tokenEffectTime;
//
// private String token;
//
// private static final long serialVersionUID = 1L;
//
// public Integer getName() {
// return name;
// }
//
// public void setName(Integer name) {
// this.name = name;
// }
//
// public String getPassword() {
// return password;
// }
//
// public void setPassword(String password) {
// this.password = password == null ? null : password.trim();
// }
//
// public Date getTokenEffectTime() {
// return tokenEffectTime;
// }
//
// public void setTokenEffectTime(Date tokenEffectTime) {
// this.tokenEffectTime = tokenEffectTime;
// }
//
// public String getToken() {
// return token;
// }
//
// public void setToken(String token) {
// this.token = token == null ? null : token.trim();
// }
//}

@ -39,6 +39,11 @@ public class HttpStatus {
public static final int HTTP_GATEWAY_TIMEOUT = 504;
public static final int HTTP_VERSION = 505;
public static final String HTTP_OK_Str = "200";
public static final String TOKEN = "token";
public static final String CODE = "code";
public HttpStatus() {
}

@ -0,0 +1,70 @@
//package com.shxy.xymanager_common.util.http;
//import com.alibaba.fastjson.JSONObject;
//import io.github.admin4j.http.HttpRequest;
//import io.github.admin4j.http.core.Pair;
//import io.github.admin4j.http.util.HttpUtil;
//import okhttp3.Response;
//
//import java.io.File;
//import java.io.IOException;
//import java.util.ArrayList;
//import java.util.HashMap;
//import java.util.List;
//import java.util.Map;
//
//public class OkHttpUtils {
//
// public static JSONObject get(String url, Map<String, Object> queryParams) throws IOException {
// Response response = HttpUtil.get(url, queryParams);
// return JSONObject.parseObject(response.body().string());
// }
//
// public static JSONObject get(String url, Map<String, Object> queryParams, Map<String, Object> headers) throws IOException {
// HttpRequest httpRequest = HttpRequest.get(url);
// setParams(queryParams, httpRequest);
// Response response = httpRequest.queryParams().headers(headers).execute();
// return JSONObject.parseObject(response.body().string());
// }
//
// public static JSONObject post(String url, String json) throws IOException {
// Response response = HttpUtil.post(url, json);
// assert response.body() != null;
// return JSONObject.parseObject(response.body().string());
// }
//
// public static JSONObject postForm(String url, Map<String, Object> formParams) throws IOException {
// Response response = HttpUtil.postForm(url, formParams);
// assert response.body() != null;
// return JSONObject.parseObject(response.body().string());
// }
//
// public static JSONObject post(String url, String json, Map<String, Object> headers) throws IOException {
// HttpRequest httpRequest = HttpRequest.post(url);
// httpRequest.setBody(json);
// Response response = httpRequest.headers(headers).execute();
// return JSONObject.parseObject(response.body().string());
// }
//
// private static void setParams(Map<String, Object> queryParams, HttpRequest httpRequest) {
// List<Pair> pairs = new ArrayList<>(queryParams.size());
// queryParams.forEach((x, y) -> pairs.add(Pair.of(x, y)));
// if (pairs.size() > 0) {
// pairs.forEach(httpRequest::queryParams);
// }
// }
//
// private static JSONObject upload() throws IOException {
// File file = new File("C:\\Users\\andanyang\\Downloads\\Sql.txt");
// Map<String, Object> formParams = new HashMap<>();
// formParams.put("key", "test");
// formParams.put("file", file);
// formParams.put("token", "WXyUseb-D4sCum-EvTIDYL-mEehwDtrSBg-Zca7t:qgOcR2gUoKmxt-VnsNb657Oatzo=:eyJzY29wZSI6InpoYW56aGkiLCJkZWFkbGluZSI6MTY2NTMwNzUxNH0=");
// Response response = HttpUtil.upload("https://upload.qiniup.com/", formParams);
// return JSONObject.parseObject(response.body().string());
// }
//
// private static void download() throws IOException {
// HttpUtil.down("https://gitee.com/admin4j/common-http","path/");
// }
//
//}

@ -0,0 +1,21 @@
package com.shxy.xymanager_common.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotEmpty;
import java.util.List;
@Data
@ApiModel(value = "查询列表对象", description = "查询列表对象")
public class DyListVo {
@ApiModelProperty(value = "是否收藏", example = "0--删除收藏 1--收藏")
private Integer type;
@ApiModelProperty(value = "查询列表对象数组", required = true)
private List<Integer> lineid;
}

@ -15,8 +15,6 @@ public interface DyLevelDao {
List<DyLineAndTowertDto> selectDyAndLineAndTowerList(@Param("dyid") Integer dyid, @Param("lineid") Integer lineid, @Param("towerid") Integer towerid, @Param("status") Integer status);
int deleteByPrimaryKey(Integer id);
int insert(DyLevel record);
int insertSelective(DyLevel record);
@ -27,6 +25,8 @@ public interface DyLevelDao {
List<DyLineAndTerminalWithHeartDto> selectTreeList( @Param("status") Integer status,@Param("lineid") Integer lineid);
List<DyLineAndTerminalWithHeartDto> selectListTreeList( @Param("status") Integer status,@Param("list") List<Integer> list);
List<DyLineAndTerminalNoHeartDto> selectTreeListByChannelId(@Param("channelid") Integer channelid, @Param("status") Integer status);
int updateByPrimaryKeySelective(DyLevel record);

@ -5,7 +5,7 @@
<generatorConfiguration>
<classPathEntry
location="D:\idea\mavenrepository\mysql\mysql-connector-java\8.0.27\mysql-connector-java-8.0.27.jar"/>
location="D:\WorkTool\IntellijIdea\maven_repository\mysql\mysql-connector-java\8.0.27\mysql-connector-java-8.0.27.jar"/>
<context id="sqlserverTables" targetRuntime="MyBatis3">
<!-- 生成的pojo将implements Serializable-->
<plugin type="org.mybatis.generator.plugins.SerializablePlugin"></plugin>
@ -35,7 +35,7 @@
也可以使用“MAVEN”来自动生成这样生成的代码会在target/generatord-source目录下
-->
<javaModelGenerator targetPackage="com.shxy.xymanager_common.entity"
targetProject="D:/project/java/backend/xymanager_common/src/main/java">
targetProject="D:/Project/JAVAProject/xympbackend/xymanager_common/src/main/java">
<property name="enableSubPackages" value="true"/>
<!-- 从数据库返回的值被清理前后的空格 -->
<property name="trimStrings" value="true"/>
@ -285,5 +285,16 @@
<!-- enableSelectByExample="false" selectByExampleQueryId="false">-->
<!-- &lt;!&ndash; <property name="useActualColumnNames" value="false"/>&ndash;&gt;-->
<!-- </table>-->
<!-- <table-->
<!-- tableName="third_user"-->
<!-- domainObjectName="ThirdUser"-->
<!-- mapperName="ThirdUserDao"-->
<!-- enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false"-->
<!-- enableSelectByExample="false" selectByExampleQueryId="false">-->
<!-- &lt;!&ndash; <property name="useActualColumnNames" value="false"/>&ndash;&gt;-->
<!-- </table>-->
</context>
</generatorConfiguration>

@ -212,6 +212,42 @@
</if>
</select>
<select id="selectListTreeList" resultMap="LineAndTerminalMap">
select
a.id as id,
a.name as name,
a.dy_value as dyvalue,
b.id as line_id,
b.name as line_name,
b.bs_manufacturer as bs_manufacturer,
b.dy_level_id as dy_level_id,
d.id as term_id,
d.tower_id as tower_id,
c.name as tower_name,
c.address as address,
d.cmdid as cmdid,
d.equip_name as equip_name,
d.display_name as display_name,
d.model as model,
d.protocol as protocol,
d.has_pan as has_pan,
d.phase as phase,
d.equipment_type as equipment_type,
d.isfavor as isfavor,
e.last_heartbeat as last_heartbeat
from ((((dy_level a left join `lines` b on a.id = b.dy_level_id )
left join towers c on b.id = c.line_id )
left join terminals d on c.id = d.tower_id )
left join terminal_status e on e.term_id = d.id)
where b.status = #{status} and a.status = #{status} and c.status = #{status} and d.status = #{status}
<if test="list != null and list.size > 0">
and b.id in
<foreach collection="list" item="id" index="index" separator="," open="(" close=")">
#{id}
</foreach>
</if>
</select>
<select id="selectTreeListByChannelId" resultMap="LineAndTerminalNoHeartMap">
SELECT
a.id AS id,

@ -155,6 +155,105 @@ public class DyLevelServiceImpl implements DyLevelService {
return Asserts.success(model);
}
@Override
public ServiceBody<DyLineTreeListModel> getzzdyTreeList(Integer type, List<Integer> idlist) {
DyLineTreeListModel model = new DyLineTreeListModel();
ArrayList<DyLineTreeListModel.TerminalBean> favorList = new ArrayList<>();
List<DyLineAndTerminalWithHeartDto> list = dyLevelDao.selectListTreeList(CommonStatus.EFFECTIVE.value(),idlist);
boolean empty = CollectionUtil.isEmpty(list);
if (empty) {
model.setList(new ArrayList<>());
} else {
int onlinenum = 0;
int totalnum = 0;
ArrayList<DyLineTreeListModel.DyListBean> dyListBeans = new ArrayList<>();
for (int i = 0; i < list.size(); i++) {
DyLineAndTerminalWithHeartDto dyDto = list.get(i);
List<LineAndTerminalWithHeartDto> linelist = dyDto.getList();
if (CollectionUtil.isEmpty(linelist)) {
continue;
}
DyLineTreeListModel.DyListBean dyModel = new DyLineTreeListModel.DyListBean();
dyModel.setId(dyDto.getId());
dyModel.setDyValue(dyDto.getDyValue());
dyModel.setName(dyDto.getName());
ArrayList<DyLineTreeListModel.LineBean> lineBeans = new ArrayList<>();
for (int j = 0; j < linelist.size(); j++) {
LineAndTerminalWithHeartDto lineDto = linelist.get(j);
List<TerminalsWithHeart> termlist = lineDto.getList();
if (CollectionUtil.isEmpty(termlist)) {
continue;
}
DyLineTreeListModel.LineBean lineBean = new DyLineTreeListModel.LineBean();
lineBean.setId(lineDto.getId());
lineBean.setName(lineDto.getName());
lineBean.setBsManufacturer(lineDto.getBsManufacturer());
ArrayList<DyLineTreeListModel.TerminalBean> beanlist = new ArrayList<>();
for (int k = 0; k < termlist.size(); k++) {
totalnum++;
TerminalsWithHeart terminalsWithHeart = termlist.get(k);
DyLineTreeListModel.TerminalBean bean = new DyLineTreeListModel.TerminalBean();
bean.setId(terminalsWithHeart.getId());
bean.setAddress(terminalsWithHeart.getAddress());
bean.setCmdid(terminalsWithHeart.getCmdid());
bean.setDisplayname(terminalsWithHeart.getDisplayname());
bean.setEquipname(terminalsWithHeart.getEquipname());
bean.setModel(terminalsWithHeart.getModel());
bean.setName(terminalsWithHeart.getName());
bean.setProtocol(terminalsWithHeart.getProtocol());
bean.setTowerid(terminalsWithHeart.getTowerid());
bean.setHasPan(terminalsWithHeart.getHasPan());
bean.setPhase(terminalsWithHeart.getPhase());
bean.setEquipmentType(terminalsWithHeart.getEquipmentType());
Integer isfavor = terminalsWithHeart.getIsfavor();
bean.setIsfavor(isfavor);
BigInteger lastheartbeat = terminalsWithHeart.getLastheartbeat();
boolean b = TerminalUtils.judgeTerminalStatus(lastheartbeat);
if (type == null || type.intValue() == -1) {//查询全部
if (b) {
bean.setOnlinestatus(CommonStatus.EFFECTIVE.value());
onlinenum++;
} else {
bean.setOnlinestatus(CommonStatus.DELETE.value());
}
beanlist.add(bean);
} else if (type.intValue() == 0) {
if (b) {
onlinenum++;
bean.setOnlinestatus(CommonStatus.EFFECTIVE.value());
} else {
bean.setOnlinestatus(CommonStatus.DELETE.value());
beanlist.add(bean);
}
} else if (type.intValue() == 1) {
if (b) {
onlinenum++;
bean.setOnlinestatus(CommonStatus.EFFECTIVE.value());
beanlist.add(bean);
} else {
bean.setOnlinestatus(CommonStatus.DELETE.value());
}
}
if (isfavor!=null && isfavor.intValue() == CommonStatus.EFFECTIVE.value()) {
favorList.add(bean);
}
}
lineBean.setList(beanlist);
lineBeans.add(lineBean);
}
dyModel.setList(lineBeans);
dyListBeans.add(dyModel);
}
model.setOnlineNum(onlinenum);
model.setTotalNum(totalnum);
model.setList(dyListBeans);
model.setFavorlist(favorList);
}
return Asserts.success(model);
}
/**
*

@ -0,0 +1,98 @@
//package com.shxy.xymanager_service.impl;
//
//import com.alibaba.fastjson.JSONObject;
//import com.shxy.xymanager_common.constant.Constants;
//import com.shxy.xymanager_common.util.StringUtils;
//import com.shxy.xymanager_common.util.http.HttpStatus;
//import com.shxy.xymanager_common.util.http.OkHttpUtils;
//import com.shxy.xymanager_service.service.HeNanHttpService;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.stereotype.Service;
//
//import java.io.IOException;
//import java.util.Map;
//
//
//@Service
//@Slf4j
//public class HeNanHttpServiceImpl implements HeNanHttpService {
//
//
// @Value("${cma.server}")
// public String name;
//
// @Value("${cma.port}")
// public String password;
//
// @Value("${cma.port}")
// public String dname;
//
//
//
// /*
// * 推送常态巡查图片数据
// * */
// @Override
// public Map<String, String> sendPatrolData() {
// JSONObject jsonObject = new JSONObject();
//
// try {
// jsonObject.put("EQUIP_ID", );
// jsonObject.put("PIC_TIME", );
// jsonObject.put("PIC_NAME", );
// jsonObject.put("PIC_IS_ALARM", );
// jsonObject.put("PIC_SOURCE", );
// jsonObject.put("D_SOURCE", );
// jsonObject.put("PIC_URL", );
// jsonObject.put("token", );
// OkHttpUtils.post("http:// 121.89.192.219:9081/visu/sendPatrolData", jsonObject.toString());
// } catch (IOException e) {
// e.printStackTrace();
// }
// return null;
// }
//
// /*
// * 定时调用该接口发送心跳数据发送心跳数据的时间间隔为5分钟
// * */
// @Override
// public Map<String, String> sendHeartBeat() {
// JSONObject jsonObject = new JSONObject();
// jsonObject.put("D_NAME", );
// jsonObject.put("token", );
// jsonObject.put("DATA_TIME", );
// try {
// OkHttpUtils.post("http:// 121.89.192.219:9081/visu/sendHeartBeat", jsonObject.toString());
// } catch (IOException e) {
// e.printStackTrace();
//
// }
// return null;
// }
//
// /*
// * 发送加密的账号密码获取tokentoken有效期自获取开始30分钟
// * */
// @Override
// public Map<String, String> getToken() {
// JSONObject jsonObject = new JSONObject();
// jsonObject.put("name", name);
// jsonObject.put("pwd", password);
// jsonObject.put("d_name", dname);
// try {
// JSONObject object = OkHttpUtils.post("http:// 121.89.192.219:9081/login/getToken", jsonObject.toString());
// String code = object.getString(HttpStatus.CODE);
// if (StringUtils.equals(code, HttpStatus.HTTP_OK_Str)) {
// String token = object.getString(HttpStatus.TOKEN);
// if (StringUtils.isNotEmpty(token)) {
//
// }
//
// }
// } catch (IOException e) {
// e.printStackTrace();
// }
// return null;
// }
//}

@ -6,6 +6,8 @@ import com.shxy.xymanager_common.model.DyListModel;
import com.shxy.xymanager_common.model.TerminalPhotosModel;
import com.shxy.xymanager_common.vo.LastTowerVo;
import java.util.List;
/**
*
*
@ -19,6 +21,13 @@ public interface DyLevelService {
*/
ServiceBody<DyLineTreeListModel> getdyTreeList(Integer integer, Integer lineid);
/**
* 线
*
* @return
*/
ServiceBody<DyLineTreeListModel> getzzdyTreeList(Integer integer, List<Integer> list);
/**
*

@ -0,0 +1,25 @@
package com.shxy.xymanager_service.service;
import java.util.Map;
/**
*
*
* @author jingjing
*/
public interface HeNanHttpService {
//推送常态巡查图片数据
Map<String, String> sendPatrolData();
/*
* 5
* */
Map<String, String> sendHeartBeat();
/*
* tokentoken30
* */
Map<String, String> getToken();
}
Loading…
Cancel
Save