Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-boot-biz
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
项目统一框架
amos-boot-biz
Commits
3a476ecb
Commit
3a476ecb
authored
Aug 14, 2023
by
lisong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
屏蔽无用代码,修改现场bug
parent
4a31f245
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
549 additions
and
536 deletions
+549
-536
pom.xml
amos-boot-data/amos-boot-data-accessapi/pom.xml
+6
-6
AccessapiApplication.java
.../src/main/java/com/yeejoin/amos/AccessapiApplication.java
+7
-7
HouseholdPvUtils.java
...yeejoin/amos/api/householdapi/Utils/HouseholdPvUtils.java
+276
-276
HouseholdTestController.java
.../api/householdapi/controller/HouseholdTestController.java
+50
-50
TaBusinessServiceImpl.java
.../amos/api/openapi/face/service/TaBusinessServiceImpl.java
+12
-2
DockingData.java
...c/main/java/com/yeejoin/amos/dockingData/DockingData.java
+195
-195
RegUnitInfoServiceImpl.java
...dule/tcm/flc/biz/service/impl/RegUnitInfoServiceImpl.java
+3
-0
No files found.
amos-boot-data/amos-boot-data-accessapi/pom.xml
View file @
3a476ecb
...
@@ -175,12 +175,12 @@
...
@@ -175,12 +175,12 @@
<artifactId>
hutool-all
</artifactId>
<artifactId>
hutool-all
</artifactId>
<version>
5.7.22
</version>
<version>
5.7.22
</version>
</dependency>
</dependency>
<dependency
>
<!-- <dependency>--
>
<groupId>
com.yeejoin
</groupId
>
<!-- <groupId>com.yeejoin</groupId>--
>
<artifactId>
amos-component-influxdb
</artifactId
>
<!-- <artifactId>amos-component-influxdb</artifactId>--
>
<version>
1.8.5-SNAPSHOT
</version
>
<!-- <version>1.8.5-SNAPSHOT</version>--
>
<scope>
compile
</scope
>
<!-- <scope>compile</scope>--
>
</dependency
>
<!-- </dependency>--
>
<dependency>
<dependency>
<groupId>
com.yeejoin
</groupId>
<groupId>
com.yeejoin
</groupId>
<artifactId>
amos-component-security
</artifactId>
<artifactId>
amos-component-security
</artifactId>
...
...
amos-boot-data/amos-boot-data-accessapi/src/main/java/com/yeejoin/amos/AccessapiApplication.java
View file @
3a476ecb
...
@@ -47,8 +47,8 @@ import com.yeejoin.amos.api.openapi.face.service.TaAccessConfigServiceImpl;
...
@@ -47,8 +47,8 @@ import com.yeejoin.amos.api.openapi.face.service.TaAccessConfigServiceImpl;
@ComponentScan
({
"org.typroject"
,
"com.yeejoin.amos"
})
@ComponentScan
({
"org.typroject"
,
"com.yeejoin.amos"
})
public
class
AccessapiApplication
{
public
class
AccessapiApplication
{
//
@Autowired
@Autowired
//
private TaAccessConfigServiceImpl taAccessConfigServiceImpl;
private
TaAccessConfigServiceImpl
taAccessConfigServiceImpl
;
private
static
final
Logger
logger
=
LogManager
.
getLogger
(
AccessapiApplication
.
class
);
private
static
final
Logger
logger
=
LogManager
.
getLogger
(
AccessapiApplication
.
class
);
...
@@ -69,9 +69,9 @@ public class AccessapiApplication {
...
@@ -69,9 +69,9 @@ public class AccessapiApplication {
+
path
+
"/doc.html\n"
+
"----------------------------------------------------------"
);
+
path
+
"/doc.html\n"
+
"----------------------------------------------------------"
);
}
}
//
@Bean
@Bean
//
public void initAccessConfig() {
public
void
initAccessConfig
()
{
//
taAccessConfigServiceImpl.refreshConfig();
taAccessConfigServiceImpl
.
refreshConfig
();
//
taAccessConfigServiceImpl.startTask();
taAccessConfigServiceImpl
.
startTask
();
//
}
}
}
}
amos-boot-data/amos-boot-data-accessapi/src/main/java/com/yeejoin/amos/api/householdapi/Utils/HouseholdPvUtils.java
View file @
3a476ecb
package
com
.
yeejoin
.
amos
.
api
.
householdapi
.
Utils
;
//
package com.yeejoin.amos.api.householdapi.Utils;
//
import
cn.hutool.Hutool
;
//
import cn.hutool.Hutool;
import
cn.hutool.core.util.ObjectUtil
;
//
import cn.hutool.core.util.ObjectUtil;
import
cn.hutool.http.HttpUtil
;
//
import cn.hutool.http.HttpUtil;
import
com.alibaba.fastjson.JSON
;
//
import com.alibaba.fastjson.JSON;
import
com.alibaba.fastjson.JSONArray
;
//
import com.alibaba.fastjson.JSONArray;
import
com.alibaba.fastjson.JSONObject
;
//
import com.alibaba.fastjson.JSONObject;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
//
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import
com.qiniu.util.Json
;
//
import com.qiniu.util.Json;
import
com.yeejoin.amos.api.householdapi.face.model.HouseholdPvApiDto
;
//
import com.yeejoin.amos.api.householdapi.face.model.HouseholdPvApiDto;
import
com.yeejoin.amos.api.householdapi.face.model.HouseholdPvProducerInfoDto
;
//
import com.yeejoin.amos.api.householdapi.face.model.HouseholdPvProducerInfoDto;
import
com.yeejoin.amos.api.householdapi.face.orm.entity.HouseholdPvProducerInfo
;
//
import com.yeejoin.amos.api.householdapi.face.orm.entity.HouseholdPvProducerInfo;
import
com.yeejoin.amos.api.householdapi.face.service.impl.HouseholdPvApiServiceImpl
;
//
import com.yeejoin.amos.api.householdapi.face.service.impl.HouseholdPvApiServiceImpl;
import
com.yeejoin.amos.api.householdapi.face.service.impl.HouseholdPvProducerInfoServiceImpl
;
//
import com.yeejoin.amos.api.householdapi.face.service.impl.HouseholdPvProducerInfoServiceImpl;
import
com.yeejoin.amos.component.influxdb.InfluxDbConnection
;
//
import com.yeejoin.amos.component.influxdb.InfluxDbConnection;
import
com.yeejoin.amos.openapi.enums.PVProducerInfoEnum
;
//
import com.yeejoin.amos.openapi.enums.PVProducerInfoEnum;
import
io.swagger.annotations.ApiModelProperty
;
//
import io.swagger.annotations.ApiModelProperty;
import
io.swagger.models.auth.In
;
//
import io.swagger.models.auth.In;
import
org.springframework.beans.factory.annotation.Autowired
;
//
import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Component
;
//
import org.springframework.stereotype.Component;
import
org.typroject.tyboot.component.cache.Redis
;
//
import org.typroject.tyboot.component.cache.Redis;
//
import
java.util.*
;
//
import java.util.*;
//
@Component
//
@Component
public
class
HouseholdPvUtils
{
//
public class HouseholdPvUtils {
@Autowired
//
@Autowired
private
HouseholdPvProducerInfoServiceImpl
householdPvProducerInfoServiceImpl
;
//
private HouseholdPvProducerInfoServiceImpl householdPvProducerInfoServiceImpl;
@Autowired
//
@Autowired
private
HouseholdPvApiServiceImpl
householdPvApiServiceImpl
;
//
private HouseholdPvApiServiceImpl householdPvApiServiceImpl;
//
@Autowired
//
@Autowired
InfluxDbConnection
influxDbConnection
;
//
InfluxDbConnection influxDbConnection;
//
private
final
static
String
API_REDIS_PREFIX
=
"HOUSEHOLD_API_CACHE_"
+
//
private final static String API_REDIS_PREFIX = "HOUSEHOLD_API_CACHE_" +
""
;
//
"";
//
/**
//
/**
* @param code 厂商code
//
* @param code 厂商code
* @return HashMap<String, Object> 发送请求前的准备 准备header信息
//
* @return HashMap<String, Object> 发送请求前的准备 准备header信息
* @deprecated 根据厂商编码获取厂商的hearer
//
* @deprecated 根据厂商编码获取厂商的hearer
*/
//
*/
public
HashMap
<
String
,
Object
>
getHeaderByProducerCode
(
String
code
)
{
//
public HashMap<String, Object> getHeaderByProducerCode(String code) {
HashMap
<
String
,
Object
>
hashMap
=
new
HashMap
<>();
//
HashMap<String, Object> hashMap = new HashMap<>();
HashMap
<
String
,
String
>
hashMaphead
=
new
HashMap
<>();
//
HashMap<String, String> hashMaphead = new HashMap<>();
HouseholdPvProducerInfo
householdPvProducerInfo
=
this
.
householdPvProducerInfoServiceImpl
.
queryForHouseholdPvProducerInfoByCode
(
code
);
//
HouseholdPvProducerInfo householdPvProducerInfo = this.householdPvProducerInfoServiceImpl.queryForHouseholdPvProducerInfoByCode(code);
String
url
=
householdPvProducerInfo
.
getProdcerUrl
()
+
householdPvProducerInfo
.
getTokenUrl
();
//
String url = householdPvProducerInfo.getProdcerUrl() + householdPvProducerInfo.getTokenUrl();
hashMap
.
put
(
"apiurl"
,
householdPvProducerInfo
.
getProdcerUrl
());
//
hashMap.put("apiurl", householdPvProducerInfo.getProdcerUrl());
if
(
PVProducerInfoEnum
.
GDW
.
getCode
().
equals
(
code
))
{
//
if (PVProducerInfoEnum.GDW.getCode().equals(code)) {
HashMap
<
String
,
String
>
map
=
new
HashMap
<>();
//
HashMap<String, String> map = new HashMap<>();
map
.
put
(
"account"
,
householdPvProducerInfo
.
getProdcerAccount
());
//
map.put("account", householdPvProducerInfo.getProdcerAccount());
map
.
put
(
"pwd"
,
householdPvProducerInfo
.
getProdcerPassword
());
//
map.put("pwd", householdPvProducerInfo.getProdcerPassword());
String
body
=
JSON
.
toJSONString
(
map
);
//
String body = JSON.toJSONString(map);
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
.
get
(
"data"
)
!=
null
)
{
//
if (jsonObject.get("data") != null) {
JSONObject
jsonObject1
=
(
JSONObject
)
jsonObject
.
get
(
"data"
);
//
JSONObject jsonObject1 = (JSONObject) jsonObject.get("data");
hashMaphead
.
put
(
"token"
,
(
String
)
jsonObject1
.
get
(
"token"
));
//
hashMaphead.put("token", (String) jsonObject1.get("token"));
hashMap
.
put
(
"header"
,
hashMaphead
);
//
hashMap.put("header", hashMaphead);
}
//
}
}
else
if
(
PVProducerInfoEnum
.
SH
.
getCode
().
equals
(
code
))
{
//
} else if (PVProducerInfoEnum.SH.getCode().equals(code)) {
HashMap
<
String
,
Object
>
map
=
new
HashMap
<>();
//
HashMap<String, Object> map = new HashMap<>();
map
.
put
(
"accountName"
,
householdPvProducerInfo
.
getProdcerAccount
());
//
map.put("accountName", householdPvProducerInfo.getProdcerAccount());
map
.
put
(
"appId"
,
householdPvProducerInfo
.
getProdcerAppid
());
//
map.put("appId", householdPvProducerInfo.getProdcerAppid());
map
.
put
(
"appSecret"
,
householdPvProducerInfo
.
getProdcerAppsecret
());
//
map.put("appSecret", householdPvProducerInfo.getProdcerAppsecret());
map
.
put
(
"corporationId"
,
householdPvProducerInfo
.
getCorporationId
());
//
map.put("corporationId", householdPvProducerInfo.getCorporationId());
map
.
put
(
"accountType"
,
2
);
//
map.put("accountType", 2);
String
body
=
JSON
.
toJSONString
(
map
);
//
String body = JSON.toJSONString(map);
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);
hashMaphead
.
put
(
"Authorization"
,
(
String
)
jsonObject
.
get
(
"data"
));
//
hashMaphead.put("Authorization", (String) jsonObject.get("data"));
hashMap
.
put
(
"header"
,
hashMaphead
);
//
hashMap.put("header", hashMaphead);
}
else
if
(
PVProducerInfoEnum
.
JLY
.
getCode
().
equals
(
code
))
{
//
} else if (PVProducerInfoEnum.JLY.getCode().equals(code)) {
hashMaphead
.
put
(
"Content-type"
,
"application/json;charset=UTF-8"
);
//
hashMaphead.put("Content-type", "application/json;charset=UTF-8");
hashMaphead
.
put
(
"Authorization"
,
"API "
+
householdPvProducerInfo
.
getProdcerAppid
());
//
hashMaphead.put("Authorization", "API " + householdPvProducerInfo.getProdcerAppid());
hashMaphead
.
put
(
"Content-MD5"
,
null
);
//
hashMaphead.put("Content-MD5", null);
hashMaphead
.
put
(
"Date"
,
GoLangHeaderUtils
.
getGMTTime
());
//
hashMaphead.put("Date", GoLangHeaderUtils.getGMTTime());
hashMap
.
put
(
"header"
,
hashMaphead
);
//
hashMap.put("header", hashMaphead);
hashMap
.
put
(
"appsecret"
,
householdPvProducerInfo
.
getProdcerAppsecret
());
//
hashMap.put("appsecret", householdPvProducerInfo.getProdcerAppsecret());
}
//
}
return
hashMap
;
//
return hashMap;
}
//
}
//
/**
//
/**
* @param seq apiId 数据库中维护的的apiId
//
* @param seq apiId 数据库中维护的的apiId
* @return String 请求返回的response字符串
//
* @return String 请求返回的response字符串
*/
//
*/
public
String
gerResponseByAPiID
(
Long
seq
)
{
//
public String gerResponseByAPiID(Long seq) {
List
cacheParams
=
new
ArrayList
();
//
List cacheParams = new ArrayList();
String
respone
=
""
;
//
String respone = "";
String
params
=
""
;
//
String params = "";
JSONArray
jsonArray
=
null
;
//
JSONArray jsonArray = null;
HouseholdPvApiDto
householdPvApiDto
=
this
.
householdPvApiServiceImpl
.
queryBySeq
(
seq
);
//
HouseholdPvApiDto householdPvApiDto = this.householdPvApiServiceImpl.queryBySeq(seq);
HashMap
<
String
,
Object
>
producerInfo
=
this
.
getHeaderByProducerCode
(
householdPvApiDto
.
getProducerId
());
//
HashMap<String, Object> producerInfo = this.getHeaderByProducerCode(householdPvApiDto.getProducerId());
String
baseurl
=
(
String
)
producerInfo
.
get
(
"apiurl"
);
//
String baseurl = (String) producerInfo.get("apiurl");
HashMap
<
String
,
String
>
headMap
=
(
HashMap
<
String
,
String
>)
producerInfo
.
get
(
"header"
);
//
HashMap<String, String> headMap = (HashMap<String, String>) producerInfo.get("header");
String
orginalAuthorization
=
headMap
.
get
(
"Authorization"
)
+
":"
;
//
String orginalAuthorization = headMap.get("Authorization") + ":";
String
url
=
baseurl
+
householdPvApiDto
.
getApiUrl
();
//
String url = baseurl + householdPvApiDto.getApiUrl();
String
appsecret
=
(
String
)
producerInfo
.
get
(
"appsecret"
);
//
String appsecret = (String) producerInfo.get("appsecret");
if
(
ObjectUtil
.
isNotEmpty
(
householdPvApiDto
.
getDependecyApiId
()))
{
//
if (ObjectUtil.isNotEmpty(householdPvApiDto.getDependecyApiId())) {
String
RedisKey
=
API_REDIS_PREFIX
+
householdPvApiDto
.
getDependecyApiId
();
//
String RedisKey = API_REDIS_PREFIX + householdPvApiDto.getDependecyApiId();
cacheParams
=
Redis
.
getRedisTemplate
().
opsForList
().
range
(
RedisKey
,
0
,
-
1
);
//
cacheParams = Redis.getRedisTemplate().opsForList().range(RedisKey, 0, -1);
if
(
cacheParams
.
size
()
>
0
)
{
//
if (cacheParams.size() > 0) {
for
(
int
i
=
0
;
i
<
cacheParams
.
size
();
i
++)
{
//
for (int i = 0; i < cacheParams.size(); i++) {
JSONObject
jsonObject
=
JSON
.
parseObject
(
householdPvApiDto
.
getParamInfo
());
//
JSONObject jsonObject = JSON.parseObject(householdPvApiDto.getParamInfo());
if
(
ObjectUtil
.
isNotEmpty
(
householdPvApiDto
.
getDependApiParamKey
()))
{
//
if (ObjectUtil.isNotEmpty(householdPvApiDto.getDependApiParamKey())) {
jsonObject
.
put
(
householdPvApiDto
.
getDependApiParamKey
(),
cacheParams
.
get
(
i
));
//
jsonObject.put(householdPvApiDto.getDependApiParamKey(), cacheParams.get(i));
}
//
}
params
=
jsonObject
.
toJSONString
();
//
params = jsonObject.toJSONString();
if
(
PVProducerInfoEnum
.
JLY
.
getCode
().
equals
(
householdPvApiDto
.
getProducerId
()))
{
//
if (PVProducerInfoEnum.JLY.getCode().equals(householdPvApiDto.getProducerId())) {
JLYHeaderMapHandler
(
params
,
householdPvApiDto
,
headMap
,
orginalAuthorization
,
appsecret
,
(
String
)
cacheParams
.
get
(
i
));
//
JLYHeaderMapHandler(params, householdPvApiDto, headMap, orginalAuthorization, appsecret, (String) cacheParams.get(i));
}
//
}
try
{
//
try {
Thread
.
sleep
(
500
);
//
Thread.sleep(500);
respone
=
sendRequest
(
householdPvApiDto
.
getRequestMethod
(),
url
,
params
,
headMap
);
//
respone = sendRequest(householdPvApiDto.getRequestMethod(), url, params, headMap);
jsonArray
=
handlerResponseByResultResolverule
(
householdPvApiDto
.
getResultResolveRule
(),
respone
);
//
jsonArray = handlerResponseByResultResolverule(householdPvApiDto.getResultResolveRule(), respone);
handleResponseAndCacheData
(
String
.
valueOf
(
seq
),
householdPvApiDto
.
getCacheField
(),
jsonArray
,
householdPvApiDto
.
getMeasurement
());
//
handleResponseAndCacheData(String.valueOf(seq), householdPvApiDto.getCacheField(), jsonArray, householdPvApiDto.getMeasurement());
}
catch
(
Exception
e
)
{
//
} catch (Exception e) {
e
.
printStackTrace
();
//
e.printStackTrace();
}
finally
{
//
} finally {
continue
;
//
continue;
}
//
}
}
//
}
}
//
}
}
else
{
//
} else {
if
(
PVProducerInfoEnum
.
JLY
.
getCode
().
equals
(
householdPvApiDto
.
getProducerId
()))
{
//
if (PVProducerInfoEnum.JLY.getCode().equals(householdPvApiDto.getProducerId())) {
JLYHeaderMapHandler
(
params
,
householdPvApiDto
,
headMap
,
orginalAuthorization
,
appsecret
,
null
);
//
JLYHeaderMapHandler(params, householdPvApiDto, headMap, orginalAuthorization, appsecret, null);
}
//
}
respone
=
sendRequest
(
householdPvApiDto
.
getRequestMethod
(),
url
,
householdPvApiDto
.
getParamInfo
(),
headMap
);
//
respone = sendRequest(householdPvApiDto.getRequestMethod(), url, householdPvApiDto.getParamInfo(), headMap);
jsonArray
=
handlerResponseByResultResolverule
(
householdPvApiDto
.
getResultResolveRule
(),
respone
);
//
jsonArray = handlerResponseByResultResolverule(householdPvApiDto.getResultResolveRule(), respone);
handleResponseAndCacheData
(
String
.
valueOf
(
seq
),
householdPvApiDto
.
getCacheField
(),
jsonArray
,
householdPvApiDto
.
getMeasurement
());
//
handleResponseAndCacheData(String.valueOf(seq), householdPvApiDto.getCacheField(), jsonArray, householdPvApiDto.getMeasurement());
if
(
ObjectUtil
.
isNotEmpty
(
householdPvApiDto
.
getIsPage
()))
{
//
if (ObjectUtil.isNotEmpty(householdPvApiDto.getIsPage())) {
Integer
size
=
getPagesize
(
householdPvApiDto
.
getPagesizeResolveRule
(),
respone
);
//
Integer size = getPagesize(householdPvApiDto.getPagesizeResolveRule(), respone);
for
(
int
i
=
1
;
i
<
size
;
i
++)
{
//
for (int i = 1; i < size; i++) {
JSONObject
jsonObject
=
JSON
.
parseObject
(
householdPvApiDto
.
getParamInfo
());
//
JSONObject jsonObject = JSON.parseObject(householdPvApiDto.getParamInfo());
if
(
ObjectUtil
.
isNotEmpty
(
householdPvApiDto
.
getPageField
()))
{
//
if (ObjectUtil.isNotEmpty(householdPvApiDto.getPageField())) {
jsonObject
.
put
(
householdPvApiDto
.
getPageField
(),
i
+
1
);
//
jsonObject.put(householdPvApiDto.getPageField(), i + 1);
}
//
}
params
=
jsonObject
.
toJSONString
();
//
params = jsonObject.toJSONString();
if
(
PVProducerInfoEnum
.
JLY
.
getCode
().
equals
(
householdPvApiDto
.
getProducerId
()))
{
//
if (PVProducerInfoEnum.JLY.getCode().equals(householdPvApiDto.getProducerId())) {
JLYHeaderMapHandler
(
params
,
householdPvApiDto
,
headMap
,
orginalAuthorization
,
appsecret
,
null
);
//
JLYHeaderMapHandler(params, householdPvApiDto, headMap, orginalAuthorization, appsecret, null);
}
//
}
respone
=
sendRequest
(
householdPvApiDto
.
getRequestMethod
(),
url
,
householdPvApiDto
.
getParamInfo
(),
headMap
);
//
respone = sendRequest(householdPvApiDto.getRequestMethod(), url, householdPvApiDto.getParamInfo(), headMap);
jsonArray
=
handlerResponseByResultResolverule
(
householdPvApiDto
.
getResultResolveRule
(),
respone
);
//
jsonArray = handlerResponseByResultResolverule(householdPvApiDto.getResultResolveRule(), respone);
handleResponseAndCacheData
(
String
.
valueOf
(
seq
),
householdPvApiDto
.
getCacheField
(),
jsonArray
,
householdPvApiDto
.
getMeasurement
());
//
handleResponseAndCacheData(String.valueOf(seq), householdPvApiDto.getCacheField(), jsonArray, householdPvApiDto.getMeasurement());
}
//
}
}
//
}
//
}
//
}
return
respone
;
//
return respone;
}
//
}
//
/**
//
/**
* @param resultResovle 请求返回的解析规则 来源与数据库
//
* @param resultResovle 请求返回的解析规则 来源与数据库
* @param response 请求返回的字符串
//
* @param response 请求返回的字符串
* @return 解析后的数据
//
* @return 解析后的数据
*/
//
*/
public
JSONArray
handlerResponseByResultResolverule
(
String
resultResovle
,
String
response
)
{
//
public JSONArray handlerResponseByResultResolverule(String resultResovle, String response) {
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
response
);
//
JSONObject jsonObject = JSONObject.parseObject(response);
JSONArray
jsonArray
=
new
JSONArray
();
//
JSONArray jsonArray = new JSONArray();
if
(
ObjectUtil
.
isNotEmpty
(
resultResovle
))
{
//
if (ObjectUtil.isNotEmpty(resultResovle)) {
String
[]
rules
=
resultResovle
.
split
(
","
);
//
String[] rules = resultResovle.split(",");
if
(
rules
.
length
>
0
)
{
//
if (rules.length > 0) {
for
(
int
i
=
0
;
i
<
rules
.
length
;
i
++)
{
//
for (int i = 0; i < rules.length; i++) {
try
{
//
try {
jsonObject
=
(
JSONObject
)
jsonObject
.
get
(
rules
[
i
]);
//
jsonObject = (JSONObject) jsonObject.get(rules[i]);
if
(
jsonObject
==
null
)
{
//
if (jsonObject == null) {
jsonArray
=
(
JSONArray
)
jsonObject
.
get
(
rules
[
i
]);
//
jsonArray = (JSONArray) jsonObject.get(rules[i]);
}
//
}
}
catch
(
Exception
exception
)
{
//
} catch (Exception exception) {
jsonArray
=
(
JSONArray
)
jsonObject
.
get
(
rules
[
i
]);
//
jsonArray = (JSONArray) jsonObject.get(rules[i]);
}
//
}
}
//
}
}
//
}
if
(
jsonArray
.
size
()
==
0
)
{
//
if (jsonArray.size() == 0) {
jsonArray
.
add
(
jsonObject
);
//
jsonArray.add(jsonObject);
}
//
}
}
//
}
return
jsonArray
;
//
return jsonArray;
}
//
}
//
/**
//
/**
* @param seq apiID
//
* @param seq apiID
* @param cacheField 要缓存的字段
//
* @param cacheField 要缓存的字段
* @param jsonArray 处理后的数据请求
//
* @param jsonArray 处理后的数据请求
* @param measurement 要在influxdb中存储的数
//
* @param measurement 要在influxdb中存储的数
* @describe 该方法用于缓存需要缓存的字段 且将需要入库的数据进行入库
//
* @describe 该方法用于缓存需要缓存的字段 且将需要入库的数据进行入库
*/
//
*/
public
void
handleResponseAndCacheData
(
String
seq
,
String
cacheField
,
JSONArray
jsonArray
,
String
measurement
)
{
//
public void handleResponseAndCacheData(String seq, String cacheField, JSONArray jsonArray, String measurement) {
String
apiID
=
API_REDIS_PREFIX
+
seq
;
//
String apiID = API_REDIS_PREFIX + seq;
List
list
=
new
ArrayList
();
//
List list = new ArrayList();
List
saveList
=
new
ArrayList
();
//
List saveList = new ArrayList();
if
(
jsonArray
.
size
()
>
0
)
{
//
if (jsonArray.size() > 0) {
for
(
Object
o
:
jsonArray
)
{
//
for (Object o : jsonArray) {
Map
<
String
,
Object
>
maps1
=
(
Map
<
String
,
Object
>)
o
;
//
Map<String, Object> maps1 = (Map<String, Object>) o;
Set
<
String
>
keys
=
maps1
.
keySet
();
//
Set<String> keys = maps1.keySet();
keys
.
forEach
((
key
)
->
{
//
keys.forEach((key) -> {
maps1
.
put
(
key
,
maps1
.
get
(
key
).
toString
());
//
maps1.put(key, maps1.get(key).toString());
});
//
});
if
(
cacheField
!=
null
)
{
//
if (cacheField != null) {
list
.
add
(
maps1
.
get
(
cacheField
));
//
list.add(maps1.get(cacheField));
}
//
}
Map
<
String
,
String
>
maps2
=
new
HashMap
<>();
//
Map<String, String> maps2 = new HashMap<>();
maps2
.
put
(
"key"
,
UUID
.
randomUUID
().
toString
());
//
maps2.put("key", UUID.randomUUID().toString());
if
(
measurement
!=
null
)
{
//
if (measurement != null) {
influxDbConnection
.
insert
(
measurement
,
maps2
,
maps1
);
//
influxDbConnection.insert(measurement, maps2, maps1);
}
//
}
//
}
//
}
}
//
}
if
(
cacheField
!=
null
)
{
//
if (cacheField != null) {
saveList
=
Redis
.
getRedisTemplate
().
opsForList
().
range
(
apiID
,
0
,
-
1
);
//
saveList = Redis.getRedisTemplate().opsForList().range(apiID, 0, -1);
if
(
saveList
.
size
()
==
0
)
{
//
if (saveList.size() == 0) {
Redis
.
getRedisTemplate
().
opsForList
().
leftPushAll
(
apiID
,
list
);
//
Redis.getRedisTemplate().opsForList().leftPushAll(apiID, list);
}
//
}
saveList
=
Redis
.
getRedisTemplate
().
opsForList
().
range
(
apiID
,
0
,
-
1
);
//
saveList = Redis.getRedisTemplate().opsForList().range(apiID, 0, -1);
if
(
saveList
.
size
()
!=
list
.
size
())
{
//
if (saveList.size() != list.size()) {
Redis
.
getRedisTemplate
().
delete
(
apiID
);
//
Redis.getRedisTemplate().delete(apiID);
Redis
.
getRedisTemplate
().
opsForList
().
leftPushAll
(
apiID
,
list
);
//
Redis.getRedisTemplate().opsForList().leftPushAll(apiID, list);
}
//
}
}
//
}
}
//
}
//
public
String
sendRequest
(
String
requestMethod
,
String
url
,
String
params
,
HashMap
<
String
,
String
>
headMap
)
{
//
public String sendRequest(String requestMethod, String url, String params, HashMap<String, String> headMap) {
String
respone
=
""
;
//
String respone = "";
if
(
requestMethod
.
equals
(
"POST"
))
{
//
if (requestMethod.equals("POST")) {
respone
=
HttpUtil
.
createPost
(
url
).
headerMap
(
headMap
,
false
).
//
respone = HttpUtil.createPost(url).headerMap(headMap, false).
body
(
params
).
execute
().
body
();
//
body(params).execute().body();
}
//
}
if
(
requestMethod
.
equals
(
"GET"
))
{
//
if (requestMethod.equals("GET")) {
respone
=
HttpUtil
.
createGet
(
url
).
headerMap
(
headMap
,
true
).
//
respone = HttpUtil.createGet(url).headerMap(headMap, true).
body
(
params
).
execute
().
body
();
//
body(params).execute().body();
}
//
}
return
respone
;
//
return respone;
}
//
}
//
/***
//
/***
*
//
*
* @param params 参数字符窜
//
* @param params 参数字符窜
* @param householdPvApiDto apidto
//
* @param householdPvApiDto apidto
* @param headMap header头
//
* @param headMap header头
* @param orginalAuthorization 原始的orginalAuthorization
//
* @param orginalAuthorization 原始的orginalAuthorization
* @param appsecret appsecret
//
* @param appsecret appsecret
* @param cacheParams 缓存的参数值
//
* @param cacheParams 缓存的参数值
* @desc 锦浪云请求参数及head头处理
//
* @desc 锦浪云请求参数及head头处理
*/
//
*/
public
void
JLYHeaderMapHandler
(
String
params
,
HouseholdPvApiDto
householdPvApiDto
,
HashMap
<
String
,
String
>
headMap
,
String
orginalAuthorization
,
String
appsecret
,
String
cacheParams
)
{
//
public void JLYHeaderMapHandler(String params, HouseholdPvApiDto householdPvApiDto, HashMap<String, String> headMap, String orginalAuthorization, String appsecret, String cacheParams) {
if
(
PVProducerInfoEnum
.
JLY
.
getCode
().
equals
(
householdPvApiDto
.
getProducerId
()))
{
//
if (PVProducerInfoEnum.JLY.getCode().equals(householdPvApiDto.getProducerId())) {
String
contentMD5
=
GoLangHeaderUtils
.
getDigest
(
params
);
//
String contentMD5 = GoLangHeaderUtils.getDigest(params);
headMap
.
put
(
"Date"
,
GoLangHeaderUtils
.
getGMTTime
());
//
headMap.put("Date", GoLangHeaderUtils.getGMTTime());
String
param
=
"POST"
+
"\n"
+
contentMD5
+
"\n"
+
"application/json"
+
"\n"
+
headMap
.
get
(
"Date"
)
+
"\n"
+
householdPvApiDto
.
getApiUrl
();
//
String param = "POST" + "\n" + contentMD5 + "\n" + "application/json" + "\n" + headMap.get("Date") + "\n" + householdPvApiDto.getApiUrl();
String
sign
=
""
;
//
String sign = "";
try
{
//
try {
sign
=
GoLangHeaderUtils
.
HmacSHA1Encrypt
(
param
,
appsecret
);
//
sign = GoLangHeaderUtils.HmacSHA1Encrypt(param, appsecret);
}
catch
(
Exception
e
)
{
//
} catch (Exception e) {
throw
new
RuntimeException
(
e
);
//
throw new RuntimeException(e);
}
//
}
headMap
.
put
(
"Content-MD5"
,
contentMD5
);
//
headMap.put("Content-MD5", contentMD5);
headMap
.
put
(
"Authorization"
,
orginalAuthorization
+
sign
);
//
headMap.put("Authorization", orginalAuthorization + sign);
}
//
}
}
//
}
//
public
Integer
getPagesize
(
String
pageSizeResovle
,
String
response
)
{
//
public Integer getPagesize(String pageSizeResovle, String response) {
Integer
pageSize
=
0
;
//
Integer pageSize = 0;
String
[]
rules
=
pageSizeResovle
.
split
(
","
);
//
String[] rules = pageSizeResovle.split(",");
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
response
);
//
JSONObject jsonObject = JSONObject.parseObject(response);
if
(
rules
.
length
>
0
)
{
//
if (rules.length > 0) {
for
(
int
i
=
0
;
i
<
rules
.
length
-
1
;
i
++)
{
//
for (int i = 0; i < rules.length - 1; i++) {
jsonObject
=
(
JSONObject
)
jsonObject
.
get
(
rules
[
i
]);
//
jsonObject = (JSONObject) jsonObject.get(rules[i]);
}
//
}
}
//
}
pageSize
=
(
Integer
)
jsonObject
.
get
(
rules
[
rules
.
length
-
1
]);
//
pageSize = (Integer) jsonObject.get(rules[rules.length - 1]);
return
pageSize
;
//
return pageSize;
}
//
}
}
//
}
amos-boot-data/amos-boot-data-accessapi/src/main/java/com/yeejoin/amos/api/householdapi/controller/HouseholdTestController.java
View file @
3a476ecb
package
com
.
yeejoin
.
amos
.
api
.
householdapi
.
controller
;
//
package com.yeejoin.amos.api.householdapi.controller;
//
import
cn.hutool.http.HttpUtil
;
//
import cn.hutool.http.HttpUtil;
import
com.yeejoin.amos.api.householdapi.Utils.HouseholdPvUtils
;
//
import com.yeejoin.amos.api.householdapi.Utils.HouseholdPvUtils;
import
com.yeejoin.amos.api.householdapi.face.model.HouseholdPvApiDto
;
//
import com.yeejoin.amos.api.householdapi.face.model.HouseholdPvApiDto;
import
com.yeejoin.amos.api.householdapi.face.model.HouseholdPvProducerInfoDto
;
//
import com.yeejoin.amos.api.householdapi.face.model.HouseholdPvProducerInfoDto;
import
com.yeejoin.amos.api.householdapi.face.service.impl.HouseholdPvApiServiceImpl
;
//
import com.yeejoin.amos.api.householdapi.face.service.impl.HouseholdPvApiServiceImpl;
import
com.yeejoin.amos.api.householdapi.face.service.impl.HouseholdPvProducerInfoServiceImpl
;
//
import com.yeejoin.amos.api.householdapi.face.service.impl.HouseholdPvProducerInfoServiceImpl;
import
com.yeejoin.amos.openapi.enums.PVProducerInfoEnum
;
//
import com.yeejoin.amos.openapi.enums.PVProducerInfoEnum;
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;
import
org.springframework.beans.factory.annotation.Autowired
;
//
import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.web.bind.annotation.PostMapping
;
//
import org.springframework.web.bind.annotation.PostMapping;
import
org.springframework.web.bind.annotation.RequestMapping
;
//
import org.springframework.web.bind.annotation.RequestMapping;
import
org.springframework.web.bind.annotation.RestController
;
//
import org.springframework.web.bind.annotation.RestController;
import
org.typroject.tyboot.core.foundation.enumeration.UserType
;
//
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import
org.typroject.tyboot.core.restful.doc.TycloudOperation
;
//
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
//
import
java.io.IOException
;
//
import java.io.IOException;
import
java.util.HashMap
;
//
import java.util.HashMap;
import
java.util.Map
;
//
import java.util.Map;
//
//
/**
/
//
**
* 户用光伏-厂商API haders
//
* 户用光伏-厂商API haders
*
//
*
* @author system_generator
//
* @author system_generator
* @date 2023-06-07
//
* @date 2023-06-07
*/
//
*/
@RestController
//
@RestController
@Api
(
tags
=
"测试"
)
//
@Api(tags = "测试")
@RequestMapping
(
value
=
"/household-pv-api-test1"
)
//
@RequestMapping(value = "/household-pv-api-test1")
public
class
HouseholdTestController
{
//
public class HouseholdTestController {
@Autowired
//
@Autowired
private
HouseholdPvUtils
householdPvUtils
;
//
private HouseholdPvUtils householdPvUtils;
//
//
/**
//
/**
* 新增户用光伏-厂商API haders
//
* 新增户用光伏-厂商API haders
*
//
*
* @return
//
* @return
*/
//
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
//
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@PostMapping
(
value
=
"/gdwdemo"
)
//
@PostMapping(value = "/gdwdemo")
@ApiOperation
(
httpMethod
=
"get"
,
value
=
"固德威示例"
,
notes
=
"固德威示例"
)
//
@ApiOperation(httpMethod = "get", value = "固德威示例", notes = "固德威示例")
public
String
save
(
Long
seq
)
throws
IOException
{
//
public String save(Long seq) throws IOException {
return
householdPvUtils
.
gerResponseByAPiID
(
seq
);
//
return householdPvUtils.gerResponseByAPiID(seq);
}
//
}
}
//
}
amos-boot-data/amos-boot-data-accessapi/src/main/java/com/yeejoin/amos/api/openapi/face/service/TaBusinessServiceImpl.java
View file @
3a476ecb
...
@@ -10,6 +10,8 @@ import com.csoft.sdk.domain.CsoftDataApiXixianGetzhutiinfoParam;
...
@@ -10,6 +10,8 @@ import com.csoft.sdk.domain.CsoftDataApiXixianGetzhutiinfoParam;
import
com.csoft.sdk.domain.request.CsoftDataApiXixianGetzhutiinfoRequest
;
import
com.csoft.sdk.domain.request.CsoftDataApiXixianGetzhutiinfoRequest
;
import
com.csoft.sdk.domain.response.CsoftDataApiXixianGetzhutiinfoResponse
;
import
com.csoft.sdk.domain.response.CsoftDataApiXixianGetzhutiinfoResponse
;
import
com.yeejoin.amos.api.openapi.face.orm.dao.DataDictionaryMapper
;
import
com.yeejoin.amos.api.openapi.face.orm.dao.DataDictionaryMapper
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.typroject.tyboot.core.foundation.utils.ValidationUtil
;
import
org.typroject.tyboot.core.foundation.utils.ValidationUtil
;
...
@@ -34,7 +36,7 @@ import com.yeejoin.amos.api.openapi.face.orm.entity.TaLicenseBaseInfo;
...
@@ -34,7 +36,7 @@ import com.yeejoin.amos.api.openapi.face.orm.entity.TaLicenseBaseInfo;
*/
*/
@Service
@Service
public
class
TaBusinessServiceImpl
extends
BaseService
<
TaAccessConfigModel
,
TaAccessConfig
,
TaAccessConfigMapper
>
{
public
class
TaBusinessServiceImpl
extends
BaseService
<
TaAccessConfigModel
,
TaAccessConfig
,
TaAccessConfigMapper
>
{
private
final
Logger
log
=
LoggerFactory
.
getLogger
(
TaBusinessServiceImpl
.
class
);
@Autowired
@Autowired
private
DataDictionaryMapper
dataDictionaryMapper
;
private
DataDictionaryMapper
dataDictionaryMapper
;
...
@@ -50,8 +52,16 @@ public class TaBusinessServiceImpl extends BaseService<TaAccessConfigModel, TaAc
...
@@ -50,8 +52,16 @@ public class TaBusinessServiceImpl extends BaseService<TaAccessConfigModel, TaAc
CsoftDataApiXixianGetzhutiinfoParam
csoftDataApiXixianParam
=
new
CsoftDataApiXixianGetzhutiinfoParam
();
CsoftDataApiXixianGetzhutiinfoParam
csoftDataApiXixianParam
=
new
CsoftDataApiXixianGetzhutiinfoParam
();
csoftDataApiXixianParam
.
setUniscid
(
code
);
csoftDataApiXixianParam
.
setUniscid
(
code
);
CsoftDataApiXixianGetzhutiinfoRequest
request
=
new
CsoftDataApiXixianGetzhutiinfoRequest
(
csoftDataApiXixianParam
);
CsoftDataApiXixianGetzhutiinfoRequest
request
=
new
CsoftDataApiXixianGetzhutiinfoRequest
(
csoftDataApiXixianParam
);
CsoftDataApiXixianGetzhutiinfoResponse
response
=
client
.
execute
(
request
);
Map
<
String
,
Object
>
result
=
new
HashMap
<>();
Map
<
String
,
Object
>
result
=
new
HashMap
<>();
CsoftDataApiXixianGetzhutiinfoResponse
response
=
null
;
try
{
log
.
info
(
"请求查询工商信息前"
);
response
=
client
.
execute
(
request
);
log
.
info
(
"请求查询工商信息完成,{}"
,
response
);
}
catch
(
Exception
e
)
{
log
.
error
(
"返回信息,{}"
,
e
.
getMessage
());
return
null
;
}
// 4.返回校验
// 4.返回校验
if
(
response
.
isSuccess
())
{
if
(
response
.
isSuccess
())
{
System
.
out
.
println
(
"成功:"
+
response
.
getData
());
System
.
out
.
println
(
"成功:"
+
response
.
getData
());
...
...
amos-boot-data/amos-boot-data-accessapi/src/main/java/com/yeejoin/amos/dockingData/DockingData.java
View file @
3a476ecb
package
com
.
yeejoin
.
amos
.
dockingData
;
//
package com.yeejoin.amos.dockingData;
//
import
com.alibaba.fastjson.JSON
;
//
import com.alibaba.fastjson.JSON;
import
com.alibaba.fastjson.JSONArray
;
//
import com.alibaba.fastjson.JSONArray;
import
com.alibaba.fastjson.JSONObject
;
//
import com.alibaba.fastjson.JSONObject;
import
com.sun.scenario.effect.impl.sw.sse.SSEBlend_SRC_OUTPeer
;
//
import com.sun.scenario.effect.impl.sw.sse.SSEBlend_SRC_OUTPeer;
import
com.yeejoin.amos.api.householdapi.Utils.HouseholdPvUtils
;
//
import com.yeejoin.amos.api.householdapi.Utils.HouseholdPvUtils;
import
com.yeejoin.amos.component.influxdb.InfluxDbConnection
;
//
import com.yeejoin.amos.component.influxdb.InfluxDbConnection;
import
org.jetbrains.annotations.TestOnly
;
//
import org.jetbrains.annotations.TestOnly;
import
org.springframework.beans.factory.annotation.Autowired
;
//
import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.beans.factory.annotation.Value
;
//
import org.springframework.beans.factory.annotation.Value;
import
org.springframework.boot.actuate.influx.InfluxDbHealthIndicator
;
//
import org.springframework.boot.actuate.influx.InfluxDbHealthIndicator;
import
org.springframework.scheduling.annotation.Scheduled
;
//
import org.springframework.scheduling.annotation.Scheduled;
import
org.springframework.stereotype.Component
;
//
import org.springframework.stereotype.Component;
//
import
javax.annotation.PostConstruct
;
//
import javax.annotation.PostConstruct;
import
java.util.HashMap
;
//
import java.util.HashMap;
import
java.util.LinkedHashMap
;
//
import java.util.LinkedHashMap;
import
java.util.Map
;
//
import java.util.Map;
import
java.util.UUID
;
//
import java.util.UUID;
import
java.util.zip.Inflater
;
//
import java.util.zip.Inflater;
//
/**
/
//
**
* @description:
//
* @description:
* @author: tw
//
* @author: tw
* @createDate: 2023/6/16
//
* @createDate: 2023/6/16
*/
//
*/
@Component
//
@Component
public
class
DockingData
{
//
public class DockingData {
//
//
@Autowired
//
@Autowired
InfluxDbConnection
influxDbConnection
;
//
InfluxDbConnection influxDbConnection;
@Autowired
//
@Autowired
HouseholdPvUtils
householdPvUtils
;
//
HouseholdPvUtils householdPvUtils;
//初始化执行
//
//初始化执行
@PostConstruct
//
@PostConstruct
public
void
init
(){
//
public void init(){
this
.
getDate
();
//
this.getDate();
}
//
}
//
//
//每二十分钟执行一次
//
//每二十分钟执行一次
@Scheduled
(
cron
=
"0 0/20 * * * ?"
)
//
@Scheduled(cron = "0 0/20 * * * ?")
public
void
fixedRate
()
{
//
public void fixedRate() {
this
.
getDate
();
//
this.getDate();
}
//
}
//
//请求获取数据
//
//请求获取数据
public
void
getDate
(){
//
public void getDate(){
//
//
//首航
//
//首航
String
data1
=
householdPvUtils
.
gerResponseByAPiID
(
1000000002L
);
//
String data1=householdPvUtils.gerResponseByAPiID(1000000002L);
JSONObject
json
=
JSON
.
parseObject
(
data1
);
//
JSONObject json= JSON.parseObject(data1);
//
if
((
Boolean
)
json
.
get
(
"success"
)){
//
if((Boolean)json.get("success")){
JSONArray
obj
=
json
.
get
(
"stationList"
)
!=
null
?(
JSONArray
)
json
.
get
(
"stationList"
):
null
;
//
JSONArray obj= json.get("stationList") !=null?(JSONArray)json.get("stationList"):null;
if
(
obj
!=
null
)
{
//
if (obj!=null) {
for
(
Object
o
:
obj
)
{
//
for (Object o : obj) {
Map
<
String
,
Object
>
maps1
=
(
Map
<
String
,
Object
>)
o
;
//
Map<String,Object> maps1 = (Map<String,Object>)o;
Map
<
String
,
String
>
maps2
=
new
HashMap
<>();
//
Map<String,String> maps2=new HashMap<>();
maps2
.
put
(
"key"
,
UUID
.
randomUUID
().
toString
());
//
maps2.put("key", UUID.randomUUID().toString());
influxDbConnection
.
insert
(
"SH_DZ"
,
maps2
,
maps1
);
//
influxDbConnection.insert("SH_DZ",maps2,maps1);
}
//
}
}
//
}
}
//
}
//
String
data2
=
householdPvUtils
.
gerResponseByAPiID
(
1000000003L
);
//
String data2=householdPvUtils.gerResponseByAPiID(1000000003L);
JSONObject
json2
=
JSON
.
parseObject
(
data2
);
//
JSONObject json2= JSON.parseObject(data2);
if
((
Boolean
)
json2
.
get
(
"success"
))
{
//
if((Boolean)json2.get("success")) {
JSONArray
obj2
=
json
.
get
(
"deviceList"
)
!=
null
?
(
JSONArray
)
json2
.
get
(
"deviceList"
)
:
null
;
//
JSONArray obj2 = json.get("deviceList") != null ? (JSONArray) json2.get("deviceList") : null;
if
(
obj2
!=
null
)
{
//
if (obj2!=null) {
for
(
Object
o
:
obj2
)
{
//
for (Object o : obj2) {
Map
<
String
,
Object
>
maps1
=
(
Map
<
String
,
Object
>)
o
;
//
Map<String, Object> maps1 = (Map<String, Object>) o;
Map
<
String
,
String
>
maps2
=
new
HashMap
<>();
//
Map<String, String> maps2 = new HashMap<>();
maps2
.
put
(
"key"
,
UUID
.
randomUUID
().
toString
());
//
maps2.put("key", UUID.randomUUID().toString());
influxDbConnection
.
insert
(
"SH_ZB"
,
maps2
,
maps1
);
//
influxDbConnection.insert("SH_ZB", maps2, maps1);
}
//
}
}
//
}
}
//
}
//
//固德威
//
//固德威
String
data3
=
householdPvUtils
.
gerResponseByAPiID
(
1000000006L
);
//
String data3 = householdPvUtils.gerResponseByAPiID(1000000006L);
//
JSONObject
json3
=
JSON
.
parseObject
(
data3
);
//
JSONObject json3= JSON.parseObject(data3);
if
(
Integer
.
valueOf
(
json3
.
get
(
"code"
).
toString
())==
0
)
{
//
if(Integer.valueOf(json3.get("code").toString())==0) {
JSONObject
obj3
=
json3
.
get
(
"data"
)
!=
null
?
(
JSONObject
)
json3
.
get
(
"data"
)
:
null
;
//
JSONObject obj3 = json3.get("data") != null ? (JSONObject)json3.get("data") : null;
if
(
obj3
!=
null
&&
obj3
.
get
(
"list"
)!=
null
)
{
//
if (obj3!=null&&obj3.get("list")!=null) {
//
JSONArray
ob
=
obj3
.
get
(
"list"
)
!=
null
?
(
JSONArray
)
obj3
.
get
(
"list"
)
:
null
;
//
JSONArray ob = obj3.get("list") != null ? (JSONArray) obj3.get("list") : null;
//
for
(
Object
o
:
ob
)
{
//
for (Object o : ob) {
Map
<
String
,
Object
>
maps1
=
(
Map
<
String
,
Object
>)
o
;
//
Map<String, Object> maps1 = (Map<String, Object>) o;
Map
<
String
,
String
>
maps2
=
new
HashMap
<>();
//
Map<String, String> maps2 = new HashMap<>();
maps2
.
put
(
"key"
,
UUID
.
randomUUID
().
toString
());
//
maps2.put("key", UUID.randomUUID().toString());
influxDbConnection
.
insert
(
"GD_DZ"
,
maps2
,
maps1
);
//
influxDbConnection.insert("GD_DZ", maps2, maps1);
}
//
}
}
//
}
}
//
}
//
String
data4
=
householdPvUtils
.
gerResponseByAPiID
(
1000000007L
);
//
String data4 = householdPvUtils.gerResponseByAPiID(1000000007L);
//
JSONObject
json4
=
JSON
.
parseObject
(
data4
);
//
JSONObject json4= JSON.parseObject(data4);
if
(
Integer
.
valueOf
(
json4
.
get
(
"code"
).
toString
())==
0
)
{
//
if(Integer.valueOf(json4.get("code").toString())==0) {
JSONObject
obj4
=
json4
.
get
(
"data"
)
!=
null
?
(
JSONObject
)
json4
.
get
(
"data"
)
:
null
;
//
JSONObject obj4 = json4.get("data") != null ? (JSONObject)json4.get("data") : null;
if
(
obj4
!=
null
&&
obj4
.
get
(
"list"
)!=
null
)
{
//
if (obj4!=null&&obj4.get("list")!=null) {
//
JSONArray
ob
=
obj4
.
get
(
"list"
)
!=
null
?
(
JSONArray
)
obj4
.
get
(
"list"
)
:
null
;
//
JSONArray ob = obj4.get("list") != null ? (JSONArray) obj4.get("list") : null;
//
for
(
Object
o
:
ob
)
{
//
for (Object o : ob) {
Map
<
String
,
Object
>
maps1
=
(
Map
<
String
,
Object
>)
o
;
//
Map<String, Object> maps1 = (Map<String, Object>) o;
Map
<
String
,
String
>
maps2
=
new
HashMap
<>();
//
Map<String, String> maps2 = new HashMap<>();
maps2
.
put
(
"key"
,
UUID
.
randomUUID
().
toString
());
//
maps2.put("key", UUID.randomUUID().toString());
influxDbConnection
.
insert
(
"GD_ZT"
,
maps2
,
maps1
);
//
influxDbConnection.insert("GD_ZT", maps2, maps1);
}
//
}
}
//
}
}
//
}
//
String
data5
=
householdPvUtils
.
gerResponseByAPiID
(
1000000008L
);
//
String data5 = householdPvUtils.gerResponseByAPiID(1000000008L);
//
JSONObject
json5
=
JSON
.
parseObject
(
data5
);
//
JSONObject json5= JSON.parseObject(data5);
if
(
Integer
.
valueOf
(
json5
.
get
(
"code"
).
toString
())==
0
)
{
//
if(Integer.valueOf(json5.get("code").toString())==0) {
JSONObject
obj5
=
json5
.
get
(
"data"
)
!=
null
?
(
JSONObject
)
json5
.
get
(
"data"
)
:
null
;
//
JSONObject obj5 = json5.get("data") != null ? (JSONObject)json5.get("data") : null;
if
(
obj5
!=
null
&&
obj5
.
get
(
"list"
)!=
null
)
{
//
if (obj5!=null&&obj5.get("list")!=null) {
//
JSONArray
ob
=
obj5
.
get
(
"list"
)
!=
null
?
(
JSONArray
)
obj5
.
get
(
"list"
)
:
null
;
//
JSONArray ob = obj5.get("list") != null ? (JSONArray) obj5.get("list") : null;
//
for
(
Object
o
:
ob
)
{
//
for (Object o : ob) {
Map
<
String
,
Object
>
maps1
=
(
Map
<
String
,
Object
>)
o
;
//
Map<String, Object> maps1 = (Map<String, Object>) o;
Map
<
String
,
String
>
maps2
=
new
HashMap
<>();
//
Map<String, String> maps2 = new HashMap<>();
maps2
.
put
(
"key"
,
UUID
.
randomUUID
().
toString
());
//
maps2.put("key", UUID.randomUUID().toString());
influxDbConnection
.
insert
(
"GD_GJ"
,
maps2
,
maps1
);
//
influxDbConnection.insert("GD_GJ", maps2, maps1);
}
//
}
}
//
}
}
//
}
//
//
String
data6
=
householdPvUtils
.
gerResponseByAPiID
(
1686897906789L
);
//
String data6 = householdPvUtils.gerResponseByAPiID(1686897906789L);
//
JSONObject
json6
=
JSON
.
parseObject
(
data6
);
//
JSONObject json6= JSON.parseObject(data6);
if
(
Integer
.
valueOf
(
json6
.
get
(
"code"
).
toString
())==
0
)
{
//
if(Integer.valueOf(json6.get("code").toString())==0) {
JSONObject
obj6
=
json6
.
get
(
"data"
)
!=
null
?
(
JSONObject
)
json6
.
get
(
"data"
)
:
null
;
//
JSONObject obj6 = json6.get("data") != null ? (JSONObject)json6.get("data") : null;
if
(
obj6
!=
null
&&
obj6
.
get
(
"page"
)!=
null
)
{
//
if (obj6!=null&&obj6.get("page")!=null) {
//
JSONArray
ob
=
((
JSONObject
)
obj6
.
get
(
"page"
)).
get
(
"records"
)!=
null
?
(
JSONArray
)
((
JSONObject
)
obj6
.
get
(
"page"
)).
get
(
"records"
)
:
null
;
//
JSONArray ob = ((JSONObject)obj6.get("page")).get("records")!= null ? (JSONArray) ((JSONObject)obj6.get("page")).get("records") : null;
//
for
(
Object
o
:
ob
)
{
//
for (Object o : ob) {
Map
<
String
,
Object
>
maps1
=
(
Map
<
String
,
Object
>)
o
;
//
Map<String, Object> maps1 = (Map<String, Object>) o;
Map
<
String
,
String
>
maps2
=
new
HashMap
<>();
//
Map<String, String> maps2 = new HashMap<>();
maps2
.
put
(
"key"
,
UUID
.
randomUUID
().
toString
());
//
maps2.put("key", UUID.randomUUID().toString());
influxDbConnection
.
insert
(
"JL_CZ"
,
maps2
,
maps1
);
//
influxDbConnection.insert("JL_CZ", maps2, maps1);
}
//
}
}
//
}
}
//
}
String
data7
=
householdPvUtils
.
gerResponseByAPiID
(
1686900771946L
);
//
String data7 = householdPvUtils.gerResponseByAPiID(1686900771946L);
JSONObject
json7
=
JSON
.
parseObject
(
data7
);
//
JSONObject json7= JSON.parseObject(data7);
if
(
Integer
.
valueOf
(
json7
.
get
(
"code"
).
toString
())==
0
)
{
//
if(Integer.valueOf(json7.get("code").toString())==0) {
JSONObject
obj7
=
json7
.
get
(
"data"
)
!=
null
?
(
JSONObject
)
json7
.
get
(
"data"
)
:
null
;
//
JSONObject obj7 = json7.get("data") != null ? (JSONObject)json7.get("data") : null;
if
(
obj7
!=
null
&&
obj7
.
get
(
"page"
)!=
null
)
{
//
if (obj7!=null&&obj7.get("page")!=null) {
//
JSONArray
ob
=
((
JSONObject
)
obj7
.
get
(
"page"
)).
get
(
"records"
)!=
null
?
(
JSONArray
)
((
JSONObject
)
obj7
.
get
(
"page"
)).
get
(
"records"
)
:
null
;
//
JSONArray ob = ((JSONObject)obj7.get("page")).get("records")!= null ? (JSONArray) ((JSONObject)obj7.get("page")).get("records") : null;
//
for
(
Object
o
:
ob
)
{
//
for (Object o : ob) {
Map
<
String
,
Object
>
maps1
=
(
Map
<
String
,
Object
>)
o
;
//
Map<String, Object> maps1 = (Map<String, Object>) o;
Map
<
String
,
String
>
maps2
=
new
HashMap
<>();
//
Map<String, String> maps2 = new HashMap<>();
maps2
.
put
(
"key"
,
UUID
.
randomUUID
().
toString
());
//
maps2.put("key", UUID.randomUUID().toString());
//
maps1
.
put
(
"etotal1"
,
maps1
.
get
(
"etotal1"
).
toString
());
//
maps1.put("etotal1",maps1.get("etotal1").toString());
maps1
.
put
(
"etoday1"
,
maps1
.
get
(
"etoday1"
).
toString
());
//
maps1.put("etoday1",maps1.get("etoday1").toString());
influxDbConnection
.
insert
(
"JL_NBQ"
,
maps2
,
maps1
);
//
influxDbConnection.insert("JL_NBQ", maps2, maps1);
}
//
}
}
//
}
}
//
}
String
data8
=
householdPvUtils
.
gerResponseByAPiID
(
1686900972965L
);
//
String data8 = householdPvUtils.gerResponseByAPiID(1686900972965L);
JSONObject
json8
=
JSON
.
parseObject
(
data8
);
//
JSONObject json8= JSON.parseObject(data8);
if
(
Integer
.
valueOf
(
json8
.
get
(
"code"
).
toString
())==
0
)
{
//
if(Integer.valueOf(json8.get("code").toString())==0) {
JSONObject
obj8
=
json8
.
get
(
"data"
)
!=
null
?
(
JSONObject
)
json8
.
get
(
"data"
)
:
null
;
//
JSONObject obj8 = json8.get("data") != null ? (JSONObject)json8.get("data") : null;
if
(
obj8
!=
null
&&
obj8
.
get
(
"records"
)!=
null
)
{
//
if (obj8!=null&&obj8.get("records")!=null) {
//
JSONArray
ob
=
obj8
.
get
(
"records"
)!=
null
?
(
JSONArray
)
obj8
.
get
(
"records"
)
:
null
;
//
JSONArray ob = obj8.get("records")!= null ? (JSONArray)obj8.get("records") : null;
//
for
(
Object
o
:
ob
)
{
//
for (Object o : ob) {
Map
<
String
,
Object
>
maps1
=
(
Map
<
String
,
Object
>)
o
;
//
Map<String, Object> maps1 = (Map<String, Object>) o;
Map
<
String
,
String
>
maps2
=
new
HashMap
<>();
//
Map<String, String> maps2 = new HashMap<>();
maps2
.
put
(
"key"
,
UUID
.
randomUUID
().
toString
());
//
maps2.put("key", UUID.randomUUID().toString());
influxDbConnection
.
insert
(
"JL_GJ"
,
maps2
,
maps1
);
//
influxDbConnection.insert("JL_GJ", maps2, maps1);
}
//
}
}
//
}
}
//
}
}
//
}
//
//
//
}
//
}
amos-boot-system-tzs/amos-boot-module-tcm/amos-boot-module-tcm-biz/src/main/java/com/yeejoin/amos/boot/module/tcm/flc/biz/service/impl/RegUnitInfoServiceImpl.java
View file @
3a476ecb
...
@@ -371,6 +371,9 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI
...
@@ -371,6 +371,9 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI
// 2.组织返回数据
// 2.组织返回数据
//2.1 工商信息查询
//2.1 工商信息查询
Map
<
String
,
Object
>
resultMap
=
accessFeignService
.
getData
(
unitCode
).
getResult
();
Map
<
String
,
Object
>
resultMap
=
accessFeignService
.
getData
(
unitCode
).
getResult
();
if
(
resultMap
==
null
){
throw
new
BadRequest
(
"工商信息接口查询失败,请稍后再试!"
);
}
if
(!
ValidationUtil
.
isEmpty
(
resultMap
)){
if
(!
ValidationUtil
.
isEmpty
(
resultMap
)){
// 2.2 工商信息组装
// 2.2 工商信息组装
String
area
=
String
.
valueOf
(
resultMap
.
get
(
"area"
));
String
area
=
String
.
valueOf
(
resultMap
.
get
(
"area"
));
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment