申请靓号功能完善
This commit is contained in:
parent
ef7fe36a42
commit
a581d569f1
@ -242,6 +242,11 @@ public enum OfficialNoticeTypeEnum {
|
||||
*/
|
||||
REFUSE_ADMIN_INVITE_RECHARGE_AGENT,
|
||||
|
||||
/**
|
||||
* 用户靓号审核结果
|
||||
*/
|
||||
USER_SPECIAL_AUDIT_RESULTS,
|
||||
|
||||
;
|
||||
|
||||
|
||||
|
||||
@ -28,7 +28,8 @@ public interface UserBeautifulNumberApplyClientApi {
|
||||
|
||||
@GetMapping("/handleApply")
|
||||
ResultResponse<Void> handleApply(@RequestParam("id") Long id,
|
||||
@RequestParam("state") Integer state);
|
||||
@RequestParam("state") Integer state,
|
||||
@RequestParam(value = "remark", required = false) String remark);
|
||||
|
||||
/**
|
||||
* 修改靓号池信息
|
||||
|
||||
@ -7,10 +7,7 @@ import com.red.circle.framework.dto.PageResult;
|
||||
import com.red.circle.framework.web.controller.BaseController;
|
||||
import com.red.circle.other.inner.model.cmd.user.UserBeautifulNumberApplyQryCmd;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@ -41,9 +38,10 @@ public class UserBeautifulNumberApplyRestController extends BaseController {
|
||||
*/
|
||||
@GetMapping("/handle/{id}/{state}")
|
||||
public void handleApply(
|
||||
@PathVariable("id") Long id,
|
||||
@PathVariable("state") Integer state) {
|
||||
userBeautifulNumberApplyService.handleApply(id, state);
|
||||
@PathVariable("id") Long id,
|
||||
@PathVariable("state") Integer state,
|
||||
@RequestParam(value = "remark", required = false) String remark) {
|
||||
userBeautifulNumberApplyService.handleApply(id, state, remark);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -55,8 +55,8 @@ public class UserBeautifulNumberApplyServiceImpl implements
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleApply(Long id, Integer state) {
|
||||
ResponseAssert.requiredSuccess(beautifulNumberApplyClient.handleApply(id, state));
|
||||
public void handleApply(Long id, Integer state, String remark) {
|
||||
ResponseAssert.requiredSuccess(beautifulNumberApplyClient.handleApply(id, state, remark));
|
||||
}
|
||||
|
||||
private Map<Long, UserProfileDTO> getMapUser(PageResult<UserBeautifulNumberApplyCO> resultPage) {
|
||||
|
||||
@ -16,7 +16,7 @@ public interface UserBeautifulNumberApplyService {
|
||||
|
||||
PageResult<UserBeautifulNumberApplyCO> pageData(UserBeautifulNumberApplyQryCmd query);
|
||||
|
||||
void handleApply(Long id, Integer state);
|
||||
void handleApply(Long id, Integer state, String remark);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -28,7 +28,7 @@ public class UserBeautifulNumberApplyCmdExe {
|
||||
|
||||
public void execute(UserSpecialIdApplyCmd cmd) {
|
||||
String account = cmd.getAccount();
|
||||
Long userId = cmd.getUserId();
|
||||
Long userId = cmd.getReqUserId();
|
||||
|
||||
UserConsumptionLevel consumptionLevel = userProfileGateway.getUserConsumptionLevel(SysOriginPlatformEnum.LIKEI, userId);
|
||||
Integer wealthLevel = consumptionLevel.getWealthLevel();
|
||||
@ -39,10 +39,10 @@ public class UserBeautifulNumberApplyCmdExe {
|
||||
wealthLevel != null && wealthLevel >= 10
|
||||
);
|
||||
|
||||
// (2) ID格式校验:8位数字或2位数字
|
||||
// (2) ID格式校验:2-8位数字
|
||||
ResponseAssert.isTrue(
|
||||
UserSpecialErrorCode.ID_FORMAT_INVALID,
|
||||
account != null && (account.matches("^\\d{8}$") || account.matches("^\\d{2}$"))
|
||||
account != null && account.matches("^\\d{2,8}$")
|
||||
);
|
||||
|
||||
// (3) 用户在当前财富等级已申请过ID(待审核)
|
||||
|
||||
@ -37,8 +37,8 @@ public class UserBeautifulNumberClientEndpoint implements UserBeautifulNumberApp
|
||||
}
|
||||
|
||||
@Override
|
||||
public ResultResponse<Void> handleApply(Long id, Integer state) {
|
||||
userBeautifulNumberApplyClientService.handleApply(id, state);
|
||||
public ResultResponse<Void> handleApply(Long id, Integer state, String remark) {
|
||||
userBeautifulNumberApplyClientService.handleApply(id, state, remark);
|
||||
return ResultResponse.success();
|
||||
}
|
||||
|
||||
|
||||
@ -20,7 +20,7 @@ public interface UserBeautifulNumberClientService {
|
||||
PageResult<UserBeautifulNumberApplyDTO> pageBeautifulNumberApply(
|
||||
UserBeautifulNumberApplyQryCmd query);
|
||||
|
||||
void handleApply(Long id, Integer state);
|
||||
void handleApply(Long id, Integer state, String remark);
|
||||
|
||||
void updateBeautifulNumber(UserBeautifulNumberCmd cmd);
|
||||
|
||||
|
||||
@ -1,5 +1,8 @@
|
||||
package com.red.circle.other.app.inner.service.user.user.impl;
|
||||
|
||||
import com.red.circle.external.inner.endpoint.message.OfficialNoticeClient;
|
||||
import com.red.circle.external.inner.model.cmd.message.notice.official.NoticeExtTemplateCustomizeCmd;
|
||||
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.framework.dto.PageResult;
|
||||
@ -38,6 +41,7 @@ public class UserBeautifulNumberClientServiceImpl implements
|
||||
private final UserBeautifulNumberService userBeautifulNumberService;
|
||||
private final UserBeautifulNumberApplyService userBeautifulNumberApplyService;
|
||||
private final UserSpecialIdService userSpecialIdService;
|
||||
private final OfficialNoticeClient officialNoticeClient;
|
||||
|
||||
@Override
|
||||
public PageResult<UserBeautifulNumberApplyDTO> pageBeautifulNumberApply(
|
||||
@ -47,13 +51,13 @@ public class UserBeautifulNumberClientServiceImpl implements
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleApply(Long id, Integer state) {
|
||||
public void handleApply(Long id, Integer state, String remark) {
|
||||
ResponseAssert.isTrue(CommonErrorCode.TYPE_IS_NOT_IN_SCOPE, checkState(state));
|
||||
userBeautifulNumberApplyService.handleApply(id, state);
|
||||
|
||||
UserBeautifulNumberApply beautifulNumberApply = userBeautifulNumberApplyService.getById(id);
|
||||
String content;
|
||||
if (state == 1) {
|
||||
UserBeautifulNumberApply beautifulNumberApply = userBeautifulNumberApplyService.getById(id);
|
||||
|
||||
UserSpecialId userSpecialId = userSpecialIdService.getByUserId(beautifulNumberApply.getApplyUser());
|
||||
if (Objects.nonNull(userSpecialId)) {
|
||||
userSpecialIdService.remove(userSpecialId.getId());
|
||||
@ -67,8 +71,24 @@ public class UserBeautifulNumberClientServiceImpl implements
|
||||
// 设置365 * 3天后过期
|
||||
specialIdCmd.setExpiredTime(TimestampUtils.dateTimePlusDays(TimestampUtils.now(),365 * 3));
|
||||
userSpecialIdService.add(specialIdCmd);
|
||||
|
||||
|
||||
content = String.format("Your application for exclusive lD 【%s】has been approved and has been applied to both you user lD and room lD.",
|
||||
beautifulNumberApply.getApplyAccount());
|
||||
} else {
|
||||
content = String.format("Your application for exclusive lD 【%s】wasn't approved for reason 【%s】",
|
||||
beautifulNumberApply.getApplyAccount(),
|
||||
remark);
|
||||
}
|
||||
|
||||
officialNoticeClient.send(
|
||||
NoticeExtTemplateCustomizeCmd.builder()
|
||||
.toAccount(beautifulNumberApply.getApplyUser())
|
||||
.noticeType(OfficialNoticeTypeEnum.USER_SPECIAL_AUDIT_RESULTS)
|
||||
.content(content)
|
||||
.build()
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
private boolean checkState(Integer state) {
|
||||
|
||||
@ -1,4 +1,6 @@
|
||||
import com.red.circle.framework.core.asserts.ResponseAssert;
|
||||
import com.red.circle.other.infra.database.mongo.service.team.TeamBillCycleUtils;
|
||||
import com.red.circle.other.inner.asserts.user.UserSpecialErrorCode;
|
||||
import com.red.circle.tool.core.date.ZonedDateTimeAsiaRiyadhUtils;
|
||||
import com.red.circle.tool.crypto.SecurityUtils;
|
||||
import org.junit.Test;
|
||||
@ -14,7 +16,10 @@ public class ApiTest {
|
||||
|
||||
@Test
|
||||
public void testPassword() {
|
||||
System.out.println(new BCryptPasswordEncoder().encode("123456"));
|
||||
String account = "445566";
|
||||
System.out.println(account.matches("^\\d{8}$"));
|
||||
System.out.println(account.matches("^\\d{2}$"));
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user