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
f106616f
Commit
f106616f
authored
4 years ago
by
lzxry
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
流量同步
parent
ed285c85
master
…
0727_bugfix
1990_bugfix
2578_bugfix
2580_fix
bigfix_20201028
bugfix_1608_new
bugfix_1760
bugfix_master_1760
liushaowei
master_mv
mobvista_master
month_flow
No related merge requests found
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
284 additions
and
4 deletions
+284
-4
CalculationFlow.java
src/main/java/common/model/CalculationFlow.java
+79
-0
Contract.java
src/main/java/common/model/Contract.java
+1
-1
TkioFlow.java
src/main/java/common/model/TkioFlow.java
+60
-0
CalculationFlowRepository.java
...ain/java/common/repository/CalculationFlowRepository.java
+15
-0
ContractRepository.java
src/main/java/common/repository/ContractRepository.java
+6
-0
TkioFlowRepository.java
src/main/java/common/repository/TkioFlowRepository.java
+18
-0
ContractServiceImpl.java
src/main/java/common/service/impl/ContractServiceImpl.java
+93
-1
AccountTask.java
src/main/java/track/task/AccountTask.java
+0
-2
TrackingFlowTask.java
src/main/java/track/task/TrackingFlowTask.java
+0
-0
applicationContext-schedule.xml
src/main/resources/spring/applicationContext-schedule.xml
+12
-0
No files found.
src/main/java/common/model/CalculationFlow.java
0 → 100644
View file @
f106616f
package
common
.
model
;
import
javax.persistence.Entity
;
import
javax.persistence.GeneratedValue
;
import
javax.persistence.Id
;
/**
* @author liyin
* @description
* @date
*/
@Entity
public
class
CalculationFlow
{
private
Long
id
;
private
String
email
;
private
String
contractCode
;
private
String
triggerType
;
private
Boolean
isAll
;
private
Integer
status
;
private
String
createTime
;
@Id
@GeneratedValue
public
Long
getId
()
{
return
id
;
}
public
void
setId
(
Long
id
)
{
this
.
id
=
id
;
}
public
String
getEmail
()
{
return
email
;
}
public
void
setEmail
(
String
email
)
{
this
.
email
=
email
;
}
public
String
getContractCode
()
{
return
contractCode
;
}
public
void
setContractCode
(
String
contractCode
)
{
this
.
contractCode
=
contractCode
;
}
public
String
getTriggerType
()
{
return
triggerType
;
}
public
void
setTriggerType
(
String
triggerType
)
{
this
.
triggerType
=
triggerType
;
}
public
Integer
getStatus
()
{
return
status
;
}
public
void
setStatus
(
Integer
status
)
{
this
.
status
=
status
;
}
public
Boolean
getIsAll
()
{
return
isAll
;
}
public
void
setIsAll
(
Boolean
isAll
)
{
this
.
isAll
=
isAll
;
}
public
String
getCreateTime
()
{
return
createTime
;
}
public
void
setCreateTime
(
String
createTime
)
{
this
.
createTime
=
createTime
;
}
}
This diff is collapsed.
Click to expand it.
src/main/java/common/model/Contract.java
View file @
f106616f
...
@@ -94,7 +94,7 @@ public class Contract {
...
@@ -94,7 +94,7 @@ public class Contract {
private
String
barrioName
;
//行政区域名称
private
String
barrioName
;
//行政区域名称
private
String
belongGroup
;
//隶属集团
private
String
belongGroup
;
//隶属集团
private
Double
trackFlow
;
//流量,tkio的
private
Double
trackFlow
;
//流量,tkio的
,万单位
private
Double
unitPrice
;
//单价,tkio
private
Double
unitPrice
;
//单价,tkio
private
Double
clickFlow
;
//区间点击数,tkio
private
Double
clickFlow
;
//区间点击数,tkio
...
...
This diff is collapsed.
Click to expand it.
src/main/java/common/model/TkioFlow.java
0 → 100644
View file @
f106616f
package
common
.
model
;
import
javax.persistence.Entity
;
import
javax.persistence.Id
;
/**
* @author liyin
* @description
* @date
*/
@Entity
public
class
TkioFlow
{
@Id
private
String
ds
;
private
String
email
;
private
String
contractCode
;
private
Long
flow
;
private
Long
costFlow
;
public
String
getDs
()
{
return
ds
;
}
public
void
setDs
(
String
ds
)
{
this
.
ds
=
ds
;
}
public
String
getEmail
()
{
return
email
;
}
public
void
setEmail
(
String
email
)
{
this
.
email
=
email
;
}
public
String
getContractCode
()
{
return
contractCode
;
}
public
void
setContractCode
(
String
contractCode
)
{
this
.
contractCode
=
contractCode
;
}
public
Long
getFlow
()
{
return
flow
;
}
public
void
setFlow
(
Long
flow
)
{
this
.
flow
=
flow
;
}
public
Long
getCostFlow
()
{
return
costFlow
;
}
public
void
setCostFlow
(
Long
costFlow
)
{
this
.
costFlow
=
costFlow
;
}
}
This diff is collapsed.
Click to expand it.
src/main/java/common/repository/CalculationFlowRepository.java
0 → 100644
View file @
f106616f
package
common
.
repository
;
import
common.model.CalculationFlow
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.data.jpa.repository.Query
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.List
;
@Transactional
public
interface
CalculationFlowRepository
extends
JpaRepository
<
CalculationFlow
,
Long
>
{
@Query
(
value
=
"select * from calculation_flow where status = ?1"
,
nativeQuery
=
true
)
List
<
CalculationFlow
>
findByStatus
(
int
status
);
}
This diff is collapsed.
Click to expand it.
src/main/java/common/repository/ContractRepository.java
View file @
f106616f
...
@@ -122,4 +122,10 @@ public interface ContractRepository extends JpaRepository<Contract, Long> {
...
@@ -122,4 +122,10 @@ public interface ContractRepository extends JpaRepository<Contract, Long> {
@Query
(
value
=
"select * from contract where contract_code=?1 limit 1 "
,
nativeQuery
=
true
)
@Query
(
value
=
"select * from contract where contract_code=?1 limit 1 "
,
nativeQuery
=
true
)
Contract
checkByCode
(
String
code
);
Contract
checkByCode
(
String
code
);
@Query
(
value
=
"select distinct email from contract where platform = ?1"
,
nativeQuery
=
true
)
List
<
String
>
findDistinctEmailByPlatform
(
String
platform
);
@Query
(
value
=
"SELECT * from contract where platform = ?1 and email = ?2"
,
nativeQuery
=
true
)
List
<
Contract
>
findByPlatformAndEmail
(
String
platform
,
String
email
);
}
}
This diff is collapsed.
Click to expand it.
src/main/java/common/repository/TkioFlowRepository.java
0 → 100644
View file @
f106616f
package
common
.
repository
;
import
common.model.TkioFlow
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.data.jpa.repository.Modifying
;
import
org.springframework.data.jpa.repository.Query
;
import
org.springframework.transaction.annotation.Transactional
;
public
interface
TkioFlowRepository
extends
JpaRepository
<
TkioFlow
,
Long
>
{
@Query
(
value
=
"select sum(flow) from tkio_flow where email = ?1 and contract_code = ?2"
,
nativeQuery
=
true
)
Long
sumFlowByEmailAndContractCode
(
String
email
,
String
contractCode
);
@Transactional
@Modifying
@Query
(
value
=
"delete from tkio_flow where email = ?1"
,
nativeQuery
=
true
)
void
deleteByEmail
(
String
email
);
}
This diff is collapsed.
Click to expand it.
src/main/java/common/service/impl/ContractServiceImpl.java
View file @
f106616f
...
@@ -220,6 +220,9 @@ public class ContractServiceImpl implements ContractService {
...
@@ -220,6 +220,9 @@ public class ContractServiceImpl implements ContractService {
@Autowired
@Autowired
private
BarrioCityRepository
barrioCityRepository
;
private
BarrioCityRepository
barrioCityRepository
;
@Autowired
private
CalculationFlowRepository
calculationFlowRepository
;
@Override
@Override
public
Map
<
String
,
Object
>
checkAccount
(
String
email
,
String
platfrom
)
{
public
Map
<
String
,
Object
>
checkAccount
(
String
email
,
String
platfrom
)
{
...
@@ -564,11 +567,33 @@ public class ContractServiceImpl implements ContractService {
...
@@ -564,11 +567,33 @@ public class ContractServiceImpl implements ContractService {
//this.calculateShareIncome(resource);//判断是否计算调整金
//this.calculateShareIncome(resource);//判断是否计算调整金
//判断库里是否已有合同的主账号
if
(
"tkio"
.
equals
(
resource
.
getPlatform
())){
List
<
Contract
>
contracts
=
contractRepository
.
findByPlatformAndEmail
(
resource
.
getPlatform
(),
resource
.
getEmail
());
CalculationFlow
calculationFlow
=
new
CalculationFlow
();
calculationFlow
.
setEmail
(
resource
.
getEmail
());
calculationFlow
.
setContractCode
(
resource
.
getContractCode
());
calculationFlow
.
setStatus
(
0
);
calculationFlow
.
setTriggerType
(
"新建"
);
calculationFlow
.
setCreateTime
(
DateUtil
.
getCurrentDateStr
());
calculationFlow
.
setIsAll
(
false
);
if
(
contracts
==
null
||
contracts
.
size
()>
0
){
for
(
Contract
contract
:
contracts
)
{
if
(
intersection
(
contract
,
resource
)){
//有交集
calculationFlow
.
setIsAll
(
true
);
break
;
}
}
}
calculationFlowRepository
.
save
(
calculationFlow
);
}
resource
=
contractRepository
.
save
(
resource
);
resource
=
contractRepository
.
save
(
resource
);
this
.
saveContractRelations
(
resource
,
resource
.
getId
());
this
.
saveContractRelations
(
resource
,
resource
.
getId
());
List
<
String
>
codes
=
contractRepository
.
findContractBodyNames
(
resource
.
getCustomerBody
(),
resource
.
getContractCode
());
List
<
String
>
codes
=
contractRepository
.
findContractBodyNames
(
resource
.
getCustomerBody
(),
resource
.
getContractCode
());
if
(!
codes
.
isEmpty
())
{
if
(!
codes
.
isEmpty
())
{
// 合同编号已存在
// 合同编号已存在
...
@@ -866,9 +891,40 @@ public class ContractServiceImpl implements ContractService {
...
@@ -866,9 +891,40 @@ public class ContractServiceImpl implements ContractService {
resource
.
setId
(
contract
.
getId
());
resource
.
setId
(
contract
.
getId
());
//判断库里是否已有合同的主账号
if
(
"tkio"
.
equals
(
resource
.
getPlatform
())
&&
(
contract
.
getStartDate
()!=
resource
.
getStartDate
()&&
contract
.
getEndDate
()!=
resource
.
getEndDate
())){
List
<
Contract
>
contracts
=
contractRepository
.
findByPlatformAndEmail
(
resource
.
getPlatform
(),
resource
.
getEmail
());
CalculationFlow
calculationFlow
=
new
CalculationFlow
();
calculationFlow
.
setEmail
(
resource
.
getEmail
());
calculationFlow
.
setContractCode
(
resource
.
getContractCode
());
calculationFlow
.
setStatus
(
0
);
calculationFlow
.
setTriggerType
(
"编辑"
);
calculationFlow
.
setCreateTime
(
DateUtil
.
getCurrentDateStr
(
DateUtil
.
C_TIME_PATTON_DEFAULT
));
calculationFlow
.
setIsAll
(
false
);
if
(
contracts
==
null
||
contracts
.
size
()>
0
){
for
(
Contract
contract1
:
contracts
)
{
if
(
contract1
.
getId
()!=
contract
.
getId
()){
if
(
intersection
(
contract1
,
resource
)
||
intersection
(
contract1
,
contract
)){
//有交集
calculationFlow
.
setIsAll
(
true
);
break
;
}
}
}
}
calculationFlowRepository
.
save
(
calculationFlow
);
}
return
contractRepository
.
save
(
resource
);
return
contractRepository
.
save
(
resource
);
}
}
public
Boolean
intersection
(
Contract
contract1
,
Contract
contract2
){
return
(
DateUtil
.
getDate
(
contract1
.
getStartDate
()).
getTime
()<=
DateUtil
.
getDate
(
contract2
.
getStartDate
()).
getTime
()&&
DateUtil
.
getDate
(
contract1
.
getEndDate
()).
getTime
()>=
DateUtil
.
getDate
(
contract2
.
getStartDate
()).
getTime
()
)||
(
DateUtil
.
getDate
(
contract1
.
getStartDate
()).
getTime
()<=
DateUtil
.
getDate
(
contract2
.
getEndDate
()).
getTime
()&&
DateUtil
.
getDate
(
contract1
.
getEndDate
()).
getTime
()>=
DateUtil
.
getDate
(
contract2
.
getEndDate
()).
getTime
())
||
(
DateUtil
.
getDate
(
contract2
.
getStartDate
()).
getTime
()<=
DateUtil
.
getDate
(
contract1
.
getStartDate
()).
getTime
()&&
DateUtil
.
getDate
(
contract2
.
getEndDate
()).
getTime
()>=
DateUtil
.
getDate
(
contract1
.
getEndDate
()).
getTime
());
}
private
List
<
ChangeDelDetail
>
changeDelInfoForContract
(
Contract
byfind
,
Contract
resource
,
Long
pid
,
String
ip
)
{
private
List
<
ChangeDelDetail
>
changeDelInfoForContract
(
Contract
byfind
,
Contract
resource
,
Long
pid
,
String
ip
)
{
...
@@ -1679,6 +1735,28 @@ public class ContractServiceImpl implements ContractService {
...
@@ -1679,6 +1735,28 @@ public class ContractServiceImpl implements ContractService {
resource
.
setContent
(
ContractStatusEnum
.
SUSPEND
.
getValue
());
resource
.
setContent
(
ContractStatusEnum
.
SUSPEND
.
getValue
());
contract
.
setStatus
(
ContractStatusEnum
.
SUSPEND
.
getKey
());
contract
.
setStatus
(
ContractStatusEnum
.
SUSPEND
.
getKey
());
showTip
=
true
;
showTip
=
true
;
//判断库里是否已有合同的主账号
if
(
"tkio"
.
equals
(
resource
.
getPlatform
())){
List
<
Contract
>
contracts
=
contractRepository
.
findByPlatformAndEmail
(
resource
.
getPlatform
(),
resource
.
getEmail
());
CalculationFlow
calculationFlow
=
new
CalculationFlow
();
calculationFlow
.
setEmail
(
resource
.
getEmail
());
calculationFlow
.
setContractCode
(
resource
.
getContractCode
());
calculationFlow
.
setStatus
(
0
);
calculationFlow
.
setTriggerType
(
"终止"
);
calculationFlow
.
setCreateTime
(
DateUtil
.
getCurrentDateStr
());
calculationFlow
.
setIsAll
(
false
);
if
(
contracts
==
null
||
contracts
.
size
()>
0
){
for
(
Contract
contract1
:
contracts
)
{
if
(
contract1
.
getId
()!=
contract
.
getId
()){
if
(
intersection
(
contract1
,
contract
)){
//有交集
calculationFlow
.
setIsAll
(
true
);
break
;
}
}
}
}
calculationFlowRepository
.
save
(
calculationFlow
);
}
}
}
}
}
...
@@ -2321,6 +2399,7 @@ public class ContractServiceImpl implements ContractService {
...
@@ -2321,6 +2399,7 @@ public class ContractServiceImpl implements ContractService {
Map
<
String
,
String
>
codeUniqueDic
=
new
HashMap
<>();
Map
<
String
,
String
>
codeUniqueDic
=
new
HashMap
<>();
List
<
String
>
accountsEmail
=
new
ArrayList
<>();
List
<
String
>
accountsEmail
=
new
ArrayList
<>();
List
<
String
>
moreEmail
=
new
ArrayList
<>();
for
(
int
j
=
1
;
j
<=
rowNumber
;
j
++)
{
for
(
int
j
=
1
;
j
<=
rowNumber
;
j
++)
{
Row
row_data
=
sheet
.
getRow
(
j
);
Row
row_data
=
sheet
.
getRow
(
j
);
Object
[]
s_data
=
new
Object
[
titleKey
.
size
()
+
extend_size
];
Object
[]
s_data
=
new
Object
[
titleKey
.
size
()
+
extend_size
];
...
@@ -2434,6 +2513,9 @@ public class ContractServiceImpl implements ContractService {
...
@@ -2434,6 +2513,9 @@ public class ContractServiceImpl implements ContractService {
s_data
[
w
]
=
dataSTR
;
s_data
[
w
]
=
dataSTR
;
if
(
"email"
.
equals
(
sheetTitle
)
&&
!
StringUtils
.
isEmpty
(
dataSTR
)
&&
"tkio"
.
equals
(
platformexcl
))
{
if
(
"email"
.
equals
(
sheetTitle
)
&&
!
StringUtils
.
isEmpty
(
dataSTR
)
&&
"tkio"
.
equals
(
platformexcl
))
{
if
(!
accountsEmail
.
contains
(
dataSTR
.
trim
())){
moreEmail
.
add
(
dataSTR
.
trim
());
}
accountsEmail
.
add
(
dataSTR
.
trim
());
accountsEmail
.
add
(
dataSTR
.
trim
());
}
}
}
}
...
@@ -2509,7 +2591,17 @@ public class ContractServiceImpl implements ContractService {
...
@@ -2509,7 +2591,17 @@ public class ContractServiceImpl implements ContractService {
// TransactionStatus transactionStatus = transactionUtils.begin();
// TransactionStatus transactionStatus = transactionUtils.begin();
jdbcTemplate
.
batchUpdate
(
sql
.
toString
(),
args_data
);
jdbcTemplate
.
batchUpdate
(
sql
.
toString
(),
args_data
);
// transactionUtils.commit(transactionStatus);
// transactionUtils.commit(transactionStatus);
if
(
"tkio"
.
equals
(
platform
)){
for
(
String
email
:
moreEmail
)
{
CalculationFlow
calculationFlow
=
new
CalculationFlow
();
calculationFlow
.
setEmail
(
email
);
calculationFlow
.
setStatus
(
0
);
calculationFlow
.
setTriggerType
(
"导入"
);
calculationFlow
.
setCreateTime
(
DateUtil
.
getCurrentDateStr
());
calculationFlow
.
setIsAll
(
true
);
calculationFlowRepository
.
save
(
calculationFlow
);
}
}
return
ResultModel
.
OK
();
return
ResultModel
.
OK
();
}
}
...
...
This diff is collapsed.
Click to expand it.
src/main/java/track/task/AccountTask.java
View file @
f106616f
package
track
.
task
;
package
track
.
task
;
import
common.model.Account4Web
;
import
common.model.TrackAccount4Web
;
import
common.model.TrackAccount4Web
;
import
common.repository.TrackAccount4WebRepository
;
import
common.repository.TrackAccount4WebRepository
;
import
org.jsoup.helper.DataUtil
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
track.model.Account
;
import
track.model.Account
;
import
track.repository.TrackAccountRepository
;
import
track.repository.TrackAccountRepository
;
...
...
This diff is collapsed.
Click to expand it.
src/main/java/track/task/TrackingFlowTask.java
0 → 100644
View file @
f106616f
This diff is collapsed.
Click to expand it.
src/main/resources/spring/applicationContext-schedule.xml
View file @
f106616f
...
@@ -63,4 +63,16 @@
...
@@ -63,4 +63,16 @@
<!--<task:scheduled ref="accountTaskCheck" method="task" cron="0 10 8 * * ?"/>-->
<!--<task:scheduled ref="accountTaskCheck" method="task" cron="0 10 8 * * ?"/>-->
<!--</task:scheduled-tasks>-->
<!--</task:scheduled-tasks>-->
<bean
id=
"syncTrackingFlowTask"
class=
"track.task.TrackingFlowTask"
></bean>
<task:scheduled-tasks>
<!--定时同步昨日流量(每天10点执行一次)-->
<task:scheduled
ref=
"syncTrackingFlowTask"
method=
"task"
cron=
"* * 10 * * ?"
/>
</task:scheduled-tasks>
<bean
id=
"syncCalculationFlowTask"
class=
"track.task.TrackingFlowTask"
></bean>
<task:scheduled-tasks>
<!--定时同步流量(每7分钟执行一次)-->
<task:scheduled
ref=
"syncCalculationFlowTask"
method=
"syncFlow"
cron=
"* 0/7 * * * ? "
/>
</task:scheduled-tasks>
</beans>
</beans>
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