Commit 83d81452 authored by tianyiming's avatar tianyiming

直流中心接口修改

parent 88382075
...@@ -205,13 +205,25 @@ public class EquipmentSpecificAlarm extends BaseEntity { ...@@ -205,13 +205,25 @@ public class EquipmentSpecificAlarm extends BaseEntity {
/** /**
* 机构/部门名称 * 机构/部门名称
*/ */
@TableField(exist = false) @TableField(value = "biz_org_name")
private String bizOrgName; private String bizOrgName;
/** /**
* 机构编码 * 机构编码
*/ */
@TableField(exist = false) @TableField(value = "biz_org_code")
private String bizOrgCode; private String bizOrgCode;
/**
* 机构code
*/
@TableField(value = "station_code")
private String stationCode;
/**
* 机构名称
*/
@TableField(value = "station_name")
private String stationName;
} }
\ No newline at end of file
package com.yeejoin.equipmanage.common.entity;
import com.baomidou.mybatisplus.annotation.*;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import java.util.Date;
@Data
@Accessors(chain = true)
@TableName("cb_org_usr")
@ApiModel(value="OrgUsr对象", description="部门信息")
public class OrgUsr {
/**
*
*/
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "机构/部门名称")
private String bizOrgName;
@ApiModelProperty(value = "机构编码")
private String bizOrgCode;
@ApiModelProperty(value = "amos中公司/部门ID")
private String amosOrgId;
@ApiModelProperty(value = "amos中公司/部门编码")
private String amosOrgCode;
@ApiModelProperty(value = "机构类型`")
private String bizOrgType;
@ApiModelProperty(value = "所属建筑名称")
private String buildName;
@ApiModelProperty(value = "所属建筑ID")
private String buildId;
@ApiModelProperty(value = "归属机构/部门/人员")
private String parentId;
@ApiModelProperty(value = "扩展属性1")
private String orgExpandAttr1;
@ApiModelProperty(value = "扩展属性2")
private String orgExpandAttr2;
@ApiModelProperty(value = "扩展属性3")
private String orgExpandAttr3;
@ApiModelProperty(value = "扩展属性4")
private String orgExpandAttr4;
private String orgExpandAttr5;
private String orgExpandAttr6;
private String orgExpandAttr7;
private String orgExpandAttr8;
@ApiModelProperty(value = "省市区code,用逗号分隔")
private String pczCode;
@ApiModelProperty(value = "省市区名称,用逗号分隔")
private String pczName;
@ApiModelProperty(value = "唯一编号")
private String code;
@ApiModelProperty(value = "数量")
@TableField(exist = false)
private Long total;
@ApiModelProperty(value = "管理类别")
@TableField(exist = false)
private String managementType;
@TableId(value = "sequence_nbr", type = IdType.ID_WORKER)
protected Long sequenceNbr;
@TableField(value = "rec_date", fill = FieldFill.INSERT_UPDATE)
protected Date recDate;
@TableField(value = "rec_user_id", fill = FieldFill.INSERT_UPDATE)
protected String recUserId;
@TableField(value = "rec_user_name", fill = FieldFill.INSERT_UPDATE)
protected String recUserName;
/**
* 是否删除
*/
@TableField(value = "is_delete")
public Boolean isDelete=false;
@ApiModelProperty(value = "是否可以点击")
@TableField(exist = false)
public Boolean canClick;
}
\ No newline at end of file
package com.yeejoin.equipmanage.common.entity.dto;
import io.swagger.annotations.ApiModel;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.experimental.Accessors;
import java.util.List;
@Data
@AllArgsConstructor
@Accessors(chain = true)
@ApiModel(value="OrgUsrDto", description="树菜单")
public class OrgUsrDto {
private String id;
private String name;
private String parentId;
private List<OrgUsrDto> children;
private String bizOrgCode;
private String code;
public Boolean canClick;
public OrgUsrDto(String id, String name, String parentId, String bizOrgCode, String code, Boolean canClick) {
super();
this.id = id;
this.name = name;
this.parentId = parentId;
this.bizOrgCode = bizOrgCode;
this.code = code;
this.canClick = canClick;
}
public OrgUsrDto() {
}
}
\ No newline at end of file
...@@ -2,12 +2,14 @@ package com.yeejoin.equipmanage.controller; ...@@ -2,12 +2,14 @@ package com.yeejoin.equipmanage.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams; import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.equipmanage.common.entity.dto.OrgUsrDto;
import com.yeejoin.equipmanage.common.utils.*; import com.yeejoin.equipmanage.common.utils.*;
import com.yeejoin.equipmanage.config.PersonIdentify; import com.yeejoin.equipmanage.config.PersonIdentify;
import com.yeejoin.equipmanage.mapper.FireFightingSystemMapper; import com.yeejoin.equipmanage.mapper.FireFightingSystemMapper;
import com.yeejoin.equipmanage.service.IEquipmentSpecificAlarmService; import com.yeejoin.equipmanage.service.IEquipmentSpecificAlarmService;
import com.yeejoin.equipmanage.service.IEquipmentSpecificSerivce; import com.yeejoin.equipmanage.service.IEquipmentSpecificSerivce;
import com.yeejoin.equipmanage.service.IFireFightingSystemService; import com.yeejoin.equipmanage.service.IFireFightingSystemService;
import com.yeejoin.equipmanage.service.IOrgUsrService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
...@@ -48,6 +50,9 @@ public class DCenterController extends AbstractBaseController { ...@@ -48,6 +50,9 @@ public class DCenterController extends AbstractBaseController {
@Autowired @Autowired
IEquipmentSpecificSerivce specificService; IEquipmentSpecificSerivce specificService;
@Autowired
IOrgUsrService iOrgUsrService;
/** /**
* 直流中心告警列表分页,用于直流中心大数据查询分页,不建议再扩展联表查询 * 直流中心告警列表分页,用于直流中心大数据查询分页,不建议再扩展联表查询
*/ */
...@@ -131,4 +136,34 @@ public class DCenterController extends AbstractBaseController { ...@@ -131,4 +136,34 @@ public class DCenterController extends AbstractBaseController {
return CommonResponseUtil.success(fireFightingSystemMapper.getCenterWaterInfo(page, bizOrgCode)); return CommonResponseUtil.success(fireFightingSystemMapper.getCenterWaterInfo(page, bizOrgCode));
} }
/**
* 换流站接入情况总览
*
* @return
*/
@GetMapping(value = "/station/connect/state")
@TycloudOperation(ApiLevel = UserType.AGENCY)
public ResponseModel getStationConnectStatus() {
return CommonResponseUtil.success(fireFightingSystemService.getStationConnectStatus());
}
/**
* 换流站接入状态统计
*
* @return
*/
@GetMapping(value = "/station/status/statistics")
@TycloudOperation(ApiLevel = UserType.AGENCY)
public ResponseModel getStationStatusStatistics() {
return CommonResponseUtil.success(fireFightingSystemService.getStationStatusStatistics());
}
@RequestMapping(value = "/companyTree", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "电力公司树", notes = "电力公司树")
@TycloudOperation(ApiLevel = UserType.AGENCY)
public ResponseModel<List<OrgUsrDto>> companyTreeByUserAndType() {
List<OrgUsrDto> menus = iOrgUsrService.getCompanyTree();
return CommonResponseUtil.success(menus);
}
} }
...@@ -634,4 +634,8 @@ public interface FireFightingSystemMapper extends BaseMapper<FireFightingSystemE ...@@ -634,4 +634,8 @@ public interface FireFightingSystemMapper extends BaseMapper<FireFightingSystemE
Map<String, Object> getWaterlevelUnit(); Map<String, Object> getWaterlevelUnit();
Map<String, Object> getStationConnectStatus();
List<Map<String, Object>> getStationStatusStatistics();
} }
package com.yeejoin.equipmanage.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.equipmanage.common.entity.OrgUsr;
import java.util.List;
public interface OrgUsrMapper extends BaseMapper<OrgUsr> {
List<OrgUsr> getCompanyTree();
}
\ No newline at end of file
...@@ -302,4 +302,8 @@ public interface IFireFightingSystemService extends IService<FireFightingSystemE ...@@ -302,4 +302,8 @@ public interface IFireFightingSystemService extends IService<FireFightingSystemE
Map<String, Object> getSystemDetailByCode(String systemCode); Map<String, Object> getSystemDetailByCode(String systemCode);
Map<String, Object> getStationConnectStatus();
List<Map<String, Object>> getStationStatusStatistics();
} }
package com.yeejoin.equipmanage.service;
import com.yeejoin.equipmanage.common.entity.dto.OrgUsrDto;
import java.util.List;
/**
* 机构/部门/人员表 服务类
*
* @author tb
* @date 2021-06-18
*/
public interface IOrgUsrService {
List<OrgUsrDto> getCompanyTree();
}
...@@ -2173,4 +2173,20 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste ...@@ -2173,4 +2173,20 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
}); });
return result; return result;
} }
@Override
public Map<String, Object> getStationConnectStatus() {
Map<String, Object> map = new HashMap<>();
Map<String, Object> resultMap = fireFightingSystemMapper.getStationConnectStatus();
map.put("online", resultMap.get("online"));
map.put("notOnline", resultMap.get("notOnline"));
return map;
}
@Override
public List<Map<String, Object>> getStationStatusStatistics() {
return fireFightingSystemMapper.getStationStatusStatistics();
}
} }
...@@ -899,6 +899,8 @@ public class MqttReceiveServiceImpl implements MqttReceiveService { ...@@ -899,6 +899,8 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
equipmentSpecificAlarm.setEmergencyLevelDescribe(equipmentSpecificIndex.getEmergencyLevelDescribe()); equipmentSpecificAlarm.setEmergencyLevelDescribe(equipmentSpecificIndex.getEmergencyLevelDescribe());
equipmentSpecificAlarm.setBizOrgCode(equipmentSpecificIndex.getBizOrgCode()); equipmentSpecificAlarm.setBizOrgCode(equipmentSpecificIndex.getBizOrgCode());
equipmentSpecificAlarm.setBizOrgName(equipmentSpecificIndex.getBizOrgName()); equipmentSpecificAlarm.setBizOrgName(equipmentSpecificIndex.getBizOrgName());
equipmentSpecificAlarm.setStationCode(stationCode);
equipmentSpecificAlarm.setStationName(stationName);
equipmentSpecificAlarms.add(equipmentSpecificAlarm); equipmentSpecificAlarms.add(equipmentSpecificAlarm);
return equipmentSpecificAlarms; return equipmentSpecificAlarms;
} }
......
package com.yeejoin.equipmanage.service.impl;
import com.yeejoin.equipmanage.common.entity.OrgUsr;
import com.yeejoin.equipmanage.common.entity.dto.OrgUsrDto;
import com.yeejoin.equipmanage.mapper.OrgUsrMapper;
import com.yeejoin.equipmanage.service.IOrgUsrService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
import java.util.*;
import java.util.stream.Collectors;
@Service
public class OrgUsrServiceImpl implements IOrgUsrService {
private final Logger logger = LoggerFactory.getLogger(OrgUsrServiceImpl.class);
@Autowired
OrgUsrMapper orgUsrMapper;
@Override
public List<OrgUsrDto> getCompanyTree(){
List<OrgUsr> list = orgUsrMapper.getCompanyTree();
return buildCompanyTree(list);
}
public static List<OrgUsrDto> buildCompanyTree(List<OrgUsr> list) {
List<OrgUsrDto> menuList = list.stream()
.map(o -> new OrgUsrDto(String.valueOf(o.getSequenceNbr()), o.getBizOrgName(),
ObjectUtils.isEmpty(o.getParentId()) ? "0" : String.valueOf(o.getParentId()),
o.getBizOrgCode(), o.getCode(), o.getCanClick())).collect(Collectors.toList());
List<OrgUsrDto> result = new ArrayList<>();
Map<String, OrgUsrDto> map = new HashMap<>(menuList.size());
menuList.forEach(e -> map.put(e.getId(), e));
Set<? extends Map.Entry<String, ? extends OrgUsrDto>> entries = map.entrySet();
entries.forEach(entry -> {
OrgUsrDto value = entry.getValue();
if (value != null) {
OrgUsrDto treeDto = map.get(value.getParentId());
if (treeDto != null) {
List<OrgUsrDto> children = treeDto.getChildren();
if (children == null) {
children = new ArrayList<>();
treeDto.setChildren(children);
}
children.add(value);
} else {
result.add(value);
}
}
});
return result;
}
}
\ No newline at end of file
...@@ -284,9 +284,10 @@ ...@@ -284,9 +284,10 @@
wlesal.equipment_specific_name as equipmentSpecificName, wlesal.equipment_specific_name as equipmentSpecificName,
wlesal.location, wlesal.location,
wlesal.station_code AS stationCode, wlesal.station_code AS stationCode,
wlesal.station_name AS stationName wlesal.biz_org_name AS stationName
FROM wl_equipment_specific_alarm_log wlesal FROM wl_equipment_specific_alarm_log wlesal
<where> <where>
wlesal.clean_time IS NULL
<if test="param.alarmType == 'BREAKDOWN'">AND wlesal.type = #{param.alarmType}</if> <if test="param.alarmType == 'BREAKDOWN'">AND wlesal.type = #{param.alarmType}</if>
<if test="param.alarmType == 'FIREALARM'">AND wlesal.type = #{param.alarmType}</if> <if test="param.alarmType == 'FIREALARM'">AND wlesal.type = #{param.alarmType}</if>
<if test="param.isFireAlarm == 'false'">AND wlesal.type != 'FIREALARM'</if> <if test="param.isFireAlarm == 'false'">AND wlesal.type != 'FIREALARM'</if>
......
...@@ -5440,4 +5440,53 @@ ...@@ -5440,4 +5440,53 @@
<select id="getWaterlevelUnit" resultType="java.util.Map"> <select id="getWaterlevelUnit" resultType="java.util.Map">
SELECT unit FROM `wl_equipment_index` WHERE name_key = 'FHS_FirePoolDevice_WaterLevel' SELECT unit FROM `wl_equipment_index` WHERE name_key = 'FHS_FirePoolDevice_WaterLevel'
</select> </select>
<select id="getStationConnectStatus" resultType="java.util.Map">
SELECT
SUM(a.`online`) AS `online`,
SUM(a.`notOnline`) AS `notOnline`
FROM
(
SELECT
IF(si.`online` = 1, 1, 0) 'online',
IF(si.`online` !=1, 1, 0) 'notOnline'
FROM
idx_biz_station_info si
GROUP BY
si.`code`
) a
</select>
<select id="getStationStatusStatistics" resultType="java.util.Map">
SELECT
s.`code`,
s.`name`,
IF
( s.total > 0, 1, 0 ) AS `status`
FROM
(
SELECT
si.id,
si.`code`,
si.`name`,
SUM(
IF
(
( wesa.`status` = 1 AND wesa.equipment_specific_index_value = 'true' ),
1,
0
)
) AS total
FROM
idx_biz_station_info si
LEFT JOIN wl_equipment_specific_alarm wesa ON si.`code` = wesa.station_code
WHERE
si.ONLINE = 1
GROUP BY
si.id
) s
GROUP BY
s.id
</select>
</mapper> </mapper>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.equipmanage.mapper.OrgUsrMapper">
<select id="getCompanyTree" resultType="com.yeejoin.equipmanage.common.entity.OrgUsr">
SELECT
usr.sequence_nbr,
usr.biz_org_name,
usr.biz_org_code,
usr.parent_id,
usr.`code`,
CASE
WHEN ibsi.`code` = usr.`code` THEN
1 ELSE 0
END AS canClick
FROM
cb_org_usr usr
LEFT JOIN idx_biz_station_info ibsi ON ibsi.`code` = usr.`code`
WHERE
usr.biz_org_type = 'COMPANY'
AND usr.is_delete = 0
</select>
</mapper>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment