已完成小程序端的项目查询
This commit is contained in:
parent
d54e517f7f
commit
138dfb39ff
|
@ -22,11 +22,13 @@ import com.greenorange.promotion.model.vo.project.ProjectDetailVO;
|
||||||
import com.greenorange.promotion.model.vo.project.ProjectPageVO;
|
import com.greenorange.promotion.model.vo.project.ProjectPageVO;
|
||||||
import com.greenorange.promotion.model.vo.project.ProjectVO;
|
import com.greenorange.promotion.model.vo.project.ProjectVO;
|
||||||
import com.greenorange.promotion.model.vo.projectNotification.ProjectNotificationVO;
|
import com.greenorange.promotion.model.vo.projectNotification.ProjectNotificationVO;
|
||||||
|
import com.greenorange.promotion.model.vo.userProject.UserProjectVO;
|
||||||
import com.greenorange.promotion.service.common.CommonService;
|
import com.greenorange.promotion.service.common.CommonService;
|
||||||
import com.greenorange.promotion.service.project.*;
|
import com.greenorange.promotion.service.project.*;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
@ -67,6 +69,10 @@ public class ProjectController {
|
||||||
@Resource
|
@Resource
|
||||||
private SubUserProjectCommissionService subUserProjectCommissionService;
|
private SubUserProjectCommissionService subUserProjectCommissionService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private UserProjectService userProjectService;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 小程序用户查看项目列表
|
* 小程序用户查看项目列表
|
||||||
|
@ -110,23 +116,23 @@ public class ProjectController {
|
||||||
return ResultUtils.success(projectDetailVO);
|
return ResultUtils.success(projectDetailVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
// /**
|
|
||||||
// * 小程序用户申请推广码
|
/**
|
||||||
// * @param promoCodeApplyRequest 推广码申请请求体
|
* 小程序用户查看正在推广的项目
|
||||||
// * @return 项目详情
|
* @return 推广的项目列表
|
||||||
// */
|
*/
|
||||||
// @PostMapping("query/id")
|
@PostMapping("get/running")
|
||||||
// @Operation(summary = "小程序用户申请推广码", description = "参数:无,权限:管理员,方法名:applyPromoCode")
|
@Operation(summary = "小程序用户查看项目列表", description = "参数:无,权限:管理员,方法名:queryUserProjectList")
|
||||||
// @RequiresPermission(mustRole = UserConstant.DEFAULT_ROLE)
|
@RequiresPermission(mustRole = UserConstant.DEFAULT_ROLE)
|
||||||
// @SysLog(title = "项目管理", content = "小程序用户申请推广码")
|
@SysLog(title = "项目管理", content = "小程序用户查看项目列表")
|
||||||
// public BaseResponse<ProjectDetailVO> applyPromoCode(@Valid @RequestBody PromoCodeApplyRequest promoCodeApplyRequest) {
|
public BaseResponse<List<UserProjectVO>> queryUserProjectList(HttpServletRequest request) {
|
||||||
// // 取出当前项目的推广码
|
Long userId = (Long) request.getAttribute("userId");
|
||||||
// Long projectId = promoCodeApplyRequest.getProjectId();
|
LambdaQueryWrapper<UserProject> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
// LambdaQueryWrapper<PromoCode> promoCodeLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
lambdaQueryWrapper.eq(UserProject::getUserId, userId);
|
||||||
// promoCodeLambdaQueryWrapper.eq(PromoCode::getProjectId, projectId);
|
List<UserProject> userProjectList = userProjectService.list(lambdaQueryWrapper);
|
||||||
// List<PromoCode> promoCodeList = promoCodeService.list(promoCodeLambdaQueryWrapper);
|
List<UserProjectVO> userProjectVOS = commonService.convertList(userProjectList, UserProjectVO.class);
|
||||||
// return ResultUtils.success(projectDetailVO);
|
return ResultUtils.success(userProjectVOS);
|
||||||
// }
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -157,6 +163,16 @@ public class ProjectController {
|
||||||
public BaseResponse<Boolean> updateProject(@Valid @RequestBody ProjectUpdateRequest projectUpdateRequest) {
|
public BaseResponse<Boolean> updateProject(@Valid @RequestBody ProjectUpdateRequest projectUpdateRequest) {
|
||||||
Project project = commonService.copyProperties(projectUpdateRequest, Project.class);
|
Project project = commonService.copyProperties(projectUpdateRequest, Project.class);
|
||||||
projectService.updateById(project);
|
projectService.updateById(project);
|
||||||
|
// 批量修改用户项目记录
|
||||||
|
LambdaQueryWrapper<UserProject> userProjectLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
userProjectLambdaQueryWrapper.eq(UserProject::getProjectId, project.getId());
|
||||||
|
List<UserProject> userProjectList = userProjectService.list(userProjectLambdaQueryWrapper);
|
||||||
|
for (UserProject userProject : userProjectList) {
|
||||||
|
userProject.setProjectName(project.getProjectName());
|
||||||
|
userProject.setProjectImage(project.getProjectImage());
|
||||||
|
userProject.setProjectSettlementCycle(project.getProjectSettlementCycle());
|
||||||
|
}
|
||||||
|
userProjectService.updateBatchById(userProjectList);
|
||||||
return ResultUtils.success(true);
|
return ResultUtils.success(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -187,6 +203,9 @@ public class ProjectController {
|
||||||
LambdaQueryWrapper<SubUserProjectCommission> subUserProjectCommissionLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<SubUserProjectCommission> subUserProjectCommissionLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
subUserProjectCommissionLambdaQueryWrapper.eq(SubUserProjectCommission::getProjectId, id);
|
subUserProjectCommissionLambdaQueryWrapper.eq(SubUserProjectCommission::getProjectId, id);
|
||||||
subUserProjectCommissionService.remove(subUserProjectCommissionLambdaQueryWrapper);
|
subUserProjectCommissionService.remove(subUserProjectCommissionLambdaQueryWrapper);
|
||||||
|
LambdaQueryWrapper<UserProject> userProjectLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
userProjectLambdaQueryWrapper.eq(UserProject::getProjectId, id);
|
||||||
|
userProjectService.remove(userProjectLambdaQueryWrapper);
|
||||||
return ResultUtils.success(true);
|
return ResultUtils.success(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package com.greenorange.promotion.controller.project;
|
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.query.QueryWrapper;
|
||||||
import com.greenorange.promotion.annotation.RequiresPermission;
|
import com.greenorange.promotion.annotation.RequiresPermission;
|
||||||
import com.greenorange.promotion.annotation.SysLog;
|
import com.greenorange.promotion.annotation.SysLog;
|
||||||
|
@ -11,14 +12,22 @@ import com.greenorange.promotion.exception.ThrowUtils;
|
||||||
import com.greenorange.promotion.model.dto.CommonBatchRequest;
|
import com.greenorange.promotion.model.dto.CommonBatchRequest;
|
||||||
import com.greenorange.promotion.model.dto.promoCodeApply.PromoCodeApplyAddRequest;
|
import com.greenorange.promotion.model.dto.promoCodeApply.PromoCodeApplyAddRequest;
|
||||||
import com.greenorange.promotion.model.dto.promoCodeApply.PromoCodeApplyQueryRequest;
|
import com.greenorange.promotion.model.dto.promoCodeApply.PromoCodeApplyQueryRequest;
|
||||||
|
import com.greenorange.promotion.model.dto.promoCodeApply.PromoCodeApplyRequest;
|
||||||
import com.greenorange.promotion.model.dto.promoCodeApply.PromoCodeApplyUpdateRequest;
|
import com.greenorange.promotion.model.dto.promoCodeApply.PromoCodeApplyUpdateRequest;
|
||||||
|
import com.greenorange.promotion.model.entity.Project;
|
||||||
|
import com.greenorange.promotion.model.entity.PromoCode;
|
||||||
import com.greenorange.promotion.model.entity.PromoCodeApply;
|
import com.greenorange.promotion.model.entity.PromoCodeApply;
|
||||||
|
import com.greenorange.promotion.model.entity.UserProject;
|
||||||
import com.greenorange.promotion.model.vo.promoCodeApply.PromoCodeApplyVO;
|
import com.greenorange.promotion.model.vo.promoCodeApply.PromoCodeApplyVO;
|
||||||
import com.greenorange.promotion.service.common.CommonService;
|
import com.greenorange.promotion.service.common.CommonService;
|
||||||
|
import com.greenorange.promotion.service.project.ProjectService;
|
||||||
import com.greenorange.promotion.service.project.PromoCodeApplyService;
|
import com.greenorange.promotion.service.project.PromoCodeApplyService;
|
||||||
|
import com.greenorange.promotion.service.project.PromoCodeService;
|
||||||
|
import com.greenorange.promotion.service.project.UserProjectService;
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
|
import jakarta.servlet.http.HttpServletRequest;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
@ -46,103 +55,97 @@ public class PromoCodeApplyController {
|
||||||
@Resource
|
@Resource
|
||||||
private CommonService commonService;
|
private CommonService commonService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private PromoCodeService promoCodeService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private UserProjectService userProjectService;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ProjectService projectService;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* web端管理员添加推广码申请记录
|
* 小程序用户申请推广码
|
||||||
* @param promoCodeApplyAddRequest 推广码申请记录添加请求体
|
* @param promoCodeApplyRequest 推广码申请请求体
|
||||||
* @return 是否添加成功
|
* @return 项目详情
|
||||||
*/
|
*/
|
||||||
@PostMapping("add")
|
@PostMapping("apply")
|
||||||
@Operation(summary = "web端管理员添加推广码申请记录", description = "参数:推广码申请记录添加请求体,权限:管理员,方法名:addPromoCodeApply")
|
@Operation(summary = "小程序用户申请推广码", description = "参数:无,权限:管理员,方法名:applyPromoCode")
|
||||||
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
@RequiresPermission(mustRole = UserConstant.DEFAULT_ROLE)
|
||||||
@SysLog(title = "推广码申请记录管理", content = "web端管理员添加推广码申请记录")
|
@SysLog(title = "项目管理", content = "小程序用户申请推广码")
|
||||||
public BaseResponse<Boolean> addPromoCodeApply(@Valid @RequestBody PromoCodeApplyAddRequest promoCodeApplyAddRequest) {
|
public BaseResponse<Boolean> applyPromoCode(@Valid @RequestBody PromoCodeApplyRequest promoCodeApplyRequest, HttpServletRequest request) {
|
||||||
PromoCodeApply promoCodeApply = commonService.copyProperties(promoCodeApplyAddRequest, PromoCodeApply.class);
|
// 取出当前项目的推广码
|
||||||
|
Long projectId = promoCodeApplyRequest.getProjectId();
|
||||||
|
LambdaQueryWrapper<PromoCode> promoCodeLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
promoCodeLambdaQueryWrapper.eq(PromoCode::getProjectId, projectId);
|
||||||
|
promoCodeLambdaQueryWrapper.eq(PromoCode::getPromoCodeStatus, false);
|
||||||
|
List<PromoCode> promoCodeList = promoCodeService.list(promoCodeLambdaQueryWrapper);
|
||||||
|
ThrowUtils.throwIf(promoCodeList.size() == 0, ErrorCode.OPERATION_ERROR, "当前项目没有推广码");
|
||||||
|
PromoCode promoCode = promoCodeList.get(0);
|
||||||
|
promoCode.setPromoCodeStatus(true);
|
||||||
|
promoCodeService.updateById(promoCode);
|
||||||
|
// 获取推广码参数信息
|
||||||
|
String promoCodeInfoKey = promoCode.getPromoCodeInfoKey();
|
||||||
|
String promoCodeLink = promoCode.getPromoCodeLink();
|
||||||
|
// 获取项目的参数信息
|
||||||
|
Project project = projectService.getById(projectId);
|
||||||
|
String projectName = project.getProjectName();
|
||||||
|
String projectImage = project.getProjectImage();
|
||||||
|
Integer projectSettlementCycle = project.getProjectSettlementCycle();
|
||||||
|
// 获取业务员信息
|
||||||
|
String salespersonName = promoCodeApplyRequest.getSalespersonName();
|
||||||
|
String salespersonPhone = promoCodeApplyRequest.getSalespersonPhone();
|
||||||
|
// 获取用户id
|
||||||
|
Long userId = (Long) request.getAttribute("userId");
|
||||||
|
// 添加推广码申请记录
|
||||||
|
PromoCodeApply promoCodeApply = PromoCodeApply.builder()
|
||||||
|
.salespersonName(salespersonName)
|
||||||
|
.salespersonPhone(salespersonPhone)
|
||||||
|
.promoCodeInfoKey(promoCodeInfoKey)
|
||||||
|
.promoCodeLink(promoCodeLink)
|
||||||
|
.projectName(projectName)
|
||||||
|
.projectImage(projectImage)
|
||||||
|
.userId(userId)
|
||||||
|
.build();
|
||||||
promoCodeApplyService.save(promoCodeApply);
|
promoCodeApplyService.save(promoCodeApply);
|
||||||
|
|
||||||
|
// 添加用户项目记录
|
||||||
|
UserProject userProject = UserProject.builder()
|
||||||
|
.projectId(projectId)
|
||||||
|
.projectName(projectName)
|
||||||
|
.projectImage(projectImage)
|
||||||
|
.projectSettlementCycle(projectSettlementCycle)
|
||||||
|
.userId(userId)
|
||||||
|
.build();
|
||||||
|
userProjectService.save(userProject);
|
||||||
return ResultUtils.success(true);
|
return ResultUtils.success(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* web端管理员根据id修改推广码申请记录信息
|
|
||||||
* @param promoCodeApplyUpdateRequest 推广码申请记录更新请求体
|
|
||||||
* @return 是否更新成功
|
|
||||||
*/
|
|
||||||
@PostMapping("update")
|
|
||||||
@Operation(summary = "web端管理员根据id修改推广码申请记录", description = "参数:推广码申请记录更新请求体,权限:管理员,方法名:updatePromoCodeApply")
|
|
||||||
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
|
||||||
@SysLog(title = "推广码申请记录管理", content = "web端管理员根据id修改推广码申请记录信息")
|
|
||||||
public BaseResponse<Boolean> updatePromoCodeApply(@Valid @RequestBody PromoCodeApplyUpdateRequest promoCodeApplyUpdateRequest) {
|
|
||||||
PromoCodeApply promoCodeApply = commonService.copyProperties(promoCodeApplyUpdateRequest, PromoCodeApply.class);
|
|
||||||
promoCodeApplyService.updateById(promoCodeApply);
|
|
||||||
return ResultUtils.success(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* web端管理员根据id删除推广码申请记录
|
* Web端管理员分页查询推广码申请记录
|
||||||
* @param commonRequest 推广码申请记录删除请求体
|
* @param promoCodeApplyQueryRequest 推广码申请记录查询请求体
|
||||||
* @return 是否删除成功
|
* @return 推广码申请记录列表
|
||||||
*/
|
*/
|
||||||
@PostMapping("delete")
|
@PostMapping("page")
|
||||||
@Operation(summary = "web端管理员根据id删除推广码申请记录", description = "参数:推广码申请记录删除请求体,权限:管理员,方法名:delPromoCodeApply")
|
@Operation(summary = "Web端管理员分页查询推广码申请记录", description = "参数:推广码申请记录查询请求体,权限:管理员,方法名:listPromoCodeApplyByPage")
|
||||||
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||||
@SysLog(title = "推广码申请记录管理", content = "web端管理员根据id删除推广码申请记录")
|
@SysLog(title = "推广码申请记录管理", content = "Web端管理员分页查询推广码申请记录")
|
||||||
public BaseResponse<Boolean> delPromoCodeApply(@Valid @RequestBody CommonRequest commonRequest) {
|
public BaseResponse<Page<PromoCodeApplyVO>> listPromoCodeApplyByPage(@Valid @RequestBody PromoCodeApplyQueryRequest promoCodeApplyQueryRequest) {
|
||||||
Long id = commonRequest.getId();
|
long current = promoCodeApplyQueryRequest.getCurrent();
|
||||||
promoCodeApplyService.removeById(id);
|
long pageSize = promoCodeApplyQueryRequest.getPageSize();
|
||||||
return ResultUtils.success(true);
|
QueryWrapper<PromoCodeApply> queryWrapper = promoCodeApplyService.getQueryWrapper(promoCodeApplyQueryRequest);
|
||||||
|
Page<PromoCodeApply> page = promoCodeApplyService.page(new Page<>(current, pageSize), queryWrapper);
|
||||||
|
List<PromoCodeApply> promoCodeApplyList = page.getRecords();
|
||||||
|
List<PromoCodeApplyVO> promoCodeApplyVOList = commonService.convertList(promoCodeApplyList, PromoCodeApplyVO.class);
|
||||||
|
Page<PromoCodeApplyVO> voPage = new Page<>(current, pageSize);
|
||||||
|
voPage.setRecords(promoCodeApplyVOList);
|
||||||
|
voPage.setPages(page.getPages());
|
||||||
|
voPage.setTotal(page.getTotal());
|
||||||
|
return ResultUtils.success(voPage);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* web端管理员批量删除推广码申请记录
|
|
||||||
* @param commonBatchRequest 推广码申请记录批量删除请求体
|
|
||||||
* @return 是否删除成功
|
|
||||||
*/
|
|
||||||
@PostMapping("delBatch")
|
|
||||||
@Operation(summary = "web端管理员批量删除推广码申请记录", description = "参数:推广码申请记录批量删除请求体,权限:管理员,方法名:delBatchPromoCodeApply")
|
|
||||||
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
|
||||||
@SysLog(title = "推广码申请记录管理", content = "web端管理员批量删除推广码申请记录")
|
|
||||||
public BaseResponse<Boolean> delBatchPromoCodeApply(@Valid @RequestBody CommonBatchRequest commonBatchRequest) {
|
|
||||||
List<Long> ids = commonBatchRequest.getIds();
|
|
||||||
promoCodeApplyService.removeByIds(ids);
|
|
||||||
return ResultUtils.success(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* web端管理员根据id查询推广码申请记录
|
|
||||||
* @param commonRequest 推广码申请记录查询请求体
|
|
||||||
* @return 推广码申请记录信息
|
|
||||||
*/
|
|
||||||
@PostMapping("queryById")
|
|
||||||
@Operation(summary = "web端管理员根据id查询推广码申请记录", description = "参数:推广码申请记录查询请求体,权限:管理员,方法名:queryPromoCodeApplyById")
|
|
||||||
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
|
||||||
@SysLog(title = "推广码申请记录管理", content = "web端管理员根据id查询推广码申请记录")
|
|
||||||
public BaseResponse<PromoCodeApplyVO> queryPromoCodeApplyById(@Valid @RequestBody CommonRequest commonRequest) {
|
|
||||||
Long id = commonRequest.getId();
|
|
||||||
PromoCodeApply promoCodeApply = promoCodeApplyService.getById(id);
|
|
||||||
ThrowUtils.throwIf(promoCodeApply == null, ErrorCode.OPERATION_ERROR, "当前推广码申请记录不存在");
|
|
||||||
PromoCodeApplyVO promoCodeApplyVO = commonService.copyProperties(promoCodeApply, PromoCodeApplyVO.class);
|
|
||||||
return ResultUtils.success(promoCodeApplyVO);
|
|
||||||
}
|
|
||||||
|
|
||||||
// /**
|
|
||||||
// * Web端管理员分页查询推广码申请记录
|
|
||||||
// * @param promoCodeApplyQueryRequest 推广码申请记录查询请求体
|
|
||||||
// * @return 推广码申请记录列表
|
|
||||||
// */
|
|
||||||
// @PostMapping("page")
|
|
||||||
// @Operation(summary = "Web端管理员分页查询推广码申请记录", description = "参数:推广码申请记录查询请求体,权限:管理员,方法名:listPromoCodeApplyByPage")
|
|
||||||
// @RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
|
||||||
// @SysLog(title = "推广码申请记录管理", content = "Web端管理员分页查询推广码申请记录")
|
|
||||||
// public BaseResponse<Page<PromoCodeApplyVO>> listPromoCodeApplyByPage(@Valid @RequestBody PromoCodeApplyQueryRequest promoCodeApplyQueryRequest) {
|
|
||||||
// long current = promoCodeApplyQueryRequest.getCurrent();
|
|
||||||
// long pageSize = promoCodeApplyQueryRequest.getPageSize();
|
|
||||||
// QueryWrapper<PromoCodeApply> queryWrapper = promoCodeApplyService.getQueryWrapper(promoCodeApplyQueryRequest);
|
|
||||||
// Page<PromoCodeApply> page = promoCodeApplyService.page(new Page<>(current, pageSize), queryWrapper);
|
|
||||||
// List<PromoCodeApply> promoCodeApplyList = page.getRecords();
|
|
||||||
// List<PromoCodeApplyVO> promoCodeApplyVOList = commonService.convertList(promoCodeApplyList, PromoCodeApplyVO.class);
|
|
||||||
// Page<PromoCodeApplyVO> voPage = new Page<>(current, pageSize);
|
|
||||||
// voPage.setRecords(promoCodeApplyVOList);
|
|
||||||
// voPage.setPages(page.getPages());
|
|
||||||
// voPage.setTotal(page.getTotal());
|
|
||||||
// return ResultUtils.success(voPage);
|
|
||||||
// }
|
|
||||||
}
|
}
|
|
@ -7,7 +7,11 @@ import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 推广码申请记录表
|
* 推广码申请记录表
|
||||||
|
@ -15,6 +19,9 @@ import lombok.Data;
|
||||||
*/
|
*/
|
||||||
@TableName(value ="promo_code_apply")
|
@TableName(value ="promo_code_apply")
|
||||||
@Data
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Builder
|
||||||
public class PromoCodeApply implements Serializable {
|
public class PromoCodeApply implements Serializable {
|
||||||
/**
|
/**
|
||||||
* 推广码申请ID
|
* 推广码申请ID
|
||||||
|
|
|
@ -6,7 +6,11 @@ import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用户项目表
|
* 用户项目表
|
||||||
|
@ -14,6 +18,9 @@ import lombok.Data;
|
||||||
*/
|
*/
|
||||||
@TableName(value ="user_project")
|
@TableName(value ="user_project")
|
||||||
@Data
|
@Data
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Builder
|
||||||
public class UserProject implements Serializable {
|
public class UserProject implements Serializable {
|
||||||
/**
|
/**
|
||||||
* 用户项目ID
|
* 用户项目ID
|
||||||
|
|
|
@ -44,12 +44,6 @@ public class UserProjectVO implements Serializable {
|
||||||
@Schema(description = "项目结算周期", example = "${field.example}")
|
@Schema(description = "项目结算周期", example = "${field.example}")
|
||||||
private Integer projectSettlementCycle;
|
private Integer projectSettlementCycle;
|
||||||
|
|
||||||
/**
|
|
||||||
* 用户ID
|
|
||||||
*/
|
|
||||||
@Schema(description = "用户ID", example = "${field.example}")
|
|
||||||
private Long userId;
|
|
||||||
|
|
||||||
|
|
||||||
@Serial
|
@Serial
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package com.greenorange.promotion.service.project;
|
package com.greenorange.promotion.service.project;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.greenorange.promotion.model.dto.promoCodeApply.PromoCodeApplyQueryRequest;
|
||||||
import com.greenorange.promotion.model.entity.PromoCodeApply;
|
import com.greenorange.promotion.model.entity.PromoCodeApply;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
|
@ -10,4 +12,9 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
*/
|
*/
|
||||||
public interface PromoCodeApplyService extends IService<PromoCodeApply> {
|
public interface PromoCodeApplyService extends IService<PromoCodeApply> {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取查询条件
|
||||||
|
*/
|
||||||
|
QueryWrapper<PromoCodeApply> getQueryWrapper(PromoCodeApplyQueryRequest promoCodeApplyQueryRequest);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,15 @@
|
||||||
package com.greenorange.promotion.service.project.impl;
|
package com.greenorange.promotion.service.project.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.greenorange.promotion.constant.CommonConstant;
|
||||||
|
import com.greenorange.promotion.model.dto.promoCodeApply.PromoCodeApplyQueryRequest;
|
||||||
|
import com.greenorange.promotion.model.entity.Project;
|
||||||
import com.greenorange.promotion.model.entity.PromoCodeApply;
|
import com.greenorange.promotion.model.entity.PromoCodeApply;
|
||||||
import com.greenorange.promotion.service.project.PromoCodeApplyService;
|
import com.greenorange.promotion.service.project.PromoCodeApplyService;
|
||||||
import com.greenorange.promotion.mapper.PromoCodeApplyMapper;
|
import com.greenorange.promotion.mapper.PromoCodeApplyMapper;
|
||||||
|
import com.greenorange.promotion.utils.SqlUtils;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -15,6 +21,19 @@ import org.springframework.stereotype.Service;
|
||||||
public class PromoCodeApplyServiceImpl extends ServiceImpl<PromoCodeApplyMapper, PromoCodeApply>
|
public class PromoCodeApplyServiceImpl extends ServiceImpl<PromoCodeApplyMapper, PromoCodeApply>
|
||||||
implements PromoCodeApplyService{
|
implements PromoCodeApplyService{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取查询条件
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public QueryWrapper<PromoCodeApply> getQueryWrapper(PromoCodeApplyQueryRequest promoCodeApplyQueryRequest) {
|
||||||
|
String salespersonPhone = promoCodeApplyQueryRequest.getSalespersonPhone();
|
||||||
|
String sortField = promoCodeApplyQueryRequest.getSortField();
|
||||||
|
String sortOrder = promoCodeApplyQueryRequest.getSortOrder();
|
||||||
|
QueryWrapper<PromoCodeApply> queryWrapper = new QueryWrapper<>();
|
||||||
|
queryWrapper.eq(StringUtils.isNotBlank(salespersonPhone), "salespersonPhone", salespersonPhone);
|
||||||
|
queryWrapper.orderBy(SqlUtils.validSortField(sortField), sortOrder.equals(CommonConstant.SORT_ORDER_ASC), sortField);
|
||||||
|
return queryWrapper;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user