chenchaod 2 mesi fa
parent
commit
c8fea414ee

+ 0
- 11
zhywpt-service-ats/src/main/java/cn/com/taiji/ats/manager/jpush/JpushAllAppManager.java Vedi File

@@ -1,11 +0,0 @@
package cn.com.taiji.ats.manager.jpush;

import cn.com.taiji.common.manager.net.http.ServiceHandleException;
import cn.com.taiji.core.model.comm.protocol.ats.jpush.JPushSendMessageRequest;
import cn.com.taiji.core.model.comm.protocol.ats.jpush.JPushSendMessageResponse;


public interface JPushAllAppManager {
JPushSendMessageResponse jpushSendMessageHandler(JPushSendMessageRequest request) throws ServiceHandleException;

}

+ 0
- 55
zhywpt-service-ats/src/main/java/cn/com/taiji/ats/manager/jpush/JpushAllAppManagerImpl.java Vedi File

@@ -1,55 +0,0 @@
package cn.com.taiji.ats.manager.jpush;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import cn.com.taiji.ats.api.TokenHelper;
import cn.com.taiji.ats.model.jpush.JPushManager;
import cn.com.taiji.common.manager.ManagerException;
import cn.com.taiji.common.manager.net.http.ServiceHandleException;
import cn.com.taiji.core.entity.dict.msgw.MessageJPushType;
import cn.com.taiji.core.model.comm.protocol.ats.jpush.JPushSendMessageRequest;
import cn.com.taiji.core.model.comm.protocol.ats.jpush.JPushSendMessageResponse;
import cn.com.taiji.core.model.comm.protocol.valid.GlyServiceError;

@Service
public class JPushAllAppManagerImpl implements JPushAllAppManager{

@Autowired
private JPushManager jpushManager;
/**
* * 极光推送-指定的registrationId列表(android/ios)-通知栏通知和自定义消息
* @param request
* @return
* @throws ManagerException
*/
@Override
public JPushSendMessageResponse jpushSendMessageHandler(JPushSendMessageRequest request) throws ServiceHandleException {
JPushSendMessageResponse response = null;
TokenHelper.logger.info("------- 极光推送-指定的registrationId列表-通知栏通知和自定义消息 START -------");
TokenHelper.logger.info("接收的request:{}", request.toJson());
//1、入参校验
request.valid();
try {
if (request.getJPushType().equals(MessageJPushType.JPUSHALLAPPN)){
response = jpushManager.sendToAllAppMessage(request);
}else if (request.getJPushType().equals(MessageJPushType.JPUSHALLAPPM)){
response = jpushManager.sendToAllAppNotification(request);
}else if (request.getJPushType().equals(MessageJPushType.JPUSHALLAPPNM)){
response = jpushManager.sendToAllAppNotificationMessage(request);
}else if (request.getJPushType().equals(MessageJPushType.JPUSHALLRIDN)){
response = jpushManager.sendToAllRidMessage(request);
}else if (request.getJPushType().equals(MessageJPushType.JPUSHALLRIDM)){
response = jpushManager.sendToAllRidNotification(request);
}else if (request.getJPushType().equals(MessageJPushType.JPUSHALLRIDNM)){
response = jpushManager.sendToAllRidNotificationMessage(request);
}
} catch (Exception e) {
TokenHelper.logger.error("", e);
throw GlyServiceError.RESPONSE_ERROR.toHandleException("极光推动发送消息失败!");
} finally {
TokenHelper.logger.info("------- 极光推送-指定的registrationId列表-通知栏通知和自定义消息 END -------");
}
return response;
}
}

+ 0
- 27
zhywpt-service-ats/src/main/java/cn/com/taiji/ats/model/jpush/JpushManager.java Vedi File

@@ -1,27 +0,0 @@
package cn.com.taiji.ats.model.jpush;

import cn.com.taiji.common.manager.ManagerException;
import cn.com.taiji.core.model.comm.protocol.ats.jpush.JPushSendMessageRequest;
import cn.com.taiji.core.model.comm.protocol.ats.jpush.JPushSendMessageResponse;


public interface JPushManager {
/**极光推送-全体App用户(android/ios)-自定义消息*/
JPushSendMessageResponse sendToAllAppMessage(JPushSendMessageRequest request) throws ManagerException;

/**极光推送-全体App用户(android/ios)-通知栏通知*/
JPushSendMessageResponse sendToAllAppNotification(JPushSendMessageRequest request) throws ManagerException;

/**极光推送-全体App用户(android/ios)-通知栏通知和自定义消息*/
JPushSendMessageResponse sendToAllAppNotificationMessage(JPushSendMessageRequest request) throws ManagerException;

/**极光推送-指定registrationId(android/ios)-自定义消息*/
JPushSendMessageResponse sendToAllRidMessage(JPushSendMessageRequest request) throws ManagerException;

/**极光推送-指定registrationId(android/ios)-通知栏通知*/
JPushSendMessageResponse sendToAllRidNotification(JPushSendMessageRequest request) throws ManagerException;

/**极光推送-指定registrationId(android/ios)-通知栏通知和自定义消息*/
JPushSendMessageResponse sendToAllRidNotificationMessage(JPushSendMessageRequest request) throws ManagerException;

}

