package com.cool.store.controller.webb;

import com.alibaba.fastjson.JSONObject;
import com.cool.store.context.CurrentUserHolder;
import com.cool.store.context.LoginUserInfo;
import com.cool.store.request.AuditApproveRequest;
import com.cool.store.request.opening.OpeningAcceptanceRequest;
import com.cool.store.request.xgj.ReceiptCallBackRequest;
import com.cool.store.response.ResponseResult;
import com.cool.store.response.bigdata.ApiResponse;
import com.cool.store.service.opening.OpeningAcceptanceService;
import com.cool.store.vo.OpenAreaTreeVO;
import com.cool.store.vo.opening.OpeningAcceptanceDetailVO;
import groovy.util.logging.Slf4j;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import org.w3c.dom.UserDataHandler;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Auther zx_szh
 * @Date 2025/12/22 14:14
 * @Version 1.0
 */
@lombok.extern.slf4j.Slf4j
@RestController
@RequestMapping("pc/OpeningAcceptance")
@Api(tags = "PC-开业验收后")
@Slf4j
public class OpeningAcceptanceController {

    @Resource
    private OpeningAcceptanceService openingAcceptanceService;

    @ApiOperation("开业验收提交/重新提交")
    @PostMapping("/submitOpeningAcceptance")
    public ResponseResult<Boolean> submitOpeningAcceptance(@RequestBody @Validated OpeningAcceptanceRequest request){
        log.info("submitOpeningAcceptance request：{}", JSONObject.toJSONString(request));
        LoginUserInfo user =  CurrentUserHolder.getUser();
        return ResponseResult.success(openingAcceptanceService.addOpeningAcceptance(request,user));
    }

    @GetMapping(path = "/getAcceptanceDetail")
    @ApiOperation("获取门店开业验收数据")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "shopId", value = "门店ID", required = true)
    })
    public ResponseResult<OpeningAcceptanceDetailVO> getAcceptanceDetail(@RequestParam(value = "shopId",required = true)Long shopId){
        return  ResponseResult.success(openingAcceptanceService.getAcceptanceDetail(shopId));
    }

    @ApiOperation("开业验收审核")
    @PostMapping("/auditOpeningAcceptance")
    public ResponseResult<Boolean> auditOpeningAcceptance(@RequestBody @Validated AuditApproveRequest request){
        log.info("auditOpeningAcceptance request：{}", JSONObject.toJSONString(request));
        LoginUserInfo user =  CurrentUserHolder.getUser();
        return ResponseResult.success(openingAcceptanceService.auditOpeningAcceptance(request,user));
    }






}
