1.修改app推送逻辑,可关闭推送
This commit is contained in:
parent
89bacebe1f
commit
75b4051cbe
|
|
@ -4,6 +4,7 @@ import com.getui.push.v2.sdk.ApiHelper;
|
|||
import com.getui.push.v2.sdk.GtApiConfiguration;
|
||||
import com.getui.push.v2.sdk.api.PushApi;
|
||||
import lombok.Data;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
|
@ -23,11 +24,14 @@ public class MyApiHelper {
|
|||
|
||||
private String url;
|
||||
|
||||
private boolean enabled;
|
||||
|
||||
/**
|
||||
* 个推接口实例化
|
||||
* @return
|
||||
*/
|
||||
@Bean(name = "onlyPushApi")
|
||||
@ConditionalOnProperty(prefix = "getui.app", name = "enabled", havingValue = "true")
|
||||
public PushApi pushApi() {
|
||||
GtApiConfiguration apiConfiguration = new GtApiConfiguration();
|
||||
//填写应用配置,参数在“Uni Push”下的“应用配置”页面中获取
|
||||
|
|
@ -40,5 +44,4 @@ public class MyApiHelper {
|
|||
PushApi pushApi = apiHelper.creatApi(PushApi.class);
|
||||
return pushApi;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -2,6 +2,7 @@ package org.jeecg.modules.message.service.impl;
|
|||
|
||||
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||
import org.jeecg.common.api.dto.message.MessageDTO;
|
||||
import org.jeecg.config.init.MyApiHelper;
|
||||
import org.jeecg.modules.message.mapper.AppMessageMapper;
|
||||
import org.jeecg.modules.message.service.IAppMessageService;
|
||||
import org.jeecg.modules.message.util.PushAppUtil;
|
||||
|
|
@ -18,19 +19,23 @@ public class AppMessageServiceImpl implements IAppMessageService {
|
|||
private PushAppUtil pushAppUtil;
|
||||
@Autowired
|
||||
private AppMessageMapper appMessageMapper;
|
||||
|
||||
@Autowired
|
||||
private MyApiHelper myApiHelper;
|
||||
|
||||
@Override
|
||||
public void sendToSingle(MessageDTO messageDTO, String groupId) {
|
||||
//根据分组id查询出关联的用户id
|
||||
List<String> groupUserIds = appMessageMapper.findGroupUserIds(groupId);
|
||||
if (CollectionUtils.isNotEmpty(groupUserIds)) {
|
||||
//根据用户id查询出用户关联的app客户端id
|
||||
List<String> userClientId = appMessageMapper.findUserClientId(groupUserIds);
|
||||
if (CollectionUtils.isNotEmpty(userClientId)) {
|
||||
userClientId = userClientId.stream().distinct().collect(Collectors.toList());
|
||||
//调用app推送方法
|
||||
pushAppUtil.pushToList(messageDTO, userClientId);
|
||||
//个推启用才推送消息到app
|
||||
if (myApiHelper.isEnabled()){
|
||||
//根据分组id查询出关联的用户id
|
||||
List<String> groupUserIds = appMessageMapper.findGroupUserIds(groupId);
|
||||
if (CollectionUtils.isNotEmpty(groupUserIds)) {
|
||||
//根据用户id查询出用户关联的app客户端id
|
||||
List<String> userClientId = appMessageMapper.findUserClientId(groupUserIds);
|
||||
if (CollectionUtils.isNotEmpty(userClientId)) {
|
||||
userClientId = userClientId.stream().distinct().collect(Collectors.toList());
|
||||
//调用app推送方法
|
||||
pushAppUtil.pushToList(messageDTO, userClientId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ import com.getui.push.v2.sdk.dto.res.TaskIdDTO;
|
|||
import org.jeecg.common.api.dto.message.MessageDTO;
|
||||
import org.jeecg.modules.message.mapper.AppMessageMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
|
@ -29,7 +30,8 @@ public class PushAppUtil {
|
|||
|
||||
@Autowired
|
||||
private AppMessageMapper appMessageMapper;
|
||||
@Resource(name = "onlyPushApi")
|
||||
@Autowired(required = false)
|
||||
@Qualifier("onlyPushApi")
|
||||
private PushApi pushApi;
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration debug="false">
|
||||
<!--定义日志文件的存储地址 -->
|
||||
<property name="LOG_HOME" value="../logs" />
|
||||
<property name="ERROR_LOG_HOME" value="../errorLogs" />
|
||||
<property name="LOG_HOME" value="./logs" />
|
||||
<property name="ERROR_LOG_HOME" value="./errorLogs" />
|
||||
|
||||
<!--<property name="COLOR_PATTERN" value="%black(%contextName-) %red(%d{yyyy-MM-dd HH:mm:ss}) %green([%thread]) %highlight(%-5level) %boldMagenta( %replace(%caller{1}){'\t|Caller.{1}0|\r\n', ''})- %gray(%msg%xEx%n)" />-->
|
||||
<!-- 控制台输出 -->
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@ db:
|
|||
'0': ${POSTGRESQL-PWD:postgres}
|
||||
url:
|
||||
'0': jdbc:postgresql://${POSTGRESQL-HOST:127.0.0.1}:${POSTGRESQL-PORT:5432}/${POSTGRESQL-DB:nacos}?tcpKeepAlive=true&reWriteBatchedInserts=true&ApplicationName=nacos_java
|
||||
#'0': jdbc:postgresql://${MYSQL-HOST:172.21.50.118}:${MYSQL-PORT:5432}/${MYSQL-DB:nacos}?tcpKeepAlive=true&reWriteBatchedInserts=true&ApplicationName=nacos_java
|
||||
user:
|
||||
'0': ${POSTGRESQL-USER:postgres}
|
||||
pool:
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user