Commit 9e592a48 authored by suhuiguang's avatar suhuiguang

Merge branch 'dev_upgrade' of http://172.16.10.76/station/YeeAmosFireAutoSysRoot into dev_upgrade

# Conflicts: # YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/service/impl/ContingencyInstanceImpl.java # YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/service/impl/RiskSourceServiceImpl.java
parents 76128b63 28409f79
package com.yeejoin.amos.fas.dao.entity;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import org.hibernate.annotations.GenericGenerator;
/**
*
* <pre>
* 消息实体
* </pre>
*
* @author HK
* @version $Id: Message.java, v 0.1 2018年1月18日 下午7:48:58 HK Exp $
*/
@Entity
@Table(name = "toip_sys_message")
public class Message extends BusinessEntity
{
/**
* <pre>
*
* </pre>
*/
private static final long serialVersionUID = 292329658525267887L;
/**
* id
*/
@Id
@GeneratedValue(generator = "uuid")
@GenericGenerator(name = "uuid", strategy = "uuid2")
@Column(name = "id", nullable = false, length = 36)
protected String id;
/**
* 时间
*/
private Date time;
/**
* 标题
*/
private String title;
/**
* 内容
*/
private String content;
/**
* 类型
*/
private String type;
/**
* 发送者
*/
private String sender;
/**
* 接收者
*/
private String receiver;
/**
* 已读者
*/
private String reader;
/**
* 业务id
*/
private String bizId;
/**
* 业务员实体名,例如com.yeejoin.amos.toip.bizrulebridge.entity.Fire
*/
private String bizclassName;
public String getId()
{
return id;
}
public void setId(String id)
{
this.id = id;
}
public Date getTime()
{
return time;
}
public void setTime(Date time)
{
this.time = time;
}
public String getTitle()
{
return title;
}
public void setTitle(String title)
{
this.title = title;
}
public String getContent()
{
return content;
}
public void setContent(String content)
{
this.content = content;
}
public String getType()
{
return type;
}
public void setType(String type)
{
this.type = type;
}
public String getSender()
{
return sender;
}
public void setSender(String sender)
{
this.sender = sender;
}
public String getReceiver()
{
return receiver;
}
public void setReceiver(String receiver)
{
this.receiver = receiver;
}
public String getReader()
{
return reader;
}
public void setReader(String reader)
{
this.reader = reader;
}
public String getBizId()
{
return bizId;
}
public void setBizId(String bizId)
{
this.bizId = bizId;
}
public String getBizclassName()
{
return bizclassName;
}
public void setBizclassName(String bizclassName)
{
this.bizclassName = bizclassName;
}
}
package com.yeejoin.amos.fas.business.action;
import java.lang.reflect.Constructor;
import java.util.HashMap;
import java.util.Map;
import org.springframework.stereotype.Component;
import com.yeejoin.amos.fas.business.action.result.ActionResult;
import com.yeejoin.amos.fas.business.action.result.BubbleTipResult;
import com.yeejoin.amos.fas.business.action.result.message.ActionResultMessage;
import com.yeejoin.amos.fas.business.service.model.ToipResponse;
/**
*
* <pre>
* 气泡提示动作
* </pre>
*
* @author amos
* @version $Id: BubbleTipAction.java, v 0.1 2019年5月16日 上午10:42:32 amos Exp $
*/
@Component
public class BubbleTipAction implements CustomerAction
{
private static String PACKAGEURL = "com.yeejoin.amos.rule.map.action.result.message.";
//@ExposeAction("气泡提示")
public void sendBubbleTip(Object bizobj, Boolean showInfo, Object title, String type)
{
BubbleTipResult result = new BubbleTipResult();
Map<String, Object> tempmap1 = new HashMap<>();
tempmap1.put("bizobj", bizobj);
result.add(tempmap1);
//是否显示气泡
Map<String, Object> tempmap2 = new HashMap<>();
tempmap2.put("showInfo", showInfo);
result.add(tempmap2);
//显示title提示
Map<String, Object> tempmap3 = new HashMap<>();
tempmap3.put("title", title);
result.add(tempmap3);
//节点类型
Map<String, Object> tempmap4 = new HashMap<>();
tempmap4.put("type", type);
result.add(tempmap4);
Constructor<?> constructor;
try
{
constructor = Class.forName(
PACKAGEURL + result.getClass().getSimpleName() + "Message")
.getConstructor(ActionResult.class);
ActionResultMessage<?> action = (ActionResultMessage<?>) constructor.newInstance(result);
String firstStr = "fromws";
String secondStr = "map";
String thirdStr = "bubble";
Object obj = action.execute(firstStr, secondStr, thirdStr);
result.setToipResponse((ToipResponse) obj);
}
catch (Exception e)
{
e.printStackTrace();
}
}
}
package com.yeejoin.amos.fas.business.action;
import java.lang.reflect.Constructor;
import java.util.HashMap;
import java.util.Map;
import org.springframework.stereotype.Component;
import com.yeejoin.amos.fas.business.action.result.ActionResult;
import com.yeejoin.amos.fas.business.action.result.BubbleTipResult;
import com.yeejoin.amos.fas.business.action.result.message.ActionResultMessage;
import com.yeejoin.amos.fas.business.service.model.ToipResponse;
/**
*
* <pre>
* 风险态势图动作
* </pre>
*
* @author amos
* @version $Id: RiskSituationAction.java, v 0.1 2019年5月16日 下午5:26:27 amos Exp $
*/
@Component
public class RiskSituationAction implements CustomerAction
{
private static String PACKAGEURL = "com.yeejoin.amos.rule.map.action.result.message.";
//@ExposeAction("气泡提示")
public void sendBubbleTip(Object bizobj, Boolean showInfo, String title)
{
BubbleTipResult result = new BubbleTipResult();
Map<String, Object> tempmap1 = new HashMap<>();
tempmap1.put("bizobj", bizobj);
result.add(tempmap1);
//是否显示气泡
Map<String, Object> tempmap2 = new HashMap<>();
tempmap2.put("showInfo", showInfo);
result.add(tempmap2);
//显示title提示
Map<String, Object> tempmap3 = new HashMap<>();
tempmap3.put("title", title);
result.add(tempmap3);
Constructor<?> constructor;
try
{
constructor = Class.forName(
PACKAGEURL + result.getClass().getSimpleName() + "Message")
.getConstructor(ActionResult.class);
ActionResultMessage<?> action = (ActionResultMessage<?>) constructor.newInstance(result);
String firstStr = "fromws";
String secondStr = "riskSituation";
String thirdStr = "bubble";
Object obj = action.execute(firstStr, secondStr, thirdStr);
result.setToipResponse((ToipResponse) obj);
}
catch (Exception e)
{
e.printStackTrace();
}
}
//@ExposeAction("区域颜色改变")
public void regionChange(Object bizobj, String colour)
{
BubbleTipResult result = new BubbleTipResult();
Map<String, Object> tempmap1 = new HashMap<>();
tempmap1.put("bizobj", bizobj);
result.add(tempmap1);
//更改颜色
Map<String, Object> tempmap2 = new HashMap<>();
tempmap2.put("colour", colour);
result.add(tempmap2);
Constructor<?> constructor;
try
{
constructor = Class.forName(
PACKAGEURL + result.getClass().getSimpleName() + "Message")
.getConstructor(ActionResult.class);
ActionResultMessage<?> action = (ActionResultMessage<?>) constructor.newInstance(result);
String firstStr = "fromws";
String secondStr = "riskSituation";
String thirdStr = "colour";
Object obj = action.execute(firstStr, secondStr, thirdStr);
result.setToipResponse((ToipResponse) obj);
}
catch (Exception e)
{
e.printStackTrace();
}
}
//@ExposeAction(value = "区域闪烁",snapshot = false)
public void regionFlicker(Object bizobj, Integer frequency)
{
BubbleTipResult result = new BubbleTipResult();
Map<String, Object> tempmap1 = new HashMap<>();
tempmap1.put("bizobj", bizobj);
result.add(tempmap1);
//更改颜色
Map<String, Object> tempmap2 = new HashMap<>();
tempmap2.put("frequency", frequency);
result.add(tempmap2);
Constructor<?> constructor;
try
{
constructor = Class.forName(
PACKAGEURL + result.getClass().getSimpleName() + "Message")
.getConstructor(ActionResult.class);
ActionResultMessage<?> action = (ActionResultMessage<?>) constructor.newInstance(result);
String firstStr = "fromws";
String secondStr = "riskSituation";
String thirdStr = "flicker";
Object obj = action.execute(firstStr, secondStr, thirdStr);
result.setToipResponse((ToipResponse) obj);
}
catch (Exception e)
{
e.printStackTrace();
}
}
}
package com.yeejoin.amos.fas.business.action;
import java.lang.reflect.Constructor;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.yeejoin.amos.fas.business.action.el.ELEvaluationContext;
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.result.TipResult;
import com.yeejoin.amos.fas.business.action.result.message.ActionResultMessage;
import com.yeejoin.amos.fas.business.action.util.DataItemUtil;
import com.yeejoin.amos.fas.business.service.model.BasicsRo;
import com.yeejoin.amos.fas.business.service.model.ToipResponse;
import com.yeejoin.amos.fas.dao.entity.BusinessEntity;
import com.yeejoin.amos.fas.dao.entity.Message;
/**
*
* <pre>
* 消息提示动作
* </pre>
*
* @author amos
* @version $Id: SimpleTipAction.java, v 0.1 2019年4月24日 下午2:47:37 amos Exp $
*/
@Component
public class SimpleTipAction implements CustomerAction
{
private static String PACKAGEURL = "com.yeejoin.amos.rule.map.action.result.message.";
// @Autowired
// private IMessageService messageService;
//@ExposeAction("消息提示")
// public void sendMessageTip(Object bizobj, String title, String content,String type)
// {
//
// try
// {
//
// ELEvaluationContext.setVariable("bizobj",bizobj);
// TipResult result = new TipResult();
// result.add(bizobj);
// Map<String, Object> tempmap1 = new HashMap<>();
// tempmap1.put("title", title);
// result.add(tempmap1);
// Map<String, Object> tempmap2 = new HashMap<>();
// content =DataItemUtil.getNative(content);
// tempmap2.put("content", content);
// result.add(tempmap2);
//
//
// Constructor<?> constructor;
//
// constructor = Class.forName(
// PACKAGEURL + result.getClass().getSimpleName() + "Message")
// .getConstructor(ActionResult.class);
// ActionResultMessage<?> action = (ActionResultMessage<?>) constructor.newInstance(result);
// String firstStr = "fromws";
// String secondStr = "global";
// String thirdStr = "msg";
// result.setBizObj((BusinessEntity)bizobj);
// Object obj = action.execute(firstStr, secondStr, thirdStr);
// result.setToipResponse((ToipResponse) obj);
// saveMessageAction(result,type);
// }
// catch (Exception e)
// {
// // TODO Auto-generated catch block
// e.printStackTrace();
// }
// }
// @SuppressWarnings("unchecked")
// private void saveMessageAction(AbstractActionResult abstractActionResult,String type)
// {
// Message message = new Message();
// List<Map<String, Object>> list = (List<Map<String, Object>>) abstractActionResult.getData();
// for(Map<String, Object> map : list) {
// for(String str: map.keySet()) {
// if(str.equals("content")) {
// message.setContent(map.get("content").toString());
// }else
// if (str.equals("title"))
// {
// message.setTitle(map.get("title").toString());
// }
// }
// BasicsRo basicsRo = (BasicsRo)abstractActionResult.getToipResponse().getBizObj();
// message.setTime(basicsRo.getDateTime());
// message.setBizId(basicsRo.getId());
// message.setBizclassName(abstractActionResult.getToipResponse().getBizObj().getClass().toString());
// message.setType(type);
// messageService.save(message);
// }
// }
}
package com.yeejoin.amos.fas.business.action.el;
import java.util.Map;
import org.springframework.expression.EvaluationContext;
import org.springframework.expression.ExpressionParser;
import org.springframework.expression.spel.standard.SpelExpressionParser;
import org.springframework.expression.spel.support.StandardEvaluationContext;
public class ELEvaluationContext
{
private static EvaluationContext instance = new StandardEvaluationContext();
private static ExpressionParser parser = new SpelExpressionParser();
public static EvaluationContext getInstance()
{
return instance;
}
public static void setVariable(String name, Object value)
{
instance.setVariable(name, value);
}
public static void setVariable(Map<String, Object> vars)
{
for (Map.Entry<String, Object> entry : vars.entrySet())
{
instance.setVariable(entry.getKey(), entry.getValue());
}
}
public static Object getValue(String Expression){
return parser.parseExpression(Expression).getValue(instance);
}
}
package com.yeejoin.amos.fas.business.action.util;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import com.alibaba.fastjson.JSONObject;
import com.yeejoin.amos.fas.business.action.el.ELEvaluationContext;
public class DataItemUtil
{
public static boolean getEnable(JSONObject jsonObject)
{
try
{
return jsonObject.getBooleanValue("enable");
}
catch (Exception e)
{
return false;
}
}
public static String getDisplayName(JSONObject jsonObject)
{
try
{
return jsonObject.get("displayname").toString();
}
catch (Exception e)
{
return null;
}
}
public static String getValue(JSONObject jsonObject)
{
try
{
return jsonObject.get("value").toString();
}
catch (Exception e)
{
return null;
}
}
public static String getName(JSONObject jsonObject)
{
try
{
return jsonObject.get("name").toString();
}
catch (Exception e)
{
return null;
}
}
public static String getNative(String str)
{
Pattern p = Pattern.compile("\\{(.*?)\\}");
Matcher m = p.matcher(str);
while (m.find())
{
String parameter = m.group();
Object parametervalue = ELEvaluationContext
.getValue(parameter.substring(1, parameter.length() - 1));
if(parametervalue != null)
str = str.replace(parameter,
parametervalue != null ? parametervalue.toString() : null);
}
return str;
}
}
......@@ -249,6 +249,8 @@ public class BaseController {
if (reginParams.getCompany() != null) {
return reginParams.getCompany().getOrgCode();
}
return null;
}
......
......@@ -11,12 +11,14 @@ public interface ContingencyOriginalMapper extends BaseMapper {
Long queryCountForPage(
@Param("equipmentId")String equipmentId,
@Param("createTime")String createTime);
@Param("createTime")String createTime,
@Param("contingencyName")String contingencyName);
List<Map> queryForPage( @Param("equipmentId")String equipmentId,
@Param("createTime")String createTime,
@Param("start") long start,
@Param("length") Integer length);
@Param("length") Integer length,
@Param("contingencyName")String contingencyName);
}
......@@ -144,7 +144,7 @@ public interface View3dMapper extends BaseMapper{
*/
List<View3dNodeVo> initViewErrorNode(String type,Long riskSourceId, String orgCode);
List<Node3DVoResponse> findViewDataByType(String type,Long riskSourceId,String orgCode);
List<Node3DVoResponse> findViewDataByType(@Param("type")String type,@Param("riskSourceId")Long riskSourceId,@Param("orgCode")String orgCode);
Long retrieveAllCount(String type, String inputText,String orgCode,String dataLevel,String protectObjName);
......
//<<<<<<< HEAD
////package com.yeejoin.amos.fas.business.service.impl;
////
////
////import com.yeejoin.amos.fas.business.action.ContingencyAction;
////import com.yeejoin.amos.fas.business.action.result.BubbleTipResult;
////import com.yeejoin.amos.fas.business.dao.mapper.ImpAndFireEquipMapper;
////import com.yeejoin.amos.fas.business.dao.repository.IContingencyOriginalDataDao;
////import com.yeejoin.amos.fas.business.dao.repository.IContingencyPlanInstanceRepository;
////import com.yeejoin.amos.fas.business.feign.RemoteRuleServer;
////import com.yeejoin.amos.fas.business.service.intfc.IContingencyInstance;
////import com.yeejoin.amos.fas.business.service.model.ContingencyRo;
////import com.yeejoin.amos.fas.business.service.model.Operate;
////import com.yeejoin.amos.fas.business.service.model.OperateGroup;
////import com.yeejoin.amos.fas.dao.entity.ContingencyOriginalData;
////import com.yeejoin.amos.fas.dao.entity.ContingencyPlanInstance;
////import com.yeejoin.amos.fas.dao.entity.Equipment;
////
////import org.codehaus.jackson.map.ObjectMapper;
////import org.slf4j.Logger;
////import org.slf4j.LoggerFactory;
////import org.springframework.beans.BeanUtils;
////import org.springframework.beans.factory.annotation.Autowired;
////import org.springframework.beans.factory.annotation.Value;
////import org.springframework.data.redis.core.RedisTemplate;
////import org.springframework.http.HttpEntity;
////import org.springframework.http.HttpMethod;
////import org.springframework.scheduling.annotation.Async;
////import org.springframework.stereotype.Service;
////import org.springframework.util.CollectionUtils;
////import org.springframework.web.client.RestTemplate;
////import org.typroject.tyboot.component.cache.Redis;
////
////import java.util.HashMap;
////import java.util.List;
////import java.util.Map;
////import java.util.Optional;
////
////@Service
////public class ContingencyInstanceImpl {
////
//// private static final Logger log = LoggerFactory.getLogger(ContingencyInstanceImpl.class);
//////
////// @Autowired
////// private IContingencyPlanInstanceRepository repository;
//////
//////
////// @Autowired
////// IContingencyOriginalDataDao iContingencyOriginalDataDao;
//////
//////
////// @Autowired
////// private RemoteRuleServer remoteRuleServer;
//////
////// @Autowired
////// private RestTemplate restTemplate;
//////
////// @Autowired
////// private ImpAndFireEquipMapper impAndFireEquipMapper;
//////
////// @Autowired
////// private RedisTemplate redisTemplate;
//////
//////
////// @Value("${params.remoteRuleUrl}")
////// private String remoteRuleUrl;
//////
//////
////// private static Map<String, String> stepMap = new HashMap<>();
//////
////// @Autowired
////// private RuleTrigger ruleTrigger;
//////
////// /* public ContingencyInstanceImpl(IContingencyPlanInstanceRepository repository) {
////// super(repository);
////// this.repository = repository;
////// }*/
//////
//////
////// /**
////// * 创建预案执行记录
////// *
////// * @param category 一级分类
////// * @param subCategory 二级分类
////// * @param content 信息内容
////// * @param recordType 信息分类
////// * @param icon 信息显示图标
////// */
////// public ContingencyPlanInstance createInstanceRecord(String instanceNo, String category, String subCategory, String content, String recordType, String icon) {
////// ContingencyPlanInstance planInstance = new ContingencyPlanInstance();
//////
////// planInstance.setContent(content);
////// planInstance.setIcon(icon);
////// planInstance.setRecordType(recordType);
////// planInstance.setCategory(category);
////// planInstance.setBatchNo(instanceNo);
//////
////// //计算序号
////// int count = repository.countByBatchNo(instanceNo);
////// planInstance.setSort(++count);
////// return this.repository.save(planInstance);
////// }
//////
//////
////// /**
////// * 查询时间轴
////// *
////// * @param instanceNo
////// * @return
////// * @throws Exception
////// */
////// public List<ContingencyPlanInstance> queryForTimeLine(String instanceNo, String recordType) throws Exception {
////// List<ContingencyPlanInstance> categorys = repository.queryForCategory(instanceNo, recordType);
////// return categorys;
////// }
//////
//////
////// public void fire(String batchNo, String stepCode, String contingencyPlanId, String buttonCode, String buttonState, String stepStateOnbutton) throws Exception {
////// //火灾误报
//////
////// ContingencyOriginalData contingencyOriginalData = iContingencyOriginalDataDao.findByBatchNo(batchNo);
////// if("FIRE_CANCEL".equals(buttonCode) || "END_EMERGENCY".equals(buttonCode)){
////// redisTemplate.delete(RiskSourceServiceImpl.cacheKeyForCanBeRunning());
////// }else{
////// redisTemplate.opsForValue().setIfAbsent(RiskSourceServiceImpl.cacheKeyForCanBeRunning(),"CONTINGENCYRUNING");
////// }
////// String stepKey = batchNo + "_" + stepCode;
////// if (stepMap.get(stepKey) == null)
////// stepMap.put(stepKey, "");
////// if (contingencyOriginalData != null) {
////// log.info("数据库中的stepcode:" + contingencyOriginalData.getStep());
////// contingencyOriginalData.setConfirm(buttonState);
////// contingencyOriginalData.setRunstep(false);
////// if (contingencyOriginalData.getStepState() == null)
////// contingencyOriginalData.setStepState("");
//////
////// if ("CONFIRM".equals(buttonState)
////// && !contingencyOriginalData.getStepState().contains(stepStateOnbutton)
////// && stepCode.equals(contingencyOriginalData.getStep()))
////// contingencyOriginalData.setStepState(contingencyOriginalData.getStepState() + stepStateOnbutton);
//////
//////
////// //请求中的步骤小于以保存的步骤
////// if (Integer.parseInt(stepCode) < Integer.parseInt(contingencyOriginalData.getStep())) {
////// contingencyOriginalData.setRunstep(true);
////// }
//////
//////
////// if (Integer.parseInt(stepCode) > Integer.parseInt(contingencyOriginalData.getStep())) {
////// //contingencyOriginalData.setStep(stepCode);
////// contingencyOriginalData.setStepState(stepStateOnbutton);
////// }
//////
//////
////// iContingencyOriginalDataDao.updateByButton(
////// contingencyOriginalData.getConfirm(),
////// contingencyOriginalData.getRunstep(),
////// contingencyOriginalData.getStepState(),
////// contingencyOriginalData.getBatchNo());
////// //setButtonExecuted(batchNo,contingencyPlanId, buttonCode,buttonState);
//////
////// //使用原始数据触发规则
//////
//////
////// if ("CONFIRM".equals(buttonState)
////// && !stepMap.get(stepKey).contains(stepStateOnbutton))
////// stepMap.put(stepKey, stepMap.get(stepKey) + stepStateOnbutton);
//////
////// ContingencyRo contingencyRo = new ContingencyRo();
////// contingencyRo.setButtonCode(buttonCode);
////// contingencyRo.setButtonState(buttonState);
////// BeanUtils.copyProperties(contingencyOriginalData, contingencyRo);
////// contingencyRo.setStep(stepCode);
////// contingencyRo.setStepState(stepMap.get(stepKey));
////// log.info("stepstate:" + contingencyRo.getStepState());
//////
//////
////// Equipment equipment = impAndFireEquipMapper.queryImpEqumtByFireEquipmt(Long.parseLong(contingencyRo.getFireEquipmentId()));
////// //Object result = remoteRuleServer.fireRuleFlow(contingencyRo, equipment.getReservePlan(),equipment.getName());
////// ruleTrigger.publish(contingencyRo, equipment.getReservePlan());
//////
////// BubbleTipResult result1 = new BubbleTipResult();
////// Map<String, Object> tempmap2 = new HashMap<>();
////// tempmap2.put("refresh","refresh");
////// tempmap2.put("batchNo",batchNo);
////// ContingencyAction.sendcmd("fromws","recordArea","refresh",result1);
////// // String url = remoteRuleUrl + "/urule/rule/refreshTimeline?batchNo=" + batchNo;
////// //restTemplate.exchange(url, HttpMethod.GET, HttpEntity.EMPTY, Object.class);
////// } else {
////// throw new Exception("数据异常,请联系管理员.");
////// }
////// }
//////
//////
////// public void setButtonExecuted(String batchNo, String contingencyPlanId, String code, String buttonState) throws Exception {
////// ObjectMapper objectMapper = new ObjectMapper();
////// Optional<ContingencyPlanInstance> contingencyPlanInstance1 = repository.findById(contingencyPlanId);
//////
////// ContingencyPlanInstance contingencyPlanInstance=contingencyPlanInstance1.get();
//////
////// if(contingencyPlanInstance1.isPresent()){
////// if (contingencyPlanInstance != null && "OPERATE".equals(contingencyPlanInstance.getRecordType())) {
////// String operateJson = contingencyPlanInstance.getContent();
////// OperateGroup operateGroup = objectMapper.readValue(operateJson, OperateGroup.class);
//////
////// List<Operate> operates = operateGroup.getOperate();
////// if (!CollectionUtils.isEmpty(operates)) {
////// for (Operate operate : operates) {
//////
////// if (code.equals(operate.getCode()) && ("executed".equals(operate.getState()) || "disable".equals(operate.getState()))){
////// if("FIRE_CANCEL".equals(code) || "END_EMERGENCY".equals(code)){
////// redisTemplate.delete(RiskSourceServiceImpl.cacheKeyForCanBeRunning());
////// }
////// throw new Exception("请勿重复操作.");
////// }
//////
//////
////// if ("CONFIRM".equals(buttonState)) {
////// if (code.equals(operate.getCode())) {
////// operate.setState("executed");
////// if("FIRE_CANCEL".equals(code) || "END_EMERGENCY".equals(code))
////// redisTemplate.delete(RiskSourceServiceImpl.cacheKeyForCanBeRunning());
////// } else {
////// operate.setState("disable");
////// }
////// }
////// }
////// }
//////
//////
////// if (buttonState.equals("CONFIRM"))
////// contingencyPlanInstance.setRunstate(true);
////// operateJson = objectMapper.writeValueAsString(operateGroup);
////// contingencyPlanInstance.setContent(operateJson);
////// repository.save(contingencyPlanInstance);
////// }
////// }
//////
////// }
//////
////// public void setButtonWait(String batchNo, String contingencyPlanId, String buttonState) throws Exception {
////// ObjectMapper objectMapper = new ObjectMapper();
////// Optional<ContingencyPlanInstance> contingencyPlanInstance1 = repository.findById(contingencyPlanId);
////// ContingencyPlanInstance contingencyPlanInstance=null;
////// if(contingencyPlanInstance1.isPresent()){
////// contingencyPlanInstance=contingencyPlanInstance1.get();
////// }
//////
////// if (contingencyPlanInstance != null && "OPERATE".equals(contingencyPlanInstance.getRecordType())) {
////// String operateJson = contingencyPlanInstance.getContent();
////// OperateGroup operateGroup = objectMapper.readValue(operateJson, OperateGroup.class);
//////
////// List<Operate> operates = operateGroup.getOperate();
////// if (!CollectionUtils.isEmpty(operates)) {
////// for (Operate operate : operates) {
//////
////// if ("CONFIRM".equals(buttonState)) {
////// operate.setState("executed");
////// }
////// }
////// }
//////
//////
////// if (buttonState.equals("CONFIRM"))
////// contingencyPlanInstance.setRunstate(true);
////// operateJson = objectMapper.writeValueAsString(operateGroup);
////// contingencyPlanInstance.setContent(operateJson);
////// repository.save(contingencyPlanInstance);
////// }
////// }
//////
//////
////// @Override
////// public void updateStep(String step, String batchNo) {
////// // TODO Auto-generated method stub
//////
////// }
////}
//=======
//package com.yeejoin.amos.fas.business.service.impl;
//
//
//import com.yeejoin.amos.component.rule.RuleTrigger;
//import com.yeejoin.amos.fas.business.action.ContingencyAction;
//import com.yeejoin.amos.fas.business.action.result.BubbleTipResult;
//import com.yeejoin.amos.fas.business.dao.mapper.ImpAndFireEquipMapper;
......@@ -15,6 +294,7 @@
//import com.yeejoin.amos.fas.dao.entity.ContingencyPlanInstance;
//import com.yeejoin.amos.fas.dao.entity.Equipment;
//
//import org.apache.commons.lang3.ArrayUtils;
//import org.codehaus.jackson.map.ObjectMapper;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
......@@ -36,242 +316,244 @@
//import java.util.Optional;
//
//@Service
//public class ContingencyInstanceImpl {
//public class ContingencyInstanceImpl /*extends GenericManagerImpl<ContingencyPlanInstance, String>*/ implements IContingencyInstance {
//
// private static final Logger log = LoggerFactory.getLogger(ContingencyInstanceImpl.class);
////
//// @Autowired
//// private IContingencyPlanInstanceRepository repository;
////
////
//// @Autowired
//// IContingencyOriginalDataDao iContingencyOriginalDataDao;
////
////
//// @Autowired
//// private RemoteRuleServer remoteRuleServer;
////
//// @Autowired
//// private RestTemplate restTemplate;
////
//// @Autowired
//// private ImpAndFireEquipMapper impAndFireEquipMapper;
////
//// @Autowired
//// private RedisTemplate redisTemplate;
////
////
//// @Value("${params.remoteRuleUrl}")
//// private String remoteRuleUrl;
////
////
//// private static Map<String, String> stepMap = new HashMap<>();
////
//// @Autowired
//// private RuleTrigger ruleTrigger;
////
//// /* public ContingencyInstanceImpl(IContingencyPlanInstanceRepository repository) {
//// super(repository);
//// this.repository = repository;
//// }*/
////
////
//// /**
//// * 创建预案执行记录
//// *
//// * @param category 一级分类
//// * @param subCategory 二级分类
//// * @param content 信息内容
//// * @param recordType 信息分类
//// * @param icon 信息显示图标
//// */
//// public ContingencyPlanInstance createInstanceRecord(String instanceNo, String category, String subCategory, String content, String recordType, String icon) {
//// ContingencyPlanInstance planInstance = new ContingencyPlanInstance();
////
//// planInstance.setContent(content);
//// planInstance.setIcon(icon);
//// planInstance.setRecordType(recordType);
//// planInstance.setCategory(category);
//// planInstance.setBatchNo(instanceNo);
////
//// //计算序号
//// int count = repository.countByBatchNo(instanceNo);
//// planInstance.setSort(++count);
//// return this.repository.save(planInstance);
//// }
////
////
//// /**
//// * 查询时间轴
//// *
//// * @param instanceNo
//// * @return
//// * @throws Exception
//// */
//// public List<ContingencyPlanInstance> queryForTimeLine(String instanceNo, String recordType) throws Exception {
//// List<ContingencyPlanInstance> categorys = repository.queryForCategory(instanceNo, recordType);
//// return categorys;
//// }
////
////
//// public void fire(String batchNo, String stepCode, String contingencyPlanId, String buttonCode, String buttonState, String stepStateOnbutton) throws Exception {
//// //火灾误报
////
//// ContingencyOriginalData contingencyOriginalData = iContingencyOriginalDataDao.findByBatchNo(batchNo);
//// if("FIRE_CANCEL".equals(buttonCode) || "END_EMERGENCY".equals(buttonCode)){
//// redisTemplate.delete(RiskSourceServiceImpl.cacheKeyForCanBeRunning());
//// }else{
//// redisTemplate.opsForValue().setIfAbsent(RiskSourceServiceImpl.cacheKeyForCanBeRunning(),"CONTINGENCYRUNING");
//// }
//// String stepKey = batchNo + "_" + stepCode;
//// if (stepMap.get(stepKey) == null)
//// stepMap.put(stepKey, "");
//// if (contingencyOriginalData != null) {
//// log.info("数据库中的stepcode:" + contingencyOriginalData.getStep());
//// contingencyOriginalData.setConfirm(buttonState);
//// contingencyOriginalData.setRunstep(false);
//// if (contingencyOriginalData.getStepState() == null)
//// contingencyOriginalData.setStepState("");
////
//// if ("CONFIRM".equals(buttonState)
//// && !contingencyOriginalData.getStepState().contains(stepStateOnbutton)
//// && stepCode.equals(contingencyOriginalData.getStep()))
//// contingencyOriginalData.setStepState(contingencyOriginalData.getStepState() + stepStateOnbutton);
////
////
//// //请求中的步骤小于以保存的步骤
//// if (Integer.parseInt(stepCode) < Integer.parseInt(contingencyOriginalData.getStep())) {
//// contingencyOriginalData.setRunstep(true);
//// }
////
////
//// if (Integer.parseInt(stepCode) > Integer.parseInt(contingencyOriginalData.getStep())) {
//// //contingencyOriginalData.setStep(stepCode);
//// contingencyOriginalData.setStepState(stepStateOnbutton);
//// }
////
////
//// iContingencyOriginalDataDao.updateByButton(
//// contingencyOriginalData.getConfirm(),
//// contingencyOriginalData.getRunstep(),
//// contingencyOriginalData.getStepState(),
//// contingencyOriginalData.getBatchNo());
//// //setButtonExecuted(batchNo,contingencyPlanId, buttonCode,buttonState);
////
//// //使用原始数据触发规则
////
////
//// if ("CONFIRM".equals(buttonState)
//// && !stepMap.get(stepKey).contains(stepStateOnbutton))
//// stepMap.put(stepKey, stepMap.get(stepKey) + stepStateOnbutton);
////
//// ContingencyRo contingencyRo = new ContingencyRo();
//// contingencyRo.setButtonCode(buttonCode);
//// contingencyRo.setButtonState(buttonState);
//// BeanUtils.copyProperties(contingencyOriginalData, contingencyRo);
//// contingencyRo.setStep(stepCode);
//// contingencyRo.setStepState(stepMap.get(stepKey));
//// log.info("stepstate:" + contingencyRo.getStepState());
////
////
//// Equipment equipment = impAndFireEquipMapper.queryImpEqumtByFireEquipmt(Long.parseLong(contingencyRo.getFireEquipmentId()));
//// //Object result = remoteRuleServer.fireRuleFlow(contingencyRo, equipment.getReservePlan(),equipment.getName());
//// ruleTrigger.publish(contingencyRo, equipment.getReservePlan());
////
//// BubbleTipResult result1 = new BubbleTipResult();
//// Map<String, Object> tempmap2 = new HashMap<>();
//// tempmap2.put("refresh","refresh");
//// tempmap2.put("batchNo",batchNo);
//// ContingencyAction.sendcmd("fromws","recordArea","refresh",result1);
//// // String url = remoteRuleUrl + "/urule/rule/refreshTimeline?batchNo=" + batchNo;
//// //restTemplate.exchange(url, HttpMethod.GET, HttpEntity.EMPTY, Object.class);
//// } else {
//// throw new Exception("数据异常,请联系管理员.");
//// }
//// }
////
////
//// public void setButtonExecuted(String batchNo, String contingencyPlanId, String code, String buttonState) throws Exception {
//// ObjectMapper objectMapper = new ObjectMapper();
//// Optional<ContingencyPlanInstance> contingencyPlanInstance1 = repository.findById(contingencyPlanId);
////
//// ContingencyPlanInstance contingencyPlanInstance=contingencyPlanInstance1.get();
////
//// if(contingencyPlanInstance1.isPresent()){
//// if (contingencyPlanInstance != null && "OPERATE".equals(contingencyPlanInstance.getRecordType())) {
//// String operateJson = contingencyPlanInstance.getContent();
//// OperateGroup operateGroup = objectMapper.readValue(operateJson, OperateGroup.class);
////
//// List<Operate> operates = operateGroup.getOperate();
//// if (!CollectionUtils.isEmpty(operates)) {
//// for (Operate operate : operates) {
////
//// if (code.equals(operate.getCode()) && ("executed".equals(operate.getState()) || "disable".equals(operate.getState()))){
//// if("FIRE_CANCEL".equals(code) || "END_EMERGENCY".equals(code)){
//// redisTemplate.delete(RiskSourceServiceImpl.cacheKeyForCanBeRunning());
//// }
//// throw new Exception("请勿重复操作.");
//// }
////
////
//// if ("CONFIRM".equals(buttonState)) {
//// if (code.equals(operate.getCode())) {
//// operate.setState("executed");
//// if("FIRE_CANCEL".equals(code) || "END_EMERGENCY".equals(code))
//// redisTemplate.delete(RiskSourceServiceImpl.cacheKeyForCanBeRunning());
//// } else {
//// operate.setState("disable");
//// }
//// }
//// }
//// }
////
////
//// if (buttonState.equals("CONFIRM"))
//// contingencyPlanInstance.setRunstate(true);
//// operateJson = objectMapper.writeValueAsString(operateGroup);
//// contingencyPlanInstance.setContent(operateJson);
//// repository.save(contingencyPlanInstance);
//// }
//// }
////
//// }
////
//// public void setButtonWait(String batchNo, String contingencyPlanId, String buttonState) throws Exception {
//// ObjectMapper objectMapper = new ObjectMapper();
//// Optional<ContingencyPlanInstance> contingencyPlanInstance1 = repository.findById(contingencyPlanId);
//// ContingencyPlanInstance contingencyPlanInstance=null;
//// if(contingencyPlanInstance1.isPresent()){
//// contingencyPlanInstance=contingencyPlanInstance1.get();
//// }
////
//// if (contingencyPlanInstance != null && "OPERATE".equals(contingencyPlanInstance.getRecordType())) {
//// String operateJson = contingencyPlanInstance.getContent();
//// OperateGroup operateGroup = objectMapper.readValue(operateJson, OperateGroup.class);
////
//// List<Operate> operates = operateGroup.getOperate();
//// if (!CollectionUtils.isEmpty(operates)) {
//// for (Operate operate : operates) {
////
//// if ("CONFIRM".equals(buttonState)) {
//// operate.setState("executed");
//// }
//// }
//// }
////
////
//// if (buttonState.equals("CONFIRM"))
//// contingencyPlanInstance.setRunstate(true);
//// operateJson = objectMapper.writeValueAsString(operateGroup);
//// contingencyPlanInstance.setContent(operateJson);
//// repository.save(contingencyPlanInstance);
//// }
//// }
////
////
//// @Override
//// public void updateStep(String step, String batchNo) {
//// // TODO Auto-generated method stub
////
//// }
//
// @Autowired
// private IContingencyPlanInstanceRepository repository;
//
//
// @Autowired
// IContingencyOriginalDataDao iContingencyOriginalDataDao;
//
//
// @Autowired
// private RemoteRuleServer remoteRuleServer;
//
// @Autowired
// private RestTemplate restTemplate;
//
// @Autowired
// private ImpAndFireEquipMapper impAndFireEquipMapper;
//
// @Autowired
// private RedisTemplate redisTemplate;
//
//
// @Value("${params.remoteRuleUrl}")
// private String remoteRuleUrl;
//
//
// private static Map<String, String> stepMap = new HashMap<>();
//
// @Autowired
// private RuleTrigger ruleTrigger;
//
// /* public ContingencyInstanceImpl(IContingencyPlanInstanceRepository repository) {
// super(repository);
// this.repository = repository;
// }*/
//
//
// /**
// * 创建预案执行记录
// *
// * @param category 一级分类
// * @param subCategory 二级分类
// * @param content 信息内容
// * @param recordType 信息分类
// * @param icon 信息显示图标
// */
// public ContingencyPlanInstance createInstanceRecord(String instanceNo, String category, String subCategory, String content, String recordType, String icon) {
// ContingencyPlanInstance planInstance = new ContingencyPlanInstance();
//
// planInstance.setContent(content);
// planInstance.setIcon(icon);
// planInstance.setRecordType(recordType);
// planInstance.setCategory(category);
// planInstance.setBatchNo(instanceNo);
//
// //计算序号
// int count = repository.countByBatchNo(instanceNo);
// planInstance.setSort(++count);
// return this.repository.save(planInstance);
// }
//
//
// /**
// * 查询时间轴
// *
// * @param instanceNo
// * @return
// * @throws Exception
// */
// public List<ContingencyPlanInstance> queryForTimeLine(String instanceNo, String recordType) throws Exception {
// List<ContingencyPlanInstance> categorys = repository.queryForCategory(instanceNo, recordType);
// return categorys;
// }
//
//
// public void fire(String batchNo, String stepCode, String contingencyPlanId, String buttonCode, String buttonState, String stepStateOnbutton) throws Exception {
// //火灾误报
//
// ContingencyOriginalData contingencyOriginalData = iContingencyOriginalDataDao.findByBatchNo(batchNo);
// if("FIRE_CANCEL".equals(buttonCode) || "END_EMERGENCY".equals(buttonCode)){
// redisTemplate.delete(RiskSourceServiceImpl.cacheKeyForCanBeRunning());
// }else{
// redisTemplate.opsForValue().setIfAbsent(RiskSourceServiceImpl.cacheKeyForCanBeRunning(),"CONTINGENCYRUNING");
// }
// String stepKey = batchNo + "_" + stepCode;
// if (stepMap.get(stepKey) == null)
// stepMap.put(stepKey, "");
// if (contingencyOriginalData != null) {
// log.info("数据库中的stepcode:" + contingencyOriginalData.getStep());
// contingencyOriginalData.setConfirm(buttonState);
// contingencyOriginalData.setRunstep(false);
// if (contingencyOriginalData.getStepState() == null)
// contingencyOriginalData.setStepState("");
//
// if ("CONFIRM".equals(buttonState)
// && !contingencyOriginalData.getStepState().contains(stepStateOnbutton)
// && stepCode.equals(contingencyOriginalData.getStep()))
// contingencyOriginalData.setStepState(contingencyOriginalData.getStepState() + stepStateOnbutton);
//
//
// //请求中的步骤小于以保存的步骤
// if (Integer.parseInt(stepCode) < Integer.parseInt(contingencyOriginalData.getStep())) {
// contingencyOriginalData.setRunstep(true);
// }
//
//
// if (Integer.parseInt(stepCode) > Integer.parseInt(contingencyOriginalData.getStep())) {
// //contingencyOriginalData.setStep(stepCode);
// contingencyOriginalData.setStepState(stepStateOnbutton);
// }
//
//
// iContingencyOriginalDataDao.updateByButton(
// contingencyOriginalData.getConfirm(),
// contingencyOriginalData.getRunstep(),
// contingencyOriginalData.getStepState(),
// contingencyOriginalData.getBatchNo());
// //setButtonExecuted(batchNo,contingencyPlanId, buttonCode,buttonState);
//
// //使用原始数据触发规则
//
//
// if ("CONFIRM".equals(buttonState)
// && !stepMap.get(stepKey).contains(stepStateOnbutton))
// stepMap.put(stepKey, stepMap.get(stepKey) + stepStateOnbutton);
//
// ContingencyRo contingencyRo = new ContingencyRo();
// contingencyRo.setButtonCode(buttonCode);
// contingencyRo.setButtonState(buttonState);
// BeanUtils.copyProperties(contingencyOriginalData, contingencyRo);
// contingencyRo.setStep(stepCode);
// contingencyRo.setStepState(stepMap.get(stepKey));
// log.info("stepstate:" + contingencyRo.getStepState());
//
//
// Equipment equipment = impAndFireEquipMapper.queryImpEqumtByFireEquipmt(Long.parseLong(contingencyRo.getFireEquipmentId()));
// //Object result = remoteRuleServer.fireRuleFlow(contingencyRo, equipment.getReservePlan(),equipment.getName());
// equipment.setName("极Ⅰ高端YY换流变A相");
// ruleTrigger.publish(contingencyRo, equipment.getReservePlan(), ArrayUtils.toArray(equipment.getName()));
//
// BubbleTipResult result1 = new BubbleTipResult();
// Map<String, Object> tempmap2 = new HashMap<>();
// tempmap2.put("refresh","refresh");
// tempmap2.put("batchNo",batchNo);
// ContingencyAction.sendcmd("fromws","recordArea","refresh",result1);
// // String url = remoteRuleUrl + "/urule/rule/refreshTimeline?batchNo=" + batchNo;
// //restTemplate.exchange(url, HttpMethod.GET, HttpEntity.EMPTY, Object.class);
// } else {
// throw new Exception("数据异常,请联系管理员.");
// }
// }
//
//
// public void setButtonExecuted(String batchNo, String contingencyPlanId, String code, String buttonState) throws Exception {
// ObjectMapper objectMapper = new ObjectMapper();
// Optional<ContingencyPlanInstance> contingencyPlanInstance1 = repository.findById(contingencyPlanId);
//
// ContingencyPlanInstance contingencyPlanInstance=contingencyPlanInstance1.get();
//
// if(contingencyPlanInstance1.isPresent()){
// if (contingencyPlanInstance != null && "OPERATE".equals(contingencyPlanInstance.getRecordType())) {
// String operateJson = contingencyPlanInstance.getContent();
// OperateGroup operateGroup = objectMapper.readValue(operateJson, OperateGroup.class);
//
// List<Operate> operates = operateGroup.getOperate();
// if (!CollectionUtils.isEmpty(operates)) {
// for (Operate operate : operates) {
//
// if (code.equals(operate.getCode()) && ("executed".equals(operate.getState()) || "disable".equals(operate.getState()))){
// if("FIRE_CANCEL".equals(code) || "END_EMERGENCY".equals(code)){
// redisTemplate.delete(RiskSourceServiceImpl.cacheKeyForCanBeRunning());
// }
// throw new Exception("请勿重复操作.");
// }
//
//
// if ("CONFIRM".equals(buttonState)) {
// if (code.equals(operate.getCode())) {
// operate.setState("executed");
// if("FIRE_CANCEL".equals(code) || "END_EMERGENCY".equals(code))
// redisTemplate.delete(RiskSourceServiceImpl.cacheKeyForCanBeRunning());
// } else {
// operate.setState("disable");
// }
// }
// }
// }
//
//
// if (buttonState.equals("CONFIRM"))
// contingencyPlanInstance.setRunstate(true);
// operateJson = objectMapper.writeValueAsString(operateGroup);
// contingencyPlanInstance.setContent(operateJson);
// repository.save(contingencyPlanInstance);
// }
// }
//
// }
//
// public void setButtonWait(String batchNo, String contingencyPlanId, String buttonState) throws Exception {
// ObjectMapper objectMapper = new ObjectMapper();
// Optional<ContingencyPlanInstance> contingencyPlanInstance1 = repository.findById(contingencyPlanId);
// ContingencyPlanInstance contingencyPlanInstance=null;
// if(contingencyPlanInstance1.isPresent()){
// contingencyPlanInstance=contingencyPlanInstance1.get();
// }
//
// if (contingencyPlanInstance != null && "OPERATE".equals(contingencyPlanInstance.getRecordType())) {
// String operateJson = contingencyPlanInstance.getContent();
// OperateGroup operateGroup = objectMapper.readValue(operateJson, OperateGroup.class);
//
// List<Operate> operates = operateGroup.getOperate();
// if (!CollectionUtils.isEmpty(operates)) {
// for (Operate operate : operates) {
//
// if ("CONFIRM".equals(buttonState)) {
// operate.setState("executed");
// }
// }
// }
//
//
// if (buttonState.equals("CONFIRM"))
// contingencyPlanInstance.setRunstate(true);
// operateJson = objectMapper.writeValueAsString(operateGroup);
// contingencyPlanInstance.setContent(operateJson);
// repository.save(contingencyPlanInstance);
// }
// }
//
//
// @Override
// public void updateStep(String step, String batchNo) {
// // TODO Auto-generated method stub
//
// }
//}
//>>>>>>> 28409f79427e917f31bc936696f98f961a5dd24d
......@@ -50,8 +50,8 @@ public class ContingencyOriginalServiceImpl /*extends GenericManagerImpl<Conting
public Page queryForPage(String contingencyName, String equipmentId, String createTime, CommonPageable pageable)
{
Long total = contingencyOriginalMapper.queryCountForPage(equipmentId,createTime);
List<Map> content = contingencyOriginalMapper.queryForPage(equipmentId,createTime,pageable.getOffset(),pageable.getPageSize());
Long total = contingencyOriginalMapper.queryCountForPage(equipmentId,createTime,contingencyName);
List<Map> content = contingencyOriginalMapper.queryForPage(equipmentId,createTime,pageable.getOffset(),pageable.getPageSize(),contingencyName);
Page result = new PageImpl(content,pageable,total);
return result;
}
......
......@@ -243,6 +243,10 @@ public class EquipmentServiceImpl implements IEquipmentService {
}
long total = this.impAndFireEquipMapper.queryBindFirEqumtPageCount(String.valueOf(equipmentId));
List<FireEquipment> list = this.impAndFireEquipMapper.queryBindFirEqumtPage(start, length, String.valueOf(equipmentId));
if(commonPageable==null)
{
commonPageable = new CommonPageable();
}
Page result = new PageImpl(list, commonPageable, total);
return result;
}
......
......@@ -21,7 +21,6 @@ import com.yeejoin.amos.fas.business.jpush.PushMsgParam;
import com.yeejoin.amos.fas.business.param.AlarmParam;
import com.yeejoin.amos.fas.business.param.CommonPageInfoParam;
import com.yeejoin.amos.fas.business.param.FmeaBindParam;
import com.yeejoin.amos.fas.business.service.intfc.IContingencyInstance;
import com.yeejoin.amos.fas.business.service.intfc.IDataRefreshService;
import com.yeejoin.amos.fas.business.service.intfc.IEquipmentService;
import com.yeejoin.amos.fas.business.service.intfc.IRiskSourceService;
......@@ -486,7 +485,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
}
//Object result = remoteRuleServer.fireRuleFlow(contingencyRo, equipment.getReservePlan(), equipment.getName());
// ruleTrigger.publish(contingencyRo, equipment.getReservePlan());
// ruleTrigger.publish(contingencyRo, equipment.getReservePlan());
ContingencyOriginalData contingencyOriginalData = new ContingencyOriginalData();
BeanUtils.copyProperties(contingencyRo, contingencyOriginalData);
iContingencyOriginalDataDao.save(contingencyOriginalData);
......
......@@ -581,10 +581,14 @@ public class View3dServiceImpl implements IView3dService {
List<HashMap<String, Object>> retrieveAll = view3dMapper.retrieveAll(type, inputText,pageable.getOffset(),pageable.getPageSize(),orgCode,dataLevel,protectObjName);
retrieveAll.stream().forEach(e->{
String person = (String)e.get("person");
JSONArray ue4Location = this.getInitJSONArray(String.valueOf(e.get("ue4Location")));
JSONArray ue4Rotation = this.getInitJSONArray(String.valueOf(e.get("ue4Rotation")));
if(person != null && !person.equals("")) {
AgencyUserModel user = remoteSecurityService.getUserById(token, product, appKey, person);
e.put("person", user != null ? user.getRealName() : "");
}
e.put("ue4Location",ue4Location);
e.put("ue4Rotation",ue4Rotation);
});
Page result = new PageImpl(retrieveAll,pageable,count);
return CommonResponseUtil.success(result);
......
package com.yeejoin.amos.fas.business.service.model;
public class ContingencyRo extends BasicsRo {
import java.io.Serializable;
public class ContingencyRo implements Serializable {
private String batchNo;
public String getBatchNo() {
return batchNo;
}
public void setBatchNo(String batchNo) {
this.batchNo = batchNo;
}
/**
*
......
......@@ -8,9 +8,9 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeansException;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
......@@ -18,6 +18,7 @@ import org.springframework.cloud.netflix.hystrix.EnableHystrix;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.core.env.Environment;
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
......@@ -27,6 +28,7 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
import com.yeejoin.amos.fas.client.invoke.RsDataQueue;
import com.yeejoin.amos.fas.context.IotContext;
import com.yeejoin.amos.filter.CrossDomainFilter;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
......@@ -91,4 +93,25 @@ public class YeeAmosFireAutoSysStart implements ApplicationContextAware
IotContext.getInstance().setApplicationContext(applicationContext);
RsDataQueue.getInstance().start();
}
/**
*
* <pre>
* 跨域处理的FilterBean
* </pre>
*
* @return
*/
@Bean
public FilterRegistrationBean crossFilterRegistrationBean()
{
FilterRegistrationBean registrationBean = new FilterRegistrationBean();
CrossDomainFilter crossDomainFilter = new CrossDomainFilter();
registrationBean.setFilter(crossDomainFilter);
// List<String> urlPatterns = new ArrayList<String>();
// urlPatterns.add("/*");
// registrationBean.setUrlPatterns(urlPatterns);
registrationBean.setOrder(0);//值小的Filter先执行
return registrationBean;
}
}
\ No newline at end of file
......@@ -5,12 +5,12 @@ security.appKeyWeb=CONVERTER_STATION
#environment
#spring.profiles.active = dev
eureka.client.serviceUrl.defaultZone=http://172.16.10.72:10001/eureka/
eureka.client.serviceUrl.defaultZone=http://172.16.3.75:10001/eureka/
eureka.client.register-with-eureka = true
eureka.client.fetch-registry = true
eureka.client.healthcheck.enabled = true
eureka.client.fetchRegistry = true
eureka.instance.prefer-ip-address=true
#DB properties:
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
......@@ -53,5 +53,10 @@ emqx.broker=tcp://172.16.10.85:1883
emqx.user-name=super
emqx.password=a123456
Push.fegin.name=PPMESSAGEPUSHSERVICE15
dutyMode.fegin.name=AMOS-DUTY
\ No newline at end of file
dutyMode.fegin.name=AMOS-DUTY
##\u89C4\u5219\u5BF9\u8C61\u81EA\u52A8\u626B\u63CF
rule.definition.load=true
rule.definition.model-package=com.yeejoin.amos.fas.business.service.model
\ No newline at end of file
......@@ -10,6 +10,7 @@ eureka.client.register-with-eureka = true
eureka.client.fetch-registry = true
eureka.client.healthcheck.enabled = true
eureka.client.fetchRegistry = true
eureka.instance.prefer-ip-address=true
#DB properties:
spring.datasource.url=jdbc:mysql://amos-mysql:3306/yeejoin_safety_business?allowMultiQueries=true&serverTimezone=GMT%2B8&characterEncoding=utf8
......@@ -54,4 +55,8 @@ emqx.user-name=super
emqx.password=a123456
Push.fegin.name=AMOS-PUSH
dutyMode.fegin.name=AMOS-DUTY
\ No newline at end of file
dutyMode.fegin.name=AMOS-DUTY
##\u89C4\u5219\u5BF9\u8C61\u81EA\u52A8\u626B\u63CF
rule.definition.load=true
rule.definition.model-package=com.yeejoin.amos.fas.business.service.model
\ No newline at end of file
......@@ -10,6 +10,7 @@ eureka.client.register-with-eureka = true
eureka.client.fetch-registry = true
eureka.client.healthcheck.enabled = true
eureka.client.fetchRegistry = true
eureka.instance.prefer-ip-address=true
#DB properties:
spring.datasource.url=jdbc:mysql://47.103.14.66:3306/91-safety-business?allowMultiQueries=true&serverTimezone=GMT%2B8&characterEncoding=utf8
......@@ -54,4 +55,8 @@ emqx.user-name=super
emqx.password=a123456
Push.fegin.name=PPMESSAGEPUSHSERVICE15
dutyMode.fegin.name=AMOS-DUTY
\ No newline at end of file
dutyMode.fegin.name=AMOS-DUTY
##\u89C4\u5219\u5BF9\u8C61\u81EA\u52A8\u626B\u63CF
rule.definition.load=true
rule.definition.model-package=com.yeejoin.amos.fas.business.service.model
\ No newline at end of file
spring.application.name = AMOS-AUTOSYS
spring.application.name = AMOS-AUTOSYS-WJ
server.port = 8083
......
......@@ -15,14 +15,18 @@
1 = 1
<if test="equipmentId!=null">
AND t.equipment_Id = ${equipmentId}
AND t.equipment_Id = #{equipmentId}
</if>
<if test="createTime!=null">
AND TO_DAYS(t.create_date) = TO_DAYS(${createTime})
AND TO_DAYS(t.create_date) = TO_DAYS(#{createTime})
</if>
<if test="contingencyName!=null and contingencyName!=''">
AND t.fire_Equipment_Name like concat('%',#{contingencyName},'%')
OR t.equipment_Name like concat('%',#{contingencyName},'%')
</if>
order by t.create_date desc
LIMIT ${start},${length} ;
LIMIT #{start},#{length} ;
</select>
......@@ -35,11 +39,15 @@
1 = 1
<if test="equipmentId!=null">
AND t.equipment_Id = ${equipmentId}
AND t.equipment_Id = #{equipmentId}
</if>
<if test="createTime!=null">
AND TO_DAYS(t.create_date) = TO_DAYS(${createTime})
AND TO_DAYS(t.create_date) = TO_DAYS(#{createTime})
</if>
<if test="contingencyName!=null and contingencyName!=''">
AND t.fire_Equipment_Name like concat('%',#{contingencyName},'%')
OR t.equipment_Name like concat('%',#{contingencyName},'%')
</if>
</select>
......
......@@ -10,7 +10,7 @@
R.id,R.name,R.code,R.parent_id,R.ue4_location,R.ue4_rotation,R.ue4_extent,
<choose>
<when test="channelType == '3dpage'">
IF(ISNULL(route_path) || LENGTH(trim(route_path)) <![CDATA[ <]]> 1,0,1) as is_bind,
IF(ISNULL(position3d) || LENGTH(trim(position3d)) <![CDATA[ <]]> 1,0,1) as is_bind,
</when>
<otherwise>
IF(ISNULL(IF(replace(trim(ue4_rotation),'[]','')='',NULL,R.ue4_rotation))
......@@ -115,84 +115,37 @@
AND B.id is not null
</when>
<when test="type == 'fireEquipment'">
select
<!-- R.id, -->
CASE
WHEN ISNULL(C.id) = 0 then C.id
WHEN ISNULL(E.id) = 0 then E.id
WHEN ISNULL(S.id) = 0 then S.id
WHEN ISNULL(W.id) = 0 then W.id
END as id
,R.parent_id,
select tmp.id,tmp.name,tmp.type,tmp.position3d,tmp.ue4_rotation,tmp.ue4_location,tmp.code,R.parent_id,
<choose>
<when test="channelType == '3dpage'">
CASE
WHEN ISNULL(C.id) = 0 AND ISNULL(C.position3d) OR LENGTH(trim(C.position3d)) <![CDATA[ <]]> 1 then 0
WHEN ISNULL(E.id) = 0 AND ISNULL(E.position3d) OR LENGTH(trim(E.position3d)) <![CDATA[ <]]> 1 then 0
WHEN ISNULL(S.id) = 0 AND ISNULL(S.position3d) OR LENGTH(trim(S.position3d)) <![CDATA[ <]]> 1 then 0
WHEN ISNULL(W.id) = 0 AND ISNULL(W.position3d) OR LENGTH(trim(W.position3d)) <![CDATA[ <]]> 1 then 0
ELSE 1
END as is_bind,
IF(ISNULL(tmp.position3d) || LENGTH(trim(tmp.position3d)) <![CDATA[ <]]> 1,0,1) as isBind
</when>
<otherwise>
CASE
WHEN ISNULL(C.id) = 0 then IF(ISNULL(IF(replace(trim(C.ue4_rotation),'[]','')='',NULL,C.ue4_rotation))
AND ISNULL(IF(replace(trim(C.ue4_rotation),'[]','')='',NULL,C.ue4_location)),0,1)
WHEN ISNULL(E.id) = 0 then IF(ISNULL(IF(replace(trim(E.ue4_rotation),'[]','')='',NULL,E.ue4_rotation))
AND ISNULL(IF(replace(trim(E.ue4_rotation),'[]','')='',NULL,E.ue4_location)),0,1)
WHEN ISNULL(S.id) = 0 then IF(ISNULL(IF(replace(trim(S.ue4_rotation),'[]','')='',NULL,S.ue4_rotation))
AND ISNULL(IF(replace(trim(S.ue4_rotation),'[]','')='',NULL,S.ue4_location)),0,1)
WHEN ISNULL(W.id) = 0 then IF(ISNULL(IF(replace(trim(W.ue4_rotation),'[]','')='',NULL,W.ue4_rotation))
AND ISNULL(IF(replace(trim(W.ue4_rotation),'[]','')='',NULL,W.ue4_location)),0,1)
END as is_bind,
IF(ISNULL(IF(replace(trim(tmp.ue4_rotation),'[]','')='',NULL,tmp.ue4_rotation))
AND ISNULL(IF(replace(trim(tmp.ue4_location),'[]','')='',NULL,tmp.ue4_location)),0,1) as isBind
</otherwise>
</choose>
CASE
WHEN ISNULL(C.id) = 0 then 'fireCar'
WHEN ISNULL(E.id) = 0 then 'fireEquipment'
WHEN ISNULL(S.id) = 0 AND S.type = 1 then 'fireChamber'
WHEN ISNULL(S.id) = 0 AND S.type = 2 then 'fireFoamRoom'
WHEN ISNULL(W.id) = 0 AND W.type = 1 then 'hydrant'
WHEN ISNULL(W.id) = 0 AND W.type = 2 then 'pool'
END as type,
CASE
WHEN ISNULL(C.id) = 0 then C.name
WHEN ISNULL(E.id) = 0 then E.name
WHEN ISNULL(S.id) = 0 then S.name
WHEN ISNULL(W.id) = 0 then W.name
END as name,
CASE
WHEN ISNULL(C.id) = 0 then C.car_num
WHEN ISNULL(E.id) = 0 then E.code
WHEN ISNULL(S.id) = 0 then S.code
WHEN ISNULL(W.id) = 0 then W.code
END as code,
CASE
WHEN ISNULL(C.id) = 0 then C.ue4_location
WHEN ISNULL(E.id) = 0 then E.ue4_location
WHEN ISNULL(S.id) = 0 then S.ue4_location
WHEN ISNULL(W.id) = 0 then W.ue4_location
END as ue4_location,
CASE
WHEN ISNULL(C.id) = 0 then C.ue4_rotation
WHEN ISNULL(E.id) = 0 then E.ue4_rotation
WHEN ISNULL(S.id) = 0 then S.ue4_rotation
WHEN ISNULL(W.id) = 0 then W.ue4_rotation
END as ue4_rotation,
0 as is_region,
CASE
WHEN ISNULL(C.id) = 0 then C.position3d
WHEN ISNULL(E.id) = 0 then E.position3d
WHEN ISNULL(S.id) = 0 then S.position3d
WHEN ISNULL(W.id) = 0 then W.position3d
END as position3d
from f_risk_source R
left join f_fire_car C on C.risk_source_id = R.id
left join f_fire_equipment E on E.risk_source_id = R.id AND equip_classify = 3
left join f_fire_station S on S.risk_source_id = R.id
left join f_water_resource W on W.risk_source_id = R.id
where 1=1
AND (C.id is not null OR E.id is not null OR S.id is not null OR w.id is not null)
from (
select id,name,'fireCar' as type,position3d,car_num as code,ue4_location,ue4_rotation,risk_source_id
from f_fire_car
union all
select id,name,'fireEquipment' as type,position3d,code,ue4_location,ue4_rotation,risk_source_id
from f_fire_equipment
union all
select id,name,CASE
WHEN S.type = 1 then 'fireChamber'
WHEN S.type = 2 then 'fireFoamRoom'
END as type,position3d,code,ue4_location,ue4_rotation,risk_source_id
from f_fire_station s
union all
select id,name,
CASE
WHEN W.type = 1 then 'hydrant'
WHEN W.type = 2 then 'pool'
END as type,position3d,code,ue4_location,ue4_rotation,risk_source_id
from f_water_resource w
) tmp
left join f_risk_source R on R.id = tmp.risk_source_id
</when>
</choose>
......
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