package com.cool.store.controller.webc;

import com.alibaba.fastjson.JSONObject;
import com.cool.store.dao.ShopStageInfoDAO;
import com.cool.store.dto.openPreparation.FirstOrderDTO;
import com.cool.store.entity.ShopInfoDO;
import com.cool.store.entity.ShopStageInfoDO;
import com.cool.store.enums.AuditStatusEnum;
import com.cool.store.enums.ErrorCodeEnum;
import com.cool.store.enums.point.ShopSubStageEnum;
import com.cool.store.enums.point.ShopSubStageStatusEnum;
import com.cool.store.exception.ServiceException;
import com.cool.store.response.ResponseResult;
import com.cool.store.service.*;
import com.cool.store.vo.OpeningOperationPlanVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @Auther: WangShuo
 * @Date: 2024/04/25/下午7:07
 * @Version 1.0
 * @注释:
 */
@RestController
@RequestMapping("/mini/openPreparation")
@Api(tags = "mini开业筹备")
@Slf4j
public class MiniOpenPreparationController {
    @Resource
    private OpeningOperationPlanService openingOperationPlanService;

    @Resource
    private FirstOrderService firstOrderService;


    @GetMapping("/openingOperationPlan/getPlan")
    @ApiOperation("查询开业运营方案")
    public ResponseResult<OpeningOperationPlanVO> getPlan(@RequestParam("shopId") Long shopId) {
        OpeningOperationPlanVO plan = openingOperationPlanService.getPlanByShopId(shopId);
        if (AuditStatusEnum.PASS.getCode().equals(plan.getResultType())) {
            return ResponseResult.success(plan);
        }
        log.info("运营方案待审核或未通过");
        return ResponseResult.success(null);
    }

    @GetMapping("/firstOrder/get")
    @ApiOperation("查询订货金")
    public ResponseResult<FirstOrderDTO> get(@RequestParam("shopId") Long shopId) {
        return ResponseResult.success(firstOrderService.getOrder(shopId));
    }

}
