release: 2.6.获取用户邀请记录(APP)

release-2024-04-25
huangyw 4 months ago
parent e3db72504d
commit 14528c51b4

@ -240,6 +240,17 @@ public class PointController {
return Result.success();
}
@ApiOperation(value = "2.6.获取用户邀请记录(APP)")
@GetMapping("/log/invitation")
@GlobalInterceptor(checkAppUserLogin = true)
@ApiImplicitParams({
@ApiImplicitParam(name = "Authorization", value = "token", required = true, dataType = "String", paramType = "header")
})
public Result<UserInvitationLogVO> getUserInvitationLog(
@RequestHeader(value = "Authorization", required = true) String authorization) {
return Result.success(userPointLogService.getUserInvitationLog(authorization));
}
@ApiOperation(value = "3.1.添加抽奖(PC)", notes = "仅限admin权限用户调用")
@PostMapping("/lottery/add")

@ -23,4 +23,6 @@ public interface UserPointLogDao extends JpaRepository<UserPointLog, String>, Jp
public List<UserPointLog> findDaysByUserIdAndTaskPointId(String userId, String pointId, Integer days);
public List<UserPointLog> findUserPointLogsByUserIdAndTaskPointId(String userId, String taskPointId);
public List<UserPointLog> findUserPointLogByTaskPointIdInAndUserId(List<String> taskPointIds, String userId);
}

@ -9,6 +9,7 @@ import com.luoo.user.dao.UserPointLogDao;
import com.luoo.user.dto.point.DrawDTO;
import com.luoo.user.dto.point.UserPointLogSearchDto;
import com.luoo.user.pojo.*;
import com.luoo.user.vo.point.UserInvitationLogVO;
import com.luoo.user.vo.point.UserPointLogVO;
import com.querydsl.core.BooleanBuilder;
import com.querydsl.core.types.Projections;
@ -23,6 +24,7 @@ import enums.PointEnums;
import java.io.IOException;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
@ -124,7 +126,6 @@ public class UserPointLogService {
/**
* 使userId
*
*/
public void addByTaskDailyAndUserId(String taskPointId, String userId) {
UserPointLog userPointLog = UserPointLog.builder()
@ -301,6 +302,27 @@ public class UserPointLogService {
addByTaskDaily(TaskPointIdConstants.SHARE_JOURNAL, token);
}
public UserInvitationLogVO getUserInvitationLog(String token) {
UserLoginDto userLoginDto = jwtUtil.getUser();
String userId = userLoginDto.getUserId();
List<String> taskPointIds = new ArrayList<>();
taskPointIds.add(TaskPointIdConstants.NEW_USER_INVITE);
taskPointIds.add(TaskPointIdConstants.INVITE_USER_3);
taskPointIds.add(TaskPointIdConstants.INVITE_USER_6);
taskPointIds.add(TaskPointIdConstants.INVITE_USER_10);
taskPointIds.add(TaskPointIdConstants.INVITE_USER_20);
List<UserPointLog> userPointLogByTaskPointIdInAndUserId = userPointLogDao.findUserPointLogByTaskPointIdInAndUserId(taskPointIds, userId);
UserInvitationLogVO userInvitationLogVO = new UserInvitationLogVO();
userInvitationLogVO.setNum(userPointLogByTaskPointIdInAndUserId.isEmpty() ? 0 : userPointLogByTaskPointIdInAndUserId.size());
userInvitationLogVO.setPoint(userPointLogByTaskPointIdInAndUserId.isEmpty() ? 0 :
userPointLogByTaskPointIdInAndUserId.stream().map(UserPointLog::getScore).reduce(0, Integer::sum)
);
return userInvitationLogVO;
}
/**
*
*

@ -0,0 +1,22 @@
package com.luoo.user.vo.point;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
/**
* @program: luoo_parent
* @description:
* @author: yawei.huang
* @create: 2024-09-23 08:14
**/
@Data
public class UserInvitationLogVO implements Serializable {
@ApiModelProperty(value = "邀请人数")
private Integer num;
@ApiModelProperty(value = "已获取的分数")
private Integer point;
}
Loading…
Cancel
Save