Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
manager
Project
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
reyun
manager
Commits
644c0f5f
Commit
644c0f5f
authored
Nov 30, 2020
by
kangxiaoshan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
月流量报表
parent
1a41f230
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
21 deletions
+27
-21
TkioFlowHistory.java
src/main/java/common/model/TkioFlowHistory.java
+2
-3
ShareIncomeServiceImpl.java
...main/java/common/service/impl/ShareIncomeServiceImpl.java
+0
-1
TrackingFlowTask.java
src/main/java/track/task/TrackingFlowTask.java
+25
-17
No files found.
src/main/java/common/model/TkioFlowHistory.java
View file @
644c0f5f
...
...
@@ -12,6 +12,7 @@ import javax.persistence.Id;
@Entity
public
class
TkioFlowHistory
{
@Id
@GeneratedValue
private
Long
id
;
private
String
ds
;
private
String
email
;
...
...
@@ -23,10 +24,8 @@ public class TkioFlowHistory {
private
String
nextCode
;
private
Integer
firstRecode
;
public
TkioFlowHistory
()
{
}
public
TkioFlowHistory
(
TkioFlow
flow
)
{
...
...
src/main/java/common/service/impl/ShareIncomeServiceImpl.java
View file @
644c0f5f
...
...
@@ -1564,7 +1564,6 @@ public class ShareIncomeServiceImpl implements ShareIncomeService {
public
boolean
checkLateContract
(
DateTime
dateTime
,
DateTime
creatTime
)
{
int
aferDays
=
dateTime
.
monthOfYear
().
get
()
==
12
?
29
:
9
;
return
dateTime
.
dayOfMonth
().
withMaximumValue
().
plusDays
(
aferDays
).
isBefore
(
creatTime
);
}
private
int
getDayRange
(
DateTime
range1
,
DateTime
range2
)
{
...
...
src/main/java/track/task/TrackingFlowTask.java
View file @
644c0f5f
...
...
@@ -91,6 +91,8 @@ public class TrackingFlowTask {
}
private
void
calculationFlowByAccount
(
CalculationFlow
calculationFlow
,
String
email
)
{
System
.
out
.
println
(
email
+
" 账号正在处理流量"
);
try
{
Account
account
=
accountRepository
.
findByEmail
(
email
);
List
<
Account
>
accountList
=
accountRepository
.
findByRootParent
(
account
.
getRootParent
());
...
...
@@ -261,7 +263,6 @@ public class TrackingFlowTask {
skip
=
false
;
}
TkioFlow
tkioFlow
=
getTkioFlow
(
clickFlow
,
yesterday
,
sortedContract
.
get
(
i
),
true
);
Long
costFlow
=
tkioFlow
.
getCostFlow
()
==
null
?
0L
:
tkioFlow
.
getCostFlow
();
TkioFlowHistory
flowHistory
=
new
TkioFlowHistory
(
tkioFlow
);
...
...
@@ -281,42 +282,44 @@ public class TrackingFlowTask {
Contract
next
=
sortedContract
.
get
(
i
+
1
);
if
(
DateTime
.
parse
(
next
.
getStartDate
()).
isBefore
(
DateTime
.
parse
(
yesterday
))
||
DateTime
.
parse
(
next
.
getStartDate
()).
isEqual
(
DateTime
.
parse
(
yesterday
)))
{
// 生效
if
(
DateTime
.
parse
(
next
.
getStartDate
()).
monthOfYear
().
get
()
!=
new
DateTime
(
next
.
getCreateTime
()).
monthOfYear
().
get
()
&&
new
DateTime
(
next
.
getCreateTime
()).
dayOfMonth
().
get
()
>
10
)
{
if
(
laterRecodeContract
(
DateTime
.
parse
(
next
.
getStartDate
()),
new
DateTime
(
next
.
getCreateTime
())))
{
//生效且晚录
if
(
DateTime
.
parse
(
yesterday
).
isBefore
(
new
DateTime
(
next
.
getCreateTime
()).
dayOfMonth
().
withMinimumValue
()))
{
//下一合同录入月1号之前的超出流量计入上分合同
flowHistory
.
setNextCode
(
next
.
getContractCode
());
//标记用于那份合同的调整流量 (该字段不为空的合同外流量之和为该字段对应合同的调整流量)
tkioFlowHistoryRepository
.
save
(
flowHistory
);
break
;
}
else
{
//2、生效时 且非晚录合同 超出流量计入下一合同
//下一合同录入月1号及之后的超出流量计入自己
clickFlow
=
new
BigInteger
(
costFlow
.
toString
());
fistRecode
=
true
;
fistRecode
=
true
;
//首次记录流量 (用于标记调整流量 归属在 合同所在月份中的第一个开始月份)
continue
;
}
}
//3、未生效或晚录合同 则关联流量信息到当前合同
if
(
DateTime
.
parse
(
yesterday
).
monthOfYear
().
get
()
==
DateTime
.
parse
(
next
.
getStartDate
()).
monthOfYear
().
get
())
{
//生效当月 超出的流量关联到 该合同
}
else
{
//2、生效且非晚录合同 超出流量计入下一合同
clickFlow
=
new
BigInteger
(
costFlow
.
toString
());
fistRecode
=
true
;
continue
;
}
}
else
{
//生效当月之前 超出的流量计入上一合同
flowHistory
.
setNextCode
(
next
.
getContractCode
());
//标记用于那份合同的调整流量
//未生效 超出的流量计入自己
tkioFlowHistoryRepository
.
save
(
flowHistory
);
}
break
;
}
}
else
{
//无下一份合同
则关联流量信息到当前合同内
//无下一份合同
超出的流量计入自己
tkioFlowHistoryRepository
.
save
(
flowHistory
);
}
}
return
clickFlow
;
}
public
void
task
()
{
List
<
String
>
emails
=
contractRepository
.
findDistinctEmailByPlatform
(
"tkio"
);
List
<
String
>
emails
=
contractRepository
.
findDistinctEmailByPlatform
(
"tkio"
);
List
<
TkioFlow
>
tkioFlowList
=
new
ArrayList
<>();
String
yesterday
=
DateUtil
.
getBeforeDays
(
1
);
//昨日
logger
.
info
(
"昨日流量同步:"
+
yesterday
);
...
...
@@ -516,6 +519,11 @@ public class TrackingFlowTask {
return
sortedContract
;
}
public
boolean
laterRecodeContract
(
DateTime
startTime
,
DateTime
creatTime
)
{
int
aferDays
=
startTime
.
monthOfYear
().
get
()
==
12
?
29
:
9
;
return
startTime
.
dayOfMonth
().
withMaximumValue
().
plusDays
(
aferDays
).
isBefore
(
creatTime
);
}
public
static
void
main
(
String
[]
args
)
throws
ParseException
{
String
ago
=
"2020-10-01"
;
int
between
=
DateUtil
.
daysBetween
(
ago
,
DateUtil
.
getBeforeDays
(
1
))
+
1
;
...
...
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