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
58e808c7
Commit
58e808c7
authored
Jun 05, 2024
by
suhuiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.气瓶许可有效期统计修改
parent
2a3908dc
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
128 additions
and
36 deletions
+128
-36
KeyValueDto.java
...eejoin/amos/boot/module/cylinder/api/dto/KeyValueDto.java
+16
-0
CylinderAreaDataMapper.java
...odule/cylinder/flc/api/mapper/CylinderAreaDataMapper.java
+23
-4
CylinderAreaDataMapper.xml
...-api/src/main/resources/mapper/CylinderAreaDataMapper.xml
+27
-12
CylinderAreaDataServiceImpl.java
...der/flc/biz/service/impl/CylinderAreaDataServiceImpl.java
+62
-20
No files found.
amos-boot-system-tzs/amos-boot-module-cylinder/amos-boot-module-cylinder-api/src/main/java/com/yeejoin/amos/boot/module/cylinder/api/dto/KeyValueDto.java
0 → 100644
View file @
58e808c7
package
com
.
yeejoin
.
amos
.
boot
.
module
.
cylinder
.
api
.
dto
;
import
lombok.Data
;
/**
* @author Administrator
*/
@Data
public
class
KeyValueDto
{
private
String
strKey
;
private
Integer
iValue
;
private
String
strValue
;
}
amos-boot-system-tzs/amos-boot-module-cylinder/amos-boot-module-cylinder-api/src/main/java/com/yeejoin/amos/boot/module/cylinder/flc/api/mapper/CylinderAreaDataMapper.java
View file @
58e808c7
package
com
.
yeejoin
.
amos
.
boot
.
module
.
cylinder
.
flc
.
api
.
mapper
;
import
com.yeejoin.amos.boot.module.cylinder.flc.api.entity.CylinderAreaData
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.yeejoin.amos.boot.module.cylinder.api.dto.KeyValueDto
;
import
com.yeejoin.amos.boot.module.cylinder.flc.api.entity.CylinderAreaData
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
import
java.util.Map
;
/**
...
...
@@ -14,9 +16,26 @@ import java.util.Map;
*/
public
interface
CylinderAreaDataMapper
extends
BaseMapper
<
CylinderAreaData
>
{
Map
<
String
,
Object
>
getLicenseEfficiency
(
@Param
(
value
=
"regionCode"
)
String
regionCode
,
@Param
(
value
=
"appId"
)
String
appId
);
Map
<
String
,
Object
>
getInspectionExpiredRate
(
@Param
(
value
=
"regionCode"
)
String
regionCode
,
@Param
(
value
=
"appId"
)
String
appId
);
Map
<
String
,
Object
>
getInspectionExpiredRate
(
@Param
(
value
=
"regionCode"
)
String
regionCode
,
@Param
(
value
=
"appId"
)
String
appId
);
Map
<
String
,
Object
>
getInspectionResultRate
(
@Param
(
value
=
"regionCode"
)
String
regionCode
,
@Param
(
value
=
"appId"
)
String
appId
);
/**
* 查询单个单位的有效期信息
*
* @param appId 公司唯一标识
* @return KeyValueDto
*/
KeyValueDto
queryLicenseEfficiencyOneCompany
(
@Param
(
value
=
"appId"
)
String
appId
);
/**
* 单位按照资质状态分组下的统计数量
*
* @param regionCode 区域
* @return List<KeyValueDto>
*/
List
<
KeyValueDto
>
queryLicenseEfficiencyOfRegion
(
@Param
(
value
=
"regionCode"
)
String
regionCode
);
Map
<
String
,
Object
>
getInspectionResultRate
(
@Param
(
value
=
"regionCode"
)
String
regionCode
,
@Param
(
value
=
"appId"
)
String
appId
);
}
amos-boot-system-tzs/amos-boot-module-cylinder/amos-boot-module-cylinder-api/src/main/resources/mapper/CylinderAreaDataMapper.xml
View file @
58e808c7
...
...
@@ -2,21 +2,36 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.yeejoin.amos.boot.module.cylinder.flc.api.mapper.CylinderAreaDataMapper"
>
<select
id=
"
getLicenseEfficiency"
resultType=
"java.util.Map
"
>
<select
id=
"
queryLicenseEfficiencyOneCompany"
resultType=
"com.yeejoin.amos.boot.module.cylinder.api.dto.KeyValueDto
"
>
SELECT
CASE WHEN COUNT ( CASE WHEN ul.expiry_date >= now( ) THEN 1 END ) = 1 THEN '正常' ELSE '已超期' END AS licenseOk,
CASE WHEN COUNT(*) = 0 THEN 0 ELSE ROUND( ( COUNT ( CASE WHEN ul.expiry_date >= now( ) THEN 1 END ) * 100.0 / COUNT ( * ) ), 2 ) END AS licenseRate
cu.sequence_nbr as strKey,
(select
case
when min(ul.expiry_date) >= now()
THEN '正常'
when min(ul.expiry_date) is null then '--'
ELSE '已超期'
END AS licenseOk from tz_base_unit_licence ul where cu.credit_code = ul.unit_code) as strValue
FROM
tz_cylinder_unit cu
LEFT JOIN tz_base_unit_licence ul ON cu.credit_code = ul.unit_code
<where>
<if
test=
"regionCode != null and regionCode != ''"
>
cu.region_code like concat('%', #{regionCode}, '%')
</if>
<if
test=
"appId != null and appId != ''"
>
cu.app_id = #{appId}
</if>
</where>
where
cu.app_id = #{appId}
</select>
<select
id=
"queryLicenseEfficiencyOfRegion"
resultType=
"com.yeejoin.amos.boot.module.cylinder.api.dto.KeyValueDto"
>
SELECT
count(1) as iValue,
(select
case
when min(ul.expiry_date) >= now()
THEN '正常'
when min(ul.expiry_date) is null then '未提供'
ELSE '已超期'
END AS licenseOk from tz_base_unit_licence ul where cu.credit_code = ul.unit_code) as strKey
FROM
tz_cylinder_unit cu
where
cu.region_code like concat('%', #{regionCode}, '%')
GROUP BY strKey
</select>
<select
id=
"getInspectionExpiredRate"
resultType=
"java.util.Map"
>
...
...
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 @
58e808c7
package
com
.
yeejoin
.
amos
.
boot
.
module
.
cylinder
.
flc
.
biz
.
service
.
impl
;
import
com.
yeejoin.amos.boot.module.cylinder.flc.api.dto.CityCylinderInfoDto
;
import
com.
baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Maps
;
import
com.yeejoin.amos.boot.module.cylinder.api.entity.ESCylinderFillingRecordDto
;
import
com.yeejoin.amos.boot.module.cylinder.api.dto.KeyValueDto
;
import
com.yeejoin.amos.boot.module.cylinder.flc.api.dto.CityCylinderInfoDto
;
import
com.yeejoin.amos.boot.module.cylinder.flc.api.dto.CylinderAreaDataDto
;
import
com.yeejoin.amos.boot.module.cylinder.flc.api.entity.CylinderAreaData
;
import
com.yeejoin.amos.boot.module.cylinder.flc.api.mapper.CylinderAreaDataMapper
;
import
com.yeejoin.amos.boot.module.cylinder.flc.api.service.ICylinderAreaDataService
;
import
com.yeejoin.amos.boot.module.cylinder.flc.api.dto.CylinderAreaDataDto
;
import
org.elasticsearch.client.RequestOptions
;
import
org.elasticsearch.client.RestHighLevelClient
;
import
org.elasticsearch.client.core.CountRequest
;
...
...
@@ -15,12 +16,14 @@ import org.elasticsearch.client.core.CountResponse;
import
org.elasticsearch.index.query.BoolQueryBuilder
;
import
org.elasticsearch.index.query.QueryBuilders
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.ObjectUtils
;
import
org.typroject.tyboot.core.foundation.utils.ValidationUtil
;
import
org.typroject.tyboot.core.rdbms.service.BaseService
;
import
org.springframework.stereotype.Service
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
java.io.IOException
;
import
java.math.BigDecimal
;
import
java.math.RoundingMode
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
...
...
@@ -32,10 +35,11 @@ import java.util.stream.Collectors;
* @date 2022-03-08
*/
@Service
public
class
CylinderAreaDataServiceImpl
extends
BaseService
<
CylinderAreaDataDto
,
CylinderAreaData
,
CylinderAreaDataMapper
>
implements
ICylinderAreaDataService
{
public
class
CylinderAreaDataServiceImpl
extends
BaseService
<
CylinderAreaDataDto
,
CylinderAreaData
,
CylinderAreaDataMapper
>
implements
ICylinderAreaDataService
{
@Autowired
private
CylinderAreaDataMapper
mapper
;
public
final
static
String
LICENSE_IS_OK
=
"正常"
;
public
final
static
String
NO_DATA_STR
=
"--"
;
@Autowired
RestHighLevelClient
restHighLevelClient
;
...
...
@@ -43,15 +47,15 @@ public class CylinderAreaDataServiceImpl extends BaseService<CylinderAreaDataDto
/**
* 分页查询
*/
public
Page
<
CylinderAreaDataDto
>
queryForCylinderAreaDataPage
(
Page
<
CylinderAreaDataDto
>
page
)
{
public
Page
<
CylinderAreaDataDto
>
queryForCylinderAreaDataPage
(
Page
<
CylinderAreaDataDto
>
page
)
{
return
this
.
queryForPage
(
page
,
null
,
false
);
}
/**
* 列表查询 示例
*/
public
List
<
CylinderAreaDataDto
>
queryForCylinderAreaDataList
()
{
return
this
.
queryForList
(
""
,
false
);
public
List
<
CylinderAreaDataDto
>
queryForCylinderAreaDataList
()
{
return
this
.
queryForList
(
""
,
false
);
}
public
List
<
CityCylinderInfoDto
>
getCityCylinderData
(
String
level
)
{
...
...
@@ -70,16 +74,22 @@ public class CylinderAreaDataServiceImpl extends BaseService<CylinderAreaDataDto
public
Page
<
Map
<
String
,
Object
>>
getEarlyWarningStatistics
(
String
regionCode
,
String
appId
)
{
Page
<
Map
<
String
,
Object
>>
page
=
new
Page
<>();
// 是否有充装企业在指定区域下
Boolean
isHavingUnitInRegion
=
true
;
List
<
Map
<
String
,
Object
>>
list
=
Lists
.
newArrayList
();
Map
<
String
,
Object
>
result1
=
Maps
.
newHashMap
();
Map
<
String
,
Object
>
result2
=
Maps
.
newHashMap
();
// 1.许可有效率
if
(!
ValidationUtil
.
isEmpty
(
appId
))
{
result1
.
put
(
"name"
,
"许可有效期"
);
result1
.
put
(
"value"
,
mapper
.
getLicenseEfficiency
(
null
,
appId
).
get
(
"licenseOk"
).
toString
());
}
else
if
(!
ValidationUtil
.
isEmpty
(
regionCode
)){
result1
.
put
(
"value"
,
this
.
getBaseMapper
().
queryLicenseEfficiencyOneCompany
(
appId
).
getStrValue
());
}
else
if
(!
ValidationUtil
.
isEmpty
(
regionCode
))
{
result1
.
put
(
"name"
,
"许可有效率(%)"
);
result1
.
put
(
"value"
,
mapper
.
getLicenseEfficiency
(
regionCode
,
null
).
get
(
"licenseRate"
).
toString
());
result1
.
put
(
"value"
,
this
.
getLicenseEfficiencyByRegion
(
regionCode
));
isHavingUnitInRegion
=
this
.
setNoUnitDataStaticInfo
(
list
,
result1
.
get
(
"value"
).
toString
());
}
if
(!
ValidationUtil
.
isEmpty
(
regionCode
)
&&
!
isHavingUnitInRegion
)
{
return
page
.
setRecords
(
list
);
}
// 2.使用登记办理率
if
(!
ValidationUtil
.
isEmpty
(
appId
))
{
...
...
@@ -92,11 +102,11 @@ public class CylinderAreaDataServiceImpl extends BaseService<CylinderAreaDataDto
// 3.检验超期率
Map
<
String
,
Object
>
result3
=
Maps
.
newHashMap
();
result3
.
put
(
"name"
,
"检验超期率(%)"
);
result3
.
put
(
"value"
,
mapper
.
getInspectionExpiredRate
(
regionCode
,
appId
).
get
(
"expiredRate"
).
toString
());
result3
.
put
(
"value"
,
this
.
getBaseMapper
()
.
getInspectionExpiredRate
(
regionCode
,
appId
).
get
(
"expiredRate"
).
toString
());
// 4.检验合格率
Map
<
String
,
Object
>
result4
=
Maps
.
newHashMap
();
result4
.
put
(
"name"
,
"检验合格率(%)"
);
result4
.
put
(
"value"
,
mapper
.
getInspectionResultRate
(
regionCode
,
appId
).
get
(
"resultRate"
).
toString
());
result4
.
put
(
"value"
,
this
.
getBaseMapper
()
.
getInspectionResultRate
(
regionCode
,
appId
).
get
(
"resultRate"
).
toString
());
// 5.充装检查率
Map
<
String
,
Object
>
result5
=
Maps
.
newHashMap
();
long
totalAll
=
searchEsCount
(
false
,
false
,
regionCode
,
appId
);
...
...
@@ -128,12 +138,44 @@ public class CylinderAreaDataServiceImpl extends BaseService<CylinderAreaDataDto
return
page
;
}
private
Map
<
String
,
Object
>
getFillingCheckRate
(
ESCylinderFillingRecordDto
esCylinderFillingRecordDto
)
{
return
null
;
private
Boolean
setNoUnitDataStaticInfo
(
List
<
Map
<
String
,
Object
>>
list
,
String
value
)
{
if
(
NO_DATA_STR
.
equals
(
value
))
{
Map
<
String
,
Object
>
result2
=
Maps
.
newHashMap
();
result2
.
put
(
"name"
,
"使用登记办理率(%)"
);
result2
.
put
(
"value"
,
NO_DATA_STR
);
Map
<
String
,
Object
>
result3
=
Maps
.
newHashMap
();
result3
.
put
(
"name"
,
"检验超期率(%)"
);
result3
.
put
(
"value"
,
NO_DATA_STR
);
Map
<
String
,
Object
>
result4
=
Maps
.
newHashMap
();
result4
.
put
(
"name"
,
"检验合格率(%)"
);
result4
.
put
(
"value"
,
NO_DATA_STR
);
Map
<
String
,
Object
>
result5
=
Maps
.
newHashMap
();
result5
.
put
(
"name"
,
"充装检查率(%)"
);
result5
.
put
(
"value"
,
NO_DATA_STR
);
Map
<
String
,
Object
>
result6
=
Maps
.
newHashMap
();
result6
.
put
(
"name"
,
"充装检查合格率(%)"
);
result6
.
put
(
"value"
,
NO_DATA_STR
);
list
.
add
(
result2
);
list
.
add
(
result3
);
list
.
add
(
result5
);
list
.
add
(
result4
);
list
.
add
(
result6
);
return
false
;
}
return
true
;
}
private
Map
<
String
,
Object
>
getValidFillingCheckRate
(
ESCylinderFillingRecordDto
esCylinderFillingRecordDto
)
{
return
null
;
private
String
getLicenseEfficiencyByRegion
(
String
regionCode
)
{
List
<
KeyValueDto
>
keyValueDtos
=
this
.
getBaseMapper
().
queryLicenseEfficiencyOfRegion
(
regionCode
);
int
totalUnitNumber
=
keyValueDtos
.
stream
().
mapToInt
(
KeyValueDto:
:
getIValue
).
sum
();
int
okUnitNumberNumber
=
keyValueDtos
.
stream
().
filter
(
k
->
k
.
getStrKey
().
equals
(
LICENSE_IS_OK
)).
mapToInt
(
KeyValueDto:
:
getIValue
).
sum
();
if
(
totalUnitNumber
==
0
)
{
return
NO_DATA_STR
;
}
BigDecimal
bigTotalUnitNumber
=
new
BigDecimal
(
String
.
valueOf
(
totalUnitNumber
));
BigDecimal
bigOkUnitNumberNumber
=
new
BigDecimal
(
String
.
valueOf
(
okUnitNumberNumber
));
BigDecimal
result
=
bigOkUnitNumberNumber
.
divide
(
bigTotalUnitNumber
,
4
,
RoundingMode
.
HALF_UP
).
multiply
(
new
BigDecimal
(
"100"
)).
setScale
(
2
);
return
result
.
toPlainString
();
}
private
long
searchEsCount
(
Boolean
checkOk
,
Boolean
resultOk
,
String
regionCode
,
String
appId
)
{
...
...
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