package com.jeequan.jeepay.mgr.ctrl.account;

import com.alibaba.fastjson.JSONObject;
import com.jeequan.jeepay.core.constants.CS;
import com.jeequan.jeepay.core.model.ApiRes;
import com.jeequan.jeepay.mgr.ctrl.CommonCtrl;
import com.jeequan.jeepay.service.impl.InfoAccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/***
* 钱包ctrl
*
* @author terrfly
*
* @date 2022/3/24 15:34
*/
@RestController
@RequestMapping("/api/account")
public class InfoAccountController extends CommonCtrl {

    @Autowired private InfoAccountService infoAccountService;

    /** 平台利润钱包 **/
    @PreAuthorize("hasAuthority('ENT_PROFIT_PLATFORM')")
    @GetMapping("/platformProfit")
    public ApiRes platformProfit() {

        JSONObject jsonObject = new JSONObject();
        jsonObject.put(CS.INFO_ID_ENUM.PLATFORM_PROFIT, infoAccountService.queryPlatformAccount(CS.INFO_ID_ENUM.PLATFORM_PROFIT));
        jsonObject.put(CS.INFO_ID_ENUM.PLATFORM_INACCOUNT, infoAccountService.queryPlatformAccount(CS.INFO_ID_ENUM.PLATFORM_INACCOUNT));
        return ApiRes.ok(jsonObject);
    }

}
