puzhibing
4 天以前 a7d9fba4c1d0b021e017abd70d1b37ba87ebae1e
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/util/KsolarUtils.java
@@ -5,7 +5,11 @@
import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ruoyi.common.core.utils.SpringUtils;
import com.ruoyi.common.core.utils.StringUtils;
import com.ruoyi.other.domain.TPlatformConfig;
import com.ruoyi.other.service.TPlatformConfigService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
@@ -166,11 +170,18 @@
    public static String token() {
        TPlatformConfig config = SpringUtils.getBean(TPlatformConfigService.class).getOne(Wrappers.lambdaQuery(TPlatformConfig.class).eq(TPlatformConfig::getPlatformName, "科士达"));
        if (config == null) {
            config = new TPlatformConfig();
        }
        if (StringUtils.isBlank(config.getAccount()) || StringUtils.isBlank(config.getPassword())) {
            config.setAccount("环岛光伏");
            config.setPassword("cR8GGwIXMI462A8Dfl9eXg==");
        }
        HttpRequest post = HttpUtil.createPost("http://111.230.136.62:8092/authentication/form");
        post.basicAuth("kstar","kstarSecret");
        post.form("username", "环岛光伏");
        post.form("password", "cR8GGwIXMI462A8Dfl9eXg==");
        System.out.println(post);
        post.form("username", config.getAccount());
        post.form("password", config.getPassword());
        HttpResponse execute = post.execute();
        String body = execute.body();
        JSONObject jsonObject = JSONObject.parseObject(body);
@@ -402,4 +413,4 @@
    }
}
}