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
00ab32e6
Commit
00ab32e6
authored
Jul 27, 2021
by
袁伟铭
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
041da083
b33bd380
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
126 additions
and
28 deletions
+126
-28
common-utils/src/main/java/com/zq/common/entity/VShjzStats.java
+55
-0
portal-server/src/main/java/com/zq/portal/dao/VShjzAchieveDao.java
+2
-1
portal-server/src/main/java/com/zq/portal/dao/VShjzStatsDao.java
+19
-0
portal-server/src/main/java/com/zq/portal/service/ShjzStatsService.java
+12
-12
portal-server/src/main/resources/mapper/ShjzAchieveStatsMapper.xml
+38
-15
No files found.
common-utils/src/main/java/com/zq/common/entity/VShjzStats.java
0 → 100644
View file @
00ab32e6
package
com
.
zq
.
common
.
entity
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
java.util.Date
;
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
@TableName
(
value
=
"v_shjz_total"
)
public
class
VShjzStats
{
/**
* ID
*/
@TableId
@ApiModelProperty
(
"ID"
)
private
Long
id
;
/**
* 区划ID
*/
@ApiModelProperty
(
"区划ID"
)
private
Long
unitId
;
/**
* 年份
*/
@ApiModelProperty
(
"年份"
)
private
String
year
;
/**
* 救助类型
*/
@ApiModelProperty
(
"救助类型"
)
private
String
helpType
;
/**
* 低保总数
*/
@ApiModelProperty
(
"低保总数"
)
private
String
total
;
/**
* createTime
*/
private
Date
createTime
;
}
portal-server/src/main/java/com/zq/portal/dao/VShjzAchieveDao.java
View file @
00ab32e6
...
...
@@ -2,6 +2,7 @@ package com.zq.portal.dao;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.zq.common.entity.VShjzAchieve
;
import
com.zq.common.entity.VShjzStats
;
import
com.zq.portal.vo.StatsVo
;
import
org.apache.ibatis.annotations.Param
;
import
org.springframework.stereotype.Repository
;
...
...
@@ -16,7 +17,7 @@ import java.util.Map;
* @since 2021-06-26 10:28:36
*/
@Repository
public
interface
VShjzAchieveDao
extends
BaseMapper
<
VShjz
Achieve
>
{
public
interface
VShjzAchieveDao
extends
BaseMapper
<
VShjz
Stats
>
{
List
<
Map
<
String
,
Object
>>
getFivesYearStats
(
@Param
(
"date"
)
String
date
);
...
...
portal-server/src/main/java/com/zq/portal/dao/VShjzStatsDao.java
0 → 100644
View file @
00ab32e6
package
com
.
zq
.
portal
.
dao
;
import
com.baomidou.dynamic.datasource.annotation.DS
;
import
com.zq.common.constant.DBName
;
import
com.zq.portal.vo.StatsReqVo
;
import
com.zq.portal.vo.StatsVo
;
import
org.springframework.stereotype.Repository
;
import
java.util.List
;
@DS
(
DBName
.
MASTER
)
@Repository
public
interface
VShjzStatsDao
{
List
<
StatsVo
>
getPeopleNumStats
(
StatsReqVo
vo
);
}
portal-server/src/main/java/com/zq/portal/service/ShjzStatsService.java
View file @
00ab32e6
...
...
@@ -82,9 +82,9 @@ public class ShjzStatsService {
BigDecimal
villageToatlAmount
=
BigDecimal
.
ZERO
;
BigDecimal
cityToatlAmount
=
BigDecimal
.
ZERO
;
for
(
Map
<
String
,
Object
>
fivesYearStat
:
fivesYearStats
)
{
if
(
"城市低保"
.
equals
(
fivesYearStat
.
get
(
"
iscity
"
).
toString
()))
{
if
(
"城市低保"
.
equals
(
fivesYearStat
.
get
(
"
helpType
"
).
toString
()))
{
cityToatlAmount
=
getFivesYearTotalNum
(
cityToatlAmount
,
fivesYearStat
);
}
else
if
(
"农村低保"
.
equals
(
fivesYearStat
.
get
(
"
iscity
"
).
toString
()))
{
}
else
if
(
"农村低保"
.
equals
(
fivesYearStat
.
get
(
"
helpType
"
).
toString
()))
{
villageToatlAmount
=
getFivesYearTotalNum
(
villageToatlAmount
,
fivesYearStat
);
}
}
...
...
@@ -150,9 +150,9 @@ public class ShjzStatsService {
BigDecimal
villageToatlAmount
=
BigDecimal
.
ZERO
;
BigDecimal
cityToatlAmount
=
BigDecimal
.
ZERO
;
for
(
Map
<
String
,
Object
>
fivesYearStat
:
fivesYearStats
)
{
if
(
"城市低保"
.
equals
(
fivesYearStat
.
get
(
"
iscity
"
).
toString
()))
{
if
(
"城市低保"
.
equals
(
fivesYearStat
.
get
(
"
helpType
"
).
toString
()))
{
cityToatlAmount
=
getThreeYearTotalNum
(
cityToatlAmount
,
fivesYearStat
);
}
else
if
(
"农村低保"
.
equals
(
fivesYearStat
.
get
(
"
iscity
"
).
toString
()))
{
}
else
if
(
"农村低保"
.
equals
(
fivesYearStat
.
get
(
"
helpType
"
).
toString
()))
{
villageToatlAmount
=
getThreeYearTotalNum
(
villageToatlAmount
,
fivesYearStat
);
}
}
...
...
@@ -181,13 +181,13 @@ public class ShjzStatsService {
List
<
Map
<
String
,
Object
>>
fivesYearStats
=
vShjzAchieveDao
.
getFivesYearStats
(
DateUtil
.
today
());
for
(
Map
<
String
,
Object
>
fivesYearStat
:
fivesYearStats
)
{
if
(
"城市低保"
.
equals
(
fivesYearStat
.
get
(
"
iscity
"
).
toString
()))
{
if
(
"城市低保"
.
equals
(
fivesYearStat
.
get
(
"
helpType
"
).
toString
()))
{
cityAmountList
.
add
(
fivesYearStat
.
get
(
"s2017"
).
toString
());
cityAmountList
.
add
(
fivesYearStat
.
get
(
"s2018"
).
toString
());
cityAmountList
.
add
(
fivesYearStat
.
get
(
"s2019"
).
toString
());
cityAmountList
.
add
(
fivesYearStat
.
get
(
"s2020"
).
toString
());
cityAmountList
.
add
(
fivesYearStat
.
get
(
"s2021"
).
toString
());
}
else
if
(
"农村低保"
.
equals
(
fivesYearStat
.
get
(
"
iscity
"
).
toString
()))
{
}
else
if
(
"农村低保"
.
equals
(
fivesYearStat
.
get
(
"
helpType
"
).
toString
()))
{
villageAmountList
.
add
(
fivesYearStat
.
get
(
"s2017"
).
toString
());
villageAmountList
.
add
(
fivesYearStat
.
get
(
"s2018"
).
toString
());
villageAmountList
.
add
(
fivesYearStat
.
get
(
"s2019"
).
toString
());
...
...
@@ -222,9 +222,9 @@ public class ShjzStatsService {
BigDecimal
villageToatlNum
=
BigDecimal
.
ZERO
;
BigDecimal
cityToatlNum
=
BigDecimal
.
ZERO
;
for
(
Map
<
String
,
Object
>
fivesYearStat
:
fivesYearStats
)
{
if
(
"城市低保"
.
equals
(
fivesYearStat
.
get
(
"
iscity
"
).
toString
()))
{
if
(
"城市低保"
.
equals
(
fivesYearStat
.
get
(
"
helpType
"
).
toString
()))
{
cityToatlNum
=
getFivesYearTotalNum
(
cityToatlNum
,
fivesYearStat
);
}
else
if
(
"农村低保"
.
equals
(
fivesYearStat
.
get
(
"
iscity
"
).
toString
()))
{
}
else
if
(
"农村低保"
.
equals
(
fivesYearStat
.
get
(
"
helpType
"
).
toString
()))
{
villageToatlNum
=
getFivesYearTotalNum
(
villageToatlNum
,
fivesYearStat
);
}
}
...
...
@@ -253,11 +253,11 @@ public class ShjzStatsService {
List
<
Map
<
String
,
Object
>>
fivesYearStats
=
vShjzAchieveDao
.
getFivesYearStats
(
DateUtil
.
today
());
for
(
Map
<
String
,
Object
>
fivesYearStat
:
fivesYearStats
)
{
if
(
"城市低保"
.
equals
(
fivesYearStat
.
get
(
"
iscity
"
).
toString
()))
{
if
(
"城市低保"
.
equals
(
fivesYearStat
.
get
(
"
helpType
"
).
toString
()))
{
cityAmountList
.
add
(
fivesYearStat
.
get
(
"s2019"
).
toString
());
cityAmountList
.
add
(
fivesYearStat
.
get
(
"s2020"
).
toString
());
cityAmountList
.
add
(
fivesYearStat
.
get
(
"s2021"
).
toString
());
}
else
if
(
"农村低保"
.
equals
(
fivesYearStat
.
get
(
"
iscity
"
).
toString
()))
{
}
else
if
(
"农村低保"
.
equals
(
fivesYearStat
.
get
(
"
helpType
"
).
toString
()))
{
villageAmountList
.
add
(
fivesYearStat
.
get
(
"s2019"
).
toString
());
villageAmountList
.
add
(
fivesYearStat
.
get
(
"s2020"
).
toString
());
villageAmountList
.
add
(
fivesYearStat
.
get
(
"s2021"
).
toString
());
...
...
@@ -290,9 +290,9 @@ public class ShjzStatsService {
BigDecimal
villageToatlNum
=
BigDecimal
.
ZERO
;
BigDecimal
cityToatlNum
=
BigDecimal
.
ZERO
;
for
(
Map
<
String
,
Object
>
fivesYearStat
:
fivesYearStats
)
{
if
(
"城市低保"
.
equals
(
fivesYearStat
.
get
(
"
iscity
"
).
toString
()))
{
if
(
"城市低保"
.
equals
(
fivesYearStat
.
get
(
"
helpType
"
).
toString
()))
{
cityToatlNum
=
getThreeYearTotalNum
(
cityToatlNum
,
fivesYearStat
);
}
else
if
(
"农村低保"
.
equals
(
fivesYearStat
.
get
(
"
iscity
"
).
toString
()))
{
}
else
if
(
"农村低保"
.
equals
(
fivesYearStat
.
get
(
"
helpType
"
).
toString
()))
{
villageToatlNum
=
getThreeYearTotalNum
(
villageToatlNum
,
fivesYearStat
);
}
}
...
...
portal-server/src/main/resources/mapper/ShjzAchieveStatsMapper.xml
View file @
00ab32e6
...
...
@@ -3,6 +3,14 @@
<mapper
namespace=
"com.zq.portal.dao.VShjzAchieveDao"
>
<select
id=
"getFivesYearStats"
resultType=
"java.util.Map"
>
SELECT help_type,
(select SUM(total) FROM v_shjz_total where `year`=${year} AND `help_type`=${help_type})
FROM `v_shjz_total`
WHERE DATE_FORMAT(createTime, '%Y-%m-%d') =
(SELECT DATE_FORMAT(createTime, '%Y-%m-%d') FROM v_shjz_total ORDER BY createTime DESC LIMIT 1)
GROUP BY
help_type
SELECT iscity,
SUM(s_2017) 's2017', SUM(s_2018) 's2018', SUM(s_2019) 's2019', SUM(s_2020) 's2020', SUM(s_2021) 's2021'
FROM `v_shjz_achieve`
...
...
@@ -13,28 +21,43 @@
</select>
<select
id=
"getStatsByYear"
resultType=
"java.util.Map"
>
SELECT get_upunitname 'city', s_${year} 'achieveNum'
FROM `v_shjz_achieve`
WHERE DATE_FORMAT(create_time, '%Y-%m-%d') =
(SELECT DATE_FORMAT(create_time, '%Y-%m-%d') FROM v_shjz_achieve ORDER BY create_time DESC
SELECT u.city_name 'city', (select SUM(total) FROM v_shjz_total where AND `year`=${year}) 'achieveNum'
FROM `v_shjz_total` s
LEFT JOIN unit_code u ON s.unit_id=u.county_id
WHERE DATE_FORMAT(createTime, '%Y-%m-%d') =
(SELECT DATE_FORMAT(createTime, '%Y-%m-%d') FROM v_shjz_total ORDER BY createTime DESC
LIMIT 1)
AND iscity = '低保'
<!-- SELECT get_upunitname 'city', s_${year} 'achieveNum'-->
<!-- FROM `v_shjz_achieve`-->
<!-- WHERE DATE_FORMAT(create_time, '%Y-%m-%d') =-->
<!-- (SELECT DATE_FORMAT(create_time, '%Y-%m-%d') FROM v_shjz_achieve ORDER BY create_time DESC-->
<!-- LIMIT 1)-->
<!-- AND iscity = '低保'-->
</select>
<select
id=
"getAreaYearShjzAchieveStats"
resultType=
"com.zq.portal.vo.StatsVo"
>
SELECT unit_id 'code', get_upunitname 'name', iscity 'type', s_2017 + s_2018 + s_2019 + s_2020 + s_2021 'num'
FROM `v_shjz_achieve`
WHERE unit_id != '45' AND DATE_FORMAT(create_time, '%Y-%m-%d') =
(SELECT DATE_FORMAT(create_time, '%Y-%m-%d') FROM v_shjz_achieve ORDER BY create_time DESC LIMIT 1)
ORDER BY unit_id
SELECT u.city_id 'code', u.city_name 'name', s.help_type 'type', (select SUM(total) FROM v_shjz_total) 'num'
FROM `v_shjz_total` s
LEFT JOIN unit_code u ON s.unit_id=u.county_id
WHERE unit_id != '45' AND DATE_FORMAT(createTime, '%Y-%m-%d') =
(SELECT DATE_FORMAT(createTime, '%Y-%m-%d') FROM v_shjz_total ORDER BY createTime DESC LIMIT 1)
ORDER BY u.city_id
<!-- SELECT unit_id 'code', get_upunitname 'name', iscity 'type', s_2017 + s_2018 + s_2019 + s_2020 + s_2021 'num'-->
<!-- FROM `v_shjz_achieve`-->
<!-- WHERE unit_id != '45' AND DATE_FORMAT(create_time, '%Y-%m-%d') =-->
<!-- (SELECT DATE_FORMAT(create_time, '%Y-%m-%d') FROM v_shjz_achieve ORDER BY create_time DESC LIMIT 1)-->
<!-- ORDER BY unit_id-->
</select>
<select
id=
"getAreaNameList"
resultType=
"java.lang.String"
>
SELECT get_upunitname 'name'
FROM `v_shjz_achieve`
WHERE unit_id != '45'
GROUP BY get_upunitname
ORDER BY unit_id
SELECT u.city_name 'name'
FROM `v_shjz_total` s
LEFT JOIN unit_code u ON s.unit_id=u.county_id
WHERE s.unit_id != '45'
GROUP BY u.city_name
ORDER BY s.unit_id
</select>
</mapper>
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