package com.unis.crk.common.controller;

import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.unis.crk.common.service.IDataCenterDownloadService;
import com.unis.crk.cplbusiness.entity.vo.DataCrkywCpljyxxDefaultVo;
import com.unis.crk.utils.ResultUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@CrossOrigin
@Api(value = "数据中心下载",tags = {"数据中心下载"})
@RestController
@RequestMapping("dataCenterDownload")
public class DataCenterDownloadController {
    @Autowired
    private IDataCenterDownloadService dataCenterDownloadService;

    /**
     * 下载用户中心用户数据信息
     * @return
     */
    @ApiOperation(value="下载", notes="下载用户中心用户数据信息")
    @PostMapping(value="/downUserInfos")
    public JSONObject downUserInfos(@RequestBody JSONObject jsonObject) {
        JSONObject returnJson = new JSONObject();
        returnJson.put("success",false);
        if (StringUtils.isEmpty(jsonObject)){
            returnJson.put("message","传入的主键为空");
            return returnJson;
        }
         returnJson = this.dataCenterDownloadService.downUserInfos(jsonObject);
        return returnJson;
    }

    @ApiOperation(value="下载", notes="下载用户中心用户数据信息")
    @PostMapping(value="/ceshi")
    public JSONObject ceshi(@RequestBody String object) throws Exception {
        JSONObject returnJson = new JSONObject();
        returnJson.put("success",false);

        returnJson = this.dataCenterDownloadService.saveScjg(object,null);
        return returnJson;
    }
}
