diff --git a/rc-service/rc-inner-api/external-inner/external-inner-model/src/main/java/com/red/circle/external/inner/model/enums/message/OfficialNoticeTypeEnum.java b/rc-service/rc-inner-api/external-inner/external-inner-model/src/main/java/com/red/circle/external/inner/model/enums/message/OfficialNoticeTypeEnum.java index b42da498..ff750eb8 100644 --- a/rc-service/rc-inner-api/external-inner/external-inner-model/src/main/java/com/red/circle/external/inner/model/enums/message/OfficialNoticeTypeEnum.java +++ b/rc-service/rc-inner-api/external-inner/external-inner-model/src/main/java/com/red/circle/external/inner/model/enums/message/OfficialNoticeTypeEnum.java @@ -112,6 +112,11 @@ public enum OfficialNoticeTypeEnum { */ BADGE_ACTIVATION, + /** + * CP组建. + */ + CP_BUILD, + /** * cp关系解除. */ diff --git a/rc-service/rc-service-other/other-adapter/src/main/java/com/red/circle/other/adapter/app/user/relation/CpRelationshipRestController.java b/rc-service/rc-service-other/other-adapter/src/main/java/com/red/circle/other/adapter/app/user/relation/CpRelationshipRestController.java index 1b946d9e..da5aaba1 100644 --- a/rc-service/rc-service-other/other-adapter/src/main/java/com/red/circle/other/adapter/app/user/relation/CpRelationshipRestController.java +++ b/rc-service/rc-service-other/other-adapter/src/main/java/com/red/circle/other/adapter/app/user/relation/CpRelationshipRestController.java @@ -106,7 +106,6 @@ public class CpRelationshipRestController extends BaseController { * @eo.method get * @eo.request-type formdata */ - // @RemoveUserActionCache(value = "#cmd.getCmdOriginUserId()") @GetMapping("/dismiss-apply") public void dismiss(@Validated CpApplyDismissCmd cmd) { userCpRelationService.dismissApply(cmd); diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/user/DismissCpApplyCmdExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/user/DismissCpApplyCmdExe.java index d37af6a7..60d2928c 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/user/DismissCpApplyCmdExe.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/user/DismissCpApplyCmdExe.java @@ -58,8 +58,6 @@ public class DismissCpApplyCmdExe { cpCabinAchieveService.deleteByCpValId(cpRelationship.getCpValId()); cpBlessRecordService.deleteByCpValId(cpRelationship.getCpValId()); - imMessageClient.sendMessageText(getSendApplyUserId(cmd), - String.valueOf(cpRelationship.getCpUserId()), cmd.getApplyText()); } private String getSendApplyUserId(CpApplyDismissCmd cmd) { diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/user/ProcessCpApplyCmd.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/user/ProcessCpApplyCmd.java index 944e9f54..0cb34fee 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/user/ProcessCpApplyCmd.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/user/ProcessCpApplyCmd.java @@ -74,9 +74,9 @@ public class ProcessCpApplyCmd { if (!isAgree(cmd)) { returnGoldCoins(cmd, cpApply); - imMessageClient.sendMessageText(cpApply.getAcceptApplyUserId().toString(), - cpApply.getSendApplyUserId().toString(), - cmd.getApplyText()); +// imMessageClient.sendMessageText(cpApply.getAcceptApplyUserId().toString(), +// cpApply.getSendApplyUserId().toString(), +// cmd.getApplyText()); return; } @@ -99,10 +99,10 @@ public class ProcessCpApplyCmd { // .setLimitContent(cpApply.getAcceptApplyUserId().toString()) // ); - imMessageClient - .sendMessageText(cpApply.getAcceptApplyUserId().toString(), - cpApply.getSendApplyUserId().toString(), - cmd.getApplyText()); +// imMessageClient +// .sendMessageText(cpApply.getAcceptApplyUserId().toString(), +// cpApply.getSendApplyUserId().toString(), +// cmd.getApplyText()); } private void refuseStatusWait(ProcessApplyCmd cmd, CpApply cpApply) { diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/user/ProcessUserCardApplyCmdExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/user/ProcessUserCardApplyCmdExe.java index b583d65f..836b4fd5 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/user/ProcessUserCardApplyCmdExe.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/user/ProcessUserCardApplyCmdExe.java @@ -66,7 +66,7 @@ public class ProcessUserCardApplyCmdExe { returnGoldCoins(cmd, apply); imMessageClient.sendMessageText(apply.getAcceptUserId().toString(), - apply.getSendUserId().toString(), cmd.getApplyText()); + apply.getSendUserId().toString(), "cmd.getApplyText()"); return; } @@ -80,7 +80,7 @@ public class ProcessUserCardApplyCmdExe { saveCard(apply); imMessageClient.sendMessageText(apply.getAcceptUserId().toString(), - apply.getSendUserId().toString(), cmd.getApplyText()); + apply.getSendUserId().toString(), "cmd.getApplyText()"); } private void saveCard(GiveFriendshipCardApply apply) { diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/user/SendCpApplyCmdExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/user/SendCpApplyCmdExe.java index 3a74c8d1..ce96093b 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/user/SendCpApplyCmdExe.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/user/SendCpApplyCmdExe.java @@ -4,17 +4,25 @@ import com.google.common.collect.Lists; import com.red.circle.common.business.core.enums.SysOriginPlatformEnum; import com.red.circle.component.redis.service.RedisService; import com.red.circle.external.inner.endpoint.message.ImMessageClient; +import com.red.circle.external.inner.endpoint.message.OfficialNoticeClient; +import com.red.circle.external.inner.model.cmd.message.notice.official.NoticeExtTemplateTypeCmd; +import com.red.circle.external.inner.model.enums.message.OfficialNoticeTypeEnum; import com.red.circle.framework.core.asserts.ResponseAssert; import com.red.circle.framework.core.response.CommonErrorCode; import com.red.circle.mq.business.model.event.user.CpApplyEvent; import com.red.circle.mq.rocket.business.producer.UserMqMessageService; +import com.red.circle.other.app.convertor.user.UserProfileAppConvertor; import com.red.circle.other.app.dto.cmd.user.relation.cp.CpApplyCmd; +import com.red.circle.other.app.util.OfficialNoticeUtils; +import com.red.circle.other.domain.gateway.user.UserProfileGateway; +import com.red.circle.other.domain.model.user.UserProfile; import com.red.circle.other.infra.database.cache.service.other.EnumConfigCacheService; import com.red.circle.other.infra.database.rds.entity.user.user.CpApply; import com.red.circle.other.infra.database.rds.service.user.user.CpApplyService; import com.red.circle.other.infra.database.rds.service.user.user.CpRelationshipService; import com.red.circle.other.infra.enums.user.user.CpApplyStatus; import com.red.circle.other.inner.enums.config.EnumConfigKey; +import com.red.circle.other.inner.model.dto.user.UserProfileDTO; import com.red.circle.tool.core.date.TimestampUtils; import com.red.circle.other.inner.asserts.user.UserRelationErrorCode; import com.red.circle.wallet.inner.endpoint.wallet.WalletGoldClient; @@ -37,11 +45,13 @@ public class SendCpApplyCmdExe { private final RedisService redisService; private final CpApplyService cpApplyService; - private final ImMessageClient imMessageClient; + private final OfficialNoticeClient officialNoticeClient; private final WalletGoldClient walletGoldClient; private final UserMqMessageService userMqMessageService; private final CpRelationshipService cpRelationshipService; private final EnumConfigCacheService enumConfigCacheService; + private final UserProfileGateway userProfileGateway; + private final UserProfileAppConvertor userProfileAppConvertor; public void execute(CpApplyCmd cmd) { @@ -79,18 +89,26 @@ public class SendCpApplyCmdExe { .build()) ); + UserProfileDTO userProfile = userProfileAppConvertor.toUserProfileDTO(userProfileGateway.getByUserId(cmd.requiredReqUserId())); + + String applyText = "User " + userProfile.getUserNickname() + " confessed the feeling to you; if you accept, you will become a couple."; + CpApply cpApply = new CpApply() .setSendApplyUserId(cmd.requiredReqUserId()) .setAcceptApplyUserId(cmd.getAcceptApplyUserId()) - .setApplyText(cmd.getApplyText()) + .setApplyText(applyText) .setStatus(CpApplyStatus.WAIT.name()) .setApplyConsumeGold(receipt.getOpAmount().getDollarAmount()); cpApplyService.save(cpApply); - imMessageClient.sendMessageText(cmd.getSendApplyUserIdString(), - cmd.getAcceptApplyUserIdString(), - cmd.getApplyText()); + officialNoticeClient.send(NoticeExtTemplateTypeCmd.builder() + .toAccount(cmd.getAcceptApplyUserId()) + .noticeType(OfficialNoticeTypeEnum.CP_BUILD) + .templateParam(OfficialNoticeUtils.buildUserProfile(userProfile)) + .expand(cpApply.getId()) + .build() + ); userMqMessageService.cpApplyDelayed( new CpApplyEvent() diff --git a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/user/query/UserCpRelationQryExe.java b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/user/query/UserCpRelationQryExe.java index 8c2803e9..506c52a5 100644 --- a/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/user/query/UserCpRelationQryExe.java +++ b/rc-service/rc-service-other/other-application/src/main/java/com/red/circle/other/app/command/user/query/UserCpRelationQryExe.java @@ -1,6 +1,7 @@ package com.red.circle.other.app.command.user.query; import com.red.circle.common.business.dto.cmd.UserIdCmd; +import com.red.circle.other.infra.utils.ZonedDateTimeUtils; import com.red.circle.tool.core.date.DateUtils; import com.red.circle.other.app.convertor.user.UserProfileAppConvertor; import com.red.circle.other.app.dto.clientobject.user.relation.cp.CpUserProfileCO; @@ -9,7 +10,12 @@ import com.red.circle.other.infra.database.cache.service.user.UserCpValueCacheSe import com.red.circle.other.infra.database.rds.service.user.user.CpRelationshipService; import com.red.circle.other.inner.model.dto.user.UserProfileDTO; import com.red.circle.other.inner.enums.user.UserCpLevelEnum; + +import java.time.ZoneId; import java.util.Optional; + +import com.red.circle.tool.core.date.LocalDateTimeUtils; +import com.red.circle.tool.core.date.ZonedId; import lombok.RequiredArgsConstructor; import org.springframework.stereotype.Component; @@ -32,7 +38,8 @@ public class UserCpRelationQryExe { .map(cpRelationship -> new CpUserProfileCO() .setUserProfile(getUserProfile(cpRelationship.getCpUserId())) .setDays(DateUtils.toDurationDays(cpRelationship.getCreateTime(), DateUtils.now())) - .setLevel(getLevel(cpRelationship.getUserId(), cpRelationship.getCpUserId())) + .setFirstDay(cpRelationship.getCreateTime().toInstant().atZone(ZoneId.systemDefault()).toLocalDate().toString()) +// .setLevel(getLevel(cpRelationship.getUserId(), cpRelationship.getCpUserId())) ) .orElse(null); } diff --git a/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/clientobject/user/relation/cp/CpUserProfileCO.java b/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/clientobject/user/relation/cp/CpUserProfileCO.java index d802df4b..39c415a0 100644 --- a/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/clientobject/user/relation/cp/CpUserProfileCO.java +++ b/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/clientobject/user/relation/cp/CpUserProfileCO.java @@ -32,6 +32,11 @@ public class CpUserProfileCO extends ClientObject { @JsonSerialize(using = ToStringSerializer.class) private Long days; + /** + * 开始组件的日期 + */ + private String firstDay; + /** * 用户CP等级. */ diff --git a/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/cmd/user/relation/cp/CpApplyCmd.java b/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/cmd/user/relation/cp/CpApplyCmd.java index afa606d7..ca6b2b3e 100644 --- a/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/cmd/user/relation/cp/CpApplyCmd.java +++ b/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/cmd/user/relation/cp/CpApplyCmd.java @@ -26,19 +26,6 @@ public class CpApplyCmd extends AppExtCommand { @NotNull(message = "acceptApplyUserId required.") private Long acceptApplyUserId; - /** - * 申请文案(长度1~100). - * - * @eo.required - */ - @Length(min = 1, max = 100, message = "applyText range 1~100") - @NotBlank(message = "applyText required.") - private String applyText; - - /** - * 判断是否发送im消息 true则不发送消息通知 - */ - private Boolean stopSendMsg; public String getAcceptApplyUserIdString() { return getAcceptApplyUserId().toString(); diff --git a/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/cmd/user/relation/cp/CpApplyDismissCmd.java b/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/cmd/user/relation/cp/CpApplyDismissCmd.java index 22341bbc..d26f6bc2 100644 --- a/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/cmd/user/relation/cp/CpApplyDismissCmd.java +++ b/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/cmd/user/relation/cp/CpApplyDismissCmd.java @@ -22,8 +22,8 @@ public class CpApplyDismissCmd extends AppExtCommand { * * @eo.required */ - @Length(min = 1, max = 100, message = "applyText range 1~100") - @NotBlank(message = "applyText {not.null}") - private String applyText; +// @Length(min = 1, max = 100, message = "applyText range 1~100") +// @NotBlank(message = "applyText {not.null}") +// private String applyText; } diff --git a/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/cmd/user/relation/cp/ProcessApplyCmd.java b/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/cmd/user/relation/cp/ProcessApplyCmd.java index 536ddb1e..b4f92163 100644 --- a/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/cmd/user/relation/cp/ProcessApplyCmd.java +++ b/rc-service/rc-service-other/other-client/src/main/java/com/red/circle/other/app/dto/cmd/user/relation/cp/ProcessApplyCmd.java @@ -26,15 +26,6 @@ public class ProcessApplyCmd extends AppExtCommand { @NotNull(message = "applyId required.") private Long applyId; - /** - * 申请文案(长度1~100). - * - * @eo.required - */ - @Length(min = 1, max = 100, message = "applyText range 1~100") - @NotBlank(message = "applyText required.") - private String applyText; - /** * true 同意,false 拒绝. * diff --git a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/gateway/user/UserRunProfileTransportGatewayImpl.java b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/gateway/user/UserRunProfileTransportGatewayImpl.java index f9e618f4..33386b75 100644 --- a/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/gateway/user/UserRunProfileTransportGatewayImpl.java +++ b/rc-service/rc-service-other/other-infrastructure/src/main/java/com/red/circle/other/infra/gateway/user/UserRunProfileTransportGatewayImpl.java @@ -275,18 +275,10 @@ public class UserRunProfileTransportGatewayImpl implements UserRunProfileTranspo .filter(e -> BadgeConfigTypeEnum.isHonorType(e.getType())).toList()); } - LocalDateTime createTime = newUserRunProfile.getCreateTime().toLocalDateTime(); - Duration duration = Duration.between(createTime, LocalDateTime.now()); - if (duration.toDays() < 7) { - OneTimeTask response = oneTimeTaskService.queryCompletedFirstCharge(newUserRunProfile.getId(), newUserRunProfile.getOriginSys()); - if (response == null) { - newUserRunProfile.setFirstRecharge(true); - newUserRunProfile.setFirstRechargeEndTime(ZonedDateTimeUtils.toTimestampDefault(createTime.plusDays(7))); - } + // 用户是否首充处理 + fillUserFirstRecharge(newUserRunProfile); - } - - newUserRunProfile.addUseProps(userUsePropsEntityMap.get(userBaseInfo.getId())); + newUserRunProfile.addUseProps(userUsePropsEntityMap.get(userBaseInfo.getId())); newUserRunProfile.addUseProps(userUseRoomTheme.get(userBaseInfo.getId())); newUserRunProfile.setOwnSpecialId(userSpecialIdMap.get(userBaseInfo.getId())); return newUserRunProfile; @@ -307,6 +299,19 @@ public class UserRunProfileTransportGatewayImpl implements UserRunProfileTranspo return userRunProfiles; } + private void fillUserFirstRecharge(UserRunProfile newUserRunProfile) { + LocalDateTime createTime = newUserRunProfile.getCreateTime().toLocalDateTime(); + Duration duration = Duration.between(createTime, LocalDateTime.now()); + if (duration.toDays() < 7) { + OneTimeTask response = oneTimeTaskService.queryCompletedFirstCharge(newUserRunProfile.getId(), newUserRunProfile.getOriginSys()); + if (response == null) { + newUserRunProfile.setFirstRecharge(true); + newUserRunProfile.setFirstRechargeEndTime(ZonedDateTimeUtils.toTimestampDefault(createTime.plusDays(7))); + } + + } + } + private Map> mapUserUseBadgeEntity(String sysOrigin, Set userIds) { return Optional.ofNullable(this.listUserUseBadgeEntity(sysOrigin, userIds))