package com.tofly.feesapi.yhgl.controller;

import com.tofly.common.core.util.StringUtil;
import com.tofly.feesapi.common.core.ResultRespone;

import com.tofly.feesapi.yhgl.entity.dto.YyZjzhUpdate;
import com.tofly.feesapi.yhgl.service.IYyZjzhService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Date;

@RestController
@RequestMapping("/api/yhgl/yyZjzh")
@Api(tags = "用户资金账号")
public class YyZjzhController {

    @Autowired
    private IYyZjzhService zjzhService;

    @ApiOperation(value = "余额转存", tags = "余额转存")
    @PutMapping
    public ResultRespone update(@RequestBody YyZjzhUpdate update) {
        if (StringUtil.isNull(update.getSfrq())) {
            update.setSfrq(new Date());
        }
        String sflsbh = zjzhService.xgyck(update);
        if (StringUtil.isNotEmpty(sflsbh)) {
            return ResultRespone.success(sflsbh);
        }
        return ResultRespone.failed("余额转存保存失败");
    }
}
