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
fd9f770b
Commit
fd9f770b
authored
Nov 06, 2023
by
tianyiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
三项统计代码添加注释
parent
1f3af219
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
14 deletions
+27
-14
ThreeSystemsServiceImpl.java
.../module/tcm/biz/service/impl/ThreeSystemsServiceImpl.java
+27
-14
No files found.
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/ThreeSystemsServiceImpl.java
View file @
fd9f770b
...
...
@@ -132,6 +132,7 @@ public class ThreeSystemsServiceImpl extends BaseService<ThreeSystemsDto, ThreeS
c
.
set
(
Calendar
.
DAY_OF_WEEK
,
Calendar
.
MONDAY
);
String
monday
=
DateUtils
.
convertDateToString
(
c
.
getTime
(),
DateUtils
.
DATE_HOUR_PATTERN
);
Boolean
flag
=
false
;
//判断今天是否本周第一天凌晨2点,如果是则最后一次更新上月数据
if
(
day
.
equals
(
monday
))
{
flag
=
true
;
}
...
...
@@ -147,6 +148,7 @@ public class ThreeSystemsServiceImpl extends BaseService<ThreeSystemsDto, ThreeS
String
monthday
=
DateUtils
.
convertDateToString
(
nowDay
,
DateUtils
.
MONTH_PATTERN
)
+
"-01 02"
;
Boolean
flag
=
false
;
//判断今天是否本月第一天凌晨2点,如果是则最后一次更新上月数据
if
(
day
.
equals
(
monthday
))
{
flag
=
true
;
}
...
...
@@ -157,7 +159,11 @@ public class ThreeSystemsServiceImpl extends BaseService<ThreeSystemsDto, ThreeS
private
void
createThreeSystemsStatistics
(
Integer
type
,
Boolean
isFirstDay
)
{
// 所有监管单位列表
List
<
LinkedHashMap
<
String
,
Object
>>
supervisionList
=
tzsTwoStaffingService
.
getSupervisionList
();
List
<
ThreeSystems
>
resultList
=
new
ArrayList
<>();
List
<
ThreeSystems
>
resultList
;
// 所有企业排查情况列表(昨天/上周/上月)
List
<
ThreeSystemsDto
>
oldStaffingCompanyList
;
// 所有企业排查情况列表(今天/本周/本月)
List
<
ThreeSystemsDto
>
newStaffingCompanyList
;
String
start
=
" 00:00:00"
;
String
end
=
" 23:59:59"
;
...
...
@@ -169,14 +175,7 @@ public class ThreeSystemsServiceImpl extends BaseService<ThreeSystemsDto, ThreeS
String
endDay
=
""
;
String
lastStart
=
""
;
String
lastEnd
=
""
;
// 所有企业排查情况列表(昨天/上周/上月)
List
<
ThreeSystemsDto
>
oldStaffingCompanyList
=
new
ArrayList
<>();
// 所有企业排查情况列表(今天/本周/本月)
List
<
ThreeSystemsDto
>
newStaffingCompanyList
=
new
ArrayList
<>();
// 根据类型设置不同的时间
if
(
1
==
type
)
{
startDay
=
day
+
start
;
endDay
=
day
+
end
;
...
...
@@ -229,21 +228,26 @@ public class ThreeSystemsServiceImpl extends BaseService<ThreeSystemsDto, ThreeS
lastEnd
=
DateUtils
.
convertDateToString
(
c
.
getTime
(),
DateUtils
.
DATE_PATTERN
)
+
end
;
}
}
//获取当天、本周、本月新的数据
newStaffingCompanyList
=
threeSystemsMapper
.
getCompanyThreeSystemsStatisticsList
(
type
,
startDay
,
endDay
);
//调用三项制度统计方法处理数据
resultList
=
getThreeSystems
(
supervisionList
,
newStaffingCompanyList
,
type
,
startDay
,
true
);
//将新数据存入统计表中
threeSystemsMapper
.
saveOrUpdateBatch
(
resultList
);
List
<
ThreeSystems
>
oldList
;
//根据lastStart和lastEnd判断是否需要更新日/周/月的历史数据(为空不更新)
if
(!
""
.
equals
(
lastStart
)
&&
!
""
.
equals
(
lastEnd
))
{
//获取日/周/月的历史数据
oldStaffingCompanyList
=
threeSystemsMapper
.
getOldCompanyThreeSystemsStatisticsList
(
type
,
DateUtils
.
dateToString
(
lastStart
));
//获取日/周/月历史数据的最新状态数据
List
<
ThreeSystemsDto
>
oldNewStaffingCompanyList
=
threeSystemsMapper
.
getCompanyThreeSystemsStatisticsList
(
type
,
lastStart
,
lastEnd
);
if
(!
ValidationUtil
.
isEmpty
(
oldNewStaffingCompanyList
))
{
// 调用三项制度统计方法处理数据
oldList
=
ValidationUtil
.
isEmpty
(
oldStaffingCompanyList
)
?
getThreeSystems
(
supervisionList
,
oldNewStaffingCompanyList
,
type
,
lastStart
,
true
)
:
getThreeSystems
(
supervisionList
,
oldNewStaffingCompanyList
,
type
,
lastStart
,
false
);
//如果历史数据不为空,更新历史数据实体
if
(!
ValidationUtil
.
isEmpty
(
oldStaffingCompanyList
))
{
if
(!
ValidationUtil
.
isEmpty
(
oldList
))
{
for
(
ThreeSystems
e
:
oldList
)
{
...
...
@@ -254,12 +258,21 @@ public class ThreeSystemsServiceImpl extends BaseService<ThreeSystemsDto, ThreeS
}
}
}
//更新统计表历史数据
threeSystemsMapper
.
saveOrUpdateBatch
(
oldList
);
}
}
}
/**
* 三项制度统计数据方法
* @param supervisionList 行政区划列表
* @param StaffingCompanyList 需要统计处理的数据列表
* @param type 统计类型
* @param date 统计日期,做筛选用,日统计传当天日期,周统计传周一日期,月统计传月一号日期
* @param isNew 是否新数据,新数据会生成主键
* @return
*/
private
List
<
ThreeSystems
>
getThreeSystems
(
List
<
LinkedHashMap
<
String
,
Object
>>
supervisionList
,
List
<
ThreeSystemsDto
>
StaffingCompanyList
,
Integer
type
,
...
...
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