cp功能完善
This commit is contained in:
parent
e570151267
commit
6852d82604
@ -112,6 +112,11 @@ public enum OfficialNoticeTypeEnum {
|
|||||||
*/
|
*/
|
||||||
BADGE_ACTIVATION,
|
BADGE_ACTIVATION,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* CP组建.
|
||||||
|
*/
|
||||||
|
CP_BUILD,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* cp关系解除.
|
* cp关系解除.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -106,7 +106,6 @@ public class CpRelationshipRestController extends BaseController {
|
|||||||
* @eo.method get
|
* @eo.method get
|
||||||
* @eo.request-type formdata
|
* @eo.request-type formdata
|
||||||
*/
|
*/
|
||||||
// @RemoveUserActionCache(value = "#cmd.getCmdOriginUserId()")
|
|
||||||
@GetMapping("/dismiss-apply")
|
@GetMapping("/dismiss-apply")
|
||||||
public void dismiss(@Validated CpApplyDismissCmd cmd) {
|
public void dismiss(@Validated CpApplyDismissCmd cmd) {
|
||||||
userCpRelationService.dismissApply(cmd);
|
userCpRelationService.dismissApply(cmd);
|
||||||
|
|||||||
@ -58,8 +58,6 @@ public class DismissCpApplyCmdExe {
|
|||||||
cpCabinAchieveService.deleteByCpValId(cpRelationship.getCpValId());
|
cpCabinAchieveService.deleteByCpValId(cpRelationship.getCpValId());
|
||||||
cpBlessRecordService.deleteByCpValId(cpRelationship.getCpValId());
|
cpBlessRecordService.deleteByCpValId(cpRelationship.getCpValId());
|
||||||
|
|
||||||
imMessageClient.sendMessageText(getSendApplyUserId(cmd),
|
|
||||||
String.valueOf(cpRelationship.getCpUserId()), cmd.getApplyText());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getSendApplyUserId(CpApplyDismissCmd cmd) {
|
private String getSendApplyUserId(CpApplyDismissCmd cmd) {
|
||||||
|
|||||||
@ -74,9 +74,9 @@ public class ProcessCpApplyCmd {
|
|||||||
|
|
||||||
if (!isAgree(cmd)) {
|
if (!isAgree(cmd)) {
|
||||||
returnGoldCoins(cmd, cpApply);
|
returnGoldCoins(cmd, cpApply);
|
||||||
imMessageClient.sendMessageText(cpApply.getAcceptApplyUserId().toString(),
|
// imMessageClient.sendMessageText(cpApply.getAcceptApplyUserId().toString(),
|
||||||
cpApply.getSendApplyUserId().toString(),
|
// cpApply.getSendApplyUserId().toString(),
|
||||||
cmd.getApplyText());
|
// cmd.getApplyText());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -99,10 +99,10 @@ public class ProcessCpApplyCmd {
|
|||||||
// .setLimitContent(cpApply.getAcceptApplyUserId().toString())
|
// .setLimitContent(cpApply.getAcceptApplyUserId().toString())
|
||||||
// );
|
// );
|
||||||
|
|
||||||
imMessageClient
|
// imMessageClient
|
||||||
.sendMessageText(cpApply.getAcceptApplyUserId().toString(),
|
// .sendMessageText(cpApply.getAcceptApplyUserId().toString(),
|
||||||
cpApply.getSendApplyUserId().toString(),
|
// cpApply.getSendApplyUserId().toString(),
|
||||||
cmd.getApplyText());
|
// cmd.getApplyText());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void refuseStatusWait(ProcessApplyCmd cmd, CpApply cpApply) {
|
private void refuseStatusWait(ProcessApplyCmd cmd, CpApply cpApply) {
|
||||||
|
|||||||
@ -66,7 +66,7 @@ public class ProcessUserCardApplyCmdExe {
|
|||||||
returnGoldCoins(cmd, apply);
|
returnGoldCoins(cmd, apply);
|
||||||
|
|
||||||
imMessageClient.sendMessageText(apply.getAcceptUserId().toString(),
|
imMessageClient.sendMessageText(apply.getAcceptUserId().toString(),
|
||||||
apply.getSendUserId().toString(), cmd.getApplyText());
|
apply.getSendUserId().toString(), "cmd.getApplyText()");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -80,7 +80,7 @@ public class ProcessUserCardApplyCmdExe {
|
|||||||
saveCard(apply);
|
saveCard(apply);
|
||||||
|
|
||||||
imMessageClient.sendMessageText(apply.getAcceptUserId().toString(),
|
imMessageClient.sendMessageText(apply.getAcceptUserId().toString(),
|
||||||
apply.getSendUserId().toString(), cmd.getApplyText());
|
apply.getSendUserId().toString(), "cmd.getApplyText()");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void saveCard(GiveFriendshipCardApply apply) {
|
private void saveCard(GiveFriendshipCardApply apply) {
|
||||||
|
|||||||
@ -4,17 +4,25 @@ import com.google.common.collect.Lists;
|
|||||||
import com.red.circle.common.business.core.enums.SysOriginPlatformEnum;
|
import com.red.circle.common.business.core.enums.SysOriginPlatformEnum;
|
||||||
import com.red.circle.component.redis.service.RedisService;
|
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.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.asserts.ResponseAssert;
|
||||||
import com.red.circle.framework.core.response.CommonErrorCode;
|
import com.red.circle.framework.core.response.CommonErrorCode;
|
||||||
import com.red.circle.mq.business.model.event.user.CpApplyEvent;
|
import com.red.circle.mq.business.model.event.user.CpApplyEvent;
|
||||||
import com.red.circle.mq.rocket.business.producer.UserMqMessageService;
|
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.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.cache.service.other.EnumConfigCacheService;
|
||||||
import com.red.circle.other.infra.database.rds.entity.user.user.CpApply;
|
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.CpApplyService;
|
||||||
import com.red.circle.other.infra.database.rds.service.user.user.CpRelationshipService;
|
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.infra.enums.user.user.CpApplyStatus;
|
||||||
import com.red.circle.other.inner.enums.config.EnumConfigKey;
|
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.tool.core.date.TimestampUtils;
|
||||||
import com.red.circle.other.inner.asserts.user.UserRelationErrorCode;
|
import com.red.circle.other.inner.asserts.user.UserRelationErrorCode;
|
||||||
import com.red.circle.wallet.inner.endpoint.wallet.WalletGoldClient;
|
import com.red.circle.wallet.inner.endpoint.wallet.WalletGoldClient;
|
||||||
@ -37,11 +45,13 @@ public class SendCpApplyCmdExe {
|
|||||||
|
|
||||||
private final RedisService redisService;
|
private final RedisService redisService;
|
||||||
private final CpApplyService cpApplyService;
|
private final CpApplyService cpApplyService;
|
||||||
private final ImMessageClient imMessageClient;
|
private final OfficialNoticeClient officialNoticeClient;
|
||||||
private final WalletGoldClient walletGoldClient;
|
private final WalletGoldClient walletGoldClient;
|
||||||
private final UserMqMessageService userMqMessageService;
|
private final UserMqMessageService userMqMessageService;
|
||||||
private final CpRelationshipService cpRelationshipService;
|
private final CpRelationshipService cpRelationshipService;
|
||||||
private final EnumConfigCacheService enumConfigCacheService;
|
private final EnumConfigCacheService enumConfigCacheService;
|
||||||
|
private final UserProfileGateway userProfileGateway;
|
||||||
|
private final UserProfileAppConvertor userProfileAppConvertor;
|
||||||
|
|
||||||
public void execute(CpApplyCmd cmd) {
|
public void execute(CpApplyCmd cmd) {
|
||||||
|
|
||||||
@ -79,18 +89,26 @@ public class SendCpApplyCmdExe {
|
|||||||
.build())
|
.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()
|
CpApply cpApply = new CpApply()
|
||||||
.setSendApplyUserId(cmd.requiredReqUserId())
|
.setSendApplyUserId(cmd.requiredReqUserId())
|
||||||
.setAcceptApplyUserId(cmd.getAcceptApplyUserId())
|
.setAcceptApplyUserId(cmd.getAcceptApplyUserId())
|
||||||
.setApplyText(cmd.getApplyText())
|
.setApplyText(applyText)
|
||||||
.setStatus(CpApplyStatus.WAIT.name())
|
.setStatus(CpApplyStatus.WAIT.name())
|
||||||
.setApplyConsumeGold(receipt.getOpAmount().getDollarAmount());
|
.setApplyConsumeGold(receipt.getOpAmount().getDollarAmount());
|
||||||
|
|
||||||
cpApplyService.save(cpApply);
|
cpApplyService.save(cpApply);
|
||||||
|
|
||||||
imMessageClient.sendMessageText(cmd.getSendApplyUserIdString(),
|
officialNoticeClient.send(NoticeExtTemplateTypeCmd.builder()
|
||||||
cmd.getAcceptApplyUserIdString(),
|
.toAccount(cmd.getAcceptApplyUserId())
|
||||||
cmd.getApplyText());
|
.noticeType(OfficialNoticeTypeEnum.CP_BUILD)
|
||||||
|
.templateParam(OfficialNoticeUtils.buildUserProfile(userProfile))
|
||||||
|
.expand(cpApply.getId())
|
||||||
|
.build()
|
||||||
|
);
|
||||||
|
|
||||||
userMqMessageService.cpApplyDelayed(
|
userMqMessageService.cpApplyDelayed(
|
||||||
new CpApplyEvent()
|
new CpApplyEvent()
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
package com.red.circle.other.app.command.user.query;
|
package com.red.circle.other.app.command.user.query;
|
||||||
|
|
||||||
import com.red.circle.common.business.dto.cmd.UserIdCmd;
|
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.tool.core.date.DateUtils;
|
||||||
import com.red.circle.other.app.convertor.user.UserProfileAppConvertor;
|
import com.red.circle.other.app.convertor.user.UserProfileAppConvertor;
|
||||||
import com.red.circle.other.app.dto.clientobject.user.relation.cp.CpUserProfileCO;
|
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.infra.database.rds.service.user.user.CpRelationshipService;
|
||||||
import com.red.circle.other.inner.model.dto.user.UserProfileDTO;
|
import com.red.circle.other.inner.model.dto.user.UserProfileDTO;
|
||||||
import com.red.circle.other.inner.enums.user.UserCpLevelEnum;
|
import com.red.circle.other.inner.enums.user.UserCpLevelEnum;
|
||||||
|
|
||||||
|
import java.time.ZoneId;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
|
import com.red.circle.tool.core.date.LocalDateTimeUtils;
|
||||||
|
import com.red.circle.tool.core.date.ZonedId;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@ -32,7 +38,8 @@ public class UserCpRelationQryExe {
|
|||||||
.map(cpRelationship -> new CpUserProfileCO()
|
.map(cpRelationship -> new CpUserProfileCO()
|
||||||
.setUserProfile(getUserProfile(cpRelationship.getCpUserId()))
|
.setUserProfile(getUserProfile(cpRelationship.getCpUserId()))
|
||||||
.setDays(DateUtils.toDurationDays(cpRelationship.getCreateTime(), DateUtils.now()))
|
.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);
|
.orElse(null);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -32,6 +32,11 @@ public class CpUserProfileCO extends ClientObject {
|
|||||||
@JsonSerialize(using = ToStringSerializer.class)
|
@JsonSerialize(using = ToStringSerializer.class)
|
||||||
private Long days;
|
private Long days;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 开始组件的日期
|
||||||
|
*/
|
||||||
|
private String firstDay;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户CP等级.
|
* 用户CP等级.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -26,19 +26,6 @@ public class CpApplyCmd extends AppExtCommand {
|
|||||||
@NotNull(message = "acceptApplyUserId required.")
|
@NotNull(message = "acceptApplyUserId required.")
|
||||||
private Long acceptApplyUserId;
|
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() {
|
public String getAcceptApplyUserIdString() {
|
||||||
return getAcceptApplyUserId().toString();
|
return getAcceptApplyUserId().toString();
|
||||||
|
|||||||
@ -22,8 +22,8 @@ public class CpApplyDismissCmd extends AppExtCommand {
|
|||||||
*
|
*
|
||||||
* @eo.required
|
* @eo.required
|
||||||
*/
|
*/
|
||||||
@Length(min = 1, max = 100, message = "applyText range 1~100")
|
// @Length(min = 1, max = 100, message = "applyText range 1~100")
|
||||||
@NotBlank(message = "applyText {not.null}")
|
// @NotBlank(message = "applyText {not.null}")
|
||||||
private String applyText;
|
// private String applyText;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -26,15 +26,6 @@ public class ProcessApplyCmd extends AppExtCommand {
|
|||||||
@NotNull(message = "applyId required.")
|
@NotNull(message = "applyId required.")
|
||||||
private Long applyId;
|
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 拒绝.
|
* true 同意,false 拒绝.
|
||||||
*
|
*
|
||||||
|
|||||||
@ -275,18 +275,10 @@ public class UserRunProfileTransportGatewayImpl implements UserRunProfileTranspo
|
|||||||
.filter(e -> BadgeConfigTypeEnum.isHonorType(e.getType())).toList());
|
.filter(e -> BadgeConfigTypeEnum.isHonorType(e.getType())).toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
LocalDateTime createTime = newUserRunProfile.getCreateTime().toLocalDateTime();
|
// 用户是否首充处理
|
||||||
Duration duration = Duration.between(createTime, LocalDateTime.now());
|
fillUserFirstRecharge(newUserRunProfile);
|
||||||
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)));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
newUserRunProfile.addUseProps(userUsePropsEntityMap.get(userBaseInfo.getId()));
|
||||||
|
|
||||||
newUserRunProfile.addUseProps(userUsePropsEntityMap.get(userBaseInfo.getId()));
|
|
||||||
newUserRunProfile.addUseProps(userUseRoomTheme.get(userBaseInfo.getId()));
|
newUserRunProfile.addUseProps(userUseRoomTheme.get(userBaseInfo.getId()));
|
||||||
newUserRunProfile.setOwnSpecialId(userSpecialIdMap.get(userBaseInfo.getId()));
|
newUserRunProfile.setOwnSpecialId(userSpecialIdMap.get(userBaseInfo.getId()));
|
||||||
return newUserRunProfile;
|
return newUserRunProfile;
|
||||||
@ -307,6 +299,19 @@ public class UserRunProfileTransportGatewayImpl implements UserRunProfileTranspo
|
|||||||
return userRunProfiles;
|
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<Long, List<UseBadgeDTO>> mapUserUseBadgeEntity(String sysOrigin,
|
private Map<Long, List<UseBadgeDTO>> mapUserUseBadgeEntity(String sysOrigin,
|
||||||
Set<Long> userIds) {
|
Set<Long> userIds) {
|
||||||
return Optional.ofNullable(this.listUserUseBadgeEntity(sysOrigin, userIds))
|
return Optional.ofNullable(this.listUserUseBadgeEntity(sysOrigin, userIds))
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user