结算记录

This commit is contained in:
2025-05-10 20:39:38 +08:00
parent b4c47cfd38
commit cc55491cd6
10 changed files with 623 additions and 0 deletions

View File

@ -0,0 +1,148 @@
package com.greenorange.promotion.controller.promoCodeApply;
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.promoCodeApply.PromoCodeApplyAddRequest;
import com.greenorange.promotion.model.dto.promoCodeApply.PromoCodeApplyQueryRequest;
import com.greenorange.promotion.model.dto.promoCodeApply.PromoCodeApplyUpdateRequest;
import com.greenorange.promotion.model.entity.PromoCodeApply;
import com.greenorange.promotion.model.vo.promoCodeApply.PromoCodeApplyVO;
import com.greenorange.promotion.service.common.CommonService;
import com.greenorange.promotion.service.project.PromoCodeApplyService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
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("promoCodeApply")
@Slf4j
@Tag(name = "推广码申请记录管理")
public class PromoCodeApplyController {
@Resource
private PromoCodeApplyService promoCodeApplyService;
@Resource
private CommonService commonService;
/**
* web端管理员添加推广码申请记录
* @param promoCodeApplyAddRequest 推广码申请记录添加请求体
* @return 是否添加成功
*/
@PostMapping("add")
@Operation(summary = "web端管理员添加推广码申请记录", description = "参数推广码申请记录添加请求体权限管理员方法名addPromoCodeApply")
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
@SysLog(title = "推广码申请记录管理", content = "web端管理员添加推广码申请记录")
public BaseResponse<Boolean> addPromoCodeApply(@Valid @RequestBody PromoCodeApplyAddRequest promoCodeApplyAddRequest) {
PromoCodeApply promoCodeApply = commonService.copyProperties(promoCodeApplyAddRequest, PromoCodeApply.class);
promoCodeApplyService.save(promoCodeApply);
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删除推广码申请记录
* @param commonRequest 推广码申请记录删除请求体
* @return 是否删除成功
*/
@PostMapping("delete")
@Operation(summary = "web端管理员根据id删除推广码申请记录", description = "参数推广码申请记录删除请求体权限管理员方法名delPromoCodeApply")
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
@SysLog(title = "推广码申请记录管理", content = "web端管理员根据id删除推广码申请记录")
public BaseResponse<Boolean> delPromoCodeApply(@Valid @RequestBody CommonRequest commonRequest) {
Long id = commonRequest.getId();
promoCodeApplyService.removeById(id);
return ResultUtils.success(true);
}
/**
* 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);
// }
}