Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
saasio
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
saasio
Commits
058ccb56
Commit
058ccb56
authored
7 years ago
by
yangfangfang
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of git.minrow.com:reyun/saasio
parents
ad184da8
5b03442b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
56 additions
and
13 deletions
+56
-13
AccountFlowRestrictServiceImpl.java
...om/reyun/service/impl/AccountFlowRestrictServiceImpl.java
+44
-10
AutoCalculateFlow.java
src/main/java/com/reyun/task/AutoCalculateFlow.java
+12
-3
No files found.
src/main/java/com/reyun/service/impl/AccountFlowRestrictServiceImpl.java
View file @
058ccb56
...
...
@@ -19,9 +19,6 @@ import java.math.BigInteger;
import
java.text.DecimalFormat
;
import
java.util.*
;
/**
* Created by song on 2017/10/19.
*/
@Service
public
class
AccountFlowRestrictServiceImpl
implements
AccountFlowRestrictService
{
@Autowired
...
...
@@ -42,11 +39,13 @@ public class AccountFlowRestrictServiceImpl implements AccountFlowRestrictServic
@Autowired
private
AccountRestrict4WebRepository
accountRestrict4WebRepository
;
@Autowired
private
ConfigParamRepository
configParamRepository
;
public
static
final
String
SUPER_USER_EMAIL_NOTIFY_SUBJECT
=
"客户包年套餐到期提醒"
;
public
static
final
String
SUPER_USER_TRACK_EMAIL_NOTIFY_CONTENT
=
"%s购买的“%s”中广告效果监测服务%s,请尽快跟进。"
;
public
static
final
String
SUPER_USER_IO_EMAIL_NOTIFY_CONTENT
=
"%s购买的“%s”中用户行为分析服务%s,请尽快跟进。"
;
public
static
final
String
ALREADY_EXPIRE
=
"已经到期"
;
private
static
final
String
SUPER_USER_EMAIL_NOTIFY_SUBJECT
=
"客户包年套餐到期提醒"
;
private
static
final
String
SUPER_USER_IO_EMAIL_NOTIFY_CONTENT
=
"%s购买的“%s”中用户行为分析服务%s,请尽快跟进。"
;
private
static
final
String
ALREADY_EXPIRE
=
"已经到期"
;
@Override
...
...
@@ -54,8 +53,6 @@ public class AccountFlowRestrictServiceImpl implements AccountFlowRestrictServic
Long
rootParent
=
accountRepository
.
findRootParentByAccountId
(
accountId
).
longValue
();
AccountRestrict4Web
accountRestrict4Web
=
new
AccountRestrict4Web
();
Account
one
=
accountRepository
.
findOne
(
accountId
);
Long
roleCategory
=
one
.
getRoleCategory
();
List
<
App
>
apps
=
appRepository
.
listAppByRootAccount
(
rootParent
);
Account
rootAccount
=
accountRepository
.
findOne
(
rootParent
);
...
...
@@ -81,8 +78,21 @@ public class AccountFlowRestrictServiceImpl implements AccountFlowRestrictServic
String
salesManLeaderEmail
=
salesManLeaderRepository
.
findLeaderByBussinessMan
(
rootAccount
.
getBussinessman
());
String
[]
split
={
""
};
if
(
salesManLeaderEmail
!=
null
){
split
=
salesManLeaderEmail
.
split
(
","
);
}
ArrayList
<
String
>
emailList
=
new
ArrayList
<>();
emailList
.
add
(
salesManLeaderEmail
);
Collections
.
addAll
(
emailList
,
split
);
ArrayList
<
String
>
accountEmailList
=
new
ArrayList
<>();
String
operate_email
=
configParamRepository
.
findParamsByKey
(
"operate_email"
);
if
(
operate_email
!=
null
){
String
[]
split1
=
operate_email
.
split
(
","
);
accountEmailList
.
addAll
(
Arrays
.
asList
(
split1
));
}
//accountEmailList.add(rootAccount.getEmail());
Date
lastMonth
=
getLastMonth
(
1
);
String
firstDayOfLastMonth
=
DateUtil
.
getFirstDayOfMonth
(
lastMonth
);
...
...
@@ -189,9 +199,12 @@ public class AccountFlowRestrictServiceImpl implements AccountFlowRestrictServic
accountRestrict4Web
.
setIOPastTimeNotified
(
true
);
String
contents
=
String
.
format
(
SUPER_USER_IO_EMAIL_NOTIFY_CONTENT
,
companyOrEmail
,
packageType
.
getPackageName
(),
"还有"
+
remainingDays
+
"天即将到期"
);
String
accountContents
=
"您购买的用户行为分析"
+
packageType
.
getPackageName
()
+
"将在"
+
remainingDays
+
"天后("
+
rootAccount
.
getPastDate
()+
")到期,为了不影响您的正常使用,请尽快联系商务续订服务。服务到期后我们将会继续支持您的数据上报和接收,但数据展示服务将暂时无法使用。"
;
try
{
Thread
emailThread
=
new
EmailThread
(
SUPER_USER_EMAIL_NOTIFY_SUBJECT
,
contents
,
emailList
);
emailThread
.
start
();
Thread
accountEmailThread
=
new
EmailThread
(
"热云数据用户行为分析套餐提醒"
,
accountContents
,
accountEmailList
);
accountEmailThread
.
start
();
}
catch
(
Exception
e
)
{
isNotifiedObject
.
setIoTenDaysNotified
(
false
);
isNotifiedRepository
.
save
(
isNotifiedObject
);
...
...
@@ -203,9 +216,12 @@ public class AccountFlowRestrictServiceImpl implements AccountFlowRestrictServic
isNotifiedRepository
.
save
(
isNotifiedObject
);
accountRestrict4Web
.
setIOPastTimeNotified
(
true
);
String
contents
=
String
.
format
(
SUPER_USER_IO_EMAIL_NOTIFY_CONTENT
,
companyOrEmail
,
packageType
.
getPackageName
(),
"还有"
+
remainingDays
+
"天即将到期"
);
String
accountContents
=
"您购买的用户行为分析"
+
packageType
.
getPackageName
()
+
"将在"
+
remainingDays
+
"天后("
+
rootAccount
.
getPastDate
()+
")到期,为了不影响您的正常使用,请尽快联系商务续订服务。服务到期后我们将会继续支持您的数据上报和接收,但数据展示服务将暂时无法使用。"
;
try
{
Thread
emailThread
=
new
EmailThread
(
SUPER_USER_EMAIL_NOTIFY_SUBJECT
,
contents
,
emailList
);
emailThread
.
start
();
Thread
accountEmailThread
=
new
EmailThread
(
"热云数据用户行为分析套餐提醒"
,
accountContents
,
accountEmailList
);
accountEmailThread
.
start
();
}
catch
(
Exception
e
)
{
isNotifiedObject
.
setIoOneMonthNotified
(
false
);
isNotifiedRepository
.
save
(
isNotifiedObject
);
...
...
@@ -231,9 +247,12 @@ public class AccountFlowRestrictServiceImpl implements AccountFlowRestrictServic
isNotifiedRepository
.
save
(
isNotifiedObject
);
accountRestrict4Web
.
setIOPastTimeNotified
(
true
);
String
contents
=
String
.
format
(
SUPER_USER_IO_EMAIL_NOTIFY_CONTENT
,
companyOrEmail
,
packageType
.
getPackageName
(),
"还有1天到期"
);
String
accountContents
=
"您购买的用户行为分析"
+
packageType
.
getPackageName
()
+
"将在明天到期,为了不影响您的正常使用,请尽快联系商务续订服务。服务到期后我们将会继续支持您的数据上报和接收,但数据展示服务将暂时无法使用。"
;
try
{
Thread
emailThread
=
new
EmailThread
(
SUPER_USER_EMAIL_NOTIFY_SUBJECT
,
contents
,
emailList
);
emailThread
.
start
();
Thread
accountEmailThread
=
new
EmailThread
(
"热云数据用户行为分析套餐提醒"
,
accountContents
,
accountEmailList
);
accountEmailThread
.
start
();
}
catch
(
Exception
e
)
{
isNotifiedObject
.
setIoOneDaysNotified
(
false
);
isNotifiedRepository
.
save
(
isNotifiedObject
);
...
...
@@ -268,9 +287,12 @@ public class AccountFlowRestrictServiceImpl implements AccountFlowRestrictServic
isNotifiedRepository
.
save
(
isNotifiedObject
);
accountRestrict4Web
.
setIOFlowNotified
(
true
);
String
contents
=
companyOrEmail
+
"购买的"
+
packageType
.
getPackageName
()
+
"用户行为分析当月剩余流量不足"
+
ioRemainPercent1
+
",请尽快跟进。"
;
String
accountContents
=
"您订阅的用户行为分析"
+
packageType
.
getPackageName
()
+
"中本月剩余流量已不足"
+
ioRemainPercent1
+
",请关注您的套餐流量使用情况。"
;
try
{
Thread
emailThread
=
new
EmailThread
(
"用户行为分析产品流量提醒"
,
contents
,
emailList
);
emailThread
.
start
();
Thread
accountEmailThread
=
new
EmailThread
(
"热云数据用户行为分析套餐提醒"
,
accountContents
,
accountEmailList
);
accountEmailThread
.
start
();
}
catch
(
Exception
e
)
{
isNotifiedObject
.
setIoThirtyPercentNotified
(
false
);
isNotifiedRepository
.
save
(
isNotifiedObject
);
...
...
@@ -282,9 +304,12 @@ public class AccountFlowRestrictServiceImpl implements AccountFlowRestrictServic
isNotifiedRepository
.
save
(
isNotifiedObject
);
accountRestrict4Web
.
setIOFlowNotified
(
true
);
String
contents
=
companyOrEmail
+
"购买的"
+
packageType
.
getPackageName
()
+
"用户行为分析当月剩余流量不足"
+
ioRemainPercent1
+
",请尽快跟进。"
;
String
accountContents
=
"您订阅的用户行为分析"
+
packageType
.
getPackageName
()
+
"中本月剩余流量已不足"
+
ioRemainPercent1
+
",请关注您的套餐流量使用情况。"
;
try
{
Thread
emailThread
=
new
EmailThread
(
"用户行为分析产品流量提醒"
,
contents
,
emailList
);
emailThread
.
start
();
Thread
accountEmailThread
=
new
EmailThread
(
"热云数据用户行为分析套餐提醒"
,
accountContents
,
accountEmailList
);
accountEmailThread
.
start
();
}
catch
(
Exception
e
)
{
isNotifiedObject
.
setIoTwentyPercentNotified
(
false
);
isNotifiedRepository
.
save
(
isNotifiedObject
);
...
...
@@ -296,9 +321,12 @@ public class AccountFlowRestrictServiceImpl implements AccountFlowRestrictServic
isNotifiedRepository
.
save
(
isNotifiedObject
);
accountRestrict4Web
.
setIOFlowNotified
(
true
);
String
contents
=
companyOrEmail
+
"购买的"
+
packageType
.
getPackageName
()
+
"用户行为分析当月剩余流量不足"
+
ioRemainPercent1
+
",请尽快跟进。"
;
String
accountContents
=
"您订阅的用户行为分析"
+
packageType
.
getPackageName
()
+
"中本月剩余流量已不足"
+
ioRemainPercent1
+
",请关注您的套餐流量使用情况。"
;
try
{
Thread
emailThread
=
new
EmailThread
(
"用户行为分析产品流量提醒"
,
contents
,
emailList
);
emailThread
.
start
();
Thread
accountEmailThread
=
new
EmailThread
(
"热云数据用户行为分析套餐提醒"
,
accountContents
,
accountEmailList
);
accountEmailThread
.
start
();
}
catch
(
Exception
e
)
{
isNotifiedObject
.
setIoTenPercentNotified
(
false
);
isNotifiedRepository
.
save
(
isNotifiedObject
);
...
...
@@ -310,9 +338,12 @@ public class AccountFlowRestrictServiceImpl implements AccountFlowRestrictServic
isNotifiedRepository
.
save
(
isNotifiedObject
);
accountRestrict4Web
.
setIOFlowNotified
(
true
);
String
contents
=
companyOrEmail
+
"购买的"
+
packageType
.
getPackageName
()
+
"用户行为分析当月剩余流量不足"
+
ioRemainPercent1
+
",请尽快跟进。"
;
String
accountContents
=
"您订阅的用户行为分析"
+
packageType
.
getPackageName
()
+
"中本月剩余流量已不足"
+
ioRemainPercent1
+
",请关注您的套餐流量使用情况。"
;
try
{
Thread
emailThread
=
new
EmailThread
(
"用户行为分析产品流量提醒"
,
contents
,
emailList
);
emailThread
.
start
();
Thread
accountEmailThread
=
new
EmailThread
(
"热云数据用户行为分析套餐提醒"
,
accountContents
,
accountEmailList
);
accountEmailThread
.
start
();
}
catch
(
Exception
e
)
{
isNotifiedObject
.
setIoFivePercentNotified
(
false
);
isNotifiedRepository
.
save
(
isNotifiedObject
);
...
...
@@ -324,9 +355,12 @@ public class AccountFlowRestrictServiceImpl implements AccountFlowRestrictServic
isNotifiedRepository
.
save
(
isNotifiedObject
);
accountRestrict4Web
.
setIOFlowNotified
(
true
);
String
contents
=
companyOrEmail
+
"购买的"
+
packageType
.
getPackageName
()
+
"中用户行为分析当月流量已用尽,请尽快跟进。"
;
String
accountContents
=
"您订阅的用户行为分析"
+
packageType
.
getPackageName
()
+
"中本月事件数已经用完,本月超出部分将占用下周流量限额,最高使用量不超出5%。服务到期后我们将会继续支持您的数据上报和接收,但数据展示服务将暂时无法使用。请您预估下月的流量使用,如果产品统计需求增加,请联系商务升级您的套餐。"
;
try
{
Thread
emailThread
=
new
EmailThread
(
"用户行为分析产品流量提醒"
,
contents
,
emailList
);
emailThread
.
start
();
Thread
accountEmailThread
=
new
EmailThread
(
"热云数据用户行为分析套餐提醒"
,
accountContents
,
accountEmailList
);
accountEmailThread
.
start
();
}
catch
(
Exception
e
)
{
isNotifiedObject
.
setIoExhaustPercentNotified
(
false
);
isNotifiedRepository
.
save
(
isNotifiedObject
);
...
...
This diff is collapsed.
Click to expand it.
src/main/java/com/reyun/task/AutoCalculateFlow.java
View file @
058ccb56
...
...
@@ -3,11 +3,13 @@ package com.reyun.task;
import
com.reyun.model.Account
;
import
com.reyun.repository.AccountRepository
;
import
com.reyun.service.AccountFlowRestrictService
;
import
com.reyun.util.DateUtil
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.Date
;
import
java.util.List
;
/**
...
...
@@ -27,9 +29,16 @@ public class AutoCalculateFlow {
try
{
List
<
Account
>
superAccount
=
accountRepository
.
findSuperAccount
();
for
(
Account
account:
superAccount
){
//System.out.println("**********************************************\n\n");
accountFlowRestrictService
.
RestrictFlowByAccountTask
(
account
.
getId
());
//System.out.println("**********************************************\n\n");
String
pastDate1
=
account
.
getPastDate
();
String
pastDate5
=
DateUtil
.
getBeforeDays
(
pastDate1
,
-
5
);
Date
pastDate
=
DateUtil
.
parseDate
(
pastDate5
);
if
(
DateUtil
.
compareDate
(
pastDate
,
new
Date
())!=-
1
){
try
{
accountFlowRestrictService
.
RestrictFlowByAccountTask
(
account
.
getId
());
}
catch
(
Exception
e
){
logger
.
info
(
e
.
getMessage
());
}
}
}
}
catch
(
Exception
e
){
e
.
printStackTrace
();
...
...
This diff is collapsed.
Click to expand it.
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