新增用户绑定当前设备

This commit is contained in:
yiyan 2019-04-11 09:46:00 +08:00
parent 7b2c9f46a0
commit b3bf43d55d
11 changed files with 118 additions and 4 deletions

View File

@ -32,6 +32,8 @@
</content> </content>
<orderEntry type="inheritedJdk" /> <orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Maven: org.apache.httpcomponents:httpclient:4.5.8" level="project" />
<orderEntry type="library" name="Maven: commons-codec:commons-codec:1.11" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.12" level="project" /> <orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.12" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" /> <orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.springframework:spring-test:5.0.8.RELEASE" level="project" /> <orderEntry type="library" scope="TEST" name="Maven: org.springframework:spring-test:5.0.8.RELEASE" level="project" />

View File

@ -0,0 +1,50 @@
package com.ifish7.mq.business.user.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.experimental.Accessors;
import java.time.LocalTime;
/**
* <p>
*
* </p>
*
* @author yan.y
* @since 2019-04-11
*/
@Data
@Accessors(chain = true)
@TableName("tbl_push_user_device")
public class TblPushUserDevice {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
private Integer pushId;
/**
* 用户ID
*/
private Integer pushUserId;
/**
* 设备ID
*/
private String pushDeviceId;
/**
* 设备绑定时间
*/
private LocalTime pushBindTime;
/**
* 设备绑定类型
*/
private String pushBindType;
}

View File

@ -0,0 +1,16 @@
package com.ifish7.mq.business.user.mapper;
import com.ifish7.mq.business.user.entity.TblPushUserDevice;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* Mapper 接口
* </p>
*
* @author yan.y
* @since 2019-04-11
*/
public interface TblPushUserDeviceMapper extends BaseMapper<TblPushUserDevice> {
}

View File

@ -0,0 +1,16 @@
package com.ifish7.mq.business.user.service;
import com.ifish7.mq.business.user.entity.TblPushUserDevice;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* <p>
* 服务类
* </p>
*
* @author yan.y
* @since 2019-04-11
*/
public interface ITblPushUserDeviceService extends IService<TblPushUserDevice> {
}

View File

@ -0,0 +1,20 @@
package com.ifish7.mq.business.user.service.impl;
import com.ifish7.mq.business.user.entity.TblPushUserDevice;
import com.ifish7.mq.business.user.mapper.TblPushUserDeviceMapper;
import com.ifish7.mq.business.user.service.ITblPushUserDeviceService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
* 服务实现类
* </p>
*
* @author yan.y
* @since 2019-04-11
*/
@Service
public class TblPushUserDeviceServiceImpl extends ServiceImpl<TblPushUserDeviceMapper, TblPushUserDevice> implements ITblPushUserDeviceService {
}

View File

@ -39,7 +39,7 @@ public class AliyunPushApi {
@Autowired @Autowired
private ITblPushListService pushListService; private ITblPushListService pushListService;
public void advancedPush(JSONObject json){ public void advancedPushAndSavePushList(JSONObject json){
//推送目标 //推送目标
//DEVICE:根据设备推送 //DEVICE:根据设备推送

View File

@ -61,6 +61,7 @@ public class DeviceInfoEvent {
* "macAddress" : "5ccf7f006686", * "macAddress" : "5ccf7f006686",
* "deviceIp" : "172.16.119.128", * "deviceIp" : "172.16.119.128",
* "hardwareType" : "02", * "hardwareType" : "02",
* "factoryCode" : "2a",
* "softwareVersion" : "02" * "softwareVersion" : "02"
* } * }
* } * }

View File

@ -18,6 +18,6 @@ public class PushNotifcationEvent {
*/ */
private void deviceNotifcationPlus(JSONObject eventBody){ private void deviceNotifcationPlus(JSONObject eventBody){
AliyunPushApi aliyunPushApi = AppBeans.getBean(AliyunPushApi.class); AliyunPushApi aliyunPushApi = AppBeans.getBean(AliyunPushApi.class);
aliyunPushApi.advancedPush(eventBody); aliyunPushApi.advancedPushAndSavePushList(eventBody);
} }
} }

View File

@ -1,5 +1,7 @@
package com.ifish7.mq.queues.listener; package com.ifish7.mq.queues.listener;
import com.alibaba.fastjson.JSON;
import com.ifish7.mq.queues.event.support.PushEventSupport;
import lombok.extern.log4j.Log4j; import lombok.extern.log4j.Log4j;
import javax.jms.JMSException; import javax.jms.JMSException;
@ -20,6 +22,8 @@ public class IfishPushQueueMessageListener implements MessageListener {
TextMessage tm = (TextMessage) message; TextMessage tm = (TextMessage) message;
try { try {
log.info("Ifish7 - Push : " + tm.getText()); log.info("Ifish7 - Push : " + tm.getText());
PushEventSupport dataEventSupport = JSON.parseObject(tm.getText(), PushEventSupport.class);
dataEventSupport.process();
} catch (JMSException e) { } catch (JMSException e) {
log.error(e); log.error(e);
} }

View File

@ -54,11 +54,11 @@ public class MybatisCodeGenerator {
// 数据源配置 // 数据源配置
DataSourceConfig dsc = new DataSourceConfig(); DataSourceConfig dsc = new DataSourceConfig();
dsc.setUrl("jdbc:mysql://localhost:3306/myfishdb?useUnicode=true&useSSL=false&characterEncoding=utf8"); dsc.setUrl("jdbc:mysql://139.196.24.156:3306/myfishdb?useUnicode=true&useSSL=false&characterEncoding=utf8");
// dsc.setSchemaName("public"); // dsc.setSchemaName("public");
dsc.setDriverName("com.mysql.jdbc.Driver"); dsc.setDriverName("com.mysql.jdbc.Driver");
dsc.setUsername("root"); dsc.setUsername("root");
dsc.setPassword("123456"); dsc.setPassword("ifish7mysql");
mpg.setDataSource(dsc); mpg.setDataSource(dsc);
// 包配置 // 包配置

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ifish7.mq.business.user.mapper.TblPushUserDeviceMapper">
</mapper>