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
507ba850
Commit
507ba850
authored
May 27, 2019
by
kangxiaoshan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
大后台
parent
ae9ee6ae
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
52 additions
and
31 deletions
+52
-31
Contract.java
src/main/java/common/model/Contract.java
+9
-11
ContractRepository.java
src/main/java/common/repository/ContractRepository.java
+4
-0
ContractServiceImpl.java
src/main/java/common/service/impl/ContractServiceImpl.java
+39
-20
No files found.
src/main/java/common/model/Contract.java
View file @
507ba850
...
...
@@ -19,6 +19,7 @@ public class Contract {
private
String
customerBody
;
private
String
email
;
//客户主账号
private
String
contractCode
;
private
int
codeNum
;
//是否首次签约
private
String
contractType
;
// 0 首次签约 1 续签 2 合同变更
private
String
startDate
;
...
...
@@ -63,8 +64,6 @@ public class Contract {
private
String
customerThird
;
// 三方客户
private
int
tradeType
;
// 行业id
private
Long
relationContract
;
// 关联合同id
private
String
relationCode
;
// 关联合同编号
private
String
hasDiscount
;
// 是否有优惠
...
...
@@ -264,10 +263,6 @@ public class Contract {
return
invoice
;
}
// public BigDecimal getRebateMoney() {
// return rebateMoney;
// }
public
BigDecimal
getInvoiceMoney
()
{
return
invoiceMoney
;
}
...
...
@@ -276,10 +271,6 @@ public class Contract {
this
.
invoiceMoney
=
invoiceMoney
;
}
// public void setRebateMoney(BigDecimal rebateMoney) {
// this.rebateMoney = rebateMoney;
// }
public
void
setInvoice
(
Long
invoice
)
{
this
.
invoice
=
invoice
;
}
...
...
@@ -308,6 +299,14 @@ public class Contract {
this
.
old
=
old
;
}
public
int
getCodeNum
()
{
return
codeNum
;
}
public
void
setCodeNum
(
int
codeNum
)
{
this
.
codeNum
=
codeNum
;
}
@Transient
public
Long
getPriceName
()
{
return
priceName
;
...
...
@@ -330,7 +329,6 @@ public class Contract {
return
priceLevelName
;
}
@Transient
public
String
getRelationCode
()
{
return
relationCode
;
}
...
...
src/main/java/common/repository/ContractRepository.java
View file @
507ba850
...
...
@@ -68,4 +68,8 @@ public interface ContractRepository extends JpaRepository<Contract, Long> {
@Query
(
value
=
"select new map( c.id as id, c.contractCode as contractCode ) from Contract c where c.platform in ?1 and c.contractCode is not null and c.contractCode <> 'null' "
)
List
<
Contract
>
contractCodePlatformNot
(
List
<
String
>
plats
,
List
<
Long
>
ids
);
@Query
(
value
=
"select contract_code from contract where my_body_code = ?1 order by code_num desc limit 1"
,
nativeQuery
=
true
)
String
findLastCode
(
String
code
);
}
src/main/java/common/service/impl/ContractServiceImpl.java
View file @
507ba850
...
...
@@ -188,22 +188,47 @@ public class ContractServiceImpl implements ContractService {
@Override
public
String
getContractCode
(
String
code
,
String
platform
,
String
company
)
{
BigInteger
countContract
=
contractRepository
.
findcountContract
(
code
);
// BigInteger countContract = contractRepository.findcountContract(code);
//
// String lastCode;
//
// if("fake".equals(platform)){
// platform = "FZBWS";
// }
//
// int codeInt = countContract.intValue();
//
// if (codeInt < 9) {
// lastCode = "0" + (codeInt + 1);
// } else {
// lastCode = "" + (codeInt + 1);
// }
// return code + "-" + platform.toUpperCase() + "-" + DateUtil.getDays2(0) + "-" + lastCode;
String
lastCode
;
String
codeName
=
contractRepository
.
findLastCode
(
code
);
if
(
"fake"
.
equals
(
platform
)){
platform
=
"FZBWS"
;
}
int
codeInt
=
countContract
.
intValue
();
int
codeInt
=
0
;
if
(!
StringUtils
.
isEmpty
(
codeName
)){
codeInt
=
Integer
.
parseInt
(
codeName
.
split
(
"-"
)[
3
]);
}
String
lastCode
;
if
(
codeInt
<
9
)
{
lastCode
=
"0"
+
(
codeInt
+
1
);
}
else
{
lastCode
=
""
+
(
codeInt
+
1
);
}
return
code
+
"-"
+
platform
.
toUpperCase
()
+
"-"
+
DateUtil
.
getDays2
(
0
)
+
"-"
+
lastCode
;
}
@Override
...
...
@@ -327,9 +352,6 @@ public class ContractServiceImpl implements ContractService {
resource
.
setCreateName
(
loginUser
.
getName
());
}
resource
.
setCreateTime
(
new
Date
());
//同步修改trackingio的数据
...
...
@@ -389,20 +411,13 @@ public class ContractServiceImpl implements ContractService {
Contract
contract
=
contractRepository
.
findOne
(
resource
.
getRelationContract
());
if
(
contract
.
getRelationContract
()
==
null
||
contract
.
getRelationContract
()
==
-
1
)
{
contract
.
setRelationContract
(
contractId
);
contract
.
setRelationCode
(
resource
.
getContractCode
());
contractRepository
.
save
(
contract
);
}
// ContractRelation relationOrigNext = contractRelationRepository.findByRelationData(relation.getRelationId(), relation.getMainContract(), resource.getPlatform());
//
// if (relationOrigNext == null) {
// // 主动关联
// ContractRelation relation2 = new ContractRelation();
// relation2.setCreateTime(new Date());
// relation2.setMainContract(resource.getRelationContract());
// relation2.setRelationId(contractId);
// relation2.setPlatform(resource.getPlatform());
// contractRelationRepository.save(relation2);
// }
//设置关联编号
resource
.
setRelationCode
(
contract
.
getContractCode
());
contractRepository
.
save
(
resource
);
}
}
...
...
@@ -786,6 +801,10 @@ public class ContractServiceImpl implements ContractService {
//记录优惠信息
saveFlowChange
(
resource
,
loginUser
,
type
,
resource
.
getDiscountTimeLong
(),
resource
.
getExtraFlow
());
}
//处理合同编号
resource
.
setCodeNum
(
Integer
.
parseInt
(
resource
.
getContractCode
().
split
(
"-"
)[
3
]));
}
...
...
@@ -797,9 +816,9 @@ public class ContractServiceImpl implements ContractService {
}
if
(
money
.
getType
().
equals
(
"pay"
))
{
contract
.
setPay
Money
(
contract
.
getMoney
());
money
.
set
Money
(
contract
.
getMoney
());
}
else
{
contract
.
setInvoice
(
contract
.
getInvoiceMoney
().
longValue
());
money
.
setMoney
(
contract
.
getInvoiceMoney
().
longValue
());
}
money
.
setCompany
(
contract
.
getMyBodyName
());
...
...
@@ -1333,7 +1352,7 @@ public class ContractServiceImpl implements ContractService {
for
(
ContractRelation
relation
:
ids
){
if
(
contract
!=
null
&&
!
relation
.
getRelationId
().
equals
(
contract
.
getRelationContract
())){
filterMap
.
put
(
relation
.
getRelationId
()+
"_"
,
""
);
filterMap
.
put
(
relation
.
getRelationId
()+
"_"
,
""
);
}
}
...
...
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