package fcb.project.manager.core.controller;

import com.alibaba.fastjson.JSON;
import com.baomidou.mybatisplus.core.metadata.IPage;
import fcb.project.manager.base.entity.*;
import fcb.project.manager.base.enums.AuditStatus;
import fcb.project.manager.base.enums.DeleteStatus;
import fcb.project.manager.base.enums.HouseStatus;
import fcb.project.manager.base.param.usedEstate.QueryUsedEstate;
import fcb.project.manager.base.service.custom.PanoService;
import fcb.project.manager.base.service.impl.TmAuditLogServiceImpl;
import fcb.project.manager.base.service.impl.TmAuditServiceImpl;
import fcb.project.manager.base.service.impl.TmHouseServiceImpl;
import fcb.project.manager.base.service.impl.TmOperationServiceImpl;
import fcb.project.manager.base.utils.DataUtils;
import fcb.project.manager.base.utils.DateUtil;
import fcb.project.manager.base.utils.ExcelUtil;
import fcb.project.manager.core.feignInterfaces.SceneFeign;
import fdage.back.sdk.base.entity.Result;
import fdage.back.sdk.base.enums.ResultCodeEnum;
import fdage.back.sdk.base.exception.CommonBaseException;
import fdage.back.sdk.base.uuid.SnowFlakeUUidUtils;
import io.swagger.annotations.*;
import lombok.extern.log4j.Log4j2;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
import java.util.stream.Collectors;

/**
 * 2 * @Author: Abner
 * 3 * @Date: 2021/1/8 11:19
 * 4
 */
@Api(tags = "二手房审核相关接口")
@RestController
@RequestMapping("fcb/project/usedaudit")
@Log4j2
public class UsedAuditController extends BaseController{


    @PostMapping("/queryOrSearchList")
    @ApiOperation(value = "根据条件拉取所有审批记录")
    @ApiResponses({
            @ApiResponse(code = 0,message = "操作成功",response = QueryUsedEstate.class)
    })
    public Result<Object> queryList(@RequestBody QueryUsedEstate queryUsedEstate){

        return  Result.success();
    }

    @PostMapping("/queryAuditLogList")
    @ApiOperation(value = "根据条件拉取所有审批记录")
    @ApiResponses({
            @ApiResponse(code = 0,message = "操作成功",response = QueryUsedEstate.class)
    })

    public Result<Object> queryAuditLogList(@RequestBody QueryUsedEstate queryUsedEstate){

        return  Result.success();
    }



    @PostMapping("/doAudit")
    @ApiOperation(value = "审核")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "审核记录ID", paramType = "query", required = true, dataType = "String"),
            @ApiImplicitParam(name = "auditStatus", value = "审核状态: 0->待审核;1->已审核;-1->不通过", paramType = "query", required = true, dataType = "Integer"),
            @ApiImplicitParam(name = "auditRemark", value = "审核备注", paramType = "query", required = true, dataType = "String"),
    })
    @Transactional(rollbackFor = Exception.class)
    public Result<Object> audit(@RequestBody AuditRequestBean auditRequestBean , HttpServletRequest request){


        return Result.success("审核成功" );
    }

    @PostMapping("/online")
    @ApiOperation(value = "上线/下线")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "id", value = "房源ID", paramType = "query", required = false, dataType = "String"),
            @ApiImplicitParam(name = "online", value = "是否上线：1->上线;-0->下线", paramType = "query", required = false, dataType = "Integer"),
            @ApiImplicitParam(name = "searchType", value = "类型  1：小区 2：房源", paramType = "query", required = false, dataType = "Integer"),
    })
    @Transactional(rollbackFor = Exception.class)
    public Result<Object> online(@RequestBody QueryUsedEstate queryUsedEstate){


        return Result.success();
    }

    @PostMapping("/exportAuditHouseList")
    @ApiOperation(value = "导出所有审核记录")
    public Result exportAuditHouseList(@RequestBody QueryUsedEstate queryUsedEstate) throws Exception{

        return Result.success();
    }


}
