已完成小程序端的项目查询
This commit is contained in:
@ -3,7 +3,6 @@ package com.greenorange.promotion.controller.project;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.greenorange.promotion.annotation.RequiresPermission;
|
||||
import com.greenorange.promotion.annotation.SysLog;
|
||||
@ -11,19 +10,18 @@ import com.greenorange.promotion.common.BaseResponse;
|
||||
import com.greenorange.promotion.common.ErrorCode;
|
||||
import com.greenorange.promotion.common.ResultUtils;
|
||||
import com.greenorange.promotion.constant.UserConstant;
|
||||
import com.greenorange.promotion.exception.BusinessException;
|
||||
import com.greenorange.promotion.exception.ThrowUtils;
|
||||
import com.greenorange.promotion.model.dto.CommonBatchRequest;
|
||||
import com.greenorange.promotion.model.dto.CommonRequest;
|
||||
import com.greenorange.promotion.model.dto.project.ProjectAddRequest;
|
||||
import com.greenorange.promotion.model.dto.project.ProjectQueryRequest;
|
||||
import com.greenorange.promotion.model.dto.project.ProjectStatusUpdateRequest;
|
||||
import com.greenorange.promotion.model.dto.project.ProjectUpdateRequest;
|
||||
import com.greenorange.promotion.model.dto.projectDetail.ProjectDetailAddRequest;
|
||||
import com.greenorange.promotion.model.dto.projectNotification.ProjectNotificationAddRequest;
|
||||
import com.greenorange.promotion.model.dto.promoCodeApply.PromoCodeApplyRequest;
|
||||
import com.greenorange.promotion.model.entity.*;
|
||||
import com.greenorange.promotion.model.vo.project.ProjectCardVO;
|
||||
import com.greenorange.promotion.model.vo.project.ProjectDetailVO;
|
||||
import com.greenorange.promotion.model.vo.project.ProjectPageVO;
|
||||
import com.greenorange.promotion.model.vo.project.ProjectVO;
|
||||
import com.greenorange.promotion.model.vo.projectNotification.ProjectNotificationVO;
|
||||
import com.greenorange.promotion.service.common.CommonService;
|
||||
import com.greenorange.promotion.service.project.*;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
@ -70,6 +68,68 @@ public class ProjectController {
|
||||
private SubUserProjectCommissionService subUserProjectCommissionService;
|
||||
|
||||
|
||||
/**
|
||||
* 小程序用户查看项目列表
|
||||
* @return 项目列表
|
||||
*/
|
||||
@PostMapping("query/card")
|
||||
@Operation(summary = "小程序用户查看项目列表", description = "参数:无,权限:管理员,方法名:queryProjectCardList")
|
||||
@RequiresPermission(mustRole = UserConstant.DEFAULT_ROLE)
|
||||
@SysLog(title = "项目管理", content = "小程序用户查看项目列表")
|
||||
public BaseResponse<List<ProjectCardVO>> queryProjectCardList() {
|
||||
List<Project> projectList = projectService.list();
|
||||
List<ProjectCardVO> projectCardVOS = commonService.convertList(projectList, ProjectCardVO.class);
|
||||
return ResultUtils.success(projectCardVOS);
|
||||
}
|
||||
|
||||
/**
|
||||
* 小程序用户根据id查询项目详情
|
||||
* @param commonRequest 项目id
|
||||
* @return 项目详情
|
||||
*/
|
||||
@PostMapping("query/id")
|
||||
@Operation(summary = "小程序用户根据id查询项目详情", description = "参数:无,权限:管理员,方法名:queryProjectDetailById")
|
||||
@RequiresPermission(mustRole = UserConstant.DEFAULT_ROLE)
|
||||
@SysLog(title = "项目管理", content = "小程序用户根据id查询项目详情")
|
||||
public BaseResponse<ProjectDetailVO> queryProjectDetailById(@Valid @RequestBody CommonRequest commonRequest) {
|
||||
Long id = commonRequest.getId();
|
||||
Project project = projectService.getById(id);
|
||||
ProjectDetailVO projectDetailVO = commonService.copyProperties(project, ProjectDetailVO.class);
|
||||
// 获取项目通知列表
|
||||
LambdaQueryWrapper<ProjectNotification> notificationLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
notificationLambdaQueryWrapper.eq(ProjectNotification::getProjectId, id);
|
||||
List<ProjectNotification> projectNotificationList = projectNotificationService.list(notificationLambdaQueryWrapper);
|
||||
List<ProjectNotificationVO> projectNotificationVOS = commonService.convertList(projectNotificationList, ProjectNotificationVO.class);
|
||||
// 获取项目明细列表
|
||||
LambdaQueryWrapper<ProjectDetail> projectDetailLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
projectDetailLambdaQueryWrapper.eq(ProjectDetail::getProjectId, id);
|
||||
List<ProjectDetail> projectDetailList = projectDetailService.list(projectDetailLambdaQueryWrapper);
|
||||
List<ProjectDetailVO> projectDetailVOS = commonService.convertList(projectDetailList, ProjectDetailVO.class);
|
||||
projectDetailVO.setProjectNotificationVOList(projectNotificationVOS);
|
||||
projectDetailVO.setProjectDetailVOList(projectDetailVOS);
|
||||
return ResultUtils.success(projectDetailVO);
|
||||
}
|
||||
|
||||
// /**
|
||||
// * 小程序用户申请推广码
|
||||
// * @param promoCodeApplyRequest 推广码申请请求体
|
||||
// * @return 项目详情
|
||||
// */
|
||||
// @PostMapping("query/id")
|
||||
// @Operation(summary = "小程序用户申请推广码", description = "参数:无,权限:管理员,方法名:applyPromoCode")
|
||||
// @RequiresPermission(mustRole = UserConstant.DEFAULT_ROLE)
|
||||
// @SysLog(title = "项目管理", content = "小程序用户申请推广码")
|
||||
// public BaseResponse<ProjectDetailVO> applyPromoCode(@Valid @RequestBody PromoCodeApplyRequest promoCodeApplyRequest) {
|
||||
// // 取出当前项目的推广码
|
||||
// Long projectId = promoCodeApplyRequest.getProjectId();
|
||||
// LambdaQueryWrapper<PromoCode> promoCodeLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
// promoCodeLambdaQueryWrapper.eq(PromoCode::getProjectId, projectId);
|
||||
// List<PromoCode> promoCodeList = promoCodeService.list(promoCodeLambdaQueryWrapper);
|
||||
// return ResultUtils.success(projectDetailVO);
|
||||
// }
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* web端管理员添加项目
|
||||
* @param projectAddRequest 项目添加请求体
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.greenorange.promotion.controller.projectSettlement;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.greenorange.promotion.annotation.RequiresPermission;
|
||||
import com.greenorange.promotion.annotation.SysLog;
|
||||
@ -12,13 +13,20 @@ import com.greenorange.promotion.model.dto.CommonBatchRequest;
|
||||
import com.greenorange.promotion.model.dto.withdrawalApply.WithdrawalApplyAddRequest;
|
||||
import com.greenorange.promotion.model.dto.withdrawalApply.WithdrawalApplyQueryRequest;
|
||||
import com.greenorange.promotion.model.dto.withdrawalApply.WithdrawalApplyUpdateRequest;
|
||||
import com.greenorange.promotion.model.entity.FundsChange;
|
||||
import com.greenorange.promotion.model.entity.UserInfo;
|
||||
import com.greenorange.promotion.model.entity.WithdrawalApply;
|
||||
import com.greenorange.promotion.model.vo.fundsChange.FundsChangeVO;
|
||||
import com.greenorange.promotion.model.vo.withdrawalApply.WithdrawalApplyVO;
|
||||
import com.greenorange.promotion.service.common.CommonService;
|
||||
import com.greenorange.promotion.service.settle.FundsChangeService;
|
||||
import com.greenorange.promotion.service.settle.WithdrawalApplyService;
|
||||
import com.greenorange.promotion.service.user.UserInfoService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import lombok.With;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
@ -28,6 +36,7 @@ import jakarta.validation.Valid;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@ -43,10 +52,71 @@ public class WithdrawalApplyController {
|
||||
@Resource
|
||||
private WithdrawalApplyService withdrawalApplyService;
|
||||
|
||||
@Resource
|
||||
private FundsChangeService fundsChangeService;
|
||||
|
||||
@Resource
|
||||
private CommonService commonService;
|
||||
|
||||
|
||||
/**
|
||||
* 小程序端用户申请提现
|
||||
* @param withdrawalApplyAddRequest 提现申请记录查添加请求体
|
||||
* @return 提现申请记录id
|
||||
*/
|
||||
@PostMapping("add")
|
||||
@Operation(summary = "小程序端用户申请提现", description = "参数:提现申请记录查添加请求体,权限:管理员,方法名:addWithdrawalApply")
|
||||
@RequiresPermission(mustRole = UserConstant.DEFAULT_ROLE)
|
||||
@SysLog(title = "提现申请记录管理", content = "小程序端用户申请提现")
|
||||
public BaseResponse<Long> addWithdrawalApply(@Valid @RequestBody WithdrawalApplyAddRequest withdrawalApplyAddRequest, HttpServletRequest request) {
|
||||
Long userId = (Long) request.getAttribute("userId");
|
||||
BigDecimal withdrawnAmount = withdrawalApplyAddRequest.getWithdrawnAmount();
|
||||
WithdrawalApply withdrawalApply = WithdrawalApply.builder()
|
||||
.withdrawnAmount(withdrawnAmount)
|
||||
.userId(userId)
|
||||
.build();
|
||||
withdrawalApplyService.save(withdrawalApply);
|
||||
return ResultUtils.success(withdrawalApply.getId());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 小程序端用户查询提现申请记录
|
||||
* @return 提现申请记录列表
|
||||
*/
|
||||
@PostMapping("query")
|
||||
@Operation(summary = "小程序端用户查询提现申请记录", description = "参数:无,权限:管理员,方法名:queryWithdrawalApplyByUserId")
|
||||
@RequiresPermission(mustRole = UserConstant.DEFAULT_ROLE)
|
||||
@SysLog(title = "提现申请记录管理", content = "小程序端用户查询提现申请记录")
|
||||
public BaseResponse<List<WithdrawalApplyVO>> queryWithdrawalApplyByUserId(HttpServletRequest request) {
|
||||
Long userId = (Long) request.getAttribute("userId");
|
||||
LambdaQueryWrapper<WithdrawalApply> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(WithdrawalApply::getUserId, userId);
|
||||
List<WithdrawalApply> withdrawalApplyList = withdrawalApplyService.list(lambdaQueryWrapper);
|
||||
List<WithdrawalApplyVO> withdrawalApplyVOS = commonService.convertList(withdrawalApplyList, WithdrawalApplyVO.class);
|
||||
return ResultUtils.success(withdrawalApplyVOS);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 小程序端用户查询资金变动记录
|
||||
* @return 提现申请记录id
|
||||
*/
|
||||
@PostMapping("query/change")
|
||||
@Operation(summary = "小程序端用户查询资金变动记录", description = "参数:无,权限:管理员,方法名:queryFundsChangeByUserId")
|
||||
@RequiresPermission(mustRole = UserConstant.DEFAULT_ROLE)
|
||||
@SysLog(title = "提现申请记录管理", content = "小程序端用户查询资金变动记录")
|
||||
public BaseResponse<List<FundsChangeVO>> queryFundsChangeByUserId(HttpServletRequest request) {
|
||||
Long userId = (Long) request.getAttribute("userId");
|
||||
LambdaQueryWrapper<FundsChange> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(FundsChange::getUserId, userId);
|
||||
List<FundsChange> fundsChangeList = fundsChangeService.list(lambdaQueryWrapper);
|
||||
List<FundsChangeVO> fundsChangeVOS = commonService.convertList(fundsChangeList, FundsChangeVO.class);
|
||||
return ResultUtils.success(fundsChangeVOS);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Web端管理员分页查询提现申请记录
|
||||
* @param withdrawalApplyQueryRequest 提现申请记录查询请求体
|
||||
|
@ -0,0 +1,105 @@
|
||||
package com.greenorange.promotion.controller.userInfo;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.greenorange.promotion.annotation.RequiresPermission;
|
||||
import com.greenorange.promotion.annotation.SysLog;
|
||||
import com.greenorange.promotion.common.BaseResponse;
|
||||
import com.greenorange.promotion.common.ErrorCode;
|
||||
import com.greenorange.promotion.common.ResultUtils;
|
||||
import com.greenorange.promotion.constant.UserConstant;
|
||||
import com.greenorange.promotion.exception.ThrowUtils;
|
||||
import com.greenorange.promotion.model.dto.CommonBatchRequest;
|
||||
import com.greenorange.promotion.model.dto.userAccount.UserAccountAddRequest;
|
||||
import com.greenorange.promotion.model.dto.userAccount.UserAccountQueryRequest;
|
||||
import com.greenorange.promotion.model.dto.userAccount.UserAccountUpdateRequest;
|
||||
import com.greenorange.promotion.model.entity.UserAccount;
|
||||
import com.greenorange.promotion.model.vo.userAccount.UserAccountVO;
|
||||
import com.greenorange.promotion.service.common.CommonService;
|
||||
import com.greenorange.promotion.service.settle.UserAccountService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.greenorange.promotion.model.dto.CommonRequest;
|
||||
import jakarta.validation.Valid;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* 用户账户 控制器
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("userAccount")
|
||||
@Slf4j
|
||||
@Tag(name = "用户账户管理")
|
||||
public class UserAccountController {
|
||||
|
||||
@Resource
|
||||
private UserAccountService userAccountService;
|
||||
|
||||
@Resource
|
||||
private CommonService commonService;
|
||||
|
||||
/**
|
||||
* 小程序端用户添加用户账户
|
||||
* @param userAccountAddRequest 用户账户添加请求体
|
||||
* @return 是否添加成功
|
||||
*/
|
||||
@PostMapping("add")
|
||||
@Operation(summary = "小程序端用户添加用户账户", description = "参数:用户账户添加请求体,权限:管理员,方法名:addUserAccount")
|
||||
@RequiresPermission(mustRole = UserConstant.DEFAULT_ROLE)
|
||||
@SysLog(title = "用户账户管理", content = "小程序端用户添加用户账户")
|
||||
public BaseResponse<Boolean> addUserAccount(@Valid @RequestBody UserAccountAddRequest userAccountAddRequest, HttpServletRequest request) {
|
||||
Long userId = (Long) request.getAttribute("userId");
|
||||
UserAccount userAccount = commonService.copyProperties(userAccountAddRequest, UserAccount.class);
|
||||
userAccount.setUserId(userId);
|
||||
userAccountService.save(userAccount);
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 小程序端用户根据id修改用户账户信息
|
||||
* @param userAccountUpdateRequest 用户账户更新请求体
|
||||
* @return 是否更新成功
|
||||
*/
|
||||
@PostMapping("update")
|
||||
@Operation(summary = "小程序端用户根据id修改用户账户信息", description = "参数:用户账户更新请求体,权限:管理员,方法名:updateUserAccount")
|
||||
@RequiresPermission(mustRole = UserConstant.DEFAULT_ROLE)
|
||||
@SysLog(title = "用户账户管理", content = "小程序端用户根据id修改用户账户信息")
|
||||
public BaseResponse<Boolean> updateUserAccount(@Valid @RequestBody UserAccountUpdateRequest userAccountUpdateRequest, HttpServletRequest request) {
|
||||
Long userId = (Long) request.getAttribute("userId");
|
||||
UserAccount userAccount = commonService.copyProperties(userAccountUpdateRequest, UserAccount.class);
|
||||
userAccount.setUserId(userId);
|
||||
userAccountService.updateById(userAccount);
|
||||
return ResultUtils.success(true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 小程序端用户根据id查询用户账户
|
||||
* @return 用户账户信息
|
||||
*/
|
||||
@PostMapping("queryById")
|
||||
@Operation(summary = "web端管理员根据id查询用户账户", description = "参数:无,权限:管理员,方法名:queryUserAccountByUserId")
|
||||
@RequiresPermission(mustRole = UserConstant.DEFAULT_ROLE)
|
||||
@SysLog(title = "用户账户管理", content = "web端管理员根据id查询用户账户")
|
||||
public BaseResponse<UserAccountVO> queryUserAccountByUserId(HttpServletRequest request) {
|
||||
Long userId = (Long) request.getAttribute("userId");
|
||||
LambdaQueryWrapper<UserAccount> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(UserAccount::getUserId, userId);
|
||||
UserAccount userAccount = userAccountService.getOne(lambdaQueryWrapper);
|
||||
UserAccountVO userAccountVO = commonService.copyProperties(userAccount, UserAccountVO.class);
|
||||
return ResultUtils.success(userAccountVO);
|
||||
}
|
||||
|
||||
|
||||
}
|
Reference in New Issue
Block a user