+ 0
- 104
zhywpt-service-ats/src/main/java/cn/com/taiji/ats/model/jpush/JpushManagerImpl.java Vedi File

@@ -1,104 +0,0 @@
package cn.com.taiji.ats.model.jpush;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import cn.com.taiji.ats.manager.jpush.messageChannelClients.MyJpushClient;
import cn.com.taiji.common.manager.ManagerException;
import cn.com.taiji.common.pub.CommonAbstract;
import cn.com.taiji.core.model.comm.protocol.ats.jpush.JPushSendMessageRequest;
import cn.com.taiji.core.model.comm.protocol.ats.jpush.JPushSendMessageResponse;


@Service
public class JPushManagerImpl extends CommonAbstract implements JPushManager {
private static final Logger logger = LoggerFactory.getLogger(JPushManagerImpl.class);

@Autowired
private MyJpushClient myJpushClient;

// 极光推送-全体App用户(android/ios)-自定义消息
@Override
public JPushSendMessageResponse sendToAllAppMessage(JPushSendMessageRequest request) throws ManagerException {
logger.info("********** 极光推送全体用户自定义消息发送 START **********");
myJpushClient.sendToAllAppMessage(request.getMsgTitle(),
request.getMsgContent(),
request.getMsgExtra());
logger.info("********** 极光推送全体用户自定义消息发送 END **********");
JPushSendMessageResponse response = new JPushSendMessageResponse();
return response;
}
//极光推送-全体App用户(android/ios)-通知栏通知
@Override
public JPushSendMessageResponse sendToAllAppNotification(JPushSendMessageRequest request) throws ManagerException {
logger.info("********** 极光推送全体用户通知栏通知发送 START **********");
myJpushClient.sendToAllAppNotification(
request.getNotificationTitle(),
request.getNotificationContent(),
request.getNotificationExtras());
logger.info("********** 极光推送全体用户通知栏通知发送 END **********");
JPushSendMessageResponse response = new JPushSendMessageResponse();
return response;
}
//极光推送-全体App用户(android/ios)-通知栏通知和自定义消息
@Override
public JPushSendMessageResponse sendToAllAppNotificationMessage(JPushSendMessageRequest request) throws ManagerException {
logger.info("********** 极光推送全体用户通知栏通知和自定义消息发送 START **********");
myJpushClient.sendToAllAppNotificationMessage(
request.getNotificationTitle(),
request.getNotificationContent(),
request.getNotificationExtras(),
request.getMsgTitle(),
request.getMsgContent(),
request.getMsgExtra());
logger.info("********** 极光推送全体用户通知栏通知和自定义消息发送 END **********");
JPushSendMessageResponse response = new JPushSendMessageResponse();
return response;
}
//极光推送-指定registrationId(android/ios)-自定义消息
@Override
public JPushSendMessageResponse sendToAllRidMessage(JPushSendMessageRequest request) throws ManagerException {
logger.info("********** 极光推送指定rid自定义消息发送 START **********");
myJpushClient.sendToAllRidMessage(
request.getRegistrationIdList(),
request.getMsgTitle(),
request.getMsgContent(),
request.getMsgExtra());
logger.info("********** 极光推送指定rid自定义消息发送 END **********");
JPushSendMessageResponse response = new JPushSendMessageResponse();
return response;
}
//极光推送-指定registrationId(android/ios)-通知栏通知
@Override
public JPushSendMessageResponse sendToAllRidNotification(JPushSendMessageRequest request) throws ManagerException {
logger.info("********** 极光推送指定rid通知栏通知发送 START **********");
myJpushClient.sendToAllRidNotification(
request.getRegistrationIdList(),
request.getNotificationTitle(),
request.getNotificationContent(),
request.getNotificationExtras());
logger.info("********** 极光推送指定rid通知栏通知发送 END **********");
JPushSendMessageResponse response = new JPushSendMessageResponse();
return response;
}

//极光推送-指定registrationId(android/ios)-通知栏通知和自定义消息
@Override
public JPushSendMessageResponse sendToAllRidNotificationMessage(JPushSendMessageRequest request) throws ManagerException {
logger.info("********** 极光推送指定rid通知栏通知和自定义消息发送 START **********");
// 发送
myJpushClient.sendToAllRidNotificationMessage(
request.getRegistrationIdList().toString(),
request.getNotificationTitle(),
request.getNotificationContent(),
request.getNotificationExtras(),
request.getMsgTitle(),
request.getMsgContent(),
request.getMsgExtra());
logger.info("********** 极光推送指定rid通知栏通知和自定义消息发送 END **********");
JPushSendMessageResponse response = new JPushSendMessageResponse();
return response;
}
}

Loading…
Annulla
Salva