Merge branch 'master' of http://8.155.172.147:8099/root/sionrui
This commit is contained in:
@@ -0,0 +1,104 @@
|
||||
package cn.iocoder.yudao.module.tik.muye.aiagent;
|
||||
|
||||
import cn.iocoder.yudao.module.tik.muye.aiagent.dal.AiAgentDO;
|
||||
import cn.iocoder.yudao.module.tik.muye.aiagent.service.AiAgentService;
|
||||
import cn.iocoder.yudao.module.tik.muye.aiagent.vo.AiAgentPageReqVO;
|
||||
import cn.iocoder.yudao.module.tik.muye.aiagent.vo.AiAgentRespVO;
|
||||
import cn.iocoder.yudao.module.tik.muye.aiagent.vo.AiAgentSaveReqVO;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
|
||||
import jakarta.validation.*;
|
||||
import jakarta.servlet.http.*;
|
||||
import java.util.*;
|
||||
import java.io.IOException;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
|
||||
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
||||
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
|
||||
|
||||
@Tag(name = "管理后台 - AI智能体")
|
||||
@RestController
|
||||
@RequestMapping("/mapper/muye/ai-agent")
|
||||
@Validated
|
||||
public class AiAgentController {
|
||||
|
||||
@Resource
|
||||
private AiAgentService aiAgentService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建AI智能体")
|
||||
@PreAuthorize("@ss.hasPermission('muye:ai-agent:create')")
|
||||
public CommonResult<Long> createAiAgent(@Valid @RequestBody AiAgentSaveReqVO createReqVO) {
|
||||
return success(aiAgentService.createAiAgent(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新AI智能体")
|
||||
@PreAuthorize("@ss.hasPermission('muye:ai-agent:update')")
|
||||
public CommonResult<Boolean> updateAiAgent(@Valid @RequestBody AiAgentSaveReqVO updateReqVO) {
|
||||
aiAgentService.updateAiAgent(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除AI智能体")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('muye:ai-agent:delete')")
|
||||
public CommonResult<Boolean> deleteAiAgent(@RequestParam("id") Long id) {
|
||||
aiAgentService.deleteAiAgent(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete-list")
|
||||
@Parameter(name = "ids", description = "编号", required = true)
|
||||
@Operation(summary = "批量删除AI智能体")
|
||||
@PreAuthorize("@ss.hasPermission('muye:ai-agent:delete')")
|
||||
public CommonResult<Boolean> deleteAiAgentList(@RequestParam("ids") List<Long> ids) {
|
||||
aiAgentService.deleteAiAgentListByIds(ids);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得AI智能体")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('muye:ai-agent:query')")
|
||||
public CommonResult<AiAgentRespVO> getAiAgent(@RequestParam("id") Long id) {
|
||||
AiAgentDO aiAgent = aiAgentService.getAiAgent(id);
|
||||
return success(BeanUtils.toBean(aiAgent, AiAgentRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得AI智能体分页")
|
||||
@PreAuthorize("@ss.hasPermission('muye:ai-agent:query')")
|
||||
public CommonResult<PageResult<AiAgentRespVO>> getAiAgentPage(@Valid AiAgentPageReqVO pageReqVO) {
|
||||
PageResult<AiAgentDO> pageResult = aiAgentService.getAiAgentPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, AiAgentRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出AI智能体 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('muye:ai-agent:export')")
|
||||
@ApiAccessLog(operateType = EXPORT)
|
||||
public void exportAiAgentExcel(@Valid AiAgentPageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<AiAgentDO> list = aiAgentService.getAiAgentPage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "AI智能体.xls", "数据", AiAgentRespVO.class,
|
||||
BeanUtils.toBean(list, AiAgentRespVO.class));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
package cn.iocoder.yudao.module.tik.muye.aiagent.dal;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
|
||||
/**
|
||||
* AI智能体 DO
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@TableName("muye_ai_agent")
|
||||
@KeySequence("muye_ai_agent_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class AiAgentDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 智能体ID
|
||||
*/
|
||||
private String agentId;
|
||||
/**
|
||||
* 智能体名称
|
||||
*/
|
||||
private String agentName;
|
||||
/**
|
||||
* 图标URL
|
||||
*/
|
||||
private String icon;
|
||||
/**
|
||||
* 状态(0-禁用 1-启用)
|
||||
*/
|
||||
private Integer status;
|
||||
/**
|
||||
* 设定描述
|
||||
*/
|
||||
private String description;
|
||||
/**
|
||||
* 预置提示词
|
||||
*/
|
||||
private String systemPrompt;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
/**
|
||||
* 操作人用户编号
|
||||
*/
|
||||
private Long operatorId;
|
||||
/**
|
||||
* 操作人账号
|
||||
*/
|
||||
private String operatorName;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package cn.iocoder.yudao.module.tik.muye.aiagent.mapper;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.module.tik.muye.aiagent.dal.AiAgentDO;
|
||||
import cn.iocoder.yudao.module.tik.muye.aiagent.vo.AiAgentPageReqVO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
|
||||
/**
|
||||
* AI智能体 Mapper
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Mapper
|
||||
public interface AiAgentMapper extends BaseMapperX<AiAgentDO> {
|
||||
|
||||
default PageResult<AiAgentDO> selectPage(AiAgentPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<AiAgentDO>()
|
||||
.eqIfPresent(AiAgentDO::getAgentId, reqVO.getAgentId())
|
||||
.likeIfPresent(AiAgentDO::getAgentName, reqVO.getAgentName())
|
||||
.eqIfPresent(AiAgentDO::getIcon, reqVO.getIcon())
|
||||
.eqIfPresent(AiAgentDO::getStatus, reqVO.getStatus())
|
||||
.eqIfPresent(AiAgentDO::getDescription, reqVO.getDescription())
|
||||
.eqIfPresent(AiAgentDO::getSystemPrompt, reqVO.getSystemPrompt())
|
||||
.eqIfPresent(AiAgentDO::getRemark, reqVO.getRemark())
|
||||
.eqIfPresent(AiAgentDO::getOperatorId, reqVO.getOperatorId())
|
||||
.likeIfPresent(AiAgentDO::getOperatorName, reqVO.getOperatorName())
|
||||
.betweenIfPresent(AiAgentDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(AiAgentDO::getId));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package cn.iocoder.yudao.module.tik.muye.aiagent.service;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import cn.iocoder.yudao.module.tik.muye.aiagent.dal.AiAgentDO;
|
||||
import cn.iocoder.yudao.module.tik.muye.aiagent.vo.AiAgentPageReqVO;
|
||||
import cn.iocoder.yudao.module.tik.muye.aiagent.vo.AiAgentSaveReqVO;
|
||||
import jakarta.validation.*;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
|
||||
/**
|
||||
* AI智能体 Service 接口
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
public interface AiAgentService {
|
||||
|
||||
/**
|
||||
* 创建AI智能体
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createAiAgent(@Valid AiAgentSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新AI智能体
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateAiAgent(@Valid AiAgentSaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除AI智能体
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteAiAgent(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除AI智能体
|
||||
*
|
||||
* @param ids 编号
|
||||
*/
|
||||
void deleteAiAgentListByIds(List<Long> ids);
|
||||
|
||||
/**
|
||||
* 获得AI智能体
|
||||
*
|
||||
* @param id 编号
|
||||
* @return AI智能体
|
||||
*/
|
||||
AiAgentDO getAiAgent(Long id);
|
||||
|
||||
/**
|
||||
* 获得AI智能体分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return AI智能体分页
|
||||
*/
|
||||
PageResult<AiAgentDO> getAiAgentPage(AiAgentPageReqVO pageReqVO);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
package cn.iocoder.yudao.module.tik.muye.aiagent.service;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.exception.ErrorCode;
|
||||
import cn.iocoder.yudao.module.tik.muye.aiagent.dal.AiAgentDO;
|
||||
import cn.iocoder.yudao.module.tik.muye.aiagent.mapper.AiAgentMapper;
|
||||
import cn.iocoder.yudao.module.tik.muye.aiagent.vo.AiAgentPageReqVO;
|
||||
import cn.iocoder.yudao.module.tik.muye.aiagent.vo.AiAgentSaveReqVO;
|
||||
import org.springframework.stereotype.Service;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.util.*;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
|
||||
/**
|
||||
* AI智能体 Service 实现类
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class AiAgentServiceImpl implements AiAgentService {
|
||||
|
||||
@Resource
|
||||
private AiAgentMapper aiAgentMapper;
|
||||
|
||||
@Override
|
||||
public Long createAiAgent(AiAgentSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
AiAgentDO aiAgent = BeanUtils.toBean(createReqVO, AiAgentDO.class);
|
||||
aiAgentMapper.insert(aiAgent);
|
||||
|
||||
// 返回
|
||||
return aiAgent.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateAiAgent(AiAgentSaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateAiAgentExists(updateReqVO.getId());
|
||||
// 更新
|
||||
AiAgentDO updateObj = BeanUtils.toBean(updateReqVO, AiAgentDO.class);
|
||||
aiAgentMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteAiAgent(Long id) {
|
||||
// 校验存在
|
||||
validateAiAgentExists(id);
|
||||
// 删除
|
||||
aiAgentMapper.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteAiAgentListByIds(List<Long> ids) {
|
||||
// 删除
|
||||
aiAgentMapper.deleteByIds(ids);
|
||||
}
|
||||
|
||||
|
||||
private void validateAiAgentExists(Long id) {
|
||||
if (aiAgentMapper.selectById(id) == null) {
|
||||
throw exception(new ErrorCode(1004, "AI智能体不存在"));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public AiAgentDO getAiAgent(Long id) {
|
||||
return aiAgentMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<AiAgentDO> getAiAgentPage(AiAgentPageReqVO pageReqVO) {
|
||||
return aiAgentMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package cn.iocoder.yudao.module.tik.muye.aiagent.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - AI智能体分页 Request VO")
|
||||
@Data
|
||||
public class AiAgentPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "智能体ID", example = "24745")
|
||||
private String agentId;
|
||||
|
||||
@Schema(description = "智能体名称", example = "芋艿")
|
||||
private String agentName;
|
||||
|
||||
@Schema(description = "图标URL")
|
||||
private String icon;
|
||||
|
||||
@Schema(description = "状态(0-禁用 1-启用)", example = "1")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "设定描述", example = "你说的对")
|
||||
private String description;
|
||||
|
||||
@Schema(description = "预置提示词")
|
||||
private String systemPrompt;
|
||||
|
||||
@Schema(description = "备注", example = "你说的对")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "操作人用户编号", example = "6593")
|
||||
private Long operatorId;
|
||||
|
||||
@Schema(description = "操作人账号", example = "赵六")
|
||||
private String operatorName;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package cn.iocoder.yudao.module.tik.muye.aiagent.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
import cn.idev.excel.annotation.*;
|
||||
|
||||
@Schema(description = "管理后台 - AI智能体 Response VO")
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class AiAgentRespVO {
|
||||
|
||||
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "5900")
|
||||
@ExcelProperty("主键")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "智能体ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "24745")
|
||||
@ExcelProperty("智能体ID")
|
||||
private String agentId;
|
||||
|
||||
@Schema(description = "智能体名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋艿")
|
||||
@ExcelProperty("智能体名称")
|
||||
private String agentName;
|
||||
|
||||
@Schema(description = "图标URL", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("图标URL")
|
||||
private String icon;
|
||||
|
||||
@Schema(description = "状态(0-禁用 1-启用)", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@ExcelProperty("状态(0-禁用 1-启用)")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "设定描述", requiredMode = Schema.RequiredMode.REQUIRED, example = "你说的对")
|
||||
@ExcelProperty("设定描述")
|
||||
private String description;
|
||||
|
||||
@Schema(description = "预置提示词", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("预置提示词")
|
||||
private String systemPrompt;
|
||||
|
||||
@Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED, example = "你说的对")
|
||||
@ExcelProperty("备注")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "操作人用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "6593")
|
||||
@ExcelProperty("操作人用户编号")
|
||||
private Long operatorId;
|
||||
|
||||
@Schema(description = "操作人账号", requiredMode = Schema.RequiredMode.REQUIRED, example = "赵六")
|
||||
@ExcelProperty("操作人账号")
|
||||
private String operatorName;
|
||||
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package cn.iocoder.yudao.module.tik.muye.aiagent.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import jakarta.validation.constraints.*;
|
||||
|
||||
@Schema(description = "管理后台 - AI智能体新增/修改 Request VO")
|
||||
@Data
|
||||
public class AiAgentSaveReqVO {
|
||||
|
||||
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "5900")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "智能体ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "24745")
|
||||
@NotEmpty(message = "智能体ID不能为空")
|
||||
private String agentId;
|
||||
|
||||
@Schema(description = "智能体名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋艿")
|
||||
@NotEmpty(message = "智能体名称不能为空")
|
||||
private String agentName;
|
||||
|
||||
@Schema(description = "图标URL", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "图标URL不能为空")
|
||||
private String icon;
|
||||
|
||||
@Schema(description = "状态(0-禁用 1-启用)", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@NotNull(message = "状态(0-禁用 1-启用)不能为空")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "设定描述", requiredMode = Schema.RequiredMode.REQUIRED, example = "你说的对")
|
||||
@NotEmpty(message = "设定描述不能为空")
|
||||
private String description;
|
||||
|
||||
@Schema(description = "预置提示词", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "预置提示词不能为空")
|
||||
private String systemPrompt;
|
||||
|
||||
@Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED, example = "你说的对")
|
||||
@NotEmpty(message = "备注不能为空")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "操作人用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "6593")
|
||||
@NotNull(message = "操作人用户编号不能为空")
|
||||
private Long operatorId;
|
||||
|
||||
@Schema(description = "操作人账号", requiredMode = Schema.RequiredMode.REQUIRED, example = "赵六")
|
||||
@NotEmpty(message = "操作人账号不能为空")
|
||||
private String operatorName;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
package cn.iocoder.yudao.module.tik.muye.aiapplication;
|
||||
|
||||
import cn.iocoder.yudao.module.tik.muye.aiapplication.dal.AiApplicationDO;
|
||||
import cn.iocoder.yudao.module.tik.muye.aiapplication.service.AiApplicationService;
|
||||
import cn.iocoder.yudao.module.tik.muye.aiapplication.vo.AiApplicationPageReqVO;
|
||||
import cn.iocoder.yudao.module.tik.muye.aiapplication.vo.AiApplicationRespVO;
|
||||
import cn.iocoder.yudao.module.tik.muye.aiapplication.vo.AiApplicationSaveReqVO;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
|
||||
import jakarta.validation.constraints.*;
|
||||
import jakarta.validation.*;
|
||||
import jakarta.servlet.http.*;
|
||||
import java.util.*;
|
||||
import java.io.IOException;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
|
||||
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
||||
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
|
||||
|
||||
|
||||
@Tag(name = "管理后台 - AI应用功能")
|
||||
@RestController
|
||||
@RequestMapping("/muye/ai-application")
|
||||
@Validated
|
||||
public class AiApplicationController {
|
||||
|
||||
@Resource
|
||||
private AiApplicationService aiApplicationService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建AI应用功能")
|
||||
@PreAuthorize("@ss.hasPermission('muye:ai-application:create')")
|
||||
public CommonResult<Long> createAiApplication(@Valid @RequestBody AiApplicationSaveReqVO createReqVO) {
|
||||
return success(aiApplicationService.createAiApplication(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新AI应用功能")
|
||||
@PreAuthorize("@ss.hasPermission('muye:ai-application:update')")
|
||||
public CommonResult<Boolean> updateAiApplication(@Valid @RequestBody AiApplicationSaveReqVO updateReqVO) {
|
||||
aiApplicationService.updateAiApplication(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除AI应用功能")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('muye:ai-application:delete')")
|
||||
public CommonResult<Boolean> deleteAiApplication(@RequestParam("id") Long id) {
|
||||
aiApplicationService.deleteAiApplication(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete-list")
|
||||
@Parameter(name = "ids", description = "编号", required = true)
|
||||
@Operation(summary = "批量删除AI应用功能")
|
||||
@PreAuthorize("@ss.hasPermission('muye:ai-application:delete')")
|
||||
public CommonResult<Boolean> deleteAiApplicationList(@RequestParam("ids") List<Long> ids) {
|
||||
aiApplicationService.deleteAiApplicationListByIds(ids);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得AI应用功能")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('muye:ai-application:query')")
|
||||
public CommonResult<AiApplicationRespVO> getAiApplication(@RequestParam("id") Long id) {
|
||||
AiApplicationDO aiApplication = aiApplicationService.getAiApplication(id);
|
||||
return success(BeanUtils.toBean(aiApplication, AiApplicationRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得AI应用功能分页")
|
||||
@PreAuthorize("@ss.hasPermission('muye:ai-application:query')")
|
||||
public CommonResult<PageResult<AiApplicationRespVO>> getAiApplicationPage(@Valid AiApplicationPageReqVO pageReqVO) {
|
||||
PageResult<AiApplicationDO> pageResult = aiApplicationService.getAiApplicationPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, AiApplicationRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出AI应用功能 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('muye:ai-application:export')")
|
||||
@ApiAccessLog(operateType = EXPORT)
|
||||
public void exportAiApplicationExcel(@Valid AiApplicationPageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<AiApplicationDO> list = aiApplicationService.getAiApplicationPage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "AI应用功能.xls", "数据", AiApplicationRespVO.class,
|
||||
BeanUtils.toBean(list, AiApplicationRespVO.class));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package cn.iocoder.yudao.module.tik.muye.aiapplication.dal;
|
||||
|
||||
import lombok.*;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
|
||||
/**
|
||||
* AI应用功能 DO
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@TableName("muye_ai_application")
|
||||
@KeySequence("muye_ai_application_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class AiApplicationDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 应用ID
|
||||
*/
|
||||
private String appId;
|
||||
/**
|
||||
* 应用名称
|
||||
*/
|
||||
private String appName;
|
||||
/**
|
||||
* 第三方API秘钥
|
||||
*/
|
||||
private String apiKey;
|
||||
/**
|
||||
* 单位消耗积分
|
||||
*/
|
||||
private Integer consumePoints;
|
||||
/**
|
||||
* 消耗单位(time-时长 count-次数)
|
||||
*/
|
||||
private String unitType;
|
||||
/**
|
||||
* 单位值(如:1min、20次)
|
||||
*/
|
||||
private String unitValue;
|
||||
/**
|
||||
* 状态(0-禁用 1-启用)
|
||||
*/
|
||||
private Integer status;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package cn.iocoder.yudao.module.tik.muye.aiapplication.mapper;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.module.tik.muye.aiapplication.dal.AiApplicationDO;
|
||||
import cn.iocoder.yudao.module.tik.muye.aiapplication.vo.AiApplicationPageReqVO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
|
||||
/**
|
||||
* AI应用功能 Mapper
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Mapper
|
||||
public interface AiApplicationMapper extends BaseMapperX<AiApplicationDO> {
|
||||
|
||||
default PageResult<AiApplicationDO> selectPage(AiApplicationPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<AiApplicationDO>()
|
||||
.eqIfPresent(AiApplicationDO::getAppId, reqVO.getAppId())
|
||||
.likeIfPresent(AiApplicationDO::getAppName, reqVO.getAppName())
|
||||
.eqIfPresent(AiApplicationDO::getApiKey, reqVO.getApiKey())
|
||||
.eqIfPresent(AiApplicationDO::getConsumePoints, reqVO.getConsumePoints())
|
||||
.eqIfPresent(AiApplicationDO::getUnitType, reqVO.getUnitType())
|
||||
.eqIfPresent(AiApplicationDO::getUnitValue, reqVO.getUnitValue())
|
||||
.eqIfPresent(AiApplicationDO::getStatus, reqVO.getStatus())
|
||||
.eqIfPresent(AiApplicationDO::getRemark, reqVO.getRemark())
|
||||
.betweenIfPresent(AiApplicationDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(AiApplicationDO::getId));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package cn.iocoder.yudao.module.tik.muye.aiapplication.service;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import cn.iocoder.yudao.module.tik.muye.aiapplication.dal.AiApplicationDO;
|
||||
import cn.iocoder.yudao.module.tik.muye.aiapplication.vo.AiApplicationPageReqVO;
|
||||
import cn.iocoder.yudao.module.tik.muye.aiapplication.vo.AiApplicationSaveReqVO;
|
||||
import jakarta.validation.*;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
|
||||
/**
|
||||
* AI应用功能 Service 接口
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
public interface AiApplicationService {
|
||||
|
||||
/**
|
||||
* 创建AI应用功能
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createAiApplication(@Valid AiApplicationSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新AI应用功能
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateAiApplication(@Valid AiApplicationSaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除AI应用功能
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteAiApplication(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除AI应用功能
|
||||
*
|
||||
* @param ids 编号
|
||||
*/
|
||||
void deleteAiApplicationListByIds(List<Long> ids);
|
||||
|
||||
/**
|
||||
* 获得AI应用功能
|
||||
*
|
||||
* @param id 编号
|
||||
* @return AI应用功能
|
||||
*/
|
||||
AiApplicationDO getAiApplication(Long id);
|
||||
|
||||
/**
|
||||
* 获得AI应用功能分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return AI应用功能分页
|
||||
*/
|
||||
PageResult<AiApplicationDO> getAiApplicationPage(AiApplicationPageReqVO pageReqVO);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
package cn.iocoder.yudao.module.tik.muye.aiapplication.service;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.exception.ErrorCode;
|
||||
import cn.iocoder.yudao.module.tik.muye.aiapplication.dal.AiApplicationDO;
|
||||
import cn.iocoder.yudao.module.tik.muye.aiapplication.mapper.AiApplicationMapper;
|
||||
import cn.iocoder.yudao.module.tik.muye.aiapplication.vo.AiApplicationPageReqVO;
|
||||
import cn.iocoder.yudao.module.tik.muye.aiapplication.vo.AiApplicationSaveReqVO;
|
||||
import org.springframework.stereotype.Service;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.util.*;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
|
||||
/**
|
||||
* AI应用功能 Service 实现类
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class AiApplicationServiceImpl implements AiApplicationService {
|
||||
|
||||
@Resource
|
||||
private AiApplicationMapper aiApplicationMapper;
|
||||
|
||||
@Override
|
||||
public Long createAiApplication(AiApplicationSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
AiApplicationDO aiApplication = BeanUtils.toBean(createReqVO, AiApplicationDO.class);
|
||||
aiApplicationMapper.insert(aiApplication);
|
||||
|
||||
// 返回
|
||||
return aiApplication.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateAiApplication(AiApplicationSaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateAiApplicationExists(updateReqVO.getId());
|
||||
// 更新
|
||||
AiApplicationDO updateObj = BeanUtils.toBean(updateReqVO, AiApplicationDO.class);
|
||||
aiApplicationMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteAiApplication(Long id) {
|
||||
// 校验存在
|
||||
validateAiApplicationExists(id);
|
||||
// 删除
|
||||
aiApplicationMapper.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteAiApplicationListByIds(List<Long> ids) {
|
||||
// 删除
|
||||
aiApplicationMapper.deleteByIds(ids);
|
||||
}
|
||||
|
||||
|
||||
private void validateAiApplicationExists(Long id) {
|
||||
if (aiApplicationMapper.selectById(id) == null) {
|
||||
throw exception(new ErrorCode(1004, "AI应用功能不存在"));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public AiApplicationDO getAiApplication(Long id) {
|
||||
return aiApplicationMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<AiApplicationDO> getAiApplicationPage(AiApplicationPageReqVO pageReqVO) {
|
||||
return aiApplicationMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package cn.iocoder.yudao.module.tik.muye.aiapplication.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - AI应用功能分页 Request VO")
|
||||
@Data
|
||||
public class AiApplicationPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "应用ID", example = "6241")
|
||||
private String appId;
|
||||
|
||||
@Schema(description = "应用名称", example = "芋艿")
|
||||
private String appName;
|
||||
|
||||
@Schema(description = "第三方API秘钥")
|
||||
private String apiKey;
|
||||
|
||||
@Schema(description = "单位消耗积分")
|
||||
private Integer consumePoints;
|
||||
|
||||
@Schema(description = "消耗单位(time-时长 count-次数)", example = "1")
|
||||
private String unitType;
|
||||
|
||||
@Schema(description = "单位值(如:1min、20次)")
|
||||
private String unitValue;
|
||||
|
||||
@Schema(description = "状态(0-禁用 1-启用)", example = "1")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "备注", example = "你说的对")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package cn.iocoder.yudao.module.tik.muye.aiapplication.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
import cn.idev.excel.annotation.*;
|
||||
|
||||
@Schema(description = "管理后台 - AI应用功能 Response VO")
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class AiApplicationRespVO {
|
||||
|
||||
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "5521")
|
||||
@ExcelProperty("主键")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "应用ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "6241")
|
||||
@ExcelProperty("应用ID")
|
||||
private String appId;
|
||||
|
||||
@Schema(description = "应用名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋艿")
|
||||
@ExcelProperty("应用名称")
|
||||
private String appName;
|
||||
|
||||
@Schema(description = "第三方API秘钥", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("第三方API秘钥")
|
||||
private String apiKey;
|
||||
|
||||
@Schema(description = "单位消耗积分", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("单位消耗积分")
|
||||
private Integer consumePoints;
|
||||
|
||||
@Schema(description = "消耗单位(time-时长 count-次数)", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@ExcelProperty("消耗单位(time-时长 count-次数)")
|
||||
private String unitType;
|
||||
|
||||
@Schema(description = "单位值(如:1min、20次)", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("单位值(如:1min、20次)")
|
||||
private String unitValue;
|
||||
|
||||
@Schema(description = "状态(0-禁用 1-启用)", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@ExcelProperty("状态(0-禁用 1-启用)")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED, example = "你说的对")
|
||||
@ExcelProperty("备注")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package cn.iocoder.yudao.module.tik.muye.aiapplication.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import jakarta.validation.constraints.*;
|
||||
|
||||
@Schema(description = "管理后台 - AI应用功能新增/修改 Request VO")
|
||||
@Data
|
||||
public class AiApplicationSaveReqVO {
|
||||
|
||||
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "5521")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "应用ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "6241")
|
||||
@NotEmpty(message = "应用ID不能为空")
|
||||
private String appId;
|
||||
|
||||
@Schema(description = "应用名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋艿")
|
||||
@NotEmpty(message = "应用名称不能为空")
|
||||
private String appName;
|
||||
|
||||
@Schema(description = "第三方API秘钥", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "第三方API秘钥不能为空")
|
||||
private String apiKey;
|
||||
|
||||
@Schema(description = "单位消耗积分", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "单位消耗积分不能为空")
|
||||
private Integer consumePoints;
|
||||
|
||||
@Schema(description = "消耗单位(time-时长 count-次数)", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@NotEmpty(message = "消耗单位(time-时长 count-次数)不能为空")
|
||||
private String unitType;
|
||||
|
||||
@Schema(description = "单位值(如:1min、20次)", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "单位值(如:1min、20次)不能为空")
|
||||
private String unitValue;
|
||||
|
||||
@Schema(description = "状态(0-禁用 1-启用)", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@NotNull(message = "状态(0-禁用 1-启用)不能为空")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED, example = "你说的对")
|
||||
@NotEmpty(message = "备注不能为空")
|
||||
private String remark;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
package cn.iocoder.yudao.module.tik.muye.aimodelconfig;
|
||||
|
||||
import cn.iocoder.yudao.module.tik.muye.aimodelconfig.dal.AiModelConfigDO;
|
||||
import cn.iocoder.yudao.module.tik.muye.aimodelconfig.vo.AiModelConfigPageReqVO;
|
||||
import cn.iocoder.yudao.module.tik.muye.aimodelconfig.vo.AiModelConfigRespVO;
|
||||
import cn.iocoder.yudao.module.tik.muye.aimodelconfig.vo.AiModelConfigSaveReqVO;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
|
||||
import jakarta.validation.constraints.*;
|
||||
import jakarta.validation.*;
|
||||
import jakarta.servlet.http.*;
|
||||
import java.util.*;
|
||||
import java.io.IOException;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
import cn.iocoder.yudao.module.tik.muye.aimodelconfig.service.AiModelConfigService;
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
|
||||
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
||||
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
|
||||
|
||||
@Tag(name = "管理后台 - AI模型配置")
|
||||
@RestController
|
||||
@RequestMapping("/muye/ai-model-config")
|
||||
@Validated
|
||||
public class AiModelConfigController {
|
||||
|
||||
@Resource
|
||||
private AiModelConfigService aiModelConfigService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建AI模型配置")
|
||||
@PreAuthorize("@ss.hasPermission('muye:ai-model-config:create')")
|
||||
public CommonResult<Long> createAiModelConfig(@Valid @RequestBody AiModelConfigSaveReqVO createReqVO) {
|
||||
return success(aiModelConfigService.createAiModelConfig(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新AI模型配置")
|
||||
@PreAuthorize("@ss.hasPermission('muye:ai-model-config:update')")
|
||||
public CommonResult<Boolean> updateAiModelConfig(@Valid @RequestBody AiModelConfigSaveReqVO updateReqVO) {
|
||||
aiModelConfigService.updateAiModelConfig(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除AI模型配置")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('muye:ai-model-config:delete')")
|
||||
public CommonResult<Boolean> deleteAiModelConfig(@RequestParam("id") Long id) {
|
||||
aiModelConfigService.deleteAiModelConfig(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete-list")
|
||||
@Parameter(name = "ids", description = "编号", required = true)
|
||||
@Operation(summary = "批量删除AI模型配置")
|
||||
@PreAuthorize("@ss.hasPermission('muye:ai-model-config:delete')")
|
||||
public CommonResult<Boolean> deleteAiModelConfigList(@RequestParam("ids") List<Long> ids) {
|
||||
aiModelConfigService.deleteAiModelConfigListByIds(ids);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得AI模型配置")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('muye:ai-model-config:query')")
|
||||
public CommonResult<AiModelConfigRespVO> getAiModelConfig(@RequestParam("id") Long id) {
|
||||
AiModelConfigDO aiModelConfig = aiModelConfigService.getAiModelConfig(id);
|
||||
return success(BeanUtils.toBean(aiModelConfig, AiModelConfigRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得AI模型配置分页")
|
||||
@PreAuthorize("@ss.hasPermission('muye:ai-model-config:query')")
|
||||
public CommonResult<PageResult<AiModelConfigRespVO>> getAiModelConfigPage(@Valid AiModelConfigPageReqVO pageReqVO) {
|
||||
PageResult<AiModelConfigDO> pageResult = aiModelConfigService.getAiModelConfigPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, AiModelConfigRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出AI模型配置 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('muye:ai-model-config:export')")
|
||||
@ApiAccessLog(operateType = EXPORT)
|
||||
public void exportAiModelConfigExcel(@Valid AiModelConfigPageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<AiModelConfigDO> list = aiModelConfigService.getAiModelConfigPage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "AI模型配置.xls", "数据", AiModelConfigRespVO.class,
|
||||
BeanUtils.toBean(list, AiModelConfigRespVO.class));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
package cn.iocoder.yudao.module.tik.muye.aimodelconfig.dal;
|
||||
|
||||
import lombok.*;
|
||||
import java.math.BigDecimal;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
|
||||
/**
|
||||
* AI模型配置 DO
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@TableName("muye_ai_model_config")
|
||||
@KeySequence("muye_ai_model_config_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class AiModelConfigDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 模型名称
|
||||
*/
|
||||
private String modelName;
|
||||
/**
|
||||
* 模型标识/编码
|
||||
*/
|
||||
private String modelCode;
|
||||
/**
|
||||
* 所属平台
|
||||
*/
|
||||
private String platform;
|
||||
/**
|
||||
* API秘钥
|
||||
*/
|
||||
private String apiKey;
|
||||
/**
|
||||
* 状态(0-禁用 1-启用)
|
||||
*/
|
||||
private Integer status;
|
||||
/**
|
||||
* 温度参数
|
||||
*/
|
||||
private BigDecimal temperature;
|
||||
/**
|
||||
* 回复数Token数
|
||||
*/
|
||||
private Integer maxTokens;
|
||||
/**
|
||||
* 每日请求次数
|
||||
*/
|
||||
private Integer dailyLimit;
|
||||
/**
|
||||
* 模型类型(image-图像 text-文本 video-视频 audio-音频)
|
||||
*/
|
||||
private String modelType;
|
||||
/**
|
||||
* 消耗积分
|
||||
*/
|
||||
private Integer consumePoints;
|
||||
/**
|
||||
* 最大文本数量
|
||||
*/
|
||||
private Integer maxTextLength;
|
||||
/**
|
||||
* 图片最大像素
|
||||
*/
|
||||
private String maxImageSize;
|
||||
/**
|
||||
* 视频最大时长(秒)
|
||||
*/
|
||||
private Integer maxVideoDuration;
|
||||
/**
|
||||
* 视频最大质量
|
||||
*/
|
||||
private String maxVideoQuality;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package cn.iocoder.yudao.module.tik.muye.aimodelconfig.mapper;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.module.tik.muye.aimodelconfig.dal.AiModelConfigDO;
|
||||
import cn.iocoder.yudao.module.tik.muye.aimodelconfig.vo.AiModelConfigPageReqVO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
|
||||
/**
|
||||
* AI模型配置 Mapper
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Mapper
|
||||
public interface AiModelConfigMapper extends BaseMapperX<AiModelConfigDO> {
|
||||
|
||||
default PageResult<AiModelConfigDO> selectPage(AiModelConfigPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<AiModelConfigDO>()
|
||||
.likeIfPresent(AiModelConfigDO::getModelName, reqVO.getModelName())
|
||||
.eqIfPresent(AiModelConfigDO::getModelCode, reqVO.getModelCode())
|
||||
.eqIfPresent(AiModelConfigDO::getPlatform, reqVO.getPlatform())
|
||||
.eqIfPresent(AiModelConfigDO::getApiKey, reqVO.getApiKey())
|
||||
.eqIfPresent(AiModelConfigDO::getStatus, reqVO.getStatus())
|
||||
.eqIfPresent(AiModelConfigDO::getTemperature, reqVO.getTemperature())
|
||||
.eqIfPresent(AiModelConfigDO::getMaxTokens, reqVO.getMaxTokens())
|
||||
.eqIfPresent(AiModelConfigDO::getDailyLimit, reqVO.getDailyLimit())
|
||||
.eqIfPresent(AiModelConfigDO::getModelType, reqVO.getModelType())
|
||||
.eqIfPresent(AiModelConfigDO::getConsumePoints, reqVO.getConsumePoints())
|
||||
.eqIfPresent(AiModelConfigDO::getMaxTextLength, reqVO.getMaxTextLength())
|
||||
.eqIfPresent(AiModelConfigDO::getMaxImageSize, reqVO.getMaxImageSize())
|
||||
.eqIfPresent(AiModelConfigDO::getMaxVideoDuration, reqVO.getMaxVideoDuration())
|
||||
.eqIfPresent(AiModelConfigDO::getMaxVideoQuality, reqVO.getMaxVideoQuality())
|
||||
.eqIfPresent(AiModelConfigDO::getRemark, reqVO.getRemark())
|
||||
.betweenIfPresent(AiModelConfigDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(AiModelConfigDO::getId));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package cn.iocoder.yudao.module.tik.muye.aimodelconfig.service;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import cn.iocoder.yudao.module.tik.muye.aimodelconfig.dal.AiModelConfigDO;
|
||||
import cn.iocoder.yudao.module.tik.muye.aimodelconfig.vo.AiModelConfigPageReqVO;
|
||||
import cn.iocoder.yudao.module.tik.muye.aimodelconfig.vo.AiModelConfigSaveReqVO;
|
||||
import jakarta.validation.*;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
|
||||
/**
|
||||
* AI模型配置 Service 接口
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
public interface AiModelConfigService {
|
||||
|
||||
/**
|
||||
* 创建AI模型配置
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createAiModelConfig(@Valid AiModelConfigSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新AI模型配置
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateAiModelConfig(@Valid AiModelConfigSaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除AI模型配置
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteAiModelConfig(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除AI模型配置
|
||||
*
|
||||
* @param ids 编号
|
||||
*/
|
||||
void deleteAiModelConfigListByIds(List<Long> ids);
|
||||
|
||||
/**
|
||||
* 获得AI模型配置
|
||||
*
|
||||
* @param id 编号
|
||||
* @return AI模型配置
|
||||
*/
|
||||
AiModelConfigDO getAiModelConfig(Long id);
|
||||
|
||||
/**
|
||||
* 获得AI模型配置分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return AI模型配置分页
|
||||
*/
|
||||
PageResult<AiModelConfigDO> getAiModelConfigPage(AiModelConfigPageReqVO pageReqVO);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
package cn.iocoder.yudao.module.tik.muye.aimodelconfig.service;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.exception.ErrorCode;
|
||||
import cn.iocoder.yudao.module.tik.muye.aimodelconfig.dal.AiModelConfigDO;
|
||||
import cn.iocoder.yudao.module.tik.muye.aimodelconfig.mapper.AiModelConfigMapper;
|
||||
import cn.iocoder.yudao.module.tik.muye.aimodelconfig.vo.AiModelConfigPageReqVO;
|
||||
import cn.iocoder.yudao.module.tik.muye.aimodelconfig.vo.AiModelConfigSaveReqVO;
|
||||
import org.springframework.stereotype.Service;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
|
||||
import java.util.*;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
|
||||
/**
|
||||
* AI模型配置 Service 实现类
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class AiModelConfigServiceImpl implements AiModelConfigService {
|
||||
|
||||
@Resource
|
||||
private AiModelConfigMapper aiModelConfigMapper;
|
||||
|
||||
@Override
|
||||
public Long createAiModelConfig(AiModelConfigSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
AiModelConfigDO aiModelConfig = BeanUtils.toBean(createReqVO, AiModelConfigDO.class);
|
||||
aiModelConfigMapper.insert(aiModelConfig);
|
||||
|
||||
// 返回
|
||||
return aiModelConfig.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateAiModelConfig(AiModelConfigSaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateAiModelConfigExists(updateReqVO.getId());
|
||||
// 更新
|
||||
AiModelConfigDO updateObj = BeanUtils.toBean(updateReqVO, AiModelConfigDO.class);
|
||||
aiModelConfigMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteAiModelConfig(Long id) {
|
||||
// 校验存在
|
||||
validateAiModelConfigExists(id);
|
||||
// 删除
|
||||
aiModelConfigMapper.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteAiModelConfigListByIds(List<Long> ids) {
|
||||
// 删除
|
||||
aiModelConfigMapper.deleteByIds(ids);
|
||||
}
|
||||
|
||||
|
||||
private void validateAiModelConfigExists(Long id) {
|
||||
if (aiModelConfigMapper.selectById(id) == null) {
|
||||
throw exception(new ErrorCode(1004, "AI模型配置不存在"));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public AiModelConfigDO getAiModelConfig(Long id) {
|
||||
return aiModelConfigMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<AiModelConfigDO> getAiModelConfigPage(AiModelConfigPageReqVO pageReqVO) {
|
||||
return aiModelConfigMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package cn.iocoder.yudao.module.tik.muye.aimodelconfig.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import java.math.BigDecimal;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - AI模型配置分页 Request VO")
|
||||
@Data
|
||||
public class AiModelConfigPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "模型名称", example = "李四")
|
||||
private String modelName;
|
||||
|
||||
@Schema(description = "模型标识/编码")
|
||||
private String modelCode;
|
||||
|
||||
@Schema(description = "所属平台")
|
||||
private String platform;
|
||||
|
||||
@Schema(description = "API秘钥")
|
||||
private String apiKey;
|
||||
|
||||
@Schema(description = "状态(0-禁用 1-启用)", example = "2")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "温度参数")
|
||||
private BigDecimal temperature;
|
||||
|
||||
@Schema(description = "回复数Token数")
|
||||
private Integer maxTokens;
|
||||
|
||||
@Schema(description = "每日请求次数")
|
||||
private Integer dailyLimit;
|
||||
|
||||
@Schema(description = "模型类型(image-图像 text-文本 video-视频 audio-音频)", example = "2")
|
||||
private String modelType;
|
||||
|
||||
@Schema(description = "消耗积分")
|
||||
private Integer consumePoints;
|
||||
|
||||
@Schema(description = "最大文本数量")
|
||||
private Integer maxTextLength;
|
||||
|
||||
@Schema(description = "图片最大像素")
|
||||
private String maxImageSize;
|
||||
|
||||
@Schema(description = "视频最大时长(秒)")
|
||||
private Integer maxVideoDuration;
|
||||
|
||||
@Schema(description = "视频最大质量")
|
||||
private String maxVideoQuality;
|
||||
|
||||
@Schema(description = "备注", example = "随便")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
package cn.iocoder.yudao.module.tik.muye.aimodelconfig.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.math.BigDecimal;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
import cn.idev.excel.annotation.*;
|
||||
|
||||
@Schema(description = "管理后台 - AI模型配置 Response VO")
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class AiModelConfigRespVO {
|
||||
|
||||
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "29327")
|
||||
@ExcelProperty("主键")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "模型名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "李四")
|
||||
@ExcelProperty("模型名称")
|
||||
private String modelName;
|
||||
|
||||
@Schema(description = "模型标识/编码", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("模型标识/编码")
|
||||
private String modelCode;
|
||||
|
||||
@Schema(description = "所属平台", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("所属平台")
|
||||
private String platform;
|
||||
|
||||
@Schema(description = "API秘钥", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("API秘钥")
|
||||
private String apiKey;
|
||||
|
||||
@Schema(description = "状态(0-禁用 1-启用)", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||
@ExcelProperty("状态(0-禁用 1-启用)")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "温度参数", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("温度参数")
|
||||
private BigDecimal temperature;
|
||||
|
||||
@Schema(description = "回复数Token数", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("回复数Token数")
|
||||
private Integer maxTokens;
|
||||
|
||||
@Schema(description = "每日请求次数", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("每日请求次数")
|
||||
private Integer dailyLimit;
|
||||
|
||||
@Schema(description = "模型类型(image-图像 text-文本 video-视频 audio-音频)", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||
@ExcelProperty("模型类型(image-图像 text-文本 video-视频 audio-音频)")
|
||||
private String modelType;
|
||||
|
||||
@Schema(description = "消耗积分", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("消耗积分")
|
||||
private Integer consumePoints;
|
||||
|
||||
@Schema(description = "最大文本数量", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("最大文本数量")
|
||||
private Integer maxTextLength;
|
||||
|
||||
@Schema(description = "图片最大像素", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("图片最大像素")
|
||||
private String maxImageSize;
|
||||
|
||||
@Schema(description = "视频最大时长(秒)", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("视频最大时长(秒)")
|
||||
private Integer maxVideoDuration;
|
||||
|
||||
@Schema(description = "视频最大质量", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("视频最大质量")
|
||||
private String maxVideoQuality;
|
||||
|
||||
@Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED, example = "随便")
|
||||
@ExcelProperty("备注")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
package cn.iocoder.yudao.module.tik.muye.aimodelconfig.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import jakarta.validation.constraints.*;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Schema(description = "管理后台 - AI模型配置新增/修改 Request VO")
|
||||
@Data
|
||||
public class AiModelConfigSaveReqVO {
|
||||
|
||||
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "29327")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "模型名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "李四")
|
||||
@NotEmpty(message = "模型名称不能为空")
|
||||
private String modelName;
|
||||
|
||||
@Schema(description = "模型标识/编码", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "模型标识/编码不能为空")
|
||||
private String modelCode;
|
||||
|
||||
@Schema(description = "所属平台", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "所属平台不能为空")
|
||||
private String platform;
|
||||
|
||||
@Schema(description = "API秘钥", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "API秘钥不能为空")
|
||||
private String apiKey;
|
||||
|
||||
@Schema(description = "状态(0-禁用 1-启用)", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||
@NotNull(message = "状态(0-禁用 1-启用)不能为空")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "温度参数", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "温度参数不能为空")
|
||||
private BigDecimal temperature;
|
||||
|
||||
@Schema(description = "回复数Token数", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "回复数Token数不能为空")
|
||||
private Integer maxTokens;
|
||||
|
||||
@Schema(description = "每日请求次数", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "每日请求次数不能为空")
|
||||
private Integer dailyLimit;
|
||||
|
||||
@Schema(description = "模型类型(image-图像 text-文本 video-视频 audio-音频)", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||
@NotEmpty(message = "模型类型(image-图像 text-文本 video-视频 audio-音频)不能为空")
|
||||
private String modelType;
|
||||
|
||||
@Schema(description = "消耗积分", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "消耗积分不能为空")
|
||||
private Integer consumePoints;
|
||||
|
||||
@Schema(description = "最大文本数量", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "最大文本数量不能为空")
|
||||
private Integer maxTextLength;
|
||||
|
||||
@Schema(description = "图片最大像素", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "图片最大像素不能为空")
|
||||
private String maxImageSize;
|
||||
|
||||
@Schema(description = "视频最大时长(秒)", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "视频最大时长(秒)不能为空")
|
||||
private Integer maxVideoDuration;
|
||||
|
||||
@Schema(description = "视频最大质量", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "视频最大质量不能为空")
|
||||
private String maxVideoQuality;
|
||||
|
||||
@Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED, example = "随便")
|
||||
@NotEmpty(message = "备注不能为空")
|
||||
private String remark;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
package cn.iocoder.yudao.module.tik.muye.membergiftpackage;
|
||||
|
||||
import cn.iocoder.yudao.module.tik.muye.membergiftpackage.dal.MemberGiftPackageDO;
|
||||
import cn.iocoder.yudao.module.tik.muye.membergiftpackage.service.MemberGiftPackageService;
|
||||
import cn.iocoder.yudao.module.tik.muye.membergiftpackage.vo.MemberGiftPackagePageReqVO;
|
||||
import cn.iocoder.yudao.module.tik.muye.membergiftpackage.vo.MemberGiftPackageRespVO;
|
||||
import cn.iocoder.yudao.module.tik.muye.membergiftpackage.vo.MemberGiftPackageSaveReqVO;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
|
||||
import jakarta.validation.constraints.*;
|
||||
import jakarta.validation.*;
|
||||
import jakarta.servlet.http.*;
|
||||
import java.util.*;
|
||||
import java.io.IOException;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
|
||||
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
||||
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
|
||||
|
||||
@Tag(name = "管理后台 - 礼包")
|
||||
@RestController
|
||||
@RequestMapping("/muye/member-gift-package")
|
||||
@Validated
|
||||
public class MemberGiftPackageController {
|
||||
|
||||
@Resource
|
||||
private MemberGiftPackageService memberGiftPackageService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建礼包")
|
||||
@PreAuthorize("@ss.hasPermission('muye:member-gift-package:create')")
|
||||
public CommonResult<Long> createMemberGiftPackage(@Valid @RequestBody MemberGiftPackageSaveReqVO createReqVO) {
|
||||
return success(memberGiftPackageService.createMemberGiftPackage(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新礼包")
|
||||
@PreAuthorize("@ss.hasPermission('muye:member-gift-package:update')")
|
||||
public CommonResult<Boolean> updateMemberGiftPackage(@Valid @RequestBody MemberGiftPackageSaveReqVO updateReqVO) {
|
||||
memberGiftPackageService.updateMemberGiftPackage(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除礼包")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('muye:member-gift-package:delete')")
|
||||
public CommonResult<Boolean> deleteMemberGiftPackage(@RequestParam("id") Long id) {
|
||||
memberGiftPackageService.deleteMemberGiftPackage(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete-list")
|
||||
@Parameter(name = "ids", description = "编号", required = true)
|
||||
@Operation(summary = "批量删除礼包")
|
||||
@PreAuthorize("@ss.hasPermission('muye:member-gift-package:delete')")
|
||||
public CommonResult<Boolean> deleteMemberGiftPackageList(@RequestParam("ids") List<Long> ids) {
|
||||
memberGiftPackageService.deleteMemberGiftPackageListByIds(ids);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得礼包")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('muye:member-gift-package:query')")
|
||||
public CommonResult<MemberGiftPackageRespVO> getMemberGiftPackage(@RequestParam("id") Long id) {
|
||||
MemberGiftPackageDO memberGiftPackage = memberGiftPackageService.getMemberGiftPackage(id);
|
||||
return success(BeanUtils.toBean(memberGiftPackage, MemberGiftPackageRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得礼包分页")
|
||||
@PreAuthorize("@ss.hasPermission('muye:member-gift-package:query')")
|
||||
public CommonResult<PageResult<MemberGiftPackageRespVO>> getMemberGiftPackagePage(@Valid MemberGiftPackagePageReqVO pageReqVO) {
|
||||
PageResult<MemberGiftPackageDO> pageResult = memberGiftPackageService.getMemberGiftPackagePage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, MemberGiftPackageRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出礼包 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('muye:member-gift-package:export')")
|
||||
@ApiAccessLog(operateType = EXPORT)
|
||||
public void exportMemberGiftPackageExcel(@Valid MemberGiftPackagePageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<MemberGiftPackageDO> list = memberGiftPackageService.getMemberGiftPackagePage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "礼包.xls", "数据", MemberGiftPackageRespVO.class,
|
||||
BeanUtils.toBean(list, MemberGiftPackageRespVO.class));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
package cn.iocoder.yudao.module.tik.muye.membergiftpackage.dal;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
|
||||
/**
|
||||
* 礼包 DO
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@TableName("muye_member_gift_package")
|
||||
@KeySequence("muye_member_gift_package_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class MemberGiftPackageDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 礼包ID
|
||||
*/
|
||||
private String packageId;
|
||||
/**
|
||||
* 礼包名称
|
||||
*/
|
||||
private String packageName;
|
||||
/**
|
||||
* C端展示排序
|
||||
*/
|
||||
private Integer sortOrder;
|
||||
/**
|
||||
* 状态(0-禁用 1-启用)
|
||||
*/
|
||||
private Integer status;
|
||||
/**
|
||||
* 购买价格
|
||||
*/
|
||||
private BigDecimal price;
|
||||
/**
|
||||
* 有效期(天)
|
||||
*/
|
||||
private Integer validityDays;
|
||||
/**
|
||||
* 赠送积分
|
||||
*/
|
||||
private Integer bonusPoints;
|
||||
/**
|
||||
* 关联应用(JSON格式)
|
||||
*/
|
||||
private String applications;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
/**
|
||||
* 操作人用户编号
|
||||
*/
|
||||
private Long operatorId;
|
||||
/**
|
||||
* 操作人账号
|
||||
*/
|
||||
private String operatorName;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package cn.iocoder.yudao.module.tik.muye.membergiftpackage.mapper;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.module.tik.muye.membergiftpackage.dal.MemberGiftPackageDO;
|
||||
import cn.iocoder.yudao.module.tik.muye.membergiftpackage.vo.MemberGiftPackagePageReqVO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
|
||||
/**
|
||||
* 礼包 Mapper
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Mapper
|
||||
public interface MemberGiftPackageMapper extends BaseMapperX<MemberGiftPackageDO> {
|
||||
|
||||
default PageResult<MemberGiftPackageDO> selectPage(MemberGiftPackagePageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<MemberGiftPackageDO>()
|
||||
.eqIfPresent(MemberGiftPackageDO::getPackageId, reqVO.getPackageId())
|
||||
.likeIfPresent(MemberGiftPackageDO::getPackageName, reqVO.getPackageName())
|
||||
.eqIfPresent(MemberGiftPackageDO::getSortOrder, reqVO.getSortOrder())
|
||||
.eqIfPresent(MemberGiftPackageDO::getStatus, reqVO.getStatus())
|
||||
.eqIfPresent(MemberGiftPackageDO::getPrice, reqVO.getPrice())
|
||||
.eqIfPresent(MemberGiftPackageDO::getValidityDays, reqVO.getValidityDays())
|
||||
.eqIfPresent(MemberGiftPackageDO::getBonusPoints, reqVO.getBonusPoints())
|
||||
.eqIfPresent(MemberGiftPackageDO::getApplications, reqVO.getApplications())
|
||||
.eqIfPresent(MemberGiftPackageDO::getRemark, reqVO.getRemark())
|
||||
.eqIfPresent(MemberGiftPackageDO::getOperatorId, reqVO.getOperatorId())
|
||||
.likeIfPresent(MemberGiftPackageDO::getOperatorName, reqVO.getOperatorName())
|
||||
.betweenIfPresent(MemberGiftPackageDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(MemberGiftPackageDO::getId));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package cn.iocoder.yudao.module.tik.muye.membergiftpackage.service;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import cn.iocoder.yudao.module.tik.muye.membergiftpackage.dal.MemberGiftPackageDO;
|
||||
import cn.iocoder.yudao.module.tik.muye.membergiftpackage.vo.MemberGiftPackagePageReqVO;
|
||||
import cn.iocoder.yudao.module.tik.muye.membergiftpackage.vo.MemberGiftPackageSaveReqVO;
|
||||
import jakarta.validation.*;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
|
||||
|
||||
/**
|
||||
* 礼包 Service 接口
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
public interface MemberGiftPackageService {
|
||||
|
||||
/**
|
||||
* 创建礼包
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createMemberGiftPackage(@Valid MemberGiftPackageSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新礼包
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateMemberGiftPackage(@Valid MemberGiftPackageSaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除礼包
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteMemberGiftPackage(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除礼包
|
||||
*
|
||||
* @param ids 编号
|
||||
*/
|
||||
void deleteMemberGiftPackageListByIds(List<Long> ids);
|
||||
|
||||
/**
|
||||
* 获得礼包
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 礼包
|
||||
*/
|
||||
MemberGiftPackageDO getMemberGiftPackage(Long id);
|
||||
|
||||
/**
|
||||
* 获得礼包分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 礼包分页
|
||||
*/
|
||||
PageResult<MemberGiftPackageDO> getMemberGiftPackagePage(MemberGiftPackagePageReqVO pageReqVO);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
package cn.iocoder.yudao.module.tik.muye.membergiftpackage.service;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.exception.ErrorCode;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import cn.iocoder.yudao.module.tik.muye.membergiftpackage.dal.MemberGiftPackageDO;
|
||||
import cn.iocoder.yudao.module.tik.muye.membergiftpackage.mapper.MemberGiftPackageMapper;
|
||||
import cn.iocoder.yudao.module.tik.muye.membergiftpackage.vo.MemberGiftPackagePageReqVO;
|
||||
import cn.iocoder.yudao.module.tik.muye.membergiftpackage.vo.MemberGiftPackageSaveReqVO;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
|
||||
/**
|
||||
* 礼包 Service 实现类
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class MemberGiftPackageServiceImpl implements MemberGiftPackageService {
|
||||
|
||||
@Resource
|
||||
private MemberGiftPackageMapper memberGiftPackageMapper;
|
||||
|
||||
@Override
|
||||
public Long createMemberGiftPackage(MemberGiftPackageSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
MemberGiftPackageDO memberGiftPackage = BeanUtils.toBean(createReqVO, MemberGiftPackageDO.class);
|
||||
memberGiftPackageMapper.insert(memberGiftPackage);
|
||||
|
||||
// 返回
|
||||
return memberGiftPackage.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateMemberGiftPackage(MemberGiftPackageSaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateMemberGiftPackageExists(updateReqVO.getId());
|
||||
// 更新
|
||||
MemberGiftPackageDO updateObj = BeanUtils.toBean(updateReqVO, MemberGiftPackageDO.class);
|
||||
memberGiftPackageMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteMemberGiftPackage(Long id) {
|
||||
// 校验存在
|
||||
validateMemberGiftPackageExists(id);
|
||||
// 删除
|
||||
memberGiftPackageMapper.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteMemberGiftPackageListByIds(List<Long> ids) {
|
||||
// 删除
|
||||
memberGiftPackageMapper.deleteByIds(ids);
|
||||
}
|
||||
|
||||
|
||||
private void validateMemberGiftPackageExists(Long id) {
|
||||
if (memberGiftPackageMapper.selectById(id) == null) {
|
||||
throw exception(new ErrorCode(1004, "礼包不存在"));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public MemberGiftPackageDO getMemberGiftPackage(Long id) {
|
||||
return memberGiftPackageMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<MemberGiftPackageDO> getMemberGiftPackagePage(MemberGiftPackagePageReqVO pageReqVO) {
|
||||
return memberGiftPackageMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package cn.iocoder.yudao.module.tik.muye.membergiftpackage.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import java.math.BigDecimal;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 礼包分页 Request VO")
|
||||
@Data
|
||||
public class MemberGiftPackagePageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "礼包ID", example = "19944")
|
||||
private String packageId;
|
||||
|
||||
@Schema(description = "礼包名称", example = "赵六")
|
||||
private String packageName;
|
||||
|
||||
@Schema(description = "C端展示排序")
|
||||
private Integer sortOrder;
|
||||
|
||||
@Schema(description = "状态(0-禁用 1-启用)", example = "2")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "购买价格", example = "5921")
|
||||
private BigDecimal price;
|
||||
|
||||
@Schema(description = "有效期(天)")
|
||||
private Integer validityDays;
|
||||
|
||||
@Schema(description = "赠送积分")
|
||||
private Integer bonusPoints;
|
||||
|
||||
@Schema(description = "关联应用(JSON格式)")
|
||||
private String applications;
|
||||
|
||||
@Schema(description = "备注", example = "你说的对")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "操作人用户编号", example = "7336")
|
||||
private Long operatorId;
|
||||
|
||||
@Schema(description = "操作人账号", example = "李四")
|
||||
private String operatorName;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
package cn.iocoder.yudao.module.tik.muye.membergiftpackage.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.math.BigDecimal;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
import cn.idev.excel.annotation.*;
|
||||
|
||||
@Schema(description = "管理后台 - 礼包 Response VO")
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class MemberGiftPackageRespVO {
|
||||
|
||||
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "31737")
|
||||
@ExcelProperty("主键")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "礼包ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "19944")
|
||||
@ExcelProperty("礼包ID")
|
||||
private String packageId;
|
||||
|
||||
@Schema(description = "礼包名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "赵六")
|
||||
@ExcelProperty("礼包名称")
|
||||
private String packageName;
|
||||
|
||||
@Schema(description = "C端展示排序", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("C端展示排序")
|
||||
private Integer sortOrder;
|
||||
|
||||
@Schema(description = "状态(0-禁用 1-启用)", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||
@ExcelProperty("状态(0-禁用 1-启用)")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "购买价格", requiredMode = Schema.RequiredMode.REQUIRED, example = "5921")
|
||||
@ExcelProperty("购买价格")
|
||||
private BigDecimal price;
|
||||
|
||||
@Schema(description = "有效期(天)", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("有效期(天)")
|
||||
private Integer validityDays;
|
||||
|
||||
@Schema(description = "赠送积分", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("赠送积分")
|
||||
private Integer bonusPoints;
|
||||
|
||||
@Schema(description = "关联应用(JSON格式)", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("关联应用(JSON格式)")
|
||||
private String applications;
|
||||
|
||||
@Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED, example = "你说的对")
|
||||
@ExcelProperty("备注")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "操作人用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "7336")
|
||||
@ExcelProperty("操作人用户编号")
|
||||
private Long operatorId;
|
||||
|
||||
@Schema(description = "操作人账号", requiredMode = Schema.RequiredMode.REQUIRED, example = "李四")
|
||||
@ExcelProperty("操作人账号")
|
||||
private String operatorName;
|
||||
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package cn.iocoder.yudao.module.tik.muye.membergiftpackage.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import jakarta.validation.constraints.*;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Schema(description = "管理后台 - 礼包新增/修改 Request VO")
|
||||
@Data
|
||||
public class MemberGiftPackageSaveReqVO {
|
||||
|
||||
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "31737")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "礼包ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "19944")
|
||||
@NotEmpty(message = "礼包ID不能为空")
|
||||
private String packageId;
|
||||
|
||||
@Schema(description = "礼包名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "赵六")
|
||||
@NotEmpty(message = "礼包名称不能为空")
|
||||
private String packageName;
|
||||
|
||||
@Schema(description = "C端展示排序", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "C端展示排序不能为空")
|
||||
private Integer sortOrder;
|
||||
|
||||
@Schema(description = "状态(0-禁用 1-启用)", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||
@NotNull(message = "状态(0-禁用 1-启用)不能为空")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "购买价格", requiredMode = Schema.RequiredMode.REQUIRED, example = "5921")
|
||||
@NotNull(message = "购买价格不能为空")
|
||||
private BigDecimal price;
|
||||
|
||||
@Schema(description = "有效期(天)", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "有效期(天)不能为空")
|
||||
private Integer validityDays;
|
||||
|
||||
@Schema(description = "赠送积分", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "赠送积分不能为空")
|
||||
private Integer bonusPoints;
|
||||
|
||||
@Schema(description = "关联应用(JSON格式)", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "关联应用(JSON格式)不能为空")
|
||||
private String applications;
|
||||
|
||||
@Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED, example = "你说的对")
|
||||
@NotEmpty(message = "备注不能为空")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "操作人用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "7336")
|
||||
@NotNull(message = "操作人用户编号不能为空")
|
||||
private Long operatorId;
|
||||
|
||||
@Schema(description = "操作人账号", requiredMode = Schema.RequiredMode.REQUIRED, example = "李四")
|
||||
@NotEmpty(message = "操作人账号不能为空")
|
||||
private String operatorName;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
package cn.iocoder.yudao.module.tik.muye.memberrechargerecord;
|
||||
|
||||
import cn.iocoder.yudao.module.tik.muye.memberrechargerecord.dal.MemberRechargeRecordDO;
|
||||
import cn.iocoder.yudao.module.tik.muye.memberrechargerecord.vo.MemberRechargeRecordPageReqVO;
|
||||
import cn.iocoder.yudao.module.tik.muye.memberrechargerecord.vo.MemberRechargeRecordRespVO;
|
||||
import cn.iocoder.yudao.module.tik.muye.memberrechargerecord.vo.MemberRechargeRecordSaveReqVO;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
|
||||
import jakarta.validation.constraints.*;
|
||||
import jakarta.validation.*;
|
||||
import jakarta.servlet.http.*;
|
||||
import java.util.*;
|
||||
import java.io.IOException;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
import cn.iocoder.yudao.module.tik.muye.memberrechargerecord.service.MemberRechargeRecordService;
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
|
||||
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
||||
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
|
||||
|
||||
|
||||
@Tag(name = "管理后台 - 充值记录")
|
||||
@RestController
|
||||
@RequestMapping("/muye/member-recharge-record")
|
||||
@Validated
|
||||
public class MemberRechargeRecordController {
|
||||
|
||||
@Resource
|
||||
private MemberRechargeRecordService memberRechargeRecordService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建充值记录")
|
||||
@PreAuthorize("@ss.hasPermission('muye:member-recharge-record:create')")
|
||||
public CommonResult<Long> createMemberRechargeRecord(@Valid @RequestBody MemberRechargeRecordSaveReqVO createReqVO) {
|
||||
return success(memberRechargeRecordService.createMemberRechargeRecord(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新充值记录")
|
||||
@PreAuthorize("@ss.hasPermission('muye:member-recharge-record:update')")
|
||||
public CommonResult<Boolean> updateMemberRechargeRecord(@Valid @RequestBody MemberRechargeRecordSaveReqVO updateReqVO) {
|
||||
memberRechargeRecordService.updateMemberRechargeRecord(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除充值记录")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('muye:member-recharge-record:delete')")
|
||||
public CommonResult<Boolean> deleteMemberRechargeRecord(@RequestParam("id") Long id) {
|
||||
memberRechargeRecordService.deleteMemberRechargeRecord(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete-list")
|
||||
@Parameter(name = "ids", description = "编号", required = true)
|
||||
@Operation(summary = "批量删除充值记录")
|
||||
@PreAuthorize("@ss.hasPermission('muye:member-recharge-record:delete')")
|
||||
public CommonResult<Boolean> deleteMemberRechargeRecordList(@RequestParam("ids") List<Long> ids) {
|
||||
memberRechargeRecordService.deleteMemberRechargeRecordListByIds(ids);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得充值记录")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('muye:member-recharge-record:query')")
|
||||
public CommonResult<MemberRechargeRecordRespVO> getMemberRechargeRecord(@RequestParam("id") Long id) {
|
||||
MemberRechargeRecordDO memberRechargeRecord = memberRechargeRecordService.getMemberRechargeRecord(id);
|
||||
return success(BeanUtils.toBean(memberRechargeRecord, MemberRechargeRecordRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得充值记录分页")
|
||||
@PreAuthorize("@ss.hasPermission('muye:member-recharge-record:query')")
|
||||
public CommonResult<PageResult<MemberRechargeRecordRespVO>> getMemberRechargeRecordPage(@Valid MemberRechargeRecordPageReqVO pageReqVO) {
|
||||
PageResult<MemberRechargeRecordDO> pageResult = memberRechargeRecordService.getMemberRechargeRecordPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, MemberRechargeRecordRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出充值记录 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('muye:member-recharge-record:export')")
|
||||
@ApiAccessLog(operateType = EXPORT)
|
||||
public void exportMemberRechargeRecordExcel(@Valid MemberRechargeRecordPageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<MemberRechargeRecordDO> list = memberRechargeRecordService.getMemberRechargeRecordPage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "充值记录.xls", "数据", MemberRechargeRecordRespVO.class,
|
||||
BeanUtils.toBean(list, MemberRechargeRecordRespVO.class));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
package cn.iocoder.yudao.module.tik.muye.memberrechargerecord.dal;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
|
||||
/**
|
||||
* 充值记录 DO
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@TableName("muye_member_recharge_record")
|
||||
@KeySequence("muye_member_recharge_record_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class MemberRechargeRecordDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 用户编号
|
||||
*/
|
||||
private Long userId;
|
||||
/**
|
||||
* 手机号
|
||||
*/
|
||||
private String mobile;
|
||||
/**
|
||||
* 充值金额
|
||||
*/
|
||||
private BigDecimal rechargeAmount;
|
||||
/**
|
||||
* 充值方式(alipay-支付宝 wechat-微信 admin-人工)
|
||||
*/
|
||||
private String rechargeType;
|
||||
/**
|
||||
* 订单类型(purchase-权限购买 exchange-积分兑换)
|
||||
*/
|
||||
private String orderType;
|
||||
/**
|
||||
* 购买权限类型
|
||||
*/
|
||||
private String permissionType;
|
||||
/**
|
||||
* 获得积分
|
||||
*/
|
||||
private Integer bonusPoints;
|
||||
/**
|
||||
* 状态(0-失败 1-成功)
|
||||
*/
|
||||
private Integer status;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package cn.iocoder.yudao.module.tik.muye.memberrechargerecord.mapper;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.module.tik.muye.memberrechargerecord.dal.MemberRechargeRecordDO;
|
||||
import cn.iocoder.yudao.module.tik.muye.memberrechargerecord.vo.MemberRechargeRecordPageReqVO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 充值记录 Mapper
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Mapper
|
||||
public interface MemberRechargeRecordMapper extends BaseMapperX<MemberRechargeRecordDO> {
|
||||
|
||||
default PageResult<MemberRechargeRecordDO> selectPage(MemberRechargeRecordPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<MemberRechargeRecordDO>()
|
||||
.eqIfPresent(MemberRechargeRecordDO::getUserId, reqVO.getUserId())
|
||||
.eqIfPresent(MemberRechargeRecordDO::getMobile, reqVO.getMobile())
|
||||
.eqIfPresent(MemberRechargeRecordDO::getRechargeAmount, reqVO.getRechargeAmount())
|
||||
.eqIfPresent(MemberRechargeRecordDO::getRechargeType, reqVO.getRechargeType())
|
||||
.eqIfPresent(MemberRechargeRecordDO::getOrderType, reqVO.getOrderType())
|
||||
.eqIfPresent(MemberRechargeRecordDO::getPermissionType, reqVO.getPermissionType())
|
||||
.eqIfPresent(MemberRechargeRecordDO::getBonusPoints, reqVO.getBonusPoints())
|
||||
.eqIfPresent(MemberRechargeRecordDO::getStatus, reqVO.getStatus())
|
||||
.eqIfPresent(MemberRechargeRecordDO::getRemark, reqVO.getRemark())
|
||||
.betweenIfPresent(MemberRechargeRecordDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(MemberRechargeRecordDO::getId));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package cn.iocoder.yudao.module.tik.muye.memberrechargerecord.service;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import cn.iocoder.yudao.module.tik.muye.memberrechargerecord.dal.MemberRechargeRecordDO;
|
||||
import cn.iocoder.yudao.module.tik.muye.memberrechargerecord.vo.MemberRechargeRecordPageReqVO;
|
||||
import cn.iocoder.yudao.module.tik.muye.memberrechargerecord.vo.MemberRechargeRecordSaveReqVO;
|
||||
import jakarta.validation.*;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
|
||||
|
||||
/**
|
||||
* 充值记录 Service 接口
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
public interface MemberRechargeRecordService {
|
||||
|
||||
/**
|
||||
* 创建充值记录
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createMemberRechargeRecord(@Valid MemberRechargeRecordSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新充值记录
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateMemberRechargeRecord(@Valid MemberRechargeRecordSaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除充值记录
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteMemberRechargeRecord(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除充值记录
|
||||
*
|
||||
* @param ids 编号
|
||||
*/
|
||||
void deleteMemberRechargeRecordListByIds(List<Long> ids);
|
||||
|
||||
/**
|
||||
* 获得充值记录
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 充值记录
|
||||
*/
|
||||
MemberRechargeRecordDO getMemberRechargeRecord(Long id);
|
||||
|
||||
/**
|
||||
* 获得充值记录分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 充值记录分页
|
||||
*/
|
||||
PageResult<MemberRechargeRecordDO> getMemberRechargeRecordPage(MemberRechargeRecordPageReqVO pageReqVO);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
package cn.iocoder.yudao.module.tik.muye.memberrechargerecord.service;
|
||||
|
||||
|
||||
import cn.iocoder.yudao.framework.common.exception.ErrorCode;
|
||||
import cn.iocoder.yudao.module.tik.muye.memberrechargerecord.dal.MemberRechargeRecordDO;
|
||||
import cn.iocoder.yudao.module.tik.muye.memberrechargerecord.mapper.MemberRechargeRecordMapper;
|
||||
import cn.iocoder.yudao.module.tik.muye.memberrechargerecord.vo.MemberRechargeRecordPageReqVO;
|
||||
import cn.iocoder.yudao.module.tik.muye.memberrechargerecord.vo.MemberRechargeRecordSaveReqVO;
|
||||
import org.springframework.stereotype.Service;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.util.*;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
|
||||
|
||||
/**
|
||||
* 充值记录 Service 实现类
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class MemberRechargeRecordServiceImpl implements MemberRechargeRecordService {
|
||||
|
||||
@Resource
|
||||
private MemberRechargeRecordMapper memberRechargeRecordMapper;
|
||||
|
||||
@Override
|
||||
public Long createMemberRechargeRecord(MemberRechargeRecordSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
MemberRechargeRecordDO memberRechargeRecord = BeanUtils.toBean(createReqVO, MemberRechargeRecordDO.class);
|
||||
memberRechargeRecordMapper.insert(memberRechargeRecord);
|
||||
|
||||
// 返回
|
||||
return memberRechargeRecord.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateMemberRechargeRecord(MemberRechargeRecordSaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateMemberRechargeRecordExists(updateReqVO.getId());
|
||||
// 更新
|
||||
MemberRechargeRecordDO updateObj = BeanUtils.toBean(updateReqVO, MemberRechargeRecordDO.class);
|
||||
memberRechargeRecordMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteMemberRechargeRecord(Long id) {
|
||||
// 校验存在
|
||||
validateMemberRechargeRecordExists(id);
|
||||
// 删除
|
||||
memberRechargeRecordMapper.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteMemberRechargeRecordListByIds(List<Long> ids) {
|
||||
// 删除
|
||||
memberRechargeRecordMapper.deleteByIds(ids);
|
||||
}
|
||||
|
||||
|
||||
private void validateMemberRechargeRecordExists(Long id) {
|
||||
if (memberRechargeRecordMapper.selectById(id) == null) {
|
||||
throw exception(new ErrorCode(1004, "充值记录不存在"));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public MemberRechargeRecordDO getMemberRechargeRecord(Long id) {
|
||||
return memberRechargeRecordMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<MemberRechargeRecordDO> getMemberRechargeRecordPage(MemberRechargeRecordPageReqVO pageReqVO) {
|
||||
return memberRechargeRecordMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package cn.iocoder.yudao.module.tik.muye.memberrechargerecord.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import java.math.BigDecimal;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 充值记录分页 Request VO")
|
||||
@Data
|
||||
public class MemberRechargeRecordPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "用户编号", example = "27188")
|
||||
private Long userId;
|
||||
|
||||
@Schema(description = "手机号")
|
||||
private String mobile;
|
||||
|
||||
@Schema(description = "充值金额")
|
||||
private BigDecimal rechargeAmount;
|
||||
|
||||
@Schema(description = "充值方式(alipay-支付宝 wechat-微信 admin-人工)", example = "2")
|
||||
private String rechargeType;
|
||||
|
||||
@Schema(description = "订单类型(purchase-权限购买 exchange-积分兑换)", example = "2")
|
||||
private String orderType;
|
||||
|
||||
@Schema(description = "购买权限类型", example = "2")
|
||||
private String permissionType;
|
||||
|
||||
@Schema(description = "获得积分")
|
||||
private Integer bonusPoints;
|
||||
|
||||
@Schema(description = "状态(0-失败 1-成功)", example = "2")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "备注", example = "你说的对")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package cn.iocoder.yudao.module.tik.muye.memberrechargerecord.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.math.BigDecimal;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
import cn.idev.excel.annotation.*;
|
||||
|
||||
@Schema(description = "管理后台 - 充值记录 Response VO")
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class MemberRechargeRecordRespVO {
|
||||
|
||||
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "25656")
|
||||
@ExcelProperty("主键")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "27188")
|
||||
@ExcelProperty("用户编号")
|
||||
private Long userId;
|
||||
|
||||
@Schema(description = "手机号", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("手机号")
|
||||
private String mobile;
|
||||
|
||||
@Schema(description = "充值金额", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("充值金额")
|
||||
private BigDecimal rechargeAmount;
|
||||
|
||||
@Schema(description = "充值方式(alipay-支付宝 wechat-微信 admin-人工)", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||
@ExcelProperty("充值方式(alipay-支付宝 wechat-微信 admin-人工)")
|
||||
private String rechargeType;
|
||||
|
||||
@Schema(description = "订单类型(purchase-权限购买 exchange-积分兑换)", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||
@ExcelProperty("订单类型(purchase-权限购买 exchange-积分兑换)")
|
||||
private String orderType;
|
||||
|
||||
@Schema(description = "购买权限类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||
@ExcelProperty("购买权限类型")
|
||||
private String permissionType;
|
||||
|
||||
@Schema(description = "获得积分", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("获得积分")
|
||||
private Integer bonusPoints;
|
||||
|
||||
@Schema(description = "状态(0-失败 1-成功)", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||
@ExcelProperty("状态(0-失败 1-成功)")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED, example = "你说的对")
|
||||
@ExcelProperty("备注")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package cn.iocoder.yudao.module.tik.muye.memberrechargerecord.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import jakarta.validation.constraints.*;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Schema(description = "管理后台 - 充值记录新增/修改 Request VO")
|
||||
@Data
|
||||
public class MemberRechargeRecordSaveReqVO {
|
||||
|
||||
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "25656")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "27188")
|
||||
@NotNull(message = "用户编号不能为空")
|
||||
private Long userId;
|
||||
|
||||
@Schema(description = "手机号", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "手机号不能为空")
|
||||
private String mobile;
|
||||
|
||||
@Schema(description = "充值金额", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "充值金额不能为空")
|
||||
private BigDecimal rechargeAmount;
|
||||
|
||||
@Schema(description = "充值方式(alipay-支付宝 wechat-微信 admin-人工)", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||
@NotEmpty(message = "充值方式(alipay-支付宝 wechat-微信 admin-人工)不能为空")
|
||||
private String rechargeType;
|
||||
|
||||
@Schema(description = "订单类型(purchase-权限购买 exchange-积分兑换)", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||
@NotEmpty(message = "订单类型(purchase-权限购买 exchange-积分兑换)不能为空")
|
||||
private String orderType;
|
||||
|
||||
@Schema(description = "购买权限类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||
@NotEmpty(message = "购买权限类型不能为空")
|
||||
private String permissionType;
|
||||
|
||||
@Schema(description = "获得积分", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "获得积分不能为空")
|
||||
private Integer bonusPoints;
|
||||
|
||||
@Schema(description = "状态(0-失败 1-成功)", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||
@NotNull(message = "状态(0-失败 1-成功)不能为空")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED, example = "你说的对")
|
||||
@NotEmpty(message = "备注不能为空")
|
||||
private String remark;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
package cn.iocoder.yudao.module.tik.muye.memberuserpermission;
|
||||
|
||||
import cn.iocoder.yudao.module.tik.muye.memberuserpermission.dal.MemberUserPermissionDO;
|
||||
import cn.iocoder.yudao.module.tik.muye.memberuserpermission.service.MemberUserPermissionService;
|
||||
import cn.iocoder.yudao.module.tik.muye.memberuserpermission.vo.MemberUserPermissionPageReqVO;
|
||||
import cn.iocoder.yudao.module.tik.muye.memberuserpermission.vo.MemberUserPermissionRespVO;
|
||||
import cn.iocoder.yudao.module.tik.muye.memberuserpermission.vo.MemberUserPermissionSaveReqVO;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
|
||||
import jakarta.validation.constraints.*;
|
||||
import jakarta.validation.*;
|
||||
import jakarta.servlet.http.*;
|
||||
import java.util.*;
|
||||
import java.io.IOException;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
|
||||
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
||||
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
|
||||
|
||||
@Tag(name = "管理后台 - 用户权限")
|
||||
@RestController
|
||||
@RequestMapping("/muye/member-user-permission")
|
||||
@Validated
|
||||
public class MemberUserPermissionController {
|
||||
|
||||
@Resource
|
||||
private MemberUserPermissionService memberUserPermissionService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建用户权限")
|
||||
@PreAuthorize("@ss.hasPermission('muye:member-user-permission:create')")
|
||||
public CommonResult<Long> createMemberUserPermission(@Valid @RequestBody MemberUserPermissionSaveReqVO createReqVO) {
|
||||
return success(memberUserPermissionService.createMemberUserPermission(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新用户权限")
|
||||
@PreAuthorize("@ss.hasPermission('muye:member-user-permission:update')")
|
||||
public CommonResult<Boolean> updateMemberUserPermission(@Valid @RequestBody MemberUserPermissionSaveReqVO updateReqVO) {
|
||||
memberUserPermissionService.updateMemberUserPermission(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除用户权限")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('muye:member-user-permission:delete')")
|
||||
public CommonResult<Boolean> deleteMemberUserPermission(@RequestParam("id") Long id) {
|
||||
memberUserPermissionService.deleteMemberUserPermission(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete-list")
|
||||
@Parameter(name = "ids", description = "编号", required = true)
|
||||
@Operation(summary = "批量删除用户权限")
|
||||
@PreAuthorize("@ss.hasPermission('muye:member-user-permission:delete')")
|
||||
public CommonResult<Boolean> deleteMemberUserPermissionList(@RequestParam("ids") List<Long> ids) {
|
||||
memberUserPermissionService.deleteMemberUserPermissionListByIds(ids);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得用户权限")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('muye:member-user-permission:query')")
|
||||
public CommonResult<MemberUserPermissionRespVO> getMemberUserPermission(@RequestParam("id") Long id) {
|
||||
MemberUserPermissionDO memberUserPermission = memberUserPermissionService.getMemberUserPermission(id);
|
||||
return success(BeanUtils.toBean(memberUserPermission, MemberUserPermissionRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得用户权限分页")
|
||||
@PreAuthorize("@ss.hasPermission('muye:member-user-permission:query')")
|
||||
public CommonResult<PageResult<MemberUserPermissionRespVO>> getMemberUserPermissionPage(@Valid MemberUserPermissionPageReqVO pageReqVO) {
|
||||
PageResult<MemberUserPermissionDO> pageResult = memberUserPermissionService.getMemberUserPermissionPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, MemberUserPermissionRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出用户权限 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('muye:member-user-permission:export')")
|
||||
@ApiAccessLog(operateType = EXPORT)
|
||||
public void exportMemberUserPermissionExcel(@Valid MemberUserPermissionPageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<MemberUserPermissionDO> list = memberUserPermissionService.getMemberUserPermissionPage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "用户权限.xls", "数据", MemberUserPermissionRespVO.class,
|
||||
BeanUtils.toBean(list, MemberUserPermissionRespVO.class));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package cn.iocoder.yudao.module.tik.muye.memberuserpermission.dal;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
|
||||
/**
|
||||
* 用户权限 DO
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@TableName("muye_member_user_permission")
|
||||
@KeySequence("muye_member_user_permission_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class MemberUserPermissionDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 用户编号
|
||||
*/
|
||||
private Long userId;
|
||||
/**
|
||||
* 权限类型
|
||||
*/
|
||||
private String permissionType;
|
||||
/**
|
||||
* 礼包ID
|
||||
*/
|
||||
private Long packageId;
|
||||
/**
|
||||
* 有效期开始时间
|
||||
*/
|
||||
private LocalDateTime validityStart;
|
||||
/**
|
||||
* 有效期结束时间
|
||||
*/
|
||||
private LocalDateTime validityEnd;
|
||||
/**
|
||||
* 状态(0-过期 1-有效)
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package cn.iocoder.yudao.module.tik.muye.memberuserpermission.mapper;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.module.tik.muye.memberuserpermission.dal.MemberUserPermissionDO;
|
||||
import cn.iocoder.yudao.module.tik.muye.memberuserpermission.vo.MemberUserPermissionPageReqVO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
|
||||
/**
|
||||
* 用户权限 Mapper
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Mapper
|
||||
public interface MemberUserPermissionMapper extends BaseMapperX<MemberUserPermissionDO> {
|
||||
|
||||
default PageResult<MemberUserPermissionDO> selectPage(MemberUserPermissionPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<MemberUserPermissionDO>()
|
||||
.eqIfPresent(MemberUserPermissionDO::getUserId, reqVO.getUserId())
|
||||
.eqIfPresent(MemberUserPermissionDO::getPermissionType, reqVO.getPermissionType())
|
||||
.eqIfPresent(MemberUserPermissionDO::getPackageId, reqVO.getPackageId())
|
||||
.eqIfPresent(MemberUserPermissionDO::getValidityStart, reqVO.getValidityStart())
|
||||
.eqIfPresent(MemberUserPermissionDO::getValidityEnd, reqVO.getValidityEnd())
|
||||
.eqIfPresent(MemberUserPermissionDO::getStatus, reqVO.getStatus())
|
||||
.betweenIfPresent(MemberUserPermissionDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(MemberUserPermissionDO::getId));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package cn.iocoder.yudao.module.tik.muye.memberuserpermission.service;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import cn.iocoder.yudao.module.tik.muye.memberuserpermission.dal.MemberUserPermissionDO;
|
||||
import cn.iocoder.yudao.module.tik.muye.memberuserpermission.vo.MemberUserPermissionPageReqVO;
|
||||
import cn.iocoder.yudao.module.tik.muye.memberuserpermission.vo.MemberUserPermissionSaveReqVO;
|
||||
import jakarta.validation.*;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
|
||||
/**
|
||||
* 用户权限 Service 接口
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
public interface MemberUserPermissionService {
|
||||
|
||||
/**
|
||||
* 创建用户权限
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createMemberUserPermission(@Valid MemberUserPermissionSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新用户权限
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateMemberUserPermission(@Valid MemberUserPermissionSaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除用户权限
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteMemberUserPermission(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除用户权限
|
||||
*
|
||||
* @param ids 编号
|
||||
*/
|
||||
void deleteMemberUserPermissionListByIds(List<Long> ids);
|
||||
|
||||
/**
|
||||
* 获得用户权限
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 用户权限
|
||||
*/
|
||||
MemberUserPermissionDO getMemberUserPermission(Long id);
|
||||
|
||||
/**
|
||||
* 获得用户权限分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 用户权限分页
|
||||
*/
|
||||
PageResult<MemberUserPermissionDO> getMemberUserPermissionPage(MemberUserPermissionPageReqVO pageReqVO);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
package cn.iocoder.yudao.module.tik.muye.memberuserpermission.service;
|
||||
|
||||
|
||||
import cn.iocoder.yudao.framework.common.exception.ErrorCode;
|
||||
import cn.iocoder.yudao.module.tik.muye.memberuserpermission.dal.MemberUserPermissionDO;
|
||||
import cn.iocoder.yudao.module.tik.muye.memberuserpermission.mapper.MemberUserPermissionMapper;
|
||||
import cn.iocoder.yudao.module.tik.muye.memberuserpermission.vo.MemberUserPermissionPageReqVO;
|
||||
import cn.iocoder.yudao.module.tik.muye.memberuserpermission.vo.MemberUserPermissionSaveReqVO;
|
||||
import org.springframework.stereotype.Service;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
|
||||
import java.util.*;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
|
||||
/**
|
||||
* 用户权限 Service 实现类
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class MemberUserPermissionServiceImpl implements MemberUserPermissionService {
|
||||
|
||||
@Resource
|
||||
private MemberUserPermissionMapper memberUserPermissionMapper;
|
||||
|
||||
@Override
|
||||
public Long createMemberUserPermission(MemberUserPermissionSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
MemberUserPermissionDO memberUserPermission = BeanUtils.toBean(createReqVO, MemberUserPermissionDO.class);
|
||||
memberUserPermissionMapper.insert(memberUserPermission);
|
||||
|
||||
// 返回
|
||||
return memberUserPermission.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateMemberUserPermission(MemberUserPermissionSaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateMemberUserPermissionExists(updateReqVO.getId());
|
||||
// 更新
|
||||
MemberUserPermissionDO updateObj = BeanUtils.toBean(updateReqVO, MemberUserPermissionDO.class);
|
||||
memberUserPermissionMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteMemberUserPermission(Long id) {
|
||||
// 校验存在
|
||||
validateMemberUserPermissionExists(id);
|
||||
// 删除
|
||||
memberUserPermissionMapper.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteMemberUserPermissionListByIds(List<Long> ids) {
|
||||
// 删除
|
||||
memberUserPermissionMapper.deleteByIds(ids);
|
||||
}
|
||||
|
||||
|
||||
private void validateMemberUserPermissionExists(Long id) {
|
||||
if (memberUserPermissionMapper.selectById(id) == null) {
|
||||
throw exception(new ErrorCode(1004, "用户权限不存在"));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public MemberUserPermissionDO getMemberUserPermission(Long id) {
|
||||
return memberUserPermissionMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<MemberUserPermissionDO> getMemberUserPermissionPage(MemberUserPermissionPageReqVO pageReqVO) {
|
||||
return memberUserPermissionMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package cn.iocoder.yudao.module.tik.muye.memberuserpermission.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 用户权限分页 Request VO")
|
||||
@Data
|
||||
public class MemberUserPermissionPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "用户编号", example = "5461")
|
||||
private Long userId;
|
||||
|
||||
@Schema(description = "权限类型", example = "2")
|
||||
private String permissionType;
|
||||
|
||||
@Schema(description = "礼包ID", example = "5404")
|
||||
private Long packageId;
|
||||
|
||||
@Schema(description = "有效期开始时间")
|
||||
private LocalDateTime validityStart;
|
||||
|
||||
@Schema(description = "有效期结束时间")
|
||||
private LocalDateTime validityEnd;
|
||||
|
||||
@Schema(description = "状态(0-过期 1-有效)", example = "1")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package cn.iocoder.yudao.module.tik.muye.memberuserpermission.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
import cn.idev.excel.annotation.*;
|
||||
|
||||
@Schema(description = "管理后台 - 用户权限 Response VO")
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class MemberUserPermissionRespVO {
|
||||
|
||||
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "30385")
|
||||
@ExcelProperty("主键")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "5461")
|
||||
@ExcelProperty("用户编号")
|
||||
private Long userId;
|
||||
|
||||
@Schema(description = "权限类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||
@ExcelProperty("权限类型")
|
||||
private String permissionType;
|
||||
|
||||
@Schema(description = "礼包ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "5404")
|
||||
@ExcelProperty("礼包ID")
|
||||
private Long packageId;
|
||||
|
||||
@Schema(description = "有效期开始时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("有效期开始时间")
|
||||
private LocalDateTime validityStart;
|
||||
|
||||
@Schema(description = "有效期结束时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("有效期结束时间")
|
||||
private LocalDateTime validityEnd;
|
||||
|
||||
@Schema(description = "状态(0-过期 1-有效)", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@ExcelProperty("状态(0-过期 1-有效)")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package cn.iocoder.yudao.module.tik.muye.memberuserpermission.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import jakarta.validation.constraints.*;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description = "管理后台 - 用户权限新增/修改 Request VO")
|
||||
@Data
|
||||
public class MemberUserPermissionSaveReqVO {
|
||||
|
||||
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "30385")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "5461")
|
||||
@NotNull(message = "用户编号不能为空")
|
||||
private Long userId;
|
||||
|
||||
@Schema(description = "权限类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||
@NotEmpty(message = "权限类型不能为空")
|
||||
private String permissionType;
|
||||
|
||||
@Schema(description = "礼包ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "5404")
|
||||
@NotNull(message = "礼包ID不能为空")
|
||||
private Long packageId;
|
||||
|
||||
@Schema(description = "有效期开始时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "有效期开始时间不能为空")
|
||||
private LocalDateTime validityStart;
|
||||
|
||||
@Schema(description = "有效期结束时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "有效期结束时间不能为空")
|
||||
private LocalDateTime validityEnd;
|
||||
|
||||
@Schema(description = "状态(0-过期 1-有效)", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@NotNull(message = "状态(0-过期 1-有效)不能为空")
|
||||
private Integer status;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
package cn.iocoder.yudao.module.tik.muye.memberuserprofile;
|
||||
|
||||
import cn.iocoder.yudao.module.tik.muye.memberuserprofile.dal.MemberUserProfileDO;
|
||||
import cn.iocoder.yudao.module.tik.muye.memberuserprofile.service.MemberUserProfileService;
|
||||
import cn.iocoder.yudao.module.tik.muye.memberuserprofile.vo.MemberUserProfilePageReqVO;
|
||||
import cn.iocoder.yudao.module.tik.muye.memberuserprofile.vo.MemberUserProfileRespVO;
|
||||
import cn.iocoder.yudao.module.tik.muye.memberuserprofile.vo.MemberUserProfileSaveReqVO;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
|
||||
import jakarta.validation.constraints.*;
|
||||
import jakarta.validation.*;
|
||||
import jakarta.servlet.http.*;
|
||||
import java.util.*;
|
||||
import java.io.IOException;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
|
||||
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
||||
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
|
||||
|
||||
|
||||
@Tag(name = "管理后台 - 会员用户档案")
|
||||
@RestController
|
||||
@RequestMapping("/muye/member-user-profile")
|
||||
@Validated
|
||||
public class MemberUserProfileController {
|
||||
|
||||
@Resource
|
||||
private MemberUserProfileService memberUserProfileService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建会员用户档案")
|
||||
@PreAuthorize("@ss.hasPermission('muye:member-user-profile:create')")
|
||||
public CommonResult<Long> createMemberUserProfile(@Valid @RequestBody MemberUserProfileSaveReqVO createReqVO) {
|
||||
return success(memberUserProfileService.createMemberUserProfile(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新会员用户档案")
|
||||
@PreAuthorize("@ss.hasPermission('muye:member-user-profile:update')")
|
||||
public CommonResult<Boolean> updateMemberUserProfile(@Valid @RequestBody MemberUserProfileSaveReqVO updateReqVO) {
|
||||
memberUserProfileService.updateMemberUserProfile(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除会员用户档案")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('muye:member-user-profile:delete')")
|
||||
public CommonResult<Boolean> deleteMemberUserProfile(@RequestParam("id") Long id) {
|
||||
memberUserProfileService.deleteMemberUserProfile(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete-list")
|
||||
@Parameter(name = "ids", description = "编号", required = true)
|
||||
@Operation(summary = "批量删除会员用户档案")
|
||||
@PreAuthorize("@ss.hasPermission('muye:member-user-profile:delete')")
|
||||
public CommonResult<Boolean> deleteMemberUserProfileList(@RequestParam("ids") List<Long> ids) {
|
||||
memberUserProfileService.deleteMemberUserProfileListByIds(ids);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得会员用户档案")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('muye:member-user-profile:query')")
|
||||
public CommonResult<MemberUserProfileRespVO> getMemberUserProfile(@RequestParam("id") Long id) {
|
||||
MemberUserProfileDO memberUserProfile = memberUserProfileService.getMemberUserProfile(id);
|
||||
return success(BeanUtils.toBean(memberUserProfile, MemberUserProfileRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得会员用户档案分页")
|
||||
@PreAuthorize("@ss.hasPermission('muye:member-user-profile:query')")
|
||||
public CommonResult<PageResult<MemberUserProfileRespVO>> getMemberUserProfilePage(@Valid MemberUserProfilePageReqVO pageReqVO) {
|
||||
PageResult<MemberUserProfileDO> pageResult = memberUserProfileService.getMemberUserProfilePage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, MemberUserProfileRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出会员用户档案 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('muye:member-user-profile:export')")
|
||||
@ApiAccessLog(operateType = EXPORT)
|
||||
public void exportMemberUserProfileExcel(@Valid MemberUserProfilePageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<MemberUserProfileDO> list = memberUserProfileService.getMemberUserProfilePage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "会员用户档案.xls", "数据", MemberUserProfileRespVO.class,
|
||||
BeanUtils.toBean(list, MemberUserProfileRespVO.class));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
package cn.iocoder.yudao.module.tik.muye.memberuserprofile.dal;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
|
||||
/**
|
||||
* 会员用户档案 DO
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@TableName("muye_member_user_profile")
|
||||
@KeySequence("muye_member_user_profile_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class MemberUserProfileDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
private String userId;
|
||||
/**
|
||||
* 手机号
|
||||
*/
|
||||
private String mobile;
|
||||
/**
|
||||
* 注册时间
|
||||
*/
|
||||
private LocalDateTime registerTime;
|
||||
/**
|
||||
* 最后登录时间
|
||||
*/
|
||||
private LocalDateTime lastLoginTime;
|
||||
/**
|
||||
* 账户总积分
|
||||
*/
|
||||
private Integer totalPoints;
|
||||
/**
|
||||
* 账户消耗积分
|
||||
*/
|
||||
private Integer usedPoints;
|
||||
/**
|
||||
* 账户剩余积分
|
||||
*/
|
||||
private Integer remainingPoints;
|
||||
/**
|
||||
* 云空间总容量(GB)
|
||||
*/
|
||||
private BigDecimal totalStorage;
|
||||
/**
|
||||
* 云空间已用容量(GB)
|
||||
*/
|
||||
private BigDecimal usedStorage;
|
||||
/**
|
||||
* 云空间剩余容量(GB)
|
||||
*/
|
||||
private BigDecimal remainingStorage;
|
||||
/**
|
||||
* 总充值金额
|
||||
*/
|
||||
private BigDecimal totalRecharge;
|
||||
/**
|
||||
* 状态(0-禁用 1-启用)
|
||||
*/
|
||||
private Integer status;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package cn.iocoder.yudao.module.tik.muye.memberuserprofile.mapper;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.module.tik.muye.memberuserprofile.dal.MemberUserProfileDO;
|
||||
import cn.iocoder.yudao.module.tik.muye.memberuserprofile.vo.MemberUserProfilePageReqVO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 会员用户档案 Mapper
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Mapper
|
||||
public interface MemberUserProfileMapper extends BaseMapperX<MemberUserProfileDO> {
|
||||
|
||||
default PageResult<MemberUserProfileDO> selectPage(MemberUserProfilePageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<MemberUserProfileDO>()
|
||||
.eqIfPresent(MemberUserProfileDO::getUserId, reqVO.getUserId())
|
||||
.eqIfPresent(MemberUserProfileDO::getMobile, reqVO.getMobile())
|
||||
.betweenIfPresent(MemberUserProfileDO::getRegisterTime, reqVO.getRegisterTime())
|
||||
.betweenIfPresent(MemberUserProfileDO::getLastLoginTime, reqVO.getLastLoginTime())
|
||||
.eqIfPresent(MemberUserProfileDO::getTotalPoints, reqVO.getTotalPoints())
|
||||
.eqIfPresent(MemberUserProfileDO::getUsedPoints, reqVO.getUsedPoints())
|
||||
.eqIfPresent(MemberUserProfileDO::getRemainingPoints, reqVO.getRemainingPoints())
|
||||
.eqIfPresent(MemberUserProfileDO::getTotalStorage, reqVO.getTotalStorage())
|
||||
.eqIfPresent(MemberUserProfileDO::getUsedStorage, reqVO.getUsedStorage())
|
||||
.eqIfPresent(MemberUserProfileDO::getRemainingStorage, reqVO.getRemainingStorage())
|
||||
.eqIfPresent(MemberUserProfileDO::getTotalRecharge, reqVO.getTotalRecharge())
|
||||
.eqIfPresent(MemberUserProfileDO::getStatus, reqVO.getStatus())
|
||||
.eqIfPresent(MemberUserProfileDO::getRemark, reqVO.getRemark())
|
||||
.betweenIfPresent(MemberUserProfileDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(MemberUserProfileDO::getId));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package cn.iocoder.yudao.module.tik.muye.memberuserprofile.service;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import cn.iocoder.yudao.module.tik.muye.memberuserprofile.dal.MemberUserProfileDO;
|
||||
import cn.iocoder.yudao.module.tik.muye.memberuserprofile.vo.MemberUserProfilePageReqVO;
|
||||
import cn.iocoder.yudao.module.tik.muye.memberuserprofile.vo.MemberUserProfileSaveReqVO;
|
||||
import jakarta.validation.*;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
|
||||
/**
|
||||
* 会员用户档案 Service 接口
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
public interface MemberUserProfileService {
|
||||
|
||||
/**
|
||||
* 创建会员用户档案
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createMemberUserProfile(@Valid MemberUserProfileSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新会员用户档案
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateMemberUserProfile(@Valid MemberUserProfileSaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除会员用户档案
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteMemberUserProfile(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除会员用户档案
|
||||
*
|
||||
* @param ids 编号
|
||||
*/
|
||||
void deleteMemberUserProfileListByIds(List<Long> ids);
|
||||
|
||||
/**
|
||||
* 获得会员用户档案
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 会员用户档案
|
||||
*/
|
||||
MemberUserProfileDO getMemberUserProfile(Long id);
|
||||
|
||||
/**
|
||||
* 获得会员用户档案分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 会员用户档案分页
|
||||
*/
|
||||
PageResult<MemberUserProfileDO> getMemberUserProfilePage(MemberUserProfilePageReqVO pageReqVO);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
package cn.iocoder.yudao.module.tik.muye.memberuserprofile.service;
|
||||
|
||||
|
||||
import cn.iocoder.yudao.framework.common.exception.ErrorCode;
|
||||
import cn.iocoder.yudao.module.tik.muye.memberuserprofile.dal.MemberUserProfileDO;
|
||||
import cn.iocoder.yudao.module.tik.muye.memberuserprofile.mapper.MemberUserProfileMapper;
|
||||
import cn.iocoder.yudao.module.tik.muye.memberuserprofile.vo.MemberUserProfilePageReqVO;
|
||||
import cn.iocoder.yudao.module.tik.muye.memberuserprofile.vo.MemberUserProfileSaveReqVO;
|
||||
import org.springframework.stereotype.Service;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import java.util.*;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
|
||||
/**
|
||||
* 会员用户档案 Service 实现类
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class MemberUserProfileServiceImpl implements MemberUserProfileService {
|
||||
|
||||
@Resource
|
||||
private MemberUserProfileMapper memberUserProfileMapper;
|
||||
|
||||
@Override
|
||||
public Long createMemberUserProfile(MemberUserProfileSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
MemberUserProfileDO memberUserProfile = BeanUtils.toBean(createReqVO, MemberUserProfileDO.class);
|
||||
memberUserProfileMapper.insert(memberUserProfile);
|
||||
|
||||
// 返回
|
||||
return memberUserProfile.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateMemberUserProfile(MemberUserProfileSaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateMemberUserProfileExists(updateReqVO.getId());
|
||||
// 更新
|
||||
MemberUserProfileDO updateObj = BeanUtils.toBean(updateReqVO, MemberUserProfileDO.class);
|
||||
memberUserProfileMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteMemberUserProfile(Long id) {
|
||||
// 校验存在
|
||||
validateMemberUserProfileExists(id);
|
||||
// 删除
|
||||
memberUserProfileMapper.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteMemberUserProfileListByIds(List<Long> ids) {
|
||||
// 删除
|
||||
memberUserProfileMapper.deleteByIds(ids);
|
||||
}
|
||||
|
||||
|
||||
private void validateMemberUserProfileExists(Long id) {
|
||||
if (memberUserProfileMapper.selectById(id) == null) {
|
||||
throw exception(new ErrorCode(1004, "会员用户档案不存在"));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public MemberUserProfileDO getMemberUserProfile(Long id) {
|
||||
return memberUserProfileMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<MemberUserProfileDO> getMemberUserProfilePage(MemberUserProfilePageReqVO pageReqVO) {
|
||||
return memberUserProfileMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package cn.iocoder.yudao.module.tik.muye.memberuserprofile.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import java.math.BigDecimal;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 会员用户档案分页 Request VO")
|
||||
@Data
|
||||
public class MemberUserProfilePageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "用户ID", example = "25766")
|
||||
private String userId;
|
||||
|
||||
@Schema(description = "手机号")
|
||||
private String mobile;
|
||||
|
||||
@Schema(description = "注册时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] registerTime;
|
||||
|
||||
@Schema(description = "最后登录时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] lastLoginTime;
|
||||
|
||||
@Schema(description = "账户总积分")
|
||||
private Integer totalPoints;
|
||||
|
||||
@Schema(description = "账户消耗积分")
|
||||
private Integer usedPoints;
|
||||
|
||||
@Schema(description = "账户剩余积分")
|
||||
private Integer remainingPoints;
|
||||
|
||||
@Schema(description = "云空间总容量(GB)")
|
||||
private BigDecimal totalStorage;
|
||||
|
||||
@Schema(description = "云空间已用容量(GB)")
|
||||
private BigDecimal usedStorage;
|
||||
|
||||
@Schema(description = "云空间剩余容量(GB)")
|
||||
private BigDecimal remainingStorage;
|
||||
|
||||
@Schema(description = "总充值金额")
|
||||
private BigDecimal totalRecharge;
|
||||
|
||||
@Schema(description = "状态(0-禁用 1-启用)", example = "1")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "备注", example = "你说的对")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
package cn.iocoder.yudao.module.tik.muye.memberuserprofile.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.math.BigDecimal;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
import cn.idev.excel.annotation.*;
|
||||
|
||||
@Schema(description = "管理后台 - 会员用户档案 Response VO")
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class MemberUserProfileRespVO {
|
||||
|
||||
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "23028")
|
||||
@ExcelProperty("主键")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "用户ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "25766")
|
||||
@ExcelProperty("用户ID")
|
||||
private String userId;
|
||||
|
||||
@Schema(description = "手机号", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("手机号")
|
||||
private String mobile;
|
||||
|
||||
@Schema(description = "注册时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("注册时间")
|
||||
private LocalDateTime registerTime;
|
||||
|
||||
@Schema(description = "最后登录时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("最后登录时间")
|
||||
private LocalDateTime lastLoginTime;
|
||||
|
||||
@Schema(description = "账户总积分", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("账户总积分")
|
||||
private Integer totalPoints;
|
||||
|
||||
@Schema(description = "账户消耗积分", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("账户消耗积分")
|
||||
private Integer usedPoints;
|
||||
|
||||
@Schema(description = "账户剩余积分", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("账户剩余积分")
|
||||
private Integer remainingPoints;
|
||||
|
||||
@Schema(description = "云空间总容量(GB)", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("云空间总容量(GB)")
|
||||
private BigDecimal totalStorage;
|
||||
|
||||
@Schema(description = "云空间已用容量(GB)", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("云空间已用容量(GB)")
|
||||
private BigDecimal usedStorage;
|
||||
|
||||
@Schema(description = "云空间剩余容量(GB)", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("云空间剩余容量(GB)")
|
||||
private BigDecimal remainingStorage;
|
||||
|
||||
@Schema(description = "总充值金额", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("总充值金额")
|
||||
private BigDecimal totalRecharge;
|
||||
|
||||
@Schema(description = "状态(0-禁用 1-启用)", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@ExcelProperty("状态(0-禁用 1-启用)")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED, example = "你说的对")
|
||||
@ExcelProperty("备注")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
package cn.iocoder.yudao.module.tik.muye.memberuserprofile.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import jakarta.validation.constraints.*;
|
||||
import java.math.BigDecimal;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Schema(description = "管理后台 - 会员用户档案新增/修改 Request VO")
|
||||
@Data
|
||||
public class MemberUserProfileSaveReqVO {
|
||||
|
||||
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "23028")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "用户ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "25766")
|
||||
@NotEmpty(message = "用户ID不能为空")
|
||||
private String userId;
|
||||
|
||||
@Schema(description = "手机号", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "手机号不能为空")
|
||||
private String mobile;
|
||||
|
||||
@Schema(description = "注册时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "注册时间不能为空")
|
||||
private LocalDateTime registerTime;
|
||||
|
||||
@Schema(description = "最后登录时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "最后登录时间不能为空")
|
||||
private LocalDateTime lastLoginTime;
|
||||
|
||||
@Schema(description = "账户总积分", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "账户总积分不能为空")
|
||||
private Integer totalPoints;
|
||||
|
||||
@Schema(description = "账户消耗积分", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "账户消耗积分不能为空")
|
||||
private Integer usedPoints;
|
||||
|
||||
@Schema(description = "账户剩余积分", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "账户剩余积分不能为空")
|
||||
private Integer remainingPoints;
|
||||
|
||||
@Schema(description = "云空间总容量(GB)", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "云空间总容量(GB)不能为空")
|
||||
private BigDecimal totalStorage;
|
||||
|
||||
@Schema(description = "云空间已用容量(GB)", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "云空间已用容量(GB)不能为空")
|
||||
private BigDecimal usedStorage;
|
||||
|
||||
@Schema(description = "云空间剩余容量(GB)", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "云空间剩余容量(GB)不能为空")
|
||||
private BigDecimal remainingStorage;
|
||||
|
||||
@Schema(description = "总充值金额", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "总充值金额不能为空")
|
||||
private BigDecimal totalRecharge;
|
||||
|
||||
@Schema(description = "状态(0-禁用 1-启用)", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@NotNull(message = "状态(0-禁用 1-启用)不能为空")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED, example = "你说的对")
|
||||
@NotEmpty(message = "备注不能为空")
|
||||
private String remark;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
package cn.iocoder.yudao.module.tik.muye.pointexchangeconfig;
|
||||
|
||||
import cn.iocoder.yudao.module.tik.muye.pointexchangeconfig.dal.PointExchangeConfigDO;
|
||||
import cn.iocoder.yudao.module.tik.muye.pointexchangeconfig.service.PointExchangeConfigService;
|
||||
import cn.iocoder.yudao.module.tik.muye.pointexchangeconfig.vo.PointExchangeConfigPageReqVO;
|
||||
import cn.iocoder.yudao.module.tik.muye.pointexchangeconfig.vo.PointExchangeConfigRespVO;
|
||||
import cn.iocoder.yudao.module.tik.muye.pointexchangeconfig.vo.PointExchangeConfigSaveReqVO;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
|
||||
import jakarta.validation.constraints.*;
|
||||
import jakarta.validation.*;
|
||||
import jakarta.servlet.http.*;
|
||||
import java.util.*;
|
||||
import java.io.IOException;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
|
||||
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
||||
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
|
||||
|
||||
@Tag(name = "管理后台 - 积分兑换配置")
|
||||
@RestController
|
||||
@RequestMapping("/muye/point-exchange-config")
|
||||
@Validated
|
||||
public class PointExchangeConfigController {
|
||||
|
||||
@Resource
|
||||
private PointExchangeConfigService pointExchangeConfigService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建积分兑换配置")
|
||||
@PreAuthorize("@ss.hasPermission('muye:point-exchange-config:create')")
|
||||
public CommonResult<Long> createPointExchangeConfig(@Valid @RequestBody PointExchangeConfigSaveReqVO createReqVO) {
|
||||
return success(pointExchangeConfigService.createPointExchangeConfig(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新积分兑换配置")
|
||||
@PreAuthorize("@ss.hasPermission('muye:point-exchange-config:update')")
|
||||
public CommonResult<Boolean> updatePointExchangeConfig(@Valid @RequestBody PointExchangeConfigSaveReqVO updateReqVO) {
|
||||
pointExchangeConfigService.updatePointExchangeConfig(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除积分兑换配置")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('muye:point-exchange-config:delete')")
|
||||
public CommonResult<Boolean> deletePointExchangeConfig(@RequestParam("id") Long id) {
|
||||
pointExchangeConfigService.deletePointExchangeConfig(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete-list")
|
||||
@Parameter(name = "ids", description = "编号", required = true)
|
||||
@Operation(summary = "批量删除积分兑换配置")
|
||||
@PreAuthorize("@ss.hasPermission('muye:point-exchange-config:delete')")
|
||||
public CommonResult<Boolean> deletePointExchangeConfigList(@RequestParam("ids") List<Long> ids) {
|
||||
pointExchangeConfigService.deletePointExchangeConfigListByIds(ids);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得积分兑换配置")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('muye:point-exchange-config:query')")
|
||||
public CommonResult<PointExchangeConfigRespVO> getPointExchangeConfig(@RequestParam("id") Long id) {
|
||||
PointExchangeConfigDO pointExchangeConfig = pointExchangeConfigService.getPointExchangeConfig(id);
|
||||
return success(BeanUtils.toBean(pointExchangeConfig, PointExchangeConfigRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得积分兑换配置分页")
|
||||
@PreAuthorize("@ss.hasPermission('muye:point-exchange-config:query')")
|
||||
public CommonResult<PageResult<PointExchangeConfigRespVO>> getPointExchangeConfigPage(@Valid PointExchangeConfigPageReqVO pageReqVO) {
|
||||
PageResult<PointExchangeConfigDO> pageResult = pointExchangeConfigService.getPointExchangeConfigPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, PointExchangeConfigRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出积分兑换配置 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('muye:point-exchange-config:export')")
|
||||
@ApiAccessLog(operateType = EXPORT)
|
||||
public void exportPointExchangeConfigExcel(@Valid PointExchangeConfigPageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<PointExchangeConfigDO> list = pointExchangeConfigService.getPointExchangeConfigPage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "积分兑换配置.xls", "数据", PointExchangeConfigRespVO.class,
|
||||
BeanUtils.toBean(list, PointExchangeConfigRespVO.class));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package cn.iocoder.yudao.module.tik.muye.pointexchangeconfig.dal;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
|
||||
/**
|
||||
* 积分兑换配置 DO
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@TableName("muye_point_exchange_config")
|
||||
@KeySequence("muye_point_exchange_config_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class PointExchangeConfigDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 兑换比例(1元兑换多少积分)
|
||||
*/
|
||||
private Integer exchangeRate;
|
||||
/**
|
||||
* 调整原因
|
||||
*/
|
||||
private String adjustReason;
|
||||
/**
|
||||
* 操作人用户编号
|
||||
*/
|
||||
private Long operatorId;
|
||||
/**
|
||||
* 操作人账号
|
||||
*/
|
||||
private String operatorName;
|
||||
/**
|
||||
* 状态(0-禁用 1-启用)
|
||||
*/
|
||||
private Integer status;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package cn.iocoder.yudao.module.tik.muye.pointexchangeconfig.mapper;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.module.tik.muye.pointexchangeconfig.dal.PointExchangeConfigDO;
|
||||
import cn.iocoder.yudao.module.tik.muye.pointexchangeconfig.vo.PointExchangeConfigPageReqVO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 积分兑换配置 Mapper
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Mapper
|
||||
public interface PointExchangeConfigMapper extends BaseMapperX<PointExchangeConfigDO> {
|
||||
|
||||
default PageResult<PointExchangeConfigDO> selectPage(PointExchangeConfigPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<PointExchangeConfigDO>()
|
||||
.eqIfPresent(PointExchangeConfigDO::getExchangeRate, reqVO.getExchangeRate())
|
||||
.eqIfPresent(PointExchangeConfigDO::getAdjustReason, reqVO.getAdjustReason())
|
||||
.eqIfPresent(PointExchangeConfigDO::getOperatorId, reqVO.getOperatorId())
|
||||
.likeIfPresent(PointExchangeConfigDO::getOperatorName, reqVO.getOperatorName())
|
||||
.eqIfPresent(PointExchangeConfigDO::getStatus, reqVO.getStatus())
|
||||
.eqIfPresent(PointExchangeConfigDO::getRemark, reqVO.getRemark())
|
||||
.betweenIfPresent(PointExchangeConfigDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(PointExchangeConfigDO::getId));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package cn.iocoder.yudao.module.tik.muye.pointexchangeconfig.service;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import cn.iocoder.yudao.module.tik.muye.pointexchangeconfig.dal.PointExchangeConfigDO;
|
||||
import cn.iocoder.yudao.module.tik.muye.pointexchangeconfig.vo.PointExchangeConfigPageReqVO;
|
||||
import cn.iocoder.yudao.module.tik.muye.pointexchangeconfig.vo.PointExchangeConfigSaveReqVO;
|
||||
import jakarta.validation.*;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
|
||||
|
||||
/**
|
||||
* 积分兑换配置 Service 接口
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
public interface PointExchangeConfigService {
|
||||
|
||||
/**
|
||||
* 创建积分兑换配置
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createPointExchangeConfig(@Valid PointExchangeConfigSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新积分兑换配置
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updatePointExchangeConfig(@Valid PointExchangeConfigSaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除积分兑换配置
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deletePointExchangeConfig(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除积分兑换配置
|
||||
*
|
||||
* @param ids 编号
|
||||
*/
|
||||
void deletePointExchangeConfigListByIds(List<Long> ids);
|
||||
|
||||
/**
|
||||
* 获得积分兑换配置
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 积分兑换配置
|
||||
*/
|
||||
PointExchangeConfigDO getPointExchangeConfig(Long id);
|
||||
|
||||
/**
|
||||
* 获得积分兑换配置分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 积分兑换配置分页
|
||||
*/
|
||||
PageResult<PointExchangeConfigDO> getPointExchangeConfigPage(PointExchangeConfigPageReqVO pageReqVO);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
package cn.iocoder.yudao.module.tik.muye.pointexchangeconfig.service;
|
||||
|
||||
|
||||
import cn.iocoder.yudao.framework.common.exception.ErrorCode;
|
||||
import cn.iocoder.yudao.module.tik.muye.pointexchangeconfig.dal.PointExchangeConfigDO;
|
||||
import cn.iocoder.yudao.module.tik.muye.pointexchangeconfig.mapper.PointExchangeConfigMapper;
|
||||
import cn.iocoder.yudao.module.tik.muye.pointexchangeconfig.vo.PointExchangeConfigPageReqVO;
|
||||
import cn.iocoder.yudao.module.tik.muye.pointexchangeconfig.vo.PointExchangeConfigSaveReqVO;
|
||||
import org.springframework.stereotype.Service;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
|
||||
import java.util.*;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
|
||||
|
||||
/**
|
||||
* 积分兑换配置 Service 实现类
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class PointExchangeConfigServiceImpl implements PointExchangeConfigService {
|
||||
|
||||
@Resource
|
||||
private PointExchangeConfigMapper pointExchangeConfigMapper;
|
||||
|
||||
@Override
|
||||
public Long createPointExchangeConfig(PointExchangeConfigSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
PointExchangeConfigDO pointExchangeConfig = BeanUtils.toBean(createReqVO, PointExchangeConfigDO.class);
|
||||
pointExchangeConfigMapper.insert(pointExchangeConfig);
|
||||
|
||||
// 返回
|
||||
return pointExchangeConfig.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updatePointExchangeConfig(PointExchangeConfigSaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validatePointExchangeConfigExists(updateReqVO.getId());
|
||||
// 更新
|
||||
PointExchangeConfigDO updateObj = BeanUtils.toBean(updateReqVO, PointExchangeConfigDO.class);
|
||||
pointExchangeConfigMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deletePointExchangeConfig(Long id) {
|
||||
// 校验存在
|
||||
validatePointExchangeConfigExists(id);
|
||||
// 删除
|
||||
pointExchangeConfigMapper.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deletePointExchangeConfigListByIds(List<Long> ids) {
|
||||
// 删除
|
||||
pointExchangeConfigMapper.deleteByIds(ids);
|
||||
}
|
||||
|
||||
|
||||
private void validatePointExchangeConfigExists(Long id) {
|
||||
if (pointExchangeConfigMapper.selectById(id) == null) {
|
||||
throw exception(new ErrorCode(1004, "积分兑换配置不存在"));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public PointExchangeConfigDO getPointExchangeConfig(Long id) {
|
||||
return pointExchangeConfigMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<PointExchangeConfigDO> getPointExchangeConfigPage(PointExchangeConfigPageReqVO pageReqVO) {
|
||||
return pointExchangeConfigMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package cn.iocoder.yudao.module.tik.muye.pointexchangeconfig.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 积分兑换配置分页 Request VO")
|
||||
@Data
|
||||
public class PointExchangeConfigPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "兑换比例(1元兑换多少积分)")
|
||||
private Integer exchangeRate;
|
||||
|
||||
@Schema(description = "调整原因", example = "不对")
|
||||
private String adjustReason;
|
||||
|
||||
@Schema(description = "操作人用户编号", example = "31386")
|
||||
private Long operatorId;
|
||||
|
||||
@Schema(description = "操作人账号", example = "赵六")
|
||||
private String operatorName;
|
||||
|
||||
@Schema(description = "状态(0-禁用 1-启用)", example = "2")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "备注", example = "你猜")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package cn.iocoder.yudao.module.tik.muye.pointexchangeconfig.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
import cn.idev.excel.annotation.*;
|
||||
|
||||
@Schema(description = "管理后台 - 积分兑换配置 Response VO")
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class PointExchangeConfigRespVO {
|
||||
|
||||
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "2453")
|
||||
@ExcelProperty("主键")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "兑换比例(1元兑换多少积分)", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("兑换比例(1元兑换多少积分)")
|
||||
private Integer exchangeRate;
|
||||
|
||||
@Schema(description = "调整原因", requiredMode = Schema.RequiredMode.REQUIRED, example = "不对")
|
||||
@ExcelProperty("调整原因")
|
||||
private String adjustReason;
|
||||
|
||||
@Schema(description = "操作人用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "31386")
|
||||
@ExcelProperty("操作人用户编号")
|
||||
private Long operatorId;
|
||||
|
||||
@Schema(description = "操作人账号", requiredMode = Schema.RequiredMode.REQUIRED, example = "赵六")
|
||||
@ExcelProperty("操作人账号")
|
||||
private String operatorName;
|
||||
|
||||
@Schema(description = "状态(0-禁用 1-启用)", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||
@ExcelProperty("状态(0-禁用 1-启用)")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED, example = "你猜")
|
||||
@ExcelProperty("备注")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package cn.iocoder.yudao.module.tik.muye.pointexchangeconfig.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import jakarta.validation.constraints.*;
|
||||
|
||||
@Schema(description = "管理后台 - 积分兑换配置新增/修改 Request VO")
|
||||
@Data
|
||||
public class PointExchangeConfigSaveReqVO {
|
||||
|
||||
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "2453")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "兑换比例(1元兑换多少积分)", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "兑换比例(1元兑换多少积分)不能为空")
|
||||
private Integer exchangeRate;
|
||||
|
||||
@Schema(description = "调整原因", requiredMode = Schema.RequiredMode.REQUIRED, example = "不对")
|
||||
@NotEmpty(message = "调整原因不能为空")
|
||||
private String adjustReason;
|
||||
|
||||
@Schema(description = "操作人用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "31386")
|
||||
@NotNull(message = "操作人用户编号不能为空")
|
||||
private Long operatorId;
|
||||
|
||||
@Schema(description = "操作人账号", requiredMode = Schema.RequiredMode.REQUIRED, example = "赵六")
|
||||
@NotEmpty(message = "操作人账号不能为空")
|
||||
private String operatorName;
|
||||
|
||||
@Schema(description = "状态(0-禁用 1-启用)", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||
@NotNull(message = "状态(0-禁用 1-启用)不能为空")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED, example = "你猜")
|
||||
@NotEmpty(message = "备注不能为空")
|
||||
private String remark;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
package cn.iocoder.yudao.module.tik.muye.pointrechargeconfig;
|
||||
|
||||
import cn.iocoder.yudao.module.tik.muye.pointrechargeconfig.dal.PointRechargeConfigDO;
|
||||
import cn.iocoder.yudao.module.tik.muye.pointrechargeconfig.service.PointRechargeConfigService;
|
||||
import cn.iocoder.yudao.module.tik.muye.pointrechargeconfig.vo.PointRechargeConfigPageReqVO;
|
||||
import cn.iocoder.yudao.module.tik.muye.pointrechargeconfig.vo.PointRechargeConfigRespVO;
|
||||
import cn.iocoder.yudao.module.tik.muye.pointrechargeconfig.vo.PointRechargeConfigSaveReqVO;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
|
||||
import jakarta.validation.constraints.*;
|
||||
import jakarta.validation.*;
|
||||
import jakarta.servlet.http.*;
|
||||
import java.util.*;
|
||||
import java.io.IOException;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
|
||||
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
||||
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
|
||||
|
||||
@Tag(name = "管理后台 - 积分充值配置")
|
||||
@RestController
|
||||
@RequestMapping("/muye/point-recharge-config")
|
||||
@Validated
|
||||
public class PointRechargeConfigController {
|
||||
|
||||
@Resource
|
||||
private PointRechargeConfigService pointRechargeConfigService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建积分充值配置")
|
||||
@PreAuthorize("@ss.hasPermission('muye:point-recharge-config:create')")
|
||||
public CommonResult<Long> createPointRechargeConfig(@Valid @RequestBody PointRechargeConfigSaveReqVO createReqVO) {
|
||||
return success(pointRechargeConfigService.createPointRechargeConfig(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新积分充值配置")
|
||||
@PreAuthorize("@ss.hasPermission('muye:point-recharge-config:update')")
|
||||
public CommonResult<Boolean> updatePointRechargeConfig(@Valid @RequestBody PointRechargeConfigSaveReqVO updateReqVO) {
|
||||
pointRechargeConfigService.updatePointRechargeConfig(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除积分充值配置")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('muye:point-recharge-config:delete')")
|
||||
public CommonResult<Boolean> deletePointRechargeConfig(@RequestParam("id") Long id) {
|
||||
pointRechargeConfigService.deletePointRechargeConfig(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete-list")
|
||||
@Parameter(name = "ids", description = "编号", required = true)
|
||||
@Operation(summary = "批量删除积分充值配置")
|
||||
@PreAuthorize("@ss.hasPermission('muye:point-recharge-config:delete')")
|
||||
public CommonResult<Boolean> deletePointRechargeConfigList(@RequestParam("ids") List<Long> ids) {
|
||||
pointRechargeConfigService.deletePointRechargeConfigListByIds(ids);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得积分充值配置")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('muye:point-recharge-config:query')")
|
||||
public CommonResult<PointRechargeConfigRespVO> getPointRechargeConfig(@RequestParam("id") Long id) {
|
||||
PointRechargeConfigDO pointRechargeConfig = pointRechargeConfigService.getPointRechargeConfig(id);
|
||||
return success(BeanUtils.toBean(pointRechargeConfig, PointRechargeConfigRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得积分充值配置分页")
|
||||
@PreAuthorize("@ss.hasPermission('muye:point-recharge-config:query')")
|
||||
public CommonResult<PageResult<PointRechargeConfigRespVO>> getPointRechargeConfigPage(@Valid PointRechargeConfigPageReqVO pageReqVO) {
|
||||
PageResult<PointRechargeConfigDO> pageResult = pointRechargeConfigService.getPointRechargeConfigPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, PointRechargeConfigRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出积分充值配置 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('muye:point-recharge-config:export')")
|
||||
@ApiAccessLog(operateType = EXPORT)
|
||||
public void exportPointRechargeConfigExcel(@Valid PointRechargeConfigPageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<PointRechargeConfigDO> list = pointRechargeConfigService.getPointRechargeConfigPage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "积分充值配置.xls", "数据", PointRechargeConfigRespVO.class,
|
||||
BeanUtils.toBean(list, PointRechargeConfigRespVO.class));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package cn.iocoder.yudao.module.tik.muye.pointrechargeconfig.dal;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
|
||||
/**
|
||||
* 积分充值配置 DO
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@TableName("muye_point_recharge_config")
|
||||
@KeySequence("muye_point_recharge_config_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class PointRechargeConfigDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 充值金额
|
||||
*/
|
||||
private BigDecimal rechargeAmount;
|
||||
/**
|
||||
* 赠送积分数
|
||||
*/
|
||||
private Integer bonusPoints;
|
||||
/**
|
||||
* 调整原因
|
||||
*/
|
||||
private String adjustReason;
|
||||
/**
|
||||
* 操作人用户编号
|
||||
*/
|
||||
private Long operatorId;
|
||||
/**
|
||||
* 操作人账号
|
||||
*/
|
||||
private String operatorName;
|
||||
/**
|
||||
* 状态(0-禁用 1-启用)
|
||||
*/
|
||||
private Integer status;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package cn.iocoder.yudao.module.tik.muye.pointrechargeconfig.mapper;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.module.tik.muye.pointrechargeconfig.dal.PointRechargeConfigDO;
|
||||
import cn.iocoder.yudao.module.tik.muye.pointrechargeconfig.vo.PointRechargeConfigPageReqVO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 积分充值配置 Mapper
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Mapper
|
||||
public interface PointRechargeConfigMapper extends BaseMapperX<PointRechargeConfigDO> {
|
||||
|
||||
default PageResult<PointRechargeConfigDO> selectPage(PointRechargeConfigPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<PointRechargeConfigDO>()
|
||||
.eqIfPresent(PointRechargeConfigDO::getRechargeAmount, reqVO.getRechargeAmount())
|
||||
.eqIfPresent(PointRechargeConfigDO::getBonusPoints, reqVO.getBonusPoints())
|
||||
.eqIfPresent(PointRechargeConfigDO::getAdjustReason, reqVO.getAdjustReason())
|
||||
.eqIfPresent(PointRechargeConfigDO::getOperatorId, reqVO.getOperatorId())
|
||||
.likeIfPresent(PointRechargeConfigDO::getOperatorName, reqVO.getOperatorName())
|
||||
.eqIfPresent(PointRechargeConfigDO::getStatus, reqVO.getStatus())
|
||||
.eqIfPresent(PointRechargeConfigDO::getRemark, reqVO.getRemark())
|
||||
.betweenIfPresent(PointRechargeConfigDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(PointRechargeConfigDO::getId));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package cn.iocoder.yudao.module.tik.muye.pointrechargeconfig.service;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import cn.iocoder.yudao.module.tik.muye.pointrechargeconfig.dal.PointRechargeConfigDO;
|
||||
import cn.iocoder.yudao.module.tik.muye.pointrechargeconfig.vo.PointRechargeConfigPageReqVO;
|
||||
import cn.iocoder.yudao.module.tik.muye.pointrechargeconfig.vo.PointRechargeConfigSaveReqVO;
|
||||
import jakarta.validation.*;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
|
||||
/**
|
||||
* 积分充值配置 Service 接口
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
public interface PointRechargeConfigService {
|
||||
|
||||
/**
|
||||
* 创建积分充值配置
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createPointRechargeConfig(@Valid PointRechargeConfigSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新积分充值配置
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updatePointRechargeConfig(@Valid PointRechargeConfigSaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除积分充值配置
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deletePointRechargeConfig(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除积分充值配置
|
||||
*
|
||||
* @param ids 编号
|
||||
*/
|
||||
void deletePointRechargeConfigListByIds(List<Long> ids);
|
||||
|
||||
/**
|
||||
* 获得积分充值配置
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 积分充值配置
|
||||
*/
|
||||
PointRechargeConfigDO getPointRechargeConfig(Long id);
|
||||
|
||||
/**
|
||||
* 获得积分充值配置分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 积分充值配置分页
|
||||
*/
|
||||
PageResult<PointRechargeConfigDO> getPointRechargeConfigPage(PointRechargeConfigPageReqVO pageReqVO);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
package cn.iocoder.yudao.module.tik.muye.pointrechargeconfig.service;
|
||||
|
||||
|
||||
import cn.iocoder.yudao.framework.common.exception.ErrorCode;
|
||||
import cn.iocoder.yudao.module.tik.muye.pointrechargeconfig.dal.PointRechargeConfigDO;
|
||||
import cn.iocoder.yudao.module.tik.muye.pointrechargeconfig.mapper.PointRechargeConfigMapper;
|
||||
import cn.iocoder.yudao.module.tik.muye.pointrechargeconfig.vo.PointRechargeConfigPageReqVO;
|
||||
import cn.iocoder.yudao.module.tik.muye.pointrechargeconfig.vo.PointRechargeConfigSaveReqVO;
|
||||
import org.springframework.stereotype.Service;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import java.util.*;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
|
||||
|
||||
/**
|
||||
* 积分充值配置 Service 实现类
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class PointRechargeConfigServiceImpl implements PointRechargeConfigService {
|
||||
|
||||
@Resource
|
||||
private PointRechargeConfigMapper pointRechargeConfigMapper;
|
||||
|
||||
@Override
|
||||
public Long createPointRechargeConfig(PointRechargeConfigSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
PointRechargeConfigDO pointRechargeConfig = BeanUtils.toBean(createReqVO, PointRechargeConfigDO.class);
|
||||
pointRechargeConfigMapper.insert(pointRechargeConfig);
|
||||
|
||||
// 返回
|
||||
return pointRechargeConfig.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updatePointRechargeConfig(PointRechargeConfigSaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validatePointRechargeConfigExists(updateReqVO.getId());
|
||||
// 更新
|
||||
PointRechargeConfigDO updateObj = BeanUtils.toBean(updateReqVO, PointRechargeConfigDO.class);
|
||||
pointRechargeConfigMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deletePointRechargeConfig(Long id) {
|
||||
// 校验存在
|
||||
validatePointRechargeConfigExists(id);
|
||||
// 删除
|
||||
pointRechargeConfigMapper.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deletePointRechargeConfigListByIds(List<Long> ids) {
|
||||
// 删除
|
||||
pointRechargeConfigMapper.deleteByIds(ids);
|
||||
}
|
||||
|
||||
|
||||
private void validatePointRechargeConfigExists(Long id) {
|
||||
if (pointRechargeConfigMapper.selectById(id) == null) {
|
||||
throw exception(new ErrorCode(1004, "积分充值配置不存在"));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public PointRechargeConfigDO getPointRechargeConfig(Long id) {
|
||||
return pointRechargeConfigMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<PointRechargeConfigDO> getPointRechargeConfigPage(PointRechargeConfigPageReqVO pageReqVO) {
|
||||
return pointRechargeConfigMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package cn.iocoder.yudao.module.tik.muye.pointrechargeconfig.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import java.math.BigDecimal;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 积分充值配置分页 Request VO")
|
||||
@Data
|
||||
public class PointRechargeConfigPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "充值金额")
|
||||
private BigDecimal rechargeAmount;
|
||||
|
||||
@Schema(description = "赠送积分数")
|
||||
private Integer bonusPoints;
|
||||
|
||||
@Schema(description = "调整原因", example = "不香")
|
||||
private String adjustReason;
|
||||
|
||||
@Schema(description = "操作人用户编号", example = "2151")
|
||||
private Long operatorId;
|
||||
|
||||
@Schema(description = "操作人账号", example = "赵六")
|
||||
private String operatorName;
|
||||
|
||||
@Schema(description = "状态(0-禁用 1-启用)", example = "2")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "备注", example = "你说的对")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package cn.iocoder.yudao.module.tik.muye.pointrechargeconfig.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.math.BigDecimal;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
import cn.idev.excel.annotation.*;
|
||||
|
||||
@Schema(description = "管理后台 - 积分充值配置 Response VO")
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class PointRechargeConfigRespVO {
|
||||
|
||||
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "4530")
|
||||
@ExcelProperty("主键")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "充值金额", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("充值金额")
|
||||
private BigDecimal rechargeAmount;
|
||||
|
||||
@Schema(description = "赠送积分数", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("赠送积分数")
|
||||
private Integer bonusPoints;
|
||||
|
||||
@Schema(description = "调整原因", requiredMode = Schema.RequiredMode.REQUIRED, example = "不香")
|
||||
@ExcelProperty("调整原因")
|
||||
private String adjustReason;
|
||||
|
||||
@Schema(description = "操作人用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "2151")
|
||||
@ExcelProperty("操作人用户编号")
|
||||
private Long operatorId;
|
||||
|
||||
@Schema(description = "操作人账号", requiredMode = Schema.RequiredMode.REQUIRED, example = "赵六")
|
||||
@ExcelProperty("操作人账号")
|
||||
private String operatorName;
|
||||
|
||||
@Schema(description = "状态(0-禁用 1-启用)", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||
@ExcelProperty("状态(0-禁用 1-启用)")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED, example = "你说的对")
|
||||
@ExcelProperty("备注")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package cn.iocoder.yudao.module.tik.muye.pointrechargeconfig.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import jakarta.validation.constraints.*;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Schema(description = "管理后台 - 积分充值配置新增/修改 Request VO")
|
||||
@Data
|
||||
public class PointRechargeConfigSaveReqVO {
|
||||
|
||||
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "4530")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "充值金额", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "充值金额不能为空")
|
||||
private BigDecimal rechargeAmount;
|
||||
|
||||
@Schema(description = "赠送积分数", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "赠送积分数不能为空")
|
||||
private Integer bonusPoints;
|
||||
|
||||
@Schema(description = "调整原因", requiredMode = Schema.RequiredMode.REQUIRED, example = "不香")
|
||||
@NotEmpty(message = "调整原因不能为空")
|
||||
private String adjustReason;
|
||||
|
||||
@Schema(description = "操作人用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "2151")
|
||||
@NotNull(message = "操作人用户编号不能为空")
|
||||
private Long operatorId;
|
||||
|
||||
@Schema(description = "操作人账号", requiredMode = Schema.RequiredMode.REQUIRED, example = "赵六")
|
||||
@NotEmpty(message = "操作人账号不能为空")
|
||||
private String operatorName;
|
||||
|
||||
@Schema(description = "状态(0-禁用 1-启用)", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||
@NotNull(message = "状态(0-禁用 1-启用)不能为空")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED, example = "你说的对")
|
||||
@NotEmpty(message = "备注不能为空")
|
||||
private String remark;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
package cn.iocoder.yudao.module.tik.muye.pointrecord;
|
||||
|
||||
import cn.iocoder.yudao.module.tik.muye.pointrecord.dal.PointRecordDO;
|
||||
import cn.iocoder.yudao.module.tik.muye.pointrecord.service.PointRecordService;
|
||||
import cn.iocoder.yudao.module.tik.muye.pointrecord.vo.PointRecordPageReqVO;
|
||||
import cn.iocoder.yudao.module.tik.muye.pointrecord.vo.PointRecordRespVO;
|
||||
import cn.iocoder.yudao.module.tik.muye.pointrecord.vo.PointRecordSaveReqVO;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
|
||||
import jakarta.validation.constraints.*;
|
||||
import jakarta.validation.*;
|
||||
import jakarta.servlet.http.*;
|
||||
import java.util.*;
|
||||
import java.io.IOException;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
|
||||
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
||||
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
|
||||
|
||||
@Tag(name = "管理后台 - 积分记录")
|
||||
@RestController
|
||||
@RequestMapping("/muye/point-record")
|
||||
@Validated
|
||||
public class PointRecordController {
|
||||
|
||||
@Resource
|
||||
private PointRecordService pointRecordService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建积分记录")
|
||||
@PreAuthorize("@ss.hasPermission('muye:point-record:create')")
|
||||
public CommonResult<Long> createPointRecord(@Valid @RequestBody PointRecordSaveReqVO createReqVO) {
|
||||
return success(pointRecordService.createPointRecord(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新积分记录")
|
||||
@PreAuthorize("@ss.hasPermission('muye:point-record:update')")
|
||||
public CommonResult<Boolean> updatePointRecord(@Valid @RequestBody PointRecordSaveReqVO updateReqVO) {
|
||||
pointRecordService.updatePointRecord(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除积分记录")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('muye:point-record:delete')")
|
||||
public CommonResult<Boolean> deletePointRecord(@RequestParam("id") Long id) {
|
||||
pointRecordService.deletePointRecord(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete-list")
|
||||
@Parameter(name = "ids", description = "编号", required = true)
|
||||
@Operation(summary = "批量删除积分记录")
|
||||
@PreAuthorize("@ss.hasPermission('muye:point-record:delete')")
|
||||
public CommonResult<Boolean> deletePointRecordList(@RequestParam("ids") List<Long> ids) {
|
||||
pointRecordService.deletePointRecordListByIds(ids);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得积分记录")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('muye:point-record:query')")
|
||||
public CommonResult<PointRecordRespVO> getPointRecord(@RequestParam("id") Long id) {
|
||||
PointRecordDO pointRecord = pointRecordService.getPointRecord(id);
|
||||
return success(BeanUtils.toBean(pointRecord, PointRecordRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得积分记录分页")
|
||||
@PreAuthorize("@ss.hasPermission('muye:point-record:query')")
|
||||
public CommonResult<PageResult<PointRecordRespVO>> getPointRecordPage(@Valid PointRecordPageReqVO pageReqVO) {
|
||||
PageResult<PointRecordDO> pageResult = pointRecordService.getPointRecordPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, PointRecordRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出积分记录 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('muye:point-record:export')")
|
||||
@ApiAccessLog(operateType = EXPORT)
|
||||
public void exportPointRecordExcel(@Valid PointRecordPageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<PointRecordDO> list = pointRecordService.getPointRecordPage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "积分记录.xls", "数据", PointRecordRespVO.class,
|
||||
BeanUtils.toBean(list, PointRecordRespVO.class));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package cn.iocoder.yudao.module.tik.muye.pointrecord.dal;
|
||||
|
||||
import lombok.*;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
|
||||
/**
|
||||
* 积分记录 DO
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@TableName("muye_point_record")
|
||||
@KeySequence("muye_point_record_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class PointRecordDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 用户编号
|
||||
*/
|
||||
private Long userId;
|
||||
/**
|
||||
* 手机号
|
||||
*/
|
||||
private String mobile;
|
||||
/**
|
||||
* 变动类型(increase-增加 decrease-减少)
|
||||
*/
|
||||
private String type;
|
||||
/**
|
||||
* 变动积分数量(正数为增加,负数为减少)
|
||||
*/
|
||||
private Integer pointAmount;
|
||||
/**
|
||||
* 变动后余额
|
||||
*/
|
||||
private Integer balance;
|
||||
/**
|
||||
* 变动原因
|
||||
*/
|
||||
private String reason;
|
||||
/**
|
||||
* 业务类型(signin-签到 recharge-充值 exchange-兑换 admin-后台调整 gift-礼包赠送)
|
||||
*/
|
||||
private String bizType;
|
||||
/**
|
||||
* 业务关联ID
|
||||
*/
|
||||
private String bizId;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package cn.iocoder.yudao.module.tik.muye.pointrecord.mapper;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.module.tik.muye.pointrecord.dal.PointRecordDO;
|
||||
import cn.iocoder.yudao.module.tik.muye.pointrecord.vo.PointRecordPageReqVO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
/**
|
||||
* 积分记录 Mapper
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Mapper
|
||||
public interface PointRecordMapper extends BaseMapperX<PointRecordDO> {
|
||||
|
||||
default PageResult<PointRecordDO> selectPage(PointRecordPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<PointRecordDO>()
|
||||
.eqIfPresent(PointRecordDO::getUserId, reqVO.getUserId())
|
||||
.eqIfPresent(PointRecordDO::getMobile, reqVO.getMobile())
|
||||
.eqIfPresent(PointRecordDO::getType, reqVO.getType())
|
||||
.eqIfPresent(PointRecordDO::getPointAmount, reqVO.getPointAmount())
|
||||
.eqIfPresent(PointRecordDO::getBalance, reqVO.getBalance())
|
||||
.eqIfPresent(PointRecordDO::getReason, reqVO.getReason())
|
||||
.eqIfPresent(PointRecordDO::getBizType, reqVO.getBizType())
|
||||
.eqIfPresent(PointRecordDO::getBizId, reqVO.getBizId())
|
||||
.eqIfPresent(PointRecordDO::getRemark, reqVO.getRemark())
|
||||
.betweenIfPresent(PointRecordDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(PointRecordDO::getId));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package cn.iocoder.yudao.module.tik.muye.pointrecord.service;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import cn.iocoder.yudao.module.tik.muye.pointrecord.dal.PointRecordDO;
|
||||
import cn.iocoder.yudao.module.tik.muye.pointrecord.vo.PointRecordPageReqVO;
|
||||
import cn.iocoder.yudao.module.tik.muye.pointrecord.vo.PointRecordSaveReqVO;
|
||||
import jakarta.validation.*;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
|
||||
/**
|
||||
* 积分记录 Service 接口
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
public interface PointRecordService {
|
||||
|
||||
/**
|
||||
* 创建积分记录
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createPointRecord(@Valid PointRecordSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新积分记录
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updatePointRecord(@Valid PointRecordSaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除积分记录
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deletePointRecord(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除积分记录
|
||||
*
|
||||
* @param ids 编号
|
||||
*/
|
||||
void deletePointRecordListByIds(List<Long> ids);
|
||||
|
||||
/**
|
||||
* 获得积分记录
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 积分记录
|
||||
*/
|
||||
PointRecordDO getPointRecord(Long id);
|
||||
|
||||
/**
|
||||
* 获得积分记录分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 积分记录分页
|
||||
*/
|
||||
PageResult<PointRecordDO> getPointRecordPage(PointRecordPageReqVO pageReqVO);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
package cn.iocoder.yudao.module.tik.muye.pointrecord.service;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.exception.ErrorCode;
|
||||
import cn.iocoder.yudao.module.tik.muye.pointrecord.dal.PointRecordDO;
|
||||
import cn.iocoder.yudao.module.tik.muye.pointrecord.mapper.PointRecordMapper;
|
||||
import cn.iocoder.yudao.module.tik.muye.pointrecord.vo.PointRecordPageReqVO;
|
||||
import cn.iocoder.yudao.module.tik.muye.pointrecord.vo.PointRecordSaveReqVO;
|
||||
import org.springframework.stereotype.Service;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
|
||||
import java.util.*;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
|
||||
|
||||
/**
|
||||
* 积分记录 Service 实现类
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class PointRecordServiceImpl implements PointRecordService {
|
||||
|
||||
@Resource
|
||||
private PointRecordMapper pointRecordMapper;
|
||||
|
||||
@Override
|
||||
public Long createPointRecord(PointRecordSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
PointRecordDO pointRecord = BeanUtils.toBean(createReqVO, PointRecordDO.class);
|
||||
pointRecordMapper.insert(pointRecord);
|
||||
|
||||
// 返回
|
||||
return pointRecord.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updatePointRecord(PointRecordSaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validatePointRecordExists(updateReqVO.getId());
|
||||
// 更新
|
||||
PointRecordDO updateObj = BeanUtils.toBean(updateReqVO, PointRecordDO.class);
|
||||
pointRecordMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deletePointRecord(Long id) {
|
||||
// 校验存在
|
||||
validatePointRecordExists(id);
|
||||
// 删除
|
||||
pointRecordMapper.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deletePointRecordListByIds(List<Long> ids) {
|
||||
// 删除
|
||||
pointRecordMapper.deleteByIds(ids);
|
||||
}
|
||||
|
||||
|
||||
private void validatePointRecordExists(Long id) {
|
||||
if (pointRecordMapper.selectById(id) == null) {
|
||||
throw exception(new ErrorCode(1004, "积分记录不存在"));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public PointRecordDO getPointRecord(Long id) {
|
||||
return pointRecordMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<PointRecordDO> getPointRecordPage(PointRecordPageReqVO pageReqVO) {
|
||||
return pointRecordMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package cn.iocoder.yudao.module.tik.muye.pointrecord.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 积分记录分页 Request VO")
|
||||
@Data
|
||||
public class PointRecordPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "用户编号", example = "5101")
|
||||
private Long userId;
|
||||
|
||||
@Schema(description = "手机号")
|
||||
private String mobile;
|
||||
|
||||
@Schema(description = "变动类型(increase-增加 decrease-减少)", example = "1")
|
||||
private String type;
|
||||
|
||||
@Schema(description = "变动积分数量(正数为增加,负数为减少)")
|
||||
private Integer pointAmount;
|
||||
|
||||
@Schema(description = "变动后余额")
|
||||
private Integer balance;
|
||||
|
||||
@Schema(description = "变动原因", example = "不对")
|
||||
private String reason;
|
||||
|
||||
@Schema(description = "业务类型(signin-签到 recharge-充值 exchange-兑换 admin-后台调整 gift-礼包赠送)", example = "1")
|
||||
private String bizType;
|
||||
|
||||
@Schema(description = "业务关联ID", example = "7730")
|
||||
private String bizId;
|
||||
|
||||
@Schema(description = "备注", example = "你猜")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package cn.iocoder.yudao.module.tik.muye.pointrecord.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
import cn.idev.excel.annotation.*;
|
||||
|
||||
@Schema(description = "管理后台 - 积分记录 Response VO")
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class PointRecordRespVO {
|
||||
|
||||
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "21023")
|
||||
@ExcelProperty("主键")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "5101")
|
||||
@ExcelProperty("用户编号")
|
||||
private Long userId;
|
||||
|
||||
@Schema(description = "手机号", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("手机号")
|
||||
private String mobile;
|
||||
|
||||
@Schema(description = "变动类型(increase-增加 decrease-减少)", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@ExcelProperty("变动类型(increase-增加 decrease-减少)")
|
||||
private String type;
|
||||
|
||||
@Schema(description = "变动积分数量(正数为增加,负数为减少)", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("变动积分数量(正数为增加,负数为减少)")
|
||||
private Integer pointAmount;
|
||||
|
||||
@Schema(description = "变动后余额", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("变动后余额")
|
||||
private Integer balance;
|
||||
|
||||
@Schema(description = "变动原因", requiredMode = Schema.RequiredMode.REQUIRED, example = "不对")
|
||||
@ExcelProperty("变动原因")
|
||||
private String reason;
|
||||
|
||||
@Schema(description = "业务类型(signin-签到 recharge-充值 exchange-兑换 admin-后台调整 gift-礼包赠送)", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@ExcelProperty("业务类型(signin-签到 recharge-充值 exchange-兑换 admin-后台调整 gift-礼包赠送)")
|
||||
private String bizType;
|
||||
|
||||
@Schema(description = "业务关联ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "7730")
|
||||
@ExcelProperty("业务关联ID")
|
||||
private String bizId;
|
||||
|
||||
@Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED, example = "你猜")
|
||||
@ExcelProperty("备注")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package cn.iocoder.yudao.module.tik.muye.pointrecord.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import jakarta.validation.constraints.*;
|
||||
|
||||
@Schema(description = "管理后台 - 积分记录新增/修改 Request VO")
|
||||
@Data
|
||||
public class PointRecordSaveReqVO {
|
||||
|
||||
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "21023")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "5101")
|
||||
@NotNull(message = "用户编号不能为空")
|
||||
private Long userId;
|
||||
|
||||
@Schema(description = "手机号", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "手机号不能为空")
|
||||
private String mobile;
|
||||
|
||||
@Schema(description = "变动类型(increase-增加 decrease-减少)", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@NotEmpty(message = "变动类型(increase-增加 decrease-减少)不能为空")
|
||||
private String type;
|
||||
|
||||
@Schema(description = "变动积分数量(正数为增加,负数为减少)", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "变动积分数量(正数为增加,负数为减少)不能为空")
|
||||
private Integer pointAmount;
|
||||
|
||||
@Schema(description = "变动后余额", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "变动后余额不能为空")
|
||||
private Integer balance;
|
||||
|
||||
@Schema(description = "变动原因", requiredMode = Schema.RequiredMode.REQUIRED, example = "不对")
|
||||
@NotEmpty(message = "变动原因不能为空")
|
||||
private String reason;
|
||||
|
||||
@Schema(description = "业务类型(signin-签到 recharge-充值 exchange-兑换 admin-后台调整 gift-礼包赠送)", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||
@NotEmpty(message = "业务类型(signin-签到 recharge-充值 exchange-兑换 admin-后台调整 gift-礼包赠送)不能为空")
|
||||
private String bizType;
|
||||
|
||||
@Schema(description = "业务关联ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "7730")
|
||||
@NotEmpty(message = "业务关联ID不能为空")
|
||||
private String bizId;
|
||||
|
||||
@Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED, example = "你猜")
|
||||
@NotEmpty(message = "备注不能为空")
|
||||
private String remark;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
package cn.iocoder.yudao.module.tik.muye.pointsigninconfig;
|
||||
|
||||
import cn.iocoder.yudao.module.tik.muye.pointsigninconfig.dal.PointSigninConfigDO;
|
||||
import cn.iocoder.yudao.module.tik.muye.pointsigninconfig.service.PointSigninConfigService;
|
||||
import cn.iocoder.yudao.module.tik.muye.pointsigninconfig.vo.PointSigninConfigPageReqVO;
|
||||
import cn.iocoder.yudao.module.tik.muye.pointsigninconfig.vo.PointSigninConfigRespVO;
|
||||
import cn.iocoder.yudao.module.tik.muye.pointsigninconfig.vo.PointSigninConfigSaveReqVO;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
|
||||
import jakarta.validation.constraints.*;
|
||||
import jakarta.validation.*;
|
||||
import jakarta.servlet.http.*;
|
||||
import java.util.*;
|
||||
import java.io.IOException;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
|
||||
|
||||
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
|
||||
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
|
||||
|
||||
|
||||
@Tag(name = "管理后台 - 积分签到配置")
|
||||
@RestController
|
||||
@RequestMapping("/muye/point-signin-config")
|
||||
@Validated
|
||||
public class PointSigninConfigController {
|
||||
|
||||
@Resource
|
||||
private PointSigninConfigService pointSigninConfigService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建积分签到配置")
|
||||
@PreAuthorize("@ss.hasPermission('muye:point-signin-config:create')")
|
||||
public CommonResult<Long> createPointSigninConfig(@Valid @RequestBody PointSigninConfigSaveReqVO createReqVO) {
|
||||
return success(pointSigninConfigService.createPointSigninConfig(createReqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新积分签到配置")
|
||||
@PreAuthorize("@ss.hasPermission('muye:point-signin-config:update')")
|
||||
public CommonResult<Boolean> updatePointSigninConfig(@Valid @RequestBody PointSigninConfigSaveReqVO updateReqVO) {
|
||||
pointSigninConfigService.updatePointSigninConfig(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除积分签到配置")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('muye:point-signin-config:delete')")
|
||||
public CommonResult<Boolean> deletePointSigninConfig(@RequestParam("id") Long id) {
|
||||
pointSigninConfigService.deletePointSigninConfig(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete-list")
|
||||
@Parameter(name = "ids", description = "编号", required = true)
|
||||
@Operation(summary = "批量删除积分签到配置")
|
||||
@PreAuthorize("@ss.hasPermission('muye:point-signin-config:delete')")
|
||||
public CommonResult<Boolean> deletePointSigninConfigList(@RequestParam("ids") List<Long> ids) {
|
||||
pointSigninConfigService.deletePointSigninConfigListByIds(ids);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得积分签到配置")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('muye:point-signin-config:query')")
|
||||
public CommonResult<PointSigninConfigRespVO> getPointSigninConfig(@RequestParam("id") Long id) {
|
||||
PointSigninConfigDO pointSigninConfig = pointSigninConfigService.getPointSigninConfig(id);
|
||||
return success(BeanUtils.toBean(pointSigninConfig, PointSigninConfigRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得积分签到配置分页")
|
||||
@PreAuthorize("@ss.hasPermission('muye:point-signin-config:query')")
|
||||
public CommonResult<PageResult<PointSigninConfigRespVO>> getPointSigninConfigPage(@Valid PointSigninConfigPageReqVO pageReqVO) {
|
||||
PageResult<PointSigninConfigDO> pageResult = pointSigninConfigService.getPointSigninConfigPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, PointSigninConfigRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出积分签到配置 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('muye:point-signin-config:export')")
|
||||
@ApiAccessLog(operateType = EXPORT)
|
||||
public void exportPointSigninConfigExcel(@Valid PointSigninConfigPageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<PointSigninConfigDO> list = pointSigninConfigService.getPointSigninConfigPage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "积分签到配置.xls", "数据", PointSigninConfigRespVO.class,
|
||||
BeanUtils.toBean(list, PointSigninConfigRespVO.class));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
package cn.iocoder.yudao.module.tik.muye.pointsigninconfig.dal;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
|
||||
/**
|
||||
* 积分签到配置 DO
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@TableName("muye_point_signin_config")
|
||||
@KeySequence("muye_point_signin_config_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class PointSigninConfigDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
@TableId
|
||||
private Long id;
|
||||
/**
|
||||
* 每日签到赠送积分
|
||||
*/
|
||||
private Integer dailyPoints;
|
||||
/**
|
||||
* 连续签到天数
|
||||
*/
|
||||
private Integer continuousDays;
|
||||
/**
|
||||
* 连续签到奖励积分
|
||||
*/
|
||||
private Integer bonusPoints;
|
||||
/**
|
||||
* 重置签到天数(0表示不重置)
|
||||
*/
|
||||
private Integer resetDays;
|
||||
/**
|
||||
* 调整原因
|
||||
*/
|
||||
private String adjustReason;
|
||||
/**
|
||||
* 操作人用户编号
|
||||
*/
|
||||
private Long operatorId;
|
||||
/**
|
||||
* 操作人账号
|
||||
*/
|
||||
private String operatorName;
|
||||
/**
|
||||
* 状态(0-禁用 1-启用)
|
||||
*/
|
||||
private Integer status;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package cn.iocoder.yudao.module.tik.muye.pointsigninconfig.mapper;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.module.tik.muye.pointsigninconfig.dal.PointSigninConfigDO;
|
||||
import cn.iocoder.yudao.module.tik.muye.pointsigninconfig.vo.PointSigninConfigPageReqVO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
|
||||
/**
|
||||
* 积分签到配置 Mapper
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Mapper
|
||||
public interface PointSigninConfigMapper extends BaseMapperX<PointSigninConfigDO> {
|
||||
|
||||
default PageResult<PointSigninConfigDO> selectPage(PointSigninConfigPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<PointSigninConfigDO>()
|
||||
.eqIfPresent(PointSigninConfigDO::getDailyPoints, reqVO.getDailyPoints())
|
||||
.eqIfPresent(PointSigninConfigDO::getContinuousDays, reqVO.getContinuousDays())
|
||||
.eqIfPresent(PointSigninConfigDO::getBonusPoints, reqVO.getBonusPoints())
|
||||
.eqIfPresent(PointSigninConfigDO::getResetDays, reqVO.getResetDays())
|
||||
.eqIfPresent(PointSigninConfigDO::getAdjustReason, reqVO.getAdjustReason())
|
||||
.eqIfPresent(PointSigninConfigDO::getOperatorId, reqVO.getOperatorId())
|
||||
.likeIfPresent(PointSigninConfigDO::getOperatorName, reqVO.getOperatorName())
|
||||
.eqIfPresent(PointSigninConfigDO::getStatus, reqVO.getStatus())
|
||||
.eqIfPresent(PointSigninConfigDO::getRemark, reqVO.getRemark())
|
||||
.betweenIfPresent(PointSigninConfigDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(PointSigninConfigDO::getId));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package cn.iocoder.yudao.module.tik.muye.pointsigninconfig.service;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import cn.iocoder.yudao.module.tik.muye.pointsigninconfig.dal.PointSigninConfigDO;
|
||||
import cn.iocoder.yudao.module.tik.muye.pointsigninconfig.vo.PointSigninConfigPageReqVO;
|
||||
import cn.iocoder.yudao.module.tik.muye.pointsigninconfig.vo.PointSigninConfigSaveReqVO;
|
||||
import jakarta.validation.*;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
|
||||
|
||||
/**
|
||||
* 积分签到配置 Service 接口
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
public interface PointSigninConfigService {
|
||||
|
||||
/**
|
||||
* 创建积分签到配置
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createPointSigninConfig(@Valid PointSigninConfigSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新积分签到配置
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updatePointSigninConfig(@Valid PointSigninConfigSaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除积分签到配置
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deletePointSigninConfig(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除积分签到配置
|
||||
*
|
||||
* @param ids 编号
|
||||
*/
|
||||
void deletePointSigninConfigListByIds(List<Long> ids);
|
||||
|
||||
/**
|
||||
* 获得积分签到配置
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 积分签到配置
|
||||
*/
|
||||
PointSigninConfigDO getPointSigninConfig(Long id);
|
||||
|
||||
/**
|
||||
* 获得积分签到配置分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 积分签到配置分页
|
||||
*/
|
||||
PageResult<PointSigninConfigDO> getPointSigninConfigPage(PointSigninConfigPageReqVO pageReqVO);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
package cn.iocoder.yudao.module.tik.muye.pointsigninconfig.service;
|
||||
|
||||
|
||||
import cn.iocoder.yudao.framework.common.exception.ErrorCode;
|
||||
import cn.iocoder.yudao.module.tik.muye.pointsigninconfig.dal.PointSigninConfigDO;
|
||||
import cn.iocoder.yudao.module.tik.muye.pointsigninconfig.mapper.PointSigninConfigMapper;
|
||||
import cn.iocoder.yudao.module.tik.muye.pointsigninconfig.vo.PointSigninConfigPageReqVO;
|
||||
import cn.iocoder.yudao.module.tik.muye.pointsigninconfig.vo.PointSigninConfigSaveReqVO;
|
||||
import org.springframework.stereotype.Service;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import java.util.*;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageResult;
|
||||
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
|
||||
|
||||
/**
|
||||
* 积分签到配置 Service 实现类
|
||||
*
|
||||
* @author 芋道源码
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class PointSigninConfigServiceImpl implements PointSigninConfigService {
|
||||
|
||||
@Resource
|
||||
private PointSigninConfigMapper pointSigninConfigMapper;
|
||||
|
||||
@Override
|
||||
public Long createPointSigninConfig(PointSigninConfigSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
PointSigninConfigDO pointSigninConfig = BeanUtils.toBean(createReqVO, PointSigninConfigDO.class);
|
||||
pointSigninConfigMapper.insert(pointSigninConfig);
|
||||
|
||||
// 返回
|
||||
return pointSigninConfig.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updatePointSigninConfig(PointSigninConfigSaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validatePointSigninConfigExists(updateReqVO.getId());
|
||||
// 更新
|
||||
PointSigninConfigDO updateObj = BeanUtils.toBean(updateReqVO, PointSigninConfigDO.class);
|
||||
pointSigninConfigMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deletePointSigninConfig(Long id) {
|
||||
// 校验存在
|
||||
validatePointSigninConfigExists(id);
|
||||
// 删除
|
||||
pointSigninConfigMapper.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deletePointSigninConfigListByIds(List<Long> ids) {
|
||||
// 删除
|
||||
pointSigninConfigMapper.deleteByIds(ids);
|
||||
}
|
||||
|
||||
|
||||
private void validatePointSigninConfigExists(Long id) {
|
||||
if (pointSigninConfigMapper.selectById(id) == null) {
|
||||
throw exception(new ErrorCode(1004, "积分签到配置不存在"));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public PointSigninConfigDO getPointSigninConfig(Long id) {
|
||||
return pointSigninConfigMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<PointSigninConfigDO> getPointSigninConfigPage(PointSigninConfigPageReqVO pageReqVO) {
|
||||
return pointSigninConfigMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package cn.iocoder.yudao.module.tik.muye.pointsigninconfig.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import cn.iocoder.yudao.framework.common.pojo.PageParam;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 积分签到配置分页 Request VO")
|
||||
@Data
|
||||
public class PointSigninConfigPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "每日签到赠送积分")
|
||||
private Integer dailyPoints;
|
||||
|
||||
@Schema(description = "连续签到天数")
|
||||
private Integer continuousDays;
|
||||
|
||||
@Schema(description = "连续签到奖励积分")
|
||||
private Integer bonusPoints;
|
||||
|
||||
@Schema(description = "重置签到天数(0表示不重置)")
|
||||
private Integer resetDays;
|
||||
|
||||
@Schema(description = "调整原因", example = "不好")
|
||||
private String adjustReason;
|
||||
|
||||
@Schema(description = "操作人用户编号", example = "7956")
|
||||
private Long operatorId;
|
||||
|
||||
@Schema(description = "操作人账号", example = "李四")
|
||||
private String operatorName;
|
||||
|
||||
@Schema(description = "状态(0-禁用 1-启用)", example = "2")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "备注", example = "你说的对")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package cn.iocoder.yudao.module.tik.muye.pointsigninconfig.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
import cn.idev.excel.annotation.*;
|
||||
|
||||
@Schema(description = "管理后台 - 积分签到配置 Response VO")
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class PointSigninConfigRespVO {
|
||||
|
||||
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "5169")
|
||||
@ExcelProperty("主键")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "每日签到赠送积分", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("每日签到赠送积分")
|
||||
private Integer dailyPoints;
|
||||
|
||||
@Schema(description = "连续签到天数", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("连续签到天数")
|
||||
private Integer continuousDays;
|
||||
|
||||
@Schema(description = "连续签到奖励积分", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("连续签到奖励积分")
|
||||
private Integer bonusPoints;
|
||||
|
||||
@Schema(description = "重置签到天数(0表示不重置)", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("重置签到天数(0表示不重置)")
|
||||
private Integer resetDays;
|
||||
|
||||
@Schema(description = "调整原因", requiredMode = Schema.RequiredMode.REQUIRED, example = "不好")
|
||||
@ExcelProperty("调整原因")
|
||||
private String adjustReason;
|
||||
|
||||
@Schema(description = "操作人用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "7956")
|
||||
@ExcelProperty("操作人用户编号")
|
||||
private Long operatorId;
|
||||
|
||||
@Schema(description = "操作人账号", requiredMode = Schema.RequiredMode.REQUIRED, example = "李四")
|
||||
@ExcelProperty("操作人账号")
|
||||
private String operatorName;
|
||||
|
||||
@Schema(description = "状态(0-禁用 1-启用)", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||
@ExcelProperty("状态(0-禁用 1-启用)")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED, example = "你说的对")
|
||||
@ExcelProperty("备注")
|
||||
private String remark;
|
||||
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package cn.iocoder.yudao.module.tik.muye.pointsigninconfig.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import jakarta.validation.constraints.*;
|
||||
|
||||
@Schema(description = "管理后台 - 积分签到配置新增/修改 Request VO")
|
||||
@Data
|
||||
public class PointSigninConfigSaveReqVO {
|
||||
|
||||
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "5169")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "每日签到赠送积分", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "每日签到赠送积分不能为空")
|
||||
private Integer dailyPoints;
|
||||
|
||||
@Schema(description = "连续签到天数", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "连续签到天数不能为空")
|
||||
private Integer continuousDays;
|
||||
|
||||
@Schema(description = "连续签到奖励积分", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "连续签到奖励积分不能为空")
|
||||
private Integer bonusPoints;
|
||||
|
||||
@Schema(description = "重置签到天数(0表示不重置)", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "重置签到天数(0表示不重置)不能为空")
|
||||
private Integer resetDays;
|
||||
|
||||
@Schema(description = "调整原因", requiredMode = Schema.RequiredMode.REQUIRED, example = "不好")
|
||||
@NotEmpty(message = "调整原因不能为空")
|
||||
private String adjustReason;
|
||||
|
||||
@Schema(description = "操作人用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "7956")
|
||||
@NotNull(message = "操作人用户编号不能为空")
|
||||
private Long operatorId;
|
||||
|
||||
@Schema(description = "操作人账号", requiredMode = Schema.RequiredMode.REQUIRED, example = "李四")
|
||||
@NotEmpty(message = "操作人账号不能为空")
|
||||
private String operatorName;
|
||||
|
||||
@Schema(description = "状态(0-禁用 1-启用)", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||
@NotNull(message = "状态(0-禁用 1-启用)不能为空")
|
||||
private Integer status;
|
||||
|
||||
@Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED, example = "你说的对")
|
||||
@NotEmpty(message = "备注不能为空")
|
||||
private String remark;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="cn.iocoder.yudao.module.tik.muye.aiagent.mapper.AiAgentMapper">
|
||||
|
||||
<!--
|
||||
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
||||
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
|
||||
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
||||
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||
-->
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="cn.iocoder.yudao.module.tik.muye.aiapplication.mapper.AiApplicationMapper">
|
||||
|
||||
<!--
|
||||
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
||||
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
|
||||
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
||||
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||
-->
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="cn.iocoder.yudao.module.tik.muye.aimodelconfig.mapper.AiModelConfigMapper">
|
||||
|
||||
<!--
|
||||
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
||||
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
|
||||
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
||||
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||
-->
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="cn.iocoder.yudao.module.tik.muye.membergiftpackage.mapper.MemberGiftPackageMapper">
|
||||
|
||||
<!--
|
||||
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
||||
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
|
||||
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
||||
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||
-->
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="cn.iocoder.yudao.module.tik.muye.memberrechargerecord.mapper.MemberRechargeRecordMapper">
|
||||
|
||||
<!--
|
||||
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
||||
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
|
||||
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
||||
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||
-->
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="cn.iocoder.yudao.module.tik.muye.memberuserpermission.mapper.MemberUserPermissionMapper">
|
||||
|
||||
<!--
|
||||
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
||||
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
|
||||
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
||||
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||
-->
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="cn.iocoder.yudao.module.tik.muye.memberuserprofile.mapper.MemberUserProfileMapper">
|
||||
|
||||
<!--
|
||||
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
||||
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
|
||||
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
||||
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||
-->
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="cn.iocoder.yudao.module.tik.muye.pointexchangeconfig.mapper.PointExchangeConfigMapper">
|
||||
|
||||
<!--
|
||||
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
||||
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
|
||||
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
||||
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||
-->
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="cn.iocoder.yudao.module.tik.muye.pointrechargeconfig.mapper.PointRechargeConfigMapper">
|
||||
|
||||
<!--
|
||||
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
||||
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
|
||||
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
||||
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||
-->
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="cn.iocoder.yudao.module.tik.muye.pointrecord.mapper.PointRecordMapper">
|
||||
|
||||
<!--
|
||||
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
||||
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
|
||||
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
||||
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||
-->
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="cn.iocoder.yudao.module.tik.muye.pointsigninconfig.mapper.PointSigninConfigMapper">
|
||||
|
||||
<!--
|
||||
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
||||
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
|
||||
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
||||
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||
-->
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user