Commit 3d4be07d authored by 单奇雲's avatar 单奇雲

冲突

parents 13dcc79b 42a577ae
......@@ -59,3 +59,4 @@ public enum ManageLevelEum {
this.manageLevel = manageLevel;
}
}
......@@ -9,7 +9,8 @@ public enum TriggerRpnChangeTypeEum {
* 触发类型枚举
*/
patrol("巡检","patrol"),
equipment("设备告警","equipment"),
alarm("设备告警","alarm"),
alarmRecovery("设备告警恢复","recovery"),
fmeaUpdate("危险因素评价","fmeaUpdate"),
fmeaDelete("危险因素删除","fmeaDelete"),
riskDelete("风险点删除","riskDelete");
......
......@@ -18,53 +18,79 @@ import java.util.Date;
@NamedQuery(name = "Alarm.findAll", query = "SELECT a FROM Alarm a")
public class Alarm extends BasicEntity {
private static final long serialVersionUID = 1L;
@Temporal(TemporalType.TIMESTAMP)
@Column(name = "alarm_time")
private Date alarmTime;
/**
* 指标或者报警信息
* 消防设备id
*/
@Lob
private String metric;
private String code;
@Column(name = "fire_equipment_id")
private Long fireEquipmentId;
/**
* 消防设备名称
*/
@Column(name = "fire_equipment_name")
private String fireEquipmentName;
/**
* 消防设备编码
*/
@Column(name = "fire_equipment_code")
private String fireEquipmentCode;
/**
* 消防点位id
*/
@Column(name = "fire_equipment_point_id")
private Long fireEquipmentPointId;
/**
* 消防点位名称
*/
@Column(name = "fire_equipment_point_name")
private String fireEquipmentPointName;
/**
* 消防点位编码
*/
@Column(name = "fire_equipment_point_code")
private String fireEquipmentPointCode;
/**
* 消防点位上传值
*/
@Column(name = "fire_equipment_point_value")
private String fireEquipmentPointValue;
/**
* 发生频率
*/
@Column(name = "frequency")
private int frequency = 1;
/**
* 告警状态
*/
@Column(name = "status")
private Boolean status = true;
/**
* 报警类型:alarm_type_fire(火灾报警)/alarm_type_trouble(故障告警)
*/
@Column(name = "type")
private String type;
/**
* 创建时间
*/
@Column(name = "create_date")
private Date createDate = new Date();
/**
* 更新时间
*/
@Column(name = "update_date")
private Date updateDate = new Date();
/**
* 报警类别
* 告警恢复时间
*/
@Column(name = "alarm_type")
private String alarmType;
@Column(name = "recovery_date")
private Date recoveryDate;
@Column(name = "fire_equipment_id")
private Long fireEquipmentId;
@Column(name = "org_code")
private String orgCode;
private String remark;
public Alarm() {
}
public Date getAlarmTime() {
return this.alarmTime;
}
public void setAlarmTime(Date alarmTime) {
this.alarmTime = alarmTime;
}
public String getCode() {
return this.code;
}
public void setCode(String code) {
this.code = code;
}
public Long getFireEquipmentId() {
return this.fireEquipmentId;
}
......@@ -81,28 +107,99 @@ public class Alarm extends BasicEntity {
this.orgCode = orgCode;
}
public String getRemark() {
return this.remark;
}
public String getFireEquipmentName() {
return fireEquipmentName;
}
public void setRemark(String remark) {
this.remark = remark;
}
public void setFireEquipmentName(String fireEquipmentName) {
this.fireEquipmentName = fireEquipmentName;
}
public String getMetric() {
return metric;
}
public String getFireEquipmentCode() {
return fireEquipmentCode;
}
public void setMetric(String metric) {
this.metric = metric;
}
public void setFireEquipmentCode(String fireEquipmentCode) {
this.fireEquipmentCode = fireEquipmentCode;
}
public String getAlarmType() {
return alarmType;
}
public Long getFireEquipmentPointId() {
return fireEquipmentPointId;
}
public void setAlarmType(String alarmType) {
this.alarmType = alarmType;
}
public void setFireEquipmentPointId(Long fireEquipmentPointId) {
this.fireEquipmentPointId = fireEquipmentPointId;
}
public String getFireEquipmentPointName() {
return fireEquipmentPointName;
}
public void setFireEquipmentPointName(String fireEquipmentPointName) {
this.fireEquipmentPointName = fireEquipmentPointName;
}
public String getFireEquipmentPointCode() {
return fireEquipmentPointCode;
}
public void setFireEquipmentPointCode(String fireEquipmentPointCode) {
this.fireEquipmentPointCode = fireEquipmentPointCode;
}
public String getFireEquipmentPointValue() {
return fireEquipmentPointValue;
}
public void setFireEquipmentPointValue(String fireEquipmentPointValue) {
this.fireEquipmentPointValue = fireEquipmentPointValue;
}
public int getFrequency() {
return frequency;
}
public void setFrequency(int frequency) {
this.frequency = frequency;
}
public Boolean getStatus() {
return status;
}
public void setStatus(Boolean status) {
this.status = status;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public Date getCreateDate() {
return createDate;
}
public void setCreateDate(Date createDate) {
this.createDate = createDate;
}
public Date getUpdateDate() {
return updateDate;
}
public void setUpdateDate(Date updateDate) {
this.updateDate = updateDate;
}
public Date getRecoveryDate() {
return recoveryDate;
}
public void setRecoveryDate(Date recoveryDate) {
this.recoveryDate = recoveryDate;
}
}
\ No newline at end of file
package com.yeejoin.amos.fas.dao.entity;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;
import java.math.BigDecimal;
import java.util.Date;
......@@ -39,7 +42,8 @@ public class FireEquipment extends BasicEntity {
@Column(name="create_by")
private String createBy;
@Temporal(TemporalType.DATE)
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd")
@Column(name="effective_date")
private Date effectiveDate;
......@@ -66,7 +70,8 @@ public class FireEquipment extends BasicEntity {
@Column(name="production_area")
private String productionArea;
@Temporal(TemporalType.DATE)
@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd")
@Column(name="production_date")
private Date productionDate;
......
......@@ -95,14 +95,6 @@ public class RiskSource extends BasicEntity {
return rpni;
}
public Integer getFlickerFrequency() {
return flickerFrequency;
}
public void setFlickerFrequency(Integer flickerFrequency) {
this.flickerFrequency = flickerFrequency;
}
public void setRpni(BigDecimal rpni) {
this.rpni = rpni;
}
......@@ -111,6 +103,14 @@ public class RiskSource extends BasicEntity {
return increment;
}
public Integer getFlickerFrequency() {
return flickerFrequency;
}
public void setFlickerFrequency(Integer flickerFrequency) {
this.flickerFrequency = flickerFrequency;
}
public void setIncrement(BigDecimal increment) {
this.increment = increment;
}
......
......@@ -32,6 +32,7 @@ public class RpnChangeLog extends BasicEntity {
/**
* 触发变化类型(巡检、告警、评价、删除)
* 变化类型(巡检、评价、告警)
*/
@Column(name = "trigger_type")
private String triggerType;
......
package com.yeejoin.amos.fas.business.action;
public interface CustomerAction {
}
package com.yeejoin.amos.fas.business.action.result;
import com.yeejoin.amos.fas.business.service.model.ToipResponse;
import com.yeejoin.amos.fas.dao.entity.BusinessEntity;
public abstract class AbstractActionResult implements ActionResult{
public ToipResponse toipResponse;
/**
* 智能体业务对象
*/
private BusinessEntity bizObj;
public ToipResponse getToipResponse() {
return toipResponse;
}
public void setToipResponse(ToipResponse toipResponse) {
this.toipResponse = toipResponse;
}
public BusinessEntity getBizObj() {
return bizObj;
}
public void setBizObj(BusinessEntity bizObj) {
this.bizObj = bizObj;
}
}
package com.yeejoin.amos.fas.business.action.result;
import java.util.List;
import com.alibaba.fastjson.JSON;
public interface ActionResult
{
public JSON toJson();
public void addAll(List<Object> data);
public void add(Object data);
public List<?> getData();
}
package com.yeejoin.amos.fas.business.action.result;
import java.util.HashMap;
import java.util.Map;
import com.alibaba.fastjson.JSON;
public class BubbleTipResult extends SimpleResult{
@Override
public JSON toJson() {
// TODO Auto-generated method stub
Map<String, Object> results = new HashMap<>();
for (Map<String, Object> tempMap : data)
{
for (Map.Entry<String, Object> entry : tempMap.entrySet())
{
results.put(entry.getKey(), entry.getValue());
}
}
return (JSON) JSON.toJSON(results);
}
}
package com.yeejoin.amos.fas.business.action.result;
import java.util.HashMap;
import java.util.Map;
import com.alibaba.fastjson.JSON;
public class RiskSituationResult extends SimpleResult{
@Override
public JSON toJson() {
// TODO Auto-generated method stub
Map<String, Object> results = new HashMap<>();
for (Map<String, Object> tempMap : data)
{
for (Map.Entry<String, Object> entry : tempMap.entrySet())
{
results.put(entry.getKey(), entry.getValue());
}
}
return (JSON) JSON.toJSON(results);
}
}
package com.yeejoin.amos.fas.business.action.result;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.alibaba.fastjson.JSON;
import com.yeejoin.amos.fas.business.util.JSONUtil;
public class SimpleResult extends AbstractActionResult implements ActionResult
{
List<Map<String, Object>> data = new ArrayList<>();
@Override
public JSON toJson()
{
List<Map<String, Object>> results = new ArrayList<>();
for (Map<String, Object> tempMap : data)
{
for (Map.Entry<String, Object> entry : tempMap.entrySet())
{
Map<String,Object> result = new HashMap<>();
result.put("label", entry.getKey());
result.put("value", entry.getValue());
results.add(result);
}
}
return (JSON) JSON.toJSON(results);
}
@Override
public void addAll(List<Object> data)
{
// this.data.addAll((Collection<? extends Map<String, Object>>) data);
}
@Override
public void add(Object data)
{
this.data.add(JSONUtil.toMap(JSONUtil.toJson(data)));
}
public void add(String key,Object value)
{
Map<String, Object> map = new HashMap<>();
map.put(key, value);
this.data.add(map);
}
@Override
public List<Map<String, Object>> getData() {
// TODO Auto-generated method stub
return data;
}
}
package com.yeejoin.amos.fas.business.action.result;
import java.util.HashMap;
import java.util.Map;
import com.alibaba.fastjson.JSON;
public class TipResult extends SimpleResult{
@Override
public JSON toJson() {
// TODO Auto-generated method stub
Map<String, Object> results = new HashMap<>();
for (Map<String, Object> tempMap : data)
{
for (Map.Entry<String, Object> entry : tempMap.entrySet())
{
results.put(entry.getKey(), entry.getValue());
}
}
return (JSON) JSON.toJSON(results);
}
}
package com.yeejoin.amos.fas.business.action.result.message;
import java.io.IOException;
import com.yeejoin.amos.fas.business.action.result.AbstractActionResult;
import com.yeejoin.amos.fas.business.action.result.ActionResult;
import com.yeejoin.amos.fas.business.action.websocket.RuleWebSocket;
import com.yeejoin.amos.fas.business.service.model.ToipResponse;
import com.yeejoin.amos.fas.business.util.Constants;
import com.yeejoin.amos.fas.core.util.CommonResponse;
public abstract class AbstractActionResultMessage<R extends ToipResponse>
implements ActionResultMessage<ToipResponse>
{
protected ActionResult actionResult;
@Override
public ToipResponse execute(String firstStr, String secondStr,
String thirdStr) throws IOException, Exception
{
ToipResponse response = buildResponse(firstStr, secondStr, thirdStr,
getActionResultByDataFormat() == null ? actionResult.getData(): getActionResultByDataFormat(),
actionResult);
if (!actionResult.getData().isEmpty())
{
sendResponse(response);
}
return response;
}
protected abstract Object getActionResultByDataFormat();
/**
*
* <pre>
* 构建对象
* </pre>
*
* @param viewTemp
* @param obj
* @return
*/
public ToipResponse buildResponse(String firstIfDomain,
String secondIfDomain, String thirdIfDomain, Object obj,
ActionResult actionResult)
{
ToipResponse toipResponse = new ToipResponse();
toipResponse.setIFDomain(firstIfDomain);
toipResponse.setTemplate(secondIfDomain + "_" + thirdIfDomain);
toipResponse.setGroup("");// group值暂填充至temolate中
// toipResponse.setActionId(ruleAction.getId());
// toipResponse.setBizId(
// ((AbstractActionResult) actionResult).getBizObj().getId());
toipResponse
.setBizObj(((AbstractActionResult) actionResult).getBizObj());
toipResponse.setResult(Constants.RESULT_SUCCESS);
toipResponse.setDataList(obj);
return toipResponse;
}
/**
*
* <pre>
* 发送数据
* </pre>
*
* @param response
* @throws IOException
* @throws Exception
*/
protected void sendResponse(CommonResponse response)
throws IOException, Exception
{
RuleWebSocket.sendInfo(response.toJsonStr());
System.out.println("数据发送成功>>>>>>>>" + response.toJsonStr());
}
}
package com.yeejoin.amos.fas.business.action.result.message;
import java.io.IOException;
public interface ActionResultMessage<T> {
/**
*
* <pre>
*
* </pre>
*
* @param firstStr 一级界面域
* @param secondStr 二级界面域
* @param thirdStr 三级界面域
* @return
* @throws IOException
* @throws Exception
*/
T execute(String firstStr, String secondStr, String thirdStr) throws IOException, Exception ;
}
package com.yeejoin.amos.fas.business.action.result.message;
import com.yeejoin.amos.fas.business.action.result.ActionResult;
/**
*
* <pre>
* 气泡消息提示
* </pre>
*
* @author amos
* @version $Id: BubbleTipResultMessage.java, v 0.1 2019年5月16日 下午1:52:36 amos Exp $
*/
public class BubbleTipResultMessage extends SimpleResultMessage{
public BubbleTipResultMessage(ActionResult actionResult) {
super(actionResult);
// TODO Auto-generated constructor stub
}
}
package com.yeejoin.amos.fas.business.action.result.message;
import com.yeejoin.amos.fas.business.action.result.ActionResult;
/**
*
* <pre>
* 气泡消息提示
* </pre>
*
* @author amos
* @version $Id: BubbleTipResultMessage.java, v 0.1 2019年5月16日 下午1:52:36 amos Exp $
*/
public class RiskSituationResultMessage extends SimpleResultMessage{
public RiskSituationResultMessage(ActionResult actionResult) {
super(actionResult);
// TODO Auto-generated constructor stub
}
}
package com.yeejoin.amos.fas.business.action.result.message;
import com.yeejoin.amos.fas.business.action.result.ActionResult;
import com.yeejoin.amos.fas.business.service.model.ToipResponse;
/**
*
* <pre>
* 简单文本输入
* </pre>
*
* @author amos
* @version $Id: SimpleResultMessage.java, v 0.1 2019年4月25日 下午1:57:33 amos Exp $
*/
public class SimpleResultMessage extends AbstractActionResultMessage<ToipResponse>
{
public SimpleResultMessage(ActionResult actionResult) {
this.actionResult = actionResult;
}
@Override
protected Object getActionResultByDataFormat() {
return actionResult.toJson();
}
}
package com.yeejoin.amos.fas.business.action.result.message;
import com.yeejoin.amos.fas.business.action.result.ActionResult;
/**
*
* <pre>
* 消息提示
* </pre>
*
* @author amos
* @version $Id: TipResultMessage.java, v 0.1 2019年4月25日 上午11:47:13 amos Exp $
*/
public class TipResultMessage extends SimpleResultMessage{
public TipResultMessage(ActionResult actionResult) {
super(actionResult);
// TODO Auto-generated constructor stub
}
}
package com.yeejoin.amos.fas.business.action.util;
import java.lang.annotation.Annotation;
import java.lang.reflect.AnnotatedElement;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.ArrayList;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
*
* <pre>
* 反射工具类
* </pre>
*
* @author HK
* @version $Id: ReflectUtil.java, v 0.1 2017年12月25日 下午8:05:45 HK Exp $
*/
public class ReflectUtil
{
private final static Logger logger = LoggerFactory
.getLogger(ReflectUtil.class);
/**
*
* <pre>
* 设置属性值
* </pre>
*
* @param target
* 目标对象
* @param fname
* 字段名称
* @param ftype
* 字典类型
* @param fvalue
* 字段值
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
public static void setFieldValue(Object target, String fname, Class ftype,
Object fvalue)
{ // 设置字段值 如:username 字段,setUsername(String username)
if (target == null || fname == null || "".equals(fname)
|| (fvalue != null
&& !ftype.isAssignableFrom(fvalue.getClass())))
{// 如果类型不匹配,直接退出
return;
}
Class clazz = target.getClass();
try
{ // 先通过setXxx()方法设置类属性值
String methodname = "set" + Character.toUpperCase(fname.charAt(0))
+ fname.substring(1);
// System.out.println(methodname);
Method method = clazz.getDeclaredMethod(methodname, ftype); // 获取定义的方法
if (!Modifier.isPublic(method.getModifiers()))
{ // 设置非共有方法权限
method.setAccessible(true);
}
method.invoke(target, fvalue); // 执行方法回调
}
catch (Exception me)
{// 如果set方法不存在,则直接设置类属性值
try
{
Field field = clazz.getDeclaredField(fname); // 获取定义的类属性
if (!Modifier.isPublic(field.getModifiers()))
{ // 设置非共有类属性权限
field.setAccessible(true);
}
field.set(target, fvalue); // 设置类属性值
}
catch (Exception fe)
{
if (logger.isDebugEnabled())
{
logger.debug(fe.getMessage());
}
}
}
}
/**
*
* <pre>
* 获取属性值
* </pre>
*
* @param target
* 目标对象
* @param fname
* 字段名称
* @param ftype
* 字段类型
* @return
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
public static Object getFieldValue(Object target, String fname, Class ftype)
{// 获取字段值 如:username 字段,getUsername()
if (target == null || fname == null || "".equals(fname))
{
return null;
}
Class clazz = target.getClass();
try
{ // 先通过getXxx()方法获取类属性值
String methodname = "get" + Character.toUpperCase(fname.charAt(0))
+ fname.substring(1);
// System.out.println(methodname);
Method method = clazz.getDeclaredMethod(methodname); // 获取定义的方法
if (!Modifier.isPublic(method.getModifiers()))
{ // 设置非共有方法权限
method.setAccessible(true);
}
return method.invoke(target); // 方法回调,返回值
}
catch (Exception me)
{// 如果get方法不存在,则直接获取类属性值
if (logger.isDebugEnabled())
{
logger.debug(me.getMessage());
}
try
{
Field field = clazz.getDeclaredField(fname); // 获取定义的类属性
if (!Modifier.isPublic(field.getModifiers()))
{ // 设置非共有类属性权限
field.setAccessible(true);
}
return field.get(target);// 返回类属性值
}
catch (Exception fe)
{
if (logger.isDebugEnabled())
{
logger.debug(fe.getMessage());
}
}
}
return null;
}
public static <E> E newInstance(final Class<? extends E> clazz)
{
try
{
return clazz.newInstance();
}
catch (final Exception e)
{
logger.warn("Could not instantiate {}: {}", clazz, e);
if (e instanceof RuntimeException)
{
throw (RuntimeException) e;
}
throw new IllegalStateException(e);
}
}
public static <A extends Annotation> A getAnnotation(
final Enum<?> enumConstant, final Class<A> annotationClass)
{
try
{
final Field field = enumConstant.getClass()
.getDeclaredField(enumConstant.name());
return getAnnotation(field, annotationClass);
}
catch (final Exception e)
{
throw new IllegalStateException(e);
}
}
public static <A extends Annotation> A getAnnotation(
final AnnotatedElement element, final Class<A> annotationClass)
{
final A annotation = element.getAnnotation(annotationClass);
if (annotation == null && element instanceof Method)
{
// check for annotations on overridden methods. Since Java 8
// those are not returned by .getAnnotation(...)
final Method m = (Method) element;
final Class<?> declaringClass = m.getDeclaringClass();
final Class<?> superClass = declaringClass.getSuperclass();
final String methodName = m.getName();
final Class<?>[] methodParameterTypes = m.getParameterTypes();
if (superClass != null)
{
try
{
final Method overriddenMethod = superClass
.getMethod(methodName, methodParameterTypes);
return getAnnotation(overriddenMethod, annotationClass);
}
catch (final NoSuchMethodException e)
{
logger.debug("Failed to get overridden method '{}' from {}",
methodName, superClass);
}
}
// check for annotations on interface methods too.
final Class<?>[] interfaces = declaringClass.getInterfaces();
for (final Class<?> interfaceClass : interfaces)
{
try
{
final Method overriddenMethod = interfaceClass
.getMethod(methodName, methodParameterTypes);
return getAnnotation(overriddenMethod, annotationClass);
}
catch (final NoSuchMethodException e)
{
logger.debug("Failed to get overridden method '{}' from {}",
methodName, interfaceClass);
}
}
}
if(annotation == null && element instanceof Class<?>){
final Class<?> clazz = (Class<?>) element;
// final Class<?> declaringClass = clazz.getDeclaringClass();
final Class<?> superClass = clazz.getSuperclass();
if (superClass != null)
{
return getAnnotation(superClass, annotationClass);
}
}
return annotation;
}
public static boolean isAnnotationPresent(final Enum<?> enumConstant,
final Class<? extends Annotation> annotationClass)
{
try
{
final Field field = enumConstant.getClass()
.getDeclaredField(enumConstant.name());
return isAnnotationPresent(field, annotationClass);
}
catch (final Exception e)
{
throw new IllegalStateException(e);
}
}
public static boolean isAnnotationPresent(final AnnotatedElement element,
final Class<? extends Annotation> annotationClass)
{
return getAnnotation(element, annotationClass) != null;
}
public static Field[] getAllFields(String clazzName,
final Class<? extends Annotation> withAnnotation) throws ClassNotFoundException
{
final List<Field> result = new ArrayList<>();
final Field[] fields = getAllFields(Class.forName(clazzName));
for (final Field field : fields)
{
if (isAnnotationPresent(field, withAnnotation))
{
result.add(field);
}
}
return result.toArray(new Field[result.size()]);
}
public static Field[] getAllFields(final Class<?> clazz,
final Class<? extends Annotation> withAnnotation)
{
final List<Field> result = new ArrayList<>();
final Field[] fields = getAllFields(clazz);
for (final Field field : fields)
{
if (isAnnotationPresent(field, withAnnotation))
{
result.add(field);
}
}
return result.toArray(new Field[result.size()]);
}
public static Field[] getAllFields(final Class<?> clazz)
{
final List<Field> allFields = new ArrayList<>();
addFields(allFields, clazz);
return allFields.toArray(new Field[allFields.size()]);
}
private static void addFields(final List<Field> allFields,
final Class<?> clazz)
{
addFields(allFields, clazz, false);
}
private static void addFields(final List<Field> allFields,
final Class<?> clazz, final boolean excludeSynthetic)
{
if (clazz == Object.class)
{
return;
}
final Field[] f = clazz.getDeclaredFields();
for (final Field field : f)
{
if (excludeSynthetic && field.isSynthetic())
{
continue;
}
allFields.add(field);
}
final Class<?> superclass = clazz.getSuperclass();
addFields(allFields, superclass, excludeSynthetic);
}
public static Method[] getMethods(final Class<?> clazz, final Class<? extends Annotation> withAnnotation) {
final List<Method> result = new ArrayList<>();
final Method[] methods = getMethods(clazz);
for (final Method method : methods) {
if (isAnnotationPresent(method, withAnnotation)) {
result.add(method);
}
}
return result.toArray(new Method[result.size()]);
}
public static Method[] getMethods(final Class<?> clazz) {
final List<Method> allMethods = new ArrayList<>();
addMethods(allMethods, clazz);
return allMethods.toArray(new Method[allMethods.size()]);
}
private static void addMethods(final List<Method> allMethods, final Class<?> clazz) {
if (clazz == Object.class || clazz == null) {
return;
}
final Method[] methods = clazz.getMethods();
for (final Method method : methods) {
final Class<?> declaringClass = method.getDeclaringClass();
if (declaringClass != Object.class) {
allMethods.add(method);
}
}
}
}
package com.yeejoin.amos.fas.business.action.websocket;
import java.io.IOException;
import java.util.Observable;
import java.util.Observer;
import java.util.concurrent.CopyOnWriteArraySet;
import javax.websocket.OnClose;
import javax.websocket.OnError;
import javax.websocket.OnMessage;
import javax.websocket.OnOpen;
import javax.websocket.Session;
import javax.websocket.server.ServerEndpoint;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
/**
*
* <pre>
* rule webSocket定义
* </pre>
*
* @author amos
* @version $Id: RuleWebSocket.java, v 0.1 2019年5月20日 下午4:59:50 amos Exp $
*/
@Component
@ServerEndpoint(value = "/rule.ws")
public class RuleWebSocket implements Observer
{
private final static Logger log = LoggerFactory.getLogger(RuleWebSocket.class);
// 静态变量,用来记录当前在线连接数。应该把它设计成线程安全的。
private static int onlineCount = 0;
// concurrent包的线程安全Set,用来存放每个客户端对应的MyWebSocket对象。
private static CopyOnWriteArraySet<RuleWebSocket> webSocketSet = new CopyOnWriteArraySet<RuleWebSocket>();
// 与某个客户端的连接会话,需要通过它来给客户端发送数据
private Session session;
private Observable ob;
private String name;
/**
* 连接建立成功调用的方法
*/
@OnOpen
public void onOpen(Session session)
{
this.session = session;
webSocketSet.add(this); // 加入set中
addOnlineCount(); // 在线数加1
log.debug("有新连接加入!当前在线人数为" + getOnlineCount());
subscribeTopics(session);
}
/**
*
* <pre>
* 订阅指挥
* </pre>
*
*/
public void subscribeTopics(Session session)
{
// this.ob = GlobalDispatch.getInstance();
// GlobalDispatch.getInstance().addObserver(this);
log.info("成功加入规则主题");
}
/**
* 连接关闭调用的方法
*/
@OnClose
public void onClose()
{
webSocketSet.remove(this); // 从set中删除
subOnlineCount(); // 在线数减1
log.debug("有一连接关闭!当前在线人数为" + getOnlineCount());
if (ob != null)
{
ob.deleteObserver(this);
}
}
/**
* 收到客户端消息后调用的方法
*
* @param message
* 客户端发送过来的消息
*/
@OnMessage
public void onMessage(String message, Session session)
{
log.info("来自客户端的消息:" + message);
}
@OnError
public void onError(Session session, Throwable error)
{
log.error("发生错误", error);
}
public void sendMessage(String message) throws IOException
{
this.session.getBasicRemote().sendText(message);
// this.session.getAsyncRemote().sendText(message);
}
/**
* 群发自定义消息
*/
public static void sendInfo(String message) throws IOException
{
log.debug("——----RuleWebSocket开始群发消息------");
log.debug("消息内容为:" + message);
for (RuleWebSocket item : webSocketSet)
{
try
{
item.sendMessage(message);
}
catch (IOException e)
{
log.error(item.session.getId() + "消息发送失败", e);
continue;
}
}
log.debug("——----RuleWebSocket结束群发消息------");
}
public static synchronized int getOnlineCount()
{
return onlineCount;
}
public static synchronized void addOnlineCount()
{
RuleWebSocket.onlineCount++;
}
public static synchronized void subOnlineCount()
{
RuleWebSocket.onlineCount--;
}
@Override
public void update(Observable o, Object arg)
{
try
{
if (session.isOpen())
{
sendMessage(arg.toString());
log.debug("session" + name + "消息发送成功");
}
else
{
o.deleteObserver(this);
log.debug("session" + name + "消息发送失败:" + "session已经失去连接");
}
}
catch (Exception e)
{
log.error("session" + name + "消息发送失败:" + e.getMessage());
}
}
}
package com.yeejoin.amos.fas.business.bo;
import java.util.Set;
/**
* 手机消息对象
*/
public class JpushMsgBo {
/**
* 接收人集合
*/
Set<String> target;
/**
* 消息体
*/
JpushMsgContentBo msg;
public Set<String> getTarget() {
return target;
}
public void setTarget(Set<String> target) {
this.target = target;
}
public JpushMsgContentBo getMsg() {
return msg;
}
public void setMsg(JpushMsgContentBo msg) {
this.msg = msg;
}
}
package com.yeejoin.amos.fas.business.bo;
import com.yeejoin.amos.fas.common.enums.TriggerRpnChangeTypeEum;
import com.yeejoin.amos.fas.core.util.DateUtil;
import java.math.BigDecimal;
/**
* 手机消息推送内容
*/
public class JpushMsgContentBo {
/**
* 危险因素名称
*/
private String fmeaName;
/**
* 触发类型
*/
private String notifyType;
/**
* 巡检状态
*/
private String checkStatus;
/**
* 执行日期
*/
private String executeDate = DateUtil.getLongCurrentDate();
/**
* 执行人
*/
private String execute;
/**
* 等级变化范围
*/
private int levelIsChange;
/**
* 当前rpn
*/
private BigDecimal rpn;
/**
*风险等级
*/
private String level;
/**
*标题
*/
private String subject;
/**
* 关联名称
*/
private String relationName;
/**
* 是否需要发送
*/
private Boolean isSend;
public JpushMsgContentBo(String fmeaName, String notifyType){
this.fmeaName = fmeaName;
this.notifyType = notifyType;
this.setSubject(notifyType);
}
public Boolean getSend() {
return isSend;
}
private void setSubject(String notifyType){
if(notifyType.equals(TriggerRpnChangeTypeEum.patrol.getCode())){
//巡检
this.subject = "风险预警";
this.isSend = true;
} else if(notifyType.equals(TriggerRpnChangeTypeEum.alarm.getCode())){
//设备告警
this.subject = "风险预警";
this.isSend = true;
} else if(notifyType.equals(TriggerRpnChangeTypeEum.alarmRecovery.getCode())){
//告警恢复
this.subject = "告警恢复";
this.isSend = true;
} else if(notifyType.equals(TriggerRpnChangeTypeEum.fmeaUpdate.getCode())){
//风险评价
this.subject = "风险评价";
this.isSend = true;
}
}
public String genMessage(){
StringBuilder message = new StringBuilder();
if(notifyType.equals(TriggerRpnChangeTypeEum.patrol.getCode())){
//巡检
message.append("执行人:").append(execute).append("\n");
message.append("执行时间:").append(executeDate).append("\n");
message.append("危险因素名称:").append(fmeaName).append("\n");
message.append("描述:").append("当前风险值上升到").append(rpn).append(",风险等级").append(getLevelChangeType()).append(level).append("\n");
message.append("触发原因:").append("关联巡检点").append(relationName).append("检查").append(checkStatus);
} else if(notifyType.equals(TriggerRpnChangeTypeEum.alarm.getCode())){
//设备告警
message.append("执行时间:").append(executeDate).append("\n");
message.append("危险因素名称:").append(fmeaName).append("\n");
message.append("描述:").append("当前风险值上升到").append(rpn).append(",风险等级").append(getLevelChangeType()).append(level).append("\n");
message.append("触发原因:").append("关联设备").append(relationName).append("指标项报警");
} else if(notifyType.equals(TriggerRpnChangeTypeEum.alarmRecovery.getCode())){
//告警恢复
message.append(relationName).append("设备告警解除");
} else if(notifyType.equals(TriggerRpnChangeTypeEum.fmeaUpdate.getCode())){
//风险评价
message.append("评价人:").append(execute).append("\n");;
message.append("评价时间:").append(executeDate).append("\n");
message.append("评价内容:").append(fmeaName).append("\n");
message.append("评价等级:").append(level);
}
return message.toString();
}
private String getLevelChangeType(){
String changeType = "";
if(levelIsChange > 0){
changeType = "上升到";
}else if(levelIsChange == 0){
changeType = "不变";
} else {
changeType = "下降到";
}
return changeType;
}
public String getExecute() {
return execute;
}
public void setExecute(String execute) {
this.execute = execute;
}
public int getLevelIsChange() {
return levelIsChange;
}
public void setLevelIsChange(int levelIsChange) {
this.levelIsChange = levelIsChange;
}
public BigDecimal getRpn() {
return rpn;
}
public void setRpn(BigDecimal rpn) {
this.rpn = rpn;
}
public String getLevel() {
return level;
}
public void setLevel(String level) {
this.level = level;
}
public String getRelationName() {
return relationName;
}
public String getSubject() {
return subject;
}
public void setRelationName(String relationName) {
this.relationName = relationName;
}
}
package com.yeejoin.amos.fas.business.bo;
import com.yeejoin.amos.fas.dao.entity.Fmea;
import java.math.BigDecimal;
/**
* 参数对象
*/
public class MsgParamBo {
private String toke;
private String product;
private String appKey;
private Fmea fmea;
private Integer managerLevel;
private String notifyType;
private String userName;
private int levelIsChange;
private BigDecimal rpn;
private String level;
private String relationName;
public String getToke() {
return toke;
}
public void setToke(String toke) {
this.toke = toke;
}
public String getProduct() {
return product;
}
public void setProduct(String product) {
this.product = product;
}
public String getAppKey() {
return appKey;
}
public void setAppKey(String appKey) {
this.appKey = appKey;
}
public Fmea getFmea() {
return fmea;
}
public void setFmea(Fmea fmea) {
this.fmea = fmea;
}
public Integer getManagerLevel() {
return managerLevel;
}
public void setManagerLevel(Integer managerLevel) {
this.managerLevel = managerLevel;
}
public String getNotifyType() {
return notifyType;
}
public void setNotifyType(String notifyType) {
this.notifyType = notifyType;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public int getLevelIsChange() {
return levelIsChange;
}
public void setLevelIsChange(int levelIsChange) {
this.levelIsChange = levelIsChange;
}
public BigDecimal getRpn() {
return rpn;
}
public void setRpn(BigDecimal rpn) {
this.rpn = rpn;
}
public String getLevel() {
return level;
}
public void setLevel(String level) {
this.level = level;
}
public String getRelationName() {
return relationName;
}
public void setRelationName(String relationName) {
this.relationName = relationName;
}
}
......@@ -7,6 +7,7 @@ public class SafetyExecuteBo {
private String label;
private String pointId;
private String type;
private String status;//指标状态
private String changeDate;
public Long getId() {
return id;
......@@ -44,4 +45,10 @@ public class SafetyExecuteBo {
public void setChangeDate(String changeDate) {
this.changeDate = changeDate;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
}
......@@ -153,7 +153,6 @@ public class BaseController {
RequestContext.setToken(getToken());
RequestContext.setProduct(getProduct());
RequestContext.setAppKey(getAppKey());
FeignClientResult feignClientResult;
try {
feignClientResult = Privilege.agencyUserClient.getme();
......
......@@ -169,8 +169,8 @@ public class CommonController extends BaseController {
@ApiOperation(httpMethod = "GET", value = "获取公司下人员列表", notes = "获取公司下人员列表")
@GetMapping(value = "/user/list", produces = "application/json;charset=UTF-8")
public CommonResponse getAllUser() {
ReginParams reginParams =getSelectedOrgInfo();
String compCode=getOrgCode(reginParams);
ReginParams reginParams = getSelectedOrgInfo();
String compCode = getOrgCode(reginParams);
List<AgencyUserModel> users = commonService.getAllUser(getToken(),getProduct(),getAppKey(), compCode);
return CommonResponseUtil.success(users);
}
......
......@@ -100,7 +100,7 @@ public class FireEquimtPointController extends BaseController {
@ApiParam(value = "监测点编号或者监测点名称模糊匹配") @RequestParam(required = false) String searchValue,
@ApiParam(value = "类型(模拟量:ANALOGUE;开关量:SWITCH)") @RequestParam(required = false) String type) {
Map<String, Object> queryMap = Maps.newHashMap();
queryMap.put("pageNumber", pageNumber);
queryMap.put("offset", pageNumber*pageSize);
queryMap.put("pageSize", pageSize);
if (isBindDevice != null && isBindDevice == 0) {
queryMap.put("fireEquipmentId", 0);
......
......@@ -90,7 +90,6 @@ public class FireSourceController extends BaseController {
@ApiOperation(httpMethod = "GET", value = "查询消防车", notes = "查询消防车")
@RequestMapping(value = "/fire-car/det/{id}", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
public CommonResponse queryFireCar(@ApiParam(value = "查询条件", required = true) @PathVariable Long id) {
FireCarDetailVo car = fireCarService.findFireCarById(getToken(),getProduct(),getAppKey(),id);
return CommonResponseUtil.success(car);
}
......
package com.yeejoin.amos.fas.business.controller;
import java.util.HashMap;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.yeejoin.amos.fas.business.param.CommonPageInfoParam;
import com.yeejoin.amos.fas.business.service.intfc.IRiskLevelService;
import com.yeejoin.amos.fas.business.util.CommonPageParamUtil;
......@@ -11,18 +25,10 @@ import com.yeejoin.amos.fas.core.util.CommonResponse;
import com.yeejoin.amos.fas.core.util.CommonResponseUtil;
import com.yeejoin.amos.fas.dao.entity.RiskLevel;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@RestController
@RequestMapping("/api/riskLevel")
......@@ -97,7 +103,7 @@ public class RiskLevelController extends BaseController {
return CommonResponseUtil.failure(e.getMessage() + ",风险等级删除失败");
}
}
@ApiOperation(value = "风险管控级别查询",notes = "风险管控级别查询")
@GetMapping(value = "/manageLevel/list")
public CommonResponse getManageLevelEumList(){
......
......@@ -125,7 +125,7 @@ public class RiskModelController extends BaseController {
RsDataQueue rs = RsDataQueue.getInstance();
params.forEach(param -> {
if (!ObjectUtils.isEmpty(param.getId())) {
rs.addUpdateMessage(param.getId());
rs.addUpdateMessage(param.getId(),user.getRealName());
}
});
return CommonResponseUtil.success();
......@@ -163,7 +163,7 @@ public class RiskModelController extends BaseController {
public CommonResponse queryFmeaByPage(@ApiParam(value = "查询条件") @RequestBody(required = false) List<CommonRequest> queryRequests,
@ApiParam(value = "分页参数", required = true) CommonPageable commonPageable) {
CommonPageInfoParam param = CommonPageParamUtil.fillCommonPageInfoParam(queryRequests, commonPageable);
Page<HashMap<String, Object>> fmeaList = fmeaService.queryFmeaList(param);
Page<HashMap<String, Object>> fmeaList = fmeaService.queryFmeaList(param,getToken(),getProduct(),getAppKey());
return CommonResponseUtil.success(fmeaList);
}
......
......@@ -513,12 +513,7 @@ public class RiskSourceController extends BaseController {
return CommonResponseUtil.success(riskSourceService.bindFireEquiment(fmeaBindParam));
}
// @ApiOperation(httpMethod = "DELETE", value = "移除消防设备绑定关系", notes = "移除消防设备绑定关系")
// @RequestMapping(value = "/fireequiment/relation/{ids}", produces = "application/json;charset=UTF-8", method = RequestMethod.DELETE)
// public CommonResponse removeFireEquiment(@PathVariable("ids") String ids) throws Exception {
// String[] idArray = ids.split(",");
// return CommonResponseUtil.success(this.riskSourceService.removeBoundRelation(idArray));
// }
@ApiOperation(httpMethod = "GET", value = "查询绑定关系设备", notes = "查询绑定关系包含已绑定和未绑定")
@RequestMapping(value = "/fireequiment/relation/all", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
......
package com.yeejoin.amos.fas.business.controller;
import java.util.HashMap;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.itextpdf.text.pdf.PdfStructTreeController.returnType;
import com.yeejoin.amos.fas.business.bo.BindPointBo;
import com.yeejoin.amos.fas.business.bo.BindRegionBo;
import com.yeejoin.amos.fas.business.service.intfc.IRiskSourceService;
import com.yeejoin.amos.fas.business.service.intfc.IView3dService;
import com.yeejoin.amos.fas.business.util.StringUtil;
import com.yeejoin.amos.fas.business.vo.ExceptionRegionVo;
import com.yeejoin.amos.fas.business.vo.ReginParams;
import com.yeejoin.amos.fas.common.enums.ResourceTypeDefEnum;
import com.yeejoin.amos.fas.core.util.CommonResponse;
import com.yeejoin.amos.fas.core.util.CommonResponseUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import io.swagger.annotations.Authorization;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@RequestMapping("/api/view3d")
......@@ -49,8 +40,6 @@ public class View3dController extends BaseController {
public CommonResponse getRegionTree() {
ReginParams reginParams =getSelectedOrgInfo();
String orgCode = this.getOrgCode(reginParams);
//TODO:待删除
orgCode = "1*2";
String channelType = this.getChannelType();
return CommonResponseUtil.success(riskSourceService.findRegionTree(channelType,orgCode));
}
......@@ -60,8 +49,6 @@ public class View3dController extends BaseController {
public CommonResponse getRegionDetail(@PathVariable("riskSourceId") Long riskSourceId) {
ReginParams reginParams =getSelectedOrgInfo();
String orgCode = this.getOrgCode(reginParams);
//TODO:待删除
orgCode = "1";
String channelType = this.getChannelType();
return CommonResponseUtil.success(riskSourceService.findRegionById(riskSourceId,orgCode,channelType));
}
......@@ -89,8 +76,6 @@ public class View3dController extends BaseController {
if(ResourceTypeDefEnum.containsTypeCode(type)) {
ReginParams reginParams =getSelectedOrgInfo();
String orgCode = this.getOrgCode(reginParams);
//TODO:待删除
orgCode = "1*2";
String channelType = this.getChannelType();
return CommonResponseUtil.success(view3dService.getPointTreeByType(type,orgCode,channelType));
}
......@@ -102,8 +87,6 @@ public class View3dController extends BaseController {
public CommonResponse getPointDetail(String type,Long pointId) {
ReginParams reginParams =getSelectedOrgInfo();
String orgCode = this.getOrgCode(reginParams);
//TODO:待删除
orgCode = "1";
return CommonResponseUtil.success(view3dService.getPointDetailByTypeAndId(type,pointId,orgCode));
}
......@@ -112,8 +95,6 @@ public class View3dController extends BaseController {
public CommonResponse safetyIndexWeek(String type,Long pointId) {
ReginParams reginParams =getSelectedOrgInfo();
String orgCode = this.getOrgCode(reginParams);
//TODO:待删除
orgCode = "1*2";
return CommonResponseUtil.success(view3dService.getSafetyIndexWeek(orgCode));
}
......@@ -122,8 +103,6 @@ public class View3dController extends BaseController {
public CommonResponse getSafetyIndexInfoByDate(@RequestParam(name = "date",required = false) String date){
ReginParams reginParams =getSelectedOrgInfo();
String orgCode = this.getOrgCode(reginParams);
//TODO:待删除
orgCode = "1*2";
return CommonResponseUtil.success(view3dService.getSafetyIndexInfoByDate(orgCode,date));
}
......@@ -132,7 +111,6 @@ public class View3dController extends BaseController {
public CommonResponse getSafetyIndexDetail(@ApiParam(value = "risk-风险异常,check-巡检异常,equip-设备故障") @PathVariable String type){
ReginParams reginParams =getSelectedOrgInfo();
String orgCode = this.getOrgCode(reginParams);
orgCode = "1*2";
return CommonResponseUtil.success(view3dService.getSafetyIndexDetail(type,orgCode));
}
......@@ -150,8 +128,6 @@ public class View3dController extends BaseController {
public CommonResponse getStatisticsCheck(){
ReginParams reginParams =getSelectedOrgInfo();
String orgCode = this.getOrgCode(reginParams);
//TODO:待删除
orgCode = "1*2";
return CommonResponseUtil.success(view3dService.getStatisticsCheck(orgCode));
}
......@@ -160,8 +136,6 @@ public class View3dController extends BaseController {
public CommonResponse getSafetyExecuteListTop5(@PathVariable("type")String type){
ReginParams reginParams =getSelectedOrgInfo();
String orgCode = this.getOrgCode(reginParams);
//TODO:待删除
orgCode = "1*2";
return CommonResponseUtil.success(view3dService.getSafetyExecuteListTop5(type,orgCode));
}
......@@ -170,7 +144,6 @@ public class View3dController extends BaseController {
public CommonResponse getStatisticsDuty(){
ReginParams reginParams =getSelectedOrgInfo();
String orgCode = this.getOrgCode(reginParams);
orgCode = "1*2";
CommonResponse statisticsDuty = view3dService.getStatisticsDuty(getAppKey(),getProduct(),orgCode);
return statisticsDuty;
}
......@@ -180,7 +153,6 @@ public class View3dController extends BaseController {
public CommonResponse getExceptionRegion(){
ReginParams reginParams =getSelectedOrgInfo();
String orgCode = this.getOrgCode(reginParams);
orgCode = "1*2";
List<ExceptionRegionVo> exceptionRegionVoList = view3dService.getExceptionRegion(orgCode);
return CommonResponseUtil.success(exceptionRegionVoList);
}
......@@ -198,8 +170,6 @@ public class View3dController extends BaseController {
public CommonResponse initViewNode(String type,Long riskSourceId){
ReginParams reginParams =getSelectedOrgInfo();
String orgCode = this.getOrgCode(reginParams);
//TODO:待删除
orgCode = "1*2";
return CommonResponseUtil.success(view3dService.initViewErrorNode(type,riskSourceId,orgCode));
}
......@@ -237,8 +207,6 @@ public class View3dController extends BaseController {
@ApiParam(value = "区域ID", required = false) @RequestParam(required = false) Long riskSourceId) {
ReginParams reginParams =getSelectedOrgInfo();
String orgCode = this.getOrgCode(reginParams);
//TODO:待删除
orgCode = "1*2";
return CommonResponseUtil.success(view3dService.find3dViewDataByType(type,riskSourceId,orgCode));
}
......
package com.yeejoin.amos.fas.business.dao.mapper;
import java.util.List;
import com.yeejoin.amos.fas.business.service.model.RuleRuningSnapshot;
public interface RuleRuningSnapshotMapper extends BaseMapper{
RuleRuningSnapshot querForObject(String batchNo);
List<RuleRuningSnapshot> querForObjectList(String batchNo);
}
......@@ -45,6 +45,13 @@ public interface View3dMapper extends BaseMapper{
* @return Long
*/
Long countCheckException(Map<String,Object> param);
/**
* 统计故障告警数量(不合格、漏检)-日期+机构
* @param param
* @return
*/
Long countFireException(Map<String,Object> param);
/**
* 今日安全指数详情
......@@ -66,6 +73,14 @@ public interface View3dMapper extends BaseMapper{
* @return list
*/
List<CheckErrorBo> getAllErrorPatrolPoint(Map<String, Object> params);
/**
* 今日安全指数故障告警详情
* @param params orgCode,date
* @return list
*/
List<CheckErrorBo> getAllFaultAlarm(Map<String, Object> params);
/**
* 今日巡检统计接口
......@@ -87,6 +102,20 @@ public interface View3dMapper extends BaseMapper{
* @return
*/
List<SafetyExecuteBo> getCheckErrorTop5(String orgCode);
/**
* 火灾告警最新5条
* @param orgCode
* @return
*/
List<SafetyExecuteBo> getFireAlarmTop5(String orgCode);
/**
* 设备状态最新5条
* @param orgCode
* @return
*/
List<SafetyExecuteBo> getEquipStatusTop5(String orgCode);
/**
* 按照类型查询点
......
......@@ -7,4 +7,5 @@ import com.yeejoin.amos.fas.dao.entity.Alarm;
@Repository("iAlarmDao")
public interface IAlarmDao extends BaseDao<Alarm, Long> {
Alarm findByStatusTrueAndFireEquipmentPointCode(String code);
}
......@@ -4,25 +4,19 @@ package com.yeejoin.amos.fas.business.feign;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import com.yeejoin.amos.component.feign.config.InnerInvokException;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.fas.business.vo.Toke;
import com.yeejoin.amos.fas.core.util.CommonResponse;
import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.privilege.model.CompanyModel;
import com.yeejoin.amos.feign.privilege.model.DepartmentModel;
import com.yeejoin.amos.feign.privilege.model.IdPasswordAuthModel;
import com.yeejoin.amos.feign.privilege.model.PermissionModel;
import com.yeejoin.amos.feign.privilege.model.*;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.amos.feign.systemctl.model.DictionarieValueModel;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import java.util.LinkedHashMap;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
......@@ -219,42 +213,44 @@ public class RemoteSecurityService {
}
return agencyUserModel;
}
//根据orgCode查询机构用户
/**
* 根据orgCode查询机构用户
* @param toke toke
* @param product product
* @param appKey appKey
* @param orgCode orgCode
* @return List<AgencyUserModel>
*/
public List<AgencyUserModel> listUserByOrgCode(String toke,String product,String appKey,String orgCode) {
if (orgCode == null || orgCode.equals("")) {
return null;
}
RequestContext.setToken(toke);
RequestContext.setProduct(product);
RequestContext.setAppKey(appKey);
List<AgencyUserModel> agencyUserModel=null;
FeignClientResult feignClientResult;
FeignClientResult feignClientResult = new FeignClientResult();
try {
feignClientResult = Privilege.agencyUserClient.queryByOrgCode(orgCode);
agencyUserModel = (List<AgencyUserModel>)feignClientResult.getResult();
} catch (InnerInvokException e) {
e.printStackTrace();
}
return agencyUserModel;
// CommonResponse commonResponse = iAmosSecurityServer.listUserByOrgCode(orgCode);
// return handleArray(commonResponse, UserModel.class);
return handleArray(feignClientResult,AgencyUserModel.class);
}
//根据orgCode查询机构
/**
* 根据orgCode查询机构
* @param toke toke
* @param product product
* @param appKey appKey
* @param orgCode orgCode
* @return Map<String, Object>
*/
public Map<String, Object> listByOrgCode(String toke,String product,String appKey,String orgCode) {
if (orgCode == null || orgCode.equals("")) {
return null;
}
RequestContext.setToken(toke);
RequestContext.setProduct(product);
RequestContext.setAppKey(appKey);
......@@ -268,11 +264,6 @@ public class RemoteSecurityService {
e.printStackTrace();
}
return agencyUserModel;
// CommonResponse commonResponse = iAmosSecurityServer.listUserByOrgCode(orgCode);
// return handleArray(commonResponse, UserModel.class);
}
......@@ -363,37 +354,35 @@ public class RemoteSecurityService {
// CommonResponse commonResponse = iAmosSecurityServer.getDepartmentTreeByCompanyId(companyId);
// return handleArray(commonResponse, DepartmentBo.class);
}
//根据id批量获取部门信息
public List<LinkedHashMap> listDepartmentByDeptIds(String toke,String product,String appKey,String departmentIds) {
/**
* 根据id批量获取部门信息
* @param toke token
* @param product product
* @param appKey appKey
* @param "200".equals(feignClientResult.getStatus())departmentIds 部门ids
* @return List<DepartmentModel>
*/
public List<DepartmentModel> listDepartmentByDeptIds(String toke,String product,String appKey,String departmentIds) {
RequestContext.setToken(toke);
RequestContext.setProduct(product);
RequestContext.setAppKey(appKey);
List<LinkedHashMap> departmentModel=null;
FeignClientResult feignClientResult;
FeignClientResult feignClientResult = new FeignClientResult();
try {
feignClientResult = Privilege.departmentClient.queryDeptByIds(departmentIds);
departmentModel = (List<LinkedHashMap>)feignClientResult.getResult();
} catch (InnerInvokException e) {
e.printStackTrace();
}
return departmentModel;
//CommonResponse commonResponse = iAmosSecurityServer.listDepartmentByDeptIds(departmentIds);
//return handleArray(commonResponse, DepartmentBo.class);
return handleArray(feignClientResult,DepartmentModel.class);
}
private <T> List<T> handleArray(CommonResponse commonResponse, Class<T> t) {
if (commonResponse != null && commonResponse.isSuccess()) {
String jsonStr = JSON.toJSONString(commonResponse.getDataList());
return JSONArray.parseArray(jsonStr, t);
private <T> List<T> handleArray(FeignClientResult feignClientResult, Class<T> t) {
List<T> list = new ArrayList<>();
if (feignClientResult != null && feignClientResult.getStatus() == 200) {
String jsonStr = JSON.toJSONString(feignClientResult.getResult());
list = JSONArray.parseArray(jsonStr, t);
}
return null;
return list;
}
private <T> T handleObj(CommonResponse commonResponse, Class<T> t) {
......
......@@ -72,18 +72,11 @@ public class AppMessagePushService {
}
public void sendMessage(PushMsgParam response) {
CommonResponse commonResponse = PushFeign.sendMessageone(response);
// try {
// if (null != response && "true".equals(isPush)) {
// PushPayload payload = PushPayload.newBuilder().setPlatform(Platform.android())
// .setAudience(Audience.all())
// .setNotification(Notification.android(response.getContent(), response.getSubject(), response.getExtras()))
// .build();
// jpushClient.sendPush(payload);
// }
// } catch (Exception e) {
// log.error("极光推送异常", e);
// }
try {
CommonResponse commonResponse = PushFeign.sendMessageone(response);
} catch (Exception e) {
log.error("极光推送异常", e);
}
}
}
package com.yeejoin.amos.fas.business.service.impl;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.stream.Collectors;
import com.yeejoin.amos.feign.privilege.model.DepartmentModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
......@@ -24,6 +21,7 @@ import com.yeejoin.amos.fas.dao.entity.AccidentType;
import com.yeejoin.amos.fas.dao.entity.RiskFactor;
import com.yeejoin.amos.fas.exception.YeeException;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import org.springframework.util.CollectionUtils;
@Service("accidentTypeService")
public class AccidentTypeServiceImpl implements IAccidentTypeService {
......@@ -71,8 +69,7 @@ public class AccidentTypeServiceImpl implements IAccidentTypeService {
}
@Override
public List<HashMap<String,Object>> queryAccidentType(String orgCode) {
public List<HashMap<String,Object>> queryAccidentType(String orgCode) {
return accidentTypeMapper.findAccidentTypeListByOrgCode(orgCode);
}
......@@ -80,35 +77,35 @@ public class AccidentTypeServiceImpl implements IAccidentTypeService {
public Page<HashMap<String, Object>> queryAccidentTypePage(String toke,String product,String appKey,CommonPageInfoParam param) {
long total = accidentTypeMapper.countPageData(param);
List<HashMap<String, Object>> content = accidentTypeMapper.findAccidentTypePage(param);
List<String> userIdList = new ArrayList<String>();
List<String> deptIdList = new ArrayList<String>();
for(HashMap<String, Object> map : content)
{
String userId = String.valueOf(map.get("createBy"));
String deptId = String.valueOf(map.get("deptId"));
if(userId!=null&&!userIdList.contains(userId))
if(!CollectionUtils.isEmpty(content)){
Set<String> userIds = new HashSet<>();
Set<String> deptIds = new HashSet<>();
for(HashMap<String, Object> map : content)
{
userIdList.add(userId);
String userId = String.valueOf(map.get("createBy"));
String deptId = String.valueOf(map.get("deptId"));
userIds.add(userId);
deptIds.add(deptId);
}
if(deptId!=null&&!deptIdList.contains(deptId))
{
deptIdList.add(deptId);
userIds.remove(null);
userIds.remove("");
deptIds.remove(null);
deptIds.remove("");
List<AgencyUserModel> users = new ArrayList<>();
if(!CollectionUtils.isEmpty(userIds)){
users = remoteSecurityService.listUserByUserIds(toke, product, appKey, Joiner.on(",").join(userIds));
}
Map<String, String> userMap = users.stream().collect(Collectors.toMap(AgencyUserModel::getUserId,AgencyUserModel::getRealName));
List<DepartmentModel> depts = new ArrayList<>();
if(!CollectionUtils.isEmpty(deptIds)){
depts = remoteSecurityService.listDepartmentByDeptIds(toke, product, appKey, Joiner.on(",").join(deptIds));
}
Map<String, String > deptMap = depts.stream().collect(Collectors.toMap(e-> e.getSequenceNbr().toString(),DepartmentModel::getDepartmentName));
content.forEach(e -> {
e.put("userName",userMap.get(e.get("createBy")));
e.put("deptName",deptMap.get(e.get("deptId")));
});
}
List<AgencyUserModel> users =remoteSecurityService.listUserByUserIds(toke, product, appKey, Joiner.on(",").join(userIdList));
Map<String, String> userMap = new HashMap<String,String>();
for (int i = 0; i < users.size(); i++) {
userMap.put(users.get(i).getUserId(), users.get(i).getUserName());
}
List<LinkedHashMap> depts =remoteSecurityService.listDepartmentByDeptIds(toke, product, appKey, Joiner.on(",").join(deptIdList));
Map<String, String> deptMap = new HashMap<String,String>();
for (int i = 0; i < depts.size(); i++) {
deptMap.put(depts.get(i).get("sequenceNbr").toString(), depts.get(i).get("departmentName").toString());
}
content.forEach(e -> {
e.put("userName",userMap.get(e.get("createBy")));
e.put("deptName",deptMap.get(e.get("deptId")));
});
Page<HashMap<String, Object>> result = new PageImpl<>(content, param, total);
return result;
}
......
......@@ -258,4 +258,9 @@ public class ContingencyInstanceImpl /*extends GenericManagerImpl<ContingencyPla
}
@Override
public void updateStep(String step, String batchNo) {
// TODO Auto-generated method stub
}
}
......@@ -457,10 +457,10 @@ public class EquipmentServiceImpl implements IEquipmentService {
@Override
public EquipCommunicationData findFireEquipmentByPointCode(String code) {
EquipCommunicationData data = (EquipCommunicationData) redisTemplate.opsForHash().get("fireEquipData", code);
if (ObjectUtils.isEmpty(data)) {
data = fireEquipMapper.findOneByPointCode(code);
}
// EquipCommunicationData data = (EquipCommunicationData) redisTemplate.opsForHash().get("fireEquipData", code);
// if (ObjectUtils.isEmpty(data)) {
EquipCommunicationData data = fireEquipMapper.findOneByPointCode(code);
// }
return data;
}
......
......@@ -9,6 +9,7 @@ import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
import org.apache.commons.collections.CollectionUtils;
import org.assertj.core.util.Sets;
......@@ -100,17 +101,13 @@ public class FireCarServiceImpl implements IFireCarService {
Set<String> deptIds = Sets.newHashSet(Lists.transform(content, Map->Map.get("dept_id")+""));
deptIds.remove("");
deptIds.remove(null);
Map<String, String> deptMap = new HashMap<String,String>();
if(!CollectionUtils.isEmpty(deptIds)){
List<LinkedHashMap> deptList = remoteSecurityService.listDepartmentByDeptIds( toke, product, appKey,Joiner.on(",").join(deptIds));
for (int i = 0; i < deptList.size(); i++) {
deptMap.put(deptList.get(i).get("sequenceNbr").toString(), deptList.get(i).get("departmentName").toString());
}
List<DepartmentModel> depts =remoteSecurityService.listDepartmentByDeptIds(toke, product, appKey, Joiner.on(",").join(deptIds));
Map<Long, String> deptMap = depts.stream().collect(Collectors.toMap(DepartmentModel::getSequenceNbr,DepartmentModel::getDepartmentName));
content.forEach(e -> {
e.put("departmentName",deptMap.get(e.get("dept_id")));
});
}
Map<String, String> deptMapNew= deptMap;
content.forEach(e -> {
e.put("departmentName",deptMapNew.get(e.get("dept_id")));
});
}
Page<HashMap<String, Object>> result = new PageImpl<HashMap<String, Object>>(content, param, total);
return result;
......@@ -120,7 +117,7 @@ public class FireCarServiceImpl implements IFireCarService {
public FireCarDetailVo findFireCarById(String toke,String product,String appKey,Long truckId) {
FireCarDetailVo carVo = fireCarMapper.getFireCarDetailById(truckId);
DepartmentModel departmentModel= remoteSecurityService.getDepartmentByDeptId(toke, product, appKey, carVo.getDeptId());
carVo.setDepartmentName(departmentModel.getDepartmentName());
carVo.setDepartmentName(departmentModel != null ? departmentModel.getDepartmentName() : "");
return carVo;
}
......
......@@ -53,6 +53,7 @@ public class FireEquipPointServiceImpl implements IFireEquipPontService {
return fireCar;
}
@Override
public String[] deletePoint(String[] idArray) throws Exception {
for (String id : idArray) {
Optional<FireEquipmentPoint> fireEquipmentPoint1 = fireEquipmentPointDao.findById(Long.parseLong(id));
......@@ -95,8 +96,11 @@ public class FireEquipPointServiceImpl implements IFireEquipPontService {
if (total.equals(0L)) {
return CommonResponseUtil.success(new PageImpl<>(Lists.newArrayList(), null, total));
}
int pageNumber = map.get("pageNumber") != null ? Integer.parseInt(map.get("pageNumber").toString()) : 0;
int pageSize = map.get("pageSize") != null ? Integer.parseInt(map.get("pageSize").toString()) : 0;
CommonPageable commonPageable = new CommonPageable(pageNumber, pageSize);
List<FireEquipmentPointEntity> list = fireEquipPointMapper.listByMap(map);
return CommonResponseUtil.success(new PageImpl<>(list, null, total));
return CommonResponseUtil.success(new PageImpl<>(list, commonPageable, total));
}
@Override
......
package com.yeejoin.amos.fas.business.service.impl;
import com.google.common.base.Joiner;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.fas.business.dao.mapper.FmeaEquipmentPointMapper;
import com.yeejoin.amos.fas.business.dao.mapper.FmeaMapper;
......@@ -10,6 +11,7 @@ import com.yeejoin.amos.fas.business.dao.repository.IRiskFactorDao;
import com.yeejoin.amos.fas.business.dao.repository.IRiskLevelDao;
import com.yeejoin.amos.fas.business.dao.repository.IRiskSourceDao;
import com.yeejoin.amos.fas.business.feign.RemoteRuleServer;
import com.yeejoin.amos.fas.business.feign.RemoteSecurityService;
import com.yeejoin.amos.fas.business.param.CommonPageInfoParam;
import com.yeejoin.amos.fas.business.service.intfc.IFmeaService;
import com.yeejoin.amos.fas.business.service.model.RiskSourceRo;
......@@ -28,12 +30,8 @@ import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.UUID;
import java.util.*;
import java.util.stream.Collectors;
@Service("fmeaService")
public class FmeaServiceImpl implements IFmeaService {
......@@ -58,7 +56,7 @@ public class FmeaServiceImpl implements IFmeaService {
IRiskFactorDao iRiskFactorDao;
@Autowired
private RemoteRuleServer remoteRuleServer;
private RemoteSecurityService remoteSecurityService;
@Autowired
private FmeaEquipmentPointMapper fmeaEquipmentPointMapper;
......@@ -84,76 +82,37 @@ public class FmeaServiceImpl implements IFmeaService {
}
@Override
public Page<HashMap<String, Object>> queryFmeaList(CommonPageInfoParam param) {
public Page<HashMap<String, Object>> queryFmeaList(CommonPageInfoParam param,String toke,String product,String appKey) {
long total = fmeaMapper.countPageData(param);
List<HashMap<String, Object>> content = fmeaMapper.queryFmeaPage(param);
StringBuffer sb = new StringBuffer();
for(HashMap<String, Object> map : content)
{
//String[] ids = sb.toString().split(",");
//String companyLeaderId = String.valueOf(map.get("companyLeaderId"));
sb.append(map.get("companyLeaderId"));
sb.append(map.get(","));
//String departmentLeaderId = String.valueOf(map.get("departmentLeaderId"));
sb.append(map.get("departmentLeaderId"));
sb.append(map.get(","));
//String groupLeaderId = String.valueOf(map.get("groupLeaderId"));
sb.append(map.get("groupLeaderId"));
sb.append(map.get(","));
//String personLeaderId = String.valueOf(map.get("personLeaderId"));
sb.append(map.get("personLeaderId"));
sb.append(map.get(","));
//String identifyUserId = String.valueOf(map.get("identifyUserId"));
sb.append(map.get("identifyUserId"));
sb.append(map.get(","));
}
sb.deleteCharAt(sb.length()-1);
FeignClientResult<List<AgencyUserModel>> resultSec = Privilege.agencyUserClient.queryByIds(sb.toString());
for(HashMap<String, Object> map : content)
{
String companyLeaderId = String.valueOf(map.get("companyLeaderId"));
String departmentLeaderId = String.valueOf(map.get("departmentLeaderId"));
String groupLeaderId = String.valueOf(map.get("groupLeaderId"));
String personLeaderId = String.valueOf(map.get("personLeaderId"));
String identifyUserId = String.valueOf(map.get("identifyUserId"));
for(AgencyUserModel user : resultSec.getResult())
{
if(companyLeaderId!=null&& companyLeaderId.equals(user.getUserId()))
{
map.put("companyLeaderName", user.getRealName());
}
if(departmentLeaderId!=null&& departmentLeaderId.equals(user.getUserId()))
{
map.put("departmentLeaderName", user.getRealName());
}
if(groupLeaderId!=null&& groupLeaderId.equals(user.getUserId()))
{
map.put("groupLeaderName", user.getRealName());
}
if(personLeaderId!=null&& personLeaderId.equals(user.getUserId()))
{
map.put("personLeaderName", user.getRealName());
}
if(identifyUserId!=null&& identifyUserId.equals(user.getUserId()))
{
map.put("identifyUserName", user.getRealName());
}
}
}
Page<HashMap<String, Object>> result = new PageImpl<HashMap<String, Object>>(content, param, total);
return result;
if(!CollectionUtils.isEmpty(content)) {
Set<String> userIds = new HashSet<>();
for (HashMap<String, Object> map : content) {
userIds.add(String.valueOf(map.get("companyLeaderId")));
userIds.add(String.valueOf(map.get("departmentLeaderId")));
userIds.add(String.valueOf(map.get("groupLeaderId")));
userIds.add(String.valueOf(map.get("personLeaderId")));
userIds.add(String.valueOf(map.get("identifyUserId")));
}
userIds.remove(null);
userIds.remove("");
if(!CollectionUtils.isEmpty(userIds)){
List<AgencyUserModel> users = new ArrayList<>();
if(!CollectionUtils.isEmpty(userIds)){
users = remoteSecurityService.listUserByUserIds(toke, product, appKey, Joiner.on(",").join(userIds));
}
Map<String, String> userMap = users.stream().collect(Collectors.toMap(AgencyUserModel::getUserId,AgencyUserModel::getRealName));
for (HashMap<String, Object> map : content) {
map.put("companyLeaderName", userMap.get(map.get("companyLeaderId")));
map.put("departmentLeaderName", userMap.get(map.get("departmentLeaderId")));
map.put("groupLeaderName", userMap.get(map.get("groupLeaderId")));
map.put("personLeaderName", userMap.get(map.get("personLeaderId")));
map.put("identifyUserName", userMap.get(map.get("identifyUserId")));
}
}
}
return new PageImpl<HashMap<String, Object>>(content, param, total);
}
......
package com.yeejoin.amos.fas.business.service.impl;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.stereotype.Service;
import com.google.common.base.Joiner;
import com.yeejoin.amos.fas.business.dao.mapper.RiskFactorMapper;
import com.yeejoin.amos.fas.business.dao.mapper.RiskSourceMapper;
......@@ -25,6 +13,15 @@ import com.yeejoin.amos.fas.dao.entity.Fmea;
import com.yeejoin.amos.fas.dao.entity.RiskFactor;
import com.yeejoin.amos.fas.exception.YeeException;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import com.yeejoin.amos.feign.privilege.model.DepartmentModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.util.*;
import java.util.stream.Collectors;
@Service("riskFactorService")
public class RiskFactorServiceImpl implements IRiskFactorService {
......@@ -46,35 +43,35 @@ public class RiskFactorServiceImpl implements IRiskFactorService {
public Page<HashMap<String, Object>> queryRiskFactorPage(String toke,String product,String appKey,CommonPageInfoParam param) {
long total = riskFactorMapper.countPageData(param);
List<HashMap<String, Object>> content = riskFactorMapper.queryRiskFactorPage(param);
List<String> userIdList = new ArrayList<String>();
List<String> deptIdList = new ArrayList<String>();
for(HashMap<String, Object> map : content)
{
String userId = String.valueOf(map.get("createBy"));
String deptId = String.valueOf(map.get("deptId"));
if(userId!=null&&!userIdList.contains(userId))
{
userIdList.add(userId);
}
if(deptId!=null&&!deptIdList.contains(deptId))
{
deptIdList.add(deptId);
}
}
List<AgencyUserModel> users =remoteSecurityService.listUserByUserIds(toke, product, appKey, Joiner.on(",").join(userIdList));
Map<String, String> userMap = new HashMap<String,String>();
for (int i = 0; i < users.size(); i++) {
userMap.put(users.get(i).getUserId(), users.get(i).getUserName());
}
List<LinkedHashMap> depts =remoteSecurityService.listDepartmentByDeptIds(toke, product, appKey, Joiner.on(",").join(deptIdList));
Map<String, String> deptMap = new HashMap<String,String>();
for (int i = 0; i < depts.size(); i++) {
deptMap.put(depts.get(i).get("sequenceNbr").toString(), depts.get(i).get("departmentName").toString());
}
content.forEach(e -> {
e.put("userName",userMap.get(e.get("createBy")));
e.put("deptName",deptMap.get(e.get("deptId")));
});
if(!CollectionUtils.isEmpty(content)){
Set<String> userIds = new HashSet<>();
Set<String> deptIds = new HashSet<>();
for(HashMap<String, Object> map : content)
{
String userId = String.valueOf(map.get("createBy"));
String deptId = String.valueOf(map.get("deptId"));
userIds.add(userId);
deptIds.add(deptId);
}
userIds.remove(null);
userIds.remove("");
deptIds.remove(null);
deptIds.remove("");
List<AgencyUserModel> users = new ArrayList<>();
if(!CollectionUtils.isEmpty(userIds)){
users = remoteSecurityService.listUserByUserIds(toke, product, appKey, Joiner.on(",").join(userIds));
}
Map<String, String> userMap = users.stream().collect(Collectors.toMap(AgencyUserModel::getUserId,AgencyUserModel::getRealName));
List<DepartmentModel> depts = new ArrayList<>();
if(!CollectionUtils.isEmpty(deptIds)){
depts = remoteSecurityService.listDepartmentByDeptIds(toke, product, appKey, Joiner.on(",").join(deptIds));
}
Map<String, String > deptMap = depts.stream().collect(Collectors.toMap(e-> e.getSequenceNbr().toString(),DepartmentModel::getDepartmentName));
content.forEach(e -> {
e.put("userName",userMap.get(e.get("createBy")));
e.put("deptName",deptMap.get(e.get("deptId")));
});
}
Page<HashMap<String, Object>> result = new PageImpl<>(content, param, total);
return result;
}
......
......@@ -8,28 +8,26 @@ import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collector;
import java.util.stream.Collectors;
import com.yeejoin.amos.fas.business.util.StringUtil;
import com.yeejoin.amos.fas.common.enums.ManageLevelEum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import com.google.common.base.Joiner;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.fas.business.dao.mapper.RiskLevelMapper;
import com.yeejoin.amos.fas.business.dao.repository.IRiskLevelDao;
import com.yeejoin.amos.fas.business.dao.repository.IRiskSourceDao;
import com.yeejoin.amos.fas.business.feign.RemoteSecurityService;
import com.yeejoin.amos.fas.business.param.CommonPageInfoParam;
import com.yeejoin.amos.fas.business.service.intfc.IRiskLevelService;
import com.yeejoin.amos.fas.business.util.StringUtil;
import com.yeejoin.amos.fas.common.enums.ManageLevelEum;
import com.yeejoin.amos.fas.dao.entity.RiskLevel;
import com.yeejoin.amos.fas.dao.entity.RiskSource;
import com.yeejoin.amos.fas.exception.YeeException;
import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
@Service("riskLevelService")
public class RiskLevelServiceImpl implements IRiskLevelService {
......@@ -46,26 +44,28 @@ public class RiskLevelServiceImpl implements IRiskLevelService {
public Page<HashMap<String, Object>> queryRiskLevelPage(String toke,String product,String appKey,CommonPageInfoParam param) {
long total = riskLevelMapper.countPageData(param);
List<HashMap<String, Object>> content = riskLevelMapper.queryRiskLevelPage(param);
Set<String> userIdList = new HashSet<String>();
for(HashMap<String, Object> map : content)
{
userIdList.add(String.valueOf(map.get("createBy")));
if(!CollectionUtils.isEmpty(content)){
Set<String> userIds = new HashSet<String>();
for(HashMap<String, Object> map : content)
{
String userId = String.valueOf(map.get("createBy"));
userIds.add(userId);
}
userIds.remove(null);
userIds.remove("");
List<AgencyUserModel> users = new ArrayList<>();
if(!CollectionUtils.isEmpty(userIds)){
users = remoteSecurityService.listUserByUserIds(toke, product, appKey, Joiner.on(",").join(userIds));
}
Map<String, String> userMap = users.stream().collect(Collectors.toMap(AgencyUserModel::getUserId, AgencyUserModel::getRealName));
content.forEach(e -> {
e.put("userName", userMap.get(String.valueOf(e.get("createBy"))));
e.put("manageLevelName",
StringUtil.isNotEmpty(e.get("manageLevel")) ? ManageLevelEum.getNameByManageLevel(Integer.parseInt(e.get("manageLevel").toString())) : "");
});
}
Map<String, String> userMap = new HashMap<String,String>();
if(userIdList.size()>0)
{
List<AgencyUserModel> users =remoteSecurityService.listUserByUserIds(toke, product, appKey, Joiner.on(",").join(userIdList));
for (int i = 0; i < users.size(); i++) {
userMap.put(users.get(i).getUserId(), users.get(i).getUserName());
}
}
content.forEach(e -> {
e.put("userName",userMap.get(String.valueOf(e.get("createBy"))));
e.put("manageLevelName",
StringUtil.isNotEmpty(e.get("manageLevel")) ? ManageLevelEum.getNameByManageLevel(Integer.parseInt(e.get("manageLevel").toString())) : "");
});
return new PageImpl<>(content, param, total);
}
......
package com.yeejoin.amos.fas.business.service.impl;
import java.lang.reflect.Method;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import org.typroject.tyboot.core.foundation.context.SpringContextHelper;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yeejoin.amos.fas.business.action.CustomerAction;
import com.yeejoin.amos.fas.business.dao.mapper.RuleRuningSnapshotMapper;
import com.yeejoin.amos.fas.business.service.intfc.IRuleRunningSnapshotService;
import com.yeejoin.amos.fas.business.service.model.BasicsRo;
import com.yeejoin.amos.fas.business.service.model.RuleRuningSnapshot;
/**
*
* <pre>
* 三维节点与规则消息实体视图service实现
* </pre>
*
* @author amos
* @version $Id: NodeMsgViewServiceImpl.java, v 0.1 2018年11月28日 下午6:14:51 amos Exp
* $
*/
@Service("ruleRunningSnapshotService")
public class RuleRunigSnapshotServiceImpl
implements IRuleRunningSnapshotService
//,ExecuteMethodHook
{
//IRuleRuningSnapshotRepository repository;
private RuleRuningSnapshotMapper ruleRuningSnapshotMapper;
private static String replayBatchNo = null;
static ObjectMapper objectMapper;
private final Logger logger = LoggerFactory.getLogger(RuleRunigSnapshotServiceImpl.class);
static {
objectMapper = new ObjectMapper();
}
// public RuleRunigSnapshotServiceImpl(IRuleRuningSnapshotRepository repository)
// {
// super(repository);
// // TODO Auto-generated constructor stub
// this.repository = repository;
// ExecuteMethodHook.hook.add(this);
// }
//
//
// /**
// * 保存动作记录
// * @param methodName
// * @param paramsAndTypes
// * @param matchedObj
// */
// public void process(Object bean,String methodName,String paramsAndTypes,Object matchedObj)
// {
//
// if(bean instanceof CustomerAction)
// {
// Set set = (Set) matchedObj;
// BasicsRo fireEquimentDataRo = (BasicsRo) set.iterator().next();
//
// RuleRuningSnapshot ruleRuningSnapshot = new RuleRuningSnapshot();
// ruleRuningSnapshot.setId(UUID.randomUUID().toString());
// ruleRuningSnapshot.setMethodClass(bean.getClass().getName());
// ruleRuningSnapshot.setMethodName(methodName);
// ruleRuningSnapshot.setMethodParam(paramsAndTypes);
//
// ruleRuningSnapshot.setBatchNo(fireEquimentDataRo.getBatchNo());
// ruleRuningSnapshot.setPackageId(fireEquimentDataRo.getPackageId());
// ruleRuningSnapshot.setEquipmentId(String.valueOf(fireEquimentDataRo.getId()));
//
// Date now = new Date();
// ruleRuningSnapshot.setCreateTime(now);
// ruleRuningSnapshot.setCreateMillisecond(String.valueOf(now.getTime()));
// ruleRuningSnapshot.setPreviousInterval(0L);
// RuleRuningSnapshot oldEntity = repository.querForObject(fireEquimentDataRo.getBatchNo());
// if(oldEntity != null)
// ruleRuningSnapshot.setPreviousInterval(now.getTime() - Long.parseLong(oldEntity.getCreateMillisecond()));
// this.repository.save(ruleRuningSnapshot);
// }
// }
@Async
public void replay(String batchNo) throws Exception
{
if(replayBatchNo != null)
throw new Exception("一次只能回放一个预案记录.");
try
{
replayBatchNo = batchNo;
List<RuleRuningSnapshot> oldEntityList=ruleRuningSnapshotMapper.querForObjectList(batchNo);
// List<RuleRuningSnapshot> oldEntityList = repository.querForObjectList(batchNo);
if(!CollectionUtils.isEmpty(oldEntityList))
{
logger.info("开始回放:batchNo="+batchNo);
logger.info("获取到动作记录个数:"+oldEntityList.size());
int count = 0;
for(RuleRuningSnapshot snapshot : oldEntityList)
{
if(replayBatchNo == null)
return ;
//延迟
logger.info("开始执行第"+(++count)+"个动作.");
logger.info("方法名:"+snapshot.getMethodClass()+"."+snapshot.getMethodName());
logger.info("需要延迟"+snapshot.getPreviousInterval()+"毫秒.......");
Thread.sleep(snapshot.getPreviousInterval());
try
{
Class clzz = Class.forName(snapshot.getMethodClass());
Object obj = SpringContextHelper.getBean(clzz);
Method[] methods=clzz.getMethods();
if(!StringUtils.isEmpty(snapshot.getMethodParam()))
{
for(Method method:methods)
{
if(replayBatchNo == null)
return ;
String name=method.getName();
if(!name.equals(snapshot.getMethodName())){
continue;
}
Map paramsMap = objectMapper.readValue(snapshot.getMethodParam(), Map.class);
List<String> datatypes = (List<String>)paramsMap.get("datatypes");
List<Object> values = (List<Object>)paramsMap.get("values");
Object[] params = new Object[values.size()];
for(int i = 0;i<datatypes.size();i++)
{
if(replayBatchNo == null)
return ;
String typeStr = datatypes.get(i);
Object value = values.get(i);
String valueStr = objectMapper.writeValueAsString(value);
Class valueClzz = Class.forName(typeStr);
params[i] = objectMapper.readValue(valueStr,valueClzz);
}
method.invoke(obj,params);
}
}else{
Method method = clzz.getMethod(snapshot.getMethodName(),new Class[]{});
method.invoke(obj);
}
logger.info("第"+(count)+"个动作执行成功.");
}catch (Exception e)
{
logger.info("第"+(count)+"个动作执行失败.");
e.printStackTrace();
logger.error(e.getMessage(),e);
}
}
}
}catch (Exception e)
{
logger.info("回放失败.");
logger.error(e.getMessage(),e);
}finally {
replayBatchNo = null;
}
}
public static String getReplayBatchNo() {
return replayBatchNo;
}
public static void setReplayBatchNoToNull() {
RuleRunigSnapshotServiceImpl.replayBatchNo = null;
}
}
\ No newline at end of file
......@@ -310,9 +310,8 @@ public class View3dServiceImpl implements IView3dService {
//3.统计巡检异常数量(不合格、漏检)-日期+机构
Long checkExceptionNum = this.getCheckExceptionNum(orgCode,date);
vo.setCheckExceptionNum(checkExceptionNum);
//4.统计火灾报警数量-日期+机构
//TODO:待毛颖确认调整完成后继续
vo.setFireExceptionNum(0L);
//4.统计故障数量-日期+机构
vo.setFireExceptionNum(getFireExceptionNum(orgCode,date));
} else {
throw new YeeException("机构:"+orgCode+" 不存在");
}
......@@ -354,6 +353,15 @@ public class View3dServiceImpl implements IView3dService {
});
} else if(StatisticsErrorTypeEum.equip.getCode().equals(type)){
//TODO:待毛颖确认调整完成后继续
List<CheckErrorBo> checkErrorBoList = view3dMapper.getAllFaultAlarm(params);
Map<String,List<CheckErrorBo>> map = checkErrorBoList.stream().collect(Collectors.groupingBy(CheckErrorBo::getStatus));
map.forEach((k,v)->{
SafetyIndexDetailVo safetyIndexDetailVo = new SafetyIndexDetailVo();
safetyIndexDetailVo.setTypeCode(k);
safetyIndexDetailVo.setTypeName(k);
safetyIndexDetailVo.setContent(getErrorContentVos(v));
resultList.add(safetyIndexDetailVo);
});
}
return resultList;
}
......@@ -382,6 +390,13 @@ public class View3dServiceImpl implements IView3dService {
param.put("date", date);
return view3dMapper.countUpperRiskPoint(param);
}
private Long getFireExceptionNum(String orgCode, String date) {
Map<String,Object> params = new HashMap<>();
params.put("orgCode", orgCode);
params.put("date", date);
return view3dMapper.countFireException(params);
}
private double changeRpnToSafetyIndex(BigDecimal rpn) {
BigDecimal rpnBig = rpn == null ? new BigDecimal("0") : rpn;
......@@ -408,9 +423,8 @@ public class View3dServiceImpl implements IView3dService {
if (optional.isPresent()) {
List<RiskSource> regionList = iRiskSourceDao.findByParentIdAndIsRegion(optional.get().getId(),RiskSourceRegionEum.TRUE.getCode());
exceptionList = regionList.stream().filter(riskSource -> {
//TODO:待毛颖确认,增加判断故障的规则(统计数据:故障或者rpn上升)
BigDecimal rpnBig = riskSource.getRpn() == null ? new BigDecimal("0") : riskSource.getRpn();
return rpnBig.subtract(riskSource.getRpni()).doubleValue() > 0;
BigDecimal rpn = riskSource.getRpn() == null ? new BigDecimal("0") : riskSource.getRpn();
return rpn.subtract(riskSource.getRpni()).doubleValue() > 0;
}).map(riskSource -> {
ExceptionRegionVo regionVo = new ExceptionRegionVo();
regionVo.setId(riskSource.getId());
......@@ -418,7 +432,8 @@ public class View3dServiceImpl implements IView3dService {
regionVo.setUe4Rotation(getInitJSONArray(riskSource.getUe4Rotation()));
regionVo.setUe4Extent(getInitJSONArray(riskSource.getUe4Extent()));
regionVo.setSafetyIndex(changeRpnToSafetyIndex(riskSource.getRpn()));
regionVo.setBreakdown(isBreakDown(riskSource.getId()));
regionVo.setBreakdown(isBreakDown(riskSource.getId()));//待后期去掉,前端图标显示统一不在细分
regionVo.setRoutePath(this.changeStringToJson(riskSource.getRoutePath()));
return regionVo;
}).collect(Collectors.toList());
}
......@@ -433,8 +448,15 @@ public class View3dServiceImpl implements IView3dService {
}
}
private JSONObject changeStringToJson(String str){
if(StringUtil.isNotEmpty(str)){
return JSON.parseObject(str);
}else {
return new JSONObject();
}
}
private Boolean isBreakDown(Long id){
//TODO:判断是否故障,待毛颖确认
return true;
}
......@@ -468,23 +490,24 @@ public class View3dServiceImpl implements IView3dService {
case "check"://巡检异常
return view3dMapper.getCheckErrorTop5(orgCode);
case "fire":
return JSON.parseArray(" [\r\n" +
" {\r\n" +
" \"id\": 35781,\r\n" +
" \"code\": \"s001\",\r\n" +
" \"label\": \"设备test\",\r\n" +
" \"pointId\": \"1\",\r\n" +
" \"type\": \"check\",\r\n" +
" \"changeDate\": \"2020-04-23 14:31:31\"\r\n" +
" },\r\n" +
" {\r\n" +
" \"id\": 35780,\r\n" +
" \"code\": \"s002\",\r\n" +
" \"label\": \"设备002\",\r\n" +
" \"pointId\": \"23123\",\r\n" +
" \"type\": \"check\",\r\n" +
" \"changeDate\": \"2020-04-23 14:31:27\"\r\n" +
" }]", SafetyExecuteBo.class);
return view3dMapper.getFireAlarmTop5(orgCode);
// return JSON.parseArray(" [\r\n" +
// " {\r\n" +
// " \"id\": 35781,\r\n" +
// " \"code\": \"s001\",\r\n" +
// " \"label\": \"设备test\",\r\n" +
// " \"pointId\": \"1\",\r\n" +
// " \"type\": \"check\",\r\n" +
// " \"changeDate\": \"2020-04-23 14:31:31\"\r\n" +
// " },\r\n" +
// " {\r\n" +
// " \"id\": 35780,\r\n" +
// " \"code\": \"s002\",\r\n" +
// " \"label\": \"设备002\",\r\n" +
// " \"pointId\": \"23123\",\r\n" +
// " \"type\": \"check\",\r\n" +
// " \"changeDate\": \"2020-04-23 14:31:27\"\r\n" +
// " }]", SafetyExecuteBo.class);
default:
throw new YeeException("不支持的类型 -->"+ type);
}
......@@ -500,9 +523,10 @@ public class View3dServiceImpl implements IView3dService {
}
@Override
public Object getEquipStatusList(String orgCode) {
return JSON.parseArray("[{\"id\":1,\"label\":\"设备1 label\",\"changeDate\":\"2020-04-26 10:00:00\"}"
+ ",{\"id\":2,\"label\":\"设备2 label\",\"changeDate\":\"2020-04-25 10:00:00\"}]");
public List<SafetyExecuteBo> getEquipStatusList(String orgCode) {
return view3dMapper.getEquipStatusTop5(orgCode);
// return JSON.parseArray("[{\"id\":1,\"label\":\"设备1 label\",\"changeDate\":\"2020-04-26 10:00:00\"}"
// + ",{\"id\":2,\"label\":\"设备2 label\",\"changeDate\":\"2020-04-25 10:00:00\"}]");
}
@Override
......
......@@ -20,5 +20,5 @@ public interface IContingencyInstance {
void fire(String batchNo,String stepCode, String contingencyPlanId, String buttonCode,String buttonState,String stepStateOnbutton) throws Exception;
void updateStep(String step, String batchNo);
}
......@@ -20,7 +20,7 @@ public interface IFmeaService {
/**
* 分页查询Fmea
*/
Page<HashMap<String, Object>> queryFmeaList(CommonPageInfoParam param);
Page<HashMap<String, Object>> queryFmeaList(CommonPageInfoParam param,String toke,String product,String appKey);
//
// void updateRpniInfo(Long riskSourceId);
......
package com.yeejoin.amos.fas.business.service.intfc;
import com.yeejoin.amos.fas.business.bo.BindRegionBo;
import com.yeejoin.amos.fas.business.bo.JpushMsgBo;
import com.yeejoin.amos.fas.business.param.AlarmParam;
import com.yeejoin.amos.fas.business.param.CommonPageInfoParam;
import com.yeejoin.amos.fas.business.param.FmeaBindParam;
......@@ -108,9 +109,9 @@ public interface IRiskSourceService {
Integer getChildTypeByPid(Long riskSourceId);
void notifyFmeaFromAbnormal(String toke,String product,String appKey,Long fmeaId, String notifyType);
void notifyFmeaFromAbnormal(String toke,String product,String appKey,Long fmeaId, String notifyType,String userName, String relationName);
void notifyFmeaFromUpdate(String toke,String product,String appKey,Long fmeaId, String nofityType);
void notifyFmeaFromUpdate(String toke,String product,String appKey,Long fmeaId, String nofityType,String userName);
/**
* 按照机构重新区域树
......@@ -133,7 +134,7 @@ public interface IRiskSourceService {
*/
void batchSaveRegionUe4(List<BindRegionBo> regionBoList);
void notifyRiskSource(Long fmeaId, Long riskSourceId, String notifyType, Set<String> jpushTargets);
void notifyRiskSource(Long fmeaId, Long riskSourceId, String notifyType, JpushMsgBo jpushMsgBo);
void notifyFmeaFromDelete(Long handId, String from);
......
package com.yeejoin.amos.fas.business.service.intfc;
/**
*
* <pre>
* 三维节点与规则消息实体视图service
* </pre>
*
* @version $Id: INodeMsgViewService.java, v 0.1 2019年1月2日 下午2:48:40 amos Exp $
*/
public interface IRuleRunningSnapshotService
{
void replay(String batchNo) throws Exception;
}
......@@ -112,7 +112,7 @@ public interface IView3dService {
* @param orgCode
* @return
*/
Object getEquipStatusList(String orgCode);
List<SafetyExecuteBo> getEquipStatusList(String orgCode);
/**
* 左侧菜单(异常点)
......
......@@ -21,6 +21,11 @@ public class ProtalDataRo extends BasicsRo {
private String userName;
/**
* 巡检人员
*/
private String checkUser;
/**
* 任务编号,如果无任务,则填充0
*/
private long taskId = 0;
......@@ -92,6 +97,14 @@ public class ProtalDataRo extends BasicsRo {
this.originalTaskState = originalTaskState;
}
public String getCheckUser() {
return checkUser;
}
public void setCheckUser(String checkUser) {
this.checkUser = checkUser;
}
public String getTaskName() {
return taskName;
}
......
package com.yeejoin.amos.fas.business.service.model;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import java.io.Serializable;
import java.util.Date;
@Entity
@Table(name = "toip_rm_snapshot")
public class RuleRuningSnapshot implements Serializable {
private static final long serialVersionUID = 292329658525267887L;
@Id
private String id ;
@Column(name = "batch_no")
private String batchNo ;// '规则执行的批次号',
@Column(name = "package_id")
private String packageId ;// '规则包id',
@Column(name = "method_class")
private String methodClass ;// 'bean方法的类名',
@Column(name = "method_name")
private String methodName ;// 'bean方法名',
@Column(name = "equipment_id")
private String equipmentId ;// '设备类型',
@Column(name = "method_param")
private String methodParam ;// 方法参数',
@Column(name = "create_time")
private Date createTime ;// 创建时间',
@Column(name = "create_millisecond")
private String createMillisecond ;// 当前动作执行时的毫秒数',
@Column(name = "previous_interval")
private Long previousInterval ;// 与上一次的动作执行的时间差',
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getBatchNo() {
return batchNo;
}
public void setBatchNo(String batchNo) {
this.batchNo = batchNo;
}
public String getPackageId() {
return packageId;
}
public void setPackageId(String packageId) {
this.packageId = packageId;
}
public String getMethodClass() {
return methodClass;
}
public void setMethodClass(String methodClass) {
this.methodClass = methodClass;
}
public String getMethodName() {
return methodName;
}
public void setMethodName(String methodName) {
this.methodName = methodName;
}
public String getEquipmentId() {
return equipmentId;
}
public void setEquipmentId(String equipmentId) {
this.equipmentId = equipmentId;
}
public String getMethodParam() {
return methodParam;
}
public void setMethodParam(String methodParam) {
this.methodParam = methodParam;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public String getCreateMillisecond() {
return createMillisecond;
}
public void setCreateMillisecond(String createMillisecond) {
this.createMillisecond = createMillisecond;
}
public Long getPreviousInterval() {
return previousInterval;
}
public void setPreviousInterval(Long previousInterval) {
this.previousInterval = previousInterval;
}
}
package com.yeejoin.amos.fas.business.service.model;
import com.yeejoin.amos.fas.core.util.CommonResponse;
import com.yeejoin.amos.fas.dao.entity.BusinessEntity;
/**
*
* <pre>
*
* </pre>
*
* @author HK
* @version $Id: ToipResponse.java, v 0.1 2018年1月26日 下午5:02:12 HK Exp $
*/
public class ToipResponse extends CommonResponse
{
// 具体界面域由三部分组成: [IFDomain].[group].[template], 其中 group可选 [IFDomain].[template]
// dispatch.map.marker.basic
/**
* <pre>
*
* </pre>
*/
private static final long serialVersionUID = 1L;
/**
* 界面域
* 例如
* dispatch.map
*/
private String IFDomain;
/**
* 模板类型
* 例如
* basic
*/
private String template;
/**
* 模板组
* 例如
* marker
*/
private String group;
/**
* 智能体业务对象
*/
private BusinessEntity bizObj;
/**
* 动作ID
*/
private String actionId;
/**
* 火灾id
*/
private String fireId;
private String domainView;
public String getIFDomain()
{
return IFDomain;
}
public void setIFDomain(String iFDomain)
{
IFDomain = iFDomain;
}
public String getTemplate()
{
return template;
}
public void setTemplate(String template)
{
this.template = template;
}
public String getGroup()
{
return group;
}
public void setGroup(String group)
{
this.group = group;
}
public BusinessEntity getBizObj() {
return bizObj;
}
public void setBizObj(BusinessEntity bizObj) {
this.bizObj = bizObj;
}
public String getActionId() {
return actionId;
}
public void setActionId(String actionId) {
this.actionId = actionId;
}
public String getDomainView() {
return domainView;
}
public void setDomainView(String domainView) {
this.domainView = domainView;
}
public String getFireId() {
return fireId;
}
public void setFireId(String fireId) {
this.fireId = fireId;
}
}
package com.yeejoin.amos.fas.business.vo;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import springfox.documentation.spring.web.json.Json;
/**
* @author suhg
*/
......@@ -32,6 +36,11 @@ public class ExceptionRegionVo {
*/
private JSONArray ue4Extent;
/**
* 自研3维区域参数
*/
private JSONObject routePath;
public Long getId() {
return id;
}
......@@ -68,6 +77,14 @@ public class ExceptionRegionVo {
return ue4Extent;
}
public JSONObject getRoutePath() {
return routePath;
}
public void setRoutePath(JSONObject routePath) {
this.routePath = routePath;
}
public void setUe4Extent(JSONArray ue4Extent) {
this.ue4Extent = ue4Extent;
}
......
......@@ -6,11 +6,39 @@ public class FmeaMessage {
private String norifyFrom;
private String userName;
/**
* 设备名称或者巡检点名称
*/
private String relationName;
private String checkStatus;
public FmeaMessage(Long handId, String norifyFrom,String userName) {
this.handId = handId;
this.norifyFrom = norifyFrom;
this.userName = userName;
}
public FmeaMessage(Long handId, String norifyFrom) {
this.handId = handId;
this.norifyFrom = norifyFrom;
}
public FmeaMessage(Long handId, String norifyFrom,String userName, String relationName, String checkStatus) {
this.handId = handId;
this.norifyFrom = norifyFrom;
this.userName = userName;
this.relationName = relationName;
this.checkStatus = checkStatus;
}
public Long getHandId() {
return handId;
}
......@@ -26,4 +54,28 @@ public class FmeaMessage {
public void setNorifyFrom(String norifyFrom) {
this.norifyFrom = norifyFrom;
}
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
public String getRelationName() {
return relationName;
}
public void setRelationName(String relationName) {
this.relationName = relationName;
}
public String getCheckStatus() {
return checkStatus;
}
public void setCheckStatus(String checkStatus) {
this.checkStatus = checkStatus;
}
}
......@@ -26,12 +26,11 @@ public class RsDataQueue {
private IRiskSourceService riskSourceService;
private volatile static RsDataQueue instance = null;
private static final String TOKE = "TOKE";
@Autowired
private RemoteSecurityService remoteSecurityService;
private RsDataQueue() {
riskSourceService = (IRiskSourceService) IotContext.getInstance().getBean(IRiskSourceService.class);
remoteSecurityService = (RemoteSecurityService)IotContext.getInstance().getBean(RemoteSecurityService.class);
}
/**
......@@ -62,16 +61,21 @@ public class RsDataQueue {
service_apdu.execute(task_runnable);
}
public void addUpdateMessage(Long fmeaId) {
blockingQueue.add(new FmeaMessage(fmeaId, TriggerRpnChangeTypeEum.fmeaUpdate.getCode()));
public void addUpdateMessage(Long fmeaId,String userName) {
blockingQueue.add(new FmeaMessage(fmeaId, TriggerRpnChangeTypeEum.fmeaUpdate.getCode(),userName));
}
public void addPatrolMessage(Long fmeaId) {
blockingQueue.add(new FmeaMessage(fmeaId, TriggerRpnChangeTypeEum.patrol.getCode()));
}
public void addEquipmentMessage(Long fmeaId) {
blockingQueue.add(new FmeaMessage(fmeaId, TriggerRpnChangeTypeEum.equipment.getCode()));
public void addPatrolMessage(Long fmeaId, String userName, String pointName, String checkStatus) {
blockingQueue.add(new FmeaMessage(fmeaId, TriggerRpnChangeTypeEum.patrol.getCode(),userName,pointName,checkStatus));
}
public void addEquipmentMessage(Long fmeaId,String equipmentName) {
blockingQueue.add(new FmeaMessage(fmeaId, TriggerRpnChangeTypeEum.alarm.getCode(),"",equipmentName,""));
}
public void addDeleteMessage(Long riskSourceId) {
......@@ -99,15 +103,17 @@ public class RsDataQueue {
}
String from = fmeaMessage.getNorifyFrom();
Long handId = fmeaMessage.getHandId();
String userName = fmeaMessage.getUserName();
String relationName = fmeaMessage.getRelationName();
if (from.equals(TriggerRpnChangeTypeEum.patrol.getCode())) {
//巡检不合格通知
riskSourceService.notifyFmeaFromAbnormal(toke.getToke(), toke.getProduct(), toke.getAppKey(), handId, from);
} else if (from.equals(TriggerRpnChangeTypeEum.equipment.getCode())) {
riskSourceService.notifyFmeaFromAbnormal(toke.getToke(), toke.getProduct(), toke.getAppKey(), handId, from, userName,relationName);
} else if (from.equals(TriggerRpnChangeTypeEum.alarm.getCode())) {
//设备告警
riskSourceService.notifyFmeaFromAbnormal(toke.getToke(), toke.getProduct(), toke.getAppKey(), handId, from);
riskSourceService.notifyFmeaFromAbnormal(toke.getToke(), toke.getProduct(), toke.getAppKey(), handId, from, userName,relationName);
} else if (from.equals(TriggerRpnChangeTypeEum.fmeaUpdate.getCode())) {
//危险因素评价修改通知
riskSourceService.notifyFmeaFromUpdate(toke.getToke(), toke.getProduct(), toke.getAppKey(), handId, from);
riskSourceService.notifyFmeaFromUpdate(toke.getToke(), toke.getProduct(), toke.getAppKey(), handId, from, userName);
} else if (from.equals(TriggerRpnChangeTypeEum.fmeaDelete.getCode())) {
//危险因素删除通知
riskSourceService.notifyFmeaFromDelete(handId, from);
......@@ -117,7 +123,7 @@ public class RsDataQueue {
}
}
} catch (Exception e) {
LoggerFactory.getLogger(this.getClass()).error(e.getMessage());
LoggerFactory.getLogger(this.getClass()).error(e.getMessage(),e);
}
}
}
......
......@@ -61,20 +61,21 @@ public class StringUtil {
* @return 是否数字的标志
*/
public static boolean isNumeric(String str) {
// 该正则表达式可以匹配所有的数字 包括负数
String bigStr;
try {
bigStr = new BigDecimal(str).toString();
} catch (Exception e) {
return false;// 异常 说明包含非数字。
}
// 该正则表达式可以匹配所有的数字 包括负数
Pattern pattern = Pattern.compile("-?[0-9]+(\\.[0-9]+)?");
String bigStr;
try {
bigStr = new BigDecimal(str).toString();
} catch (Exception e) {
return false;//异常 说明包含非数字。
}
Matcher isNum = numericPattern.matcher(bigStr); // matcher是全匹配
if (!isNum.matches()) {
return false;
}
return true;
}
Matcher isNum = pattern.matcher(bigStr); // matcher是全匹配
if (!isNum.matches()) {
return false;
}
return true;
}
public static int toInt(String s) {
if (s != null && !"".equals(s.trim())) {
......
......@@ -12,9 +12,9 @@ eureka.client.healthcheck.enabled = true
eureka.client.fetchRegistry = true
#DB properties:
spring.datasource.url=jdbc:mysql://47.103.14.66:3306/91-safety-business?allowMultiQueries=true&serverTimezone=GMT%2B8&characterEncoding=utf8
spring.datasource.url=jdbc:mysql://172.16.11.33:3306/safety-business-2.0?allowMultiQueries=true&serverTimezone=GMT%2B8&characterEncoding=utf8
spring.datasource.username=root
spring.datasource.password=root_123
spring.datasource.password=admin_1234
spring.datasource.driver-class-name = com.mysql.jdbc.Driver
spring.datasource.hikari.maxLifetime = 1765000
spring.datasource.hikari.maximum-pool-size = 10
......@@ -30,7 +30,7 @@ spring.data.mongodb.uri = mongodb://172.16.11.33:27017/iecmonitor
params.remoteRuleUrl=http://magintursh.xicp.net:18080/
params.remoteWebsocketUrl=http://172.16.10.91:10600/
spring.redis.database=5
spring.redis.database=1
spring.redis.host=172.16.11.33
spring.redis.port=6379
spring.redis.password=1234560
......@@ -45,3 +45,15 @@ file.uploadUrl=D:\\upload\\files\\
#picture read
file.readUrl=http://172.16.3.89:8083/file/getFile?in=
params.isPush=true
## emqx
emqx.clean-session=true
emqx.client-id=${spring.application.name}-${random.int[1024,65536]}
emqx.broker=tcp://172.16.10.85:1883
emqx.user-name=super
emqx.password=a123456
Push.fegin.name=PPMESSAGEPUSHSERVICE15
dutyMode.fegin.name=AMOS-DUTY
bussunis.domain=http://172.16.10.183:8083
\ No newline at end of file
......@@ -30,7 +30,7 @@ spring.data.mongodb.uri = mongodb://amos-mongo:27017/iecmonitor
params.remoteRuleUrl=http://station-rule:8080/
params.remoteWebsocketUrl=http://station-websocket:10600/
spring.redis.database=5
spring.redis.database=1
spring.redis.host=amos-redis
spring.redis.port=6379
spring.redis.password=redis2020
......@@ -45,3 +45,15 @@ file.uploadUrl=D:\\upload\\files\\
#picture read
file.readUrl=http://station-fireautosys:8083/file/getFile?in=
params.isPush=true
## emqx
emqx.clean-session=true
emqx.client-id=${spring.application.name}-${random.int[1024,65536]}
emqx.broker=tcp://172.16.10.85:1883
emqx.user-name=super
emqx.password=a123456
Push.fegin.name=AMOS-PUSH
dutyMode.fegin.name=AMOS-DUTY
bussunis.domain=http://172.16.10.183:8083
\ No newline at end of file
......@@ -30,7 +30,7 @@ spring.data.mongodb.uri = mongodb://172.16.11.33:27017/iecmonitor
params.remoteRuleUrl=http://magintursh.xicp.net:18080/
params.remoteWebsocketUrl=http://172.16.10.91:10600/
spring.redis.database=5
spring.redis.database=1
spring.redis.host=127.0.0.1
spring.redis.port=6379
spring.redis.password=
......@@ -45,3 +45,15 @@ file.uploadUrl=D:\\upload\\files\\
#picture read
file.readUrl=http://172.16.3.89:8083/file/getFile?in=
params.isPush=true
## emqx
emqx.clean-session=true
emqx.client-id=${spring.application.name}-${random.int[1024,65536]}
emqx.broker=tcp://172.16.10.85:1883
emqx.user-name=super
emqx.password=a123456
Push.fegin.name=PPMESSAGEPUSHSERVICE15
dutyMode.fegin.name=AMOS-DUTY
bussunis.domain=http://172.16.10.183:8083
\ No newline at end of file
spring.application.name = AMOS-AUTOSYS-XKQ1
spring.application.name = AMOS-AUTOSYS
server.port = 8083
......
......@@ -240,4 +240,43 @@
add COLUMN `flicker_frequency` int(11) DEFAULT 0 COMMENT '闪烁频率' after `status`;
</sql>
</changeSet>
<changeSet author="maoying" id="1589444792914-1">
<preConditions onFail="MARK_RAN">
<tableExists tableName="f_alarm"/>
</preConditions>
<comment>create table f_alarm</comment>
<sql>
DROP TABLE IF EXISTS f_alarm;
CREATE TABLE `f_alarm` (
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '主键',
`org_code` varchar(100) NOT NULL COMMENT '机构编号',
`fire_equipment_id` bigint(20) NOT NULL DEFAULT '0' COMMENT '消防设备id',
`fire_equipment_code` varchar(255) NOT NULL COMMENT '设备编码',
`fire_equipment_name` varchar(255) NOT NULL COMMENT '设备名称',
`fire_equipment_point_id` bigint(20) NOT NULL COMMENT '消防点位id',
`fire_equipment_point_code` varchar(255) NOT NULL COMMENT '消防点位名称',
`fire_equipment_point_name` varchar(255) NOT NULL,
`fire_equipment_point_value` varchar(500) DEFAULT NULL COMMENT '报警值',
`frequency` int(10) NOT NULL DEFAULT '1' COMMENT '发生频次',
`status` bit(1) DEFAULT b'1' COMMENT '报警状态:1报警0恢复',
`type` varchar(50) NOT NULL COMMENT '报警类型:alarm_type_fire(火灾报警)/alarm_type_trouble(故障告警)',
`create_date` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_date` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
`recovery_date` datetime DEFAULT NULL COMMENT '告警恢复时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='报警信息表';
</sql>
</changeSet>
<changeSet author="suhuiguang" id="1589769364577-1">
<preConditions onFail="MARK_RAN">
<columnExists tableName="f_risk_level " columnName="manage_level"/>
</preConditions>
<comment>f_risk_level 增加管控级别 初始化数据</comment>
<sql>
update f_risk_level set manage_level = 1 where level = '1';
update f_risk_level set manage_level = 2 where level = '2';
update f_risk_level set manage_level = 3 where level = '3';
update f_risk_level set manage_level = 4 where level = '4';
</sql>
</changeSet>
</databaseChangeLog>
\ No newline at end of file
......@@ -122,4 +122,18 @@
</sql>
</changeSet>
<changeSet author="maoying" id="1589954524000-1" runOnChange="true">
<comment>updatePointConfig 触发器创建</comment>
<sql endDelimiter="#">
DROP TRIGGER IF EXISTS `updatePointConfig`;
CREATE TRIGGER `updatePointConfig` AFTER UPDATE ON `p_point` FOR EACH ROW
BEGIN
IF (new.name != old.name)
THEN
UPDATE p_point_config pc SET pc.`name` = CONCAT(new.name,'合格') WHERE pc.name LIKE '%合格' AND pc.point_id = new.id;
UPDATE p_point_config pc SET pc.`name` = CONCAT(new.name,'漏检') WHERE pc.name LIKE '%漏检' AND pc.point_id = new.id;
END IF;
END#
</sql>
</changeSet>
</databaseChangeLog>
\ No newline at end of file
......@@ -152,8 +152,8 @@
</if>
</where>
order by a.create_date desc
<if test="pageSize!=null and pageSize!=-1 and pageNumber!=null">
limit #{pageNumber},#{pageSize}
<if test="pageSize!=null and pageSize!=-1 and offset!=null">
limit #{offset},#{pageSize}
</if>
</select>
......@@ -429,8 +429,6 @@
<foreach collection="list" item="item" index="index" open="(" separator="," close=")">
#{item}
</foreach>
and
fire_equipment_id = 0
</delete>
</mapper>
\ No newline at end of file
......@@ -24,6 +24,7 @@
a.name,
a.color,
a.create_by as createBy,
a.manage_level manageLevel,
a.create_date as createDate,
a.remark,
a.manage_level as manageLevel
......
......@@ -609,7 +609,8 @@
wr.max_level,
wr.area,
ep.CODE,
wr.`name`
wr.`name`,
ep.value
FROM
f_fire_equipment_point ep
INNER JOIN f_water_resource_equipment wre ON wre.fire_equipment_id = ep.fire_equipment_id AND ep.type = 'ANALOGUE'
......@@ -669,8 +670,8 @@
<if test="riskLevelId != null">
risk_level_id = #{riskLevelId},
</if>
<if test="flicker_frequency != null">
flicker_frequency = #{flicker_frequency}
<if test="flickerFrequency != null">
flicker_frequency = #{flickerFrequency}
</if>
</set>
where id = #{id}
......
<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.fas.business.dao.mapper.RuleRuningSnapshotMapper">
<select id="querForObject" resultType="com.yeejoin.amos.fas.business.service.model.RuleRuningSnapshot">
SELECT * FROM toip_rm_snapshot t WHERE t.batch_no = #{batchNo} ORDER BY t.create_millisecond DESC limit 0,1
</select>
<select id="querForObjectList" resultType="com.yeejoin.amos.fas.business.service.model.RuleRuningSnapshot">
SELECT * FROM toip_rm_snapshot t WHERE t.batch_no = #{batchNo} ORDER BY t.create_millisecond
</select>
</mapper>
\ No newline at end of file
......@@ -436,6 +436,19 @@
) pt
where #{date} BETWEEN pt.begin_date and pt.end_date
</select>
<select id="countFireException" resultType="long">
SELECT
count(1)
FROM
f_alarm a
WHERE
`status` = TRUE
AND org_code = #{orgCode}
AND type = 'alarm_type_trouble'
AND date_format(a.update_date, '%Y-%m-%d') = #{date}
</select>
<select id="getAllErrorRiskPoint" resultType="com.yeejoin.amos.fas.business.bo.RiskPointRpnChangeBo" >
SELECT
b.id,
......@@ -468,6 +481,23 @@
and a.org_code = #{orgCode}
</select>
<select id="getAllFaultAlarm" resultType="com.yeejoin.amos.fas.business.bo.CheckErrorBo">
SELECT
a.id,
a.fire_equipment_point_name as `name`,
fe.equip_type as status,
a.update_date as changeDate
FROM
f_alarm a
LEFT JOIN f_fire_equipment fe ON fe.id = a.fire_equipment_id
WHERE
`status` = TRUE
AND type = 'alarm_type_trouble'
AND a.org_code = #{orgCode}
AND date_format(a.update_date, '%Y-%m-%d') =#{date}
</select>
<select id="getStatisticsCheck" resultType="java.util.HashMap">
<![CDATA[
SELECT d.status as type, count(1) as value
......@@ -498,11 +528,42 @@
left join p_point I ON I.id = p.point_id
where p.is_ok IN ('2', '3')
AND I.is_delete = 0
AND p.org_code = #{org_code} or p.org_code like CONCAT(#{orgCode},'-','%')
AND p.org_code = #{orgCode} or p.org_code like CONCAT(#{orgCode},'-','%')
ORDER BY p.check_time desc
limit 0,5
</select>
<select id="getFireAlarmTop5" resultType="com.yeejoin.amos.fas.business.bo.SafetyExecuteBo">
SELECT
a.fire_equipment_id id,
a.fire_equipment_code code,
a.fire_equipment_point_name as `label`,
a.update_date as changeDate,
"monitorEquipment" type
FROM
f_alarm a
WHERE
a.org_code = #{orgCode}
AND a.`status` = TRUE
AND a.type = 'alarm_type_fire'
ORDER BY a.update_date DESC
limit 0,5
</select>
<select id="getEquipStatusTop5" resultType="com.yeejoin.amos.fas.business.bo.SafetyExecuteBo">
SELECT
fed.id,
fed.eq_point_name label,
fed.e_value status,
fed.create_date changeDate
FROM
f_fire_equipment_data fed
WHERE
fed.org_code = #{orgCode}
ORDER BY fed.create_date DESC
limit 0,5
</select>
<select id="getPintsByType" resultType="hashmap">
select CONCAT(type,'-',id) as `key`,sp.* from
(select id,name,code,ue4_location as ue4Location,ue4_rotation as ue4Rotation ,'riskSource' as type,org_code as orgCode,
......
......@@ -31,6 +31,11 @@
</properties>
<dependencies>
<dependency>
<groupId>com.yeejoin</groupId>
<artifactId>amos-component-rule</artifactId>
<version>1.1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
......
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