package com.nmgs.controller;

import com.nmgs.config.ResultData;
import com.nmgs.service.UserTableService;
import com.nmgs.service.impl.SolveUserAndVehcleServiceImpl;
import com.nmgs.util.PubTools;
import com.nmgs.util.WebsocketUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("solveUserAndVehclePic")
@Api(tags = "用户和车辆照片处理")
public class SolveUserAndVehclePicController {

    public SolveUserAndVehcleServiceImpl solveUserAndVehcleServiceImpl;

    @Autowired
    public void setUserTableService(SolveUserAndVehcleServiceImpl solveUserAndVehcleServiceImplT) {
        this.solveUserAndVehcleServiceImpl = solveUserAndVehcleServiceImplT;
    }

    @RequestMapping(value = "syncFile",
            method = {RequestMethod.POST}
    )
    @ApiOperation(value = "同步附件到服务器", httpMethod = "POST")
    public ResultData<String> syncFile(@RequestParam("syncType") String syncType) {
        try {
            solveUserAndVehcleServiceImpl.syncFile(syncType);
        } catch (Exception e) {
            return ResultData.fail("同步失败====>" + e.getMessage());
        }
        return ResultData.success(1, "同步成功");
    }

}
