Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
civil-bigdata
Overview
Overview
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
civil
civil-bigdata
Commits
ef0ae1a5
Commit
ef0ae1a5
authored
Aug 05, 2021
by
袁伟铭
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改社会救助
parent
914d7a6b
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
62 additions
and
50 deletions
+62
-50
portal-server/src/main/java/com/zq/portal/manager/PortalCacheKeys.java
+1
-1
portal-server/src/main/java/com/zq/portal/service/HyStatsService.java
+1
-2
portal-server/src/main/java/com/zq/portal/service/ShjzStatsService.java
+45
-17
portal-server/src/main/java/com/zq/portal/task/StatsTimingTask.java
+10
-10
portal-server/src/main/resources/mapper/ShjzStatsDao.xml
+5
-20
No files found.
portal-server/src/main/java/com/zq/portal/manager/PortalCacheKeys.java
View file @
ef0ae1a5
...
...
@@ -123,6 +123,6 @@ public abstract class PortalCacheKeys {
// 低保 获取近5年折线图
public
static
String
getFivesYearEnbuzEnjoyStatsKey
(
StatsReqVo
vo
)
{
return
PREFIX
+
"getFivesYearEnbuzEnjoyStats
"
;
return
PREFIX
+
"getFivesYearEnbuzEnjoyStats
."
+
vo
.
getAreaCode
()
;
}
}
portal-server/src/main/java/com/zq/portal/service/HyStatsService.java
View file @
ef0ae1a5
...
...
@@ -21,7 +21,6 @@ import lombok.RequiredArgsConstructor;
import
org.springframework.stereotype.Service
;
import
java.util.*
;
import
java.util.concurrent.TimeUnit
;
@Service
@RequiredArgsConstructor
...
...
@@ -240,7 +239,7 @@ public class HyStatsService {
if
(
StringUtils
.
isBlank
(
vo
.
getAreaCode
()))
{
vo
.
setAreaCode
(
"450000000000"
);
}
SystemArea
area
=
areaDao
.
getAreaByCode
(
vo
.
getAreaCode
(
));
SystemArea
area
=
areaDao
.
getAreaByCode
(
SystemArea
.
patchZero
(
vo
.
getAreaCode
()
));
vo
.
setSubAreaCode
(
area
.
subAreaCode
());
vo
.
setType
(
"IA"
);
...
...
portal-server/src/main/java/com/zq/portal/service/ShjzStatsService.java
View file @
ef0ae1a5
...
...
@@ -90,9 +90,9 @@ public class ShjzStatsService {
BigDecimal
villageToatlAmount
=
BigDecimal
.
ZERO
;
BigDecimal
cityToatlAmount
=
BigDecimal
.
ZERO
;
for
(
Map
<
String
,
Object
>
fivesYearStat
:
fivesYearStats
)
{
if
(
"城市低保"
.
equals
(
fivesYearStat
.
get
(
"
helpType
"
).
toString
()))
{
if
(
"城市低保"
.
equals
(
fivesYearStat
.
get
(
"
iscity
"
).
toString
()))
{
cityToatlAmount
=
getFivesYearTotalNum
(
cityToatlAmount
,
fivesYearStat
);
}
else
if
(
"农村低保"
.
equals
(
fivesYearStat
.
get
(
"
helpType
"
).
toString
()))
{
}
else
if
(
"农村低保"
.
equals
(
fivesYearStat
.
get
(
"
iscity
"
).
toString
()))
{
villageToatlAmount
=
getFivesYearTotalNum
(
villageToatlAmount
,
fivesYearStat
);
}
}
...
...
@@ -412,6 +412,9 @@ public class ShjzStatsService {
*/
public
Object
getEnjoyNum
(
StatsReqVo
vo
)
{
SystemArea
systemArea
=
areaDao
.
selectById
(
SystemArea
.
patchZero
(
vo
.
getAreaCode
()));
if
(
systemArea
.
getCode
().
startsWith
(
"450110"
))
{
systemArea
.
setCode
(
"450122"
+
systemArea
.
getCode
().
substring
(
6
));
}
vo
.
setSubAreaCode
(
systemArea
.
subAreaCode
());
vo
.
setSize
(
SystemArea
.
getNextLevelLength
(
systemArea
.
getType
()));
...
...
@@ -420,7 +423,6 @@ public class ShjzStatsService {
enbuzStats
.
setAreaName
(
systemArea
.
getName
());
for
(
StatsVo
statsVo
:
statsList
)
{
enbuzStats
.
setYear
(
Integer
.
parseInt
(
statsVo
.
getDate
().
substring
(
0
,
4
)));
if
(
statsVo
.
getType
().
equals
(
"农村低保"
))
{
if
(
enbuzStats
.
getVillageNum
()
!=
null
)
{
enbuzStats
.
setVillageNum
(
enbuzStats
.
getVillageNum
()
+
statsVo
.
getNum
());
...
...
@@ -443,19 +445,30 @@ public class ShjzStatsService {
}
}
}
//
TODO
临时人数
// 临时人数
StatsVo
temporaryNumStats
=
shjzStatsDao
.
getTemporaryNumStats
(
vo
);
enbuzStats
.
setTemporaryNum
(
temporaryNumStats
.
getNum
()
==
null
?
0
:
temporaryNumStats
.
getNum
());
if
(
temporaryNumStats
!=
null
)
{
enbuzStats
.
setTemporaryNum
(
temporaryNumStats
.
getNum
()
==
null
?
0
:
temporaryNumStats
.
getNum
());
}
else
{
enbuzStats
.
setTemporaryNum
(
0
);
}
//
TODO
边民人数
// 边民人数
StatsVo
borderNumStats
=
shjzStatsDao
.
getBorderNumStats
(
vo
);
enbuzStats
.
setTemporaryNum
(
borderNumStats
.
getNum
()
==
null
?
0
:
borderNumStats
.
getNum
());
if
(
borderNumStats
!=
null
)
{
enbuzStats
.
setBorderNum
(
borderNumStats
.
getNum
()
==
null
?
0
:
borderNumStats
.
getNum
());
}
else
{
enbuzStats
.
setBorderNum
(
0
);
}
Map
<
String
,
Object
>
bean
=
BeanUtil
.
beanToMap
(
enbuzStats
);
CityEnum
cityEnum
=
CityEnum
.
ofCode
(
systemArea
.
subAreaCode
());
if
(
cityEnum
!=
null
)
{
bean
.
put
(
"cityNumRate"
,
BigDecimal
.
valueOf
(
enbuzStats
.
getCityNum
()).
divide
(
BigDecimal
.
valueOf
(
cityEnum
.
getCity
()),
3
,
RoundingMode
.
HALF_UP
).
multiply
(
BigDecimal
.
valueOf
(
100
)).
setScale
(
2
,
RoundingMode
.
HALF_UP
).
stripTrailingZeros
().
toPlainString
()
+
"%"
);
bean
.
put
(
"villageNumRate"
,
BigDecimal
.
valueOf
(
enbuzStats
.
getVillageNum
()).
divide
(
BigDecimal
.
valueOf
(
cityEnum
.
getVillage
()),
3
,
RoundingMode
.
HALF_UP
).
multiply
(
BigDecimal
.
valueOf
(
100
)).
setScale
(
2
,
RoundingMode
.
HALF_UP
).
stripTrailingZeros
().
toPlainString
()
+
"%"
);
}
else
{
bean
.
put
(
"cityNumRate"
,
0
);
bean
.
put
(
"villageNumRate"
,
0
);
}
redisUtils
.
setObj
(
PortalCacheKeys
.
getEnjoyEnbuzNumKey
(
vo
),
bean
);
...
...
@@ -484,6 +497,9 @@ public class ShjzStatsService {
*/
public
Object
getAreaUnderNumStats
(
StatsReqVo
vo
)
{
SystemArea
systemArea
=
areaDao
.
selectById
(
SystemArea
.
patchZero
(
vo
.
getAreaCode
()));
if
(
systemArea
.
getCode
().
startsWith
(
"450110"
))
{
systemArea
.
setCode
(
"450122"
+
systemArea
.
getCode
().
substring
(
6
));
}
vo
.
setSubAreaCode
(
systemArea
.
subAreaCode
());
// SQL分组区域长度
vo
.
setSize
(
SystemArea
.
getNextLevelLength
(
systemArea
.
getType
()));
...
...
@@ -528,13 +544,17 @@ public class ShjzStatsService {
cityStatsList
.
forEach
(
statsVo
->
{
if
(
statsVo
.
getType
().
equals
(
"城市低保"
))
{
SystemArea
area
=
areaDao
.
selectById
(
SystemArea
.
patchZero
(
statsVo
.
getCode
()));
areaList
.
add
(
area
.
getName
());
if
(
area
!=
null
)
{
areaList
.
add
(
area
.
getName
());
cityNumList
.
add
(
NumberUtil
.
toStr
(
statsVo
.
getNum
(),
"0"
));
cityNumList
.
add
(
NumberUtil
.
toStr
(
statsVo
.
getNum
(),
"0"
));
CityEnum
cityEnum
=
CityEnum
.
ofCode
(
statsVo
.
getCode
());
if
(
cityEnum
!=
null
)
{
cityNumRateList
.
add
(
BigDecimal
.
valueOf
(
statsVo
.
getNum
()).
divide
(
BigDecimal
.
valueOf
(
cityEnum
.
getCity
()),
3
,
RoundingMode
.
HALF_UP
).
multiply
(
BigDecimal
.
valueOf
(
100
)).
setScale
(
2
,
RoundingMode
.
HALF_UP
).
stripTrailingZeros
().
toPlainString
());
CityEnum
cityEnum
=
CityEnum
.
ofCode
(
statsVo
.
getCode
());
if
(
cityEnum
!=
null
)
{
cityNumRateList
.
add
(
BigDecimal
.
valueOf
(
statsVo
.
getNum
()).
divide
(
BigDecimal
.
valueOf
(
cityEnum
.
getCity
()),
3
,
RoundingMode
.
HALF_UP
).
multiply
(
BigDecimal
.
valueOf
(
100
)).
setScale
(
2
,
RoundingMode
.
HALF_UP
).
stripTrailingZeros
().
toPlainString
());
}
else
{
cityNumRateList
.
add
(
"0"
);
}
}
}
});
...
...
@@ -544,11 +564,16 @@ public class ShjzStatsService {
villageStatsList
.
sort
(
Comparator
.
comparing
(
StatsVo:
:
getCode
));
villageStatsList
.
forEach
(
statsVo
->
{
if
(
statsVo
.
getType
().
equals
(
"农村低保"
))
{
villageNumList
.
add
(
NumberUtil
.
toStr
(
statsVo
.
getNum
(),
"0"
));
CityEnum
cityEnum
=
CityEnum
.
ofCode
(
statsVo
.
getCode
());
if
(
cityEnum
!=
null
)
{
villageNumRateList
.
add
(
BigDecimal
.
valueOf
(
statsVo
.
getNum
()).
divide
(
BigDecimal
.
valueOf
(
cityEnum
.
getVillage
()),
3
,
RoundingMode
.
HALF_UP
).
multiply
(
BigDecimal
.
valueOf
(
100
)).
setScale
(
2
,
RoundingMode
.
HALF_UP
).
stripTrailingZeros
().
toPlainString
());
SystemArea
area
=
areaDao
.
selectById
(
SystemArea
.
patchZero
(
statsVo
.
getCode
()));
if
(
area
!=
null
)
{
villageNumList
.
add
(
NumberUtil
.
toStr
(
statsVo
.
getNum
(),
"0"
));
CityEnum
cityEnum
=
CityEnum
.
ofCode
(
statsVo
.
getCode
());
if
(
cityEnum
!=
null
)
{
villageNumRateList
.
add
(
BigDecimal
.
valueOf
(
statsVo
.
getNum
()).
divide
(
BigDecimal
.
valueOf
(
cityEnum
.
getVillage
()),
3
,
RoundingMode
.
HALF_UP
).
multiply
(
BigDecimal
.
valueOf
(
100
)).
setScale
(
2
,
RoundingMode
.
HALF_UP
).
stripTrailingZeros
().
toPlainString
());
}
else
{
villageNumRateList
.
add
(
"0"
);
}
}
}
});
...
...
@@ -586,6 +611,9 @@ public class ShjzStatsService {
*/
public
Object
getFivesYearEnjoyStats
(
StatsReqVo
vo
)
{
SystemArea
systemArea
=
areaDao
.
selectById
(
SystemArea
.
patchZero
(
vo
.
getAreaCode
()));
if
(
systemArea
.
getCode
().
startsWith
(
"450110"
))
{
systemArea
.
setCode
(
"450122"
+
systemArea
.
getCode
().
substring
(
6
));
}
vo
.
setSubAreaCode
(
systemArea
.
subAreaCode
());
List
<
StatsVo
>
statsList
=
shjzStatsDao
.
getFivesYearEnjoyStats
(
vo
);
...
...
portal-server/src/main/java/com/zq/portal/task/StatsTimingTask.java
View file @
ef0ae1a5
...
...
@@ -27,10 +27,10 @@ public class StatsTimingTask {
private
final
ShjzStatsService
shjzStatsService
;
private
final
AreaDao
areaDao
;
private
final
String
cron
=
"0 0 0/12 * * ?"
;
// private final String cron = "0 58
22
* * ?";
// private final String cron = "0 58
1
* * ?";
@Scheduled
(
cron
=
cron
)
@Scheduled
(
fixedDelay
=
3600000
)
public
void
cacheAreaData
()
{
System
.
out
.
println
(
"基本数统计 触发时间 :"
+
new
Date
());
peopleService
.
getDBUserCount
();
...
...
@@ -39,7 +39,7 @@ public class StatsTimingTask {
peopleService
.
getCJYLCount
();
}
@Scheduled
(
cron
=
cron
)
@Scheduled
(
fixedDelay
=
3600000
)
public
void
hyStatsTask
()
{
System
.
out
.
println
(
"婚姻-基本数统计 触发时间 :"
+
new
Date
());
...
...
@@ -85,7 +85,7 @@ public class StatsTimingTask {
hyStatsService
.
getAreaUnderMarriageStatsList
(
StatsReqVo
.
builder
().
areaCode
(
areaCode
).
year
(
year
).
build
());
}
@Scheduled
(
cron
=
cron
)
@Scheduled
(
fixedDelay
=
3600000
)
public
void
etStatsTask
()
{
System
.
out
.
println
(
"儿童-基本数统计 触发时间 :"
+
new
Date
());
List
<
SystemArea
>
cityAreaList
=
areaDao
.
selectList
(
Wrappers
.
lambdaQuery
(
SystemArea
.
builder
().
parentId
(
"450000000000"
).
build
()));
...
...
@@ -124,7 +124,7 @@ public class StatsTimingTask {
etStatsService
.
getAgencyPercentageStats
(
StatsReqVo
.
builder
().
areaCode
(
areaCode
).
year
(
year
).
build
());
}
@Scheduled
(
cron
=
cron
)
@Scheduled
(
fixedDelay
=
3600000
)
public
void
shzzStatsTask
()
{
System
.
out
.
println
(
"社会组织-基本数统计 触发时间 :"
+
new
Date
());
...
...
@@ -163,7 +163,7 @@ public class StatsTimingTask {
shzzStatsService
.
getSoorganPercentageStats
(
StatsReqVo
.
builder
().
areaCode
(
areaCode
).
year
(
year
).
build
());
}
@Scheduled
(
cron
=
cron
)
@Scheduled
(
fixedDelay
=
3600000
)
public
void
cjStatsTask
()
{
System
.
out
.
println
(
"残疾-基本数统计 触发时间 :"
+
new
Date
());
...
...
@@ -202,7 +202,7 @@ public class StatsTimingTask {
cjStatsService
.
getAreaDisabledIssueStats
(
StatsReqVo
.
builder
().
areaCode
(
areaCode
).
year
(
year
).
build
());
}
@Scheduled
(
cron
=
cron
)
@Scheduled
(
fixedDelay
=
3600000
)
public
void
bzStatsTask
()
{
System
.
out
.
println
(
"殡葬-基本数统计 触发时间 :"
+
new
Date
());
...
...
@@ -241,7 +241,7 @@ public class StatsTimingTask {
bzStatsService
.
getCremationRateStats
(
StatsReqVo
.
builder
().
areaCode
(
areaCode
).
year
(
year
).
build
());
}
@Scheduled
(
cron
=
cron
)
@Scheduled
(
fixedDelay
=
3600000
)
public
void
ylStatsTask
()
{
System
.
out
.
println
(
"养老-基本数统计 触发时间 :"
+
new
Date
());
...
...
@@ -278,7 +278,7 @@ public class StatsTimingTask {
ylStatsService
.
getAreaNursingStatsList
(
StatsReqVo
.
builder
().
areaCode
(
areaCode
).
year
(
year
).
build
());
}
@Scheduled
(
cron
=
cron
)
@Scheduled
(
fixedDelay
=
3600000
)
public
void
shjzStatsTask
()
{
System
.
out
.
println
(
"社会救助-基本数统计 触发时间 :"
+
new
Date
());
...
...
@@ -301,7 +301,7 @@ public class StatsTimingTask {
private
void
shjzStats
(
String
areaCode
,
Integer
year
)
{
shjzStatsService
.
getEnjoyNum
(
StatsReqVo
.
builder
().
areaCode
(
areaCode
).
year
(
year
).
build
());
shjzStatsService
.
getAreaUnderNumStats
(
StatsReqVo
.
builder
().
areaCode
(
areaCode
).
year
(
year
).
build
());
shjzStatsService
.
getFivesYearEnjoyStats
(
StatsReqVo
.
builder
().
areaCode
(
areaCode
).
year
(
year
).
build
());
shjzStatsService
.
getFivesYearEnjoyStats
(
StatsReqVo
.
builder
().
areaCode
(
areaCode
).
build
());
}
}
portal-server/src/main/resources/mapper/ShjzStatsDao.xml
View file @
ef0ae1a5
...
...
@@ -43,7 +43,7 @@
</select>
<select
id=
"getEnjoyNum"
resultType=
"com.zq.portal.vo.StatsVo"
>
SELECT
DATE_FORMAT(h.PERMIT_DATE, "%Y-%m") 'date',
SELECT
( CASE h.ISCITY
WHEN 0 THEN '农村低保'
WHEN 1 THEN '城市低保'
...
...
@@ -59,16 +59,9 @@
<if
test=
"subAreaCode != null and subAreaCode != ''"
>
AND h.UNIT_ID LIKE CONCAT(#{subAreaCode}, '%')
</if>
<choose>
<when
test=
"year != null"
>
AND DATE_FORMAT( h.PERMIT_DATE, "%Y" ) = #{year}
</when>
<otherwise>
AND DATE_FORMAT( h.PERMIT_DATE, "%Y" ) = DATE_FORMAT(NOW(), "%Y" )
</otherwise>
</choose>
AND DATE_FORMAT( h.PERMIT_DATE, "%Y-%m-%d" )
<
= '2021-07-01'
AND DATE_FORMAT( h.STOP_DATE, "%Y-%m-%d" ) >= '2021-07-01'
GROUP BY
DATE_FORMAT( h.PERMIT_DATE, "%Y-%m" ),
ISCITY
</select>
...
...
@@ -117,7 +110,6 @@
<select
id=
"getAreaUnderNumStats"
resultType=
"com.zq.portal.vo.StatsVo"
>
SELECT
LEFT(h.UNIT_ID, #{size}) 'code',
DATE_FORMAT( h.PERMIT_DATE, "%Y-%m" ) 'date',
( CASE h.ISCITY
WHEN 0 THEN '农村低保'
WHEN 1 THEN '城市低保'
...
...
@@ -135,17 +127,10 @@
<if
test=
"subAreaCode != null and subAreaCode != ''"
>
AND h.UNIT_ID LIKE CONCAT(#{subAreaCode}, '%')
</if>
<choose>
<when
test=
"year != null"
>
AND DATE_FORMAT( h.PERMIT_DATE, "%Y" ) = #{year}
</when>
<otherwise>
AND DATE_FORMAT( h.PERMIT_DATE, "%Y" ) = DATE_FORMAT(NOW(), "%Y" )
</otherwise>
</choose>
AND DATE_FORMAT( h.PERMIT_DATE, "%Y-%m-%d" )
<
= '2021-07-01'
AND DATE_FORMAT( h.STOP_DATE, "%Y-%m-%d" ) >= '2021-07-01'
GROUP BY
LEFT(h.UNIT_ID, #{size}),
DATE_FORMAT( h.PERMIT_DATE, "%Y-%m" ),
ISCITY
</select>
...
...
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