wzj-boot/ruoyi-admin/src/main/java/org/dromara/app/AppTenantController.java
2025-08-21 15:47:28 +08:00

45 lines
1.7 KiB
Java

package org.dromara.app;
import com.wzj.soopin.transaction.convert.WithdrawConvert;
import com.wzj.soopin.transaction.domain.bo.WithdrawBO;
import com.wzj.soopin.transaction.enums.WithdrawType;
import com.wzj.soopin.transaction.service.IWithdrawService;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.dromara.common.core.domain.R;
import org.dromara.common.core.domain.model.LoginUser;
import org.dromara.common.core.exception.ServiceException;
import org.dromara.common.log.annotation.Log;
import org.dromara.common.log.enums.BusinessType;
import org.dromara.common.satoken.utils.LoginHelper;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@Tag(name = "租户")
@RestController
@RequestMapping("/app/tenant")
@RequiredArgsConstructor
public class AppTenantController {
private final IWithdrawService withdrawService;
private final WithdrawConvert withdrawConvert;
@Tag(name = "提现")
@Log(title = "提现 ", businessType = BusinessType.INSERT)
@PostMapping("/withdraw")
public R withdraw(@RequestBody WithdrawBO bo) {
//获取用户信息
LoginUser loginUser = LoginHelper.getLoginUser();
if (loginUser == null) {
throw new ServiceException("用户未登录");
}
Long memberId = loginUser.getUserId();
bo.setMemberId(memberId);
bo.setType(WithdrawType.REVENUE.getCode());
return R.ok(withdrawService.withdrawRevenue(withdrawConvert.toPo(bo)));
}
}