ty
1 year ago
206 changed files with 3476 additions and 5296 deletions
@ -0,0 +1,72 @@ |
|||||||
|
package com.hnac.hzims.common.utils; |
||||||
|
|
||||||
|
import com.alibaba.druid.support.json.JSONUtils; |
||||||
|
import com.alibaba.fastjson.JSON; |
||||||
|
import com.alibaba.fastjson.JSONObject; |
||||||
|
import com.fasterxml.jackson.databind.JsonNode; |
||||||
|
import com.hikvision.artemis.sdk.ArtemisHttpUtil; |
||||||
|
import com.hikvision.artemis.sdk.config.ArtemisConfig; |
||||||
|
import okhttp3.MediaType; |
||||||
|
import okhttp3.MultipartBody; |
||||||
|
import okhttp3.RequestBody; |
||||||
|
import org.springblade.core.log.exception.ServiceException; |
||||||
|
import org.springblade.core.log.logger.BladeLogger; |
||||||
|
import org.springblade.core.tool.jackson.JsonUtil; |
||||||
|
import org.springblade.core.tool.utils.DateUtil; |
||||||
|
import org.springblade.core.tool.utils.Func; |
||||||
|
import org.springblade.server.domain.Sys; |
||||||
|
import org.springframework.beans.factory.annotation.Value; |
||||||
|
import org.springframework.util.Assert; |
||||||
|
|
||||||
|
import java.text.DateFormat; |
||||||
|
import java.time.LocalDateTime; |
||||||
|
import java.time.ZoneId; |
||||||
|
import java.time.ZoneOffset; |
||||||
|
import java.time.format.DateTimeFormatter; |
||||||
|
import java.util.HashMap; |
||||||
|
import java.util.Map; |
||||||
|
import java.util.Optional; |
||||||
|
|
||||||
|
/** |
||||||
|
* @Author: huangxing |
||||||
|
* @Date: 2024/1/10 14:40 |
||||||
|
*/ |
||||||
|
public class HiKUtil { |
||||||
|
|
||||||
|
public static String APP_KEY = "26486442"; |
||||||
|
public static String APP_SECRET = "tXBM9jsMqeM9yvEMS8qg"; |
||||||
|
public static String HOST = "140.210.208.111:443"; |
||||||
|
|
||||||
|
public static String send(String api, Map<String, Object> map) { |
||||||
|
ArtemisConfig.host = HOST; |
||||||
|
ArtemisConfig.appKey = APP_KEY; |
||||||
|
ArtemisConfig.appSecret = APP_SECRET; |
||||||
|
|
||||||
|
final String url = "/artemis" + api; |
||||||
|
Map<String, String> path = new HashMap<String,String>(2){{ |
||||||
|
put("https://", url); |
||||||
|
}}; |
||||||
|
String contentType = "application/json"; |
||||||
|
String body = JSON.toJSONString(map); |
||||||
|
String result = ArtemisHttpUtil.doPostStringArtemis(path, body, null, null, contentType, null); |
||||||
|
JSONObject object = JsonUtil.parse(result, JSONObject.class); |
||||||
|
return object.getString("data"); |
||||||
|
} |
||||||
|
|
||||||
|
public static String send(String api, Map<String, Object> map, String host,String appKey,String appSecret) { |
||||||
|
ArtemisConfig.host = host; |
||||||
|
ArtemisConfig.appKey = appKey; |
||||||
|
ArtemisConfig.appSecret = appSecret; |
||||||
|
|
||||||
|
final String url = "/artemis" + api; |
||||||
|
Map<String, String> path = new HashMap<String,String>(2){{ |
||||||
|
put("https://", url); |
||||||
|
}}; |
||||||
|
String contentType = "application/json"; |
||||||
|
String body = JSON.toJSONString(map); |
||||||
|
String result = ArtemisHttpUtil.doPostStringArtemis(path, body, null, null, contentType, null); |
||||||
|
JSONObject object = JsonUtil.parse(result, JSONObject.class); |
||||||
|
return object.getString("data"); |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -1,4 +1,4 @@ |
|||||||
package com.hnac.hzims.operational.alert.entity; |
package com.hnac.hzims.alarm.entity; |
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableName; |
import com.baomidou.mybatisplus.annotation.TableName; |
||||||
import io.swagger.annotations.ApiModel; |
import io.swagger.annotations.ApiModel; |
@ -1,4 +1,4 @@ |
|||||||
package com.hnac.hzims.operational.alert.entity; |
package com.hnac.hzims.alarm.entity; |
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableName; |
import com.baomidou.mybatisplus.annotation.TableName; |
||||||
import io.swagger.annotations.ApiModel; |
import io.swagger.annotations.ApiModel; |
@ -1,8 +1,8 @@ |
|||||||
package com.hnac.hzims.operational.alert.vo; |
package com.hnac.hzims.alarm.vo; |
||||||
|
|
||||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize; |
import com.fasterxml.jackson.databind.annotation.JsonSerialize; |
||||||
import com.fasterxml.jackson.databind.ser.std.NullSerializer; |
import com.fasterxml.jackson.databind.ser.std.NullSerializer; |
||||||
import com.hnac.hzims.operational.alert.entity.AlarmHandleEntity; |
import com.hnac.hzims.alarm.entity.AlarmHandleEntity; |
||||||
import io.swagger.annotations.ApiModelProperty; |
import io.swagger.annotations.ApiModelProperty; |
||||||
import lombok.Data; |
import lombok.Data; |
||||||
import lombok.EqualsAndHashCode; |
import lombok.EqualsAndHashCode; |
@ -0,0 +1,25 @@ |
|||||||
|
package com.hnac.hzims.operational.duty.vo; |
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty; |
||||||
|
import lombok.Data; |
||||||
|
|
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author ysj |
||||||
|
*/ |
||||||
|
@Data |
||||||
|
public class DutyGroupMemberVo { |
||||||
|
|
||||||
|
@ApiModelProperty(value = "班组Id") |
||||||
|
private String groupId; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "班组名称") |
||||||
|
private String groupName; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "机构Id") |
||||||
|
private Long createDept; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "班组成员对象") |
||||||
|
private List<DutyMemberVO> member; |
||||||
|
} |
@ -0,0 +1,21 @@ |
|||||||
|
package com.hnac.hzims.operational.duty.vo; |
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.annotation.JsonSerialize; |
||||||
|
import com.fasterxml.jackson.databind.ser.std.NullSerializer; |
||||||
|
import io.swagger.annotations.ApiModelProperty; |
||||||
|
import lombok.Data; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author ysj |
||||||
|
*/ |
||||||
|
@Data |
||||||
|
public class DutyMemberVO { |
||||||
|
|
||||||
|
@ApiModelProperty(value = "班组人员Id") |
||||||
|
@JsonSerialize(nullsUsing = NullSerializer.class) |
||||||
|
private Long personId; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "班组人员名称") |
||||||
|
private String personName; |
||||||
|
|
||||||
|
} |
@ -0,0 +1,6 @@ |
|||||||
|
package com.hnac.hzims.safeproduct.constants; |
||||||
|
|
||||||
|
public interface RedisConstants { |
||||||
|
/**安全工器具提醒记录**/ |
||||||
|
String TOOLS_REMIND_MSG = "200000:hzims:safeproduct:tools:remind"; |
||||||
|
} |
@ -0,0 +1,46 @@ |
|||||||
|
package com.hnac.hzims.safeproduct.dto; |
||||||
|
|
||||||
|
import com.hnac.hzims.safeproduct.entity.CarCheckItemEntity; |
||||||
|
import io.swagger.annotations.ApiModel; |
||||||
|
import io.swagger.annotations.ApiModelProperty; |
||||||
|
import lombok.Data; |
||||||
|
|
||||||
|
import javax.validation.constraints.NotNull; |
||||||
|
import javax.validation.constraints.Size; |
||||||
|
import java.util.Date; |
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author liwen |
||||||
|
* @date 2024-01-09 |
||||||
|
*/ |
||||||
|
@Data |
||||||
|
@ApiModel(value = "车检记录DTO类") |
||||||
|
public class CarCheckRecordDTO { |
||||||
|
|
||||||
|
@ApiModelProperty("车检记录id") |
||||||
|
private Long id; |
||||||
|
|
||||||
|
@ApiModelProperty("车辆id") |
||||||
|
private Long carId; |
||||||
|
|
||||||
|
@NotNull |
||||||
|
@Size(max = 50, message = "检查人长度不能超过50") |
||||||
|
@ApiModelProperty("检查人") |
||||||
|
private String checker; |
||||||
|
|
||||||
|
@NotNull |
||||||
|
@ApiModelProperty("检查时间") |
||||||
|
private Date checkTime; |
||||||
|
|
||||||
|
@NotNull |
||||||
|
@ApiModelProperty("检查结论") |
||||||
|
private String conclusion; |
||||||
|
|
||||||
|
@Size(max = 500, message = "填报备注长度不能超过50") |
||||||
|
@ApiModelProperty("填报备注") |
||||||
|
private String remark; |
||||||
|
|
||||||
|
@ApiModelProperty("检查项列表") |
||||||
|
List<CarCheckItemEntity> itemList; |
||||||
|
} |
@ -0,0 +1,30 @@ |
|||||||
|
package com.hnac.hzims.safeproduct.enums; |
||||||
|
|
||||||
|
/** |
||||||
|
* 车辆保险记录状态枚举类 |
||||||
|
* |
||||||
|
* @author liwen |
||||||
|
* @date 2024-01-11 |
||||||
|
*/ |
||||||
|
public enum CarInsuranceStatusEnum { |
||||||
|
|
||||||
|
INSURED("INSURED", "已参保"), |
||||||
|
UNINSURED("UNINSURED", "未参保"); |
||||||
|
|
||||||
|
private final String value; |
||||||
|
|
||||||
|
private final String desc; |
||||||
|
|
||||||
|
CarInsuranceStatusEnum(String value, String desc) { |
||||||
|
this.value = value; |
||||||
|
this.desc = desc; |
||||||
|
} |
||||||
|
|
||||||
|
public String getValue() { |
||||||
|
return value; |
||||||
|
} |
||||||
|
|
||||||
|
public String getDesc() { |
||||||
|
return desc; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,30 @@ |
|||||||
|
package com.hnac.hzims.safeproduct.enums; |
||||||
|
|
||||||
|
/** |
||||||
|
* 车辆维保记录状态枚举类 |
||||||
|
* |
||||||
|
* @author liwen |
||||||
|
* @date 2024-01-10 |
||||||
|
*/ |
||||||
|
public enum CarMaintenanceStatusEnum { |
||||||
|
|
||||||
|
MAINTAINED("MAINTAINED", "已维保"), |
||||||
|
UNMAINTAINED("UNMAINTAINED", "未维保"); |
||||||
|
|
||||||
|
private final String value; |
||||||
|
|
||||||
|
private final String desc; |
||||||
|
|
||||||
|
CarMaintenanceStatusEnum(String value, String desc) { |
||||||
|
this.value = value; |
||||||
|
this.desc = desc; |
||||||
|
} |
||||||
|
|
||||||
|
public String getValue() { |
||||||
|
return value; |
||||||
|
} |
||||||
|
|
||||||
|
public String getDesc() { |
||||||
|
return desc; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,30 @@ |
|||||||
|
package com.hnac.hzims.safeproduct.enums; |
||||||
|
|
||||||
|
/** |
||||||
|
* 用车记录枚举类 |
||||||
|
* |
||||||
|
* @author liwen |
||||||
|
* @date 2024-01-10 |
||||||
|
*/ |
||||||
|
public enum CarUsedRecordEnum { |
||||||
|
|
||||||
|
USING("USING", "使用中"), |
||||||
|
USED("USED", "已使用"); |
||||||
|
|
||||||
|
private final String value; |
||||||
|
|
||||||
|
private final String desc; |
||||||
|
|
||||||
|
CarUsedRecordEnum(String value, String desc) { |
||||||
|
this.value = value; |
||||||
|
this.desc = desc; |
||||||
|
} |
||||||
|
|
||||||
|
public String getValue() { |
||||||
|
return value; |
||||||
|
} |
||||||
|
|
||||||
|
public String getDesc() { |
||||||
|
return desc; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,37 @@ |
|||||||
|
package com.hnac.hzims.safeproduct.vo; |
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel; |
||||||
|
import io.swagger.annotations.ApiModelProperty; |
||||||
|
import lombok.Data; |
||||||
|
|
||||||
|
import java.util.Date; |
||||||
|
|
||||||
|
/** |
||||||
|
* @author liwen |
||||||
|
* @date 2024-01-09 |
||||||
|
*/ |
||||||
|
@Data |
||||||
|
@ApiModel(value = "车检记录页面VO类") |
||||||
|
public class CarCheckRecordPageVO { |
||||||
|
|
||||||
|
@ApiModelProperty("车检记录id") |
||||||
|
private Long id; |
||||||
|
|
||||||
|
@ApiModelProperty("单位") |
||||||
|
private String unit; |
||||||
|
|
||||||
|
@ApiModelProperty("品牌") |
||||||
|
private String carBrand; |
||||||
|
|
||||||
|
@ApiModelProperty("车牌号") |
||||||
|
private String plateNumber; |
||||||
|
|
||||||
|
@ApiModelProperty("检查人") |
||||||
|
private String checker; |
||||||
|
|
||||||
|
@ApiModelProperty("检查时间") |
||||||
|
private Date checkTime; |
||||||
|
|
||||||
|
@ApiModelProperty("检查结论") |
||||||
|
private String conclusion; |
||||||
|
} |
@ -1,6 +1,6 @@ |
|||||||
package com.hnac.hzims.operational.alert.mapper; |
package com.hnac.hzims.alarm.show.mapper; |
||||||
|
|
||||||
import com.hnac.hzims.operational.alert.entity.AlarmHandleDetailEntity; |
import com.hnac.hzims.alarm.entity.AlarmHandleDetailEntity; |
||||||
import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper; |
import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper; |
||||||
|
|
||||||
/** |
/** |
@ -1,6 +1,6 @@ |
|||||||
<?xml version="1.0" encoding="UTF-8"?> |
<?xml version="1.0" encoding="UTF-8"?> |
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||||
<mapper namespace="com.hnac.hzims.operational.alert.mapper.AlarmHandleDetailMapper"> |
<mapper namespace="com.hnac.hzims.alarm.show.mapper.AlarmHandleDetailMapper"> |
||||||
|
|
||||||
|
|
||||||
</mapper> |
</mapper> |
@ -0,0 +1,51 @@ |
|||||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||||
|
<mapper namespace="com.hnac.hzims.alarm.show.mapper.AlarmHandleMapper"> |
||||||
|
|
||||||
|
|
||||||
|
<select id="selectHandlePage" resultType="com.hnac.hzims.alarm.vo.AlarmHandleVo"> |
||||||
|
SELECT H.*,HANDLE_USER,D.PHENOMENON_ID,D.ACCESS_ID,D.DELAY_TIME,D.DELAY_CAUSE, |
||||||
|
D.FALSE_ALARM_DESC,D.FILE_PATH,S.NAME AS STATION_NAME,P.CHECK_PROCESS_INSTANCE_ID,A.PROCESS_INSTANCE_ID |
||||||
|
FROM HZIMS_ALARM_HANDLE H |
||||||
|
LEFT JOIN HZIMS_ALARM_HANDLE_DETAIL D |
||||||
|
ON H.DETAIL_ID = D.ID |
||||||
|
LEFT JOIN DEV_HZIMS_OPERATION.HZIMS_STATION S |
||||||
|
ON H.STATION_CODE = S.CODE |
||||||
|
LEFT JOIN DEV_HZIMS_OPERATION.HZIMS_OPER_PHENOMENON P |
||||||
|
ON D.PHENOMENON_ID = P.ID |
||||||
|
LEFT JOIN DEV_HZIMS_OPERATION.HZIMS_OPER_ACCESS_PLAN A |
||||||
|
ON D.ACCESS_ID = A.ID |
||||||
|
<where> |
||||||
|
H.IS_DELETED = 0 |
||||||
|
<if test="param.stationCode != null"> |
||||||
|
AND H.STATION_CODE = #{param.stationCode} |
||||||
|
</if> |
||||||
|
<if test="param.handleUser != null"> |
||||||
|
AND H.CREATE_USER = #{param.handleUser} |
||||||
|
</if> |
||||||
|
<if test="param.startTime != null"> |
||||||
|
AND H.CREATE_TIME >= #{param.startTime} |
||||||
|
</if> |
||||||
|
<if test="param.endTime != null"> |
||||||
|
AND H.CREATE_TIME <= #{param.endTime} |
||||||
|
</if> |
||||||
|
<if test="param.handleWay != null"> |
||||||
|
AND H.HANDLE_WAY = #{param.handleWay} |
||||||
|
</if> |
||||||
|
</where> |
||||||
|
order by create_time desc |
||||||
|
</select> |
||||||
|
<select id="handles" resultType="java.lang.String"> |
||||||
|
SELECT HANDLER.ALARM_ID |
||||||
|
FROM HZIMS_ALARM_HANDLE HANDLER |
||||||
|
LEFT JOIN HZIMS_ALARM_HANDLE_DETAIL DETAIL |
||||||
|
ON HANDLER.DETAIL_ID = DETAIL.ID |
||||||
|
<where> |
||||||
|
HANDLER.IS_DELETED = 0 |
||||||
|
<if test="start != null and end != null"> |
||||||
|
AND HANDLER.CREATE_TIME BETWEEN #{start} AND #{end} |
||||||
|
</if> |
||||||
|
AND (DETAIL.DELAY_TIME > #{end} OR DETAIL.DELAY_TIME IS NULL) |
||||||
|
</where> |
||||||
|
</select> |
||||||
|
</mapper> |
@ -1,6 +1,7 @@ |
|||||||
package com.hnac.hzims.operational.alert.service; |
package com.hnac.hzims.alarm.show.service; |
||||||
|
|
||||||
import com.hnac.hzims.operational.alert.entity.AlarmHandleDetailEntity; |
|
||||||
|
import com.hnac.hzims.alarm.entity.AlarmHandleDetailEntity; |
||||||
import org.springblade.core.mp.base.BaseService; |
import org.springblade.core.mp.base.BaseService; |
||||||
|
|
||||||
/** |
/** |
@ -1,8 +1,8 @@ |
|||||||
package com.hnac.hzims.operational.alert.service.impl; |
package com.hnac.hzims.alarm.show.service.impl; |
||||||
|
|
||||||
import com.hnac.hzims.operational.alert.entity.AlarmHandleDetailEntity; |
import com.hnac.hzims.alarm.entity.AlarmHandleDetailEntity; |
||||||
import com.hnac.hzims.operational.alert.mapper.AlarmHandleDetailMapper; |
import com.hnac.hzims.alarm.show.mapper.AlarmHandleDetailMapper; |
||||||
import com.hnac.hzims.operational.alert.service.AlarmHandleDetailService; |
import com.hnac.hzims.alarm.show.service.AlarmHandleDetailService; |
||||||
import lombok.RequiredArgsConstructor; |
import lombok.RequiredArgsConstructor; |
||||||
import lombok.extern.slf4j.Slf4j; |
import lombok.extern.slf4j.Slf4j; |
||||||
import org.springblade.core.mp.base.BaseServiceImpl; |
import org.springblade.core.mp.base.BaseServiceImpl; |
@ -1,6 +1,6 @@ |
|||||||
package com.hnac.hzims.operational.alert.wrapper; |
package com.hnac.hzims.alarm.show.wrapper; |
||||||
|
|
||||||
import com.hnac.hzims.operational.alert.vo.AlarmHandleVo; |
import com.hnac.hzims.alarm.vo.AlarmHandleVo; |
||||||
import org.springblade.core.mp.support.BaseEntityWrapper; |
import org.springblade.core.mp.support.BaseEntityWrapper; |
||||||
import org.springblade.core.tool.utils.ObjectUtil; |
import org.springblade.core.tool.utils.ObjectUtil; |
||||||
import org.springblade.system.user.cache.UserCache; |
import org.springblade.system.user.cache.UserCache; |
@ -1,4 +1,4 @@ |
|||||||
package com.hnac.hzims.alarm.handle.mapper; |
package com.hnac.hzims.alarm.source.mapper; |
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||||
import com.hnac.hzims.alarm.entity.AlarmHistoryEntity; |
import com.hnac.hzims.alarm.entity.AlarmHistoryEntity; |
@ -1,5 +1,5 @@ |
|||||||
<?xml version="1.0" encoding="UTF-8"?> |
<?xml version="1.0" encoding="UTF-8"?> |
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||||
<mapper namespace="com.hnac.hzims.alarm.handle.mapper.AlarmHistoryMapper"> |
<mapper namespace="com.hnac.hzims.alarm.source.mapper.AlarmHistoryMapper"> |
||||||
|
|
||||||
</mapper> |
</mapper> |
@ -1,4 +1,4 @@ |
|||||||
package com.hnac.hzims.alarm.handle.service; |
package com.hnac.hzims.alarm.source.service; |
||||||
|
|
||||||
import com.hnac.hzims.alarm.entity.AlarmHistoryEntity; |
import com.hnac.hzims.alarm.entity.AlarmHistoryEntity; |
||||||
import org.springblade.core.mp.base.BaseService; |
import org.springblade.core.mp.base.BaseService; |
@ -1,4 +1,4 @@ |
|||||||
package com.hnac.hzims.alarm.handle.service; |
package com.hnac.hzims.alarm.source.service; |
||||||
|
|
||||||
import com.hnac.hzims.alarm.entity.AlarmEntity; |
import com.hnac.hzims.alarm.entity.AlarmEntity; |
||||||
|
|
@ -1,4 +1,4 @@ |
|||||||
package com.hnac.hzims.alarm.handle.service; |
package com.hnac.hzims.alarm.source.service; |
||||||
|
|
||||||
import com.hnac.hzims.alarm.entity.AlarmEntity; |
import com.hnac.hzims.alarm.entity.AlarmEntity; |
||||||
|
|
@ -1,4 +1,4 @@ |
|||||||
package com.hnac.hzims.alarm.handle.service; |
package com.hnac.hzims.alarm.source.service; |
||||||
|
|
||||||
import com.hnac.hzims.alarm.entity.AlarmEntity; |
import com.hnac.hzims.alarm.entity.AlarmEntity; |
||||||
|
|
@ -1,4 +1,4 @@ |
|||||||
package com.hnac.hzims.alarm.handle.service; |
package com.hnac.hzims.alarm.source.service; |
||||||
|
|
||||||
import com.hnac.hzims.alarm.entity.AlarmEntity; |
import com.hnac.hzims.alarm.entity.AlarmEntity; |
||||||
|
|
@ -1,4 +1,4 @@ |
|||||||
package com.hnac.hzims.alarm.handle.service; |
package com.hnac.hzims.alarm.source.service; |
||||||
|
|
||||||
import com.hnac.hzims.alarm.entity.AlarmEntity; |
import com.hnac.hzims.alarm.entity.AlarmEntity; |
||||||
|
|
@ -1,4 +1,4 @@ |
|||||||
package com.hnac.hzims.alarm.handle.service; |
package com.hnac.hzims.alarm.source.service; |
||||||
|
|
||||||
import com.hnac.hzims.alarm.entity.AlarmEntity; |
import com.hnac.hzims.alarm.entity.AlarmEntity; |
||||||
|
|
@ -1,7 +1,7 @@ |
|||||||
package com.hnac.hzims.alarm.handle.service.impl; |
package com.hnac.hzims.alarm.source.service.impl; |
||||||
|
|
||||||
import com.hnac.hzims.alarm.entity.AlarmHistoryEntity; |
import com.hnac.hzims.alarm.entity.AlarmHistoryEntity; |
||||||
import com.hnac.hzims.alarm.handle.mapper.AlarmHistoryMapper; |
import com.hnac.hzims.alarm.source.mapper.AlarmHistoryMapper; |
||||||
import lombok.AllArgsConstructor; |
import lombok.AllArgsConstructor; |
||||||
import lombok.extern.slf4j.Slf4j; |
import lombok.extern.slf4j.Slf4j; |
||||||
import org.springblade.core.mp.base.BaseService; |
import org.springblade.core.mp.base.BaseService; |
@ -1,10 +1,10 @@ |
|||||||
package com.hnac.hzims.alarm.handle.service.impl; |
package com.hnac.hzims.alarm.source.service.impl; |
||||||
|
|
||||||
import com.alibaba.fastjson.JSONObject; |
import com.alibaba.fastjson.JSONObject; |
||||||
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
||||||
import com.hnac.hzims.alarm.entity.AlarmEntity; |
import com.hnac.hzims.alarm.entity.AlarmEntity; |
||||||
import com.hnac.hzims.alarm.handle.service.DroolsAlarmService; |
import com.hnac.hzims.alarm.source.service.DroolsAlarmService; |
||||||
import com.hnac.hzims.alarm.handle.service.MessageService; |
import com.hnac.hzims.alarm.source.service.MessageService; |
||||||
import com.hnac.hzims.alarm.show.service.AlarmService; |
import com.hnac.hzims.alarm.show.service.AlarmService; |
||||||
import com.hnac.hzims.alarm.vo.ConditionAlarmVo; |
import com.hnac.hzims.alarm.vo.ConditionAlarmVo; |
||||||
import com.hnac.hzims.equipment.feign.IEmInfoClient; |
import com.hnac.hzims.equipment.feign.IEmInfoClient; |
@ -1,10 +1,10 @@ |
|||||||
package com.hnac.hzims.alarm.handle.service.impl; |
package com.hnac.hzims.alarm.source.service.impl; |
||||||
|
|
||||||
import com.alibaba.fastjson.JSONObject; |
import com.alibaba.fastjson.JSONObject; |
||||||
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
||||||
import com.hnac.hzims.alarm.entity.AlarmEntity; |
import com.hnac.hzims.alarm.entity.AlarmEntity; |
||||||
import com.hnac.hzims.alarm.handle.service.FdpAlarmService; |
import com.hnac.hzims.alarm.source.service.FdpAlarmService; |
||||||
import com.hnac.hzims.alarm.handle.service.MessageService; |
import com.hnac.hzims.alarm.source.service.MessageService; |
||||||
import com.hnac.hzims.alarm.show.service.AlarmService; |
import com.hnac.hzims.alarm.show.service.AlarmService; |
||||||
import com.hnac.hzims.alarm.vo.FdpAlarmVo; |
import com.hnac.hzims.alarm.vo.FdpAlarmVo; |
||||||
import com.hnac.hzims.message.fegin.IMessageClient; |
import com.hnac.hzims.message.fegin.IMessageClient; |
@ -1,11 +1,11 @@ |
|||||||
package com.hnac.hzims.alarm.handle.service.impl; |
package com.hnac.hzims.alarm.source.service.impl; |
||||||
|
|
||||||
import com.alibaba.fastjson.JSONObject; |
import com.alibaba.fastjson.JSONObject; |
||||||
import com.alibaba.fastjson.TypeReference; |
import com.alibaba.fastjson.TypeReference; |
||||||
import com.hnac.hzims.alarm.constants.AlarmConstants; |
import com.hnac.hzims.alarm.constants.AlarmConstants; |
||||||
import com.hnac.hzims.alarm.entity.AlarmEntity; |
import com.hnac.hzims.alarm.entity.AlarmEntity; |
||||||
import com.hnac.hzims.alarm.handle.service.LevelAlarmService; |
import com.hnac.hzims.alarm.source.service.LevelAlarmService; |
||||||
import com.hnac.hzims.alarm.handle.service.MessageService; |
import com.hnac.hzims.alarm.source.service.MessageService; |
||||||
import com.hnac.hzims.alarm.show.service.AlarmService; |
import com.hnac.hzims.alarm.show.service.AlarmService; |
||||||
import com.hnac.hzims.alarm.vo.LevelMessageVo; |
import com.hnac.hzims.alarm.vo.LevelMessageVo; |
||||||
import com.hnac.hzims.alarm.vo.LevelVo; |
import com.hnac.hzims.alarm.vo.LevelVo; |
@ -1,9 +1,9 @@ |
|||||||
package com.hnac.hzims.alarm.handle.service.impl; |
package com.hnac.hzims.alarm.source.service.impl; |
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; |
||||||
import com.hnac.hzims.alarm.config.service.AlarmConfigService; |
import com.hnac.hzims.alarm.config.service.AlarmConfigService; |
||||||
import com.hnac.hzims.alarm.entity.AlarmEntity; |
import com.hnac.hzims.alarm.entity.AlarmEntity; |
||||||
import com.hnac.hzims.alarm.handle.service.MessageService; |
import com.hnac.hzims.alarm.source.service.MessageService; |
||||||
import com.hnac.hzims.message.MessageConstants; |
import com.hnac.hzims.message.MessageConstants; |
||||||
import com.hnac.hzims.message.dto.BusinessMessageDTO; |
import com.hnac.hzims.message.dto.BusinessMessageDTO; |
||||||
import com.hnac.hzims.message.dto.SmsPushDto; |
import com.hnac.hzims.message.dto.SmsPushDto; |
@ -1,182 +0,0 @@ |
|||||||
package com.hnac.hzims.operational.alert; |
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSONObject; |
|
||||||
import com.hnac.hzims.monitor.feign.IMonitorClient; |
|
||||||
import com.hnac.hzims.operational.alert.service.AlertDefectService; |
|
||||||
import com.hnac.hzims.operational.alert.vo.AlertVo; |
|
||||||
import com.hnac.hzims.operational.station.service.IStationService; |
|
||||||
import com.hnac.hzinfo.core.push.enums.PushAudienceType; |
|
||||||
import com.hnac.hzinfo.core.push.model.PushAudience; |
|
||||||
import com.hnac.hzinfo.core.push.model.PushInfo; |
|
||||||
import com.hnac.hzinfo.core.push.model.PushPlatform; |
|
||||||
import lombok.extern.slf4j.Slf4j; |
|
||||||
import org.java_websocket.client.WebSocketClient; |
|
||||||
import org.java_websocket.handshake.ServerHandshake; |
|
||||||
import org.springblade.core.log.exception.ServiceException; |
|
||||||
import org.springblade.core.tool.utils.Func; |
|
||||||
import org.springblade.core.tool.utils.SpringUtil; |
|
||||||
import org.springblade.resource.feign.IPushClient; |
|
||||||
import org.springblade.resource.vo.PushInfoVO; |
|
||||||
import org.springblade.system.user.entity.User; |
|
||||||
import org.springframework.beans.factory.annotation.Value; |
|
||||||
|
|
||||||
import javax.net.ssl.*; |
|
||||||
import java.net.URI; |
|
||||||
import java.security.SecureRandom; |
|
||||||
import java.security.cert.X509Certificate; |
|
||||||
import java.util.Collections; |
|
||||||
import java.util.HashMap; |
|
||||||
import java.util.List; |
|
||||||
import java.util.Map; |
|
||||||
import java.util.stream.Collectors; |
|
||||||
|
|
||||||
/** |
|
||||||
* 该socket服务只能启一个微服务,启动多个微服务的话同一个信息会重复发。 |
|
||||||
* 如果operation服务需要部署多个微服务,这个alert需要分离出来作为单独的微服务部署,且只能部署一个。 |
|
||||||
* @Author: py |
|
||||||
*/ |
|
||||||
@Slf4j |
|
||||||
public class AlertWebSocketClient extends WebSocketClient { |
|
||||||
|
|
||||||
@Value("${hzims.operation.task.jgPushCode}") |
|
||||||
String jgPushCode; |
|
||||||
|
|
||||||
IStationService stationService; |
|
||||||
IPushClient pushClient; |
|
||||||
IMonitorClient monitorClient; |
|
||||||
|
|
||||||
AlertDefectService alertDefectService; |
|
||||||
|
|
||||||
public AlertWebSocketClient(URI serverUri) { |
|
||||||
super(serverUri); |
|
||||||
stationService = SpringUtil.getBean(IStationService.class); |
|
||||||
pushClient = SpringUtil.getBean(IPushClient.class); |
|
||||||
monitorClient = SpringUtil.getBean(IMonitorClient.class); |
|
||||||
alertDefectService = SpringUtil.getBean(AlertDefectService.class); |
|
||||||
if(serverUri.toString().contains("wss://")){ |
|
||||||
trustAllHosts(this); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public void onOpen(ServerHandshake handshakedata) { |
|
||||||
log.info("[websocket] 连接成功"); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@Override |
|
||||||
public void onMessage(String message) { |
|
||||||
log.info("[websocket] 收到消息={}",message); |
|
||||||
try{ |
|
||||||
// 处理信息
|
|
||||||
handleMsg(message); |
|
||||||
// 告警缺陷处理现象
|
|
||||||
handleAlertDefect(message); |
|
||||||
} |
|
||||||
catch (Exception e){ |
|
||||||
log.error(e.getMessage()); |
|
||||||
} |
|
||||||
/**自动诊断**/ |
|
||||||
this.diagnosisByMsg(message); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@Override |
|
||||||
public void onClose(int code, String reason, boolean remote) { |
|
||||||
log.info("[websocket] 退出连接={}-{}, 是否远程主动中断 = ", code , reason, remote); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@Override |
|
||||||
public void onError(Exception ex) { |
|
||||||
log.error("[websocket] onError = {}",ex.getMessage()); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
void trustAllHosts(AlertWebSocketClient appClient) { |
|
||||||
log.info("[websocket] wss 连接 ----- "); |
|
||||||
try { |
|
||||||
// wss需添加
|
|
||||||
SSLContext sslContext = SSLContext.getInstance("TLS"); |
|
||||||
sslContext.init(null, new TrustManager[] { new X509TrustManager() { |
|
||||||
|
|
||||||
@Override |
|
||||||
public void checkClientTrusted(X509Certificate[] chain, |
|
||||||
String authType) { |
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public void checkServerTrusted(X509Certificate[] chain, |
|
||||||
String authType) { |
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public X509Certificate[] getAcceptedIssuers() { |
|
||||||
return new X509Certificate[0]; |
|
||||||
} |
|
||||||
} }, new SecureRandom()); |
|
||||||
SSLSocketFactory factory = sslContext.getSocketFactory(); |
|
||||||
appClient.setSocket(factory.createSocket()); |
|
||||||
} catch (Exception e) { |
|
||||||
log.error("[websocket] trustAllHosts 错误 - " + e.toString()); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
/** |
|
||||||
* 推送信息到移动端 |
|
||||||
* @param message |
|
||||||
*/ |
|
||||||
private void handleMsg(String message){ |
|
||||||
JSONObject msg = JSONObject.parseObject(message); |
|
||||||
if(Func.isEmpty(msg.getString("soe_explain")) || Func.isEmpty(msg.getString("station"))){ |
|
||||||
return; |
|
||||||
} |
|
||||||
List<User> users = stationService.getUsersByStationId(msg.getString("station")); |
|
||||||
if(Func.isEmpty(users)){ |
|
||||||
return; |
|
||||||
} |
|
||||||
// 移动端消息推送 : 使用 用户id做TAG,前端注册用户id为TAG
|
|
||||||
PushInfoVO pushInfoVO = new PushInfoVO(); |
|
||||||
pushInfoVO.setTenantId(users.get(0).getTenantId()); |
|
||||||
PushPlatform platform = PushPlatform.all(); |
|
||||||
Map<PushAudienceType, List<String>> audienceMap = new HashMap<>(); |
|
||||||
audienceMap.put(PushAudienceType.TAG, users.stream().map(user -> user.getId().toString()).collect(Collectors.toList())); |
|
||||||
PushAudience audience = new PushAudience(false, audienceMap); |
|
||||||
PushInfo pushInfo = new PushInfo(jgPushCode |
|
||||||
, "实时告警" |
|
||||||
, msg.getString("soe_explain") |
|
||||||
, "" |
|
||||||
, null |
|
||||||
, platform |
|
||||||
, audience); |
|
||||||
pushInfoVO.setPushInfo(pushInfo); |
|
||||||
// FIXME:极光推送暂时关闭 推送消息给移动端
|
|
||||||
//pushClient.tenantPush(pushInfoVO);
|
|
||||||
log.info("[websocket] handleMsg finish ----- " + pushInfo.toString()); |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* 告警缺陷处理 |
|
||||||
* @param message |
|
||||||
*/ |
|
||||||
private void handleAlertDefect(String message) { |
|
||||||
List<AlertVo> list = Collections.singletonList(JSONObject.parseObject(message, AlertVo.class)); |
|
||||||
alertDefectService.saveAlertDefect(list); |
|
||||||
} |
|
||||||
|
|
||||||
/*** |
|
||||||
* 根据返回信息自动诊断 |
|
||||||
* @param message |
|
||||||
*/ |
|
||||||
private void diagnosisByMsg(String message){ |
|
||||||
JSONObject msg = JSONObject.parseObject(message); |
|
||||||
if(Func.isEmpty(msg.getString("station")) || Func.isEmpty(msg.getString("realid"))){ |
|
||||||
return; |
|
||||||
} |
|
||||||
/**根据station/realid进行诊断**/ |
|
||||||
monitorClient.alertAutoDiagnosis(msg.getString("realid"),msg.getString("station")); |
|
||||||
} |
|
||||||
} |
|
@ -1,44 +0,0 @@ |
|||||||
package com.hnac.hzims.operational.alert; |
|
||||||
|
|
||||||
import lombok.extern.slf4j.Slf4j; |
|
||||||
import org.java_websocket.client.WebSocketClient; |
|
||||||
import org.springblade.core.tool.utils.Func; |
|
||||||
import org.springframework.beans.factory.annotation.Value; |
|
||||||
import org.springframework.scheduling.annotation.EnableScheduling; |
|
||||||
import org.springframework.scheduling.annotation.Scheduled; |
|
||||||
import org.springframework.stereotype.Component; |
|
||||||
|
|
||||||
import java.net.URI; |
|
||||||
|
|
||||||
/** |
|
||||||
* @Author: py |
|
||||||
*/ |
|
||||||
@Slf4j |
|
||||||
@EnableScheduling |
|
||||||
@Component |
|
||||||
public class WebSocketClientManager { |
|
||||||
@Value("${hzims.alert.ws-url}") |
|
||||||
String wsUrl; |
|
||||||
|
|
||||||
WebSocketClient webSocketClient; |
|
||||||
|
|
||||||
/** |
|
||||||
* 保活,每30秒发送一次信息 |
|
||||||
*/ |
|
||||||
@Scheduled(cron="0 */1 * * * ? ") |
|
||||||
private void keepAlive(){ |
|
||||||
if(Func.isNotEmpty(webSocketClient) && webSocketClient.isOpen()){ |
|
||||||
webSocketClient.send("{\"type\":\"soe\"}"); |
|
||||||
log.info("[WebSocketClient] 发送保活信息"); |
|
||||||
} else { |
|
||||||
try { |
|
||||||
webSocketClient = new AlertWebSocketClient(new URI(wsUrl)); |
|
||||||
if(webSocketClient.connectBlocking()){ |
|
||||||
webSocketClient.send("{\"type\":\"soe\"}"); |
|
||||||
} |
|
||||||
} catch (Exception e) { |
|
||||||
log.error("[WebSocketClient] connectBlocking 错误={}",e.toString()); |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
@ -1,157 +0,0 @@ |
|||||||
package com.hnac.hzims.operational.alert.controller; |
|
||||||
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
||||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; |
|
||||||
import com.hnac.hzims.common.logs.annotation.OperationAnnotation; |
|
||||||
import com.hnac.hzims.common.logs.enums.BusinessType; |
|
||||||
import com.hnac.hzims.common.logs.enums.OperatorType; |
|
||||||
import com.hnac.hzims.operational.alert.entity.HistoryAbnormalAlarmEntity; |
|
||||||
import com.hnac.hzims.operational.alert.service.HistoryAbnormalAlarmService; |
|
||||||
import com.hnac.hzims.operational.alert.vo.AlarmParamVo; |
|
||||||
import com.hnac.hzims.operational.alert.vo.AlarmReustVo; |
|
||||||
import com.hnac.hzims.operational.alert.vo.HistoryAlarmVo; |
|
||||||
import com.hnac.hzims.operational.config.vo.AlarmDataPageVo; |
|
||||||
import com.hnac.hzims.operational.config.vo.AlarmVo; |
|
||||||
import com.hnac.hzims.operational.config.vo.IntelligentAlarmCountVo; |
|
||||||
import com.hnac.hzims.operational.station.vo.HistoryAbnormalAlarmVo; |
|
||||||
import io.swagger.annotations.Api; |
|
||||||
import io.swagger.annotations.ApiOperation; |
|
||||||
import io.swagger.annotations.ApiParam; |
|
||||||
import lombok.AllArgsConstructor; |
|
||||||
import org.springblade.core.boot.ctrl.BladeController; |
|
||||||
import org.springblade.core.log.annotation.ApiLog; |
|
||||||
import org.springblade.core.mp.support.Condition; |
|
||||||
import org.springblade.core.mp.support.Query; |
|
||||||
import org.springblade.core.tool.api.R; |
|
||||||
import org.springblade.core.tool.utils.Func; |
|
||||||
import org.springframework.web.bind.annotation.*; |
|
||||||
|
|
||||||
import javax.validation.Valid; |
|
||||||
import java.util.List; |
|
||||||
|
|
||||||
/** |
|
||||||
* @author ysj |
|
||||||
*/ |
|
||||||
@Api(tags = {"通讯中断、数据异常"}) |
|
||||||
@RestController |
|
||||||
@AllArgsConstructor |
|
||||||
@RequestMapping("/abnormal/alarm") |
|
||||||
public class AbnormalAlarmController extends BladeController { |
|
||||||
|
|
||||||
|
|
||||||
private final HistoryAbnormalAlarmService service; |
|
||||||
/** |
|
||||||
* 统计通讯中断时间 |
|
||||||
*/ |
|
||||||
@ApiLog |
|
||||||
@RequestMapping(value = "/statisticsTime", method = {RequestMethod.GET, RequestMethod.POST}) |
|
||||||
@ApiOperationSupport(order = 1) |
|
||||||
@ApiOperation(value = "统计通讯中断时间", notes = "传入imsDutyMainEntity") |
|
||||||
@OperationAnnotation(moduleName = "通讯告警统计",title = "通讯告警统计", operatorType = OperatorType.MOBILE, |
|
||||||
businessType = BusinessType.GENCODE,action = "查询通讯告警统计数据") |
|
||||||
public R<IPage<HistoryAbnormalAlarmVo>> statisticsTime(HistoryAlarmVo entity, Query query) { |
|
||||||
IPage<HistoryAbnormalAlarmVo> pages = service.getAlarmTime(query,entity); |
|
||||||
return R.data(pages); |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* 统计通讯中断二级目录查询 |
|
||||||
*/ |
|
||||||
@ApiLog |
|
||||||
@RequestMapping(value = "/queryByEntity", method = {RequestMethod.GET, RequestMethod.POST}) |
|
||||||
@ApiOperationSupport(order = 1) |
|
||||||
@ApiOperation(value = "统计通讯中断二级目录查询", notes = "传入imsDutyMainEntity") |
|
||||||
public R<IPage<HistoryAbnormalAlarmVo>> queryByEntity(HistoryAlarmVo entity, Query query) { |
|
||||||
IPage<HistoryAbnormalAlarmVo> pages = service.queryByEntity(entity,query); |
|
||||||
return R.data(pages); |
|
||||||
} |
|
||||||
|
|
||||||
@ApiLog |
|
||||||
@GetMapping("/queryStationName") |
|
||||||
@ApiOperationSupport(order = 2) |
|
||||||
@ApiOperation(value = "查询站点") |
|
||||||
public R<List<String>> queryStationName() { |
|
||||||
List<String> res = service.queryStationName(); |
|
||||||
return R.data(res); |
|
||||||
} |
|
||||||
/** |
|
||||||
* 详情 |
|
||||||
*/ |
|
||||||
@ApiLog |
|
||||||
@RequestMapping(value = "/detail", method = {RequestMethod.GET, RequestMethod.POST}) |
|
||||||
@ApiOperationSupport(order = 3) |
|
||||||
@ApiOperation(value = "详情", notes = "传入HistoryAbnormalAlarmEntity") |
|
||||||
public R<HistoryAbnormalAlarmEntity> detail(HistoryAbnormalAlarmEntity entity) { |
|
||||||
HistoryAbnormalAlarmEntity detail = service.getOne(Condition.getQueryWrapper(entity)); |
|
||||||
return R.data(detail); |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* 分页 |
|
||||||
*/ |
|
||||||
@ApiLog |
|
||||||
@GetMapping("/list") |
|
||||||
@ApiOperationSupport(order = 4) |
|
||||||
@ApiOperation(value = "分页", notes = "传入HistoryAbnormalAlarmEntity") |
|
||||||
public R<IPage<HistoryAbnormalAlarmEntity>> list(HistoryAbnormalAlarmEntity entity, Query query) { |
|
||||||
IPage<HistoryAbnormalAlarmEntity> pages = service.page(Condition.getPage(query), Condition.getQueryWrapper(entity)); |
|
||||||
return R.data(pages); |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* 新增或修改 |
|
||||||
*/ |
|
||||||
@PostMapping("/submit") |
|
||||||
@ApiOperationSupport(order = 5) |
|
||||||
@ApiOperation(value = "新增或修改", notes = "传入HistoryAbnormalAlarmEntity") |
|
||||||
public R submit(@Valid @RequestBody HistoryAbnormalAlarmEntity entity) { |
|
||||||
return R.status(service.saveOrUpdate(entity)); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
/** |
|
||||||
* 删除 |
|
||||||
*/ |
|
||||||
@PostMapping("/remove") |
|
||||||
@ApiOperationSupport(order = 6) |
|
||||||
@ApiOperation(value = "逻辑删除", notes = "传入ids") |
|
||||||
public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) { |
|
||||||
return R.status(service.deleteLogic(Func.toLongList(ids))); |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* |
|
||||||
*/ |
|
||||||
@ApiLog |
|
||||||
@ApiOperation(value = "原始告警接口") |
|
||||||
@ApiOperationSupport(order = 7) |
|
||||||
@RequestMapping(value = "/alarms", method = {RequestMethod.GET, RequestMethod.POST}) |
|
||||||
public R<AlarmReustVo> alarms(AlarmParamVo param){ |
|
||||||
return R.data(service.alarms(param)); |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* 智能告警数量: 时间范围当天 |
|
||||||
*/ |
|
||||||
@ApiLog |
|
||||||
@ApiOperation(value = "智能告警数量") |
|
||||||
@ApiOperationSupport(order = 8) |
|
||||||
@RequestMapping(value = "/count", method = {RequestMethod.GET, RequestMethod.POST}) |
|
||||||
public R<List<IntelligentAlarmCountVo>> count(){ |
|
||||||
return R.data(service.alarmCount()); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
/** |
|
||||||
* 智能告警数据: 时间范围当天 |
|
||||||
*/ |
|
||||||
@ApiLog |
|
||||||
@ApiOperation(value = "智能告警数据") |
|
||||||
@ApiOperationSupport(order = 9) |
|
||||||
@RequestMapping(value = "/data", method = RequestMethod.GET) |
|
||||||
public R<IPage<AlarmVo>> data(AlarmDataPageVo page,Query query) { |
|
||||||
return R.data(service.alarmData(page,query)); |
|
||||||
} |
|
||||||
|
|
||||||
} |
|
@ -1,67 +0,0 @@ |
|||||||
package com.hnac.hzims.operational.alert.controller; |
|
||||||
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
||||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; |
|
||||||
import com.hnac.hzims.operational.alert.entity.HistoryLevelAlarmEntity; |
|
||||||
import com.hnac.hzims.operational.alert.service.HistoryLevelAlarmService; |
|
||||||
import com.hnac.hzims.operational.config.vo.IntelligentAlarmCountVo; |
|
||||||
import io.swagger.annotations.Api; |
|
||||||
import io.swagger.annotations.ApiOperation; |
|
||||||
import io.swagger.annotations.ApiParam; |
|
||||||
import lombok.AllArgsConstructor; |
|
||||||
import org.springblade.core.boot.ctrl.BladeController; |
|
||||||
import org.springblade.core.log.annotation.ApiLog; |
|
||||||
import org.springblade.core.mp.support.Query; |
|
||||||
import org.springblade.core.tool.api.R; |
|
||||||
import org.springblade.core.tool.utils.Func; |
|
||||||
import org.springframework.web.bind.annotation.*; |
|
||||||
|
|
||||||
import java.util.List; |
|
||||||
|
|
||||||
/** |
|
||||||
* @author ysj |
|
||||||
*/ |
|
||||||
@Api(tags = {"等级告警"}) |
|
||||||
@RestController |
|
||||||
@AllArgsConstructor |
|
||||||
@RequestMapping("/level/alarm") |
|
||||||
public class LevelAlarmController extends BladeController { |
|
||||||
|
|
||||||
private HistoryLevelAlarmService service; |
|
||||||
|
|
||||||
/** |
|
||||||
* 分页 |
|
||||||
*/ |
|
||||||
@ApiLog |
|
||||||
@GetMapping("/list") |
|
||||||
@ApiOperationSupport(order = 1) |
|
||||||
@ApiOperation(value = "分页", notes = "传入HistoryAbnormalAlarmEntity") |
|
||||||
public R<IPage<HistoryLevelAlarmEntity>> list(HistoryLevelAlarmEntity entity, Query query) { |
|
||||||
IPage<HistoryLevelAlarmEntity> pages = service.pageCondition(query, entity); |
|
||||||
return R.data(pages); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
/** |
|
||||||
* 删除 |
|
||||||
*/ |
|
||||||
@PostMapping("/remove") |
|
||||||
@ApiOperationSupport(order = 2) |
|
||||||
@ApiOperation(value = "逻辑删除", notes = "传入ids") |
|
||||||
public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) { |
|
||||||
return R.status(service.deleteLogic(Func.toLongList(ids))); |
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* 智能告警数量: 时间范围当天 |
|
||||||
*/ |
|
||||||
@ApiLog |
|
||||||
@ApiOperation(value = "智能告警数量") |
|
||||||
@ApiOperationSupport(order = 3) |
|
||||||
@RequestMapping(value = "/count", method = {RequestMethod.GET, RequestMethod.POST}) |
|
||||||
public R<List<IntelligentAlarmCountVo>> count(){ |
|
||||||
return R.data(service.alarmCount()); |
|
||||||
} |
|
||||||
|
|
||||||
} |
|
@ -1,17 +0,0 @@ |
|||||||
package com.hnac.hzims.operational.alert.mapper; |
|
||||||
|
|
||||||
import com.hnac.hzims.operational.alert.entity.AbnormalAlarmEntity; |
|
||||||
import org.apache.ibatis.annotations.Param; |
|
||||||
import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper; |
|
||||||
|
|
||||||
import java.util.List; |
|
||||||
|
|
||||||
/** |
|
||||||
* @author YSJ |
|
||||||
*/ |
|
||||||
public interface AbnormalAlarmMapper extends UserDataScopeBaseMapper<AbnormalAlarmEntity> { |
|
||||||
|
|
||||||
AbnormalAlarmEntity getAbnormalAlarm(@Param("stationId") String stationId,@Param("type") String type); |
|
||||||
|
|
||||||
List<String> getAbnormalAlarmList(); |
|
||||||
} |
|
@ -1,17 +0,0 @@ |
|||||||
<?xml version="1.0" encoding="UTF-8"?> |
|
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|
||||||
<mapper namespace="com.hnac.hzims.operational.alert.mapper.AbnormalAlarmMapper"> |
|
||||||
|
|
||||||
<select id="getAbnormalAlarm" resultType="com.hnac.hzims.operational.alert.entity.AbnormalAlarmEntity"> |
|
||||||
select * from hzims_abnormal_alarm |
|
||||||
where station_id = #{stationId} |
|
||||||
and type = #{type} |
|
||||||
and is_deleted = 0 |
|
||||||
</select> |
|
||||||
<select id="getAbnormalAlarmList" resultType="java.lang.String"> |
|
||||||
select distinct station_id from hzims_abnormal_alarm |
|
||||||
where is_deleted = 0 |
|
||||||
and type in (13,14) |
|
||||||
and `STATUS` = 0 |
|
||||||
</select> |
|
||||||
</mapper> |
|
@ -1,57 +0,0 @@ |
|||||||
<?xml version="1.0" encoding="UTF-8"?> |
|
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|
||||||
<mapper namespace="com.hnac.hzims.operational.alert.mapper.AlarmHandleMapper"> |
|
||||||
|
|
||||||
|
|
||||||
<select id="selectHandlePage" resultType="com.hnac.hzims.operational.alert.vo.AlarmHandleVo"> |
|
||||||
select h.*,handle_user,d.phenomenon_id,d.access_id,d.delay_time,d.delay_cause, |
|
||||||
d.false_alarm_desc,d.file_path,s.name as station_name,p.check_process_instance_id,a.process_instance_id |
|
||||||
from hzims_alarm_handle h |
|
||||||
left join hzims_alarm_handle_detail d |
|
||||||
on h.detail_id = d.id |
|
||||||
left join hzims_station s |
|
||||||
on h.station_code = s.code |
|
||||||
left join hzims_oper_phenomenon p |
|
||||||
on d.PHENOMENON_ID = p.id |
|
||||||
left join hzims_oper_access_plan a |
|
||||||
on d.access_id = a.id |
|
||||||
<where> |
|
||||||
h.is_deleted = 0 |
|
||||||
<if test="param.stationCode != null"> |
|
||||||
and h.station_code = #{param.stationCode} |
|
||||||
</if> |
|
||||||
<if test="param.handleUser != null"> |
|
||||||
and h.create_user = #{param.handleUser} |
|
||||||
</if> |
|
||||||
<if test="param.startTime != null"> |
|
||||||
and h.create_time >= #{param.startTime} |
|
||||||
</if> |
|
||||||
<if test="param.endTime != null"> |
|
||||||
and h.create_time <= #{param.endTime} |
|
||||||
</if> |
|
||||||
<if test="param.handleWay != null"> |
|
||||||
and h.handle_way = #{param.handleWay} |
|
||||||
</if> |
|
||||||
</where> |
|
||||||
order by create_time desc |
|
||||||
</select> |
|
||||||
<select id="handles" resultType="com.hnac.hzims.operational.alert.entity.AlarmHandleEntity"> |
|
||||||
select handler.* |
|
||||||
from hzims_alarm_handle handler |
|
||||||
left join hzims_alarm_handle_detail detail |
|
||||||
on handler.detail_id = detail.id |
|
||||||
<where> |
|
||||||
handler.is_deleted = 0 |
|
||||||
<if test="types != null and types.size > 0"> |
|
||||||
and alarm_type in |
|
||||||
<foreach collection="types" item="type" index="index" open="(" close=")" separator=","> |
|
||||||
#{type} |
|
||||||
</foreach> |
|
||||||
</if> |
|
||||||
<if test="start != null and end != null"> |
|
||||||
and handler.create_time between #{start} and #{end} |
|
||||||
</if> |
|
||||||
and (detail.DELAY_TIME > #{end} or detail.DELAY_TIME is null) |
|
||||||
</where> |
|
||||||
</select> |
|
||||||
</mapper> |
|
@ -1,13 +0,0 @@ |
|||||||
package com.hnac.hzims.operational.alert.mapper; |
|
||||||
|
|
||||||
import com.hnac.hzims.operational.alert.entity.AlertDefectConfigEntity; |
|
||||||
|
|
||||||
import java.util.List; |
|
||||||
|
|
||||||
/** |
|
||||||
* @author YSJ |
|
||||||
*/ |
|
||||||
public interface AlertDefectConfigMapper { |
|
||||||
|
|
||||||
List<AlertDefectConfigEntity> getConfigAll(); |
|
||||||
} |
|
@ -1,8 +0,0 @@ |
|||||||
<?xml version="1.0" encoding="UTF-8"?> |
|
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|
||||||
<mapper namespace="com.hnac.hzims.operational.alert.mapper.AlertDefectConfigMapper"> |
|
||||||
|
|
||||||
<select id="getConfigAll" resultType="com.hnac.hzims.operational.alert.entity.AlertDefectConfigEntity"> |
|
||||||
select * from hzims_alert_defect_config |
|
||||||
</select> |
|
||||||
</mapper> |
|
@ -1,26 +0,0 @@ |
|||||||
package com.hnac.hzims.operational.alert.mapper; |
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
||||||
import com.hnac.hzims.operational.alert.entity.AbnormalAlarmEntity; |
|
||||||
import com.hnac.hzims.operational.alert.entity.HistoryAbnormalAlarmEntity; |
|
||||||
import com.hnac.hzims.operational.station.vo.HistoryAbnormalAlarmVo; |
|
||||||
import com.hnac.hzims.spare.vo.SpReceiveVO; |
|
||||||
import org.apache.ibatis.annotations.Param; |
|
||||||
import org.springblade.core.datascope.mapper.UserDataScopeBaseMapper; |
|
||||||
|
|
||||||
import java.util.Date; |
|
||||||
import java.util.List; |
|
||||||
|
|
||||||
/** |
|
||||||
* @author YSJ |
|
||||||
*/ |
|
||||||
public interface HistoryAbnormalAlarmMapper extends UserDataScopeBaseMapper<HistoryAbnormalAlarmEntity> { |
|
||||||
|
|
||||||
List<HistoryAbnormalAlarmEntity> getHistoryAbnormalAlarm(@Param("stationId") String stationId,@Param("type") String type); |
|
||||||
|
|
||||||
List<HistoryAbnormalAlarmVo> selectPageList(IPage<HistoryAbnormalAlarmVo> page, String type, List<String> stations); |
|
||||||
|
|
||||||
List<HistoryAbnormalAlarmEntity> getAlarmEntity(@Param("type") String type,@Param("stationName") List<String> stationName,@Param("startTime") Date startTime,@Param("endTime") Date endTime); |
|
||||||
|
|
||||||
List<String> getStationName(); |
|
||||||
} |
|
@ -1,49 +0,0 @@ |
|||||||
<?xml version="1.0" encoding="UTF-8"?> |
|
||||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|
||||||
<mapper namespace="com.hnac.hzims.operational.alert.mapper.HistoryAbnormalAlarmMapper"> |
|
||||||
|
|
||||||
<select id="getHistoryAbnormalAlarm" resultType="com.hnac.hzims.operational.alert.entity.HistoryAbnormalAlarmEntity"> |
|
||||||
select * from hzims_history_abnormal_alarm |
|
||||||
where station_id = #{stationId} |
|
||||||
and type = #{type} |
|
||||||
and status = 0 |
|
||||||
</select> |
|
||||||
|
|
||||||
<select id="selectPageList" resultType="com.hnac.hzims.operational.station.vo.HistoryAbnormalAlarmVo"> |
|
||||||
select * from hzims_history_abnormal_alarm |
|
||||||
where status = 0 |
|
||||||
<if test="type != null and type != ''"> |
|
||||||
and type = #{type} |
|
||||||
</if> |
|
||||||
<if test="stations != null"> |
|
||||||
and station_id in |
|
||||||
<foreach collection="stations" item="item" open="(" close=")" separator="," > |
|
||||||
#{item} |
|
||||||
</foreach> |
|
||||||
</if> |
|
||||||
</select> |
|
||||||
|
|
||||||
<select id="getStationName" resultType="java.lang.String"> |
|
||||||
select distinct STATION_NAME from hzims_history_abnormal_alarm |
|
||||||
</select> |
|
||||||
|
|
||||||
<select id="getAlarmEntity" resultType="com.hnac.hzims.operational.alert.entity.HistoryAbnormalAlarmEntity"> |
|
||||||
select * from hzims_history_abnormal_alarm |
|
||||||
where is_deleted = 0 |
|
||||||
<if test="type != null and type != ''"> |
|
||||||
and type = #{type} |
|
||||||
</if> |
|
||||||
<if test="stationName != null"> |
|
||||||
and station_name in |
|
||||||
<foreach collection="stationName" item="item" open="(" close=")" separator="," > |
|
||||||
#{item} |
|
||||||
</foreach> |
|
||||||
</if> |
|
||||||
<if test="startTime != null"> |
|
||||||
and start_time > #{startTime} |
|
||||||
</if> |
|
||||||
<if test="endTime != null"> |
|
||||||
and end_time <= #{endTime} |
|
||||||
</if> |
|
||||||
</select> |
|
||||||
</mapper> |
|
@ -1,11 +0,0 @@ |
|||||||
package com.hnac.hzims.operational.alert.mapper; |
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
|
||||||
import com.hnac.hzims.operational.alert.entity.HistoryLevelAlarmEntity; |
|
||||||
|
|
||||||
/** |
|
||||||
* @author YSJ |
|
||||||
*/ |
|
||||||
public interface HistoryLevelAlarmMapper extends BaseMapper<HistoryLevelAlarmEntity> { |
|
||||||
|
|
||||||
} |
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue