签到记录:完善 review 提到的问题
This commit is contained in:
parent
2f7371b4ea
commit
1bb2010dc0
|
@ -1,33 +0,0 @@
|
||||||
package cn.iocoder.yudao.module.member.controller.app.signin;
|
|
||||||
|
|
||||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
|
||||||
import cn.iocoder.yudao.module.member.service.signin.MemberSignInRecordService;
|
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
|
||||||
|
|
||||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
|
||||||
import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
|
|
||||||
|
|
||||||
// TODO @xiaqing:sign-in
|
|
||||||
@Tag(name = "签到APP - 签到")
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/member/signin")
|
|
||||||
public class AppMemberSignInController {
|
|
||||||
|
|
||||||
@Resource
|
|
||||||
private MemberSignInRecordService signInRecordService;
|
|
||||||
|
|
||||||
// TODO @xiaqing:泛型:
|
|
||||||
// TODO @xiaqing:合并到 AppMemberSignInRecordController 的 getSignInRecordSummary 里哈。
|
|
||||||
@Operation(summary = "个人签到信息")
|
|
||||||
@GetMapping("/get-summary")
|
|
||||||
public CommonResult getUserSummary() {
|
|
||||||
return success(signInRecordService.getSignInRecordSummary(getLoginUserId()));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -31,22 +31,11 @@ public class AppMemberSignInRecordController {
|
||||||
@Resource
|
@Resource
|
||||||
private MemberSignInRecordService signInRecordService;
|
private MemberSignInRecordService signInRecordService;
|
||||||
|
|
||||||
// TODO 芋艿:临时 mock => UserSignController.getUserInfo
|
|
||||||
@GetMapping("/get-summary")
|
@GetMapping("/get-summary")
|
||||||
@Operation(summary = "获得个人签到统计")
|
@Operation(summary = "获得个人签到统计")
|
||||||
@PreAuthenticated
|
@PreAuthenticated
|
||||||
public CommonResult<AppMemberSignInRecordSummaryRespVO> getSignInRecordSummary() {
|
public CommonResult<AppMemberSignInRecordSummaryRespVO> getSignInRecordSummary() {
|
||||||
AppMemberSignInRecordSummaryRespVO respVO = new AppMemberSignInRecordSummaryRespVO();
|
return success(signInRecordService.getSignInRecordSummary(getLoginUserId()));
|
||||||
if (false) {
|
|
||||||
respVO.setTotalDay(100);
|
|
||||||
respVO.setContinuousDay(5);
|
|
||||||
respVO.setTodaySignIn(true);
|
|
||||||
} else {
|
|
||||||
respVO.setTotalDay(100);
|
|
||||||
respVO.setContinuousDay(10);
|
|
||||||
respVO.setTodaySignIn(false);
|
|
||||||
}
|
|
||||||
return success(respVO);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/create")
|
@PostMapping("/create")
|
||||||
|
|
|
@ -1,24 +0,0 @@
|
||||||
package cn.iocoder.yudao.module.member.controller.app.signin.vo;
|
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
|
|
||||||
@Schema(description = "用户签到积分 Response VO")
|
|
||||||
@Data
|
|
||||||
public class AppMemberSignInRecordRespVO {
|
|
||||||
|
|
||||||
@Schema(description = "第几天签到", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
|
||||||
private Integer day;
|
|
||||||
|
|
||||||
@Schema(description = "签到的积分", requiredMode = Schema.RequiredMode.REQUIRED, example = "10")
|
|
||||||
private Integer point;
|
|
||||||
|
|
||||||
@Schema(description = "签到的经验", requiredMode = Schema.RequiredMode.REQUIRED, example = "10")
|
|
||||||
private Integer experience;
|
|
||||||
|
|
||||||
@Schema(description = "签到时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
|
||||||
private LocalDateTime createTime;
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,21 +0,0 @@
|
||||||
package cn.iocoder.yudao.module.member.controller.app.signin.vo;
|
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
|
|
||||||
@Schema(description = "用户签到统计信息 Response VO")
|
|
||||||
@Data
|
|
||||||
public class AppMemberSignInSummaryRespVO {
|
|
||||||
|
|
||||||
@Schema(description = "持续签到天数", requiredMode = Schema.RequiredMode.REQUIRED, example = "5")
|
|
||||||
private Integer continuousDay;
|
|
||||||
|
|
||||||
@Schema(description = "总签到天数", requiredMode = Schema.RequiredMode.REQUIRED, example = "10")
|
|
||||||
private Integer totalDay;
|
|
||||||
|
|
||||||
@Schema(description = "当天是否签到", requiredMode = Schema.RequiredMode.REQUIRED,example = "true")
|
|
||||||
private Boolean todaySignIn ;
|
|
||||||
|
|
||||||
}
|
|
|
@ -3,7 +3,7 @@ package cn.iocoder.yudao.module.member.service.signin;
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||||
import cn.iocoder.yudao.module.member.controller.admin.signin.vo.record.MemberSignInRecordPageReqVO;
|
import cn.iocoder.yudao.module.member.controller.admin.signin.vo.record.MemberSignInRecordPageReqVO;
|
||||||
import cn.iocoder.yudao.module.member.controller.app.signin.vo.AppMemberSignInSummaryRespVO;
|
import cn.iocoder.yudao.module.member.controller.app.signin.vo.record.AppMemberSignInRecordSummaryRespVO;
|
||||||
import cn.iocoder.yudao.module.member.dal.dataobject.signin.MemberSignInRecordDO;
|
import cn.iocoder.yudao.module.member.dal.dataobject.signin.MemberSignInRecordDO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -24,7 +24,7 @@ public interface MemberSignInRecordService {
|
||||||
/**
|
/**
|
||||||
* 【会员】获得签到记录分页
|
* 【会员】获得签到记录分页
|
||||||
*
|
*
|
||||||
* @param userId 用户编号
|
* @param userId 用户编号
|
||||||
* @param pageParam 分页查询
|
* @param pageParam 分页查询
|
||||||
* @return 签到记录分页
|
* @return 签到记录分页
|
||||||
*/
|
*/
|
||||||
|
@ -44,7 +44,7 @@ public interface MemberSignInRecordService {
|
||||||
* @param userId 用户编号
|
* @param userId 用户编号
|
||||||
* @return 个人签到统计信息
|
* @return 个人签到统计信息
|
||||||
*/
|
*/
|
||||||
AppMemberSignInSummaryRespVO getSignInRecordSummary(Long userId);
|
AppMemberSignInRecordSummaryRespVO getSignInRecordSummary(Long userId);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ import cn.iocoder.yudao.framework.common.util.object.ObjectUtils;
|
||||||
import cn.iocoder.yudao.module.member.api.user.MemberUserApi;
|
import cn.iocoder.yudao.module.member.api.user.MemberUserApi;
|
||||||
import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO;
|
import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO;
|
||||||
import cn.iocoder.yudao.module.member.controller.admin.signin.vo.record.MemberSignInRecordPageReqVO;
|
import cn.iocoder.yudao.module.member.controller.admin.signin.vo.record.MemberSignInRecordPageReqVO;
|
||||||
import cn.iocoder.yudao.module.member.controller.app.signin.vo.AppMemberSignInSummaryRespVO;
|
import cn.iocoder.yudao.module.member.controller.app.signin.vo.record.AppMemberSignInRecordSummaryRespVO;
|
||||||
import cn.iocoder.yudao.module.member.convert.signin.MemberSignInRecordConvert;
|
import cn.iocoder.yudao.module.member.convert.signin.MemberSignInRecordConvert;
|
||||||
import cn.iocoder.yudao.module.member.dal.dataobject.signin.MemberSignInConfigDO;
|
import cn.iocoder.yudao.module.member.dal.dataobject.signin.MemberSignInConfigDO;
|
||||||
import cn.iocoder.yudao.module.member.dal.dataobject.signin.MemberSignInRecordDO;
|
import cn.iocoder.yudao.module.member.dal.dataobject.signin.MemberSignInRecordDO;
|
||||||
|
@ -56,9 +56,9 @@ public class MemberSignInRecordServiceImpl implements MemberSignInRecordService
|
||||||
private MemberUserApi memberUserApi;
|
private MemberUserApi memberUserApi;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AppMemberSignInSummaryRespVO getSignInRecordSummary(Long userId) {
|
public AppMemberSignInRecordSummaryRespVO getSignInRecordSummary(Long userId) {
|
||||||
// 1. 初始化默认返回信息
|
// 1. 初始化默认返回信息
|
||||||
AppMemberSignInSummaryRespVO vo = new AppMemberSignInSummaryRespVO();
|
AppMemberSignInRecordSummaryRespVO vo = new AppMemberSignInRecordSummaryRespVO();
|
||||||
vo.setTotalDay(0);
|
vo.setTotalDay(0);
|
||||||
vo.setContinuousDay(0);
|
vo.setContinuousDay(0);
|
||||||
vo.setTodaySignIn(false);
|
vo.setTodaySignIn(false);
|
||||||
|
|
Loading…
Reference in New Issue