Commit 42a8d0e7 authored by maoying's avatar maoying

解决冲突

parents 626a194c 53786e66
package com.yeejoin.equipmanage.common.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yeejoin.equipmanage.common.entity.publics.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.Date;
@Data
@TableName("wl_equip_qrcode_record")
@ApiModel(value = "装备二维码报警及消除记录", description = "装备二维码报警及消除记录")
public class EquipQrcodeRecord extends BaseEntity {
@ApiModelProperty(value = "设备id")
@TableField("equip_id")
private Long equipid;
@ApiModelProperty(value = "消除时间")
@TableField("clean_time")
private Date cleanTime;
@ApiModelProperty(value = "告警时间")
@TableField("alarm_time")
private Date alarmTime;
@ApiModelProperty(value = "来源")
@TableField("source")
private String source;
@ApiModelProperty(value = "来源id alarm表或p_check_input")
@TableField("source_id")
private Long sourceId;
@ApiModelProperty(value = "状态(0:绿码,1:黄码,2:红码)")
@TableField("status")
private String status;
@ApiModelProperty(value = "状态(0:绿码,1:黄码,2:红码)")
@TableField("biz_org_code")
private String bizOrgCode;
@ApiModelProperty(value = "状态(0:绿码,1:黄码,2:红码)")
@TableField("biz_org_name")
private String bizOrgName;
@ApiModelProperty(value = "状态(0:绿码,1:黄码,2:红码)")
@TableField("system_code")
private String systemCode;
}
package com.yeejoin.equipmanage.common.enums;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* @author
* @title: EquipQrcodeColorEnum
* <pre>
* @description: TODO
* </pre>
* @date 2020/12/12 14:23
*/
@Getter
@AllArgsConstructor
public enum DynamicLabelEnum {
NAME("name","名称"),
CODE("code","编码"),
POSITION("position","存放位置"),
MANUFACTURER("manufacturer","供应商"),
SYSTEM("systemName","所属系统"),
QRCODE("qrCode", "二维码"),
ALARMCONTENT("alarmContent","告警内容"),
ALARMDATE("alarmDate","告警时间");
private String code;
private String describe;
public static DynamicLabelEnum getEnumByKey(String key) {
DynamicLabelEnum colorEnum = null;
for (DynamicLabelEnum u : DynamicLabelEnum.values()) {
if (u.getCode().equals(key)) {
colorEnum = u;
break;
}
}
return colorEnum;
}
}
package com.yeejoin.equipmanage.common.enums;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.Getter;
/**
* @author
* @title: EquipQrcodeColorEnum
* <pre>
* @description: TODO
* </pre>
* @date 2020/12/12 14:23
*/
@Getter
@AllArgsConstructor
public enum EquipQrcodeColorEnum {
GREEN("0","绿色", "#00E12E"),
YELLOW("1","黄色", "#FFA500"),
RED("2","红色", "#EF2805");
private String code;
private String describe;
private String color;
public static EquipQrcodeColorEnum getEnumByKey(String key) {
EquipQrcodeColorEnum colorEnum = null;
for (EquipQrcodeColorEnum u : EquipQrcodeColorEnum.values()) {
if (u.getCode().equals(key)) {
colorEnum = u;
break;
}
}
return colorEnum;
}
}
package com.yeejoin.equipmanage.common.vo;
import lombok.Data;
import java.util.List;
/**
* @author keyong
* @title: RiskBizInfoVo
* <pre>
* @description: TODO
* </pre>
* @date 2023/5/17 11:22
*/
@Data
public class RiskBizInfoVo {
private String warningObjectName;
private String warningObjectCode;
private String warningTime;
private String sourceAttribution;
private String sourceAttributionDesc;
private List<RiskDynamicDetailsVo> dynamicDetails;
}
package com.yeejoin.equipmanage.common.vo;
import lombok.Data;
/**
* @author keyong
* @title: RiskDataVo
* <pre>
* @description: TODO
* </pre>
* @date 2023/5/17 11:19
*/
@Data
public class RiskDataVo {
private String indexKey;
private String indexValue;
private String traceId;
private RiskBizInfoVo bizInfo;
}
package com.yeejoin.equipmanage.common.vo;
import lombok.Data;
import java.util.List;
/**
* @author keyong
* @title: RiskDynamicDetailsVo
* <pre>
* @description: TODO
* </pre>
* @date 2023/5/17 11:36
*/
@Data
public class RiskDynamicDetailsVo {
private String tabName;
private List<TableContentVo> tabContent;
}
package com.yeejoin.equipmanage.common.vo;
import lombok.Data;
import java.util.Date;
/**
* @author keyong
* @title: SendToMsgRiskAlarmInfoVo
* <pre>
* @description: TODO
* </pre>
* @date 2023/5/22 15:24
*/
@Data
public class SendToMsgRiskAlarmInfoVo {
private String key;
private String name;
private String value;
private String alarmContent;
private Date alarmDate;
}
package com.yeejoin.equipmanage.common.vo;
import lombok.Data;
/**
* @author keyong
* @title: SendToMsgRiskDetailVo
* <pre>
* @description: TODO
* </pre>
* @date 2023/5/22 15:16
*/
@Data
public class SendToMsgRiskDetailVo {
private SendToMsgRiskEquipInfoVo equipInfo;
private SendToMsgRiskAlarmInfoVo alarmInfo;
}
package com.yeejoin.equipmanage.common.vo;
import lombok.Data;
/**
* @author keyong
* @title: SendToMsgRiskEquipInfoVo
* <pre>
* @description: TODO
* </pre>
* @date 2023/5/22 15:21
*/
@Data
public class SendToMsgRiskEquipInfoVo {
private String id;
// 装备名称
private String name;
// 装备编码
private String code;
private String bizOrgName;
private String bizOrgCode;
private String traceId;
private String equipSpeId;
// 指标告警状态
private Boolean reportIsAlarm = false;
// 存放位置
private String position;
private String systemName;
private String systemIds;
private String manufacturerName;
private String qrCode;
private String codeColor;
private String batchNo;
}
package com.yeejoin.equipmanage.common.vo;
import lombok.Data;
/**
* @author keyong
* @title: TableContentVo
* <pre>
* @description: TODO
* </pre>
* @date 2023/5/17 11:20
*/
@Data
public class TableContentVo {
private String key;
private String label;
private Object value;
private String type;
}
...@@ -21,6 +21,8 @@ public class TopicEntityVo { ...@@ -21,6 +21,8 @@ public class TopicEntityVo {
private String message; private String message;
private String data;
private String type; private String type;
// 若是车辆返回车牌号 // 若是车辆返回车牌号
......
...@@ -58,6 +58,11 @@ public class EquipmentIotMqttReceiveConfig { ...@@ -58,6 +58,11 @@ public class EquipmentIotMqttReceiveConfig {
@Value("${spring.mqtt.completionTimeout}") @Value("${spring.mqtt.completionTimeout}")
private int completionTimeout; private int completionTimeout;
@Value("${equip.center.risk.topic}")
private String riskMsgCenterEquipTopic;
@Value("${patrol.center.risk.topic}")
private String riskMsgCenterPatrolTopic;
private EquipmentSpecificMapper equipmentSpecificMapper; private EquipmentSpecificMapper equipmentSpecificMapper;
...@@ -121,11 +126,13 @@ public class EquipmentIotMqttReceiveConfig { ...@@ -121,11 +126,13 @@ public class EquipmentIotMqttReceiveConfig {
if (equipAndCars.size() <= 0) { if (equipAndCars.size() <= 0) {
list.add(defaultTopic); list.add(defaultTopic);
} }
list.addAll(ConfigPageTopicEnum.getEnumTopicList()); //大屏数据推送接口订阅 list.addAll(ConfigPageTopicEnum.getEnumTopicList()); // 大屏数据推送接口订阅
list.add("+/+/property"); // 添加iot車輛裝備數據上報事件监听 list.add("+/+/property"); // 添加iot车辆装备数据上报事件监听
list.add("+/+/event"); // 添加iot事件监听 list.add("+/+/event"); // 添加iot事件监听
list.add("+/+/transmit"); // 添加交换站事件监听 list.add("+/+/transmit"); // 添加交换站事件监听
list.add("+/+/perspective"); // 添加交换站事件监听 list.add("+/+/perspective"); // 添加交换站事件监听
list.add(riskMsgCenterEquipTopic);
list.add(riskMsgCenterPatrolTopic);
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);
...@@ -153,6 +160,8 @@ public class EquipmentIotMqttReceiveConfig { ...@@ -153,6 +160,8 @@ public class EquipmentIotMqttReceiveConfig {
mqttReceiveService.handlerMqttRomaMessage(topic,msg); mqttReceiveService.handlerMqttRomaMessage(topic,msg);
}else if (dataType.equals("perspective") && StringUtil.isNotEmpty(msg)){ }else if (dataType.equals("perspective") && StringUtil.isNotEmpty(msg)){
mqttReceiveService.handlerMqttIotMessage(topic,msg); mqttReceiveService.handlerMqttIotMessage(topic,msg);
} else if (dataType.equals("trigger") && StringUtil.isNotEmpty(msg)) {
mqttReceiveService.handleDataToRiskModel(topic, msg);
} }
} }
}; };
......
...@@ -9,6 +9,7 @@ import com.yeejoin.equipmanage.service.IEmergencyService; ...@@ -9,6 +9,7 @@ import com.yeejoin.equipmanage.service.IEmergencyService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
import liquibase.pro.packaged.B;
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.util.ObjectUtils; import org.springframework.util.ObjectUtils;
...@@ -52,6 +53,19 @@ public class EmergencyController extends AbstractBaseController { ...@@ -52,6 +53,19 @@ public class EmergencyController extends AbstractBaseController {
return CommonResponseUtil.success(iEmergencyService.getSystemState(bizOrgCode)); return CommonResponseUtil.success(iEmergencyService.getSystemState(bizOrgCode));
} }
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation("系统告警统计")
@GetMapping(value = "/system/alarm")
public ResponseModel getSystemAlarmCount(@RequestParam(value = "status",required = false) String status,
@RequestParam(value = "current",required = false) int current,
@RequestParam(value = "size",required = false) int size,
@RequestParam(value = "bizOrgCode",required = false)String bizOrgCode) {
if (current > 0){
current = (current-1)*size;
}
return CommonResponseUtil.success(iEmergencyService.getSystemAlarmCount(status,current,size, bizOrgCode));
}
/** /**
* CAFS-消防水箱信息 * CAFS-消防水箱信息
*/ */
......
package com.yeejoin.equipmanage.controller; package com.yeejoin.equipmanage.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
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.bo.ReginParams;
import com.yeejoin.equipmanage.common.dto.EquipmentSpecificDto; import com.yeejoin.equipmanage.common.dto.EquipmentSpecificDto;
import com.yeejoin.equipmanage.common.entity.EquipQrcodeRecord;
import com.yeejoin.equipmanage.common.entity.EquipmentDetail; import com.yeejoin.equipmanage.common.entity.EquipmentDetail;
import com.yeejoin.equipmanage.common.entity.EquipmentSpecific; import com.yeejoin.equipmanage.common.entity.EquipmentSpecific;
import com.yeejoin.equipmanage.common.entity.dto.EquipmentSpecificDTO; import com.yeejoin.equipmanage.common.entity.dto.EquipmentSpecificDTO;
...@@ -12,11 +14,13 @@ import com.yeejoin.equipmanage.common.entity.vo.ComplementCodeVO; ...@@ -12,11 +14,13 @@ import com.yeejoin.equipmanage.common.entity.vo.ComplementCodeVO;
import com.yeejoin.equipmanage.common.entity.vo.EquiplistSpecificBySystemVO; import com.yeejoin.equipmanage.common.entity.vo.EquiplistSpecificBySystemVO;
import com.yeejoin.equipmanage.common.entity.vo.IotIndexInfoVo; import com.yeejoin.equipmanage.common.entity.vo.IotIndexInfoVo;
import com.yeejoin.equipmanage.common.entity.vo.SourceNameByEquipSpeIdVO; import com.yeejoin.equipmanage.common.entity.vo.SourceNameByEquipSpeIdVO;
import com.yeejoin.equipmanage.common.enums.EquipQrcodeColorEnum;
import com.yeejoin.equipmanage.common.utils.CommonResponseUtil; import com.yeejoin.equipmanage.common.utils.CommonResponseUtil;
import com.yeejoin.equipmanage.common.utils.StringUtil; import com.yeejoin.equipmanage.common.utils.StringUtil;
import com.yeejoin.equipmanage.common.vo.EquipmentOnCarVo; import com.yeejoin.equipmanage.common.vo.EquipmentOnCarVo;
import com.yeejoin.equipmanage.common.vo.VideoOnEquipmentSpecificVo; import com.yeejoin.equipmanage.common.vo.VideoOnEquipmentSpecificVo;
import com.yeejoin.equipmanage.fegin.IotFeign; import com.yeejoin.equipmanage.fegin.IotFeign;
import com.yeejoin.equipmanage.mapper.EquipQrcodeRecordMapper;
import com.yeejoin.equipmanage.mapper.EquipmentSpecificMapper; import com.yeejoin.equipmanage.mapper.EquipmentSpecificMapper;
import com.yeejoin.equipmanage.service.IEquipmentDetailService; import com.yeejoin.equipmanage.service.IEquipmentDetailService;
import com.yeejoin.equipmanage.service.IEquipmentSpecificSerivce; import com.yeejoin.equipmanage.service.IEquipmentSpecificSerivce;
...@@ -56,6 +60,9 @@ public class EquipmentSpecificController extends AbstractBaseController { ...@@ -56,6 +60,9 @@ public class EquipmentSpecificController extends AbstractBaseController {
EquipmentSpecificMapper equipmentSpecificMapper; EquipmentSpecificMapper equipmentSpecificMapper;
@Autowired @Autowired
EquipQrcodeRecordMapper equipQrcodeRecordMapper;
@Autowired
IEquipmentDetailService equipmentDetailService; IEquipmentDetailService equipmentDetailService;
@Value("${systemctl.sync.switch}") @Value("${systemctl.sync.switch}")
...@@ -91,6 +98,7 @@ public class EquipmentSpecificController extends AbstractBaseController { ...@@ -91,6 +98,7 @@ public class EquipmentSpecificController extends AbstractBaseController {
return equipmentSpecificSerivce.getSourceNameByEquipSpeId(id); return equipmentSpecificSerivce.getSourceNameByEquipSpeId(id);
} }
/** /**
* 通过id获取设备区域建筑等信息 * 通过id获取设备区域建筑等信息
* *
...@@ -405,6 +413,49 @@ public class EquipmentSpecificController extends AbstractBaseController { ...@@ -405,6 +413,49 @@ public class EquipmentSpecificController extends AbstractBaseController {
return CommonResponseUtil.success(equipmentSpecificSerivce.getFireAutoSysInfo(startDate, endDate)); return CommonResponseUtil.success(equipmentSpecificSerivce.getFireAutoSysInfo(startDate, endDate));
} }
@GetMapping(value = "/status/equip")
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "修改装备二维码状态", notes = "修改装备二维码状态")
public ResponseModel updateEquipSpecificStatus( String status, String id,String sourceId,String source){
EquipmentSpecific spec = equipmentSpecificSerivce.getBaseMapper().selectById(id);
int oldStatus = Integer.valueOf(spec.getEquipStatus());
int newStatus = Integer.valueOf(status);
if (oldStatus >= newStatus){
//保存 wl_equip_qrcode_record 二维码记录
EquipQrcodeRecord equipQrcodeRecord = new EquipQrcodeRecord();
equipQrcodeRecord.setEquipid(Long.valueOf(id));
equipQrcodeRecord.setSource(source);
equipQrcodeRecord.setAlarmTime(new Date());
equipQrcodeRecord.setStatus(status);
equipQrcodeRecord.setSourceId(Long.valueOf(sourceId));
equipQrcodeRecord.setBizOrgCode(spec.getBizOrgCode());
equipQrcodeRecord.setBizOrgName(spec.getBizOrgName());
equipQrcodeRecord.setSystemCode(spec.getSystemId());
equipQrcodeRecordMapper.insert(equipQrcodeRecord);
}else {
equipmentSpecificSerivce.updateEquipSpecificStatus(status, id);
}
return CommonResponseUtil.success();
}
@GetMapping(value = "/status/checkInput")
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "idx修改巡检项对应装备二维码状态", notes = "idx修改巡检项对应装备二维码状态")
public ResponseModel updateEquipSpecificStatusByCheckInput( String id){
//查询 巡检项所绑定装备
String equipId = equipmentSpecificSerivce.updateEquipSpecificStatusByCheckInput(id);
LambdaQueryWrapper<EquipQrcodeRecord> query = new LambdaQueryWrapper<>();
query.eq(EquipQrcodeRecord::getEquipid,equipId);
query.isNull(EquipQrcodeRecord::getCleanTime);
List<EquipQrcodeRecord> equipQrcodeRecords = equipQrcodeRecordMapper.selectList(query);
if (equipQrcodeRecords.size() == 0) { //如果记录表中此装备无未消除的故障等 则恢复绿码
//修改装备二维码状态为合格 此处为0代表绿色 是idx只有在合格是才会触发此接口
equipmentSpecificSerivce.updateEquipSpecificStatus("0", equipId);
}
return CommonResponseUtil.success();
}
@GetMapping(value = "/info/paomo") @GetMapping(value = "/info/paomo")
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "查询泡沫系统指标", notes = "查询泡沫系统指标") @ApiOperation(httpMethod = "GET", value = "查询泡沫系统指标", notes = "查询泡沫系统指标")
......
...@@ -274,12 +274,12 @@ public class SupervisionConfigureController extends AbstractBaseController { ...@@ -274,12 +274,12 @@ public class SupervisionConfigureController extends AbstractBaseController {
@RequestMapping(value = "/alarmTrend", method = RequestMethod.GET) @RequestMapping(value = "/alarmTrend", method = RequestMethod.GET)
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "报警类型趋势", produces = "application/json;charset=UTF-8", notes = "报警类型趋势") @ApiOperation(httpMethod = "GET", value = "报警类型趋势", produces = "application/json;charset=UTF-8", notes = "报警类型趋势")
public ResponseModel alarmTrend(@RequestParam(required = false) String bizOrgCode) { public ResponseModel alarmTrend(@RequestParam(required = false) String bizOrgCode, @RequestParam(required = false) String companyCode) {
if (StringUtils.isEmpty(bizOrgCode)) { if (StringUtils.isEmpty(bizOrgCode)) {
ReginParams reginParams = getSelectedOrgInfo(); ReginParams reginParams = getSelectedOrgInfo();
bizOrgCode = !ValidationUtil.isEmpty(reginParams.getPersonIdentity()) && StringUtil.isNotEmpty(reginParams.getPersonIdentity().getBizOrgCode()) ? reginParams.getPersonIdentity().getBizOrgCode() : null; bizOrgCode = !ValidationUtil.isEmpty(reginParams.getPersonIdentity()) && StringUtil.isNotEmpty(reginParams.getPersonIdentity().getBizOrgCode()) ? reginParams.getPersonIdentity().getBizOrgCode() : null;
} }
return CommonResponseUtil.success(equipmentSpecificAlarmService.alarmTrend(bizOrgCode)); return CommonResponseUtil.success(equipmentSpecificAlarmService.alarmTrend(bizOrgCode, companyCode));
} }
@PersonIdentify @PersonIdentify
......
...@@ -14,7 +14,8 @@ import java.util.Map; ...@@ -14,7 +14,8 @@ import java.util.Map;
/** /**
* @author DELL * @author DELL
*/ */
@FeignClient(name = "${iot.vehicle.track}", path = "iot", configuration = {FeignConfiguration.class}) //@FeignClient(name = "${iot.vehicle.track}", path = "iot", configuration = {FeignConfiguration.class})
@FeignClient(name = "AMOS-API-IOT", path = "iot", configuration = { FeignConfiguration.class })
public interface IotFeign { public interface IotFeign {
@RequestMapping(value = "/v1/livedata/list", method = RequestMethod.GET, consumes = "application/json") @RequestMapping(value = "/v1/livedata/list", method = RequestMethod.GET, consumes = "application/json")
......
package com.yeejoin.equipmanage.listener;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yeejoin.equipmanage.common.entity.Car;
import com.yeejoin.equipmanage.common.entity.WlCarMileage;
import com.yeejoin.equipmanage.common.utils.CoordinateUtil;
import com.yeejoin.equipmanage.fegin.IotFeign;
import com.yeejoin.equipmanage.service.ICarService;
import com.yeejoin.equipmanage.service.IWlCarMileageService;
import com.yeejoin.equipmanage.service.impl.WlCarMileageServiceImpl;
import com.yeejoin.equipmanage.thread.ThreadCar;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.eclipse.paho.client.mqttv3.MqttMessage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import org.typroject.tyboot.component.emq.EmqKeeper;
import org.typroject.tyboot.component.emq.EmqxListener;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigDecimal;
import java.net.HttpURLConnection;
import java.net.URL;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
@Component
public class CarIotNewListener extends EmqxListener {
@Autowired
private IWlCarMileageService iWlCarMileageService;
@Autowired
private ICarService iCarService;
@Autowired
private IotFeign iotFeign;
@Value("${mileage.clippingtime}")
private Long clipping_time;
private final String GUIDE_KEY = "813684495d9a3981dd2c7694916fe404";
private final String GUIDE_URL = "https://restapi.amap.com/v3/geocode/regeo?";
@Autowired
private EmqKeeper emqkeeper;
private static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
// 用于根据topicId 也就是物联设备id 存储对应的线程来进行计时
private static HashMap<String, ThreadCar> deviceInfo = new HashMap();
private static HashMap<String, String> deviceLastInfo = new HashMap();
@Override
public void processMessage(String topic, MqttMessage message) throws Exception {
System.out.println(topic);
System.out.println(message);
String measurement = topic.split("/")[0];
String deviceName = topic.split("/")[1];
String iotCode = measurement + deviceName;
JSONObject jsonObject = JSONObject.parseObject(message.toString());
if (jsonObject.containsKey("FireCar_Longitude")) {
this.updateCarLocation(jsonObject,iotCode);
//如果map中已经存在该设备或者该设备有但是线程已经执行了
if ((!deviceInfo.containsKey(iotCode)) || (deviceInfo.containsKey(iotCode) && deviceInfo.get(iotCode) == null)) {
ThreadCar threadCar = new ThreadCar(iotCode, jsonObject, this.iWlCarMileageService, this.iotFeign, this.iCarService, this.emqkeeper, clipping_time);
deviceInfo.put(iotCode, threadCar);
threadCar.start();
}
String coordinate = jsonObject.getDoubleValue("FireCar_Longitude") + String.valueOf(jsonObject.getDoubleValue("FireCar_Latitude"));
if (!deviceLastInfo.containsKey(iotCode)) {
deviceLastInfo.put(iotCode, coordinate);
}
Long currentTime = new Date().getTime();
Long endTime = jsonObject.getLong("time");
// if ((startTime - endTime) <= 600000) {
if (((currentTime - endTime) <= clipping_time) && (!deviceLastInfo.get(iotCode).equals(coordinate))) {
try {
deviceInfo.get(iotCode).interrupt();
} catch (Exception e) {
}
ThreadCar threadCar = new ThreadCar(iotCode, jsonObject, this.iWlCarMileageService, this.iotFeign, this.iCarService, this.emqkeeper, clipping_time);
deviceInfo.put(iotCode, threadCar);
//更新车辆的最新坐标数据
deviceLastInfo.put(iotCode, coordinate);
threadCar.start();
}
if (iWlCarMileageService.getUncompleteMileagByIotCode(iotCode)) {
WlCarMileage wlCarMileage = new WlCarMileage();
wlCarMileage.setIotCode(iotCode);
wlCarMileage.setDate(new Date());
// 获取开始坐标
double startLongitude = jsonObject.getDoubleValue("FireCar_Longitude");
double startLatitude = jsonObject.getDoubleValue("FireCar_Latitude");
// String currentTime = "20"+jsonObject.getString("currentTime");
wlCarMileage.setStartLongitude(startLongitude);
wlCarMileage.setStartLatitude(startLatitude);
// Date startTime = UTCToCST();
Date startTime = new Date(jsonObject.getLong("time"));
wlCarMileage.setStartTime(startTime);
wlCarMileage.setStartName(getAddress(startLongitude, startLatitude));
wlCarMileage.setStartSpeed(Double.valueOf(jsonObject.getDoubleValue("FireCar_Speed")).intValue());
try {
iWlCarMileageService.save(wlCarMileage);
} catch (Exception e) {
e.printStackTrace();
iWlCarMileageService.save(wlCarMileage);
}
}
}
}
public String getAddress(double longitude, double lantitude) {
StringBuilder api = new StringBuilder(GUIDE_URL);
api.append("key=").append(GUIDE_KEY).append("&location=").append(longitude).append(",").append(lantitude).append("&radius=1000").append("&batch=false").append("&extensions=base").append("&roadlevel=0").append("&batch=false");
StringBuilder res = new StringBuilder();
BufferedReader in = null;
try {
System.out.println(api.toString());
URL url = new URL(api.toString());
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setDoOutput(true);
conn.setRequestMethod("POST");
in = new BufferedReader(new InputStreamReader(conn.getInputStream(), "UTF-8"));
String line;
while ((line = in.readLine()) != null) {
res.append(line).append("\n");
}
JSONObject object = JSONObject.parseObject(res.toString());
System.out.println(object);
JSONObject regeocode = object.getJSONObject("regeocode");
String address = regeocode.getString("formatted_address");
if ("[]".equals(address)) {
System.out.println("===============无效坐标:" + longitude + "," + lantitude);
address = "无效坐标";
}
res = new StringBuilder(address);
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
if (in != null) {
in.close();
}
} catch (IOException e) {
e.printStackTrace();
}
}
return res.toString();
}
public Date UTCToCST(String UTCStr) throws ParseException {
Date date = sdf.parse(UTCStr);
System.out.println("UTC时间: " + date);
Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.set(Calendar.HOUR, calendar.get(Calendar.HOUR) + 8);
return calendar.getTime();
}
public void updateCarLocation(JSONObject jsonObject, String iotCode) {
if (jsonObject.containsKey("FireCar_Longitude") && jsonObject.containsKey("FireCar_Latitude")) {
// 获取开始坐标
double startLongitude = jsonObject.getDoubleValue("FireCar_Longitude");
double startLatitude = jsonObject.getDoubleValue("FireCar_Latitude");
int direction = jsonObject.getIntValue("direction");
// 地图推送消息
Car car = iCarService.getOne(new LambdaQueryWrapper<Car>().eq(Car::getIotCode, iotCode));
if (car != null && startLongitude != 0 && startLatitude != 0) {
JSONArray sendArr = new JSONArray();
JSONObject sendObj = new JSONObject();
sendObj.put("id", String.valueOf(car.getId()));
sendObj.put("direction", direction);
sendObj.put("longitude", String.valueOf(startLongitude));
sendObj.put("latitude", String.valueOf(startLatitude));
sendObj.put("carNum", car.getCarNum());
sendObj.put("bizOrgName", car.getBizOrgName());
sendArr.add(sendObj);
MqttMessage mqttMessage = new MqttMessage();
mqttMessage.setPayload(sendArr.toJSONString().getBytes());
car.setLongitude(startLongitude);
car.setLatitude(startLatitude);
iCarService.updateById(car);
System.out.println("-----------推送车辆位置消息到到地图成功--------");
try {
emqkeeper.getMqttClient().publish("car/location", mqttMessage);
} catch (MqttException e) {
throw new RuntimeException(e);
}
}
}
}
}
...@@ -59,6 +59,9 @@ public interface EmergencyMapper extends BaseMapper{ ...@@ -59,6 +59,9 @@ public interface EmergencyMapper extends BaseMapper{
List<Map<String, Object>> getSystemState(@Param("bizOrgCode") String bizOrgCode); List<Map<String, Object>> getSystemState(@Param("bizOrgCode") String bizOrgCode);
Map<String, Object> getSystemAlarmTheCount(@Param("status") String status,@Param("bizOrgCode") String bizOrgCode);
List<Map<String, Object>> getSystemAlarmCount(@Param("status") String status,@Param("current") int current,@Param("size") int size,@Param("bizOrgCode") String bizOrgCode);
List<Map<String, Object>> getCAFSWaterTankInfo(); List<Map<String, Object>> getCAFSWaterTankInfo();
List<Map<String, Object>> selectAlarmAnalysis(@Param("startDate")String startDate, @Param("endDate")String endDate, @Param("dataType")String dataType, @Param("date")String date, @Param("list") List<String> codes); List<Map<String, Object>> selectAlarmAnalysis(@Param("startDate")String startDate, @Param("endDate")String endDate, @Param("dataType")String dataType, @Param("date")String date, @Param("list") List<String> codes);
......
package com.yeejoin.equipmanage.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.equipmanage.common.entity.EquipQrcodeRecord;
public interface EquipQrcodeRecordMapper extends BaseMapper<EquipQrcodeRecord> {
}
...@@ -264,4 +264,8 @@ public interface EquipmentSpecificMapper extends BaseMapper<EquipmentSpecific> { ...@@ -264,4 +264,8 @@ public interface EquipmentSpecificMapper extends BaseMapper<EquipmentSpecific> {
EquipmentSpecific getEquipSpecificEntityByCode(@Param("code") String code); EquipmentSpecific getEquipSpecificEntityByCode(@Param("code") String code);
void updateEquipSpecificStatus(String status,String id);
String updateEquipSpecificStatusByCheckInput(String id);
} }
...@@ -17,6 +17,7 @@ public interface IEmergencyService { ...@@ -17,6 +17,7 @@ public interface IEmergencyService {
* @return * @return
*/ */
List<Map<String, Object>> getSystemState(String bizOrgCode); List<Map<String, Object>> getSystemState(String bizOrgCode);
Map<String, Object> getSystemAlarmCount(String status, int current, int size,String bizOrgCode);
/** /**
* @return * @return
......
...@@ -100,7 +100,7 @@ public interface IEquipmentSpecificAlarmService extends IService<EquipmentSpecif ...@@ -100,7 +100,7 @@ public interface IEquipmentSpecificAlarmService extends IService<EquipmentSpecif
Page<Map<String, Object>> dcFireAlarmLogPage(CommonPageInfoParam param); Page<Map<String, Object>> dcFireAlarmLogPage(CommonPageInfoParam param);
List<Map<String, Object>> stationInfo(); List<Map<String, Object>> stationInfo();
List<Map<String, Object>> alarmTrend(String bizOrgCode); List<Map<String, Object>> alarmTrend(String bizOrgCode, String companyCode);
List<Map<String, Object>> allList(CommonPageInfoParam param); List<Map<String, Object>> allList(CommonPageInfoParam param);
......
...@@ -285,4 +285,7 @@ public interface IEquipmentSpecificSerivce extends IService<EquipmentSpecific> { ...@@ -285,4 +285,7 @@ public interface IEquipmentSpecificSerivce extends IService<EquipmentSpecific> {
Map<String,Object> getStationCode(Long id); Map<String,Object> getStationCode(Long id);
void updateEquipSpecificStatus(String status, String id);
String updateEquipSpecificStatusByCheckInput( String id);
} }
...@@ -30,6 +30,7 @@ public interface IWlCarMileageService extends IService<WlCarMileage> { ...@@ -30,6 +30,7 @@ public interface IWlCarMileageService extends IService<WlCarMileage> {
* 里程切分(0点若里程未结束,自动切分设置结束信息,并开始新里程) * 里程切分(0点若里程未结束,自动切分设置结束信息,并开始新里程)
*/ */
void mileageSegmentation(); void mileageSegmentation();
//根据iot编码查询是否有未结束里程
Boolean getUncompleteMileagByIotCode(String iotCode);
} }
...@@ -31,4 +31,10 @@ public interface MqttReceiveService { ...@@ -31,4 +31,10 @@ public interface MqttReceiveService {
* @param message 消息内容 * @param message 消息内容
*/ */
void handlerMqttIotMessage(String topic, String message); void handlerMqttIotMessage(String topic, String message);
/**
* 中心级接收消息发送至消息服务
* @param topic
* @param message
*/
void handleDataToRiskModel(String topic, String message);
} }
...@@ -1767,7 +1767,7 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i ...@@ -1767,7 +1767,7 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i
collect.forEach(item -> { collect.forEach(item -> {
HashMap<String, Object> buildingData = new HashMap<>(); HashMap<String, Object> buildingData = new HashMap<>();
// 建筑默认父级id 为顶级id // 建筑默认父级id 为顶级id
buildingData.put("parentId", id); buildingData.put("parentId", 0);
// 建筑类型 // 建筑类型
String groupCode = null; String groupCode = null;
if (!ObjectUtils.isEmpty(item.getBuildingType())) { if (!ObjectUtils.isEmpty(item.getBuildingType())) {
......
...@@ -157,6 +157,7 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS ...@@ -157,6 +157,7 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS
private Boolean syncSwitch; private Boolean syncSwitch;
@Autowired @Autowired
@Lazy
private IWlCarMileageService iWlCarMileageService; private IWlCarMileageService iWlCarMileageService;
/** /**
......
...@@ -84,6 +84,27 @@ public class EmergencyServiceImpl implements IEmergencyService { ...@@ -84,6 +84,27 @@ public class EmergencyServiceImpl implements IEmergencyService {
return list; return list;
} }
@Override
public Map<String, Object> getSystemAlarmCount(String status, int current, int size, String bizOrgCode) {
Map<String, Object> resultMap = new HashMap<>();
Map<String, Object> map = emergencyMapper.getSystemAlarmTheCount(status, bizOrgCode);
resultMap.put("total", map.get("total"));
List<Map<String, Object>> list = emergencyMapper.getSystemAlarmCount(status,current,size,bizOrgCode);
if (0 < list.size()) {
list.forEach(x -> {
x.put("statis", x.get("status"));
if ("正常".equals(String.valueOf(x.get("status")))) {
x.put("level", "success");
} else {
x.put("level", "warning");
}
});
}
resultMap.put("records", list);
return resultMap;
}
@Override @Override
public List<Map<String, Object>> getCAFSWaterTankInfo() { public List<Map<String, Object>> getCAFSWaterTankInfo() {
List<Map<String, Object>> list = emergencyMapper.getCAFSWaterTankInfo(); List<Map<String, Object>> list = emergencyMapper.getCAFSWaterTankInfo();
......
...@@ -853,9 +853,17 @@ public class EquipmentSpecificAlarmServiceImpl extends ServiceImpl<EquipmentSpec ...@@ -853,9 +853,17 @@ public class EquipmentSpecificAlarmServiceImpl extends ServiceImpl<EquipmentSpec
} }
@Override @Override
public List<Map<String, Object>> alarmTrend(String bizOrgCode) { public List<Map<String, Object>> alarmTrend(String bizOrgCode, String companyCode) {
if (StringUtils.isNotEmpty(companyCode)) {
bizOrgCode = fireFightingSystemMapper.queryByCompanyCode(companyCode);
return this.baseMapper.alarmTrend(bizOrgCode); return this.baseMapper.alarmTrend(bizOrgCode);
} else if (StringUtils.isNotEmpty(bizOrgCode)) {
return this.baseMapper.alarmTrend(bizOrgCode);
} else {
return new ArrayList<>();
} }
}
@Override @Override
public List<Map<String, Object>> stationInfo() { public List<Map<String, Object>> stationInfo() {
return this.baseMapper.stationInfo(); return this.baseMapper.stationInfo();
......
...@@ -2095,4 +2095,14 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM ...@@ -2095,4 +2095,14 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
return equipmentSpecificMapper.getStationCode(id); return equipmentSpecificMapper.getStationCode(id);
} }
@Override
public void updateEquipSpecificStatus(String status, String id){
equipmentSpecificMapper.updateEquipSpecificStatus(status,id);
}
@Override
public String updateEquipSpecificStatusByCheckInput( String id){
return equipmentSpecificMapper.updateEquipSpecificStatusByCheckInput(id);
}
} }
...@@ -3,6 +3,7 @@ package com.yeejoin.equipmanage.service.impl; ...@@ -3,6 +3,7 @@ package com.yeejoin.equipmanage.service.impl;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
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.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
...@@ -20,6 +21,9 @@ import org.slf4j.Logger; ...@@ -20,6 +21,9 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
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.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.restful.utils.ResponseModel; import org.typroject.tyboot.core.restful.utils.ResponseModel;
...@@ -45,7 +49,10 @@ import java.util.*; ...@@ -45,7 +49,10 @@ import java.util.*;
* @author duanwei * @author duanwei
* @date 2023-02-01 * @date 2023-02-01
*/ */
@Service @Service
@EnableScheduling
@EnableAsync
public class WlCarMileageServiceImpl extends ServiceImpl<WlCarMileageMapper, WlCarMileage> public class WlCarMileageServiceImpl extends ServiceImpl<WlCarMileageMapper, WlCarMileage>
implements IWlCarMileageService { implements IWlCarMileageService {
...@@ -183,6 +190,10 @@ public class WlCarMileageServiceImpl extends ServiceImpl<WlCarMileageMapper, WlC ...@@ -183,6 +190,10 @@ public class WlCarMileageServiceImpl extends ServiceImpl<WlCarMileageMapper, WlC
} }
if (result != null) { if (result != null) {
Map<String, Object> jsonObject = (Map<String, Object>) JSONObject.parseObject(result); Map<String, Object> jsonObject = (Map<String, Object>) JSONObject.parseObject(result);
//判断是否坐标不满足高德地图纠偏需求
if(jsonObject.containsKey("errcode")&&jsonObject.get("errcode").toString().equals("30001")){
return list;
}
if (jsonObject.containsKey("data")) { if (jsonObject.containsKey("data")) {
JSONObject data3 = JSONObject.parseObject(jsonObject.get("data").toString()); JSONObject data3 = JSONObject.parseObject(jsonObject.get("data").toString());
JSONArray points1 = JSONArray.parseArray(data3.get("points").toString()); JSONArray points1 = JSONArray.parseArray(data3.get("points").toString());
...@@ -278,6 +289,7 @@ public class WlCarMileageServiceImpl extends ServiceImpl<WlCarMileageMapper, WlC ...@@ -278,6 +289,7 @@ public class WlCarMileageServiceImpl extends ServiceImpl<WlCarMileageMapper, WlC
@Override @Override
@Scheduled(cron = "${mileage.segmentation.cron}") @Scheduled(cron = "${mileage.segmentation.cron}")
@Async
public void mileageSegmentation() { public void mileageSegmentation() {
log.info("轨迹切分定时任务开始执行时间.............{}", LocalDateTime.now()); log.info("轨迹切分定时任务开始执行时间.............{}", LocalDateTime.now());
Calendar cal = Calendar.getInstance(); Calendar cal = Calendar.getInstance();
...@@ -373,6 +385,12 @@ public class WlCarMileageServiceImpl extends ServiceImpl<WlCarMileageMapper, WlC ...@@ -373,6 +385,12 @@ public class WlCarMileageServiceImpl extends ServiceImpl<WlCarMileageMapper, WlC
log.info("轨迹切分任务执行完成.............."); log.info("轨迹切分任务执行完成..............");
} }
@Override
public Boolean getUncompleteMileagByIotCode(String iotCode) {
Integer integer = this.count(new QueryWrapper<WlCarMileage>().select("1").lambda().eq(WlCarMileage::getIotCode,iotCode).isNull(WlCarMileage::getEndTime));
return integer <= 0 ;
}
private String getAddress(double longitude, double lantitude) { private String getAddress(double longitude, double lantitude) {
StringBuilder api = new StringBuilder(GUIDE_ADDRESS_URL); StringBuilder api = new StringBuilder(GUIDE_ADDRESS_URL);
......
package com.yeejoin.equipmanage.thread;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yeejoin.equipmanage.common.entity.Car;
import com.yeejoin.equipmanage.common.entity.WlCarMileage;
import com.yeejoin.equipmanage.common.utils.CoordinateUtil;
import com.yeejoin.equipmanage.fegin.IotFeign;
import com.yeejoin.equipmanage.service.ICarService;
import com.yeejoin.equipmanage.service.IWlCarMileageService;
import com.yeejoin.equipmanage.utils.CarUtils;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.eclipse.paho.client.mqttv3.MqttMessage;
import org.typroject.tyboot.component.emq.EmqKeeper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Timer;
import java.util.concurrent.TimeUnit;
public class ThreadCar extends Thread {
private IWlCarMileageService iWlCarMileageService;
private IotFeign iotFeign;
private String topic;
private Long clippingTime;
ICarService iCarService;
private EmqKeeper emqkeeper;
private JSONObject jsonObject;
public ThreadCar(String topic, JSONObject jsonObject, IWlCarMileageService iWlCarMileageService, IotFeign iotFeign, ICarService iCarService, EmqKeeper emqkeeper, Long clippingTime) {
this.topic = topic;
this.jsonObject = jsonObject;
this.iWlCarMileageService = iWlCarMileageService;
this.iotFeign = iotFeign;
this.iCarService = iCarService;
this.emqkeeper = emqkeeper;
this.clippingTime = clippingTime;
}
@Override
public void run() {
//toDo
// 获取最后一个有坐标的数据
JSONObject lastObj = null;
WlCarMileage last = null;
try {
this.sleep(clippingTime);
//业务处理
//如果十分钟没有坐标,则需要设置结束标记
// 获取结束坐标
String measurement = topic.split("/")[0];
String deviceName = topic.split("/")[1];
String iotCode = measurement + deviceName;
last = iWlCarMileageService
.getOne(new LambdaQueryWrapper<WlCarMileage>().eq(WlCarMileage::getIotCode, iotCode)
.isNull(WlCarMileage::getEndLongitude).isNull(WlCarMileage::getEndLatitude)
.orderByDesc(WlCarMileage::getStartTime).last("limit 1"));
ResponseModel<List<Object>> result = iotFeign.getLiveData(measurement, deviceName,
last.getStartTime(), new Date(new Date().getTime() + 2000));
List<Object> list = result.getResult();
if (list != null && list.size() > 0) {
// 过滤空坐标
List<Object> filterList = new ArrayList<Object>();
for (int i = 0; i < list.size(); i++) {
JSONObject Obj = JSONObject.parseObject(JSONObject.toJSONString(list.get(i)));
if (Obj.get("FireCar_Longitude") != null && Obj.get("FireCar_Latitude") != null
&& Obj.getDoubleValue("FireCar_Longitude") != 0
&& Obj.getDoubleValue("FireCar_Latitude") != 0) {
filterList.add(list.get(i));
// 获取第一个不为空的坐标
if (lastObj == null) {
lastObj = Obj;
}
}
}
// JSONObject lastObj =
// JSONObject.parseObject(JSONObject.toJSONString(list.get(list.size() - 1)));
if (lastObj == null) {
lastObj = new JSONObject();
lastObj.put("FireCar_Longitude", 0.0);
lastObj.put("FireCar_Latitude", 0.0);
lastObj.put("time", 0);
lastObj.put("FireCar_Speed", 0);
}
double endLongitude = lastObj.getDoubleValue("FireCar_Longitude");
double endLatitude = lastObj.getDoubleValue("FireCar_Latitude");
// 230215180624
// Date endTime =UTCToCST(lastObj.getString("time"));
Date endTime = new Date(jsonObject.getLong("time"));
long takeTime = (endTime.getTime() / 1000 * 1000) - (last.getStartTime().getTime() / 1000 * 1000);
last.setEndLongitude(endLongitude);
last.setEndLatitude(endLatitude);
last.setEndTime(endTime);
last.setEndName(CarUtils.getAddress(endLongitude, endLatitude));
last.setEndSpeed(lastObj.getIntValue("FireCar_Speed"));
last.setTakeTime(takeTime);
double travel = 0.0;
// 获取里程
for (int i = 0; i < filterList.size() - 1; i++) {
JSONObject start = JSONObject.parseObject(JSONObject.toJSONString(filterList.get(i)));
JSONObject end = JSONObject.parseObject(JSONObject.toJSONString(filterList.get(i + 1)));
travel += CoordinateUtil.distance(start.getDoubleValue("FireCar_Latitude"),
start.getDoubleValue("FireCar_Longitude"), end.getDoubleValue("FireCar_Latitude"),
end.getDoubleValue("FireCar_Longitude"));
}
last.setTravel(new BigDecimal(travel / 1000).setScale(1, BigDecimal.ROUND_HALF_UP).doubleValue());
iWlCarMileageService.updateById(last);
System.out.println("============================================================更新结束坐标成功==========:"+topic);
this.interrupt();
}
} catch (Exception exception) {
if (last != null) {
iWlCarMileageService.updateById(last);
}
}
}
}
package com.yeejoin.equipmanage.utils;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yeejoin.equipmanage.common.entity.Car;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.eclipse.paho.client.mqttv3.MqttMessage;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
public class CarUtils {
private static final String GUIDE_KEY = "813684495d9a3981dd2c7694916fe404";
private static final String GUIDE_URL = "https://restapi.amap.com/v3/geocode/regeo?";
public static String getAddress(double longitude, double lantitude) {
StringBuilder api = new StringBuilder(GUIDE_URL);
api.append("key=").append(GUIDE_KEY).append("&location=").append(longitude).append(",").append(lantitude)
.append("&radius=1000").append("&batch=false").append("&extensions=base").append("&roadlevel=0")
.append("&batch=false");
StringBuilder res = new StringBuilder();
BufferedReader in = null;
try {
System.out.println(api.toString());
URL url = new URL(api.toString());
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setDoOutput(true);
conn.setRequestMethod("POST");
in = new BufferedReader(new InputStreamReader(conn.getInputStream(), "UTF-8"));
String line;
while ((line = in.readLine()) != null) {
res.append(line).append("\n");
}
JSONObject object = JSONObject.parseObject(res.toString());
System.out.println(object);
JSONObject regeocode = object.getJSONObject("regeocode");
String address = regeocode.getString("formatted_address");
if ("[]".equals(address)) {
System.out.println("===============无效坐标:" + longitude + "," + lantitude);
address = "无效坐标";
}
res = new StringBuilder(address);
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
if (in != null) {
in.close();
}
} catch (IOException e) {
e.printStackTrace();
}
}
return res.toString();
}
}
...@@ -4,7 +4,10 @@ import com.alibaba.fastjson.JSON; ...@@ -4,7 +4,10 @@ import com.alibaba.fastjson.JSON;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams; import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel; import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.patrol.business.constants.XJConstant; import com.yeejoin.amos.patrol.business.constants.XJConstant;
import com.yeejoin.amos.patrol.business.dto.CheckDto; import com.yeejoin.amos.patrol.business.dao.mapper.CheckMapper;
import com.yeejoin.amos.patrol.business.dao.mapper.PointMapper;
import com.yeejoin.amos.patrol.business.dto.*;
import com.yeejoin.amos.patrol.business.feign.EquipFeign;
import com.yeejoin.amos.patrol.business.param.CheckInfoPageParam; import com.yeejoin.amos.patrol.business.param.CheckInfoPageParam;
import com.yeejoin.amos.patrol.business.param.CheckRecordParam; import com.yeejoin.amos.patrol.business.param.CheckRecordParam;
import com.yeejoin.amos.patrol.business.param.CheckStatisticalParam; import com.yeejoin.amos.patrol.business.param.CheckStatisticalParam;
...@@ -70,6 +73,9 @@ public class CheckController extends AbstractBaseController { ...@@ -70,6 +73,9 @@ public class CheckController extends AbstractBaseController {
private AsyncTask asyncTask; private AsyncTask asyncTask;
@Autowired @Autowired
private EquipFeign equipFeign;
@Autowired
private IPlanTaskService planTaskService; private IPlanTaskService planTaskService;
@Autowired @Autowired
...@@ -101,6 +107,18 @@ public class CheckController extends AbstractBaseController { ...@@ -101,6 +107,18 @@ public class CheckController extends AbstractBaseController {
@Autowired @Autowired
private WebMqttComponent webMqttComponent; private WebMqttComponent webMqttComponent;
@Value("${patrol.message.create.topic}")
private String patrolRiskCreateTopic;
@Value("${patrol.center.risk.topic}")
private String riskTopic;
@Autowired
private CheckMapper checkMapper;
@Autowired
PointMapper pointMapper;
/** /**
* *
* 巡查记录列表 * 巡查记录列表
...@@ -113,8 +131,10 @@ public class CheckController extends AbstractBaseController { ...@@ -113,8 +131,10 @@ public class CheckController extends AbstractBaseController {
@ApiParam(value = "查询条件", required = false) @RequestBody(required = false) CheckInfoPageParam param, @ApiParam(value = "查询条件", required = false) @RequestBody(required = false) CheckInfoPageParam param,
@ApiParam(value = "分页参数", required = true) CommonPageable commonPageable) { @ApiParam(value = "分页参数", required = true) CommonPageable commonPageable) {
ReginParams reginParams = getSelectedOrgInfo(); ReginParams reginParams = getSelectedOrgInfo();
param.setBizOrgCode(reginParams.getPersonIdentity().getBizOrgCode());
param.setOrderBy("checkDate desc"); param.setOrderBy("checkDate desc");
param.setBizOrgCode(ObjectUtils.isEmpty(param.getBizOrgCode()) ?
"3".equals(param.getIsOK()) ? null : reginParams.getPersonIdentity().getBizOrgCode()
: param.getBizOrgCode());
if(commonPageable !=null){ if(commonPageable !=null){
param.setPageNumber(commonPageable.getPageNumber()-1); param.setPageNumber(commonPageable.getPageNumber()-1);
param.setPageSize(commonPageable.getPageSize()); param.setPageSize(commonPageable.getPageSize());
...@@ -239,6 +259,9 @@ public class CheckController extends AbstractBaseController { ...@@ -239,6 +259,9 @@ public class CheckController extends AbstractBaseController {
}); });
} }
List<Map<String, Object>> checkInputItems = checkMapper.queryCheckInputItemsByCheckId(checkDto.getCheckId());
publishDataToMessage(checkInputItems);
is.pointCheckInfoPushToB(checkDto.getCheckId()); is.pointCheckInfoPushToB(checkDto.getCheckId());
//数字换流站页面刷新 //数字换流站页面刷新
try { try {
...@@ -259,8 +282,47 @@ public class CheckController extends AbstractBaseController { ...@@ -259,8 +282,47 @@ public class CheckController extends AbstractBaseController {
} }
} }
/**
* 巡检组装发送风险消息
* @param
*/
public void publishDataToMessage(List<Map<String, Object>> checkInputItems) {
for (Map<String, Object> map : checkInputItems) {
SendToMsgRiskDetailVo detailVo = new SendToMsgRiskDetailVo();
SendToMsgRiskEquipInfoVo equipInfoVo = new SendToMsgRiskEquipInfoVo();
SendToMsgRiskAlarmInfoVo alarmInfoVo = new SendToMsgRiskAlarmInfoVo();
if (map.containsKey("equipId") && !map.get("input_value").equals("合格") ){
equipFeign.updateEquipSpecificStatus("1",map.get("equipId").toString(),map.get("traceId").toString(),"patrol");
equipInfoVo.setEquipSpeId(String.valueOf(map.get("equipId")));
equipInfoVo.setReportIsAlarm(Boolean.TRUE);
}
equipInfoVo.setId(String.valueOf(map.get("id")));
equipInfoVo.setName(String.valueOf(map.get("inputItem")));
equipInfoVo.setValue(String.valueOf(map.get("input_value")));
equipInfoVo.setCode(String.valueOf(map.get("item_no")));
equipInfoVo.setBizOrgCode(String.valueOf(map.get("biz_org_code")));
equipInfoVo.setBizOrgName(String.valueOf(map.get("biz_org_name")));
if (map.containsKey("traceId")){
equipInfoVo.setTraceId(map.get("traceId").toString());
}
Map<String, Object> pointMap = pointMapper.getPointById(Long.valueOf(String.valueOf(map.get("pointId"))));
alarmInfoVo.setKey(String.valueOf(pointMap.get("id")));
alarmInfoVo.setName(String.valueOf(pointMap.get("pointName")));
alarmInfoVo.setValue(String.valueOf(pointMap.get("pointNo")));
TopicEntityVo topicEntityVo = new TopicEntityVo();
topicEntityVo.setTopic(riskTopic);
detailVo.setEquipInfo(equipInfoVo);
detailVo.setAlarmInfo(alarmInfoVo);
topicEntityVo.setData(JSON.toJSONString(detailVo));
try {
webMqttComponent.publish(patrolRiskCreateTopic, JSON.toJSONString(topicEntityVo));
} catch (Exception e) {
log.error("推送失败-----------" + e.getMessage());
}
}
}
/** /**
* 巡检计划查询 * 巡检计划查询
......
...@@ -83,6 +83,20 @@ public class SafetyPreCtrlController extends AbstractBaseController { ...@@ -83,6 +83,20 @@ public class SafetyPreCtrlController extends AbstractBaseController {
} }
@TycloudOperation(ApiLevel = UserType.AGENCY) @TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "巡检点统计", notes = "巡检点统计")
@RequestMapping(value = "/countPointData", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
public HashMap<String, Object> countPointData(@RequestParam(required = false) String bizOrgCode) {
Map<String,Object> List= pointService.countPointData(bizOrgCode);
HashMap<String, Object> temph = new HashMap<>();
temph.put("result",List);
temph.put("status",200);
temph.put("message","");
return temph;
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "巡检情况统计", notes = "巡检情况统计") @ApiOperation(value = "巡检情况统计", notes = "巡检情况统计")
@RequestMapping(value = "/countMonthNew", produces = "application/json;charset=UTF-8", method = RequestMethod.GET) @RequestMapping(value = "/countMonthNew", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
public HashMap<String, Object> countMonthCheckByIdNew() { public HashMap<String, Object> countMonthCheckByIdNew() {
......
...@@ -277,4 +277,5 @@ public interface CheckMapper extends BaseMapper { ...@@ -277,4 +277,5 @@ public interface CheckMapper extends BaseMapper {
List<Map<String, Object>> selectCheckById(@Param(value = "taskId") Long taskId, @Param(value = "pointId") Long pointId); List<Map<String, Object>> selectCheckById(@Param(value = "taskId") Long taskId, @Param(value = "pointId") Long pointId);
List<Map<String, Object>> queryCheckInputItemsByCheckId(@Param(value="checkId") long checkId);
} }
...@@ -79,6 +79,8 @@ public interface PointMapper extends BaseMapper { ...@@ -79,6 +79,8 @@ public interface PointMapper extends BaseMapper {
List<HashMap<String, Object>> getSumPtForDeptNew(@Param(value = "orgCode") String loginOrgCode); List<HashMap<String, Object>> getSumPtForDeptNew(@Param(value = "orgCode") String loginOrgCode);
List<HashMap<String, Object>> getSumPtForAdmin(@Param(value = "orgCode") String orgCode); List<HashMap<String, Object>> getSumPtForAdmin(@Param(value = "orgCode") String orgCode);
Map<String, Object> countPointData(@Param(value = "orgCode") String orgCode);
long getCheckPointCount(CheckPtListPageParam param); long getCheckPointCount(CheckPtListPageParam param);
long getCheckPointCountNew(CheckPtListPageParam param); long getCheckPointCountNew(CheckPtListPageParam param);
......
package com.yeejoin.amos.patrol.business.dto;
import lombok.Data;
import java.util.Date;
/**
* @author keyong
* @title: SendToMsgRiskAlarmInfoVo
* <pre>
* @description: TODO
* </pre>
* @date 2023/5/22 15:24
*/
@Data
public class SendToMsgRiskAlarmInfoVo {
private String key;
private String value;
private String name;
private String alarmContent;
private Date alarmDate;
}
package com.yeejoin.amos.patrol.business.dto;
import lombok.Data;
/**
* @author keyong
* @title: SendToMsgRiskDetailVo
* <pre>
* @description: TODO
* </pre>
* @date 2023/5/22 15:16
*/
@Data
public class SendToMsgRiskDetailVo {
private SendToMsgRiskEquipInfoVo equipInfo;
private SendToMsgRiskAlarmInfoVo alarmInfo;
}
package com.yeejoin.amos.patrol.business.dto;
import lombok.Data;
/**
* @author keyong
* @title: SendToMsgRiskEquipInfoVo
* <pre>
* @description: TODO
* </pre>
* @date 2023/5/22 15:21
*/
@Data
public class SendToMsgRiskEquipInfoVo {
private String id;
private String name;
private String value;
private String code;
private String bizOrgName;
private String bizOrgCode;
private String traceId;
private String equipSpeId;
// 指标告警状态
private Boolean reportIsAlarm = false;
// 存放位置
private String position;
private String systemName;
private String systemIds;
private String manufacturerName;
private String qrCode;
private String codeColor;
private String batchNo;
}
package com.yeejoin.amos.patrol.business.dto;
import io.swagger.annotations.ApiModel;
import lombok.Data;
/**
* @author keyong
* @title: TopicVo
* <pre>
* @description:
* </pre>
* @date 2020/11/13 9:15
*/
@Data
@ApiModel(description = "订阅主题Vo")
public class TopicEntityVo {
private String topic;
private String iotCode;
private String message;
private String data;
private String type;
// 若是车辆返回车牌号
private String code;
}
...@@ -46,5 +46,8 @@ public interface EquipFeign { ...@@ -46,5 +46,8 @@ public interface EquipFeign {
@RequestMapping(value = "${equip.fegin.prefix}"+"/building/getOne", method = RequestMethod.GET ,consumes="application/json") @RequestMapping(value = "${equip.fegin.prefix}"+"/building/getOne", method = RequestMethod.GET ,consumes="application/json")
FeignClientResult getBuildingTreeOne(@RequestParam(value = "instanceId", required = true) String instanceId); FeignClientResult getBuildingTreeOne(@RequestParam(value = "instanceId", required = true) String instanceId);
@RequestMapping(value = "${equip.fegin.prefix}"+"/equipSpecific/status/equip", method = RequestMethod.GET ,consumes="application/json")
FeignClientResult updateEquipSpecificStatus(@RequestParam(value = "status", required = false) String status,@RequestParam(value = "id", required = false) String id,@RequestParam(value = "sourceId", required = false) String sourceId,@RequestParam(value = "source", required = false) String source);
} }
...@@ -58,6 +58,7 @@ import javax.persistence.criteria.Predicate; ...@@ -58,6 +58,7 @@ import javax.persistence.criteria.Predicate;
import javax.persistence.criteria.Root; import javax.persistence.criteria.Root;
import java.beans.PropertyDescriptor; import java.beans.PropertyDescriptor;
import java.math.BigInteger; import java.math.BigInteger;
import java.text.NumberFormat;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -1430,6 +1431,43 @@ public class PointServiceImpl implements IPointService { ...@@ -1430,6 +1431,43 @@ public class PointServiceImpl implements IPointService {
return rContent; return rContent;
} }
@Override
public Map<String, Object> countPointData(String orgCode) {
Map<String, Object> maps = pointMapper.countPointData(orgCode);
int over_num = Integer.parseInt(maps.get("over_num").toString());
int today_num = Integer.parseInt(maps.get("today_num").toString());
int miss_num = Integer.parseInt(maps.get("miss_num").toString());
int unfinish_num = Integer.parseInt(maps.get("unfinish_num").toString());
String passRate = "";
String passMiss = "";
if (over_num == 0) {
passRate = 0 + "";
} else {
passRate = getPercent(over_num, (over_num+unfinish_num));
}
// today_num = miss_num + today_num;
if (miss_num == 0) {
passMiss = 0 + "";
} else {
passMiss = getPercent(miss_num, today_num);
}
passRate = passRate.replace("%", "");
passMiss = passMiss.replace("%", "");
maps.put("passRate",passRate);
maps.put("passMiss",passMiss);
return maps;
}
public String getPercent(int x, int y) {
double d1 = x * 1.0;
double d2 = y * 1.0;
NumberFormat percentInstance = NumberFormat.getPercentInstance();
// 设置保留几位小数,这里设置的是保留两位小数
percentInstance.setMinimumFractionDigits(2);
return percentInstance.format(d1 / d2);
}
@Override @Override
public List<HashMap<String, Object>> getSumPtByRoleNew(String orgcode) { public List<HashMap<String, Object>> getSumPtByRoleNew(String orgcode) {
......
...@@ -250,6 +250,7 @@ public interface IPointService { ...@@ -250,6 +250,7 @@ public interface IPointService {
List<HashMap<String, Object>> getSumPtByRole(HashMap<String, Object> paramMap); List<HashMap<String, Object>> getSumPtByRole(HashMap<String, Object> paramMap);
Map<String, Object> countPointData(String orgCode);
List<HashMap<String, Object>> getSumPtByRoleNew(String orgCode); List<HashMap<String, Object>> getSumPtByRoleNew(String orgCode);
/** /**
* 导入导入巡检点数据 * 导入导入巡检点数据
......
...@@ -45,6 +45,16 @@ public class CheckInfoVo { ...@@ -45,6 +45,16 @@ public class CheckInfoVo {
@Excel(name = "备注说明", orderNum = "14") @Excel(name = "备注说明", orderNum = "14")
private String remark; private String remark;
private String bizOrgName;
public void setBizOrgName(String bizOrgName) {
this.bizOrgName = bizOrgName;
}
public String getBizOrgName() {
return bizOrgName;
}
public String getId() { public String getId() {
return id; return id;
} }
......
...@@ -2,6 +2,7 @@ package com.yeejoin; ...@@ -2,6 +2,7 @@ package com.yeejoin;
import com.yeejoin.amos.boot.biz.common.utils.oConvertUtils; import com.yeejoin.amos.boot.biz.common.utils.oConvertUtils;
import com.yeejoin.equipmanage.listener.CarIotListener; import com.yeejoin.equipmanage.listener.CarIotListener;
import com.yeejoin.equipmanage.listener.CarIotNewListener;
import org.eclipse.paho.client.mqttv3.MqttException; import org.eclipse.paho.client.mqttv3.MqttException;
import org.mybatis.spring.annotation.MapperScan; import org.mybatis.spring.annotation.MapperScan;
import org.slf4j.Logger; import org.slf4j.Logger;
...@@ -19,6 +20,7 @@ import org.springframework.context.annotation.ComponentScan; ...@@ -19,6 +20,7 @@ import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.FilterType; import org.springframework.context.annotation.FilterType;
import org.springframework.core.env.Environment; import org.springframework.core.env.Environment;
import org.springframework.scheduling.annotation.EnableAsync; import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.transaction.annotation.EnableTransactionManagement; import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.springframework.web.client.RestTemplate; import org.springframework.web.client.RestTemplate;
import org.typroject.tyboot.component.emq.EmqKeeper; import org.typroject.tyboot.component.emq.EmqKeeper;
...@@ -46,8 +48,12 @@ public class AmostEquipApplication { ...@@ -46,8 +48,12 @@ public class AmostEquipApplication {
@Autowired @Autowired
private EmqKeeper emqKeeper; private EmqKeeper emqKeeper;
// @Autowired
// private CarIotListener carIotListener;
@Autowired @Autowired
private CarIotListener carIotListener; private CarIotNewListener carIotNewListener;
public static void main(String[] args) throws UnknownHostException { public static void main(String[] args) throws UnknownHostException {
ConfigurableApplicationContext context = SpringApplication.run(AmostEquipApplication.class, args); ConfigurableApplicationContext context = SpringApplication.run(AmostEquipApplication.class, args);
...@@ -74,6 +80,6 @@ public class AmostEquipApplication { ...@@ -74,6 +80,6 @@ public class AmostEquipApplication {
*/ */
@Bean @Bean
void initMqtt() throws MqttException { void initMqtt() throws MqttException {
emqKeeper.getMqttClient().subscribe("+/+/property", 1, carIotListener); emqKeeper.getMqttClient().subscribe("+/+/property", 1, carIotNewListener);
} }
} }
...@@ -135,3 +135,4 @@ water.level.indexKey=FHS_FirePoolDevice_WaterLevel,FHS_LevelDetector_WaterLevel, ...@@ -135,3 +135,4 @@ water.level.indexKey=FHS_FirePoolDevice_WaterLevel,FHS_LevelDetector_WaterLevel,
mileage.parameter=0.5 mileage.parameter=0.5
# 江西电建-车辆里程跨天记录切分(每日0点执行) # 江西电建-车辆里程跨天记录切分(每日0点执行)
mileage.segmentation.cron=0 0 0 * * ? mileage.segmentation.cron=0 0 0 * * ?
mileage.clippingtime=600000
\ No newline at end of file
...@@ -15,22 +15,22 @@ mybatis.type-aliases-package=com.yeejoin.equipmanage.common.entity ...@@ -15,22 +15,22 @@ mybatis.type-aliases-package=com.yeejoin.equipmanage.common.entity
spring.jackson.time-zone=GMT+8 spring.jackson.time-zone=GMT+8
spring.jackson.date-format=yyyy-MM-dd HH:mm:ss spring.jackson.date-format=yyyy-MM-dd HH:mm:ss
#分页 #\u5206\u9875
pagehelper.helper-dialect=mysql pagehelper.helper-dialect=mysql
pagehelper.params=count=countSql pagehelper.params=count=countSql
pagehelper.reasonable=false pagehelper.reasonable=false
pagehelper.support-methods-arguments=true pagehelper.support-methods-arguments=true
#覆盖相同名称bean #\u8986\u76D6\u76F8\u540C\u540D\u79F0bean
spring.main.allow-bean-definition-overriding=true spring.main.allow-bean-definition-overriding=true
#liquibase #liquibase
spring.liquibase.change-log=classpath:/changelog/changelog-master.xml spring.liquibase.change-log=classpath:/changelog/changelog-master.xml
spring.liquibase.enabled=true spring.liquibase.enabled=true
#上传文件设置 #\u4E0A\u4F20\u6587\u4EF6\u8BBE\u7F6E
spring.servlet.multipart.maxFileSize=100MB spring.servlet.multipart.maxFileSize=100MB
spring.servlet.multipart.maxRequestSize=100MB spring.servlet.multipart.maxRequestSize=100MB
#fegin调用服务名称 #fegin\u8C03\u7528\u670D\u52A1\u540D\u79F0
patrol.fegin.name=AMOS-PATROL patrol.fegin.name=AMOS-PATROL
maintenance.feign.name=AMOS-MAINTENANCE-API maintenance.feign.name=AMOS-MAINTENANCE-API
precontrol.feign.name=JEPCC-PRECONTROL-SERVER precontrol.feign.name=JEPCC-PRECONTROL-SERVER
...@@ -45,21 +45,21 @@ iot.vehicle.track=AMOS-API-IOT ...@@ -45,21 +45,21 @@ 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
#项目初始化画布id #\u9879\u76EE\u521D\u59CB\u5316\u753B\u5E03id
morphic.projectSeq=1390314016458514433 morphic.projectSeq=1390314016458514433
#wl_equipment_category 表id (取火灾报警系统id) #wl_equipment_category \u8868id \uFF08\u53D6\u706B\u707E\u62A5\u8B66\u7CFB\u7EDFid\uFF09
equipment.fire.systemid=1302870628873932802 equipment.fire.systemid=1302870628873932802
equipment.type=2 equipment.type=2
equipment.hierarchy=1,2,4,6 equipment.hierarchy=1,2,4,6
#装备查询根据装备类型编码过滤,4为过滤掉车相关数据,多个的话,添加方式为4,5 #\u88C5\u5907\u67E5\u8BE2\u6839\u636E\u88C5\u5907\u7C7B\u578B\u7F16\u7801\u8FC7\u6EE4\uFF0C4\u4E3A\u8FC7\u6EE4\u6389\u8F66\u76F8\u5173\u6570\u636E\uFF0C\u591A\u4E2A\u7684\u8BDD\uFF0C\u6DFB\u52A0\u65B9\u5F0F\u4E3A4,5
equipment.filter.code=4 equipment.filter.code=4
#wl_equipment_category 编码 92040000 为消防行业 火灾系统分类编码 #wl_equipment_category \u7F16\u7801 92040000 \u4E3A\u6D88\u9632\u884C\u4E1A \u706B\u707E\u7CFB\u7EDF\u5206\u7C7B\u7F16\u7801
equip.system.alarm.code=92040000 equip.system.alarm.code=92040000
#wl_equipment_category 编码 50000000 为安防行业 摄像头分类编码 #wl_equipment_category \u7F16\u7801 50000000 \u4E3A\u5B89\u9632\u884C\u4E1A \u6444\u50CF\u5934\u5206\u7C7B\u7F16\u7801
equip.security.code=50000000 equip.security.code=50000000
## redis失效时间 ## redis\u5931\u6548\u65F6\u95F4
redis.cache.failure.time=10800 redis.cache.failure.time=10800
#平台字典配置项 #\u5E73\u53F0\u5B57\u5178\u914D\u7F6E\u9879
systemctl.dict.iot-core-param=IOT_CORE_PARAM systemctl.dict.iot-core-param=IOT_CORE_PARAM
systemctl.dict.area-type=AREA_TYPE systemctl.dict.area-type=AREA_TYPE
systemctl.dict.allow-operation=ALLOW_OPERATION systemctl.dict.allow-operation=ALLOW_OPERATION
...@@ -75,14 +75,22 @@ mqtt.vehicle.topic=${equipManage.name}.vehicle.state ...@@ -75,14 +75,22 @@ mqtt.vehicle.topic=${equipManage.name}.vehicle.state
equip.point.equipmentdata.topic=${equipManage.name}.equipment.state equip.point.equipmentdata.topic=${equipManage.name}.equipment.state
equip.index.topic=${equipManage.name}.equipment.index.state equip.index.topic=${equipManage.name}.equipment.index.state
equip.iot.monitor.topic=team/station/monitor/matrix equip.iot.monitor.topic=team/station/monitor/matrix
# 接口地址 # \u7AD9\u7AEFmessage\u76D1\u542C\u4E3B\u9898
equip.message.create.topic=emq.risk.created
# \u4E2D\u5FC3\u7EA7\u76D1\u542C\u4E3B\u9898
equip.center.risk.topic=equip/risk/trigger
patrol.center.risk.topic=patrol/risk/trigger
# \u4E2D\u5FC3\u7EA7\u53D1\u9001\u81F3\u98CE\u9669\u670D\u52A1\u6D88\u606F\u683C\u5F0F
equip.risk.model.topic=equip/data/analysis
# \u63A5\u53E3\u5730\u5740
equip.scene.detail.url=${server.servlet.context-path}/scene/%s/detail/list equip.scene.detail.url=${server.servlet.context-path}/scene/%s/detail/list
equip.point.equipmentdata.url=${server.servlet.context-path}/equipSpecific/getAll?id= equip.point.equipmentdata.url=${server.servlet.context-path}/equipSpecific/getAll?id=
equip.point.speindex.url=${server.servlet.context-path}/fire-fighting-system/getSpeIndex?id= equip.point.speindex.url=${server.servlet.context-path}/fire-fighting-system/getSpeIndex?id=
equip.point.equipmentDetail.url=${server.servlet.context-path}/equipSpecific/getOneCard?id= equip.point.equipmentDetail.url=${server.servlet.context-path}/equipSpecific/getOneCard?id=
#组态获取系统详情接口地址 #\u7EC4\u6001\u83B7\u53D6\u7CFB\u7EDF\u8BE6\u60C5\u63A5\u53E3\u5730\u5740
firefightingsystem.detail.url=${server.servlet.context-path}/fire-fighting-system/getSystemById?id= firefightingsystem.detail.url=${server.servlet.context-path}/fire-fighting-system/getSystemById?id=
#组态获取分页接口地址 #\u7EC4\u6001\u83B7\u53D6\u5206\u9875\u63A5\u53E3\u5730\u5740
firefightingsystem.equip.alarms.url=${server.servlet.context-path}/fire-fighting-system/getEquipmentAlarmBySystemIdOrSourceIdVO firefightingsystem.equip.alarms.url=${server.servlet.context-path}/fire-fighting-system/getEquipmentAlarmBySystemIdOrSourceIdVO
building.detail=${server.servlet.context-path}/building/findByInstanceId building.detail=${server.servlet.context-path}/building/findByInstanceId
building.floor.detail=${server.servlet.context-path}/building/getBuildDetaliByFloorId?instanceId= building.floor.detail=${server.servlet.context-path}/building/getBuildDetaliByFloorId?instanceId=
...@@ -93,15 +101,15 @@ dcs.token-key=dcs_token_key ...@@ -93,15 +101,15 @@ dcs.token-key=dcs_token_key
dcs.client.secret=fire_system dcs.client.secret=fire_system
dcs.x.hw.id=NR_REST_APP dcs.x.hw.id=NR_REST_APP
dcs.x.hw.appKey=s+YkvQhwilx91TRJHhNDmw== dcs.x.hw.appKey=s+YkvQhwilx91TRJHhNDmw==
# 故障告警/消防告警/跑马灯权限标识 true 机场 / false 电力 # \u6545\u969C\u544A\u8B66/\u6D88\u9632\u544A\u8B66/\u8DD1\u9A6C\u706F\u6743\u9650\u6807\u8BC6 true \u673A\u573A / false \u7535\u529B
equip.enabled =false equip.enabled =false
#es储存物联日志是否删除开关 #es\u50A8\u5B58\u7269\u8054\u65E5\u5FD7\u662F\u5426\u5220\u9664\u5F00\u5173
es.ESEquiplistSpecific.flag= true es.ESEquiplistSpecific.flag= true
#es储存数据时间年 #es\u50A8\u5B58\u6570\u636E\u65F6\u95F4\u5E74
es.ESEquiplistSpecific.year= 1 es.ESEquiplistSpecific.year= 1
#es储存物联日志定时删除 #es\u50A8\u5B58\u7269\u8054\u65E5\u5FD7\u5B9A\u65F6\u5220\u9664
es.ESEquiplistSpecific.time= 0 0 2 1 * ? es.ESEquiplistSpecific.time= 0 0 2 1 * ?
## ES properties: ## ES properties:
biz.elasticsearch.address=172.16.11.201 biz.elasticsearch.address=172.16.11.201
...@@ -114,21 +122,21 @@ elasticsearch.password= Yeejoin@2020 ...@@ -114,21 +122,21 @@ elasticsearch.password= Yeejoin@2020
# 权限标识-物联区域 # \u6743\u9650\u6807\u8BC6-\u7269\u8054\u533A\u57DF
auth-key-area=area_info auth-key-area=area_info
# 权限标识-消防系统 # \u6743\u9650\u6807\u8BC6-\u6D88\u9632\u7CFB\u7EDF
auth-key-fire-system=fire_system_info auth-key-fire-system=fire_system_info
# 权限标识-消防系统和建筑 # \u6743\u9650\u6807\u8BC6-\u6D88\u9632\u7CFB\u7EDF\u548C\u5EFA\u7B51
auth-key-fire-system-build=fire_system_build_info auth-key-fire-system-build=fire_system_build_info
# 权限标识-消防装备 # \u6743\u9650\u6807\u8BC6-\u6D88\u9632\u88C5\u5907
auth-key-fire-equip=fire_equip_info auth-key-fire-equip=fire_equip_info
# 权限标识-消防视频 # \u6743\u9650\u6807\u8BC6-\u6D88\u9632\u89C6\u9891
auth-key-fire-video=fire_video_info auth-key-fire-video=fire_video_info
# 权限标识-消防建筑视频 # \u6743\u9650\u6807\u8BC6-\u6D88\u9632\u5EFA\u7B51\u89C6\u9891
auth-key-fire-build-video=fire_build_video_info auth-key-fire-build-video=fire_build_video_info
# 权限标识-消防车辆 # \u6743\u9650\u6807\u8BC6-\u6D88\u9632\u8F66\u8F86
auth-key-fire-car=fire_car_info auth-key-fire-car=fire_car_info
# 权限标识-消防建筑 # \u6743\u9650\u6807\u8BC6-\u6D88\u9632\u5EFA\u7B51
auth-key-fire-building=fire_building_info auth-key-fire-building=fire_building_info
redis_car_type_count = carTypeAndCount redis_car_type_count = carTypeAndCount
...@@ -136,10 +144,10 @@ redis_car_type_count = carTypeAndCount ...@@ -136,10 +144,10 @@ redis_car_type_count = carTypeAndCount
redis_equip_type_count = equipTypeAndCount redis_equip_type_count = equipTypeAndCount
emergency.disposal.indicators=emergencyDisposalIndicators emergency.disposal.indicators=emergencyDisposalIndicators
# 权限标识-物联装备 # \u6743\u9650\u6807\u8BC6-\u7269\u8054\u88C5\u5907
auth-key-fire-iot-equip=fire_iot-equip_info auth-key-fire-iot-equip=fire_iot-equip_info
# app离线同步装备数据开关 # app\u79BB\u7EBF\u540C\u6B65\u88C5\u5907\u6570\u636E\u5F00\u5173
auth-open-fire-equip=false auth-open-fire-equip=false
fxkgtId=1522051112935387138 fxkgtId=1522051112935387138
...@@ -148,7 +156,7 @@ management.security.enabled=true ...@@ -148,7 +156,7 @@ management.security.enabled=true
management.endpoint.health.show-details=always management.endpoint.health.show-details=always
spring.security.user.name=admin spring.security.user.name=admin
spring.security.user.password=a1234560 spring.security.user.password=a1234560
#每個站表示 #\u6BCF\u500B\u7AD9\u8868\u793A
stationCode=LSHLZ1bZAJU645Pgl7 stationCode=LSHLZ1bZAJU645Pgl7
##代码中有部分逻辑冲突需要处理 为区分机场和电力逻辑 增加开关 若为true 则为机场逻辑 为false 则为电力逻辑 ##\u4EE3\u7801\u4E2D\u6709\u90E8\u5206\u903B\u8F91\u51B2\u7A81\u9700\u8981\u5904\u7406 \u4E3A\u533A\u5206\u673A\u573A\u548C\u7535\u529B\u903B\u8F91 \u589E\u52A0\u5F00\u5173 \u82E5\u4E3Atrue \u5219\u4E3A\u673A\u573A\u903B\u8F91 \u4E3Afalse \u5219\u4E3A\u7535\u529B\u903B\u8F91
logic=false logic=false
\ No newline at end of file
...@@ -52,7 +52,8 @@ ...@@ -52,7 +52,8 @@
(SELECT GROUP_CONCAT(fem.name) FROM `f_fire_fighting_system` fem WHERE find_in_set(fem.id,spe.system_id)) as systemName, (SELECT GROUP_CONCAT(fem.name) FROM `f_fire_fighting_system` fem WHERE find_in_set(fem.id,spe.system_id)) as systemName,
if(ala.clean_time is null, '未消除', '已消除') AS cleanStatus, if(ala.clean_time is null, '未消除', '已消除') AS cleanStatus,
ala.clean_time, ala.clean_time,
ala.defect_batch_id ala.defect_batch_id,
spe.biz_org_name AS bizOrgName
from from
wl_equipment_specific_alarm_log as ala wl_equipment_specific_alarm_log as ala
left join wl_equipment_specific as spe on spe.id = ala.equipment_specific_id left join wl_equipment_specific as spe on spe.id = ala.equipment_specific_id
......
...@@ -36,6 +36,108 @@ ...@@ -36,6 +36,108 @@
`fs`.`sort` `fs`.`sort`
</select> </select>
<select id="getSystemAlarmTheCount" resultType="java.util.Map">
SELECT
count(*) as total
FROM
(
SELECT
`fs`.`id` AS `key`,
`fs`.`name` AS `name`,
`fs`.system_type_code AS systemTypeCode,
`fs`.`code` AS CODE,
`fs`.`biz_org_code` AS bizOrgCode,
`fs`.`biz_org_name` AS bizOrgName,
(
SELECT
count( * )
FROM
( SELECT id FROM wl_equipment_specific_alarm_log WHERE system_codes = fs.CODE AND clean_time IS NULL GROUP BY equipment_specific_id ) b
) AS alarmNum,
IF
(
(
(
SELECT
count( `wesa`.`equipment_specific_id` )
FROM
`wl_equipment_specific_alarm` `wesa`
WHERE
( 0 <![CDATA[<>]]> find_in_set( `fs`.`id`, `wesa`.`system_ids` ) AND `wesa`.`status` = 1 )
) > 0
),
'异常',
'正常'
) AS `status`
FROM
`f_fire_fighting_system` `fs`
GROUP BY
`fs`.`id`
ORDER BY
fs.biz_org_name
) sys
<where>
<if test="status != null and status != ''">
sys.status = #{status}
</if>
<if test="bizOrgCode != null and bizOrgCode != ''">
and sys.bizOrgCode like concat('%',#{bizOrgCode},'%')
</if>
</where>
</select>
<select id="getSystemAlarmCount" resultType="Map">
SELECT
*
FROM
(
SELECT
`fs`.`id` AS `key`,
`fs`.`name` AS `name`,
`fs`.system_type_code AS systemTypeCode,
`fs`.`code` AS CODE,
`fs`.`biz_org_code` AS bizOrgCode,
`fs`.`biz_org_name` AS bizOrgName,
(
SELECT
count( * )
FROM
( SELECT id FROM wl_equipment_specific_alarm_log WHERE system_codes = fs.CODE AND clean_time IS NULL GROUP BY equipment_specific_id ) b
) AS alarmNum,
IF
(
(
(
SELECT
count( `wesa`.`equipment_specific_id` )
FROM
`wl_equipment_specific_alarm` `wesa`
WHERE
( 0 <![CDATA[<>]]> find_in_set( `fs`.`id`, `wesa`.`system_ids` ) AND `wesa`.`status` = 1 )
) > 0
),
'异常',
'正常'
) AS `status`
FROM
`f_fire_fighting_system` `fs`
GROUP BY
`fs`.`id`
ORDER BY
fs.biz_org_name
) sys
<where>
<if test="status != null and status != ''">
sys.status = #{status}
</if>
<if test="bizOrgCode != null and bizOrgCode != ''">
and sys.bizOrgCode like concat('%',#{bizOrgCode},'%')
</if>
</where>
LIMIT #{current},#{size}
</select>
<select id="getCAFSWaterTankInfo" resultType="Map"> <select id="getCAFSWaterTankInfo" resultType="Map">
SELECT SELECT
wes.id AS specificId, wes.id AS specificId,
......
...@@ -211,7 +211,8 @@ ...@@ -211,7 +211,8 @@
where fefe.fire_equipment_id = wlesal.equipment_specific_id where fefe.fire_equipment_id = wlesal.equipment_specific_id
) as equipmentName, ) as equipmentName,
wlesal.equipment_specific_name as equipmentSpecificName, wlesal.equipment_specific_name as equipmentSpecificName,
wles.position wles.position,
wles.biz_org_name as bizOrgName
FROM wl_equipment_specific_alarm_log wlesal FROM wl_equipment_specific_alarm_log wlesal
LEFT JOIN wl_equipment_specific wles ON wlesal.equipment_specific_id = wles.id LEFT JOIN wl_equipment_specific wles ON wlesal.equipment_specific_id = wles.id
LEFT JOIN wl_equipment_detail wled ON wles.equipment_detail_id = wled.id LEFT JOIN wl_equipment_detail wled ON wles.equipment_detail_id = wled.id
......
...@@ -2344,4 +2344,18 @@ ...@@ -2344,4 +2344,18 @@
FROM FROM
`f_equipment` a `f_equipment` a
</select> </select>
<update id="updateEquipSpecificStatus">
update wl_equipment_specific set equip_status = #{status} where id = #{id}
</update>
<select id="updateEquipSpecificStatusByCheckInput" resultType="java.lang.String">
SELECT
ppc.equipment_id
FROM
p_check_input ci
LEFT JOIN `p_point_classify` ppc ON ci .point_classify_id = ppc.id
WHERE ci.id = #{id}
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -5144,7 +5144,7 @@ ...@@ -5144,7 +5144,7 @@
( (
max( CASE WHEN fi.field_name = 'maxLevel' THEN fi.field_value END ) = '' max( CASE WHEN fi.field_name = 'maxLevel' THEN fi.field_value END ) = ''
OR max( CASE WHEN fi.field_name = 'maxLevel' THEN fi.field_value END ) IS NULL, OR max( CASE WHEN fi.field_name = 'maxLevel' THEN fi.field_value END ) IS NULL,
0, 1000,
max( CASE WHEN fi.field_name = 'maxLevel' THEN fi.field_value END )) AS maxValues max( CASE WHEN fi.field_name = 'maxLevel' THEN fi.field_value END )) AS maxValues
FROM FROM
wl_form_instance_equip fi wl_form_instance_equip fi
...@@ -5165,7 +5165,7 @@ ...@@ -5165,7 +5165,7 @@
max( CASE WHEN fi.field_name = 'maxPressure' THEN fi.field_value END ) = '' max( CASE WHEN fi.field_name = 'maxPressure' THEN fi.field_value END ) = ''
OR max( CASE WHEN fi.field_name = 'maxPressure' THEN fi.field_value END ) IS NULL OR max( CASE WHEN fi.field_name = 'maxPressure' THEN fi.field_value END ) IS NULL
OR max( CASE WHEN fi.field_name = 'maxPressure' THEN fi.field_value END ) = 'null', OR max( CASE WHEN fi.field_name = 'maxPressure' THEN fi.field_value END ) = 'null',
0, 1000,
max( CASE WHEN fi.field_name = 'maxPressure' THEN fi.field_value END )) AS maxValues max( CASE WHEN fi.field_name = 'maxPressure' THEN fi.field_value END )) AS maxValues
FROM FROM
wl_form_instance_equip fi wl_form_instance_equip fi
......
...@@ -51,6 +51,10 @@ amosRefresh.danger.topic =patrolDangerInsertOrUpdate ...@@ -51,6 +51,10 @@ amosRefresh.danger.topic =patrolDangerInsertOrUpdate
amosRefresh.patrol.topic =patrolCheckInsert amosRefresh.patrol.topic =patrolCheckInsert
patrol.point.classify.topic=patrol/point/classify patrol.point.classify.topic=patrol/point/classify
patrol.topic=patrol/# patrol.topic=patrol/#
# \u7AD9\u7AEFmessage\u76D1\u542C\u4E3B\u9898
patrol.message.create.topic=emq.risk.created
# \u4E2D\u5FC3\u7EA7\u76D1\u542C\u4E3B\u9898
patrol.center.risk.topic=patrol/risk/trigger
#\u505C\u6B62\u901A\u8FC7WEB\u516C\u5F00\u6240\u6709\u7AEF\u70B9 #\u505C\u6B62\u901A\u8FC7WEB\u516C\u5F00\u6240\u6709\u7AEF\u70B9
#management.endpoints.web.exposure.exclude=* #management.endpoints.web.exposure.exclude=*
## redis\u5931\u6548\u65F6\u95F4 ## redis\u5931\u6548\u65F6\u95F4
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
<result property="planTaskId" column="plan_Task_Id"/> <result property="planTaskId" column="plan_Task_Id"/>
<result property="catalogId" column="Catalog_Id"/> <result property="catalogId" column="Catalog_Id"/>
<result property="depId" column="departmentId"/> <result property="depId" column="departmentId"/>
<result property="bizOrgName" column="bizOrgName"/>
</resultMap> </resultMap>
<!--统计-记录统计 --> <!--统计-记录统计 -->
<select id="countCheckInfoData" resultType="long"> <select id="countCheckInfoData" resultType="long">
...@@ -79,19 +79,19 @@ ...@@ -79,19 +79,19 @@
<if test="beginDate!=null and beginDate!= ''">and a.check_time >= #{beginDate} </if> <if test="beginDate!=null and beginDate!= ''">and a.check_time >= #{beginDate} </if>
<if test="endDate!=null and endDate!= ''">and #{endDate} >= a.check_time</if> <if test="endDate!=null and endDate!= ''">and #{endDate} >= a.check_time</if>
<!-- <if test="endDate!=null"> and #{endDate} <![CDATA[>=]]> a.check_time </if> --> <!-- <if test="endDate!=null"> and #{endDate} <![CDATA[>=]]> a.check_time </if> -->
<if test="userName!=null">and a.user_name like concat(concat("%",#{userName}),"%")</if> <if test="userName!=null and userName!=''">and a.user_name like concat(concat("%",#{userName}),"%")</if>
<if test="pointName!=null">and b.name like concat(concat("%",#{pointName}),"%")</if> <if test="pointName!=null and pointName!=''">and a.point_name like concat(concat("%",#{pointName}),"%")</if>
<if test="pointNo!=null">and b.point_no like concat('%',#{pointNo},'%')</if> <if test="pointNo!=null and pointNo!=''">and b.point_no like concat('%',#{pointNo},'%')</if>
<if test="isFixed!=null">and b.is_fixed = #{isFixed}</if> <if test="isFixed!=null and isFixed!=''">and b.is_fixed = #{isFixed}</if>
<if test="isOK!=null and isOK!=''">and a.is_OK = #{isOK}</if> <if test="isOK!=null and isOK!=''">and a.is_OK = #{isOK}</if>
<if test="planId!=null">and a.plan_Id = #{planId}</if> <if test="planId!=null and planId!=''">and a.plan_Id = #{planId}</if>
<if test="planTaskId!=null">and a.plan_task_id = #{planTaskId}</if> <if test="planTaskId!=null and planTaskId!=''">and a.plan_task_id = #{planTaskId}</if>
<if test="userId!=null">and find_in_set(#{userId}, a.user_id) > 0</if> <if test="userId!=null and userId!=''">and find_in_set(#{userId}, a.user_id) > 0</if>
<if test="routeId!=null">and a.route_Id = #{routeId}</if> <if test="routeId!=null and routeId!=''">and a.route_Id = #{routeId}</if>
<if test="catalogId!=null">and b.Catalog_Id = #{catalogId}</if> <if test="catalogId!=null and catalogId!=''">and b.Catalog_Id = #{catalogId}</if>
<if test="orgCode!=null">and (a.org_Code like concat (#{orgCode},"-%")or a.org_Code= #{orgCode})</if> <if test="orgCode!=null and orgCode!=''">and (a.org_Code like concat (#{orgCode},"-%")or a.org_Code= #{orgCode})</if>
<if test="pointId!=null">and a.point_id = #{pointId}</if> <if test="pointId!=null and pointId!=''">and a.point_id = #{pointId}</if>
<if test="checkTime!=null">and TO_DAYS(a.check_time) = TO_DAYS('${checkTime}')</if> <if test="checkTime!=null and checkTime!=''">and TO_DAYS(a.check_time) = TO_DAYS('${checkTime}')</if>
<if test="departmentId!=null and departmentId!='-1'"> and find_in_set(#{departmentId}, a.dep_id) > 0</if> <if test="departmentId!=null and departmentId!='-1'"> and find_in_set(#{departmentId}, a.dep_id) > 0</if>
<if test="checkType == '计划检查'">and a.plan_task_id &gt; 0</if> <if test="checkType == '计划检查'">and a.plan_task_id &gt; 0</if>
<if test="checkType == '无计划检查'">and a.plan_task_id &lt;= 0</if> <if test="checkType == '无计划检查'">and a.plan_task_id &lt;= 0</if>
...@@ -212,7 +212,7 @@ ...@@ -212,7 +212,7 @@
a.id, a.id,
a.org_code, a.org_code,
a.point_id pointId, a.point_id pointId,
b.name point_name, a.point_name,
b.is_fixed, b.is_fixed,
b.point_no pointNo, b.point_no pointNo,
a.user_id, a.user_id,
...@@ -249,7 +249,7 @@ ...@@ -249,7 +249,7 @@
END END
) as is_ok, ) as is_ok,
a.score, a.score,
d.`name` AS `route_name`, a.`route_name`,
( (
CASE CASE
WHEN a.check_mode = 'QR' WHEN a.check_mode = 'QR'
...@@ -266,13 +266,14 @@ ...@@ -266,13 +266,14 @@
'系统自检' '系统自检'
END END
) as check_mode, ) as check_mode,
e.`name` AS `plan_name`, a.`plan_name` AS `plan_name`,
a.plan_task_id, a.plan_task_id,
a.plan_id, a.plan_id,
a.`route_id`, a.`route_id`,
b.`catalog_id`, b.`catalog_id`,
a.error, a.error,
a.remark a.remark,
b.biz_org_name AS bizOrgName
FROM FROM
`p_check` `a` `p_check` `a`
LEFT JOIN `p_point` `b` ON `a`.`point_id` = `b`.`id` LEFT JOIN `p_point` `b` ON `a`.`point_id` = `b`.`id`
...@@ -287,19 +288,19 @@ ...@@ -287,19 +288,19 @@
<if test="beginDate!=null and beginDate!= ''">and a.check_time >= #{beginDate} </if> <if test="beginDate!=null and beginDate!= ''">and a.check_time >= #{beginDate} </if>
<if test="endDate!=null and endDate!= ''">and #{endDate} >= a.check_time</if> <if test="endDate!=null and endDate!= ''">and #{endDate} >= a.check_time</if>
<!-- <if test="endDate!=null"> and #{endDate} <![CDATA[>=]]> a.check_time </if> --> <!-- <if test="endDate!=null"> and #{endDate} <![CDATA[>=]]> a.check_time </if> -->
<if test="userName!=null">and a.user_name like concat(concat("%",#{userName}),"%")</if> <if test="userName!=null and userName!=''">and a.user_name like concat(concat("%",#{userName}),"%")</if>
<if test="pointName!=null">and b.name like concat(concat("%",#{pointName}),"%")</if> <if test="pointName!=null and pointName!= ''">and b.name like concat(concat("%",#{pointName}),"%")</if>
<if test="pointNo!=null">and b.point_no like concat('%',#{pointNo},'%')</if> <if test="pointNo!=null and pointNo!=''">and b.point_no like concat('%',#{pointNo},'%')</if>
<if test="isFixed!=null">and b.is_fixed = #{isFixed}</if> <if test="isFixed!=null and isFixed!=''">and b.is_fixed = #{isFixed}</if>
<if test="isOK!=null and isOK!=''">and a.is_OK = #{isOK}</if> <if test="isOK!=null and isOK!=''">and a.is_OK = #{isOK}</if>
<if test="planId!=null">and a.plan_Id = #{planId}</if> <if test="planId!=null and planId!='' ">and a.plan_Id = #{planId}</if>
<if test="planTaskId!=null">and a.plan_task_id = #{planTaskId}</if> <if test="planTaskId!=null and planTaskId!=''">and a.plan_task_id = #{planTaskId}</if>
<if test="userId!=null">and find_in_set(#{userId}, a.user_id) > 0</if> <if test="userId!=null and userId!=''">and find_in_set(#{userId}, a.user_id) > 0</if>
<if test="routeId!=null">and a.route_Id = #{routeId}</if> <if test="routeId!=null and routeId!=''">and a.route_Id = #{routeId}</if>
<if test="catalogId!=null">and b.Catalog_Id = #{catalogId}</if> <if test="catalogId!=null and catalogId!=''">and b.Catalog_Id = #{catalogId}</if>
<if test="orgCode!=null">and (a.org_Code like concat (#{orgCode},"-%")or a.org_Code= #{orgCode})</if> <if test="orgCode!=null and orgCode!=''">and (a.org_Code like concat (#{orgCode},"-%")or a.org_Code= #{orgCode})</if>
<if test="pointId!=null">and a.point_id = #{pointId}</if> <if test="pointId!=null and pointId!=''">and a.point_id = #{pointId}</if>
<if test="checkTime!=null">and TO_DAYS(a.check_time) = TO_DAYS('${checkTime}')</if> <if test="checkTime!=null and checkTime!=''">and TO_DAYS(a.check_time) = TO_DAYS('${checkTime}')</if>
<if test="departmentId!=null and departmentId!='-1'"> and find_in_set(#{departmentId}, a.dep_id) > 0</if> <if test="departmentId!=null and departmentId!='-1'"> and find_in_set(#{departmentId}, a.dep_id) > 0</if>
<if test="checkType == '计划检查'">and a.plan_task_id &gt; 0</if> <if test="checkType == '计划检查'">and a.plan_task_id &gt; 0</if>
<if test="checkType == '无计划检查'">and a.plan_task_id &lt;= 0</if> <if test="checkType == '无计划检查'">and a.plan_task_id &lt;= 0</if>
...@@ -2177,4 +2178,33 @@ ...@@ -2177,4 +2178,33 @@
WHERE pc.plan_task_id = #{taskId} AND pc.point_id = #{pointId} AND pc.is_ok = 3 WHERE pc.plan_task_id = #{taskId} AND pc.point_id = #{pointId} AND pc.is_ok = 3
</select> </select>
<select id="queryCheckInputItemsByCheckId" resultType="Map">
SELECT
c.id,
c.point_id pointId,
ii.item_no,
ii.NAME inputItem,
ci.input_value,
CASE
ci.is_ok
WHEN 1 THEN
'合格'
WHEN 2 THEN
'不合格' ELSE '漏检'
END AS is_ok,
ii.biz_org_code,
ii.biz_org_name,
ci.score ,
ci.id as traceId,
ppc.equipment_id as equipId
FROM
p_check c
LEFT JOIN p_check_input ci ON ci.check_id = c.id
LEFT JOIN p_input_item ii ON ii.id = ci.input_id
LEFT JOIN p_point_classify ppc on ci.point_classify_id = ppc.id
WHERE
c.id = #{checkId}
ORDER BY
ci.order_no
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -490,6 +490,58 @@ ...@@ -490,6 +490,58 @@
) vp ) vp
) tt group by tt.RealTimeStatus,tt.status order by status ) tt group by tt.RealTimeStatus,tt.status order by status
</select> </select>
<select id="countPointData" resultType="java.util.HashMap">
SELECT
(
SELECT
IFNULL( count( * ), 0 )
FROM
`p_check`
WHERE
check_time LIKE CONCAT( DATE_FORMAT( now( ), '%Y-%m-%d' ), '%' )
<if test="orgCode!=null">
and (org_code LIKE CONCAT('%',#{orgCode},'%' ))
</if>
AND is_ok = 1
) AS `over_num`,
(
SELECT
IFNULL( count( * ), 0 )
FROM
`p_check`
WHERE
check_time LIKE CONCAT( DATE_FORMAT( now( ), '%Y-%m-%d' ), '%' )
<if test="orgCode!=null">
and (org_code LIKE CONCAT('%',#{orgCode},'%' ))
</if>
AND is_ok = 2
) AS `unfinish_num`,
(
SELECT
IFNULL( count( * ), 0 )
FROM
`p_check`
WHERE
check_time LIKE CONCAT( DATE_FORMAT( now( ), '%Y-%m-%d' ), '%' )
<if test="orgCode!=null">
and (org_code LIKE CONCAT('%',#{orgCode},'%' ))
</if>
AND is_ok = 3
) AS `miss_num`,
(
SELECT
ifnull( sum( `p_plan_task`.`point_num` ), 0 )
FROM
`p_plan_task`
WHERE
( `p_plan_task`.`check_date` LIKE concat( curdate( ), '%' ) )
<if test="orgCode!=null">
and (org_code LIKE CONCAT('%',#{orgCode},'%' ))
</if>
) AS `today_num`
</select>
<!-- 巡检点统计 --> <!-- 巡检点统计 -->
<select id="getSumPtForDept" resultType="java.util.HashMap"> <select id="getSumPtForDept" resultType="java.util.HashMap">
SELECT RealTimeStatus as name,status,count(1) as value SELECT RealTimeStatus as name,status,count(1) as value
......
...@@ -71,6 +71,7 @@ public class EmqMessageService extends EmqxListener { ...@@ -71,6 +71,7 @@ public class EmqMessageService extends EmqxListener {
@Override @Override
public void processMessage(String topic, MqttMessage message) throws Exception { public void processMessage(String topic, MqttMessage message) throws Exception {
log.info(topic+"进来了,内容:"+message);
JSONObject result = JSONObject.fromObject(new String(message.getPayload())); JSONObject result = JSONObject.fromObject(new String(message.getPayload()));
JSONObject messageResult = new JSONObject(); JSONObject messageResult = new JSONObject();
messageResult.put("result", result); messageResult.put("result", result);
......
#注册中心地址 #注册中心地址
eureka.client.service-url.defaultZone =http://172.16.10.215:10001/eureka/ eureka.client.service-url.defaultZone =http://172.16.11.201:10001/eureka/
eureka.instance.prefer-ip-address=true eureka.instance.prefer-ip-address=true
management.endpoint.health.show-details=always management.endpoint.health.show-details=always
management.endpoints.web.exposure.include=* management.endpoints.web.exposure.include=*
eureka.instance.health-check-url-path=/actuator/health eureka.instance.health-check-url-path=/actuator/health
eureka.instance.metadata-map.management.context-path=${server.servlet.context-path}/actuator eureka.instance.metadata-map.management.context-path=${server.servlet.context-path}/actuator
eureka.instance.status-page-url-path=/actuator/info eureka.instance.status-page-url-path=/actuator/info
eureka.instance.metadata-map.management.api-docs=http://localhost:${server.port}${server.servlet.context-path}/swagger-ui.html eureka.instance.metadata-map.management.api-docs=http://172.16.11.201:${server.port}${server.servlet.context-path}/swagger-ui.html
# kafka集群信息 # kafka集群信息
spring.kafka.bootstrap-servers=172.16.3.100:9092 spring.kafka.bootstrap-servers=172.16.10.215:9092
# 生产者配置 # 生产者配置
# 设置大于0的值,则客户端会将发送失败的记录重新发送 # 重试次数 # 设置大于0的值,则客户端会将发送失败的记录重新发送 # 重试次数
spring.kafka.producer.retries=1 spring.kafka.producer.retries=1
...@@ -74,7 +74,7 @@ management.health.redis.enabled=false ...@@ -74,7 +74,7 @@ management.health.redis.enabled=false
## 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.10.215:1883 emqx.broker=tcp://172.16.11.201:1883
emqx.client-user-name=admin emqx.client-user-name=admin
emqx.client-password=public emqx.client-password=public
emqx.max-inflight=1000 emqx.max-inflight=1000
...@@ -86,7 +86,7 @@ emqx.max-inflight=1000 ...@@ -86,7 +86,7 @@ emqx.max-inflight=1000
kafka.topics=null kafka.topics=null
#需要监听得eqm消息主题 根据是否是中心极和站端选择需要监听得主题进行配置 emq.iot.created, #需要监听得eqm消息主题 根据是否是中心极和站端选择需要监听得主题进行配置 emq.iot.created,
emq.topic=emq.xf.created,emq.iot.created,emq.patrol.created,emq.sign.created,emq.bussSign.created,emq.user.created emq.topic=emq.xf.created,emq.iot.created,emq.patrol.created,emq.sign.created,emq.bussSign.created,emq.user.created,emq.risk.created
##中心级配置配置 ##中心级配置配置
##需要监听得kafka消息主题 根据是否是中心极和站端选择需要监听得主题进行配置 ##需要监听得kafka消息主题 根据是否是中心极和站端选择需要监听得主题进行配置
......
...@@ -27,6 +27,21 @@ ...@@ -27,6 +27,21 @@
{ {
"code": "xf", "code": "xf",
"emqTopic": "emq.xf.created", "emqTopic": "emq.xf.created",
"akkaTopic": "JKXT2BP-XF-Topic" "akkaTopic": "JKXT2BP-XFYY-Topic"
},
{
"code": "risk",
"emqTopic": "emq.risk.created",
"akkaTopic": "JKXT2BP-XFYY-Topic"
},
{
"code": "patrol",
"emqTopic": "emq.patrol.created",
"akkaTopic": "JKXT2BP-XFYY-Topic"
},
{
"code": "equipQrcode",
"emqTopic": "emq.mcb.zxj",
"akkaTopic": "JKXT2BP-XFYY-Topic"
} }
] ]
\ No newline at end of file
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