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
98f5b139
Commit
98f5b139
authored
Oct 09, 2023
by
tianyiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
小程序列表、单位总览修改
parent
8b7e920a
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
102 additions
and
154 deletions
+102
-154
InspectionDetectionInfoModelForWX.java
...module/app/api/dto/InspectionDetectionInfoModelForWX.java
+1
-1
InspectionDetectionInfo.java
...s/boot/module/app/api/entity/InspectionDetectionInfo.java
+1
-1
EquipmentCategoryServiceImpl.java
...le/app/biz/service/impl/EquipmentCategoryServiceImpl.java
+32
-142
TzsAppService.java
.../amos/boot/module/app/biz/service/impl/TzsAppService.java
+68
-10
No files found.
amos-boot-system-tzs/amos-boot-module-app/amos-boot-module-app-api/src/main/java/com/yeejoin/amos/boot/module/app/api/dto/InspectionDetectionInfoModelForWX.java
View file @
98f5b139
...
@@ -18,5 +18,5 @@ public class InspectionDetectionInfoModelForWX {
...
@@ -18,5 +18,5 @@ public class InspectionDetectionInfoModelForWX {
private
String
inspectConclusion
;
private
String
inspectConclusion
;
@ApiModelProperty
(
value
=
"下次检验日期"
)
@ApiModelProperty
(
value
=
"下次检验日期"
)
private
Date
nextInspectDate
;
private
String
nextInspectDate
;
}
}
amos-boot-system-tzs/amos-boot-module-app/amos-boot-module-app-api/src/main/java/com/yeejoin/amos/boot/module/app/api/entity/InspectionDetectionInfo.java
View file @
98f5b139
...
@@ -63,7 +63,7 @@ public class InspectionDetectionInfo extends AbstractEquipBaseEntity {
...
@@ -63,7 +63,7 @@ public class InspectionDetectionInfo extends AbstractEquipBaseEntity {
* */
* */
@TableField
(
value
=
"\"INSPECT_DATE\""
)
@TableField
(
value
=
"\"INSPECT_DATE\""
)
private
Date
inspectDate
;
private
String
inspectDate
;
/**
/**
* * 检验结论
* * 检验结论
* */
* */
...
...
amos-boot-system-tzs/amos-boot-module-app/amos-boot-module-app-biz/src/main/java/com/yeejoin/amos/boot/module/app/biz/service/impl/EquipmentCategoryServiceImpl.java
View file @
98f5b139
...
@@ -1067,123 +1067,6 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
...
@@ -1067,123 +1067,6 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
}
}
//分页查询所有数据
public
Page
<
Map
<
String
,
Object
>>
getAll
(
Map
<
String
,
Object
>
map
)
{
String
tableName
=
map
.
get
(
TABLENAME
).
toString
();
Assert
.
hasText
(
tableName
,
"表名不能为空"
);
String
selectSql
=
" SELECT * FROM "
+
tableName
+
" WHERE IS_NOT_ES <> 1 or IS_NOT_ES IS NULL "
;
Integer
number
=
ValidationUtil
.
isEmpty
(
map
.
get
(
"number"
))
?
0
:
Integer
.
valueOf
(
map
.
get
(
"number"
).
toString
());
Integer
size
=
ValidationUtil
.
isEmpty
(
map
.
get
(
"size"
))
?
0
:
Integer
.
valueOf
(
map
.
get
(
"size"
).
toString
());
Page
<
Map
<
String
,
Object
>>
page
=
new
Page
<>(
number
,
size
);
int
begin
=
(
number
-
1
)
*
size
;
if
(
size
>
0
)
{
selectSql
=
selectSql
+
" LIMIT "
+
begin
+
","
+
size
;
}
List
<
Map
<
String
,
Object
>>
mapList
=
bizJdbcTemplate
.
queryForList
(
selectSql
);
page
.
setRecords
(
mapList
);
page
.
setTotal
(
mapList
.
size
());
return
page
;
}
//查询总条数
public
Long
counts
(
Map
<
String
,
Object
>
map
)
{
String
tableName
=
map
.
get
(
TABLENAME
).
toString
();
Assert
.
hasText
(
tableName
,
"表名不能为空"
);
String
countSql
=
" SELECT COUNT(SEQUENCE_NBR) count FROM "
+
tableName
+
" WHERE IS_NOT_ES <> 1 or IS_NOT_ES IS NULL"
;
Long
count
=
bizJdbcTemplate
.
queryForObject
(
countSql
,
Long
.
class
);
return
count
;
}
/**
* es数据同步
*
* @return
*/
public
void
saveEs
()
{
long
start
=
System
.
currentTimeMillis
();
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
TABLENAME
,
"idx_biz_view_jg_all"
);
Long
counts
=
counts
(
map
);
Long
times
=
counts
/
1000
;
Long
yushu
=
counts
%
1000
;
if
(
yushu
>
0
)
{
times
++;
}
long
total
=
0
;
for
(
int
i
=
1
;
i
<=
times
;
i
++)
{
map
.
put
(
"number"
,
1
);
map
.
put
(
"size"
,
1000
);
Page
<
Map
<
String
,
Object
>>
page
=
getAll
(
map
);
total
=
total
+
page
.
getTotal
();
saveBatchEquipment2Es
(
page
.
getRecords
());
// for (Map<String, Object> record : page.getRecords()) {
// if (ValidationUtil.isEmpty(record.get("IS_NOT_ES"))) {
// saveESEquipmentCategory(record);
// }
// }
}
long
end
=
System
.
currentTimeMillis
();
log
.
info
(
"本次一码通同步设备数据:【"
+
total
+
"】条,耗时:"
+
(
end
-
start
)
+
" 毫秒"
);
}
public
void
saveBatchEquipment2Es
(
List
<
Map
<
String
,
Object
>>
equipList
)
{
List
<
ESEquipmentCategoryDto
>
esEquipDtoList
=
Lists
.
newArrayList
();
List
<
String
>
recordList
=
Lists
.
newArrayList
();
if
(
ValidationUtil
.
isEmpty
(
equipList
))
{
return
;
}
for
(
Map
<
String
,
Object
>
e
:
equipList
)
{
String
recDate1
=
""
;
if
(
ValidationUtil
.
isEmpty
(
e
.
get
(
"REC_DATE"
)))
{
try
{
recDate1
=
DateUtil
.
formatDate
(
new
Date
(),
"yyyy-MM-dd hh:mm:ss"
);
}
catch
(
Exception
ex
)
{
ex
.
printStackTrace
();
}
}
else
{
recDate1
=
e
.
get
(
"REC_DATE"
).
toString
().
substring
(
0
,
19
);
}
long
time
=
Timestamp
.
valueOf
(
recDate1
).
getTime
();
e
.
put
(
"REC_DATE"
,
time
);
ESEquipmentCategoryDto
esEquipDto
=
JSONObject
.
parseObject
(
toJSONString
(
e
),
ESEquipmentCategoryDto
.
class
);
esEquipDtoList
.
add
(
esEquipDto
);
recordList
.
add
((
String
)
e
.
get
(
"SEQUENCE_NBR"
));
}
long
start
=
System
.
currentTimeMillis
();
esEquipmentCategory
.
saveAll
(
esEquipDtoList
);
long
end
=
System
.
currentTimeMillis
();
long
cost
=
end
-
start
;
System
.
out
.
println
(
"批量存入es1000条数据耗时:"
+
cost
);
long
start1
=
System
.
currentTimeMillis
();
superviseInfoMapper
.
updateRecordBatch
(
recordList
);
long
end1
=
System
.
currentTimeMillis
();
long
cost1
=
end1
-
start1
;
System
.
out
.
println
(
"批量更新1000条业务数据耗时:"
+
cost1
);
}
/**
* es保存设备数据
*/
public
ESEquipmentCategoryDto
saveESEquipmentCategory
(
Map
<
String
,
Object
>
map
)
{
//处理时间问题
String
recDate1
=
map
.
get
(
"REC_DATE"
).
toString
().
substring
(
0
,
19
);
long
time
=
Timestamp
.
valueOf
(
recDate1
).
getTime
();
map
.
put
(
"REC_DATE"
,
time
);
ESEquipmentCategoryDto
dto
=
JSONObject
.
parseObject
(
toJSONString
(
map
),
ESEquipmentCategoryDto
.
class
);
ESEquipmentCategoryDto
save
=
esEquipmentCategory
.
save
(
dto
);
if
(!
ObjectUtils
.
isEmpty
(
save
))
{
//同步到es后修改
UseInfo
useInfo
=
new
UseInfo
();
useInfo
.
setIsNotEs
(
1
);
useInfoMapper
.
update
(
useInfo
,
new
QueryWrapper
<
UseInfo
>().
eq
(
"RECORD"
,
map
.
get
(
"SEQUENCE_NBR"
).
toString
()));
}
return
save
;
}
public
Page
<
JSONObject
>
queryByKeys
(
JSONObject
map
)
{
public
Page
<
JSONObject
>
queryByKeys
(
JSONObject
map
)
{
// //根据当前登录人查询
// //根据当前登录人查询
if
(!
ValidationUtil
.
isEmpty
(
map
.
get
(
EQUSTATE
)))
{
if
(!
ValidationUtil
.
isEmpty
(
map
.
get
(
EQUSTATE
)))
{
...
@@ -1194,15 +1077,6 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
...
@@ -1194,15 +1077,6 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
String
code
=
object
.
getString
(
"orgCode"
);
String
code
=
object
.
getString
(
"orgCode"
);
String
companyCode
=
object
.
getString
(
"companyCode"
).
contains
(
"_"
)
?
String
companyCode
=
object
.
getString
(
"companyCode"
).
contains
(
"_"
)
?
object
.
getString
(
"companyCode"
).
split
(
"_"
)[
1
]
:
object
.
getString
(
"companyCode"
);
object
.
getString
(
"companyCode"
).
split
(
"_"
)[
1
]
:
object
.
getString
(
"companyCode"
);
if
(!
ValidationUtil
.
isEmpty
(
level
))
{
if
(
LEVEL
.
equals
(
level
))
{
//企业
map
.
put
(
"USE_UNIT_CREDIT_CODE"
,
companyCode
);
}
else
{
//监管单位
map
.
put
(
"ORG_BRANCH_CODE"
,
code
);
}
}
Page
<
JSONObject
>
result
=
new
Page
<>(
map
.
getInteger
(
"number"
),
map
.
getInteger
(
"size"
));
Page
<
JSONObject
>
result
=
new
Page
<>(
map
.
getInteger
(
"number"
),
map
.
getInteger
(
"size"
));
SearchRequest
request
=
new
SearchRequest
();
SearchRequest
request
=
new
SearchRequest
();
request
.
indices
(
"idx_biz_view_jg_all"
);
request
.
indices
(
"idx_biz_view_jg_all"
);
...
@@ -1210,6 +1084,34 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
...
@@ -1210,6 +1084,34 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
builder
.
trackTotalHits
(
true
);
builder
.
trackTotalHits
(
true
);
BoolQueryBuilder
boolMust
=
QueryBuilders
.
boolQuery
();
BoolQueryBuilder
boolMust
=
QueryBuilders
.
boolQuery
();
//通用匹配规则,条件构建
//通用匹配规则,条件构建
// 根据当前登录用户类型及管辖机构筛选条件添加对应参数
if
(!
ValidationUtil
.
isEmpty
(
level
))
{
if
(
LEVEL
.
equals
(
level
))
{
//企业
map
.
put
(
"USE_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
);
}
}
}
//SEQUENCE_NBR
//SEQUENCE_NBR
if
(!
ObjectUtils
.
isEmpty
(
map
.
getString
(
"SEQUENCE_NBR"
)))
{
if
(!
ObjectUtils
.
isEmpty
(
map
.
getString
(
"SEQUENCE_NBR"
)))
{
BoolQueryBuilder
meBuilder
=
QueryBuilders
.
boolQuery
();
BoolQueryBuilder
meBuilder
=
QueryBuilders
.
boolQuery
();
...
@@ -1217,18 +1119,6 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
...
@@ -1217,18 +1119,6 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
meBuilder
.
must
(
QueryBuilders
.
matchPhraseQuery
(
"SEQUENCE_NBR"
,
"*"
+
test
+
"*"
));
meBuilder
.
must
(
QueryBuilders
.
matchPhraseQuery
(
"SEQUENCE_NBR"
,
"*"
+
test
+
"*"
));
boolMust
.
must
(
meBuilder
);
boolMust
.
must
(
meBuilder
);
}
}
if
(!
ObjectUtils
.
isEmpty
(
map
.
getString
(
"ORG_BRANCH_NAME"
)))
{
BoolQueryBuilder
query
=
QueryBuilders
.
boolQuery
();
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
();
String
test
=
QueryParser
.
escape
(
map
.
getString
(
"ORG_BRANCH_CODE"
));
query
.
must
(
QueryBuilders
.
matchPhrasePrefixQuery
(
"ORG_BRANCH_CODE"
,
test
));
boolMust
.
must
(
query
);
}
if
(!
ObjectUtils
.
isEmpty
(
map
.
getString
(
"USE_UNIT_NAME"
)))
{
if
(!
ObjectUtils
.
isEmpty
(
map
.
getString
(
"USE_UNIT_NAME"
)))
{
BoolQueryBuilder
query
=
QueryBuilders
.
boolQuery
();
BoolQueryBuilder
query
=
QueryBuilders
.
boolQuery
();
String
test
=
QueryParser
.
escape
(
map
.
getString
(
"USE_UNIT_NAME"
));
String
test
=
QueryParser
.
escape
(
map
.
getString
(
"USE_UNIT_NAME"
));
...
@@ -1262,8 +1152,8 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
...
@@ -1262,8 +1152,8 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
}
}
if
(!
ObjectUtils
.
isEmpty
(
map
.
getString
(
"USE_ORG_CODE"
)))
{
if
(!
ObjectUtils
.
isEmpty
(
map
.
getString
(
"USE_ORG_CODE"
)))
{
BoolQueryBuilder
meBuilder
=
QueryBuilders
.
boolQuery
();
BoolQueryBuilder
meBuilder
=
QueryBuilders
.
boolQuery
();
String
test
=
QueryParser
.
escape
(
map
.
getString
(
"USE_ORG_CODE"
)
.
toLowerCase
()
);
String
test
=
QueryParser
.
escape
(
map
.
getString
(
"USE_ORG_CODE"
));
meBuilder
.
must
(
QueryBuilders
.
matchPhrase
Query
(
"USE_ORG_CODE"
,
"*"
+
test
+
"*"
));
meBuilder
.
must
(
QueryBuilders
.
wildcard
Query
(
"USE_ORG_CODE"
,
"*"
+
test
+
"*"
));
boolMust
.
must
(
meBuilder
);
boolMust
.
must
(
meBuilder
);
}
}
if
(!
ObjectUtils
.
isEmpty
(
map
.
getString
(
"CODE96333"
)))
{
if
(!
ObjectUtils
.
isEmpty
(
map
.
getString
(
"CODE96333"
)))
{
...
@@ -1281,8 +1171,8 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
...
@@ -1281,8 +1171,8 @@ public class EquipmentCategoryServiceImpl extends BaseService<EquipmentCategoryD
if
(!
ObjectUtils
.
isEmpty
(
map
.
getString
(
"SUPERVISORY_CODE"
)))
{
if
(!
ObjectUtils
.
isEmpty
(
map
.
getString
(
"SUPERVISORY_CODE"
)))
{
BoolQueryBuilder
meBuilder
=
QueryBuilders
.
boolQuery
();
BoolQueryBuilder
meBuilder
=
QueryBuilders
.
boolQuery
();
// String test = QueryParser.escape(map.getString("SUPERVISORY_CODE").toLowerCase(
));
String
test
=
QueryParser
.
escape
(
map
.
getString
(
"SUPERVISORY_CODE"
));
meBuilder
.
must
(
QueryBuilders
.
matchPhraseQuery
(
"SUPERVISORY_CODE"
,
"*"
+
map
.
getString
(
"SUPERVISORY_CODE"
).
toLowerCase
()
+
"*"
));
meBuilder
.
must
(
QueryBuilders
.
wildcardQuery
(
"SUPERVISORY_CODE"
,
"*"
+
test
+
"*"
));
boolMust
.
must
(
meBuilder
);
boolMust
.
must
(
meBuilder
);
}
}
if
(!
ObjectUtils
.
isEmpty
(
map
.
getString
(
"USE_PLACE"
)))
{
if
(!
ObjectUtils
.
isEmpty
(
map
.
getString
(
"USE_PLACE"
)))
{
...
...
amos-boot-system-tzs/amos-boot-module-app/amos-boot-module-app-biz/src/main/java/com/yeejoin/amos/boot/module/app/biz/service/impl/TzsAppService.java
View file @
98f5b139
...
@@ -59,6 +59,7 @@ import com.yeejoin.amos.boot.module.app.api.entity.ProduceInfo;
...
@@ -59,6 +59,7 @@ import com.yeejoin.amos.boot.module.app.api.entity.ProduceInfo;
import
com.yeejoin.amos.boot.module.app.api.entity.ProtectionDevices
;
import
com.yeejoin.amos.boot.module.app.api.entity.ProtectionDevices
;
import
com.yeejoin.amos.boot.module.app.api.entity.RegistrationInfo
;
import
com.yeejoin.amos.boot.module.app.api.entity.RegistrationInfo
;
import
com.yeejoin.amos.boot.module.app.api.entity.UseInfo
;
import
com.yeejoin.amos.boot.module.app.api.entity.UseInfo
;
import
com.yeejoin.amos.boot.module.app.api.enums.EquipmentCategoryEnum
;
import
com.yeejoin.amos.boot.module.app.api.enums.EquipmentClassifityEnum
;
import
com.yeejoin.amos.boot.module.app.api.enums.EquipmentClassifityEnum
;
import
com.yeejoin.amos.boot.module.app.api.mapper.CategoryOtherInfoMapper
;
import
com.yeejoin.amos.boot.module.app.api.mapper.CategoryOtherInfoMapper
;
import
com.yeejoin.amos.boot.module.app.api.mapper.EquipmentCategoryMapper
;
import
com.yeejoin.amos.boot.module.app.api.mapper.EquipmentCategoryMapper
;
...
@@ -68,8 +69,10 @@ import com.yeejoin.amos.boot.module.app.biz.utils.JsonUtils;
...
@@ -68,8 +69,10 @@ import com.yeejoin.amos.boot.module.app.biz.utils.JsonUtils;
import
com.yeejoin.amos.boot.module.app.biz.utils.RedisUtil
;
import
com.yeejoin.amos.boot.module.app.biz.utils.RedisUtil
;
import
com.yeejoin.amos.boot.module.app.flc.api.feign.IdxFeignService
;
import
com.yeejoin.amos.boot.module.app.flc.api.feign.IdxFeignService
;
import
com.yeejoin.amos.component.feign.model.FeignClientResult
;
import
com.yeejoin.amos.component.feign.model.FeignClientResult
;
import
com.yeejoin.amos.component.feign.utils.FeignUtil
;
import
com.yeejoin.amos.feign.privilege.Privilege
;
import
com.yeejoin.amos.feign.privilege.Privilege
;
import
com.yeejoin.amos.feign.privilege.model.AgencyUserModel
;
import
com.yeejoin.amos.feign.privilege.model.AgencyUserModel
;
import
com.yeejoin.amos.feign.privilege.model.CompanyModel
;
import
com.yeejoin.amos.feign.privilege.model.IdPasswordAuthModel
;
import
com.yeejoin.amos.feign.privilege.model.IdPasswordAuthModel
;
import
com.yeejoin.amos.feign.systemctl.Systemctl
;
import
com.yeejoin.amos.feign.systemctl.Systemctl
;
import
com.yeejoin.amos.feign.systemctl.model.RegionModel
;
import
com.yeejoin.amos.feign.systemctl.model.RegionModel
;
...
@@ -81,6 +84,16 @@ import org.apache.commons.lang3.StringUtils;
...
@@ -81,6 +84,16 @@ import org.apache.commons.lang3.StringUtils;
import
org.apache.http.entity.ContentType
;
import
org.apache.http.entity.ContentType
;
import
org.apache.ibatis.builder.MapperBuilderAssistant
;
import
org.apache.ibatis.builder.MapperBuilderAssistant
;
import
org.bouncycastle.jce.provider.BouncyCastleProvider
;
import
org.bouncycastle.jce.provider.BouncyCastleProvider
;
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.index.query.BoolQueryBuilder
;
import
org.elasticsearch.index.query.QueryBuilders
;
import
org.elasticsearch.search.aggregations.AggregationBuilders
;
import
org.elasticsearch.search.aggregations.bucket.terms.Terms
;
import
org.elasticsearch.search.aggregations.bucket.terms.TermsAggregationBuilder
;
import
org.elasticsearch.search.builder.SearchSourceBuilder
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.core.io.Resource
;
import
org.springframework.core.io.Resource
;
...
@@ -91,6 +104,7 @@ import org.springframework.web.multipart.MultipartFile;
...
@@ -91,6 +104,7 @@ import org.springframework.web.multipart.MultipartFile;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
import
org.typroject.tyboot.core.foundation.utils.ValidationUtil
;
import
org.typroject.tyboot.core.foundation.utils.ValidationUtil
;
import
org.typroject.tyboot.core.rdbms.service.BaseService
;
import
org.typroject.tyboot.core.rdbms.service.BaseService
;
import
org.typroject.tyboot.core.restful.exception.instance.BadRequest
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
javax.crypto.Cipher
;
import
javax.crypto.Cipher
;
...
@@ -180,6 +194,9 @@ public class TzsAppService {
...
@@ -180,6 +194,9 @@ public class TzsAppService {
private
Resource
equipCategory
;
private
Resource
equipCategory
;
@Autowired
@Autowired
RestHighLevelClient
restHighLevelClient
;
@Autowired
private
RedisUtil
redisUtil
;
private
RedisUtil
redisUtil
;
private
static
final
String
STREET
=
"STREET"
;
private
static
final
String
STREET
=
"STREET"
;
...
@@ -707,18 +724,54 @@ public class TzsAppService {
...
@@ -707,18 +724,54 @@ public class TzsAppService {
Map
<
String
,
List
<
Map
<
String
,
Object
>>>
resourceJson
=
JsonUtils
.
getResourceJson
(
equipCategory
);
Map
<
String
,
List
<
Map
<
String
,
Object
>>>
resourceJson
=
JsonUtils
.
getResourceJson
(
equipCategory
);
List
<
Map
<
String
,
Object
>>
mapList
=
resourceJson
.
get
(
EquipmentClassifityEnum
.
BDLS
.
getCode
());
List
<
Map
<
String
,
Object
>>
mapList
=
resourceJson
.
get
(
EquipmentClassifityEnum
.
BDLS
.
getCode
());
List
<
Map
<
String
,
Object
>>
list
=
new
ArrayList
<>();
List
<
Map
<
String
,
Object
>>
list
=
new
ArrayList
<>();
List
<
Map
<
String
,
Object
>>
listMap
=
equipmentCategoryMapper
.
getCategoryCount
(
companyCode
);
SearchSourceBuilder
builder
=
new
SearchSourceBuilder
();
for
(
Map
<
String
,
Object
>
map
:
mapList
)
{
builder
.
trackTotalHits
(
true
);
for
(
Map
<
String
,
Object
>
map1
:
listMap
)
{
SearchRequest
request
=
new
SearchRequest
();
if
(
map
.
get
(
"code"
).
equals
(
map1
.
get
(
"category"
)))
{
request
.
indices
(
"idx_biz_view_jg_all"
);
map
.
put
(
"waitClaim"
,
map1
.
get
(
"waitClaim"
));
BoolQueryBuilder
boolMust
=
QueryBuilders
.
boolQuery
();
map
.
put
(
"alreadyClaim"
,
map1
.
get
(
"alreadyClaim"
));
map
.
put
(
"refuseClaim"
,
map1
.
get
(
"refuseClaim"
));
BoolQueryBuilder
query
=
QueryBuilders
.
boolQuery
();
Long
sum
=
Long
.
valueOf
(
map1
.
get
(
"waitClaim"
).
toString
())
+
Long
.
valueOf
(
map1
.
get
(
"alreadyClaim"
).
toString
())
+
Long
.
valueOf
(
map1
.
get
(
"refuseClaim"
).
toString
());
query
.
must
(
QueryBuilders
.
matchPhraseQuery
(
"USE_UNIT_CREDIT_CODE"
,
companyCode
));
map
.
put
(
"sum"
,
sum
);
boolMust
.
must
(
query
);
TermsAggregationBuilder
field1Aggregation
=
AggregationBuilders
.
terms
(
"group_by_code"
)
.
field
(
"EQU_LIST_CODE"
)
.
size
(
1000
);
TermsAggregationBuilder
field2Aggregation
=
AggregationBuilders
.
terms
(
"group_by_status"
)
.
field
(
"STATUS"
)
.
size
(
1000
);
builder
.
query
(
boolMust
);
field1Aggregation
.
subAggregation
(
field2Aggregation
);
builder
.
aggregation
(
field1Aggregation
);
builder
.
size
(
0
);
request
.
source
(
builder
);
Map
<
String
,
Object
>
statusCountMap
=
new
HashMap
<>();
try
{
SearchResponse
response
=
restHighLevelClient
.
search
(
request
,
RequestOptions
.
DEFAULT
);
Terms
field1Terms
=
response
.
getAggregations
().
get
(
"group_by_code"
);
for
(
Terms
.
Bucket
field1Bucket
:
field1Terms
.
getBuckets
())
{
Terms
field2Terms
=
field1Bucket
.
getAggregations
().
get
(
"group_by_status"
);
for
(
Terms
.
Bucket
field2Bucket
:
field2Terms
.
getBuckets
())
{
String
field1Value
=
field1Bucket
.
getKeyAsString
();
String
field2Value
=
EquipmentCategoryEnum
.
YRL
.
getName
().
equals
(
field2Bucket
.
getKeyAsString
())
?
"alreadyClaim"
:
EquipmentCategoryEnum
.
DRL
.
getName
().
equals
(
field2Bucket
.
getKeyAsString
())
?
"waitClaim"
:
EquipmentCategoryEnum
.
YJL
.
getName
().
equals
(
field2Bucket
.
getKeyAsString
())
?
"refuseClaim"
:
"caogao"
;
long
docCount
=
field2Bucket
.
getDocCount
();
statusCountMap
.
put
(
field1Value
+
"|"
+
field2Value
,
docCount
);
}
}
}
}
list
.
add
(
map
);
}
catch
(
IOException
e
)
{
throw
new
BadRequest
(
"es数据查询失败"
);
}
for
(
Map
<
String
,
Object
>
item
:
mapList
)
{
item
.
put
(
"waitClaim"
,
getCountNumber
(
item
.
get
(
"code"
).
toString
(),
"waitClaim"
,
statusCountMap
));
item
.
put
(
"alreadyClaim"
,
getCountNumber
(
item
.
get
(
"code"
).
toString
(),
"alreadyClaim"
,
statusCountMap
));
item
.
put
(
"refuseClaim"
,
getCountNumber
(
item
.
get
(
"code"
).
toString
(),
"refuseClaim"
,
statusCountMap
));
item
.
put
(
"sum"
,
Long
.
parseLong
(
item
.
get
(
"waitClaim"
).
toString
())
+
Long
.
parseLong
(
item
.
get
(
"alreadyClaim"
).
toString
())
+
Long
.
parseLong
(
item
.
get
(
"refuseClaim"
).
toString
()));
list
.
add
(
item
);
}
}
page
.
setCurrent
(
1
);
page
.
setCurrent
(
1
);
page
.
setTotal
(
list
.
size
());
page
.
setTotal
(
list
.
size
());
...
@@ -726,6 +779,11 @@ public class TzsAppService {
...
@@ -726,6 +779,11 @@ public class TzsAppService {
return
page
;
return
page
;
}
}
private
Long
getCountNumber
(
String
type
,
String
status
,
Map
<
String
,
Object
>
statusCountMap
)
{
String
key
=
type
+
"|"
+
status
;
return
Long
.
parseLong
(
statusCountMap
.
getOrDefault
(
key
,
"0"
).
toString
());
}
public
Page
<
Map
<
String
,
Object
>>
getTable
(
Map
<
String
,
Object
>
map
)
{
public
Page
<
Map
<
String
,
Object
>>
getTable
(
Map
<
String
,
Object
>
map
)
{
Page
<
Map
<
String
,
Object
>>
table
=
null
;
Page
<
Map
<
String
,
Object
>>
table
=
null
;
String
teqy
=
(
String
)
map
.
get
(
"teqy"
);
String
teqy
=
(
String
)
map
.
get
(
"teqy"
);
...
...
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