Commit 79838267 authored by KeYong's avatar KeYong

提交mqtt推送代码

parent 38e19aba
package com.yeejoin.amos.fas.common.enums;
/**
* @author keyong
* @title: EquipmentRiskTypeEnum
* <pre>
* @description: TODO
* </pre>
* @date 2020/11/10 13:40
*/
public enum EquipmentRiskTypeEnum {
HZGJ("alarm", "火灾告警"),GZ("trouble", "故障");
private String code;
private String type;
EquipmentRiskTypeEnum(String code, String type) {
this.code=code;
this.type=type;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
}
package com.yeejoin.amos.fas.dao.entity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
/**
* @author keyong
* @title: EquipmentSpecific
* <pre>
* @description: TODO
* </pre>
* @date 2020/11/16 15:44
*/
@Entity
@Table(name="wl_equipment_specific")
@NamedQuery(name="EquipmentSpecific.findAll", query="SELECT e FROM EquipmentSpecific e")
public class EquipmentSpecific extends BasicEntity {
@Column(name="equipment_detail_id")
private Long equipmentDetailId;
@Column(name="qr_code")
private String qrCode;
@Column(name="single")
private Boolean single;
@Column(name="system_id")
private Long systemId;
@Column(name="iot_code")
private String iotCode;
@Column(name="org_code")
private String orgCode;
@Column(name="code")
private String code;
public void setEquipmentDetailId(Long equipmentDetailId) {
this.equipmentDetailId = equipmentDetailId;
}
public void setQrCode(String qrCode) {
this.qrCode = qrCode;
}
public void setSingle(Boolean single) {
this.single = single;
}
public void setSystemId(Long systemId) {
this.systemId = systemId;
}
public void setIotCode(String iotCode) {
this.iotCode = iotCode;
}
public void setOrgCode(String orgCode) {
this.orgCode = orgCode;
}
public void setCode(String code) {
this.code = code;
}
public Long getEquipmentDetailId() {
return equipmentDetailId;
}
public String getQrCode() {
return qrCode;
}
public Boolean getSingle() {
return single;
}
public Long getSystemId() {
return systemId;
}
public String getIotCode() {
return iotCode;
}
public String getOrgCode() {
return orgCode;
}
public String getCode() {
return code;
}
public EquipmentSpecific(Long equipmentDetailId, String qrCode, Boolean single, Long systemId, String iotCode, String orgCode, String code) {
this.equipmentDetailId = equipmentDetailId;
this.qrCode = qrCode;
this.single = single;
this.systemId = systemId;
this.iotCode = iotCode;
this.orgCode = orgCode;
this.code = code;
}
public EquipmentSpecific() {
}
}
package com.yeejoin.amos.fas.business.action.mq;
import com.yeejoin.amos.fas.business.service.intfc.IEquipmentHandlerService;
import org.eclipse.paho.client.mqttv3.MqttConnectOptions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.integration.annotation.IntegrationComponentScan;
import org.springframework.integration.annotation.ServiceActivator;
import org.springframework.integration.channel.DirectChannel;
import org.springframework.integration.core.MessageProducer;
import org.springframework.integration.mqtt.core.DefaultMqttPahoClientFactory;
import org.springframework.integration.mqtt.core.MqttPahoClientFactory;
import org.springframework.integration.mqtt.inbound.MqttPahoMessageDrivenChannelAdapter;
import org.springframework.integration.mqtt.support.DefaultPahoMessageConverter;
import org.springframework.messaging.Message;
import org.springframework.messaging.MessageChannel;
import org.springframework.messaging.MessageHandler;
/**
* @author keyong
* @title: WebMqttSubscribe
* <pre>
* @description: Mqtt订阅消息类
* </pre>
* @date 2020/11/9 17:50
*/
@Configuration
@IntegrationComponentScan
public class WebMqttSubscribe {
@Value("${emqx.user-name}")
private String userName;
@Value("${emqx.password}")
private String password;
@Value("${emqx.broker}")
private String hostUrl;
@Value("${emqx.client-id}")
private String clientId;
@Value("${emqx.defaultTopic}")
private String defaultTopic;
public MqttPahoMessageDrivenChannelAdapter adapter;
@Autowired
IEquipmentHandlerService equipmentHandlerService;
@Bean
public MqttConnectOptions getMqttConnectOptions() {
MqttConnectOptions mqttConnectOptions = new MqttConnectOptions();
mqttConnectOptions.setUserName(userName);
mqttConnectOptions.setPassword(password.toCharArray());
mqttConnectOptions.setServerURIs(new String[]{hostUrl});
mqttConnectOptions.setKeepAliveInterval(2);
mqttConnectOptions.setAutomaticReconnect(true);
return mqttConnectOptions;
}
@Bean
public MqttPahoClientFactory mqttPahoClientFactory() {
DefaultMqttPahoClientFactory factory = new DefaultMqttPahoClientFactory();
factory.setConnectionOptions(getMqttConnectOptions());
return factory;
}
@Bean
public MessageChannel mqttInputChannel() {
return new DirectChannel();
}
@Bean
public MessageProducer inbound() {
adapter = new MqttPahoMessageDrivenChannelAdapter(clientId, mqttPahoClientFactory(), defaultTopic);
adapter.setConverter(new DefaultPahoMessageConverter());
adapter.setQos(0);
adapter.setOutputChannel(mqttInputChannel());
return adapter;
}
@Bean
@ServiceActivator(inputChannel = "mqttInputChannel")
public MessageHandler handler() {
return new MessageHandler() {
@Override
public void handleMessage(Message<?> message) {
String topic = message.getHeaders().get("mqtt_receivedTopic").toString();
String msg = message.getPayload().toString();
// 订阅之后的处理逻辑
equipmentHandlerService.handlerMqttMessage(topic, msg);
}
};
}
}
package com.yeejoin.amos.fas.business.controller; package com.yeejoin.amos.fas.business.controller;
import com.yeejoin.amos.fas.business.service.intfc.IEquipmentHandlerService;
import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.ArrayUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
...@@ -31,16 +32,19 @@ public class SafetyController extends BaseController{ ...@@ -31,16 +32,19 @@ public class SafetyController extends BaseController{
@Autowired @Autowired
private RuleTrigger ruleTrigger; private RuleTrigger ruleTrigger;
@Autowired
IEquipmentHandlerService equipmentHandlerService;
/** /**
* 保存登陆用户选择公司信息 * 保存登陆用户选择公司信息
*/ */
@Permission
@ApiOperation(value = " 保存登陆用户选择公司信息", notes = " 保存登陆用户选择公司信息") @ApiOperation(value = " 保存登陆用户选择公司信息", notes = " 保存登陆用户选择公司信息")
@PostMapping(value = "/save/curCompany") @PostMapping(value = "/save/curCompany")
public CommonResponse saveCurCompany(@RequestBody ReginParams reginParams) { public CommonResponse saveCurCompany(@RequestBody ReginParams reginParams) {
this.saveSelectedOrgInfo(reginParams); this.saveSelectedOrgInfo(reginParams);
equipmentHandlerService.subscribeTopic(reginParams);
return CommonResponseUtil.success(); return CommonResponseUtil.success();
} }
......
...@@ -3,7 +3,9 @@ package com.yeejoin.amos.fas.business.dao.mapper; ...@@ -3,7 +3,9 @@ package com.yeejoin.amos.fas.business.dao.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.fas.business.vo.AssoEquipsVo; import com.yeejoin.amos.fas.business.vo.AssoEquipsVo;
import com.yeejoin.amos.fas.business.vo.EquipmentPointVo; import com.yeejoin.amos.fas.business.vo.EquipmentPointVo;
import com.yeejoin.amos.fas.business.vo.EquipmentSpecificForRiskVo;
import com.yeejoin.amos.fas.business.vo.EquipmentSpecificVo; import com.yeejoin.amos.fas.business.vo.EquipmentSpecificVo;
import com.yeejoin.amos.fas.dao.entity.EquipmentSpecific;
import com.yeejoin.amos.fas.dao.entity.FmeaEquipmentPoint; import com.yeejoin.amos.fas.dao.entity.FmeaEquipmentPoint;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
...@@ -51,4 +53,20 @@ public interface EquipmentSpecificMapper extends BaseMapper<EquipmentSpecificVo> ...@@ -51,4 +53,20 @@ public interface EquipmentSpecificMapper extends BaseMapper<EquipmentSpecificVo>
* @return * @return
*/ */
List<EquipmentSpecificVo> getFireEquiments(@Param("equipmentId")String equipmentId, @Param("fname")String fname); List<EquipmentSpecificVo> getFireEquiments(@Param("equipmentId")String equipmentId, @Param("fname")String fname);
String findEquipNameById(@Param("id")long id);
/**
* <pre>
* @Description: 通过id查询
* </pre>
*
* @MethodName:
* @Param: [id]
* @Return: EquipmentSpecific
* @Throws
* @Author keyong
* @Date 2020/11/17 19:32
*/
EquipmentSpecificForRiskVo getOneById(@Param("id")long id);
} }
...@@ -30,4 +30,6 @@ public interface FmeaEquipmentPointMapper extends BaseMapper { ...@@ -30,4 +30,6 @@ public interface FmeaEquipmentPointMapper extends BaseMapper {
void updateStateByIds(@Param("state") Integer state, void updateStateByIds(@Param("state") Integer state,
@Param("ids") List<Long> ids); @Param("ids") List<Long> ids);
List<FmeaEquipmentPoint> listFmeaByEquipIndexIdAndEquipId(@Param("specificIndexId") long specificIndexId, @Param("equipId") long equipId);
} }
...@@ -621,7 +621,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -621,7 +621,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
contingencyRo.setEquipmentCode(equipment.getCode()); contingencyRo.setEquipmentCode(equipment.getCode());
contingencyRo.setEquipmentOrgCode(equipment.getOrgCode()); contingencyRo.setEquipmentOrgCode(equipment.getOrgCode());
Map cameraInfo = impAndFireEquipMapper.queryForCamera(String.valueOf(equipment.getId())); Map cameraInfo = impAndFireEquipMapper.queryForCamera(String.valueOf(equipment.getId()));//查询重点设备关联视频点位,暂不处理
if (cameraInfo != null) { if (cameraInfo != null) {
contingencyRo.setCameraCodes(String.valueOf(cameraInfo.get("codes"))); contingencyRo.setCameraCodes(String.valueOf(cameraInfo.get("codes")));
...@@ -648,15 +648,16 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -648,15 +648,16 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
} }
} }
} }
// 获取遥信指标
List<Map> points = fireEquipPointMapper.getPointsByEquipmentIdAndType(equipment.getId(), "SWITCH"); // 获取遥信指标,暂不处理 ---20201111 code = 设备编码iot_code-指标项name_key
List<Map> points = fireEquipPointMapper.getPointsByEquipmentIdAndType(equipment.getId(), "SWITCH");//物联属性指标 and 为true或false
HashMap<String, Integer> telesignallingMap = new HashMap<>(); HashMap<String, Integer> telesignallingMap = new HashMap<>();
for (Map map : points) { for (Map map : points) {
telesignallingMap.put(map.get("code") + "", (ObjectUtils.isEmpty(map.get("value")) || "false".equals(map.get("value").toString())) ? 0 : 1); telesignallingMap.put(map.get("code") + "", (ObjectUtils.isEmpty(map.get("value")) || "false".equals(map.get("value").toString())) ? 0 : 1);
} }
contingencyRo.setTelesignallingMap(telesignallingMap); contingencyRo.setTelesignallingMap(telesignallingMap);
// 获取遥测指标 // 获取遥测指标
points = fireEquipPointMapper.getPointsByEquipmentIdAndType(equipment.getId(), "ANALOGUE"); points = fireEquipPointMapper.getPointsByEquipmentIdAndType(equipment.getId(), "ANALOGUE"); //物联指标 非 true false
HashMap<String, Double> telemetryMap = new HashMap<>(); HashMap<String, Double> telemetryMap = new HashMap<>();
for (Map map : points) { for (Map map : points) {
telemetryMap.put(map.get("code") + "", Double.valueOf(ObjectUtils.isEmpty(map.get("value")) ? "0" : map.get("value").toString())); telemetryMap.put(map.get("code") + "", Double.valueOf(ObjectUtils.isEmpty(map.get("value")) ? "0" : map.get("value").toString()));
...@@ -933,7 +934,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -933,7 +934,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
if(!ObjectUtils.isEmpty(fireEquipmentPoint)){ if(!ObjectUtils.isEmpty(fireEquipmentPoint)){
fireEquipmentPoint.setValue(deviceData.getState()); fireEquipmentPoint.setValue(deviceData.getState());
updateFirePointValue(fireEquipmentPoint.getId(), deviceData.getState()); updateFirePointValue(fireEquipmentPoint.getId(), deviceData.getState());//不需要
String fireEquipmentPointType = null; String fireEquipmentPointType = null;
if (!ObjectUtils.isEmpty(fireEquipmentPoint.getAlarmType())) { if (!ObjectUtils.isEmpty(fireEquipmentPoint.getAlarmType())) {
...@@ -963,7 +964,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -963,7 +964,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
deviceRo.setPointCode(deviceData.getPointCode()); deviceRo.setPointCode(deviceData.getPointCode());
deviceRo.setValue(deviceData.getState()); deviceRo.setValue(deviceData.getState());
triggerPlanDevice(deviceRo, equipment, toke); triggerPlanDevice(deviceRo, equipment, toke);
Boolean have = impAndFireEquipMapper.existsAlarmPointByEqpPointIdAndEquipId(fireEquipmentPoint.getId(), equipment.getId()); Boolean have = impAndFireEquipMapper.existsAlarmPointByEqpPointIdAndEquipId(fireEquipmentPoint.getId(), equipment.getId());//判断重点设备关联该指标项,需要修改为新查询
if (!ObjectUtils.isEmpty(have) && have) { if (!ObjectUtils.isEmpty(have) && have) {
//动态预案执行 //动态预案执行
dynamicPlan(deviceData, equipment, fireEquipment,toke); dynamicPlan(deviceData, equipment, fireEquipment,toke);
...@@ -1037,7 +1038,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService { ...@@ -1037,7 +1038,7 @@ public class RiskSourceServiceImpl implements IRiskSourceService {
map.put("value", param.getState()); map.put("value", param.getState());
map.put("id", param.getPointCode()); map.put("id", param.getPointCode());
Map<String, Map<String, Object>> riskSourceMap = new HashMap(); Map<String, Map<String, Object>> riskSourceMap = new HashMap();
riskSourceMap.put("equipments", map); riskSourceMap.put("equipments", map);//这个需要确认下
remoteWebSocketServer.sendMessage("equipmentMode", JSON.toJSONString(riskSourceMap)); remoteWebSocketServer.sendMessage("equipmentMode", JSON.toJSONString(riskSourceMap));
// 推送设备状态信息 // 推送设备状态信息
......
package com.yeejoin.amos.fas.business.service.intfc;
import com.yeejoin.amos.fas.business.vo.ReginParams;
/**
* @author keyong
* @title: IEquipmentHandler
* <pre>
* @description: 站端接受装备信息系统数据处理流程
* </pre>
* @date 2020/11/10 18:01
*/
public interface IEquipmentHandlerService {
void handlerMqttMessage(String topic, String message);
void subscribeTopic(ReginParams reginParams);
}
package com.yeejoin.amos.fas.business.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author keyong
* @title: EquipmentSpecificForRiskVo
* <pre>
* @description: 实体装备Vo
* </pre>
* @date 2020/11/17 19:38
*/
@Data
public class EquipmentSpecificForRiskVo {
@ApiModelProperty(value = "id")
private Long id;
@ApiModelProperty(value = "equipName")
private String name;
@ApiModelProperty(value = "code")
private String code;
@ApiModelProperty(value = "systemName")
private String systemName;
@ApiModelProperty(value = "detailid")
private Long equipmentDetailId;
@ApiModelProperty(value = "二维码")
private String qrCode;
@ApiModelProperty(value = "管理方式(默认单件)")
private int single;
@ApiModelProperty(value = "所属系统")
private int systemId;
@ApiModelProperty(value = "物联code")
private String iotCode;
@ApiModelProperty(value = "orgCode")
private String orgCode;
}
package com.yeejoin.amos.fas.business.vo;
/**
* @author keyong
* @title: EquipmentSpecificIndexVo
* <pre>
* @description: 装备性能指标Vo
* </pre>
* @date 2020/11/11 16:49
*/
public class EquipmentSpecificIndexVo {
// id
private long id;
// 装备id
private Long equipmentSpecificId;
// 性能指标value
private String value;
// 性能指标id
private Long equipmentIndexId;
// 性能指标name key
private String nameKey;
// 装备编码
private String code;
// 物联编码
private String iotCode;
// 订阅类型
private String type;
public void setId(long id) {
this.id = id;
}
public long getId() {
return id;
}
public void setIotCode(String iotCode) {
this.iotCode = iotCode;
}
public void setType(String type) {
this.type = type;
}
public String getIotCode() {
return iotCode;
}
public String getType() {
return type;
}
public Long getEquipmentSpecificId() {
return equipmentSpecificId;
}
public String getValue() {
return value;
}
public Long getEquipmentIndexId() {
return equipmentIndexId;
}
public String getNameKey() {
return nameKey;
}
public String getCode() {
return code;
}
public void setEquipmentSpecificId(Long equipmentSpecificId) {
this.equipmentSpecificId = equipmentSpecificId;
}
public void setValue(String value) {
this.value = value;
}
public void setEquipmentIndexId(Long equipmentIndexId) {
this.equipmentIndexId = equipmentIndexId;
}
public void setNameKey(String nameKey) {
this.nameKey = nameKey;
}
public void setCode(String code) {
this.code = code;
}
public EquipmentSpecificIndexVo() {
}
public EquipmentSpecificIndexVo(Long equipmentSpecificId, String value, Long equipmentIndexId, String nameKey, String code, String iotCode, String type) {
this.equipmentSpecificId = equipmentSpecificId;
this.value = value;
this.equipmentIndexId = equipmentIndexId;
this.nameKey = nameKey;
this.code = code;
this.iotCode = iotCode;
this.type = type;
}
}
package com.yeejoin.amos.fas.business.vo;
import io.swagger.annotations.ApiModel;
import lombok.Data;
/**
* @author keyong
* @title: TopicEntityVo
* <pre>
* @description: TODO
* </pre>
* @date 2020/11/13 10:02
*/
@Data
@ApiModel(description = "订阅主题Vo")
public class TopicEntityVo {
private String topic;
private String iotCode;
private String message;
private String type;
}
...@@ -4,6 +4,7 @@ package com.yeejoin.amos.fas.config; ...@@ -4,6 +4,7 @@ package com.yeejoin.amos.fas.config;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import com.yeejoin.amos.component.feign.config.InnerInvokException; import com.yeejoin.amos.component.feign.config.InnerInvokException;
import com.yeejoin.amos.fas.business.action.mq.WebMqttSubscribe;
import com.yeejoin.amos.fas.business.feign.RemoteSecurityService; import com.yeejoin.amos.fas.business.feign.RemoteSecurityService;
import com.yeejoin.amos.fas.business.vo.DepartmentBo; import com.yeejoin.amos.fas.business.vo.DepartmentBo;
import com.yeejoin.amos.fas.business.vo.RoleBo; import com.yeejoin.amos.fas.business.vo.RoleBo;
...@@ -16,6 +17,7 @@ import org.slf4j.Logger; ...@@ -16,6 +17,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
...@@ -51,7 +53,8 @@ public class PermissionAspect { ...@@ -51,7 +53,8 @@ public class PermissionAspect {
@Autowired @Autowired
private RemoteSecurityService remoteSecurityService; private RemoteSecurityService remoteSecurityService;
// 前置通知,在方法执行之前 // 前置通知,在方法执行之前
@Before(value = "@annotation(Permission)") @Before(value = "@annotation(Permission)")
public void PermissionCheck(JoinPoint joinPoint) throws PermissionException { public void PermissionCheck(JoinPoint joinPoint) throws PermissionException {
...@@ -75,44 +78,44 @@ public class PermissionAspect { ...@@ -75,44 +78,44 @@ public class PermissionAspect {
if (joinPoint.getSignature().getName().equals("saveCurCompany")) { if (joinPoint.getSignature().getName().equals("saveCurCompany")) {
return; return;
} }
FeignClientResult feignClientResult; // FeignClientResult feignClientResult;
AgencyUserModel userModel=null; // AgencyUserModel userModel=null;
try { // try {
feignClientResult = Privilege.agencyUserClient.getme(); // feignClientResult = Privilege.agencyUserClient.getme();
userModel = (AgencyUserModel) feignClientResult.getResult(); // userModel = (AgencyUserModel) feignClientResult.getResult();
//
} catch (InnerInvokException e) { // } catch (InnerInvokException e) {
e.printStackTrace(); // e.printStackTrace();
} // }
String userId = null; // String userId = null;
ReginParams regionParam = new ReginParams(); // ReginParams regionParam = new ReginParams();
if(userModel != null){ // if(userModel != null){
userId = userModel.getUserId(); // userId = userModel.getUserId();
Map<Long, List<RoleModel>> orgRoles = userModel.getOrgRoles(); // Map<Long, List<RoleModel>> orgRoles = userModel.getOrgRoles();
List<RoleModel> roleModels = null; // List<RoleModel> roleModels = null;
if(!ObjectUtils.isEmpty(orgRoles)) { // if(!ObjectUtils.isEmpty(orgRoles)) {
for (Map.Entry<Long, List<RoleModel>> entry : orgRoles.entrySet()) { // for (Map.Entry<Long, List<RoleModel>> entry : orgRoles.entrySet()) {
roleModels = entry.getValue(); // roleModels = entry.getValue();
break; // break;
} // }
} // }
ReginParams reginParams = JSON.parseObject(redisTemplate.opsForValue().get(buildKey(userModel.getUserId(), token)), ReginParams.class); // ReginParams reginParams = JSON.parseObject(redisTemplate.opsForValue().get(buildKey(userModel.getUserId(), token)), ReginParams.class);
if(reginParams == null && userModel.getCompanys().size() > 0){ // if(reginParams == null && userModel.getCompanys().size() > 0){
CompanyModel companyModel = userModel.getCompanys().get(0); // CompanyModel companyModel = userModel.getCompanys().get(0);
//
List<DepartmentModel> deptList = remoteSecurityService.getDepartmentTreeByCompanyId(token, product, appKey, companyModel.getSequenceNbr().toString()); // List<DepartmentModel> deptList = remoteSecurityService.getDepartmentTreeByCompanyId(token, product, appKey, companyModel.getSequenceNbr().toString());
if(deptList.size() > 0){ // if(deptList.size() > 0){
CompanyBo companyBo = convertCompanyModelToBo(companyModel); // CompanyBo companyBo = convertCompanyModelToBo(companyModel);
DepartmentBo departmentBo = convertDepartmentModelToBo(deptList.get(0)); // DepartmentBo departmentBo = convertDepartmentModelToBo(deptList.get(0));
regionParam.setCompany(companyBo); // regionParam.setCompany(companyBo);
regionParam.setDepartment(departmentBo); // regionParam.setDepartment(departmentBo);
} // }
if(!ObjectUtils.isEmpty(roleModels)){ // if(!ObjectUtils.isEmpty(roleModels)){
regionParam.setRole(convertRoleModelToBo(roleModels.get(0))); // regionParam.setRole(convertRoleModelToBo(roleModels.get(0)));
} // }
redisTemplate.opsForValue().set(buildKey(userId, token), JSONObject.toJSONString(regionParam)); // redisTemplate.opsForValue().set(buildKey(userId, token), JSONObject.toJSONString(regionParam));
} // }
} // }
} }
private DepartmentBo convertDepartmentModelToBo(DepartmentModel departmentModel){ private DepartmentBo convertDepartmentModelToBo(DepartmentModel departmentModel){
......
...@@ -52,6 +52,9 @@ emqx.client-id=${spring.application.name}-${random.int[1024,65536]} ...@@ -52,6 +52,9 @@ emqx.client-id=${spring.application.name}-${random.int[1024,65536]}
emqx.broker=tcp://172.16.10.85:1883 emqx.broker=tcp://172.16.10.85:1883
emqx.user-name=super emqx.user-name=super
emqx.password=a123456 emqx.password=a123456
# 只用于初始化
emqx.defaultTopic=mqtt_topic
Push.fegin.name=APPMESSAGEPUSHSERVICE-36 Push.fegin.name=APPMESSAGEPUSHSERVICE-36
......
...@@ -46,8 +46,8 @@ spring.servlet.multipart.max-request-size=20MB ...@@ -46,8 +46,8 @@ spring.servlet.multipart.max-request-size=20MB
#feginName #feginName
visual.fegin.name=maas-visual visual.fegin.name=maas-visual
dutyMode.fegin.name=AMOSDUTYMODE dutyMode.fegin.name=AMOSDUTYMODE
#队站装备管理名称,主要用于风险区域同步至仓库货位 #队站装备管理名称,主要用于风险区域同步至仓库货位和订阅装备信息系统
equipManage.fegin.name=AMOS-EQUIPMANAGE-ZZY equipManage.fegin.name=AMOS-EQUIPMANAGE
#是否开启将风险区域同步至仓库货位true开启,false关闭。默认关闭。 #是否开启将风险区域同步至仓库货位true开启,false关闭。默认关闭。
equipManage.fegin.isSyn=false equipManage.fegin.isSyn=false
......
...@@ -145,4 +145,31 @@ ...@@ -145,4 +145,31 @@
</if> </if>
limit #{pageNumber},#{pageSize} limit #{pageNumber},#{pageSize}
</select> </select>
<select id="findEquipNameById" resultType="String">
select
wed.name
from
wl_equipment_specific wes
left join
wl_equipment_detail wed ON wed.id = wes.equipment_detail_id
where
wes.id=#{id}
</select>
<select id="getOneById" resultType="com.yeejoin.amos.fas.business.vo.EquipmentSpecificForRiskVo">
select
wes.id as id,
wed.name as name,
wes.equipment_detail_id as equipmentDetailId,
wes.qr_code as qrCode,
wes.code as code,
wes.org_code as orgCode
from
wl_equipment_specific wes
left join
wl_equipment_detail wed ON wed.id = wes.equipment_detail_id
where
wes.id=#{id}
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -160,4 +160,17 @@ ...@@ -160,4 +160,17 @@
</foreach> </foreach>
</update> </update>
<select id="listFmeaByEquipIndexIdAndEquipId" resultType="com.yeejoin.amos.fas.dao.entity.FmeaEquipmentPoint">
select
id,
fmea_id as fmeaId,
equipment_point_id as equipmentPointId,
state,
important_equipment_id as importantEquipmentId
from
f_fmea_equipment_point
where
equipment_point_id = #{specificIndexId} and important_equipment_id = #{equipId}
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -193,6 +193,16 @@ ...@@ -193,6 +193,16 @@
<artifactId>jpush-client</artifactId> <artifactId>jpush-client</artifactId>
<version>3.3.10</version> <version>3.3.10</version>
</dependency> </dependency>
<!-- MQTT依赖 -->
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-stream</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.integration</groupId>
<artifactId>spring-integration-mqtt</artifactId>
</dependency>
</dependencies> </dependencies>
<dependencyManagement> <dependencyManagement>
......
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