package com.xhpc.evcs.api;

import com.xhpc.evcs.dto.*;
import com.xhpc.evcs.encryption.EvcsConst;
import com.xhpc.evcs.utils.JSONUtil;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;

@RestController()
public class CheckChargeOrderController {

    @PostMapping("/v1/check_charge_orders")
    public CommonResponse check_charge_orders(@RequestBody CommonRequest<CheckChargeOrderRequestData> commonRequest) throws IOException {
        //todo 正在开发
        String operatorID = commonRequest.getOperatorId();
        StationInfo stationInfo = new StationInfo();
        stationInfo.setOperatorId(operatorID);
        String data = commonRequest.getData();
        CheckChargeOrderRequestData req = JSONUtil.readParams(data, CheckChargeOrderRequestData.class);
        CommonResponse response = new CommonResponse();
        response.setRet(EvcsConst.RET_SUCC);
        CheckChargeOrderResponseData resp = new CheckChargeOrderResponseData();
        resp.setCheckOrderSeq(req.getCheckOrderSeq());
        resp.setStartTime(req.getStartTime());
        resp.setEndTime(req.getEndTime());
        resp.setDisputeOrders(new DisputeOrder[]{});
        resp.setTotalDisputeMoney(0.0);
        resp.setTotalDisputeOrder(0);
        resp.setTotalDisputePower(0.0);
        response.setData(JSONUtil.toJSONString(resp));
        return response;
    }

}
