签到记录:完善 review 提到的问题

This commit is contained in:
puhui999 2023-10-21 01:11:10 +08:00
parent 2f7371b4ea
commit 1bb2010dc0
6 changed files with 7 additions and 96 deletions

View File

@ -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 @xiaqingsign-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()));
}
}

View File

@ -31,22 +31,11 @@ public class AppMemberSignInRecordController {
@Resource
private MemberSignInRecordService signInRecordService;
// TODO 芋艿临时 mock => UserSignController.getUserInfo
@GetMapping("/get-summary")
@Operation(summary = "获得个人签到统计")
@PreAuthenticated
public CommonResult<AppMemberSignInRecordSummaryRespVO> getSignInRecordSummary() {
AppMemberSignInRecordSummaryRespVO respVO = new AppMemberSignInRecordSummaryRespVO();
if (false) {
respVO.setTotalDay(100);
respVO.setContinuousDay(5);
respVO.setTodaySignIn(true);
} else {
respVO.setTotalDay(100);
respVO.setContinuousDay(10);
respVO.setTodaySignIn(false);
}
return success(respVO);
return success(signInRecordService.getSignInRecordSummary(getLoginUserId()));
}
@PostMapping("/create")

View File

@ -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;
}

View File

@ -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 ;
}

View File

@ -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.PageResult;
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;
/**
@ -24,7 +24,7 @@ public interface MemberSignInRecordService {
/**
* 会员获得签到记录分页
*
* @param userId 用户编号
* @param userId 用户编号
* @param pageParam 分页查询
* @return 签到记录分页
*/
@ -44,7 +44,7 @@ public interface MemberSignInRecordService {
* @param userId 用户编号
* @return 个人签到统计信息
*/
AppMemberSignInSummaryRespVO getSignInRecordSummary(Long userId);
AppMemberSignInRecordSummaryRespVO getSignInRecordSummary(Long userId);
}

View File

@ -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.dto.MemberUserRespDTO;
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.dal.dataobject.signin.MemberSignInConfigDO;
import cn.iocoder.yudao.module.member.dal.dataobject.signin.MemberSignInRecordDO;
@ -56,9 +56,9 @@ public class MemberSignInRecordServiceImpl implements MemberSignInRecordService
private MemberUserApi memberUserApi;
@Override
public AppMemberSignInSummaryRespVO getSignInRecordSummary(Long userId) {
public AppMemberSignInRecordSummaryRespVO getSignInRecordSummary(Long userId) {
// 1. 初始化默认返回信息
AppMemberSignInSummaryRespVO vo = new AppMemberSignInSummaryRespVO();
AppMemberSignInRecordSummaryRespVO vo = new AppMemberSignInRecordSummaryRespVO();
vo.setTotalDay(0);
vo.setContinuousDay(0);
vo.setTodaySignIn(false);