Commit 648ca99a authored by 李秀明's avatar 李秀明

Merge remote-tracking branch 'origin/develop_dl_bugfix_0723' into develop_dl_bugfix_0723

parents 3313678a 51a6aa49
......@@ -28,7 +28,8 @@ public class OrgMenuDto {
private String bizOrgCode;
private Long total;
private String code;
private Boolean isOnline = true;
public Boolean getLeaf() {
return ObjectUtils.isEmpty(children);
}
......@@ -56,6 +57,18 @@ public class OrgMenuDto {
this.code = code;
}
public OrgMenuDto(Long key, String title, Long parentId, String bizOrgType, boolean leaf, String bizOrgCode, String code, Boolean isOnline) {
super();
this.key = key;
this.title = title;
this.parentId = parentId;
this.bizOrgType = bizOrgType;
this.leaf = leaf;
this.bizOrgCode = bizOrgCode;
this.code = code;
this.isOnline = isOnline;
}
public OrgMenuDto(Long key, String title, Long parentId, String bizOrgType, boolean leaf, String bizOrgCode) {
super();
this.key = key;
......
......@@ -123,6 +123,8 @@ public interface OrgUsrMapper extends BaseMapper<OrgUsr> {
List<OrgUsr> companyDeptListWithPersonCount(Map<String, Object> param);
List<OrgUsr> companyListWithPersonCount(Map<String, Object> param);
List<OrgUsr> companyDeptListWithPersonCountNew(Map<String, Object> param);
List<OrgUsr> companyTreeByUser(String bizOrgCode);
......
......@@ -3,9 +3,11 @@ package com.yeejoin.amos.boot.module.common.api.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Map;
public interface StationInfoMapper extends BaseMapper {
Long count(@Param("bizOrgCode") String bizOrgCode, @Param("stationType") String stationType);
Map<String, String> selectStationInfo(@Param("bizOrgCode") String bizOrgCode);
List<Map<String, Object>> selectStationInfoList();
}
......@@ -1038,6 +1038,19 @@
and usr.is_delete = false
</select>
<select id="companyListWithPersonCount"
resultType="com.yeejoin.amos.boot.module.common.api.entity.OrgUsr">
SELECT usr.*,
(select count(1)
from cb_org_usr u
where u.biz_org_type = 'PERSON'
and u.is_delete = false
and u.biz_org_code like CONCAT(usr.biz_org_code, '%')) as total
FROM cb_org_usr usr
where usr.biz_org_type = 'COMPANY'
and usr.is_delete = false
</select>
<select id="companyDeptListWithPersonCountNew"
resultType="com.yeejoin.amos.boot.module.common.api.entity.OrgUsr">
SELECT usr.*,
......
......@@ -26,4 +26,11 @@
</where>
LIMIT 1
</select>
<select id="selectStationInfoList" resultType="java.util.Map">
SELECT
*
FROM
idx_biz_station_info
</select>
</mapper>
......@@ -44,4 +44,7 @@ public class EquipmentSpecificVo implements Serializable {
@ApiModelProperty(value = "装备分类code")
private String ecode;
@ApiModelProperty
private String bizOrgCode;
}
......@@ -82,13 +82,14 @@ public class PluginInterceptor implements Interceptor {
ReflectionUtils.makeAccessible(field);
field.set(boundSql, sql);
return executor.query(mappedStatement, parameter, rowBounds, resultHandler, cacheKey, boundSql);
} else if ("com.yeejoin.equipmanage.mapper.FireFightingSystemMapper.getSystemInfoPage".equals(id)) {
} else if ("com.yeejoin.equipmanage.mapper.FireFightingSystemMapper.getSystemInfoPage".equals(id) ||
"com.yeejoin.equipmanage.mapper.EmergencyMapper.alarmList".equals(id)) {
//执行结果
String sortField = "";
if (parameter instanceof HashMap) {
sortField = ((HashMap<?, ?>) parameter).get("sortField").toString();
}
sql = sql.replace("_sortField", sortField);
sql = sql.replace("@SORT_FIELD", sortField);
//通过反射修改sql语句
Field field = boundSql.getClass().getDeclaredField("sql");
ReflectionUtils.makeAccessible(field);
......
......@@ -562,6 +562,17 @@ public class OrgUsrController extends BaseController {
@PersonIdentify
@TycloudOperation(ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/companyTreeIsOnline", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "根据登录人及类型获取公司树", notes = "根据登录人及类型获取公司树")
public ResponseModel<List<OrgMenuDto>> companyTreeIsOnline() {
// 获取登陆人角色
ReginParams reginParams = getSelectedOrgInfo();
List<OrgMenuDto> menus = iOrgUsrService.companyTreeByUserNumber2(reginParams);
return ResponseHelper.buildResponse(menus);
}
@PersonIdentify
@TycloudOperation(ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/companyTreeByUserToPatrolRoute", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "根据登录人获取公司部门树【部门账号登录可查看上级单位】", notes = "根据登录人获取公司部门树")
public ResponseModel<List<OrgMenuDto>> companyTreeByUserToPatrolRoute() {
......
......@@ -55,6 +55,7 @@ import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.annotation.Resource;
import java.io.Serializable;
......@@ -227,6 +228,59 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
return result;
}
public List<OrgMenuDto> buildTreeParallel2(List<OrgUsr> list) {
List<Map<String, Object>> stationInfoOnline = stationInfoMapper.selectStationInfoList();
List<String> bizOrgCodeList = stationInfoOnline.stream().map(item -> item.get("biz_org_code").toString()).collect(Collectors.toList());
List<OrgMenuDto> menuList = list.stream()
.map(o -> new OrgMenuDto(o.getSequenceNbr(), o.getBizOrgName(),
ObjectUtils.isEmpty(o.getParentId()) ? 0L : Long.parseLong(o.getParentId()), o.getBizOrgType(),
false, o.getBizOrgCode(), o.getCode(), o.getBizOrgCode().length() == 18 && bizOrgCodeList.contains(o.getBizOrgCode()) ? Boolean.TRUE : Boolean.FALSE).setTotal(o.getTotal()))
.collect(Collectors.toList());
List<OrgMenuDto> result = new ArrayList<>();
Map<Long, OrgMenuDto> map = new HashMap<>(menuList.size());
menuList.forEach(e -> map.put(e.getKey(), e));
Set<? extends Map.Entry<Long, ? extends OrgMenuDto>> entries = map.entrySet();
// 此处多线程,会value 出现null 的情况
entries.forEach(entry -> {
OrgMenuDto value = entry.getValue();
if (value != null) {
OrgMenuDto treeDto = map.get(value.getParentId());
if (treeDto != null) {
List<OrgMenuDto> children = treeDto.getChildren();
if (children == null) {
children = new ArrayList<>();
treeDto.setChildren(children);
}
children.add(value);
} else {
result.add(value);
}
}
});
List<OrgMenuDto> orgMenuDtos = doIsOnlineData(result);
return orgMenuDtos;
}
private List<OrgMenuDto> doIsOnlineData(List<OrgMenuDto> list) {
if (CollectionUtils.isNotEmpty(list)) {
for (OrgMenuDto orgMenuDto : list) {
orgMenuDto.setIsOnline(Boolean.TRUE);
if (orgMenuDto.getBizOrgCode().length() == 12 && CollectionUtils.isNotEmpty(orgMenuDto.getChildren())) {
Set<Boolean> collect = orgMenuDto.getChildren().stream().map(OrgMenuDto::getIsOnline).collect(Collectors.toSet());
if (CollectionUtils.isEmpty(collect) || (collect.contains(Boolean.FALSE) && !collect.contains(Boolean.TRUE))) {
orgMenuDto.setIsOnline(Boolean.FALSE);
}
} else if (CollectionUtils.isEmpty(orgMenuDto.getChildren())) {
orgMenuDto.setIsOnline(Boolean.FALSE);
}
doIsOnlineData(orgMenuDto.getChildren());
}
}
return list;
}
public static String getOrgCodeStr() {
return TreeParser.genTreeCode();
}
......@@ -2939,6 +2993,24 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
return buildTreeParallel(list);
}
public List<OrgMenuDto> companyTreeByUserNumber2(ReginParams reginParams) {
Map<String, Object> param = new HashMap<>();
String bizOrgCode = reginParams.getPersonIdentity().getBizOrgCode();
// 权限处理
if (!logic){
OrgUsr orgUsr = orgUsrMapper.selectById(reginParams.getPersonIdentity().getCompanyId());
//判断登陆人是否已经是顶级节点单位
if (!ObjectUtils.isEmpty(orgUsr) && orgUsr.getParentId() != null) {
orgUsr = this.selectParentOrgUsr(orgUsr);
bizOrgCode = orgUsr.getBizOrgCode() != null? orgUsr.getBizOrgCode():bizOrgCode;
}
}
PermissionInterceptorContext.setDataAuthRule(authKey);
param.put("bizOrgCode",bizOrgCode);
List<OrgUsr> list = orgUsrMapper.companyListWithPersonCount(param);
return buildTreeParallel2(list);
}
public List<OrgMenuDto> companyTreeByUserNumberNew(ReginParams reginParams) {
Map<String, Object> param = new HashMap<>();
// 权限处理
......
......@@ -74,7 +74,8 @@ public class AlarmStatisticController extends AbstractBaseController {
}
}
}
return CommonResponseUtil.success(iEmergencyService.alarmList(page, bizOrgCode, systemCode, types, emergencyLevels, name, cleanStatus, handleStatus, createDate, startDate, endDate));
return CommonResponseUtil.success(iEmergencyService.alarmList(page, bizOrgCode, systemCode, types, emergencyLevels,
name, cleanStatus, handleStatus, createDate, startDate, endDate, "", ""));
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
......
......@@ -709,7 +709,8 @@ public class EmergencyController extends AbstractBaseController {
@RequestParam(required = false) String systemCode,
@RequestParam(required = false) String createDate,
@RequestParam(required = false) String startDate,
@RequestParam(required = false) String endDate
@RequestParam(required = false) String endDate,
@RequestParam(required = false) String sorter
) {
Page<Map<String, Object>> page = new Page<>(pageNumber, pageSize);
if (StringUtils.isEmpty(bizOrgCode)) {
......@@ -722,7 +723,12 @@ public class EmergencyController extends AbstractBaseController {
}
}
}
return CommonResponseUtil.success(iEmergencyService.alarmList(page, bizOrgCode, systemCode, types, emergencyLevels, name, cleanStatus, handleStatus, createDate, startDate, endDate));
String sortField = "", sortOrder = "";
if (org.springframework.util.StringUtils.hasText(sorter)) {
sortField = sorter.split("@")[0].equalsIgnoreCase("cleanStatus") ? "clean_time" : sorter.split("@")[0];
sortOrder = sorter.split("@")[1];
}
return CommonResponseUtil.success(iEmergencyService.alarmList(page, bizOrgCode, systemCode, types, emergencyLevels, name, cleanStatus, handleStatus, createDate, startDate, endDate, sortField, sortOrder));
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
......
package com.yeejoin.equipmanage.controller;
import com.yeejoin.equipmanage.common.utils.CommonResponseUtil;
import com.yeejoin.equipmanage.service.IFireFightingSystemService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.List;
import java.util.Map;
/**
* @author keyong
* @title: AlarmStatisticController
* <pre>
* @description: TODO
* </pre>
* @date 2024/7/31 19:33
*/
@RestController
@Api(tags = "关键数据相关API")
@RequestMapping(value = "/keyWordsInfo", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public class KeyWordsInfoController extends AbstractBaseController {
@Autowired
private IFireFightingSystemService iFireFightingSystemService;
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(value = "查询已绑定排油阀的换流变信息", notes = "查询已绑定排油阀的换流变信息")
@RequestMapping(value = "/getFEquipInfoList", method = RequestMethod.GET)
public ResponseModel getFEquipInfoList(@RequestParam(required = false) String bizOrgCode) {
List<Map<String, Object>> resultList = iFireFightingSystemService.getFEquipInfoList(bizOrgCode);
return CommonResponseUtil.success(resultList);
}
}
......@@ -254,12 +254,7 @@ public class PoolStatisticController {
Page<Map<String, Object>> page1 = fireFightingSystemMapper.getWaterInfoList(page, bizOrgCode, sortFlag, sortOrder, status);
List<Map<String, Object>> res = page1.getRecords();
if (!res.isEmpty()) {
List<Map<String, Object>> infoList = fireFightingSystemMapper.getWaterInfoByBizOrgName(bizOrgCode);
for (Map<String, Object> m : res) {
List<Map<String, Object>> list = infoList.stream().filter(x -> String.valueOf(x.get("bizOrgName")).equals(m.get("bizOrgName"))).collect(Collectors.toList());
String csl = String.valueOf(list.get(0).get("csl"));
int result = new BigDecimal(4000).compareTo(new BigDecimal(csl));
m.put("eligibility", result < 0 ? "1" : "0");
Map<String, Object> transResult = UnitTransformUtil.transformValues(String.valueOf(m.get("nowLevel")),
String.valueOf(m.get("unit")), String.valueOf(m.get("minLevel")), String.valueOf(m.get("maxLevel")));
m.put("nowLevel", transResult.get("nowValue"));
......
......@@ -107,7 +107,7 @@ public class SystemStatisticController extends AbstractBaseController {
// 获取当天结束时间(23点59分59秒)
Date endOfDay = DateUtil.endOfDay(new Date());
String endOfDayStr = DateUtil.formatDateTime(endOfDay);
ResponseModel<Map<String, Object>> mapResponseModel = iotFeign.queryIotDataNum(startOfDayStr, endOfDayStr);
ResponseModel<Map<String, Object>> mapResponseModel = iotFeign.queryIotDataNum(startOfDayStr, endOfDayStr, bizOrgCode);
if (200 == mapResponseModel.getStatus() ) {
Map<String, Object> result = mapResponseModel.getResult();
Object totalNum = result.get("totalNum");
......
......@@ -84,7 +84,8 @@ public interface IotFeign {
@RequestMapping(value = "v1/livedata/queryIotDataNum", method = RequestMethod.GET, consumes = "application/json")
ResponseModel<Map<String ,Object>> queryIotDataNum(@RequestParam("timeStart") String timeStart,
@RequestParam("timeEnd") String timeEnd);
@RequestParam("timeEnd") String timeEnd,
@RequestParam(value = "bizOrgCode", required = false) String bizOrgCode);
@RequestMapping(value = "v1/livedata/queryIotDataNumByIndex", method = RequestMethod.GET, consumes = "application/json")
ResponseModel<Map<String ,Integer>> queryIotDataNumByIndex(@RequestParam(value = "timeStart") String timeStart,
......
......@@ -107,7 +107,12 @@ public interface EmergencyMapper extends BaseMapper{
* @param name 设备名称
* @return
*/
Page<Map<String, Object>> alarmList(@Param("page") Page<Map<String, Object>> page, @Param("bizOrgCode") String bizOrgCode, @Param("systemCode") String systemCode, @Param("types") List<String> types, @Param("emergencyLevels") List<String> emergencyLevels, @Param("name") String name, @Param("cleanStatus") Integer cleanStatus, @Param("handleStatus") Integer handleStatus , @Param("createDate") String createDate , @Param("startDate") String startDate , @Param("endDate") String endDate);
Page<Map<String, Object>> alarmList(@Param("page") Page<Map<String, Object>> page, @Param("bizOrgCode") String bizOrgCode,
@Param("systemCode") String systemCode, @Param("types") List<String> types,
@Param("emergencyLevels") List<String> emergencyLevels, @Param("name") String name,
@Param("cleanStatus") Integer cleanStatus, @Param("handleStatus") Integer handleStatus,
@Param("createDate") String createDate , @Param("startDate") String startDate ,
@Param("endDate") String endDate, @Param("sortField") String sortField, @Param("sortOrder") String sortOrder);
List<Map<String, Object>> alarmListNoPage( @Param("bizOrgCode") String bizOrgCode, @Param("systemCode") String systemCode, @Param("types") List<String> types, @Param("emergencyLevels") List<String> emergencyLevels, @Param("name") String name, @Param("cleanStatus") Integer cleanStatus, @Param("handleStatus") Integer handleStatus , @Param("createDate") String createDate , @Param("startDate") String startDate , @Param("endDate") String endDate);
......
......@@ -771,4 +771,8 @@ public interface FireFightingSystemMapper extends BaseMapper<FireFightingSystemE
List<Map<String, Object>> getSystemAlarmNum(@Param("bizOrgCode") String bizOrgCode, String startDate, String endDate);
List<Map<String, Object>> getSystemTypes(String bizOrgCode);
List<Map<String, Object>> getFEquipInfoList(@Param("bizOrgCode") String bizOrgCode);
List<Map<String, Object>> getEquipIndexList(@Param("collect") List<String> collect);
}
......@@ -69,7 +69,9 @@ public interface IEmergencyService {
List<Map<String, Object>> getPressurePumpDiagnosticAnalysis(String bizOrgCode);
Page<Map<String, Object>> alarmList(Page<Map<String, Object>> page,String bizOrgCode, String systemCode, List<String> types, List<String> emergencyLevels, String name, Integer cleanStatus, Integer handleStatus,String createDate,String startDate,String endDate);
Page<Map<String, Object>> alarmList(Page<Map<String, Object>> page,String bizOrgCode, String systemCode, List<String> types,
List<String> emergencyLevels, String name, Integer cleanStatus, Integer handleStatus,
String createDate,String startDate,String endDate,String sortField,String sortOrder);
Map<String, List<PressurePumpCountVo>> getPressurePumpDay();
......
......@@ -360,4 +360,6 @@ public interface IFireFightingSystemService extends IService<FireFightingSystemE
List<OrgMenuDto> getSystemEquipTree(String systemCode);
List<Map<String, Object>> getSystemAlarmNum(String bizOrgCode, String startDate, String endDate);
List<Map<String, Object>> getFEquipInfoList(String bizOrgCode);
}
......@@ -643,8 +643,12 @@ public class EmergencyServiceImpl implements IEmergencyService {
@Override
public Page<Map<String, Object>> alarmList(Page<Map<String, Object>> page, String bizOrgCode, String systemCode, List<String> types, List<String> emergencyLevels, String name, Integer cleanStatus, Integer handleStatus,String createDate,String startDate,String endDate) {
return emergencyMapper.alarmList(page, bizOrgCode, systemCode, types, emergencyLevels, name, cleanStatus, handleStatus, createDate, startDate, endDate);
public Page<Map<String, Object>> alarmList(Page<Map<String, Object>> page, String bizOrgCode, String systemCode,
List<String> types, List<String> emergencyLevels, String name, Integer cleanStatus,
Integer handleStatus,String createDate,String startDate,String endDate,
String sortField,String sortOrder) {
return emergencyMapper.alarmList(page, bizOrgCode, systemCode, types, emergencyLevels, name, cleanStatus,
handleStatus, createDate, startDate, endDate, sortField, sortOrder);
}
//稳压泵定时向缓存中存昨日启动次数任务
......
package com.yeejoin.equipmanage.service.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
......@@ -1224,7 +1227,6 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
resList.add(map);
i++;
}
;
}
return resList;
}
......@@ -2925,4 +2927,52 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
});
return result;
}
@Override
public List<Map<String, Object>> getFEquipInfoList(String bizOrgCode) {
List<Map<String, Object>> list = this.baseMapper.getFEquipInfoList(bizOrgCode);
ArrayList<String> strings = new ArrayList<>();
list.forEach(item -> {
String equipIds = item.get("equipIds").toString();
strings.addAll(Arrays.asList(equipIds.split(",")));
});
List<String> collect = strings.stream().distinct().collect(Collectors.toList());
List<Map<String, Object>> equipIndexList = this.baseMapper.getEquipIndexList(collect);
Map<String, Map<String, Object>> equipmentSpecificId = equipIndexList.stream().collect(Collectors.toMap(item -> item.get("equipmentSpecificId").toString(), item -> item));
List<Map<String, Object>> resultList = new ArrayList<>();
list.forEach(item -> {
int isOpen = 0;
Date updateDate = null;
String equipIds = item.get("equipIds").toString();
String[] equipIdList = equipIds.split(",");
for (String index : equipIdList) {
if (ObjectUtil.isNotEmpty(equipmentSpecificId)
&& equipmentSpecificId.containsKey(index)
&& equipmentSpecificId.get(index).containsKey("equipmentIndexKey")
&& equipmentSpecificId.get(index).get("equipmentIndexKey").toString().equals("ONL_DrainOilValve_Open")) {
Map<String, Object> map = equipmentSpecificId.get(index);
isOpen = 1;
if (updateDate == null) {
updateDate = DateUtil.parse(map.get("updateDate").toString(), DatePattern.UTC_SIMPLE_PATTERN);
} else {
int comparisonResult = DateUtil.compare(updateDate, DateUtil.parse(map.get("updateDate").toString(), DatePattern.UTC_SIMPLE_PATTERN));
updateDate = comparisonResult < 0 ? DateUtil.parse(map.get("updateDate").toString(), DatePattern.UTC_SIMPLE_PATTERN) : updateDate;
}
}
}
HashMap<String, Object> resultMap = new HashMap<>();
if (isOpen == 1) {
resultMap.put("startStatus", item.get("name").toString() + "开启");
resultMap.put("drainDuration", item.get("drainDuration"));
resultMap.put("updateDate", updateDate);
resultList.add(resultMap);
}
});
HashMap<String, Object> closeMap = new HashMap<>();
closeMap.put("startStatus", "关闭");
closeMap.put("updateDate", "--");
closeMap.put("drainDuration", "");
List<Map<String, Object>> closeList = Collections.singletonList(closeMap);
return CollUtil.isNotEmpty(resultList) ? resultList : closeList;
}
}
......@@ -399,11 +399,13 @@ public class MqttReceiveServiceImpl implements MqttReceiveService {
}
//给 iot服务 推送消息 插数据到 influxdb
if (isSendIot) {
EquipmentSpecificVo equipmentSpecificVo = eqIotCodeList.get(0);
JSONObject messageObj = JSON.parseObject(message);
if (!messageObj.containsKey("traceId")) {
String traceId = System.currentTimeMillis() + "";
messageObj.put("traceId", traceId);
}
messageObj.put("bizOrgCode", equipmentSpecificVo.getBizOrgCode());
String messageTraceId = JSON.toJSONString(messageObj);
mqttSendGateway.sendToMqtt("influxdb/" + topic.substring(0, endIndex), messageTraceId);
}
......
......@@ -1492,7 +1492,19 @@
</if>
</where>
ORDER BY
<if test="sortField != null and sortField != ''">
<choose>
<when test="sortOrder == 'ascend'">
wlesal.@SORT_FIELD ASC
</when>
<otherwise>
wlesal.@SORT_FIELD DESC
</otherwise>
</choose>
</if>
<if test="sortField == null or sortField == ''">
wlesal.create_date DESC
</if>
</select>
<select id="alarmListNoPage" resultType="java.util.Map">
......
......@@ -211,7 +211,8 @@
`wes`.`system_id`
)) AS `code`,
wes.system_id systemId,
( SELECT GROUP_CONCAT(fs.name) FROM f_fire_fighting_system fs WHERE `wes`.`system_id` like CONCAT("%",fs.id,'%') ) AS systemName
( SELECT GROUP_CONCAT(fs.name) FROM f_fire_fighting_system fs WHERE `wes`.`system_id` like CONCAT("%",fs.id,'%') ) AS systemName,
biz_org_code as bizOrgCode
FROM
wl_equipment_specific AS wes
......@@ -224,7 +225,8 @@
'car' AS type,
wc.car_num AS `code`,
'' systemId,
'' systemName
'' systemName,
biz_org_code as bizOrgCode
FROM
wl_car wc
where TRIM(wc.iot_code) != '' AND wc.iot_code IS NOT NULL
......
......@@ -5147,7 +5147,133 @@
r.sequence_nbr
) a
)) b
)c
) c
LEFT JOIN (SELECT SUM(c1.csl) AS totalCsl, (CASE WHEN SUM(c1.csl) <![CDATA[<]]> 4000 THEN '0' ELSE '1' END) AS eligibility, c1.bizOrgName FROM (
select
*,
(
CASE
WHEN nowLevel IS NOT NULL
AND maxLevel IS NOT NULL
AND nowLevel - maxLevel > 0 THEN
'1'
WHEN nowLevel IS NOT NULL
AND minLevel IS NOT NULL
AND nowLevel != '--'
AND nowLevel - minLevel >= 0 THEN
'0'
WHEN nowLevel IS NOT NULL
AND minLevel IS NOT NULL AND nowLevel != '--'
AND minLevel - nowLevel > 0 THEN
'1' ELSE '0'
END
) AS `status`,
IFNULL(nowLevel/maxlevel, 0) * volume AS csl
from (
(SELECT
r.sequence_nbr AS id,
r.`name`,
wes.id as equipmentSpecificId,
IFNULL( rp.min_water_level, 0 ) AS minLevel,
IFNULL( rp.max_water_level, 0 ) AS maxLevel,
IFNULL( rp.output_flow_rate, 0 ) AS outputFlowRate,
IFNULL((select
avg(IFNULL(ei.`value`, 0))
from
wl_equipment_specific_index ei
where
(ei.equipment_index_key = 'FHS_FirePoolDevice_WaterLevel' or ei.equipment_index_key = 'FHS_WirelessliquidDetector_WaterLevel')
AND FIND_IN_SET( ei.equipment_specific_id, rp.level_device_id) > 0), '--') AS nowLevel,
IFNULL(CASE WHEN (ei.equipment_index_key = 'FHS_FirePoolDevice_WaterLevel' or ei.equipment_index_key = 'FHS_WirelessliquidDetector_WaterLevel') THEN ei.`unit` END,'--') AS 'unit',
IFNULL( rp.volume, 0 ) AS volume,
ec.image,
r.resource_type,
r.sequence_nbr,
wes.code,
ifnull(rp.pump_device_id, '') as pumpDeviceId,
r.biz_org_name AS bizOrgName
FROM
cb_water_resource r
LEFT JOIN cb_water_resource_pool rp ON rp.resource_id = r.sequence_nbr
LEFT JOIN wl_equipment_specific_index ei ON ei.equipment_specific_id = rp.level_device_id
LEFT JOIN wl_equipment_category ec ON ec.id = r.equip_category_id
LEFT JOIN f_fire_fighting_system fs ON fs.id = r.belong_fighting_system_id
LEFT JOIN wl_equipment_specific wes ON wes.id = rp.level_device_id
WHERE
r.resource_type = 'industryPool'
AND r.is_delete = 1
AND r.`biz_org_code` IS NOT NULL
<if test="bizOrgCode!=null and bizOrgCode!=''">
AND r.biz_org_code like concat(#{bizOrgCode}, '%')
</if>
GROUP BY
r.sequence_nbr) union all
(
SELECT
a1.id,
a1.`name`,
a1.equipmentSpecificId,
a1.minLevel,
a1.maxLevel,
a1.outputFlowRate,
IFNULL( a1.nowLevel, '--' ) nowLevel,
a1.`unit`,
a1.volume,
a1.image,
a1.resource_type,
a1.sequence_nbr,
a1.code,
a1.pumpDeviceId,
a1.bizOrgName
FROM
(
SELECT
r.sequence_nbr AS id,
r.`name`,
wes.id as equipmentSpecificId,
IFNULL( rp.min_water_level, 0 ) AS minLevel,
IFNULL( rp.max_water_level, 0 ) AS maxLevel,
IFNULL( rp.output_flow_rate, 0 ) AS outputFlowRate,
(select
avg(IFNULL(ei.`value`,0))
from
wl_equipment_specific_index ei
where
(ei.equipment_index_key = 'FHS_FirePoolDevice_WaterLevel' or ei.equipment_index_key = 'FHS_WirelessliquidDetector_WaterLevel')
and FIND_IN_SET( ei.equipment_specific_id, rp.level_device_id) > 0) AS nowLevel,
(select
ei.unit
from
wl_equipment_specific_index ei
where
(ei.equipment_index_key = 'FHS_FirePoolDevice_WaterLevel' or ei.equipment_index_key = 'FHS_WirelessliquidDetector_WaterLevel')
and FIND_IN_SET( ei.equipment_specific_id, rp.level_device_id) > 0 limit 1) AS 'unit',
IFNULL( rp.volume, 0 ) AS volume,
ec.image,
r.resource_type,
r.sequence_nbr,
rp.level_device_id,
wes.code,
ifnull(rp.pump_device_id, '') as pumpDeviceId,
r.biz_org_name AS bizOrgName
FROM
cb_water_resource r
LEFT JOIN cb_water_resource_pool rp ON rp.resource_id = r.sequence_nbr
LEFT JOIN wl_equipment_category ec ON ec.id = r.equip_category_id
LEFT JOIN f_fire_fighting_system fs ON fs.id = r.belong_fighting_system_id
LEFT JOIN wl_equipment_specific wes ON wes.id = rp.level_device_id
WHERE
r.resource_type = 'pool'
AND r.is_delete = 1
AND r.`biz_org_code` IS NOT NULL
<if test="bizOrgCode!=null and bizOrgCode!=''">
AND r.biz_org_code like concat(#{bizOrgCode}, '%')
</if>
GROUP BY
r.sequence_nbr
) a1
)) b1
) c1 GROUP BY bizOrgName) d ON d.bizOrgName = c.bizOrgName
<where>
<if test="status != null and status != ''">
c.`status` = #{status}
......@@ -5163,6 +5289,16 @@
</otherwise>
</choose>
</if>
<if test="sortFlag != null and sortFlag != '' and sortFlag = '2'">
<choose>
<when test="sortOrder == 'ascend'">
ORDER BY d.eligibility ASC
</when>
<otherwise>
ORDER BY d.eligibility DESC
</otherwise>
</choose>
</if>
</select>
<select id="getWaterInfoByBizOrgName" resultType="java.util.Map">
......@@ -7004,10 +7140,10 @@
<if test="sortField != null and sortField != ''">
<choose>
<when test="sortOrder == 'ascend'">
_sortField ASC
@SORT_FIELD ASC
</when>
<otherwise>
_sortField DESC
@SORT_FIELD DESC
</otherwise>
</choose>
</if>
......@@ -7021,17 +7157,31 @@
*
FROM
(
(SELECT count( 1 ) AS indexNum FROM wl_equipment_specific_index a LEFT JOIN wl_equipment_index b ON a.equipment_index_id = b.id WHERE b.is_iot = 1) AS indexNum,
(SELECT count( 1 ) AS equipNum FROM wl_equipment_specific es LEFT JOIN wl_equipment e ON e.`code` = es.equipment_code WHERE e.is_iot = 1
(SELECT
sum( n.num )
FROM
(
SELECT
a.id,
count( 1 ) AS num
FROM
wl_equipment_specific a
LEFT JOIN (select m.* from wl_equipment_specific_index m left join wl_equipment_index e on e.id = m.equipment_index_id where e.is_iot = 1) b ON a.id = b.equipment_specific_id
<where>
<if test="bizOrgCode!=null and bizOrgCode!=''">
AND es.biz_org_code LIKE CONCAT(#{bizOrgCode},'%')
AND a.biz_org_code LIKE CONCAT(#{bizOrgCode},'%')
</if>
) AS equipNum,
(SELECT count(1) AS indexMonitorNum FROM wl_equipment_specific_index wesi LEFT JOIN wl_equipment_specific wes on wesi.equipment_specific_id = wes.id WHERE DATE_FORMAT(wesi.update_date, '%Y-%m-%d') = DATE_FORMAT(NOW(), '%Y-%m-%d')
</where>
GROUP BY
a.id
) n
)
) AS indexNum,
(SELECT count( 1 ) AS equipNum FROM wl_equipment_specific es LEFT JOIN wl_equipment e ON e.`code` = es.equipment_code WHERE e.is_iot = 1
<if test="bizOrgCode!=null and bizOrgCode!=''">
AND wes.biz_org_code LIKE CONCAT(#{bizOrgCode},'%')
AND es.biz_org_code LIKE CONCAT(#{bizOrgCode},'%')
</if>
) AS indexMonitorNum
) AS equipNum
)
</select>
......@@ -7096,4 +7246,47 @@
GROUP BY
t1.system_type_code
</select>
<select id="getFEquipInfoList" resultType="java.util.Map">
SELECT
a.id,
a.drain_duration AS drainDuration,
a.`code` AS `code`,
a.`name` AS `name`,
GROUP_CONCAT( c.id ) AS equipIds
FROM
f_equipment a
LEFT JOIN f_equipment_fire_equipment b ON b.equipment_id = a.id
LEFT JOIN wl_equipment_specific c ON b.fire_equipment_id = c.id and LEFT ( c.equipment_code, 8 ) = '92100400'
<where>
<if test="bizOrgCode != null and bizOrgCode != ''">
AND c.biz_org_code like concat(#{bizOrgCode}, '%')
</if>
</where>
GROUP BY
a.id
HAVING
equipIds IS NOT NULL
AND equipIds != ''
</select>
<select id="getEquipIndexList" resultType="java.util.Map">
SELECT
equipment_specific_id AS equipmentSpecificId,
update_date AS updateDate,
equipment_index_key AS equipmentIndexKey
FROM
wl_equipment_specific_index
WHERE
equipment_index_key IN ( 'ONL_DrainOilValve_Open', 'ONL_DrainOilValve_Close' )
AND `value` = 'true'
AND equipment_specific_id in
<foreach collection="collect" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
GROUP BY
equipment_specific_id
ORDER BY
update_date DESC
</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