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
6778b148
Commit
6778b148
authored
5 years ago
by
kangxiaoshan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
v1.3
parent
f8b78a2f
master
…
0727_bugfix
1082_bugfix
1151_bugfix
1209_bugfix
1315_bugfix
1439_bugfix
1608_bugfix
1608_from_1619
1619_bugfix
1990_bugfix
2578_bugfix
2580_fix
32400_fix
32599_bugfix
649_bugfix
bigfix_20201028
bugfix_1608_new
bugfix_1760
bugfix_master_1760
change_double
develper
liushaowei
master_mv
mobvista_master
month_flow
No related merge requests found
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
241 additions
and
191 deletions
+241
-191
ContractController.java
src/main/java/common/controller/ContractController.java
+9
-0
ContractRepository.java
src/main/java/common/repository/ContractRepository.java
+3
-0
ContractService.java
src/main/java/common/service/ContractService.java
+3
-0
ContractServiceImpl.java
src/main/java/common/service/impl/ContractServiceImpl.java
+226
-191
No files found.
src/main/java/common/controller/ContractController.java
View file @
6778b148
...
@@ -75,6 +75,15 @@ public class ContractController {
...
@@ -75,6 +75,15 @@ public class ContractController {
return
ResultModel
.
OK
(
service
.
findAll
(
loginAccount
,
startDate
,
endDate
,
platform
,
contractId
));
return
ResultModel
.
OK
(
service
.
findAll
(
loginAccount
,
startDate
,
endDate
,
platform
,
contractId
));
}
}
@RequestMapping
(
value
=
"findOne"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
public
ResultModel
findOne
(
@CurrentAccount
User
loginAccount
,
@PathVariable
String
platform
,
@RequestParam
String
startDate
,
@RequestParam
String
endDate
,
String
contractId
)
{
return
ResultModel
.
OK
(
service
.
findOne
(
loginAccount
,
startDate
,
endDate
,
platform
,
contractId
));
}
@RequestMapping
(
value
=
"export"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_OCTET_STREAM_VALUE
)
@RequestMapping
(
value
=
"export"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_OCTET_STREAM_VALUE
)
@ResponseBody
@ResponseBody
public
ResponseEntity
<
byte
[]>
export
(
@CurrentAccount
User
loginAccount
,
@PathVariable
String
platform
,
@RequestParam
String
startDate
public
ResponseEntity
<
byte
[]>
export
(
@CurrentAccount
User
loginAccount
,
@PathVariable
String
platform
,
@RequestParam
String
startDate
...
...
This diff is collapsed.
Click to expand it.
src/main/java/common/repository/ContractRepository.java
View file @
6778b148
...
@@ -79,4 +79,7 @@ public interface ContractRepository extends JpaRepository<Contract, Long> {
...
@@ -79,4 +79,7 @@ public interface ContractRepository extends JpaRepository<Contract, Long> {
@Query
(
value
=
"SELECT * from contract where platform =?1 and email = ?2 and (status <> 'end' or status <> 'cancel')"
,
nativeQuery
=
true
)
@Query
(
value
=
"SELECT * from contract where platform =?1 and email = ?2 and (status <> 'end' or status <> 'cancel')"
,
nativeQuery
=
true
)
List
<
Contract
>
findByPlatformAndEmailStatus
(
String
platgorm
,
String
email
,
int
status
);
List
<
Contract
>
findByPlatformAndEmailStatus
(
String
platgorm
,
String
email
,
int
status
);
@Query
(
value
=
"select * from contract where contract_code =?2 and platform = ?1 "
,
nativeQuery
=
true
)
Contract
findOneByCode
(
String
platform
,
String
contractId
);
}
}
This diff is collapsed.
Click to expand it.
src/main/java/common/service/ContractService.java
View file @
6778b148
...
@@ -70,4 +70,6 @@ public interface ContractService {
...
@@ -70,4 +70,6 @@ public interface ContractService {
List
<
ChangeDelDetail
>
getChangeDelDetailData
(
User
loginAccount
,
String
pid
);
List
<
ChangeDelDetail
>
getChangeDelDetailData
(
User
loginAccount
,
String
pid
);
ChangeDelInfo
changesDelRecover
(
String
id
,
String
type
,
User
loginAccount
);
ChangeDelInfo
changesDelRecover
(
String
id
,
String
type
,
User
loginAccount
);
Contract
findOne
(
User
loginAccount
,
String
startDate
,
String
endDate
,
String
platform
,
String
contractId
);
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/main/java/common/service/impl/ContractServiceImpl.java
View file @
6778b148
...
@@ -49,11 +49,11 @@ public class ContractServiceImpl implements ContractService {
...
@@ -49,11 +49,11 @@ public class ContractServiceImpl implements ContractService {
}};
}};
public
static
final
Map
<
String
,
String
>
FUNCTION_TYPE
=
new
HashMap
()
{{
public
static
final
Map
<
String
,
String
>
FUNCTION_TYPE
=
new
HashMap
()
{{
put
(
"1"
,
"流量赠送"
);
put
(
"1"
,
"流量赠送"
);
put
(
"2"
,
"合同变更记录"
);
put
(
"2"
,
"合同变更记录"
);
put
(
"3"
,
"收款/开票记录"
);
put
(
"3"
,
"收款/开票记录"
);
put
(
"4"
,
"合同管理"
);
put
(
"4"
,
"合同管理"
);
}};
}};
@Autowired
@Autowired
...
@@ -231,7 +231,7 @@ public class ContractServiceImpl implements ContractService {
...
@@ -231,7 +231,7 @@ public class ContractServiceImpl implements ContractService {
String
codeName
=
contractRepository
.
findLastCode
(
code
);
String
codeName
=
contractRepository
.
findLastCode
(
code
);
if
(
"fake"
.
equals
(
platform
))
{
if
(
"fake"
.
equals
(
platform
))
{
platform
=
"FZBWS"
;
platform
=
"FZBWS"
;
}
}
...
@@ -258,7 +258,6 @@ public class ContractServiceImpl implements ContractService {
...
@@ -258,7 +258,6 @@ public class ContractServiceImpl implements ContractService {
return
code
+
"-"
+
platform
.
toUpperCase
()
+
"-"
+
DateUtil
.
getDays2
(
0
)
+
"-"
+
lastCode
;
return
code
+
"-"
+
platform
.
toUpperCase
()
+
"-"
+
DateUtil
.
getDays2
(
0
)
+
"-"
+
lastCode
;
}
}
@Override
@Override
...
@@ -303,16 +302,14 @@ public class ContractServiceImpl implements ContractService {
...
@@ -303,16 +302,14 @@ public class ContractServiceImpl implements ContractService {
}
}
return
list
;
return
list
;
}
else
{
}
else
{
List
<
PackageBase
>
packageBases
=
packageBaseRepository
.
findByPlatAndStatus
(
platform
,
1
);
List
<
PackageBase
>
packageBases
=
packageBaseRepository
.
findByPlatAndStatus
(
platform
,
1
);
return
packageBases
;
return
packageBases
;
}
}
}
}
@Override
@Override
...
@@ -374,22 +371,21 @@ public class ContractServiceImpl implements ContractService {
...
@@ -374,22 +371,21 @@ public class ContractServiceImpl implements ContractService {
}
}
resource
.
setInvoice
(
0L
);
resource
.
setInvoice
(
0L
);
Long
extraFlow
=
resource
.
getExtraFlow
();
Long
extraFlow
=
resource
.
getExtraFlow
();
if
(
extraFlow
==
null
)
{
if
(
extraFlow
==
null
)
{
extraFlow
=
0L
;
extraFlow
=
0L
;
}
}
if
(
resource
.
getPayMoney
()==
null
)
{
if
(
resource
.
getPayMoney
()
==
null
)
{
resource
.
setPayMoney
(
0L
);
resource
.
setPayMoney
(
0L
);
}
}
resource
.
setDs
(
DateUtil
.
getBeforeDays
(
0
));
resource
.
setDs
(
DateUtil
.
getBeforeDays
(
0
));
this
.
saveIncrementFlow
(
resource
,
extraFlow
);
this
.
saveIncrementFlow
(
resource
,
extraFlow
);
this
.
dealContractStatus
(
resource
,
loginUser
,
"save"
);
this
.
dealContractStatus
(
resource
,
loginUser
,
"save"
);
if
(
resource
.
getRelationContract
()
==
null
)
{
if
(
resource
.
getRelationContract
()
==
null
)
{
resource
.
setRelationContract
(-
1L
);
resource
.
setRelationContract
(-
1L
);
...
@@ -415,13 +411,13 @@ public class ContractServiceImpl implements ContractService {
...
@@ -415,13 +411,13 @@ public class ContractServiceImpl implements ContractService {
resource
=
contractRepository
.
save
(
resource
);
resource
=
contractRepository
.
save
(
resource
);
this
.
saveContractRelations
(
resource
,
resource
.
getId
());
this
.
saveContractRelations
(
resource
,
resource
.
getId
());
return
resource
;
return
resource
;
}
}
private
void
saveIncrementFlow
(
Contract
resource
,
Long
extraFlow
)
{
private
void
saveIncrementFlow
(
Contract
resource
,
Long
extraFlow
)
{
if
(
resource
.
getType
().
equals
(
"main"
))
{
if
(
resource
.
getType
().
equals
(
"main"
))
{
if
(
resource
.
getPlatform
().
equals
(
"tkio"
))
{
if
(
resource
.
getPlatform
().
equals
(
"tkio"
))
{
if
(!(
extraFlow
.
longValue
()
==
0
))
{
if
(!(
extraFlow
.
longValue
()
==
0
))
{
...
@@ -441,7 +437,7 @@ public class ContractServiceImpl implements ContractService {
...
@@ -441,7 +437,7 @@ public class ContractServiceImpl implements ContractService {
}
}
private
void
saveContractRelations
(
Contract
resource
,
Long
contractId
)
{
private
void
saveContractRelations
(
Contract
resource
,
Long
contractId
)
{
if
(
resource
.
getRelationContract
()
!=
null
&&
resource
.
getRelationContract
()
>
0
)
{
if
(
resource
.
getRelationContract
()
!=
null
&&
resource
.
getRelationContract
()
>
0
)
{
//保存关联合同信息
//保存关联合同信息
ContractRelation
relation
=
new
ContractRelation
();
ContractRelation
relation
=
new
ContractRelation
();
...
@@ -450,8 +446,8 @@ public class ContractServiceImpl implements ContractService {
...
@@ -450,8 +446,8 @@ public class ContractServiceImpl implements ContractService {
relation
.
setRelationId
(
resource
.
getRelationContract
());
relation
.
setRelationId
(
resource
.
getRelationContract
());
relation
.
setPlatform
(
resource
.
getPlatform
());
relation
.
setPlatform
(
resource
.
getPlatform
());
ContractRelation
relationOrig
=
contractRelationRepository
.
findByRelationData
(
relation
.
getMainContract
(),
relation
.
getRelationId
(),
resource
.
getPlatform
());
ContractRelation
relationOrig
=
contractRelationRepository
.
findByRelationData
(
relation
.
getMainContract
(),
relation
.
getRelationId
(),
resource
.
getPlatform
());
if
(
relationOrig
==
null
)
{
if
(
relationOrig
==
null
)
{
contractRelationRepository
.
save
(
relation
);
contractRelationRepository
.
save
(
relation
);
}
}
...
@@ -614,7 +610,7 @@ public class ContractServiceImpl implements ContractService {
...
@@ -614,7 +610,7 @@ public class ContractServiceImpl implements ContractService {
public
Contract
update
(
User
loginUser
,
Contract
resource
,
String
ip
)
{
public
Contract
update
(
User
loginUser
,
Contract
resource
,
String
ip
)
{
Contract
contract
=
contractRepository
.
findOne
(
resource
.
getId
());
Contract
contract
=
contractRepository
.
findOne
(
resource
.
getId
());
if
(!
contract
.
getContractCode
().
equals
(
resource
.
getContractCode
()))
{
if
(!
contract
.
getContractCode
().
equals
(
resource
.
getContractCode
()))
{
Contract
contractExist
=
contractRepository
.
findByCode
(
resource
.
getContractCode
());
Contract
contractExist
=
contractRepository
.
findByCode
(
resource
.
getContractCode
());
if
(
contractExist
!=
null
)
{
if
(
contractExist
!=
null
)
{
// 合同编号已存在
// 合同编号已存在
...
@@ -625,9 +621,9 @@ public class ContractServiceImpl implements ContractService {
...
@@ -625,9 +621,9 @@ public class ContractServiceImpl implements ContractService {
}
}
}
}
this
.
dealContractStatus
(
resource
,
loginUser
,
"update"
);
this
.
dealContractStatus
(
resource
,
loginUser
,
"update"
);
this
.
saveContractRelations
(
resource
,
contract
.
getId
());
this
.
saveContractRelations
(
resource
,
contract
.
getId
());
ChangeDelInfo
delInfo
=
new
ChangeDelInfo
();
ChangeDelInfo
delInfo
=
new
ChangeDelInfo
();
...
@@ -643,7 +639,7 @@ public class ContractServiceImpl implements ContractService {
...
@@ -643,7 +639,7 @@ public class ContractServiceImpl implements ContractService {
delInfo
.
setIp
(
ip
);
delInfo
.
setIp
(
ip
);
List
<
ChangeDelDetail
>
updateFields
=
this
.
changeDelInfoForContract
(
contract
,
resource
,
delInfo
.
getId
(),
""
);
List
<
ChangeDelDetail
>
updateFields
=
this
.
changeDelInfoForContract
(
contract
,
resource
,
delInfo
.
getId
(),
""
);
if
(
updateFields
!=
null
&&
updateFields
.
size
()
>
0
)
{
if
(
updateFields
!=
null
&&
updateFields
.
size
()
>
0
)
{
changeDelInfoRepository
.
save
(
delInfo
);
changeDelInfoRepository
.
save
(
delInfo
);
...
@@ -672,70 +668,68 @@ public class ContractServiceImpl implements ContractService {
...
@@ -672,70 +668,68 @@ public class ContractServiceImpl implements ContractService {
}
}
private
List
<
ChangeDelDetail
>
changeDelInfoForContract
(
Contract
byfind
,
Contract
resource
,
Long
pid
,
String
ip
){
private
List
<
ChangeDelDetail
>
changeDelInfoForContract
(
Contract
byfind
,
Contract
resource
,
Long
pid
,
String
ip
)
{
List
<
ChangeDelDetail
>
delDetailsList
=
new
ArrayList
<>();
List
<
ChangeDelDetail
>
delDetailsList
=
new
ArrayList
<>();
String
contractCode
=
byfind
.
getContractCode
();
String
contractCode
=
byfind
.
getContractCode
();
this
.
dealChangeInfoDetail
(
byfind
.
getCustomerBody
(),
resource
.
getCustomerBody
(),
this
.
dealChangeInfoDetail
(
byfind
.
getCustomerBody
(),
resource
.
getCustomerBody
(),
"客户签约主体"
,
"customerBody"
,
pid
,
delDetailsList
,
byfind
);
"客户签约主体"
,
"customerBody"
,
pid
,
delDetailsList
,
byfind
);
this
.
dealChangeInfoDetail
(
byfind
.
getCustomerShort
(),
resource
.
getCustomerShort
(),
this
.
dealChangeInfoDetail
(
byfind
.
getCustomerShort
(),
resource
.
getCustomerShort
(),
"客户简称"
,
"customerShort"
,
pid
,
delDetailsList
,
byfind
);
"客户简称"
,
"customerShort"
,
pid
,
delDetailsList
,
byfind
);
this
.
dealChangeInfoDetail
(
byfind
.
getCustomerThird
(),
resource
.
getCustomerThird
(),
this
.
dealChangeInfoDetail
(
byfind
.
getCustomerThird
(),
resource
.
getCustomerThird
(),
"第三方签约主体"
,
"customerThird"
,
pid
,
delDetailsList
,
byfind
);
"第三方签约主体"
,
"customerThird"
,
pid
,
delDetailsList
,
byfind
);
if
(
byfind
.
getTradeType
()
!=
resource
.
getTradeType
())
{
if
(
byfind
.
getTradeType
()
!=
resource
.
getTradeType
())
{
List
<
TradeType
>
types
=
tradeTypeRepsitory
.
findByTwoId
(
byfind
.
getTradeType
(),
resource
.
getTradeType
());
List
<
TradeType
>
types
=
tradeTypeRepsitory
.
findByTwoId
(
byfind
.
getTradeType
(),
resource
.
getTradeType
());
Map
<
String
,
String
>
dataDic
=
new
HashMap
();
Map
<
String
,
String
>
dataDic
=
new
HashMap
();
for
(
TradeType
tradeType:
types
)
{
for
(
TradeType
tradeType
:
types
)
{
dataDic
.
put
(
tradeType
.
getId
().
toString
(),
tradeType
.
getName
());
dataDic
.
put
(
tradeType
.
getId
().
toString
(),
tradeType
.
getName
());
}
}
String
nameFind
=
dataDic
.
get
(
byfind
.
getTradeType
()
+
""
);
String
nameFind
=
dataDic
.
get
(
byfind
.
getTradeType
()
+
""
);
String
nameResource
=
dataDic
.
get
(
resource
.
getTradeType
()
+
""
);
String
nameResource
=
dataDic
.
get
(
resource
.
getTradeType
()
+
""
);
this
.
dealChangeInfoDetail
(
nameFind
==
null
?
"无"
:
nameFind
,
nameResource
==
null
?
"无"
:
nameResource
,
this
.
dealChangeInfoDetail
(
nameFind
==
null
?
"无"
:
nameFind
,
nameResource
==
null
?
"无"
:
nameResource
,
"行业分类"
,
"tradeType"
,
pid
,
delDetailsList
,
byfind
);
"行业分类"
,
"tradeType"
,
pid
,
delDetailsList
,
byfind
);
}
}
this
.
dealChangeInfoDetail
(
byfind
.
getStartDate
(),
resource
.
getStartDate
(),
this
.
dealChangeInfoDetail
(
byfind
.
getStartDate
(),
resource
.
getStartDate
(),
"合同开始日期"
,
"startDate"
,
pid
,
delDetailsList
,
byfind
);
"合同开始日期"
,
"startDate"
,
pid
,
delDetailsList
,
byfind
);
this
.
dealChangeInfoDetail
(
byfind
.
getEndDate
(),
resource
.
getEndDate
(),
this
.
dealChangeInfoDetail
(
byfind
.
getEndDate
(),
resource
.
getEndDate
(),
"合同结束日期"
,
"startDate"
,
pid
,
delDetailsList
,
byfind
);
"合同结束日期"
,
"startDate"
,
pid
,
delDetailsList
,
byfind
);
if
(
byfind
.
getSale
()
!=
resource
.
getSale
())
{
if
(
byfind
.
getSale
()
!=
resource
.
getSale
())
{
List
<
Sales
>
sales
=
salesRepository
.
findByTwoId
(
byfind
.
getSale
(),
resource
.
getSale
());
List
<
Sales
>
sales
=
salesRepository
.
findByTwoId
(
byfind
.
getSale
(),
resource
.
getSale
());
this
.
dealChangeInfoDetail
(
sales
.
get
(
0
).
getName
(),
sales
.
get
(
1
).
getName
(),
this
.
dealChangeInfoDetail
(
sales
.
get
(
0
).
getName
(),
sales
.
get
(
1
).
getName
(),
"签约销售"
,
"sale"
,
pid
,
delDetailsList
,
byfind
);
"签约销售"
,
"sale"
,
pid
,
delDetailsList
,
byfind
);
}
}
this
.
dealChangeInfoDetail
(
byfind
.
getExtraFlow
()
==
null
?
""
:
byfind
.
getExtraFlow
().
toString
(),
this
.
dealChangeInfoDetail
(
byfind
.
getExtraFlow
()
==
null
?
""
:
byfind
.
getExtraFlow
().
toString
(),
resource
.
getExtraFlow
()
==
null
?
""
:
resource
.
getExtraFlow
().
toString
(),
resource
.
getExtraFlow
()
==
null
?
""
:
resource
.
getExtraFlow
().
toString
(),
"赠送流量"
,
"extraFlow"
,
pid
,
delDetailsList
,
byfind
);
"赠送流量"
,
"extraFlow"
,
pid
,
delDetailsList
,
byfind
);
this
.
dealChangeInfoDetail
(
byfind
.
getEmail
(),
resource
.
getEmail
(),
this
.
dealChangeInfoDetail
(
byfind
.
getEmail
(),
resource
.
getEmail
(),
"客户主账号"
,
"startDate"
,
pid
,
delDetailsList
,
byfind
);
"客户主账号"
,
"startDate"
,
pid
,
delDetailsList
,
byfind
);
this
.
dealChangeInfoDetail
(
CONTRACT_TYPE
.
get
(
byfind
.
getContractType
()),
this
.
dealChangeInfoDetail
(
CONTRACT_TYPE
.
get
(
byfind
.
getContractType
()),
CONTRACT_TYPE
.
get
(
resource
.
getContractType
()),
CONTRACT_TYPE
.
get
(
resource
.
getContractType
()),
"签约类型"
,
"startDate"
,
pid
,
delDetailsList
,
byfind
);
"签约类型"
,
"startDate"
,
pid
,
delDetailsList
,
byfind
);
this
.
dealChangeInfoDetail
(
byfind
.
getDiscountTimeLong
()
==
null
?
""
:
byfind
.
getDiscountTimeLong
().
toString
(),
this
.
dealChangeInfoDetail
(
byfind
.
getDiscountTimeLong
()
==
null
?
""
:
byfind
.
getDiscountTimeLong
().
toString
(),
resource
.
getDiscountTimeLong
()
==
null
?
""
:
resource
.
getDiscountTimeLong
().
toString
(),
resource
.
getDiscountTimeLong
()
==
null
?
""
:
resource
.
getDiscountTimeLong
().
toString
(),
"赠送时长"
,
"discountTimeLong"
,
pid
,
delDetailsList
,
byfind
);
"赠送时长"
,
"discountTimeLong"
,
pid
,
delDetailsList
,
byfind
);
this
.
dealChangeInfoDetail
(
byfind
.
getRelationCode
()
==
null
?
"无"
:
byfind
.
getRelationCode
(),
this
.
dealChangeInfoDetail
(
byfind
.
getRelationCode
()
==
null
?
"无"
:
byfind
.
getRelationCode
(),
resource
.
getRelationCode
()
==
null
?
"无"
:
resource
.
getRelationCode
(),
resource
.
getRelationCode
()
==
null
?
"无"
:
resource
.
getRelationCode
(),
"关联合同"
,
"relationCode"
,
pid
,
delDetailsList
,
byfind
);
"关联合同"
,
"relationCode"
,
pid
,
delDetailsList
,
byfind
);
return
delDetailsList
;
return
delDetailsList
;
}
}
private
void
dealChangeInfoDetail
(
String
before
,
String
now
,
String
delDetailinfo
,
String
fildeName
,
private
void
dealChangeInfoDetail
(
String
before
,
String
now
,
String
delDetailinfo
,
String
fildeName
,
Long
pid
,
List
<
ChangeDelDetail
>
delDetails
,
Contract
contract
)
{
Long
pid
,
List
<
ChangeDelDetail
>
delDetails
,
Contract
contract
)
{
ChangeDelDetail
delDetail
=
new
ChangeDelDetail
();
ChangeDelDetail
delDetail
=
new
ChangeDelDetail
();
delDetail
.
setFiledName
(
fildeName
);
delDetail
.
setFiledName
(
fildeName
);
...
@@ -887,7 +881,7 @@ public class ContractServiceImpl implements ContractService {
...
@@ -887,7 +881,7 @@ public class ContractServiceImpl implements ContractService {
}
}
private
void
dealContractStatus
(
Contract
resource
,
User
loginUser
,
String
type
)
{
private
void
dealContractStatus
(
Contract
resource
,
User
loginUser
,
String
type
)
{
if
(
resource
.
getPayMoney
()
!=
null
)
{
if
(
resource
.
getPayMoney
()
!=
null
)
{
if
(
resource
.
getMoney
()
==
null
)
{
if
(
resource
.
getMoney
()
==
null
)
{
...
@@ -898,27 +892,25 @@ public class ContractServiceImpl implements ContractService {
...
@@ -898,27 +892,25 @@ public class ContractServiceImpl implements ContractService {
//未回款
//未回款
resource
.
setStatus
(
ContractStatusEnum
.
MONEY_BACK_NONE
.
getKey
());
resource
.
setStatus
(
ContractStatusEnum
.
MONEY_BACK_NONE
.
getKey
());
}
else
if
(
resource
.
getPayMoney
().
longValue
()
<
resource
.
getMoney
().
longValue
())
{
}
else
if
(
resource
.
getPayMoney
().
longValue
()
<
resource
.
getMoney
().
longValue
())
{
// 部分回款
// 部分回款
resource
.
setStatus
(
ContractStatusEnum
.
MONEY_BACK_PART
.
getKey
());
resource
.
setStatus
(
ContractStatusEnum
.
MONEY_BACK_PART
.
getKey
());
//记录收款记录
//记录收款记录
ContractMoney
money
=
new
ContractMoney
();
ContractMoney
money
=
new
ContractMoney
();
money
.
setType
(
"pay"
);
money
.
setType
(
"pay"
);
saveContractMoney
(
money
,
loginUser
,
resource
,
type
);
saveContractMoney
(
money
,
loginUser
,
resource
,
type
);
}
else
{
}
else
{
// 已回款
// 已回款
resource
.
setStatus
(
ContractStatusEnum
.
MONEY_BACK_ALL
.
getKey
());
resource
.
setStatus
(
ContractStatusEnum
.
MONEY_BACK_ALL
.
getKey
());
ContractMoney
money
=
new
ContractMoney
();
ContractMoney
money
=
new
ContractMoney
();
money
.
setType
(
"pay"
);
money
.
setType
(
"pay"
);
saveContractMoney
(
money
,
loginUser
,
resource
,
type
);
saveContractMoney
(
money
,
loginUser
,
resource
,
type
);
}
}
}
else
{
}
else
{
//未回款
//未回款
resource
.
setStatus
(
ContractStatusEnum
.
MONEY_BACK_NONE
.
getKey
());
resource
.
setStatus
(
ContractStatusEnum
.
MONEY_BACK_NONE
.
getKey
());
...
@@ -930,11 +922,11 @@ public class ContractServiceImpl implements ContractService {
...
@@ -930,11 +922,11 @@ public class ContractServiceImpl implements ContractService {
if
(
resource
.
getInvoiceMoney
()
==
null
)
{
if
(
resource
.
getInvoiceMoney
()
==
null
)
{
resource
.
setInvoiceMoney
(
new
BigDecimal
(
0
));
resource
.
setInvoiceMoney
(
new
BigDecimal
(
0
));
}
else
{
}
else
{
// 记录发票记录
// 记录发票记录
ContractMoney
money
=
new
ContractMoney
();
ContractMoney
money
=
new
ContractMoney
();
money
.
setType
(
"invoice"
);
money
.
setType
(
"invoice"
);
saveContractMoney
(
money
,
loginUser
,
resource
,
type
);
saveContractMoney
(
money
,
loginUser
,
resource
,
type
);
}
}
if
(
resource
.
getDiscountTimeLong
()
==
null
)
{
if
(
resource
.
getDiscountTimeLong
()
==
null
)
{
...
@@ -945,9 +937,9 @@ public class ContractServiceImpl implements ContractService {
...
@@ -945,9 +937,9 @@ public class ContractServiceImpl implements ContractService {
resource
.
setExtraFlow
(
0L
);
resource
.
setExtraFlow
(
0L
);
}
}
if
(
resource
.
getDiscountTimeLong
()>
0
||
resource
.
getExtraFlow
()>
0
)
{
if
(
resource
.
getDiscountTimeLong
()
>
0
||
resource
.
getExtraFlow
()
>
0
)
{
//记录优惠信息
//记录优惠信息
saveFlowChange
(
resource
,
loginUser
,
type
,
resource
.
getDiscountTimeLong
(),
resource
.
getExtraFlow
());
saveFlowChange
(
resource
,
loginUser
,
type
,
resource
.
getDiscountTimeLong
(),
resource
.
getExtraFlow
());
}
}
//处理合同编号
//处理合同编号
...
@@ -957,9 +949,9 @@ public class ContractServiceImpl implements ContractService {
...
@@ -957,9 +949,9 @@ public class ContractServiceImpl implements ContractService {
//保存开票收款记录
//保存开票收款记录
private
void
saveContractMoney
(
ContractMoney
money
,
User
loginUser
,
Contract
contract
,
String
type
)
{
private
void
saveContractMoney
(
ContractMoney
money
,
User
loginUser
,
Contract
contract
,
String
type
)
{
if
(!
"save"
.
equals
(
type
))
{
if
(!
"save"
.
equals
(
type
))
{
return
;
return
;
}
}
...
@@ -984,9 +976,9 @@ public class ContractServiceImpl implements ContractService {
...
@@ -984,9 +976,9 @@ public class ContractServiceImpl implements ContractService {
}
}
// 保存优惠流量 优惠时长 记录
// 保存优惠流量 优惠时长 记录
private
void
saveFlowChange
(
Contract
contract
,
User
loginUser
,
String
type
,
Long
discountTimeLong
,
Long
extraFlow
){
private
void
saveFlowChange
(
Contract
contract
,
User
loginUser
,
String
type
,
Long
discountTimeLong
,
Long
extraFlow
)
{
if
(!
"save"
.
equals
(
type
))
{
if
(!
"save"
.
equals
(
type
))
{
return
;
return
;
}
}
...
@@ -1007,7 +999,6 @@ public class ContractServiceImpl implements ContractService {
...
@@ -1007,7 +999,6 @@ public class ContractServiceImpl implements ContractService {
/**
/**
*
* @param loginAccount
* @param loginAccount
* @param startDate
* @param startDate
* @param endDate
* @param endDate
...
@@ -1019,56 +1010,17 @@ public class ContractServiceImpl implements ContractService {
...
@@ -1019,56 +1010,17 @@ public class ContractServiceImpl implements ContractService {
public
List
<
Contract
>
findAll
(
User
loginAccount
,
String
startDate
,
String
endDate
,
String
platform
,
String
contractId
)
{
public
List
<
Contract
>
findAll
(
User
loginAccount
,
String
startDate
,
String
endDate
,
String
platform
,
String
contractId
)
{
List
<
Contract
>
result
=
new
ArrayList
<>();
List
<
Contract
>
result
=
new
ArrayList
<>();
List
<
Sales
>
salesList
=
salesRepository
.
findAllByStatusOn
();
Map
<
Long
,
String
>
saleMap
=
new
HashMap
<>();
if
(
ValidateUtil
.
isValid
(
salesList
))
{
for
(
Sales
s
:
salesList
)
{
saleMap
.
put
(
s
.
getId
(),
s
.
getName
());
}
}
List
<
PackageType
>
typeList
=
packageTypeRepository
.
findAll
();
Map
<
Long
,
String
>
typeMap
=
new
HashMap
<>();
if
(
ValidateUtil
.
isValid
(
typeList
))
{
for
(
PackageType
s
:
typeList
)
{
typeMap
.
put
(
s
.
getId
(),
s
.
getPackageName
());
}
}
List
<
ContractIncrement
>
incrementList
=
contractIncrementRepository
.
findAll
();
Map
<
Long
,
String
>
incremenMap
=
new
HashMap
<>();
if
(
ValidateUtil
.
isValid
(
incrementList
))
{
for
(
ContractIncrement
s
:
incrementList
)
{
incremenMap
.
put
(
s
.
getId
(),
s
.
getPackageName
());
}
}
List
<
BPUContract
>
bpuContractList
=
bpuContractRepository
.
findAll
();
Map
<
Long
,
String
>
bpuMap
=
new
HashMap
<>();
if
(
ValidateUtil
.
isValid
(
bpuContractList
))
{
for
(
BPUContract
s
:
bpuContractList
)
{
bpuMap
.
put
(
s
.
getId
(),
s
.
getPackageName
());
}
}
List
<
PackageBase
>
packageBases
=
packageBaseRepository
.
findByPlatAndStatus
(
platform
,
1
);
Map
<
Long
,
PackageBase
>
packageBaseMap
=
new
HashMap
<>();
for
(
PackageBase
base:
packageBases
){
packageBaseMap
.
put
(
base
.
getId
(),
base
);
}
List
<
String
>
platforms
=
new
ArrayList
<>();
List
<
String
>
platforms
=
new
ArrayList
<>();
Map
<
String
,
String
>
idsDic
=
new
HashMap
<>();
Map
<
String
,
String
>
idsDic
=
new
HashMap
<>();
platforms
.
add
(
platform
);
platforms
.
add
(
platform
);
if
(!
StringUtils
.
isEmpty
(
contractId
))
{
if
(!
StringUtils
.
isEmpty
(
contractId
))
{
//获取 关联合同列表
//获取 关联合同列表
List
<
String
>
conIds
=
new
ArrayList
<>();
List
<
String
>
conIds
=
new
ArrayList
<>();
conIds
.
add
(
contractId
);
conIds
.
add
(
contractId
);
this
.
getContractRelationIds
(
conIds
,
idsDic
);
this
.
getContractRelationIds
(
conIds
,
idsDic
);
idsDic
.
remove
(
contractId
);
idsDic
.
remove
(
contractId
);
if
(
"fake"
.
equals
(
platform
))
{
if
(
"fake"
.
equals
(
platform
))
{
platforms
.
add
(
"tkio"
);
platforms
.
add
(
"tkio"
);
}
}
}
}
...
@@ -1089,13 +1041,13 @@ public class ContractServiceImpl implements ContractService {
...
@@ -1089,13 +1041,13 @@ public class ContractServiceImpl implements ContractService {
// contractList = contractRepository.findByDsAndRoile(startDate, endDate, platfrom, idList);
// contractList = contractRepository.findByDsAndRoile(startDate, endDate, platfrom, idList);
if
(!
StringUtils
.
isEmpty
(
contractId
))
{
if
(!
StringUtils
.
isEmpty
(
contractId
))
{
//查看关联合同
//查看关联合同
if
(
ids
!=
null
&&
ids
.
size
()
>
0
)
{
if
(
ids
!=
null
&&
ids
.
size
()
>
0
)
{
contractList
=
contractRepository
.
findByDsAndRoileRelation
(
startDate
,
endDate
,
platforms
,
idList
,
ids
);
contractList
=
contractRepository
.
findByDsAndRoileRelation
(
startDate
,
endDate
,
platforms
,
idList
,
ids
);
}
}
}
else
{
}
else
{
contractList
=
contractRepository
.
findByDsAndRoile
(
startDate
,
endDate
,
platform
,
idList
);
contractList
=
contractRepository
.
findByDsAndRoile
(
startDate
,
endDate
,
platform
,
idList
);
}
}
...
@@ -1103,16 +1055,26 @@ public class ContractServiceImpl implements ContractService {
...
@@ -1103,16 +1055,26 @@ public class ContractServiceImpl implements ContractService {
}
else
{
}
else
{
// contractList = contractRepository.findByDs(startDate, endDate, platform);
// contractList = contractRepository.findByDs(startDate, endDate, platform);
if
(!
StringUtils
.
isEmpty
(
contractId
))
{
if
(!
StringUtils
.
isEmpty
(
contractId
))
{
if
(
ids
!=
null
&&
ids
.
size
()
>
0
)
{
if
(
ids
!=
null
&&
ids
.
size
()
>
0
)
{
contractList
=
contractRepository
.
findByDsRelation
(
startDate
,
endDate
,
platforms
,
ids
);
contractList
=
contractRepository
.
findByDsRelation
(
startDate
,
endDate
,
platforms
,
ids
);
}
}
}
else
{
}
else
{
contractList
=
contractRepository
.
findByDs
(
startDate
,
endDate
,
platform
);
contractList
=
contractRepository
.
findByDs
(
startDate
,
endDate
,
platform
);
}
}
}
}
Map
<
String
,
String
>
saleMap
=
new
HashMap
();
Map
<
String
,
String
>
typeMap
=
new
HashMap
();
Map
<
String
,
PackageBase
>
packageBaseMap
=
new
HashMap
<>();
// 获取字典数据
this
.
getDicMapDatas
(
saleMap
,
typeMap
,
null
,
null
,
packageBaseMap
,
platform
);
if
(
ValidateUtil
.
isValid
(
contractList
))
{
if
(
ValidateUtil
.
isValid
(
contractList
))
{
for
(
Contract
c
:
contractList
)
{
for
(
Contract
c
:
contractList
)
{
...
@@ -1125,7 +1087,7 @@ public class ContractServiceImpl implements ContractService {
...
@@ -1125,7 +1087,7 @@ public class ContractServiceImpl implements ContractService {
c
.
setHasDiscount
(
"无"
);
c
.
setHasDiscount
(
"无"
);
}
}
if
(
c
.
getRelationContract
()==
null
)
{
if
(
c
.
getRelationContract
()
==
null
)
{
c
.
setRelationContract
(-
1L
);
c
.
setRelationContract
(-
1L
);
}
}
...
@@ -1139,11 +1101,11 @@ public class ContractServiceImpl implements ContractService {
...
@@ -1139,11 +1101,11 @@ public class ContractServiceImpl implements ContractService {
// }
// }
c
.
setSaleName
(
saleMap
.
containsKey
(
c
.
getSale
())
?
saleMap
.
get
(
c
.
getSale
())
:
""
);
c
.
setSaleName
(
saleMap
.
containsKey
(
c
.
getSale
())
?
saleMap
.
get
(
c
.
getSale
())
:
""
);
if
(
"tkio"
.
equals
(
platform
))
{
if
(
"tkio"
.
equals
(
platform
))
{
c
.
setPriceLevelName
(
typeMap
.
containsKey
(
c
.
getPriceLevel
())
?
typeMap
.
get
(
c
.
getPriceLevel
())
:
""
);
c
.
setPriceLevelName
(
typeMap
.
containsKey
(
c
.
getPriceLevel
())
?
typeMap
.
get
(
c
.
getPriceLevel
())
:
""
);
}
else
{
}
else
{
c
.
setPriceLevelName
(
packageBaseMap
.
get
(
c
.
getPriceLevel
())
==
null
?
""
:
packageBaseMap
.
get
(
c
.
getPriceLevel
()).
getPackageName
());
c
.
setPriceLevelName
(
packageBaseMap
.
get
(
c
.
getPriceLevel
())
==
null
?
""
:
packageBaseMap
.
get
(
c
.
getPriceLevel
()).
getPackageName
());
}
}
...
@@ -1155,7 +1117,86 @@ public class ContractServiceImpl implements ContractService {
...
@@ -1155,7 +1117,86 @@ public class ContractServiceImpl implements ContractService {
}
}
private
void
getContractRelationIds
(
List
<
String
>
contractId
,
Map
<
String
,
String
>
idsDic
){
public
void
getDicMapDatas
(
Map
saleMap
,
Map
typeMap
,
Map
incremenMap
,
Map
bpuMap
,
Map
packageBaseMap
,
String
platform
)
{
if
(
saleMap
!=
null
)
{
List
<
Sales
>
salesList
=
salesRepository
.
findAllByStatusOn
();
if
(
ValidateUtil
.
isValid
(
salesList
))
{
for
(
Sales
s
:
salesList
)
{
saleMap
.
put
(
s
.
getId
(),
s
.
getName
());
}
}
}
if
(
typeMap
!=
null
)
{
List
<
PackageType
>
typeList
=
packageTypeRepository
.
findAll
();
if
(
ValidateUtil
.
isValid
(
typeList
))
{
for
(
PackageType
s
:
typeList
)
{
typeMap
.
put
(
s
.
getId
(),
s
.
getPackageName
());
}
}
}
if
(
incremenMap
!=
null
)
{
List
<
ContractIncrement
>
incrementList
=
contractIncrementRepository
.
findAll
();
if
(
ValidateUtil
.
isValid
(
incrementList
))
{
for
(
ContractIncrement
s
:
incrementList
)
{
incremenMap
.
put
(
s
.
getId
(),
s
.
getPackageName
());
}
}
}
if
(
bpuMap
!=
null
)
{
List
<
BPUContract
>
bpuContractList
=
bpuContractRepository
.
findAll
();
if
(
ValidateUtil
.
isValid
(
bpuContractList
))
{
for
(
BPUContract
s
:
bpuContractList
)
{
bpuMap
.
put
(
s
.
getId
(),
s
.
getPackageName
());
}
}
}
if
(
packageBaseMap
!=
null
)
{
List
<
PackageBase
>
packageBases
=
packageBaseRepository
.
findByPlatAndStatus
(
platform
,
1
);
for
(
PackageBase
base
:
packageBases
)
{
packageBaseMap
.
put
(
base
.
getId
(),
base
);
}
}
}
@Override
public
Contract
findOne
(
User
loginAccount
,
String
startDate
,
String
endDate
,
String
platform
,
String
contractId
)
{
Contract
contract
=
contractRepository
.
findOneByCode
(
platform
,
contractId
);
Map
<
String
,
String
>
saleMap
=
new
HashMap
();
Map
<
String
,
String
>
typeMap
=
new
HashMap
();
Map
<
String
,
PackageBase
>
packageBaseMap
=
new
HashMap
<>();
// 获取字典数据
this
.
getDicMapDatas
(
saleMap
,
typeMap
,
null
,
null
,
packageBaseMap
,
platform
);
contract
.
setSaleName
(
saleMap
.
containsKey
(
contract
.
getSale
())
?
saleMap
.
get
(
contract
.
getSale
())
:
""
);
if
(
"tkio"
.
equals
(
platform
))
{
contract
.
setPriceLevelName
(
typeMap
.
containsKey
(
contract
.
getPriceLevel
())
?
typeMap
.
get
(
contract
.
getPriceLevel
())
:
""
);
}
else
{
contract
.
setPriceLevelName
(
packageBaseMap
.
get
(
contract
.
getPriceLevel
())
==
null
?
""
:
packageBaseMap
.
get
(
contract
.
getPriceLevel
()).
getPackageName
());
}
contract
.
setCreateName
(
saleMap
.
containsKey
(
contract
.
getCreateAccount
())
?
saleMap
.
get
(
contract
.
getCreateAccount
())
:
""
);
return
contract
;
}
private
void
getContractRelationIds
(
List
<
String
>
contractId
,
Map
<
String
,
String
>
idsDic
)
{
//获取 关联合同 id
//获取 关联合同 id
List
<
String
>
contractIds
=
new
ArrayList
<>();
List
<
String
>
contractIds
=
new
ArrayList
<>();
...
@@ -1163,18 +1204,18 @@ public class ContractServiceImpl implements ContractService {
...
@@ -1163,18 +1204,18 @@ public class ContractServiceImpl implements ContractService {
List
<
BigInteger
>
ids
=
contractRelationRepository
.
findRelationIds
(
contractId
);
List
<
BigInteger
>
ids
=
contractRelationRepository
.
findRelationIds
(
contractId
);
if
(
ids
!=
null
&&
ids
.
size
()
>
0
)
{
if
(
ids
!=
null
&&
ids
.
size
()
>
0
)
{
for
(
BigInteger
id
:
ids
)
{
for
(
BigInteger
id
:
ids
)
{
String
idss
=
id
.
toString
();
String
idss
=
id
.
toString
();
if
(
idsDic
.
get
(
idss
)
==
null
)
{
if
(
idsDic
.
get
(
idss
)
==
null
)
{
contractIds
.
add
(
idss
);
contractIds
.
add
(
idss
);
idsDic
.
put
(
idss
,
"0"
);
idsDic
.
put
(
idss
,
"0"
);
}
}
}
}
if
(
contractIds
.
size
()>
0
)
{
if
(
contractIds
.
size
()
>
0
)
{
//递归 查询 id 查询所有相关联的合同
//递归 查询 id 查询所有相关联的合同
this
.
getContractRelationIds
(
contractIds
,
idsDic
);
this
.
getContractRelationIds
(
contractIds
,
idsDic
);
}
}
}
}
}
}
...
@@ -1199,13 +1240,13 @@ public class ContractServiceImpl implements ContractService {
...
@@ -1199,13 +1240,13 @@ public class ContractServiceImpl implements ContractService {
contract
.
setStatus
(
status
);
contract
.
setStatus
(
status
);
changeDelInfo
.
setDetail
(
"废弃合同"
);
changeDelInfo
.
setDetail
(
"废弃合同"
);
changeDelInfo
.
setSourceId
(
contract
.
getId
());
changeDelInfo
.
setSourceId
(
contract
.
getId
());
this
.
saveChangeDelInfo
(
changeDelInfo
,
4
,
2
,
ip
,
loginUser
);
// type 2 修改
this
.
saveChangeDelInfo
(
changeDelInfo
,
4
,
2
,
ip
,
loginUser
);
// type 2 修改
}
else
{
}
else
{
changeDelInfo
.
setDetail
(
"删除合同"
);
changeDelInfo
.
setDetail
(
"删除合同"
);
changeDelInfo
.
setOriginal
(
contract
.
getStatus
());
changeDelInfo
.
setOriginal
(
contract
.
getStatus
());
changeDelInfo
.
setSourceId
(
contract
.
getId
());
changeDelInfo
.
setSourceId
(
contract
.
getId
());
this
.
saveChangeDelInfo
(
changeDelInfo
,
4
,
1
,
ip
,
loginUser
);
this
.
saveChangeDelInfo
(
changeDelInfo
,
4
,
1
,
ip
,
loginUser
);
contract
.
setStatus
(
ContractStatusEnum
.
DELETE
.
getKey
());
contract
.
setStatus
(
ContractStatusEnum
.
DELETE
.
getKey
());
}
}
...
@@ -1269,13 +1310,13 @@ public class ContractServiceImpl implements ContractService {
...
@@ -1269,13 +1310,13 @@ public class ContractServiceImpl implements ContractService {
public
ContractMoney
pay
(
User
loginUser
,
ContractMoney
resource
)
{
public
ContractMoney
pay
(
User
loginUser
,
ContractMoney
resource
)
{
Contract
contract
=
contractRepository
.
findByCode
(
resource
.
getContractCode
());
Contract
contract
=
contractRepository
.
findByCode
(
resource
.
getContractCode
());
if
(
resource
.
getType
().
equals
(
"pay"
))
{
if
(
resource
.
getType
().
equals
(
"pay"
))
{
contract
.
setPayMoney
(
contract
.
getPayMoney
()
+
resource
.
getMoney
());
contract
.
setPayMoney
(
contract
.
getPayMoney
()
+
resource
.
getMoney
());
//判断回款状态
//判断回款状态
this
.
dealContractStatus
(
contract
,
loginUser
,
"update"
);
this
.
dealContractStatus
(
contract
,
loginUser
,
"update"
);
}
else
{
}
else
{
contract
.
setInvoiceMoney
(
contract
.
getInvoiceMoney
().
add
(
new
BigDecimal
(
resource
.
getMoney
().
toString
()))
);
contract
.
setInvoiceMoney
(
contract
.
getInvoiceMoney
().
add
(
new
BigDecimal
(
resource
.
getMoney
().
toString
())));
}
}
if
(
contract
.
getType
().
equals
(
ContractTypeEnum
.
INCREMENT
.
getKey
()))
{
if
(
contract
.
getType
().
equals
(
ContractTypeEnum
.
INCREMENT
.
getKey
()))
{
...
@@ -1308,26 +1349,26 @@ public class ContractServiceImpl implements ContractService {
...
@@ -1308,26 +1349,26 @@ public class ContractServiceImpl implements ContractService {
if
(
resource
.
getType
().
equals
(
"price"
))
{
if
(
resource
.
getType
().
equals
(
"price"
))
{
resource
.
setContent
(
packageMap
.
get
(
contract
.
getPriceLevel
())
+
"改为"
+
packageMap
.
get
(
resource
.
getLevel
()));
resource
.
setContent
(
packageMap
.
get
(
contract
.
getPriceLevel
())
+
"改为"
+
packageMap
.
get
(
resource
.
getLevel
()));
resource
.
setMarke
(
contract
.
getMoney
()
+
"元改为"
+
resource
.
getMoney
()+
"元"
);
resource
.
setMarke
(
contract
.
getMoney
()
+
"元改为"
+
resource
.
getMoney
()
+
"元"
);
contract
.
setMoney
(
resource
.
getMoney
());
contract
.
setMoney
(
resource
.
getMoney
());
contract
.
setPriceLevel
(
resource
.
getLevel
());
contract
.
setPriceLevel
(
resource
.
getLevel
());
// 处理回款状态
// 处理回款状态
this
.
dealContractStatus
(
contract
,
loginUser
,
"update"
);
this
.
dealContractStatus
(
contract
,
loginUser
,
"update"
);
}
else
if
(
"give"
.
equals
(
resource
.
getType
()))
{
}
else
if
(
"give"
.
equals
(
resource
.
getType
()))
{
//变更优惠记录
//变更优惠记录
this
.
saveFlowChange
(
contract
,
loginUser
,
"save"
,
resource
.
getDiscountTimeLong
(),
resource
.
getExtraFlow
());
this
.
saveFlowChange
(
contract
,
loginUser
,
"save"
,
resource
.
getDiscountTimeLong
(),
resource
.
getExtraFlow
());
// 累加 合同表中数据
// 累加 合同表中数据
if
(
resource
.
getExtraFlow
()!=
null
)
{
if
(
resource
.
getExtraFlow
()
!=
null
)
{
contract
.
setExtraFlow
(
contract
.
getExtraFlow
()
+
resource
.
getExtraFlow
());
contract
.
setExtraFlow
(
contract
.
getExtraFlow
()
+
resource
.
getExtraFlow
());
}
}
if
(
resource
.
getDiscountTimeLong
()!=
null
)
{
if
(
resource
.
getDiscountTimeLong
()
!=
null
)
{
contract
.
setDiscountTimeLong
(
contract
.
getDiscountTimeLong
()
+
resource
.
getDiscountTimeLong
());
contract
.
setDiscountTimeLong
(
contract
.
getDiscountTimeLong
()
+
resource
.
getDiscountTimeLong
());
}
}
}
else
{
}
else
{
...
@@ -1347,7 +1388,7 @@ public class ContractServiceImpl implements ContractService {
...
@@ -1347,7 +1388,7 @@ public class ContractServiceImpl implements ContractService {
resource
.
setDs
(
DateUtil
.
getBeforeDays
(
0
));
resource
.
setDs
(
DateUtil
.
getBeforeDays
(
0
));
resource
.
setUser
(
loginUser
.
getId
());
resource
.
setUser
(
loginUser
.
getId
());
if
(!
"give"
.
equals
(
resource
.
getType
()))
{
if
(!
"give"
.
equals
(
resource
.
getType
()))
{
contractChangeRepository
.
save
(
resource
);
contractChangeRepository
.
save
(
resource
);
}
}
...
@@ -1359,8 +1400,7 @@ public class ContractServiceImpl implements ContractService {
...
@@ -1359,8 +1400,7 @@ public class ContractServiceImpl implements ContractService {
public
Object
changesDel
(
String
platform
,
String
id
,
String
type
,
String
ip
,
User
loginUser
)
{
public
Object
changesDel
(
String
platform
,
String
id
,
String
type
,
String
ip
,
User
loginUser
)
{
if
(
"give"
.
equals
(
type
))
{
if
(
"give"
.
equals
(
type
)){
// 优惠流量
// 优惠流量
FlowChange
change
=
flowChangeRepository
.
findOne
(
Long
.
parseLong
(
id
));
FlowChange
change
=
flowChangeRepository
.
findOne
(
Long
.
parseLong
(
id
));
change
.
setDelFlag
(
1
);
change
.
setDelFlag
(
1
);
...
@@ -1370,12 +1410,12 @@ public class ContractServiceImpl implements ContractService {
...
@@ -1370,12 +1410,12 @@ public class ContractServiceImpl implements ContractService {
changeDelInfo
.
setContractCode
(
change
.
getContractCode
());
changeDelInfo
.
setContractCode
(
change
.
getContractCode
());
changeDelInfo
.
setEmail
(
change
.
getEmail
());
changeDelInfo
.
setEmail
(
change
.
getEmail
());
changeDelInfo
.
setSourceId
(
change
.
getId
());
changeDelInfo
.
setSourceId
(
change
.
getId
());
changeDelInfo
.
setDetail
(
"赠送时长:"
+
change
.
getDiscountTimeLong
()+
"天 — 赠送流量"
+
change
.
getDiscountFlow
());
changeDelInfo
.
setDetail
(
"赠送时长:"
+
change
.
getDiscountTimeLong
()
+
"天 — 赠送流量"
+
change
.
getDiscountFlow
());
this
.
saveChangeDelInfo
(
changeDelInfo
,
1
,
1
,
ip
,
loginUser
);
this
.
saveChangeDelInfo
(
changeDelInfo
,
1
,
1
,
ip
,
loginUser
);
return
change
;
return
change
;
}
else
if
(
"change"
.
equals
(
type
))
{
}
else
if
(
"change"
.
equals
(
type
))
{
//套餐变更
//套餐变更
ContractChange
contractChange
=
contractChangeRepository
.
findOne
(
Long
.
parseLong
(
id
));
ContractChange
contractChange
=
contractChangeRepository
.
findOne
(
Long
.
parseLong
(
id
));
contractChange
.
setDelFlag
(
1
);
contractChange
.
setDelFlag
(
1
);
...
@@ -1386,10 +1426,10 @@ public class ContractServiceImpl implements ContractService {
...
@@ -1386,10 +1426,10 @@ public class ContractServiceImpl implements ContractService {
changeDelInfo
.
setDetail
(
"套餐变更"
);
changeDelInfo
.
setDetail
(
"套餐变更"
);
changeDelInfo
.
setEmail
(
contractChange
.
getEmail
());
changeDelInfo
.
setEmail
(
contractChange
.
getEmail
());
changeDelInfo
.
setSourceId
(
contractChange
.
getId
());
changeDelInfo
.
setSourceId
(
contractChange
.
getId
());
this
.
saveChangeDelInfo
(
changeDelInfo
,
2
,
1
,
ip
,
loginUser
);
this
.
saveChangeDelInfo
(
changeDelInfo
,
2
,
1
,
ip
,
loginUser
);
return
contractChange
;
return
contractChange
;
}
else
{
}
else
{
ContractMoney
contractMoney
=
contractMoneyRepository
.
findOne
(
Long
.
parseLong
(
id
));
ContractMoney
contractMoney
=
contractMoneyRepository
.
findOne
(
Long
.
parseLong
(
id
));
contractMoney
.
setDelFlag
(
1
);
contractMoney
.
setDelFlag
(
1
);
...
@@ -1400,36 +1440,35 @@ public class ContractServiceImpl implements ContractService {
...
@@ -1400,36 +1440,35 @@ public class ContractServiceImpl implements ContractService {
changeDelInfo
.
setEmail
(
contractMoney
.
getEmail
());
changeDelInfo
.
setEmail
(
contractMoney
.
getEmail
());
changeDelInfo
.
setSourceId
(
contractMoney
.
getId
());
changeDelInfo
.
setSourceId
(
contractMoney
.
getId
());
if
(
"pay"
.
equals
(
contractMoney
.
getType
()))
{
if
(
"pay"
.
equals
(
contractMoney
.
getType
()))
{
this
.
dealPayMoneyByContractMoney
(
contractMoney
,-
1
);
this
.
dealPayMoneyByContractMoney
(
contractMoney
,
-
1
);
changeDelInfo
.
setDetail
(
"收款记录-金额:"
+
contractMoney
.
getMoney
());
changeDelInfo
.
setDetail
(
"收款记录-金额:"
+
contractMoney
.
getMoney
());
}
else
{
}
else
{
changeDelInfo
.
setDetail
(
"开票记录-金额:"
+
contractMoney
.
getMoney
());
changeDelInfo
.
setDetail
(
"开票记录-金额:"
+
contractMoney
.
getMoney
());
}
}
this
.
saveChangeDelInfo
(
changeDelInfo
,
3
,
1
,
ip
,
loginUser
);
this
.
saveChangeDelInfo
(
changeDelInfo
,
3
,
1
,
ip
,
loginUser
);
return
contractMoney
;
return
contractMoney
;
}
}
}
}
private
void
dealPayMoneyByContractMoney
(
ContractMoney
contractMoney
,
int
addOr
)
{
private
void
dealPayMoneyByContractMoney
(
ContractMoney
contractMoney
,
int
addOr
)
{
// 删除收款记录 修改相应收款金额
// 删除收款记录 修改相应收款金额
// 恢复收款记录 修改相应合同收款金额
// 恢复收款记录 修改相应合同收款金额
Contract
contract
=
contractRepository
.
findByCode
(
contractMoney
.
getContractCode
());
Contract
contract
=
contractRepository
.
findByCode
(
contractMoney
.
getContractCode
());
contract
.
setPayMoney
(
contract
.
getPayMoney
()
+
contractMoney
.
getMoney
()
*
addOr
);
contract
.
setPayMoney
(
contract
.
getPayMoney
()
+
contractMoney
.
getMoney
()
*
addOr
);
contractRepository
.
save
(
contract
);
contractRepository
.
save
(
contract
);
}
}
@Override
@Override
public
List
<
ChangeDelInfo
>
getChangeDelData
(
User
loginAccount
,
String
contranctCode
,
String
startDate
,
String
endDate
)
{
public
List
<
ChangeDelInfo
>
getChangeDelData
(
User
loginAccount
,
String
contranctCode
,
String
startDate
,
String
endDate
)
{
List
<
ChangeDelInfo
>
datas
=
changeDelInfoRepository
.
findOnStartDate
(
startDate
,
endDate
);
List
<
ChangeDelInfo
>
datas
=
changeDelInfoRepository
.
findOnStartDate
(
startDate
,
endDate
);
return
datas
;
return
datas
;
}
}
...
@@ -1447,30 +1486,30 @@ public class ContractServiceImpl implements ContractService {
...
@@ -1447,30 +1486,30 @@ public class ContractServiceImpl implements ContractService {
// 恢复删除
// 恢复删除
ChangeDelInfo
changeDelInfo
=
changeDelInfoRepository
.
findOne
(
Long
.
parseLong
(
id
));
ChangeDelInfo
changeDelInfo
=
changeDelInfoRepository
.
findOne
(
Long
.
parseLong
(
id
));
if
(
changeDelInfo
.
getModifyType
()==
1
)
{
if
(
changeDelInfo
.
getModifyType
()
==
1
)
{
// put("1","流量赠送");
// put("1","流量赠送");
// put("2","合同变更记录");
// put("2","合同变更记录");
// put("3","收款/开票记录");
// put("3","收款/开票记录");
// put("4","合同管理");
// put("4","合同管理");
if
(
changeDelInfo
.
getFunction
()==
1
)
{
if
(
changeDelInfo
.
getFunction
()
==
1
)
{
FlowChange
change
=
flowChangeRepository
.
findOne
(
changeDelInfo
.
getSourceId
());
FlowChange
change
=
flowChangeRepository
.
findOne
(
changeDelInfo
.
getSourceId
());
change
.
setDelFlag
(
0
);
change
.
setDelFlag
(
0
);
flowChangeRepository
.
save
(
change
);
flowChangeRepository
.
save
(
change
);
}
else
if
(
changeDelInfo
.
getFunction
()==
2
)
{
}
else
if
(
changeDelInfo
.
getFunction
()
==
2
)
{
ContractChange
contractChange
=
contractChangeRepository
.
findOne
(
changeDelInfo
.
getSourceId
());
ContractChange
contractChange
=
contractChangeRepository
.
findOne
(
changeDelInfo
.
getSourceId
());
contractChange
.
setDelFlag
(
0
);
contractChange
.
setDelFlag
(
0
);
contractChangeRepository
.
save
(
contractChange
);
contractChangeRepository
.
save
(
contractChange
);
}
else
if
(
changeDelInfo
.
getFunction
()==
3
)
{
}
else
if
(
changeDelInfo
.
getFunction
()
==
3
)
{
//
//
ContractMoney
money
=
contractMoneyRepository
.
findOne
(
changeDelInfo
.
getSourceId
());
ContractMoney
money
=
contractMoneyRepository
.
findOne
(
changeDelInfo
.
getSourceId
());
String
detail
=
changeDelInfo
.
getDetail
();
String
detail
=
changeDelInfo
.
getDetail
();
if
(
detail
!=
null
&&
detail
.
startsWith
(
"收款"
))
{
if
(
detail
!=
null
&&
detail
.
startsWith
(
"收款"
))
{
//恢复收款记录 修改相应合同收款金额
//恢复收款记录 修改相应合同收款金额
dealPayMoneyByContractMoney
(
money
,
1
);
dealPayMoneyByContractMoney
(
money
,
1
);
}
}
money
.
setDelFlag
(
0
);
money
.
setDelFlag
(
0
);
contractMoneyRepository
.
save
(
money
);
contractMoneyRepository
.
save
(
money
);
}
else
if
(
changeDelInfo
.
getFunction
()==
4
)
{
}
else
if
(
changeDelInfo
.
getFunction
()
==
4
)
{
// 合同恢复
// 合同恢复
Contract
contract
=
contractRepository
.
findOne
(
changeDelInfo
.
getSourceId
());
Contract
contract
=
contractRepository
.
findOne
(
changeDelInfo
.
getSourceId
());
contract
.
setStatus
(
changeDelInfo
.
getOriginal
());
contract
.
setStatus
(
changeDelInfo
.
getOriginal
());
...
@@ -1484,7 +1523,7 @@ public class ContractServiceImpl implements ContractService {
...
@@ -1484,7 +1523,7 @@ public class ContractServiceImpl implements ContractService {
return
null
;
return
null
;
}
}
public
void
saveChangeDelInfo
(
ChangeDelInfo
changeDelInfo
,
int
function
,
int
type
,
String
ip
,
User
loginUser
){
public
void
saveChangeDelInfo
(
ChangeDelInfo
changeDelInfo
,
int
function
,
int
type
,
String
ip
,
User
loginUser
)
{
changeDelInfo
.
setCreatTime
(
new
Date
());
changeDelInfo
.
setCreatTime
(
new
Date
());
changeDelInfo
.
setFunction
(
function
);
// 1 赠送记录
changeDelInfo
.
setFunction
(
function
);
// 1 赠送记录
...
@@ -1573,7 +1612,7 @@ public class ContractServiceImpl implements ContractService {
...
@@ -1573,7 +1612,7 @@ public class ContractServiceImpl implements ContractService {
changeDelInfo
.
setDetail
(
"修改详情"
);
//
changeDelInfo
.
setDetail
(
"修改详情"
);
//
changeDelInfo
.
setContractCode
(
contractMoney
.
getContractCode
());
changeDelInfo
.
setContractCode
(
contractMoney
.
getContractCode
());
changeDelInfo
.
setEmail
(
contractMoney
.
getEmail
());
changeDelInfo
.
setEmail
(
contractMoney
.
getEmail
());
this
.
saveChangeDelInfo
(
changeDelInfo
,
3
,
2
,
ip
,
loginUser
);
this
.
saveChangeDelInfo
(
changeDelInfo
,
3
,
2
,
ip
,
loginUser
);
delDetail
.
setCreatTime
(
new
Date
());
delDetail
.
setCreatTime
(
new
Date
());
delDetail
.
setContractCode
(
contractMoney
.
getContractCode
());
delDetail
.
setContractCode
(
contractMoney
.
getContractCode
());
...
@@ -1640,9 +1679,9 @@ public class ContractServiceImpl implements ContractService {
...
@@ -1640,9 +1679,9 @@ public class ContractServiceImpl implements ContractService {
@Override
@Override
public
List
<
Map
>
contractCodeAll
(
String
platform
,
String
contractId
)
{
public
List
<
Map
>
contractCodeAll
(
String
platform
,
String
contractId
)
{
Map
<
String
,
String
>
data
=
new
HashMap
<>();
Map
<
String
,
String
>
data
=
new
HashMap
<>();
data
.
put
(
"id"
,
"-1"
);
data
.
put
(
"id"
,
"-1"
);
data
.
put
(
"contractCode"
,
"无"
);
data
.
put
(
"contractCode"
,
"无"
);
List
result
=
new
ArrayList
();
List
result
=
new
ArrayList
();
result
.
add
(
data
);
result
.
add
(
data
);
...
@@ -1651,13 +1690,13 @@ public class ContractServiceImpl implements ContractService {
...
@@ -1651,13 +1690,13 @@ public class ContractServiceImpl implements ContractService {
plats
.
add
(
platform
);
plats
.
add
(
platform
);
if
(
"fake"
.
equals
(
platform
))
{
if
(
"fake"
.
equals
(
platform
))
{
plats
.
add
(
"tkio"
);
plats
.
add
(
"tkio"
);
}
}
List
<
ContractRelation
>
ids
=
null
;
List
<
ContractRelation
>
ids
=
null
;
Contract
contract
=
null
;
Contract
contract
=
null
;
if
(!
StringUtils
.
isEmpty
(
contractId
)
&&
!
contractId
.
equals
(
"null"
))
{
if
(!
StringUtils
.
isEmpty
(
contractId
)
&&
!
contractId
.
equals
(
"null"
))
{
ids
=
contractRelationRepository
.
findRelationIdsMain
(
contractId
);
ids
=
contractRelationRepository
.
findRelationIdsMain
(
contractId
);
contract
=
contractRepository
.
findOne
(
Long
.
parseLong
(
contractId
));
contract
=
contractRepository
.
findOne
(
Long
.
parseLong
(
contractId
));
}
}
...
@@ -1665,11 +1704,11 @@ public class ContractServiceImpl implements ContractService {
...
@@ -1665,11 +1704,11 @@ public class ContractServiceImpl implements ContractService {
if
(
ids
!=
null
)
{
if
(
ids
!=
null
)
{
// 已关联合同 字典
// 已关联合同 字典
Map
<
String
,
String
>
filterMap
=
new
HashMap
();
Map
<
String
,
String
>
filterMap
=
new
HashMap
();
for
(
ContractRelation
relation
:
ids
)
{
for
(
ContractRelation
relation
:
ids
)
{
if
(
contract
!=
null
&&
!
relation
.
getRelationId
().
equals
(
contract
.
getRelationContract
()))
{
if
(
contract
!=
null
&&
!
relation
.
getRelationId
().
equals
(
contract
.
getRelationContract
()))
{
filterMap
.
put
(
relation
.
getRelationId
()+
"_"
,
""
);
filterMap
.
put
(
relation
.
getRelationId
()
+
"_"
,
""
);
}
}
}
}
...
@@ -1679,7 +1718,7 @@ public class ContractServiceImpl implements ContractService {
...
@@ -1679,7 +1718,7 @@ public class ContractServiceImpl implements ContractService {
for
(
Map
m
:
resultBefore
)
{
for
(
Map
m
:
resultBefore
)
{
String
m_id
=
m
.
get
(
"id"
).
toString
()
+
"_"
;
String
m_id
=
m
.
get
(
"id"
).
toString
()
+
"_"
;
if
(
filterMap
.
get
(
m_id
)
==
null
&&
!
m_id
.
equals
(
contractId
+
"_"
))
{
if
(
filterMap
.
get
(
m_id
)
==
null
&&
!
m_id
.
equals
(
contractId
+
"_"
))
{
result
.
add
(
m
);
result
.
add
(
m
);
}
}
}
}
...
@@ -1695,12 +1734,12 @@ public class ContractServiceImpl implements ContractService {
...
@@ -1695,12 +1734,12 @@ public class ContractServiceImpl implements ContractService {
Contract
contractExist
=
contractRepository
.
findByCodePlatform
(
contractCode
,
platform
);
Contract
contractExist
=
contractRepository
.
findByCodePlatform
(
contractCode
,
platform
);
Map
<
String
,
String
>
data
=
new
HashMap
<>();
Map
<
String
,
String
>
data
=
new
HashMap
<>();
if
(
contractExist
!=
null
)
{
if
(
contractExist
!=
null
)
{
data
.
put
(
"exist"
,
"true"
);
data
.
put
(
"exist"
,
"true"
);
}
else
{
}
else
{
data
.
put
(
"exist"
,
"false"
);
data
.
put
(
"exist"
,
"false"
);
}
}
return
data
;
return
data
;
}
}
...
@@ -1757,8 +1796,4 @@ public class ContractServiceImpl implements ContractService {
...
@@ -1757,8 +1796,4 @@ public class ContractServiceImpl implements ContractService {
}
}
}
}
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