Merge branch 'main' of gitea.haiyihy.com:hy/chatapp3-java
This commit is contained in:
commit
7bc8b44450
@ -29,28 +29,34 @@ import com.red.circle.other.infra.convertor.material.PropsMaterialInfraConvertor
|
|||||||
import com.red.circle.other.infra.database.cache.key.AdminFreeKeys;
|
import com.red.circle.other.infra.database.cache.key.AdminFreeKeys;
|
||||||
import com.red.circle.other.infra.database.mongo.entity.team.team.TeamMember;
|
import com.red.circle.other.infra.database.mongo.entity.team.team.TeamMember;
|
||||||
import com.red.circle.other.infra.database.mongo.entity.team.team.TeamProfile;
|
import com.red.circle.other.infra.database.mongo.entity.team.team.TeamProfile;
|
||||||
import com.red.circle.other.infra.database.mongo.entity.user.profile.UserSpecialId;
|
import com.red.circle.other.infra.database.mongo.entity.user.profile.UserSpecialId;
|
||||||
import com.red.circle.other.infra.database.mongo.service.team.team.TeamMemberService;
|
import com.red.circle.other.infra.database.mongo.service.team.team.TeamMemberService;
|
||||||
import com.red.circle.other.infra.database.mongo.service.team.team.TeamProfileService;
|
import com.red.circle.other.infra.database.mongo.service.team.team.TeamProfileService;
|
||||||
import com.red.circle.other.infra.database.mongo.service.user.profile.UserSpecialIdService;
|
import com.red.circle.other.infra.database.mongo.service.user.profile.UserSpecialIdService;
|
||||||
import com.red.circle.other.infra.database.rds.entity.props.PropsSourceRecord;
|
import com.red.circle.other.infra.database.rds.entity.badge.BadgeConfig;
|
||||||
import com.red.circle.other.infra.database.rds.entity.sys.Administrator;
|
import com.red.circle.other.infra.database.rds.entity.props.PropsSourceRecord;
|
||||||
import com.red.circle.other.infra.database.rds.entity.team.BusinessDevelopmentBaseInfo;
|
import com.red.circle.other.infra.database.rds.entity.sys.Administrator;
|
||||||
import com.red.circle.other.infra.database.rds.entity.team.BusinessDevelopmentTeam;
|
import com.red.circle.other.infra.database.rds.entity.team.BusinessDevelopmentBaseInfo;
|
||||||
import com.red.circle.other.infra.database.rds.service.props.PropsSourceRecordService;
|
import com.red.circle.other.infra.database.rds.entity.team.BusinessDevelopmentTeam;
|
||||||
import com.red.circle.other.infra.database.rds.service.sys.AdministratorService;
|
import com.red.circle.other.infra.database.rds.service.badge.BadgeConfigService;
|
||||||
import com.red.circle.other.infra.database.rds.service.team.BusinessDevelopmentBaseInfoService;
|
import com.red.circle.other.infra.database.rds.service.props.PropsSourceRecordService;
|
||||||
import com.red.circle.other.infra.database.rds.service.team.BusinessDevelopmentTeamService;
|
import com.red.circle.other.infra.database.rds.service.sys.AdministratorService;
|
||||||
import com.red.circle.other.inner.asserts.user.UserErrorCode;
|
import com.red.circle.other.infra.database.rds.service.team.BusinessDevelopmentBaseInfoService;
|
||||||
import com.red.circle.other.inner.endpoint.material.props.PropsBackpackClient;
|
import com.red.circle.other.infra.database.rds.service.team.BusinessDevelopmentTeamService;
|
||||||
import com.red.circle.other.inner.endpoint.material.props.PropsNobleVipClient;
|
import com.red.circle.other.inner.asserts.user.UserErrorCode;
|
||||||
import com.red.circle.other.inner.endpoint.user.user.UserProfileClient;
|
import com.red.circle.other.inner.endpoint.material.props.BadgeBackpackClient;
|
||||||
import com.red.circle.other.inner.enums.material.ConsolePropsTypeEnum;
|
import com.red.circle.other.inner.endpoint.material.props.PropsBackpackClient;
|
||||||
import com.red.circle.other.inner.enums.material.PropsCommodityType;
|
import com.red.circle.other.inner.endpoint.material.props.PropsNobleVipClient;
|
||||||
import com.red.circle.other.inner.enums.team.TeamMemberRole;
|
import com.red.circle.other.inner.endpoint.user.user.UserProfileClient;
|
||||||
import com.red.circle.other.inner.model.cmd.material.GivePropsBackpackCmd;
|
import com.red.circle.other.inner.enums.material.BadgeBackpackExpireTypeEnum;
|
||||||
import com.red.circle.other.inner.model.cmd.team.TeamMemberBackQryCmd;
|
import com.red.circle.other.inner.enums.material.ConsolePropsTypeEnum;
|
||||||
import com.red.circle.other.inner.model.dto.material.PropsResourcesDTO;
|
import com.red.circle.other.inner.enums.material.PropsCommodityType;
|
||||||
|
import com.red.circle.other.inner.enums.team.TeamMemberRole;
|
||||||
|
import com.red.circle.other.inner.enums.sys.SysBadgeConfigTypeEnum;
|
||||||
|
import com.red.circle.other.inner.model.cmd.material.GiveBadgeCmd;
|
||||||
|
import com.red.circle.other.inner.model.cmd.material.GivePropsBackpackCmd;
|
||||||
|
import com.red.circle.other.inner.model.cmd.team.TeamMemberBackQryCmd;
|
||||||
|
import com.red.circle.other.inner.model.dto.material.PropsResourcesDTO;
|
||||||
import com.red.circle.other.inner.model.dto.material.props.NobleVipAbility;
|
import com.red.circle.other.inner.model.dto.material.props.NobleVipAbility;
|
||||||
import com.red.circle.other.inner.model.dto.material.props.PropsNobleVipAbilityDTO;
|
import com.red.circle.other.inner.model.dto.material.props.PropsNobleVipAbilityDTO;
|
||||||
import com.red.circle.tool.core.collection.CollectionUtils;
|
import com.red.circle.tool.core.collection.CollectionUtils;
|
||||||
@ -73,18 +79,21 @@ import java.util.stream.Collectors;
|
|||||||
@Service
|
@Service
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class ManagerAuthServiceImpl implements ManagerAuthService {
|
public class ManagerAuthServiceImpl implements ManagerAuthService {
|
||||||
|
|
||||||
private final RoomManagerAuthsQueryExe roomManagerAuthsQueryExe;
|
private static final int MANAGER_BADGE_GIFT_DAYS = 7;
|
||||||
|
|
||||||
|
private final RoomManagerAuthsQueryExe roomManagerAuthsQueryExe;
|
||||||
private final ManagerApprovalNotPassCmdExe managerApprovalNotPassCmdExe;
|
private final ManagerApprovalNotPassCmdExe managerApprovalNotPassCmdExe;
|
||||||
private final PropsSourceRecordService propsSourceRecordService;
|
private final PropsSourceRecordService propsSourceRecordService;
|
||||||
private final AdministratorService administratorService;
|
private final AdministratorService administratorService;
|
||||||
private final PropsMaterialInfraConvertor propsMaterialInfraConvertor;
|
private final PropsMaterialInfraConvertor propsMaterialInfraConvertor;
|
||||||
private final UserProfileGateway userProfileGateway;
|
private final UserProfileGateway userProfileGateway;
|
||||||
private final UserRegionGateway userRegionGateway;
|
private final UserRegionGateway userRegionGateway;
|
||||||
private final RedisService redisService;
|
private final RedisService redisService;
|
||||||
private final PropsBackpackClient propsBackpackClient;
|
private final PropsBackpackClient propsBackpackClient;
|
||||||
private final PropsStoreGateway propsStoreGateway;
|
private final BadgeBackpackClient badgeBackpackClient;
|
||||||
|
private final PropsStoreGateway propsStoreGateway;
|
||||||
private final BusinessDevelopmentBaseInfoService businessDevelopmentBaseInfoService;
|
private final BusinessDevelopmentBaseInfoService businessDevelopmentBaseInfoService;
|
||||||
private final TeamMemberService teamMemberService;
|
private final TeamMemberService teamMemberService;
|
||||||
private final TeamProfileService teamProfileService;
|
private final TeamProfileService teamProfileService;
|
||||||
@ -92,8 +101,9 @@ public class ManagerAuthServiceImpl implements ManagerAuthService {
|
|||||||
private final PropsNobleVipGateway propsNobleVipGateway;
|
private final PropsNobleVipGateway propsNobleVipGateway;
|
||||||
private final UserProfileClient userProfileClient;
|
private final UserProfileClient userProfileClient;
|
||||||
private final OfficialNoticeClient officialNoticeClient;
|
private final OfficialNoticeClient officialNoticeClient;
|
||||||
private final AdministratorAuthService administratorAuthService;
|
private final AdministratorAuthService administratorAuthService;
|
||||||
private final PropsNobleVipClient propsNobleVipClient;
|
private final PropsNobleVipClient propsNobleVipClient;
|
||||||
|
private final BadgeConfigService badgeConfigService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public RoomManagerAuthsCO managerAuths(RoomManageCommonCmd roomManageCommonCmd) {
|
public RoomManagerAuthsCO managerAuths(RoomManageCommonCmd roomManageCommonCmd) {
|
||||||
@ -300,8 +310,18 @@ public class ManagerAuthServiceImpl implements ManagerAuthService {
|
|||||||
// UserProfile admin = userProfileGateway.getByUserId(cmd.requiredReqUserId());
|
// UserProfile admin = userProfileGateway.getByUserId(cmd.requiredReqUserId());
|
||||||
|
|
||||||
|
|
||||||
int days = PropsCommodityType.NOBLE_VIP.name().equals(propsSourceRecord.getType()) ? 3 : 7;
|
if (PropsCommodityType.BADGE.name().equals(propsSourceRecord.getType())) {
|
||||||
sendPropsRecord(cmd, propsSourceRecord.getType(), days);
|
if (!Boolean.TRUE.equals(propsSourceRecord.getAdminFree())) {
|
||||||
|
ResponseAssert.failure(CommonErrorCode.SEND_FAILURE,
|
||||||
|
"badge is not admin free.");
|
||||||
|
}
|
||||||
|
sendBadgeRecord(cmd, resolveBadgeType(propsSourceRecord.getId()),
|
||||||
|
MANAGER_BADGE_GIFT_DAYS);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int days = PropsCommodityType.NOBLE_VIP.name().equals(propsSourceRecord.getType()) ? 3 : 7;
|
||||||
|
sendPropsRecord(cmd, propsSourceRecord.getType(), days);
|
||||||
//vip单独处理
|
//vip单独处理
|
||||||
if (propsSourceRecord.getType().equals(PropsCommodityType.NOBLE_VIP.name())) {
|
if (propsSourceRecord.getType().equals(PropsCommodityType.NOBLE_VIP.name())) {
|
||||||
PropsNobleVipAbilityDTO vipAbility = propsNobleVipGateway.getAbilityDTO(propsSourceRecord.getId());
|
PropsNobleVipAbilityDTO vipAbility = propsNobleVipGateway.getAbilityDTO(propsSourceRecord.getId());
|
||||||
@ -377,11 +397,11 @@ public class ManagerAuthServiceImpl implements ManagerAuthService {
|
|||||||
userProfileClient.removeCacheAll(receiverId);
|
userProfileClient.removeCacheAll(receiverId);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sendPropsRecord(PropsGiveAwayCmd cmd, String sourceType, Integer days) {
|
private void sendPropsRecord(PropsGiveAwayCmd cmd, String sourceType, Integer days) {
|
||||||
//开始赠送道具
|
//开始赠送道具
|
||||||
log.info("admin free props start.{}", cmd);
|
log.info("admin free props start.{}", cmd);
|
||||||
// 赠送的都是7天
|
// 赠送的都是7天
|
||||||
propsBackpackClient.giveProps(new GivePropsBackpackCmd()
|
propsBackpackClient.giveProps(new GivePropsBackpackCmd()
|
||||||
.setAcceptUserId(cmd.getAcceptUserId())
|
.setAcceptUserId(cmd.getAcceptUserId())
|
||||||
.setPropsId(cmd.getPropsId())
|
.setPropsId(cmd.getPropsId())
|
||||||
.setType(sourceType)
|
.setType(sourceType)
|
||||||
@ -398,13 +418,41 @@ public class ManagerAuthServiceImpl implements ManagerAuthService {
|
|||||||
.append(cmd.getPropsId())
|
.append(cmd.getPropsId())
|
||||||
.append(" 道具 给 ").append(cmd.getAcceptUserId());
|
.append(" 道具 给 ").append(cmd.getAcceptUserId());
|
||||||
// sendTelegram(stringBuilder);
|
// sendTelegram(stringBuilder);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("赠送道具 发送机器人失败", e);
|
log.error("赠送道具 发送机器人失败", e);
|
||||||
}
|
}
|
||||||
RegionConfig region = userRegionGateway.getRegionConfigByUserId(cmd.getAcceptUserId());
|
sendGiftNotice(cmd, sourceType, days);
|
||||||
if (region == null) {
|
}
|
||||||
return;
|
|
||||||
}
|
private void sendBadgeRecord(PropsGiveAwayCmd cmd, SysBadgeConfigTypeEnum badgeType, Integer days) {
|
||||||
|
log.info("admin free badge start.{}", cmd);
|
||||||
|
badgeBackpackClient.giveBadge(new GiveBadgeCmd()
|
||||||
|
.setAcceptUserId(cmd.getAcceptUserId())
|
||||||
|
.setBadgeId(cmd.getPropsId())
|
||||||
|
.setExpireType(BadgeBackpackExpireTypeEnum.TEMPORARY)
|
||||||
|
.setDays(days)
|
||||||
|
.setBadgeType(badgeType));
|
||||||
|
sendGiftNotice(cmd, badgeType.getName(), days);
|
||||||
|
}
|
||||||
|
|
||||||
|
private SysBadgeConfigTypeEnum resolveBadgeType(Long badgeId) {
|
||||||
|
BadgeConfig badgeConfig = badgeConfigService.getById(badgeId);
|
||||||
|
if (Objects.isNull(badgeConfig) || StringUtils.isBlank(badgeConfig.getType())) {
|
||||||
|
return SysBadgeConfigTypeEnum.ACTIVITY;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
return SysBadgeConfigTypeEnum.valueOf(badgeConfig.getType());
|
||||||
|
} catch (IllegalArgumentException e) {
|
||||||
|
log.warn("unknown badge type: {}, badgeId: {}", badgeConfig.getType(), badgeId);
|
||||||
|
return SysBadgeConfigTypeEnum.ACTIVITY;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void sendGiftNotice(PropsGiveAwayCmd cmd, String sourceType, Integer days) {
|
||||||
|
RegionConfig region = userRegionGateway.getRegionConfigByUserId(cmd.getAcceptUserId());
|
||||||
|
if (region == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
String url = null;
|
String url = null;
|
||||||
PropsSourceRecord props = propsSourceRecordService.getPropsById(cmd.getPropsId());
|
PropsSourceRecord props = propsSourceRecordService.getPropsById(cmd.getPropsId());
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user