phpcjl
2024-12-04 c347a62bcccc71484ac7e955443fe3d14d8f3014
ruoyi-service/ruoyi-account/src/main/java/com/ruoyi/account/controller/WalletController.java
@@ -12,14 +12,20 @@
import com.ruoyi.system.api.model.LoginUser;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.util.List;
@Api(tags = "钱包")
@Api(tags = "小程序-个人中心-我的钱包")
@RestController
@RequestMapping("wallet")
public class WalletController extends BaseController {
@@ -34,7 +40,7 @@
     * 钱包详情
     */
    @GetMapping("detail")
    @ApiOperation(value = "钱包详情", notes = "钱包详情", tags = {"小程序-个人中心-我的钱包-钱包详情"})
    @ApiOperation(value = "钱包详情", notes = "钱包详情")
    public R<WalletVO> detail() {
        LoginUser loginUserApplet = tokenService.getLoginUserApplet();
        WalletVO walletVO = walletService.getWalletByUserId(loginUserApplet.getUserid());
@@ -44,11 +50,24 @@
    /**
     * 变更明细
     */
    @ApiOperation(value = "变更明细", notes = "变更明细", tags = {"小程序-个人中心-我的钱包-变更记录"})
    @ApiOperation(value = "变更明细", notes = "变更明细")
    @GetMapping("change")
    public R<List<BalanceChangeRecord>> change() {
    public R<List<BalanceChangeRecord>> change(@ApiParam(value = "变更类型", required = false)
                                               @RequestParam(required = false) Integer changeType,
                                               @ApiParam(value = "创建时间", required = false)
                                               @RequestParam(required = false) @DateTimeFormat(pattern = "yyyy-MM-dd")
                                               LocalDate createTime) {
        Long userId = SecurityUtils.getUserId();
        LocalDateTime localDateTime = null;
        if (createTime != null) {
            LocalTime specificTime = LocalTime.of(0, 0);
            localDateTime = createTime.atTime(specificTime);
        }
        return R.ok(balanceChangeRecordService.list(new LambdaQueryWrapper<BalanceChangeRecord>()
                .eq(changeType != null, BalanceChangeRecord::getChangeType, changeType)
                .eq(createTime != null, BalanceChangeRecord::getCreateTime, localDateTime)
                .eq(BalanceChangeRecord::getAppUserId, userId)));
    }