Commit 6d9852d0 authored by chenzhao's avatar chenzhao

Merge branch 'developer' of http://39.98.45.134:8090/moa/amos-boot-biz into developer

parents cd6c5850 0efd85d7
...@@ -336,6 +336,7 @@ public class ImasterDataServiceImpl implements ImasterDataService { ...@@ -336,6 +336,7 @@ public class ImasterDataServiceImpl implements ImasterDataService {
} }
//sn编码 //sn编码
jpCollector.setSnCode(imasterCollectorList.getEsnCode()); jpCollector.setSnCode(imasterCollectorList.getEsnCode());
jpCollector.setAddr(imasterStationList.getPlantAddress());
jpCollector.setName(imasterCollectorList.getDevName()); jpCollector.setName(imasterCollectorList.getDevName());
//类型 //类型
// jpCollector.setType(collectorDetailDto.getModel()); // jpCollector.setType(collectorDetailDto.getModel());
......
package com.yeejoin.amos.boot.module.jxiop.biz.listener; package com.yeejoin.amos.boot.module.jxiop.biz.listener;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yeejoin.amos.boot.module.jxiop.api.dto.ProduceMsg;
import com.yeejoin.amos.boot.module.jxiop.api.entity.PersonAccount; import com.yeejoin.amos.boot.module.jxiop.api.entity.PersonAccount;
import com.yeejoin.amos.boot.module.jxiop.api.entity.PersonAccountFed; import com.yeejoin.amos.boot.module.jxiop.api.entity.PersonAccountFed;
import com.yeejoin.amos.boot.module.jxiop.api.mapper.PersonAccountFedMapper; import com.yeejoin.amos.boot.module.jxiop.api.mapper.PersonAccountFedMapper;
import com.yeejoin.amos.boot.module.jxiop.api.mapper.PersonAccountMapper; import com.yeejoin.amos.boot.module.jxiop.api.mapper.PersonAccountMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.activemq.QuerueProduce;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.privilege.Privilege;
import com.yeejoin.amos.feign.privilege.model.AgencyUserModel;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.activemq.command.ActiveMQTextMessage; import org.apache.activemq.command.ActiveMQTextMessage;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -14,6 +21,9 @@ import org.springframework.jms.annotation.JmsListener; ...@@ -14,6 +21,9 @@ import org.springframework.jms.annotation.JmsListener;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import java.util.HashMap;
import java.util.Map;
import javax.jms.Message; import javax.jms.Message;
@Component @Component
...@@ -24,7 +34,9 @@ public class PlatformModifyPasswordistener { ...@@ -24,7 +34,9 @@ public class PlatformModifyPasswordistener {
@Autowired @Autowired
PersonAccountFedMapper personAccountFedMapper; PersonAccountFedMapper personAccountFedMapper;
@Value("${amos.secret.key}") @Value("${amos.secret.key}")
private String secretKey; private String secretKey;
@Autowired
QuerueProduce querueProduce;
@JmsListener(destination = "${modifypasswordqueue}") @JmsListener(destination = "${modifypasswordqueue}")
public void reciveMesssage(Message message) { public void reciveMesssage(Message message) {
...@@ -45,6 +57,20 @@ public class PlatformModifyPasswordistener { ...@@ -45,6 +57,20 @@ public class PlatformModifyPasswordistener {
personAccountFed.setSecondaryPassword((String) jsonObject.get("rePassword")); personAccountFed.setSecondaryPassword((String) jsonObject.get("rePassword"));
personAccountFedMapper.updateById(personAccountFed); personAccountFedMapper.updateById(personAccountFed);
} }
//发消息通知集成方修改
Map<String, Object> data=new HashMap<>();
FeignClientResult<AgencyUserModel> amosUser = Privilege.agencyUserClient.queryByUserId(personAccount.getPuserId());
AgencyUserModel user = new AgencyUserModel();
if (!ObjectUtils.isEmpty(amosUser)) {
if (amosUser.getStatus() == 200) {
user = amosUser.getResult();
} else {
throw new RuntimeException(amosUser.getMessage());
}
}
data.put("SEQUENCE_NBR",user.getSequenceNbr());
ProduceMsg produceMsg= new ProduceMsg(data, "UPDATE",personAccount.getPuserId());
querueProduce.produceMsg(JSON.toJSONString(produceMsg));
message.acknowledge(); message.acknowledge();
log.info("--------------------消息消费成功 {}", jsonObject); log.info("--------------------消息消费成功 {}", jsonObject);
} catch (Exception e) { } catch (Exception e) {
......
...@@ -4,9 +4,12 @@ import java.text.SimpleDateFormat; ...@@ -4,9 +4,12 @@ import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Calendar; import java.util.Calendar;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.concurrent.TimeUnit; import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
import javax.annotation.PostConstruct;
import org.apache.kafka.clients.consumer.ConsumerRecord; import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -17,8 +20,10 @@ import org.typroject.tyboot.core.rdbms.service.BaseService; ...@@ -17,8 +20,10 @@ import org.typroject.tyboot.core.rdbms.service.BaseService;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.AlarmEventDto; import com.yeejoin.amos.boot.module.jxiop.biz.dto.AlarmEventDto;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.ColModel; import com.yeejoin.amos.boot.module.jxiop.biz.dto.ColModel;
import com.yeejoin.amos.boot.module.jxiop.biz.dto.DataGridMock; import com.yeejoin.amos.boot.module.jxiop.biz.dto.DataGridMock;
...@@ -39,6 +44,21 @@ public class AlarmEventServiceImpl extends BaseService<AlarmEventDto, AlarmEvent ...@@ -39,6 +44,21 @@ public class AlarmEventServiceImpl extends BaseService<AlarmEventDto, AlarmEvent
@Autowired @Autowired
private EquipmentSpecificIndexMapper equipmentSpecificIndexMapper; private EquipmentSpecificIndexMapper equipmentSpecificIndexMapper;
@Autowired
private RedisUtils redisUtils;
@Autowired
private static Map<String, EquipmentSpecificIndex> map;
@PostConstruct
public void init() {
QueryWrapper<EquipmentSpecificIndex> wrapper = new QueryWrapper<>();
wrapper.eq("is_alarm", 1);
List<EquipmentSpecificIndex> list = equipmentSpecificIndexMapper.selectList(wrapper);
map = list.stream().collect(Collectors.toMap(EquipmentSpecificIndex::getEquipmentSpecificName,
Function.identity(), (key1, key2) -> key2));
}
@Async("jxiopAsyncExecutor") @Async("jxiopAsyncExecutor")
public void handleMessage(List<ConsumerRecord<String, String>> record) { public void handleMessage(List<ConsumerRecord<String, String>> record) {
List<AlarmEvent> alarmEvents = new ArrayList<>(); List<AlarmEvent> alarmEvents = new ArrayList<>();
...@@ -62,15 +82,20 @@ public class AlarmEventServiceImpl extends BaseService<AlarmEventDto, AlarmEvent ...@@ -62,15 +82,20 @@ public class AlarmEventServiceImpl extends BaseService<AlarmEventDto, AlarmEvent
} else { } else {
EquipAlarmEvent equipAlarmEvent = new EquipAlarmEvent(); EquipAlarmEvent equipAlarmEvent = new EquipAlarmEvent();
if (indexName.contains("实时故障") && objName.contains("风机")) { if (indexName.contains("实时故障") && objName.contains("风机")) {
LambdaQueryWrapper<EquipmentSpecificIndex> wrapper = new LambdaQueryWrapper<>(); // LambdaQueryWrapper<EquipmentSpecificIndex> wrapper = new
wrapper.eq(EquipmentSpecificIndex::getEquipmentSpecificName, objName); // LambdaQueryWrapper<>();
EquipmentSpecificIndex equipmentSpecificIndex = equipmentSpecificIndexMapper.selectOne(wrapper); // wrapper.eq(EquipmentSpecificIndex::getEquipmentSpecificName, objName);
// EquipmentSpecificIndex equipmentSpecificIndex =
// equipmentSpecificIndexMapper.selectOne(wrapper);
EquipmentSpecificIndex equipmentSpecificIndex = map.get(objName);
if (equipmentSpecificIndex == null) {
continue;
}
String valueEnum = equipmentSpecificIndex.getValueEnum(); String valueEnum = equipmentSpecificIndex.getValueEnum();
JSONArray arr = JSONObject.parseArray(valueEnum); JSONArray arr = JSONObject.parseArray(valueEnum);
for(Object o:arr) for (Object o : arr) {
{ JSONObject json = JSONObject.parseObject(JSONObject.toJSONString(o));
JSONObject json = JSONObject.parseObject(JSONObject.toJSONString(o)); if (json.containsKey("key") && value.equals(json.get("key"))) {
if (json.containsKey("key")&&value.equals(json.get("key"))) {
String warn = json.getString("label"); String warn = json.getString("label");
if (warn.indexOf("备留") == -1) { if (warn.indexOf("备留") == -1) {
equipAlarmEvent.setEquipName(objName); equipAlarmEvent.setEquipName(objName);
...@@ -118,9 +143,9 @@ public class AlarmEventServiceImpl extends BaseService<AlarmEventDto, AlarmEvent ...@@ -118,9 +143,9 @@ public class AlarmEventServiceImpl extends BaseService<AlarmEventDto, AlarmEvent
i.setValue("分"); i.setValue("分");
} }
i.setStationName("升压站"); i.setStationName("升压站");
long mills = i.getCreatedTime()/1000000; long mills = i.getCreatedTime() / 1000000;
car.setTimeInMillis(mills); car.setTimeInMillis(mills);
//System.out.println(sdf.format(car.getTime())); // System.out.println(sdf.format(car.getTime()));
i.setTime(sdf.format(car.getTime())); i.setTime(sdf.format(car.getTime()));
}); });
PageInfo<EquipAlarmEvent> page = new PageInfo(alarmEventList); PageInfo<EquipAlarmEvent> page = new PageInfo(alarmEventList);
...@@ -131,8 +156,7 @@ public class AlarmEventServiceImpl extends BaseService<AlarmEventDto, AlarmEvent ...@@ -131,8 +156,7 @@ public class AlarmEventServiceImpl extends BaseService<AlarmEventDto, AlarmEvent
ColModel colModelEventDesc = new ColModel("eventDesc", "eventDesc", "事件描述", "事件描述", "dataGrid", "eventDesc"); ColModel colModelEventDesc = new ColModel("eventDesc", "eventDesc", "事件描述", "事件描述", "dataGrid", "eventDesc");
ColModel colModelAlarmGroupName = new ColModel("alarmGroupName", "alarmGroupName", "事件告警组", "事件告警组", "dataGrid", ColModel colModelAlarmGroupName = new ColModel("alarmGroupName", "alarmGroupName", "事件告警组", "事件告警组", "dataGrid",
"alarmGroupName"); "alarmGroupName");
ColModel colModelEventTime = new ColModel("time", "time", "事件发生时间", "事件发生时间", "dataGrid", ColModel colModelEventTime = new ColModel("time", "time", "事件发生时间", "事件发生时间", "dataGrid", "time");
"time");
ColModel colModelEventMovement = new ColModel("value", "value", "事件值", "事件值", "dataGrid", "value"); ColModel colModelEventMovement = new ColModel("value", "value", "事件值", "事件值", "dataGrid", "value");
List<ColModel> listColModel = Arrays.asList(colModelStationName, colModelEventDesc, colModelAlarmGroupName, List<ColModel> listColModel = Arrays.asList(colModelStationName, colModelEventDesc, colModelAlarmGroupName,
colModelEventTime, colModelEventMovement); colModelEventTime, colModelEventMovement);
......
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