package com.jjt.utils;

import cn.hutool.crypto.digest.MD5;
import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpUtil;
import cn.hutool.http.Method;
import cn.hutool.json.JSONObject;
import com.jjt.common.constant.CacheConstants;
import com.jjt.common.core.redis.RedisCache;
import com.jjt.common.core.text.Convert;
import com.jjt.common.utils.StringUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;

/**
 * IotServiceImpl$
 *
 * @author wukai
 * @date 2024/5/4 20:35
 */
@Component
@Slf4j
public class EnvPowerService {
    @Resource
    private RedisCache redisCache;
    private String uri = "http://192.168.79.21:18080/truelove/energy/manage/monthlyFinancialStatement";

    /**
     * 查询数据
     *
     * @param date sql语句
     * @return JSON数据
     */
    public JSONObject query(String date) {
        JSONObject object = new JSONObject();
        object.set("selectTime", date);
        object.set("timeType", "DAY");
        HttpRequest request = HttpUtil.createPost(uri);
        request.setMethod(Method.POST);
        request.body(object.toString());
        return IotTools.getData(request);
    }

}
