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
7498d5be
Commit
7498d5be
authored
Nov 04, 2020
by
liushaowei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1758需求:TKIO合同导入主账号为空时全部收入计算在合同截止日期
parent
a96649e9
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
50 additions
and
15 deletions
+50
-15
pom.xml
pom.xml
+2
-2
ContractRepository.java
src/main/java/common/repository/ContractRepository.java
+4
-0
ContractServiceImpl.java
src/main/java/common/service/impl/ContractServiceImpl.java
+20
-8
ShareIncomeServiceImpl.java
...main/java/common/service/impl/ShareIncomeServiceImpl.java
+21
-2
DateUtil.java
src/main/java/util/DateUtil.java
+3
-3
No files found.
pom.xml
View file @
7498d5be
...
@@ -156,10 +156,10 @@
...
@@ -156,10 +156,10 @@
<redis.ip.requesttimes>
5
</redis.ip.requesttimes>
<redis.ip.requesttimes>
5
</redis.ip.requesttimes>
<redis.ip.unknown.requesttimes>
5
</redis.ip.unknown.requesttimes>
<redis.ip.unknown.requesttimes>
5
</redis.ip.unknown.requesttimes>
<redis.surl.host>
10.3.20.33
</redis.surl.host>
<redis.surl.host>
localhost
</redis.surl.host>
<redis.surl.port>
6379
</redis.surl.port>
<redis.surl.port>
6379
</redis.surl.port>
<redis.event.host>
10.3.20.33
</redis.event.host>
<redis.event.host>
localhost
</redis.event.host>
<redis.event.port>
6379
</redis.event.port>
<redis.event.port>
6379
</redis.event.port>
<redis.event.database>
13
</redis.event.database>
<redis.event.database>
13
</redis.event.database>
<!--Redis setting//end-->
<!--Redis setting//end-->
...
...
src/main/java/common/repository/ContractRepository.java
View file @
7498d5be
...
@@ -128,4 +128,8 @@ public interface ContractRepository extends JpaRepository<Contract, Long> {
...
@@ -128,4 +128,8 @@ public interface ContractRepository extends JpaRepository<Contract, Long> {
@Query
(
value
=
"SELECT * from contract where platform = ?1 and email = ?2"
,
nativeQuery
=
true
)
@Query
(
value
=
"SELECT * from contract where platform = ?1 and email = ?2"
,
nativeQuery
=
true
)
List
<
Contract
>
findByPlatformAndEmail
(
String
platform
,
String
email
);
List
<
Contract
>
findByPlatformAndEmail
(
String
platform
,
String
email
);
@Query
(
value
=
"select id from contract where (email is null or email='') and ( end_date >= ?1 and end_date <= ?2 )"
,
nativeQuery
=
true
)
List
<
Long
>
findAllEmailIsNull
(
String
startDate
,
String
endDate
);
}
}
src/main/java/common/service/impl/ContractServiceImpl.java
View file @
7498d5be
...
@@ -1466,6 +1466,7 @@ public class ContractServiceImpl implements ContractService {
...
@@ -1466,6 +1466,7 @@ public class ContractServiceImpl implements ContractService {
result
.
add
(
c
);
result
.
add
(
c
);
}
}
}
}
return
result
;
return
result
;
}
}
...
@@ -2427,8 +2428,16 @@ public class ContractServiceImpl implements ContractService {
...
@@ -2427,8 +2428,16 @@ public class ContractServiceImpl implements ContractService {
Cell
cell
=
row_data
.
getCell
(
w
);
Cell
cell
=
row_data
.
getCell
(
w
);
int
line_num
=
j
+
1
;
int
line_num
=
j
+
1
;
if
(
null
==
cell
||
cell
.
getCellTypeEnum
().
equals
(
CellType
.
BLANK
))
{
if
(
null
==
cell
||
cell
.
getCellTypeEnum
().
equals
(
CellType
.
BLANK
))
{
return
ResultModel
.
ERROR
(
"第"
+
line_num
+
"行【"
+
//主账号为空,额外处理
SHEET_TITLE_RESERVE
.
get
(
sheetTitle
)
+
"】不能为空,请重新上传"
);
if
(
"email"
.
equals
(
sheetTitle
)
&&
"tkio"
.
equals
(
platformexcl
))
{
String
dataSTR
=
formatter
.
formatCellValue
(
cell
).
trim
();
s_data
[
w
]
=
dataSTR
;
moreEmail
.
add
(
dataSTR
.
trim
());
accountsEmail
.
add
(
dataSTR
.
trim
());
}
else
{
//非主账号 按照之前逻辑不变
return
ResultModel
.
ERROR
(
"第"
+
line_num
+
"行【"
+
SHEET_TITLE_RESERVE
.
get
(
sheetTitle
)
+
"】不能为空,请重新上传"
);
}
}
else
{
}
else
{
String
dataSTR
=
formatter
.
formatCellValue
(
cell
).
trim
();
String
dataSTR
=
formatter
.
formatCellValue
(
cell
).
trim
();
//校验合同编号
//校验合同编号
...
@@ -2436,14 +2445,12 @@ public class ContractServiceImpl implements ContractService {
...
@@ -2436,14 +2445,12 @@ public class ContractServiceImpl implements ContractService {
if
(!
codeUniqueDic
.
containsKey
(
dataSTR
))
{
if
(!
codeUniqueDic
.
containsKey
(
dataSTR
))
{
codeUniqueDic
.
put
(
dataSTR
,
"1"
);
codeUniqueDic
.
put
(
dataSTR
,
"1"
);
}
else
{
}
else
{
return
ResultModel
.
ERROR
(
ResultStatus
.
CCODE_EXITS
.
getCode
(),
return
ResultModel
.
ERROR
(
ResultStatus
.
CCODE_EXITS
.
getCode
(),
"合同编号【"
+
dataSTR
+
"】已存在,请重新上传"
);
"合同编号【"
+
dataSTR
+
"】已存在,请重新上传"
);
}
}
Contract
contractExist
=
contractRepository
.
checkByCode
(
dataSTR
);
Contract
contractExist
=
contractRepository
.
checkByCode
(
dataSTR
);
if
(
contractExist
!=
null
)
{
if
(
contractExist
!=
null
)
{
return
ResultModel
.
ERROR
(
ResultStatus
.
CCODE_EXITS
.
getCode
(),
return
ResultModel
.
ERROR
(
ResultStatus
.
CCODE_EXITS
.
getCode
(),
"合同编号【"
+
dataSTR
+
"】已存在,请重新上传"
);
"合同编号【"
+
dataSTR
+
"】已存在,请重新上传"
);
}
}
}
}
...
@@ -2523,8 +2530,8 @@ public class ContractServiceImpl implements ContractService {
...
@@ -2523,8 +2530,8 @@ public class ContractServiceImpl implements ContractService {
return
ResultModel
.
ERROR
(
"第"
+
line_num
+
"行【行政区域】code错误"
);
return
ResultModel
.
ERROR
(
"第"
+
line_num
+
"行【行政区域】code错误"
);
}
}
}
else
{
}
else
{
//主账号不为空,按照之前逻辑不变
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
()))
{
if
(!
accountsEmail
.
contains
(
dataSTR
.
trim
()))
{
moreEmail
.
add
(
dataSTR
.
trim
());
moreEmail
.
add
(
dataSTR
.
trim
());
...
@@ -2557,17 +2564,22 @@ public class ContractServiceImpl implements ContractService {
...
@@ -2557,17 +2564,22 @@ public class ContractServiceImpl implements ContractService {
for
(
int
i
=
0
;
i
<
accountsEmail
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
accountsEmail
.
size
();
i
++)
{
String
e
=
accountsEmail
.
get
(
i
);
String
e
=
accountsEmail
.
get
(
i
);
if
(
"tkio"
.
equals
(
platformexcl
)
&&
""
.
equals
(
e
))
{
// tiko允许主账号email是空
}
else
{
//按照之前逻辑
if
(!
emailDic
.
containsKey
(
e
))
{
if
(!
emailDic
.
containsKey
(
e
))
{
return
ResultModel
.
ERROR
(
"第"
+
(
i
+
1
)
+
"行 客户主账号【"
+
e
+
"】在Office运营后台未找到,请重新上传"
);
return
ResultModel
.
ERROR
(
"第"
+
(
i
+
1
)
+
"行 客户主账号【"
+
e
+
"】在Office运营后台未找到,请重新上传"
);
}
}
}
}
}
}
}
//platform,product,my_body_code,create_time,code_num,type,status,back_status,ds,
//platform,product,my_body_code,create_time,code_num,type,status,back_status,ds,
s_data
[
row_already
]
=
platform
;
s_data
[
row_already
]
=
platform
;
s_data
[
row_already
+
1
]
=
"tkio"
.
equals
(
platform
)
?
"trackingio"
:
platform
;
s_data
[
row_already
+
1
]
=
"tkio"
.
equals
(
platform
)
?
"trackingio"
:
platform
;
s_data
[
row_already
+
2
]
=
bodyCode
;
s_data
[
row_already
+
2
]
=
bodyCode
;
s_data
[
row_already
+
3
]
=
createTime
;
s_data
[
row_already
+
3
]
=
DateUtil
.
getCurrentDateStr
()
;
s_data
[
row_already
+
4
]
=
0
;
s_data
[
row_already
+
4
]
=
0
;
s_data
[
row_already
+
5
]
=
"main"
;
s_data
[
row_already
+
5
]
=
"main"
;
s_data
[
row_already
+
6
]
=
ContractStatusEnum
.
NFORMAL
.
getKey
();
//常规合同
s_data
[
row_already
+
6
]
=
ContractStatusEnum
.
NFORMAL
.
getKey
();
//常规合同
...
...
src/main/java/common/service/impl/ShareIncomeServiceImpl.java
View file @
7498d5be
...
@@ -22,6 +22,7 @@ import tkio.repository.AppRepository;
...
@@ -22,6 +22,7 @@ import tkio.repository.AppRepository;
import
tkio.service.AccountFlowRestrictService
;
import
tkio.service.AccountFlowRestrictService
;
import
util.ContractBranchUtil
;
import
util.ContractBranchUtil
;
import
util.DateUtil
;
import
util.DateUtil
;
import
util.StringUtil
;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.math.BigInteger
;
import
java.math.BigInteger
;
...
@@ -152,6 +153,25 @@ public class ShareIncomeServiceImpl implements ShareIncomeService {
...
@@ -152,6 +153,25 @@ public class ShareIncomeServiceImpl implements ShareIncomeService {
}
}
logger
.
info
(
"计算分摊收入耗时:{}"
,
(
System
.
currentTimeMillis
()
-
start_
));
logger
.
info
(
"计算分摊收入耗时:{}"
,
(
System
.
currentTimeMillis
()
-
start_
));
//结果集result二次加工
if
(
"tkio"
.
equals
(
platform
))
{
//查询主账号为空的 并且 结束日期在查询范围内的
List
<
Long
>
allEmailIsNullIds
=
contractRepository
.
findAllEmailIsNull
(
startDate
,
endDate
);
for
(
Contract
contract
:
contracts
){
if
(
StringUtil
.
isEmpty
(
contract
.
getEmail
())){
//不在查询范围内的数据,全部置空
if
(
allEmailIsNullIds
==
null
||
!
allEmailIsNullIds
.
contains
(
BigInteger
.
valueOf
(
contract
.
getId
())))
{
contract
.
setClickFlow
(
0
D
);
//区间点击数(万次)
contract
.
setIntervaIncomeShare
(
0L
);
//区间分摊收入
contract
.
setAdjustmentFund
(
0L
);
//区间调整金额
contract
.
setIncomeShareAll
(
0L
);
//区间总收入
contract
.
setIncomeGross
(
0L
);
//累计总收入(元)
}
}
}
}
return
contracts
;
return
contracts
;
}
}
...
@@ -173,8 +193,7 @@ public class ShareIncomeServiceImpl implements ShareIncomeService {
...
@@ -173,8 +193,7 @@ public class ShareIncomeServiceImpl implements ShareIncomeService {
contract
.
setIncomeExcludingTax
(
excludTax
);
contract
.
setIncomeExcludingTax
(
excludTax
);
//计算单价,精准保留16位数
//计算单价,精准保留16位数
BigDecimal
unitPriceAccurate
=
new
BigDecimal
(
contract
.
getMoney
()/
1.06
/
contract
.
getTrackFlow
())
BigDecimal
unitPriceAccurate
=
new
BigDecimal
(
contract
.
getMoney
()/
1.06
/
contract
.
getTrackFlow
()).
setScale
(
16
,
BigDecimal
.
ROUND_HALF_UP
);
.
setScale
(
16
,
BigDecimal
.
ROUND_HALF_UP
);
//四舍五入单价
//四舍五入单价
double
unitPrice
=
unitPriceAccurate
.
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
).
doubleValue
();
double
unitPrice
=
unitPriceAccurate
.
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
).
doubleValue
();
//不限量套餐会在方法里面重新赋值单价
//不限量套餐会在方法里面重新赋值单价
...
...
src/main/java/util/DateUtil.java
View file @
7498d5be
...
@@ -63,7 +63,7 @@ public class DateUtil {
...
@@ -63,7 +63,7 @@ public class DateUtil {
Calendar
cal
=
Calendar
.
getInstance
();
Calendar
cal
=
Calendar
.
getInstance
();
Date
currDate
=
cal
.
getTime
();
Date
currDate
=
cal
.
getTime
();
return
format
(
currDate
);
return
format
(
currDate
,
C_TIME_PATTON_DEFAULT
);
}
}
/**
/**
...
@@ -1518,8 +1518,8 @@ public class DateUtil {
...
@@ -1518,8 +1518,8 @@ public class DateUtil {
//
//
// String newdate = DateUtil.format(date,DateUtil.C_TIME_PATTON_DEFAULT);
// String newdate = DateUtil.format(date,DateUtil.C_TIME_PATTON_DEFAULT);
// System.out.println(newdate);
// System.out.println(newdate);
System
.
out
.
print
(
DateUtil
.
getBeforeDays
(
"2017-03-31"
,-
70
));
//
System.out.print(DateUtil.getBeforeDays("2017-03-31",-70));
System
.
out
.
println
(
DateUtil
.
getCurrentDateStr
());
}
}
}
}
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