Commit 0eb3f67d authored by litengwei's avatar litengwei

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

parents 0d564a04 1e0fecc6
...@@ -441,4 +441,34 @@ public class DataDictionaryController extends BaseController { ...@@ -441,4 +441,34 @@ public class DataDictionaryController extends BaseController {
List<DataDictionary> list = iDataDictionaryService.list(queryWrapper); List<DataDictionary> list = iDataDictionaryService.list(queryWrapper);
return ResponseHelper.buildResponse(list); return ResponseHelper.buildResponse(list);
} }
@TycloudOperation(needAuth = true, ApiLevel = UserType.AGENCY)
@RequestMapping(value = "/job/list", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "按人员岗位类型统计", notes = "按人员岗位类型统计")
public ResponseModel<Object> getPeopleJobStatistic(HttpServletRequest request, String types) {
HashMap<Object, Object> objectObjectHashMap = new HashMap<>();
try {
String[] typest = types.split(",");
for (String type : typest) {
QueryWrapper<DataDictionary> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("type", type);
queryWrapper.orderByAsc("sort_num");
if (redisUtils.hasKey(RedisKey.DATA_DICTIONARY_CODE_XIN + type)) {
Object obj = redisUtils.get(RedisKey.DATA_DICTIONARY_CODE_XIN + type);
objectObjectHashMap.put(type, obj);
} else {
Collection<DataDictionary> list = iDataDictionaryService.list(queryWrapper);
List<MenuFrom> menus = null;
menus = TreeParser.getTreexin(null, list, DataDictionary.class.getName(), "getCode", 0, "getName",
"getParent", null);
redisUtils.set(RedisKey.DATA_DICTIONARY_CODE_XIN + type, JSON.toJSON(menus), time);
objectObjectHashMap.put(type, menus);
}
}
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException("系统异常!");
}
return ResponseHelper.buildResponse(objectObjectHashMap);
}
} }
...@@ -22,15 +22,21 @@ public class AlarmKafkaConsumer { ...@@ -22,15 +22,21 @@ public class AlarmKafkaConsumer {
PointSystemServiceImpl pointSystemServiceImpl; PointSystemServiceImpl pointSystemServiceImpl;
//消费者来处理消息 //消费者来处理消息
@KafkaListener(id="user1" , topics ={"${kafka.equipment.alarm}"}) @KafkaListener(id="alarmInfo" , topics ={"${kafka.equipment.alarm}"})
public void message1( String record, Acknowledgment ack){ public void message1( String record, Acknowledgment ack){
// 处理业务 // 处理业务
String date=record; String date=record;
System.out.println("消息进来了" +record);
//异步触发预警 //异步触发预警
pointSystemServiceImpl.sendWarningAsync(date); pointSystemServiceImpl.sendWarningAsync(date);
//手动提交 //手动提交
ack.acknowledge(); ack.acknowledge();
}
@KafkaListener(id="user2" , topics ={"${kafka.equipment.test}"})
public void message2( String record, Acknowledgment ack){
String date=record;
System.out.println("消息进来了 8888888888888888888888");
} }
......
...@@ -99,12 +99,18 @@ public class PointSystemServiceImpl extends ServiceImpl<PointSystemMapper, Point ...@@ -99,12 +99,18 @@ public class PointSystemServiceImpl extends ServiceImpl<PointSystemMapper, Point
//通过测点地址获取,和对应值 获取kks //通过测点地址获取,和对应值 获取kks
QueryWrapper<PointSystem> pointSystemWrapper = new QueryWrapper<>(); QueryWrapper<PointSystem> pointSystemWrapper = new QueryWrapper<>();
pointSystemWrapper.lambda().eq(PointSystem::getAddress, address); pointSystemWrapper.lambda().eq(PointSystem::getAddress, address);
if(!value.equals("false") && !value.equals("true")){
pointSystemWrapper.lambda().eq(PointSystem::getValue, value); pointSystemWrapper.lambda().eq(PointSystem::getValue, value);
}
pointSystemWrapper.lambda().eq(PointSystem::getGatewayId, gatewayId); pointSystemWrapper.lambda().eq(PointSystem::getGatewayId, gatewayId);
PointSystem pointSystem = pointSystemMapper.selectOne(pointSystemWrapper); List<PointSystem> pointSystems = pointSystemMapper.selectList(pointSystemWrapper);
if (pointSystem == null) { if (pointSystems == null || pointSystems.size() < 1 ) {
throw new RuntimeException("获取kks码失败!"); throw new RuntimeException("获取kks码失败!");
} }
PointSystem pointSystem = pointSystems.get(0);
if (pointSystem.getType().equals("遥信")){
return;
}
//调用获取设备相关信息 //调用获取设备相关信息
Map<String, String> maps = new HashMap<>(); Map<String, String> maps = new HashMap<>();
maps.put("type", "equipinfo"); maps.put("type", "equipinfo");
......
...@@ -53,7 +53,8 @@ spring.kafka.producer.value-serializer=org.apache.kafka.common.serialization.Str ...@@ -53,7 +53,8 @@ spring.kafka.producer.value-serializer=org.apache.kafka.common.serialization.Str
kafka.equipment.alarm=EQUIPMENT_ALARM88 kafka.equipment.alarm=EQUIPMENT_ALARM
kafka.equipment.test=test88888
#电站对接第三方查询设备kks码 #电站对接第三方查询设备kks码
power.station.url=http://139.9.169.123:5024/prod-api/fdgl/process/DataInterface power.station.url=http://139.9.169.123:5024/prod-api/fdgl/process/DataInterface
......
...@@ -1352,12 +1352,12 @@ LEFT JOIN ( ...@@ -1352,12 +1352,12 @@ LEFT JOIN (
LEFT JOIN ( LEFT JOIN (
SELECT SELECT
v.`instance_id`, v.`instance_id`,
max( CASE v.field_code WHEN 'fireManagementPostCode' THEN IFNULL( v.field_value_label, v.field_value ) END ) fireManagementPostCode, max(CASE v.field_code WHEN 'fireManagementPostCode' THEN IFNULL(v.field_value_label, v.field_value) END) fireManagementPostCode,
max( CASE v.field_code WHEN 'fireManagementPostCode' THEN v.field_value END ) fireManagementPost, max(CASE v.field_code WHEN 'fireManagementPostCode' THEN v.field_value END) fireManagementPost,
max( CASE v.field_code WHEN 'fireManagementPostCode' THEN v.field_value_label END ) fireManagementPostName, max(CASE v.field_code WHEN 'fireManagementPostCode' THEN v.field_value_label END) fireManagementPostName,
max( CASE v.field_code WHEN 'positionType' THEN IFNULL( v.field_value, v.field_value_label ) END ) positionType, max(CASE v.field_code WHEN 'positionType' THEN IFNULL( v.field_value, v.field_value_label ) END) positionType,
max( CASE v.field_code WHEN 'positionType' THEN v.field_value_label END ) positionTypeName, max(CASE v.field_code WHEN 'positionType' THEN v.field_value_label END) positionTypeName,
max( CASE v.field_code WHEN 'peopleType' THEN v.field_value END ) peopleType max(CASE v.field_code WHEN 'peopleType' THEN v.field_value END) peopleType
FROM FROM
`cb_dynamic_form_instance` v `cb_dynamic_form_instance` v
WHERE WHERE
...@@ -1403,9 +1403,9 @@ LEFT JOIN ( ...@@ -1403,9 +1403,9 @@ LEFT JOIN (
LEFT JOIN ( LEFT JOIN (
SELECT SELECT
v.`instance_id`, v.`instance_id`,
max( CASE v.field_code WHEN 'positionType' THEN v.field_value END ) positionType, max(CASE v.field_code WHEN 'positionType' THEN v.field_value END) positionType,
max( CASE v.field_code WHEN 'positionType' THEN v.field_value_label END ) positionTypeName, max(CASE v.field_code WHEN 'positionType' THEN v.field_value_label END) positionTypeName,
max( CASE v.field_code WHEN 'peopleType' THEN v.field_value END ) peopleType max(CASE v.field_code WHEN 'peopleType' THEN v.field_value END) peopleType
FROM FROM
`cb_dynamic_form_instance` v `cb_dynamic_form_instance` v
WHERE WHERE
......
...@@ -173,6 +173,10 @@ public class EquipmentSpecific extends BaseEntity { ...@@ -173,6 +173,10 @@ public class EquipmentSpecific extends BaseEntity {
@TableField("warranty_info") @TableField("warranty_info")
private String warrantyInfo; private String warrantyInfo;
@ApiModelProperty(value = "指标类型编码")
@TableField("type_code")
private String typeCode;
@ApiModelProperty(value = "质保周期") @ApiModelProperty(value = "质保周期")
@TableField("warranty_period") @TableField("warranty_period")
@JsonFormat(pattern = "yyyy-MM-dd") @JsonFormat(pattern = "yyyy-MM-dd")
......
...@@ -34,5 +34,7 @@ public class EquipmentExportVO { ...@@ -34,5 +34,7 @@ public class EquipmentExportVO {
private String classification = ""; private String classification = "";
@ExcelProperty(value = "所属系统", index = 11) @ExcelProperty(value = "所属系统", index = 11)
private String systemName = ""; private String systemName = "";
@ExcelProperty(value = "所属单位", index = 12)
private String bizOrgName = "";
} }
...@@ -33,12 +33,12 @@ public class UnitTransformUtil { ...@@ -33,12 +33,12 @@ public class UnitTransformUtil {
if (nowVal.compareTo(new BigDecimal(minValue)) < 0) { if (nowVal.compareTo(new BigDecimal(minValue)) < 0) {
map.put("status", "0"); map.put("status", "0");
map.put("abs", nowVal.divide(new BigDecimal(maxValue),2,BigDecimal.ROUND_HALF_UP).movePointRight(2)); map.put("abs", nowVal.divide(new BigDecimal(maxValue),2,BigDecimal.ROUND_HALF_UP).movePointRight(2));
} else if (nowVal.compareTo(new BigDecimal(maxValue)) > 0) { // 当前值大于最大值
map.put("status", "2");
map.put("abs", 100);
} else if (nowVal.compareTo(new BigDecimal(maxValue)) == 0) { } else if (nowVal.compareTo(new BigDecimal(maxValue)) == 0) {
map.put("status", "1"); map.put("status", "1");
map.put("abs", 100); map.put("abs", 100);
} else if (nowVal.compareTo(new BigDecimal(0)) == 0) {
map.put("status", "1");
map.put("abs", "--");
} else { } else {
map.put("status", "1"); map.put("status", "1");
map.put("abs", nowVal.divide(new BigDecimal(maxValue),2,BigDecimal.ROUND_HALF_UP).movePointRight(2)); map.put("abs", nowVal.divide(new BigDecimal(maxValue),2,BigDecimal.ROUND_HALF_UP).movePointRight(2));
......
...@@ -12,24 +12,26 @@ import java.io.Serializable; ...@@ -12,24 +12,26 @@ import java.io.Serializable;
@Data @Data
public class EquipmentAlarmDownloadVO implements Serializable { public class EquipmentAlarmDownloadVO implements Serializable {
@ExcelProperty(value = "所属单位", index = 0)
private String bizOrgName = "";
@ExcelProperty(value = "告警类型", index = 0) @ExcelProperty(value = "告警类型", index = 1)
private String alarmType = ""; private String alarmType = "";
@ExcelProperty(value = "告警设备", index = 1) @ExcelProperty(value = "告警设备", index = 2)
private String equipName = ""; private String equipName = "";
@ExcelProperty(value = "告警内容", index = 2) @ExcelProperty(value = "告警内容", index = 3)
private String alarmContent = ""; private String alarmContent = "";
@ExcelProperty(value = "设备编号", index = 3) @ExcelProperty(value = "设备编号", index = 4)
private String equipCode = ""; private String equipCode = "";
@ExcelProperty(value = "告警位置", index = 4) @ExcelProperty(value = "告警位置", index = 5)
private String alarmPosition = ""; private String alarmPosition = "";
@ExcelProperty(value = "保护对象", index = 5) // @ExcelProperty(value = "保护对象", index = 5)
private String protectObj = ""; // private String protectObj = "";
@ExcelProperty(value = "告警时间", index = 6) @ExcelProperty(value = "告警时间", index = 6)
private String alarmTime = ""; private String alarmTime = "";
......
...@@ -47,6 +47,7 @@ public class EquipmentIndexCacheRunner implements CommandLineRunner { ...@@ -47,6 +47,7 @@ public class EquipmentIndexCacheRunner implements CommandLineRunner {
redisUtils.hmset(RedisKey.EQUIP_INDEX_ADDRESS, equipmentIndexVOMap); redisUtils.hmset(RedisKey.EQUIP_INDEX_ADDRESS, equipmentIndexVOMap);
redisUtils.hmset(RedisKey.EQUIP_INDEX_ADDRESS_KEY, equipmentIndexKeyMap); redisUtils.hmset(RedisKey.EQUIP_INDEX_ADDRESS_KEY, equipmentIndexKeyMap);
// log.info("Redis存入数据key==equip_index_address_key_station: {}", equipmentIndexEventMap);
redisUtils.hmset(RedisKey.EQUIP_INDEX_ADDRESS_KEY_STATION, equipmentIndexEventMap); redisUtils.hmset(RedisKey.EQUIP_INDEX_ADDRESS_KEY_STATION, equipmentIndexEventMap);
} }
} }
\ No newline at end of file
...@@ -135,7 +135,7 @@ public class EquipmentIotMqttReceiveConfig { ...@@ -135,7 +135,7 @@ public class EquipmentIotMqttReceiveConfig {
list.add("+/+/perspective"); // 添加交换站事件监听 list.add("+/+/perspective"); // 添加交换站事件监听
list.add(riskMsgCenterEquipTopic); list.add(riskMsgCenterEquipTopic);
list.add(riskMsgCenterPatrolTopic); list.add(riskMsgCenterPatrolTopic);
list.add("+/+/shaoshan"); // 添加换流站韶山监听事件 list.add("+/+/eventAlarm"); // 添加换流站韶山监听事件 --- shaoshan 修改为 eventAlarm:事件告警 - 统一
String[] arr = list.toArray(new String[list.size()]); String[] arr = list.toArray(new String[list.size()]);
adapter = new MqttPahoMessageDrivenChannelAdapter(clientId + "_inbound", mqttPahoClientFactory(), arr); adapter = new MqttPahoMessageDrivenChannelAdapter(clientId + "_inbound", mqttPahoClientFactory(), arr);
adapter.setCompletionTimeout(completionTimeout); adapter.setCompletionTimeout(completionTimeout);
...@@ -161,7 +161,7 @@ public class EquipmentIotMqttReceiveConfig { ...@@ -161,7 +161,7 @@ public class EquipmentIotMqttReceiveConfig {
mqttEventReceiveService.handlerMqttIncrementMessage(topic, msg); mqttEventReceiveService.handlerMqttIncrementMessage(topic, msg);
}else if (dataType.equals("transmit") && StringUtil.isNotEmpty(msg)){ // 遥信遥测信号 }else if (dataType.equals("transmit") && StringUtil.isNotEmpty(msg)){ // 遥信遥测信号
mqttReceiveService.handlerMqttRomaMessage(topic,msg); mqttReceiveService.handlerMqttRomaMessage(topic,msg);
}else if (dataType.equals("shaoshan") && StringUtil.isNotEmpty(msg)){ // 告警信号 }else if (dataType.equals("eventAlarm") && StringUtil.isNotEmpty(msg)){ // 告警信号
mqttReceiveService.handlerMqttStationMessage(topic,msg); mqttReceiveService.handlerMqttStationMessage(topic,msg);
} }
} }
......
package com.yeejoin.equipmanage.controller; package com.yeejoin.equipmanage.controller;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
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.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.equipmanage.common.entity.Alarm; import com.yeejoin.equipmanage.common.entity.Alarm;
import com.yeejoin.equipmanage.common.utils.NameUtils; import com.yeejoin.equipmanage.common.utils.NameUtils;
import com.yeejoin.equipmanage.config.PersonIdentify;
import com.yeejoin.equipmanage.service.IAlarmService; import com.yeejoin.equipmanage.service.IAlarmService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import liquibase.pro.packaged.O;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.enumeration.UserType; import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation; import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel; import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Arrays; import java.util.Arrays;
import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
...@@ -34,6 +44,9 @@ public class AlarmController { ...@@ -34,6 +44,9 @@ public class AlarmController {
@Autowired @Autowired
IAlarmService iAlarmService; IAlarmService iAlarmService;
@Autowired
RedisUtils redisUtils;
/** /**
* 新增 * 新增
* *
...@@ -136,13 +149,39 @@ public class AlarmController { ...@@ -136,13 +149,39 @@ public class AlarmController {
* *
* @return * @return
*/ */
@RequestMapping(value = "/updateById", method = RequestMethod.GET) @PersonIdentify
@RequestMapping(value = "/totalAlarmNum", method = RequestMethod.GET)
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "修改", notes = "修改") @ApiOperation(httpMethod = "GET", value = "设备平台告警数量统计,按系统", notes = "设备平台告警数量统计,按系统")
public ResponseModel<Map<String, Object>> updateByIdAlarm(String bizOrgCode, String systemId) { public ResponseModel<Object> totalAlarmNum(String bizOrgCode, String systemId) {
ResponseModel responseModel = new ResponseModel(); if(StringUtils.isEmpty(bizOrgCode)) {
// responseModel.setResult(); ReginParams reginParams = JSONObject.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class);
bizOrgCode = reginParams.getPersonIdentity().getBizOrgCode();
}
return ResponseHelper.buildResponse(iAlarmService.totalNum(bizOrgCode, systemId));
}
return iAlarmService.updateById(alarm);
/**
* 设备告警信息导出
*
* @return
*/
@RequestMapping(value = "/downList", method = RequestMethod.GET)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "告警信息导出", notes = "告警信息导出")
public void downList(HttpServletResponse response, @RequestParam(required = false) List<String> types,
@RequestParam(required = false) List<String> emergencyLevels,
@RequestParam(required = false) String name,
@RequestParam(required = false) Integer cleanStatus,
@RequestParam(required = false) Integer handleStatus,
@RequestParam(required = false) String bizOrgCode,
@RequestParam(required = false) String systemCode,
@RequestParam(required = false) String createDate,
@RequestParam(required = false) String startDate,
@RequestParam(required = false) String endDate ) {
iAlarmService.downList(response,bizOrgCode, systemCode, types, emergencyLevels, name, cleanStatus, handleStatus, createDate, startDate, endDate);
} }
} }
...@@ -671,8 +671,11 @@ public class FireFightingSystemController extends AbstractBaseController { ...@@ -671,8 +671,11 @@ public class FireFightingSystemController extends AbstractBaseController {
@PostMapping(value = "/getMonitoringUnitList") @PostMapping(value = "/getMonitoringUnitList")
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "POST", value = "查询监测部件列表", notes = "查询监测部件列表") @ApiOperation(httpMethod = "POST", value = "查询监测部件列表", notes = "查询监测部件列表")
public IPage<EquipTypeImgAmountVO> getMonitoringUnitList(@RequestBody EquipTypeAmountPageDTO equipTypeAmountPage) { public IPage<EquipTypeImgAmountVO> getMonitoringUnitList(
return equipmentSpecificSerivce.getMonitoringUnitList(equipTypeAmountPage); @RequestBody EquipTypeAmountPageDTO equipTypeAmountPage,
@RequestParam(value = "useSource", required = false) String useSource
) {
return equipmentSpecificSerivce.getMonitoringUnitList(equipTypeAmountPage, useSource);
} }
@GetMapping(value = "/getMonitoringCount") @GetMapping(value = "/getMonitoringCount")
......
package com.yeejoin.equipmanage.controller; package com.yeejoin.equipmanage.controller;
import com.yeejoin.equipmanage.common.entity.SignalClassify;
import com.yeejoin.equipmanage.common.vo.EquipCategoryVo; import com.yeejoin.equipmanage.common.vo.EquipCategoryVo;
import com.yeejoin.equipmanage.service.IStatisticsService; import com.yeejoin.equipmanage.service.IStatisticsService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
...@@ -10,6 +11,8 @@ import org.springframework.http.MediaType; ...@@ -10,6 +11,8 @@ import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.foundation.enumeration.UserType; import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation; import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.util.List; import java.util.List;
...@@ -95,4 +98,11 @@ public class StatisticsController { ...@@ -95,4 +98,11 @@ public class StatisticsController {
public List<EquipCategoryVo> equipCategoryVoList(@PathVariable String systemCode) { public List<EquipCategoryVo> equipCategoryVoList(@PathVariable String systemCode) {
return iStatisticsService.equipCategoryVoList(systemCode); return iStatisticsService.equipCategoryVoList(systemCode);
} }
@RequestMapping(value = "/test", method = RequestMethod.GET)
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "根据id查询", notes = "根据id查询")
public ResponseModel<String> getStr() {
return ResponseHelper.buildResponse(iStatisticsService.getStr());
}
} }
package com.yeejoin.equipmanage.dto;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.Data;
@Data
public class AlarmExportDto {
@ExcelProperty(value = "设备名称", index = 0)
private String equipmentSpecificName;
@ExcelProperty(value = "类型", index = 1)
private String type;
@ExcelProperty(value = "等级", index = 2)
private String emergencyLevelDescribe;
@ExcelProperty(value = "消除状态", index = 3)
private String cleanStatus;
@ExcelProperty(value = "时间", index = 4)
private String createDate;
@ExcelProperty(value = "所在位置", index = 5)
private String location;
@ExcelProperty(value = "告警确认", index = 6)
private String handleStatus;
}
package com.yeejoin.equipmanage.dto;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.math.BigDecimal;
/**
* @author keyong
* @title: ReportAlarmDto
* <pre>
* @description: TODO
* </pre>
* @date 2024/5/11 9:56
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class ReportAlarmDto {
private String equipmentSpecificId;
private String specificName;
private String location;
private String equipmentSpecificIndexName;
private String alamContent;
private BigDecimal alarmNum;
private String createDate;
private String updateDate;
private String type;
}
...@@ -143,7 +143,14 @@ public interface JcsFeign { ...@@ -143,7 +143,14 @@ public interface JcsFeign {
* @return ResponseModel<OrgUsrDto> * @return ResponseModel<OrgUsrDto>
*/ */
@GetMapping(value = "/org-usr/{authKey}/listWithAuth") @GetMapping(value = "/org-usr/{authKey}/listWithAuth")
FeignClientResult<List<OrgUsrDto>> getCompanyDeptListWithAuth(@PathVariable(value = "authKey") String authKey, @RequestParam(value = "orgTypes", required = false) String orgTypes, @RequestParam(value = "type", required = false) String type); FeignClientResult<List<OrgUsrDto>> getCompanyDeptListWithAuth(
@RequestHeader(value = "Appkey") String appKey,
@RequestHeader(value = "Product") String product,
@RequestHeader(value = "Token") String token,
@PathVariable(value = "authKey") String authKey,
@RequestParam(value = "orgTypes", required = false) String orgTypes,
@RequestParam(value = "type", required = false) String type
);
@GetMapping(value = "/org-usr/{authKey}/listWithAuthToPartol") @GetMapping(value = "/org-usr/{authKey}/listWithAuthToPartol")
FeignClientResult<List<OrgUsrDto>> getCompanyDeptListWithAuthToPartol(@PathVariable(value = "authKey") String authKey, @RequestParam(value = "orgTypes", required = false) String orgTypes); FeignClientResult<List<OrgUsrDto>> getCompanyDeptListWithAuthToPartol(@PathVariable(value = "authKey") String authKey, @RequestParam(value = "orgTypes", required = false) String orgTypes);
......
...@@ -2,6 +2,10 @@ package com.yeejoin.equipmanage.mapper; ...@@ -2,6 +2,10 @@ package com.yeejoin.equipmanage.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.equipmanage.common.entity.Alarm; import com.yeejoin.equipmanage.common.entity.Alarm;
import liquibase.pro.packaged.S;
import java.util.List;
import java.util.Map;
/** /**
* Mapper 接口 * Mapper 接口
...@@ -11,4 +15,5 @@ import com.yeejoin.equipmanage.common.entity.Alarm; ...@@ -11,4 +15,5 @@ import com.yeejoin.equipmanage.common.entity.Alarm;
*/ */
public interface AlarmMapper extends BaseMapper<Alarm> { public interface AlarmMapper extends BaseMapper<Alarm> {
List<Map<String,String>> totalNum(String bizOrgCode, String systemId);
} }
...@@ -109,6 +109,8 @@ public interface EmergencyMapper extends BaseMapper{ ...@@ -109,6 +109,8 @@ public interface EmergencyMapper extends BaseMapper{
*/ */
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);
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);
IPage<EquipTypeImgAmountVO> getEmergencyEquipList(@Param("page") IPage page, @Param("equipTypeAmountPage") EquipTypeAmountPageDTO equipTypeAmountPage, @Param("list") List<String> list); IPage<EquipTypeImgAmountVO> getEmergencyEquipList(@Param("page") IPage page, @Param("equipTypeAmountPage") EquipTypeAmountPageDTO equipTypeAmountPage, @Param("list") List<String> list);
List<Map<String, Object >> getEquipStatistic(@Param("bizOrgCode") String bizOrgCode, @Param("equipCodeKey") String equipCodeKey); List<Map<String, Object >> getEquipStatistic(@Param("bizOrgCode") String bizOrgCode, @Param("equipCodeKey") String equipCodeKey);
......
...@@ -11,6 +11,7 @@ import com.yeejoin.equipmanage.common.entity.dto.EquipSpecificAlarmDTO; ...@@ -11,6 +11,7 @@ import com.yeejoin.equipmanage.common.entity.dto.EquipSpecificAlarmDTO;
import com.yeejoin.equipmanage.common.entity.vo.EquipmentIotAlarmVO; import com.yeejoin.equipmanage.common.entity.vo.EquipmentIotAlarmVO;
import com.yeejoin.equipmanage.common.utils.CommonPageInfoParam; import com.yeejoin.equipmanage.common.utils.CommonPageInfoParam;
import com.yeejoin.equipmanage.common.vo.EquipAlarmLineVo; import com.yeejoin.equipmanage.common.vo.EquipAlarmLineVo;
import com.yeejoin.equipmanage.dto.ReportAlarmDto;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
...@@ -235,5 +236,5 @@ public interface EquipmentSpecificAlarmMapper extends BaseMapper<EquipmentSpecif ...@@ -235,5 +236,5 @@ public interface EquipmentSpecificAlarmMapper extends BaseMapper<EquipmentSpecif
void clearAlarmData(@Param("equipmentSpecificId") Long equipmentSpecificId); void clearAlarmData(@Param("equipmentSpecificId") Long equipmentSpecificId);
List<Map<String, Object>> getAlarmDetailByDate(@Param("bizOrgCode") String bizOrgCode, @Param("startDate") String startDate, @Param("endDate") String endDate, @Param("sysId") Long sysId); List<ReportAlarmDto> getAlarmDetailByDate(@Param("bizOrgCode") String bizOrgCode, @Param("startDate") String startDate, @Param("endDate") String endDate, @Param("sysId") Long sysId);
} }
...@@ -308,7 +308,11 @@ public interface EquipmentSpecificMapper extends BaseMapper<EquipmentSpecific> { ...@@ -308,7 +308,11 @@ public interface EquipmentSpecificMapper extends BaseMapper<EquipmentSpecific> {
List<Map<String, Object>> getListByCode(@Param("code") String code, @Param("bizOrgCode") String bizOrgCode); List<Map<String, Object>> getListByCode(@Param("code") String code, @Param("bizOrgCode") String bizOrgCode);
IPage<EquipTypeImgAmountVO> getMonitoringUnitList(@Param("page") IPage page,@Param("equipTypeAmountPage") EquipTypeAmountPageDTO equipTypeAmountPage); IPage<EquipTypeImgAmountVO> getMonitoringUnitList(
@Param("page") IPage page,
@Param("equipTypeAmountPage") EquipTypeAmountPageDTO equipTypeAmountPage,
@Param("useSource") String useSource
);
List<Map<String, Object >> getMonitoringCount(String bizOrgCode); List<Map<String, Object >> getMonitoringCount(String bizOrgCode);
......
package com.yeejoin.equipmanage.service; package com.yeejoin.equipmanage.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.yeejoin.equipmanage.common.entity.Alarm; import com.yeejoin.equipmanage.common.entity.Alarm;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
/** /**
* 服务类 * 服务类
* *
...@@ -11,4 +16,7 @@ import com.yeejoin.equipmanage.common.entity.Alarm; ...@@ -11,4 +16,7 @@ import com.yeejoin.equipmanage.common.entity.Alarm;
*/ */
public interface IAlarmService extends IService<Alarm> { public interface IAlarmService extends IService<Alarm> {
List<Map<String,String>> totalNum(String bizOrgCode, String systemId);
void downList(HttpServletResponse response, String bizOrgCode, String systemCode, List<String> types, List<String> emergencyLevels, String name, Integer cleanStatus, Integer handleStatus, String createDate, String startDate, String endDate);
} }
...@@ -305,7 +305,7 @@ public interface IEquipmentSpecificSerivce extends IService<EquipmentSpecific> { ...@@ -305,7 +305,7 @@ public interface IEquipmentSpecificSerivce extends IService<EquipmentSpecific> {
String updateEquipSpecificStatusByCheckInput( String id); String updateEquipSpecificStatusByCheckInput( String id);
IPage<EquipTypeImgAmountVO> getMonitoringUnitList(EquipTypeAmountPageDTO equipTypeAmountPage); IPage<EquipTypeImgAmountVO> getMonitoringUnitList(EquipTypeAmountPageDTO equipTypeAmountPage, String useSource);
List<Map<String, Object >> getMonitoringCount(String bizOrgCode); List<Map<String, Object >> getMonitoringCount(String bizOrgCode);
......
...@@ -22,5 +22,6 @@ public interface IStatisticsService { ...@@ -22,5 +22,6 @@ public interface IStatisticsService {
*/ */
List<EquipCategoryVo> equipCategoryVoList(String systemCode); List<EquipCategoryVo> equipCategoryVoList(String systemCode);
String getStr();
} }
package com.yeejoin.equipmanage.service.impl; package com.yeejoin.equipmanage.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.yeejoin.amos.boot.biz.common.excel.ExcelUtil;
import com.yeejoin.equipmanage.common.entity.Alarm; import com.yeejoin.equipmanage.common.entity.Alarm;
import com.yeejoin.equipmanage.common.vo.EquipmentAlarmDownloadVO;
import com.yeejoin.equipmanage.dto.AlarmExportDto;
import com.yeejoin.equipmanage.mapper.AlarmMapper; import com.yeejoin.equipmanage.mapper.AlarmMapper;
import com.yeejoin.equipmanage.mapper.EmergencyMapper;
import com.yeejoin.equipmanage.service.IAlarmService; import com.yeejoin.equipmanage.service.IAlarmService;
import liquibase.pro.packaged.L;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/** /**
* 服务实现类 * 服务实现类
* *
...@@ -15,4 +29,30 @@ import org.springframework.stereotype.Service; ...@@ -15,4 +29,30 @@ import org.springframework.stereotype.Service;
@Service @Service
public class AlarmServiceImpl extends ServiceImpl<AlarmMapper, Alarm> implements IAlarmService { public class AlarmServiceImpl extends ServiceImpl<AlarmMapper, Alarm> implements IAlarmService {
@Autowired
AlarmMapper alarmMapper;
@Autowired
EmergencyMapper emergencyMapper;
@Override
public void downList(HttpServletResponse response, String bizOrgCode, String systemCode, List<String> types, List<String> emergencyLevels, String name, Integer cleanStatus, Integer handleStatus, String createDate, String startDate, String endDate) {
List<Map<String, Object>> list = emergencyMapper.alarmListNoPage(bizOrgCode, systemCode, types, emergencyLevels, name, cleanStatus, handleStatus, createDate, startDate, endDate);
List<AlarmExportDto> alarmExportDtoList = new ArrayList<>();
if(list.size() > 0) {
for (Map m :list
) {
String s = JSONObject.toJSONString(m);
AlarmExportDto dto = JSONObject.parseObject(s, AlarmExportDto.class);
alarmExportDtoList.add(dto);
}
ExcelUtil.createTemplate(response, "设备告警信息", "设备告警信息", alarmExportDtoList, AlarmExportDto.class, null, false);
}
}
@Override
public List<Map<String,String>> totalNum(String bizOrgCode, String systemId) {
return alarmMapper.totalNum(bizOrgCode, systemId);
}
} }
...@@ -105,8 +105,8 @@ public class AnalysisReportLogServiceImpl extends ServiceImpl<AnalysisReportLogM ...@@ -105,8 +105,8 @@ public class AnalysisReportLogServiceImpl extends ServiceImpl<AnalysisReportLogM
filter(index -> index.get("code").equals(String.valueOf(f.get("typeCode")))).collect(Collectors.toList()); filter(index -> index.get("code").equals(String.valueOf(f.get("typeCode")))).collect(Collectors.toList());
if (!ObjectUtils.isEmpty(collect)) { if (!ObjectUtils.isEmpty(collect)) {
String indicator = String.valueOf(collect.get(0).get("index")); String indicator = String.valueOf(collect.get(0).get("index"));
analysisReportMonthMapper.insertSystemMonthData(new ArrayList<>(Arrays.asList(indicator.split(","))), beginDateStr, endDateStr, Long.valueOf(f.get("id").toString())); analysisReportMonthMapper.insertSystemMonthData(new ArrayList<>(), beginDateStr, endDateStr, Long.valueOf(f.get("id").toString()));
analysisReportSummaryMapper.insertSystemMonthSummaryData(new ArrayList<>(Arrays.asList(indicator.split(","))), beginDateStr, endDateStr, Long.valueOf(f.get("id").toString())); analysisReportSummaryMapper.insertSystemMonthSummaryData(new ArrayList<>(), beginDateStr, endDateStr, Long.valueOf(f.get("id").toString()));
} }
}); });
} }
...@@ -136,8 +136,8 @@ public class AnalysisReportLogServiceImpl extends ServiceImpl<AnalysisReportLogM ...@@ -136,8 +136,8 @@ public class AnalysisReportLogServiceImpl extends ServiceImpl<AnalysisReportLogM
filter(index -> index.get("code").equals(String.valueOf(f.get("typeCode")))).collect(Collectors.toList()); filter(index -> index.get("code").equals(String.valueOf(f.get("typeCode")))).collect(Collectors.toList());
if (!ObjectUtils.isEmpty(collect)) { if (!ObjectUtils.isEmpty(collect)) {
String indicator = String.valueOf(collect.get(0).get("index")); String indicator = String.valueOf(collect.get(0).get("index"));
analysisReportMonthMapper.insertSystemMonthData(new ArrayList<>(Arrays.asList(indicator.split(","))), beginDateStr, endDateStr, Long.valueOf(f.get("id").toString())); analysisReportMonthMapper.insertSystemMonthData(new ArrayList<>(), beginDateStr, endDateStr, Long.valueOf(f.get("id").toString()));
analysisReportSummaryMapper.insertSystemMonthSummaryData(new ArrayList<>(Arrays.asList(indicator.split(","))), beginDateStr, endDateStr, Long.valueOf(f.get("id").toString())); analysisReportSummaryMapper.insertSystemMonthSummaryData(new ArrayList<>(), beginDateStr, endDateStr, Long.valueOf(f.get("id").toString()));
} }
}); });
} }
......
...@@ -54,6 +54,7 @@ import org.springframework.transaction.annotation.Transactional; ...@@ -54,6 +54,7 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.exception.BaseException; import org.typroject.tyboot.core.foundation.exception.BaseException;
import org.typroject.tyboot.core.foundation.utils.Bean; import org.typroject.tyboot.core.foundation.utils.Bean;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil; import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
...@@ -64,6 +65,7 @@ import java.io.IOException; ...@@ -64,6 +65,7 @@ import java.io.IOException;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
import java.util.concurrent.CompletableFuture;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -541,12 +543,14 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i ...@@ -541,12 +543,14 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i
} }
private List<BuildingTreeVo> getBuildingTreeVos(Boolean isContainRootNode, String bizOrgCode) { private List<BuildingTreeVo> getBuildingTreeVos(Boolean isContainRootNode, String bizOrgCode) {
FormGroup formGroup = iFormGroupService.getByUniqueKey(GroupCodeEnum.ALL_BUILDING.getGroupCode()); CompletableFuture<FormGroup> formGroupFuture = CompletableFuture.supplyAsync(() -> iFormGroupService.getByUniqueKey(GroupCodeEnum.ALL_BUILDING.getGroupCode()));
List<Map<String, Object>> allList = iFormInstanceService.getSpecialChildrenList(null, bizOrgCode); CompletableFuture<List<Map<String, Object>> > allListFuture = CompletableFuture.supplyAsync(() -> iFormInstanceService.getSpecialChildrenList(null, bizOrgCode));
List<BuildingTreeVo> allListVo = buildBuildingData(formGroup, allList, isContainRootNode); return CompletableFuture.allOf(formGroupFuture, allListFuture).thenApply(v -> {
List<BuildingTreeVo> allListVo = buildBuildingData(formGroupFuture.join(), allListFuture.join(), isContainRootNode);
Map<Long, String> absolutePositionMap = getBuildingAbsolutePosition(allListVo); Map<Long, String> absolutePositionMap = getBuildingAbsolutePosition(allListVo);
allListVo.forEach(s -> s.setAbsolutePosition(absolutePositionMap.get(s.getId()))); allListVo.forEach(s -> s.setAbsolutePosition(absolutePositionMap.get(s.getId())));
return allListVo; return allListVo;
}).join();
} }
...@@ -706,25 +710,23 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i ...@@ -706,25 +710,23 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i
@Override @Override
public List<PointTreeVo> getBuildTreeNot(String bizOrgCode) { public List<PointTreeVo> getBuildTreeNot(String bizOrgCode) {
List<PointTreeVo> responses = this.baseMapper.getBuildList(bizOrgCode,null); List<PointTreeVo> responses = this.baseMapper.getBuildList(bizOrgCode, null);
List<PointTreeVo> treeList = new ArrayList<>(); Map<Long, PointTreeVo> nodeMap = responses.parallelStream().collect(Collectors.toMap(PointTreeVo::getSequenceNbr, t -> t));
List<PointTreeVo> treeList = responses.parallelStream()
for (PointTreeVo tree : responses) { .filter(node -> node.getParentId() == null || node.getParentId() == -1)
if (tree.getParentId() == null || tree.getParentId() == -1) { .map(node -> buildTree(node, nodeMap))
treeList.add(tree); .collect(Collectors.toList());
} return treeList;
for (PointTreeVo treeNode : responses) {
if (tree.getSequenceNbr().equals(treeNode.getParentId())) {
if (tree.getChildren() == null) {
tree.setChildren(new ArrayList<>());
}
tree.getChildren().add(treeNode);
}
}
} }
private PointTreeVo buildTree(PointTreeVo node, Map<Long, PointTreeVo> nodeMap) {
return treeList; if (node.getChildren() == null) {
node.setChildren(new ArrayList<>());
}
nodeMap.values().parallelStream()
.filter(childNode -> childNode.getParentId().equals(node.getSequenceNbr()))
.forEach(childNode -> node.getChildren().add(buildTree(childNode, nodeMap)));
return node;
} }
@Override @Override
...@@ -1309,10 +1311,16 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i ...@@ -1309,10 +1311,16 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i
@Override @Override
public Map<Long, String> getBuildingAbsolutePosition() { public Map<Long, String> getBuildingAbsolutePosition() {
FormGroup formGroup = iFormGroupService.getByUniqueKey(GroupCodeEnum.ALL_BUILDING.getGroupCode()); CompletableFuture<FormGroup> formGroupCompletableFuture = CompletableFuture.supplyAsync(() ->
List<Map<String, Object>> allList = iFormInstanceService.getSpecialChildrenList(null, null); iFormGroupService.getByUniqueKey(GroupCodeEnum.ALL_BUILDING.getGroupCode())
);
CompletableFuture<List<Map<String, Object>>> allListCompletableFuture = CompletableFuture.supplyAsync(() ->
iFormInstanceService.getSpecialChildrenList(null, null)
);
return formGroupCompletableFuture.thenCombine(allListCompletableFuture, (formGroup, allList) -> {
List<BuildingTreeVo> allListVo = buildBuildingData(formGroup, allList, true); List<BuildingTreeVo> allListVo = buildBuildingData(formGroup, allList, true);
return getBuildingAbsolutePosition(allListVo); return getBuildingAbsolutePosition(allListVo);
}).join();
} }
@Override @Override
...@@ -1418,12 +1426,15 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i ...@@ -1418,12 +1426,15 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i
//1.组装数据 //1.组装数据
List<BuildingTreeVo> companyBuildingList = buildBuildingAndCompanyListVos(authKey, type,"building"); List<BuildingTreeVo> companyBuildingList = buildBuildingAndCompanyListVos(authKey, type,"building");
//2.list to tree //2.list to tree
List<BuildingTreeVo> buildingTreeVos = companyBuildingList.stream().filter(a -> companyBuildingList.stream().noneMatch(c -> c.getId().toString().equals(a.getParentId()))).peek(b -> b.setChildren(getCompanyBuildingChildrenTree(b.getId().toString(), companyBuildingList))).collect(Collectors.toList()); List<BuildingTreeVo> buildingTreeVos = companyBuildingList.parallelStream()
.filter(
a -> companyBuildingList.parallelStream().noneMatch(c -> c.getId().toString().equals(a.getParentId()))
).peek(
b -> b.setChildren(getCompanyBuildingChildrenTree(b.getId().toString(), companyBuildingList))
).collect(Collectors.toList());
// 任务 7481 // 任务 7481
if(buildingTreeVos.size() == 1 && buildingTreeVos.get(0).getChildren().size() > 0) { if(buildingTreeVos.size() == 1 && !CollectionUtils.isEmpty(buildingTreeVos.get(0).getChildren())) {
List<BuildingTreeVo> buildingTreeVosNew = buildingTreeVos.get(0).getChildren().stream().sorted(new Comparator<BuildingTreeVo>() { List<BuildingTreeVo> buildingTreeVosNew = buildingTreeVos.get(0).getChildren().parallelStream().sorted((o1, o2) -> {
@Override
public int compare(BuildingTreeVo o1, BuildingTreeVo o2) {
if(o1.getGroupType().equals(o2.getGroupType())) { if(o1.getGroupType().equals(o2.getGroupType())) {
return 0; return 0;
} }
...@@ -1434,7 +1445,6 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i ...@@ -1434,7 +1445,6 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i
return 1; return 1;
} }
return 0; return 0;
}
}).collect(Collectors.toList()); }).collect(Collectors.toList());
buildingTreeVos.get(0).setChildren(buildingTreeVosNew); buildingTreeVos.get(0).setChildren(buildingTreeVosNew);
} }
...@@ -1480,9 +1490,24 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i ...@@ -1480,9 +1490,24 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i
if (StringUtils.isEmpty(authKey)) { if (StringUtils.isEmpty(authKey)) {
authKey = this.authKey; authKey = this.authKey;
} }
List<BuildingTreeVo> buildingTreeVos = getBuildingTreeVos(false, null); // List<BuildingTreeVo> buildingTreeVos = getBuildingTreeVos(false, null);
// 1.获取公司list // 1.获取公司list
List<OrgUsrDto> orgUsrLists = jcsRemoteService.getCompanyDeptListWithAuth(authKey, "COMPANY", type); // List<OrgUsrDto> orgUsrLists = jcsRemoteService.getCompanyDeptListWithAuth(authKey, "COMPANY", type);
CompletableFuture<List<BuildingTreeVo>> companyListFuture = CompletableFuture.supplyAsync(() -> getBuildingTreeVos(false, null));
String finalAuthKey = authKey;
String appKey = RequestContext.getAppKey();
String product = RequestContext.getProduct();
String token = RequestContext.getToken();
CompletableFuture<List<OrgUsrDto>> orgUsrListFuture = CompletableFuture.supplyAsync(() -> {
RequestContext.setAppKey(appKey);
RequestContext.setProduct(product);
RequestContext.setToken(token);
return jcsRemoteService.getCompanyDeptListWithAuth(finalAuthKey, "COMPANY", type);
});
CompletableFuture.allOf(companyListFuture, orgUsrListFuture).join();
List<BuildingTreeVo> buildingTreeVos = companyListFuture.join();
List<OrgUsrDto> orgUsrLists = orgUsrListFuture.join();
if(orgUsrLists.isEmpty()){ if(orgUsrLists.isEmpty()){
return new ArrayList<>(); return new ArrayList<>();
} }
...@@ -1676,7 +1701,7 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i ...@@ -1676,7 +1701,7 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i
} }
private List<BuildingTreeVo> getCompanyBuildingChildrenTree(String parentId, List<BuildingTreeVo> all) { private List<BuildingTreeVo> getCompanyBuildingChildrenTree(String parentId, List<BuildingTreeVo> all) {
return all.stream().filter(a -> parentId.equals(a.getParentId())).peek(a -> { return all.parallelStream().filter(a -> parentId.equals(a.getParentId())).peek(a -> {
a.setChildren(getCompanyBuildingChildrenTree(a.getId().toString(), all)); a.setChildren(getCompanyBuildingChildrenTree(a.getId().toString(), all));
}).collect(Collectors.toList()); }).collect(Collectors.toList());
} }
......
...@@ -426,7 +426,7 @@ public class EquipmentDetailServiceImpl extends ServiceImpl<EquipmentDetailMappe ...@@ -426,7 +426,7 @@ public class EquipmentDetailServiceImpl extends ServiceImpl<EquipmentDetailMappe
for (FireFightingSystemEntity entity : sys) { for (FireFightingSystemEntity entity : sys) {
sb.append(entity.getName()).append(","); sb.append(entity.getName()).append(",");
} }
equipmentSpecific.setSystemName(Objects.isNull(sb.toString()) ? "" : sb.deleteCharAt(sb.lastIndexOf(",")).toString()); equipmentSpecific.setSystemName(sb.toString());
} }
// 装备分类 // 装备分类
Equipment equipment = equipmentDetail.getEquipment(); Equipment equipment = equipmentDetail.getEquipment();
......
...@@ -139,13 +139,13 @@ public class EquipmentSpecificAlarmServiceImpl extends ServiceImpl<EquipmentSpec ...@@ -139,13 +139,13 @@ public class EquipmentSpecificAlarmServiceImpl extends ServiceImpl<EquipmentSpec
ids.forEach(id -> { ids.forEach(id -> {
EquipmentAlarmDownloadVO alarmDownloadVO = new EquipmentAlarmDownloadVO(); EquipmentAlarmDownloadVO alarmDownloadVO = new EquipmentAlarmDownloadVO();
if ((alarm.get("id").toString()).equals(id.toString())) { if ((alarm.get("id").toString()).equals(id.toString())) {
// alarmDownloadVO.setId((Long) alarm.get("id")); alarmDownloadVO.setBizOrgName(StringUtil.isNotEmpty(alarm.get("bizOrgName")) ? alarm.get("bizOrgName").toString() : "");
alarmDownloadVO.setAlarmType(signalClassifyService.getTypeNameByCode(alarm.get("type").toString()).getTypeName()); alarmDownloadVO.setAlarmType(signalClassifyService.getTypeNameByCode(alarm.get("type").toString()).getTypeName());
alarmDownloadVO.setEquipName(alarm.get("fireEquipmentName").toString()); alarmDownloadVO.setEquipName(alarm.get("fireEquipmentName").toString());
alarmDownloadVO.setAlarmContent(alarm.get("alarmContent").toString()); alarmDownloadVO.setAlarmContent(alarm.get("alarmContent").toString());
alarmDownloadVO.setEquipCode(StringUtil.isNotEmpty(alarm.get("fireEquipmentCode")) ? alarm.get("fireEquipmentCode").toString() : ""); alarmDownloadVO.setEquipCode(StringUtil.isNotEmpty(alarm.get("fireEquipmentCode")) ? alarm.get("fireEquipmentCode").toString() : "");
alarmDownloadVO.setAlarmPosition(StringUtil.isNotEmpty(alarm.get("warehouseStructureName")) ? alarm.get("warehouseStructureName").toString() : ""); alarmDownloadVO.setAlarmPosition(StringUtil.isNotEmpty(alarm.get("warehouseStructureName")) ? alarm.get("warehouseStructureName").toString() : "");
alarmDownloadVO.setProtectObj(StringUtil.isNotEmpty(alarm.get("equipmentName")) ? alarm.get("equipmentName").toString() : ""); // alarmDownloadVO.setProtectObj(StringUtil.isNotEmpty(alarm.get("equipmentName")) ? alarm.get("equipmentName").toString() : "");
alarmDownloadVO.setAlarmTime(StringUtil.isNotEmpty(alarm.get("createDate")) ? alarm.get("createDate").toString().replace("T", " ") : ""); alarmDownloadVO.setAlarmTime(StringUtil.isNotEmpty(alarm.get("createDate")) ? alarm.get("createDate").toString().replace("T", " ") : "");
alarmDownloadVO.setCleanStatus(alarm.get("cleanStatus").toString()); alarmDownloadVO.setCleanStatus(alarm.get("cleanStatus").toString());
// 处理状态、处理类型无业务字段,后期业务功能实现之后需在此处返回相应字段 // 处理状态、处理类型无业务字段,后期业务功能实现之后需在此处返回相应字段
...@@ -170,13 +170,13 @@ public class EquipmentSpecificAlarmServiceImpl extends ServiceImpl<EquipmentSpec ...@@ -170,13 +170,13 @@ public class EquipmentSpecificAlarmServiceImpl extends ServiceImpl<EquipmentSpec
if (0 < list.size()) { if (0 < list.size()) {
list.forEach(alarm -> { list.forEach(alarm -> {
EquipmentAlarmDownloadVO alarmDownloadVO = new EquipmentAlarmDownloadVO(); EquipmentAlarmDownloadVO alarmDownloadVO = new EquipmentAlarmDownloadVO();
// alarmDownloadVO.setId((Long) alarm.get("id")); alarmDownloadVO.setBizOrgName(StringUtil.isNotEmpty(alarm.get("bizOrgName")) ? alarm.get("bizOrgName").toString() : "");
alarmDownloadVO.setAlarmType(signalClassifyService.getTypeNameByCode(alarm.get("type").toString()).getTypeName()); alarmDownloadVO.setAlarmType(signalClassifyService.getTypeNameByCode(alarm.get("type").toString()).getTypeName());
alarmDownloadVO.setEquipName(alarm.get("fireEquipmentName").toString()); alarmDownloadVO.setEquipName(alarm.get("fireEquipmentName").toString());
alarmDownloadVO.setAlarmContent(alarm.get("alarmContent").toString()); alarmDownloadVO.setAlarmContent(alarm.get("alarmContent").toString());
alarmDownloadVO.setEquipCode(StringUtil.isNotEmpty(alarm.get("fireEquipmentCode")) ? alarm.get("fireEquipmentCode").toString() : ""); alarmDownloadVO.setEquipCode(StringUtil.isNotEmpty(alarm.get("fireEquipmentCode")) ? alarm.get("fireEquipmentCode").toString() : "");
alarmDownloadVO.setAlarmPosition(StringUtil.isNotEmpty(alarm.get("warehouseStructureName")) ? alarm.get("warehouseStructureName").toString() : ""); alarmDownloadVO.setAlarmPosition(StringUtil.isNotEmpty(alarm.get("warehouseStructureName")) ? alarm.get("warehouseStructureName").toString() : "");
alarmDownloadVO.setProtectObj(StringUtil.isNotEmpty(alarm.get("equipmentName")) ? alarm.get("equipmentName").toString() : ""); // alarmDownloadVO.setProtectObj(StringUtil.isNotEmpty(alarm.get("equipmentName")) ? alarm.get("equipmentName").toString() : "");
alarmDownloadVO.setAlarmTime(StringUtil.isNotEmpty(alarm.get("createDate")) ? alarm.get("createDate").toString().replace("T", " ") : ""); alarmDownloadVO.setAlarmTime(StringUtil.isNotEmpty(alarm.get("createDate")) ? alarm.get("createDate").toString().replace("T", " ") : "");
alarmDownloadVO.setCleanStatus(alarm.get("cleanStatus").toString()); alarmDownloadVO.setCleanStatus(alarm.get("cleanStatus").toString());
// 处理状态、处理类型无业务字段,后期业务功能实现之后需在此处返回相应字段 // 处理状态、处理类型无业务字段,后期业务功能实现之后需在此处返回相应字段
......
...@@ -37,8 +37,6 @@ import com.yeejoin.equipmanage.mapper.*; ...@@ -37,8 +37,6 @@ import com.yeejoin.equipmanage.mapper.*;
import com.yeejoin.equipmanage.remote.RemoteSecurityService; import com.yeejoin.equipmanage.remote.RemoteSecurityService;
import com.yeejoin.equipmanage.service.*; import com.yeejoin.equipmanage.service.*;
import com.yeejoin.equipmanage.utils.RelationRedisUtil; import com.yeejoin.equipmanage.utils.RelationRedisUtil;
import liquibase.pro.packaged.J;
import liquibase.pro.packaged.S;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
...@@ -1726,6 +1724,7 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM ...@@ -1726,6 +1724,7 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
es.setRealtimeIotIndexId(index.getEquipmentIndexId()); es.setRealtimeIotIndexId(index.getEquipmentIndexId());
es.setRealtimeIotIndexUpdateDate(index.getUpdateDate()); es.setRealtimeIotIndexUpdateDate(index.getUpdateDate());
es.setValueLabel(index.getValueLabel()); es.setValueLabel(index.getValueLabel());
es.setTypeCode(index.getTypeCode());
equipmentSpecificMapper.updateById(es); equipmentSpecificMapper.updateById(es);
} }
} }
...@@ -2170,8 +2169,8 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM ...@@ -2170,8 +2169,8 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
} }
@Override @Override
public IPage<EquipTypeImgAmountVO> getMonitoringUnitList(EquipTypeAmountPageDTO equipTypeAmountPage) { public IPage<EquipTypeImgAmountVO> getMonitoringUnitList(EquipTypeAmountPageDTO equipTypeAmountPage, String useSource) {
IPage<EquipTypeImgAmountVO> record = equipmentSpecificMapper.getMonitoringUnitList(equipTypeAmountPage.getPage(), equipTypeAmountPage); IPage<EquipTypeImgAmountVO> record = equipmentSpecificMapper.getMonitoringUnitList(equipTypeAmountPage.getPage(), equipTypeAmountPage, useSource);
record.getRecords().forEach(e -> { record.getRecords().forEach(e -> {
e.setEquip(equipmentSpecificMapper.getMonitoringEquip(String.valueOf(e.getId())).get("num").toString()); e.setEquip(equipmentSpecificMapper.getMonitoringEquip(String.valueOf(e.getId())).get("num").toString());
e.setOther(equipmentSpecificMapper.getMonitoringOther(String.valueOf(e.getId())).get("num").toString()); e.setOther(equipmentSpecificMapper.getMonitoringOther(String.valueOf(e.getId())).get("num").toString());
......
...@@ -6,6 +6,7 @@ import com.yeejoin.equipmanage.common.dto.OrgUsrDto; ...@@ -6,6 +6,7 @@ import com.yeejoin.equipmanage.common.dto.OrgUsrDto;
import com.yeejoin.equipmanage.fegin.JcsFeign; import com.yeejoin.equipmanage.fegin.JcsFeign;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import java.util.List; import java.util.List;
...@@ -37,7 +38,7 @@ public class JCSRemoteService { ...@@ -37,7 +38,7 @@ public class JCSRemoteService {
* @return List<OrgUsrDto> * @return List<OrgUsrDto>
*/ */
public List<OrgUsrDto> getCompanyDeptListWithAuth(String authKey, String orgTypes,String type) { public List<OrgUsrDto> getCompanyDeptListWithAuth(String authKey, String orgTypes,String type) {
FeignClientResult<List<OrgUsrDto>> feignClientResult = jcsFeignClient.getCompanyDeptListWithAuth(authKey, orgTypes, type); FeignClientResult<List<OrgUsrDto>> feignClientResult = jcsFeignClient.getCompanyDeptListWithAuth(RequestContext.getAppKey(), RequestContext.getProduct(), RequestContext.getToken(), authKey, orgTypes, type);
return feignClientResult.getResult(); return feignClientResult.getResult();
} }
......
package com.yeejoin.equipmanage.service.impl; package com.yeejoin.equipmanage.service.impl;
import com.alibaba.fastjson.JSON;
import com.yeejoin.equipmanage.common.vo.SShanStationMessage;
import com.yeejoin.equipmanage.utils.ClassToJsonUtil;
import org.springframework.core.io.Resource;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel; import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
...@@ -16,6 +20,7 @@ import com.yeejoin.equipmanage.mapper.StockDetailMapper; ...@@ -16,6 +20,7 @@ import com.yeejoin.equipmanage.mapper.StockDetailMapper;
import com.yeejoin.equipmanage.remote.RemoteSecurityService; import com.yeejoin.equipmanage.remote.RemoteSecurityService;
import com.yeejoin.equipmanage.service.*; import com.yeejoin.equipmanage.service.*;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
...@@ -221,6 +226,29 @@ public class StatisticsServiceImpl implements IStatisticsService { ...@@ -221,6 +226,29 @@ public class StatisticsServiceImpl implements IStatisticsService {
return equipmentSpecificMapper.selectEquipCategoryNumber(fightingSystemEntity.getId()); return equipmentSpecificMapper.selectEquipCategoryNumber(fightingSystemEntity.getId());
} }
@Value("classpath:/json/commonMessage.json")
private Resource commonMessage;
@Override
public String getStr() {
String s = "{\"code\":2000,\"id\":1,\"body\":{\"warns\":[{\"systemid\":\"2\",\"pointId\":\"73811\",\"level\":\"3\",\"time\":\"2024-04-08 09:17:56.226\",\"type\":\"遥信变位\",\"deviceId\":\"\",\"content\":\"火灾报警主机_主控楼二层1#蓄电池室可燃气体火警屏蔽状态 消失\"}]}}";
String s1 = "{\"data_class\":\"realdata\",\"data_type\":\"alarm\",\"op_type\":\"subscribe_emergency\",\"condition\":{\"station_psr_id\":\"50edcb6c1b8a811030493c80a2014950ed9d4f59e8\",\"station_name\":\"中州换流站\",\"alarm_type\":\"yx_bw\"},\"data\":[{\"psrId\":\"D017020000000000000000999\",\"astId\":\"D017020000000000000000999\",\"equipType\":\"ASTType_0000111\",\"eventType\":\"OtherSignal\",\"alarmSource\":\"OWS\",\"alarmLevel\":\"3\",\"description\":\"2024-03-11 09:06:17::585 S2WCL12A E3.C01软水器再生结束信号 出现\",\"dateTime\":\"2024-03-11 09:06:17.585\"}]}";
String s2 = "{\"code\":2000,\"id\":1,\"body\":{\"time_stamp\":\"2024-04-07 16:42:52.616\",\"datatype\":\"analog\",\"name\":\"直流接地极电流IDEE\",\"value\":12.969970703125,\"key\":\"0000YC00010100409C\",\"quality\":0,”code”:1001}}";
String s3 = "{\n" +
" \"timeStamp\": \"2024-05-15 15:29:01.883\",\n" +
" \"warns\": [\n" +
" {\n" +
" \"deviceId\": \"sxxfb30000001112967078\",\n" +
" \"eventstatus\": \"出现\",\n" +
" \"pointId\": \"LS.S2.RCS9794-ZKL.-.绍兴消防泵.2号稳压泵运行\",\n" +
" \"time\": \"2024-05-15 15:29:01.883\"\n" +
" }\n" +
" ]\n" +
" }";
// SShanStationMessage sShanStationMessage = JSON.parseObject(s3, SShanStationMessage.class);
// return String.valueOf(sShanStationMessage);
return ClassToJsonUtil.class2json(s1, commonMessage, "k1");
}
private Double getExtinguishingCountByWarehouseId(String categoryCode, Long warehouseId) { private Double getExtinguishingCountByWarehouseId(String categoryCode, Long warehouseId) {
......
package com.yeejoin.equipmanage.utils;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.google.gson.JsonObject;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.core.io.Resource;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.*;
import java.util.stream.Collectors;
/**
* @author keyong
* @title: ClassToJsonUtil
* <pre>
* @description: TODO
* </pre>
* @date 2024/4/11 11:28
*/
public class ClassToJsonUtil {
private static Map<String, Object> map = new HashMap<>();
public static String class2json(Object obj, Resource commonMessage, String topic) {
String json;
try {
json = IOUtils.toString(commonMessage.getInputStream(), String.valueOf(StandardCharsets.UTF_8));
} catch (IOException e) {
throw new RuntimeException("获取kafka信息模板失败!");
}
List<Map> listModel = JSONObject.parseArray(json, Map.class);
if (0 < listModel.size()) {
List<Map> mapList = listModel.stream().filter(x -> String.valueOf(x.get("kafkaTopic")).equalsIgnoreCase(topic)).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(mapList)) {
Map<String, Object> map1 = mapList.get(0);
JSONObject object = JSON.parseObject(String.valueOf(obj));
analysisJson(object, "");
JSONObject res = analyseJson(JSON.toJSONString(map1), map);
res.put("kafkaTopic", map1.get("kafkaTopic"));
res.put("mqTopic", map1.get("mqTopic"));
return JSON.toJSONString(res);
}
}
return null;
}
private static JSONObject analysisJson(Object objJson, String flag) {
if (objJson instanceof JSONArray) {//如果obj为json数组
JSONArray objArray = (JSONArray) objJson;
for (int i = 0; i < objArray.size(); i++) {
analysisJson(objArray.get(i), flag);
}
} else if (objJson instanceof JSONObject) {//如果为json对象
JSONObject jsonObject = (JSONObject) objJson;
Iterator it = jsonObject.keySet().iterator();
while (it.hasNext()) {
String key = it.next().toString();
Object object = jsonObject.get(key);
//如果得到的是数组
if (object instanceof JSONArray) {
JSONArray objArray = (JSONArray) object;
String path = "";
if (StringUtils.isNotBlank(flag)) {
path = flag + "." + key;
} else {
path = key;
}
analysisJson(objArray, path);
} else if (object instanceof JSONObject) {//如果key中是一个json对象
String path = "";
if (StringUtils.isNotBlank(flag)) {
path = flag + "." + key;
} else {
path = key;
}
analysisJson((JSONObject) object, path);
} else {//如果key中是其他
String path = "";
if (StringUtils.isNotBlank(flag)) {
path = flag + "." + key;
} else {
path = key;
}
// System.out.println(path+":"+object.toString()+" ");
map.put(path, String.valueOf(object));
}
}
} else {//如果key中是其他
// System.out.println(flag+":"+objJson.toString()+" ");
map.put(flag, String.valueOf(objJson));
}
return JSONObject.parseObject(JSON.toJSONString(map));
}
public static JSONObject analyseJson(String jsonData, Map<String, Object> keyMap) {
SortedMap<String, Object> map = new TreeMap<>();
JSONObject jsonObject = JSON.parseObject(jsonData);
for (String key : jsonObject.keySet()) {
String resKey = keyMap.get(key) == null ? key : String.valueOf(keyMap.get(key));
Object value = jsonObject.get(key);
if (value instanceof JSONArray) {
JSONArray jsonArray = new JSONArray(new LinkedList<>());
JSONArray array = jsonObject.getJSONArray(key);
for (int i = 0; i < array.size(); i++) {
Object object = array.get(i);
if (object instanceof String) {
map.put(resKey, array);
} else {
JSONObject sortJson = analyseJson(String.valueOf(object), keyMap);
jsonArray.add(sortJson);
map.put(resKey, jsonArray);
}
}
} else if (value instanceof JSONObject) {
JSONObject sortJson = analyseJson(String.valueOf(value), keyMap);
map.put(resKey, sortJson);
} else {
map.put(resKey, ObjectUtils.isNotEmpty(keyMap.get(value)) ? keyMap.get(value) : "");
}
}
return new JSONObject(map);
}
}
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.url = jdbc:mysql://172.16.11.201:3306/dl_business?useUnicode=true&allowMultiQueries=true&characterEncoding=utf-8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai spring.datasource.url = jdbc:mysql://172.16.10.241:3306/dl_business_v3.0.1.3?useUnicode=true&allowMultiQueries=true&characterEncoding=utf-8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai
spring.datasource.username=root spring.datasource.username=root
spring.datasource.password=Yeejoin@2020 spring.datasource.password=Yeejoin@2020
spring.datasource.type=com.zaxxer.hikari.HikariDataSource spring.datasource.type=com.zaxxer.hikari.HikariDataSource
...@@ -12,22 +12,24 @@ spring.datasource.hikari.max-lifetime= 1800000 ...@@ -12,22 +12,24 @@ spring.datasource.hikari.max-lifetime= 1800000
spring.datasource.hikari.connection-timeout= 60000 spring.datasource.hikari.connection-timeout= 60000
spring.datasource.hikari.connection-test-query= SELECT 1 spring.datasource.hikari.connection-test-query= SELECT 1
##########eureka配置信息############### ##########eureka????###############
eureka.instance.prefer-ip-address = true eureka.instance.prefer-ip-address = true
#服务实例ip地址,若eureka.instance.prefer-ip-address=false,ip-address设置失效,一般情况不用设置。 #????ip????eureka.instance.prefer-ip-address=false,ip-address??????????????
#eureka.instance.ip-address= 172.16.3.135 #eureka.instance.ip-address= 172.16.3.135
#eureka服务ip配置,可填写固定ip地址
eureka.instance.hostname=172.16.11.201
#eureka服务配置的校验账号及密码,配置需和eureka服务后台配置文件中一致 #eureka服务配置的校验账号及密码,配置需和eureka服务后台配置文件中一致
#eureka??ip????????ip??
eureka.instance.hostname=172.16.10.241
#eureka????????????,????eureka???????????
spring.security.user.name=admin spring.security.user.name=admin
spring.security.user.password=a1234560 spring.security.user.password=a1234560
eureka.client.serviceUrl.defaultZone=http://${spring.security.user.name}:${spring.security.user.password}@${eureka.instance.hostname}:10001/eureka/ eureka.client.serviceUrl.defaultZone=http://${spring.security.user.name}:${spring.security.user.password}@${eureka.instance.hostname}:10001/eureka/
##########eureka配置信息############### ##########eureka????###############
#redis #redis
spring.redis.database=1 spring.redis.database=1
spring.redis.host=172.16.11.201 spring.redis.host=172.16.10.241
spring.redis.port=6379 spring.redis.port=6379
spring.redis.password=yeejoin@2020 spring.redis.password=yeejoin@2020
spring.redis.lettuce.pool.max-active=200 spring.redis.lettuce.pool.max-active=200
...@@ -39,10 +41,10 @@ spring.redis.expire.time=30000 ...@@ -39,10 +41,10 @@ spring.redis.expire.time=30000
## emqx ## emqx
emqx.clean-session=true emqx.clean-session=true
emqx.client-id=${spring.application.name}-${random.int[1024,65536]} emqx.client-id=${spring.application.name}-${random.int[1024,65536]}
emqx.broker=tcp://172.16.11.201:1883 emqx.broker=tcp://172.16.10.241:1883
emqx.user-name=admin emqx.user-name=admin
emqx.password=public emqx.password=public
mqtt.scene.host=mqtt://172.16.11.201:8083/mqtt mqtt.scene.host=mqtt://172.16.10.241:8083/mqtt
mqtt.client.product.id=mqtt mqtt.client.product.id=mqtt
mqtt.topic=topic_mqtt mqtt.topic=topic_mqtt
spring.mqtt.completionTimeout=3000 spring.mqtt.completionTimeout=3000
...@@ -57,7 +59,7 @@ spring.influx.actions=10000 ...@@ -57,7 +59,7 @@ spring.influx.actions=10000
spring.influx.bufferLimit=20000 spring.influx.bufferLimit=20000
#系统机器人账号 #???????
amos.system.user.user-name=fas_system amos.system.user.user-name=fas_system
amos.system.user.password=a1234560 amos.system.user.password=a1234560
amos.system.user.app-key=studio_normalapp_3056965 amos.system.user.app-key=studio_normalapp_3056965
...@@ -66,36 +68,36 @@ security.productApp=STUDIO_APP_MOBILE ...@@ -66,36 +68,36 @@ security.productApp=STUDIO_APP_MOBILE
#向数字站同步设备,巡查点台账信息开关,适用于数字站1.0版本,目前停止同步,默认为false #?????????????????????????1.0?????????????false
systemctl.sync.switch=false systemctl.sync.switch=false
#数据JCS开关 设备资源数据权限配置,站端部署,库里只有单站数据可不进行开启(false),中心级部署或存在多站数据时需开启(true)数据权限过滤 #??JCS?? ???????????????????????????????false???????????????????true???????
systemctl.jcs.switch=true systemctl.jcs.switch=true
#给平台同步告警数据,若不同步影响消防自动化告警消息框数据展示 #?????????,????????????????????
systemctl.amos.switch=true systemctl.amos.switch=true
#告警数据是否发送给App端,发送是通过jpush实现,需要有网情况下。目前电力消防不支持网络使用,默认不进行APP推送 #?????????App???????jpush??????????????????????????????APP??
isSendApp=false isSendApp=false
###############向数字化平台3.0进行告警转发配置信息################################ ###############??????3.0??????????################################
#告警推送开关,若无推送需求进行关闭(false) #??????????????????false?
dcs.send.message=false dcs.send.message=false
#请求头参数 #?????
dcs.client-id=fire_system dcs.client-id=fire_system
dcs.client.secret=fire_system dcs.client.secret=fire_system
dcs.grant-type=client_credentials dcs.grant-type=client_credentials
dcs.scope=all dcs.scope=all
dcs.token-key=dcs_token_key dcs.token-key=dcs_token_key
#华为roma秘钥每个站有区别与集成商索取 #??roma??????????????
dcs.x.hw.id=io.cs dcs.x.hw.id=io.cs
dcs.x.hw.appKey=i!YmnHgJ=Ysz8V+O@ZG237inQKfixkQ.-#-P3IlR8fO%.#F!g%35Z#@tp$6G+52v dcs.x.hw.appKey=i!YmnHgJ=Ysz8V+O@ZG237inQKfixkQ.-#-P3IlR8fO%.#F!g%35Z#@tp$6G+52v
# \u7531\u4E8E\u76EE\u524D\u6709\u4E0D\u6B62\u4E00\u4E2A\u6570\u5B57\u7AD9\u5E73\u53F0\u5BF9\u5E94\u63A5\u53E3\u89C4\u8303\u4E0D\u4E00\u81F4\uFF0C\u6240\u4EE5\u6B64\u5904\u589E\u52A0\u914D\u7F6E\uFF0Ctrue\u8868\u793A\u9002\u7528\u4E8E\u5357\u745E\u79D1\u6280\u7684\u63A5\u53E3\u89C4\u8303 # ?????????????????????????????????true??????????????
#平台集成商是否科技接口,(科技为true、继保和许继为false) #????????????(???true???????false?
dcs.NRKJ.use=false dcs.NRKJ.use=false
dcs.source.type=\u9ad8\u7ea7\u5e94\u7528 dcs.source.type=????
#数字化平台3.0权限接口 #?????3.0????
dcs.url.token=http://172.21.101.123/udaap-ddis/v1/cs/auth-service/oauth/token dcs.url.token=http://172.21.101.123/udaap-ddis/v1/cs/auth-service/oauth/token
#数字化平台3.0告警存储接口 #?????3.0??????
dcs.url.sendalarm=http://172.21.101.101/v1/cs/alarm-service/appalarm/sendalarm dcs.url.sendalarm=http://172.21.101.101/v1/cs/alarm-service/appalarm/sendalarm
################################################################################# #################################################################################
...@@ -103,45 +105,45 @@ dcs.url.sendalarm=http://172.21.101.101/v1/cs/alarm-service/appalarm/sendalarm ...@@ -103,45 +105,45 @@ dcs.url.sendalarm=http://172.21.101.101/v1/cs/alarm-service/appalarm/sendalarm
param.system.online.date = 2019-02-12 param.system.online.date = 2019-02-12
############数字1.0视频接入服务配置,其他版本不支持################################## ############??1.0????????????????##################################
# 视频转码服务开关 hls(关)/flv(开),默认关闭,数字换流站1.0使用时开启 # ???????? hls(?)/flv(?),??????????1.0?????
window.vedioFormat = hls window.vedioFormat = hls
# 航天视频服务地址 # ????????
param.htvideo.url=http://192.168.4.174:9001; param.htvideo.url=http://192.168.4.174:9001;
# 南瑞视频转码服务地址 # ??????????
param.nrvideo.url=http://198.87.103.158:8001; param.nrvideo.url=http://198.87.103.158:8001;
#南瑞视频平台通过视频id获取flv格式视频播放地址 #??????????id??flv????????
param.nrflvbyvoideoid.url=http://192.168.4.159:10010/api/media/live param.nrflvbyvoideoid.url=http://192.168.4.159:10010/api/media/live
##################################################################################### #####################################################################################
#装备服务在接收到站端iot推送的装备数据后进行influxdb存库 #??????????iot??????????influxdb??
#1.在装备接口消息处向influxdb/{productKey}/{deviceName} 消息地址推送数据,iot负责存库 #1.?????????influxdb/{productKey}/{deviceName} ?????????iot????
#2.配置文件添加配置项开关,默认为关闭,该功能只使用于中心及系统 #2.??????????????????????????????
#是否向iot推送消息 #???iot????
isSendIot=false isSendIot=false
#站端编码及中文名称,用于数据上送 #????????????????
state.code=GW190301 state.code=GW190301
state.name=\u9526\u5c4f\u6362\u6d41\u7ad9 state.name=?????
#站端编码,用于物联报表查询 #?????????????
stationCode=LSHLZ1bZAJU645Pgl7 stationCode=LSHLZ1bZAJU645Pgl7
#用于总部系统与站端系统逻辑区分,站端写zd总部默认为空 #???????????????????zd??????
system.type=zd system.type=zd
#遥测信号是否向直流中心推送,数字站默认不推送 #??????????????????????
is.open.telemetering=false is.open.telemetering=false
# message 接收来自南瑞平台的告警事件描述,如:出现(即为true) # message ???????????????????????true?
message.alarm.char=\u51FA\u73B0 message.alarm.char=??
# 电建项目配置 # ??????
mileage.parameter=0.5 mileage.parameter=0.5
# 电建项目配置 # ??????
mileage.segmentation.cron=0 0 0 * * ? mileage.segmentation.cron=0 0 0 * * ?
mileage.splitmileage.cron=0 0/1 * * * ? mileage.splitmileage.cron=0 0/1 * * * ?
mileage.clippingtime=600000 mileage.clippingtime=600000
...@@ -150,10 +152,10 @@ equip.car.maxTravel=400 ...@@ -150,10 +152,10 @@ equip.car.maxTravel=400
equip.risk.model.topic="" equip.risk.model.topic=""
#mileage.segmentation.cron= 0 */2 * * * ? #mileage.segmentation.cron= 0 */2 * * * ?
# 机场使用特殊配置iotCode前缀,装备、车辆及导入使用到 # ????????iotCode??????????????
# 机场使用 # ????
#iot.code.prefix.have.used=20210003,20210004,20210005 #iot.code.prefix.have.used=20210003,20210004,20210005
# 电力使用 # ????
iot.code.prefix.have.used= iot.code.prefix.have.used=
#kafka #kafka
......
...@@ -46,8 +46,8 @@ iot.vehicle.track=AMOS-API-IOT ...@@ -46,8 +46,8 @@ iot.vehicle.track=AMOS-API-IOT
jcs.fegin.name=JCS jcs.fegin.name=JCS
video.fegin.name=VIDEO video.fegin.name=VIDEO
idx.feign.name=AMOS-IDX idx.feign.name=AMOS-IDX
mcb.feign.name=MCB-SERVER mcb.feign.name=MCB-SERVER
#\u9879\u76EE\u521D\u59CB\u5316\u753B\u5E03id #\u9879\u76EE\u521D\u59CB\u5316\u753B\u5E03id
morphic.projectSeq=1390314016458514433 morphic.projectSeq=1390314016458514433
#wl_equipment_category \u8868id \uFF08\u53D6\u706B\u707E\u62A5\u8B66\u7CFB\u7EDFid\uFF09 #wl_equipment_category \u8868id \uFF08\u53D6\u706B\u707E\u62A5\u8B66\u7CFB\u7EDFid\uFF09
...@@ -155,30 +155,34 @@ management.endpoint.health.show-details=always ...@@ -155,30 +155,34 @@ management.endpoint.health.show-details=always
logic=false logic=false
##电力报表定时任务 ##????????
jobs.month.cron = 0 50 0 1 * ? jobs.month.cron = 0 50 0 1 * ?
jobs.day.cron = 0 5 0 * * ? jobs.day.cron = 0 5 0 * * ?
jobs.week.cron = 0 25 0 ? * 1 jobs.week.cron = 0 25 0 ? * 1
jobs.day.cron.old = 0 25 0 * * ? jobs.day.cron.old = 0 25 0 * * ?
# ?????????
update.car.qrCode=0 01 00 * * ?
#预案消防炮设备类型编码 #???????????
equipment.plan.monitor=92030200,92032200 equipment.plan.monitor=92030200,92032200
#消防泵设备类型编码 #?????????
equipment.plan.pump=92010600,92030600,92130400,92140200,92150300 equipment.plan.pump=92010600,92030600,92130400,92140200,92150300
#电力设备报废业务,在设备报废前30日 每日9点执行 系统推送提醒。设备报废后停止消息推送提醒 #???????????????30? ??9??? ????????????????????
equipment.scrap.day=30 equipment.scrap.day=30
equipment.scrap.cron=0 0 9 * * ? equipment.scrap.cron=0 0 9 * * ?
#???????????kks?
power.station.url=http://139.9.169.123:5024/process/DataInterface
#稳压泵定时向缓存中存昨日启动次数任务 #??????????????????
equipment.pressurepump.start.cron=0 0 0 * * ? equipment.pressurepump.start.cron=0 0 0 * * ?
#稳压泵启停指标 #???????
equipment.pressurepump.start=FHS_PressurePump_Start equipment.pressurepump.start=FHS_PressurePump_Start
#稳压泵压力指标 #???????
equipment.pressurepump.pipepressure=FHS_PipePressureDetector_PipePressure equipment.pressurepump.pipepressure=FHS_PipePressureDetector_PipePressure
#液位指标编码 #??????
water.level.indexKey=FHS_FirePoolDevice_WaterLevel,FHS_LevelDetector_WaterLevel,FHS_WirelessliquidDetector_WaterLevel,CAFS_FoamTank_FoamTankLevel,CAFS_WaterTank_WaterTankLevel water.level.indexKey=FHS_FirePoolDevice_WaterLevel,FHS_LevelDetector_WaterLevel,FHS_WirelessliquidDetector_WaterLevel,CAFS_FoamTank_FoamTankLevel,CAFS_WaterTank_WaterTankLevel
...@@ -1115,4 +1115,16 @@ ...@@ -1115,4 +1115,16 @@
ADD pump_device_name varchar(1500) DEFAULT NULL COMMENT '消防泵装置名称s'; ADD pump_device_name varchar(1500) DEFAULT NULL COMMENT '消防泵装置名称s';
</sql> </sql>
</changeSet> </changeSet>
<changeSet author="xxz" id="20240510-1">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="wl_equipment_specific" columnName="type_code"/>
</not>
</preConditions>
<comment>wl_equipment_specific表新增属性字段type_code</comment>
<sql>
ALTER TABLE `wl_equipment_specific` ADD COLUMN `type_code` VARCHAR (50) NULL COMMENT '指标类型编码';
</sql>
</changeSet>
</databaseChangeLog> </databaseChangeLog>
\ No newline at end of file
[
{
"kafkaTopic": "k1",
"mqTopic": "romaSite/data/transmit",
"data": {
"dataType": "condition.station_psr_id",
"value": "condition.station_psr_id",
"timeStamp": "condition.station_psr_id",
"quality": "condition.station_psr_id",
"scadaId": "condition.station_psr_id",
"key": "condition.station_psr_id",
"disCreate": "condition.station_psr_id",
"name": "condition.station_psr_id"
}
},
{
"kafkaTopic": "k2",
"mqTopic": "romaSite/data/eventAlarm",
"data": {
"timeStamp": "body.warns.time",
"warns": [
{
"eventTextL1": "body.warns.systemid",
"pointId": "body.warns.pointId",
"time": "body.warns.type",
"deviceId": "deviceId",
"eventstatus": "body.warns.content"
}
]
}
}
]
\ No newline at end of file
...@@ -2,4 +2,39 @@ ...@@ -2,4 +2,39 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.equipmanage.mapper.AlarmMapper"> <mapper namespace="com.yeejoin.equipmanage.mapper.AlarmMapper">
<select id="totalNum" resultType="java.util.Map">
SELECT count(*) num, 'qlgj' as code from wl_equipment_specific_alarm_log a
where a.biz_org_code like concat(#{bizOrgCode}, '%')
<if test="systemId != null and systemId !=''">
and FIND_IN_SET(#{systemId},a.system_ids)
</if>
and date_format(a.`create_date`,'%Y-%m-%d') = date_format(now(),'%Y-%m-%d')
UNION ALL
SELECT count(*) num, 'wfggj' as code from wl_equipment_specific_alarm_log a where a.`status` = 1 and a.clean_time IS NULL
and a.biz_org_code like concat(#{bizOrgCode}, '%')
<if test="systemId != null and systemId !=''">
and FIND_IN_SET(#{systemId},a.system_ids)
</if>
UNION ALL
SELECT count(*) num, 'hzgj' as code from wl_equipment_specific_alarm_log a where a.`type` = 'FIREALARM' and a.clean_time IS NULL
and a.`status` = 1
and a.biz_org_code like concat(#{bizOrgCode}, '%')
<if test="systemId != null and systemId !=''">
and FIND_IN_SET(#{systemId},a.system_ids)
</if>
UNION ALL
SELECT count(*) num, 'gzgj' as code from wl_equipment_specific_alarm_log a where a.`type` = 'BREAKDOWN' and a.clean_time IS NULL
and a.`status` = 1
and a.biz_org_code like concat(#{bizOrgCode}, '%')
<if test="systemId != null and systemId !=''">
and FIND_IN_SET(#{systemId},a.system_ids)
</if>
UNION ALL
SELECT count(*) num, 'pbgj' as code from wl_equipment_specific_alarm_log a where a.`type` = 'SHIELD' and a.clean_time IS NULL
and a.`status` = 1
and a.biz_org_code like concat(#{bizOrgCode}, '%')
<if test="systemId != null and systemId !=''">
and FIND_IN_SET(#{systemId},a.system_ids)
</if>
</select>
</mapper> </mapper>
...@@ -1420,8 +1420,10 @@ ...@@ -1420,8 +1420,10 @@
IF (wlesal.clean_time IS NOT NULL, '已消除', '未消除' ) cleanStatus, IF (wlesal.clean_time IS NOT NULL, '已消除', '未消除' ) cleanStatus,
wlesal.equipment_index_id AS fireEquipmentIndexId, wlesal.equipment_index_id AS fireEquipmentIndexId,
wlesal.equipment_specific_code AS code, wlesal.equipment_specific_code AS code,
fs.code AS systemCode,
wlesal.equipment_specific_index_key AS fireEquipmentSpecificIndexKey, wlesal.equipment_specific_index_key AS fireEquipmentSpecificIndexKey,
wlesal.equipment_specific_index_name AS fireEquipmentSpecificIndexName, wlesal.equipment_specific_index_name AS fireEquipmentSpecificIndexName,
wlesal.emergency_level_color AS emergencyLevelColor,
CASE wlesal.equipment_specific_index_value CASE wlesal.equipment_specific_index_value
WHEN 'true' THEN '是' WHEN 'true' THEN '是'
WHEN 'false' THEN '否' WHEN 'false' THEN '否'
...@@ -1453,10 +1455,90 @@ ...@@ -1453,10 +1455,90 @@
<if test='createDate != null and createDate == "1"'> <if test='createDate != null and createDate == "1"'>
AND wlesal.create_date LIKE CONCAT( DATE_FORMAT( NOW( ), '%Y-%m-%d' ), '%' ) AND wlesal.create_date LIKE CONCAT( DATE_FORMAT( NOW( ), '%Y-%m-%d' ), '%' )
</if> </if>
<if test='startDate != null and startDate == ""'> <if test="startDate != null and startDate != ''">
AND wlesal.create_date >= DATE_FORMAT( #{startDate}, '%Y-%m-%d %H:%i:%s' )
</if>
<if test="endDate != null and endDate != ''">
AND DATE_FORMAT( #{endDate}, '%Y-%m-%d %H:%i:%s' ) >= wlesal.create_date
</if>
<if test="systemCode != null and systemCode != ''">
and fs.code = #{systemCode}
</if>
<if test="name != null and name != ''">
and wlesal.equipment_specific_name like concat('%', #{name},'%')
</if>
<if test="cleanStatus != null and cleanStatus != '' and cleanStatus == 2">
and wlesal.clean_time IS NULL
</if>
<if test="cleanStatus != null and cleanStatus != '' and cleanStatus == 1">
and wlesal.clean_time IS NOT NULL
</if>
<if test="handleStatus != null and handleStatus != '' and handleStatus == 2">
and wlesal.confirm_type IS NULL
</if>
<if test="handleStatus != null and handleStatus != '' and handleStatus == 1">
and wlesal.confirm_type IS NOT NULL
</if>
<if test="types != null">
<foreach collection="types" index="index" item="item" open="and (" separator=" OR " close=")">
wlesal.type = #{item}
</foreach>
</if>
<if test="emergencyLevels != null">
<foreach collection="emergencyLevels" index="index" item="item" open="and (" separator=" OR " close=")">
wlesal.emergency_level = #{item}
</foreach>
</if>
</where>
ORDER BY
wlesal.create_date DESC
</select>
<select id="alarmListNoPage" resultType="java.util.Map">
SELECT
wlesal.id,
concat(wlesal.equipment_specific_name, wlesal.equipment_specific_index_name) AS alamContent,
IF (wlesal.confirm_type IS NULL, '未确认', '已确认') handleStatus,
IF (wlesal.clean_time IS NOT NULL, '已消除', '未消除' ) cleanStatus,
wlesal.equipment_index_id AS fireEquipmentIndexId,
wlesal.equipment_specific_code AS code,
wlesal.equipment_specific_index_key AS fireEquipmentSpecificIndexKey,
wlesal.equipment_specific_index_name AS fireEquipmentSpecificIndexName,
CASE wlesal.equipment_specific_index_value
WHEN 'true' THEN '是'
WHEN 'false' THEN '否'
ELSE wlesal.equipment_specific_index_value
END AS fireEquipmentPointValue,
wlesal.type AS typeCode,
(
SELECT
type_name
FROM
wl_signal_classify sc
WHERE
sc.type_code = wlesal.type
LIMIT 1
) AS type,
wlesal.equipment_specific_name AS equipmentSpecificName,
wlesal.location,
date_format(wlesal.create_date, '%Y-%m-%d %H:%i:%s') createDate,
wlesal.emergency_level_describe AS emergencyLevelDescribe,
fs.name AS systemName
FROM
wl_equipment_specific_alarm_log wlesal
LEFT JOIN wl_equipment_specific wes ON wes.id = wlesal.equipment_specific_id
LEFT JOIN f_fire_fighting_system fs ON FIND_IN_SET( fs.id, wlesal.system_ids )
<where>
<if test="bizOrgCode != null and bizOrgCode != ''">
and wlesal.biz_org_code like concat(#{bizOrgCode},'%')
</if>
<if test='createDate != null and createDate == "1"'>
AND wlesal.create_date LIKE CONCAT( DATE_FORMAT( NOW( ), '%Y-%m-%d' ), '%' )
</if>
<if test="startDate != null and startDate != ''">
AND wlesal.create_date >= DATE_FORMAT( ${startDate}, '%Y-%m-%d %H:%i:%s' ) AND wlesal.create_date >= DATE_FORMAT( ${startDate}, '%Y-%m-%d %H:%i:%s' )
</if> </if>
<if test='endDate != null and endDate == ""'> <if test="endDate != null and endDate != ''">
AND DATE_FORMAT( ${endDate}, '%Y-%m-%d %H:%i:%s' ) >= wlesal.create_date AND DATE_FORMAT( ${endDate}, '%Y-%m-%d %H:%i:%s' ) >= wlesal.create_date
</if> </if>
<if test="systemCode != null and systemCode != ''"> <if test="systemCode != null and systemCode != ''">
......
...@@ -467,7 +467,7 @@ ...@@ -467,7 +467,7 @@
wlesal.equipment_specific_id AS fireEquipmentId, wlesal.equipment_specific_id AS fireEquipmentId,
wles.equipment_detail_id AS equipDetailId, wles.equipment_detail_id AS equipDetailId,
wles.`code` AS fireEquipmentCode, wles.`code` AS fireEquipmentCode,
wlesal.biz_org_name AS bizOrgName,
IF ( IF (
wles.`code` IS NULL, wles.`code` IS NULL,
wlesal.equipment_specific_name, wlesal.equipment_specific_name,
...@@ -1602,18 +1602,19 @@ ...@@ -1602,18 +1602,19 @@
DELETE FROM wl_equipment_alarm_report_day WHERE equipment_specific_id = #{equipmentSpecificId}; DELETE FROM wl_equipment_alarm_report_day WHERE equipment_specific_id = #{equipmentSpecificId};
</delete> </delete>
<select id="getAlarmDetailByDate" resultType="Map"> <select id="getAlarmDetailByDate" resultType="com.yeejoin.equipmanage.dto.ReportAlarmDto">
SELECT SELECT
wlesa.equipment_specific_id, wlesa.equipment_specific_id AS equipmentSpecificId,
wlesa.equipment_specific_name AS specificName, wlesa.equipment_specific_name AS specificName,
wlesa.location AS location, wlesa.location AS location,
wlesa.equipment_specific_index_name, wlesa.equipment_specific_index_name AS equipmentSpecificIndexName,
concat(wlesa.equipment_specific_name, wlesa.equipment_specific_index_name) AS alamContent, concat(wlesa.equipment_specific_name, wlesa.equipment_specific_index_name) AS alamContent,
wlesa.frequency AS alarmNum, IFNULL(SUM(wlesa.frequency), 0) AS alarmNum,
wlesa.type AS type,
DATE_FORMAT(wlesa.update_date, '%Y-%m-%d %H:%i:%s') AS updateDate,
DATE_FORMAT(wlesa.create_date, '%Y-%m-%d %H:%i:%s') AS createDate DATE_FORMAT(wlesa.create_date, '%Y-%m-%d %H:%i:%s') AS createDate
FROM FROM
`wl_equipment_specific_alarm` `wlesa` `wl_equipment_specific_alarm` `wlesa`
LEFT JOIN f_fire_fighting_system AS sys ON FIND_IN_SET(sys.id, wlesa.system_ids)
<where> <where>
<if test="bizOrgCode != null and bizOrgCode != ''">AND <if test="bizOrgCode != null and bizOrgCode != ''">AND
wlesa.biz_org_code like concat (#{bizOrgCode},'%') wlesa.biz_org_code like concat (#{bizOrgCode},'%')
...@@ -1624,6 +1625,7 @@ ...@@ -1624,6 +1625,7 @@
AND find_in_set(#{sysId}, wlesa.system_ids) AND find_in_set(#{sysId}, wlesa.system_ids)
</if> </if>
</where> </where>
ORDER BY wlesa.create_date DESC GROUP BY wlesa.equipment_specific_id, wlesa.type
ORDER BY wlesa.update_date DESC
</select> </select>
</mapper> </mapper>
\ No newline at end of file
...@@ -329,6 +329,7 @@ ...@@ -329,6 +329,7 @@
si.create_date, si.create_date,
si.update_date, si.update_date,
si.index_address, si.index_address,
si.event_address AS eventAddress,
si.gateway_id, si.gateway_id,
si.data_type, si.data_type,
si.equipment_specific_name, si.equipment_specific_name,
...@@ -576,7 +577,8 @@ ...@@ -576,7 +577,8 @@
wesi.emergency_level as emergencyLevel, wesi.emergency_level as emergencyLevel,
wesi.emergency_level_describe as emergencyLevelDescribe, wesi.emergency_level_describe as emergencyLevelDescribe,
wes.biz_org_name AS bizOrgName, wes.biz_org_name AS bizOrgName,
wes.biz_org_code AS bizOrgCode wes.biz_org_code AS bizOrgCode,
wes.position AS location
FROM wl_equipment_specific_index AS wesi FROM wl_equipment_specific_index AS wesi
LEFT JOIN wl_equipment_specific AS wes ON wes.id = wesi.equipment_specific_id LEFT JOIN wl_equipment_specific AS wes ON wes.id = wesi.equipment_specific_id
LEFT JOIN wl_equipment_detail ed ON ed.id = wes.equipment_detail_id LEFT JOIN wl_equipment_detail ed ON ed.id = wes.equipment_detail_id
......
...@@ -2673,7 +2673,12 @@ ...@@ -2673,7 +2673,12 @@
</if> </if>
AND wed.equipment_name is not null AND wed.equipment_name is not null
</where> </where>
<if test="useSource == null or useSource == ''">
ORDER BY CONVERT(bizOrgName USING gbk) ASC, equipStatus DESC , wes.create_date DESC ORDER BY CONVERT(bizOrgName USING gbk) ASC, equipStatus DESC , wes.create_date DESC
</if>
<if test="useSource == 'cardscreen'">
ORDER BY equipStatus DESC , wes.create_date DESC
</if>
</select> </select>
<select id="getMonitoringCount" resultType="java.util.Map"> <select id="getMonitoringCount" resultType="java.util.Map">
SELECT SELECT
...@@ -2691,10 +2696,10 @@ ...@@ -2691,10 +2696,10 @@
</select> </select>
<select id="getMonitoringEquip" resultType="java.util.Map"> <select id="getMonitoringEquip" resultType="java.util.Map">
SELECT IFNULL(SUM(IF(aqr.SOURCE = 'equip', 1, 0)), 0) as num FROM dl_amos_idx_biz.idx_access_qrcode_record aqr WHERE aqr.buss_id = #{id} SELECT IFNULL(SUM(IF(aqr.SOURCE = 'equip' AND aqr.TYPE = 'equipment' AND CLEAN_TIME IS NULL, 1, 0)), 0) as num FROM dl_amos_idx_biz.idx_access_qrcode_record aqr WHERE aqr.buss_id = #{id}
</select> </select>
<select id="getMonitoringOther" resultType="java.util.Map"> <select id="getMonitoringOther" resultType="java.util.Map">
SELECT IFNULL(SUM(IF(aqr.SOURCE != 'equip', 1, 0)), 0) as num FROM dl_amos_idx_biz.idx_access_qrcode_record aqr WHERE aqr.buss_id = #{id} SELECT IFNULL(SUM(IF(aqr.SOURCE != 'equip' AND aqr.TYPE = 'equipment' AND CLEAN_TIME IS NULL, 1, 0)), 0) as num FROM dl_amos_idx_biz.idx_access_qrcode_record aqr WHERE aqr.buss_id = #{id}
</select> </select>
<update id="updateEquipQrCode" parameterType="list"> <update id="updateEquipQrCode" parameterType="list">
......
...@@ -8,13 +8,11 @@ import org.apache.kafka.clients.consumer.ConsumerRecord; ...@@ -8,13 +8,11 @@ import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.eclipse.paho.client.mqttv3.MqttException; import org.eclipse.paho.client.mqttv3.MqttException;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.io.Resource;
import org.springframework.kafka.annotation.KafkaListener; import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.kafka.support.Acknowledgment; import org.springframework.kafka.support.Acknowledgment;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.typroject.tyboot.component.emq.EmqKeeper; import org.typroject.tyboot.component.emq.EmqKeeper;
import org.springframework.core.io.Resource;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
import java.util.Arrays; import java.util.Arrays;
...@@ -173,6 +171,77 @@ public class KafkaConsumerService { ...@@ -173,6 +171,77 @@ public class KafkaConsumerService {
} }
} }
} }
//
// /**
// * 韶山换流对接Kafka
// * @param record record
// * @param ack ack
// */
// @KafkaListener(id = "kafkaConsumer", groupId = "kafkaConsumerGroup", topics = "#{'${queue.kafka.shaoshan.topics}'.split(',')}", containerFactory = "kafkaRomaContainerFactory")
// public void kafkaConsumer(ConsumerRecord<?, String> record, Acknowledgment ack) {
// Optional<?> message = Optional.ofNullable(record.value());
// if (message.isPresent()) {
// try {
//// JSONObject messageObj = JSONObject.fromObject(record.value());
//// JSONObject data = messageObj.getJSONObject("body");
//// JSONObject object = JSONObject.fromObject(record.value());
//// String json = ClassToJsonUtil.class2json(object, commonMessage, MQTT_TOPIC_EVENT_ALARM);
//// emqKeeper.getMqttClient().publish(MQTT_TOPIC_EVENT_ALARM, json.getBytes(StandardCharsets.UTF_8), 0, false);
//
// JSONObject object = JSONObject.fromObject(record.value());
// com.alibaba.fastjson.JSONObject jsonObj = ClassToJsonUtil.class2json(object, commonMessage, record.topic());
// emqKeeper.getMqttClient().publish(String.valueOf(jsonObj.get("mqTopic")), JSON.toJSONString(jsonObj).getBytes("UTF-8"), 0, false);
// ack.acknowledge();
// } catch (MqttException e) {
// log.error("解析数据失败,{}", e.getMessage());
// } catch (UnsupportedEncodingException e) {
// e.printStackTrace();
// }
// }
// }
//
// /**
// * 事件告警对接Kafka
// * @param record record
// * @param ack ack
// * groupId = kafkaConsumerGroup
// * 该消息的消息格式为
// * {"data_class":"realdata","data_type":"alarm","op_type":"subscribe_emergency","condition":{"station_psr_id":"50edcb6c1b8a811030493c80a2014950ed9d4f59e8","station_name":"中州换流站","alarm_type":"yx_bw"},"data":[{"psrId":"D017020000000000000000999","astId":"D017020000000000000000999","equipType":"ASTType_0000111","eventType":"OtherSignal","alarmSource":"OWS","alarmLevel":"3","description":"2024-03-11 09:06:17::585 S2WCL12A E3.C01软水器再生结束信号 出现","dateTime":"2024-03-11 09:06:17.585"}]}
// */
//
// @KafkaListener(id = "kafkaConsumerEventAlarm", groupId = "kafkaConsumerGroupEventAlarm", topics = "#{'${queue.kafka.eventAlarm.topics}'.split(',')}", containerFactory = "kafkaRomaContainerFactory")
// public void kafkaConsumerEventAlarm(ConsumerRecord<?, String> record, Acknowledgment ack) {
// Optional<?> message = Optional.ofNullable(record.value());
// if (message.isPresent()) {
// try {
//// JSONObject messageObj = JSONObject.fromObject(record.value());
//// JSONArray dataArray = messageObj.getJSONArray("data");
//// JSONArray jsonArray = new JSONArray();
//// String timestamp = "";
//// for (Object obj : dataArray) {
//// JSONObject finallyObj = new JSONObject();
//// com.alibaba.fastjson.JSONObject detail = com.alibaba.fastjson.JSONObject.parseObject(com.alibaba.fastjson.JSONObject.toJSONString(obj));
//// finallyObj.put("eventtextL1", detail.get("description"));
//// finallyObj.put("pointId", detail.get("astId"));
//// finallyObj.put("time", detail.get("dateTime"));
//// jsonArray.add(finallyObj);
//// timestamp = detail.get("dateTime").toString();
//// }
//// JSONObject jsonObjectMessage = new JSONObject();
//// jsonObjectMessage.put("warns", jsonArray);
//// jsonObjectMessage.put("timestamp", timestamp);
//
// JSONObject object = JSONObject.fromObject(record.value());
// com.alibaba.fastjson.JSONObject jsonObj = ClassToJsonUtil.class2json(object, commonMessage, record.topic());
// emqKeeper.getMqttClient().publish(String.valueOf(jsonObj.get("mqTopic")), JSON.toJSONString(jsonObj).getBytes("UTF-8"), 0, false);
// ack.acknowledge();
// } catch (MqttException e) {
// log.error("解析数据失败,{}", e.getMessage());
// } catch (UnsupportedEncodingException e) {
// e.printStackTrace();
// }
// }
// }
/** /**
......
...@@ -111,3 +111,6 @@ system.zxj=false ...@@ -111,3 +111,6 @@ system.zxj=false
queue.kafka.topics=null queue.kafka.topics=null
kafka.auto-startup=false kafka.auto-startup=false
#浜嬩欢鍛婅瀵规帴Kafka涓婚
queue.kafka.eventAlarm.topics=JKXT2BP-GJ-Topic-site
[ [
{ {
"kafkaTopic": "k1", "kafkaTopic": "T_DC_MQ_REALDATA",
"mqTopic": "romaSite/data/transmit", "mqTopic": "romaSite/data/transmit",
"data": { "data": {
"dataType": "condition.station_psr_id", "dataType": "body.datatype",
"value": "condition.station_psr_id", "value": "body.value",
"timeStamp": "condition.station_psr_id", "timeStamp": "body.time_stamp",
"quality": "condition.station_psr_id", "quality": "body.quality",
"scadaId": "condition.station_psr_id", "scadaId": "body.key",
"key": "condition.station_psr_id", "key": "body.key",
"disCreate": "condition.station_psr_id", "disCreate": "body.station_psr_id",
"name": "condition.station_psr_id" "name": "body.name"
} }
}, },
{ {
"kafkaTopic": "k2", "kafkaTopic": "T_DC_MQ_ALARM",
"mqTopic": "romaSite/data/eventAlarm", "mqTopic": "romaSite/data/eventAlarm",
"data": { "data": {
"timeStamp": "body.warns.time", "timeStamp": "body.warns.time",
"warns": [ "warns": [
{ {
"eventTextL1": "body.warns.systemid",
"pointId": "body.warns.pointId", "pointId": "body.warns.pointId",
"time": "body.warns.type", "time": "body.warns.time",
"deviceId": "deviceId", "deviceId": "body.warns.deviceId",
"eventstatus": "body.warns.content" "eventstatus": "body.warns.eventstatus"
} }
] ]
} }
......
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