cp功能完善
This commit is contained in:
parent
e570151267
commit
6852d82604
@ -112,6 +112,11 @@ public enum OfficialNoticeTypeEnum {
|
||||
*/
|
||||
BADGE_ACTIVATION,
|
||||
|
||||
/**
|
||||
* CP组建.
|
||||
*/
|
||||
CP_BUILD,
|
||||
|
||||
/**
|
||||
* cp关系解除.
|
||||
*/
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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) {
|
||||
|
||||
@ -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) {
|
||||
|
||||
@ -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) {
|
||||
|
||||
@ -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()
|
||||
|
||||
@ -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);
|
||||
}
|
||||
|
||||
@ -32,6 +32,11 @@ public class CpUserProfileCO extends ClientObject {
|
||||
@JsonSerialize(using = ToStringSerializer.class)
|
||||
private Long days;
|
||||
|
||||
/**
|
||||
* 开始组件的日期
|
||||
*/
|
||||
private String firstDay;
|
||||
|
||||
/**
|
||||
* 用户CP等级.
|
||||
*/
|
||||
|
||||
@ -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();
|
||||
|
||||
@ -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;
|
||||
|
||||
}
|
||||
|
||||
@ -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 拒绝.
|
||||
*
|
||||
|
||||
@ -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<Long, List<UseBadgeDTO>> mapUserUseBadgeEntity(String sysOrigin,
|
||||
Set<Long> userIds) {
|
||||
return Optional.ofNullable(this.listUserUseBadgeEntity(sysOrigin, userIds))
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user