|
|
|
@@ -6,6 +6,7 @@ import com.aliyuncs.http.FormatType;
|
|
|
|
|
import com.aliyuncs.profile.DefaultProfile;
|
|
|
|
|
import com.aliyuncs.push.model.v20160801.PushRequest;
|
|
|
|
|
import com.aliyuncs.push.model.v20160801.PushResponse;
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
|
import com.ifish7.mq.business.user.entity.TblAliyunDeviceInfo;
|
|
|
|
|
import com.ifish7.mq.business.user.entity.TblPushList;
|
|
|
|
@@ -59,7 +60,14 @@ public class AliyunPushApi {
|
|
|
|
|
//根据Target来设定,多个值使用逗号分隔
|
|
|
|
|
//此处应该查询出用户所对应的deviceId ★★★★★
|
|
|
|
|
// String deviceIds = getUserDevices(String.valueOf(pushList.getUserId()));
|
|
|
|
|
List<TblAliyunDeviceInfo> pushUserDevices = aliyunDeviceInfoService.list(new QueryWrapper<TblAliyunDeviceInfo>().lambda().eq(TblAliyunDeviceInfo::getUserId, pushList.getUserId()));
|
|
|
|
|
//查询所有
|
|
|
|
|
LambdaQueryWrapper<TblAliyunDeviceInfo> allQuary = new QueryWrapper<TblAliyunDeviceInfo>().lambda().eq(TblAliyunDeviceInfo::getUserId, pushList.getUserId());
|
|
|
|
|
if ("IOS".equals(pushList.getPhoneType().toUpperCase())) {
|
|
|
|
|
allQuary.eq(TblAliyunDeviceInfo::getPhoneType,"iOS");
|
|
|
|
|
} else if("ANDROID".equals(pushList.getPhoneType().toUpperCase())) {
|
|
|
|
|
allQuary.eq(TblAliyunDeviceInfo::getPhoneType,"ANDROID");
|
|
|
|
|
}
|
|
|
|
|
List<TblAliyunDeviceInfo> pushUserDevices = aliyunDeviceInfoService.list(allQuary);
|
|
|
|
|
pushUserDevices.forEach(aliyunDeviceInfo -> {
|
|
|
|
|
if ("iOS".equals(aliyunDeviceInfo.getPhoneType())) {
|
|
|
|
|
pushRequest.setAppKey(Long.parseLong(iosAppKey));
|
|
|
|
@@ -97,11 +105,11 @@ public class AliyunPushApi {
|
|
|
|
|
pushList.setReportId(Integer.parseInt(response.getMessageId()));
|
|
|
|
|
//未读
|
|
|
|
|
pushList.setIsRead(1);
|
|
|
|
|
pushList.setDeviceId(pushList.getDeviceId() == 0 ? null : pushList.getDeviceId());
|
|
|
|
|
pushListService.save(pushList);
|
|
|
|
|
pushList.setDeviceId((pushList.getDeviceId() == null || pushList.getDeviceId() == 0)? null : pushList.getDeviceId());
|
|
|
|
|
} catch (ClientException e) {
|
|
|
|
|
log.error(e.getMessage(),e);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
pushListService.save(pushList);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|