Commit 6071cb0b authored by caotao's avatar caotao

新增首航请求工具类

parent e70fe2d5
...@@ -34,10 +34,10 @@ import org.typroject.tyboot.core.restful.exception.GlobalExceptionHandler; ...@@ -34,10 +34,10 @@ import org.typroject.tyboot.core.restful.exception.GlobalExceptionHandler;
@EnableTransactionManagement @EnableTransactionManagement
@EnableConfigurationProperties @EnableConfigurationProperties
@ServletComponentScan @ServletComponentScan
@EnableDiscoveryClient //@EnableDiscoveryClient
@EnableFeignClients //@EnableFeignClients
@EnableAsync @EnableAsync
@EnableEurekaClient //@EnableEurekaClient
@EnableScheduling @EnableScheduling
@MapperScan(value = { "org.typroject.tyboot.*.*.face.orm.dao", "com.yeejoin.amos.api.*.face.orm.dao", @MapperScan(value = { "org.typroject.tyboot.*.*.face.orm.dao", "com.yeejoin.amos.api.*.face.orm.dao",
"org.typroject.tyboot.face.*.orm.dao*", "com.yeejoin.amos.boot.biz.common.dao.mapper" }) "org.typroject.tyboot.face.*.orm.dao*", "com.yeejoin.amos.boot.biz.common.dao.mapper" })
......
...@@ -31,7 +31,7 @@ public class SofarRequestUtil { ...@@ -31,7 +31,7 @@ public class SofarRequestUtil {
public HashMap<String, String> getHeaderOfSofar() { public HashMap<String, String> getHeaderOfSofar() {
HashMap<String,String> requestHeader = new HashMap<>(); HashMap<String,String> requestHeader = new HashMap<>();
if(ObjectUtil.isNotEmpty(redisUtils.get(redisKey))){ if(ObjectUtil.isNotEmpty(redisUtils.get(redisKey))){
requestHeader.put("token",redisUtils.get(redisKey).toString()); requestHeader.put("authorization",redisUtils.get(redisKey).toString());
return requestHeader; return requestHeader;
} }
HashMap<String, Object> map = new HashMap<>(); HashMap<String, Object> map = new HashMap<>();
...@@ -45,8 +45,7 @@ public class SofarRequestUtil { ...@@ -45,8 +45,7 @@ public class SofarRequestUtil {
String response = HttpUtil.createPost(url).body(body).execute().body(); String response = HttpUtil.createPost(url).body(body).execute().body();
JSONObject jsonObject = JSON.parseObject(response); JSONObject jsonObject = JSON.parseObject(response);
if(jsonObject.getString("msg").equals("success")){ if(jsonObject.getString("msg").equals("success")){
JSONObject jsonObject1 = jsonObject.getJSONObject("data"); String token = jsonObject.getString("data");
String token = jsonObject1.getString("token");
requestHeader.put("authorization",token); requestHeader.put("authorization",token);
redisUtils.set(redisKey,token,5183900); redisUtils.set(redisKey,token,5183900);
} }
...@@ -72,8 +71,9 @@ public class SofarRequestUtil { ...@@ -72,8 +71,9 @@ public class SofarRequestUtil {
try { try {
HashMap<String, String> headMap = getHeaderOfSofar(); HashMap<String, String> headMap = getHeaderOfSofar();
String url = GoodWeConstant.baseurl + apiurl; String url = SoFarConstant.baseurl + apiurl;
respone = sendRequest(requestMethod, url, requestParmInfo, headMap); respone = sendRequest(requestMethod, url, requestParmInfo, headMap);
JSONObject jsonObject = JSONObject.parseObject(respone);
// jsonArray = handlerResponseByResultResolverule(ResultResolveRule, respone); // jsonArray = handlerResponseByResultResolverule(ResultResolveRule, respone);
// if (!ObjectUtils.isEmpty(jsonArray)) { // if (!ObjectUtils.isEmpty(jsonArray)) {
// result = JSONArray.parseArray(jsonArray.toJSONString(), tClass); // result = JSONArray.parseArray(jsonArray.toJSONString(), tClass);
......
...@@ -25,7 +25,7 @@ public class SoFarConstant { ...@@ -25,7 +25,7 @@ public class SoFarConstant {
public static String password = "ZXNK123456.."; public static String password = "ZXNK123456..";
public static String tokenurl = "/account/auth/createToken"; public static String tokenurl = "/account/auth/createToken";
public static String stationListUrl = "/api/OpenApi/GetUserPowerStation"; public static String stationListUrl = "/station/v1.0/list";
public static String stationListStatusUrl = "/api/OpenApi/QueryPowerStationMonitor"; public static String stationListStatusUrl = "/api/OpenApi/QueryPowerStationMonitor";
public static String stationDetailUrl = "/api/OpenApi/GetPowerStationMonitorDetail"; public static String stationDetailUrl = "/api/OpenApi/GetPowerStationMonitorDetail";
public static String collectorListUrl = "/v1/api/collectorList"; public static String collectorListUrl = "/v1/api/collectorList";
......
...@@ -2,11 +2,9 @@ package com.yeejoin.amos.api.householdapi.controller; ...@@ -2,11 +2,9 @@ package com.yeejoin.amos.api.householdapi.controller;
import com.yeejoin.amos.api.householdapi.Utils.GoodWeRequestUtil; import com.yeejoin.amos.api.householdapi.Utils.GoodWeRequestUtil;
import com.yeejoin.amos.api.householdapi.Utils.HouseholdPvUtils; import com.yeejoin.amos.api.householdapi.Utils.HouseholdPvUtils;
import com.yeejoin.amos.api.householdapi.face.service.GoLangDataAcquisitionService; import com.yeejoin.amos.api.householdapi.face.service.*;
import com.yeejoin.amos.api.householdapi.face.service.GoodWeDataAcquisitionService;
import com.yeejoin.amos.api.householdapi.face.service.ImasterDataService;
import com.yeejoin.amos.api.householdapi.face.service.KSolarDataAcquisitionService;
import com.yeejoin.amos.api.householdapi.face.service.impl.ImasterDataServiceImpl; import com.yeejoin.amos.api.householdapi.face.service.impl.ImasterDataServiceImpl;
import com.yeejoin.amos.api.householdapi.face.service.impl.SofarDataAcquisitionServiceImpl;
import fastjson.JSON; import fastjson.JSON;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
...@@ -40,6 +38,8 @@ public class HouseholdTestController { ...@@ -40,6 +38,8 @@ public class HouseholdTestController {
private ImasterDataService imasterDataService; private ImasterDataService imasterDataService;
@Autowired @Autowired
private GoodWeDataAcquisitionService goodWeDataAcquisitionService; private GoodWeDataAcquisitionService goodWeDataAcquisitionService;
@Autowired
private SofarDataAcquisitionService sofarDataAcquisitionService;
/** /**
...@@ -83,7 +83,7 @@ public class HouseholdTestController { ...@@ -83,7 +83,7 @@ public class HouseholdTestController {
@PostMapping(value = "/sofarnew") @PostMapping(value = "/sofarnew")
@ApiOperation(httpMethod = "POST", value = "首航", notes = "首航") @ApiOperation(httpMethod = "POST", value = "首航", notes = "首航")
public void sofarnew() throws IOException { public void sofarnew() throws IOException {
// goLangDataAcquisitionService.stationList(); sofarDataAcquisitionService.stationList();
// goLangDataAcquisitionService.stationDetail(); // goLangDataAcquisitionService.stationDetail();
// goLangDataAcquisitionService.collectorList(); // goLangDataAcquisitionService.collectorList();
// goLangDataAcquisitionService.inverterList(); // goLangDataAcquisitionService.inverterList();
......
package com.yeejoin.amos.api.householdapi.face.service.impl;
import com.yeejoin.amos.api.householdapi.Utils.SofarRequestUtil;
import com.yeejoin.amos.api.householdapi.constant.SoFarConstant;
import com.yeejoin.amos.api.householdapi.face.orm.houseapi.entity.tdeingine.GolangStationList;
import com.yeejoin.amos.api.householdapi.face.service.SofarDataAcquisitionService;
import fastjson.JSON;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.Map;
@Service
public class SofarDataAcquisitionServiceImpl implements SofarDataAcquisitionService {
@Autowired
private SofarRequestUtil requestUtil;
@Override
public void stationList() {
Map<String, Object> requestInfo = new HashMap<>();
requestInfo.put("page", 1);
requestInfo.put("size", 1000);
String param = JSON.toJSONString(requestInfo);
requestUtil.getResPonse(SoFarConstant.stationListUrl,SoFarConstant.requestPost, param, SoFarConstant.resovleRule_data, GolangStationList.class);
}
@Override
public void stationDetail() {
}
@Override
public void collectorList() {
}
@Override
public void collectorDetail() {
}
@Override
public void inverterList() {
}
@Override
public void inverterDetail() {
}
@Override
public void inverAlramInfo() {
}
}
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