Commit c6de9800 authored by caotao's avatar caotao

固德威相关代码提交

parent c66ade4f
......@@ -49,8 +49,9 @@ public class GoodWeRequestUtil {
JSONObject jsonObject = JSON.parseObject(respone);
if(jsonObject.getString("code").equals("0")){
JSONObject jsonObject1 = jsonObject.getJSONObject("data");
hashMap.put("token",jsonObject1.getString("token"));
redisUtils.expire(redisKey,jsonObject1.getLong("expire")-10);
String token = jsonObject1.getString("token");
hashMap.put("token",token);
redisUtils.set(redisKey,token,jsonObject1.getLong("expired")-10);
}
return hashMap;
}
......
......@@ -11,10 +11,11 @@ public class GoodWeConstant {
public static String baseurl = "http://openapi.sems.com.cn";
public static String account = "18679135705";
public static String password = "Lfj5705@sems";
public static String password = "Ljf5705@sems";
public static String tokenurl = "/api/OpenApi/GetToken";
public static String stationListUrl = "/api/OpenApi/GetUserPowerStation";
public static String stationDetailUrl = "/v1/api/stationDetail";
public static String stationListStatusUrl = "/api/OpenApi/QueryPowerStationMonitor";
public static String stationDetailUrl = "/api/OpenApi/GetPowerStationMonitorDetail";
public static String collectorListUrl = "/v1/api/collectorList";
public static String collectorDetailUrl = "/v1/api/collectorDetail";
public static String inverterListUrl = "/v1/api/inverterList";
......@@ -27,7 +28,7 @@ public class GoodWeConstant {
public static String inverterMonthURL ="/v1/api/inverterMonth";
public static String inverterYearURL ="/v1/api/inverterYear";
public static String resovleRule_data_page_records = "data,page,records";
public static String resovleRule_data_list = "data,page,list";
public static String resovleRule_data_list = "data,list";
public static String resovleRule_data_records = "data,records";
public static String resovleRule_data = "data";
public static String requestPost = "POST";
......
package com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine;
import lombok.Data;
@Data
public class GoodWeStationList {
private String id;
private String pw_name;
private String conn_date;
private String pw_capacity;
private String pw_type;
private String pw_inventersnum;
}
package com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
@Data
@TableName(value = "goodwe_station_monitor_list", autoResultMap = true)
public class GoodWeStationMonitorList {
@TableField("created_time")
private long createdTime;
@TableField("powerstation_id")
private String powerstation_id;
@TableField("stationname")
private String stationname;
@TableField("adcode")
private String adcode;
@TableField("location")
private String location;
@TableField("status")
private Integer status;
@TableField("pac")
private Double pac;
@TableField("capacity")
private Double capacity;
@TableField("eday")
private Double eday;
@TableField("etotal")
private Double etotal;
@TableField("powerstation_type")
private String powerstation_type;
@TableField("longitude")
private String longitude;
@TableField("latitude")
private String latitude;
@TableField("pac_kw")
private Double pac_kw;
@TableField("to_hour")
private Double to_hour;
}
package com.yeejoin.amos.api.householdapi.face.orm.mapper.tdengine;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine.GoodWeStationMonitorList;
public interface GoodWeStationMonitorListMapper extends BaseMapper<GoodWeStationMonitorList> {
}
......@@ -3,7 +3,8 @@ package com.yeejoin.amos.api.householdapi.face.service.impl;
import com.alibaba.fastjson.JSON;
import com.yeejoin.amos.api.householdapi.Utils.GoodWeRequestUtil;
import com.yeejoin.amos.api.householdapi.constant.GoodWeConstant;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine.GoodWeStationList;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine.GoodWeStationMonitorList;
import com.yeejoin.amos.api.householdapi.face.orm.mapper.tdengine.GoodWeStationMonitorListMapper;
import com.yeejoin.amos.api.householdapi.face.service.GoodWeDataAcquisitionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -14,19 +15,30 @@ import java.util.List;
public class GoodWeDataAcquisitionServiceImpl implements GoodWeDataAcquisitionService {
@Autowired
GoodWeRequestUtil goodWeRequestUtil;
@Autowired
GoodWeStationMonitorListMapper goodWeStationMonitorListMapper;
@Override
public void stationList() {
HashMap<String, Object> requestInfo = new HashMap<>();
requestInfo.put("page_index", 1);
requestInfo.put("page_size", 100);
requestInfo.put("page_size", 200);
String requstParam = JSON.toJSONString(requestInfo);
List<GoodWeStationList> goodWeStationLists =goodWeRequestUtil.getResPonse(GoodWeConstant.stationListUrl, GoodWeConstant.requestPost, requstParam, GoodWeConstant.resovleRule_data_list, GoodWeStationList.class);
goodWeStationLists.size();
List<GoodWeStationMonitorList> goodWeStationLists =goodWeRequestUtil.getResPonse(GoodWeConstant.stationListStatusUrl, GoodWeConstant.requestPost, requstParam, GoodWeConstant.resovleRule_data_list, GoodWeStationMonitorList.class);
if(goodWeStationLists.size()>0){
goodWeStationLists.forEach(goodWeStationList -> {
goodWeStationList.setCreatedTime(System.currentTimeMillis());
goodWeStationMonitorListMapper.insert(goodWeStationList);
});
}
}
@Override
public void stationDetail() {
HashMap<String, Object> requestInfo = new HashMap<>();
requestInfo.put("page_index", 1);
requestInfo.put("page_size", 200);
String requstParam = JSON.toJSONString(requestInfo);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment