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