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
d829ee8a
Commit
d829ee8a
authored
Jul 19, 2024
by
王果
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/develop_tzs_register_to_0715' into…
Merge remote-tracking branch 'origin/develop_tzs_register_to_0715' into develop_tzs_register_to_0715
parents
93a23727
e19651a3
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
311 additions
and
22 deletions
+311
-22
DPStatisticsServiceImpl.java
...t/module/jg/biz/service/impl/DPStatisticsServiceImpl.java
+10
-12
JyjcInspectionApplicationMapper.java
...dule/jyjc/api/mapper/JyjcInspectionApplicationMapper.java
+10
-0
JyjcInspectionApplicationMapper.xml
...main/resources/mapper/JyjcInspectionApplicationMapper.xml
+17
-0
DPStatisticsController.java
...ot/module/jyjc/biz/controller/DPStatisticsController.java
+34
-0
DPStatisticsServiceImpl.java
...module/jyjc/biz/service/impl/DPStatisticsServiceImpl.java
+228
-3
DPSubServiceImpl.java
...s/boot/module/jyjc/biz/service/impl/DPSubServiceImpl.java
+9
-4
JyjcInspectionApplicationServiceImpl.java
...iz/service/impl/JyjcInspectionApplicationServiceImpl.java
+1
-1
company.json
...boot-module-jyjc-biz/src/main/resources/json/company.json
+1
-1
ScreenImpl.java
...ot/module/tcm/biz/service/impl/statistics/ScreenImpl.java
+1
-1
No files found.
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/DPStatisticsServiceImpl.java
View file @
d829ee8a
...
...
@@ -109,7 +109,6 @@ public class DPStatisticsServiceImpl {
private
TzsUserInfoMapper
userInfoMapper
;
private
RedisUtils
redisUtils
;
private
static
Map
<
String
,
String
>
regionCodeOrgCodeMap
=
new
ConcurrentHashMap
<>();
...
...
@@ -119,7 +118,7 @@ public class DPStatisticsServiceImpl {
private
DPStatisticsMapper
dpStatisticsMapper
;
public
DPStatisticsServiceImpl
(
EquipmentCategoryMapper
equipmentCategoryMapper
,
JgUseRegistrationMapper
useRegistrationMapper
,
EquipTechParamPipelineMapper
techParamsPipelineMapper
,
JgEnableDisableMapper
enableDisableMapper
,
JgScrapCancelMapper
scrapCancelMapper
,
RestHighLevelClient
restHighLevelClient
,
TzBaseEnterpriseInfoMapper
enterpriseInfoMapper
,
CommonMapper
commonMapper
,
TzsUserInfoMapper
userInfoMapper
,
RedisUtils
redisUtils
,
RedisUtils
redisUtils1
)
{
public
DPStatisticsServiceImpl
(
EquipmentCategoryMapper
equipmentCategoryMapper
,
JgUseRegistrationMapper
useRegistrationMapper
,
EquipTechParamPipelineMapper
techParamsPipelineMapper
,
JgEnableDisableMapper
enableDisableMapper
,
JgScrapCancelMapper
scrapCancelMapper
,
RestHighLevelClient
restHighLevelClient
,
TzBaseEnterpriseInfoMapper
enterpriseInfoMapper
,
CommonMapper
commonMapper
,
TzsUserInfoMapper
userInfoMapper
)
{
this
.
equipmentCategoryMapper
=
equipmentCategoryMapper
;
this
.
useRegistrationMapper
=
useRegistrationMapper
;
this
.
techParamsPipelineMapper
=
techParamsPipelineMapper
;
...
...
@@ -129,7 +128,6 @@ public class DPStatisticsServiceImpl {
this
.
enterpriseInfoMapper
=
enterpriseInfoMapper
;
this
.
commonMapper
=
commonMapper
;
this
.
userInfoMapper
=
userInfoMapper
;
this
.
redisUtils
=
redisUtils1
;
}
public
void
init
()
{
...
...
@@ -294,7 +292,7 @@ public class DPStatisticsServiceImpl {
// 设备类别精确查询气瓶
boolMust
.
must
(
QueryBuilders
.
termsQuery
(
"EQU_CATEGORY_CODE"
,
EQU_CATEGORY_CYLINDER
));
// 纳管状态为已纳管
boolMust
.
must
(
QueryBuilders
.
term
s
Query
(
"IS_INTO_MANAGEMENT"
,
true
));
boolMust
.
must
(
QueryBuilders
.
termQuery
(
"IS_INTO_MANAGEMENT"
,
true
));
request
.
query
(
boolMust
);
try
{
CountResponse
response
=
restHighLevelClient
.
count
(
request
,
RequestOptions
.
DEFAULT
);
...
...
@@ -323,7 +321,7 @@ public class DPStatisticsServiceImpl {
// 区域信息模糊查询
boolMust
.
must
(
QueryBuilders
.
wildcardQuery
(
"USE_PLACE_CODE"
,
"*"
+
dpFilterParamDto
.
getCityCode
()
+
"*"
));
// 纳管状态为已纳管
boolMust
.
must
(
QueryBuilders
.
term
s
Query
(
"IS_INTO_MANAGEMENT"
,
true
));
boolMust
.
must
(
QueryBuilders
.
termQuery
(
"IS_INTO_MANAGEMENT"
,
true
));
SearchSourceBuilder
builder
=
new
SearchSourceBuilder
();
builder
.
query
(
boolMust
);
TermsAggregationBuilder
aggregationBuilder
=
AggregationBuilders
.
terms
(
"count_by_equ_list_code"
).
field
(
"EQU_LIST_CODE"
);
...
...
@@ -682,7 +680,7 @@ public class DPStatisticsServiceImpl {
// 区域信息模糊查询
boolMust
.
must
(
QueryBuilders
.
wildcardQuery
(
"USE_PLACE_CODE"
,
"*"
+
dpFilterParamDto
.
getCityCode
()
+
"*"
));
// 纳管状态为已纳管
boolMust
.
must
(
QueryBuilders
.
term
s
Query
(
"IS_INTO_MANAGEMENT"
,
true
));
boolMust
.
must
(
QueryBuilders
.
termQuery
(
"IS_INTO_MANAGEMENT"
,
true
));
SearchSourceBuilder
builder
=
new
SearchSourceBuilder
();
builder
.
query
(
boolMust
);
TermsAggregationBuilder
aggregationBuilder
=
AggregationBuilders
.
terms
(
"EQU_STATE_COUNT"
).
field
(
"EQU_STATE"
);
...
...
@@ -735,7 +733,7 @@ public class DPStatisticsServiceImpl {
// 区域信息模糊查询
boolMust
.
must
(
QueryBuilders
.
wildcardQuery
(
"USE_PLACE_CODE"
,
"*"
+
dpFilterParamDto
.
getCityCode
()
+
"*"
));
// 纳管状态为已纳管
boolMust
.
must
(
QueryBuilders
.
term
s
Query
(
"IS_INTO_MANAGEMENT"
,
true
));
boolMust
.
must
(
QueryBuilders
.
termQuery
(
"IS_INTO_MANAGEMENT"
,
true
));
SearchSourceBuilder
builder
=
new
SearchSourceBuilder
();
builder
.
query
(
boolMust
);
// 设备状态
...
...
@@ -1021,19 +1019,19 @@ public class DPStatisticsServiceImpl {
for
(
int
i
=
0
;
i
<
5
;
i
++){
Map
<
String
,
Object
>
result
=
new
HashMap
<>();
if
(
i
==
0
){
result
.
put
(
"key"
,
i
);
result
.
put
(
"key"
,
i
+
""
);
result
.
put
(
"name"
,
"告知管理"
);
}
else
if
(
i
==
1
){
result
.
put
(
"key"
,
i
);
result
.
put
(
"key"
,
i
+
""
);
result
.
put
(
"name"
,
"使用登记"
);
}
else
if
(
i
==
2
){
result
.
put
(
"key"
,
i
);
result
.
put
(
"key"
,
i
+
""
);
result
.
put
(
"name"
,
"变更登记"
);
}
else
if
(
i
==
3
){
result
.
put
(
"key"
,
i
);
result
.
put
(
"key"
,
i
+
""
);
result
.
put
(
"name"
,
"停用启用"
);
}
else
if
(
i
==
4
){
result
.
put
(
"key"
,
i
);
result
.
put
(
"key"
,
i
+
""
);
result
.
put
(
"name"
,
"注销报废"
);
}
resultList
.
add
(
result
);
...
...
amos-boot-system-tzs/amos-boot-module-jyjc/amos-boot-module-jyjc-api/src/main/java/com/yeejoin/amos/boot/module/jyjc/api/mapper/JyjcInspectionApplicationMapper.java
View file @
d829ee8a
...
...
@@ -73,4 +73,14 @@ public interface JyjcInspectionApplicationMapper extends BaseMapper<JyjcInspecti
* @return List<CountDto>
*/
List
<
CountDto
>
queryAppByEquListForDP
(
@Param
(
"orgCode"
)
String
orgCode
,
@Param
(
"dto"
)
DPFilterParamDto
dpFilterParamDto
);
/**
* 按照8大类,统计
* @param orgCode 指定区域对应的公司
* @param dpFilterParamDto 时间过滤条件
* @return CountDto
*/
CountDto
queryAppByEquListForReporting
(
@Param
(
"orgCode"
)
String
orgCode
,
@Param
(
"dto"
)
DPFilterParamDto
dpFilterParamDto
);
}
amos-boot-system-tzs/amos-boot-module-jyjc/amos-boot-module-jyjc-api/src/main/resources/mapper/JyjcInspectionApplicationMapper.xml
View file @
d829ee8a
...
...
@@ -275,4 +275,21 @@
and date_ge(CAST(a.application_date as date),#{dto.beginDate}) and date_le(CAST(a.application_date as date),#{dto.endDate})
GROUP BY a.equip_classify
</select>
<select
id=
"queryAppByEquListForReporting"
resultType=
"com.yeejoin.amos.boot.biz.common.dto.CountDto"
>
SELECT
count(1) as longValue
FROM
tz_jyjc_inspection_application a,
tz_base_enterprise_info b
where
a.inspection_unit_code= b.use_unit_code
and a.status != '6610' and a.status != '6615'
and b.supervise_org_code like CONCAT(#{orgCode}, '%')
<if
test=
"dto.beginDate !=null"
>
and date_ge(CAST(a.application_date as date),#{dto.beginDate})
</if>
<if
test=
"dto.endDate !=null"
>
and date_le(CAST(a.application_date as date),#{dto.endDate})
</if>
</select>
</mapper>
amos-boot-system-tzs/amos-boot-module-jyjc/amos-boot-module-jyjc-biz/src/main/java/com/yeejoin/amos/boot/module/jyjc/biz/controller/DPStatisticsController.java
View file @
d829ee8a
...
...
@@ -124,4 +124,38 @@ public class DPStatisticsController {
}
return
ResponseHelper
.
buildResponse
(
statisticsService
.
queryInspectionEquipByEquList
(
dpFilterParamDto
));
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"大屏-检验检测-中间地图左侧全局统计"
,
notes
=
"大屏-检验检测-中间地图左侧全局统计"
)
@PostMapping
(
value
=
"/jy/center-map/legend"
)
public
ResponseModel
<
Map
<
String
,
Object
>>
centerMapCountForGlobal
(
@Validated
@RequestBody
DPFilterParamDto
dpFilterParamDto
,
BindingResult
result
)
{
List
<
FieldError
>
fieldErrors
=
result
.
getFieldErrors
();
if
(!
fieldErrors
.
isEmpty
())
{
throw
new
BadRequest
(
fieldErrors
.
get
(
0
).
getDefaultMessage
());
}
return
ResponseHelper
.
buildResponse
(
statisticsService
.
getCenterMapCountDataForGlobal
(
dpFilterParamDto
));
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"大屏-检验检测-中间地图地市统计"
,
notes
=
"大屏-检验检测-中间-地图地市统计"
)
@PostMapping
(
value
=
"/jy/center-map/overview"
)
public
ResponseModel
<
List
<
Map
<
String
,
Object
>>>
centerMapCountForOverview
(
@Validated
@RequestBody
DPFilterParamDto
dpFilterParamDto
,
BindingResult
result
)
{
List
<
FieldError
>
fieldErrors
=
result
.
getFieldErrors
();
if
(!
fieldErrors
.
isEmpty
())
{
throw
new
BadRequest
(
fieldErrors
.
get
(
0
).
getDefaultMessage
());
}
return
ResponseHelper
.
buildResponse
(
statisticsService
.
getCenterMapCountDataForOverview
(
dpFilterParamDto
));
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"大屏-检验检测-八大类设备检验临期、超期统计"
,
notes
=
"大屏-检验检测-八大类设备检验临期、超期统计"
)
@PostMapping
(
value
=
"/jy/equipInspectTime/countByEquList"
)
public
ResponseModel
<
Map
<
String
,
Object
>>
equipInspectTimeCountByEquList
(
@Validated
@RequestBody
DPFilterParamDto
dpFilterParamDto
,
BindingResult
result
)
{
List
<
FieldError
>
fieldErrors
=
result
.
getFieldErrors
();
if
(!
fieldErrors
.
isEmpty
())
{
throw
new
BadRequest
(
fieldErrors
.
get
(
0
).
getDefaultMessage
());
}
return
ResponseHelper
.
buildResponse
(
statisticsService
.
equipInspectTimeCountByEquList
(
dpFilterParamDto
));
}
}
amos-boot-system-tzs/amos-boot-module-jyjc/amos-boot-module-jyjc-biz/src/main/java/com/yeejoin/amos/boot/module/jyjc/biz/service/impl/DPStatisticsServiceImpl.java
View file @
d829ee8a
...
...
@@ -10,6 +10,7 @@ import com.yeejoin.amos.boot.module.jyjc.api.enums.BizTypeEnum;
import
com.yeejoin.amos.boot.module.jyjc.api.enums.JYJCTypeEnum
;
import
com.yeejoin.amos.boot.module.jyjc.api.mapper.*
;
import
com.yeejoin.amos.boot.module.ymt.api.dto.EquipmentCategoryDto
;
import
com.yeejoin.amos.boot.module.ymt.api.enums.EquimentEnum
;
import
com.yeejoin.amos.boot.module.ymt.api.mapper.EquipmentCategoryMapper
;
import
com.yeejoin.amos.boot.module.ymt.api.mapper.TzsUserInfoMapper
;
import
com.yeejoin.amos.component.feign.model.FeignClientResult
;
...
...
@@ -17,8 +18,21 @@ import com.yeejoin.amos.feign.systemctl.Systemctl;
import
com.yeejoin.amos.feign.systemctl.model.RegionModel
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
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.client.core.CountRequest
;
import
org.elasticsearch.client.core.CountResponse
;
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.stereotype.Service
;
import
java.io.IOException
;
import
java.time.LocalDate
;
import
java.time.LocalDateTime
;
import
java.time.format.DateTimeFormatter
;
...
...
@@ -63,7 +77,11 @@ public class DPStatisticsServiceImpl {
private
static
Map
<
String
,
String
>
regionCodeOrgCodeMap
=
new
ConcurrentHashMap
<>();
public
DPStatisticsServiceImpl
(
EquipmentCategoryMapper
equipmentCategoryMapper
,
JyjcInspectionApplicationEquipMapper
inspectionApplicationEquipMapper
,
JyjcInspectionApplicationMapper
inspectionApplicationMapper
,
TzsUserInfoMapper
tzsUserInfoMapper
,
JyjcBaseMapper
jyjcBaseMapper
,
JyjcInspectionResultMapper
inspectionResultMapper
,
JyjcOpeningApplicationMapper
openingApplicationMapper
)
{
private
static
Map
<
String
,
List
<
RegionModel
>>
regionChildRegionMap
=
new
ConcurrentHashMap
<>();
private
RestHighLevelClient
restHighLevelClient
;
public
DPStatisticsServiceImpl
(
EquipmentCategoryMapper
equipmentCategoryMapper
,
JyjcInspectionApplicationEquipMapper
inspectionApplicationEquipMapper
,
JyjcInspectionApplicationMapper
inspectionApplicationMapper
,
TzsUserInfoMapper
tzsUserInfoMapper
,
JyjcBaseMapper
jyjcBaseMapper
,
JyjcInspectionResultMapper
inspectionResultMapper
,
JyjcOpeningApplicationMapper
openingApplicationMapper
,
RestHighLevelClient
restHighLevelClient
)
{
this
.
equipmentCategoryMapper
=
equipmentCategoryMapper
;
this
.
inspectionApplicationEquipMapper
=
inspectionApplicationEquipMapper
;
this
.
inspectionApplicationMapper
=
inspectionApplicationMapper
;
...
...
@@ -71,6 +89,7 @@ public class DPStatisticsServiceImpl {
this
.
jyjcBaseMapper
=
jyjcBaseMapper
;
this
.
inspectionResultMapper
=
inspectionResultMapper
;
this
.
openingApplicationMapper
=
openingApplicationMapper
;
this
.
restHighLevelClient
=
restHighLevelClient
;
}
...
...
@@ -215,8 +234,14 @@ public class DPStatisticsServiceImpl {
private
List
<
RegionModel
>
getRegionList
(
DPFilterParamDto
dpFilterParamDto
)
{
try
{
FeignClientResult
<
List
<
RegionModel
>>
feignClientResult
=
Systemctl
.
regionClient
.
queryByParentRegionCode
(
Integer
.
parseInt
(
dpFilterParamDto
.
getCityCode
()));
return
feignClientResult
.
getResult
();
if
(
regionChildRegionMap
.
get
(
dpFilterParamDto
.
getCityCode
())
==
null
)
{
FeignClientResult
<
List
<
RegionModel
>>
feignClientResult
=
Systemctl
.
regionClient
.
queryByParentRegionCode
(
Integer
.
parseInt
(
dpFilterParamDto
.
getCityCode
()));
List
<
RegionModel
>
regionModels
=
feignClientResult
.
getResult
();
regionChildRegionMap
.
put
(
dpFilterParamDto
.
getCityCode
(),
regionModels
);
return
regionModels
;
}
else
{
return
regionChildRegionMap
.
get
(
dpFilterParamDto
.
getCityCode
());
}
}
catch
(
Exception
e
)
{
log
.
error
(
"查询行政区域失败:{}"
,
e
.
getMessage
());
}
...
...
@@ -325,4 +350,204 @@ public class DPStatisticsServiceImpl {
List
<
String
>
names
=
equipmentCategoryDtos
.
stream
().
map
(
EquipmentCategoryDto:
:
getName
).
collect
(
Collectors
.
toList
());
result
.
put
(
"xdata"
,
names
);
}
private
List
<
String
>
getEquListXDataCommon
(
List
<
EquipmentCategoryDto
>
equipmentCategoryDtos
)
{
// 8大类
return
equipmentCategoryDtos
.
stream
().
map
(
EquipmentCategoryDto:
:
getName
).
collect
(
Collectors
.
toList
());
}
public
Map
<
String
,
Object
>
getCenterMapCountDataForGlobal
(
DPFilterParamDto
dpFilterParamDto
)
{
Map
<
String
,
Object
>
result
=
new
HashMap
<>();
// 1.报检数量统计
this
.
staticsCenterMapCountDataReporting
(
result
,
dpFilterParamDto
);
// 2.检验检测临期设备数数量统计
this
.
staticsCenterMapCountDataTemporary
(
result
,
dpFilterParamDto
);
// 3.检验检测超期设备数数量统计
this
.
staticsCenterMapCountDataOverdue
(
result
,
dpFilterParamDto
);
return
result
;
}
private
void
staticsCenterMapCountDataTemporary
(
Map
<
String
,
Object
>
result
,
DPFilterParamDto
dpFilterParamDto
)
{
long
num
=
0
;
CountRequest
request
=
new
CountRequest
();
request
.
indices
(
"idx_biz_view_jg_all"
);
BoolQueryBuilder
boolMust
=
QueryBuilders
.
boolQuery
();
// 且区域信息模糊查询
boolMust
.
must
(
QueryBuilders
.
wildcardQuery
(
"USE_PLACE_CODE"
,
"*"
+
dpFilterParamDto
.
getCityCode
()
+
"*"
));
// 且纳管状态为已纳管
boolMust
.
must
(
QueryBuilders
.
termQuery
(
"IS_INTO_MANAGEMENT"
,
true
));
// 且在用状态设备
boolMust
.
must
(
QueryBuilders
.
termQuery
(
"EQU_STATE"
,
EquimentEnum
.
ZAIYONG
.
getCode
()));
// 且下次检验日期大于等于当天
long
currentDayTime
=
DateUtil
.
parse
(
DateUtil
.
today
(),
"yyy-MM-dd"
).
getTime
();
boolMust
.
must
(
QueryBuilders
.
rangeQuery
(
"NEXT_INSPECT_DATE"
).
gte
(
currentDayTime
));
// 且查询 下次检验日期 <= 当前天+30天 极为临期
long
currentDayAfter30DayTime
=
DateUtil
.
offsetDay
(
DateUtil
.
parse
(
DateUtil
.
today
(),
"yyy-MM-dd"
),
30
).
getTime
();
boolMust
.
must
(
QueryBuilders
.
rangeQuery
(
"NEXT_INSPECT_DATE"
).
lte
(
currentDayAfter30DayTime
));
request
.
query
(
boolMust
);
try
{
CountResponse
response
=
restHighLevelClient
.
count
(
request
,
RequestOptions
.
DEFAULT
);
num
=
response
.
getCount
();
}
catch
(
IOException
e
)
{
throw
new
RuntimeException
(
e
);
}
result
.
put
(
"jyjclqsbCount"
,
num
);
}
private
void
staticsCenterMapCountDataOverdue
(
Map
<
String
,
Object
>
result
,
DPFilterParamDto
dpFilterParamDto
)
{
long
num
=
0
;
CountRequest
request
=
new
CountRequest
();
request
.
indices
(
"idx_biz_view_jg_all"
);
BoolQueryBuilder
boolMust
=
QueryBuilders
.
boolQuery
();
// 区域信息模糊查询
boolMust
.
must
(
QueryBuilders
.
wildcardQuery
(
"USE_PLACE_CODE"
,
"*"
+
dpFilterParamDto
.
getCityCode
()
+
"*"
));
// 纳管状态为已纳管
boolMust
.
must
(
QueryBuilders
.
termQuery
(
"IS_INTO_MANAGEMENT"
,
true
));
// 在用状态设备
boolMust
.
must
(
QueryBuilders
.
termQuery
(
"EQU_STATE"
,
EquimentEnum
.
ZAIYONG
.
getCode
()));
// 查询下次检验日期小于当前天的设备,即为超期检验超期设备
long
currentDayTime
=
DateUtil
.
parse
(
DateUtil
.
now
(),
"yyy-MM-dd"
).
getTime
();
boolMust
.
must
(
QueryBuilders
.
rangeQuery
(
"NEXT_INSPECT_DATE"
).
lt
(
currentDayTime
));
request
.
query
(
boolMust
);
try
{
CountResponse
response
=
restHighLevelClient
.
count
(
request
,
RequestOptions
.
DEFAULT
);
num
=
response
.
getCount
();
}
catch
(
IOException
e
)
{
throw
new
RuntimeException
(
e
);
}
result
.
put
(
"jyjccqsbCount"
,
num
);
}
private
void
staticsCenterMapCountDataReporting
(
Map
<
String
,
Object
>
result
,
DPFilterParamDto
dpFilterParamDto
)
{
String
orgCode
=
this
.
getAndSetOrgCode
(
dpFilterParamDto
.
getCityCode
());
CountDto
countDto
=
inspectionApplicationMapper
.
queryAppByEquListForReporting
(
orgCode
,
dpFilterParamDto
);
result
.
put
(
"bjCount"
,
countDto
.
getLongValue
());
}
public
List
<
Map
<
String
,
Object
>>
getCenterMapCountDataForOverview
(
DPFilterParamDto
dpFilterParamDto
)
{
return
getRegionList
(
dpFilterParamDto
).
parallelStream
().
filter
(
e
->
e
.
getParentRegionCode
()
!=
null
&&
(
e
.
getParentRegionCode
().
toString
()).
equals
(
dpFilterParamDto
.
getCityCode
())).
map
(
r
->
{
DPFilterParamDto
filterParamDto
=
new
DPFilterParamDto
();
filterParamDto
.
setCityCode
(
r
.
getRegionCode
().
toString
());
Map
<
String
,
Object
>
itemResult
=
getCenterMapOverviewData
(
filterParamDto
);
itemResult
.
put
(
"regionCode"
,
r
.
getRegionCode
());
itemResult
.
put
(
"regionName"
,
r
.
getRegionName
());
return
itemResult
;
}).
collect
(
Collectors
.
toList
());
}
private
Map
<
String
,
Object
>
getCenterMapOverviewData
(
DPFilterParamDto
filterParamDto
)
{
Map
<
String
,
Object
>
result
=
new
HashMap
<>();
// 1.报检数量统计
this
.
staticsCenterMapCountDataReporting
(
result
,
filterParamDto
);
// 2.检验检测临期设备数数量统计
this
.
staticsCenterMapCountDataTemporary
(
result
,
filterParamDto
);
// 3.检验检测超期设备数数量统计
this
.
staticsCenterMapCountDataOverdue
(
result
,
filterParamDto
);
return
result
;
}
public
Map
<
String
,
Object
>
equipInspectTimeCountByEquList
(
DPFilterParamDto
dpFilterParamDto
)
{
// 1.按照前端约定格式返回数据
Map
<
String
,
Object
>
result
=
new
HashMap
<>();
// 1.1 图列数据构造
result
.
put
(
"legendData"
,
this
.
getLegendDataForJyTime
());
// 8大类设备种类
List
<
EquipmentCategoryDto
>
equipmentCategoryDtos
=
equipmentCategoryMapper
.
selectClassify
();
// 2.x轴数据构造
result
.
put
(
"xdata"
,
this
.
getEquListXDataCommon
(
equipmentCategoryDtos
));
// 3.y轴数据构造
this
.
buildYDataForJyTime
(
result
,
dpFilterParamDto
,
equipmentCategoryDtos
);
return
result
;
}
private
void
buildYDataForJyTime
(
Map
<
String
,
Object
>
result
,
DPFilterParamDto
dpFilterParamDto
,
List
<
EquipmentCategoryDto
>
equipmentCategoryDtos
)
{
// 1.检验检测临期设备数数量统计
staticsCenterMapCountDataForJyTimeTemporary
(
result
,
dpFilterParamDto
,
equipmentCategoryDtos
);
// 2.检验检测超期设备数数量统计
staticsCenterMapCountDataForJyTimeOverdue
(
result
,
dpFilterParamDto
,
equipmentCategoryDtos
);
}
private
void
staticsCenterMapCountDataForJyTimeTemporary
(
Map
<
String
,
Object
>
result
,
DPFilterParamDto
dpFilterParamDto
,
List
<
EquipmentCategoryDto
>
equipmentCategoryDtos
)
{
SearchRequest
request
=
new
SearchRequest
();
request
.
indices
(
"idx_biz_view_jg_all"
);
BoolQueryBuilder
boolMust
=
QueryBuilders
.
boolQuery
();
// 且区域信息模糊查询
boolMust
.
must
(
QueryBuilders
.
wildcardQuery
(
"USE_PLACE_CODE"
,
"*"
+
dpFilterParamDto
.
getCityCode
()
+
"*"
));
// 且纳管状态为已纳管
boolMust
.
must
(
QueryBuilders
.
termQuery
(
"IS_INTO_MANAGEMENT"
,
true
));
// 且在用状态设备
boolMust
.
must
(
QueryBuilders
.
termQuery
(
"EQU_STATE"
,
EquimentEnum
.
ZAIYONG
.
getCode
()));
// 且下次检验日期大于等于当天
long
currentDayTime
=
DateUtil
.
parse
(
DateUtil
.
today
(),
"yyy-MM-dd"
).
getTime
();
boolMust
.
must
(
QueryBuilders
.
rangeQuery
(
"NEXT_INSPECT_DATE"
).
gte
(
currentDayTime
));
// 且查询 下次检验日期 <= 当前天+30天 极为临期
long
currentDayAfter30DayTime
=
DateUtil
.
offsetDay
(
DateUtil
.
parse
(
DateUtil
.
today
(),
"yyy-MM-dd"
),
30
).
getTime
();
boolMust
.
must
(
QueryBuilders
.
rangeQuery
(
"NEXT_INSPECT_DATE"
).
lte
(
currentDayAfter30DayTime
));
SearchSourceBuilder
builder
=
new
SearchSourceBuilder
();
builder
.
query
(
boolMust
);
TermsAggregationBuilder
aggregationBuilder
=
AggregationBuilders
.
terms
(
"count_by_equ_list_code"
).
field
(
"EQU_LIST_CODE"
);
builder
.
aggregation
(
aggregationBuilder
);
request
.
source
(
builder
);
try
{
SearchResponse
response
=
restHighLevelClient
.
search
(
request
,
RequestOptions
.
DEFAULT
);
Terms
terms
=
response
.
getAggregations
().
get
(
"count_by_equ_list_code"
);
Map
<
String
,
Long
>
countMap
=
new
HashMap
<>();
for
(
Terms
.
Bucket
bucket
:
terms
.
getBuckets
())
{
countMap
.
put
(
bucket
.
getKeyAsString
(),
bucket
.
getDocCount
());
}
// 按照8大类枚举,进行加工。目的:固定八大类防止没统计数据导致缺少分类、将设备种类的code换成前端定义的key
equipmentCategoryDtos
.
forEach
(
c
->
{
result
.
put
(
c
.
getName
(),
countMap
.
getOrDefault
(
c
.
getCode
(),
0L
));
});
}
catch
(
IOException
e
)
{
throw
new
RuntimeException
(
e
);
}
}
private
void
staticsCenterMapCountDataForJyTimeOverdue
(
Map
<
String
,
Object
>
result
,
DPFilterParamDto
dpFilterParamDto
,
List
<
EquipmentCategoryDto
>
equipmentCategoryDtos
)
{
SearchRequest
request
=
new
SearchRequest
();
request
.
indices
(
"idx_biz_view_jg_all"
);
BoolQueryBuilder
boolMust
=
QueryBuilders
.
boolQuery
();
// 区域信息模糊查询
boolMust
.
must
(
QueryBuilders
.
wildcardQuery
(
"USE_PLACE_CODE"
,
"*"
+
dpFilterParamDto
.
getCityCode
()
+
"*"
));
// 纳管状态为已纳管
boolMust
.
must
(
QueryBuilders
.
termQuery
(
"IS_INTO_MANAGEMENT"
,
true
));
// 在用状态设备
boolMust
.
must
(
QueryBuilders
.
termQuery
(
"EQU_STATE"
,
EquimentEnum
.
ZAIYONG
.
getCode
()));
// 查询下次检验日期小于当前天的设备,即为超期检验超期设备
long
currentDayTime
=
DateUtil
.
parse
(
DateUtil
.
now
(),
"yyy-MM-dd"
).
getTime
();
boolMust
.
must
(
QueryBuilders
.
rangeQuery
(
"NEXT_INSPECT_DATE"
).
lt
(
currentDayTime
));
SearchSourceBuilder
builder
=
new
SearchSourceBuilder
();
builder
.
query
(
boolMust
);
TermsAggregationBuilder
aggregationBuilder
=
AggregationBuilders
.
terms
(
"count_by_equ_list_code"
).
field
(
"EQU_LIST_CODE"
);
builder
.
aggregation
(
aggregationBuilder
);
request
.
source
(
builder
);
try
{
SearchResponse
response
=
restHighLevelClient
.
search
(
request
,
RequestOptions
.
DEFAULT
);
Terms
terms
=
response
.
getAggregations
().
get
(
"count_by_equ_list_code"
);
Map
<
String
,
Long
>
countMap
=
new
HashMap
<>();
for
(
Terms
.
Bucket
bucket
:
terms
.
getBuckets
())
{
countMap
.
put
(
bucket
.
getKeyAsString
(),
bucket
.
getDocCount
());
}
// 按照8大类枚举,进行加工。目的:固定八大类防止没统计数据导致缺少分类、将设备种类的code换成前端定义的key
equipmentCategoryDtos
.
forEach
(
c
->
{
result
.
put
(
c
.
getName
(),
countMap
.
getOrDefault
(
c
.
getCode
(),
0L
));
});
}
catch
(
IOException
e
)
{
throw
new
RuntimeException
(
e
);
}
}
private
Object
getLegendDataForJyTime
()
{
Map
<
String
,
Object
>
item1
=
new
LinkedHashMap
<>();
item1
.
put
(
"dataKey"
,
"approach"
);
item1
.
put
(
"value"
,
"临期"
);
Map
<
String
,
Object
>
item2
=
new
LinkedHashMap
<>();
item2
.
put
(
"dataKey"
,
"overdue"
);
item2
.
put
(
"value"
,
"超期"
);
return
Arrays
.
asList
(
item1
,
item2
);
}
}
amos-boot-system-tzs/amos-boot-module-jyjc/amos-boot-module-jyjc-biz/src/main/java/com/yeejoin/amos/boot/module/jyjc/biz/service/impl/DPSubServiceImpl.java
View file @
d829ee8a
...
...
@@ -77,7 +77,7 @@ public class DPSubServiceImpl {
if
(!
ValidationUtil
.
isEmpty
(
api
)){
ResponseModel
responseModel
=
this
.
getApiResult
((
JSONObject
)
api
,
!
ValidationUtil
.
isEmpty
(
resultConvert
)
?
resultConvert
.
toString
()
:
null
);
if
(!
ValidationUtil
.
isEmpty
(
responseModel
))
{
if
(!
ValidationUtil
.
isEmpty
(
responseModel
.
getResult
()
))
{
apiResult
=
JSONObject
.
parseObject
(
responseModel
.
getResult
().
toString
());
}
}
...
...
@@ -110,6 +110,8 @@ public class DPSubServiceImpl {
map
.
put
(
"columns"
,
JsonValueUtils
.
getValueByKey
(
yObj
,
"visualParams"
,
"visualParams.modelTableColumns"
));
map
.
put
(
"dataList"
,
apiResult
);
map
.
put
(
"showPage"
,
true
);
map
.
put
(
"api"
,
api
);
map
.
put
(
"rowKey"
,
"record"
);
content
.
put
(
tab
.
getString
(
"key"
),
map
);
}
}
...
...
@@ -268,6 +270,7 @@ public class DPSubServiceImpl {
JSONObject
qrcode
=
map
.
getJSONObject
(
"qrcode"
);
String
problemTime
=
apiResult
.
getString
(
"problemTime"
);
String
problemStatus
=
apiResult
.
getString
(
"problemStatus"
);
String
color
=
null
;
if
(!
ValidationUtil
.
isEmpty
(
problemTime
)){
try
{
qrcode
.
put
(
"text"
,
DateUtil
.
formatDate
(
DateUtil
.
smartFormat
(
problemTime
),
"yyyy-MM-dd"
));
...
...
@@ -277,15 +280,16 @@ public class DPSubServiceImpl {
}
}
if
(
"正常"
.
equals
(
problemStatus
)){
problemStatus
=
"green"
;
color
=
"green"
;
}
else
if
(
"异常"
.
equals
(
problemStatus
)){
problemStatus
=
"red"
;
color
=
"red"
;
}
qrcode
.
put
(
"value"
,
!
ValidationUtil
.
isEmpty
(
apiResult
.
get
(
"useCode"
))
?
apiResult
.
get
(
"useCode"
)
:
apiResult
.
get
(
"USE_ORG_CODE"
));
qrcode
.
put
(
"status"
,
problemStatus
);
qrcode
.
put
(
"color"
,
color
);
});
mergedArray
=
mergedArray
.
stream
().
filter
(
x
->
!
"QRCode"
.
equals
(
JsonValueUtils
.
getValueByKey
(
x
,
"
visualParams"
,
"visualParams.componentKey"
))).
collect
(
Collectors
.
toList
());
mergedArray
=
mergedArray
.
stream
().
filter
(
x
->
!
"QRCode"
.
equals
(
JsonValueUtils
.
getValueByKey
(
x
,
"
componentKey"
,
null
))).
collect
(
Collectors
.
toList
());
mergedArray
.
stream
().
forEach
(
x
->
{
JSONObject
xObj
=
(
JSONObject
)
x
;
JSONObject
visualParams
=
xObj
.
getJSONObject
(
"visualParams"
);
...
...
@@ -396,6 +400,7 @@ public class DPSubServiceImpl {
return
jsonObject
;
}).
collect
(
Collectors
.
toList
());
subObj
.
put
(
"rowKey"
,
"key"
);
subObj
.
put
(
"showPage"
,
false
);
subObj
.
put
(
"columns"
,
columns
);
subObj
.
put
(
"dataList"
,
apiResult
.
get
(
JsonValueUtils
.
getValueByKey
(
yObj
,
"visualParams"
,
"visualParams.fieldKey"
)));
...
...
amos-boot-system-tzs/amos-boot-module-jyjc/amos-boot-module-jyjc-biz/src/main/java/com/yeejoin/amos/boot/module/jyjc/biz/service/impl/JyjcInspectionApplicationServiceImpl.java
View file @
d829ee8a
...
...
@@ -1289,7 +1289,7 @@ public class JyjcInspectionApplicationServiceImpl extends BaseService<JyjcInspec
}
// 只有纳管的设备才能做业务 TODO
boolMust
.
must
(
QueryBuilders
.
existsQuery
(
"IS_INTO_MANAGEMENT"
));
boolMust
.
must
(
QueryBuilders
.
term
s
Query
(
"IS_INTO_MANAGEMENT"
,
true
));
boolMust
.
must
(
QueryBuilders
.
termQuery
(
"IS_INTO_MANAGEMENT"
,
true
));
}
private
Set
<
String
>
getEquipInFlowing
()
{
...
...
amos-boot-system-tzs/amos-boot-module-jyjc/amos-boot-module-jyjc-biz/src/main/resources/json/company.json
View file @
d829ee8a
...
...
@@ -28,7 +28,7 @@
"apiPath"
:
"/jg/equipment-register/page"
,
"params"
:
{
"number"
:
1
,
"size"
:
1
0
,
"size"
:
1
4
,
"USE_UNIT_CREDIT_CODE"
:
"{useUnitCode}"
}
}
...
...
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/statistics/ScreenImpl.java
View file @
d829ee8a
...
...
@@ -452,7 +452,7 @@ public class ScreenImpl implements IScreenService {
//设置模糊搜索
searchSourceBuilder
.
query
(
QueryBuilders
.
boolQuery
()
.
must
(
QueryBuilders
.
wildcardQuery
(
"USE_PLACE_CODE"
,
"*"
+
screenDto
.
getCityCode
()+
"*"
))
.
must
(
QueryBuilders
.
term
s
Query
(
"IS_INTO_MANAGEMENT"
,
true
)));
.
must
(
QueryBuilders
.
termQuery
(
"IS_INTO_MANAGEMENT"
,
true
)));
searchSourceBuilder
.
aggregation
(
AggregationBuilders
.
terms
(
"USE_SITE_CODE"
).
field
(
"USE_SITE_CODE"
)
);
...
...
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