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
7d708f59
Commit
7d708f59
authored
Apr 02, 2018
by
carrieyzzhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
export
parent
cc658f18
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
119 additions
and
14 deletions
+119
-14
pom.xml
pom.xml
+15
-0
saasio.iml
saasio.iml
+5
-0
EventStatsController.java
src/main/java/com/reyun/controller/EventStatsController.java
+2
-2
FunnelController.java
src/main/java/com/reyun/controller/FunnelController.java
+1
-1
IntelligentPathController.java
.../java/com/reyun/controller/IntelligentPathController.java
+1
-1
RetentionController.java
src/main/java/com/reyun/controller/RetentionController.java
+2
-2
AccountFlowRestrictServiceImpl.java
...om/reyun/service/impl/AccountFlowRestrictServiceImpl.java
+1
-1
ExportReportTask.java
src/main/java/com/reyun/task/ExportReportTask.java
+75
-0
ExportReportThread.java
src/main/java/com/reyun/taskexecute/ExportReportThread.java
+0
-0
AwsS3Util.java
src/main/java/com/reyun/util/AwsS3Util.java
+2
-2
Constant.java
src/main/java/com/reyun/util/Constant.java
+7
-2
SendCommonPostMail.java
src/main/java/com/reyun/util/SendCommonPostMail.java
+2
-3
applicationContext-schedule.xml
src/main/resources/applicationContext-schedule.xml
+2
-0
common.properties
src/main/resources/common.properties
+1
-0
key.properties
src/main/resources/key.properties
+3
-0
No files found.
pom.xml
View file @
7d708f59
...
...
@@ -91,6 +91,11 @@
<account.check.url>
http://localhost:8091
</account.check.url>
<ddb.accesskey>
AKIAOS2UEXIFNVER2O6A
</ddb.accesskey>
<ddb.secretkey>
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
</ddb.secretkey>
<report.export.task>
ExportReportTask
</report.export.task>
</properties>
</profile>
<profile>
...
...
@@ -201,6 +206,11 @@
<account.check.url>
http://52.80.113.103:8006
</account.check.url>
<ddb.accesskey>
AKIAOS2UEXIFNVER2O6A
</ddb.accesskey>
<ddb.secretkey>
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
</ddb.secretkey>
<report.export.task>
ExportReportTask
</report.export.task>
</properties>
</profile>
...
...
@@ -271,6 +281,11 @@
<account.check.url>
http://io.reyun.com
</account.check.url>
<ddb.accesskey>
AKIAPMJ4QRXP6BECFUVQ
</ddb.accesskey>
<ddb.secretkey>
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
</ddb.secretkey>
<report.export.task>
ExportReportTask
</report.export.task>
</properties>
</profile>
</profiles>
...
...
saasio.iml
View file @
7d708f59
...
...
@@ -12,6 +12,11 @@
</webroots>
</configuration>
</facet>
<facet
type=
"Spring"
name=
"Spring"
>
<configuration>
<fileset
id=
"fileset"
name=
"Spring Application Context"
removed=
"false"
/>
</configuration>
</facet>
</component>
<component
name=
"NewModuleRootManager"
LANGUAGE_LEVEL=
"JDK_1_8"
inherit-compiler-output=
"false"
>
<output
url=
"file://$MODULE_DIR$/target/classes"
/>
...
...
src/main/java/com/reyun/controller/EventStatsController.java
View file @
7d708f59
...
...
@@ -43,7 +43,7 @@ public class EventStatsController {
if
(!
StringUtil
.
isEmpty
(
eventCondition
)
&&
!
StringUtil
.
isEmpty
(
startDate
)
&&
!
StringUtil
.
isEmpty
(
endDate
))
{
return
ResultModel
.
OK
(
complicateEventsService
.
queryComplicatedEvent
(
appId
,
account
.
getId
(),
startDate
,
endDate
,
eventCondition
,
viewFlag
,
1
));
eventCondition
,
viewFlag
,
Constant
.
iscache
));
}
else
{
return
ResultModel
.
ERROR
(
ResultStatus
.
PARAM_INVALID
);
...
...
@@ -64,7 +64,7 @@ public class EventStatsController {
if
(!
StringUtil
.
isEmpty
(
eventCondition
)
&&
!
StringUtil
.
isEmpty
(
startDate
)
&&
!
StringUtil
.
isEmpty
(
endDate
))
{
return
ResultModel
.
OK
(
complicateEventsService
.
queryDistinctTotalData
(
appId
,
account
.
getId
(),
startDate
,
endDate
,
eventCondition
,
viewFlag
,
Constant
.
i
a
cache
));
eventCondition
,
viewFlag
,
Constant
.
i
s
cache
));
}
else
{
return
ResultModel
.
ERROR
(
ResultStatus
.
PARAM_INVALID
);
...
...
src/main/java/com/reyun/controller/FunnelController.java
View file @
7d708f59
...
...
@@ -58,7 +58,7 @@ public class FunnelController {
isProfile
=
true
;
}
boolean
isDevice
=
StringUtil
.
isEmpty
(
isDeviceStr
)?
false
:
"true"
.
equals
(
isDeviceStr
)?
true
:
false
;
Map
<
String
,
List
>
result
=
funnelService
.
funnelReport
(
funnel
,
startDate
,
endDate
,
usergroupStr
,
isList
,
dimentionStr
,
loginAccount
,
isDevice
,
isProfile
,
Constant
.
i
a
cache
);
Map
<
String
,
List
>
result
=
funnelService
.
funnelReport
(
funnel
,
startDate
,
endDate
,
usergroupStr
,
isList
,
dimentionStr
,
loginAccount
,
isDevice
,
isProfile
,
Constant
.
i
s
cache
);
if
(
result
.
isEmpty
())
{
return
ResultModel
.
ERROR
(
ResultStatus
.
NETWORK_ERROR
);
...
...
src/main/java/com/reyun/controller/IntelligentPathController.java
View file @
7d708f59
...
...
@@ -75,6 +75,6 @@ public class IntelligentPathController {
intelligentPath
.
setUserGroup
(
Long
.
parseLong
(
userGroup
));
}
return
ResultModel
.
OK
(
intelligentPathService
.
queryIntelligentPath
(
loginAccount
,
intelligentPath
,
Constant
.
i
a
cache
));
return
ResultModel
.
OK
(
intelligentPathService
.
queryIntelligentPath
(
loginAccount
,
intelligentPath
,
Constant
.
i
s
cache
));
}
}
src/main/java/com/reyun/controller/RetentionController.java
View file @
7d708f59
...
...
@@ -86,7 +86,7 @@ public class RetentionController {
String
endDate
=
this
.
getEndDateByReportView
(
end
,
reportView
);
Map
<
String
,
List
>
result
=
retentionService
.
retentionDetailReport
(
loginAccount
,
startDate
,
endDate
,
isList
,
eventInfo
,
app
,
userGroupStr
,
dimensionStr
,
reportView
,
interval
,
isDevice
,
retentiontype
,
isProfile
,
Constant
.
i
a
cache
);
userGroupStr
,
dimensionStr
,
reportView
,
interval
,
isDevice
,
retentiontype
,
isProfile
,
Constant
.
i
s
cache
);
if
(
retentiontype
.
equals
(
"define"
))
{
userLogService
.
insertLog
(
loginAccount
,
LogEnumType
.
FIND
.
getCode
(),
LogEnumType
.
FIND
.
getName
()
+
"留存明细报表"
,
...
...
@@ -146,7 +146,7 @@ public class RetentionController {
Map
<
String
,
List
>
result
=
retentionService
.
retentionReport
(
startDate
,
endDate
,
isList
,
eventInfo
,
app
,
userGroupStr
,
dimensionStr
,
reportView
,
interval
,
isDevice
,
loginAccount
.
getId
(),
retentiontype
,
isProfile
,
Constant
.
ia
cache
);
dimensionStr
,
reportView
,
interval
,
isDevice
,
loginAccount
.
getId
(),
retentiontype
,
isProfile
,
Constant
.
is
cache
);
if
(
retentiontype
.
equals
(
"define"
))
{
userLogService
.
insertLog
(
loginAccount
,
LogEnumType
.
FIND
.
getCode
(),
LogEnumType
.
FIND
.
getName
()
+
"留存报表"
,
...
...
src/main/java/com/reyun/service/impl/AccountFlowRestrictServiceImpl.java
View file @
7d708f59
...
...
@@ -391,7 +391,7 @@ public class AccountFlowRestrictServiceImpl implements AccountFlowRestrictServic
conditions
.
put
(
"startdate"
,
createTime
);
conditions
.
put
(
"enddate"
,
pastDate
);
conditions
.
put
(
"datatype"
,
"list"
);
conditions
.
put
(
"iscache"
,
Constant
.
iscache
);
conditions
.
put
(
"iscache"
,
Constant
.
iscache
.
toString
()
);
String
url
=
Constant
.
reportUrl
+
"/api/trackingio/"
+
reportName
+
"/"
+
appId
;
String
responseJson
=
HttpClientUtil
.
doHttpPostRequest
(
url
,
"trackingio"
,
conditions
);
HashMap
<
String
,
String
>
resultValMap
=
new
HashMap
<>();
...
...
src/main/java/com/reyun/task/ExportReportTask.java
0 → 100644
View file @
7d708f59
package
com
.
reyun
.
task
;
import
com.reyun.dic.DownloadStatusEnumType
;
import
com.reyun.model.ExportReportInfo
;
import
com.reyun.service.ExportReportInfoService
;
import
com.reyun.taskexecute.ExportReportThread
;
import
com.reyun.util.AwsS3Util
;
import
com.reyun.util.Constant
;
import
com.reyun.util.RedisUtilNew
;
import
org.apache.commons.lang.time.DateUtils
;
import
org.joda.time.DateTime
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.List
;
/**
* Created by zxy on 17/4/27.
* description:报表导出
*/
@Service
public
class
ExportReportTask
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
ExportReportTask
.
class
);
private
static
int
EXPIRE_PERIOD
=
(
int
)
DateUtils
.
MILLIS_PER_MINUTE
*
1
/
1000
;
private
static
final
String
S3_DOWNLOAD_BUCKET
=
"reyundownload-test"
;
private
static
final
String
DOWNLOAD_PATH
=
"trackingio/reportdownload/"
;
@Autowired
private
ExportReportInfoService
exportService
;
public
void
run
(){
logger
.
info
(
"导出报表结果数据................//Begin, 执行时间: {}"
,
DateTime
.
now
());
if
(
RedisUtilNew
.
getInstance
().
tryLock
(
Constant
.
reportExportTask
,
EXPIRE_PERIOD
)
!=
null
)
{
//生成数据
List
<
ExportReportInfo
>
exportList
=
exportService
.
findExport2Deal
();
for
(
ExportReportInfo
export
:
exportList
)
{
logger
.
info
(
export
.
getFileName
());
Thread
exportReportThread
=
new
ExportReportThread
(
export
);
exportReportThread
.
start
();
}
//删除已过期文件
List
<
ExportReportInfo
>
invalidExportInfoList
=
exportService
.
findInvalidExportList
();
for
(
ExportReportInfo
invalidExport
:
invalidExportInfoList
)
{
final
String
s3key
=
DOWNLOAD_PATH
+
invalidExport
.
getFileName
();
//删除文件
if
(
AwsS3Util
.
getInstance
().
getAmazonS3
().
doesObjectExist
(
S3_DOWNLOAD_BUCKET
,
s3key
))
{
AwsS3Util
.
getInstance
().
deleteS3Object
(
S3_DOWNLOAD_BUCKET
,
s3key
);
}
//跟新文件为失效状态
exportService
.
updateStatus
(
invalidExport
.
getId
(),
DownloadStatusEnumType
.
INVALID
.
getCode
());
}
}
else
{
logger
.
info
(
"ExportReportTask正在执行中......"
);
}
logger
.
info
(
"导出报表结果数据................//End"
);
}
}
src/main/java/com/reyun/taskexecute/ExportReportThread.java
0 → 100644
View file @
7d708f59
This diff is collapsed.
Click to expand it.
src/main/java/com/reyun/util/AwsS3Util.java
View file @
7d708f59
...
...
@@ -24,8 +24,8 @@ public class AwsS3Util {
private
AmazonS3
s3
;
private
AwsS3Util
()
{
String
accessKey
=
""
;
String
secretKey
=
""
;
String
accessKey
=
Constant
.
accessKey
;
String
secretKey
=
Constant
.
secretKey
;
if
((
accessKey
!=
null
)
&&
(
secretKey
!=
null
))
{
AWSCredentials
credentials
=
new
BasicAWSCredentials
(
accessKey
,
secretKey
);
...
...
src/main/java/com/reyun/util/Constant.java
View file @
7d708f59
...
...
@@ -35,11 +35,11 @@ public class Constant {
public
static
String
reportUrl
=
commonBundle
.
getString
(
"report.url"
);
public
static
String
adminUrl
=
commonBundle
.
getString
(
"admin.url"
);
public
static
String
trackingUrl
=
commonBundle
.
getString
(
"trackingio.url"
);
public
static
String
iscache
=
commonBundle
.
getString
(
"iscache"
);
public
static
String
receiverHost
=
commonBundle
.
getString
(
"receiver.host"
);
public
static
String
receiverPort
=
commonBundle
.
getString
(
"receiver.port"
);
public
static
String
demoUrl
=
commonBundle
.
getString
(
"demo.url"
);
public
static
String
flowneed
=
commonBundle
.
getString
(
"flowneed"
);
public
static
String
reportExportTask
=
commonBundle
.
getString
(
"report.export.task"
);
...
...
@@ -56,5 +56,10 @@ public class Constant {
public
static
ResourceBundle
redis
=
ResourceBundle
.
getBundle
(
"redis"
);
public
static
String
REDIS_IP_REQUEST_TIMES
=
redis
.
getString
(
"redis.ip.requesttimes"
);
public
static
long
cacheLiveTime
=
Long
.
parseLong
(
redis
.
getString
(
"cache.livetime"
));
public
static
Integer
iacache
=
Integer
.
parseInt
(
redis
.
getString
(
"iscache"
));
public
static
Integer
iscache
=
Integer
.
parseInt
(
redis
.
getString
(
"iscache"
));
public
static
ResourceBundle
keyBuddle
=
ResourceBundle
.
getBundle
(
"key"
);
public
static
String
accessKey
=
keyBuddle
.
getString
(
"ddb.accesskey"
);
public
static
String
secretKey
=
keyBuddle
.
getString
(
"ddb.secretkey"
);
}
src/main/java/com/reyun/util/SendCommonPostMail.java
View file @
7d708f59
...
...
@@ -17,7 +17,6 @@ import java.util.List;
public
class
SendCommonPostMail
{
protected
static
Logger
logger
=
LoggerFactory
.
getLogger
(
SendCommonPostMail
.
class
);
static
String
url
=
"http://api.sendcloud.net/apiv2/mail/send"
;
static
String
apiUser
=
"service24h"
;
...
...
@@ -56,11 +55,11 @@ public class SendCommonPostMail {
String
result
=
EntityUtils
.
toString
(
response
.
getEntity
());
success
=
true
;
}
else
{
logger
.
error
(
"sendcloud response status is error......."
);
System
.
out
.
println
(
"sendcloud response status is error......."
);
}
httPost
.
releaseConnection
();
}
catch
(
Exception
e
)
{
logger
.
error
(
"fail to send mail to "
+
toEmail
);
System
.
out
.
println
(
"fail to send mail to "
+
toEmail
);
}
return
success
;
}
...
...
src/main/resources/applicationContext-schedule.xml
View file @
7d708f59
...
...
@@ -10,8 +10,10 @@
<description>
调度配置
</description>
<bean
id=
"autoCalculateFlow"
class=
"com.reyun.task.AutoCalculateFlow"
></bean>
<!--<bean id="exportReportTask" class="com.reyun.task.ExportReportTask"></bean>-->
<task:scheduled-tasks>
<task:scheduled
ref=
"autoCalculateFlow"
method=
"run"
cron=
"0 0 7 * * ?"
/>
<!--<task:scheduled ref="exportReportTask" method="run" cron="0 */2 * * * ?"/>-->
</task:scheduled-tasks>
</beans>
src/main/resources/common.properties
View file @
7d708f59
...
...
@@ -2,6 +2,7 @@ profile.table=${profile.table}
event.table
=
${event.table}
usergroup.table
=
${usergroup.table}
account.check.url
=
${account.check.url}
report.export.task
=
${report.export.task}
receiver.host
=
${receiver.host}
receiver.port
=
${receiver.port}
...
...
src/main/resources/key.properties
0 → 100644
View file @
7d708f59
# Redis common settings
ddb.accesskey
=
${ddb.accesskey}
ddb.secretkey
=
${ddb.secretkey}
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