树状接口修改

dev
liuguijing 1 year ago
parent 2d3f852c19
commit 14be9b9aa2

@ -48,7 +48,6 @@ 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")
@ -62,19 +61,6 @@ 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")

@ -1,18 +0,0 @@
package com.shxy.xymanager_common.dto;
import lombok.Data;
import java.util.List;
@Data
public class DyLineAndTerminalWithHeartDto {
private Integer id;
private String name;
private Integer dyValue;
private List<LineAndTerminalWithHeartDto> list;
}

@ -48,6 +48,8 @@ public class TerminalStatus implements Serializable {
private BigInteger wsUpdateTime;
private BigInteger rsUpdateTime;
private BigInteger bootTime;
private BigInteger updateTime;

@ -5,6 +5,7 @@ import cn.hutool.core.date.DateUnit;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.shxy.xymanager_common.enums.CommonStatus;
import com.shxy.xymanager_common.util.MyDateUtils;
import com.shxy.xymanager_common.util.xinyin.TerminalUtils;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@ -19,8 +20,6 @@ import java.util.Date;
@ApiModel(value = "装置", description = "装置")
public class Terminals implements Serializable {
@Value("${heart.time}")
private static Integer hearttime;
@ApiModelProperty(value = "装置编号", example = "123456")
private Integer id;
@ -74,7 +73,7 @@ public class Terminals implements Serializable {
long time = MyDateUtils.TimeSecond2MillSecond(lastheartbeat.longValue());
DateTime date = MyDateUtils.date(time);
long between = MyDateUtils.between(MyDateUtils.getNowDate(), date, DateUnit.MINUTE);
if (between > hearttime) {
if (between > TerminalUtils.hearttime) {
return CommonStatus.DELETE.value();
} else {
return CommonStatus.EFFECTIVE.value();

@ -1,104 +0,0 @@
package com.shxy.xymanager_common.model;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
*
*/
@Data
@ApiModel(value = "通道树状列表", description = "通道树状列表信息")
public class TerminalChannelTreeListModel implements Serializable {
@ApiModelProperty(value = "电压列表", example = "[]")
private List<DyLineTreeListModel.DyListBean> list;
@Data
public static class DyListBean {
@ApiModelProperty(value = "电压编号", example = "123456")
private Integer id;
@ApiModelProperty(value = "电压名称", example = "AAAA")
private String name;
@ApiModelProperty(value = "电压大小", example = "AAAA")
private Integer dyValue;
@ApiModelProperty(value = "线路列表", example = "[]")
private List<DyLineTreeListModel.LineBean> list;
}
@Data
public static class LineBean {
@ApiModelProperty(value = "线路编号", example = "123456")
private Integer id;
@ApiModelProperty(value = "线路名称", example = "AAAA")
private String name;
@ApiModelProperty(value = "单位", example = "123456")
private String bsManufacturer;
@ApiModelProperty(value = "装置信息", example = "123456")
private List<DyLineTreeListModel.TerminalBean> list;
}
@Data
public static class TerminalBean {
@ApiModelProperty(value = "装置编号", example = "123456")
private Integer id;
@ApiModelProperty(value = "杆塔编号", example = "123456")
private Integer towerid;
@ApiModelProperty(value = "杆塔名称", example = "123456")
private Integer name;
@ApiModelProperty(value = "图像监测装置 ID17 位编码)", example = "12345678")
private String cmdid;
@ApiModelProperty(value = "装置名称", example = "名称名称")
private String equipName;
@ApiModelProperty(value = "显示名", example = "名称名称")
private String displayname;
@ApiModelProperty(value = "装置型号", example = "型号型号")
private String model;
@ApiModelProperty(value = "通道列表对象", example = "[]")
private List<ChannelBean> list;
}
@Data
public static class ChannelBean {
@ApiModelProperty(value = "通道id", example = "12321")
private Integer id;
@ApiModelProperty(value = "装置编号", example = "123456")
private Integer termId;
@ApiModelProperty(value = "通道编号", example = "123456")
private Byte channelNo;
@ApiModelProperty(value = "通道名称", example = "123456")
private String channelName;
@ApiModelProperty(value = "分辨率W", example = "123456")
private Integer maxResolutionWidth;
@ApiModelProperty(value = "分辨率H", example = "123456")
private Integer maxResolutionHeight;
}
}

@ -36,7 +36,7 @@ import java.util.Map;
@Component
public class TerminalUtils {
private static Integer hearttime;
public static Integer hearttime;
private static String photoaddress;

@ -2,7 +2,6 @@ package com.shxy.xymanager_dao.dao;
import com.shxy.xymanager_common.dto.DyAndLineAndTowerAndTermDto;
import com.shxy.xymanager_common.dto.DyLineAndTerminalNoHeartDto;
import com.shxy.xymanager_common.dto.DyLineAndTerminalWithHeartDto;
import com.shxy.xymanager_common.dto.DyLineAndTowertDto;
import com.shxy.xymanager_common.entity.DyLevel;
import com.shxy.xymanager_common.entity.DyLevelExample;
@ -26,10 +25,6 @@ public interface DyLevelDao {
List<DyLevel> selectAll(@Param("status") Integer status);
List<DyLineAndTerminalWithHeartDto> selectTreeList(@Param("status") Integer status, @Param("dyid") List<Integer> dyplist, @Param("lineid") List<Integer> lineplist, @Param("towerid") List<Integer> towplist, @Param("isSuper") Integer isSuper);
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);

@ -40,35 +40,6 @@
</where>
</sql>
<resultMap id="LineAndTerminalMap" type="com.shxy.xymanager_common.dto.DyLineAndTerminalWithHeartDto">
<id column="id" jdbcType="INTEGER" property="id" />
<result column="name" jdbcType="VARCHAR" property="name" />
<result column="dyvalue" jdbcType="INTEGER" property="dyValue" />
<collection javaType="list" ofType="com.shxy.xymanager_common.dto.LineAndTerminalWithHeartDto" property="list">
<id column="line_id" jdbcType="INTEGER" property="id" />
<result column="line_name" jdbcType="VARCHAR" property="name" />
<result column="bs_manufacturer" jdbcType="VARCHAR" property="bsManufacturer" />
<result column="dy_level_id" jdbcType="INTEGER" property="dyLevel" />
<collection javaType="list" ofType="com.shxy.xymanager_common.dto.TerminalsWithHeart" property="list">
<result column="term_id" jdbcType="INTEGER" property="id" />
<result column="tower_id" jdbcType="INTEGER" property="towerid" />
<result column="protocol" jdbcType="INTEGER" property="protocol" />
<result column="tower_name" jdbcType="VARCHAR" property="name" />
<result column="address" jdbcType="VARCHAR" property="address" />
<result column="cmdid" jdbcType="VARCHAR" property="cmdid" />
<result column="equip_name" jdbcType="VARCHAR" property="equipname" />
<result column="display_name" jdbcType="VARCHAR" property="displayname" />
<result column="model" jdbcType="VARCHAR" property="model" />
<result column="last_heartbeat" jdbcType="BIGINT" property="lastheartbeat" />
<result column="has_pan" jdbcType="INTEGER" property="hasPan" />
<result column="phase" jdbcType="VARCHAR" property="phase" />
<result column="equipment_type" jdbcType="VARCHAR" property="equipmentType" />
<result column="dev_type" jdbcType="VARCHAR" property="devType" />
<result column="isfavor" jdbcType="INTEGER" property="isfavor" />
</collection>
</collection>
</resultMap>
<resultMap id="LineAndTerminalNoHeartMap" type="com.shxy.xymanager_common.dto.DyLineAndTerminalNoHeartDto">
<id column="id" jdbcType="INTEGER" property="id" />
<result column="name" jdbcType="VARCHAR" property="name" />
@ -223,97 +194,6 @@
</where>
</select>
<select id="selectTreeList" 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.dev_type as dev_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="isSuper == 0">
and (
false
<if test="dyid != null and dyid.size > 0">
or a.id in
<foreach collection="dyid" item="id" index="index" separator="," open="(" close=")">
#{id}
</foreach>
</if>
<if test="lineid != null and lineid.size > 0">
or b.id in
<foreach collection="lineid" item="id" index="index" separator="," open="(" close=")">
#{id}
</foreach>
</if>
<if test="towerid != null and towerid.size > 0">
or c.id in
<foreach collection="towerid" item="id" index="index" separator="," open="(" close=")">
#{id}
</foreach>
</if>
)
</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,

@ -142,12 +142,11 @@ public class DyLevelServiceImpl implements DyLevelService {
List<Terminals> terminals = terminalsDao.selectByExample(example3);
TerminalStatusExample example4 = new TerminalStatusExample();
if (CollectionUtil.isNotEmpty(termpList) || aSuper.equals(CommonStatus.EFFECTIVE.value())) {
if (CollectionUtil.isNotEmpty(termpList) || aSuper.equals(CommonStatus.DELETE.value())) {
example4.createCriteria().andTermIdIn(termpList);
}
List<TerminalStatus> terminalStatuses = terminalStatusDao.selectByExample(example4);
AtomicInteger onlinenum = new AtomicInteger();
AtomicInteger totalnum = new AtomicInteger();
if (CollectionUtil.isNotEmpty(dyLevels)) {
@ -186,46 +185,29 @@ public class DyLevelServiceImpl implements DyLevelService {
for (TerminalStatus tsitem : terminalStatuses) {
tsmap.put(tsitem.getTermId(), tsitem);
}
linemap.forEach((key, value) -> {
Integer dyLevelId = value.getDyLevelId();
if (dyLevelId != null) {
DyLevel dyLevel = dymap.get(dyLevelId);
if (BeanUtil.isNotEmpty(dyLevel)) {
DyLevel dyLevel = dymap.get(value.getDyLevelId());
dyLevel.getList().add(value);
}
}
});
towermap.forEach((key, value) -> {
Integer lineId = value.getLineId();
if (lineId != null) {
Lines lines1 = linemap.get(lineId);
if (BeanUtil.isNotEmpty(lines1)) {
Lines lines1 = linemap.get(value.getLineId());
lines1.getList().add(value);
}
}
});
termmap.forEach((key, value) -> {
Integer towerid = value.getTowerid();
Towers towers1 = towermap.get(towerid);
if (BeanUtil.isNotEmpty(towers1)) {
Towers towers1 = towermap.get(value.getTowerid());
Integer id = value.getId();
TerminalStatus terminalStatus = tsmap.get(id);
if (terminalStatus != null) {
value.setLastheartbeat(terminalStatus.getLastHeartbeat());
}
boolean contains = favoridlist.contains(id);
if (contains) {
favorList.add(value);
}
if (towerid != null) {
Integer onlinestatus = value.getOnlinestatus();
if (type == null || type.intValue() == -1) {//查询全部
totalnum.getAndIncrement();
Integer onlinestatus = value.getOnlinestatus();
if (onlinestatus.equals(CommonStatus.EFFECTIVE.value())) {
onlinenum.getAndIncrement();
}
@ -233,128 +215,30 @@ public class DyLevelServiceImpl implements DyLevelService {
} else if (type.intValue() == 0) {
totalnum.getAndIncrement();
Integer onlinestatus = value.getOnlinestatus();
if (onlinestatus.equals(CommonStatus.EFFECTIVE.value())) {
onlinenum.getAndIncrement();
} else {
towers1.getList().add(value);
}
} else if (type.intValue() == 1) {
totalnum.getAndIncrement();
Integer onlinestatus = value.getOnlinestatus();
if (onlinestatus.equals(CommonStatus.EFFECTIVE.value())) {
onlinenum.getAndIncrement();
towers1.getList().add(value);
}
}
}
}
});
model.setOnlineNum(onlinenum.get());
model.setTotalNum(totalnum.get());
model.setFavorlist(favorList);
model.setList(dyLevels);
}
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);
return Asserts.success(new DyLineTreeListModel());
}
/**
@ -437,10 +321,7 @@ public class DyLevelServiceImpl implements DyLevelService {
});
imgarlarmsList = terminalImgAlarmsDao.selectAlarmsByTermidAndPhotoId(photoList, labellist);
}
beans = TerminalUtils.setTowerPhotoList(requestIp, list, lineMap, termchannelMapMap, terminalMap, termchannelMap, towerMap, photoList, imgarlarmsList);
}
model.setList(beans);
PageInfo pageData = PageUtils.getPageData(list);

Loading…
Cancel
Save