package org.springblade.modules.app.web;


import com.wn.common.datamodel.ResultDTO;
import org.springblade.modules.app.common.dto.EnteringZhejiangFilingDTO;
import org.springblade.modules.app.common.dto.UserDTO;
import org.springblade.modules.app.manager.EnteringZhejiangFilingManager;
import org.springblade.modules.app.utils.UserUtils;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import com.wn.common.controller.BaseController;

/**
 * <p>
 * 入浙备案登记信息 前端控制器
 * </p>
 *
 * @author huyinuo
 * @since 2022-01-11
 */
@RestController
@RequestMapping("app/entering/zhejiang/filing")
public class EnteringZhejiangFilingController extends BaseController {

    @Autowired
    private EnteringZhejiangFilingManager enteringZhejiangFilingManager;

    @Autowired
    private UserUtils userUtils;

    //@ApiOperation(value = "新增入浙备案")
    @PostMapping
    public ResponseEntity<ResultDTO<Long>> addEnteringZhejiangFiling(@RequestBody EnteringZhejiangFilingDTO enteringZhejiangFilingDTO) {
        UserDTO userDTO = userUtils.getUser(enteringZhejiangFilingDTO.getToken());
        return success(enteringZhejiangFilingManager.addEnteringZhejiangFiling(enteringZhejiangFilingDTO, userDTO));
    }

    //@ApiOperation(value = "查询入浙备案信息")
    @GetMapping
    public ResponseEntity<ResultDTO<EnteringZhejiangFilingDTO>> getEnteringZhejiangFiling(String token) {
        UserDTO userDTO = userUtils.getUser(token);
        return success(enteringZhejiangFilingManager.getEnteringZhejiangFiling(userDTO));
    }

}

