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
1cf7d7af
Commit
1cf7d7af
authored
Dec 27, 2023
by
yangyang
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/develop_tzs_register' into develop_tzs_register
parents
e50e227b
97797e4b
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
132 additions
and
91 deletions
+132
-91
IJgChangeRegistrationReformService.java
...le/jg/api/service/IJgChangeRegistrationReformService.java
+16
-1
JgMaintainNoticeMapper.xml
...-api/src/main/resources/mapper/JgMaintainNoticeMapper.xml
+0
-1
JgChangeRegistrationReformController.java
.../biz/controller/JgChangeRegistrationReformController.java
+6
-5
CommonServiceImpl.java
...os/boot/module/jg/biz/service/impl/CommonServiceImpl.java
+8
-6
IdxBizJgRegisterInfoServiceImpl.java
.../jg/biz/service/impl/IdxBizJgRegisterInfoServiceImpl.java
+36
-68
JgChangeRegistrationReformServiceImpl.java
...z/service/impl/JgChangeRegistrationReformServiceImpl.java
+0
-0
JgChangeRegistrationUnitServiceImpl.java
...biz/service/impl/JgChangeRegistrationUnitServiceImpl.java
+12
-10
ElasticSearchClientConfig.java
...boot/module/ymt/biz/config/ElasticSearchClientConfig.java
+54
-0
No files found.
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-api/src/main/java/com/yeejoin/amos/boot/module/jg/api/service/IJgChangeRegistrationReformService.java
View file @
1cf7d7af
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
api
.
service
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.amos.boot.module.jg.api.dto.JgChangeRegistrationReformDto
;
import
javax.servlet.http.HttpServletResponse
;
import
java.util.List
;
import
java.util.Map
;
/**
* 改造变更登记接口类
*
...
...
@@ -8,5 +16,12 @@ package com.yeejoin.amos.boot.module.jg.api.service;
* @date 2023-12-20
*/
public
interface
IJgChangeRegistrationReformService
{
Page
<
Map
<
String
,
Object
>>
getList
(
JgChangeRegistrationReformDto
dto
,
Page
<
Map
<
String
,
Object
>>
page
,
List
<
String
>
roleIds
);
void
save
(
JSONObject
map
);
void
updateExecuteIds
(
String
instanceId
,
Long
sequenceNbr
,
String
operate
);
void
flowExecute
(
Long
id
,
String
instanceId
,
String
operate
,
String
comment
);
void
withdraw
(
String
instanceId
);
void
deleteBatch
(
List
<
Long
>
ids
);
Map
<
String
,
Object
>
getDetail
(
String
currentDocumentId
,
String
equipId
);
void
exportUseRegistrationCertificate
(
String
sequenceNbr
,
HttpServletResponse
response
);
}
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-api/src/main/resources/mapper/JgMaintainNoticeMapper.xml
View file @
1cf7d7af
...
...
@@ -99,7 +99,6 @@
fi.factory_standard AS factoryStandard,
fi.product_quality_yield_prove AS productQualityYieldProve,
fi.ins_use_maintain_explain AS insUseMaintainExplain,
ui.safety_manager AS safetyManager,
ei.legal_person AS safetyManager,
ei.legal_phone AS safetyManagerPhone,
ui.CITY_NAME AS useUnitCityName,
...
...
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/controller/JgChangeRegistrationReformController.java
View file @
1cf7d7af
...
...
@@ -25,6 +25,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import
org.typroject.tyboot.core.restful.doc.TycloudOperation
;
import
org.typroject.tyboot.core.foundation.enumeration.UserType
;
import
javax.servlet.http.HttpServletResponse
;
/**
* 改造变更登记
*
...
...
@@ -130,10 +132,9 @@ public class JgChangeRegistrationReformController extends BaseController {
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@
ApiOperation
(
httpMethod
=
"GET"
,
value
=
"打印历史数据"
,
notes
=
"打印历史数据
"
)
@
GetMapping
(
value
=
"/printHistoryData
"
)
public
ResponseModel
<
Map
<
String
,
Object
>>
printHistoryData
(
@RequestParam
(
"currentDocumentId"
)
String
currentDocumentId
,
@RequestParam
(
value
=
"equipId"
,
required
=
false
)
String
equipId
)
{
return
ResponseHelper
.
buildResponse
(
jgChangeRegistrationReformServiceImpl
.
getDetail
(
currentDocumentId
,
equipId
)
);
@
GetMapping
(
value
=
"/export
"
)
@
ApiOperation
(
httpMethod
=
"GET"
,
value
=
"改造登记-导出使用登记证"
,
notes
=
"改造登记-导出使用登记证
"
)
public
void
exportImageZip
(
HttpServletResponse
response
,
@RequestParam
(
"sequenceNbr"
)
String
sequenceNbr
)
{
jgChangeRegistrationReformServiceImpl
.
exportUseRegistrationCertificate
(
sequenceNbr
,
response
);
}
}
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/service/impl/CommonServiceImpl.java
View file @
1cf7d7af
...
...
@@ -27,13 +27,11 @@ import org.springframework.util.CollectionUtils;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
import
org.typroject.tyboot.core.
restful.utils.ResponseMode
l
;
import
org.typroject.tyboot.core.
foundation.utils.ValidationUti
l
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.ByteArrayInputStream
;
import
java.io.File
;
import
java.io.FileInputStream
;
import
java.io.InputStream
;
import
java.nio.file.Files
;
import
java.util.*
;
import
java.util.stream.Collectors
;
...
...
@@ -99,16 +97,20 @@ public class CommonServiceImpl implements ICommonService {
public
List
<
EquipmentCategory
>
getEquipmentCategoryList
(
String
code
,
String
type
)
{
List
<
EquipmentCategory
>
result
=
new
ArrayList
<>();
LambdaQueryWrapper
<
EquipmentCategory
>
wrapper
=
new
LambdaQueryWrapper
<>();
wrapper
.
eq
(
EquipmentCategory:
:
getCode
,
code
);
EquipmentCategory
equipmentCategory
=
equipmentCategoryMapper
.
selectOne
(
wrapper
);
if
(
ObjectUtils
.
isEmpty
(
type
))
{
result
.
add
(
equipmentCategory
);
if
(!
ValidationUtil
.
isEmpty
(
equipmentCategory
)){
result
.
add
(
equipmentCategory
);
}
}
else
{
LambdaQueryWrapper
<
EquipmentCategory
>
wrapper2
=
new
LambdaQueryWrapper
<>();
wrapper2
.
eq
(
EquipmentCategory:
:
getParentId
,
equipmentCategory
.
getId
());
result
=
equipmentCategoryMapper
.
selectList
(
wrapper2
);
List
<
EquipmentCategory
>
equipmentCategories
=
equipmentCategoryMapper
.
selectList
(
wrapper2
);
if
(!
ValidationUtil
.
isEmpty
(
equipmentCategories
)){
result
=
equipmentCategories
;
}
}
return
result
;
}
...
...
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/service/impl/IdxBizJgRegisterInfoServiceImpl.java
View file @
1cf7d7af
...
...
@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
com.baomidou.mybatisplus.core.toolkit.StringUtils
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.amos.boot.biz.common.bo.CompanyBo
;
import
com.yeejoin.amos.boot.biz.common.bo.ReginParams
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisKey
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisUtils
;
...
...
@@ -12,17 +13,13 @@ import com.yeejoin.amos.boot.module.jg.api.enums.ConstructionEnum;
import
com.yeejoin.amos.boot.module.jg.biz.dao.ESEquipmentCategory
;
import
com.yeejoin.amos.boot.module.jg.biz.service.*
;
import
com.yeejoin.amos.boot.module.ymt.api.dto.ESEquipmentCategoryDto
;
import
com.yeejoin.amos.boot.module.ymt.api.dto.IdxBizJgConstructionInfoDto
;
import
com.yeejoin.amos.boot.module.ymt.api.dto.IdxBizJgInspectionDetectionInfoDto
;
import
com.yeejoin.amos.boot.module.ymt.api.dto.IdxBizJgMainPartsDto
;
import
com.yeejoin.amos.boot.module.ymt.api.dto.IdxBizJgMaintenanceRecordInfoDto
;
import
com.yeejoin.amos.boot.module.ymt.api.dto.IdxBizJgProtectionDevicesDto
;
import
com.yeejoin.amos.boot.module.ymt.api.dto.IdxBizJgRegisterInfoDto
;
import
com.yeejoin.amos.boot.module.ymt.api.entity.*
;
import
com.yeejoin.amos.boot.module.ymt.api.enums.EquimentEnum
;
import
com.yeejoin.amos.boot.module.ymt.api.mapper.CategoryOtherInfoMapper
;
import
com.yeejoin.amos.boot.module.ymt.api.mapper.IdxBizJgRegisterInfoMapper
;
import
com.yeejoin.amos.boot.module.ymt.api.mapper.SuperviseInfoMapper
;
import
com.yeejoin.amos.feign.privilege.Privilege
;
import
com.yeejoin.amos.feign.privilege.model.CompanyModel
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.lucene.queryparser.classic.QueryParser
;
...
...
@@ -30,7 +27,6 @@ import org.elasticsearch.action.search.SearchRequest;
import
org.elasticsearch.action.search.SearchResponse
;
import
org.elasticsearch.client.RequestOptions
;
import
org.elasticsearch.client.RestHighLevelClient
;
import
org.elasticsearch.common.recycler.Recycler
;
import
org.elasticsearch.index.query.BoolQueryBuilder
;
import
org.elasticsearch.index.query.QueryBuilders
;
import
org.elasticsearch.search.builder.SearchSourceBuilder
;
...
...
@@ -69,13 +65,6 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
private
static
final
String
EQUDEFINE
=
"EQU_DEFINE"
;
private
static
final
String
EQUDEFINECODE
=
"EQU_DEFINE_CODE"
;
/**
* levlel=company,是企业,如果不是都是监管单位,
* * 在接口中查询当前登录人所属单位是监管单位还是企业。
* * 如果为监管单位添加监管机构查询参数(ORG_BRANCH_CODE);
* * 如果为企业添加使用单位查询参数(USE_UNIT_CREDIT_CODE)
*/
private
static
final
String
LEVEL
=
"company"
;
// 新增修改标识
private
static
final
String
OPERATESAVE
=
"save"
;
private
static
final
String
OPERATEEDIT
=
"edit"
;
...
...
@@ -123,6 +112,7 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
@Autowired
private
SuperviseInfoMapper
superviseInfoMapper
;
/**
* 设备注册信息
*
...
...
@@ -541,53 +531,32 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
builder
.
trackTotalHits
(
true
);
BoolQueryBuilder
boolMust
=
QueryBuilders
.
boolQuery
();
//获取当前登录人单位类型
JSONObject
company
=
getCompanyType
();
if
(
ValidationUtil
.
isEmpty
(
company
))
{
result
.
setRecords
(
new
ArrayList
<>());
result
.
setTotal
(
0
);
return
result
;
}
String
companyCode
=
company
.
getString
(
"companyCode"
).
contains
(
"_"
)
?
company
.
getString
(
"companyCode"
).
split
(
"_"
)[
1
]
:
company
.
getString
(
"companyCode"
);
String
type
=
company
.
getString
(
"companyType"
);
if
(
ValidationUtil
.
isEmpty
(
type
)
||
ValidationUtil
.
isEmpty
(
companyCode
))
{
result
.
setRecords
(
new
ArrayList
<>());
result
.
setTotal
(
0
);
return
result
;
}
//根据当前登录人查询
if
(!
ValidationUtil
.
isEmpty
(
map
.
get
(
EQUSTATE
)))
{
map
.
put
(
EQUSTATE
,
EquimentEnum
.
getCode
.
get
(
map
.
get
(
EQUSTATE
).
toString
()).
toString
());
}
//获取当前登录人单位类型
List
<
JSONObject
>
companyType
=
getCompanyType
();
if
(!
ValidationUtil
.
isEmpty
(
companyType
))
{
JSONObject
object
=
getCompanyType
().
get
(
0
);
String
level
=
object
.
getString
(
"level"
);
String
code
=
object
.
getString
(
"orgCode"
);
String
companyCode
=
object
.
getString
(
"companyCode"
).
contains
(
"_"
)
?
object
.
getString
(
"companyCode"
).
split
(
"_"
)[
1
]
:
object
.
getString
(
"companyCode"
);
String
type
=
object
.
getString
(
"companyType"
);
// 根据当前登录用户类型及管辖机构筛选条件添加对应参数
if
(!
ValidationUtil
.
isEmpty
(
level
))
{
if
(
LEVEL
.
equals
(
level
))
{
//企业
if
(!
ValidationUtil
.
isEmpty
(
type
)
&&
ValidationUtil
.
equals
(
type
,
"使用单位"
))
{
map
.
put
(
"USE_UNIT_CREDIT_CODE"
,
companyCode
);
}
else
if
(!
ValidationUtil
.
isEmpty
(
type
)
&&
ValidationUtil
.
equals
(
type
,
"安装改造维修单位"
))
{
map
.
put
(
"USC_UNIT_CREDIT_CODE"
,
companyCode
);
}
if
(!
ObjectUtils
.
isEmpty
(
map
.
getString
(
"ORG_BRANCH_CODE"
)))
{
BoolQueryBuilder
query
=
QueryBuilders
.
boolQuery
();
String
test
=
QueryParser
.
escape
(
map
.
getString
(
"ORG_BRANCH_CODE"
));
query
.
must
(
QueryBuilders
.
matchPhrasePrefixQuery
(
"ORG_BRANCH_CODE"
,
test
));
boolMust
.
must
(
query
);
}
}
else
{
if
(!
ObjectUtils
.
isEmpty
(
map
.
getString
(
"ORG_BRANCH_CODE"
)))
{
String
paramCode
=
map
.
getString
(
"ORG_BRANCH_CODE"
);
if
(
paramCode
.
contains
(
code
))
{
BoolQueryBuilder
query
=
QueryBuilders
.
boolQuery
();
String
test
=
QueryParser
.
escape
(
map
.
getString
(
"ORG_BRANCH_CODE"
));
query
.
must
(
QueryBuilders
.
matchPhrasePrefixQuery
(
"ORG_BRANCH_CODE"
,
test
));
boolMust
.
must
(
query
);
}
else
{
return
result
;
}
}
else
{
//监管单位
map
.
put
(
"ORG_BRANCH_CODE"
,
code
);
}
}
}
// 根据当前登录用户类型及管辖机构筛选条件添加对应参数
if
(!
ValidationUtil
.
isEmpty
(
type
)
&&
ValidationUtil
.
equals
(
type
,
"使用单位"
))
{
map
.
put
(
"USE_UNIT_CREDIT_CODE"
,
companyCode
);
}
else
if
(!
ValidationUtil
.
isEmpty
(
type
)
&&
ValidationUtil
.
equals
(
type
,
"安装改造维修单位"
))
{
map
.
put
(
"USC_UNIT_CREDIT_CODE"
,
companyCode
);
}
// 默认条件【STATUS==="" || null】
...
...
@@ -732,23 +701,22 @@ public class IdxBizJgRegisterInfoServiceImpl extends BaseService<IdxBizJgRegiste
*
* @return
*/
public
List
<
JSONObject
>
getCompanyType
()
{
public
JSONObject
getCompanyType
()
{
ReginParams
reginParams
=
JSON
.
parseObject
(
redisUtils
.
get
(
RedisKey
.
buildReginKey
(
RequestContext
.
getExeUserId
(),
RequestContext
.
getToken
())).
toString
(),
ReginParams
.
class
);
List
<
CompanyModel
>
companys
=
reginParams
.
getUserModel
().
getCompanys
();
ReginParams
reginParams
=
JSON
Object
.
parseObject
(
redisUtils
.
get
(
RedisKey
.
buildReginKey
(
RequestContext
.
getExeUserId
(),
RequestContext
.
getToken
())).
toString
(),
ReginParams
.
class
);
CompanyBo
company
=
reginParams
.
getCompany
();
List
<
JSONObject
>
objectList
=
new
ArrayList
<>();
if
(!
ValidationUtil
.
isEmpty
(
companys
))
{
for
(
CompanyModel
company
:
companys
)
{
JSONObject
object
=
new
JSONObject
();
object
.
put
(
"level"
,
company
.
getLevel
());
object
.
put
(
"orgCode"
,
company
.
getOrgCode
());
object
.
put
(
"companyCode"
,
company
.
getCompanyCode
());
object
.
put
(
"companyType"
,
company
.
getCompanyType
());
objectList
.
add
(
object
);
JSONObject
object
=
new
JSONObject
();
if
(!
ValidationUtil
.
isEmpty
(
company
))
{
object
.
put
(
"level"
,
company
.
getLevel
());
object
.
put
(
"orgCode"
,
company
.
getOrgCode
());
object
.
put
(
"companyCode"
,
company
.
getCompanyCode
());
CompanyModel
result
=
Privilege
.
companyClient
.
queryByCompanyCode
(
company
.
getCompanyCode
()).
getResult
();
if
(!
ValidationUtil
.
isEmpty
(
result
)){
object
.
put
(
"companyType"
,
result
.
getCompanyType
());
}
}
return
object
List
;
return
object
;
}
private
String
batchSubmitOrUpdate
(
Map
<
String
,
Object
>
map
)
{
...
...
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/service/impl/JgChangeRegistrationReformServiceImpl.java
View file @
1cf7d7af
This diff is collapsed.
Click to expand it.
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/service/impl/JgChangeRegistrationUnitServiceImpl.java
View file @
1cf7d7af
...
...
@@ -704,11 +704,11 @@ public class JgChangeRegistrationUnitServiceImpl extends BaseService<JgChangeReg
throw
new
BadRequest
(
"使用登记证导出失败,请稍后重试!"
);
}
//是否废弃
exportParamsMap
.
put
(
"isInvalid"
,
jgChangeRegistrationUnitEq
.
getIsInvalid
());
exportParamsMap
.
put
(
"isInvalid"
,
ValidationUtil
.
isEmpty
(
jgChangeRegistrationUnitEq
.
getIsInvalid
())
?
"0"
:
jgChangeRegistrationUnitEq
.
getIsInvalid
());
//登记机关
exportParamsMap
.
put
(
"receiveOrgName"
,
transfer
.
getReceiveOrgName
());
//使用登记证编号
exportParamsMap
.
put
(
"useRegistrationCode"
,
transfer
.
getUseRegistCode
());
exportParamsMap
.
put
(
"useRegistrationCode"
,
ValidationUtil
.
isEmpty
(
transfer
.
getUseRegistCode
())
?
""
:
transfer
.
getUseRegistCode
());
//使用单位名称
exportParamsMap
.
put
(
"useUnitName"
,
transfer
.
getUseUnitName
());
//监管码
...
...
@@ -733,15 +733,17 @@ public class JgChangeRegistrationUnitServiceImpl extends BaseService<JgChangeReg
String
equDefine
=
registerInfo
.
getEquDefine
();
//设备品种
List
<
EquipmentCategory
>
categoryList0
=
commonService
.
getEquipmentCategoryList
(
equList
,
null
);
List
<
EquipmentCategory
>
categoryList1
=
commonService
.
getEquipmentCategoryList
(
equCategory
,
null
);
List
<
EquipmentCategory
>
categoryList2
=
commonService
.
getEquipmentCategoryList
(
equDefine
,
null
);
if
(
org
.
apache
.
commons
.
collections
.
CollectionUtils
.
isNotEmpty
(
categoryList1
))
{
exportParamsMap
.
put
(
"equList"
,
categoryList0
.
get
(
0
).
getName
());
}
if
(
org
.
apache
.
commons
.
collections
.
CollectionUtils
.
isNotEmpty
(
categoryList1
))
{
exportParamsMap
.
put
(
"equCategory"
,
categoryList1
.
get
(
0
).
getName
());
}
if
(
org
.
apache
.
commons
.
collections
.
CollectionUtils
.
isNotEmpty
(
categoryList2
))
{
exportParamsMap
.
put
(
"equDefine"
,
categoryList2
.
get
(
0
).
getName
());
if
(!
ValidationUtil
.
isEmpty
(
equDefine
))
{
List
<
EquipmentCategory
>
categoryList2
=
commonService
.
getEquipmentCategoryList
(
equDefine
,
null
);
if
(
org
.
apache
.
commons
.
collections
.
CollectionUtils
.
isNotEmpty
(
categoryList2
))
{
exportParamsMap
.
put
(
"equDefine"
,
categoryList2
.
get
(
0
).
getName
());
}
}
//设备代码
exportParamsMap
.
put
(
"equCode"
,
registerInfo
.
getEquCode
());
...
...
@@ -753,11 +755,11 @@ public class JgChangeRegistrationUnitServiceImpl extends BaseService<JgChangeReg
exportParamsMap
.
put
(
"useInnerCode"
,
useInfo
.
getUseInnerCode
());
String
fullAddress
=
""
;
String
province
=
useInfo
.
getProvinceName
();
String
city
=
useInfo
.
getCityName
();
String
county
=
useInfo
.
getCountyName
();
String
street
=
useInfo
.
getStreetName
();
String
address
=
useInfo
.
getAddress
();
String
province
=
ValidationUtil
.
isEmpty
(
useInfo
.
getProvinceName
())
?
""
:
useInfo
.
getProvinceName
();
String
city
=
ValidationUtil
.
isEmpty
(
useInfo
.
getCityName
())
?
""
:
useInfo
.
getCityName
();
String
county
=
ValidationUtil
.
isEmpty
(
useInfo
.
getCountyName
())
?
""
:
useInfo
.
getCountyName
();
String
street
=
ValidationUtil
.
isEmpty
(
useInfo
.
getStreetName
())
?
""
:
useInfo
.
getStreetName
();
String
address
=
ValidationUtil
.
isEmpty
(
useInfo
.
getAddress
())
?
""
:
useInfo
.
getAddress
();
fullAddress
=
province
+
city
+
county
+
street
+
address
;
exportParamsMap
.
put
(
"fullAddress"
,
fullAddress
);
}
...
...
amos-boot-system-tzs/amos-boot-module-ymt/amos-boot-module-ymt-biz/src/main/java/com/yeejoin/amos/boot/module/ymt/biz/config/ElasticSearchClientConfig.java
0 → 100644
View file @
1cf7d7af
package
com
.
yeejoin
.
amos
.
boot
.
module
.
ymt
.
biz
.
config
;
import
org.apache.http.HttpHost
;
import
org.apache.http.auth.AuthScope
;
import
org.apache.http.auth.UsernamePasswordCredentials
;
import
org.apache.http.client.CredentialsProvider
;
import
org.apache.http.impl.client.BasicCredentialsProvider
;
import
org.elasticsearch.client.RestClient
;
import
org.elasticsearch.client.RestClientBuilder
;
import
org.elasticsearch.client.RestHighLevelClient
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
java.util.Arrays
;
@Configuration
public
class
ElasticSearchClientConfig
{
@Value
(
"${spring.elasticsearch.rest.uris}"
)
private
String
uris
;
@Value
(
"${elasticsearch.username}"
)
private
String
username
;
@Value
(
"${elasticsearch.password}"
)
private
String
password
;
@Bean
(
destroyMethod
=
"close"
)
public
RestHighLevelClient
restHighLevelClient
()
{
final
CredentialsProvider
credentialsProvider
=
new
BasicCredentialsProvider
();
credentialsProvider
.
setCredentials
(
AuthScope
.
ANY
,
new
UsernamePasswordCredentials
(
username
,
password
));
try
{
HttpHost
[]
httpHosts
=
Arrays
.
stream
(
uris
.
split
(
","
)).
map
(
HttpHost:
:
create
).
toArray
(
HttpHost
[]::
new
);
RestClientBuilder
builder
=
RestClient
.
builder
(
httpHosts
);
builder
.
setHttpClientConfigCallback
(
httpClientBuilder
->
{
httpClientBuilder
.
disableAuthCaching
();
return
httpClientBuilder
.
setDefaultCredentialsProvider
(
credentialsProvider
);
});
// 该方法接收一个RequestConfig.Builder对象,对该对象进行修改后然后返回。
builder
.
setRequestConfigCallback
(
requestConfigBuilder
->
{
// 连接超时(默认为1秒)
return
requestConfigBuilder
.
setConnectTimeout
(
5000
*
1000
)
// 套接字超时(默认为30秒)//更改客户端的超时限制默认30秒现在改为100*1000分钟
.
setSocketTimeout
(
6000
*
1000
);
});
return
new
RestHighLevelClient
(
builder
);
}
catch
(
Exception
e
)
{
throw
new
IllegalStateException
(
"Invalid ES nodes "
+
"property '"
+
uris
+
"'"
,
e
);
}
}
}
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