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
cd54953c
Commit
cd54953c
authored
Aug 15, 2023
by
tianyiming
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop_tzs' into develop_tzs_96333
parents
3d0038d1
fef2a54e
Show whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
843 additions
and
618 deletions
+843
-618
ControllerAop.java
...a/com/yeejoin/amos/boot/biz/common/aop/ControllerAop.java
+10
-0
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
TzBaseEnterpriseInfoServiceImpl.java
...tor/biz/service/impl/TzBaseEnterpriseInfoServiceImpl.java
+2
-0
TzsUserInfoDto.java
.../yeejoin/amos/boot/module/tcm/api/dto/TzsUserInfoDto.java
+2
-1
TzsUserInfo.java
.../yeejoin/amos/boot/module/tcm/api/entity/TzsUserInfo.java
+6
-0
ITzsUserInfoService.java
...amos/boot/module/tcm/api/service/ITzsUserInfoService.java
+1
-0
TzsUserInfoVo.java
...om/yeejoin/amos/boot/module/tcm/api/vo/TzsUserInfoVo.java
+7
-0
TzsUserInfoMapper.xml
...e-tcm-api/src/main/resources/mapper/TzsUserInfoMapper.xml
+2
-0
TzsUserInfoController.java
...boot/module/tcm/biz/controller/TzsUserInfoController.java
+7
-0
TzBaseEnterpriseInfoServiceImpl.java
...tcm/biz/service/impl/TzBaseEnterpriseInfoServiceImpl.java
+27
-29
TzsUserInfoServiceImpl.java
...t/module/tcm/biz/service/impl/TzsUserInfoServiceImpl.java
+39
-1
RegUnitInfoServiceImpl.java
...dule/tcm/flc/biz/service/impl/RegUnitInfoServiceImpl.java
+3
-0
IdxFeignService.java
...n/amos/boot/module/ymt/flc/api/feign/IdxFeignService.java
+3
-7
CategoryOtherInfoMapper.xml
...api/src/main/resources/mapper/CategoryOtherInfoMapper.xml
+9
-5
RedissonManager.java
...join/amos/boot/module/ymt/biz/config/RedissonManager.java
+53
-0
EquipmentCategoryServiceImpl.java
...le/ymt/biz/service/impl/EquipmentCategoryServiceImpl.java
+116
-33
application-dev.properties
...ule-ymt-biz/src/main/resources/application-dev.properties
+5
-5
pom.xml
amos-boot-system-tzs/pom.xml
+5
-1
No files found.
amos-boot-biz-common/src/main/java/com/yeejoin/amos/boot/biz/common/aop/ControllerAop.java
View file @
cd54953c
...
...
@@ -24,6 +24,8 @@ import org.aspectj.lang.annotation.Aspect;
import
org.aspectj.lang.annotation.Before
;
import
org.aspectj.lang.annotation.Pointcut
;
import
org.aspectj.lang.reflect.MethodSignature
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.core.annotation.Order
;
...
...
@@ -52,6 +54,9 @@ import java.util.regex.Pattern;
@Component
@Order
(
value
=
0
)
public
class
ControllerAop
{
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
ControllerAop
.
class
);
/**
* saveUserRedis设置过期时间
*/
...
...
@@ -118,6 +123,7 @@ public class ControllerAop {
if
(
ValidationUtil
.
isEmpty
(
token
))
{
fillRequestContext
(
request
);
token
=
RequestContext
.
getToken
();
logger
.
info
(
"studio url token ===========>"
+
token
);
}
if
(
token
!=
null
)
{
String
pattern
=
RedisKey
.
buildPatternKey
(
token
);
...
...
@@ -132,7 +138,9 @@ public class ControllerAop {
RequestContext
.
setExeUserId
(
userModel
.
getUserId
());
}
catch
(
Exception
e
)
{
// 删除失效token缓存
logger
.
info
(
"catch pattern before==========>"
+
pattern
);
redisUtils
.
getAndDeletePatternKeys
(
pattern
);
logger
.
info
(
"catch pattern after==========>"
+
pattern
);
throw
new
RuntimeException
(
e
.
getMessage
());
}
saveUserRedis
(
userModel
,
token
);
...
...
@@ -201,7 +209,9 @@ public class ControllerAop {
String
token
=
null
;
String
product
=
null
;
String
appKey
=
null
;
logger
.
info
(
"fillRequestContext request =====>"
+
request
);
if
(
request
!=
null
&&
request
.
getParameterMap
()
!=
null
)
{
logger
.
info
(
"fillRequestContext request getParameterMap =====>"
+
request
.
getParameterMap
());
if
(
request
.
getParameterMap
().
get
(
"token"
)
!=
null
&&
request
.
getParameterMap
().
get
(
"product"
)
!=
null
&&
request
.
getParameterMap
().
get
(
"appKey"
)
!=
null
)
{
token
=
request
.
getParameterMap
().
get
(
"token"
)[
0
];
...
...
amos-boot-data/amos-boot-data-accessapi/pom.xml
View file @
cd54953c
...
...
@@ -175,12 +175,12 @@
<artifactId>
hutool-all
</artifactId>
<version>
5.7.22
</version>
</dependency>
<dependency
>
<groupId>
com.yeejoin
</groupId
>
<artifactId>
amos-component-influxdb
</artifactId
>
<version>
1.8.5-SNAPSHOT
</version
>
<scope>
compile
</scope
>
</dependency
>
<!-- <dependency>--
>
<!-- <groupId>com.yeejoin</groupId>--
>
<!-- <artifactId>amos-component-influxdb</artifactId>--
>
<!-- <version>1.8.5-SNAPSHOT</version>--
>
<!-- <scope>compile</scope>--
>
<!-- </dependency>--
>
<dependency>
<groupId>
com.yeejoin
</groupId>
<artifactId>
amos-component-security
</artifactId>
...
...
amos-boot-data/amos-boot-data-accessapi/src/main/java/com/yeejoin/amos/AccessapiApplication.java
View file @
cd54953c
...
...
@@ -47,8 +47,8 @@ import com.yeejoin.amos.api.openapi.face.service.TaAccessConfigServiceImpl;
@ComponentScan
({
"org.typroject"
,
"com.yeejoin.amos"
})
public
class
AccessapiApplication
{
//
@Autowired
//
private TaAccessConfigServiceImpl taAccessConfigServiceImpl;
@Autowired
private
TaAccessConfigServiceImpl
taAccessConfigServiceImpl
;
private
static
final
Logger
logger
=
LogManager
.
getLogger
(
AccessapiApplication
.
class
);
...
...
@@ -69,9 +69,9 @@ public class AccessapiApplication {
+
path
+
"/doc.html\n"
+
"----------------------------------------------------------"
);
}
//
@Bean
//
public void initAccessConfig() {
//
taAccessConfigServiceImpl.refreshConfig();
//
taAccessConfigServiceImpl.startTask();
//
}
@Bean
public
void
initAccessConfig
()
{
taAccessConfigServiceImpl
.
refreshConfig
();
taAccessConfigServiceImpl
.
startTask
();
}
}
amos-boot-data/amos-boot-data-accessapi/src/main/java/com/yeejoin/amos/api/householdapi/Utils/HouseholdPvUtils.java
View file @
cd54953c
package
com
.
yeejoin
.
amos
.
api
.
householdapi
.
Utils
;
import
cn.hutool.Hutool
;
import
cn.hutool.core.util.ObjectUtil
;
import
cn.hutool.http.HttpUtil
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.qiniu.util.Json
;
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.orm.entity.HouseholdPvProducerInfo
;
import
com.yeejoin.amos.api.householdapi.face.service.impl.HouseholdPvApiServiceImpl
;
import
com.yeejoin.amos.api.householdapi.face.service.impl.HouseholdPvProducerInfoServiceImpl
;
import
com.yeejoin.amos.component.influxdb.InfluxDbConnection
;
import
com.yeejoin.amos.openapi.enums.PVProducerInfoEnum
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.models.auth.In
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
org.typroject.tyboot.component.cache.Redis
;
import
java.util.*
;
@Component
public
class
HouseholdPvUtils
{
@Autowired
private
HouseholdPvProducerInfoServiceImpl
householdPvProducerInfoServiceImpl
;
@Autowired
private
HouseholdPvApiServiceImpl
householdPvApiServiceImpl
;
@Autowired
InfluxDbConnection
influxDbConnection
;
private
final
static
String
API_REDIS_PREFIX
=
"HOUSEHOLD_API_CACHE_"
+
""
;
/**
* @param code 厂商code
* @return HashMap<String, Object> 发送请求前的准备 准备header信息
* @deprecated 根据厂商编码获取厂商的hearer
*/
public
HashMap
<
String
,
Object
>
getHeaderByProducerCode
(
String
code
)
{
HashMap
<
String
,
Object
>
hashMap
=
new
HashMap
<>();
HashMap
<
String
,
String
>
hashMaphead
=
new
HashMap
<>();
HouseholdPvProducerInfo
householdPvProducerInfo
=
this
.
householdPvProducerInfoServiceImpl
.
queryForHouseholdPvProducerInfoByCode
(
code
);
String
url
=
householdPvProducerInfo
.
getProdcerUrl
()
+
householdPvProducerInfo
.
getTokenUrl
();
hashMap
.
put
(
"apiurl"
,
householdPvProducerInfo
.
getProdcerUrl
());
if
(
PVProducerInfoEnum
.
GDW
.
getCode
().
equals
(
code
))
{
HashMap
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"account"
,
householdPvProducerInfo
.
getProdcerAccount
());
map
.
put
(
"pwd"
,
householdPvProducerInfo
.
getProdcerPassword
());
String
body
=
JSON
.
toJSONString
(
map
);
String
response
=
HttpUtil
.
createPost
(
url
).
body
(
body
).
execute
().
body
();
JSONObject
jsonObject
=
JSON
.
parseObject
(
response
);
if
(
jsonObject
.
get
(
"data"
)
!=
null
)
{
JSONObject
jsonObject1
=
(
JSONObject
)
jsonObject
.
get
(
"data"
);
hashMaphead
.
put
(
"token"
,
(
String
)
jsonObject1
.
get
(
"token"
));
hashMap
.
put
(
"header"
,
hashMaphead
);
}
}
else
if
(
PVProducerInfoEnum
.
SH
.
getCode
().
equals
(
code
))
{
HashMap
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"accountName"
,
householdPvProducerInfo
.
getProdcerAccount
());
map
.
put
(
"appId"
,
householdPvProducerInfo
.
getProdcerAppid
());
map
.
put
(
"appSecret"
,
householdPvProducerInfo
.
getProdcerAppsecret
());
map
.
put
(
"corporationId"
,
householdPvProducerInfo
.
getCorporationId
());
map
.
put
(
"accountType"
,
2
);
String
body
=
JSON
.
toJSONString
(
map
);
String
response
=
HttpUtil
.
createPost
(
url
).
body
(
body
).
execute
().
body
();
JSONObject
jsonObject
=
JSON
.
parseObject
(
response
);
hashMaphead
.
put
(
"Authorization"
,
(
String
)
jsonObject
.
get
(
"data"
));
hashMap
.
put
(
"header"
,
hashMaphead
);
}
else
if
(
PVProducerInfoEnum
.
JLY
.
getCode
().
equals
(
code
))
{
hashMaphead
.
put
(
"Content-type"
,
"application/json;charset=UTF-8"
);
hashMaphead
.
put
(
"Authorization"
,
"API "
+
householdPvProducerInfo
.
getProdcerAppid
());
hashMaphead
.
put
(
"Content-MD5"
,
null
);
hashMaphead
.
put
(
"Date"
,
GoLangHeaderUtils
.
getGMTTime
());
hashMap
.
put
(
"header"
,
hashMaphead
);
hashMap
.
put
(
"appsecret"
,
householdPvProducerInfo
.
getProdcerAppsecret
());
}
return
hashMap
;
}
/**
* @param seq apiId 数据库中维护的的apiId
* @return String 请求返回的response字符串
*/
public
String
gerResponseByAPiID
(
Long
seq
)
{
List
cacheParams
=
new
ArrayList
();
String
respone
=
""
;
String
params
=
""
;
JSONArray
jsonArray
=
null
;
HouseholdPvApiDto
householdPvApiDto
=
this
.
householdPvApiServiceImpl
.
queryBySeq
(
seq
);
HashMap
<
String
,
Object
>
producerInfo
=
this
.
getHeaderByProducerCode
(
householdPvApiDto
.
getProducerId
());
String
baseurl
=
(
String
)
producerInfo
.
get
(
"apiurl"
);
HashMap
<
String
,
String
>
headMap
=
(
HashMap
<
String
,
String
>)
producerInfo
.
get
(
"header"
);
String
orginalAuthorization
=
headMap
.
get
(
"Authorization"
)
+
":"
;
String
url
=
baseurl
+
householdPvApiDto
.
getApiUrl
();
String
appsecret
=
(
String
)
producerInfo
.
get
(
"appsecret"
);
if
(
ObjectUtil
.
isNotEmpty
(
householdPvApiDto
.
getDependecyApiId
()))
{
String
RedisKey
=
API_REDIS_PREFIX
+
householdPvApiDto
.
getDependecyApiId
();
cacheParams
=
Redis
.
getRedisTemplate
().
opsForList
().
range
(
RedisKey
,
0
,
-
1
);
if
(
cacheParams
.
size
()
>
0
)
{
for
(
int
i
=
0
;
i
<
cacheParams
.
size
();
i
++)
{
JSONObject
jsonObject
=
JSON
.
parseObject
(
householdPvApiDto
.
getParamInfo
());
if
(
ObjectUtil
.
isNotEmpty
(
householdPvApiDto
.
getDependApiParamKey
()))
{
jsonObject
.
put
(
householdPvApiDto
.
getDependApiParamKey
(),
cacheParams
.
get
(
i
));
}
params
=
jsonObject
.
toJSONString
();
if
(
PVProducerInfoEnum
.
JLY
.
getCode
().
equals
(
householdPvApiDto
.
getProducerId
()))
{
JLYHeaderMapHandler
(
params
,
householdPvApiDto
,
headMap
,
orginalAuthorization
,
appsecret
,
(
String
)
cacheParams
.
get
(
i
));
}
try
{
Thread
.
sleep
(
500
);
respone
=
sendRequest
(
householdPvApiDto
.
getRequestMethod
(),
url
,
params
,
headMap
);
jsonArray
=
handlerResponseByResultResolverule
(
householdPvApiDto
.
getResultResolveRule
(),
respone
);
handleResponseAndCacheData
(
String
.
valueOf
(
seq
),
householdPvApiDto
.
getCacheField
(),
jsonArray
,
householdPvApiDto
.
getMeasurement
());
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
finally
{
continue
;
}
}
}
}
else
{
if
(
PVProducerInfoEnum
.
JLY
.
getCode
().
equals
(
householdPvApiDto
.
getProducerId
()))
{
JLYHeaderMapHandler
(
params
,
householdPvApiDto
,
headMap
,
orginalAuthorization
,
appsecret
,
null
);
}
respone
=
sendRequest
(
householdPvApiDto
.
getRequestMethod
(),
url
,
householdPvApiDto
.
getParamInfo
(),
headMap
);
jsonArray
=
handlerResponseByResultResolverule
(
householdPvApiDto
.
getResultResolveRule
(),
respone
);
handleResponseAndCacheData
(
String
.
valueOf
(
seq
),
householdPvApiDto
.
getCacheField
(),
jsonArray
,
householdPvApiDto
.
getMeasurement
());
if
(
ObjectUtil
.
isNotEmpty
(
householdPvApiDto
.
getIsPage
()))
{
Integer
size
=
getPagesize
(
householdPvApiDto
.
getPagesizeResolveRule
(),
respone
);
for
(
int
i
=
1
;
i
<
size
;
i
++)
{
JSONObject
jsonObject
=
JSON
.
parseObject
(
householdPvApiDto
.
getParamInfo
());
if
(
ObjectUtil
.
isNotEmpty
(
householdPvApiDto
.
getPageField
()))
{
jsonObject
.
put
(
householdPvApiDto
.
getPageField
(),
i
+
1
);
}
params
=
jsonObject
.
toJSONString
();
if
(
PVProducerInfoEnum
.
JLY
.
getCode
().
equals
(
householdPvApiDto
.
getProducerId
()))
{
JLYHeaderMapHandler
(
params
,
householdPvApiDto
,
headMap
,
orginalAuthorization
,
appsecret
,
null
);
}
respone
=
sendRequest
(
householdPvApiDto
.
getRequestMethod
(),
url
,
householdPvApiDto
.
getParamInfo
(),
headMap
);
jsonArray
=
handlerResponseByResultResolverule
(
householdPvApiDto
.
getResultResolveRule
(),
respone
);
handleResponseAndCacheData
(
String
.
valueOf
(
seq
),
householdPvApiDto
.
getCacheField
(),
jsonArray
,
householdPvApiDto
.
getMeasurement
());
}
}
}
return
respone
;
}
/**
* @param resultResovle 请求返回的解析规则 来源与数据库
* @param response 请求返回的字符串
* @return 解析后的数据
*/
public
JSONArray
handlerResponseByResultResolverule
(
String
resultResovle
,
String
response
)
{
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
response
);
JSONArray
jsonArray
=
new
JSONArray
();
if
(
ObjectUtil
.
isNotEmpty
(
resultResovle
))
{
String
[]
rules
=
resultResovle
.
split
(
","
);
if
(
rules
.
length
>
0
)
{
for
(
int
i
=
0
;
i
<
rules
.
length
;
i
++)
{
try
{
jsonObject
=
(
JSONObject
)
jsonObject
.
get
(
rules
[
i
]);
if
(
jsonObject
==
null
)
{
jsonArray
=
(
JSONArray
)
jsonObject
.
get
(
rules
[
i
]);
}
}
catch
(
Exception
exception
)
{
jsonArray
=
(
JSONArray
)
jsonObject
.
get
(
rules
[
i
]);
}
}
}
if
(
jsonArray
.
size
()
==
0
)
{
jsonArray
.
add
(
jsonObject
);
}
}
return
jsonArray
;
}
/**
* @param seq apiID
* @param cacheField 要缓存的字段
* @param jsonArray 处理后的数据请求
* @param measurement 要在influxdb中存储的数
* @describe 该方法用于缓存需要缓存的字段 且将需要入库的数据进行入库
*/
public
void
handleResponseAndCacheData
(
String
seq
,
String
cacheField
,
JSONArray
jsonArray
,
String
measurement
)
{
String
apiID
=
API_REDIS_PREFIX
+
seq
;
List
list
=
new
ArrayList
();
List
saveList
=
new
ArrayList
();
if
(
jsonArray
.
size
()
>
0
)
{
for
(
Object
o
:
jsonArray
)
{
Map
<
String
,
Object
>
maps1
=
(
Map
<
String
,
Object
>)
o
;
Set
<
String
>
keys
=
maps1
.
keySet
();
keys
.
forEach
((
key
)
->
{
maps1
.
put
(
key
,
maps1
.
get
(
key
).
toString
());
});
if
(
cacheField
!=
null
)
{
list
.
add
(
maps1
.
get
(
cacheField
));
}
Map
<
String
,
String
>
maps2
=
new
HashMap
<>();
maps2
.
put
(
"key"
,
UUID
.
randomUUID
().
toString
());
if
(
measurement
!=
null
)
{
influxDbConnection
.
insert
(
measurement
,
maps2
,
maps1
);
}
}
}
if
(
cacheField
!=
null
)
{
saveList
=
Redis
.
getRedisTemplate
().
opsForList
().
range
(
apiID
,
0
,
-
1
);
if
(
saveList
.
size
()
==
0
)
{
Redis
.
getRedisTemplate
().
opsForList
().
leftPushAll
(
apiID
,
list
);
}
saveList
=
Redis
.
getRedisTemplate
().
opsForList
().
range
(
apiID
,
0
,
-
1
);
if
(
saveList
.
size
()
!=
list
.
size
())
{
Redis
.
getRedisTemplate
().
delete
(
apiID
);
Redis
.
getRedisTemplate
().
opsForList
().
leftPushAll
(
apiID
,
list
);
}
}
}
public
String
sendRequest
(
String
requestMethod
,
String
url
,
String
params
,
HashMap
<
String
,
String
>
headMap
)
{
String
respone
=
""
;
if
(
requestMethod
.
equals
(
"POST"
))
{
respone
=
HttpUtil
.
createPost
(
url
).
headerMap
(
headMap
,
false
).
body
(
params
).
execute
().
body
();
}
if
(
requestMethod
.
equals
(
"GET"
))
{
respone
=
HttpUtil
.
createGet
(
url
).
headerMap
(
headMap
,
true
).
body
(
params
).
execute
().
body
();
}
return
respone
;
}
/***
*
* @param params 参数字符窜
* @param householdPvApiDto apidto
* @param headMap header头
* @param orginalAuthorization 原始的orginalAuthorization
* @param appsecret appsecret
* @param cacheParams 缓存的参数值
* @desc 锦浪云请求参数及head头处理
*/
public
void
JLYHeaderMapHandler
(
String
params
,
HouseholdPvApiDto
householdPvApiDto
,
HashMap
<
String
,
String
>
headMap
,
String
orginalAuthorization
,
String
appsecret
,
String
cacheParams
)
{
if
(
PVProducerInfoEnum
.
JLY
.
getCode
().
equals
(
householdPvApiDto
.
getProducerId
()))
{
String
contentMD5
=
GoLangHeaderUtils
.
getDigest
(
params
);
headMap
.
put
(
"Date"
,
GoLangHeaderUtils
.
getGMTTime
());
String
param
=
"POST"
+
"\n"
+
contentMD5
+
"\n"
+
"application/json"
+
"\n"
+
headMap
.
get
(
"Date"
)
+
"\n"
+
householdPvApiDto
.
getApiUrl
();
String
sign
=
""
;
try
{
sign
=
GoLangHeaderUtils
.
HmacSHA1Encrypt
(
param
,
appsecret
);
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
e
);
}
headMap
.
put
(
"Content-MD5"
,
contentMD5
);
headMap
.
put
(
"Authorization"
,
orginalAuthorization
+
sign
);
}
}
public
Integer
getPagesize
(
String
pageSizeResovle
,
String
response
)
{
Integer
pageSize
=
0
;
String
[]
rules
=
pageSizeResovle
.
split
(
","
);
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
response
);
if
(
rules
.
length
>
0
)
{
for
(
int
i
=
0
;
i
<
rules
.
length
-
1
;
i
++)
{
jsonObject
=
(
JSONObject
)
jsonObject
.
get
(
rules
[
i
]);
}
}
pageSize
=
(
Integer
)
jsonObject
.
get
(
rules
[
rules
.
length
-
1
]);
return
pageSize
;
}
}
//
package com.yeejoin.amos.api.householdapi.Utils;
//
//
import cn.hutool.Hutool;
//
import cn.hutool.core.util.ObjectUtil;
//
import cn.hutool.http.HttpUtil;
//
import com.alibaba.fastjson.JSON;
//
import com.alibaba.fastjson.JSONArray;
//
import com.alibaba.fastjson.JSONObject;
//
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
//
import com.qiniu.util.Json;
//
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.orm.entity.HouseholdPvProducerInfo;
//
import com.yeejoin.amos.api.householdapi.face.service.impl.HouseholdPvApiServiceImpl;
//
import com.yeejoin.amos.api.householdapi.face.service.impl.HouseholdPvProducerInfoServiceImpl;
//
import com.yeejoin.amos.component.influxdb.InfluxDbConnection;
//
import com.yeejoin.amos.openapi.enums.PVProducerInfoEnum;
//
import io.swagger.annotations.ApiModelProperty;
//
import io.swagger.models.auth.In;
//
import org.springframework.beans.factory.annotation.Autowired;
//
import org.springframework.stereotype.Component;
//
import org.typroject.tyboot.component.cache.Redis;
//
//
import java.util.*;
//
//
@Component
//
public class HouseholdPvUtils {
//
@Autowired
//
private HouseholdPvProducerInfoServiceImpl householdPvProducerInfoServiceImpl;
//
@Autowired
//
private HouseholdPvApiServiceImpl householdPvApiServiceImpl;
//
//
@Autowired
//
InfluxDbConnection influxDbConnection;
//
//
private final static String API_REDIS_PREFIX = "HOUSEHOLD_API_CACHE_" +
//
"";
//
//
/**
//
* @param code 厂商code
//
* @return HashMap<String, Object> 发送请求前的准备 准备header信息
//
* @deprecated 根据厂商编码获取厂商的hearer
//
*/
//
public HashMap<String, Object> getHeaderByProducerCode(String code) {
//
HashMap<String, Object> hashMap = new HashMap<>();
//
HashMap<String, String> hashMaphead = new HashMap<>();
//
HouseholdPvProducerInfo householdPvProducerInfo = this.householdPvProducerInfoServiceImpl.queryForHouseholdPvProducerInfoByCode(code);
//
String url = householdPvProducerInfo.getProdcerUrl() + householdPvProducerInfo.getTokenUrl();
//
hashMap.put("apiurl", householdPvProducerInfo.getProdcerUrl());
//
if (PVProducerInfoEnum.GDW.getCode().equals(code)) {
//
HashMap<String, String> map = new HashMap<>();
//
map.put("account", householdPvProducerInfo.getProdcerAccount());
//
map.put("pwd", householdPvProducerInfo.getProdcerPassword());
//
String body = JSON.toJSONString(map);
//
String response = HttpUtil.createPost(url).body(body).execute().body();
//
JSONObject jsonObject = JSON.parseObject(response);
//
if (jsonObject.get("data") != null) {
//
JSONObject jsonObject1 = (JSONObject) jsonObject.get("data");
//
hashMaphead.put("token", (String) jsonObject1.get("token"));
//
hashMap.put("header", hashMaphead);
//
}
//
} else if (PVProducerInfoEnum.SH.getCode().equals(code)) {
//
HashMap<String, Object> map = new HashMap<>();
//
map.put("accountName", householdPvProducerInfo.getProdcerAccount());
//
map.put("appId", householdPvProducerInfo.getProdcerAppid());
//
map.put("appSecret", householdPvProducerInfo.getProdcerAppsecret());
//
map.put("corporationId", householdPvProducerInfo.getCorporationId());
//
map.put("accountType", 2);
//
String body = JSON.toJSONString(map);
//
String response = HttpUtil.createPost(url).body(body).execute().body();
//
JSONObject jsonObject = JSON.parseObject(response);
//
hashMaphead.put("Authorization", (String) jsonObject.get("data"));
//
hashMap.put("header", hashMaphead);
//
} else if (PVProducerInfoEnum.JLY.getCode().equals(code)) {
//
hashMaphead.put("Content-type", "application/json;charset=UTF-8");
//
hashMaphead.put("Authorization", "API " + householdPvProducerInfo.getProdcerAppid());
//
hashMaphead.put("Content-MD5", null);
//
hashMaphead.put("Date", GoLangHeaderUtils.getGMTTime());
//
hashMap.put("header", hashMaphead);
//
hashMap.put("appsecret", householdPvProducerInfo.getProdcerAppsecret());
//
}
//
return hashMap;
//
}
//
//
/**
//
* @param seq apiId 数据库中维护的的apiId
//
* @return String 请求返回的response字符串
//
*/
//
public String gerResponseByAPiID(Long seq) {
//
List cacheParams = new ArrayList();
//
String respone = "";
//
String params = "";
//
JSONArray jsonArray = null;
//
HouseholdPvApiDto householdPvApiDto = this.householdPvApiServiceImpl.queryBySeq(seq);
//
HashMap<String, Object> producerInfo = this.getHeaderByProducerCode(householdPvApiDto.getProducerId());
//
String baseurl = (String) producerInfo.get("apiurl");
//
HashMap<String, String> headMap = (HashMap<String, String>) producerInfo.get("header");
//
String orginalAuthorization = headMap.get("Authorization") + ":";
//
String url = baseurl + householdPvApiDto.getApiUrl();
//
String appsecret = (String) producerInfo.get("appsecret");
//
if (ObjectUtil.isNotEmpty(householdPvApiDto.getDependecyApiId())) {
//
String RedisKey = API_REDIS_PREFIX + householdPvApiDto.getDependecyApiId();
//
cacheParams = Redis.getRedisTemplate().opsForList().range(RedisKey, 0, -1);
//
if (cacheParams.size() > 0) {
//
for (int i = 0; i < cacheParams.size(); i++) {
//
JSONObject jsonObject = JSON.parseObject(householdPvApiDto.getParamInfo());
//
if (ObjectUtil.isNotEmpty(householdPvApiDto.getDependApiParamKey())) {
//
jsonObject.put(householdPvApiDto.getDependApiParamKey(), cacheParams.get(i));
//
}
//
params = jsonObject.toJSONString();
//
if (PVProducerInfoEnum.JLY.getCode().equals(householdPvApiDto.getProducerId())) {
//
JLYHeaderMapHandler(params, householdPvApiDto, headMap, orginalAuthorization, appsecret, (String) cacheParams.get(i));
//
}
//
try {
//
Thread.sleep(500);
//
respone = sendRequest(householdPvApiDto.getRequestMethod(), url, params, headMap);
//
jsonArray = handlerResponseByResultResolverule(householdPvApiDto.getResultResolveRule(), respone);
//
handleResponseAndCacheData(String.valueOf(seq), householdPvApiDto.getCacheField(), jsonArray, householdPvApiDto.getMeasurement());
//
} catch (Exception e) {
//
e.printStackTrace();
//
} finally {
//
continue;
//
}
//
}
//
}
//
} else {
//
if (PVProducerInfoEnum.JLY.getCode().equals(householdPvApiDto.getProducerId())) {
//
JLYHeaderMapHandler(params, householdPvApiDto, headMap, orginalAuthorization, appsecret, null);
//
}
//
respone = sendRequest(householdPvApiDto.getRequestMethod(), url, householdPvApiDto.getParamInfo(), headMap);
//
jsonArray = handlerResponseByResultResolverule(householdPvApiDto.getResultResolveRule(), respone);
//
handleResponseAndCacheData(String.valueOf(seq), householdPvApiDto.getCacheField(), jsonArray, householdPvApiDto.getMeasurement());
//
if (ObjectUtil.isNotEmpty(householdPvApiDto.getIsPage())) {
//
Integer size = getPagesize(householdPvApiDto.getPagesizeResolveRule(), respone);
//
for (int i = 1; i < size; i++) {
//
JSONObject jsonObject = JSON.parseObject(householdPvApiDto.getParamInfo());
//
if (ObjectUtil.isNotEmpty(householdPvApiDto.getPageField())) {
//
jsonObject.put(householdPvApiDto.getPageField(), i + 1);
//
}
//
params = jsonObject.toJSONString();
//
if (PVProducerInfoEnum.JLY.getCode().equals(householdPvApiDto.getProducerId())) {
//
JLYHeaderMapHandler(params, householdPvApiDto, headMap, orginalAuthorization, appsecret, null);
//
}
//
respone = sendRequest(householdPvApiDto.getRequestMethod(), url, householdPvApiDto.getParamInfo(), headMap);
//
jsonArray = handlerResponseByResultResolverule(householdPvApiDto.getResultResolveRule(), respone);
//
handleResponseAndCacheData(String.valueOf(seq), householdPvApiDto.getCacheField(), jsonArray, householdPvApiDto.getMeasurement());
//
}
//
}
//
//
}
//
return respone;
//
}
//
//
/**
//
* @param resultResovle 请求返回的解析规则 来源与数据库
//
* @param response 请求返回的字符串
//
* @return 解析后的数据
//
*/
//
public JSONArray handlerResponseByResultResolverule(String resultResovle, String response) {
//
JSONObject jsonObject = JSONObject.parseObject(response);
//
JSONArray jsonArray = new JSONArray();
//
if (ObjectUtil.isNotEmpty(resultResovle)) {
//
String[] rules = resultResovle.split(",");
//
if (rules.length > 0) {
//
for (int i = 0; i < rules.length; i++) {
//
try {
//
jsonObject = (JSONObject) jsonObject.get(rules[i]);
//
if (jsonObject == null) {
//
jsonArray = (JSONArray) jsonObject.get(rules[i]);
//
}
//
} catch (Exception exception) {
//
jsonArray = (JSONArray) jsonObject.get(rules[i]);
//
}
//
}
//
}
//
if (jsonArray.size() == 0) {
//
jsonArray.add(jsonObject);
//
}
//
}
//
return jsonArray;
//
}
//
//
/**
//
* @param seq apiID
//
* @param cacheField 要缓存的字段
//
* @param jsonArray 处理后的数据请求
//
* @param measurement 要在influxdb中存储的数
//
* @describe 该方法用于缓存需要缓存的字段 且将需要入库的数据进行入库
//
*/
//
public void handleResponseAndCacheData(String seq, String cacheField, JSONArray jsonArray, String measurement) {
//
String apiID = API_REDIS_PREFIX + seq;
//
List list = new ArrayList();
//
List saveList = new ArrayList();
//
if (jsonArray.size() > 0) {
//
for (Object o : jsonArray) {
//
Map<String, Object> maps1 = (Map<String, Object>) o;
//
Set<String> keys = maps1.keySet();
//
keys.forEach((key) -> {
//
maps1.put(key, maps1.get(key).toString());
//
});
//
if (cacheField != null) {
//
list.add(maps1.get(cacheField));
//
}
//
Map<String, String> maps2 = new HashMap<>();
//
maps2.put("key", UUID.randomUUID().toString());
//
if (measurement != null) {
//
influxDbConnection.insert(measurement, maps2, maps1);
//
}
//
//
}
//
}
//
if (cacheField != null) {
//
saveList = Redis.getRedisTemplate().opsForList().range(apiID, 0, -1);
//
if (saveList.size() == 0) {
//
Redis.getRedisTemplate().opsForList().leftPushAll(apiID, list);
//
}
//
saveList = Redis.getRedisTemplate().opsForList().range(apiID, 0, -1);
//
if (saveList.size() != list.size()) {
//
Redis.getRedisTemplate().delete(apiID);
//
Redis.getRedisTemplate().opsForList().leftPushAll(apiID, list);
//
}
//
}
//
}
//
//
public String sendRequest(String requestMethod, String url, String params, HashMap<String, String> headMap) {
//
String respone = "";
//
if (requestMethod.equals("POST")) {
//
respone = HttpUtil.createPost(url).headerMap(headMap, false).
//
body(params).execute().body();
//
}
//
if (requestMethod.equals("GET")) {
//
respone = HttpUtil.createGet(url).headerMap(headMap, true).
//
body(params).execute().body();
//
}
//
return respone;
//
}
//
//
/***
//
*
//
* @param params 参数字符窜
//
* @param householdPvApiDto apidto
//
* @param headMap header头
//
* @param orginalAuthorization 原始的orginalAuthorization
//
* @param appsecret appsecret
//
* @param cacheParams 缓存的参数值
//
* @desc 锦浪云请求参数及head头处理
//
*/
//
public void JLYHeaderMapHandler(String params, HouseholdPvApiDto householdPvApiDto, HashMap<String, String> headMap, String orginalAuthorization, String appsecret, String cacheParams) {
//
if (PVProducerInfoEnum.JLY.getCode().equals(householdPvApiDto.getProducerId())) {
//
String contentMD5 = GoLangHeaderUtils.getDigest(params);
//
headMap.put("Date", GoLangHeaderUtils.getGMTTime());
//
String param = "POST" + "\n" + contentMD5 + "\n" + "application/json" + "\n" + headMap.get("Date") + "\n" + householdPvApiDto.getApiUrl();
//
String sign = "";
//
try {
//
sign = GoLangHeaderUtils.HmacSHA1Encrypt(param, appsecret);
//
} catch (Exception e) {
//
throw new RuntimeException(e);
//
}
//
headMap.put("Content-MD5", contentMD5);
//
headMap.put("Authorization", orginalAuthorization + sign);
//
}
//
}
//
//
public Integer getPagesize(String pageSizeResovle, String response) {
//
Integer pageSize = 0;
//
String[] rules = pageSizeResovle.split(",");
//
JSONObject jsonObject = JSONObject.parseObject(response);
//
if (rules.length > 0) {
//
for (int i = 0; i < rules.length - 1; i++) {
//
jsonObject = (JSONObject) jsonObject.get(rules[i]);
//
}
//
}
//
pageSize = (Integer) jsonObject.get(rules[rules.length - 1]);
//
return pageSize;
//
}
//
}
amos-boot-data/amos-boot-data-accessapi/src/main/java/com/yeejoin/amos/api/householdapi/controller/HouseholdTestController.java
View file @
cd54953c
package
com
.
yeejoin
.
amos
.
api
.
householdapi
.
controller
;
import
cn.hutool.http.HttpUtil
;
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.HouseholdPvProducerInfoDto
;
import
com.yeejoin.amos.api.householdapi.face.service.impl.HouseholdPvApiServiceImpl
;
import
com.yeejoin.amos.api.householdapi.face.service.impl.HouseholdPvProducerInfoServiceImpl
;
import
com.yeejoin.amos.openapi.enums.PVProducerInfoEnum
;
import
fastjson.JSON
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.typroject.tyboot.core.foundation.enumeration.UserType
;
import
org.typroject.tyboot.core.restful.doc.TycloudOperation
;
import
java.io.IOException
;
import
java.util.HashMap
;
import
java.util.Map
;
/**
* 户用光伏-厂商API haders
*
* @author system_generator
* @date 2023-06-07
*/
@RestController
@Api
(
tags
=
"测试"
)
@RequestMapping
(
value
=
"/household-pv-api-test1"
)
public
class
HouseholdTestController
{
@Autowired
private
HouseholdPvUtils
householdPvUtils
;
/**
* 新增户用光伏-厂商API haders
*
* @return
*/
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
,
needAuth
=
false
)
@PostMapping
(
value
=
"/gdwdemo"
)
@ApiOperation
(
httpMethod
=
"get"
,
value
=
"固德威示例"
,
notes
=
"固德威示例"
)
public
String
save
(
Long
seq
)
throws
IOException
{
return
householdPvUtils
.
gerResponseByAPiID
(
seq
);
}
}
//
package com.yeejoin.amos.api.householdapi.controller;
//
//
import cn.hutool.http.HttpUtil;
//
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.HouseholdPvProducerInfoDto;
//
import com.yeejoin.amos.api.householdapi.face.service.impl.HouseholdPvApiServiceImpl;
//
import com.yeejoin.amos.api.householdapi.face.service.impl.HouseholdPvProducerInfoServiceImpl;
//
import com.yeejoin.amos.openapi.enums.PVProducerInfoEnum;
//
import fastjson.JSON;
//
import io.swagger.annotations.Api;
//
import io.swagger.annotations.ApiOperation;
//
import org.springframework.beans.factory.annotation.Autowired;
//
import org.springframework.web.bind.annotation.PostMapping;
//
import org.springframework.web.bind.annotation.RequestMapping;
//
import org.springframework.web.bind.annotation.RestController;
//
import org.typroject.tyboot.core.foundation.enumeration.UserType;
//
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
//
//
import java.io.IOException;
//
import java.util.HashMap;
//
import java.util.Map;
//
//
/
//
**
//
* 户用光伏-厂商API haders
//
*
//
* @author system_generator
//
* @date 2023-06-07
//
*/
//
@RestController
//
@Api(tags = "测试")
//
@RequestMapping(value = "/household-pv-api-test1")
//
public class HouseholdTestController {
//
@Autowired
//
private HouseholdPvUtils householdPvUtils;
//
//
//
/**
//
* 新增户用光伏-厂商API haders
//
*
//
* @return
//
*/
//
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
//
@PostMapping(value = "/gdwdemo")
//
@ApiOperation(httpMethod = "get", value = "固德威示例", notes = "固德威示例")
//
public String save(Long seq) throws IOException {
//
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 @
cd54953c
...
...
@@ -10,6 +10,8 @@ import com.csoft.sdk.domain.CsoftDataApiXixianGetzhutiinfoParam;
import
com.csoft.sdk.domain.request.CsoftDataApiXixianGetzhutiinfoRequest
;
import
com.csoft.sdk.domain.response.CsoftDataApiXixianGetzhutiinfoResponse
;
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.stereotype.Service
;
import
org.typroject.tyboot.core.foundation.utils.ValidationUtil
;
...
...
@@ -34,7 +36,7 @@ import com.yeejoin.amos.api.openapi.face.orm.entity.TaLicenseBaseInfo;
*/
@Service
public
class
TaBusinessServiceImpl
extends
BaseService
<
TaAccessConfigModel
,
TaAccessConfig
,
TaAccessConfigMapper
>
{
private
final
Logger
log
=
LoggerFactory
.
getLogger
(
TaBusinessServiceImpl
.
class
);
@Autowired
private
DataDictionaryMapper
dataDictionaryMapper
;
...
...
@@ -50,8 +52,16 @@ public class TaBusinessServiceImpl extends BaseService<TaAccessConfigModel, TaAc
CsoftDataApiXixianGetzhutiinfoParam
csoftDataApiXixianParam
=
new
CsoftDataApiXixianGetzhutiinfoParam
();
csoftDataApiXixianParam
.
setUniscid
(
code
);
CsoftDataApiXixianGetzhutiinfoRequest
request
=
new
CsoftDataApiXixianGetzhutiinfoRequest
(
csoftDataApiXixianParam
);
CsoftDataApiXixianGetzhutiinfoResponse
response
=
client
.
execute
(
request
);
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.返回校验
if
(
response
.
isSuccess
())
{
System
.
out
.
println
(
"成功:"
+
response
.
getData
());
...
...
amos-boot-data/amos-boot-data-accessapi/src/main/java/com/yeejoin/amos/dockingData/DockingData.java
View file @
cd54953c
package
com
.
yeejoin
.
amos
.
dockingData
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.sun.scenario.effect.impl.sw.sse.SSEBlend_SRC_OUTPeer
;
import
com.yeejoin.amos.api.householdapi.Utils.HouseholdPvUtils
;
import
com.yeejoin.amos.component.influxdb.InfluxDbConnection
;
import
org.jetbrains.annotations.TestOnly
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.boot.actuate.influx.InfluxDbHealthIndicator
;
import
org.springframework.scheduling.annotation.Scheduled
;
import
org.springframework.stereotype.Component
;
import
javax.annotation.PostConstruct
;
import
java.util.HashMap
;
import
java.util.LinkedHashMap
;
import
java.util.Map
;
import
java.util.UUID
;
import
java.util.zip.Inflater
;
/**
* @description:
* @author: tw
* @createDate: 2023/6/16
*/
@Component
public
class
DockingData
{
@Autowired
InfluxDbConnection
influxDbConnection
;
@Autowired
HouseholdPvUtils
householdPvUtils
;
//初始化执行
@PostConstruct
public
void
init
(){
this
.
getDate
();
}
//每二十分钟执行一次
@Scheduled
(
cron
=
"0 0/20 * * * ?"
)
public
void
fixedRate
()
{
this
.
getDate
();
}
//请求获取数据
public
void
getDate
(){
//首航
String
data1
=
householdPvUtils
.
gerResponseByAPiID
(
1000000002L
);
JSONObject
json
=
JSON
.
parseObject
(
data1
);
if
((
Boolean
)
json
.
get
(
"success"
)){
JSONArray
obj
=
json
.
get
(
"stationList"
)
!=
null
?(
JSONArray
)
json
.
get
(
"stationList"
):
null
;
if
(
obj
!=
null
)
{
for
(
Object
o
:
obj
)
{
Map
<
String
,
Object
>
maps1
=
(
Map
<
String
,
Object
>)
o
;
Map
<
String
,
String
>
maps2
=
new
HashMap
<>();
maps2
.
put
(
"key"
,
UUID
.
randomUUID
().
toString
());
influxDbConnection
.
insert
(
"SH_DZ"
,
maps2
,
maps1
);
}
}
}
String
data2
=
householdPvUtils
.
gerResponseByAPiID
(
1000000003L
);
JSONObject
json2
=
JSON
.
parseObject
(
data2
);
if
((
Boolean
)
json2
.
get
(
"success"
))
{
JSONArray
obj2
=
json
.
get
(
"deviceList"
)
!=
null
?
(
JSONArray
)
json2
.
get
(
"deviceList"
)
:
null
;
if
(
obj2
!=
null
)
{
for
(
Object
o
:
obj2
)
{
Map
<
String
,
Object
>
maps1
=
(
Map
<
String
,
Object
>)
o
;
Map
<
String
,
String
>
maps2
=
new
HashMap
<>();
maps2
.
put
(
"key"
,
UUID
.
randomUUID
().
toString
());
influxDbConnection
.
insert
(
"SH_ZB"
,
maps2
,
maps1
);
}
}
}
//固德威
String
data3
=
householdPvUtils
.
gerResponseByAPiID
(
1000000006L
);
JSONObject
json3
=
JSON
.
parseObject
(
data3
);
if
(
Integer
.
valueOf
(
json3
.
get
(
"code"
).
toString
())==
0
)
{
JSONObject
obj3
=
json3
.
get
(
"data"
)
!=
null
?
(
JSONObject
)
json3
.
get
(
"data"
)
:
null
;
if
(
obj3
!=
null
&&
obj3
.
get
(
"list"
)!=
null
)
{
JSONArray
ob
=
obj3
.
get
(
"list"
)
!=
null
?
(
JSONArray
)
obj3
.
get
(
"list"
)
:
null
;
for
(
Object
o
:
ob
)
{
Map
<
String
,
Object
>
maps1
=
(
Map
<
String
,
Object
>)
o
;
Map
<
String
,
String
>
maps2
=
new
HashMap
<>();
maps2
.
put
(
"key"
,
UUID
.
randomUUID
().
toString
());
influxDbConnection
.
insert
(
"GD_DZ"
,
maps2
,
maps1
);
}
}
}
String
data4
=
householdPvUtils
.
gerResponseByAPiID
(
1000000007L
);
JSONObject
json4
=
JSON
.
parseObject
(
data4
);
if
(
Integer
.
valueOf
(
json4
.
get
(
"code"
).
toString
())==
0
)
{
JSONObject
obj4
=
json4
.
get
(
"data"
)
!=
null
?
(
JSONObject
)
json4
.
get
(
"data"
)
:
null
;
if
(
obj4
!=
null
&&
obj4
.
get
(
"list"
)!=
null
)
{
JSONArray
ob
=
obj4
.
get
(
"list"
)
!=
null
?
(
JSONArray
)
obj4
.
get
(
"list"
)
:
null
;
for
(
Object
o
:
ob
)
{
Map
<
String
,
Object
>
maps1
=
(
Map
<
String
,
Object
>)
o
;
Map
<
String
,
String
>
maps2
=
new
HashMap
<>();
maps2
.
put
(
"key"
,
UUID
.
randomUUID
().
toString
());
influxDbConnection
.
insert
(
"GD_ZT"
,
maps2
,
maps1
);
}
}
}
String
data5
=
householdPvUtils
.
gerResponseByAPiID
(
1000000008L
);
JSONObject
json5
=
JSON
.
parseObject
(
data5
);
if
(
Integer
.
valueOf
(
json5
.
get
(
"code"
).
toString
())==
0
)
{
JSONObject
obj5
=
json5
.
get
(
"data"
)
!=
null
?
(
JSONObject
)
json5
.
get
(
"data"
)
:
null
;
if
(
obj5
!=
null
&&
obj5
.
get
(
"list"
)!=
null
)
{
JSONArray
ob
=
obj5
.
get
(
"list"
)
!=
null
?
(
JSONArray
)
obj5
.
get
(
"list"
)
:
null
;
for
(
Object
o
:
ob
)
{
Map
<
String
,
Object
>
maps1
=
(
Map
<
String
,
Object
>)
o
;
Map
<
String
,
String
>
maps2
=
new
HashMap
<>();
maps2
.
put
(
"key"
,
UUID
.
randomUUID
().
toString
());
influxDbConnection
.
insert
(
"GD_GJ"
,
maps2
,
maps1
);
}
}
}
String
data6
=
householdPvUtils
.
gerResponseByAPiID
(
1686897906789L
);
JSONObject
json6
=
JSON
.
parseObject
(
data6
);
if
(
Integer
.
valueOf
(
json6
.
get
(
"code"
).
toString
())==
0
)
{
JSONObject
obj6
=
json6
.
get
(
"data"
)
!=
null
?
(
JSONObject
)
json6
.
get
(
"data"
)
:
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
;
for
(
Object
o
:
ob
)
{
Map
<
String
,
Object
>
maps1
=
(
Map
<
String
,
Object
>)
o
;
Map
<
String
,
String
>
maps2
=
new
HashMap
<>();
maps2
.
put
(
"key"
,
UUID
.
randomUUID
().
toString
());
influxDbConnection
.
insert
(
"JL_CZ"
,
maps2
,
maps1
);
}
}
}
String
data7
=
householdPvUtils
.
gerResponseByAPiID
(
1686900771946L
);
JSONObject
json7
=
JSON
.
parseObject
(
data7
);
if
(
Integer
.
valueOf
(
json7
.
get
(
"code"
).
toString
())==
0
)
{
JSONObject
obj7
=
json7
.
get
(
"data"
)
!=
null
?
(
JSONObject
)
json7
.
get
(
"data"
)
:
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
;
for
(
Object
o
:
ob
)
{
Map
<
String
,
Object
>
maps1
=
(
Map
<
String
,
Object
>)
o
;
Map
<
String
,
String
>
maps2
=
new
HashMap
<>();
maps2
.
put
(
"key"
,
UUID
.
randomUUID
().
toString
());
maps1
.
put
(
"etotal1"
,
maps1
.
get
(
"etotal1"
).
toString
());
maps1
.
put
(
"etoday1"
,
maps1
.
get
(
"etoday1"
).
toString
());
influxDbConnection
.
insert
(
"JL_NBQ"
,
maps2
,
maps1
);
}
}
}
String
data8
=
householdPvUtils
.
gerResponseByAPiID
(
1686900972965L
);
JSONObject
json8
=
JSON
.
parseObject
(
data8
);
if
(
Integer
.
valueOf
(
json8
.
get
(
"code"
).
toString
())==
0
)
{
JSONObject
obj8
=
json8
.
get
(
"data"
)
!=
null
?
(
JSONObject
)
json8
.
get
(
"data"
)
:
null
;
if
(
obj8
!=
null
&&
obj8
.
get
(
"records"
)!=
null
)
{
JSONArray
ob
=
obj8
.
get
(
"records"
)!=
null
?
(
JSONArray
)
obj8
.
get
(
"records"
)
:
null
;
for
(
Object
o
:
ob
)
{
Map
<
String
,
Object
>
maps1
=
(
Map
<
String
,
Object
>)
o
;
Map
<
String
,
String
>
maps2
=
new
HashMap
<>();
maps2
.
put
(
"key"
,
UUID
.
randomUUID
().
toString
());
influxDbConnection
.
insert
(
"JL_GJ"
,
maps2
,
maps1
);
}
}
}
}
}
//
package com.yeejoin.amos.dockingData;
//
//
import com.alibaba.fastjson.JSON;
//
import com.alibaba.fastjson.JSONArray;
//
import com.alibaba.fastjson.JSONObject;
//
import com.sun.scenario.effect.impl.sw.sse.SSEBlend_SRC_OUTPeer;
//
import com.yeejoin.amos.api.householdapi.Utils.HouseholdPvUtils;
//
import com.yeejoin.amos.component.influxdb.InfluxDbConnection;
//
import org.jetbrains.annotations.TestOnly;
//
import org.springframework.beans.factory.annotation.Autowired;
//
import org.springframework.beans.factory.annotation.Value;
//
import org.springframework.boot.actuate.influx.InfluxDbHealthIndicator;
//
import org.springframework.scheduling.annotation.Scheduled;
//
import org.springframework.stereotype.Component;
//
//
import javax.annotation.PostConstruct;
//
import java.util.HashMap;
//
import java.util.LinkedHashMap;
//
import java.util.Map;
//
import java.util.UUID;
//
import java.util.zip.Inflater;
//
/
//
**
//
* @description:
//
* @author: tw
//
* @createDate: 2023/6/16
//
*/
//
@Component
//
public class DockingData {
//
//
//
@Autowired
//
InfluxDbConnection influxDbConnection;
//
@Autowired
//
HouseholdPvUtils householdPvUtils;
//
//初始化执行
//
@PostConstruct
//
public void init(){
//
this.getDate();
//
}
//
//
//
//每二十分钟执行一次
//
@Scheduled(cron = "0 0/20 * * * ?")
//
public void fixedRate() {
//
this.getDate();
//
}
//
//
//请求获取数据
//
public void getDate(){
//
//
//
//首航
//
String data1=householdPvUtils.gerResponseByAPiID(1000000002L);
//
JSONObject json= JSON.parseObject(data1);
//
//
if((Boolean)json.get("success")){
//
JSONArray obj= json.get("stationList") !=null?(JSONArray)json.get("stationList"):null;
//
if (obj!=null) {
//
for (Object o : obj) {
//
Map<String,Object> maps1 = (Map<String,Object>)o;
//
Map<String,String> maps2=new HashMap<>();
//
maps2.put("key", UUID.randomUUID().toString());
//
influxDbConnection.insert("SH_DZ",maps2,maps1);
//
}
//
}
//
}
//
//
String data2=householdPvUtils.gerResponseByAPiID(1000000003L);
//
JSONObject json2= JSON.parseObject(data2);
//
if((Boolean)json2.get("success")) {
//
JSONArray obj2 = json.get("deviceList") != null ? (JSONArray) json2.get("deviceList") : null;
//
if (obj2!=null) {
//
for (Object o : obj2) {
//
Map<String, Object> maps1 = (Map<String, Object>) o;
//
Map<String, String> maps2 = new HashMap<>();
//
maps2.put("key", UUID.randomUUID().toString());
//
influxDbConnection.insert("SH_ZB", maps2, maps1);
//
}
//
}
//
}
//
//
//固德威
//
String data3 = householdPvUtils.gerResponseByAPiID(1000000006L);
//
//
JSONObject json3= JSON.parseObject(data3);
//
if(Integer.valueOf(json3.get("code").toString())==0) {
//
JSONObject obj3 = json3.get("data") != null ? (JSONObject)json3.get("data") : null;
//
if (obj3!=null&&obj3.get("list")!=null) {
//
//
JSONArray ob = obj3.get("list") != null ? (JSONArray) obj3.get("list") : null;
//
//
for (Object o : ob) {
//
Map<String, Object> maps1 = (Map<String, Object>) o;
//
Map<String, String> maps2 = new HashMap<>();
//
maps2.put("key", UUID.randomUUID().toString());
//
influxDbConnection.insert("GD_DZ", maps2, maps1);
//
}
//
}
//
}
//
//
String data4 = householdPvUtils.gerResponseByAPiID(1000000007L);
//
//
JSONObject json4= JSON.parseObject(data4);
//
if(Integer.valueOf(json4.get("code").toString())==0) {
//
JSONObject obj4 = json4.get("data") != null ? (JSONObject)json4.get("data") : null;
//
if (obj4!=null&&obj4.get("list")!=null) {
//
//
JSONArray ob = obj4.get("list") != null ? (JSONArray) obj4.get("list") : null;
//
//
for (Object o : ob) {
//
Map<String, Object> maps1 = (Map<String, Object>) o;
//
Map<String, String> maps2 = new HashMap<>();
//
maps2.put("key", UUID.randomUUID().toString());
//
influxDbConnection.insert("GD_ZT", maps2, maps1);
//
}
//
}
//
}
//
//
String data5 = householdPvUtils.gerResponseByAPiID(1000000008L);
//
//
JSONObject json5= JSON.parseObject(data5);
//
if(Integer.valueOf(json5.get("code").toString())==0) {
//
JSONObject obj5 = json5.get("data") != null ? (JSONObject)json5.get("data") : null;
//
if (obj5!=null&&obj5.get("list")!=null) {
//
//
JSONArray ob = obj5.get("list") != null ? (JSONArray) obj5.get("list") : null;
//
//
for (Object o : ob) {
//
Map<String, Object> maps1 = (Map<String, Object>) o;
//
Map<String, String> maps2 = new HashMap<>();
//
maps2.put("key", UUID.randomUUID().toString());
//
influxDbConnection.insert("GD_GJ", maps2, maps1);
//
}
//
}
//
}
//
//
//
String data6 = householdPvUtils.gerResponseByAPiID(1686897906789L);
//
//
JSONObject json6= JSON.parseObject(data6);
//
if(Integer.valueOf(json6.get("code").toString())==0) {
//
JSONObject obj6 = json6.get("data") != null ? (JSONObject)json6.get("data") : 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;
//
//
for (Object o : ob) {
//
Map<String, Object> maps1 = (Map<String, Object>) o;
//
Map<String, String> maps2 = new HashMap<>();
//
maps2.put("key", UUID.randomUUID().toString());
//
influxDbConnection.insert("JL_CZ", maps2, maps1);
//
}
//
}
//
}
//
String data7 = householdPvUtils.gerResponseByAPiID(1686900771946L);
//
JSONObject json7= JSON.parseObject(data7);
//
if(Integer.valueOf(json7.get("code").toString())==0) {
//
JSONObject obj7 = json7.get("data") != null ? (JSONObject)json7.get("data") : 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;
//
//
for (Object o : ob) {
//
Map<String, Object> maps1 = (Map<String, Object>) o;
//
Map<String, String> maps2 = new HashMap<>();
//
maps2.put("key", UUID.randomUUID().toString());
//
//
maps1.put("etotal1",maps1.get("etotal1").toString());
//
maps1.put("etoday1",maps1.get("etoday1").toString());
//
influxDbConnection.insert("JL_NBQ", maps2, maps1);
//
}
//
}
//
}
//
String data8 = householdPvUtils.gerResponseByAPiID(1686900972965L);
//
JSONObject json8= JSON.parseObject(data8);
//
if(Integer.valueOf(json8.get("code").toString())==0) {
//
JSONObject obj8 = json8.get("data") != null ? (JSONObject)json8.get("data") : null;
//
if (obj8!=null&&obj8.get("records")!=null) {
//
//
JSONArray ob = obj8.get("records")!= null ? (JSONArray)obj8.get("records") : null;
//
//
for (Object o : ob) {
//
Map<String, Object> maps1 = (Map<String, Object>) o;
//
Map<String, String> maps2 = new HashMap<>();
//
maps2.put("key", UUID.randomUUID().toString());
//
influxDbConnection.insert("JL_GJ", maps2, maps1);
//
}
//
}
//
}
//
}
//
//
//
//
}
amos-boot-system-tzs/amos-boot-module-96333/amos-boot-module-96333-biz/src/main/java/com/yeejoin/amos/boot/module/elevator/biz/service/impl/TzBaseEnterpriseInfoServiceImpl.java
View file @
cd54953c
...
...
@@ -39,6 +39,7 @@ import com.yeejoin.amos.feign.privilege.util.DesUtil;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.context.annotation.Lazy
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.ObjectUtils
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
...
...
@@ -82,6 +83,7 @@ public class TzBaseEnterpriseInfoServiceImpl
RegUnitIcServiceImpl
regUnitIcService
;
@Autowired
@Lazy
RegUnitInfoServiceImpl
regUnitInfoService
;
@Autowired
...
...
amos-boot-system-tzs/amos-boot-module-tcm/amos-boot-module-tcm-api/src/main/java/com/yeejoin/amos/boot/module/tcm/api/dto/TzsUserInfoDto.java
View file @
cd54953c
...
...
@@ -68,5 +68,6 @@ public class TzsUserInfoDto extends BaseDto {
@ApiModelProperty
(
value
=
"年龄"
)
private
Integer
age
;
@ApiModelProperty
(
value
=
"平台账号锁定状态"
)
private
String
lockStatus
;
}
amos-boot-system-tzs/amos-boot-module-tcm/amos-boot-module-tcm-api/src/main/java/com/yeejoin/amos/boot/module/tcm/api/entity/TzsUserInfo.java
View file @
cd54953c
...
...
@@ -117,4 +117,10 @@ public class TzsUserInfo extends BaseEntity {
*/
@TableField
(
"amos_user_id"
)
private
String
amosUserId
;
/**
* 平台账号锁定状态
*/
@TableField
(
"lock_status"
)
private
String
lockStatus
;
}
amos-boot-system-tzs/amos-boot-module-tcm/amos-boot-module-tcm-api/src/main/java/com/yeejoin/amos/boot/module/tcm/api/service/ITzsUserInfoService.java
View file @
cd54953c
...
...
@@ -22,4 +22,5 @@ public interface ITzsUserInfoService extends IService<TzsUserInfo> {
Map
<
String
,
Object
>
getDetail
(
Long
id
);
boolean
BindAccount
(
Map
<
String
,
Object
>
map
);
String
startOrStopAccount
(
Map
<
String
,
Object
>
map
);
}
amos-boot-system-tzs/amos-boot-module-tcm/amos-boot-module-tcm-api/src/main/java/com/yeejoin/amos/boot/module/tcm/api/vo/TzsUserInfoVo.java
View file @
cd54953c
...
...
@@ -107,4 +107,11 @@ public class TzsUserInfoVo {
*/
@TableField
(
"amos_user_id"
)
private
String
amosUserId
;
/**
* 平台账号锁定状态
*/
@TableField
(
"lock_status"
)
private
String
lockStatus
;
}
amos-boot-system-tzs/amos-boot-module-tcm/amos-boot-module-tcm-api/src/main/resources/mapper/TzsUserInfoMapper.xml
View file @
cd54953c
...
...
@@ -15,6 +15,8 @@
speciality,
profile,
amos_user_name,
amos_user_id,
lock_status,
CASE
WHEN gender = 1 THEN
'男' ELSE '女'
...
...
amos-boot-system-tzs/amos-boot-module-tcm/amos-boot-module-tcm-biz/src/main/java/com/yeejoin/amos/boot/module/tcm/biz/controller/TzsUserInfoController.java
View file @
cd54953c
...
...
@@ -126,4 +126,11 @@ public class TzsUserInfoController extends BaseController {
public
ResponseModel
<
Boolean
>
BindAccount
(
@RequestBody
Map
<
String
,
Object
>
map
)
{
return
ResponseHelper
.
buildResponse
(
tzsUserInfoService
.
BindAccount
(
map
));
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@PostMapping
(
value
=
"/startOrStopAccount"
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"启用或者停用账户"
,
notes
=
"启用或者停用账户"
)
public
ResponseModel
<
String
>
startOrStopAccount
(
@RequestBody
Map
<
String
,
Object
>
map
)
{
return
ResponseHelper
.
buildResponse
(
tzsUserInfoService
.
startOrStopAccount
(
map
));
}
}
amos-boot-system-tzs/amos-boot-module-tcm/amos-boot-module-tcm-biz/src/main/java/com/yeejoin/amos/boot/module/tcm/biz/service/impl/TzBaseEnterpriseInfoServiceImpl.java
View file @
cd54953c
...
...
@@ -451,7 +451,7 @@ public class TzBaseEnterpriseInfoServiceImpl
public
TzBaseEnterpriseInfoDto
companyInfoUpdate
(
Map
<
String
,
Object
>
map
)
{
TzBaseEnterpriseInfo
tzBaseEnterpriseInfo
=
new
TzBaseEnterpriseInfo
();
tzBaseEnterpriseInfo
.
setSequenceNbr
(
Long
.
valueOf
(
map
.
get
(
"sequenceNbr"
).
toString
()));
//修改基本信息
tzBaseEnterpriseInfo
.
setEquipCategory
(
JSON
.
toJSONString
(
map
.
get
(
"equipCategory"
)));
Map
<
String
,
String
>
map1
=
(
Map
<
String
,
String
>)
map
.
get
(
"longitudeLatitude"
);
tzBaseEnterpriseInfo
.
setAddress
(
ObjectUtils
.
isEmpty
(
map1
.
get
(
"address"
))
?
null
:
map1
.
get
(
"address"
));
...
...
@@ -465,36 +465,34 @@ public class TzBaseEnterpriseInfoServiceImpl
tzBaseEnterpriseInfo
.
setSuperviseOrgName
(
ObjectUtils
.
isEmpty
(
map
.
get
(
"superviseOrgName"
))
?
null
:
String
.
valueOf
(
map
.
get
(
"superviseOrgName"
)));
//修改工商信息
RegUnitIc
regUnitIc
=
new
RegUnitIc
();
List
<
String
>
addressList
=
(
List
<
String
>)
map
.
get
(
"registerAddressList"
);
tzBaseEnterpriseInfo
.
setProvince
(
addressList
.
get
(
0
));
tzBaseEnterpriseInfo
.
setCity
(
addressList
.
get
(
1
));
tzBaseEnterpriseInfo
.
setDistrict
(
addressList
.
get
(
3
));
tzBaseEnterpriseInfo
.
setCommunity
(
ObjectUtils
.
isEmpty
(
map
.
get
(
"community"
))
?
null
:
String
.
valueOf
(
map
.
get
(
"community"
)));
tzBaseEnterpriseInfo
.
setStreet
(
ObjectUtils
.
isEmpty
(
map
.
get
(
"stree"
))
?
null
:
String
.
valueOf
(
map
.
get
(
"stree"
)));
tzBaseEnterpriseInfo
.
setLegalPerson
(
ObjectUtils
.
isEmpty
(
map
.
get
(
"legalPerson"
))
?
null
:
String
.
valueOf
(
map
.
get
(
"legalPerson"
)));
regUnitIc
.
setIndustryName
(
ObjectUtils
.
isEmpty
(
map
.
get
(
"industryName"
))
?
null
:
String
.
valueOf
(
map
.
get
(
"industryName"
)));
regUnitIc
.
setRegisteredOrgan
(
ObjectUtils
.
isEmpty
(
map
.
get
(
"registeredOrgan"
))
?
null
:
String
.
valueOf
(
map
.
get
(
"registeredOrgan"
)));
Date
approvedDate
=
new
Date
();
try
{
approvedDate
=
DateUtils
.
dateParse
(
String
.
valueOf
(
map
.
get
(
"approvedDate"
)),
"yyyy-MM-dd"
);
}
catch
(
ParseException
e
)
{
throw
new
RuntimeException
(
e
);
}
regUnitIc
.
setBusinessState
(
ObjectUtils
.
isEmpty
(
map
.
get
(
"businessState"
))
?
null
:
String
.
valueOf
(
map
.
get
(
"businessState"
)));
regUnitIc
.
setApprovedDate
(
ObjectUtils
.
isEmpty
(
map
.
get
(
"approvedDate"
))
?
null
:
approvedDate
);
RegUnitIcDto
regUnitIcDto
=
JSON
.
parseObject
(
JSON
.
toJSONString
(
map
.
get
(
"regUnitIcDto"
)),
new
TypeReference
<
RegUnitIcDto
>()
{
});
// regUnitIcService.update(regUnitIc, new QueryWrapper<RegUnitIc>().eq("unit_code", regUnitIcDto.getUnitCode()));
//修改许可信息
List
<
BaseUnitLicence
>
licences
=
(
List
<
BaseUnitLicence
>)
map
.
get
(
"unitLicences"
);
//
RegUnitIc regUnitIc = new RegUnitIc();
//
List<String> addressList = (List<String>) map.get("registerAddressList");
//
tzBaseEnterpriseInfo.setProvince(addressList.get(0));
//
tzBaseEnterpriseInfo.setCity(addressList.get(1));
//
tzBaseEnterpriseInfo.setDistrict(addressList.get(3));
//
tzBaseEnterpriseInfo.setCommunity(ObjectUtils.isEmpty(map.get("community")) ? null : String.valueOf(map.get("community")));
//
tzBaseEnterpriseInfo.setStreet(ObjectUtils.isEmpty(map.get("stree")) ? null : String.valueOf(map.get("stree")));
//
tzBaseEnterpriseInfo.setLegalPerson(ObjectUtils.isEmpty(map.get("legalPerson")) ? null : String.valueOf(map.get("legalPerson")));
//
regUnitIc.setIndustryName(ObjectUtils.isEmpty(map.get("industryName")) ? null : String.valueOf(map.get("industryName")));
//
regUnitIc.setRegisteredOrgan(ObjectUtils.isEmpty(map.get("registeredOrgan")) ? null : String.valueOf(map.get("registeredOrgan")));
//
Date approvedDate = new Date();
//
try {
//
approvedDate = DateUtils.dateParse(String.valueOf(map.get("approvedDate")), "yyyy-MM-dd");
//
} catch (ParseException e) {
//
throw new RuntimeException(e);
//
}
//
regUnitIc.setBusinessState(ObjectUtils.isEmpty(map.get("businessState")) ? null : String.valueOf(map.get("businessState")));
//
regUnitIc.setApprovedDate(ObjectUtils.isEmpty(map.get("approvedDate")) ? null : approvedDate);
//
RegUnitIcDto regUnitIcDto = JSON.parseObject(JSON.toJSONString(map.get("regUnitIcDto")), new TypeReference<RegUnitIcDto>() {
//
});
//
//
regUnitIcService.update(regUnitIc, new QueryWrapper<RegUnitIc>().eq("unit_code", regUnitIcDto.getUnitCode()));
//
//
//
//修改许可信息
//
List<BaseUnitLicence> licences = (List<BaseUnitLicence>) map.get("unitLicences");
// baseUnitLicenceService.saveOrUpdateBatch(licences);
// boolean b = tzBaseEnterpriseInfoService.updateById(tzBaseEnterpriseInfo);
boolean
b
=
true
;
boolean
b
=
tzBaseEnterpriseInfoService
.
updateById
(
tzBaseEnterpriseInfo
);
if
(
b
)
{
TzBaseEnterpriseInfoDto
tzBaseEnterpriseInfoDto
=
new
TzBaseEnterpriseInfoDto
();
BeanUtils
.
copyProperties
(
tzBaseEnterpriseInfo
,
tzBaseEnterpriseInfoDto
);
...
...
amos-boot-system-tzs/amos-boot-module-tcm/amos-boot-module-tcm-biz/src/main/java/com/yeejoin/amos/boot/module/tcm/biz/service/impl/TzsUserInfoServiceImpl.java
View file @
cd54953c
...
...
@@ -47,6 +47,13 @@ public class TzsUserInfoServiceImpl extends BaseService<TzsUserInfoDto, TzsUserI
@Autowired
private
DataDictionaryMapper
dataDictionaryMapper
;
//企业人员角色
private
final
String
USER_ROLE
=
"QYRYJS"
;
//企业人员用户组
private
final
String
ROLE_GROUP
=
"QYRYYHZ"
;
//平台用户锁定状态
private
final
String
UNLOCK
=
"UNLOCK"
;
private
final
String
LOCK
=
"LOCK"
;
@Autowired
private
TzsUserQualificationsServiceImpl
tzsUserQualificationsService
;
...
...
@@ -174,6 +181,7 @@ public class TzsUserInfoServiceImpl extends BaseService<TzsUserInfoDto, TzsUserI
String
sequenceNbr
=
map
.
get
(
"sequenceNbr"
).
toString
();
String
roles
=
map
.
get
(
"role"
).
toString
();
String
status
=
map
.
get
(
"status"
).
toString
();
String
roleGroupCode
=
map
.
get
(
"roleGroup"
).
toString
();
FeignClientResult
<
AgencyUserModel
>
userResult
=
null
;
try
{
...
...
@@ -195,7 +203,7 @@ public class TzsUserInfoServiceImpl extends BaseService<TzsUserInfoDto, TzsUserI
List
<
RoleModel
>
allRoleList
=
new
ArrayList
<>();
List
<
Long
>
roleIds
=
new
ArrayList
<>();
DataDictionary
unitType
=
iDataDictionaryService
.
getOne
(
new
LambdaQueryWrapper
<
DataDictionary
>().
eq
(
DataDictionary:
:
getCode
,
roles
));
.
getOne
(
new
LambdaQueryWrapper
<
DataDictionary
>().
eq
(
DataDictionary:
:
getCode
,
roles
)
.
eq
(
DataDictionary:
:
getType
,
USER_ROLE
)
);
String
role
=
unitType
.
getExtend
()
!=
null
?
unitType
.
getExtend
()
:
""
;
for
(
String
s
:
role
.
split
(
","
))
{
RoleModel
roleModel
=
Privilege
.
roleClient
.
seleteOne
(
Long
.
valueOf
(
s
)).
getResult
();
...
...
@@ -216,9 +224,17 @@ public class TzsUserInfoServiceImpl extends BaseService<TzsUserInfoDto, TzsUserI
agencyUserModel
.
setOrgRoleSeqs
(
roleSeqMap
);
userResult
=
Privilege
.
agencyUserClient
.
create
(
agencyUserModel
);
if
(
userResult
.
getStatus
()
==
200
)
{
List
<
String
>
userIds
=
new
ArrayList
<>();
userIds
.
add
(
userResult
.
getResult
().
getUserId
());
DataDictionary
roleGroup
=
iDataDictionaryService
.
getOne
(
new
LambdaQueryWrapper
<
DataDictionary
>().
eq
(
DataDictionary:
:
getCode
,
roleGroupCode
).
eq
(
DataDictionary:
:
getType
,
ROLE_GROUP
));
if
(!
ObjectUtils
.
isEmpty
(
roleGroup
)
&&
roleGroup
.
getExtend
()
!=
null
)
{
Privilege
.
groupUserClient
.
create
(
Long
.
valueOf
(
roleGroup
.
getExtend
()),
userIds
);
}
TzsUserInfo
tzsUserInfo
=
tzsUserInfoMapper
.
selectById
(
sequenceNbr
);
tzsUserInfo
.
setAmosUserId
(
userResult
.
getResult
().
getUserId
());
tzsUserInfo
.
setAmosUserName
(
userResult
.
getResult
().
getUserName
());
tzsUserInfo
.
setLockStatus
(
status
);
tzsUserInfoMapper
.
updateById
(
tzsUserInfo
);
}
return
true
;
...
...
@@ -232,4 +248,26 @@ public class TzsUserInfoServiceImpl extends BaseService<TzsUserInfoDto, TzsUserI
}
}
@Override
public
String
startOrStopAccount
(
Map
<
String
,
Object
>
map
)
{
Long
sequenceNbr
=
Long
.
valueOf
(
map
.
get
(
"sequenceNbr"
).
toString
());
String
amosUserId
=
map
.
get
(
"amosUserId"
).
toString
();
String
lockStatus
=
null
;
FeignClientResult
<
List
<
String
>>
userResult
=
null
;
if
(
UNLOCK
.
equals
(
map
.
get
(
"lockStatus"
)))
{
userResult
=
Privilege
.
agencyUserClient
.
lockUsers
(
amosUserId
);
lockStatus
=
200
==
userResult
.
getStatus
()
?
LOCK
:
UNLOCK
;
}
else
{
userResult
=
Privilege
.
agencyUserClient
.
unlockUsers
(
amosUserId
);
lockStatus
=
200
==
userResult
.
getStatus
()
?
UNLOCK
:
LOCK
;
}
if
(!
ObjectUtils
.
isEmpty
(
lockStatus
)){
TzsUserInfo
tzsUserInfo
=
new
TzsUserInfo
();
tzsUserInfo
.
setSequenceNbr
(
sequenceNbr
);
tzsUserInfo
.
setLockStatus
(
lockStatus
);
tzsUserInfoMapper
.
updateById
(
tzsUserInfo
);
}
return
userResult
.
getResult
().
get
(
0
);
}
}
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 @
cd54953c
...
...
@@ -371,6 +371,9 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI
// 2.组织返回数据
//2.1 工商信息查询
Map
<
String
,
Object
>
resultMap
=
accessFeignService
.
getData
(
unitCode
).
getResult
();
if
(
resultMap
==
null
){
throw
new
BadRequest
(
"工商信息接口查询失败,请稍后再试!"
);
}
if
(!
ValidationUtil
.
isEmpty
(
resultMap
)){
// 2.2 工商信息组装
String
area
=
String
.
valueOf
(
resultMap
.
get
(
"area"
));
...
...
amos-boot-system-tzs/amos-boot-module-ymt/amos-boot-module-ymt-api/src/main/java/com/yeejoin/amos/boot/module/ymt/flc/api/feign/IdxFeignService.java
View file @
cd54953c
...
...
@@ -41,19 +41,15 @@ public interface IdxFeignService {
/**
* 多表单页提交 数据填报
*/
@RequestMapping
(
value
=
"/table/batch/submit"
,
method
=
RequestMethod
.
POST
)
ResponseModel
batchSubmit
(
@RequestParam
(
required
=
false
)
String
taskId
,
@RequestParam
(
required
=
false
)
String
planInstanceId
,
@RequestParam
(
required
=
false
)
String
topic
,
@RequestParam
(
required
=
false
)
String
tableName
,
@RequestMapping
(
value
=
"/report/form/batch/submit"
,
method
=
RequestMethod
.
POST
)
ResponseModel
batchSubmit
(
@RequestParam
(
required
=
false
)
String
topic
,
@RequestBody
Map
<
String
,
Object
>
kv
)
throws
Exception
;
/**
* 多表单页修改数据修改
*/
@RequestMapping
(
value
=
"/
table
/batch/update"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"/
report/form
/batch/update"
,
method
=
RequestMethod
.
POST
)
ResponseModel
batchUpdate
(
@RequestParam
(
required
=
false
)
String
topic
,
@RequestParam
(
required
=
false
)
String
tableName
,
@RequestBody
Map
<
String
,
Object
>
kv
)
throws
Exception
;
/**
...
...
amos-boot-system-tzs/amos-boot-module-ymt/amos-boot-module-ymt-api/src/main/resources/mapper/CategoryOtherInfoMapper.xml
View file @
cd54953c
...
...
@@ -103,23 +103,27 @@
<select
id=
"checkCode"
resultType=
"java.util.Map"
>
SELECT
<if
test=
"equCode != null and equCode != ''"
>
(SELECT COUNT ( 1 ) FROM idx_biz_jg_register_info ibjri WHERE ibjri."EQU_CODE" = #{equCode}
(SELECT COUNT ( 1 ) FROM idx_biz_jg_register_info ibjri
LEFT JOIN idx_biz_jg_other_info ibjoi ON ibjoi."RECORD" = ibjri."RECORD"
WHERE ibjri."EQU_CODE" = #{equCode}
<if
test=
"type != 'save' "
>
and ibjri."RECORD" != #{record}
and ibjri."RECORD" != #{record}
and ibjoi."CLAIM_STATUS" = '已认领'
</if>
) AS equCode,
</if>
<if
test=
"useOrgCode != null and useOrgCode != ''"
>
(SELECT COUNT ( 1 ) FROM idx_biz_jg_register_info ibjri WHERE ibjri."USE_ORG_CODE" = #{useOrgCode}
(SELECT COUNT ( 1 ) FROM idx_biz_jg_register_info ibjri
LEFT JOIN idx_biz_jg_other_info ibjoi ON ibjoi."RECORD" = ibjri."RECORD"
WHERE ibjri."USE_ORG_CODE" = #{useOrgCode}
<if
test=
"type != 'save'"
>
and ibjri."RECORD" != #{record}
and ibjri."RECORD" != #{record}
and ibjoi."CLAIM_STATUS" = '已认领'
</if>
) AS useOrgCode,
</if>
<if
test=
"code96333 != null and code96333 != ''"
>
(SELECT COUNT ( 1 ) FROM idx_biz_jg_other_info ibjoi WHERE ibjoi."CODE96333" = #{code96333}
<if
test=
"type != 'save'"
>
and ibjoi."RECORD" != #{record}
and ibjoi."RECORD" != #{record}
and ibjoi."CLAIM_STATUS" = '已认领'
</if>
) AS code
</if>
...
...
amos-boot-system-tzs/amos-boot-module-ymt/amos-boot-module-ymt-biz/src/main/java/com/yeejoin/amos/boot/module/ymt/biz/config/RedissonManager.java
0 → 100644
View file @
cd54953c
package
com
.
yeejoin
.
amos
.
boot
.
module
.
ymt
.
biz
.
config
;
import
lombok.extern.slf4j.Slf4j
;
import
org.redisson.Redisson
;
import
org.redisson.api.RedissonClient
;
import
org.redisson.config.Config
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
@Configuration
@Slf4j
public
class
RedissonManager
{
//集群环境使用
// @Value("${spring.redis.cluster.nodes}")
// private String clusterNodes;
//通用
@Value
(
"${spring.redis.password}"
)
private
String
password
;
//单机环境使用
@Value
(
"${spring.redis.host}"
)
private
String
host
;
//单机环境使用
@Value
(
"${spring.redis.port}"
)
private
String
port
;
@Bean
public
RedissonClient
redissonClient
()
{
//集群环境使用
// log.info("clusterNodes{}",clusterNodes);
// log.info("password{}",password);
//
// Config config = new Config();
// config.useClusterServers()
// .addNodeAddress(clusterNodes.split(","))
// .setPassword(password);
// return Redisson.create(config);
//单机打包使用
Config
config
=
new
Config
();
config
.
useSingleServer
().
setAddress
(
host
+
":"
+
port
).
setPassword
(
password
);
return
Redisson
.
create
(
config
);
}
}
amos-boot-system-tzs/amos-boot-module-ymt/amos-boot-module-ymt-biz/src/main/java/com/yeejoin/amos/boot/module/ymt/biz/service/impl/EquipmentCategoryServiceImpl.java
View file @
cd54953c
...
...
@@ -19,12 +19,14 @@ import com.yeejoin.amos.boot.module.ymt.api.mapper.*;
import
com.yeejoin.amos.boot.module.ymt.api.service.IEquipmentCategoryService
;
import
com.yeejoin.amos.boot.module.ymt.api.vo.EquipExportVo
;
import
com.yeejoin.amos.boot.module.ymt.biz.dao.ESEquipmentCategory
;
import
com.yeejoin.amos.boot.module.ymt.biz.utils.JsonUtils
;
import
com.yeejoin.amos.boot.module.ymt.flc.api.feign.IdxFeignService
;
import
com.yeejoin.amos.boot.module.ymt.flc.api.feign.PrivilegeFeginService
;
import
com.yeejoin.amos.component.feign.model.FeignClientResult
;
import
com.yeejoin.amos.feign.privilege.model.CompanyModel
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.lucene.queryparser.classic.QueryParser
;
import
org.elasticsearch.action.search.SearchRequest
;
import
org.elasticsearch.action.search.SearchResponse
;
import
org.elasticsearch.client.RequestOptions
;
...
...
@@ -33,10 +35,13 @@ import org.elasticsearch.index.query.BoolQueryBuilder;
import
org.elasticsearch.index.query.QueryBuilders
;
import
org.elasticsearch.search.builder.SearchSourceBuilder
;
import
org.elasticsearch.search.sort.SortOrder
;
import
org.redisson.api.RLock
;
import
org.redisson.api.RedissonClient
;
import
org.springframework.aop.framework.AopContext
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.core.io.Resource
;
import
org.springframework.data.elasticsearch.core.ElasticsearchTemplate
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.jdbc.core.JdbcTemplate
;
import
org.springframework.scheduling.annotation.Async
;
...
...
@@ -56,6 +61,9 @@ import java.io.IOException;
import
java.sql.Timestamp
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
import
java.util.concurrent.ExecutorService
;
import
java.util.concurrent.Executors
;
import
java.util.concurrent.TimeUnit
;
import
java.util.stream.Collectors
;
import
static
com
.
alibaba
.
fastjson
.
JSON
.
toJSONString
;
...
...
@@ -888,8 +896,14 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
list
.
add
(
equipmentCategoryData
);
}
}
if
(!
ObjectUtils
.
isEmpty
(
unitCodes
))
{
equipmentCategoryDataMapper
.
delete
(
new
QueryWrapper
<
EquipmentCategoryData
>().
in
(
"unit_code"
,
unitCodes
));
if
(!
ObjectUtils
.
isEmpty
(
unitCodes
)
&&
!
ObjectUtils
.
isEmpty
(
orgBranchCodes
)
)
{
equipmentCategoryDataMapper
.
delete
(
new
QueryWrapper
<
EquipmentCategoryData
>()
.
in
(
"unit_code"
,
unitCodes
)
.
in
(
"org_branch_code"
,
orgBranchCodes
));
}
if
(!
ObjectUtils
.
isEmpty
(
unitCodes
)
&&
ObjectUtils
.
isEmpty
(
orgBranchCodes
)
)
{
equipmentCategoryDataMapper
.
delete
(
new
QueryWrapper
<
EquipmentCategoryData
>()
.
in
(
"unit_code"
,
unitCodes
));
}
if
(!
ObjectUtils
.
isEmpty
(
list
))
{
equipmentCategoryDataService
.
saveOrUpdateBatch
(
list
);
...
...
@@ -942,7 +956,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
}
private
List
<
EquipmentCategoryData
>
updateEquipmentCategoryData
(
String
unitCode
,
String
orgBranchCode
)
{
private
List
<
EquipmentCategoryData
>
updateEquipmentCategoryData
(
String
unitCode
)
{
List
<
String
>
unitCodeList
=
new
ArrayList
<>();
unitCodeList
.
add
(
unitCode
);
List
<
EquipmentCategoryData
>
equipmentCategoryData
=
getCategoryData
(
unitCodeList
,
null
);
...
...
@@ -994,11 +1008,18 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
return
records
;
}
@Autowired
RedissonClient
redissonClient
;
private
final
static
String
LOCK_KEY
=
"RESOURCE_KEY"
;
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
ResponseModel
submit
(
Map
<
String
,
Object
>
map
)
{
StopWatch
stopWatch
=
new
StopWatch
();
stopWatch
.
start
();
StopWatch
stopWatch3
=
new
StopWatch
();
stopWatch3
.
start
();
SupervisoryCodeInfo
supervisoryCodeInfo
=
new
SupervisoryCodeInfo
();
ResponseModel
responseModel
=
new
ResponseModel
();
LinkedHashMap
useInfoFrom
=
(
LinkedHashMap
)
map
.
get
(
USE_INFO_FROM_ID
);
...
...
@@ -1014,7 +1035,7 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
String
code96333
=
String
.
valueOf
(
superviseMap
.
get
(
"code96333"
));
String
operateType
=
String
.
valueOf
(
superviseMap
.
get
(
"operateType"
));
//生成码
Map
<
String
,
String
>
codeMap
;
Map
<
String
,
String
>
codeMap
=
new
HashMap
<>()
;
if
(
EquipmentCategoryEnum
.
YRL
.
getName
().
equals
(
claimStatus
))
{
log
.
info
(
"准备生成监管码或96333电梯识别码"
);
String
city
=
String
.
valueOf
(
superviseMap
.
get
(
"city"
));
...
...
@@ -1023,16 +1044,44 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
String
supervisionCode
=
String
.
valueOf
(
superviseMap
.
get
(
"supervisionCode"
));
EquipmentCategoryServiceImpl
categoryService
=
(
EquipmentCategoryServiceImpl
)
AopContext
.
currentProxy
();
//生成码
//集群模式使用
RLock
lock
=
redissonClient
.
getLock
(
LOCK_KEY
);
// lock.lock(); // 获取锁
// log.info("加锁成功");
// codeMap = categoryService.creatCode(city, county, equCategory, code96333, supervisionCode);
// log.info("生成码成功");
// lock.unlock(); // 释放锁
// log.info("释放锁");
// log.info("已生成对应监管码或96333电梯识别码");
//单机模式使用
boolean
flag
=
false
;
if
(
lock
.
tryLock
(
3
,
100
,
TimeUnit
.
SECONDS
))
{
codeMap
=
categoryService
.
creatCode
(
city
,
county
,
equCategory
,
code96333
,
supervisionCode
);
log
.
info
(
"已生成对应监管码或96333电梯识别码"
);
flag
=
true
;
}
if
(
flag
){
lock
.
unlock
();
// 释放锁
log
.
info
(
"释放锁"
);
}
//删除map中的冗余数据,添加对应监管码和96333码调用idx多表单页提交接口吧保存数据
map
.
remove
(
"data"
);
supervisionMap
.
put
(
"CODE96333"
,
codeMap
.
get
(
"code96333"
));
supervisionMap
.
put
(
"SUPERVISORY_CODE"
,
codeMap
.
get
(
"superviseCode"
));
map
.
put
(
SUPERVISION_FROM_ID
,
supervisionMap
);
stopWatch
.
stop
();
if
(
log
.
isInfoEnabled
())
{
log
.
info
(
"业务调用idx前耗时:{} 秒"
,
stopWatch
.
getTotalTimeSeconds
());
}
StopWatch
stopWatch1
=
new
StopWatch
();
stopWatch1
.
start
();
//根据操作状态判断是调用新增还是修改接口
responseModel
=
"save"
.
equals
(
operateType
)
?
idxFeignService
.
batchSubmit
(
null
,
null
,
null
,
null
,
map
)
:
idxFeignService
.
batchUpdate
(
null
,
null
,
map
);
responseModel
=
"save"
.
equals
(
operateType
)
?
idxFeignService
.
batchSubmit
(
null
,
map
)
:
idxFeignService
.
batchUpdate
(
null
,
map
);
stopWatch1
.
stop
();
if
(
log
.
isInfoEnabled
())
{
log
.
info
(
"业务调用idx耗时:{} 秒"
,
stopWatch1
.
getTotalTimeSeconds
());
}
if
(!
ObjectUtils
.
isEmpty
(
responseModel
)
&&
"200"
.
equals
(
String
.
valueOf
(
responseModel
.
getStatus
())))
{
supervisoryCodeInfo
.
setStatus
(
EquipmentCategoryEnum
.
YSY
.
getCode
());
}
else
{
...
...
@@ -1044,20 +1093,42 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
supervisionMap
.
put
(
"CODE96333"
,
"null"
.
equals
(
code96333
)
?
null
:
code96333
);
map
.
put
(
SUPERVISION_FROM_ID
,
supervisionMap
);
//根据操作状态判断是调用新增还是修改接口
responseModel
=
"save"
.
equals
(
operateType
)
?
idxFeignService
.
batchSubmit
(
null
,
null
,
null
,
null
,
map
)
:
idxFeignService
.
batchUpdate
(
null
,
null
,
map
);
responseModel
=
"save"
.
equals
(
operateType
)
?
idxFeignService
.
batchSubmit
(
null
,
map
)
:
idxFeignService
.
batchUpdate
(
null
,
map
);
}
else
{
map
.
remove
(
"data"
);
responseModel
=
idxFeignService
.
batchUpdate
(
null
,
null
,
map
);
responseModel
=
idxFeignService
.
batchUpdate
(
null
,
map
);
}
StopWatch
stopWatch4
=
new
StopWatch
();
stopWatch4
.
start
();
if
(!
ObjectUtils
.
isEmpty
(
responseModel
)
&&
"200"
.
equals
(
String
.
valueOf
(
responseModel
.
getStatus
())))
{
log
.
info
(
"responseModel.getResult().toString()->>>>>>>>>>>>>>"
,
responseModel
.
getResult
());
log
.
info
(
"responseModel.getResult().toString()->>>>>>>>>>>>>>
{}
"
,
responseModel
.
getResult
());
checkEsData
(
String
.
valueOf
(
responseModel
.
getResult
()));
}
stopWatch4
.
stop
();
if
(
log
.
isInfoEnabled
())
{
log
.
info
(
"更新es耗时:{} 秒"
,
stopWatch4
.
getTotalTimeSeconds
());
}
stopWatch3
.
stop
();
if
(
log
.
isInfoEnabled
())
{
log
.
info
(
"通用提交耗时:{} 秒"
,
stopWatch3
.
getTotalTimeSeconds
());
}
StopWatch
stopWatch5
=
new
StopWatch
();
stopWatch5
.
start
();
ExecutorService
threadPool
=
Executors
.
newCachedThreadPool
();
threadPool
.
submit
(
new
Runnable
()
{
@Override
public
void
run
()
{
log
.
info
(
"已生成对应监管码"
+
supervisionMap
.
get
(
"SUPERVISORY_CODE"
));
log
.
info
(
"已生成对应96333电梯识别码"
+
supervisionMap
.
get
(
"CODE96333"
));
supervisoryCodeInfoMapper
.
update
(
supervisoryCodeInfo
,
new
QueryWrapper
<
SupervisoryCodeInfo
>().
eq
(
"supervisory_code"
,
supervisionMap
.
get
(
"SUPERVISORY_CODE"
)));
stopWatch
.
stop
();
log
.
info
(
"unitCode-------->>>>>>>>>>{}"
,
unitCode
);
updateEquipmentCategoryData
(
unitCode
);
}
});
stopWatch5
.
stop
();
if
(
log
.
isInfoEnabled
())
{
log
.
info
(
"
通用提交耗时:{} 秒"
,
stopWatch
.
getTotalTimeSeconds
());
log
.
info
(
"
异步操作耗时:{} 秒"
,
stopWatch5
.
getTotalTimeSeconds
());
}
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
...
...
@@ -1075,10 +1146,6 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
response
.
setMessage
(
"操作失败,请检查数据输入后重新提交"
);
response
.
setStatus
(
HttpStatus
.
BAD_REQUEST
.
value
());
return
response
;
}
finally
{
log
.
info
(
"已生成对应监管码"
+
supervisionMap
.
get
(
"SUPERVISORY_CODE"
));
log
.
info
(
"已生成对应96333电梯识别码"
+
supervisionMap
.
get
(
"CODE96333"
));
updateEquipmentCategoryData
(
unitCode
,
orgBranchCode
);
}
return
responseModel
;
}
...
...
@@ -1205,84 +1272,100 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
//SEQUENCE_NBR
if
(!
ObjectUtils
.
isEmpty
(
map
.
getString
(
"SEQUENCE_NBR"
)))
{
BoolQueryBuilder
meBuilder
=
QueryBuilders
.
boolQuery
();
meBuilder
.
must
(
QueryBuilders
.
matchPhraseQuery
(
"SEQUENCE_NBR"
,
"*"
+
map
.
getString
(
"SEQUENCE_NBR"
)+
"*"
));
String
test
=
QueryParser
.
escape
(
map
.
getString
(
"SEQUENCE_NBR"
));
meBuilder
.
must
(
QueryBuilders
.
matchPhraseQuery
(
"SEQUENCE_NBR"
,
"*"
+
test
+
"*"
));
boolMust
.
must
(
meBuilder
);
}
if
(!
ObjectUtils
.
isEmpty
(
map
.
getString
(
"ORG_BRANCH_NAME"
)))
{
BoolQueryBuilder
query
=
QueryBuilders
.
boolQuery
();
query
.
must
(
QueryBuilders
.
matchPhraseQuery
(
"ORG_BRANCH_NAME"
,
"*"
+
map
.
getString
(
"ORG_BRANCH_NAME"
)+
"*"
));
String
test
=
QueryParser
.
escape
(
map
.
getString
(
"ORG_BRANCH_NAME"
));
query
.
must
(
QueryBuilders
.
matchPhraseQuery
(
"ORG_BRANCH_NAME"
,
"*"
+
test
+
"*"
));
boolMust
.
must
(
query
);
}
if
(!
ObjectUtils
.
isEmpty
(
map
.
getString
(
"ORG_BRANCH_CODE"
)))
{
BoolQueryBuilder
query
=
QueryBuilders
.
boolQuery
();
query
.
must
(
QueryBuilders
.
matchPhraseQuery
(
"ORG_BRANCH_CODE"
,
"*"
+
map
.
getString
(
"ORG_BRANCH_CODE"
)
+
"*"
));
String
test
=
QueryParser
.
escape
(
map
.
getString
(
"ORG_BRANCH_CODE"
));
query
.
must
(
QueryBuilders
.
matchPhraseQuery
(
"ORG_BRANCH_CODE"
,
"*"
+
test
+
"*"
));
boolMust
.
must
(
query
);
}
if
(!
ObjectUtils
.
isEmpty
(
map
.
getString
(
"USE_UNIT_NAME"
)))
{
BoolQueryBuilder
query
=
QueryBuilders
.
boolQuery
();
query
.
must
(
QueryBuilders
.
matchPhraseQuery
(
"USE_UNIT_NAME"
,
"*"
+
map
.
getString
(
"USE_UNIT_NAME"
)+
"*"
));
String
test
=
QueryParser
.
escape
(
map
.
getString
(
"USE_UNIT_NAME"
));
query
.
must
(
QueryBuilders
.
matchPhraseQuery
(
"USE_UNIT_NAME"
,
"*"
+
test
+
"*"
));
boolMust
.
must
(
query
);
}
if
(!
ObjectUtils
.
isEmpty
(
map
.
getString
(
"USE_UNIT_CREDIT_CODE"
)))
{
BoolQueryBuilder
meBuilder
=
QueryBuilders
.
boolQuery
();
meBuilder
.
must
(
QueryBuilders
.
matchPhraseQuery
(
"USE_UNIT_CREDIT_CODE"
,
"*"
+
map
.
getString
(
"USE_UNIT_CREDIT_CODE"
)+
"*"
));
String
test
=
QueryParser
.
escape
(
map
.
getString
(
"USE_UNIT_CREDIT_CODE"
));
meBuilder
.
must
(
QueryBuilders
.
matchPhraseQuery
(
"USE_UNIT_CREDIT_CODE"
,
"*"
+
test
+
"*"
));
boolMust
.
must
(
meBuilder
);
}
if
(!
ObjectUtils
.
isEmpty
(
map
.
getString
(
"EQU_LIST_CODE"
)))
{
BoolQueryBuilder
meBuilder
=
QueryBuilders
.
boolQuery
();
meBuilder
.
must
(
QueryBuilders
.
matchPhraseQuery
(
"EQU_LIST_CODE"
,
"*"
+
map
.
getString
(
"EQU_LIST_CODE"
)
+
"*"
));
String
test
=
QueryParser
.
escape
(
map
.
getString
(
"EQU_LIST_CODE"
));
meBuilder
.
must
(
QueryBuilders
.
matchPhraseQuery
(
"EQU_LIST_CODE"
,
"*"
+
test
+
"*"
));
boolMust
.
must
(
meBuilder
);
}
if
(!
ObjectUtils
.
isEmpty
(
map
.
getString
(
"EQU_LIST"
)))
{
BoolQueryBuilder
meBuilder
=
QueryBuilders
.
boolQuery
();
meBuilder
.
must
(
QueryBuilders
.
matchPhraseQuery
(
"EQU_LIST"
,
"*"
+
map
.
getString
(
"EQU_LIST"
)+
"*"
));
String
test
=
QueryParser
.
escape
(
map
.
getString
(
"EQU_LIST"
));
meBuilder
.
must
(
QueryBuilders
.
matchPhraseQuery
(
"EQU_LIST"
,
"*"
+
test
+
"*"
));
boolMust
.
must
(
meBuilder
);
}
if
(!
ObjectUtils
.
isEmpty
(
map
.
getString
(
"EQU_CATEGORY"
)))
{
BoolQueryBuilder
meBuilder
=
QueryBuilders
.
boolQuery
();
meBuilder
.
must
(
QueryBuilders
.
matchPhraseQuery
(
"EQU_CATEGORY"
,
"*"
+
map
.
getString
(
"EQU_CATEGORY"
)+
"*"
));
String
test
=
QueryParser
.
escape
(
map
.
getString
(
"EQU_CATEGORY"
));
meBuilder
.
must
(
QueryBuilders
.
matchPhraseQuery
(
"EQU_CATEGORY"
,
"*"
+
test
+
"*"
));
boolMust
.
must
(
meBuilder
);
}
if
(!
ObjectUtils
.
isEmpty
(
map
.
getString
(
"USE_ORG_CODE"
)))
{
BoolQueryBuilder
meBuilder
=
QueryBuilders
.
boolQuery
();
meBuilder
.
must
(
QueryBuilders
.
wildcardQuery
(
"USE_ORG_CODE"
,
"*"
+
map
.
getString
(
"USE_ORG_CODE"
).
toLowerCase
()+
"*"
));
String
test
=
QueryParser
.
escape
(
map
.
getString
(
"USE_ORG_CODE"
).
toLowerCase
());
meBuilder
.
must
(
QueryBuilders
.
matchPhraseQuery
(
"USE_ORG_CODE"
,
"*"
+
test
+
"*"
));
boolMust
.
must
(
meBuilder
);
}
if
(!
ObjectUtils
.
isEmpty
(
map
.
getString
(
"CODE96333"
)))
{
BoolQueryBuilder
meBuilder
=
QueryBuilders
.
boolQuery
();
meBuilder
.
must
(
QueryBuilders
.
wildcardQuery
(
"CODE96333"
,
"*"
+
map
.
getString
(
"CODE96333"
).
toLowerCase
()+
"*"
));
String
test
=
QueryParser
.
escape
(
map
.
getString
(
"CODE96333"
).
toLowerCase
());
meBuilder
.
must
(
QueryBuilders
.
matchPhraseQuery
(
"CODE96333"
,
"*"
+
test
+
"*"
));
boolMust
.
must
(
meBuilder
);
}
if
(!
ObjectUtils
.
isEmpty
(
map
.
getString
(
"EQU_CODE"
)))
{
BoolQueryBuilder
meBuilder
=
QueryBuilders
.
boolQuery
();
meBuilder
.
must
(
QueryBuilders
.
wildcardQuery
(
"EQU_CODE"
,
"*"
+
map
.
getString
(
"EQU_CODE"
)
+
"*"
));
String
test
=
QueryParser
.
escape
(
map
.
getString
(
"EQU_CODE"
));
meBuilder
.
must
(
QueryBuilders
.
matchPhraseQuery
(
"EQU_CODE"
,
"*"
+
test
+
"*"
));
boolMust
.
must
(
meBuilder
);
}
if
(!
ObjectUtils
.
isEmpty
(
map
.
getString
(
"SUPERVISORY_CODE"
)))
{
BoolQueryBuilder
meBuilder
=
QueryBuilders
.
boolQuery
();
meBuilder
.
must
(
QueryBuilders
.
wildcardQuery
(
"SUPERVISORY_CODE"
,
"*"
+
map
.
getString
(
"SUPERVISORY_CODE"
).
toLowerCase
()+
"*"
));
// String test = QueryParser.escape(map.getString("SUPERVISORY_CODE").toLowerCase());
meBuilder
.
must
(
QueryBuilders
.
matchPhraseQuery
(
"SUPERVISORY_CODE"
,
"*"
+
map
.
getString
(
"SUPERVISORY_CODE"
).
toLowerCase
()
+
"*"
));
boolMust
.
must
(
meBuilder
);
}
if
(!
ObjectUtils
.
isEmpty
(
map
.
getString
(
"USE_PLACE"
)))
{
BoolQueryBuilder
query
=
QueryBuilders
.
boolQuery
();
query
.
must
(
QueryBuilders
.
matchPhraseQuery
(
"USE_PLACE"
,
"*"
+
map
.
getString
(
"USE_PLACE"
)
+
"*"
));
String
test
=
QueryParser
.
escape
(
map
.
getString
(
"USE_PLACE"
));
query
.
must
(
QueryBuilders
.
matchPhraseQuery
(
"USE_PLACE"
,
"*"
+
test
+
"*"
));
boolMust
.
must
(
query
);
}
if
(!
ObjectUtils
.
isEmpty
(
map
.
getString
(
"ADDRESS"
)))
{
BoolQueryBuilder
query
=
QueryBuilders
.
boolQuery
();
query
.
must
(
QueryBuilders
.
matchPhraseQuery
(
"ADDRESS"
,
"*"
+
map
.
getString
(
"ADDRESS"
)
+
"*"
));
String
test
=
QueryParser
.
escape
(
map
.
getString
(
"ADDRESS"
));
query
.
must
(
QueryBuilders
.
matchPhraseQuery
(
"ADDRESS"
,
"*"
+
test
+
"*"
));
boolMust
.
must
(
query
);
}
if
(!
ObjectUtils
.
isEmpty
(
map
.
getString
(
"EQU_STATE"
))
)
{
if
(!
ObjectUtils
.
isEmpty
(
map
.
getString
(
"EQU_STATE"
)))
{
BoolQueryBuilder
meBuilder
=
QueryBuilders
.
boolQuery
();
meBuilder
.
must
(
QueryBuilders
.
matchQuery
(
"EQU_STATE"
,
map
.
getLong
(
"EQU_STATE"
)));
String
test
=
QueryParser
.
escape
(
map
.
getLong
(
"EQU_STATE"
).
toString
());
meBuilder
.
must
(
QueryBuilders
.
matchQuery
(
"EQU_STATE"
,
test
));
boolMust
.
must
(
meBuilder
);
}
if
(!
ObjectUtils
.
isEmpty
(
map
.
getString
(
"STATUS"
)))
{
BoolQueryBuilder
meBuilder
=
QueryBuilders
.
boolQuery
();
meBuilder
.
must
(
QueryBuilders
.
matchPhraseQuery
(
"STATUS"
,
"*"
+
map
.
getString
(
"STATUS"
)+
"*"
));
String
test
=
QueryParser
.
escape
(
map
.
getString
(
"STATUS"
));
meBuilder
.
must
(
QueryBuilders
.
matchPhraseQuery
(
"STATUS"
,
"*"
+
test
+
"*"
));
boolMust
.
must
(
meBuilder
);
}
builder
.
query
(
boolMust
);
...
...
amos-boot-system-tzs/amos-boot-module-ymt/amos-boot-module-ymt-biz/src/main/resources/application-dev.properties
View file @
cd54953c
...
...
@@ -7,14 +7,14 @@ eureka.client.service-url.defaultZone=http://172.16.10.230:10001/eureka/
eureka.instance.prefer-ip-address
=
true
management.endpoint.health.show-details
=
always
management.endpoints.web.exposure.include
=
*
eureka.instance.health-check-url
=
http://172.16.3.
34
:${server.port}${server.servlet.context-path}/actuator/health
eureka.instance.health-check-url
=
http://172.16.3.
17
:${server.port}${server.servlet.context-path}/actuator/health
eureka.instance.metadata-map.management.context-path
=
${server.servlet.context-path}/actuator
eureka.instance.status-page-url
=
http://172.16.3.
34
:${server.port}${server.servlet.context-path}/actuator/info
eureka.instance.metadata-map.management.api-docs
=
http://172.16.3.
34
:${server.port}${server.servlet.context-path}/doc.html
eureka.instance.ip-address
=
172.16.3.
34
eureka.instance.status-page-url
=
http://172.16.3.
17
:${server.port}${server.servlet.context-path}/actuator/info
eureka.instance.metadata-map.management.api-docs
=
http://172.16.3.
17
:${server.port}${server.servlet.context-path}/doc.html
eureka.instance.ip-address
=
172.16.3.
17
## ES properties:
elasticsearch.username
=
elastic
elasticsearch.password
=
a
123456
elasticsearch.password
=
123456
spring.elasticsearch.rest.uris
=
http://172.16.10.230:9200
## unit(h)
alertcall.es.synchrony.time
=
48
...
...
amos-boot-system-tzs/pom.xml
View file @
cd54953c
...
...
@@ -68,7 +68,11 @@
<artifactId>
amos-component-security
</artifactId>
<version>
${amos.version.tzs}
</version>
</dependency>
<dependency>
<groupId>
org.redisson
</groupId>
<artifactId>
redisson
</artifactId>
<version>
2.7.0
</version>
</dependency>
</dependencies>
<dependencyManagement>
...
...
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