@ -12,15 +12,18 @@ import com.cloud.kicc.common.core.constant.SecurityConstants;
@@ -12,15 +12,18 @@ import com.cloud.kicc.common.core.constant.SecurityConstants;
import com.cloud.kicc.common.core.exception.CheckedException ;
import com.cloud.kicc.commonbiz.api.entity.Message ;
import com.cloud.kicc.commonbiz.api.entity.PushApplication ;
import com.cloud.kicc.commonbiz.api.entity.PushCustomType ;
import com.cloud.kicc.commonbiz.api.entity.UserPush ;
import com.cloud.kicc.commonbiz.mapper.PushApplicationMapper ;
import com.cloud.kicc.commonbiz.service.IPushApplicationService ;
import com.cloud.kicc.commonbiz.service.IPushCustomTypeService ;
import com.cloud.kicc.commonbiz.service.UserPushService ;
import com.cloud.kicc.commonbiz.util.PushClientUtil ;
import com.cloud.kicc.system.api.entity.User ;
import com.cloud.kicc.system.api.feign.RemoteUserService ;
import lombok.RequiredArgsConstructor ;
import okhttp3.OkHttpClient ;
import org.springframework.security.core.parameters.P ;
import org.springframework.stereotype.Service ;
import org.springframework.transaction.annotation.Transactional ;
import org.springframework.web.context.request.RequestContextHolder ;
@ -49,6 +52,7 @@ public class PushApplicationServiceImpl extends ServiceImpl<PushApplicationMappe
@@ -49,6 +52,7 @@ public class PushApplicationServiceImpl extends ServiceImpl<PushApplicationMappe
private final OkHttpClient okHttpClient ;
private final UserPushService userPushService ;
private final RemoteUserService remoteUserService ;
private final IPushCustomTypeService iPushCustomTypeService ;
@Override
public void messageSend ( Message message ) {
@ -70,6 +74,17 @@ public class PushApplicationServiceImpl extends ServiceImpl<PushApplicationMappe
@@ -70,6 +74,17 @@ public class PushApplicationServiceImpl extends ServiceImpl<PushApplicationMappe
}
}
// 查询当前用户设置的自定义快捷方式消息提醒属性
PushCustomType pushCustomType = iPushCustomTypeService . getOne ( Wrappers . < PushCustomType > lambdaQuery ( )
. eq ( PushCustomType : : getId , message . getCustomTypeId ( ) ) . eq ( PushCustomType : : getCreateById , message . getSendUserId ( ) ) ) ;
if ( ObjectUtil . isNotEmpty ( pushCustomType ) ) {
message . setPlaySound ( pushCustomType . getPlaySound ( ) ) ;
message . setPlayVibrate ( pushCustomType . getPlayVibrate ( ) ) ;
message . setPlayLights ( pushCustomType . getPlayLights ( ) ) ;
if ( StrUtil . isNotBlank ( pushCustomType . getCustomPlayFileName ( ) ) )
message . setCustomPlayFileName ( pushCustomType . getCustomPlayFileName ( ) ) ;
}
List < UserPush > pushList = userPushService . list ( Wrappers . < UserPush > lambdaQuery ( ) . eq ( UserPush : : getUserId , message . getSendUserId ( ) ) ) ;
if ( ObjectUtil . isNotEmpty ( pushList ) ) {
// 设置默认数据
@ -78,6 +93,7 @@ public class PushApplicationServiceImpl extends ServiceImpl<PushApplicationMappe
@@ -78,6 +93,7 @@ public class PushApplicationServiceImpl extends ServiceImpl<PushApplicationMappe
message . setAlias ( pushList . stream ( ) . map ( item - > item . getPushId ( ) ) . collect ( Collectors . joining ( "," ) ) ) ;
JSONObject custom = new JSONObject ( ) ;
custom . put ( "sendUserId" , message . getSendUserId ( ) ) ;
custom . put ( "customPlayFileName" , message . getCustomPlayFileName ( ) ) ;
message . setCustom ( custom . toString ( ) ) ;
JSONObject jsonObject = new JSONObject ( ) ;
jsonObject . put ( "production_mode" , PushClientUtil . PRODUCTION_MODE ) ;