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
def3298a
Commit
def3298a
authored
Jan 08, 2021
by
lzxry
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CAS
parent
bebfec0c
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
419 additions
and
25 deletions
+419
-25
pom.xml
pom.xml
+3
-0
ADIUser.java
src/main/java/adi/model/ADIUser.java
+28
-0
ADIAccountServiceImpl.java
src/main/java/adi/service/impl/ADIAccountServiceImpl.java
+19
-17
ContractController.java
src/main/java/common/controller/ContractController.java
+60
-5
Contract.java
src/main/java/common/model/Contract.java
+32
-0
ContractServiceImpl.java
src/main/java/common/service/impl/ContractServiceImpl.java
+6
-3
ShareIncomeServiceImpl.java
...main/java/common/service/impl/ShareIncomeServiceImpl.java
+268
-0
Constant.java
src/main/java/util/Constant.java
+1
-0
ContractBranchUtil.java
src/main/java/util/ContractBranchUtil.java
+1
-0
common.properties
src/main/resources/common.properties
+1
-0
No files found.
pom.xml
View file @
def3298a
...
...
@@ -89,6 +89,7 @@
<report.url>
http://10.3.20.41:9010
</report.url>
<import.temp.url>
http://10.3.20.41:9001
</import.temp.url>
<adi.url>
http://39.104.114.198
</adi.url>
<!--Redis setting-->
<redis.key.validtime>
120
</redis.key.validtime>
...
...
@@ -162,6 +163,7 @@
<!--<report.url>http://localhost:9010</report.url>-->
<report.url>
http://10.3.20.41:9010
</report.url>
<import.temp.url>
http://10.3.20.41:9001
</import.temp.url>
<adi.url>
http://39.104.114.198
</adi.url>
<contract.uppath></contract.uppath>
<!--Redis setting-->
<redis.key.validtime>
120
</redis.key.validtime>
...
...
@@ -260,6 +262,7 @@
<report.url>
http://internal-report-api-976419027.cn-north-1.elb.amazonaws.com.cn
</report.url>
<import.temp.url>
http://172.31.25.137:9001
</import.temp.url>
<adi.url>
http://www.adinsights.cn
</adi.url>
<!--Redis setting-->
<redis.key.validtime>
120
</redis.key.validtime>
<redis.ip.requesttimes>
5
</redis.ip.requesttimes>
...
...
src/main/java/adi/model/ADIUser.java
View file @
def3298a
...
...
@@ -48,6 +48,10 @@ public class ADIUser implements Serializable{
private
String
pastDate
;
private
Boolean
sitOn
=
false
;
//是否坐席
private
Boolean
useStatus
=
true
;
//坐席启用
private
String
accountStatus
;
private
String
sendStatus
;
private
String
sendTime
;
public
Boolean
getSitOn
()
{
return
sitOn
;
...
...
@@ -365,6 +369,30 @@ public class ADIUser implements Serializable{
this
.
constractStartTime
=
constractStartTime
;
}
public
String
getAccountStatus
()
{
return
accountStatus
;
}
public
void
setAccountStatus
(
String
accountStatus
)
{
this
.
accountStatus
=
accountStatus
;
}
public
String
getSendStatus
()
{
return
sendStatus
;
}
public
void
setSendStatus
(
String
sendStatus
)
{
this
.
sendStatus
=
sendStatus
;
}
public
String
getSendTime
()
{
return
sendTime
;
}
public
void
setSendTime
(
String
sendTime
)
{
this
.
sendTime
=
sendTime
;
}
@Override
public
String
toString
()
{
return
"ADIUser{"
+
...
...
src/main/java/adi/service/impl/ADIAccountServiceImpl.java
View file @
def3298a
...
...
@@ -22,9 +22,11 @@ import org.json.JSONException;
import
org.json.JSONObject
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.StringUtils
;
import
tkio.model.PackageType
;
import
userio.repository.IOPackageTypeRepository
;
import
userio.repository.IOSalesManLeaderRepository
;
import
util.Constant
;
import
util.DateUtil
;
import
util.HttpClientUtil
;
import
util.ValidateUtil
;
...
...
@@ -70,7 +72,6 @@ public class ADIAccountServiceImpl implements ADIAccountService {
ReminderLevelRepository
reminderLevelRepository
;
@Autowired
PressMoneyRepository
pressMoneyRepository
;
private
static
String
u
=
"http://www.adinsights.cn/"
;
@Override
public
Map
<
String
,
Object
>
findSale
(
User
user
,
Long
sale
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
();
...
...
@@ -135,7 +136,7 @@ public class ADIAccountServiceImpl implements ADIAccountService {
ADIUser
adiUser
=
findOne
(
contract
.
getEmail
());
if
(
null
!=
adiUser
){
String
url
=
u
+
"adi/api/user/web/update"
;
String
url
=
Constant
.
adiUrl
+
"adi/api/user/web/update"
;
Map
<
String
,
String
>
conditions
=
new
HashMap
<>();
conditions
.
put
(
"expriedTime"
,
contract
.
getEndDate
()
+
" 00:00:00"
);
conditions
.
put
(
"constractStartTime"
,
contract
.
getStartDate
()
+
" 00:00:00"
);
...
...
@@ -154,7 +155,7 @@ public class ADIAccountServiceImpl implements ADIAccountService {
private
List
<
ADIUser
>
getAllAccount
()
throws
JSONException
{
List
<
ADIUser
>
list
=
new
ArrayList
<>();
String
url
=
u
+
"adi/api/user/web/list"
;
String
url
=
Constant
.
adiUrl
+
"adi/api/user/web/list"
;
Map
<
String
,
String
>
conditions
=
new
HashMap
<>();
conditions
.
put
(
"type"
,
""
);
conditions
.
put
(
"status"
,
""
);
...
...
@@ -319,21 +320,22 @@ public class ADIAccountServiceImpl implements ADIAccountService {
}
@Override
public
ADIUser
findOne
(
String
email
)
{
String
url
=
u
+
"adi/api/user/web/one"
;
Map
<
String
,
String
>
conditions
=
new
HashMap
<>();
conditions
.
put
(
"field"
,
"email"
);
conditions
.
put
(
"value"
,
email
);
String
request
=
HttpClientUtil
.
doHttpPostRequest
(
url
,
""
,
conditions
,
"utf-8"
);
String
url
=
Constant
.
adiUrl
+
"/adi/api/user/web/one?email="
+
email
;
String
request
=
HttpClientUtil
.
doHttpGetRequest
(
url
,
""
);
ADIUser
adiUser
=
null
;
try
{
JSONObject
rs
=
new
JSONObject
(
request
);
String
content
=
rs
.
get
(
"content"
).
toString
();
if
(!
"null"
.
equals
(
content
)){
try
{
adiUser
=
new
ObjectMapper
().
readValue
(
content
,
ADIUser
.
class
);
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
if
(!
StringUtils
.
isEmpty
(
content
)){
JSONArray
jsonArray
=
new
JSONArray
(
content
);
JSONObject
jsonObject
=
jsonArray
.
getJSONObject
(
0
);
adiUser
=
new
ADIUser
();
adiUser
.
setCompany
(
jsonObject
.
getString
(
"company"
));
adiUser
.
setAccountStatus
(
jsonObject
.
getString
(
"accountStatus"
));
adiUser
.
setSendStatus
(
jsonObject
.
getString
(
"sendStatus"
));
adiUser
.
setEmail
(
jsonObject
.
getString
(
"email"
));
adiUser
.
setSendTime
(
jsonObject
.
getString
(
"sendTime"
));
//adiUser = new ObjectMapper().readValue(content, ADIUser.class);
}
}
catch
(
JSONException
e
)
{
e
.
printStackTrace
();
...
...
@@ -368,7 +370,7 @@ public class ADIAccountServiceImpl implements ADIAccountService {
contract
.
setStatus
(
"executing"
);
contractRepository
.
save
(
contract
);
}
String
url
=
u
+
"adi/api/user/web/update"
;
String
url
=
Constant
.
adiUrl
+
"adi/api/user/web/update"
;
Map
<
String
,
String
>
conditions
=
new
HashMap
<>();
conditions
.
put
(
"expriedTime"
,
null
);
conditions
.
put
(
"constractStartTime"
,
null
);
...
...
@@ -406,7 +408,7 @@ public class ADIAccountServiceImpl implements ADIAccountService {
contractRepository
.
save
(
contract
);
}
String
url
=
u
+
"adi/api/user/web/update"
;
String
url
=
Constant
.
adiUrl
+
"adi/api/user/web/update"
;
Map
<
String
,
String
>
conditions
=
new
HashMap
<>();
conditions
.
put
(
"expriedTime"
,
null
);
conditions
.
put
(
"constractStartTime"
,
null
);
...
...
@@ -545,7 +547,7 @@ public class ADIAccountServiceImpl implements ADIAccountService {
}
public
static
void
main
(
String
[]
args
)
{
String
url
=
u
+
"adi/api/user/web/one"
;
String
url
=
Constant
.
adiUrl
+
"adi/api/user/web/one"
;
Map
<
String
,
String
>
conditions
=
new
HashMap
<>();
conditions
.
put
(
"field"
,
"email"
);
conditions
.
put
(
"value"
,
"zhangshaoyou@reyun.com"
);
...
...
src/main/java/common/controller/ContractController.java
View file @
def3298a
...
...
@@ -137,6 +137,9 @@ public class ContractController {
if
(
platform
.
equals
(
"tkio"
)){
title
=
Arrays
.
asList
(
"录入时间,合同编号,客户账号,我方签约主体,签约方,行政区域,隶属集团,行业分类,销售,开始日期,结束日期,套餐类型,合同流量(万次),赠送流量(万次),合同金额,签约类型,合同状态,回款状态,关联合同,关联合同编号,补充协议签订日期"
.
split
(
","
));
}
if
(
platform
.
equals
(
"cas"
)){
title
=
Arrays
.
asList
(
"录入时间,合同编号,客户账号,我方签约主体,签约方,行政区域,隶属集团,行业分类,销售,开始日期,结束日期,套餐类型,有效期开始日有效期结束日,合同金额,签约类型,合同状态,回款状态,关联合同"
.
split
(
","
));
}
else
{
title
=
Arrays
.
asList
(
"录入时间,合同编号,客户账号,我方签约主体,签约方,行政区域,隶属集团,行业分类,销售,开始日期,结束日期,套餐类型,合同金额,签约类型,合同状态,回款状态,关联合同"
.
split
(
","
));
...
...
@@ -173,11 +176,21 @@ public class ContractController {
rowBody
.
createCell
(
19
).
setCellValue
(
contract
.
getRelationCode
()
==
null
?
""
:
contract
.
getRelationCode
());
rowBody
.
createCell
(
20
).
setCellValue
(
contract
.
getSignedDate
()
==
null
?
""
:
contract
.
getSignedDate
());
}
else
{
rowBody
.
createCell
(
12
).
setCellValue
(
contract
.
getMoney
()
==
null
?
0
:
contract
.
getMoney
());
rowBody
.
createCell
(
13
).
setCellValue
(
CONTRACT_STATUS
.
get
(
contract
.
getContractType
()));
rowBody
.
createCell
(
14
).
setCellValue
(
CONTRACT_STATUS
.
get
(
contract
.
getStatus
()));
rowBody
.
createCell
(
15
).
setCellValue
(
CONTRACT_STATUS
.
get
(
contract
.
getBackStatus
()
+
"_back"
));
rowBody
.
createCell
(
16
).
setCellValue
(
contract
.
getRelationCode
()
==
null
?
""
:
contract
.
getRelationCode
());
if
(
platform
.
equals
(
"cas"
)){
rowBody
.
createCell
(
12
).
setCellValue
(
contract
.
getValidStartDate
());
rowBody
.
createCell
(
13
).
setCellValue
(
contract
.
getValidEndDate
());
rowBody
.
createCell
(
14
).
setCellValue
(
contract
.
getMoney
()
==
null
?
0
:
contract
.
getMoney
());
rowBody
.
createCell
(
15
).
setCellValue
(
CONTRACT_STATUS
.
get
(
contract
.
getContractType
()));
rowBody
.
createCell
(
16
).
setCellValue
(
CONTRACT_STATUS
.
get
(
contract
.
getStatus
()));
rowBody
.
createCell
(
17
).
setCellValue
(
CONTRACT_STATUS
.
get
(
contract
.
getBackStatus
()
+
"_back"
));
rowBody
.
createCell
(
18
).
setCellValue
(
contract
.
getRelationCode
()
==
null
?
""
:
contract
.
getRelationCode
());
}
else
{
rowBody
.
createCell
(
12
).
setCellValue
(
contract
.
getMoney
()
==
null
?
0
:
contract
.
getMoney
());
rowBody
.
createCell
(
13
).
setCellValue
(
CONTRACT_STATUS
.
get
(
contract
.
getContractType
()));
rowBody
.
createCell
(
14
).
setCellValue
(
CONTRACT_STATUS
.
get
(
contract
.
getStatus
()));
rowBody
.
createCell
(
15
).
setCellValue
(
CONTRACT_STATUS
.
get
(
contract
.
getBackStatus
()
+
"_back"
));
rowBody
.
createCell
(
16
).
setCellValue
(
contract
.
getRelationCode
()
==
null
?
""
:
contract
.
getRelationCode
());
}
}
}
...
...
@@ -512,6 +525,8 @@ public class ContractController {
workbook
=
createTKIOExcel
(
contracts
);
}
else
if
(
platform
.
equals
(
"adi"
)){
workbook
=
createADIExcel
(
contracts
);
}
else
if
(
platform
.
equals
(
"cas"
)){
workbook
=
createCASExcel
(
contracts
);
}
else
{
workbook
=
createCommonExcel
(
contracts
);
}
...
...
@@ -545,7 +560,47 @@ public class ContractController {
this.exportWrite(fileName, sb.toString(), "分摊收入报表", response);*/
}
private
HSSFWorkbook
createCASExcel
(
List
<
Contract
>
contracts
)
{
DecimalFormat
df
=
new
DecimalFormat
(
"##,##0.00"
);
//创建工作薄对象
HSSFWorkbook
workbook
=
new
HSSFWorkbook
();
//这里也可以设置sheet的Name
//创建工作表对象
HSSFSheet
sheet
=
workbook
.
createSheet
();
//创建工作表的行
HSSFRow
row
=
sheet
.
createRow
(
0
);
List
<
String
>
title
=
Arrays
.
asList
(
"我方签约主体,签约方,合同编号,行政区域,隶属集团,合同状态,合同金额,不含税收入,合同开始日期,合同截止日期,套餐类型,有效期开始日,有效期结束日,一次性确认收入,区间使用天数,区间分摊收入,调整额,分摊总收入"
.
split
(
","
));
int
lineSize
=
title
.
size
();
for
(
int
i
=
0
;
i
<
lineSize
;
i
++)
{
row
.
createCell
(
i
).
setCellValue
(
title
.
get
(
i
));
}
for
(
int
i
=
0
;
i
<
contracts
.
size
();
i
++)
{
Contract
contract
=
contracts
.
get
(
i
);
HSSFRow
rowBody
=
sheet
.
createRow
(
i
+
1
);
rowBody
.
createCell
(
0
).
setCellValue
(
contract
.
getMyBodyName
());
rowBody
.
createCell
(
1
).
setCellValue
(
contract
.
getCustomerBody
());
rowBody
.
createCell
(
2
).
setCellValue
(
contract
.
getContractCode
());
rowBody
.
createCell
(
3
).
setCellValue
(
contract
.
getBarrioName
());
rowBody
.
createCell
(
4
).
setCellValue
(
contract
.
getBelongGroup
());
rowBody
.
createCell
(
5
).
setCellValue
(
CONTRACT_STATUS
.
get
(
contract
.
getStatus
()));
rowBody
.
createCell
(
6
).
setCellValue
(
df
.
format
(
contract
.
getMoney
()));
rowBody
.
createCell
(
7
).
setCellValue
(
df
.
format
(
contract
.
getIncomeExcludingTax
()
*
1.0
/
100
));
rowBody
.
createCell
(
8
).
setCellValue
(
contract
.
getStartDate
());
rowBody
.
createCell
(
9
).
setCellValue
(
contract
.
getEndDate
());
rowBody
.
createCell
(
10
).
setCellValue
(
contract
.
getPriceLevelName
());
rowBody
.
createCell
(
11
).
setCellValue
(
contract
.
getValidStartDate
());
rowBody
.
createCell
(
12
).
setCellValue
(
contract
.
getValidEndDate
());
rowBody
.
createCell
(
13
).
setCellValue
(
contract
.
getOneTimeRecognizedRevenue
());
rowBody
.
createCell
(
14
).
setCellValue
(
contract
.
getIntervalUseDays
());
rowBody
.
createCell
(
15
).
setCellValue
(
df
.
format
(
contract
.
getIntervaIncomeShare
()
*
1.0
/
100
));
rowBody
.
createCell
(
16
).
setCellValue
(
df
.
format
(
contract
.
getAdjustmentFund
()
*
1.0
/
100
));
rowBody
.
createCell
(
17
).
setCellValue
(
df
.
format
(
contract
.
getIncomeShareAll
()
*
1.0
/
100
));
}
return
workbook
;
}
private
HSSFWorkbook
createADIExcel
(
List
<
Contract
>
contracts
)
{
DecimalFormat
df
=
new
DecimalFormat
(
"##,##0.00"
);
//创建工作薄对象
...
...
src/main/java/common/model/Contract.java
View file @
def3298a
...
...
@@ -103,6 +103,10 @@ public class Contract {
private
double
historyTkioFlow
;
//万单位,保留四位
private
BigDecimal
unitPriceAccurate
;
//16位的单价
private
String
validStartDate
;
//有效开始日
private
String
validEndDate
;
//有效结束日
private
Double
oneTimeRecognizedRevenue
;
//一次性确认收入
@Id
@GeneratedValue
public
Long
getId
()
{
...
...
@@ -661,6 +665,31 @@ public class Contract {
this
.
unitPriceAccurate
=
unitPriceAccurate
;
}
public
String
getValidStartDate
()
{
return
validStartDate
;
}
public
void
setValidStartDate
(
String
validStartDate
)
{
this
.
validStartDate
=
validStartDate
;
}
public
String
getValidEndDate
()
{
return
validEndDate
;
}
public
void
setValidEndDate
(
String
validEndDate
)
{
this
.
validEndDate
=
validEndDate
;
}
@Transient
public
Double
getOneTimeRecognizedRevenue
()
{
return
oneTimeRecognizedRevenue
;
}
public
void
setOneTimeRecognizedRevenue
(
Double
oneTimeRecognizedRevenue
)
{
this
.
oneTimeRecognizedRevenue
=
oneTimeRecognizedRevenue
;
}
@Override
public
String
toString
()
{
return
"Contract{"
+
...
...
@@ -725,11 +754,14 @@ public class Contract {
", trackFlow="
+
trackFlow
+
", unitPrice="
+
unitPrice
+
", clickFlow="
+
clickFlow
+
", operate="
+
operate
+
", nextSignedDate='"
+
nextSignedDate
+
'\''
+
", nextSignedContractCode='"
+
nextSignedContractCode
+
'\''
+
", signedDate='"
+
signedDate
+
'\''
+
", historyTkioFlow="
+
historyTkioFlow
+
", unitPriceAccurate="
+
unitPriceAccurate
+
", validStartDate='"
+
validStartDate
+
'\''
+
", validEndDate='"
+
validEndDate
+
'\''
+
'}'
;
}
}
src/main/java/common/service/impl/ContractServiceImpl.java
View file @
def3298a
...
...
@@ -237,7 +237,7 @@ public class ContractServiceImpl implements ContractService {
Account
account
=
null
;
IOAccount4Web
ioAccount4Web
=
null
;
ADIUser
adiUser
=
null
;
platfrom
=
"tkio"
;
//
platfrom = "tkio";
if
(
"tkio"
.
equals
(
platfrom
))
{
//account4Web = account4WebRepository.findByEmail(email);
...
...
@@ -256,16 +256,19 @@ public class ContractServiceImpl implements ContractService {
}
else
if
(
"io"
.
equals
(
platfrom
))
{
ioAccount4Web
=
ioAccount4WebRepository
.
findByEmail
(
email
);
}
else
if
(
"adi"
.
equals
(
platfrom
))
{
}
else
if
(
"adi"
.
equals
(
platfrom
)
||
"cas"
.
equals
(
platfrom
)
)
{
adiUser
=
adiAccountService
.
findOne
(
email
);
}
if
(
null
==
account
&&
null
==
ioAccount4Web
&&
null
==
adiUser
)
{
if
(
null
==
account
&&
null
==
ioAccount4Web
&&
null
==
adiUser
)
{
map
.
put
(
"result"
,
0
);
}
else
{
BigInteger
integer
=
contractRepository
.
countNumByEmail
(
email
,
platfrom
);
map
.
put
(
"result"
,
1
);
if
(
platfrom
.
equals
(
"adi"
))
{
map
.
put
(
"company"
,
adiUser
.
getCompany
());
}
else
if
(
platfrom
.
equals
(
"cas"
))
{
map
.
put
(
"company"
,
adiUser
.
getCompany
());
map
.
put
(
"validStartDate"
,
adiUser
.
getSendTime
());
}
else
{
// map.put("company", null == account4Web ? ioAccount4Web.getCompany() : account4Web.getCompany());
map
.
put
(
"company"
,
account
.
getCompany
());
...
...
src/main/java/common/service/impl/ShareIncomeServiceImpl.java
View file @
def3298a
...
...
@@ -163,6 +163,7 @@ public class ShareIncomeServiceImpl implements ShareIncomeService {
this
.
shareIncome4ContractTKIO
(
v
,
start
,
end
,
false
);
}
break
;
case
"type_three"
:
this
.
shareIncome4ContractCAS
(
v
,
start
,
end
);
break
;
default
:
this
.
shareIncome4Contract
(
v
,
start
,
end
);
break
;
}
});
...
...
@@ -192,6 +193,273 @@ public class ShareIncomeServiceImpl implements ShareIncomeService {
return
contracts
;
}
private
void
shareIncome4ContractCAS
(
Contract
contract
,
DateTime
start
,
DateTime
end
)
{
DateTime
[]
selected
=
new
DateTime
[]{
start
,
end
};
//用户筛选开始/结束日期
DateTime
[]
contractPart
=
new
DateTime
[]{
new
DateTime
(
contract
.
getStartDate
()),
new
DateTime
(
contract
.
getEndDate
())};
//合同开始结束 时间
DateTime
[]
contractValidPart
=
new
DateTime
[]{
new
DateTime
(
contract
.
getValidStartDate
()),
new
DateTime
(
contract
.
getValidEndDate
())};
//合同有效日 开始结束 时间
DateTime
[]
usePart
=
new
DateTime
[]{
selected
[
0
].
compareTo
(
contractValidPart
[
0
])
<=
0
?
contractValidPart
[
0
]
:
selected
[
0
],
selected
[
1
].
compareTo
(
contractValidPart
[
1
])
>=
0
?
contractValidPart
[
1
]
:
selected
[
1
]
};
usePart
[
0
]
=
usePart
[
0
].
compareTo
(
usePart
[
1
])
>=
0
?
usePart
[
1
]
:
usePart
[
0
];
contract
.
setIntervalUseDays
(
getDayRange
(
contractValidPart
[
0
],
usePart
[
1
])
+
1
);
BigDecimal
bigDecimal
=
new
BigDecimal
(
contract
.
getMoney
()
/
1.13
)
.
setScale
(
8
,
BigDecimal
.
ROUND_HALF_UP
);
Long
excludTax
=
bigDecimal
.
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
).
multiply
(
new
BigDecimal
(
100L
)).
longValue
();
//不含税收入*100
contract
.
setIncomeExcludingTax
(
excludTax
);
BigDecimal
oneTimeRecognizedRevenue
=
bigDecimal
.
multiply
(
new
BigDecimal
(
"0.9"
));
BigDecimal
dailyRevenueRecognition
=
bigDecimal
.
multiply
(
new
BigDecimal
(
"0.1"
));
contract
.
setOneTimeRecognizedRevenue
(
oneTimeRecognizedRevenue
.
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
).
doubleValue
());
int
contractAllDay
=
getDayRange
(
contractPart
[
0
],
contractPart
[
1
])
+
1
;
//合同总天数
//处理精度
BigDecimal
dayShareIncome
=
dailyRevenueRecognition
.
divide
(
new
BigDecimal
(
String
.
valueOf
(
contractAllDay
)),
8
,
BigDecimal
.
ROUND_HALF_UP
);
//作废合同处理
Contract
cancleContract
=
this
.
cancledShareCAS
(
contract
,
oneTimeRecognizedRevenue
,
contractAllDay
,
dayShareIncome
,
contractPart
,
usePart
,
selected
,
contractValidPart
);
if
(
cancleContract
!=
null
)
{
return
;
}
//中止合同处理
Contract
suspendContract
=
this
.
suspendShareCAS
(
contract
,
oneTimeRecognizedRevenue
,
contractAllDay
,
dayShareIncome
,
contractPart
,
usePart
,
selected
,
contractValidPart
);
if
(
suspendContract
!=
null
)
{
return
;
}
//晚录合同处理
DateTime
create
=
new
DateTime
(
new
DateTime
(
contract
.
getCreateTime
()).
toString
(
"yyyy-MM-dd"
));
//录入时间点
DateTime
[]
creatPoints
=
new
DateTime
[]{
create
,
//录入日
create
.
dayOfMonth
().
withMinimumValue
()
//录入月1日
};
this
.
afterContractCAS
(
contract
,
oneTimeRecognizedRevenue
,
contractAllDay
,
dayShareIncome
,
contractPart
,
usePart
,
selected
,
creatPoints
,
contractValidPart
);
}
private
void
afterContractCAS
(
Contract
contract
,
BigDecimal
oneTimeRecognizedRevenue
,
int
contractAllDay
,
BigDecimal
dayShareIncome
,
DateTime
[]
contractPart
,
DateTime
[]
usePart
,
DateTime
[]
selected
,
DateTime
[]
creatPoints
,
DateTime
[]
contractValidPart
)
{
int
betweenMonth
=
Months
.
monthsBetween
(
contractPart
[
0
],
creatPoints
[
0
]).
getMonths
();
//时间范围内用于计算分摊金额的天数
int
daysIncom
=
getDayRange
(
usePart
[
0
],
usePart
[
1
])
+
1
;
//区间分摊总收入
contract
.
setIntervaIncomeShare
(
shareMultiply
(
dayShareIncome
,
new
BigDecimal
(
daysIncom
),
0
));
/*if(checkTwoTime(contractValidPart[0],usePart[1]) && checkTwoTime(usePart[0],contractValidPart[0])){
contract.setIntervaIncomeShare(contract.getIntervaIncomeShare()+oneTimeRecognizedRevenue.setScale(0,BigDecimal.ROUND_HALF_UP).longValue());
}*/
if
(
checkTwoTime
(
contractValidPart
[
0
],
usePart
[
1
])
&&
checkTwoTime
(
usePart
[
0
],
contractValidPart
[
0
])){
//contract.setIntervaIncomeShare(contract.getIntervaIncomeShare()+oneTimeRecognizedRevenue.setScale(0,BigDecimal.ROUND_HALF_UP).longValue());
}
else
{
contract
.
setOneTimeRecognizedRevenue
(
0.0
);
}
Long
adjustmentFund
=
0L
;
//调整金
boolean
isLateContract
=
false
;
// 是否为晚录合同(为了兼容历史数据 此处做冗余判断)
if
(
ContractStatusEnum
.
LATE
.
getKey
().
equals
(
contract
.
getStatus
()))
{
isLateContract
=
true
;
}
else
if
(
checkLateContract
(
contractValidPart
[
0
],
creatPoints
[
0
]))
{
isLateContract
=
true
;
}
if
(
isLateContract
)
{
contract
.
setStatus
(
ContractStatusEnum
.
LATE
.
getKey
());
}
boolean
isLater
=
true
;
if
(!
isLateContract
||
betweenMonth
<
1
)
{
//非合同晚录
contract
.
setAdjustmentFund
(
0L
);
contract
.
setIncomeShareAll
(
contract
.
getIntervaIncomeShare
());
isLater
=
false
;
}
else
if
(
selected
[
1
].
isBefore
(
creatPoints
[
1
]))
{
//录入月1号之前 调整金为 0 分摊为 0
contract
.
setIntervaIncomeShare
(
0L
);
contract
.
setAdjustmentFund
(
0L
);
contract
.
setIncomeShareAll
(
contract
.
getIntervaIncomeShare
());
contract
.
setOneTimeRecognizedRevenue
(
0.0
);
contract
.
setStatus
(
ContractStatusEnum
.
LATE
.
getKey
());
}
else
{
contract
.
setStatus
(
ContractStatusEnum
.
LATE
.
getKey
());
//合同晚录
//所选时间范围内的分摊收入(录入月1号 即creatPoints[1] 开始计算)
DateTime
useStart
=
creatPoints
[
1
].
compareTo
(
selected
[
0
])
>=
0
?
creatPoints
[
1
]
:
selected
[
0
];
daysIncom
=
getDayRange
(
useStart
,
usePart
[
1
])
+
1
;
contract
.
setIntervaIncomeShare
(
shareMultiply
(
dayShareIncome
,
new
BigDecimal
(
daysIncom
),
0
));
/*if(checkTwoTime(contractValidPart[0],usePart[1]) && checkTwoTime(useStart,contractValidPart[0])){
contract.setIntervaIncomeShare(contract.getIntervaIncomeShare()+oneTimeRecognizedRevenue.setScale(0,BigDecimal.ROUND_HALF_UP).longValue());
}*/
adjustmentFund
=
shareMultiply
(
dayShareIncome
,
new
BigDecimal
(
getDayRange
(
contractValidPart
[
0
],
creatPoints
[
1
].
plusDays
(-
1
))
+
1
),
0
);
adjustmentFund
+=
oneTimeRecognizedRevenue
.
multiply
(
new
BigDecimal
(
"100"
)).
setScale
(
0
,
BigDecimal
.
ROUND_HALF_UP
).
longValue
();
if
(
checkTwoTime
(
selected
[
0
],
creatPoints
[
1
])
&&
checkTwoTime
(
creatPoints
[
1
],
selected
[
1
]))
{
//所选时间范围包含 录入月 1 号 显示统计的调整金
contract
.
setAdjustmentFund
(
adjustmentFund
);
}
else
{
contract
.
setAdjustmentFund
(
0L
);
}
}
if
(
checkTwoTime
(
selected
[
0
],
contractValidPart
[
1
])
&&
checkTwoTime
(
contractValidPart
[
1
],
selected
[
1
]))
{
contract
.
setIncomeGross
(
shareMultiply
(
new
BigDecimal
(
getDayRange
(
contractValidPart
[
0
],
contractValidPart
[
1
])
+
1
),
dayShareIncome
,
0
));
contract
.
setIncomeGross
(
contract
.
getIncomeGross
()+
oneTimeRecognizedRevenue
.
setScale
(
0
,
BigDecimal
.
ROUND_HALF_UP
).
longValue
());
}
else
{
contract
.
setIncomeGross
(
shareMultiply
(
new
BigDecimal
(
getDayRange
(
contractValidPart
[
0
],
selected
[
1
])
+
1
),
dayShareIncome
,
0
));
if
(
checkTwoTime
(
contractValidPart
[
0
],
selected
[
1
])){
contract
.
setIncomeGross
(
contract
.
getIncomeGross
()+
oneTimeRecognizedRevenue
.
setScale
(
0
,
BigDecimal
.
ROUND_HALF_UP
).
longValue
());
}
}
if
(
checkTwoTime
(
contractValidPart
[
1
],
selected
[
1
]))
{
//最后一日分摊金计算处理
Long
lastDay
;
if
(
isLater
)
{
lastDay
=
contract
.
getIncomeExcludingTax
()
-
adjustmentFund
-
shareMultiply
(
dayShareIncome
,
new
BigDecimal
(
getDayRange
(
creatPoints
[
1
],
contractValidPart
[
1
])),
0
);
}
else
{
lastDay
=
contract
.
getIncomeExcludingTax
()
-
adjustmentFund
-
shareMultiply
(
dayShareIncome
,
new
BigDecimal
(
getDayRange
(
contractValidPart
[
0
],
contractValidPart
[
1
])),
0
);
}
//最后一日 或 包含最后一日 时
contract
.
setIntervaIncomeShare
(
contract
.
getIntervaIncomeShare
()
-
dayShareIncome
.
setScale
(
0
,
BigDecimal
.
ROUND_HALF_UP
).
longValue
()
+
lastDay
);
}
Double
v
=
contract
.
getOneTimeRecognizedRevenue
()
*
100L
;
contract
.
setIncomeShareAll
(
contract
.
getIntervaIncomeShare
()
+
contract
.
getAdjustmentFund
()
+
v
.
longValue
());
}
private
Contract
suspendShareCAS
(
Contract
contract
,
BigDecimal
oneTimeRecognizedRevenue
,
int
contractAllDay
,
BigDecimal
dayShareIncome
,
DateTime
[]
contractPart
,
DateTime
[]
usePart
,
DateTime
[]
selected
,
DateTime
[]
contractValidPart
)
{
if
(!
ContractStatusEnum
.
SUSPEND
.
getKey
().
equals
(
contract
.
getStatus
()))
{
return
null
;
}
ContractChange
contractChange
=
contractChangeRepository
.
findByContentCode
(
ContractStatusEnum
.
SUSPEND
.
getValue
(),
contract
.
getContractCode
());
if
(
contractChange
==
null
)
{
contract
.
setAdjustmentFund
(
0L
);
contract
.
setIntervaIncomeShare
(
0L
);
contract
.
setIncomeShareAll
(
0L
);
return
contract
;
}
// 合同终止日 或 作废日
DateTime
cancelDate
=
new
DateTime
(
contractChange
.
getDs
());
//中止操作入库时间
DateTime
suspendDate
=
new
DateTime
(
new
DateTime
(
contractChange
.
getCreateTime
()).
toString
(
"yyyy-MM-dd"
));
Long
adjustmentFund
=
0L
;
if
(
checkTwoTime
(
suspendDate
,
cancelDate
))
{
adjustmentFund
=
0L
;
}
else
{
adjustmentFund
=
shareMultiply
(
new
BigDecimal
((
getDayRange
(
cancelDate
,
suspendDate
)
+
1
)
*
-
1
),
dayShareIncome
,
0
);
if
(
checkTwoTime
(
contractValidPart
[
0
],
suspendDate
)
&&
checkTwoTime
(
cancelDate
,
contractValidPart
[
0
])){
adjustmentFund
+=
oneTimeRecognizedRevenue
.
multiply
(
new
BigDecimal
(
"100"
)).
setScale
(
0
,
BigDecimal
.
ROUND_HALF_UP
).
longValue
();
}
else
{
contract
.
setOneTimeRecognizedRevenue
(
0.0
);
}
}
DateTime
usedEnd
=
usePart
[
1
].
compareTo
(
cancelDate
)
<=
0
?
usePart
[
1
]
:
cancelDate
;
int
daysIncom
=
Days
.
daysBetween
(
usePart
[
0
],
usedEnd
).
getDays
()
+
1
;
daysIncom
=
daysIncom
<
0
?
0
:
daysIncom
;
//区间分摊总收入
contract
.
setIntervaIncomeShare
(
shareMultiply
(
dayShareIncome
,
new
BigDecimal
(
daysIncom
),
0
));
/*if(checkTwoTime(contractValidPart[0],usedEnd) && checkTwoTime(usePart[0],contractValidPart[0])){
contract.setIntervaIncomeShare(contract.getIntervaIncomeShare()+oneTimeRecognizedRevenue.setScale(BigDecimal.ROUND_HALF_UP).longValue());
}*/
if
(
checkTwoTime
(
contractValidPart
[
0
],
usedEnd
)
&&
checkTwoTime
(
usePart
[
0
],
contractValidPart
[
0
])){
}
else
{
contract
.
setOneTimeRecognizedRevenue
(
0.0
);
}
if
(
checkTwoTime
(
selected
[
0
],
cancelDate
)
&&
checkTwoTime
(
cancelDate
,
selected
[
1
]))
{
contract
.
setAdjustmentFund
(
adjustmentFund
);
contract
.
setIncomeGross
(
shareMultiply
(
new
BigDecimal
(
getDayRange
(
contractValidPart
[
0
],
cancelDate
)
+
1
),
dayShareIncome
,
0
));
if
(
checkTwoTime
(
contractValidPart
[
0
],
cancelDate
)
&&
checkTwoTime
(
contractPart
[
0
],
contractValidPart
[
0
])){
contract
.
setIncomeGross
(
contract
.
getIntervaIncomeShare
()+
oneTimeRecognizedRevenue
.
setScale
(
0
,
BigDecimal
.
ROUND_HALF_UP
).
longValue
());
}
}
else
{
contract
.
setAdjustmentFund
(
0L
);
contract
.
setIncomeGross
(
shareMultiply
(
new
BigDecimal
(
getDayRange
(
contractValidPart
[
0
],
selected
[
1
])
+
1
),
dayShareIncome
,
0
));
if
(
checkTwoTime
(
contractValidPart
[
0
],
cancelDate
)
&&
checkTwoTime
(
contractPart
[
0
],
contractValidPart
[
0
])){
contract
.
setIncomeGross
(
contract
.
getIntervaIncomeShare
()+
oneTimeRecognizedRevenue
.
setScale
(
0
,
BigDecimal
.
ROUND_HALF_UP
).
longValue
());
}
}
Double
v
=
contract
.
getOneTimeRecognizedRevenue
()
*
100L
;
contract
.
setIncomeShareAll
(
contract
.
getIntervaIncomeShare
()
+
contract
.
getAdjustmentFund
()
+
v
.
longValue
());
return
contract
;
}
private
Contract
cancledShareCAS
(
Contract
contract
,
BigDecimal
oneTimeRecognizedRevenue
,
int
contractAllDay
,
BigDecimal
dayShareIncome
,
DateTime
[]
contractPart
,
DateTime
[]
usePart
,
DateTime
[]
selected
,
DateTime
[]
contractValidPart
)
{
if
(!
ContractStatusEnum
.
CANCEL
.
getKey
().
equals
(
contract
.
getStatus
()))
{
return
null
;
}
ContractChange
contractChange
=
contractChangeRepository
.
findByContentCode
(
ContractStatusEnum
.
CANCEL
.
getValue
(),
contract
.
getContractCode
());
if
(
contractChange
==
null
)
{
contract
.
setAdjustmentFund
(
0L
);
contract
.
setIntervaIncomeShare
(
0L
);
contract
.
setIncomeShareAll
(
0L
);
return
contract
;
}
// 合同终止日 或 作废日
DateTime
cancelDate
=
new
DateTime
(
contractChange
.
getDs
());
Long
adjustmentFund
=
shareMultiply
(
new
BigDecimal
((
getDayRange
(
contractValidPart
[
0
],
cancelDate
)
+
1
)
*
-
1
),
dayShareIncome
,
0
);
adjustmentFund
-=
oneTimeRecognizedRevenue
.
multiply
(
new
BigDecimal
(
"100"
)).
setScale
(
0
,
BigDecimal
.
ROUND_HALF_UP
).
longValue
();
if
(
checkTwoTime
(
contractValidPart
[
0
],
selected
[
1
])
&&
checkTwoTime
(
selected
[
0
],
contractValidPart
[
0
])){
}
else
{
contract
.
setOneTimeRecognizedRevenue
(
0.0
);
}
DateTime
usedEnd
=
usePart
[
1
].
compareTo
(
cancelDate
)
<=
0
?
usePart
[
1
]
:
cancelDate
;
int
daysIncom
=
Days
.
daysBetween
(
usePart
[
0
],
usedEnd
).
getDays
()
+
1
;
daysIncom
=
daysIncom
<
0
?
0
:
daysIncom
;
contract
.
setIntervalUseDays
(
getDayRange
(
contractValidPart
[
0
],
usedEnd
)
+
1
);
//区间分摊总收入
contract
.
setIntervaIncomeShare
(
shareMultiply
(
dayShareIncome
,
new
BigDecimal
(
daysIncom
),
0
));
if
(
checkTwoTime
(
selected
[
0
],
cancelDate
)
&&
checkTwoTime
(
cancelDate
,
selected
[
1
]))
{
contract
.
setAdjustmentFund
(
adjustmentFund
);
}
else
{
contract
.
setAdjustmentFund
(
0L
);
}
contract
.
setIncomeGross
(
0L
);
Double
v
=
contract
.
getOneTimeRecognizedRevenue
()
*
100L
;
contract
.
setIncomeShareAll
(
contract
.
getIntervaIncomeShare
()
+
contract
.
getAdjustmentFund
()
+
v
.
longValue
());
return
contract
;
}
/**
* 功能描述:增加补充协议的逻辑
* @author liyin
...
...
src/main/java/util/Constant.java
View file @
def3298a
...
...
@@ -24,6 +24,7 @@ public class Constant {
public
static
ResourceBundle
commonBundle
=
ResourceBundle
.
getBundle
(
"common"
);
public
static
String
reportUrl
=
commonBundle
.
getString
(
"report.url"
);
public
static
String
importTempUrl
=
commonBundle
.
getString
(
"import.temp.url"
);
public
static
String
adiUrl
=
commonBundle
.
getString
(
"adi.url"
);
public
static
ResourceBundle
redis
=
ResourceBundle
.
getBundle
(
"redis"
);
public
static
String
REDIS_KEY_VALID_TIME
=
redis
.
getString
(
"redis.key.validtime"
);
...
...
src/main/java/util/ContractBranchUtil.java
View file @
def3298a
...
...
@@ -21,6 +21,7 @@ public class ContractBranchUtil {
map
.
put
(
"ads"
,
"type_one"
);
map
.
put
(
"abtest"
,
"type_one"
);
map
.
put
(
"tkio"
,
"type_two"
);
map
.
put
(
"cas"
,
"type_three"
);
}
public
static
String
getValue
(
String
key
){
return
map
.
get
(
key
);
...
...
src/main/resources/common.properties
View file @
def3298a
...
...
@@ -5,3 +5,4 @@ profile.table=${profile.table}
event.table
=
${event.table}
usergroup.table
=
${usergroup.table}
iscache
=
${iscache}
adi.url
=
${adi.url}
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