2024-03-06 20:56:22 +08:00
|
|
|
package com.ai.da.controller;
|
|
|
|
|
|
2024-03-26 14:58:43 +08:00
|
|
|
import com.ai.da.common.context.UserContext;
|
2024-03-15 15:38:56 +08:00
|
|
|
import com.ai.da.common.response.PageBaseResponse;
|
2024-03-06 20:56:22 +08:00
|
|
|
import com.ai.da.common.response.Response;
|
2024-03-15 15:38:56 +08:00
|
|
|
import com.ai.da.mapper.primary.entity.CreditsDetail;
|
|
|
|
|
import com.ai.da.model.dto.QueryIncomeOrExpenditureDTO;
|
2024-03-06 20:56:22 +08:00
|
|
|
import com.ai.da.service.CreditsService;
|
|
|
|
|
import io.swagger.annotations.Api;
|
|
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
2024-03-15 15:38:56 +08:00
|
|
|
import javax.validation.Valid;
|
2024-03-06 20:56:22 +08:00
|
|
|
|
|
|
|
|
@CrossOrigin
|
|
|
|
|
@RestController
|
|
|
|
|
@RequestMapping("/api/credits")
|
|
|
|
|
@Api(tags = "积分")
|
|
|
|
|
@Slf4j
|
|
|
|
|
public class CreditsController {
|
|
|
|
|
|
|
|
|
|
@Resource
|
|
|
|
|
private CreditsService creditsService;
|
|
|
|
|
|
2024-03-15 15:38:56 +08:00
|
|
|
@ApiOperation("获取当前积分")
|
2024-03-06 20:56:22 +08:00
|
|
|
@GetMapping("/getCredits")
|
2024-03-26 14:58:43 +08:00
|
|
|
public Response<String> getCredits() {
|
|
|
|
|
String credits = creditsService.getCredits(UserContext.getUserHolder().getId());
|
2024-03-06 20:56:22 +08:00
|
|
|
return Response.success(credits);
|
|
|
|
|
}
|
2024-03-15 15:38:56 +08:00
|
|
|
|
|
|
|
|
@ApiOperation("获取积分详细")
|
|
|
|
|
@PostMapping("/getCreditsDetail")
|
2024-03-26 14:58:43 +08:00
|
|
|
public Response<PageBaseResponse<CreditsDetail>> getCreditsDetail(@Valid @RequestBody QueryIncomeOrExpenditureDTO queryPageByTimeDTO) {
|
2024-03-15 15:38:56 +08:00
|
|
|
PageBaseResponse<CreditsDetail> credits = creditsService.queryCreditsDetailsPage(queryPageByTimeDTO);
|
|
|
|
|
return Response.success(credits);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2024-03-06 20:56:22 +08:00
|
|
|
}
|