Compare commits
39 Commits
4c81ebac23
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| a99f05d029 | |||
| bd315fcbd9 | |||
| 716cde6ea0 | |||
| 04755188d6 | |||
| b12f232f56 | |||
| d75a3e0212 | |||
| 299bc5e28b | |||
| d7ed10f45d | |||
| ca6e3d20f6 | |||
| 6fad3b45fe | |||
| a8da54c130 | |||
| d105bd4fa6 | |||
| be54601cdd | |||
| 2207add193 | |||
| 98e427c65a | |||
| baf38df6c3 | |||
| eb4b615ed6 | |||
| 2ed121926b | |||
| c07367ea53 | |||
| 7c72e60a32 | |||
| 0cab423604 | |||
| 2eaf9a37d5 | |||
| c3b18774e0 | |||
| 2e8a5db5fc | |||
| 553feba55d | |||
| 128f840f7e | |||
| cfa2c89600 | |||
| 0c5a038595 | |||
| d517682c62 | |||
| 419d9a930c | |||
| 1694603465 | |||
| e2269e1ff4 | |||
| ccbbcbff53 | |||
| 16f1d653c3 | |||
| 5c95baf336 | |||
| 6c7cc367b5 | |||
| 6328a5531d | |||
| bb1b1af3ea | |||
| a5d2125d90 |
34
CLAUDE.md
34
CLAUDE.md
@@ -67,6 +67,7 @@ The project uses a **modular monolith** architecture with the following key modu
|
|||||||
- `yolo-spring-boot-starter-biz-*`: Business-specific components (tenant, data permission, IP)
|
- `yolo-spring-boot-starter-biz-*`: Business-specific components (tenant, data permission, IP)
|
||||||
- **yolo-module-system**: System management module (users, roles, permissions, dictionaries)
|
- **yolo-module-system**: System management module (users, roles, permissions, dictionaries)
|
||||||
- **yolo-module-infra**: Infrastructure module (jobs, file storage, code generator, monitoring)
|
- **yolo-module-infra**: Infrastructure module (jobs, file storage, code generator, monitoring)
|
||||||
|
- **keyboard-server**: Business module for keyboard-specific features (custom controllers, services, DAL)
|
||||||
- **yolo-server**: Main application container (empty shell that aggregates modules)
|
- **yolo-server**: Main application container (empty shell that aggregates modules)
|
||||||
|
|
||||||
### Layered Architecture
|
### Layered Architecture
|
||||||
@@ -104,30 +105,17 @@ enums/ # Module-specific enums
|
|||||||
- Connection: `jdbc:postgresql://localhost:5432/keyborad_db`
|
- Connection: `jdbc:postgresql://localhost:5432/keyborad_db`
|
||||||
- Default credentials: root/123asd
|
- Default credentials: root/123asd
|
||||||
|
|
||||||
### Database Scripts
|
|
||||||
SQL scripts are located in `sql/` directory with support for multiple databases:
|
|
||||||
- `sql/postgresql/` - PostgreSQL scripts
|
|
||||||
- `sql/mysql/` - MySQL scripts
|
|
||||||
- `sql/oracle/`, `sql/sqlserver/`, `sql/dm/`, `sql/kingbase/`, `sql/opengauss/` - Other DB support
|
|
||||||
|
|
||||||
### Database Conversion
|
|
||||||
Use `sql/tools/convertor.py` to convert MySQL scripts to other databases:
|
|
||||||
```bash
|
|
||||||
cd sql/tools
|
|
||||||
python3 convertor.py postgres > output.sql
|
|
||||||
```
|
|
||||||
|
|
||||||
### Quick Database Setup with Docker
|
### Quick Database Setup with Docker
|
||||||
```bash
|
```bash
|
||||||
cd sql/tools
|
cd script/docker
|
||||||
docker compose up -d postgres
|
docker compose up -d
|
||||||
```
|
```
|
||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
|
|
||||||
### Application Profiles
|
### Application Profiles
|
||||||
- `application.yaml` - Base configuration
|
- `application.yaml` - Base configuration
|
||||||
- `application-local.yaml` - Local development (port 48080)
|
- `application-local.yaml` - Local development (port 48081)
|
||||||
- `application-dev.yaml` - Development environment
|
- `application-dev.yaml` - Development environment
|
||||||
|
|
||||||
### Key Configuration Properties
|
### Key Configuration Properties
|
||||||
@@ -174,15 +162,15 @@ Configured via `spring.datasource.dynamic.datasource`:
|
|||||||
|
|
||||||
## API Documentation
|
## API Documentation
|
||||||
|
|
||||||
- **Swagger UI**: http://localhost:48080/swagger-ui
|
- **Swagger UI**: http://localhost:48081/swagger-ui
|
||||||
- **Knife4j UI**: http://localhost:48080/doc.html (enhanced Swagger UI)
|
- **Knife4j UI**: http://localhost:48081/doc.html (enhanced Swagger UI)
|
||||||
- **OpenAPI JSON**: http://localhost:48080/v3/api-docs
|
- **OpenAPI JSON**: http://localhost:48081/v3/api-docs
|
||||||
|
|
||||||
## Monitoring & Admin
|
## Monitoring & Admin
|
||||||
|
|
||||||
- **Spring Boot Admin**: http://localhost:48080/admin
|
- **Spring Boot Admin**: http://localhost:48081/admin
|
||||||
- **Actuator**: http://localhost:48080/actuator
|
- **Actuator**: http://localhost:48081/actuator
|
||||||
- **Druid Monitor**: http://localhost:48080/druid (database connection pool)
|
- **Druid Monitor**: http://localhost:48081/druid (database connection pool)
|
||||||
|
|
||||||
## Common Issues
|
## Common Issues
|
||||||
|
|
||||||
@@ -193,7 +181,7 @@ If you encounter startup issues, refer to: https://doc.iocoder.cn/quick-start/
|
|||||||
Ensure PostgreSQL is running and credentials in `application-local.yaml` are correct.
|
Ensure PostgreSQL is running and credentials in `application-local.yaml` are correct.
|
||||||
|
|
||||||
### Port Conflicts
|
### Port Conflicts
|
||||||
Default port is 48080. Change via `server.port` in configuration files.
|
Default port is 48081. Change via `server.port` in configuration files.
|
||||||
|
|
||||||
## Dependencies & Versions
|
## Dependencies & Versions
|
||||||
|
|
||||||
|
|||||||
@@ -52,5 +52,11 @@
|
|||||||
<version>2025.11-SNAPSHOT</version>
|
<version>2025.11-SNAPSHOT</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.yolo</groupId>
|
||||||
|
<artifactId>yolo-module-system</artifactId>
|
||||||
|
<version>2025.11-SNAPSHOT</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
|
|||||||
@@ -0,0 +1,55 @@
|
|||||||
|
package com.yolo.keyboard.api.invitecode;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.RandomUtil;
|
||||||
|
import com.yolo.keyboard.dal.dataobject.userinvitecodes.KeyboardUserInviteCodesDO;
|
||||||
|
import com.yolo.keyboard.dal.mysql.userinvitecodes.KeyboardUserInviteCodesMapper;
|
||||||
|
import com.yolo.keyboard.module.system.api.invitecode.UserInviteCodeApi;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户邀请码 API 实现类
|
||||||
|
*
|
||||||
|
* @author ziin
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class UserInviteCodeApiImpl implements UserInviteCodeApi {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private KeyboardUserInviteCodesMapper userInviteCodesMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String createInviteCodeForAgent(Long userId, Long tenantId) {
|
||||||
|
String inviteCode = generateUniqueInviteCode();
|
||||||
|
KeyboardUserInviteCodesDO inviteCodeDO = KeyboardUserInviteCodesDO.builder()
|
||||||
|
.code(inviteCode)
|
||||||
|
.ownerSystemUserId(userId)
|
||||||
|
.ownerTenantId(tenantId)
|
||||||
|
.status((short) 1)
|
||||||
|
.createdAt(LocalDateTime.now())
|
||||||
|
.usedCount(0)
|
||||||
|
.inviteType("AGENT")
|
||||||
|
.build();
|
||||||
|
userInviteCodesMapper.insert(inviteCodeDO);
|
||||||
|
return inviteCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生成唯一的6位邀请码(字母和数字混合)
|
||||||
|
*/
|
||||||
|
private String generateUniqueInviteCode() {
|
||||||
|
String code;
|
||||||
|
int maxAttempts = 100;
|
||||||
|
int attempt = 0;
|
||||||
|
do {
|
||||||
|
code = RandomUtil.randomString("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789", 6);
|
||||||
|
attempt++;
|
||||||
|
if (attempt >= maxAttempts) {
|
||||||
|
throw new RuntimeException("无法生成唯一的邀请码,请稍后重试");
|
||||||
|
}
|
||||||
|
} while (userInviteCodesMapper.selectOne(KeyboardUserInviteCodesDO::getCode, code) != null);
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
package com.yolo.keyboard.api.tenantbalance;
|
||||||
|
|
||||||
|
import com.yolo.keyboard.dal.dataobject.tenantbalance.TenantBalanceDO;
|
||||||
|
import com.yolo.keyboard.dal.mysql.tenantbalance.TenantBalanceMapper;
|
||||||
|
import com.yolo.keyboard.module.system.api.tenantbalance.TenantBalanceApi;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 租户余额 API 实现类
|
||||||
|
*
|
||||||
|
* @author ziin
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Slf4j
|
||||||
|
public class TenantBalanceApiImpl implements TenantBalanceApi {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private TenantBalanceMapper tenantBalanceMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void initTenantBalance(Long tenantId) {
|
||||||
|
// 检查是否已存在
|
||||||
|
TenantBalanceDO existingBalance = tenantBalanceMapper.selectById(tenantId);
|
||||||
|
if (existingBalance != null) {
|
||||||
|
log.info("[initTenantBalance] 租户 {} 钱包已存在,跳过初始化", tenantId);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 初始化租户钱包
|
||||||
|
TenantBalanceDO balance = new TenantBalanceDO();
|
||||||
|
balance.setId(tenantId);
|
||||||
|
balance.setBalance(BigDecimal.ZERO);
|
||||||
|
balance.setWithdrawableBalance(BigDecimal.ZERO);
|
||||||
|
balance.setFrozenAmt(BigDecimal.ZERO);
|
||||||
|
balance.setVersion(0);
|
||||||
|
tenantBalanceMapper.insert(balance);
|
||||||
|
|
||||||
|
log.info("[initTenantBalance] 租户 {} 钱包初始化成功", tenantId);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,104 @@
|
|||||||
|
package com.yolo.keyboard.controller.admin.tag;
|
||||||
|
|
||||||
|
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 com.yolo.keyboard.framework.common.pojo.PageParam;
|
||||||
|
import com.yolo.keyboard.framework.common.pojo.PageResult;
|
||||||
|
import com.yolo.keyboard.framework.common.pojo.CommonResult;
|
||||||
|
import com.yolo.keyboard.framework.common.util.object.BeanUtils;
|
||||||
|
import static com.yolo.keyboard.framework.common.pojo.CommonResult.success;
|
||||||
|
|
||||||
|
import com.yolo.keyboard.framework.excel.core.util.ExcelUtils;
|
||||||
|
|
||||||
|
import com.yolo.keyboard.framework.apilog.core.annotation.ApiAccessLog;
|
||||||
|
import static com.yolo.keyboard.framework.apilog.core.enums.OperateTypeEnum.*;
|
||||||
|
|
||||||
|
import com.yolo.keyboard.controller.admin.tag.vo.*;
|
||||||
|
import com.yolo.keyboard.dal.dataobject.tag.KeyboardTagDO;
|
||||||
|
import com.yolo.keyboard.service.tag.KeyboardTagService;
|
||||||
|
|
||||||
|
@Tag(name = "管理后台 - 人设标签")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/keyboard/tag")
|
||||||
|
@Validated
|
||||||
|
public class KeyboardTagController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private KeyboardTagService tagService;
|
||||||
|
|
||||||
|
@PostMapping("/create")
|
||||||
|
@Operation(summary = "创建人设标签")
|
||||||
|
@PreAuthorize("@ss.hasPermission('keyboard:tag:create')")
|
||||||
|
public CommonResult<Integer> createTag(@Valid @RequestBody KeyboardTagSaveReqVO createReqVO) {
|
||||||
|
return success(tagService.createTag(createReqVO));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/update")
|
||||||
|
@Operation(summary = "更新人设标签")
|
||||||
|
@PreAuthorize("@ss.hasPermission('keyboard:tag:update')")
|
||||||
|
public CommonResult<Boolean> updateTag(@Valid @RequestBody KeyboardTagSaveReqVO updateReqVO) {
|
||||||
|
tagService.updateTag(updateReqVO);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/delete")
|
||||||
|
@Operation(summary = "删除人设标签")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true)
|
||||||
|
@PreAuthorize("@ss.hasPermission('keyboard:tag:delete')")
|
||||||
|
public CommonResult<Boolean> deleteTag(@RequestParam("id") Integer id) {
|
||||||
|
tagService.deleteTag(id);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/delete-list")
|
||||||
|
@Parameter(name = "ids", description = "编号", required = true)
|
||||||
|
@Operation(summary = "批量删除人设标签")
|
||||||
|
@PreAuthorize("@ss.hasPermission('keyboard:tag:delete')")
|
||||||
|
public CommonResult<Boolean> deleteTagList(@RequestParam("ids") List<Integer> ids) {
|
||||||
|
tagService.deleteTagListByIds(ids);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/get")
|
||||||
|
@Operation(summary = "获得人设标签")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||||
|
@PreAuthorize("@ss.hasPermission('keyboard:tag:query')")
|
||||||
|
public CommonResult<KeyboardTagRespVO> getTag(@RequestParam("id") Integer id) {
|
||||||
|
KeyboardTagDO tag = tagService.getTag(id);
|
||||||
|
return success(BeanUtils.toBean(tag, KeyboardTagRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/page")
|
||||||
|
@Operation(summary = "获得人设标签分页")
|
||||||
|
@PreAuthorize("@ss.hasPermission('keyboard:tag:query')")
|
||||||
|
public CommonResult<PageResult<KeyboardTagRespVO>> getTagPage(@Valid KeyboardTagPageReqVO pageReqVO) {
|
||||||
|
PageResult<KeyboardTagDO> pageResult = tagService.getTagPage(pageReqVO);
|
||||||
|
return success(BeanUtils.toBean(pageResult, KeyboardTagRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/export-excel")
|
||||||
|
@Operation(summary = "导出人设标签 Excel")
|
||||||
|
@PreAuthorize("@ss.hasPermission('keyboard:tag:export')")
|
||||||
|
@ApiAccessLog(operateType = EXPORT)
|
||||||
|
public void exportTagExcel(@Valid KeyboardTagPageReqVO pageReqVO,
|
||||||
|
HttpServletResponse response) throws IOException {
|
||||||
|
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||||
|
List<KeyboardTagDO> list = tagService.getTagPage(pageReqVO).getList();
|
||||||
|
// 导出 Excel
|
||||||
|
ExcelUtils.write(response, "人设标签.xls", "数据", KeyboardTagRespVO.class,
|
||||||
|
BeanUtils.toBean(list, KeyboardTagRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package com.yolo.keyboard.controller.admin.tag.vo;
|
||||||
|
|
||||||
|
import lombok.*;
|
||||||
|
import java.util.*;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import com.yolo.keyboard.framework.common.pojo.PageParam;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
import static com.yolo.keyboard.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 人设标签分页 Request VO")
|
||||||
|
@Data
|
||||||
|
public class KeyboardTagPageReqVO extends PageParam {
|
||||||
|
|
||||||
|
@Schema(description = "标签名", example = "王五")
|
||||||
|
private String tagName;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间")
|
||||||
|
private LocalDateTime createdAt;
|
||||||
|
|
||||||
|
@Schema(description = "更新时间")
|
||||||
|
private LocalDateTime updatedAt;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
package com.yolo.keyboard.controller.admin.tag.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 KeyboardTagRespVO {
|
||||||
|
|
||||||
|
@Schema(description = "主键 Id", requiredMode = Schema.RequiredMode.REQUIRED, example = "20413")
|
||||||
|
@ExcelProperty("主键 Id")
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
@Schema(description = "标签名", example = "王五")
|
||||||
|
@ExcelProperty("标签名")
|
||||||
|
private String tagName;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间")
|
||||||
|
@ExcelProperty("创建时间")
|
||||||
|
private LocalDateTime createdAt;
|
||||||
|
|
||||||
|
@Schema(description = "更新时间")
|
||||||
|
@ExcelProperty("更新时间")
|
||||||
|
private LocalDateTime updatedAt;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
package com.yolo.keyboard.controller.admin.tag.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 KeyboardTagSaveReqVO {
|
||||||
|
|
||||||
|
@Schema(description = "主键 Id", requiredMode = Schema.RequiredMode.REQUIRED, example = "20413")
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
@Schema(description = "标签名", example = "王五")
|
||||||
|
private String tagName;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间")
|
||||||
|
private LocalDateTime createdAt;
|
||||||
|
|
||||||
|
@Schema(description = "更新时间")
|
||||||
|
private LocalDateTime updatedAt;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,191 @@
|
|||||||
|
package com.yolo.keyboard.controller.admin.tenantbalance;
|
||||||
|
|
||||||
|
import com.yolo.keyboard.dal.dataobject.tenantbalancetransaction.TenantBalanceTransactionDO;
|
||||||
|
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 com.yolo.keyboard.framework.common.pojo.PageParam;
|
||||||
|
import com.yolo.keyboard.framework.common.pojo.PageResult;
|
||||||
|
import com.yolo.keyboard.framework.common.pojo.CommonResult;
|
||||||
|
import com.yolo.keyboard.framework.common.util.object.BeanUtils;
|
||||||
|
import static com.yolo.keyboard.framework.common.pojo.CommonResult.success;
|
||||||
|
|
||||||
|
import com.yolo.keyboard.framework.excel.core.util.ExcelUtils;
|
||||||
|
|
||||||
|
import com.yolo.keyboard.framework.apilog.core.annotation.ApiAccessLog;
|
||||||
|
import static com.yolo.keyboard.framework.apilog.core.enums.OperateTypeEnum.*;
|
||||||
|
|
||||||
|
import com.yolo.keyboard.controller.admin.tenantbalance.vo.*;
|
||||||
|
import com.yolo.keyboard.dal.dataobject.tenantbalance.TenantBalanceDO;
|
||||||
|
import com.yolo.keyboard.service.tenantbalance.TenantBalanceService;
|
||||||
|
|
||||||
|
@Tag(name = "管理后台 - 租户余额")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/keyboard/tenant-balance")
|
||||||
|
@Validated
|
||||||
|
public class TenantBalanceController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private TenantBalanceService tenantBalanceService;
|
||||||
|
|
||||||
|
@PostMapping("/create")
|
||||||
|
@Operation(summary = "创建租户余额")
|
||||||
|
@PreAuthorize("@ss.hasPermission('keyboard:tenant-balance:create')")
|
||||||
|
public CommonResult<Long> createTenantBalance(@Valid @RequestBody TenantBalanceSaveReqVO createReqVO) {
|
||||||
|
return success(tenantBalanceService.createTenantBalance(createReqVO));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/update")
|
||||||
|
@Operation(summary = "更新租户余额")
|
||||||
|
@PreAuthorize("@ss.hasPermission('keyboard:tenant-balance:update')")
|
||||||
|
public CommonResult<Boolean> updateTenantBalance(@Valid @RequestBody TenantBalanceSaveReqVO updateReqVO) {
|
||||||
|
tenantBalanceService.updateTenantBalance(updateReqVO);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/delete")
|
||||||
|
@Operation(summary = "删除租户余额")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true)
|
||||||
|
@PreAuthorize("@ss.hasPermission('keyboard:tenant-balance:delete')")
|
||||||
|
public CommonResult<Boolean> deleteTenantBalance(@RequestParam("id") Long id) {
|
||||||
|
tenantBalanceService.deleteTenantBalance(id);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/delete-list")
|
||||||
|
@Parameter(name = "ids", description = "编号", required = true)
|
||||||
|
@Operation(summary = "批量删除租户余额")
|
||||||
|
@PreAuthorize("@ss.hasPermission('keyboard:tenant-balance:delete')")
|
||||||
|
public CommonResult<Boolean> deleteTenantBalanceList(@RequestParam("ids") List<Long> ids) {
|
||||||
|
tenantBalanceService.deleteTenantBalanceListByIds(ids);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/get")
|
||||||
|
@Operation(summary = "获得租户余额")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||||
|
@PreAuthorize("@ss.hasPermission('keyboard:tenant-balance:query')")
|
||||||
|
public CommonResult<TenantBalanceRespVO> getTenantBalance(@RequestParam("id") Long id) {
|
||||||
|
TenantBalanceDO tenantBalance = tenantBalanceService.getTenantBalance(id);
|
||||||
|
return success(BeanUtils.toBean(tenantBalance, TenantBalanceRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/page")
|
||||||
|
@Operation(summary = "获得租户余额分页")
|
||||||
|
@PreAuthorize("@ss.hasPermission('keyboard:tenant-balance:query')")
|
||||||
|
public CommonResult<PageResult<TenantBalanceRespVO>> getTenantBalancePage(@Valid TenantBalancePageReqVO pageReqVO) {
|
||||||
|
PageResult<TenantBalanceDO> pageResult = tenantBalanceService.getTenantBalancePage(pageReqVO);
|
||||||
|
return success(BeanUtils.toBean(pageResult, TenantBalanceRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/export-excel")
|
||||||
|
@Operation(summary = "导出租户余额 Excel")
|
||||||
|
@PreAuthorize("@ss.hasPermission('keyboard:tenant-balance:export')")
|
||||||
|
@ApiAccessLog(operateType = EXPORT)
|
||||||
|
public void exportTenantBalanceExcel(@Valid TenantBalancePageReqVO pageReqVO,
|
||||||
|
HttpServletResponse response) throws IOException {
|
||||||
|
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||||
|
List<TenantBalanceDO> list = tenantBalanceService.getTenantBalancePage(pageReqVO).getList();
|
||||||
|
// 导出 Excel
|
||||||
|
ExcelUtils.write(response, "租户余额.xls", "数据", TenantBalanceRespVO.class,
|
||||||
|
BeanUtils.toBean(list, TenantBalanceRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/addAmount")
|
||||||
|
@Operation(summary = "添加租户余额")
|
||||||
|
@PreAuthorize("@ss.hasPermission('system:tenant-balance:add')")
|
||||||
|
public CommonResult<Boolean> addTenantBalance(@Valid @RequestBody TenantBalanceAddReqVO addReqVO) {
|
||||||
|
tenantBalanceService.addTenantBalance(addReqVO);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/get-self-amount")
|
||||||
|
@Operation(summary = "获得自己的余额")
|
||||||
|
@PreAuthorize("@ss.hasPermission('system:tenant-balance:self-amount')")
|
||||||
|
public CommonResult<TenantBalanceRespVO> getTenantBalance() {
|
||||||
|
TenantBalanceDO tenantBalance = tenantBalanceService.getSelfBalance();
|
||||||
|
return success(BeanUtils.toBean(tenantBalance, TenantBalanceRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/get-self-subordinate-amount-page")
|
||||||
|
@Operation(summary = "获得自己下级余额的分页")
|
||||||
|
@PreAuthorize("@ss.hasPermission('system:tenant-balance:self-subordinate')")
|
||||||
|
public CommonResult<PageResult<TenantBalanceRespVO>> getSelfSubordinate(@Valid TenantBalancePageReqVO pageReqVO) {
|
||||||
|
PageResult<TenantBalanceRespVO> tenantBalancePage = tenantBalanceService.getSelfSubordinateTenantBalancePage(pageReqVO);
|
||||||
|
return success(BeanUtils.toBean(tenantBalancePage, TenantBalanceRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/withdraw")
|
||||||
|
@Operation(summary = "租户提现")
|
||||||
|
@PreAuthorize("@ss.hasPermission('system:tenant-balance:withdraw')")
|
||||||
|
public CommonResult<Boolean> withdraw(@Valid @RequestBody TenantBalanceWithdrawReqVO withdrawReqVO) {
|
||||||
|
tenantBalanceService.withdraw(withdrawReqVO);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// ==================== 子表(租户积分记录) ====================
|
||||||
|
|
||||||
|
@GetMapping("/tenant-balance-transaction/page")
|
||||||
|
@Operation(summary = "获得租户积分记录分页")
|
||||||
|
@Parameter(name = "tenantId", description = "租户 Id")
|
||||||
|
@PreAuthorize("@ss.hasPermission('keyboard:tenant-balance:query')")
|
||||||
|
public CommonResult<PageResult<TenantBalanceTransactionRespVO>> getTenantBalanceTransactionPage(PageParam pageReqVO,
|
||||||
|
@RequestParam("tenantId") Long tenantId) {
|
||||||
|
PageResult<TenantBalanceTransactionDO> pageResult = tenantBalanceService.getTenantBalanceTransactionPage(pageReqVO, tenantId);
|
||||||
|
return success(BeanUtils.toBean(pageResult, TenantBalanceTransactionRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/tenant-balance-transaction/create")
|
||||||
|
@Operation(summary = "创建租户积分记录")
|
||||||
|
@PreAuthorize("@ss.hasPermission('keyboard:tenant-balance:create')")
|
||||||
|
public CommonResult<Long> createTenantBalanceTransaction(@Valid @RequestBody TenantBalanceTransactionDO tenantBalanceTransaction) {
|
||||||
|
return success(tenantBalanceService.createTenantBalanceTransaction(tenantBalanceTransaction));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/tenant-balance-transaction/update")
|
||||||
|
@Operation(summary = "更新租户积分记录")
|
||||||
|
@PreAuthorize("@ss.hasPermission('keyboard:tenant-balance:update')")
|
||||||
|
public CommonResult<Boolean> updateTenantBalanceTransaction(@Valid @RequestBody TenantBalanceTransactionDO tenantBalanceTransaction) {
|
||||||
|
tenantBalanceService.updateTenantBalanceTransaction(tenantBalanceTransaction);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/tenant-balance-transaction/delete")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true)
|
||||||
|
@Operation(summary = "删除租户积分记录")
|
||||||
|
@PreAuthorize("@ss.hasPermission('keyboard:tenant-balance:delete')")
|
||||||
|
public CommonResult<Boolean> deleteTenantBalanceTransaction(@RequestParam("id") Long id) {
|
||||||
|
tenantBalanceService.deleteTenantBalanceTransaction(id);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/tenant-balance-transaction/delete-list")
|
||||||
|
@Parameter(name = "ids", description = "编号", required = true)
|
||||||
|
@Operation(summary = "批量删除租户积分记录")
|
||||||
|
@PreAuthorize("@ss.hasPermission('keyboard:tenant-balance:delete')")
|
||||||
|
public CommonResult<Boolean> deleteTenantBalanceTransactionList(@RequestParam("ids") List<Long> ids) {
|
||||||
|
tenantBalanceService.deleteTenantBalanceTransactionListByIds(ids);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/tenant-balance-transaction/get")
|
||||||
|
@Operation(summary = "获得租户积分记录")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true)
|
||||||
|
@PreAuthorize("@ss.hasPermission('keyboard:tenant-balance:query')")
|
||||||
|
public CommonResult<TenantBalanceTransactionRespVO> getTenantBalanceTransaction(@RequestParam("id") Long id) {
|
||||||
|
TenantBalanceTransactionDO transaction = tenantBalanceService.getTenantBalanceTransaction(id);
|
||||||
|
return success(BeanUtils.toBean(transaction, TenantBalanceTransactionRespVO.class));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package com.yolo.keyboard.controller.admin.tenantbalance.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @author: ziin
|
||||||
|
* @date: 2025/11/19 21:05
|
||||||
|
*/
|
||||||
|
@Schema(description = "管理后台 - 租户余额添加VO")
|
||||||
|
@Data
|
||||||
|
public class TenantBalanceAddReqVO {
|
||||||
|
@Schema(description = "租户 Id", requiredMode = Schema.RequiredMode.REQUIRED, example = "19954")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "增加的余额", requiredMode = Schema.RequiredMode.REQUIRED, example = "1000000")
|
||||||
|
private BigDecimal amount;
|
||||||
|
|
||||||
|
@Schema(description = "备注", example = "备注")
|
||||||
|
private String remark;
|
||||||
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
package com.yolo.keyboard.controller.admin.tenantbalance.vo;
|
||||||
|
|
||||||
|
import lombok.*;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.*;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import com.yolo.keyboard.framework.common.pojo.PageParam;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
import static com.yolo.keyboard.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 租户余额分页 Request VO")
|
||||||
|
@Data
|
||||||
|
public class TenantBalancePageReqVO extends PageParam {
|
||||||
|
|
||||||
|
@Schema(description = "当前积分余额")
|
||||||
|
private BigDecimal balance;
|
||||||
|
|
||||||
|
@Schema(description = "乐观锁版本号")
|
||||||
|
private Integer version;
|
||||||
|
|
||||||
|
@Schema(description = "更新时间")
|
||||||
|
private LocalDateTime updatedAt;
|
||||||
|
|
||||||
|
|
||||||
|
@Schema(description = "冻结金额")
|
||||||
|
private BigDecimal frozenAmt;
|
||||||
|
|
||||||
|
@Schema(description = "可提现金额")
|
||||||
|
private BigDecimal withdrawableBalance;
|
||||||
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
package com.yolo.keyboard.controller.admin.tenantbalance.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.*;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
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 TenantBalanceRespVO {
|
||||||
|
|
||||||
|
@Schema(description = "租户 Id", requiredMode = Schema.RequiredMode.REQUIRED, example = "13447")
|
||||||
|
@ExcelProperty("租户 Id")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "当前积分余额", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@ExcelProperty("当前积分余额")
|
||||||
|
private BigDecimal balance;
|
||||||
|
|
||||||
|
@Schema(description = "乐观锁版本号", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@ExcelProperty("乐观锁版本号")
|
||||||
|
private Integer version;
|
||||||
|
|
||||||
|
@Schema(description = "更新时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@ExcelProperty("更新时间")
|
||||||
|
private LocalDateTime updatedAt;
|
||||||
|
|
||||||
|
@Schema(description = "冻结金额")
|
||||||
|
private BigDecimal frozenAmt;
|
||||||
|
|
||||||
|
@Schema(description = "可提现金额")
|
||||||
|
private BigDecimal withdrawableBalance;
|
||||||
|
}
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
package com.yolo.keyboard.controller.admin.tenantbalance.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.*;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.*;
|
||||||
|
import jakarta.validation.constraints.*;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 租户余额新增/修改 Request VO")
|
||||||
|
@Data
|
||||||
|
public class TenantBalanceSaveReqVO {
|
||||||
|
|
||||||
|
@Schema(description = "租户 Id", requiredMode = Schema.RequiredMode.REQUIRED, example = "13447")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "当前积分余额", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@NotNull(message = "当前积分余额不能为空")
|
||||||
|
private BigDecimal balance;
|
||||||
|
|
||||||
|
@Schema(description = "乐观锁版本号", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@NotNull(message = "乐观锁版本号不能为空")
|
||||||
|
private Integer version;
|
||||||
|
|
||||||
|
@Schema(description = "更新时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@NotNull(message = "更新时间不能为空")
|
||||||
|
private LocalDateTime updatedAt;
|
||||||
|
|
||||||
|
@Schema(description = "冻结金额")
|
||||||
|
private BigDecimal frozenAmt;
|
||||||
|
|
||||||
|
@Schema(description = "可提现金额")
|
||||||
|
private BigDecimal withdrawableBalance;
|
||||||
|
}
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
package com.yolo.keyboard.controller.admin.tenantbalance.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 租户积分记录 Response VO")
|
||||||
|
@Data
|
||||||
|
public class TenantBalanceTransactionRespVO {
|
||||||
|
|
||||||
|
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "本次变动点数,正加负减", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00")
|
||||||
|
private BigDecimal points;
|
||||||
|
|
||||||
|
@Schema(description = "变动后余额快照", example = "1000.00")
|
||||||
|
private BigDecimal balance;
|
||||||
|
|
||||||
|
@Schema(description = "变动后冻结金额快照", example = "200.00")
|
||||||
|
private BigDecimal frozenAmt;
|
||||||
|
|
||||||
|
@Schema(description = "变动后可提现余额快照", example = "800.00")
|
||||||
|
private BigDecimal withdrawableBalance;
|
||||||
|
|
||||||
|
@Schema(description = "变动类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "RECHARGE")
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
@Schema(description = "变动描述", example = "余额充值")
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
@Schema(description = "订单Id/业务单号", example = "ORD123456")
|
||||||
|
private String orderId;
|
||||||
|
|
||||||
|
@Schema(description = "业务流水号", example = "BIZ123456")
|
||||||
|
private String bizNo;
|
||||||
|
|
||||||
|
@Schema(description = "操作人Id", example = "1")
|
||||||
|
private Long operatorId;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间")
|
||||||
|
private LocalDateTime createdAt;
|
||||||
|
|
||||||
|
@Schema(description = "备注", example = "管理员充值")
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
@Schema(description = "租户Id", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||||
|
private Long tenantId;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
package com.yolo.keyboard.controller.admin.tenantbalance.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import jakarta.validation.constraints.DecimalMin;
|
||||||
|
import jakarta.validation.constraints.NotEmpty;
|
||||||
|
import jakarta.validation.constraints.NotNull;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 管理后台 - 租户余额提现 Request VO
|
||||||
|
*/
|
||||||
|
@Schema(description = "管理后台 - 租户余额提现 Request VO")
|
||||||
|
@Data
|
||||||
|
public class TenantBalanceWithdrawReqVO {
|
||||||
|
|
||||||
|
@Schema(description = "提现金额", requiredMode = Schema.RequiredMode.REQUIRED, example = "1000")
|
||||||
|
@NotNull(message = "提现金额不能为空")
|
||||||
|
@DecimalMin(value = "0.01", message = "提现金额必须大于0")
|
||||||
|
private BigDecimal amount;
|
||||||
|
|
||||||
|
@Schema(description = "打款渠道:BANK/ALIPAY/WECHAT", requiredMode = Schema.RequiredMode.REQUIRED, example = "BANK")
|
||||||
|
@NotEmpty(message = "打款渠道不能为空")
|
||||||
|
private String payChannel;
|
||||||
|
|
||||||
|
@Schema(description = "收款方类型:PERSON(个人)/COMPANY(企业)", requiredMode = Schema.RequiredMode.REQUIRED, example = "PERSON")
|
||||||
|
@NotEmpty(message = "收款方类型不能为空")
|
||||||
|
private String payeeType;
|
||||||
|
|
||||||
|
@Schema(description = "收款人姓名或公司名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "张三")
|
||||||
|
@NotEmpty(message = "收款人姓名不能为空")
|
||||||
|
private String payeeName;
|
||||||
|
|
||||||
|
@Schema(description = "收款账号(银行卡/支付宝等)", requiredMode = Schema.RequiredMode.REQUIRED, example = "6222021234567890123")
|
||||||
|
@NotEmpty(message = "收款账号不能为空")
|
||||||
|
private String payeeAccount;
|
||||||
|
|
||||||
|
@Schema(description = "收款银行名称(银行渠道必填)", example = "中国工商银行")
|
||||||
|
private String payeeBankName;
|
||||||
|
|
||||||
|
@Schema(description = "银行编码", example = "ICBC")
|
||||||
|
private String payeeBankCode;
|
||||||
|
|
||||||
|
@Schema(description = "银行支行名称", example = "北京分行朝阳支行")
|
||||||
|
private String payeeBankBranch;
|
||||||
|
|
||||||
|
@Schema(description = "备注", example = "提现备注")
|
||||||
|
private String remark;
|
||||||
|
}
|
||||||
@@ -0,0 +1,106 @@
|
|||||||
|
package com.yolo.keyboard.controller.admin.tenantcommission;
|
||||||
|
|
||||||
|
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 com.yolo.keyboard.framework.common.pojo.PageParam;
|
||||||
|
import com.yolo.keyboard.framework.common.pojo.PageResult;
|
||||||
|
import com.yolo.keyboard.framework.common.pojo.CommonResult;
|
||||||
|
import com.yolo.keyboard.framework.common.util.object.BeanUtils;
|
||||||
|
import static com.yolo.keyboard.framework.common.pojo.CommonResult.success;
|
||||||
|
|
||||||
|
import com.yolo.keyboard.framework.excel.core.util.ExcelUtils;
|
||||||
|
|
||||||
|
import com.yolo.keyboard.framework.apilog.core.annotation.ApiAccessLog;
|
||||||
|
import static com.yolo.keyboard.framework.apilog.core.enums.OperateTypeEnum.*;
|
||||||
|
|
||||||
|
import com.yolo.keyboard.controller.admin.tenantcommission.vo.*;
|
||||||
|
import com.yolo.keyboard.dal.dataobject.tenantcommission.KeyboardTenantCommissionDO;
|
||||||
|
import com.yolo.keyboard.service.tenantcommission.KeyboardTenantCommissionService;
|
||||||
|
|
||||||
|
@Tag(name = "管理后台 - 租户内购分成记录")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/keyboard/tenant-commission")
|
||||||
|
@Validated
|
||||||
|
public class KeyboardTenantCommissionController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private KeyboardTenantCommissionService tenantCommissionService;
|
||||||
|
|
||||||
|
|
||||||
|
@PostMapping("/create")
|
||||||
|
@Operation(summary = "创建租户内购分成记录")
|
||||||
|
@PreAuthorize("@ss.hasPermission('keyboard:tenant-commission:create')")
|
||||||
|
public CommonResult<Long> createTenantCommission(@Valid @RequestBody KeyboardTenantCommissionSaveReqVO createReqVO) {
|
||||||
|
|
||||||
|
return success(tenantCommissionService.createTenantCommission(createReqVO));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/update")
|
||||||
|
@Operation(summary = "更新租户内购分成记录")
|
||||||
|
@PreAuthorize("@ss.hasPermission('keyboard:tenant-commission:update')")
|
||||||
|
public CommonResult<Boolean> updateTenantCommission(@Valid @RequestBody KeyboardTenantCommissionSaveReqVO updateReqVO) {
|
||||||
|
tenantCommissionService.updateTenantCommission(updateReqVO);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/delete")
|
||||||
|
@Operation(summary = "删除租户内购分成记录")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true)
|
||||||
|
@PreAuthorize("@ss.hasPermission('keyboard:tenant-commission:delete')")
|
||||||
|
public CommonResult<Boolean> deleteTenantCommission(@RequestParam("id") Long id) {
|
||||||
|
tenantCommissionService.deleteTenantCommission(id);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/delete-list")
|
||||||
|
@Parameter(name = "ids", description = "编号", required = true)
|
||||||
|
@Operation(summary = "批量删除租户内购分成记录")
|
||||||
|
@PreAuthorize("@ss.hasPermission('keyboard:tenant-commission:delete')")
|
||||||
|
public CommonResult<Boolean> deleteTenantCommissionList(@RequestParam("ids") List<Long> ids) {
|
||||||
|
tenantCommissionService.deleteTenantCommissionListByIds(ids);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/get")
|
||||||
|
@Operation(summary = "获得租户内购分成记录")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||||
|
@PreAuthorize("@ss.hasPermission('keyboard:tenant-commission:query')")
|
||||||
|
public CommonResult<KeyboardTenantCommissionRespVO> getTenantCommission(@RequestParam("id") Long id) {
|
||||||
|
KeyboardTenantCommissionDO tenantCommission = tenantCommissionService.getTenantCommission(id);
|
||||||
|
return success(BeanUtils.toBean(tenantCommission, KeyboardTenantCommissionRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/page")
|
||||||
|
@Operation(summary = "获得租户内购分成记录分页")
|
||||||
|
@PreAuthorize("@ss.hasPermission('keyboard:tenant-commission:query')")
|
||||||
|
public CommonResult<PageResult<KeyboardTenantCommissionRespVO>> getTenantCommissionPage(@Valid KeyboardTenantCommissionPageReqVO pageReqVO) {
|
||||||
|
PageResult<KeyboardTenantCommissionDO> pageResult = tenantCommissionService.getTenantCommissionPage(pageReqVO);
|
||||||
|
return success(BeanUtils.toBean(pageResult, KeyboardTenantCommissionRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/export-excel")
|
||||||
|
@Operation(summary = "导出租户内购分成记录 Excel")
|
||||||
|
@PreAuthorize("@ss.hasPermission('keyboard:tenant-commission:export')")
|
||||||
|
@ApiAccessLog(operateType = EXPORT)
|
||||||
|
public void exportTenantCommissionExcel(@Valid KeyboardTenantCommissionPageReqVO pageReqVO,
|
||||||
|
HttpServletResponse response) throws IOException {
|
||||||
|
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||||
|
List<KeyboardTenantCommissionDO> list = tenantCommissionService.getTenantCommissionPage(pageReqVO).getList();
|
||||||
|
// 导出 Excel
|
||||||
|
ExcelUtils.write(response, "租户内购分成记录.xls", "数据", KeyboardTenantCommissionRespVO.class,
|
||||||
|
BeanUtils.toBean(list, KeyboardTenantCommissionRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
package com.yolo.keyboard.controller.admin.tenantcommission.vo;
|
||||||
|
|
||||||
|
import lombok.*;
|
||||||
|
import java.util.*;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import com.yolo.keyboard.framework.common.pojo.PageParam;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
import static com.yolo.keyboard.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 租户内购分成记录分页 Request VO")
|
||||||
|
@Data
|
||||||
|
public class KeyboardTenantCommissionPageReqVO extends PageParam {
|
||||||
|
|
||||||
|
@Schema(description = "租户ID", example = "1", hidden = true)
|
||||||
|
private Long tenantId;
|
||||||
|
|
||||||
|
@Schema(description = "内购记录ID", example = "20900")
|
||||||
|
private Integer purchaseRecordId;
|
||||||
|
|
||||||
|
@Schema(description = "内购交易ID", example = "30383")
|
||||||
|
private String transactionId;
|
||||||
|
|
||||||
|
@Schema(description = "被邀请用户ID(购买用户)", example = "2447")
|
||||||
|
private Integer inviteeUserId;
|
||||||
|
|
||||||
|
@Schema(description = "邀请人用户ID", example = "1012")
|
||||||
|
private Long inviterUserId;
|
||||||
|
|
||||||
|
@Schema(description = "内购金额")
|
||||||
|
private BigDecimal purchaseAmount;
|
||||||
|
|
||||||
|
@Schema(description = "分成比例")
|
||||||
|
private BigDecimal commissionRate;
|
||||||
|
|
||||||
|
@Schema(description = "分成金额")
|
||||||
|
private BigDecimal commissionAmount;
|
||||||
|
|
||||||
|
@Schema(description = "状态:PENDING-待结算,SETTLED-已结算,REFUNDED-已退款", example = "2")
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
@Schema(description = "内购时间")
|
||||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
|
private LocalDateTime[] purchaseTime;
|
||||||
|
|
||||||
|
@Schema(description = "结算时间")
|
||||||
|
private LocalDateTime settledAt;
|
||||||
|
|
||||||
|
@Schema(description = "关联的余额交易记录ID", example = "29131")
|
||||||
|
private Long balanceTransactionId;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间")
|
||||||
|
private LocalDateTime createdAt;
|
||||||
|
|
||||||
|
@Schema(description = "更新时间")
|
||||||
|
private LocalDateTime updatedAt;
|
||||||
|
|
||||||
|
@Schema(description = "备注", example = "随便")
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,76 @@
|
|||||||
|
package com.yolo.keyboard.controller.admin.tenantcommission.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 KeyboardTenantCommissionRespVO {
|
||||||
|
|
||||||
|
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "3144")
|
||||||
|
@ExcelProperty("主键")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "内购记录ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "20900")
|
||||||
|
@ExcelProperty("内购记录ID")
|
||||||
|
private Integer purchaseRecordId;
|
||||||
|
|
||||||
|
@Schema(description = "内购交易ID", example = "30383")
|
||||||
|
@ExcelProperty("内购交易ID")
|
||||||
|
private String transactionId;
|
||||||
|
|
||||||
|
@Schema(description = "被邀请用户ID(购买用户)", example = "2447")
|
||||||
|
@ExcelProperty("被邀请用户ID(购买用户)")
|
||||||
|
private Integer inviteeUserId;
|
||||||
|
|
||||||
|
@Schema(description = "邀请人用户ID", example = "1012")
|
||||||
|
@ExcelProperty("邀请人用户ID")
|
||||||
|
private Long inviterUserId;
|
||||||
|
|
||||||
|
@Schema(description = "内购金额")
|
||||||
|
@ExcelProperty("内购金额")
|
||||||
|
private BigDecimal purchaseAmount;
|
||||||
|
|
||||||
|
@Schema(description = "分成比例")
|
||||||
|
@ExcelProperty("分成比例")
|
||||||
|
private BigDecimal commissionRate;
|
||||||
|
|
||||||
|
@Schema(description = "分成金额")
|
||||||
|
@ExcelProperty("分成金额")
|
||||||
|
private BigDecimal commissionAmount;
|
||||||
|
|
||||||
|
@Schema(description = "状态:PENDING-待结算,SETTLED-已结算,REFUNDED-已退款", example = "2")
|
||||||
|
@ExcelProperty("状态:PENDING-待结算,SETTLED-已结算,REFUNDED-已退款")
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
@Schema(description = "内购时间")
|
||||||
|
@ExcelProperty("内购时间")
|
||||||
|
private LocalDateTime purchaseTime;
|
||||||
|
|
||||||
|
@Schema(description = "结算时间")
|
||||||
|
@ExcelProperty("结算时间")
|
||||||
|
private LocalDateTime settledAt;
|
||||||
|
|
||||||
|
@Schema(description = "关联的余额交易记录ID", example = "29131")
|
||||||
|
@ExcelProperty("关联的余额交易记录ID")
|
||||||
|
private Long balanceTransactionId;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间")
|
||||||
|
@ExcelProperty("创建时间")
|
||||||
|
private LocalDateTime createdAt;
|
||||||
|
|
||||||
|
@Schema(description = "更新时间")
|
||||||
|
@ExcelProperty("更新时间")
|
||||||
|
private LocalDateTime updatedAt;
|
||||||
|
|
||||||
|
@Schema(description = "备注", example = "随便")
|
||||||
|
@ExcelProperty("备注")
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
package com.yolo.keyboard.controller.admin.tenantcommission.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 KeyboardTenantCommissionSaveReqVO {
|
||||||
|
|
||||||
|
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "3144")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "内购记录ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "20900")
|
||||||
|
@NotNull(message = "内购记录ID不能为空")
|
||||||
|
private Integer purchaseRecordId;
|
||||||
|
|
||||||
|
@Schema(description = "内购交易ID", example = "30383")
|
||||||
|
private String transactionId;
|
||||||
|
|
||||||
|
@Schema(description = "被邀请用户ID(购买用户)", example = "2447")
|
||||||
|
private Integer inviteeUserId;
|
||||||
|
|
||||||
|
@Schema(description = "邀请人用户ID", example = "1012")
|
||||||
|
private Long inviterUserId;
|
||||||
|
|
||||||
|
@Schema(description = "内购金额")
|
||||||
|
private BigDecimal purchaseAmount;
|
||||||
|
|
||||||
|
@Schema(description = "分成比例")
|
||||||
|
private BigDecimal commissionRate;
|
||||||
|
|
||||||
|
@Schema(description = "分成金额")
|
||||||
|
private BigDecimal commissionAmount;
|
||||||
|
|
||||||
|
@Schema(description = "状态:PENDING-待结算,SETTLED-已结算,REFUNDED-已退款", example = "2")
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
@Schema(description = "内购时间")
|
||||||
|
private LocalDateTime purchaseTime;
|
||||||
|
|
||||||
|
@Schema(description = "结算时间")
|
||||||
|
private LocalDateTime settledAt;
|
||||||
|
|
||||||
|
@Schema(description = "关联的余额交易记录ID", example = "29131")
|
||||||
|
private Long balanceTransactionId;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间")
|
||||||
|
private LocalDateTime createdAt;
|
||||||
|
|
||||||
|
@Schema(description = "更新时间")
|
||||||
|
private LocalDateTime updatedAt;
|
||||||
|
|
||||||
|
@Schema(description = "备注", example = "随便")
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,103 @@
|
|||||||
|
package com.yolo.keyboard.controller.admin.tenantwithdraworder;
|
||||||
|
|
||||||
|
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 com.yolo.keyboard.framework.common.pojo.PageParam;
|
||||||
|
import com.yolo.keyboard.framework.common.pojo.PageResult;
|
||||||
|
import com.yolo.keyboard.framework.common.pojo.CommonResult;
|
||||||
|
import com.yolo.keyboard.framework.common.util.object.BeanUtils;
|
||||||
|
import static com.yolo.keyboard.framework.common.pojo.CommonResult.success;
|
||||||
|
|
||||||
|
import com.yolo.keyboard.framework.excel.core.util.ExcelUtils;
|
||||||
|
|
||||||
|
import com.yolo.keyboard.framework.apilog.core.annotation.ApiAccessLog;
|
||||||
|
import static com.yolo.keyboard.framework.apilog.core.enums.OperateTypeEnum.*;
|
||||||
|
|
||||||
|
import com.yolo.keyboard.controller.admin.tenantwithdraworder.vo.*;
|
||||||
|
import com.yolo.keyboard.dal.dataobject.tenantwithdraworder.KeyboardTenantWithdrawOrderDO;
|
||||||
|
import com.yolo.keyboard.service.tenantwithdraworder.KeyboardTenantWithdrawOrderService;
|
||||||
|
|
||||||
|
@Tag(name = "管理后台 - 租户提现订单表(申请-审核-打款-完成/失败)")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/keyboard/tenant-withdraw-order")
|
||||||
|
@Validated
|
||||||
|
public class KeyboardTenantWithdrawOrderController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private KeyboardTenantWithdrawOrderService tenantWithdrawOrderService;
|
||||||
|
|
||||||
|
@PostMapping("/create")
|
||||||
|
@Operation(summary = "创建租户提现订单表(申请-审核-打款-完成/失败)")
|
||||||
|
@PreAuthorize("@ss.hasPermission('keyboard:tenant-withdraw-order:create')")
|
||||||
|
public CommonResult<Long> createTenantWithdrawOrder(@Valid @RequestBody KeyboardTenantWithdrawOrderSaveReqVO createReqVO) {
|
||||||
|
return success(tenantWithdrawOrderService.createTenantWithdrawOrder(createReqVO));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/update")
|
||||||
|
@Operation(summary = "更新租户提现订单表(申请-审核-打款-完成/失败)")
|
||||||
|
@PreAuthorize("@ss.hasPermission('keyboard:tenant-withdraw-order:update')")
|
||||||
|
public CommonResult<Boolean> updateTenantWithdrawOrder(@Valid @RequestBody KeyboardTenantWithdrawOrderSaveReqVO updateReqVO) {
|
||||||
|
tenantWithdrawOrderService.updateTenantWithdrawOrder(updateReqVO);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/delete")
|
||||||
|
@Operation(summary = "删除租户提现订单表(申请-审核-打款-完成/失败)")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true)
|
||||||
|
@PreAuthorize("@ss.hasPermission('keyboard:tenant-withdraw-order:delete')")
|
||||||
|
public CommonResult<Boolean> deleteTenantWithdrawOrder(@RequestParam("id") Long id) {
|
||||||
|
tenantWithdrawOrderService.deleteTenantWithdrawOrder(id);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/delete-list")
|
||||||
|
@Parameter(name = "ids", description = "编号", required = true)
|
||||||
|
@Operation(summary = "批量删除租户提现订单表(申请-审核-打款-完成/失败)")
|
||||||
|
@PreAuthorize("@ss.hasPermission('keyboard:tenant-withdraw-order:delete')")
|
||||||
|
public CommonResult<Boolean> deleteTenantWithdrawOrderList(@RequestParam("ids") List<Long> ids) {
|
||||||
|
tenantWithdrawOrderService.deleteTenantWithdrawOrderListByIds(ids);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/get")
|
||||||
|
@Operation(summary = "获得租户提现订单表(申请-审核-打款-完成/失败)")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||||
|
@PreAuthorize("@ss.hasPermission('keyboard:tenant-withdraw-order:query')")
|
||||||
|
public CommonResult<KeyboardTenantWithdrawOrderRespVO> getTenantWithdrawOrder(@RequestParam("id") Long id) {
|
||||||
|
KeyboardTenantWithdrawOrderDO tenantWithdrawOrder = tenantWithdrawOrderService.getTenantWithdrawOrder(id);
|
||||||
|
return success(BeanUtils.toBean(tenantWithdrawOrder, KeyboardTenantWithdrawOrderRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/page")
|
||||||
|
@Operation(summary = "获得租户提现订单表(申请-审核-打款-完成/失败)分页")
|
||||||
|
@PreAuthorize("@ss.hasPermission('keyboard:tenant-withdraw-order:query')")
|
||||||
|
public CommonResult<PageResult<KeyboardTenantWithdrawOrderRespVO>> getTenantWithdrawOrderPage(@Valid KeyboardTenantWithdrawOrderPageReqVO pageReqVO) {
|
||||||
|
PageResult<KeyboardTenantWithdrawOrderRespVO> pageResult = tenantWithdrawOrderService.getTenantWithdrawOrderPage(pageReqVO);
|
||||||
|
return success(pageResult);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/export-excel")
|
||||||
|
@Operation(summary = "导出租户提现订单表(申请-审核-打款-完成/失败) Excel")
|
||||||
|
@PreAuthorize("@ss.hasPermission('keyboard:tenant-withdraw-order:export')")
|
||||||
|
@ApiAccessLog(operateType = EXPORT)
|
||||||
|
public void exportTenantWithdrawOrderExcel(@Valid KeyboardTenantWithdrawOrderPageReqVO pageReqVO,
|
||||||
|
HttpServletResponse response) throws IOException {
|
||||||
|
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||||
|
List<KeyboardTenantWithdrawOrderRespVO> list = tenantWithdrawOrderService.getTenantWithdrawOrderPage(pageReqVO).getList();
|
||||||
|
// 导出 Excel
|
||||||
|
ExcelUtils.write(response, "租户提现订单表(申请-审核-打款-完成/失败).xls", "数据", KeyboardTenantWithdrawOrderRespVO.class, list);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,117 @@
|
|||||||
|
package com.yolo.keyboard.controller.admin.tenantwithdraworder.vo;
|
||||||
|
|
||||||
|
import lombok.*;
|
||||||
|
import java.util.*;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import com.yolo.keyboard.framework.common.pojo.PageParam;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
import static com.yolo.keyboard.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 租户提现订单表(申请-审核-打款-完成/失败)分页 Request VO")
|
||||||
|
@Data
|
||||||
|
public class KeyboardTenantWithdrawOrderPageReqVO extends PageParam {
|
||||||
|
|
||||||
|
@Schema(description = "提现单号(业务唯一)")
|
||||||
|
private String withdrawNo;
|
||||||
|
|
||||||
|
@Schema(description = "业务幂等号(防重复提交)")
|
||||||
|
private String bizNo;
|
||||||
|
|
||||||
|
@Schema(description = "币种(默认 CNY)")
|
||||||
|
private String currency;
|
||||||
|
|
||||||
|
@Schema(description = "提现申请金额(单位:分)")
|
||||||
|
private Long amount;
|
||||||
|
|
||||||
|
@Schema(description = "手续费金额(单位:分)")
|
||||||
|
private Long feeAmount;
|
||||||
|
|
||||||
|
@Schema(description = "实际到账金额(单位:分 = amount - fee_amount)")
|
||||||
|
private Long actualAmount;
|
||||||
|
|
||||||
|
@Schema(description = "打款渠道:BANK/ALIPAY/WECHAT/PAYPAL 等")
|
||||||
|
private String payChannel;
|
||||||
|
|
||||||
|
@Schema(description = "收款方类型:PERSON(个人)/COMPANY(企业)", example = "1")
|
||||||
|
private String payeeType;
|
||||||
|
|
||||||
|
@Schema(description = "收款人姓名或公司名称(快照)", example = "张三")
|
||||||
|
private String payeeName;
|
||||||
|
|
||||||
|
@Schema(description = "收款账号(银行卡/支付宝等,建议加密或脱敏)", example = "5425")
|
||||||
|
private String payeeAccount;
|
||||||
|
|
||||||
|
@Schema(description = "收款银行名称", example = "芋艿")
|
||||||
|
private String payeeBankName;
|
||||||
|
|
||||||
|
@Schema(description = "银行编码(可选)")
|
||||||
|
private String payeeBankCode;
|
||||||
|
|
||||||
|
@Schema(description = "银行支行名称(可选)")
|
||||||
|
private String payeeBankBranch;
|
||||||
|
|
||||||
|
@Schema(description = "提现状态:APPLIED/APPROVED/REJECTED/PAYING/PAID/FAILED/CANCELED", example = "1")
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
@Schema(description = "审核状态:PENDING/PASSED/REJECTED", example = "1")
|
||||||
|
private String auditStatus;
|
||||||
|
|
||||||
|
@Schema(description = "拒绝原因或打款失败原因", example = "不香")
|
||||||
|
private String reason;
|
||||||
|
|
||||||
|
@Schema(description = "提现申请时间")
|
||||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
|
private LocalDateTime[] applyTime;
|
||||||
|
|
||||||
|
@Schema(description = "审核完成时间")
|
||||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
|
private LocalDateTime[] auditTime;
|
||||||
|
|
||||||
|
@Schema(description = "发起打款时间(请求第三方)")
|
||||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
|
private LocalDateTime[] payTime;
|
||||||
|
|
||||||
|
@Schema(description = "打款成功时间(第三方确认)")
|
||||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
|
private LocalDateTime[] paidTime;
|
||||||
|
|
||||||
|
@Schema(description = "业务终态时间(成功/失败/取消)")
|
||||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
|
private LocalDateTime[] finishTime;
|
||||||
|
|
||||||
|
@Schema(description = "打款批次号(内部使用)")
|
||||||
|
private String payerBatchNo;
|
||||||
|
|
||||||
|
@Schema(description = "第三方打款交易号/流水号(对账用)")
|
||||||
|
private String channelTradeNo;
|
||||||
|
|
||||||
|
@Schema(description = "第三方返回的原始报文(用于排查)")
|
||||||
|
private Object channelRaw;
|
||||||
|
|
||||||
|
@Schema(description = "关联余额流水ID(冻结/扣减/返还)", example = "30641")
|
||||||
|
private Long balanceTxnId;
|
||||||
|
|
||||||
|
@Schema(description = "乐观锁版本号")
|
||||||
|
private Integer version;
|
||||||
|
|
||||||
|
@Schema(description = "提现申请人ID", example = "6858")
|
||||||
|
private Long creatorId;
|
||||||
|
|
||||||
|
@Schema(description = "审核人ID", example = "15039")
|
||||||
|
private Long auditorId;
|
||||||
|
|
||||||
|
@Schema(description = "打款操作人ID", example = "8850")
|
||||||
|
private Long payerId;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间")
|
||||||
|
private LocalDateTime createdAt;
|
||||||
|
|
||||||
|
@Schema(description = "更新时间")
|
||||||
|
private LocalDateTime updatedAt;
|
||||||
|
|
||||||
|
@Schema(description = "租户ID列表(用于下级租户过滤)", hidden = true)
|
||||||
|
private List<Long> tenantIds;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,153 @@
|
|||||||
|
package com.yolo.keyboard.controller.admin.tenantwithdraworder.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.*;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
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 KeyboardTenantWithdrawOrderRespVO {
|
||||||
|
|
||||||
|
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "20442")
|
||||||
|
@ExcelProperty("主键")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "提现单号(业务唯一)", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@ExcelProperty("提现单号(业务唯一)")
|
||||||
|
private String withdrawNo;
|
||||||
|
|
||||||
|
@Schema(description = "业务幂等号(防重复提交)")
|
||||||
|
@ExcelProperty("业务幂等号(防重复提交)")
|
||||||
|
private String bizNo;
|
||||||
|
|
||||||
|
@Schema(description = "币种(默认 CNY)", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@ExcelProperty("币种(默认 CNY)")
|
||||||
|
private String currency;
|
||||||
|
|
||||||
|
@Schema(description = "提现申请金额(单位:元)", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@ExcelProperty("提现申请金额(单位:元)")
|
||||||
|
private BigDecimal amount;
|
||||||
|
|
||||||
|
@Schema(description = "手续费金额(单位:元)", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@ExcelProperty("手续费金额(单位:元)")
|
||||||
|
private BigDecimal feeAmount;
|
||||||
|
|
||||||
|
@Schema(description = "实际到账金额(单位:元 = amount - fee_amount)", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@ExcelProperty("实际到账金额(单位:元 = amount - fee_amount)")
|
||||||
|
private BigDecimal actualAmount;
|
||||||
|
|
||||||
|
@Schema(description = "打款渠道:BANK/ALIPAY/WECHAT/PAYPAL 等", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@ExcelProperty("打款渠道:BANK/ALIPAY/WECHAT/PAYPAL 等")
|
||||||
|
private String payChannel;
|
||||||
|
|
||||||
|
@Schema(description = "收款方类型:PERSON(个人)/COMPANY(企业)", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||||
|
@ExcelProperty("收款方类型:PERSON(个人)/COMPANY(企业)")
|
||||||
|
private String payeeType;
|
||||||
|
|
||||||
|
@Schema(description = "收款人姓名或公司名称(快照)", example = "张三")
|
||||||
|
@ExcelProperty("收款人姓名或公司名称(快照)")
|
||||||
|
private String payeeName;
|
||||||
|
|
||||||
|
@Schema(description = "收款账号(银行卡/支付宝等,建议加密或脱敏)", example = "5425")
|
||||||
|
@ExcelProperty("收款账号(银行卡/支付宝等,建议加密或脱敏)")
|
||||||
|
private String payeeAccount;
|
||||||
|
|
||||||
|
@Schema(description = "收款银行名称", example = "芋艿")
|
||||||
|
@ExcelProperty("收款银行名称")
|
||||||
|
private String payeeBankName;
|
||||||
|
|
||||||
|
@Schema(description = "银行编码(可选)")
|
||||||
|
@ExcelProperty("银行编码(可选)")
|
||||||
|
private String payeeBankCode;
|
||||||
|
|
||||||
|
@Schema(description = "银行支行名称(可选)")
|
||||||
|
@ExcelProperty("银行支行名称(可选)")
|
||||||
|
private String payeeBankBranch;
|
||||||
|
|
||||||
|
@Schema(description = "提现状态:APPLIED/APPROVED/REJECTED/PAYING/PAID/FAILED/CANCELED", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||||
|
@ExcelProperty("提现状态:APPLIED/APPROVED/REJECTED/PAYING/PAID/FAILED/CANCELED")
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
@Schema(description = "审核状态:PENDING/PASSED/REJECTED", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||||
|
@ExcelProperty("审核状态:PENDING/PASSED/REJECTED")
|
||||||
|
private String auditStatus;
|
||||||
|
|
||||||
|
@Schema(description = "拒绝原因或打款失败原因", example = "不香")
|
||||||
|
@ExcelProperty("拒绝原因或打款失败原因")
|
||||||
|
private String reason;
|
||||||
|
|
||||||
|
@Schema(description = "提现申请时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@ExcelProperty("提现申请时间")
|
||||||
|
private LocalDateTime applyTime;
|
||||||
|
|
||||||
|
@Schema(description = "审核完成时间")
|
||||||
|
@ExcelProperty("审核完成时间")
|
||||||
|
private LocalDateTime auditTime;
|
||||||
|
|
||||||
|
@Schema(description = "发起打款时间(请求第三方)")
|
||||||
|
@ExcelProperty("发起打款时间(请求第三方)")
|
||||||
|
private LocalDateTime payTime;
|
||||||
|
|
||||||
|
@Schema(description = "打款成功时间(第三方确认)")
|
||||||
|
@ExcelProperty("打款成功时间(第三方确认)")
|
||||||
|
private LocalDateTime paidTime;
|
||||||
|
|
||||||
|
@Schema(description = "业务终态时间(成功/失败/取消)")
|
||||||
|
@ExcelProperty("业务终态时间(成功/失败/取消)")
|
||||||
|
private LocalDateTime finishTime;
|
||||||
|
|
||||||
|
@Schema(description = "打款批次号(内部使用)")
|
||||||
|
@ExcelProperty("打款批次号(内部使用)")
|
||||||
|
private String payerBatchNo;
|
||||||
|
|
||||||
|
@Schema(description = "第三方打款交易号/流水号(对账用)")
|
||||||
|
@ExcelProperty("第三方打款交易号/流水号(对账用)")
|
||||||
|
private String channelTradeNo;
|
||||||
|
|
||||||
|
@Schema(description = "第三方返回的原始报文(用于排查)")
|
||||||
|
@ExcelProperty("第三方返回的原始报文(用于排查)")
|
||||||
|
private Object channelRaw;
|
||||||
|
|
||||||
|
@Schema(description = "关联余额流水ID(冻结/扣减/返还)", example = "30641")
|
||||||
|
@ExcelProperty("关联余额流水ID(冻结/扣减/返还)")
|
||||||
|
private Long balanceTxnId;
|
||||||
|
|
||||||
|
@Schema(description = "乐观锁版本号", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@ExcelProperty("乐观锁版本号")
|
||||||
|
private Integer version;
|
||||||
|
|
||||||
|
@Schema(description = "提现申请人ID", example = "6858")
|
||||||
|
@ExcelProperty("提现申请人ID")
|
||||||
|
private Long creatorId;
|
||||||
|
|
||||||
|
@Schema(description = "审核人ID", example = "15039")
|
||||||
|
@ExcelProperty("审核人ID")
|
||||||
|
private Long auditorId;
|
||||||
|
|
||||||
|
@Schema(description = "打款操作人ID", example = "8850")
|
||||||
|
@ExcelProperty("打款操作人ID")
|
||||||
|
private Long payerId;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@ExcelProperty("创建时间")
|
||||||
|
private LocalDateTime createdAt;
|
||||||
|
|
||||||
|
@Schema(description = "更新时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@ExcelProperty("更新时间")
|
||||||
|
private LocalDateTime updatedAt;
|
||||||
|
|
||||||
|
@Schema(description = "租户编号", example = "1")
|
||||||
|
@ExcelProperty("租户编号")
|
||||||
|
private Long tenantId;
|
||||||
|
|
||||||
|
@Schema(description = "租户名称", example = "芋道源码")
|
||||||
|
@ExcelProperty("租户名称")
|
||||||
|
private String tenantName;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,125 @@
|
|||||||
|
package com.yolo.keyboard.controller.admin.tenantwithdraworder.vo;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.*;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.*;
|
||||||
|
import jakarta.validation.constraints.*;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 租户提现订单表(申请-审核-打款-完成/失败)新增/修改 Request VO")
|
||||||
|
@Data
|
||||||
|
public class KeyboardTenantWithdrawOrderSaveReqVO {
|
||||||
|
|
||||||
|
@Schema(description = "主键", requiredMode = Schema.RequiredMode.REQUIRED, example = "20442")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "提现单号(业务唯一)", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@NotEmpty(message = "提现单号(业务唯一)不能为空")
|
||||||
|
private String withdrawNo;
|
||||||
|
|
||||||
|
@Schema(description = "业务幂等号(防重复提交)")
|
||||||
|
private String bizNo;
|
||||||
|
|
||||||
|
@Schema(description = "币种(默认 CNY)", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@NotEmpty(message = "币种(默认 CNY)不能为空")
|
||||||
|
private String currency;
|
||||||
|
|
||||||
|
@Schema(description = "提现申请金额(单位:元)", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@NotNull(message = "提现申请金额不能为空")
|
||||||
|
private BigDecimal amount;
|
||||||
|
|
||||||
|
@Schema(description = "手续费金额(单位:元)", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@NotNull(message = "手续费金额不能为空")
|
||||||
|
private BigDecimal feeAmount;
|
||||||
|
|
||||||
|
@Schema(description = "实际到账金额(单位:元 = amount - fee_amount)", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@NotNull(message = "实际到账金额不能为空")
|
||||||
|
private BigDecimal actualAmount;
|
||||||
|
|
||||||
|
@Schema(description = "打款渠道:BANK/ALIPAY/WECHAT/PAYPAL 等", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@NotEmpty(message = "打款渠道:BANK/ALIPAY/WECHAT/PAYPAL 等不能为空")
|
||||||
|
private String payChannel;
|
||||||
|
|
||||||
|
@Schema(description = "收款方类型:PERSON(个人)/COMPANY(企业)", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||||
|
@NotEmpty(message = "收款方类型:PERSON(个人)/COMPANY(企业)不能为空")
|
||||||
|
private String payeeType;
|
||||||
|
|
||||||
|
@Schema(description = "收款人姓名或公司名称(快照)", example = "张三")
|
||||||
|
private String payeeName;
|
||||||
|
|
||||||
|
@Schema(description = "收款账号(银行卡/支付宝等,建议加密或脱敏)", example = "5425")
|
||||||
|
private String payeeAccount;
|
||||||
|
|
||||||
|
@Schema(description = "收款银行名称", example = "芋艿")
|
||||||
|
private String payeeBankName;
|
||||||
|
|
||||||
|
@Schema(description = "银行编码(可选)")
|
||||||
|
private String payeeBankCode;
|
||||||
|
|
||||||
|
@Schema(description = "银行支行名称(可选)")
|
||||||
|
private String payeeBankBranch;
|
||||||
|
|
||||||
|
@Schema(description = "提现状态:APPLIED/APPROVED/REJECTED/PAYING/PAID/FAILED/CANCELED", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||||
|
@NotEmpty(message = "提现状态:APPLIED/APPROVED/REJECTED/PAYING/PAID/FAILED/CANCELED不能为空")
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
@Schema(description = "审核状态:PENDING/PASSED/REJECTED", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||||
|
@NotEmpty(message = "审核状态:PENDING/PASSED/REJECTED不能为空")
|
||||||
|
private String auditStatus;
|
||||||
|
|
||||||
|
@Schema(description = "拒绝原因或打款失败原因", example = "不香")
|
||||||
|
private String reason;
|
||||||
|
|
||||||
|
@Schema(description = "提现申请时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@NotNull(message = "提现申请时间不能为空")
|
||||||
|
private LocalDateTime applyTime;
|
||||||
|
|
||||||
|
@Schema(description = "审核完成时间")
|
||||||
|
private LocalDateTime auditTime;
|
||||||
|
|
||||||
|
@Schema(description = "发起打款时间(请求第三方)")
|
||||||
|
private LocalDateTime payTime;
|
||||||
|
|
||||||
|
@Schema(description = "打款成功时间(第三方确认)")
|
||||||
|
private LocalDateTime paidTime;
|
||||||
|
|
||||||
|
@Schema(description = "业务终态时间(成功/失败/取消)")
|
||||||
|
private LocalDateTime finishTime;
|
||||||
|
|
||||||
|
@Schema(description = "打款批次号(内部使用)")
|
||||||
|
private String payerBatchNo;
|
||||||
|
|
||||||
|
@Schema(description = "第三方打款交易号/流水号(对账用)")
|
||||||
|
private String channelTradeNo;
|
||||||
|
|
||||||
|
@Schema(description = "第三方返回的原始报文(用于排查)")
|
||||||
|
private Object channelRaw;
|
||||||
|
|
||||||
|
@Schema(description = "关联余额流水ID(冻结/扣减/返还)", example = "30641")
|
||||||
|
private Long balanceTxnId;
|
||||||
|
|
||||||
|
@Schema(description = "乐观锁版本号", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@NotNull(message = "乐观锁版本号不能为空")
|
||||||
|
private Integer version;
|
||||||
|
|
||||||
|
@Schema(description = "提现申请人ID", example = "6858")
|
||||||
|
private Long creatorId;
|
||||||
|
|
||||||
|
@Schema(description = "审核人ID", example = "15039")
|
||||||
|
private Long auditorId;
|
||||||
|
|
||||||
|
@Schema(description = "打款操作人ID", example = "8850")
|
||||||
|
private Long payerId;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@NotNull(message = "创建时间不能为空")
|
||||||
|
private LocalDateTime createdAt;
|
||||||
|
|
||||||
|
@Schema(description = "更新时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@NotNull(message = "更新时间不能为空")
|
||||||
|
private LocalDateTime updatedAt;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,104 @@
|
|||||||
|
package com.yolo.keyboard.controller.admin.usercharacter;
|
||||||
|
|
||||||
|
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 com.yolo.keyboard.framework.common.pojo.PageParam;
|
||||||
|
import com.yolo.keyboard.framework.common.pojo.PageResult;
|
||||||
|
import com.yolo.keyboard.framework.common.pojo.CommonResult;
|
||||||
|
import com.yolo.keyboard.framework.common.util.object.BeanUtils;
|
||||||
|
import static com.yolo.keyboard.framework.common.pojo.CommonResult.success;
|
||||||
|
|
||||||
|
import com.yolo.keyboard.framework.excel.core.util.ExcelUtils;
|
||||||
|
|
||||||
|
import com.yolo.keyboard.framework.apilog.core.annotation.ApiAccessLog;
|
||||||
|
import static com.yolo.keyboard.framework.apilog.core.enums.OperateTypeEnum.*;
|
||||||
|
|
||||||
|
import com.yolo.keyboard.controller.admin.usercharacter.vo.*;
|
||||||
|
import com.yolo.keyboard.dal.dataobject.usercharacter.KeyboardUserCharacterDO;
|
||||||
|
import com.yolo.keyboard.service.usercharacter.KeyboardUserCharacterService;
|
||||||
|
|
||||||
|
@Tag(name = "管理后台 - 用户人设管理")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/keyboard/user-character")
|
||||||
|
@Validated
|
||||||
|
public class KeyboardUserCharacterController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private KeyboardUserCharacterService userCharacterService;
|
||||||
|
|
||||||
|
@PostMapping("/create")
|
||||||
|
@Operation(summary = "创建用户人设管理")
|
||||||
|
@PreAuthorize("@ss.hasPermission('keyboard:user-character:create')")
|
||||||
|
public CommonResult<Long> createUserCharacter(@Valid @RequestBody KeyboardUserCharacterSaveReqVO createReqVO) {
|
||||||
|
return success(userCharacterService.createUserCharacter(createReqVO));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/update")
|
||||||
|
@Operation(summary = "更新用户人设管理")
|
||||||
|
@PreAuthorize("@ss.hasPermission('keyboard:user-character:update')")
|
||||||
|
public CommonResult<Boolean> updateUserCharacter(@Valid @RequestBody KeyboardUserCharacterSaveReqVO updateReqVO) {
|
||||||
|
userCharacterService.updateUserCharacter(updateReqVO);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/delete")
|
||||||
|
@Operation(summary = "删除用户人设管理")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true)
|
||||||
|
@PreAuthorize("@ss.hasPermission('keyboard:user-character:delete')")
|
||||||
|
public CommonResult<Boolean> deleteUserCharacter(@RequestParam("id") Long id) {
|
||||||
|
userCharacterService.deleteUserCharacter(id);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/delete-list")
|
||||||
|
@Parameter(name = "ids", description = "编号", required = true)
|
||||||
|
@Operation(summary = "批量删除用户人设管理")
|
||||||
|
@PreAuthorize("@ss.hasPermission('keyboard:user-character:delete')")
|
||||||
|
public CommonResult<Boolean> deleteUserCharacterList(@RequestParam("ids") List<Long> ids) {
|
||||||
|
userCharacterService.deleteUserCharacterListByIds(ids);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/get")
|
||||||
|
@Operation(summary = "获得用户人设管理")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||||
|
@PreAuthorize("@ss.hasPermission('keyboard:user-character:query')")
|
||||||
|
public CommonResult<KeyboardUserCharacterRespVO> getUserCharacter(@RequestParam("id") Long id) {
|
||||||
|
KeyboardUserCharacterDO userCharacter = userCharacterService.getUserCharacter(id);
|
||||||
|
return success(BeanUtils.toBean(userCharacter, KeyboardUserCharacterRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/page")
|
||||||
|
@Operation(summary = "获得用户人设管理分页")
|
||||||
|
@PreAuthorize("@ss.hasPermission('keyboard:user-character:query')")
|
||||||
|
public CommonResult<PageResult<KeyboardUserCharacterRespVO>> getUserCharacterPage(@Valid KeyboardUserCharacterPageReqVO pageReqVO) {
|
||||||
|
PageResult<KeyboardUserCharacterDO> pageResult = userCharacterService.getUserCharacterPage(pageReqVO);
|
||||||
|
return success(BeanUtils.toBean(pageResult, KeyboardUserCharacterRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/export-excel")
|
||||||
|
@Operation(summary = "导出用户人设管理 Excel")
|
||||||
|
@PreAuthorize("@ss.hasPermission('keyboard:user-character:export')")
|
||||||
|
@ApiAccessLog(operateType = EXPORT)
|
||||||
|
public void exportUserCharacterExcel(@Valid KeyboardUserCharacterPageReqVO pageReqVO,
|
||||||
|
HttpServletResponse response) throws IOException {
|
||||||
|
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||||
|
List<KeyboardUserCharacterDO> list = userCharacterService.getUserCharacterPage(pageReqVO).getList();
|
||||||
|
// 导出 Excel
|
||||||
|
ExcelUtils.write(response, "用户人设管理.xls", "数据", KeyboardUserCharacterRespVO.class,
|
||||||
|
BeanUtils.toBean(list, KeyboardUserCharacterRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
package com.yolo.keyboard.controller.admin.usercharacter.vo;
|
||||||
|
|
||||||
|
import lombok.*;
|
||||||
|
import java.util.*;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import com.yolo.keyboard.framework.common.pojo.PageParam;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
import static com.yolo.keyboard.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 用户人设管理分页 Request VO")
|
||||||
|
@Data
|
||||||
|
public class KeyboardUserCharacterPageReqVO extends PageParam {
|
||||||
|
|
||||||
|
@Schema(description = "键盘人设 id", example = "7333")
|
||||||
|
private Long characterId;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间")
|
||||||
|
private LocalDateTime createdAt;
|
||||||
|
|
||||||
|
@Schema(description = "更新时间")
|
||||||
|
private LocalDateTime updatedAt;
|
||||||
|
|
||||||
|
@Schema(description = "用户 Id", example = "31348")
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
@Schema(description = "emoji 标签")
|
||||||
|
private String emoji;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
package com.yolo.keyboard.controller.admin.usercharacter.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 KeyboardUserCharacterRespVO {
|
||||||
|
|
||||||
|
@Schema(description = "主键 Id", requiredMode = Schema.RequiredMode.REQUIRED, example = "32344")
|
||||||
|
@ExcelProperty("主键 Id")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "键盘人设 id", example = "7333")
|
||||||
|
@ExcelProperty("键盘人设 id")
|
||||||
|
private Long characterId;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间")
|
||||||
|
@ExcelProperty("创建时间")
|
||||||
|
private LocalDateTime createdAt;
|
||||||
|
|
||||||
|
@Schema(description = "更新时间")
|
||||||
|
@ExcelProperty("更新时间")
|
||||||
|
private LocalDateTime updatedAt;
|
||||||
|
|
||||||
|
@Schema(description = "用户 Id", example = "31348")
|
||||||
|
@ExcelProperty("用户 Id")
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
@Schema(description = "emoji 标签")
|
||||||
|
@ExcelProperty("emoji 标签")
|
||||||
|
private String emoji;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
package com.yolo.keyboard.controller.admin.usercharacter.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 KeyboardUserCharacterSaveReqVO {
|
||||||
|
|
||||||
|
@Schema(description = "主键 Id", requiredMode = Schema.RequiredMode.REQUIRED, example = "32344")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "键盘人设 id", example = "7333")
|
||||||
|
private Long characterId;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间")
|
||||||
|
private LocalDateTime createdAt;
|
||||||
|
|
||||||
|
@Schema(description = "更新时间")
|
||||||
|
private LocalDateTime updatedAt;
|
||||||
|
|
||||||
|
@Schema(description = "用户 Id", example = "31348")
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
@Schema(description = "emoji 标签")
|
||||||
|
private String emoji;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,104 @@
|
|||||||
|
package com.yolo.keyboard.controller.admin.userinvitecodes;
|
||||||
|
|
||||||
|
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 com.yolo.keyboard.framework.common.pojo.PageParam;
|
||||||
|
import com.yolo.keyboard.framework.common.pojo.PageResult;
|
||||||
|
import com.yolo.keyboard.framework.common.pojo.CommonResult;
|
||||||
|
import com.yolo.keyboard.framework.common.util.object.BeanUtils;
|
||||||
|
import static com.yolo.keyboard.framework.common.pojo.CommonResult.success;
|
||||||
|
|
||||||
|
import com.yolo.keyboard.framework.excel.core.util.ExcelUtils;
|
||||||
|
|
||||||
|
import com.yolo.keyboard.framework.apilog.core.annotation.ApiAccessLog;
|
||||||
|
import static com.yolo.keyboard.framework.apilog.core.enums.OperateTypeEnum.*;
|
||||||
|
|
||||||
|
import com.yolo.keyboard.controller.admin.userinvitecodes.vo.*;
|
||||||
|
import com.yolo.keyboard.dal.dataobject.userinvitecodes.KeyboardUserInviteCodesDO;
|
||||||
|
import com.yolo.keyboard.service.userinvitecodes.KeyboardUserInviteCodesService;
|
||||||
|
|
||||||
|
@Tag(name = "管理后台 - 用户生成的邀请码表,用于邀请新用户注册/安装并建立邀请关系")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/keyboard/user-invite-codes")
|
||||||
|
@Validated
|
||||||
|
public class KeyboardUserInviteCodesController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private KeyboardUserInviteCodesService userInviteCodesService;
|
||||||
|
|
||||||
|
@PostMapping("/create")
|
||||||
|
@Operation(summary = "创建用户生成的邀请码表,用于邀请新用户注册/安装并建立邀请关系")
|
||||||
|
@PreAuthorize("@ss.hasPermission('keyboard:user-invite-codes:create')")
|
||||||
|
public CommonResult<Long> createUserInviteCodes(@Valid @RequestBody KeyboardUserInviteCodesSaveReqVO createReqVO) {
|
||||||
|
return success(userInviteCodesService.createUserInviteCodes(createReqVO));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/update")
|
||||||
|
@Operation(summary = "更新用户生成的邀请码表,用于邀请新用户注册/安装并建立邀请关系")
|
||||||
|
@PreAuthorize("@ss.hasPermission('keyboard:user-invite-codes:update')")
|
||||||
|
public CommonResult<Boolean> updateUserInviteCodes(@Valid @RequestBody KeyboardUserInviteCodesSaveReqVO updateReqVO) {
|
||||||
|
userInviteCodesService.updateUserInviteCodes(updateReqVO);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/delete")
|
||||||
|
@Operation(summary = "删除用户生成的邀请码表,用于邀请新用户注册/安装并建立邀请关系")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true)
|
||||||
|
@PreAuthorize("@ss.hasPermission('keyboard:user-invite-codes:delete')")
|
||||||
|
public CommonResult<Boolean> deleteUserInviteCodes(@RequestParam("id") Long id) {
|
||||||
|
userInviteCodesService.deleteUserInviteCodes(id);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/delete-list")
|
||||||
|
@Parameter(name = "ids", description = "编号", required = true)
|
||||||
|
@Operation(summary = "批量删除用户生成的邀请码表,用于邀请新用户注册/安装并建立邀请关系")
|
||||||
|
@PreAuthorize("@ss.hasPermission('keyboard:user-invite-codes:delete')")
|
||||||
|
public CommonResult<Boolean> deleteUserInviteCodesList(@RequestParam("ids") List<Long> ids) {
|
||||||
|
userInviteCodesService.deleteUserInviteCodesListByIds(ids);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/get")
|
||||||
|
@Operation(summary = "获得用户生成的邀请码表,用于邀请新用户注册/安装并建立邀请关系")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||||
|
@PreAuthorize("@ss.hasPermission('keyboard:user-invite-codes:query')")
|
||||||
|
public CommonResult<KeyboardUserInviteCodesRespVO> getUserInviteCodes(@RequestParam("id") Long id) {
|
||||||
|
KeyboardUserInviteCodesDO userInviteCodes = userInviteCodesService.getUserInviteCodes(id);
|
||||||
|
return success(BeanUtils.toBean(userInviteCodes, KeyboardUserInviteCodesRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/page")
|
||||||
|
@Operation(summary = "获得用户生成的邀请码表,用于邀请新用户注册/安装并建立邀请关系分页")
|
||||||
|
@PreAuthorize("@ss.hasPermission('keyboard:user-invite-codes:query')")
|
||||||
|
public CommonResult<PageResult<KeyboardUserInviteCodesRespVO>> getUserInviteCodesPage(@Valid KeyboardUserInviteCodesPageReqVO pageReqVO) {
|
||||||
|
PageResult<KeyboardUserInviteCodesDO> pageResult = userInviteCodesService.getUserInviteCodesPage(pageReqVO);
|
||||||
|
return success(BeanUtils.toBean(pageResult, KeyboardUserInviteCodesRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/export-excel")
|
||||||
|
@Operation(summary = "导出用户生成的邀请码表,用于邀请新用户注册/安装并建立邀请关系 Excel")
|
||||||
|
@PreAuthorize("@ss.hasPermission('keyboard:user-invite-codes:export')")
|
||||||
|
@ApiAccessLog(operateType = EXPORT)
|
||||||
|
public void exportUserInviteCodesExcel(@Valid KeyboardUserInviteCodesPageReqVO pageReqVO,
|
||||||
|
HttpServletResponse response) throws IOException {
|
||||||
|
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||||
|
List<KeyboardUserInviteCodesDO> list = userInviteCodesService.getUserInviteCodesPage(pageReqVO).getList();
|
||||||
|
// 导出 Excel
|
||||||
|
ExcelUtils.write(response, "用户生成的邀请码表,用于邀请新用户注册/安装并建立邀请关系.xls", "数据", KeyboardUserInviteCodesRespVO.class,
|
||||||
|
BeanUtils.toBean(list, KeyboardUserInviteCodesRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
package com.yolo.keyboard.controller.admin.userinvitecodes.vo;
|
||||||
|
|
||||||
|
import lombok.*;
|
||||||
|
import java.util.*;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import com.yolo.keyboard.framework.common.pojo.PageParam;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
import static com.yolo.keyboard.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 用户生成的邀请码表,用于邀请新用户注册/安装并建立邀请关系分页 Request VO")
|
||||||
|
@Data
|
||||||
|
public class KeyboardUserInviteCodesPageReqVO extends PageParam {
|
||||||
|
|
||||||
|
@Schema(description = "邀请码字符串,对外展示,唯一")
|
||||||
|
private String code;
|
||||||
|
|
||||||
|
@Schema(description = "邀请码所属用户ID(邀请人)", example = "14170")
|
||||||
|
private Long ownerUserId;
|
||||||
|
|
||||||
|
@Schema(description = "邀请码状态:1=启用,0=停用", example = "2")
|
||||||
|
private Short status;
|
||||||
|
|
||||||
|
@Schema(description = "邀请码创建时间")
|
||||||
|
private LocalDateTime createdAt;
|
||||||
|
|
||||||
|
@Schema(description = "邀请码过期时间,NULL表示永久有效")
|
||||||
|
private LocalDateTime expiresAt;
|
||||||
|
|
||||||
|
@Schema(description = "邀请码最大可使用次数,NULL表示不限次数")
|
||||||
|
private Integer maxUses;
|
||||||
|
|
||||||
|
@Schema(description = "邀请码已使用次数", example = "25037")
|
||||||
|
private Integer usedCount;
|
||||||
|
|
||||||
|
@Schema(description = "邀请码所属租户", example = "17355")
|
||||||
|
private Long ownerTenantId;
|
||||||
|
|
||||||
|
@Schema(description = "邀请码所属系统用户", example = "772")
|
||||||
|
private Long ownerSystemUserId;
|
||||||
|
|
||||||
|
@Schema(description = "邀请码类型", example = "1")
|
||||||
|
private String inviteType;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
package com.yolo.keyboard.controller.admin.userinvitecodes.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 KeyboardUserInviteCodesRespVO {
|
||||||
|
|
||||||
|
@Schema(description = "邀请码主键ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "3053")
|
||||||
|
@ExcelProperty("邀请码主键ID")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "邀请码字符串,对外展示,唯一", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@ExcelProperty("邀请码字符串,对外展示,唯一")
|
||||||
|
private String code;
|
||||||
|
|
||||||
|
@Schema(description = "邀请码所属用户ID(邀请人)", requiredMode = Schema.RequiredMode.REQUIRED, example = "14170")
|
||||||
|
@ExcelProperty("邀请码所属用户ID(邀请人)")
|
||||||
|
private Long ownerUserId;
|
||||||
|
|
||||||
|
@Schema(description = "邀请码状态:1=启用,0=停用", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||||
|
@ExcelProperty("邀请码状态:1=启用,0=停用")
|
||||||
|
private Short status;
|
||||||
|
|
||||||
|
@Schema(description = "邀请码创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@ExcelProperty("邀请码创建时间")
|
||||||
|
private LocalDateTime createdAt;
|
||||||
|
|
||||||
|
@Schema(description = "邀请码过期时间,NULL表示永久有效")
|
||||||
|
@ExcelProperty("邀请码过期时间,NULL表示永久有效")
|
||||||
|
private LocalDateTime expiresAt;
|
||||||
|
|
||||||
|
@Schema(description = "邀请码最大可使用次数,NULL表示不限次数")
|
||||||
|
@ExcelProperty("邀请码最大可使用次数,NULL表示不限次数")
|
||||||
|
private Integer maxUses;
|
||||||
|
|
||||||
|
@Schema(description = "邀请码已使用次数", requiredMode = Schema.RequiredMode.REQUIRED, example = "25037")
|
||||||
|
@ExcelProperty("邀请码已使用次数")
|
||||||
|
private Integer usedCount;
|
||||||
|
|
||||||
|
@Schema(description = "邀请码所属租户", example = "17355")
|
||||||
|
@ExcelProperty("邀请码所属租户")
|
||||||
|
private Long ownerTenantId;
|
||||||
|
|
||||||
|
@Schema(description = "邀请码所属系统用户ID(邀请人)", example = "772")
|
||||||
|
@ExcelProperty("邀请码所属系统用户")
|
||||||
|
private Long ownerSystemUserId;
|
||||||
|
|
||||||
|
@Schema(description = "邀请码类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||||
|
@ExcelProperty("邀请码类型")
|
||||||
|
private String inviteType;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
package com.yolo.keyboard.controller.admin.userinvitecodes.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 KeyboardUserInviteCodesSaveReqVO {
|
||||||
|
|
||||||
|
@Schema(description = "邀请码主键ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "3053")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "邀请码字符串,对外展示,唯一", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@NotEmpty(message = "邀请码字符串,对外展示,唯一不能为空")
|
||||||
|
private String code;
|
||||||
|
|
||||||
|
@Schema(description = "邀请码所属用户ID(邀请人)", requiredMode = Schema.RequiredMode.REQUIRED, example = "14170")
|
||||||
|
@NotNull(message = "邀请码所属用户ID(邀请人)不能为空")
|
||||||
|
private Long ownerUserId;
|
||||||
|
|
||||||
|
@Schema(description = "邀请码状态:1=启用,0=停用", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||||
|
@NotNull(message = "邀请码状态:1=启用,0=停用不能为空")
|
||||||
|
private Short status;
|
||||||
|
|
||||||
|
@Schema(description = "邀请码创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@NotNull(message = "邀请码创建时间不能为空")
|
||||||
|
private LocalDateTime createdAt;
|
||||||
|
|
||||||
|
@Schema(description = "邀请码过期时间,NULL表示永久有效")
|
||||||
|
private LocalDateTime expiresAt;
|
||||||
|
|
||||||
|
@Schema(description = "邀请码最大可使用次数,NULL表示不限次数")
|
||||||
|
private Integer maxUses;
|
||||||
|
|
||||||
|
@Schema(description = "邀请码已使用次数", requiredMode = Schema.RequiredMode.REQUIRED, example = "25037")
|
||||||
|
@NotNull(message = "邀请码已使用次数不能为空")
|
||||||
|
private Integer usedCount;
|
||||||
|
|
||||||
|
@Schema(description = "邀请码所属租户", example = "17355")
|
||||||
|
private Long ownerTenantId;
|
||||||
|
|
||||||
|
@Schema(description = "邀请码所属系统用户", example = "772")
|
||||||
|
private Long ownerSystemUserId;
|
||||||
|
|
||||||
|
@Schema(description = "邀请码类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
|
||||||
|
@NotEmpty(message = "邀请码类型不能为空")
|
||||||
|
private String inviteType;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,104 @@
|
|||||||
|
package com.yolo.keyboard.controller.admin.userinvites;
|
||||||
|
|
||||||
|
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 com.yolo.keyboard.framework.common.pojo.PageParam;
|
||||||
|
import com.yolo.keyboard.framework.common.pojo.PageResult;
|
||||||
|
import com.yolo.keyboard.framework.common.pojo.CommonResult;
|
||||||
|
import com.yolo.keyboard.framework.common.util.object.BeanUtils;
|
||||||
|
import static com.yolo.keyboard.framework.common.pojo.CommonResult.success;
|
||||||
|
|
||||||
|
import com.yolo.keyboard.framework.excel.core.util.ExcelUtils;
|
||||||
|
|
||||||
|
import com.yolo.keyboard.framework.apilog.core.annotation.ApiAccessLog;
|
||||||
|
import static com.yolo.keyboard.framework.apilog.core.enums.OperateTypeEnum.*;
|
||||||
|
|
||||||
|
import com.yolo.keyboard.controller.admin.userinvites.vo.*;
|
||||||
|
import com.yolo.keyboard.dal.dataobject.userinvites.KeyboardUserInvitesDO;
|
||||||
|
import com.yolo.keyboard.service.userinvites.KeyboardUserInvitesService;
|
||||||
|
|
||||||
|
@Tag(name = "管理后台 - 用户邀请关系绑定台账表,记录新用户最终归属的邀请人")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/keyboard/user-invites")
|
||||||
|
@Validated
|
||||||
|
public class KeyboardUserInvitesController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private KeyboardUserInvitesService userInvitesService;
|
||||||
|
|
||||||
|
@PostMapping("/create")
|
||||||
|
@Operation(summary = "创建用户邀请关系绑定台账表,记录新用户最终归属的邀请人")
|
||||||
|
@PreAuthorize("@ss.hasPermission('keyboard:user-invites:create')")
|
||||||
|
public CommonResult<Long> createUserInvites(@Valid @RequestBody KeyboardUserInvitesSaveReqVO createReqVO) {
|
||||||
|
return success(userInvitesService.createUserInvites(createReqVO));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/update")
|
||||||
|
@Operation(summary = "更新用户邀请关系绑定台账表,记录新用户最终归属的邀请人")
|
||||||
|
@PreAuthorize("@ss.hasPermission('keyboard:user-invites:update')")
|
||||||
|
public CommonResult<Boolean> updateUserInvites(@Valid @RequestBody KeyboardUserInvitesSaveReqVO updateReqVO) {
|
||||||
|
userInvitesService.updateUserInvites(updateReqVO);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/delete")
|
||||||
|
@Operation(summary = "删除用户邀请关系绑定台账表,记录新用户最终归属的邀请人")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true)
|
||||||
|
@PreAuthorize("@ss.hasPermission('keyboard:user-invites:delete')")
|
||||||
|
public CommonResult<Boolean> deleteUserInvites(@RequestParam("id") Long id) {
|
||||||
|
userInvitesService.deleteUserInvites(id);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/delete-list")
|
||||||
|
@Parameter(name = "ids", description = "编号", required = true)
|
||||||
|
@Operation(summary = "批量删除用户邀请关系绑定台账表,记录新用户最终归属的邀请人")
|
||||||
|
@PreAuthorize("@ss.hasPermission('keyboard:user-invites:delete')")
|
||||||
|
public CommonResult<Boolean> deleteUserInvitesList(@RequestParam("ids") List<Long> ids) {
|
||||||
|
userInvitesService.deleteUserInvitesListByIds(ids);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/get")
|
||||||
|
@Operation(summary = "获得用户邀请关系绑定台账表,记录新用户最终归属的邀请人")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||||
|
@PreAuthorize("@ss.hasPermission('keyboard:user-invites:query')")
|
||||||
|
public CommonResult<KeyboardUserInvitesRespVO> getUserInvites(@RequestParam("id") Long id) {
|
||||||
|
KeyboardUserInvitesDO userInvites = userInvitesService.getUserInvites(id);
|
||||||
|
return success(BeanUtils.toBean(userInvites, KeyboardUserInvitesRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/page")
|
||||||
|
@Operation(summary = "获得用户邀请关系绑定台账表,记录新用户最终归属的邀请人分页")
|
||||||
|
@PreAuthorize("@ss.hasPermission('keyboard:user-invites:query')")
|
||||||
|
public CommonResult<PageResult<KeyboardUserInvitesRespVO>> getUserInvitesPage(@Valid KeyboardUserInvitesPageReqVO pageReqVO) {
|
||||||
|
PageResult<KeyboardUserInvitesDO> pageResult = userInvitesService.getUserInvitesPage(pageReqVO);
|
||||||
|
return success(BeanUtils.toBean(pageResult, KeyboardUserInvitesRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/export-excel")
|
||||||
|
@Operation(summary = "导出用户邀请关系绑定台账表,记录新用户最终归属的邀请人 Excel")
|
||||||
|
@PreAuthorize("@ss.hasPermission('keyboard:user-invites:export')")
|
||||||
|
@ApiAccessLog(operateType = EXPORT)
|
||||||
|
public void exportUserInvitesExcel(@Valid KeyboardUserInvitesPageReqVO pageReqVO,
|
||||||
|
HttpServletResponse response) throws IOException {
|
||||||
|
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||||
|
List<KeyboardUserInvitesDO> list = userInvitesService.getUserInvitesPage(pageReqVO).getList();
|
||||||
|
// 导出 Excel
|
||||||
|
ExcelUtils.write(response, "用户邀请关系绑定台账表,记录新用户最终归属的邀请人.xls", "数据", KeyboardUserInvitesRespVO.class,
|
||||||
|
BeanUtils.toBean(list, KeyboardUserInvitesRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,55 @@
|
|||||||
|
package com.yolo.keyboard.controller.admin.userinvites.vo;
|
||||||
|
|
||||||
|
import lombok.*;
|
||||||
|
import java.util.*;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import com.yolo.keyboard.framework.common.pojo.PageParam;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
import static com.yolo.keyboard.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 用户邀请关系绑定台账表,记录新用户最终归属的邀请人分页 Request VO")
|
||||||
|
@Data
|
||||||
|
public class KeyboardUserInvitesPageReqVO extends PageParam {
|
||||||
|
|
||||||
|
@Schema(description = "邀请人用户ID", example = "11992")
|
||||||
|
private Long inviterUserId;
|
||||||
|
|
||||||
|
@Schema(description = "被邀请人用户ID(新注册用户)", example = "28499")
|
||||||
|
private Long inviteeUserId;
|
||||||
|
|
||||||
|
@Schema(description = "使用的邀请码ID", example = "30340")
|
||||||
|
private Long inviteCodeId;
|
||||||
|
|
||||||
|
@Schema(description = "绑定时关联的点击Token(通过邀请链接自动绑定时使用)")
|
||||||
|
private String clickToken;
|
||||||
|
|
||||||
|
@Schema(description = "绑定方式:1=手动填写邀请码,2=邀请链接自动绑定,3=其他方式", example = "2")
|
||||||
|
private Short bindType;
|
||||||
|
|
||||||
|
@Schema(description = "邀请关系绑定完成时间")
|
||||||
|
private LocalDateTime boundAt;
|
||||||
|
|
||||||
|
@Schema(description = "绑定 iP")
|
||||||
|
private String bindIp;
|
||||||
|
|
||||||
|
@Schema(description = "userAgent")
|
||||||
|
private String bindUserAgent;
|
||||||
|
|
||||||
|
@Schema(description = "邀请码类型快照:USER=普通用户邀请,AGENT=代理邀请", example = "2")
|
||||||
|
private String inviteType;
|
||||||
|
|
||||||
|
@Schema(description = "收益结算归属租户ID(代理结算用,绑定时固化)", example = "25223")
|
||||||
|
private Long profitTenantId;
|
||||||
|
|
||||||
|
@Schema(description = "收益归因员工ID(用于区分租户员工/渠道,绑定时固化)", example = "31236")
|
||||||
|
private Long profitEmployeeId;
|
||||||
|
|
||||||
|
@Schema(description = "邀请人所属租户ID快照(便于审计/对账,可选)", example = "17028")
|
||||||
|
private Long inviterTenantId;
|
||||||
|
|
||||||
|
@Schema(description = "邀请码字符串快照(便于排查,可选)")
|
||||||
|
private String inviteCode;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,71 @@
|
|||||||
|
package com.yolo.keyboard.controller.admin.userinvites.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 KeyboardUserInvitesRespVO {
|
||||||
|
|
||||||
|
@Schema(description = "邀请绑定记录主键ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "7254")
|
||||||
|
@ExcelProperty("邀请绑定记录主键ID")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "邀请人用户ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "11992")
|
||||||
|
@ExcelProperty("邀请人用户ID")
|
||||||
|
private Long inviterUserId;
|
||||||
|
|
||||||
|
@Schema(description = "被邀请人用户ID(新注册用户)", requiredMode = Schema.RequiredMode.REQUIRED, example = "28499")
|
||||||
|
@ExcelProperty("被邀请人用户ID(新注册用户)")
|
||||||
|
private Long inviteeUserId;
|
||||||
|
|
||||||
|
@Schema(description = "使用的邀请码ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "30340")
|
||||||
|
@ExcelProperty("使用的邀请码ID")
|
||||||
|
private Long inviteCodeId;
|
||||||
|
|
||||||
|
@Schema(description = "绑定时关联的点击Token(通过邀请链接自动绑定时使用)")
|
||||||
|
@ExcelProperty("绑定时关联的点击Token(通过邀请链接自动绑定时使用)")
|
||||||
|
private String clickToken;
|
||||||
|
|
||||||
|
@Schema(description = "绑定方式:1=手动填写邀请码,2=邀请链接自动绑定,3=其他方式", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||||
|
@ExcelProperty("绑定方式:1=手动填写邀请码,2=邀请链接自动绑定,3=其他方式")
|
||||||
|
private Short bindType;
|
||||||
|
|
||||||
|
@Schema(description = "邀请关系绑定完成时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@ExcelProperty("邀请关系绑定完成时间")
|
||||||
|
private LocalDateTime boundAt;
|
||||||
|
|
||||||
|
@Schema(description = "绑定 iP")
|
||||||
|
@ExcelProperty("绑定 iP")
|
||||||
|
private String bindIp;
|
||||||
|
|
||||||
|
@Schema(description = "userAgent")
|
||||||
|
@ExcelProperty("userAgent")
|
||||||
|
private String bindUserAgent;
|
||||||
|
|
||||||
|
@Schema(description = "邀请码类型快照:USER=普通用户邀请,AGENT=代理邀请", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||||
|
@ExcelProperty("邀请码类型快照:USER=普通用户邀请,AGENT=代理邀请")
|
||||||
|
private String inviteType;
|
||||||
|
|
||||||
|
@Schema(description = "收益结算归属租户ID(代理结算用,绑定时固化)", example = "25223")
|
||||||
|
@ExcelProperty("收益结算归属租户ID(代理结算用,绑定时固化)")
|
||||||
|
private Long profitTenantId;
|
||||||
|
|
||||||
|
@Schema(description = "收益归因员工ID(用于区分租户员工/渠道,绑定时固化)", example = "31236")
|
||||||
|
@ExcelProperty("收益归因员工ID(用于区分租户员工/渠道,绑定时固化)")
|
||||||
|
private Long profitEmployeeId;
|
||||||
|
|
||||||
|
@Schema(description = "邀请人所属租户ID快照(便于审计/对账,可选)", example = "17028")
|
||||||
|
@ExcelProperty("邀请人所属租户ID快照(便于审计/对账,可选)")
|
||||||
|
private Long inviterTenantId;
|
||||||
|
|
||||||
|
@Schema(description = "邀请码字符串快照(便于排查,可选)")
|
||||||
|
@ExcelProperty("邀请码字符串快照(便于排查,可选)")
|
||||||
|
private String inviteCode;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
package com.yolo.keyboard.controller.admin.userinvites.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 KeyboardUserInvitesSaveReqVO {
|
||||||
|
|
||||||
|
@Schema(description = "邀请绑定记录主键ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "7254")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "邀请人用户ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "11992")
|
||||||
|
@NotNull(message = "邀请人用户ID不能为空")
|
||||||
|
private Long inviterUserId;
|
||||||
|
|
||||||
|
@Schema(description = "被邀请人用户ID(新注册用户)", requiredMode = Schema.RequiredMode.REQUIRED, example = "28499")
|
||||||
|
@NotNull(message = "被邀请人用户ID(新注册用户)不能为空")
|
||||||
|
private Long inviteeUserId;
|
||||||
|
|
||||||
|
@Schema(description = "使用的邀请码ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "30340")
|
||||||
|
@NotNull(message = "使用的邀请码ID不能为空")
|
||||||
|
private Long inviteCodeId;
|
||||||
|
|
||||||
|
@Schema(description = "绑定时关联的点击Token(通过邀请链接自动绑定时使用)")
|
||||||
|
private String clickToken;
|
||||||
|
|
||||||
|
@Schema(description = "绑定方式:1=手动填写邀请码,2=邀请链接自动绑定,3=其他方式", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||||
|
@NotNull(message = "绑定方式:1=手动填写邀请码,2=邀请链接自动绑定,3=其他方式不能为空")
|
||||||
|
private Short bindType;
|
||||||
|
|
||||||
|
@Schema(description = "邀请关系绑定完成时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@NotNull(message = "邀请关系绑定完成时间不能为空")
|
||||||
|
private LocalDateTime boundAt;
|
||||||
|
|
||||||
|
@Schema(description = "绑定 iP")
|
||||||
|
private String bindIp;
|
||||||
|
|
||||||
|
@Schema(description = "userAgent")
|
||||||
|
private String bindUserAgent;
|
||||||
|
|
||||||
|
@Schema(description = "邀请码类型快照:USER=普通用户邀请,AGENT=代理邀请", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
|
||||||
|
@NotEmpty(message = "邀请码类型快照:USER=普通用户邀请,AGENT=代理邀请不能为空")
|
||||||
|
private String inviteType;
|
||||||
|
|
||||||
|
@Schema(description = "收益结算归属租户ID(代理结算用,绑定时固化)", example = "25223")
|
||||||
|
private Long profitTenantId;
|
||||||
|
|
||||||
|
@Schema(description = "收益归因员工ID(用于区分租户员工/渠道,绑定时固化)", example = "31236")
|
||||||
|
private Long profitEmployeeId;
|
||||||
|
|
||||||
|
@Schema(description = "邀请人所属租户ID快照(便于审计/对账,可选)", example = "17028")
|
||||||
|
private Long inviterTenantId;
|
||||||
|
|
||||||
|
@Schema(description = "邀请码字符串快照(便于排查,可选)")
|
||||||
|
private String inviteCode;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,104 @@
|
|||||||
|
package com.yolo.keyboard.controller.admin.userquotatotal;
|
||||||
|
|
||||||
|
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 com.yolo.keyboard.framework.common.pojo.PageParam;
|
||||||
|
import com.yolo.keyboard.framework.common.pojo.PageResult;
|
||||||
|
import com.yolo.keyboard.framework.common.pojo.CommonResult;
|
||||||
|
import com.yolo.keyboard.framework.common.util.object.BeanUtils;
|
||||||
|
import static com.yolo.keyboard.framework.common.pojo.CommonResult.success;
|
||||||
|
|
||||||
|
import com.yolo.keyboard.framework.excel.core.util.ExcelUtils;
|
||||||
|
|
||||||
|
import com.yolo.keyboard.framework.apilog.core.annotation.ApiAccessLog;
|
||||||
|
import static com.yolo.keyboard.framework.apilog.core.enums.OperateTypeEnum.*;
|
||||||
|
|
||||||
|
import com.yolo.keyboard.controller.admin.userquotatotal.vo.*;
|
||||||
|
import com.yolo.keyboard.dal.dataobject.userquotatotal.KeyboardUserQuotaTotalDO;
|
||||||
|
import com.yolo.keyboard.service.userquotatotal.KeyboardUserQuotaTotalService;
|
||||||
|
|
||||||
|
@Tag(name = "管理后台 - 用户免费功能永久总次数额度表(所有功能共用)")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/keyboard/user-quota-total")
|
||||||
|
@Validated
|
||||||
|
public class KeyboardUserQuotaTotalController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private KeyboardUserQuotaTotalService userQuotaTotalService;
|
||||||
|
|
||||||
|
@PostMapping("/create")
|
||||||
|
@Operation(summary = "创建用户免费功能永久总次数额度表(所有功能共用)")
|
||||||
|
@PreAuthorize("@ss.hasPermission('keyboard:user-quota-total:create')")
|
||||||
|
public CommonResult<Long> createUserQuotaTotal(@Valid @RequestBody KeyboardUserQuotaTotalSaveReqVO createReqVO) {
|
||||||
|
return success(userQuotaTotalService.createUserQuotaTotal(createReqVO));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/update")
|
||||||
|
@Operation(summary = "更新用户免费功能永久总次数额度表(所有功能共用)")
|
||||||
|
@PreAuthorize("@ss.hasPermission('keyboard:user-quota-total:update')")
|
||||||
|
public CommonResult<Boolean> updateUserQuotaTotal(@Valid @RequestBody KeyboardUserQuotaTotalSaveReqVO updateReqVO) {
|
||||||
|
userQuotaTotalService.updateUserQuotaTotal(updateReqVO);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/delete")
|
||||||
|
@Operation(summary = "删除用户免费功能永久总次数额度表(所有功能共用)")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true)
|
||||||
|
@PreAuthorize("@ss.hasPermission('keyboard:user-quota-total:delete')")
|
||||||
|
public CommonResult<Boolean> deleteUserQuotaTotal(@RequestParam("id") Long id) {
|
||||||
|
userQuotaTotalService.deleteUserQuotaTotal(id);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/delete-list")
|
||||||
|
@Parameter(name = "ids", description = "编号", required = true)
|
||||||
|
@Operation(summary = "批量删除用户免费功能永久总次数额度表(所有功能共用)")
|
||||||
|
@PreAuthorize("@ss.hasPermission('keyboard:user-quota-total:delete')")
|
||||||
|
public CommonResult<Boolean> deleteUserQuotaTotalList(@RequestParam("ids") List<Long> ids) {
|
||||||
|
userQuotaTotalService.deleteUserQuotaTotalListByIds(ids);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/get")
|
||||||
|
@Operation(summary = "获得用户免费功能永久总次数额度表(所有功能共用)")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||||
|
@PreAuthorize("@ss.hasPermission('keyboard:user-quota-total:query')")
|
||||||
|
public CommonResult<KeyboardUserQuotaTotalRespVO> getUserQuotaTotal(@RequestParam("id") Long id) {
|
||||||
|
KeyboardUserQuotaTotalDO userQuotaTotal = userQuotaTotalService.getUserQuotaTotal(id);
|
||||||
|
return success(BeanUtils.toBean(userQuotaTotal, KeyboardUserQuotaTotalRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/page")
|
||||||
|
@Operation(summary = "获得用户免费功能永久总次数额度表(所有功能共用)分页")
|
||||||
|
@PreAuthorize("@ss.hasPermission('keyboard:user-quota-total:query')")
|
||||||
|
public CommonResult<PageResult<KeyboardUserQuotaTotalRespVO>> getUserQuotaTotalPage(@Valid KeyboardUserQuotaTotalPageReqVO pageReqVO) {
|
||||||
|
PageResult<KeyboardUserQuotaTotalDO> pageResult = userQuotaTotalService.getUserQuotaTotalPage(pageReqVO);
|
||||||
|
return success(BeanUtils.toBean(pageResult, KeyboardUserQuotaTotalRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/export-excel")
|
||||||
|
@Operation(summary = "导出用户免费功能永久总次数额度表(所有功能共用) Excel")
|
||||||
|
@PreAuthorize("@ss.hasPermission('keyboard:user-quota-total:export')")
|
||||||
|
@ApiAccessLog(operateType = EXPORT)
|
||||||
|
public void exportUserQuotaTotalExcel(@Valid KeyboardUserQuotaTotalPageReqVO pageReqVO,
|
||||||
|
HttpServletResponse response) throws IOException {
|
||||||
|
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||||
|
List<KeyboardUserQuotaTotalDO> list = userQuotaTotalService.getUserQuotaTotalPage(pageReqVO).getList();
|
||||||
|
// 导出 Excel
|
||||||
|
ExcelUtils.write(response, "用户免费功能永久总次数额度表(所有功能共用).xls", "数据", KeyboardUserQuotaTotalRespVO.class,
|
||||||
|
BeanUtils.toBean(list, KeyboardUserQuotaTotalRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
package com.yolo.keyboard.controller.admin.userquotatotal.vo;
|
||||||
|
|
||||||
|
import lombok.*;
|
||||||
|
import java.util.*;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import com.yolo.keyboard.framework.common.pojo.PageParam;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
import static com.yolo.keyboard.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 用户免费功能永久总次数额度表(所有功能共用)分页 Request VO")
|
||||||
|
@Data
|
||||||
|
public class KeyboardUserQuotaTotalPageReqVO extends PageParam {
|
||||||
|
|
||||||
|
@Schema(description = "免费体验的永久总次数上限(可通过运营活动增加)")
|
||||||
|
private Integer totalQuota;
|
||||||
|
|
||||||
|
@Schema(description = "已消耗的免费次数")
|
||||||
|
private Integer usedQuota;
|
||||||
|
|
||||||
|
@Schema(description = "乐观锁版本号(并发控制预留字段)")
|
||||||
|
private Integer version;
|
||||||
|
|
||||||
|
@Schema(description = "首次创建额度记录的时间(通常为注册时间)")
|
||||||
|
private LocalDateTime createdAt;
|
||||||
|
|
||||||
|
@Schema(description = "最近一次额度发生变化的时间(消耗或赠送)")
|
||||||
|
private LocalDateTime updatedAt;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
package com.yolo.keyboard.controller.admin.userquotatotal.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 KeyboardUserQuotaTotalRespVO {
|
||||||
|
|
||||||
|
@Schema(description = "用户唯一ID,对应系统用户", requiredMode = Schema.RequiredMode.REQUIRED, example = "19113")
|
||||||
|
@ExcelProperty("用户唯一ID,对应系统用户")
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
@Schema(description = "免费体验的永久总次数上限(可通过运营活动增加)", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@ExcelProperty("免费体验的永久总次数上限(可通过运营活动增加)")
|
||||||
|
private Integer totalQuota;
|
||||||
|
|
||||||
|
@Schema(description = "已消耗的免费次数", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@ExcelProperty("已消耗的免费次数")
|
||||||
|
private Integer usedQuota;
|
||||||
|
|
||||||
|
@Schema(description = "乐观锁版本号(并发控制预留字段)", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@ExcelProperty("乐观锁版本号(并发控制预留字段)")
|
||||||
|
private Integer version;
|
||||||
|
|
||||||
|
@Schema(description = "首次创建额度记录的时间(通常为注册时间)", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@ExcelProperty("首次创建额度记录的时间(通常为注册时间)")
|
||||||
|
private LocalDateTime createdAt;
|
||||||
|
|
||||||
|
@Schema(description = "最近一次额度发生变化的时间(消耗或赠送)", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@ExcelProperty("最近一次额度发生变化的时间(消耗或赠送)")
|
||||||
|
private LocalDateTime updatedAt;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
package com.yolo.keyboard.controller.admin.userquotatotal.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 KeyboardUserQuotaTotalSaveReqVO {
|
||||||
|
|
||||||
|
@Schema(description = "用户唯一ID,对应系统用户", requiredMode = Schema.RequiredMode.REQUIRED, example = "19113")
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
@Schema(description = "免费体验的永久总次数上限(可通过运营活动增加)", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@NotNull(message = "免费体验的永久总次数上限(可通过运营活动增加)不能为空")
|
||||||
|
private Integer totalQuota;
|
||||||
|
|
||||||
|
@Schema(description = "已消耗的免费次数", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@NotNull(message = "已消耗的免费次数不能为空")
|
||||||
|
private Integer usedQuota;
|
||||||
|
|
||||||
|
@Schema(description = "乐观锁版本号(并发控制预留字段)", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@NotNull(message = "乐观锁版本号(并发控制预留字段)不能为空")
|
||||||
|
private Integer version;
|
||||||
|
|
||||||
|
@Schema(description = "首次创建额度记录的时间(通常为注册时间)", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@NotNull(message = "首次创建额度记录的时间(通常为注册时间)不能为空")
|
||||||
|
private LocalDateTime createdAt;
|
||||||
|
|
||||||
|
@Schema(description = "最近一次额度发生变化的时间(消耗或赠送)", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||||
|
@NotNull(message = "最近一次额度发生变化的时间(消耗或赠送)不能为空")
|
||||||
|
private LocalDateTime updatedAt;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,104 @@
|
|||||||
|
package com.yolo.keyboard.controller.admin.userthemes;
|
||||||
|
|
||||||
|
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 com.yolo.keyboard.framework.common.pojo.PageParam;
|
||||||
|
import com.yolo.keyboard.framework.common.pojo.PageResult;
|
||||||
|
import com.yolo.keyboard.framework.common.pojo.CommonResult;
|
||||||
|
import com.yolo.keyboard.framework.common.util.object.BeanUtils;
|
||||||
|
import static com.yolo.keyboard.framework.common.pojo.CommonResult.success;
|
||||||
|
|
||||||
|
import com.yolo.keyboard.framework.excel.core.util.ExcelUtils;
|
||||||
|
|
||||||
|
import com.yolo.keyboard.framework.apilog.core.annotation.ApiAccessLog;
|
||||||
|
import static com.yolo.keyboard.framework.apilog.core.enums.OperateTypeEnum.*;
|
||||||
|
|
||||||
|
import com.yolo.keyboard.controller.admin.userthemes.vo.*;
|
||||||
|
import com.yolo.keyboard.dal.dataobject.userthemes.KeyboardUserThemesDO;
|
||||||
|
import com.yolo.keyboard.service.userthemes.KeyboardUserThemesService;
|
||||||
|
|
||||||
|
@Tag(name = "管理后台 - 用户主题")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/keyboard/user-themes")
|
||||||
|
@Validated
|
||||||
|
public class KeyboardUserThemesController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private KeyboardUserThemesService userThemesService;
|
||||||
|
|
||||||
|
@PostMapping("/create")
|
||||||
|
@Operation(summary = "创建用户主题")
|
||||||
|
@PreAuthorize("@ss.hasPermission('keyboard:user-themes:create')")
|
||||||
|
public CommonResult<Long> createUserThemes(@Valid @RequestBody KeyboardUserThemesSaveReqVO createReqVO) {
|
||||||
|
return success(userThemesService.createUserThemes(createReqVO));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/update")
|
||||||
|
@Operation(summary = "更新用户主题")
|
||||||
|
@PreAuthorize("@ss.hasPermission('keyboard:user-themes:update')")
|
||||||
|
public CommonResult<Boolean> updateUserThemes(@Valid @RequestBody KeyboardUserThemesSaveReqVO updateReqVO) {
|
||||||
|
userThemesService.updateUserThemes(updateReqVO);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/delete")
|
||||||
|
@Operation(summary = "删除用户主题")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true)
|
||||||
|
@PreAuthorize("@ss.hasPermission('keyboard:user-themes:delete')")
|
||||||
|
public CommonResult<Boolean> deleteUserThemes(@RequestParam("id") Long id) {
|
||||||
|
userThemesService.deleteUserThemes(id);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/delete-list")
|
||||||
|
@Parameter(name = "ids", description = "编号", required = true)
|
||||||
|
@Operation(summary = "批量删除用户主题")
|
||||||
|
@PreAuthorize("@ss.hasPermission('keyboard:user-themes:delete')")
|
||||||
|
public CommonResult<Boolean> deleteUserThemesList(@RequestParam("ids") List<Long> ids) {
|
||||||
|
userThemesService.deleteUserThemesListByIds(ids);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/get")
|
||||||
|
@Operation(summary = "获得用户主题")
|
||||||
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||||
|
@PreAuthorize("@ss.hasPermission('keyboard:user-themes:query')")
|
||||||
|
public CommonResult<KeyboardUserThemesRespVO> getUserThemes(@RequestParam("id") Long id) {
|
||||||
|
KeyboardUserThemesDO userThemes = userThemesService.getUserThemes(id);
|
||||||
|
return success(BeanUtils.toBean(userThemes, KeyboardUserThemesRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/page")
|
||||||
|
@Operation(summary = "获得用户主题分页")
|
||||||
|
@PreAuthorize("@ss.hasPermission('keyboard:user-themes:query')")
|
||||||
|
public CommonResult<PageResult<KeyboardUserThemesRespVO>> getUserThemesPage(@Valid KeyboardUserThemesPageReqVO pageReqVO) {
|
||||||
|
PageResult<KeyboardUserThemesDO> pageResult = userThemesService.getUserThemesPage(pageReqVO);
|
||||||
|
return success(BeanUtils.toBean(pageResult, KeyboardUserThemesRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/export-excel")
|
||||||
|
@Operation(summary = "导出用户主题 Excel")
|
||||||
|
@PreAuthorize("@ss.hasPermission('keyboard:user-themes:export')")
|
||||||
|
@ApiAccessLog(operateType = EXPORT)
|
||||||
|
public void exportUserThemesExcel(@Valid KeyboardUserThemesPageReqVO pageReqVO,
|
||||||
|
HttpServletResponse response) throws IOException {
|
||||||
|
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||||
|
List<KeyboardUserThemesDO> list = userThemesService.getUserThemesPage(pageReqVO).getList();
|
||||||
|
// 导出 Excel
|
||||||
|
ExcelUtils.write(response, "用户主题.xls", "数据", KeyboardUserThemesRespVO.class,
|
||||||
|
BeanUtils.toBean(list, KeyboardUserThemesRespVO.class));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
package com.yolo.keyboard.controller.admin.userthemes.vo;
|
||||||
|
|
||||||
|
import lombok.*;
|
||||||
|
import java.util.*;
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import com.yolo.keyboard.framework.common.pojo.PageParam;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
import static com.yolo.keyboard.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||||
|
|
||||||
|
@Schema(description = "管理后台 - 用户主题分页 Request VO")
|
||||||
|
@Data
|
||||||
|
public class KeyboardUserThemesPageReqVO extends PageParam {
|
||||||
|
|
||||||
|
@Schema(description = "主题主键", example = "21647")
|
||||||
|
private Long themeId;
|
||||||
|
|
||||||
|
@Schema(description = "用户 Id", example = "9884")
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间")
|
||||||
|
private LocalDateTime createdAt;
|
||||||
|
|
||||||
|
@Schema(description = "是否从显示移除")
|
||||||
|
private Boolean viewDeleted;
|
||||||
|
|
||||||
|
@Schema(description = "更新时间")
|
||||||
|
private Boolean updatedAt;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
package com.yolo.keyboard.controller.admin.userthemes.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 KeyboardUserThemesRespVO {
|
||||||
|
|
||||||
|
@Schema(description = "主键 id", requiredMode = Schema.RequiredMode.REQUIRED, example = "746")
|
||||||
|
@ExcelProperty("主键 id")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "主题主键", example = "21647")
|
||||||
|
@ExcelProperty("主题主键")
|
||||||
|
private Long themeId;
|
||||||
|
|
||||||
|
@Schema(description = "用户 Id", example = "9884")
|
||||||
|
@ExcelProperty("用户 Id")
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间")
|
||||||
|
@ExcelProperty("创建时间")
|
||||||
|
private LocalDateTime createdAt;
|
||||||
|
|
||||||
|
@Schema(description = "是否从显示移除")
|
||||||
|
@ExcelProperty("是否从显示移除")
|
||||||
|
private Boolean viewDeleted;
|
||||||
|
|
||||||
|
@Schema(description = "更新时间")
|
||||||
|
@ExcelProperty("更新时间")
|
||||||
|
private Boolean updatedAt;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
package com.yolo.keyboard.controller.admin.userthemes.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 KeyboardUserThemesSaveReqVO {
|
||||||
|
|
||||||
|
@Schema(description = "主键 id", requiredMode = Schema.RequiredMode.REQUIRED, example = "746")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Schema(description = "主题主键", example = "21647")
|
||||||
|
private Long themeId;
|
||||||
|
|
||||||
|
@Schema(description = "用户 Id", example = "9884")
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
@Schema(description = "创建时间")
|
||||||
|
private LocalDateTime createdAt;
|
||||||
|
|
||||||
|
@Schema(description = "是否从显示移除")
|
||||||
|
private Boolean viewDeleted;
|
||||||
|
|
||||||
|
@Schema(description = "更新时间")
|
||||||
|
private Boolean updatedAt;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
package com.yolo.keyboard.dal.dataobject.tag;
|
||||||
|
|
||||||
|
import com.yolo.keyboard.framework.tenant.core.aop.TenantIgnore;
|
||||||
|
import lombok.*;
|
||||||
|
import java.util.*;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import com.yolo.keyboard.framework.mybatis.core.dataobject.BaseDO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 人设标签 DO
|
||||||
|
*
|
||||||
|
* @author ziin
|
||||||
|
*/
|
||||||
|
@TableName("keyboard_tag")
|
||||||
|
@KeySequence("keyboard_tag_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||||
|
@Data
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@TenantIgnore
|
||||||
|
public class KeyboardTagDO{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键 Id
|
||||||
|
*/
|
||||||
|
@TableId
|
||||||
|
private Integer id;
|
||||||
|
/**
|
||||||
|
* 标签名
|
||||||
|
*/
|
||||||
|
private String tagName;
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime createdAt;
|
||||||
|
/**
|
||||||
|
* 更新时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime updatedAt;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
package com.yolo.keyboard.dal.dataobject.tenantbalance;
|
||||||
|
|
||||||
|
import com.yolo.keyboard.framework.tenant.core.aop.TenantIgnore;
|
||||||
|
import lombok.*;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.*;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import com.yolo.keyboard.framework.mybatis.core.dataobject.BaseDO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 租户余额 DO
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
@TableName("system_tenant_balance")
|
||||||
|
//@KeySequence("system_tenant_balance_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@TenantIgnore
|
||||||
|
public class TenantBalanceDO extends BaseDO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 租户 Id
|
||||||
|
*/
|
||||||
|
@TableId
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 当前积分余额
|
||||||
|
*/
|
||||||
|
private BigDecimal balance;
|
||||||
|
/**
|
||||||
|
* 乐观锁版本号
|
||||||
|
*/
|
||||||
|
@Version
|
||||||
|
private Integer version;
|
||||||
|
/**
|
||||||
|
* 更新时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime updatedAt;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 冻结金额
|
||||||
|
*/
|
||||||
|
private BigDecimal frozenAmt;
|
||||||
|
|
||||||
|
private BigDecimal withdrawableBalance;
|
||||||
|
}
|
||||||
@@ -0,0 +1,74 @@
|
|||||||
|
package com.yolo.keyboard.dal.dataobject.tenantbalancetransaction;
|
||||||
|
|
||||||
|
import com.yolo.keyboard.framework.tenant.core.aop.TenantIgnore;
|
||||||
|
import lombok.*;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.*;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import com.yolo.keyboard.framework.mybatis.core.dataobject.BaseDO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 租户积分记录 DO
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
@TableName("system_tenant_balance_transaction")
|
||||||
|
@KeySequence("system_tenant_balance_transaction_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||||
|
@Data
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@TenantIgnore
|
||||||
|
public class TenantBalanceTransactionDO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键
|
||||||
|
*/
|
||||||
|
@TableId
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 本次变动点数,正加负减
|
||||||
|
*/
|
||||||
|
private BigDecimal points;
|
||||||
|
/**
|
||||||
|
* 变动后余额快照(冗余)
|
||||||
|
*/
|
||||||
|
private BigDecimal balance;
|
||||||
|
/**
|
||||||
|
* 变动类型,如 TRANSFER_IN, WITHDRAW,REFUND_COMMISSION ,RECHARGE_COMMISSION
|
||||||
|
*/
|
||||||
|
private String type;
|
||||||
|
/**
|
||||||
|
* 变动描述
|
||||||
|
*/
|
||||||
|
private String description;
|
||||||
|
/**
|
||||||
|
* 订单 Id/业务单号
|
||||||
|
*/
|
||||||
|
private String orderId;
|
||||||
|
/**
|
||||||
|
* 业务流水号(转账、订单等唯一标识)
|
||||||
|
*/
|
||||||
|
private String bizNo;
|
||||||
|
/**
|
||||||
|
* 操作人 Id
|
||||||
|
*/
|
||||||
|
private Long operatorId;
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime createdAt;
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
private Long tenantId;
|
||||||
|
|
||||||
|
private BigDecimal frozenAmt;
|
||||||
|
|
||||||
|
private BigDecimal withdrawableBalance;
|
||||||
|
}
|
||||||
@@ -0,0 +1,117 @@
|
|||||||
|
package com.yolo.keyboard.dal.dataobject.tenantcommission;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.KeySequence;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.yolo.keyboard.framework.tenant.core.aop.TenantIgnore;
|
||||||
|
import lombok.*;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 租户分成记录 DO
|
||||||
|
* 记录每笔内购订单的分成计算结果
|
||||||
|
*
|
||||||
|
* @author ziin
|
||||||
|
*/
|
||||||
|
@TableName("keyboard_tenant_commission")
|
||||||
|
@KeySequence("keyboard_tenant_commission_seq")
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@TenantIgnore
|
||||||
|
public class KeyboardTenantCommissionDO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键
|
||||||
|
*/
|
||||||
|
@TableId
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 内购记录ID
|
||||||
|
*/
|
||||||
|
private Integer purchaseRecordId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 内购交易ID(唯一标识)
|
||||||
|
*/
|
||||||
|
private String transactionId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 被邀请用户ID(购买用户)
|
||||||
|
*/
|
||||||
|
private Integer inviteeUserId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 邀请人用户ID
|
||||||
|
*/
|
||||||
|
private Long inviterUserId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 收益归属租户ID
|
||||||
|
*/
|
||||||
|
private Long tenantId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 内购金额
|
||||||
|
*/
|
||||||
|
private BigDecimal purchaseAmount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分成比例
|
||||||
|
*/
|
||||||
|
private BigDecimal commissionRate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分成金额
|
||||||
|
*/
|
||||||
|
private BigDecimal commissionAmount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态:PENDING-待结算,SETTLED-已结算,REFUNDED-已退款
|
||||||
|
*/
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 内购时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime purchaseTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 结算时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime settledAt;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关联的余额交易记录ID
|
||||||
|
*/
|
||||||
|
private Long balanceTransactionId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime createdAt;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime updatedAt;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 可提现时间(结算时间 + 30天)
|
||||||
|
*/
|
||||||
|
private LocalDateTime withdrawableAt;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否已处理转可提现:false-未处理,true-已处理
|
||||||
|
*/
|
||||||
|
private Boolean withdrawableProcessed;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 备注
|
||||||
|
*/
|
||||||
|
private String remark;
|
||||||
|
}
|
||||||
@@ -0,0 +1,165 @@
|
|||||||
|
package com.yolo.keyboard.dal.dataobject.tenantwithdraworder;
|
||||||
|
|
||||||
|
import com.yolo.keyboard.framework.tenant.core.aop.TenantIgnore;
|
||||||
|
import lombok.*;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.*;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import com.yolo.keyboard.framework.mybatis.core.dataobject.BaseDO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 租户提现订单表(申请-审核-打款-完成/失败) DO
|
||||||
|
*
|
||||||
|
* @author ziin
|
||||||
|
*/
|
||||||
|
@TableName("system_tenant_withdraw_order")
|
||||||
|
@KeySequence("system_tenant_withdraw_order_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||||
|
@Data
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@TenantIgnore
|
||||||
|
public class KeyboardTenantWithdrawOrderDO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键
|
||||||
|
*/
|
||||||
|
@TableId
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 提现单号(业务唯一)
|
||||||
|
*/
|
||||||
|
private String withdrawNo;
|
||||||
|
/**
|
||||||
|
* 业务幂等号(防重复提交)
|
||||||
|
*/
|
||||||
|
private String bizNo;
|
||||||
|
/**
|
||||||
|
* 币种(默认 CNY)
|
||||||
|
*/
|
||||||
|
private String currency;
|
||||||
|
/**
|
||||||
|
* 提现申请金额(单位:元)
|
||||||
|
*/
|
||||||
|
private BigDecimal amount;
|
||||||
|
/**
|
||||||
|
* 手续费金额(单位:元)
|
||||||
|
*/
|
||||||
|
private BigDecimal feeAmount;
|
||||||
|
/**
|
||||||
|
* 实际到账金额(单位:元 = amount - fee_amount)
|
||||||
|
*/
|
||||||
|
private BigDecimal actualAmount;
|
||||||
|
/**
|
||||||
|
* 打款渠道:BANK/ALIPAY/WECHAT/PAYPAL 等
|
||||||
|
*/
|
||||||
|
private String payChannel;
|
||||||
|
/**
|
||||||
|
* 收款方类型:PERSON(个人)/COMPANY(企业)
|
||||||
|
*/
|
||||||
|
private String payeeType;
|
||||||
|
/**
|
||||||
|
* 收款人姓名或公司名称(快照)
|
||||||
|
*/
|
||||||
|
private String payeeName;
|
||||||
|
/**
|
||||||
|
* 收款账号(银行卡/支付宝等,建议加密或脱敏)
|
||||||
|
*/
|
||||||
|
private String payeeAccount;
|
||||||
|
/**
|
||||||
|
* 收款银行名称
|
||||||
|
*/
|
||||||
|
private String payeeBankName;
|
||||||
|
/**
|
||||||
|
* 银行编码(可选)
|
||||||
|
*/
|
||||||
|
private String payeeBankCode;
|
||||||
|
/**
|
||||||
|
* 银行支行名称(可选)
|
||||||
|
*/
|
||||||
|
private String payeeBankBranch;
|
||||||
|
/**
|
||||||
|
* 提现状态:APPLIED/APPROVED/REJECTED/PAYING/PAID/FAILED/CANCELED
|
||||||
|
*/
|
||||||
|
private String status;
|
||||||
|
/**
|
||||||
|
* 审核状态:PENDING/PASSED/REJECTED
|
||||||
|
*/
|
||||||
|
private String auditStatus;
|
||||||
|
/**
|
||||||
|
* 拒绝原因或打款失败原因
|
||||||
|
*/
|
||||||
|
private String reason;
|
||||||
|
/**
|
||||||
|
* 提现申请时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime applyTime;
|
||||||
|
/**
|
||||||
|
* 审核完成时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime auditTime;
|
||||||
|
/**
|
||||||
|
* 发起打款时间(请求第三方)
|
||||||
|
*/
|
||||||
|
private LocalDateTime payTime;
|
||||||
|
/**
|
||||||
|
* 打款成功时间(第三方确认)
|
||||||
|
*/
|
||||||
|
private LocalDateTime paidTime;
|
||||||
|
/**
|
||||||
|
* 业务终态时间(成功/失败/取消)
|
||||||
|
*/
|
||||||
|
private LocalDateTime finishTime;
|
||||||
|
/**
|
||||||
|
* 打款批次号(内部使用)
|
||||||
|
*/
|
||||||
|
private String payerBatchNo;
|
||||||
|
/**
|
||||||
|
* 第三方打款交易号/流水号(对账用)
|
||||||
|
*/
|
||||||
|
private String channelTradeNo;
|
||||||
|
/**
|
||||||
|
* 第三方返回的原始报文(用于排查)
|
||||||
|
*/
|
||||||
|
private Object channelRaw;
|
||||||
|
/**
|
||||||
|
* 关联余额流水ID(冻结/扣减/返还)
|
||||||
|
*/
|
||||||
|
private Long balanceTxnId;
|
||||||
|
/**
|
||||||
|
* 乐观锁版本号
|
||||||
|
*/
|
||||||
|
@Version
|
||||||
|
private Integer version;
|
||||||
|
/**
|
||||||
|
* 提现申请人ID
|
||||||
|
*/
|
||||||
|
private Long creatorId;
|
||||||
|
/**
|
||||||
|
* 审核人ID
|
||||||
|
*/
|
||||||
|
private Long auditorId;
|
||||||
|
/**
|
||||||
|
* 打款操作人ID
|
||||||
|
*/
|
||||||
|
private Long payerId;
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime createdAt;
|
||||||
|
/**
|
||||||
|
* 更新时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime updatedAt;
|
||||||
|
|
||||||
|
private Long tenantId;
|
||||||
|
}
|
||||||
@@ -7,6 +7,7 @@ import java.math.BigDecimal;
|
|||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import com.baomidou.mybatisplus.annotation.*;
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import com.yolo.keyboard.framework.mybatis.core.type.JsonbTypeHandler;
|
||||||
import com.yolo.keyboard.framework.mybatis.core.dataobject.BaseDO;
|
import com.yolo.keyboard.framework.mybatis.core.dataobject.BaseDO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -14,7 +15,7 @@ import com.yolo.keyboard.framework.mybatis.core.dataobject.BaseDO;
|
|||||||
*
|
*
|
||||||
* @author ziin
|
* @author ziin
|
||||||
*/
|
*/
|
||||||
@TableName("keyboard_themes")
|
@TableName(value = "keyboard_themes", autoResultMap = true)
|
||||||
@KeySequence("keyboard_themes_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
@KeySequence("keyboard_themes_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||||
@Data
|
@Data
|
||||||
@ToString(callSuper = true)
|
@ToString(callSuper = true)
|
||||||
@@ -40,6 +41,7 @@ public class KeyboardThemesDO {
|
|||||||
/**
|
/**
|
||||||
* 主题标签
|
* 主题标签
|
||||||
*/
|
*/
|
||||||
|
@TableField(typeHandler = JsonbTypeHandler.class)
|
||||||
private Object themeTag;
|
private Object themeTag;
|
||||||
/**
|
/**
|
||||||
* 主题下载次数
|
* 主题下载次数
|
||||||
|
|||||||
@@ -0,0 +1,53 @@
|
|||||||
|
package com.yolo.keyboard.dal.dataobject.usercharacter;
|
||||||
|
|
||||||
|
import com.yolo.keyboard.framework.tenant.core.aop.TenantIgnore;
|
||||||
|
import lombok.*;
|
||||||
|
import java.util.*;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import com.yolo.keyboard.framework.mybatis.core.dataobject.BaseDO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户人设管理 DO
|
||||||
|
*
|
||||||
|
* @author ziin
|
||||||
|
*/
|
||||||
|
@TableName("keyboard_user_character")
|
||||||
|
@KeySequence("keyboard_user_character_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||||
|
@Data
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@TenantIgnore
|
||||||
|
public class KeyboardUserCharacterDO{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键 Id
|
||||||
|
*/
|
||||||
|
@TableId
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 键盘人设 id
|
||||||
|
*/
|
||||||
|
private Long characterId;
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime createdAt;
|
||||||
|
/**
|
||||||
|
* 更新时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime updatedAt;
|
||||||
|
/**
|
||||||
|
* 用户 Id
|
||||||
|
*/
|
||||||
|
private Long userId;
|
||||||
|
/**
|
||||||
|
* emoji 标签
|
||||||
|
*/
|
||||||
|
private String emoji;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,73 @@
|
|||||||
|
package com.yolo.keyboard.dal.dataobject.userinvitecodes;
|
||||||
|
|
||||||
|
import com.yolo.keyboard.framework.tenant.core.aop.TenantIgnore;
|
||||||
|
import lombok.*;
|
||||||
|
import java.util.*;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import com.yolo.keyboard.framework.mybatis.core.dataobject.BaseDO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户生成的邀请码表,用于邀请新用户注册/安装并建立邀请关系 DO
|
||||||
|
*
|
||||||
|
* @author ziin
|
||||||
|
*/
|
||||||
|
@TableName("keyboard_user_invite_codes")
|
||||||
|
@KeySequence("invite_codes_id_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||||
|
@Data
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@TenantIgnore
|
||||||
|
public class KeyboardUserInviteCodesDO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 邀请码主键ID
|
||||||
|
*/
|
||||||
|
@TableId
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 邀请码字符串,对外展示,唯一
|
||||||
|
*/
|
||||||
|
private String code;
|
||||||
|
/**
|
||||||
|
* 邀请码所属用户ID(邀请人)
|
||||||
|
*/
|
||||||
|
private Long ownerUserId;
|
||||||
|
/**
|
||||||
|
* 邀请码状态:1=启用,0=停用
|
||||||
|
*/
|
||||||
|
private Short status;
|
||||||
|
/**
|
||||||
|
* 邀请码创建时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime createdAt;
|
||||||
|
/**
|
||||||
|
* 邀请码过期时间,NULL表示永久有效
|
||||||
|
*/
|
||||||
|
private LocalDateTime expiresAt;
|
||||||
|
/**
|
||||||
|
* 邀请码最大可使用次数,NULL表示不限次数
|
||||||
|
*/
|
||||||
|
private Integer maxUses;
|
||||||
|
/**
|
||||||
|
* 邀请码已使用次数
|
||||||
|
*/
|
||||||
|
private Integer usedCount;
|
||||||
|
/**
|
||||||
|
* 邀请码所属租户
|
||||||
|
*/
|
||||||
|
private Long ownerTenantId;
|
||||||
|
/**
|
||||||
|
* 邀请码所属系统用户
|
||||||
|
*/
|
||||||
|
private Long ownerSystemUserId;
|
||||||
|
/**
|
||||||
|
* 邀请码类型
|
||||||
|
*/
|
||||||
|
private String inviteType;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,84 @@
|
|||||||
|
package com.yolo.keyboard.dal.dataobject.userinvites;
|
||||||
|
|
||||||
|
import com.yolo.keyboard.framework.tenant.core.aop.TenantIgnore;
|
||||||
|
import lombok.*;
|
||||||
|
import java.util.*;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import com.yolo.keyboard.framework.mybatis.core.dataobject.BaseDO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户邀请关系绑定台账表,记录新用户最终归属的邀请人 DO
|
||||||
|
*
|
||||||
|
* @author ziin
|
||||||
|
*/
|
||||||
|
@TableName("keyboard_user_invites")
|
||||||
|
@KeySequence("keyboard_user_invites_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||||
|
@Data
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@TenantIgnore
|
||||||
|
public class KeyboardUserInvitesDO {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 邀请绑定记录主键ID
|
||||||
|
*/
|
||||||
|
@TableId
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 邀请人用户ID
|
||||||
|
*/
|
||||||
|
private Long inviterUserId;
|
||||||
|
/**
|
||||||
|
* 被邀请人用户ID(新注册用户)
|
||||||
|
*/
|
||||||
|
private Long inviteeUserId;
|
||||||
|
/**
|
||||||
|
* 使用的邀请码ID
|
||||||
|
*/
|
||||||
|
private Long inviteCodeId;
|
||||||
|
/**
|
||||||
|
* 绑定时关联的点击Token(通过邀请链接自动绑定时使用)
|
||||||
|
*/
|
||||||
|
private String clickToken;
|
||||||
|
/**
|
||||||
|
* 绑定方式:1=手动填写邀请码,2=邀请链接自动绑定,3=其他方式
|
||||||
|
*/
|
||||||
|
private Short bindType;
|
||||||
|
/**
|
||||||
|
* 邀请关系绑定完成时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime boundAt;
|
||||||
|
/**
|
||||||
|
* 绑定 iP
|
||||||
|
*/
|
||||||
|
private String bindIp;
|
||||||
|
/**
|
||||||
|
* userAgent
|
||||||
|
*/
|
||||||
|
private String bindUserAgent;
|
||||||
|
/**
|
||||||
|
* 邀请码类型快照:USER=普通用户邀请,AGENT=代理邀请
|
||||||
|
*/
|
||||||
|
private String inviteType;
|
||||||
|
/**
|
||||||
|
* 收益结算归属租户ID(代理结算用,绑定时固化)
|
||||||
|
*/
|
||||||
|
private Long profitTenantId;
|
||||||
|
/**
|
||||||
|
* 收益归因员工ID(用于区分租户员工/渠道,绑定时固化)
|
||||||
|
*/
|
||||||
|
private Long profitEmployeeId;
|
||||||
|
/**
|
||||||
|
* 邀请人所属租户ID快照(便于审计/对账,可选)
|
||||||
|
*/
|
||||||
|
private Long inviterTenantId;
|
||||||
|
/**
|
||||||
|
* 邀请码字符串快照(便于排查,可选)
|
||||||
|
*/
|
||||||
|
private String inviteCode;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
package com.yolo.keyboard.dal.dataobject.userquotatotal;
|
||||||
|
|
||||||
|
import com.yolo.keyboard.framework.tenant.core.aop.TenantIgnore;
|
||||||
|
import lombok.*;
|
||||||
|
import java.util.*;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import com.yolo.keyboard.framework.mybatis.core.dataobject.BaseDO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户免费功能永久总次数额度表(所有功能共用) DO
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
@TableName("keyboard_user_quota_total")
|
||||||
|
@KeySequence("keyboard_user_quota_total_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||||
|
@Data
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@TenantIgnore
|
||||||
|
public class KeyboardUserQuotaTotalDO{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户唯一ID,对应系统用户
|
||||||
|
*/
|
||||||
|
@TableId
|
||||||
|
private Long userId;
|
||||||
|
/**
|
||||||
|
* 免费体验的永久总次数上限(可通过运营活动增加)
|
||||||
|
*/
|
||||||
|
private Integer totalQuota;
|
||||||
|
/**
|
||||||
|
* 已消耗的免费次数
|
||||||
|
*/
|
||||||
|
private Integer usedQuota;
|
||||||
|
/**
|
||||||
|
* 乐观锁版本号(并发控制预留字段)
|
||||||
|
*/
|
||||||
|
private Integer version;
|
||||||
|
/**
|
||||||
|
* 首次创建额度记录的时间(通常为注册时间)
|
||||||
|
*/
|
||||||
|
private LocalDateTime createdAt;
|
||||||
|
/**
|
||||||
|
* 最近一次额度发生变化的时间(消耗或赠送)
|
||||||
|
*/
|
||||||
|
private LocalDateTime updatedAt;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
package com.yolo.keyboard.dal.dataobject.userthemes;
|
||||||
|
|
||||||
|
import com.yolo.keyboard.framework.tenant.core.aop.TenantIgnore;
|
||||||
|
import lombok.*;
|
||||||
|
import java.util.*;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import com.baomidou.mybatisplus.annotation.*;
|
||||||
|
import com.yolo.keyboard.framework.mybatis.core.dataobject.BaseDO;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户主题 DO
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
@TableName("keyboard_user_themes")
|
||||||
|
@KeySequence("keyboard_user_themes_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||||
|
@Data
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@TenantIgnore
|
||||||
|
public class KeyboardUserThemesDO{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键 id
|
||||||
|
*/
|
||||||
|
@TableId
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 主题主键
|
||||||
|
*/
|
||||||
|
private Long themeId;
|
||||||
|
/**
|
||||||
|
* 用户 Id
|
||||||
|
*/
|
||||||
|
private Long userId;
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime createdAt;
|
||||||
|
/**
|
||||||
|
* 是否从显示移除
|
||||||
|
*/
|
||||||
|
private Boolean viewDeleted;
|
||||||
|
/**
|
||||||
|
* 更新时间
|
||||||
|
*/
|
||||||
|
private Boolean updatedAt;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
package com.yolo.keyboard.dal.mysql.tag;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
import com.yolo.keyboard.framework.common.pojo.PageResult;
|
||||||
|
import com.yolo.keyboard.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
|
import com.yolo.keyboard.framework.mybatis.core.mapper.BaseMapperX;
|
||||||
|
import com.yolo.keyboard.dal.dataobject.tag.KeyboardTagDO;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import com.yolo.keyboard.controller.admin.tag.vo.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 人设标签 Mapper
|
||||||
|
*
|
||||||
|
* @author ziin
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface KeyboardTagMapper extends BaseMapperX<KeyboardTagDO> {
|
||||||
|
|
||||||
|
default PageResult<KeyboardTagDO> selectPage(KeyboardTagPageReqVO reqVO) {
|
||||||
|
return selectPage(reqVO, new LambdaQueryWrapperX<KeyboardTagDO>()
|
||||||
|
.likeIfPresent(KeyboardTagDO::getTagName, reqVO.getTagName())
|
||||||
|
.eqIfPresent(KeyboardTagDO::getCreatedAt, reqVO.getCreatedAt())
|
||||||
|
.eqIfPresent(KeyboardTagDO::getUpdatedAt, reqVO.getUpdatedAt())
|
||||||
|
.orderByDesc(KeyboardTagDO::getId));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
package com.yolo.keyboard.dal.mysql.tenantbalance;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
import com.yolo.keyboard.framework.common.pojo.PageResult;
|
||||||
|
import com.yolo.keyboard.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
|
import com.yolo.keyboard.framework.mybatis.core.mapper.BaseMapperX;
|
||||||
|
import com.yolo.keyboard.dal.dataobject.tenantbalance.TenantBalanceDO;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import com.yolo.keyboard.controller.admin.tenantbalance.vo.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 租户余额 Mapper
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface TenantBalanceMapper extends BaseMapperX<TenantBalanceDO> {
|
||||||
|
|
||||||
|
default PageResult<TenantBalanceDO> selectPage(TenantBalancePageReqVO reqVO) {
|
||||||
|
return selectPage(reqVO, new LambdaQueryWrapperX<TenantBalanceDO>()
|
||||||
|
.eqIfPresent(TenantBalanceDO::getBalance, reqVO.getBalance())
|
||||||
|
.eqIfPresent(TenantBalanceDO::getVersion, reqVO.getVersion())
|
||||||
|
.eqIfPresent(TenantBalanceDO::getUpdatedAt, reqVO.getUpdatedAt())
|
||||||
|
.orderByDesc(TenantBalanceDO::getId));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
package com.yolo.keyboard.dal.mysql.tenantbalancetransaction;
|
||||||
|
|
||||||
|
import com.yolo.keyboard.dal.dataobject.tenantbalancetransaction.TenantBalanceTransactionDO;
|
||||||
|
import com.yolo.keyboard.framework.common.pojo.PageParam;
|
||||||
|
import com.yolo.keyboard.framework.common.pojo.PageResult;
|
||||||
|
import com.yolo.keyboard.framework.mybatis.core.mapper.BaseMapperX;
|
||||||
|
import com.yolo.keyboard.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 租户积分记录 Mapper
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface TenantBalanceTransactionMapper extends BaseMapperX<TenantBalanceTransactionDO> {
|
||||||
|
|
||||||
|
default PageResult<TenantBalanceTransactionDO> selectPage(PageParam reqVO, Long tenantId) {
|
||||||
|
return selectPage(reqVO, new LambdaQueryWrapperX<TenantBalanceTransactionDO>()
|
||||||
|
.eq(TenantBalanceTransactionDO::getTenantId, tenantId)
|
||||||
|
.orderByDesc(TenantBalanceTransactionDO::getId));
|
||||||
|
}
|
||||||
|
|
||||||
|
default int deleteByTenantId(Long tenantId) {
|
||||||
|
return delete(TenantBalanceTransactionDO::getTenantId, tenantId);
|
||||||
|
}
|
||||||
|
|
||||||
|
default int deleteByTenantIds(List<Long> tenantIds) {
|
||||||
|
return deleteBatch(TenantBalanceTransactionDO::getTenantId, tenantIds);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
package com.yolo.keyboard.dal.mysql.tenantcommission;
|
||||||
|
|
||||||
|
import com.yolo.keyboard.controller.admin.tenantcommission.vo.KeyboardTenantCommissionPageReqVO;
|
||||||
|
import com.yolo.keyboard.dal.dataobject.tenantcommission.KeyboardTenantCommissionDO;
|
||||||
|
import com.yolo.keyboard.framework.common.pojo.PageResult;
|
||||||
|
import com.yolo.keyboard.framework.mybatis.core.mapper.BaseMapperX;
|
||||||
|
import com.yolo.keyboard.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 租户分成记录 Mapper
|
||||||
|
*
|
||||||
|
* @author ziin
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface KeyboardTenantCommissionMapper extends BaseMapperX<KeyboardTenantCommissionDO> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据交易ID查询分成记录
|
||||||
|
*/
|
||||||
|
default KeyboardTenantCommissionDO selectByTransactionId(String transactionId) {
|
||||||
|
return selectOne(KeyboardTenantCommissionDO::getTransactionId, transactionId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据内购记录ID查询分成记录
|
||||||
|
*/
|
||||||
|
default KeyboardTenantCommissionDO selectByPurchaseRecordId(Integer purchaseRecordId) {
|
||||||
|
return selectOne(KeyboardTenantCommissionDO::getPurchaseRecordId, purchaseRecordId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据内购记录ID和租户ID查询分成记录
|
||||||
|
* 用于检查某个租户是否已经对某条内购记录计算过分成
|
||||||
|
*/
|
||||||
|
default KeyboardTenantCommissionDO selectByPurchaseRecordIdAndTenantId(Integer purchaseRecordId, Long tenantId) {
|
||||||
|
return selectOne(new LambdaQueryWrapperX<KeyboardTenantCommissionDO>()
|
||||||
|
.eq(KeyboardTenantCommissionDO::getPurchaseRecordId, purchaseRecordId)
|
||||||
|
.eq(KeyboardTenantCommissionDO::getTenantId, tenantId));
|
||||||
|
}
|
||||||
|
|
||||||
|
default PageResult<KeyboardTenantCommissionDO> selectPage(KeyboardTenantCommissionPageReqVO reqVO) {
|
||||||
|
return selectPage(reqVO, new LambdaQueryWrapperX<KeyboardTenantCommissionDO>()
|
||||||
|
.eqIfPresent(KeyboardTenantCommissionDO::getTenantId, reqVO.getTenantId())
|
||||||
|
.eqIfPresent(KeyboardTenantCommissionDO::getPurchaseRecordId, reqVO.getPurchaseRecordId())
|
||||||
|
.eqIfPresent(KeyboardTenantCommissionDO::getTransactionId, reqVO.getTransactionId())
|
||||||
|
.eqIfPresent(KeyboardTenantCommissionDO::getInviteeUserId, reqVO.getInviteeUserId())
|
||||||
|
.eqIfPresent(KeyboardTenantCommissionDO::getInviterUserId, reqVO.getInviterUserId())
|
||||||
|
.eqIfPresent(KeyboardTenantCommissionDO::getPurchaseAmount, reqVO.getPurchaseAmount())
|
||||||
|
.eqIfPresent(KeyboardTenantCommissionDO::getCommissionRate, reqVO.getCommissionRate())
|
||||||
|
.eqIfPresent(KeyboardTenantCommissionDO::getCommissionAmount, reqVO.getCommissionAmount())
|
||||||
|
.eqIfPresent(KeyboardTenantCommissionDO::getStatus, reqVO.getStatus())
|
||||||
|
.betweenIfPresent(KeyboardTenantCommissionDO::getPurchaseTime, reqVO.getPurchaseTime())
|
||||||
|
.eqIfPresent(KeyboardTenantCommissionDO::getSettledAt, reqVO.getSettledAt())
|
||||||
|
.eqIfPresent(KeyboardTenantCommissionDO::getBalanceTransactionId, reqVO.getBalanceTransactionId())
|
||||||
|
.eqIfPresent(KeyboardTenantCommissionDO::getCreatedAt, reqVO.getCreatedAt())
|
||||||
|
.eqIfPresent(KeyboardTenantCommissionDO::getUpdatedAt, reqVO.getUpdatedAt())
|
||||||
|
.eqIfPresent(KeyboardTenantCommissionDO::getRemark, reqVO.getRemark())
|
||||||
|
.orderByDesc(KeyboardTenantCommissionDO::getId));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,57 @@
|
|||||||
|
package com.yolo.keyboard.dal.mysql.tenantwithdraworder;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
import com.yolo.keyboard.framework.common.pojo.PageResult;
|
||||||
|
import com.yolo.keyboard.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
|
import com.yolo.keyboard.framework.mybatis.core.mapper.BaseMapperX;
|
||||||
|
import com.yolo.keyboard.dal.dataobject.tenantwithdraworder.KeyboardTenantWithdrawOrderDO;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import com.yolo.keyboard.controller.admin.tenantwithdraworder.vo.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 租户提现订单表(申请-审核-打款-完成/失败) Mapper
|
||||||
|
*
|
||||||
|
* @author ziin
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface KeyboardTenantWithdrawOrderMapper extends BaseMapperX<KeyboardTenantWithdrawOrderDO> {
|
||||||
|
|
||||||
|
default PageResult<KeyboardTenantWithdrawOrderDO> selectPage(KeyboardTenantWithdrawOrderPageReqVO reqVO) {
|
||||||
|
return selectPage(reqVO, new LambdaQueryWrapperX<KeyboardTenantWithdrawOrderDO>()
|
||||||
|
.inIfPresent(KeyboardTenantWithdrawOrderDO::getTenantId, reqVO.getTenantIds())
|
||||||
|
.eqIfPresent(KeyboardTenantWithdrawOrderDO::getWithdrawNo, reqVO.getWithdrawNo())
|
||||||
|
.eqIfPresent(KeyboardTenantWithdrawOrderDO::getBizNo, reqVO.getBizNo())
|
||||||
|
.eqIfPresent(KeyboardTenantWithdrawOrderDO::getCurrency, reqVO.getCurrency())
|
||||||
|
.eqIfPresent(KeyboardTenantWithdrawOrderDO::getAmount, reqVO.getAmount())
|
||||||
|
.eqIfPresent(KeyboardTenantWithdrawOrderDO::getFeeAmount, reqVO.getFeeAmount())
|
||||||
|
.eqIfPresent(KeyboardTenantWithdrawOrderDO::getActualAmount, reqVO.getActualAmount())
|
||||||
|
.eqIfPresent(KeyboardTenantWithdrawOrderDO::getPayChannel, reqVO.getPayChannel())
|
||||||
|
.eqIfPresent(KeyboardTenantWithdrawOrderDO::getPayeeType, reqVO.getPayeeType())
|
||||||
|
.likeIfPresent(KeyboardTenantWithdrawOrderDO::getPayeeName, reqVO.getPayeeName())
|
||||||
|
.eqIfPresent(KeyboardTenantWithdrawOrderDO::getPayeeAccount, reqVO.getPayeeAccount())
|
||||||
|
.likeIfPresent(KeyboardTenantWithdrawOrderDO::getPayeeBankName, reqVO.getPayeeBankName())
|
||||||
|
.eqIfPresent(KeyboardTenantWithdrawOrderDO::getPayeeBankCode, reqVO.getPayeeBankCode())
|
||||||
|
.eqIfPresent(KeyboardTenantWithdrawOrderDO::getPayeeBankBranch, reqVO.getPayeeBankBranch())
|
||||||
|
.eqIfPresent(KeyboardTenantWithdrawOrderDO::getStatus, reqVO.getStatus())
|
||||||
|
.eqIfPresent(KeyboardTenantWithdrawOrderDO::getAuditStatus, reqVO.getAuditStatus())
|
||||||
|
.eqIfPresent(KeyboardTenantWithdrawOrderDO::getReason, reqVO.getReason())
|
||||||
|
.betweenIfPresent(KeyboardTenantWithdrawOrderDO::getApplyTime, reqVO.getApplyTime())
|
||||||
|
.betweenIfPresent(KeyboardTenantWithdrawOrderDO::getAuditTime, reqVO.getAuditTime())
|
||||||
|
.betweenIfPresent(KeyboardTenantWithdrawOrderDO::getPayTime, reqVO.getPayTime())
|
||||||
|
.betweenIfPresent(KeyboardTenantWithdrawOrderDO::getPaidTime, reqVO.getPaidTime())
|
||||||
|
.betweenIfPresent(KeyboardTenantWithdrawOrderDO::getFinishTime, reqVO.getFinishTime())
|
||||||
|
.eqIfPresent(KeyboardTenantWithdrawOrderDO::getPayerBatchNo, reqVO.getPayerBatchNo())
|
||||||
|
.eqIfPresent(KeyboardTenantWithdrawOrderDO::getChannelTradeNo, reqVO.getChannelTradeNo())
|
||||||
|
.eqIfPresent(KeyboardTenantWithdrawOrderDO::getChannelRaw, reqVO.getChannelRaw())
|
||||||
|
.eqIfPresent(KeyboardTenantWithdrawOrderDO::getBalanceTxnId, reqVO.getBalanceTxnId())
|
||||||
|
.eqIfPresent(KeyboardTenantWithdrawOrderDO::getVersion, reqVO.getVersion())
|
||||||
|
.eqIfPresent(KeyboardTenantWithdrawOrderDO::getCreatorId, reqVO.getCreatorId())
|
||||||
|
.eqIfPresent(KeyboardTenantWithdrawOrderDO::getAuditorId, reqVO.getAuditorId())
|
||||||
|
.eqIfPresent(KeyboardTenantWithdrawOrderDO::getPayerId, reqVO.getPayerId())
|
||||||
|
.eqIfPresent(KeyboardTenantWithdrawOrderDO::getCreatedAt, reqVO.getCreatedAt())
|
||||||
|
.eqIfPresent(KeyboardTenantWithdrawOrderDO::getUpdatedAt, reqVO.getUpdatedAt())
|
||||||
|
.orderByDesc(KeyboardTenantWithdrawOrderDO::getId));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
package com.yolo.keyboard.dal.mysql.usercharacter;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
import com.yolo.keyboard.framework.common.pojo.PageResult;
|
||||||
|
import com.yolo.keyboard.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
|
import com.yolo.keyboard.framework.mybatis.core.mapper.BaseMapperX;
|
||||||
|
import com.yolo.keyboard.dal.dataobject.usercharacter.KeyboardUserCharacterDO;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import com.yolo.keyboard.controller.admin.usercharacter.vo.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户人设管理 Mapper
|
||||||
|
*
|
||||||
|
* @author ziin
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface KeyboardUserCharacterMapper extends BaseMapperX<KeyboardUserCharacterDO> {
|
||||||
|
|
||||||
|
default PageResult<KeyboardUserCharacterDO> selectPage(KeyboardUserCharacterPageReqVO reqVO) {
|
||||||
|
return selectPage(reqVO, new LambdaQueryWrapperX<KeyboardUserCharacterDO>()
|
||||||
|
.eqIfPresent(KeyboardUserCharacterDO::getCharacterId, reqVO.getCharacterId())
|
||||||
|
.eqIfPresent(KeyboardUserCharacterDO::getCreatedAt, reqVO.getCreatedAt())
|
||||||
|
.eqIfPresent(KeyboardUserCharacterDO::getUpdatedAt, reqVO.getUpdatedAt())
|
||||||
|
.eqIfPresent(KeyboardUserCharacterDO::getUserId, reqVO.getUserId())
|
||||||
|
.eqIfPresent(KeyboardUserCharacterDO::getEmoji, reqVO.getEmoji())
|
||||||
|
.orderByDesc(KeyboardUserCharacterDO::getId));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
package com.yolo.keyboard.dal.mysql.userinvitecodes;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
import com.yolo.keyboard.framework.common.pojo.PageResult;
|
||||||
|
import com.yolo.keyboard.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
|
import com.yolo.keyboard.framework.mybatis.core.mapper.BaseMapperX;
|
||||||
|
import com.yolo.keyboard.dal.dataobject.userinvitecodes.KeyboardUserInviteCodesDO;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import com.yolo.keyboard.controller.admin.userinvitecodes.vo.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户生成的邀请码表,用于邀请新用户注册/安装并建立邀请关系 Mapper
|
||||||
|
*
|
||||||
|
* @author ziin
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface KeyboardUserInviteCodesMapper extends BaseMapperX<KeyboardUserInviteCodesDO> {
|
||||||
|
|
||||||
|
default PageResult<KeyboardUserInviteCodesDO> selectPage(KeyboardUserInviteCodesPageReqVO reqVO) {
|
||||||
|
return selectPage(reqVO, new LambdaQueryWrapperX<KeyboardUserInviteCodesDO>()
|
||||||
|
.eqIfPresent(KeyboardUserInviteCodesDO::getCode, reqVO.getCode())
|
||||||
|
.eqIfPresent(KeyboardUserInviteCodesDO::getOwnerUserId, reqVO.getOwnerUserId())
|
||||||
|
.eqIfPresent(KeyboardUserInviteCodesDO::getStatus, reqVO.getStatus())
|
||||||
|
.eqIfPresent(KeyboardUserInviteCodesDO::getCreatedAt, reqVO.getCreatedAt())
|
||||||
|
.eqIfPresent(KeyboardUserInviteCodesDO::getExpiresAt, reqVO.getExpiresAt())
|
||||||
|
.eqIfPresent(KeyboardUserInviteCodesDO::getMaxUses, reqVO.getMaxUses())
|
||||||
|
.eqIfPresent(KeyboardUserInviteCodesDO::getUsedCount, reqVO.getUsedCount())
|
||||||
|
.eqIfPresent(KeyboardUserInviteCodesDO::getOwnerTenantId, reqVO.getOwnerTenantId())
|
||||||
|
.eqIfPresent(KeyboardUserInviteCodesDO::getOwnerSystemUserId, reqVO.getOwnerSystemUserId())
|
||||||
|
.eqIfPresent(KeyboardUserInviteCodesDO::getInviteType, reqVO.getInviteType())
|
||||||
|
.orderByDesc(KeyboardUserInviteCodesDO::getId));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
package com.yolo.keyboard.dal.mysql.userinvites;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
import com.yolo.keyboard.framework.common.pojo.PageResult;
|
||||||
|
import com.yolo.keyboard.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
|
import com.yolo.keyboard.framework.mybatis.core.mapper.BaseMapperX;
|
||||||
|
import com.yolo.keyboard.dal.dataobject.userinvites.KeyboardUserInvitesDO;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import com.yolo.keyboard.controller.admin.userinvites.vo.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户邀请关系绑定台账表,记录新用户最终归属的邀请人 Mapper
|
||||||
|
*
|
||||||
|
* @author ziin
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface KeyboardUserInvitesMapper extends BaseMapperX<KeyboardUserInvitesDO> {
|
||||||
|
|
||||||
|
default PageResult<KeyboardUserInvitesDO> selectPage(KeyboardUserInvitesPageReqVO reqVO) {
|
||||||
|
return selectPage(reqVO, new LambdaQueryWrapperX<KeyboardUserInvitesDO>()
|
||||||
|
.eqIfPresent(KeyboardUserInvitesDO::getInviterUserId, reqVO.getInviterUserId())
|
||||||
|
.eqIfPresent(KeyboardUserInvitesDO::getInviteeUserId, reqVO.getInviteeUserId())
|
||||||
|
.eqIfPresent(KeyboardUserInvitesDO::getInviteCodeId, reqVO.getInviteCodeId())
|
||||||
|
.eqIfPresent(KeyboardUserInvitesDO::getClickToken, reqVO.getClickToken())
|
||||||
|
.eqIfPresent(KeyboardUserInvitesDO::getBindType, reqVO.getBindType())
|
||||||
|
.eqIfPresent(KeyboardUserInvitesDO::getBoundAt, reqVO.getBoundAt())
|
||||||
|
.eqIfPresent(KeyboardUserInvitesDO::getBindIp, reqVO.getBindIp())
|
||||||
|
.eqIfPresent(KeyboardUserInvitesDO::getBindUserAgent, reqVO.getBindUserAgent())
|
||||||
|
.eqIfPresent(KeyboardUserInvitesDO::getInviteType, reqVO.getInviteType())
|
||||||
|
.eqIfPresent(KeyboardUserInvitesDO::getProfitTenantId, reqVO.getProfitTenantId())
|
||||||
|
.eqIfPresent(KeyboardUserInvitesDO::getProfitEmployeeId, reqVO.getProfitEmployeeId())
|
||||||
|
.eqIfPresent(KeyboardUserInvitesDO::getInviterTenantId, reqVO.getInviterTenantId())
|
||||||
|
.eqIfPresent(KeyboardUserInvitesDO::getInviteCode, reqVO.getInviteCode())
|
||||||
|
.orderByDesc(KeyboardUserInvitesDO::getId));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
package com.yolo.keyboard.dal.mysql.userquotatotal;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
import com.yolo.keyboard.framework.common.pojo.PageResult;
|
||||||
|
import com.yolo.keyboard.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
|
import com.yolo.keyboard.framework.mybatis.core.mapper.BaseMapperX;
|
||||||
|
import com.yolo.keyboard.dal.dataobject.userquotatotal.KeyboardUserQuotaTotalDO;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import com.yolo.keyboard.controller.admin.userquotatotal.vo.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户免费功能永久总次数额度表(所有功能共用) Mapper
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface KeyboardUserQuotaTotalMapper extends BaseMapperX<KeyboardUserQuotaTotalDO> {
|
||||||
|
|
||||||
|
default PageResult<KeyboardUserQuotaTotalDO> selectPage(KeyboardUserQuotaTotalPageReqVO reqVO) {
|
||||||
|
return selectPage(reqVO, new LambdaQueryWrapperX<KeyboardUserQuotaTotalDO>()
|
||||||
|
.eqIfPresent(KeyboardUserQuotaTotalDO::getTotalQuota, reqVO.getTotalQuota())
|
||||||
|
.eqIfPresent(KeyboardUserQuotaTotalDO::getUsedQuota, reqVO.getUsedQuota())
|
||||||
|
.eqIfPresent(KeyboardUserQuotaTotalDO::getVersion, reqVO.getVersion())
|
||||||
|
.eqIfPresent(KeyboardUserQuotaTotalDO::getCreatedAt, reqVO.getCreatedAt())
|
||||||
|
.eqIfPresent(KeyboardUserQuotaTotalDO::getUpdatedAt, reqVO.getUpdatedAt())
|
||||||
|
.orderByDesc(KeyboardUserQuotaTotalDO::getUserId));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
package com.yolo.keyboard.dal.mysql.userthemes;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
import com.yolo.keyboard.framework.common.pojo.PageResult;
|
||||||
|
import com.yolo.keyboard.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
|
import com.yolo.keyboard.framework.mybatis.core.mapper.BaseMapperX;
|
||||||
|
import com.yolo.keyboard.dal.dataobject.userthemes.KeyboardUserThemesDO;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import com.yolo.keyboard.controller.admin.userthemes.vo.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户主题 Mapper
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface KeyboardUserThemesMapper extends BaseMapperX<KeyboardUserThemesDO> {
|
||||||
|
|
||||||
|
default PageResult<KeyboardUserThemesDO> selectPage(KeyboardUserThemesPageReqVO reqVO) {
|
||||||
|
return selectPage(reqVO, new LambdaQueryWrapperX<KeyboardUserThemesDO>()
|
||||||
|
.eqIfPresent(KeyboardUserThemesDO::getThemeId, reqVO.getThemeId())
|
||||||
|
.eqIfPresent(KeyboardUserThemesDO::getUserId, reqVO.getUserId())
|
||||||
|
.eqIfPresent(KeyboardUserThemesDO::getCreatedAt, reqVO.getCreatedAt())
|
||||||
|
.eqIfPresent(KeyboardUserThemesDO::getViewDeleted, reqVO.getViewDeleted())
|
||||||
|
.eqIfPresent(KeyboardUserThemesDO::getUpdatedAt, reqVO.getUpdatedAt())
|
||||||
|
.orderByDesc(KeyboardUserThemesDO::getId));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,134 @@
|
|||||||
|
package com.yolo.keyboard.job;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import com.yolo.keyboard.dal.dataobject.tenantbalance.TenantBalanceDO;
|
||||||
|
import com.yolo.keyboard.dal.dataobject.tenantbalancetransaction.TenantBalanceTransactionDO;
|
||||||
|
import com.yolo.keyboard.dal.dataobject.tenantcommission.KeyboardTenantCommissionDO;
|
||||||
|
import com.yolo.keyboard.dal.mysql.tenantbalance.TenantBalanceMapper;
|
||||||
|
import com.yolo.keyboard.dal.mysql.tenantbalancetransaction.TenantBalanceTransactionMapper;
|
||||||
|
import com.yolo.keyboard.dal.mysql.tenantcommission.KeyboardTenantCommissionMapper;
|
||||||
|
import com.yolo.keyboard.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
|
import com.yolo.keyboard.framework.quartz.core.handler.JobHandler;
|
||||||
|
import com.yolo.keyboard.framework.tenant.core.aop.TenantIgnore;
|
||||||
|
import com.yolo.keyboard.utils.BizNoGenerator;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分成可提现转换定时任务
|
||||||
|
* 每小时执行一次,将满30天的分成金额转为可提现余额
|
||||||
|
*
|
||||||
|
* @author ziin
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
@Slf4j
|
||||||
|
public class CommissionWithdrawableJob implements JobHandler {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private KeyboardTenantCommissionMapper commissionMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private TenantBalanceMapper tenantBalanceMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private TenantBalanceTransactionMapper balanceTransactionMapper;
|
||||||
|
|
||||||
|
private static final String WITHDRAWABLE_TYPE = "WITHDRAWABLE";
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@TenantIgnore
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public String execute(String param) {
|
||||||
|
log.info("[CommissionWithdrawableJob] 开始执行分成可提现转换任务");
|
||||||
|
|
||||||
|
LocalDateTime now = LocalDateTime.now();
|
||||||
|
|
||||||
|
// 1. 查询已到可提现时间且未处理的分成记录
|
||||||
|
List<KeyboardTenantCommissionDO> commissions = commissionMapper.selectList(
|
||||||
|
new LambdaQueryWrapperX<KeyboardTenantCommissionDO>()
|
||||||
|
.le(KeyboardTenantCommissionDO::getWithdrawableAt, now)
|
||||||
|
.eq(KeyboardTenantCommissionDO::getWithdrawableProcessed, false)
|
||||||
|
.eq(KeyboardTenantCommissionDO::getStatus, "SETTLED")
|
||||||
|
);
|
||||||
|
|
||||||
|
if (CollUtil.isEmpty(commissions)) {
|
||||||
|
log.info("[CommissionWithdrawableJob] 没有需要处理的分成记录");
|
||||||
|
return "没有需要处理的分成记录";
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. 按租户分组汇总金额
|
||||||
|
Map<Long, List<KeyboardTenantCommissionDO>> tenantCommissionsMap = commissions.stream()
|
||||||
|
.collect(Collectors.groupingBy(KeyboardTenantCommissionDO::getTenantId));
|
||||||
|
|
||||||
|
int tenantCount = 0;
|
||||||
|
int commissionCount = 0;
|
||||||
|
BigDecimal totalAmount = BigDecimal.ZERO;
|
||||||
|
|
||||||
|
// 3. 逐个租户处理
|
||||||
|
for (Map.Entry<Long, List<KeyboardTenantCommissionDO>> entry : tenantCommissionsMap.entrySet()) {
|
||||||
|
Long tenantId = entry.getKey();
|
||||||
|
List<KeyboardTenantCommissionDO> tenantCommissions = entry.getValue();
|
||||||
|
|
||||||
|
// 计算该租户的总可提现金额
|
||||||
|
BigDecimal tenantTotalAmount = tenantCommissions.stream()
|
||||||
|
.map(KeyboardTenantCommissionDO::getCommissionAmount)
|
||||||
|
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||||
|
|
||||||
|
// 更新租户可提现余额
|
||||||
|
TenantBalanceDO balance = tenantBalanceMapper.selectById(tenantId);
|
||||||
|
if (balance == null) {
|
||||||
|
log.warn("[CommissionWithdrawableJob] 租户 {} 余额记录不存在,跳过", tenantId);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
BigDecimal currentWithdrawable = balance.getWithdrawableBalance() != null
|
||||||
|
? balance.getWithdrawableBalance() : BigDecimal.ZERO;
|
||||||
|
BigDecimal newWithdrawable = currentWithdrawable.add(tenantTotalAmount);
|
||||||
|
balance.setWithdrawableBalance(newWithdrawable);
|
||||||
|
tenantBalanceMapper.updateById(balance);
|
||||||
|
|
||||||
|
// 创建余额交易记录
|
||||||
|
String bizNo = BizNoGenerator.generate("WDB");
|
||||||
|
TenantBalanceTransactionDO transaction = TenantBalanceTransactionDO.builder()
|
||||||
|
.bizNo(bizNo)
|
||||||
|
.points(tenantTotalAmount)
|
||||||
|
.balance(balance.getBalance())
|
||||||
|
.frozenAmt(balance.getFrozenAmt() != null ? balance.getFrozenAmt() : BigDecimal.ZERO)
|
||||||
|
.withdrawableBalance(newWithdrawable)
|
||||||
|
.tenantId(tenantId)
|
||||||
|
.type(WITHDRAWABLE_TYPE)
|
||||||
|
.description("分成转可提现")
|
||||||
|
.createdAt(now)
|
||||||
|
.remark("共 " + tenantCommissions.size() + " 笔分成转为可提现")
|
||||||
|
.build();
|
||||||
|
balanceTransactionMapper.insert(transaction);
|
||||||
|
|
||||||
|
// 标记分成记录为已处理
|
||||||
|
for (KeyboardTenantCommissionDO commission : tenantCommissions) {
|
||||||
|
commission.setWithdrawableProcessed(true);
|
||||||
|
commission.setUpdatedAt(now);
|
||||||
|
commissionMapper.updateById(commission);
|
||||||
|
}
|
||||||
|
|
||||||
|
tenantCount++;
|
||||||
|
commissionCount += tenantCommissions.size();
|
||||||
|
totalAmount = totalAmount.add(tenantTotalAmount);
|
||||||
|
|
||||||
|
log.info("[CommissionWithdrawableJob] 处理租户 {},分成 {} 笔,金额 {}",
|
||||||
|
tenantId, tenantCommissions.size(), tenantTotalAmount);
|
||||||
|
}
|
||||||
|
|
||||||
|
String result = String.format("处理租户 %d 个,分成记录 %d 条,总金额 %s",
|
||||||
|
tenantCount, commissionCount, totalAmount.toPlainString());
|
||||||
|
log.info("[CommissionWithdrawableJob] 任务执行完成: {}", result);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,308 @@
|
|||||||
|
package com.yolo.keyboard.job;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import com.yolo.keyboard.dal.dataobject.tenantbalance.TenantBalanceDO;
|
||||||
|
import com.yolo.keyboard.dal.dataobject.tenantbalancetransaction.TenantBalanceTransactionDO;
|
||||||
|
import com.yolo.keyboard.dal.dataobject.tenantcommission.KeyboardTenantCommissionDO;
|
||||||
|
import com.yolo.keyboard.dal.dataobject.userinvites.KeyboardUserInvitesDO;
|
||||||
|
import com.yolo.keyboard.dal.dataobject.userpurchaserecords.KeyboardUserPurchaseRecordsDO;
|
||||||
|
import com.yolo.keyboard.dal.mysql.tenantbalance.TenantBalanceMapper;
|
||||||
|
import com.yolo.keyboard.dal.mysql.tenantbalancetransaction.TenantBalanceTransactionMapper;
|
||||||
|
import com.yolo.keyboard.dal.mysql.tenantcommission.KeyboardTenantCommissionMapper;
|
||||||
|
import com.yolo.keyboard.dal.mysql.userinvites.KeyboardUserInvitesMapper;
|
||||||
|
import com.yolo.keyboard.dal.mysql.userpurchaserecords.KeyboardUserPurchaseRecordsMapper;
|
||||||
|
import com.yolo.keyboard.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
|
import com.yolo.keyboard.framework.quartz.core.handler.JobHandler;
|
||||||
|
import com.yolo.keyboard.framework.tenant.core.aop.TenantIgnore;
|
||||||
|
import com.yolo.keyboard.module.system.dal.dataobject.tenant.TenantDO;
|
||||||
|
import com.yolo.keyboard.module.system.dal.mysql.tenant.TenantMapper;
|
||||||
|
import com.yolo.keyboard.utils.BizNoGenerator;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.math.RoundingMode;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 租户分成计算定时任务
|
||||||
|
* 每小时执行一次,计算邀请用户的内购分成
|
||||||
|
* 支持一级代理和二级代理的分成计算
|
||||||
|
*
|
||||||
|
* @author ziin
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
@Slf4j
|
||||||
|
public class TenantCommissionCalculateJob implements JobHandler {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private KeyboardUserPurchaseRecordsMapper purchaseRecordsMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private KeyboardUserInvitesMapper userInvitesMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private KeyboardTenantCommissionMapper commissionMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private TenantMapper tenantMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private TenantBalanceMapper tenantBalanceMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private TenantBalanceTransactionMapper balanceTransactionMapper;
|
||||||
|
|
||||||
|
private static final String COMMISSION_TYPE = "COMMISSION";
|
||||||
|
private static final String STATUS_PAID = "PAID";
|
||||||
|
private static final String INVITE_TYPE_AGENT = "AGENT";
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@TenantIgnore
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public String execute(String param) {
|
||||||
|
log.info("[TenantCommissionCalculateJob] 开始执行分成计算任务");
|
||||||
|
|
||||||
|
// 1. 查询最近一小时内已支付的内购记录
|
||||||
|
LocalDateTime endTime = LocalDateTime.now();
|
||||||
|
LocalDateTime startTime = endTime.minusHours(1);
|
||||||
|
|
||||||
|
List<KeyboardUserPurchaseRecordsDO> purchaseRecords = purchaseRecordsMapper.selectList(
|
||||||
|
new LambdaQueryWrapperX<KeyboardUserPurchaseRecordsDO>()
|
||||||
|
.eq(KeyboardUserPurchaseRecordsDO::getStatus, STATUS_PAID)
|
||||||
|
.between(KeyboardUserPurchaseRecordsDO::getPurchaseTime, startTime, endTime)
|
||||||
|
);
|
||||||
|
|
||||||
|
if (CollUtil.isEmpty(purchaseRecords)) {
|
||||||
|
log.info("[TenantCommissionCalculateJob] 最近一小时内没有已支付的内购记录");
|
||||||
|
return "没有需要处理的内购记录";
|
||||||
|
}
|
||||||
|
|
||||||
|
int processedCount = 0;
|
||||||
|
int commissionCount = 0;
|
||||||
|
BigDecimal totalCommission = BigDecimal.ZERO;
|
||||||
|
|
||||||
|
// 2. 遍历内购记录,检查是否有邀请关系
|
||||||
|
for (KeyboardUserPurchaseRecordsDO record : purchaseRecords) {
|
||||||
|
// 检查是否已经计算过分成
|
||||||
|
if (commissionMapper.selectByPurchaseRecordId(record.getId()) != null) {
|
||||||
|
log.debug("[TenantCommissionCalculateJob] 内购记录 {} 已计算过分成,跳过", record.getId());
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
processedCount++;
|
||||||
|
|
||||||
|
// 查询该用户的邀请关系
|
||||||
|
KeyboardUserInvitesDO invite = userInvitesMapper.selectOne(
|
||||||
|
KeyboardUserInvitesDO::getInviteeUserId, record.getUserId().longValue()
|
||||||
|
);
|
||||||
|
|
||||||
|
if (invite == null) {
|
||||||
|
log.debug("[TenantCommissionCalculateJob] 用户 {} 没有邀请关系,跳过", record.getUserId());
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 只处理代理邀请类型
|
||||||
|
if (!INVITE_TYPE_AGENT.equals(invite.getInviteType())) {
|
||||||
|
log.debug("[TenantCommissionCalculateJob] 用户 {} 的邀请类型不是代理,跳过", record.getUserId());
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取收益归属租户(邀请人所属租户)
|
||||||
|
Long inviterTenantId = invite.getProfitTenantId();
|
||||||
|
if (inviterTenantId == null) {
|
||||||
|
inviterTenantId = invite.getInviterTenantId();
|
||||||
|
}
|
||||||
|
if (inviterTenantId == null) {
|
||||||
|
log.warn("[TenantCommissionCalculateJob] 用户 {} 的邀请关系没有关联租户,跳过", record.getUserId());
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取邀请人租户信息
|
||||||
|
TenantDO inviterTenant = tenantMapper.selectById(inviterTenantId);
|
||||||
|
if (inviterTenant == null) {
|
||||||
|
log.warn("[TenantCommissionCalculateJob] 租户 {} 不存在,跳过", inviterTenantId);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取内购金额
|
||||||
|
BigDecimal purchaseAmount = record.getPrice();
|
||||||
|
if (purchaseAmount == null || purchaseAmount.compareTo(BigDecimal.ZERO) <= 0) {
|
||||||
|
log.debug("[TenantCommissionCalculateJob] 内购记录 {} 金额无效,跳过", record.getId());
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
LocalDateTime now = LocalDateTime.now();
|
||||||
|
LocalDateTime withdrawableAt = now.plusDays(30);
|
||||||
|
|
||||||
|
// 判断是否是二级代理(有上级租户)
|
||||||
|
if (inviterTenant.getParentId() != null) {
|
||||||
|
// 二级代理场景:需要给一级代理和二级代理都分成
|
||||||
|
TenantDO parentTenant = tenantMapper.selectById(inviterTenant.getParentId());
|
||||||
|
if (parentTenant == null) {
|
||||||
|
log.warn("[TenantCommissionCalculateJob] 上级租户 {} 不存在,跳过", inviterTenant.getParentId());
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 使用一级代理的分成比例计算总分成
|
||||||
|
BigDecimal totalCommissionRate = parentTenant.getProfitShareRatio();
|
||||||
|
if (totalCommissionRate == null || totalCommissionRate.compareTo(BigDecimal.ZERO) <= 0) {
|
||||||
|
log.debug("[TenantCommissionCalculateJob] 一级代理租户 {} 没有设置分成比例,跳过", parentTenant.getId());
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
BigDecimal totalCommissionAmount = purchaseAmount.multiply(totalCommissionRate)
|
||||||
|
.setScale(2, RoundingMode.HALF_UP);
|
||||||
|
|
||||||
|
// 获取二级代理的返点比例
|
||||||
|
BigDecimal rebateRatio = inviterTenant.getUpstreamRebateRatio();
|
||||||
|
if (rebateRatio == null || rebateRatio.compareTo(BigDecimal.ZERO) <= 0) {
|
||||||
|
// 如果没有设置返点比例,全部归一级代理
|
||||||
|
log.debug("[TenantCommissionCalculateJob] 二级代理租户 {} 没有设置返点比例,全部归一级代理", inviterTenantId);
|
||||||
|
int count = createCommissionRecord(record, invite, parentTenant.getId(), purchaseAmount,
|
||||||
|
totalCommissionRate, totalCommissionAmount, now, withdrawableAt,
|
||||||
|
"一级代理分成(二级代理无返点)");
|
||||||
|
commissionCount += count;
|
||||||
|
totalCommission = totalCommission.add(totalCommissionAmount);
|
||||||
|
} else {
|
||||||
|
// 计算二级代理分成
|
||||||
|
BigDecimal secondLevelAmount = totalCommissionAmount.multiply(rebateRatio)
|
||||||
|
.setScale(2, RoundingMode.HALF_UP);
|
||||||
|
// 计算一级代理分成
|
||||||
|
BigDecimal firstLevelAmount = totalCommissionAmount.subtract(secondLevelAmount);
|
||||||
|
|
||||||
|
// 为二级代理创建分成记录
|
||||||
|
if (secondLevelAmount.compareTo(BigDecimal.ZERO) > 0) {
|
||||||
|
int count = createCommissionRecord(record, invite, inviterTenantId, purchaseAmount,
|
||||||
|
rebateRatio, secondLevelAmount, now, withdrawableAt,
|
||||||
|
"二级代理分成");
|
||||||
|
commissionCount += count;
|
||||||
|
totalCommission = totalCommission.add(secondLevelAmount);
|
||||||
|
log.info("[TenantCommissionCalculateJob] 内购记录 {}, 二级代理 {}, 分成金额 {}",
|
||||||
|
record.getId(), inviterTenantId, secondLevelAmount);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 为一级代理创建分成记录
|
||||||
|
if (firstLevelAmount.compareTo(BigDecimal.ZERO) > 0) {
|
||||||
|
BigDecimal firstLevelRate = BigDecimal.ONE.subtract(rebateRatio);
|
||||||
|
int count = createCommissionRecord(record, invite, parentTenant.getId(), purchaseAmount,
|
||||||
|
firstLevelRate, firstLevelAmount, now, withdrawableAt,
|
||||||
|
"一级代理分成(扣除二级返点)");
|
||||||
|
commissionCount += count;
|
||||||
|
totalCommission = totalCommission.add(firstLevelAmount);
|
||||||
|
log.info("[TenantCommissionCalculateJob] 内购记录 {}, 一级代理 {}, 分成金额 {}",
|
||||||
|
record.getId(), parentTenant.getId(), firstLevelAmount);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// 一级代理场景:全部分成归一级代理
|
||||||
|
BigDecimal commissionRate = inviterTenant.getProfitShareRatio();
|
||||||
|
if (commissionRate == null || commissionRate.compareTo(BigDecimal.ZERO) <= 0) {
|
||||||
|
log.debug("[TenantCommissionCalculateJob] 租户 {} 没有设置分成比例,跳过", inviterTenantId);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
BigDecimal commissionAmount = purchaseAmount.multiply(commissionRate)
|
||||||
|
.setScale(2, RoundingMode.HALF_UP);
|
||||||
|
|
||||||
|
int count = createCommissionRecord(record, invite, inviterTenantId, purchaseAmount,
|
||||||
|
commissionRate, commissionAmount, now, withdrawableAt,
|
||||||
|
"一级代理分成");
|
||||||
|
commissionCount += count;
|
||||||
|
totalCommission = totalCommission.add(commissionAmount);
|
||||||
|
|
||||||
|
log.info("[TenantCommissionCalculateJob] 内购记录 {}, 一级代理 {}, 分成金额 {}",
|
||||||
|
record.getId(), inviterTenantId, commissionAmount);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
String result = String.format("处理内购记录 %d 条,生成分成 %d 条,总分成金额 %s",
|
||||||
|
processedCount, commissionCount, totalCommission.toPlainString());
|
||||||
|
log.info("[TenantCommissionCalculateJob] 任务执行完成: {}", result);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建分成记录并更新租户余额
|
||||||
|
*
|
||||||
|
* @return 创建的分成记录数量
|
||||||
|
*/
|
||||||
|
private int createCommissionRecord(KeyboardUserPurchaseRecordsDO record,
|
||||||
|
KeyboardUserInvitesDO invite,
|
||||||
|
Long tenantId,
|
||||||
|
BigDecimal purchaseAmount,
|
||||||
|
BigDecimal commissionRate,
|
||||||
|
BigDecimal commissionAmount,
|
||||||
|
LocalDateTime now,
|
||||||
|
LocalDateTime withdrawableAt,
|
||||||
|
String remark) {
|
||||||
|
// 0. 检查该租户是否已对该内购记录计算过分成(防止重复计算)
|
||||||
|
KeyboardTenantCommissionDO existingCommission = commissionMapper.selectByPurchaseRecordIdAndTenantId(record.getId(), tenantId);
|
||||||
|
if (existingCommission != null) {
|
||||||
|
log.debug("[TenantCommissionCalculateJob] 租户 {} 已对内购记录 {} 计算过分成,跳过", tenantId, record.getId());
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 1. 创建分成记录
|
||||||
|
KeyboardTenantCommissionDO commission = KeyboardTenantCommissionDO.builder()
|
||||||
|
.purchaseRecordId(record.getId())
|
||||||
|
.transactionId(record.getTransactionId())
|
||||||
|
.inviteeUserId(record.getUserId())
|
||||||
|
.inviterUserId(invite.getProfitEmployeeId())
|
||||||
|
.tenantId(tenantId)
|
||||||
|
.purchaseAmount(purchaseAmount)
|
||||||
|
.commissionRate(commissionRate)
|
||||||
|
.commissionAmount(commissionAmount)
|
||||||
|
.status("SETTLED")
|
||||||
|
.purchaseTime(record.getPurchaseTime())
|
||||||
|
.settledAt(now)
|
||||||
|
.withdrawableAt(withdrawableAt)
|
||||||
|
.withdrawableProcessed(false)
|
||||||
|
.createdAt(now)
|
||||||
|
.updatedAt(now)
|
||||||
|
.remark(remark)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
// 2. 更新租户余额(分成金额先计入总余额,30天后才可提现)
|
||||||
|
TenantBalanceDO balance = tenantBalanceMapper.selectById(tenantId);
|
||||||
|
if (balance == null) {
|
||||||
|
balance = new TenantBalanceDO();
|
||||||
|
balance.setId(tenantId);
|
||||||
|
balance.setBalance(commissionAmount);
|
||||||
|
balance.setWithdrawableBalance(BigDecimal.ZERO);
|
||||||
|
balance.setFrozenAmt(BigDecimal.ZERO);
|
||||||
|
balance.setVersion(0);
|
||||||
|
tenantBalanceMapper.insert(balance);
|
||||||
|
} else {
|
||||||
|
BigDecimal newBalance = balance.getBalance().add(commissionAmount);
|
||||||
|
balance.setBalance(newBalance);
|
||||||
|
tenantBalanceMapper.updateById(balance);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3. 创建余额交易记录
|
||||||
|
String bizNo = BizNoGenerator.generate("COMM");
|
||||||
|
TenantBalanceTransactionDO transaction = TenantBalanceTransactionDO.builder()
|
||||||
|
.bizNo(bizNo)
|
||||||
|
.points(commissionAmount)
|
||||||
|
.balance(balance.getBalance())
|
||||||
|
.frozenAmt(balance.getFrozenAmt() != null ? balance.getFrozenAmt() : BigDecimal.ZERO)
|
||||||
|
.withdrawableBalance(balance.getWithdrawableBalance() != null ? balance.getWithdrawableBalance() : BigDecimal.ZERO)
|
||||||
|
.tenantId(tenantId)
|
||||||
|
.type(COMMISSION_TYPE)
|
||||||
|
.description("邀请用户内购分成")
|
||||||
|
.orderId(record.getTransactionId())
|
||||||
|
.createdAt(now)
|
||||||
|
.remark("内购记录ID: " + record.getId() + ", 被邀请用户: " + record.getUserId() + ", " + remark)
|
||||||
|
.build();
|
||||||
|
balanceTransactionMapper.insert(transaction);
|
||||||
|
|
||||||
|
// 4. 更新分成记录的关联交易ID并保存
|
||||||
|
commission.setBalanceTransactionId(transaction.getId());
|
||||||
|
commissionMapper.insert(commission);
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
package com.yolo.keyboard.service.tag;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import jakarta.validation.*;
|
||||||
|
import com.yolo.keyboard.controller.admin.tag.vo.*;
|
||||||
|
import com.yolo.keyboard.dal.dataobject.tag.KeyboardTagDO;
|
||||||
|
import com.yolo.keyboard.framework.common.pojo.PageResult;
|
||||||
|
import com.yolo.keyboard.framework.common.pojo.PageParam;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 人设标签 Service 接口
|
||||||
|
*
|
||||||
|
* @author ziin
|
||||||
|
*/
|
||||||
|
public interface KeyboardTagService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建人设标签
|
||||||
|
*
|
||||||
|
* @param createReqVO 创建信息
|
||||||
|
* @return 编号
|
||||||
|
*/
|
||||||
|
Integer createTag(@Valid KeyboardTagSaveReqVO createReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新人设标签
|
||||||
|
*
|
||||||
|
* @param updateReqVO 更新信息
|
||||||
|
*/
|
||||||
|
void updateTag(@Valid KeyboardTagSaveReqVO updateReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除人设标签
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
*/
|
||||||
|
void deleteTag(Integer id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除人设标签
|
||||||
|
*
|
||||||
|
* @param ids 编号
|
||||||
|
*/
|
||||||
|
void deleteTagListByIds(List<Integer> ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得人设标签
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
* @return 人设标签
|
||||||
|
*/
|
||||||
|
KeyboardTagDO getTag(Integer id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得人设标签分页
|
||||||
|
*
|
||||||
|
* @param pageReqVO 分页查询
|
||||||
|
* @return 人设标签分页
|
||||||
|
*/
|
||||||
|
PageResult<KeyboardTagDO> getTagPage(KeyboardTagPageReqVO pageReqVO);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,85 @@
|
|||||||
|
package com.yolo.keyboard.service.tag;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import com.yolo.keyboard.controller.admin.tag.vo.*;
|
||||||
|
import com.yolo.keyboard.dal.dataobject.tag.KeyboardTagDO;
|
||||||
|
import com.yolo.keyboard.framework.common.pojo.PageResult;
|
||||||
|
import com.yolo.keyboard.framework.common.pojo.PageParam;
|
||||||
|
import com.yolo.keyboard.framework.common.util.object.BeanUtils;
|
||||||
|
|
||||||
|
import com.yolo.keyboard.dal.mysql.tag.KeyboardTagMapper;
|
||||||
|
|
||||||
|
import static com.yolo.keyboard.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
|
import static com.yolo.keyboard.framework.common.util.collection.CollectionUtils.convertList;
|
||||||
|
import static com.yolo.keyboard.framework.common.util.collection.CollectionUtils.diffList;
|
||||||
|
import static com.yolo.keyboard.module.infra.enums.ErrorCodeConstants.TAG_NOT_EXISTS;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 人设标签 Service 实现类
|
||||||
|
*
|
||||||
|
* @author ziin
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Validated
|
||||||
|
public class KeyboardTagServiceImpl implements KeyboardTagService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private KeyboardTagMapper tagMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Integer createTag(KeyboardTagSaveReqVO createReqVO) {
|
||||||
|
// 插入
|
||||||
|
KeyboardTagDO tag = BeanUtils.toBean(createReqVO, KeyboardTagDO.class);
|
||||||
|
tagMapper.insert(tag);
|
||||||
|
|
||||||
|
// 返回
|
||||||
|
return tag.getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateTag(KeyboardTagSaveReqVO updateReqVO) {
|
||||||
|
// 校验存在
|
||||||
|
validateTagExists(updateReqVO.getId());
|
||||||
|
// 更新
|
||||||
|
KeyboardTagDO updateObj = BeanUtils.toBean(updateReqVO, KeyboardTagDO.class);
|
||||||
|
tagMapper.updateById(updateObj);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteTag(Integer id) {
|
||||||
|
// 校验存在
|
||||||
|
validateTagExists(id);
|
||||||
|
// 删除
|
||||||
|
tagMapper.deleteById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteTagListByIds(List<Integer> ids) {
|
||||||
|
// 删除
|
||||||
|
tagMapper.deleteByIds(ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void validateTagExists(Integer id) {
|
||||||
|
if (tagMapper.selectById(id) == null) {
|
||||||
|
throw exception(TAG_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public KeyboardTagDO getTag(Integer id) {
|
||||||
|
return tagMapper.selectById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult<KeyboardTagDO> getTagPage(KeyboardTagPageReqVO pageReqVO) {
|
||||||
|
return tagMapper.selectPage(pageReqVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,139 @@
|
|||||||
|
package com.yolo.keyboard.service.tenantbalance;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
import com.yolo.keyboard.dal.dataobject.tenantbalancetransaction.TenantBalanceTransactionDO;
|
||||||
|
import jakarta.validation.*;
|
||||||
|
import com.yolo.keyboard.controller.admin.tenantbalance.vo.*;
|
||||||
|
import com.yolo.keyboard.dal.dataobject.tenantbalance.TenantBalanceDO;
|
||||||
|
import com.yolo.keyboard.framework.common.pojo.PageResult;
|
||||||
|
import com.yolo.keyboard.framework.common.pojo.PageParam;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 租户余额 Service 接口
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
public interface TenantBalanceService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建租户余额
|
||||||
|
*
|
||||||
|
* @param createReqVO 创建信息
|
||||||
|
* @return 编号
|
||||||
|
*/
|
||||||
|
Long createTenantBalance(@Valid TenantBalanceSaveReqVO createReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新租户余额
|
||||||
|
*
|
||||||
|
* @param updateReqVO 更新信息
|
||||||
|
*/
|
||||||
|
void updateTenantBalance(@Valid TenantBalanceSaveReqVO updateReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除租户余额
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
*/
|
||||||
|
void deleteTenantBalance(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除租户余额
|
||||||
|
*
|
||||||
|
* @param ids 编号
|
||||||
|
*/
|
||||||
|
void deleteTenantBalanceListByIds(List<Long> ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得租户余额
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
* @return 租户余额
|
||||||
|
*/
|
||||||
|
TenantBalanceDO getTenantBalance(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得租户余额分页
|
||||||
|
*
|
||||||
|
* @param pageReqVO 分页查询
|
||||||
|
* @return 租户余额分页
|
||||||
|
*/
|
||||||
|
PageResult<TenantBalanceDO> getTenantBalancePage(TenantBalancePageReqVO pageReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 添加租户余额
|
||||||
|
*
|
||||||
|
* @param addReqVO 添加信息
|
||||||
|
*/
|
||||||
|
void addTenantBalance(@Valid TenantBalanceAddReqVO addReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得自己的余额
|
||||||
|
*
|
||||||
|
* @return 租户余额
|
||||||
|
*/
|
||||||
|
TenantBalanceDO getSelfBalance();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得自己下级余额的分页
|
||||||
|
*
|
||||||
|
* @param pageReqVO 分页查询
|
||||||
|
* @return 租户余额分页
|
||||||
|
*/
|
||||||
|
PageResult<TenantBalanceRespVO> getSelfSubordinateTenantBalancePage(TenantBalancePageReqVO pageReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得租户积分记录分页
|
||||||
|
*
|
||||||
|
* @param pageReqVO 分页查询
|
||||||
|
* @param tenantId 租户 Id
|
||||||
|
* @return 租户积分记录分页
|
||||||
|
*/
|
||||||
|
PageResult<TenantBalanceTransactionDO> getTenantBalanceTransactionPage(PageParam pageReqVO, Long tenantId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建租户积分记录
|
||||||
|
*
|
||||||
|
* @param tenantBalanceTransaction 创建信息
|
||||||
|
* @return 编号
|
||||||
|
*/
|
||||||
|
Long createTenantBalanceTransaction(@Valid TenantBalanceTransactionDO tenantBalanceTransaction);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新租户积分记录
|
||||||
|
*
|
||||||
|
* @param tenantBalanceTransaction 更新信息
|
||||||
|
*/
|
||||||
|
void updateTenantBalanceTransaction(@Valid TenantBalanceTransactionDO tenantBalanceTransaction);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除租户积分记录
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
*/
|
||||||
|
void deleteTenantBalanceTransaction(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除租户积分记录
|
||||||
|
*
|
||||||
|
* @param ids 编号
|
||||||
|
*/
|
||||||
|
void deleteTenantBalanceTransactionListByIds(List<Long> ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得租户积分记录
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
* @return 租户积分记录
|
||||||
|
*/
|
||||||
|
TenantBalanceTransactionDO getTenantBalanceTransaction(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 租户提现
|
||||||
|
*
|
||||||
|
* @param withdrawReqVO 提现信息
|
||||||
|
*/
|
||||||
|
void withdraw(@Valid TenantBalanceWithdrawReqVO withdrawReqVO);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,375 @@
|
|||||||
|
package com.yolo.keyboard.service.tenantbalance;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import cn.hutool.json.JSONUtil;
|
||||||
|
import com.yolo.keyboard.dal.dataobject.tenantbalancetransaction.TenantBalanceTransactionDO;
|
||||||
|
import com.yolo.keyboard.dal.dataobject.tenantwithdraworder.KeyboardTenantWithdrawOrderDO;
|
||||||
|
import com.yolo.keyboard.dal.mysql.tenantbalancetransaction.TenantBalanceTransactionMapper;
|
||||||
|
import com.yolo.keyboard.dal.mysql.tenantwithdraworder.KeyboardTenantWithdrawOrderMapper;
|
||||||
|
import com.yolo.keyboard.framework.common.util.collection.CollectionUtils;
|
||||||
|
import com.yolo.keyboard.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||||
|
import com.yolo.keyboard.framework.tenant.core.context.TenantContextHolder;
|
||||||
|
import com.yolo.keyboard.module.infra.api.config.ConfigApi;
|
||||||
|
import com.yolo.keyboard.module.system.api.notify.NotifyMessageSendApi;
|
||||||
|
import com.yolo.keyboard.module.system.api.notify.dto.NotifySendSingleToUserReqDTO;
|
||||||
|
import com.yolo.keyboard.utils.BizNoGenerator;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.*;
|
||||||
|
import com.yolo.keyboard.controller.admin.tenantbalance.vo.*;
|
||||||
|
import com.yolo.keyboard.dal.dataobject.tenantbalance.TenantBalanceDO;
|
||||||
|
import com.yolo.keyboard.framework.common.pojo.PageResult;
|
||||||
|
import com.yolo.keyboard.framework.common.pojo.PageParam;
|
||||||
|
import com.yolo.keyboard.framework.common.util.object.BeanUtils;
|
||||||
|
|
||||||
|
import com.yolo.keyboard.dal.mysql.tenantbalance.TenantBalanceMapper;
|
||||||
|
import com.yolo.keyboard.module.system.dal.dataobject.tenant.TenantDO;
|
||||||
|
import com.yolo.keyboard.module.system.dal.mysql.tenant.TenantMapper;
|
||||||
|
|
||||||
|
import static com.yolo.keyboard.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
|
import static com.yolo.keyboard.framework.common.util.collection.CollectionUtils.convertList;
|
||||||
|
import static com.yolo.keyboard.framework.common.util.collection.CollectionUtils.diffList;
|
||||||
|
import static com.yolo.keyboard.module.infra.enums.ErrorCodeConstants.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 租户余额 Service 实现类
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Validated
|
||||||
|
public class TenantBalanceServiceImpl implements TenantBalanceService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private TenantBalanceMapper tenantBalanceMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private TenantBalanceTransactionMapper tenantBalanceTransactionMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private TenantMapper tenantMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private ConfigApi configApi;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private KeyboardTenantWithdrawOrderMapper tenantWithdrawOrderMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private NotifyMessageSendApi notifyMessageSendApi;
|
||||||
|
|
||||||
|
private static final String WITHDRAW_DAYS_CONFIG_KEY = "WITHDRAW-DAYS";
|
||||||
|
private static final String WITHDRAW_NOTIFY_TEMPLATE_CODE = "tx-001";
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long createTenantBalance(TenantBalanceSaveReqVO createReqVO) {
|
||||||
|
// 插入
|
||||||
|
TenantBalanceDO tenantBalance = BeanUtils.toBean(createReqVO, TenantBalanceDO.class);
|
||||||
|
tenantBalanceMapper.insert(tenantBalance);
|
||||||
|
|
||||||
|
// 返回
|
||||||
|
return tenantBalance.getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateTenantBalance(TenantBalanceSaveReqVO updateReqVO) {
|
||||||
|
// 校验存在
|
||||||
|
validateTenantBalanceExists(updateReqVO.getId());
|
||||||
|
// 更新
|
||||||
|
TenantBalanceDO updateObj = BeanUtils.toBean(updateReqVO, TenantBalanceDO.class);
|
||||||
|
tenantBalanceMapper.updateById(updateObj);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteTenantBalance(Long id) {
|
||||||
|
// 校验存在
|
||||||
|
validateTenantBalanceExists(id);
|
||||||
|
// 删除
|
||||||
|
tenantBalanceMapper.deleteById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteTenantBalanceListByIds(List<Long> ids) {
|
||||||
|
// 删除
|
||||||
|
tenantBalanceMapper.deleteByIds(ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void validateTenantBalanceExists(Long id) {
|
||||||
|
if (tenantBalanceMapper.selectById(id) == null) {
|
||||||
|
throw exception(TENANT_BALANCE_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TenantBalanceDO getTenantBalance(Long id) {
|
||||||
|
return tenantBalanceMapper.selectById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult<TenantBalanceDO> getTenantBalancePage(TenantBalancePageReqVO pageReqVO) {
|
||||||
|
return tenantBalanceMapper.selectPage(pageReqVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public void addTenantBalance(TenantBalanceAddReqVO addReqVO) {
|
||||||
|
// 1. 根据ID查询租户余额记录,校验是否存在
|
||||||
|
TenantBalanceDO balance = tenantBalanceMapper.selectById(addReqVO.getId());
|
||||||
|
if (balance == null) {
|
||||||
|
throw exception(TENANT_BALANCE_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. 计算新的余额(当前余额 + 充值金额)
|
||||||
|
BigDecimal newBalance = balance.getBalance().add(new BigDecimal(String.valueOf(addReqVO.getAmount())));
|
||||||
|
// 3. 更新租户余额(使用乐观锁)
|
||||||
|
balance.setBalance(newBalance);
|
||||||
|
int updateCount = tenantBalanceMapper.updateById(balance);
|
||||||
|
if (updateCount == 0) {
|
||||||
|
throw exception(TENANT_BALANCE_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 4. 创建余额交易记录
|
||||||
|
TenantBalanceTransactionDO transaction = TenantBalanceTransactionDO.builder()
|
||||||
|
.bizNo(BizNoGenerator.generate("RECHARGE")) // 生成充值业务编号
|
||||||
|
.points(new BigDecimal(String.valueOf(addReqVO.getAmount()))) // 充值金额
|
||||||
|
.balance(newBalance) // 充值后余额
|
||||||
|
.frozenAmt(balance.getFrozenAmt() != null ? balance.getFrozenAmt() : BigDecimal.ZERO) // 当前冻结金额
|
||||||
|
.withdrawableBalance(balance.getWithdrawableBalance() != null ? balance.getWithdrawableBalance() : BigDecimal.ZERO) // 当前可提现金额
|
||||||
|
.tenantId(addReqVO.getId())
|
||||||
|
.type("RECHARGE") // 交易类型:充值
|
||||||
|
.description("余额充值") // 交易描述
|
||||||
|
.remark(addReqVO.getRemark()) // 备注信息
|
||||||
|
.operatorId(TenantContextHolder.getTenantId()) // 操作人ID(当前租户ID)
|
||||||
|
.build();
|
||||||
|
// 5. 插入交易记录到数据库
|
||||||
|
tenantBalanceTransactionMapper.insert(transaction);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TenantBalanceDO getSelfBalance() {
|
||||||
|
Long tenantId = TenantContextHolder.getRequiredTenantId();
|
||||||
|
return tenantBalanceMapper.selectById(tenantId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult<TenantBalanceRespVO> getSelfSubordinateTenantBalancePage(TenantBalancePageReqVO pageReqVO) {
|
||||||
|
// 1. 获取当前租户ID
|
||||||
|
Long currentTenantId = TenantContextHolder.getRequiredTenantId();
|
||||||
|
|
||||||
|
// 2. 查询当前租户的下级租户列表
|
||||||
|
List<TenantDO> subordinateTenants = tenantMapper.selectList(TenantDO::getParentId, currentTenantId);
|
||||||
|
|
||||||
|
// 3. 提取下级租户的ID列表
|
||||||
|
List<Long> tenantIds = CollectionUtils.convertList(subordinateTenants, TenantDO::getId);
|
||||||
|
|
||||||
|
// 4. 如果没有下级租户,则直接返回空的分页结果
|
||||||
|
if (CollUtil.isEmpty(tenantIds)) {
|
||||||
|
return PageResult.empty();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 5. 根据下级租户ID列表查询对应的余额信息,并进行分页
|
||||||
|
PageResult<TenantBalanceDO> pageResult = tenantBalanceMapper.selectPage(pageReqVO,
|
||||||
|
new LambdaQueryWrapperX<TenantBalanceDO>().in(TenantBalanceDO::getId, tenantIds));
|
||||||
|
|
||||||
|
// 6. 将查询结果转换为响应VO并返回
|
||||||
|
return BeanUtils.toBean(pageResult, TenantBalanceRespVO.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult<TenantBalanceTransactionDO> getTenantBalanceTransactionPage(PageParam pageReqVO, Long tenantId) {
|
||||||
|
return tenantBalanceTransactionMapper.selectPage(pageReqVO, tenantId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long createTenantBalanceTransaction(TenantBalanceTransactionDO tenantBalanceTransaction) {
|
||||||
|
tenantBalanceTransactionMapper.insert(tenantBalanceTransaction);
|
||||||
|
return tenantBalanceTransaction.getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateTenantBalanceTransaction(TenantBalanceTransactionDO tenantBalanceTransaction) {
|
||||||
|
// 校验存在
|
||||||
|
validateTenantBalanceTransactionExists(tenantBalanceTransaction.getId());
|
||||||
|
// 更新
|
||||||
|
tenantBalanceTransactionMapper.updateById(tenantBalanceTransaction);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteTenantBalanceTransaction(Long id) {
|
||||||
|
// 删除
|
||||||
|
tenantBalanceTransactionMapper.deleteById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteTenantBalanceTransactionListByIds(List<Long> ids) {
|
||||||
|
// 删除
|
||||||
|
tenantBalanceTransactionMapper.deleteByIds(ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TenantBalanceTransactionDO getTenantBalanceTransaction(Long id) {
|
||||||
|
return tenantBalanceTransactionMapper.selectById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void validateTenantBalanceTransactionExists(Long id) {
|
||||||
|
if (tenantBalanceTransactionMapper.selectById(id) == null) {
|
||||||
|
throw exception(TENANT_BALANCE_TRANSACTION_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void deleteTenantBalanceTransactionByTenantId(Long tenantId) {
|
||||||
|
tenantBalanceTransactionMapper.deleteByTenantId(tenantId);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void deleteTenantBalanceTransactionByTenantIds(List<Long> tenantIds) {
|
||||||
|
tenantBalanceTransactionMapper.deleteByTenantIds(tenantIds);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public void withdraw(TenantBalanceWithdrawReqVO withdrawReqVO) {
|
||||||
|
// 1. 校验是否在提现日期范围内
|
||||||
|
validateWithdrawDate();
|
||||||
|
|
||||||
|
// 2. 获取当前租户的余额记录
|
||||||
|
Long tenantId = TenantContextHolder.getRequiredTenantId();
|
||||||
|
TenantBalanceDO balance = tenantBalanceMapper.selectById(tenantId);
|
||||||
|
if (balance == null) {
|
||||||
|
throw exception(TENANT_BALANCE_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 3. 校验可提现金额是否充足
|
||||||
|
BigDecimal withdrawAmount = withdrawReqVO.getAmount();
|
||||||
|
BigDecimal withdrawableBalance = balance.getWithdrawableBalance() != null ? balance.getWithdrawableBalance() : BigDecimal.ZERO;
|
||||||
|
if (withdrawableBalance.compareTo(withdrawAmount) < 0) {
|
||||||
|
throw exception(TENANT_BALANCE_WITHDRAW_INSUFFICIENT);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 4. 从可提现金额中扣减并增加冻结金额
|
||||||
|
BigDecimal frozenAmt = balance.getFrozenAmt() != null ? balance.getFrozenAmt() : BigDecimal.ZERO;
|
||||||
|
BigDecimal newWithdrawableBalance = withdrawableBalance.subtract(withdrawAmount);
|
||||||
|
BigDecimal newFrozenAmt = frozenAmt.add(withdrawAmount);
|
||||||
|
balance.setWithdrawableBalance(newWithdrawableBalance);
|
||||||
|
balance.setFrozenAmt(newFrozenAmt);
|
||||||
|
int updateCount = tenantBalanceMapper.updateById(balance);
|
||||||
|
if (updateCount == 0) {
|
||||||
|
throw exception(TENANT_BALANCE_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 5. 生成提现单号
|
||||||
|
String withdrawNo = BizNoGenerator.generate("WD");
|
||||||
|
String bizNo = BizNoGenerator.generate("BIZ");
|
||||||
|
|
||||||
|
// 6. 创建冻结交易记录
|
||||||
|
TenantBalanceTransactionDO transaction = TenantBalanceTransactionDO.builder()
|
||||||
|
.bizNo(bizNo)
|
||||||
|
.points(withdrawAmount.negate()) // 冻结金额(负数表示冻结扣减)
|
||||||
|
.balance(balance.getBalance()) // 当前总余额
|
||||||
|
.frozenAmt(newFrozenAmt) // 冻结后的冻结金额
|
||||||
|
.withdrawableBalance(newWithdrawableBalance) // 扣减后的可提现余额
|
||||||
|
.tenantId(tenantId)
|
||||||
|
.type("FREEZE")
|
||||||
|
.description("提现冻结")
|
||||||
|
.remark(withdrawReqVO.getRemark())
|
||||||
|
.operatorId(tenantId)
|
||||||
|
.build();
|
||||||
|
tenantBalanceTransactionMapper.insert(transaction);
|
||||||
|
|
||||||
|
// 7. 创建提现申请订单
|
||||||
|
LocalDateTime now = LocalDateTime.now();
|
||||||
|
KeyboardTenantWithdrawOrderDO withdrawOrder = KeyboardTenantWithdrawOrderDO.builder()
|
||||||
|
.withdrawNo(withdrawNo)
|
||||||
|
.bizNo(bizNo)
|
||||||
|
.tenantId(tenantId)
|
||||||
|
.currency("CNY")
|
||||||
|
.amount(withdrawAmount) // 直接存储 BigDecimal
|
||||||
|
.feeAmount(BigDecimal.ZERO) // 手续费暂时为0
|
||||||
|
.actualAmount(withdrawAmount) // 实际到账金额
|
||||||
|
// 收款信息
|
||||||
|
.payChannel(withdrawReqVO.getPayChannel())
|
||||||
|
.payeeType(withdrawReqVO.getPayeeType())
|
||||||
|
.payeeName(withdrawReqVO.getPayeeName())
|
||||||
|
.payeeAccount(withdrawReqVO.getPayeeAccount())
|
||||||
|
.payeeBankName(withdrawReqVO.getPayeeBankName())
|
||||||
|
.payeeBankCode(withdrawReqVO.getPayeeBankCode())
|
||||||
|
.payeeBankBranch(withdrawReqVO.getPayeeBankBranch())
|
||||||
|
// 状态
|
||||||
|
.status("APPLIED") // 申请中
|
||||||
|
.auditStatus("PENDING") // 待审核
|
||||||
|
.applyTime(now)
|
||||||
|
.balanceTxnId(transaction.getId()) // 关联冻结交易记录
|
||||||
|
.creatorId(tenantId)
|
||||||
|
.createdAt(now)
|
||||||
|
.updatedAt(now)
|
||||||
|
.build();
|
||||||
|
tenantWithdrawOrderMapper.insert(withdrawOrder);
|
||||||
|
|
||||||
|
// 8. 发送站内信通知
|
||||||
|
sendWithdrawNotify(tenantId, withdrawAmount);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 发送提现站内信通知
|
||||||
|
*
|
||||||
|
* @param tenantId 租户ID
|
||||||
|
* @param withdrawAmount 提现金额
|
||||||
|
*/
|
||||||
|
private void sendWithdrawNotify(Long tenantId, BigDecimal withdrawAmount) {
|
||||||
|
// 获取租户信息,找到联系人用户ID
|
||||||
|
TenantDO tenant = tenantMapper.selectById(tenantId);
|
||||||
|
if (tenant == null || tenant.getContactUserId() == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 构建站内信请求
|
||||||
|
NotifySendSingleToUserReqDTO reqDTO = new NotifySendSingleToUserReqDTO();
|
||||||
|
reqDTO.setUserId(tenant.getContactUserId());
|
||||||
|
reqDTO.setTemplateCode(WITHDRAW_NOTIFY_TEMPLATE_CODE);
|
||||||
|
reqDTO.setTemplateParams(Map.of("amount", withdrawAmount.toPlainString()));
|
||||||
|
|
||||||
|
// 发送站内信
|
||||||
|
notifyMessageSendApi.sendSingleMessageToAdmin(reqDTO);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验是否在提现日期范围内
|
||||||
|
* 配置格式:{"start": 25, "days": 6}
|
||||||
|
* 表示每月从第 start 天开始,连续 days 天可以提现(不允许跨月)
|
||||||
|
*/
|
||||||
|
private void validateWithdrawDate() {
|
||||||
|
// 获取提现日期配置
|
||||||
|
String configValue = configApi.getConfigValueByKey(WITHDRAW_DAYS_CONFIG_KEY);
|
||||||
|
if (configValue == null || configValue.isEmpty()) {
|
||||||
|
throw exception(TENANT_BALANCE_WITHDRAW_CONFIG_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 解析配置
|
||||||
|
cn.hutool.json.JSONObject config = JSONUtil.parseObj(configValue);
|
||||||
|
int startDay = config.getInt("start");
|
||||||
|
int days = config.getInt("days");
|
||||||
|
|
||||||
|
// 获取当前日期
|
||||||
|
LocalDate today = LocalDate.now();
|
||||||
|
int currentDay = today.getDayOfMonth();
|
||||||
|
int lastDayOfMonth = today.lengthOfMonth();
|
||||||
|
|
||||||
|
// 计算提现日期范围(不允许跨月,endDay 最大为当月最后一天)
|
||||||
|
int endDay = Math.min(startDay + days - 1, lastDayOfMonth);
|
||||||
|
|
||||||
|
// 判断当前日期是否在 [startDay, endDay] 范围内
|
||||||
|
boolean isInRange = currentDay >= startDay && currentDay <= endDay;
|
||||||
|
|
||||||
|
if (!isInRange) {
|
||||||
|
throw exception(TENANT_BALANCE_WITHDRAW_NOT_IN_DATE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,69 @@
|
|||||||
|
package com.yolo.keyboard.service.tenantcommission;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import jakarta.validation.*;
|
||||||
|
import com.yolo.keyboard.controller.admin.tenantcommission.vo.*;
|
||||||
|
import com.yolo.keyboard.dal.dataobject.tenantcommission.KeyboardTenantCommissionDO;
|
||||||
|
import com.yolo.keyboard.framework.common.pojo.PageResult;
|
||||||
|
import com.yolo.keyboard.framework.common.pojo.PageParam;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 租户内购分成记录 Service 接口
|
||||||
|
*
|
||||||
|
* @author ziin
|
||||||
|
*/
|
||||||
|
public interface KeyboardTenantCommissionService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建租户内购分成记录
|
||||||
|
*
|
||||||
|
* @param createReqVO 创建信息
|
||||||
|
* @return 编号
|
||||||
|
*/
|
||||||
|
Long createTenantCommission(@Valid KeyboardTenantCommissionSaveReqVO createReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新租户内购分成记录
|
||||||
|
*
|
||||||
|
* @param updateReqVO 更新信息
|
||||||
|
*/
|
||||||
|
void updateTenantCommission(@Valid KeyboardTenantCommissionSaveReqVO updateReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除租户内购分成记录
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
*/
|
||||||
|
void deleteTenantCommission(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除租户内购分成记录
|
||||||
|
*
|
||||||
|
* @param ids 编号
|
||||||
|
*/
|
||||||
|
void deleteTenantCommissionListByIds(List<Long> ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得租户内购分成记录
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
* @return 租户内购分成记录
|
||||||
|
*/
|
||||||
|
KeyboardTenantCommissionDO getTenantCommission(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得租户内购分成记录分页
|
||||||
|
*
|
||||||
|
* @param pageReqVO 分页查询
|
||||||
|
* @return 租户内购分成记录分页
|
||||||
|
*/
|
||||||
|
PageResult<KeyboardTenantCommissionDO> getTenantCommissionPage(KeyboardTenantCommissionPageReqVO pageReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得当前登录租户的分成记录分页
|
||||||
|
*
|
||||||
|
* @param pageReqVO 分页查询
|
||||||
|
* @return 租户内购分成记录分页
|
||||||
|
*/
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,99 @@
|
|||||||
|
package com.yolo.keyboard.service.tenantcommission;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import com.yolo.keyboard.controller.admin.tenantcommission.vo.*;
|
||||||
|
import com.yolo.keyboard.dal.dataobject.tenantcommission.KeyboardTenantCommissionDO;
|
||||||
|
import com.yolo.keyboard.framework.common.pojo.PageResult;
|
||||||
|
import com.yolo.keyboard.framework.common.pojo.PageParam;
|
||||||
|
import com.yolo.keyboard.framework.common.util.object.BeanUtils;
|
||||||
|
|
||||||
|
import com.yolo.keyboard.dal.mysql.tenantcommission.KeyboardTenantCommissionMapper;
|
||||||
|
import com.yolo.keyboard.framework.tenant.core.context.TenantContextHolder;
|
||||||
|
import com.yolo.keyboard.module.system.dal.dataobject.tenant.TenantDO;
|
||||||
|
import com.yolo.keyboard.module.system.dal.mysql.tenant.TenantMapper;
|
||||||
|
|
||||||
|
import static com.yolo.keyboard.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
|
import static com.yolo.keyboard.framework.common.util.collection.CollectionUtils.convertList;
|
||||||
|
import static com.yolo.keyboard.framework.common.util.collection.CollectionUtils.diffList;import static com.yolo.keyboard.module.infra.enums.ErrorCodeConstants.TENANT_COMMISSION_NOT_EXISTS;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 租户内购分成记录 Service 实现类
|
||||||
|
*
|
||||||
|
* @author ziin
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Validated
|
||||||
|
public class KeyboardTenantCommissionServiceImpl implements KeyboardTenantCommissionService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private KeyboardTenantCommissionMapper tenantCommissionMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private TenantMapper tenantMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long createTenantCommission(KeyboardTenantCommissionSaveReqVO createReqVO) {
|
||||||
|
// 插入
|
||||||
|
KeyboardTenantCommissionDO tenantCommission = BeanUtils.toBean(createReqVO, KeyboardTenantCommissionDO.class);
|
||||||
|
tenantCommissionMapper.insert(tenantCommission);
|
||||||
|
|
||||||
|
// 返回
|
||||||
|
return tenantCommission.getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateTenantCommission(KeyboardTenantCommissionSaveReqVO updateReqVO) {
|
||||||
|
// 校验存在
|
||||||
|
validateTenantCommissionExists(updateReqVO.getId());
|
||||||
|
// 更新
|
||||||
|
KeyboardTenantCommissionDO updateObj = BeanUtils.toBean(updateReqVO, KeyboardTenantCommissionDO.class);
|
||||||
|
tenantCommissionMapper.updateById(updateObj);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteTenantCommission(Long id) {
|
||||||
|
// 校验存在
|
||||||
|
validateTenantCommissionExists(id);
|
||||||
|
// 删除
|
||||||
|
tenantCommissionMapper.deleteById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteTenantCommissionListByIds(List<Long> ids) {
|
||||||
|
// 删除
|
||||||
|
tenantCommissionMapper.deleteByIds(ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void validateTenantCommissionExists(Long id) {
|
||||||
|
if (tenantCommissionMapper.selectById(id) == null) {
|
||||||
|
throw exception(TENANT_COMMISSION_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public KeyboardTenantCommissionDO getTenantCommission(Long id) {
|
||||||
|
return tenantCommissionMapper.selectById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult<KeyboardTenantCommissionDO> getTenantCommissionPage(KeyboardTenantCommissionPageReqVO pageReqVO) {
|
||||||
|
// 如果当前租户的 tenantLevel 不等于 0,只能查询属于自己的数据
|
||||||
|
Long currentTenantId = TenantContextHolder.getTenantId();
|
||||||
|
if (currentTenantId != null) {
|
||||||
|
TenantDO currentTenant = tenantMapper.selectById(currentTenantId);
|
||||||
|
if (currentTenant != null && currentTenant.getTenantLevel() != null
|
||||||
|
&& currentTenant.getTenantLevel() != 0) {
|
||||||
|
pageReqVO.setTenantId(currentTenantId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return tenantCommissionMapper.selectPage(pageReqVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
package com.yolo.keyboard.service.tenantwithdraworder;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import jakarta.validation.*;
|
||||||
|
import com.yolo.keyboard.controller.admin.tenantwithdraworder.vo.*;
|
||||||
|
import com.yolo.keyboard.dal.dataobject.tenantwithdraworder.KeyboardTenantWithdrawOrderDO;
|
||||||
|
import com.yolo.keyboard.framework.common.pojo.PageResult;
|
||||||
|
import com.yolo.keyboard.framework.common.pojo.PageParam;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 租户提现订单表(申请-审核-打款-完成/失败) Service 接口
|
||||||
|
*
|
||||||
|
* @author ziin
|
||||||
|
*/
|
||||||
|
public interface KeyboardTenantWithdrawOrderService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建租户提现订单表(申请-审核-打款-完成/失败)
|
||||||
|
*
|
||||||
|
* @param createReqVO 创建信息
|
||||||
|
* @return 编号
|
||||||
|
*/
|
||||||
|
Long createTenantWithdrawOrder(@Valid KeyboardTenantWithdrawOrderSaveReqVO createReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新租户提现订单表(申请-审核-打款-完成/失败)
|
||||||
|
*
|
||||||
|
* @param updateReqVO 更新信息
|
||||||
|
*/
|
||||||
|
void updateTenantWithdrawOrder(@Valid KeyboardTenantWithdrawOrderSaveReqVO updateReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除租户提现订单表(申请-审核-打款-完成/失败)
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
*/
|
||||||
|
void deleteTenantWithdrawOrder(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除租户提现订单表(申请-审核-打款-完成/失败)
|
||||||
|
*
|
||||||
|
* @param ids 编号
|
||||||
|
*/
|
||||||
|
void deleteTenantWithdrawOrderListByIds(List<Long> ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得租户提现订单表(申请-审核-打款-完成/失败)
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
* @return 租户提现订单表(申请-审核-打款-完成/失败)
|
||||||
|
*/
|
||||||
|
KeyboardTenantWithdrawOrderDO getTenantWithdrawOrder(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得租户提现订单表(申请-审核-打款-完成/失败)分页
|
||||||
|
*
|
||||||
|
* @param pageReqVO 分页查询
|
||||||
|
* @return 租户提现订单表(申请-审核-打款-完成/失败)分页
|
||||||
|
*/
|
||||||
|
PageResult<KeyboardTenantWithdrawOrderRespVO> getTenantWithdrawOrderPage(KeyboardTenantWithdrawOrderPageReqVO pageReqVO);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,297 @@
|
|||||||
|
package com.yolo.keyboard.service.tenantwithdraworder;
|
||||||
|
|
||||||
|
import com.yolo.keyboard.controller.admin.tenantwithdraworder.vo.KeyboardTenantWithdrawOrderPageReqVO;
|
||||||
|
import com.yolo.keyboard.controller.admin.tenantwithdraworder.vo.KeyboardTenantWithdrawOrderRespVO;
|
||||||
|
import com.yolo.keyboard.controller.admin.tenantwithdraworder.vo.KeyboardTenantWithdrawOrderSaveReqVO;
|
||||||
|
import com.yolo.keyboard.dal.dataobject.tenantbalance.TenantBalanceDO;
|
||||||
|
import com.yolo.keyboard.dal.dataobject.tenantbalancetransaction.TenantBalanceTransactionDO;
|
||||||
|
import com.yolo.keyboard.dal.dataobject.tenantwithdraworder.KeyboardTenantWithdrawOrderDO;
|
||||||
|
import com.yolo.keyboard.dal.mysql.tenantbalance.TenantBalanceMapper;
|
||||||
|
import com.yolo.keyboard.dal.mysql.tenantbalancetransaction.TenantBalanceTransactionMapper;
|
||||||
|
import com.yolo.keyboard.dal.mysql.tenantwithdraworder.KeyboardTenantWithdrawOrderMapper;
|
||||||
|
import com.yolo.keyboard.framework.common.pojo.PageResult;
|
||||||
|
import com.yolo.keyboard.framework.common.util.object.BeanUtils;
|
||||||
|
import com.yolo.keyboard.framework.tenant.core.context.TenantContextHolder;
|
||||||
|
import com.yolo.keyboard.module.system.dal.dataobject.tenant.TenantDO;
|
||||||
|
import com.yolo.keyboard.module.system.dal.mysql.tenant.TenantMapper;
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import static com.yolo.keyboard.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
|
import static com.yolo.keyboard.module.infra.enums.ErrorCodeConstants.TENANT_WITHDRAW_ORDER_NOT_EXISTS;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 租户提现订单表(申请-审核-打款-完成/失败) Service 实现类
|
||||||
|
*
|
||||||
|
* @author ziin
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Validated
|
||||||
|
public class KeyboardTenantWithdrawOrderServiceImpl implements KeyboardTenantWithdrawOrderService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private KeyboardTenantWithdrawOrderMapper tenantWithdrawOrderMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private TenantMapper tenantMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private TenantBalanceMapper tenantBalanceMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private TenantBalanceTransactionMapper tenantBalanceTransactionMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long createTenantWithdrawOrder(KeyboardTenantWithdrawOrderSaveReqVO createReqVO) {
|
||||||
|
// 插入
|
||||||
|
KeyboardTenantWithdrawOrderDO tenantWithdrawOrder = BeanUtils.toBean(createReqVO, KeyboardTenantWithdrawOrderDO.class);
|
||||||
|
tenantWithdrawOrderMapper.insert(tenantWithdrawOrder);
|
||||||
|
|
||||||
|
// 返回
|
||||||
|
return tenantWithdrawOrder.getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public void updateTenantWithdrawOrder(KeyboardTenantWithdrawOrderSaveReqVO updateReqVO) {
|
||||||
|
// 校验存在
|
||||||
|
KeyboardTenantWithdrawOrderDO existingOrder = tenantWithdrawOrderMapper.selectById(updateReqVO.getId());
|
||||||
|
if (existingOrder == null) {
|
||||||
|
throw exception(TENANT_WITHDRAW_ORDER_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 更新订单
|
||||||
|
KeyboardTenantWithdrawOrderDO updateObj = BeanUtils.toBean(updateReqVO, KeyboardTenantWithdrawOrderDO.class);
|
||||||
|
tenantWithdrawOrderMapper.updateById(updateObj);
|
||||||
|
|
||||||
|
String newStatus = updateReqVO.getStatus();
|
||||||
|
String oldStatus = existingOrder.getStatus();
|
||||||
|
|
||||||
|
// 如果提现状态更新为成功(PAID),则扣除提现用户的冻结金额并创建流水记录
|
||||||
|
if ("PAID".equals(newStatus) && !"PAID".equals(oldStatus)) {
|
||||||
|
handleWithdrawSuccess(existingOrder);
|
||||||
|
}
|
||||||
|
// 如果提现状态更新为已拒绝、已取消、打款失败,则返还冻结金额到可提现余额并创建流水记录
|
||||||
|
else if (isRefundStatus(newStatus) && !isRefundStatus(oldStatus)) {
|
||||||
|
handleWithdrawRefund(existingOrder, newStatus, updateReqVO.getReason());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 判断是否为需要退还冻结金额的状态
|
||||||
|
*/
|
||||||
|
private boolean isRefundStatus(String status) {
|
||||||
|
return "REJECTED".equals(status) || "CANCELED".equals(status) || "FAILED".equals(status);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理提现成功:扣除冻结金额并记录流水
|
||||||
|
*/
|
||||||
|
private void handleWithdrawSuccess(KeyboardTenantWithdrawOrderDO order) {
|
||||||
|
TenantBalanceDO balance = tenantBalanceMapper.selectById(order.getTenantId());
|
||||||
|
if (balance == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 扣除冻结金额
|
||||||
|
BigDecimal frozenAmt = balance.getFrozenAmt() != null ? balance.getFrozenAmt() : BigDecimal.ZERO;
|
||||||
|
BigDecimal withdrawAmount = order.getAmount();
|
||||||
|
BigDecimal newFrozenAmt = frozenAmt.subtract(withdrawAmount);
|
||||||
|
if (newFrozenAmt.compareTo(BigDecimal.ZERO) < 0) {
|
||||||
|
newFrozenAmt = BigDecimal.ZERO;
|
||||||
|
}
|
||||||
|
balance.setFrozenAmt(newFrozenAmt);
|
||||||
|
tenantBalanceMapper.updateById(balance);
|
||||||
|
|
||||||
|
// 创建提现成功的流水记录
|
||||||
|
BigDecimal currentWithdrawableBalance = balance.getWithdrawableBalance() != null ? balance.getWithdrawableBalance() : BigDecimal.ZERO;
|
||||||
|
TenantBalanceTransactionDO transaction = TenantBalanceTransactionDO.builder()
|
||||||
|
.bizNo(order.getBizNo())
|
||||||
|
.points(withdrawAmount.negate()) // 提现金额(负数表示支出)
|
||||||
|
.balance(balance.getBalance()) // 当前总余额
|
||||||
|
.frozenAmt(newFrozenAmt) // 扣除后的冻结金额
|
||||||
|
.withdrawableBalance(currentWithdrawableBalance) // 当前可提现余额
|
||||||
|
.tenantId(order.getTenantId())
|
||||||
|
.type("WITHDRAW_SUCCESS")
|
||||||
|
.description("提现成功")
|
||||||
|
.orderId(order.getWithdrawNo())
|
||||||
|
.operatorId(TenantContextHolder.getTenantId())
|
||||||
|
.createdAt(LocalDateTime.now())
|
||||||
|
.build();
|
||||||
|
tenantBalanceTransactionMapper.insert(transaction);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理提现退还:返还冻结金额到可提现余额并记录流水
|
||||||
|
*
|
||||||
|
* @param order 提现订单
|
||||||
|
* @param newStatus 新状态
|
||||||
|
* @param reason 拒绝/失败/取消原因
|
||||||
|
*/
|
||||||
|
private void handleWithdrawRefund(KeyboardTenantWithdrawOrderDO order, String newStatus, String reason) {
|
||||||
|
TenantBalanceDO balance = tenantBalanceMapper.selectById(order.getTenantId());
|
||||||
|
if (balance == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
BigDecimal withdrawAmount = order.getAmount();
|
||||||
|
|
||||||
|
// 扣除冻结金额
|
||||||
|
BigDecimal frozenAmt = balance.getFrozenAmt() != null ? balance.getFrozenAmt() : BigDecimal.ZERO;
|
||||||
|
BigDecimal newFrozenAmt = frozenAmt.subtract(withdrawAmount);
|
||||||
|
if (newFrozenAmt.compareTo(BigDecimal.ZERO) < 0) {
|
||||||
|
newFrozenAmt = BigDecimal.ZERO;
|
||||||
|
}
|
||||||
|
balance.setFrozenAmt(newFrozenAmt);
|
||||||
|
|
||||||
|
// 返还到可提现余额
|
||||||
|
BigDecimal withdrawableBalance = balance.getWithdrawableBalance() != null ? balance.getWithdrawableBalance() : BigDecimal.ZERO;
|
||||||
|
BigDecimal newWithdrawableBalance = withdrawableBalance.add(withdrawAmount);
|
||||||
|
balance.setWithdrawableBalance(newWithdrawableBalance);
|
||||||
|
|
||||||
|
tenantBalanceMapper.updateById(balance);
|
||||||
|
|
||||||
|
// 根据状态确定流水类型和描述
|
||||||
|
String type;
|
||||||
|
String description;
|
||||||
|
switch (newStatus) {
|
||||||
|
case "REJECTED":
|
||||||
|
type = "WITHDRAW_REJECTED";
|
||||||
|
description = "提现被拒绝,金额已退还";
|
||||||
|
break;
|
||||||
|
case "CANCELED":
|
||||||
|
type = "WITHDRAW_CANCELED";
|
||||||
|
description = "提现已取消,金额已退还";
|
||||||
|
break;
|
||||||
|
case "FAILED":
|
||||||
|
type = "WITHDRAW_FAILED";
|
||||||
|
description = "提现打款失败,金额已退还";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
type = "WITHDRAW_REFUND";
|
||||||
|
description = "提现退还";
|
||||||
|
}
|
||||||
|
|
||||||
|
// 备注:优先使用传入的原因,如果没有则使用默认描述
|
||||||
|
String remark = (reason != null && !reason.trim().isEmpty()) ? reason : description;
|
||||||
|
|
||||||
|
// 创建退还流水记录
|
||||||
|
TenantBalanceTransactionDO transaction = TenantBalanceTransactionDO.builder()
|
||||||
|
.bizNo(order.getBizNo())
|
||||||
|
.points(withdrawAmount) // 退还金额(正数表示收入)
|
||||||
|
.balance(balance.getBalance()) // 当前总余额
|
||||||
|
.frozenAmt(newFrozenAmt) // 扣除后的冻结金额
|
||||||
|
.withdrawableBalance(newWithdrawableBalance) // 退还后的可提现余额
|
||||||
|
.tenantId(order.getTenantId())
|
||||||
|
.type(type)
|
||||||
|
.description(description)
|
||||||
|
.remark(remark)
|
||||||
|
.orderId(order.getWithdrawNo())
|
||||||
|
.operatorId(TenantContextHolder.getTenantId())
|
||||||
|
.createdAt(LocalDateTime.now())
|
||||||
|
.build();
|
||||||
|
tenantBalanceTransactionMapper.insert(transaction);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteTenantWithdrawOrder(Long id) {
|
||||||
|
// 校验存在
|
||||||
|
validateTenantWithdrawOrderExists(id);
|
||||||
|
// 删除
|
||||||
|
tenantWithdrawOrderMapper.deleteById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteTenantWithdrawOrderListByIds(List<Long> ids) {
|
||||||
|
// 删除
|
||||||
|
tenantWithdrawOrderMapper.deleteByIds(ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void validateTenantWithdrawOrderExists(Long id) {
|
||||||
|
if (tenantWithdrawOrderMapper.selectById(id) == null) {
|
||||||
|
throw exception(TENANT_WITHDRAW_ORDER_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public KeyboardTenantWithdrawOrderDO getTenantWithdrawOrder(Long id) {
|
||||||
|
return tenantWithdrawOrderMapper.selectById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult<KeyboardTenantWithdrawOrderRespVO> getTenantWithdrawOrderPage(KeyboardTenantWithdrawOrderPageReqVO pageReqVO) {
|
||||||
|
// 根据当前租户级别过滤下级租户的提现申请
|
||||||
|
Long currentTenantId = TenantContextHolder.getTenantId();
|
||||||
|
if (currentTenantId != null) {
|
||||||
|
TenantDO currentTenant = tenantMapper.selectById(currentTenantId);
|
||||||
|
if (currentTenant != null && currentTenant.getTenantLevel() != null) {
|
||||||
|
if (currentTenant.getTenantLevel() == 0) {
|
||||||
|
// 系统管理员:只能查看1级代理的提现申请
|
||||||
|
List<TenantDO> firstLevelAgents = tenantMapper.selectList(
|
||||||
|
new LambdaQueryWrapper<TenantDO>().eq(TenantDO::getTenantLevel, 1));
|
||||||
|
List<Long> firstLevelAgentIds = firstLevelAgents.stream()
|
||||||
|
.map(TenantDO::getId)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
if (CollUtil.isEmpty(firstLevelAgentIds)) {
|
||||||
|
// 没有1级代理,返回空结果
|
||||||
|
return PageResult.empty(0L);
|
||||||
|
}
|
||||||
|
pageReqVO.setTenantIds(firstLevelAgentIds);
|
||||||
|
} else {
|
||||||
|
// 非系统管理员:只能查看直属下级租户的提现申请
|
||||||
|
List<TenantDO> subordinateTenants = tenantMapper.selectList(
|
||||||
|
new LambdaQueryWrapper<TenantDO>().eq(TenantDO::getParentId, currentTenantId));
|
||||||
|
List<Long> subordinateTenantIds = subordinateTenants.stream()
|
||||||
|
.map(TenantDO::getId)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
if (CollUtil.isEmpty(subordinateTenantIds)) {
|
||||||
|
// 没有下级租户,返回空结果
|
||||||
|
return PageResult.empty(0L);
|
||||||
|
}
|
||||||
|
pageReqVO.setTenantIds(subordinateTenantIds);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 分页查询租户提现订单数据
|
||||||
|
PageResult<KeyboardTenantWithdrawOrderDO> pageResult = tenantWithdrawOrderMapper.selectPage(pageReqVO);
|
||||||
|
if (CollUtil.isEmpty(pageResult.getList())) {
|
||||||
|
return PageResult.empty(pageResult.getTotal());
|
||||||
|
}
|
||||||
|
|
||||||
|
// 批量获取租户名称 - 提升性能,避免N+1查询
|
||||||
|
List<Long> tenantIds = pageResult.getList().stream()
|
||||||
|
.map(KeyboardTenantWithdrawOrderDO::getTenantId)
|
||||||
|
.distinct()
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
List<TenantDO> tenants = tenantMapper.selectBatchIds(tenantIds);
|
||||||
|
Map<Long, String> tenantNameMap = CollUtil.isEmpty(tenants)
|
||||||
|
? new HashMap<>() // 如果没有查询到租户数据,返回空map
|
||||||
|
: tenants.stream().collect(Collectors.toMap(TenantDO::getId, TenantDO::getName, (a, b) -> a)); // 构建租户ID到名称的映射
|
||||||
|
|
||||||
|
// 转换为 VO 并填充租户名称
|
||||||
|
List<KeyboardTenantWithdrawOrderRespVO> voList = pageResult.getList().stream().map(order -> {
|
||||||
|
// 将DO转换为VO
|
||||||
|
KeyboardTenantWithdrawOrderRespVO vo = BeanUtils.toBean(order, KeyboardTenantWithdrawOrderRespVO.class);
|
||||||
|
// 根据租户ID获取并设置租户名称
|
||||||
|
vo.setTenantName(tenantNameMap.get(order.getTenantId()));
|
||||||
|
return vo;
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
|
||||||
|
// 返回包含VO列表和总数的分页结果
|
||||||
|
return new PageResult<>(voList, pageResult.getTotal());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -5,21 +5,18 @@ import com.yolo.keyboard.controller.admin.themes.vo.KeyboardThemesPageReqVO;
|
|||||||
import com.yolo.keyboard.controller.admin.themes.vo.KeyboardThemesSaveReqVO;
|
import com.yolo.keyboard.controller.admin.themes.vo.KeyboardThemesSaveReqVO;
|
||||||
import com.yolo.keyboard.dal.dataobject.themes.KeyboardThemesDO;
|
import com.yolo.keyboard.dal.dataobject.themes.KeyboardThemesDO;
|
||||||
import com.yolo.keyboard.dal.mysql.themes.KeyboardThemesMapper;
|
import com.yolo.keyboard.dal.mysql.themes.KeyboardThemesMapper;
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import jakarta.annotation.Resource;
|
|
||||||
import org.springframework.validation.annotation.Validated;
|
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
|
||||||
|
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
import com.yolo.keyboard.framework.common.pojo.PageResult;
|
import com.yolo.keyboard.framework.common.pojo.PageResult;
|
||||||
import com.yolo.keyboard.framework.common.pojo.PageParam;
|
|
||||||
import com.yolo.keyboard.framework.common.util.object.BeanUtils;
|
import com.yolo.keyboard.framework.common.util.object.BeanUtils;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import org.springframework.data.redis.core.RedisTemplate;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
import static com.yolo.keyboard.framework.common.exception.util.ServiceExceptionUtil.exception;
|
import static com.yolo.keyboard.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
import static com.yolo.keyboard.framework.common.util.collection.CollectionUtils.convertList;
|
|
||||||
import static com.yolo.keyboard.framework.common.util.collection.CollectionUtils.diffList;
|
|
||||||
import static com.yolo.keyboard.module.infra.enums.ErrorCodeConstants.THEMES_NOT_EXISTS;
|
import static com.yolo.keyboard.module.infra.enums.ErrorCodeConstants.THEMES_NOT_EXISTS;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -31,15 +28,25 @@ import static com.yolo.keyboard.module.infra.enums.ErrorCodeConstants.THEMES_NOT
|
|||||||
@Validated
|
@Validated
|
||||||
public class KeyboardThemesServiceImpl implements KeyboardThemesService {
|
public class KeyboardThemesServiceImpl implements KeyboardThemesService {
|
||||||
|
|
||||||
|
private static final String THEME_STYLE_KEY_PREFIX = "theme:style:";
|
||||||
|
private static final String THEME_STYLE_ALL_KEY = "theme:style:all";
|
||||||
|
private static final Long ALL_STYLE_ID = 9999L;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
private KeyboardThemesMapper themesMapper;
|
private KeyboardThemesMapper themesMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private RedisTemplate<String, Object> redisTemplate;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Long createThemes(KeyboardThemesSaveReqVO createReqVO) {
|
public Long createThemes(KeyboardThemesSaveReqVO createReqVO) {
|
||||||
// 插入
|
// 插入
|
||||||
KeyboardThemesDO themes = BeanUtils.toBean(createReqVO, KeyboardThemesDO.class);
|
KeyboardThemesDO themes = BeanUtils.toBean(createReqVO, KeyboardThemesDO.class);
|
||||||
themesMapper.insert(themes);
|
themesMapper.insert(themes);
|
||||||
|
|
||||||
|
// 同步更新 Redis 缓存
|
||||||
|
refreshThemeStyleCache(themes.getThemeStyle());
|
||||||
|
|
||||||
// 返回
|
// 返回
|
||||||
return themes.getId();
|
return themes.getId();
|
||||||
}
|
}
|
||||||
@@ -47,25 +54,57 @@ public class KeyboardThemesServiceImpl implements KeyboardThemesService {
|
|||||||
@Override
|
@Override
|
||||||
public void updateThemes(KeyboardThemesSaveReqVO updateReqVO) {
|
public void updateThemes(KeyboardThemesSaveReqVO updateReqVO) {
|
||||||
// 校验存在
|
// 校验存在
|
||||||
|
KeyboardThemesDO oldTheme = themesMapper.selectById(updateReqVO.getId());
|
||||||
validateThemesExists(updateReqVO.getId());
|
validateThemesExists(updateReqVO.getId());
|
||||||
|
|
||||||
// 更新
|
// 更新
|
||||||
KeyboardThemesDO updateObj = BeanUtils.toBean(updateReqVO, KeyboardThemesDO.class);
|
KeyboardThemesDO updateObj = BeanUtils.toBean(updateReqVO, KeyboardThemesDO.class);
|
||||||
themesMapper.updateById(updateObj);
|
themesMapper.updateById(updateObj);
|
||||||
|
|
||||||
|
// 同步更新 Redis 缓存(如果风格变更,需要刷新新旧两个风格的缓存)
|
||||||
|
refreshThemeStyleCache(updateReqVO.getThemeStyle());
|
||||||
|
if (oldTheme != null && oldTheme.getThemeStyle() != null
|
||||||
|
&& !oldTheme.getThemeStyle().equals(updateReqVO.getThemeStyle())) {
|
||||||
|
refreshThemeStyleCache(oldTheme.getThemeStyle());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void deleteThemes(Long id) {
|
public void deleteThemes(Long id) {
|
||||||
// 校验存在
|
// 校验存在
|
||||||
|
KeyboardThemesDO theme = themesMapper.selectById(id);
|
||||||
validateThemesExists(id);
|
validateThemesExists(id);
|
||||||
|
|
||||||
// 删除
|
// 删除
|
||||||
themesMapper.deleteById(id);
|
themesMapper.deleteById(id);
|
||||||
|
|
||||||
|
// 同步更新 Redis 缓存
|
||||||
|
if (theme != null && theme.getThemeStyle() != null) {
|
||||||
|
refreshThemeStyleCache(theme.getThemeStyle());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void deleteThemesListByIds(List<Long> ids) {
|
public void deleteThemesListByIds(List<Long> ids) {
|
||||||
|
// 获取要删除的主题列表,记录其风格
|
||||||
|
List<KeyboardThemesDO> themes = themesMapper.selectBatchIds(ids);
|
||||||
|
Set<Long> styleIds = new HashSet<>();
|
||||||
|
if (CollUtil.isNotEmpty(themes)) {
|
||||||
|
for (KeyboardThemesDO theme : themes) {
|
||||||
|
if (theme.getThemeStyle() != null) {
|
||||||
|
styleIds.add(theme.getThemeStyle());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 删除
|
// 删除
|
||||||
themesMapper.deleteByIds(ids);
|
themesMapper.deleteByIds(ids);
|
||||||
|
|
||||||
|
// 同步更新 Redis 缓存
|
||||||
|
for (Long styleId : styleIds) {
|
||||||
|
refreshThemeStyleCache(styleId);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private void validateThemesExists(Long id) {
|
private void validateThemesExists(Long id) {
|
||||||
@@ -84,4 +123,32 @@ public class KeyboardThemesServiceImpl implements KeyboardThemesService {
|
|||||||
return themesMapper.selectPage(pageReqVO);
|
return themesMapper.selectPage(pageReqVO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 刷新主题风格缓存
|
||||||
|
*
|
||||||
|
* @param styleId 风格ID
|
||||||
|
*/
|
||||||
|
private void refreshThemeStyleCache(Long styleId) {
|
||||||
|
if (styleId == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 1. 刷新指定风格的缓存
|
||||||
|
String styleKey = THEME_STYLE_KEY_PREFIX + styleId;
|
||||||
|
List<KeyboardThemesDO> themesByStyle = themesMapper.selectList(KeyboardThemesDO::getThemeStyle, styleId);
|
||||||
|
if (CollUtil.isNotEmpty(themesByStyle)) {
|
||||||
|
redisTemplate.opsForValue().set(styleKey, themesByStyle);
|
||||||
|
} else {
|
||||||
|
redisTemplate.delete(styleKey);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 2. 刷新全部主题缓存(theme:style:all)
|
||||||
|
List<KeyboardThemesDO> allThemes = themesMapper.selectList();
|
||||||
|
if (CollUtil.isNotEmpty(allThemes)) {
|
||||||
|
redisTemplate.opsForValue().set(THEME_STYLE_ALL_KEY, allThemes);
|
||||||
|
} else {
|
||||||
|
redisTemplate.delete(THEME_STYLE_ALL_KEY);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
package com.yolo.keyboard.service.usercharacter;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import jakarta.validation.*;
|
||||||
|
import com.yolo.keyboard.controller.admin.usercharacter.vo.*;
|
||||||
|
import com.yolo.keyboard.dal.dataobject.usercharacter.KeyboardUserCharacterDO;
|
||||||
|
import com.yolo.keyboard.framework.common.pojo.PageResult;
|
||||||
|
import com.yolo.keyboard.framework.common.pojo.PageParam;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户人设管理 Service 接口
|
||||||
|
*
|
||||||
|
* @author ziin
|
||||||
|
*/
|
||||||
|
public interface KeyboardUserCharacterService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建用户人设管理
|
||||||
|
*
|
||||||
|
* @param createReqVO 创建信息
|
||||||
|
* @return 编号
|
||||||
|
*/
|
||||||
|
Long createUserCharacter(@Valid KeyboardUserCharacterSaveReqVO createReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新用户人设管理
|
||||||
|
*
|
||||||
|
* @param updateReqVO 更新信息
|
||||||
|
*/
|
||||||
|
void updateUserCharacter(@Valid KeyboardUserCharacterSaveReqVO updateReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除用户人设管理
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
*/
|
||||||
|
void deleteUserCharacter(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除用户人设管理
|
||||||
|
*
|
||||||
|
* @param ids 编号
|
||||||
|
*/
|
||||||
|
void deleteUserCharacterListByIds(List<Long> ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得用户人设管理
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
* @return 用户人设管理
|
||||||
|
*/
|
||||||
|
KeyboardUserCharacterDO getUserCharacter(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得用户人设管理分页
|
||||||
|
*
|
||||||
|
* @param pageReqVO 分页查询
|
||||||
|
* @return 用户人设管理分页
|
||||||
|
*/
|
||||||
|
PageResult<KeyboardUserCharacterDO> getUserCharacterPage(KeyboardUserCharacterPageReqVO pageReqVO);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,80 @@
|
|||||||
|
package com.yolo.keyboard.service.usercharacter;
|
||||||
|
|
||||||
|
import com.yolo.keyboard.controller.admin.usercharacter.vo.KeyboardUserCharacterPageReqVO;
|
||||||
|
import com.yolo.keyboard.controller.admin.usercharacter.vo.KeyboardUserCharacterSaveReqVO;
|
||||||
|
import com.yolo.keyboard.dal.dataobject.usercharacter.KeyboardUserCharacterDO;
|
||||||
|
import com.yolo.keyboard.dal.mysql.usercharacter.KeyboardUserCharacterMapper;
|
||||||
|
import com.yolo.keyboard.framework.common.pojo.PageResult;
|
||||||
|
import com.yolo.keyboard.framework.common.util.object.BeanUtils;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static com.yolo.keyboard.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
|
import static com.yolo.keyboard.module.infra.enums.ErrorCodeConstants.USER_CHARACTER_NOT_EXISTS;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户人设管理 Service 实现类
|
||||||
|
*
|
||||||
|
* @author ziin
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Validated
|
||||||
|
public class KeyboardUserCharacterServiceImpl implements KeyboardUserCharacterService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private KeyboardUserCharacterMapper userCharacterMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long createUserCharacter(KeyboardUserCharacterSaveReqVO createReqVO) {
|
||||||
|
// 插入
|
||||||
|
KeyboardUserCharacterDO userCharacter = BeanUtils.toBean(createReqVO, KeyboardUserCharacterDO.class);
|
||||||
|
userCharacterMapper.insert(userCharacter);
|
||||||
|
|
||||||
|
// 返回
|
||||||
|
return userCharacter.getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateUserCharacter(KeyboardUserCharacterSaveReqVO updateReqVO) {
|
||||||
|
// 校验存在
|
||||||
|
validateUserCharacterExists(updateReqVO.getId());
|
||||||
|
// 更新
|
||||||
|
KeyboardUserCharacterDO updateObj = BeanUtils.toBean(updateReqVO, KeyboardUserCharacterDO.class);
|
||||||
|
userCharacterMapper.updateById(updateObj);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteUserCharacter(Long id) {
|
||||||
|
// 校验存在
|
||||||
|
validateUserCharacterExists(id);
|
||||||
|
// 删除
|
||||||
|
userCharacterMapper.deleteById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteUserCharacterListByIds(List<Long> ids) {
|
||||||
|
// 删除
|
||||||
|
userCharacterMapper.deleteByIds(ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void validateUserCharacterExists(Long id) {
|
||||||
|
if (userCharacterMapper.selectById(id) == null) {
|
||||||
|
throw exception(USER_CHARACTER_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public KeyboardUserCharacterDO getUserCharacter(Long id) {
|
||||||
|
return userCharacterMapper.selectById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult<KeyboardUserCharacterDO> getUserCharacterPage(KeyboardUserCharacterPageReqVO pageReqVO) {
|
||||||
|
return userCharacterMapper.selectPage(pageReqVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
package com.yolo.keyboard.service.userinvitecodes;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import jakarta.validation.*;
|
||||||
|
import com.yolo.keyboard.controller.admin.userinvitecodes.vo.*;
|
||||||
|
import com.yolo.keyboard.dal.dataobject.userinvitecodes.KeyboardUserInviteCodesDO;
|
||||||
|
import com.yolo.keyboard.framework.common.pojo.PageResult;
|
||||||
|
import com.yolo.keyboard.framework.common.pojo.PageParam;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户生成的邀请码表,用于邀请新用户注册/安装并建立邀请关系 Service 接口
|
||||||
|
*
|
||||||
|
* @author ziin
|
||||||
|
*/
|
||||||
|
public interface KeyboardUserInviteCodesService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建用户生成的邀请码表,用于邀请新用户注册/安装并建立邀请关系
|
||||||
|
*
|
||||||
|
* @param createReqVO 创建信息
|
||||||
|
* @return 编号
|
||||||
|
*/
|
||||||
|
Long createUserInviteCodes(@Valid KeyboardUserInviteCodesSaveReqVO createReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新用户生成的邀请码表,用于邀请新用户注册/安装并建立邀请关系
|
||||||
|
*
|
||||||
|
* @param updateReqVO 更新信息
|
||||||
|
*/
|
||||||
|
void updateUserInviteCodes(@Valid KeyboardUserInviteCodesSaveReqVO updateReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除用户生成的邀请码表,用于邀请新用户注册/安装并建立邀请关系
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
*/
|
||||||
|
void deleteUserInviteCodes(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除用户生成的邀请码表,用于邀请新用户注册/安装并建立邀请关系
|
||||||
|
*
|
||||||
|
* @param ids 编号
|
||||||
|
*/
|
||||||
|
void deleteUserInviteCodesListByIds(List<Long> ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得用户生成的邀请码表,用于邀请新用户注册/安装并建立邀请关系
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
* @return 用户生成的邀请码表,用于邀请新用户注册/安装并建立邀请关系
|
||||||
|
*/
|
||||||
|
KeyboardUserInviteCodesDO getUserInviteCodes(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得用户生成的邀请码表,用于邀请新用户注册/安装并建立邀请关系分页
|
||||||
|
*
|
||||||
|
* @param pageReqVO 分页查询
|
||||||
|
* @return 用户生成的邀请码表,用于邀请新用户注册/安装并建立邀请关系分页
|
||||||
|
*/
|
||||||
|
PageResult<KeyboardUserInviteCodesDO> getUserInviteCodesPage(KeyboardUserInviteCodesPageReqVO pageReqVO);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,85 @@
|
|||||||
|
package com.yolo.keyboard.service.userinvitecodes;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import com.yolo.keyboard.controller.admin.userinvitecodes.vo.*;
|
||||||
|
import com.yolo.keyboard.dal.dataobject.userinvitecodes.KeyboardUserInviteCodesDO;
|
||||||
|
import com.yolo.keyboard.framework.common.pojo.PageResult;
|
||||||
|
import com.yolo.keyboard.framework.common.pojo.PageParam;
|
||||||
|
import com.yolo.keyboard.framework.common.util.object.BeanUtils;
|
||||||
|
|
||||||
|
import com.yolo.keyboard.dal.mysql.userinvitecodes.KeyboardUserInviteCodesMapper;
|
||||||
|
|
||||||
|
import static com.yolo.keyboard.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
|
import static com.yolo.keyboard.framework.common.util.collection.CollectionUtils.convertList;
|
||||||
|
import static com.yolo.keyboard.framework.common.util.collection.CollectionUtils.diffList;
|
||||||
|
import static com.yolo.keyboard.module.infra.enums.ErrorCodeConstants.USER_INVITE_CODES_NOT_EXISTS;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户生成的邀请码表,用于邀请新用户注册/安装并建立邀请关系 Service 实现类
|
||||||
|
*
|
||||||
|
* @author ziin
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Validated
|
||||||
|
public class KeyboardUserInviteCodesServiceImpl implements KeyboardUserInviteCodesService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private KeyboardUserInviteCodesMapper userInviteCodesMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long createUserInviteCodes(KeyboardUserInviteCodesSaveReqVO createReqVO) {
|
||||||
|
// 插入
|
||||||
|
KeyboardUserInviteCodesDO userInviteCodes = BeanUtils.toBean(createReqVO, KeyboardUserInviteCodesDO.class);
|
||||||
|
userInviteCodesMapper.insert(userInviteCodes);
|
||||||
|
|
||||||
|
// 返回
|
||||||
|
return userInviteCodes.getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateUserInviteCodes(KeyboardUserInviteCodesSaveReqVO updateReqVO) {
|
||||||
|
// 校验存在
|
||||||
|
validateUserInviteCodesExists(updateReqVO.getId());
|
||||||
|
// 更新
|
||||||
|
KeyboardUserInviteCodesDO updateObj = BeanUtils.toBean(updateReqVO, KeyboardUserInviteCodesDO.class);
|
||||||
|
userInviteCodesMapper.updateById(updateObj);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteUserInviteCodes(Long id) {
|
||||||
|
// 校验存在
|
||||||
|
validateUserInviteCodesExists(id);
|
||||||
|
// 删除
|
||||||
|
userInviteCodesMapper.deleteById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteUserInviteCodesListByIds(List<Long> ids) {
|
||||||
|
// 删除
|
||||||
|
userInviteCodesMapper.deleteByIds(ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void validateUserInviteCodesExists(Long id) {
|
||||||
|
if (userInviteCodesMapper.selectById(id) == null) {
|
||||||
|
throw exception(USER_INVITE_CODES_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public KeyboardUserInviteCodesDO getUserInviteCodes(Long id) {
|
||||||
|
return userInviteCodesMapper.selectById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult<KeyboardUserInviteCodesDO> getUserInviteCodesPage(KeyboardUserInviteCodesPageReqVO pageReqVO) {
|
||||||
|
return userInviteCodesMapper.selectPage(pageReqVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
package com.yolo.keyboard.service.userinvites;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import jakarta.validation.*;
|
||||||
|
import com.yolo.keyboard.controller.admin.userinvites.vo.*;
|
||||||
|
import com.yolo.keyboard.dal.dataobject.userinvites.KeyboardUserInvitesDO;
|
||||||
|
import com.yolo.keyboard.framework.common.pojo.PageResult;
|
||||||
|
import com.yolo.keyboard.framework.common.pojo.PageParam;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户邀请关系绑定台账表,记录新用户最终归属的邀请人 Service 接口
|
||||||
|
*
|
||||||
|
* @author ziin
|
||||||
|
*/
|
||||||
|
public interface KeyboardUserInvitesService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建用户邀请关系绑定台账表,记录新用户最终归属的邀请人
|
||||||
|
*
|
||||||
|
* @param createReqVO 创建信息
|
||||||
|
* @return 编号
|
||||||
|
*/
|
||||||
|
Long createUserInvites(@Valid KeyboardUserInvitesSaveReqVO createReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新用户邀请关系绑定台账表,记录新用户最终归属的邀请人
|
||||||
|
*
|
||||||
|
* @param updateReqVO 更新信息
|
||||||
|
*/
|
||||||
|
void updateUserInvites(@Valid KeyboardUserInvitesSaveReqVO updateReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除用户邀请关系绑定台账表,记录新用户最终归属的邀请人
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
*/
|
||||||
|
void deleteUserInvites(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除用户邀请关系绑定台账表,记录新用户最终归属的邀请人
|
||||||
|
*
|
||||||
|
* @param ids 编号
|
||||||
|
*/
|
||||||
|
void deleteUserInvitesListByIds(List<Long> ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得用户邀请关系绑定台账表,记录新用户最终归属的邀请人
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
* @return 用户邀请关系绑定台账表,记录新用户最终归属的邀请人
|
||||||
|
*/
|
||||||
|
KeyboardUserInvitesDO getUserInvites(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得用户邀请关系绑定台账表,记录新用户最终归属的邀请人分页
|
||||||
|
*
|
||||||
|
* @param pageReqVO 分页查询
|
||||||
|
* @return 用户邀请关系绑定台账表,记录新用户最终归属的邀请人分页
|
||||||
|
*/
|
||||||
|
PageResult<KeyboardUserInvitesDO> getUserInvitesPage(KeyboardUserInvitesPageReqVO pageReqVO);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,80 @@
|
|||||||
|
package com.yolo.keyboard.service.userinvites;
|
||||||
|
|
||||||
|
import com.yolo.keyboard.controller.admin.userinvites.vo.KeyboardUserInvitesPageReqVO;
|
||||||
|
import com.yolo.keyboard.controller.admin.userinvites.vo.KeyboardUserInvitesSaveReqVO;
|
||||||
|
import com.yolo.keyboard.dal.dataobject.userinvites.KeyboardUserInvitesDO;
|
||||||
|
import com.yolo.keyboard.dal.mysql.userinvites.KeyboardUserInvitesMapper;
|
||||||
|
import com.yolo.keyboard.framework.common.pojo.PageResult;
|
||||||
|
import com.yolo.keyboard.framework.common.util.object.BeanUtils;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static com.yolo.keyboard.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
|
import static com.yolo.keyboard.module.infra.enums.ErrorCodeConstants.USER_INVITES_NOT_EXISTS;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户邀请关系绑定台账表,记录新用户最终归属的邀请人 Service 实现类
|
||||||
|
*
|
||||||
|
* @author ziin
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Validated
|
||||||
|
public class KeyboardUserInvitesServiceImpl implements KeyboardUserInvitesService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private KeyboardUserInvitesMapper userInvitesMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long createUserInvites(KeyboardUserInvitesSaveReqVO createReqVO) {
|
||||||
|
// 插入
|
||||||
|
KeyboardUserInvitesDO userInvites = BeanUtils.toBean(createReqVO, KeyboardUserInvitesDO.class);
|
||||||
|
userInvitesMapper.insert(userInvites);
|
||||||
|
|
||||||
|
// 返回
|
||||||
|
return userInvites.getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateUserInvites(KeyboardUserInvitesSaveReqVO updateReqVO) {
|
||||||
|
// 校验存在
|
||||||
|
validateUserInvitesExists(updateReqVO.getId());
|
||||||
|
// 更新
|
||||||
|
KeyboardUserInvitesDO updateObj = BeanUtils.toBean(updateReqVO, KeyboardUserInvitesDO.class);
|
||||||
|
userInvitesMapper.updateById(updateObj);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteUserInvites(Long id) {
|
||||||
|
// 校验存在
|
||||||
|
validateUserInvitesExists(id);
|
||||||
|
// 删除
|
||||||
|
userInvitesMapper.deleteById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteUserInvitesListByIds(List<Long> ids) {
|
||||||
|
// 删除
|
||||||
|
userInvitesMapper.deleteByIds(ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void validateUserInvitesExists(Long id) {
|
||||||
|
if (userInvitesMapper.selectById(id) == null) {
|
||||||
|
throw exception(USER_INVITES_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public KeyboardUserInvitesDO getUserInvites(Long id) {
|
||||||
|
return userInvitesMapper.selectById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult<KeyboardUserInvitesDO> getUserInvitesPage(KeyboardUserInvitesPageReqVO pageReqVO) {
|
||||||
|
return userInvitesMapper.selectPage(pageReqVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
package com.yolo.keyboard.service.userquotatotal;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import jakarta.validation.*;
|
||||||
|
import com.yolo.keyboard.controller.admin.userquotatotal.vo.*;
|
||||||
|
import com.yolo.keyboard.dal.dataobject.userquotatotal.KeyboardUserQuotaTotalDO;
|
||||||
|
import com.yolo.keyboard.framework.common.pojo.PageResult;
|
||||||
|
import com.yolo.keyboard.framework.common.pojo.PageParam;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户免费功能永久总次数额度表(所有功能共用) Service 接口
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
public interface KeyboardUserQuotaTotalService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建用户免费功能永久总次数额度表(所有功能共用)
|
||||||
|
*
|
||||||
|
* @param createReqVO 创建信息
|
||||||
|
* @return 编号
|
||||||
|
*/
|
||||||
|
Long createUserQuotaTotal(@Valid KeyboardUserQuotaTotalSaveReqVO createReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新用户免费功能永久总次数额度表(所有功能共用)
|
||||||
|
*
|
||||||
|
* @param updateReqVO 更新信息
|
||||||
|
*/
|
||||||
|
void updateUserQuotaTotal(@Valid KeyboardUserQuotaTotalSaveReqVO updateReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除用户免费功能永久总次数额度表(所有功能共用)
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
*/
|
||||||
|
void deleteUserQuotaTotal(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除用户免费功能永久总次数额度表(所有功能共用)
|
||||||
|
*
|
||||||
|
* @param ids 编号
|
||||||
|
*/
|
||||||
|
void deleteUserQuotaTotalListByIds(List<Long> ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得用户免费功能永久总次数额度表(所有功能共用)
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
* @return 用户免费功能永久总次数额度表(所有功能共用)
|
||||||
|
*/
|
||||||
|
KeyboardUserQuotaTotalDO getUserQuotaTotal(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得用户免费功能永久总次数额度表(所有功能共用)分页
|
||||||
|
*
|
||||||
|
* @param pageReqVO 分页查询
|
||||||
|
* @return 用户免费功能永久总次数额度表(所有功能共用)分页
|
||||||
|
*/
|
||||||
|
PageResult<KeyboardUserQuotaTotalDO> getUserQuotaTotalPage(KeyboardUserQuotaTotalPageReqVO pageReqVO);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,81 @@
|
|||||||
|
package com.yolo.keyboard.service.userquotatotal;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import com.yolo.keyboard.controller.admin.userquotatotal.vo.*;
|
||||||
|
import com.yolo.keyboard.dal.dataobject.userquotatotal.KeyboardUserQuotaTotalDO;
|
||||||
|
import com.yolo.keyboard.framework.common.pojo.PageResult;
|
||||||
|
import com.yolo.keyboard.framework.common.util.object.BeanUtils;
|
||||||
|
|
||||||
|
import com.yolo.keyboard.dal.mysql.userquotatotal.KeyboardUserQuotaTotalMapper;
|
||||||
|
|
||||||
|
import static com.yolo.keyboard.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
|
import static com.yolo.keyboard.module.infra.enums.ErrorCodeConstants.USER_QUOTA_TOTAL_NOT_EXISTS;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户免费功能永久总次数额度表(所有功能共用) Service 实现类
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Validated
|
||||||
|
public class KeyboardUserQuotaTotalServiceImpl implements KeyboardUserQuotaTotalService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private KeyboardUserQuotaTotalMapper userQuotaTotalMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long createUserQuotaTotal(KeyboardUserQuotaTotalSaveReqVO createReqVO) {
|
||||||
|
// 插入
|
||||||
|
KeyboardUserQuotaTotalDO userQuotaTotal = BeanUtils.toBean(createReqVO, KeyboardUserQuotaTotalDO.class);
|
||||||
|
userQuotaTotalMapper.insert(userQuotaTotal);
|
||||||
|
|
||||||
|
// 返回
|
||||||
|
return userQuotaTotal.getUserId();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateUserQuotaTotal(KeyboardUserQuotaTotalSaveReqVO updateReqVO) {
|
||||||
|
// 校验存在
|
||||||
|
validateUserQuotaTotalExists(updateReqVO.getUserId());
|
||||||
|
// 更新
|
||||||
|
KeyboardUserQuotaTotalDO updateObj = BeanUtils.toBean(updateReqVO, KeyboardUserQuotaTotalDO.class);
|
||||||
|
userQuotaTotalMapper.updateById(updateObj);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteUserQuotaTotal(Long id) {
|
||||||
|
// 校验存在
|
||||||
|
validateUserQuotaTotalExists(id);
|
||||||
|
// 删除
|
||||||
|
userQuotaTotalMapper.deleteById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteUserQuotaTotalListByIds(List<Long> ids) {
|
||||||
|
// 删除
|
||||||
|
userQuotaTotalMapper.deleteByIds(ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void validateUserQuotaTotalExists(Long id) {
|
||||||
|
if (userQuotaTotalMapper.selectById(id) == null) {
|
||||||
|
throw exception(USER_QUOTA_TOTAL_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public KeyboardUserQuotaTotalDO getUserQuotaTotal(Long id) {
|
||||||
|
return userQuotaTotalMapper.selectById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult<KeyboardUserQuotaTotalDO> getUserQuotaTotalPage(KeyboardUserQuotaTotalPageReqVO pageReqVO) {
|
||||||
|
return userQuotaTotalMapper.selectPage(pageReqVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
package com.yolo.keyboard.service.userthemes;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import jakarta.validation.*;
|
||||||
|
import com.yolo.keyboard.controller.admin.userthemes.vo.*;
|
||||||
|
import com.yolo.keyboard.dal.dataobject.userthemes.KeyboardUserThemesDO;
|
||||||
|
import com.yolo.keyboard.framework.common.pojo.PageResult;
|
||||||
|
import com.yolo.keyboard.framework.common.pojo.PageParam;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户主题 Service 接口
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
public interface KeyboardUserThemesService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建用户主题
|
||||||
|
*
|
||||||
|
* @param createReqVO 创建信息
|
||||||
|
* @return 编号
|
||||||
|
*/
|
||||||
|
Long createUserThemes(@Valid KeyboardUserThemesSaveReqVO createReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新用户主题
|
||||||
|
*
|
||||||
|
* @param updateReqVO 更新信息
|
||||||
|
*/
|
||||||
|
void updateUserThemes(@Valid KeyboardUserThemesSaveReqVO updateReqVO);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除用户主题
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
*/
|
||||||
|
void deleteUserThemes(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除用户主题
|
||||||
|
*
|
||||||
|
* @param ids 编号
|
||||||
|
*/
|
||||||
|
void deleteUserThemesListByIds(List<Long> ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得用户主题
|
||||||
|
*
|
||||||
|
* @param id 编号
|
||||||
|
* @return 用户主题
|
||||||
|
*/
|
||||||
|
KeyboardUserThemesDO getUserThemes(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获得用户主题分页
|
||||||
|
*
|
||||||
|
* @param pageReqVO 分页查询
|
||||||
|
* @return 用户主题分页
|
||||||
|
*/
|
||||||
|
PageResult<KeyboardUserThemesDO> getUserThemesPage(KeyboardUserThemesPageReqVO pageReqVO);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,83 @@
|
|||||||
|
package com.yolo.keyboard.service.userthemes;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import com.yolo.keyboard.controller.admin.userthemes.vo.*;
|
||||||
|
import com.yolo.keyboard.dal.dataobject.userthemes.KeyboardUserThemesDO;
|
||||||
|
import com.yolo.keyboard.framework.common.pojo.PageResult;
|
||||||
|
import com.yolo.keyboard.framework.common.pojo.PageParam;
|
||||||
|
import com.yolo.keyboard.framework.common.util.object.BeanUtils;
|
||||||
|
|
||||||
|
import com.yolo.keyboard.dal.mysql.userthemes.KeyboardUserThemesMapper;
|
||||||
|
|
||||||
|
import static com.yolo.keyboard.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||||
|
import static com.yolo.keyboard.module.infra.enums.ErrorCodeConstants.USER_THEMES_NOT_EXISTS;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户主题 Service 实现类
|
||||||
|
*
|
||||||
|
* @author 芋道源码
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Validated
|
||||||
|
public class KeyboardUserThemesServiceImpl implements KeyboardUserThemesService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private KeyboardUserThemesMapper userThemesMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long createUserThemes(KeyboardUserThemesSaveReqVO createReqVO) {
|
||||||
|
// 插入
|
||||||
|
KeyboardUserThemesDO userThemes = BeanUtils.toBean(createReqVO, KeyboardUserThemesDO.class);
|
||||||
|
userThemesMapper.insert(userThemes);
|
||||||
|
|
||||||
|
// 返回
|
||||||
|
return userThemes.getId();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateUserThemes(KeyboardUserThemesSaveReqVO updateReqVO) {
|
||||||
|
// 校验存在
|
||||||
|
validateUserThemesExists(updateReqVO.getId());
|
||||||
|
// 更新
|
||||||
|
KeyboardUserThemesDO updateObj = BeanUtils.toBean(updateReqVO, KeyboardUserThemesDO.class);
|
||||||
|
userThemesMapper.updateById(updateObj);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteUserThemes(Long id) {
|
||||||
|
// 校验存在
|
||||||
|
validateUserThemesExists(id);
|
||||||
|
// 删除
|
||||||
|
userThemesMapper.deleteById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteUserThemesListByIds(List<Long> ids) {
|
||||||
|
// 删除
|
||||||
|
userThemesMapper.deleteByIds(ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void validateUserThemesExists(Long id) {
|
||||||
|
if (userThemesMapper.selectById(id) == null) {
|
||||||
|
throw exception(USER_THEMES_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public KeyboardUserThemesDO getUserThemes(Long id) {
|
||||||
|
return userThemesMapper.selectById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult<KeyboardUserThemesDO> getUserThemesPage(KeyboardUserThemesPageReqVO pageReqVO) {
|
||||||
|
return userThemesMapper.selectPage(pageReqVO);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package com.yolo.keyboard.utils;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.IdUtil;
|
||||||
|
|
||||||
|
public class BizNoGenerator {
|
||||||
|
public static String generate(String prefix) {
|
||||||
|
return prefix + "-" + IdUtil.getSnowflakeNextIdStr();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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="com.yolo.keyboard.dal.mysql.tag.KeyboardTagMapper">
|
||||||
|
|
||||||
|
<!--
|
||||||
|
一般情况下,尽可能使用 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="com.yolo.keyboard.dal.mysql.tenantbalance.TenantBalanceMapper">
|
||||||
|
|
||||||
|
<!--
|
||||||
|
一般情况下,尽可能使用 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="com.yolo.keyboard.module.keyboard.dal.mysql.tenantcommission.KeyboardTenantCommissionMapper">
|
||||||
|
|
||||||
|
<!--
|
||||||
|
一般情况下,尽可能使用 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="com.yolo.keyboard.dal.mysql.tenantwithdraworder.KeyboardTenantWithdrawOrderMapper">
|
||||||
|
|
||||||
|
<!--
|
||||||
|
一般情况下,尽可能使用 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="com.yolo.keyboard.dal.mysql.usercharacter.KeyboardUserCharacterMapper">
|
||||||
|
|
||||||
|
<!--
|
||||||
|
一般情况下,尽可能使用 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="com.yolo.keyboard.dal.mysql.userinvitecodes.KeyboardUserInviteCodesMapper">
|
||||||
|
|
||||||
|
<!--
|
||||||
|
一般情况下,尽可能使用 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="com.yolo.keyboard.module.keyboard.dal.mysql.userinvites.KeyboardUserInvitesMapper">
|
||||||
|
|
||||||
|
<!--
|
||||||
|
一般情况下,尽可能使用 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="com.yolo.keyboard.dal.mysql.userquotatotal.KeyboardUserQuotaTotalMapper">
|
||||||
|
|
||||||
|
<!--
|
||||||
|
一般情况下,尽可能使用 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="com.yolo.keyboard.dal.mysql.userthemes.KeyboardUserThemesMapper">
|
||||||
|
|
||||||
|
<!--
|
||||||
|
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
||||||
|
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
|
||||||
|
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
||||||
|
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||||
|
-->
|
||||||
|
|
||||||
|
</mapper>
|
||||||
2
pom.xml
2
pom.xml
@@ -46,6 +46,8 @@
|
|||||||
<spring.boot.version>3.5.5</spring.boot.version>
|
<spring.boot.version>3.5.5</spring.boot.version>
|
||||||
<mapstruct.version>1.6.3</mapstruct.version>
|
<mapstruct.version>1.6.3</mapstruct.version>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
<!-- 覆盖 Spring Boot 默认的 Quartz 版本 -->
|
||||||
|
<quartz.version>2.5.2</quartz.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<dependencyManagement>
|
<dependencyManagement>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"local": {
|
"local": {
|
||||||
"baseUrl": "http://127.0.0.1:48080/admin-api",
|
"baseUrl": "http://127.0.0.1:48081/admin-api",
|
||||||
"token": "test1",
|
"token": "test1",
|
||||||
"adminTenantId": "1",
|
"adminTenantId": "1",
|
||||||
|
|
||||||
|
|||||||
@@ -18,6 +18,8 @@
|
|||||||
<flatten-maven-plugin.version>1.7.2</flatten-maven-plugin.version>
|
<flatten-maven-plugin.version>1.7.2</flatten-maven-plugin.version>
|
||||||
<!-- 统一依赖管理 -->
|
<!-- 统一依赖管理 -->
|
||||||
<spring.boot.version>3.5.8</spring.boot.version>
|
<spring.boot.version>3.5.8</spring.boot.version>
|
||||||
|
<!-- 覆盖 Spring Boot 默认的 Quartz 版本 -->
|
||||||
|
<quartz.version>2.5.2</quartz.version>
|
||||||
<!-- Web 相关 -->
|
<!-- Web 相关 -->
|
||||||
<springdoc.version>2.8.14</springdoc.version>
|
<springdoc.version>2.8.14</springdoc.version>
|
||||||
<knife4j.version>4.5.0</knife4j.version>
|
<knife4j.version>4.5.0</knife4j.version>
|
||||||
@@ -95,6 +97,13 @@
|
|||||||
<scope>import</scope>
|
<scope>import</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- 覆盖 Spring Boot 默认的 Quartz 版本 -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.quartz-scheduler</groupId>
|
||||||
|
<artifactId>quartz</artifactId>
|
||||||
|
<version>${quartz.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<!-- 业务组件 -->
|
<!-- 业务组件 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>io.github.mouzt</groupId>
|
<groupId>io.github.mouzt</groupId>
|
||||||
|
|||||||
@@ -28,8 +28,19 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-starter-quartz</artifactId>
|
<artifactId>spring-boot-starter-quartz</artifactId>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<artifactId>quartz</artifactId>
|
||||||
|
<groupId>org.quartz-scheduler</groupId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.quartz-scheduler</groupId>
|
||||||
|
<artifactId>quartz</artifactId>
|
||||||
|
<version>2.5.2</version>
|
||||||
|
</dependency>
|
||||||
<!-- 工具类相关 -->
|
<!-- 工具类相关 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>jakarta.validation</groupId>
|
<groupId>jakarta.validation</groupId>
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import com.baomidou.mybatisplus.extension.incrementer.*;
|
|||||||
import com.baomidou.mybatisplus.extension.parser.JsqlParserGlobal;
|
import com.baomidou.mybatisplus.extension.parser.JsqlParserGlobal;
|
||||||
import com.baomidou.mybatisplus.extension.parser.cache.JdkSerialCaffeineJsqlParseCache;
|
import com.baomidou.mybatisplus.extension.parser.cache.JdkSerialCaffeineJsqlParseCache;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
|
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.inner.OptimisticLockerInnerInterceptor;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
|
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
@@ -48,6 +49,7 @@ public class YoloMybatisAutoConfiguration {
|
|||||||
public MybatisPlusInterceptor mybatisPlusInterceptor() {
|
public MybatisPlusInterceptor mybatisPlusInterceptor() {
|
||||||
MybatisPlusInterceptor mybatisPlusInterceptor = new MybatisPlusInterceptor();
|
MybatisPlusInterceptor mybatisPlusInterceptor = new MybatisPlusInterceptor();
|
||||||
mybatisPlusInterceptor.addInnerInterceptor(new PaginationInnerInterceptor()); // 分页插件
|
mybatisPlusInterceptor.addInnerInterceptor(new PaginationInnerInterceptor()); // 分页插件
|
||||||
|
mybatisPlusInterceptor.addInnerInterceptor(new OptimisticLockerInnerInterceptor()); // 乐观锁插件
|
||||||
// ↓↓↓ 按需开启,可能会影响到 updateBatch 的地方:例如说文件配置管理 ↓↓↓
|
// ↓↓↓ 按需开启,可能会影响到 updateBatch 的地方:例如说文件配置管理 ↓↓↓
|
||||||
// mybatisPlusInterceptor.addInnerInterceptor(new BlockAttackInnerInterceptor()); // 拦截没有指定条件的 update 和 delete 语句
|
// mybatisPlusInterceptor.addInnerInterceptor(new BlockAttackInnerInterceptor()); // 拦截没有指定条件的 update 和 delete 语句
|
||||||
return mybatisPlusInterceptor;
|
return mybatisPlusInterceptor;
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user