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
1d096ab5
Commit
1d096ab5
authored
Jul 24, 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
1a863b7b
eaeed283
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
398 additions
and
24 deletions
+398
-24
AlertCalledMapper.xml
...96333-api/src/main/resources/mapper/AlertCalledMapper.xml
+3
-6
DPStatisticsServiceImpl.java
...le/elevator/biz/service/impl/DPStatisticsServiceImpl.java
+3
-0
IssueMainBodyEnum.java
.../amos/boot/module/common/api/enums/IssueMainBodyEnum.java
+0
-2
IssueTypeEnum.java
...join/amos/boot/module/common/api/enums/IssueTypeEnum.java
+16
-11
EquipQuestionNumCountDto.java
...oot/module/cylinder/api/dto/EquipQuestionNumCountDto.java
+31
-0
EquipmentClassifityEnum.java
...ot/module/cylinder/api/enums/EquipmentClassifityEnum.java
+9
-0
DPStatisticsMapper.java
...s/boot/module/cylinder/api/mapper/DPStatisticsMapper.java
+9
-1
DPStatisticsMapper.xml
...nder-api/src/main/resources/mapper/DPStatisticsMapper.xml
+88
-0
CylinderStatisticsController.java
...nder/flc/biz/controller/CylinderStatisticsController.java
+43
-0
CylinderAreaDataServiceImpl.java
...der/flc/biz/service/impl/CylinderAreaDataServiceImpl.java
+88
-4
DPStatisticsServiceImpl.java
...ylinder/flc/biz/service/impl/DPStatisticsServiceImpl.java
+108
-0
No files found.
amos-boot-system-tzs/amos-boot-module-96333/amos-boot-module-96333-api/src/main/resources/mapper/AlertCalledMapper.xml
View file @
1d096ab5
...
...
@@ -147,16 +147,13 @@
LEFT JOIN idx_biz_jg_use_info ibjuj ON tac.equipment_id = ibjuj.RECORD
LEFT JOIN cb_data_dictionary cdd ON ibjuj.USE_PLACE = cdd.sequence_nbr
WHERE
biz_org_code LIKE concat(#{regionCode}, '%')
tac.
biz_org_code LIKE concat(#{regionCode}, '%')
AND (tac.alarm_type_code = '960' or tac.alarm_type_code = '961')
AND
ibjuj.USE_PLACE is NOT NULL
AND cdd.NAME is NOT NULL
<if
test=
"dto.beginDate !=null and dto.beginDate !=''"
>
and date_ge(CAST(tac.call_time as date),#{dto.beginDate})
</if>
<if
test=
"dto.endDate !=null and dto.endDate !=''"
>
and date_le(CAST(tac.call_time as date),#{dto.endDate})
<if
test=
"dto.beginDate !=null and dto.beginDate !='' and dto.endDate !=null and dto.endDate !=''"
>
AND tac.call_time BETWEEN #{dto.beginDate} AND #{dto.endDate}
</if>
GROUP BY
cdd.NAME
...
...
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/DPStatisticsServiceImpl.java
View file @
1d096ab5
...
...
@@ -133,6 +133,9 @@ public class DPStatisticsServiceImpl {
public
JSONObject
eventStatByLocation
(
DPFilterParamDto
dpFilterParamDto
)
throws
Exception
{
String
orgCode
=
this
.
getAndSetOrgCode
(
dpFilterParamDto
);
dpFilterParamDto
.
setBeginDate
(
DateUtil
.
formatDate
(
DateTimeUtil
.
getMinValueOfOneDay
(
DateTimeUtil
.
addMonths
(
new
Date
(),
-
1
)),
DateUtil
.
Y_M_D_HMS
));
dpFilterParamDto
.
setEndDate
(
DateUtil
.
formatDate
(
DateTimeUtil
.
getMaxValueOfOneDay
(
new
Date
()),
DateUtil
.
Y_M_D_HMS
));
List
<
Map
<
String
,
Object
>>
maps
=
alertCalledMapper
.
queryListByLocation
(
orgCode
,
dpFilterParamDto
);
List
<
Object
>
xdata
=
maps
.
stream
().
map
(
item
->
item
.
get
(
"name"
)).
collect
(
Collectors
.
toList
());
List
<
Object
>
ydata
=
maps
.
stream
().
map
(
item
->
item
.
get
(
"majorAlertCount"
)).
collect
(
Collectors
.
toList
());
...
...
amos-boot-system-tzs/amos-boot-module-common/amos-boot-module-common-api/src/main/java/com/yeejoin/amos/boot/module/common/api/enums/IssueMainBodyEnum.java
View file @
1d096ab5
...
...
@@ -15,8 +15,6 @@ public enum IssueMainBodyEnum {
COMPANY
(
"企业"
,
"2"
),
//设备
EQUIPMENT
(
"设备"
,
"3"
),
//气瓶
CYLINDER
(
"气瓶"
,
"4"
),
;
...
...
amos-boot-system-tzs/amos-boot-module-common/amos-boot-module-common-api/src/main/java/com/yeejoin/amos/boot/module/common/api/enums/IssueTypeEnum.java
View file @
1d096ab5
...
...
@@ -10,13 +10,13 @@ import java.util.List;
@Getter
public
enum
IssueTypeEnum
{
//检验超期(设备)
CHECK_OVERDUE_EQUMENT
(
"检验超期"
,
"2"
,
"3"
),
CHECK_OVERDUE_EQUMENT
(
"检验超期"
,
"2"
,
"3
,4
"
),
//维保超期(设备)
MAINTENANCE_OVERDUE_EQUMENT
(
"维保超期"
,
"1"
,
"3"
),
//资质超期(设备)
QUALIFICATION_OVERDUE_EQUMENT
(
"资质超期"
,
"3"
,
"3"
),
//检验不合格(设备)
CHECK_UNQUALIFIED_EQUMENT
(
"检验不合格"
,
"4"
,
"3"
),
CHECK_UNQUALIFIED_EQUMENT
(
"检验不合格"
,
"4"
,
"3
,4
"
),
//超设计使用年限(设备)
DESIGN_OVERDUE_EQUMENT
(
"超设计使用年限"
,
"5"
,
"3"
),
//电梯困人(设备)
...
...
@@ -33,16 +33,12 @@ public enum IssueTypeEnum {
LICENSE_EXPIRY_PERSON
(
"许可临期"
,
"11"
,
"1"
),
//许可超期(个人)
LICENSE_OVERDUE_PERSON
(
"许可超期"
,
"12"
,
"1"
),
//许可超期(气瓶)
LICENSE_OVERDUE_CYLINDER
(
"许可超期"
,
"13"
,
"4"
),
//检验超期(气瓶)
CHECK_OVERDUE_CYLINDER
(
"检验超期"
,
"14"
,
"4"
),
//检验不合格(气瓶)
CHECK_UNQUALIFIED_CYLINDER
(
"检验不合格"
,
"15"
,
"4"
),
//操作人员资质超期(气瓶)
OPERATOR_QUALIFICATION_OVERDUE_CYLINDER
(
"操作人员资质超期"
,
"1
6"
,
"1
"
),
OPERATOR_QUALIFICATION_OVERDUE_CYLINDER
(
"操作人员资质超期"
,
"1
3"
,
"4
"
),
//充装异常(气瓶)
CHARGE_EXCEPTION_CYLINDER
(
"充装异常"
,
"17"
,
"4"
),
CHARGE_EXCEPTION_CYLINDER
(
"充装异常"
,
"14"
,
"4"
),
//许可超期(设备,气瓶)
LICENSE_OVERDUE
(
"许可超期"
,
"14"
,
"3,4"
),
...
...
@@ -68,10 +64,19 @@ public enum IssueTypeEnum {
return
list
;
}
public
static
String
getNameByCode
(
String
code
)
{
for
(
IssueTypeEnum
testEnum
:
EnumSet
.
allOf
(
IssueTypeEnum
.
class
))
{
if
(
testEnum
.
getCode
().
equals
(
code
)){
return
testEnum
.
getName
();
}
}
return
null
;
}
public
static
List
<
String
>
getEnumNameListByMainBody
(
String
mainBody
)
{
List
<
String
>
list
=
new
ArrayList
<>();
for
(
IssueTypeEnum
testEnum
:
EnumSet
.
allOf
(
IssueTypeEnum
.
class
))
{
if
(
mainBody
.
equals
(
testEnum
.
getMainBody
()
)){
if
(
testEnum
.
getMainBody
().
contains
(
mainBody
)){
list
.
add
(
testEnum
.
getName
());
}
}
...
...
amos-boot-system-tzs/amos-boot-module-cylinder/amos-boot-module-cylinder-api/src/main/java/com/yeejoin/amos/boot/module/cylinder/api/dto/EquipQuestionNumCountDto.java
0 → 100644
View file @
1d096ab5
package
com
.
yeejoin
.
amos
.
boot
.
module
.
cylinder
.
api
.
dto
;
import
lombok.Data
;
/**
* @author Administrator
*/
@Data
public
class
EquipQuestionNumCountDto
{
/**
* 设备id
*/
private
String
sourceId
;
private
String
useOrgCode
;
private
String
supervisoryCode
;
private
String
useUnitName
;
private
String
cityName
;
private
String
equList
;
private
Long
total
;
private
Long
finished
;
}
amos-boot-system-tzs/amos-boot-module-cylinder/amos-boot-module-cylinder-api/src/main/java/com/yeejoin/amos/boot/module/cylinder/api/enums/EquipmentClassifityEnum.java
View file @
1d096ab5
...
...
@@ -38,4 +38,13 @@ public enum EquipmentClassifityEnum {
}
}
public
static
String
getNameByCode
(
String
code
){
for
(
EquipmentClassifityEnum
value
:
EquipmentClassifityEnum
.
values
())
{
if
(
value
.
getCode
().
equals
(
code
)){
return
value
.
getName
();
}
}
return
""
;
}
}
amos-boot-system-tzs/amos-boot-module-cylinder/amos-boot-module-cylinder-api/src/main/java/com/yeejoin/amos/boot/module/cylinder/api/mapper/DPStatisticsMapper.java
View file @
1d096ab5
package
com
.
yeejoin
.
amos
.
boot
.
module
.
cylinder
.
api
.
mapper
;
import
com.yeejoin.amos.boot.module.common.api.dto.DPFilterParamDto
;
import
com.yeejoin.amos.boot.module.cylinder.api.dto.EquipQuestionNumCountDto
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
...
...
@@ -15,7 +17,7 @@ public interface DPStatisticsMapper {
@Param
(
"startDate"
)
String
startDate
,
@Param
(
"status"
)
String
status
);
List
<
Map
<
String
,
Object
>>
selectByOrgAndProblemType
(
@Param
(
"orgCode"
)
String
orgCode
,
@Param
(
"enumNameList"
)
List
<
String
>
enumNameList
,
@Param
(
"startDate"
)
String
startDate
,
@Param
(
"sourceType"
)
String
sourceType
);
@Param
(
"startDate"
)
String
startDate
,
@Param
(
"sourceType"
)
String
sourceType
,
@Param
(
"equipType"
)
String
equipType
);
List
<
Map
<
String
,
Object
>>
getIssueCountByMonth
(
@Param
(
"orgCode"
)
String
orgCode
,
@Param
(
"year"
)
String
year
,
@Param
(
"status"
)
String
status
);
List
<
Map
<
String
,
Object
>>
getIssueCountByDate
(
@Param
(
"orgCode"
)
String
orgCode
,
@Param
(
"year"
)
String
year
,
@Param
(
"status"
)
String
status
);
...
...
@@ -31,4 +33,10 @@ public interface DPStatisticsMapper {
List
<
Map
<
String
,
Object
>>
issueProblemLevelCount
(
@Param
(
"orgCode"
)
String
orgCode
,
@Param
(
"time"
)
String
time
);
List
<
Map
<
String
,
Object
>>
issueCompanyTop
(
@Param
(
"orgCode"
)
String
orgCode
,
@Param
(
"time"
)
String
time
);
List
<
Map
<
String
,
Object
>>
issueChildrenCityCountTop
(
@Param
(
"orgCodes"
)
List
<
String
>
orgCodes
,
@Param
(
"now"
)
String
now
,
@Param
(
"status"
)
String
status
);
List
<
Map
<
String
,
Object
>>
issueCountTopByProblemType
(
@Param
(
"orgCode"
)
String
orgCode
,
@Param
(
"status"
)
String
status
);
List
<
EquipQuestionNumCountDto
>
queryEquipQuestionList
(
@Param
(
"orgCode"
)
String
orgCode
,
@Param
(
"dto"
)
DPFilterParamDto
dpFilterParamDto
);
}
amos-boot-system-tzs/amos-boot-module-cylinder/amos-boot-module-cylinder-api/src/main/resources/mapper/DPStatisticsMapper.xml
View file @
1d096ab5
...
...
@@ -35,6 +35,9 @@
governing_body_org_code LIKE concat ( #{orgCode}, '%' )
AND problem_time
>
= #{startDate}
AND source_type = #{sourceType}
<if
test=
"null != equipType"
>
AND equip_list_code = #{equipType}
</if>
AND problem_type IN
<foreach
collection=
"enumNameList"
item=
"item"
separator=
","
open=
"("
close=
")"
>
#{item}
...
...
@@ -149,6 +152,91 @@
COUNT DESC
LIMIT 10
</select>
<select
id=
"issueChildrenCityCountTop"
resultType=
"java.util.Map"
>
SELECT COUNT
( 1 ),
governing_body_org_code AS orgCode
FROM
tzs_safety_problem_tracing
WHERE
DATE_FORMAT(problem_time,'%Y')
>
= #{now}
AND
<foreach
collection=
"orgCodes"
item=
"orgCode"
separator=
"OR"
open=
"("
close=
")"
>
governing_body_org_code LIKE concat ( #{orgCode}, '%' )
</foreach>
<if
test=
"null != status"
>
AND problem_status_code = #{status}
</if>
GROUP BY
governing_body_org_code
</select>
<select
id=
"issueCountTopByProblemType"
resultType=
"java.util.Map"
>
SELECT COUNT
( 1 ),
problem_type_code AS problemTypeCode
FROM
tzs_safety_problem_tracing
WHERE
governing_body_org_code LIKE concat ( #{orgCode}, '%' )
<if
test=
"null != status"
>
AND problem_status_code = #{status}
</if>
GROUP BY
problem_type_code
ORDER BY
COUNT DESC
LIMIT 10
</select>
<select
id=
"queryEquipQuestionList"
resultType=
"com.yeejoin.amos.boot.module.cylinder.api.dto.EquipQuestionNumCountDto"
>
select
bb."USE_ORG_CODE",
cc."SUPERVISORY_CODE",
dd."USE_UNIT_NAME",
aa.finished,
aa.source_id,
aa.total,
dd."CITY_NAME",
bb."EQU_LIST"
from
(
select
a.total,
a.source_id,
ifnull(b.total,0) as finished
from
(
SELECT
count(1) as total,
source_id
FROM
"tzs_safety_problem_tracing"
WHERE
source_type_code = '3'
and governing_body_org_code like concat(#{orgCode}, '%')
and cast(problem_time AS DATE) between #{dto.beginDate} and #{dto.endDate}
GROUP BY source_id ORDER BY total desc) a
left join (
SELECT
count(1) as total,
source_id
FROM
"tzs_safety_problem_tracing"
WHERE
source_type_code = '3'
and problem_status_code ='1'
and governing_body_org_code like concat(#{orgCode}, '%')
and cast(problem_time AS DATE) between #{dto.beginDate} and #{dto.endDate}
GROUP BY source_id ORDER BY total desc) b on a.source_id = b.source_id
) aa,
idx_biz_jg_register_info bb,
idx_biz_jg_other_info cc,
idx_biz_jg_use_info dd
where
aa.source_id=bb."RECORD"
and aa.source_id=cc."RECORD"
and aa.source_id=dd."RECORD"
order by aa.total desc
</select>
</mapper>
amos-boot-system-tzs/amos-boot-module-cylinder/amos-boot-module-cylinder-biz/src/main/java/com/yeejoin/amos/boot/module/cylinder/flc/biz/controller/CylinderStatisticsController.java
View file @
1d096ab5
...
...
@@ -4,15 +4,21 @@ package com.yeejoin.amos.boot.module.cylinder.flc.biz.controller;
import
com.baomidou.dynamic.datasource.annotation.DS
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.amos.boot.module.common.api.dto.DPFilterParamDto
;
import
com.yeejoin.amos.boot.module.cylinder.api.dto.CylinderFillingMessageModel
;
import
com.yeejoin.amos.boot.module.cylinder.flc.biz.service.impl.CylinderAreaDataServiceImpl
;
import
com.yeejoin.amos.boot.module.cylinder.flc.biz.service.impl.DPStatisticsServiceImpl
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.validation.BindingResult
;
import
org.springframework.validation.FieldError
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.*
;
import
org.typroject.tyboot.core.foundation.enumeration.UserType
;
import
org.typroject.tyboot.core.restful.doc.TycloudOperation
;
import
org.typroject.tyboot.core.restful.exception.instance.BadRequest
;
import
org.typroject.tyboot.core.restful.utils.ResponseHelper
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
...
...
@@ -26,6 +32,8 @@ public class CylinderStatisticsController {
@Autowired
private
CylinderAreaDataServiceImpl
service
;
@Autowired
private
DPStatisticsServiceImpl
statisticsService
;
/**
* 预警预报统计
...
...
@@ -217,5 +225,40 @@ public class CylinderStatisticsController {
}
List
<
Map
<
String
,
Object
>>
result
=
service
.
issueCompanyTop
(
regionCode
.
toString
());
return
ResponseHelper
.
buildResponse
(
result
);
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"大屏-安全追溯-同设备近30天按问题次数滚动"
,
notes
=
"大屏-安全追溯-同设备近30天按问题次数滚动"
)
@PostMapping
(
value
=
"/aqzs/equip-question/list"
)
public
ResponseModel
<
List
<
Map
<
String
,
Object
>>>
getEquipQuestionList
(
@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
.
getEquipQuestionList
(
dpFilterParamDto
));
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
value
=
"当年下级区域问题闭环率排名"
)
@PostMapping
(
value
=
"/issueChildrenCityCountTop"
)
public
ResponseModel
<
List
<
Map
<
String
,
Object
>>>
issueChildrenCityCountTop
(
@RequestBody
Map
<
String
,
Object
>
map
)
throws
Exception
{
Object
regionCode
=
map
.
get
(
"cityCode"
);
if
(
ObjectUtils
.
isEmpty
(
regionCode
))
{
regionCode
=
"610000"
;
}
List
<
Map
<
String
,
Object
>>
result
=
service
.
issueChildrenCityCountTop
(
regionCode
.
toString
());
return
ResponseHelper
.
buildResponse
(
result
);
};
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@ApiOperation
(
value
=
"按问题类型排名top 10"
)
@PostMapping
(
value
=
"/issueCountTopByProblemType"
)
public
ResponseModel
<
List
<
Map
<
String
,
Object
>>>
issueCountTopByProblemType
(
@RequestBody
Map
<
String
,
Object
>
map
)
throws
Exception
{
Object
regionCode
=
map
.
get
(
"cityCode"
);
if
(
ObjectUtils
.
isEmpty
(
regionCode
))
{
regionCode
=
"610000"
;
}
List
<
Map
<
String
,
Object
>>
result
=
service
.
issueCountTopByProblemType
(
regionCode
.
toString
());
return
ResponseHelper
.
buildResponse
(
result
);
};
}
amos-boot-system-tzs/amos-boot-module-cylinder/amos-boot-module-cylinder-biz/src/main/java/com/yeejoin/amos/boot/module/cylinder/flc/biz/service/impl/CylinderAreaDataServiceImpl.java
View file @
1d096ab5
...
...
@@ -872,7 +872,7 @@ public class CylinderAreaDataServiceImpl extends BaseService<CylinderAreaDataDto
String
orgCode
=
getAndSetOrgCode
(
cityCode
);
List
<
String
>
enumNameList
=
IssueTypeEnum
.
getEnumNameListByMainBody
(
"3"
);
String
startDate
=
LocalDate
.
now
().
minusDays
(
29
).
format
(
DateTimeFormatter
.
ofPattern
(
"yyyy-MM-dd"
));
List
<
Map
<
String
,
Object
>>
list
=
statisticsMapper
.
selectByOrgAndProblemType
(
orgCode
,
enumNameList
,
startDate
,
IssueMainBodyEnum
.
EQUIPMENT
.
getName
());
List
<
Map
<
String
,
Object
>>
list
=
statisticsMapper
.
selectByOrgAndProblemType
(
orgCode
,
enumNameList
,
startDate
,
IssueMainBodyEnum
.
EQUIPMENT
.
getName
()
,
null
);
list
.
stream
().
forEach
(
t
->{
dataMap
.
put
(
t
.
get
(
"problemType"
).
toString
(),
t
.
get
(
"count"
).
toString
());
});
...
...
@@ -891,7 +891,7 @@ public class CylinderAreaDataServiceImpl extends BaseService<CylinderAreaDataDto
String
orgCode
=
getAndSetOrgCode
(
cityCode
);
List
<
String
>
enumNameList
=
IssueTypeEnum
.
getEnumNameListByMainBody
(
"2"
);
String
startDate
=
LocalDate
.
now
().
minusDays
(
29
).
format
(
DateTimeFormatter
.
ofPattern
(
"yyyy-MM-dd"
));
List
<
Map
<
String
,
Object
>>
list
=
statisticsMapper
.
selectByOrgAndProblemType
(
orgCode
,
enumNameList
,
startDate
,
IssueMainBodyEnum
.
COMPANY
.
getName
());
List
<
Map
<
String
,
Object
>>
list
=
statisticsMapper
.
selectByOrgAndProblemType
(
orgCode
,
enumNameList
,
startDate
,
IssueMainBodyEnum
.
COMPANY
.
getName
()
,
null
);
list
.
stream
().
forEach
(
t
->{
dataMap
.
put
(
t
.
get
(
"problemType"
).
toString
(),
t
.
get
(
"count"
).
toString
());
});
...
...
@@ -923,7 +923,7 @@ public class CylinderAreaDataServiceImpl extends BaseService<CylinderAreaDataDto
String
orgCode
=
getAndSetOrgCode
(
cityCode
);
List
<
String
>
enumNameList
=
IssueTypeEnum
.
getEnumNameListByMainBody
(
"1"
);
String
startDate
=
LocalDate
.
now
().
minusDays
(
29
).
format
(
DateTimeFormatter
.
ofPattern
(
"yyyy-MM-dd"
));
List
<
Map
<
String
,
Object
>>
list
=
statisticsMapper
.
selectByOrgAndProblemType
(
orgCode
,
enumNameList
,
startDate
,
IssueMainBodyEnum
.
PERSON
.
getName
());
List
<
Map
<
String
,
Object
>>
list
=
statisticsMapper
.
selectByOrgAndProblemType
(
orgCode
,
enumNameList
,
startDate
,
IssueMainBodyEnum
.
PERSON
.
getName
()
,
null
);
list
.
stream
().
forEach
(
t
->{
dataMap
.
put
(
t
.
get
(
"problemType"
).
toString
(),
t
.
get
(
"count"
).
toString
());
});
...
...
@@ -944,7 +944,7 @@ public class CylinderAreaDataServiceImpl extends BaseService<CylinderAreaDataDto
String
orgCode
=
getAndSetOrgCode
(
cityCode
);
List
<
String
>
enumNameList
=
IssueTypeEnum
.
getEnumNameListByMainBody
(
"4"
);
String
startDate
=
LocalDate
.
now
().
minusDays
(
29
).
format
(
DateTimeFormatter
.
ofPattern
(
"yyyy-MM-dd"
));
List
<
Map
<
String
,
Object
>>
list
=
statisticsMapper
.
selectByOrgAndProblemType
(
orgCode
,
enumNameList
,
startDate
,
IssueMainBodyEnum
.
CYLINDER
.
getName
()
);
List
<
Map
<
String
,
Object
>>
list
=
statisticsMapper
.
selectByOrgAndProblemType
(
orgCode
,
enumNameList
,
startDate
,
IssueMainBodyEnum
.
EQUIPMENT
.
getName
(),
"2300"
);
list
.
stream
().
forEach
(
t
->{
dataMap
.
put
(
t
.
get
(
"problemType"
).
toString
(),
t
.
get
(
"count"
).
toString
());
});
...
...
@@ -1151,4 +1151,87 @@ public class CylinderAreaDataServiceImpl extends BaseService<CylinderAreaDataDto
}
return
resultList
;
}
public
List
<
Map
<
String
,
Object
>>
issueChildrenCityCountTop
(
String
cityCode
)
throws
Exception
{
List
<
RegionModel
>
regionModels
=
setRegionIfRootParent
(
cityCode
);
List
<
Integer
>
regionCodeList
=
regionModels
.
stream
().
map
(
m
->
m
.
getRegionCode
()).
collect
(
Collectors
.
toList
());
List
<
Map
<
String
,
String
>>
orgCodeAndCompanyCodesByCompanyCodes
=
statisticsMapper
.
getOrgCodeAndCompanyCodesByCompanyCodes
(
regionCodeList
);
List
<
String
>
orgCodes
=
orgCodeAndCompanyCodesByCompanyCodes
.
stream
().
map
(
m
->
m
.
get
(
"orgCode"
)).
collect
(
Collectors
.
toList
());
String
now
=
LocalDate
.
now
().
format
(
DateTimeFormatter
.
ofPattern
(
"yyyy"
));
Map
<
String
,
String
>
orgCodeAndCompanyCodesMap
=
new
HashMap
<>();
orgCodeAndCompanyCodesByCompanyCodes
.
stream
().
forEach
(
t
->{
orgCodeAndCompanyCodesMap
.
put
(
t
.
get
(
"companyCode"
),
t
.
get
(
"orgCode"
));
});
List
<
Map
<
String
,
Object
>>
allIssueCount
=
statisticsMapper
.
issueChildrenCityCountTop
(
orgCodes
,
now
,
null
);
List
<
Map
<
String
,
Object
>>
endIssueCount
=
statisticsMapper
.
issueChildrenCityCountTop
(
orgCodes
,
now
,
"1"
);
Map
<
String
,
Object
>
allIssuedataMap
=
new
HashMap
<>();
Map
<
String
,
Object
>
endIssuedataMap
=
new
HashMap
<>();
allIssueCount
.
stream
().
forEach
(
t
->{
allIssuedataMap
.
put
(
t
.
get
(
"orgCode"
).
toString
(),
t
.
get
(
"count"
));
});
endIssueCount
.
stream
().
forEach
(
t
->{
endIssuedataMap
.
put
(
t
.
get
(
"orgCode"
).
toString
(),
t
.
get
(
"count"
));
});
List
<
Map
<
String
,
Object
>>
resultList
=
new
ArrayList
<>();
for
(
RegionModel
regionModel
:
regionModels
){
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
AtomicInteger
allCount
=
new
AtomicInteger
();
AtomicInteger
endCount
=
new
AtomicInteger
();
map
.
put
(
"region"
,
regionModel
.
getRegionName
());
if
(
StringUtils
.
isNotBlank
(
orgCodeAndCompanyCodesMap
.
get
(
regionModel
.
getRegionCode
()+
""
))){
allIssuedataMap
.
forEach
((
k
,
v
)->{
if
(
k
.
startsWith
(
orgCodeAndCompanyCodesMap
.
get
(
regionModel
.
getRegionCode
()+
""
))){
if
(
null
!=
v
){
allCount
.
addAndGet
(
Integer
.
valueOf
(
v
+
""
));
}
}
});
}
if
(
StringUtils
.
isNotBlank
(
orgCodeAndCompanyCodesMap
.
get
(
regionModel
.
getRegionCode
()+
""
))){
endIssuedataMap
.
forEach
((
k
,
v
)->{
if
(
k
.
startsWith
(
orgCodeAndCompanyCodesMap
.
get
(
regionModel
.
getRegionCode
()+
""
))){
if
(
null
!=
v
){
endCount
.
addAndGet
(
Integer
.
valueOf
(
v
+
""
));
}
}
});
}
if
(
allCount
.
get
()
!=
0
)
{
map
.
put
(
"rate"
,
new
DecimalFormat
(
"0.00"
).
format
(
Double
.
parseDouble
(
endCount
+
""
)
/
(
Double
.
parseDouble
(
allCount
.
get
()+
""
))));
}
else
{
map
.
put
(
"rate"
,
"0.00"
);
}
resultList
.
add
(
map
);
}
resultList
.
sort
(
Comparator
.
comparing
(
m
->
Double
.
valueOf
(
m
.
get
(
"rate"
)+
""
),
Comparator
.
reverseOrder
()));
for
(
int
i
=
0
;
i
<
resultList
.
size
();
i
++){
resultList
.
get
(
i
).
put
(
"sequenceNbr"
,(
i
+
1
)+
""
);
}
return
resultList
;
}
public
List
<
Map
<
String
,
Object
>>
issueCountTopByProblemType
(
String
cityCode
)
{
String
orgCode
=
getAndSetOrgCode
(
cityCode
);
List
<
Map
<
String
,
Object
>>
allList
=
statisticsMapper
.
issueCountTopByProblemType
(
orgCode
,
null
);
List
<
Map
<
String
,
Object
>>
endList
=
statisticsMapper
.
issueCountTopByProblemType
(
orgCode
,
"1"
);
Map
<
String
,
Object
>
endIssuedataMap
=
new
HashMap
<>();
endList
.
stream
().
forEach
(
t
->{
endIssuedataMap
.
put
(
t
.
get
(
"problemTypeCode"
).
toString
(),
t
.
get
(
"count"
));
});
List
<
Map
<
String
,
Object
>>
resultList
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
allList
.
size
();
i
++){
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"name"
,
IssueTypeEnum
.
getNameByCode
(
allList
.
get
(
i
).
get
(
"problemTypeCode"
).
toString
()));
map
.
put
(
"count"
,
allList
.
get
(
i
).
get
(
"count"
));
if
(
null
!=
endIssuedataMap
.
get
(
allList
.
get
(
i
).
get
(
"problemTypeCode"
).
toString
())){
map
.
put
(
"rate"
,
new
DecimalFormat
(
"0.00"
).
format
(
Double
.
parseDouble
(
endIssuedataMap
.
get
(
allList
.
get
(
i
).
get
(
"problemTypeCode"
).
toString
())+
""
)
/
(
Double
.
parseDouble
(
allList
.
get
(
i
).
get
(
"count"
)+
""
))));
}
resultList
.
add
(
map
);
}
return
resultList
;
}
}
\ No newline at end of file
amos-boot-system-tzs/amos-boot-module-cylinder/amos-boot-module-cylinder-biz/src/main/java/com/yeejoin/amos/boot/module/cylinder/flc/biz/service/impl/DPStatisticsServiceImpl.java
0 → 100644
View file @
1d096ab5
package
com
.
yeejoin
.
amos
.
boot
.
module
.
cylinder
.
flc
.
biz
.
service
.
impl
;
import
cn.hutool.core.date.DateUtil
;
import
com.yeejoin.amos.boot.module.common.api.dto.DPFilterParamDto
;
import
com.yeejoin.amos.boot.module.cylinder.api.dto.EquipQuestionNumCountDto
;
import
com.yeejoin.amos.boot.module.cylinder.api.enums.EquipmentClassifityEnum
;
import
com.yeejoin.amos.boot.module.cylinder.api.mapper.DPStatisticsMapper
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.stereotype.Service
;
import
java.math.BigDecimal
;
import
java.math.RoundingMode
;
import
java.text.NumberFormat
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.concurrent.ConcurrentHashMap
;
import
java.util.stream.Collectors
;
@Service
public
class
DPStatisticsServiceImpl
{
private
static
Map
<
String
,
String
>
regionCodeOrgCodeMap
=
new
ConcurrentHashMap
<>();
private
DPStatisticsMapper
statisticsMapper
;
public
DPStatisticsServiceImpl
(
DPStatisticsMapper
statisticsMapper
)
{
this
.
statisticsMapper
=
statisticsMapper
;
}
public
List
<
Map
<
String
,
Object
>>
getEquipQuestionList
(
DPFilterParamDto
dpFilterParamDto
)
{
this
.
setDefaultFilter
(
dpFilterParamDto
);
String
orgCode
=
this
.
getAndSetOrgCode
(
dpFilterParamDto
.
getCityCode
());
if
(
StringUtils
.
isEmpty
(
orgCode
)){
return
new
ArrayList
<>();
}
List
<
EquipQuestionNumCountDto
>
equipQuestionNumCountDtos
=
statisticsMapper
.
queryEquipQuestionList
(
orgCode
,
dpFilterParamDto
);
return
this
.
calPercentFinishedAndCast2Map
(
equipQuestionNumCountDtos
);
}
private
List
<
Map
<
String
,
Object
>>
calPercentFinishedAndCast2Map
(
List
<
EquipQuestionNumCountDto
>
equipQuestionNumCountDtos
)
{
return
equipQuestionNumCountDtos
.
stream
().
map
(
e
->
{
Map
<
String
,
Object
>
item
=
new
HashMap
<>();
// 设备id
item
.
put
(
"key"
,
e
.
getSourceId
());
// 区域名称
item
.
put
(
"regionName"
,
e
.
getCityName
());
// 设备种类
item
.
put
(
"deviceCategoryName"
,
EquipmentClassifityEnum
.
getNameByCode
(
e
.
getEquList
()));
// 监管码/使用登记证编号
item
.
put
(
"code"
,
this
.
buildCodeWithSplit
(
e
.
getSupervisoryCode
(),
e
.
getUseOrgCode
()));
// 使用单位
item
.
put
(
"useUnitName"
,
e
.
getUseUnitName
());
// 问题次数
item
.
put
(
"issuesNumber"
,
e
.
getTotal
());
// 闭环率
item
.
put
(
"closedLoopRate"
,
this
.
calClosedLoopRate
(
e
.
getTotal
(),
e
.
getFinished
()));
return
item
;
}).
collect
(
Collectors
.
toList
());
}
private
String
calClosedLoopRate
(
Long
total
,
Long
finished
)
{
if
(
total
==
0
)
{
return
"0"
;
}
BigDecimal
totalBig
=
new
BigDecimal
(
total
.
toString
());
BigDecimal
finishedBig
=
new
BigDecimal
(
finished
.
toString
());
BigDecimal
result
=
finishedBig
.
divide
(
totalBig
,
2
,
RoundingMode
.
HALF_UP
);
NumberFormat
nt
=
NumberFormat
.
getPercentInstance
();
nt
.
setMinimumFractionDigits
(
0
);
return
nt
.
format
(
result
);
}
private
String
buildCodeWithSplit
(
String
supervisoryCode
,
String
useOrgCode
)
{
if
(
StringUtils
.
isNotEmpty
(
supervisoryCode
)
&&
StringUtils
.
isNotEmpty
(
useOrgCode
))
{
return
String
.
format
(
"%s/%s"
,
supervisoryCode
,
useOrgCode
);
}
if
(
StringUtils
.
isNotEmpty
(
supervisoryCode
))
{
return
supervisoryCode
;
}
if
(
StringUtils
.
isNotEmpty
(
useOrgCode
))
{
return
useOrgCode
;
}
return
""
;
}
private
void
setDefaultFilter
(
DPFilterParamDto
dpFilterParamDto
)
{
if
(
StringUtils
.
isEmpty
(
dpFilterParamDto
.
getBeginDate
()))
{
dpFilterParamDto
.
setBeginDate
(
DateUtil
.
lastMonth
().
toDateStr
());
}
if
(
StringUtils
.
isEmpty
(
dpFilterParamDto
.
getEndDate
()))
{
dpFilterParamDto
.
setEndDate
(
DateUtil
.
today
());
}
}
private
String
getAndSetOrgCode
(
String
region
)
{
String
orgCode
=
regionCodeOrgCodeMap
.
get
(
region
);
if
(
orgCode
==
null
)
{
orgCode
=
statisticsMapper
.
getOrgCodeByCompanyCode
(
region
);
if
(
orgCode
!=
null
)
{
regionCodeOrgCodeMap
.
put
(
region
,
orgCode
);
}
}
return
orgCode
;
}
}
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