package com.yami.shop.service.hb.impl;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.yami.shop.bean.dto.hb.HBBaseReq;
import com.yami.shop.bean.dto.hb.HBStoreBaseInfoReq;
import com.yami.shop.bean.model.ShopDetail;
import com.yami.shop.common.util.hb.HBR;
import com.yami.shop.dao.ShopDetailMapper;
import com.yami.shop.service.hb.IStoreManagementService;
import com.yami.shop.service.hb.ITransportService;
import com.yami.shop.utils.HBSignUtil;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import static com.yami.shop.common.util.HttpUtil.post;


/**
 * 门店管理服务实现
 *
 * @author fubojin
 * @version 1.0.0
 * @since 2025-09-1
 */
@Slf4j
@Service
@AllArgsConstructor
@Transactional(readOnly = true)
public class TransportService implements ITransportService {
    private final ShopDetailMapper shopDetailMapper;

    @Override
    @Transactional
    public HBR addTransport(JSONObject registerRequest) {
        try {
            String bodyStr = registerRequest.getString("body");
            log.info("开始门店注册，body：{}", bodyStr);
            JSONObject bodyJson = JSON.parseObject(bodyStr); // 使用Fastjson的解析方法
            String outStationNo = bodyJson.getString("outStationNo");

//            String hb = doGetStation(outStationNo);
//            JSONObject goodsInfoJson = JSON.parseObject(hb);
//            // 2. 逐层解析获取productHostInfoDTOS数组
//            JSONObject result = goodsInfoJson.getJSONObject("result");

            // 4. 构建响应
            return HBR.success();

        } catch (Exception e) {
            log.error("门店注册失败：{}", e.getMessage(), e);
            return HBR.error("未知异常");
        }
    }


}
