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
ca9d7978
Commit
ca9d7978
authored
Apr 27, 2019
by
kangxiaoshan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
大后台更新
parent
6c65e984
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
374 additions
and
11 deletions
+374
-11
ContractController.java
src/main/java/common/controller/ContractController.java
+23
-6
Contract.java
src/main/java/common/model/Contract.java
+88
-5
ContractRelation.java
src/main/java/common/model/ContractRelation.java
+52
-0
TradeType.java
src/main/java/common/model/TradeType.java
+68
-0
ContractRelationRepository.java
...in/java/common/repository/ContractRelationRepository.java
+11
-0
ContractRepository.java
src/main/java/common/repository/ContractRepository.java
+10
-0
TradeTypeRepsitory.java
src/main/java/common/repository/TradeTypeRepsitory.java
+12
-0
ContractService.java
src/main/java/common/service/ContractService.java
+9
-0
ContractServiceImpl.java
src/main/java/common/service/impl/ContractServiceImpl.java
+101
-0
No files found.
src/main/java/common/controller/ContractController.java
View file @
ca9d7978
...
@@ -50,12 +50,12 @@ public class ContractController {
...
@@ -50,12 +50,12 @@ public class ContractController {
@Autowired
@Autowired
private
ContractService
service
;
private
ContractService
service
;
@RequestMapping
(
value
=
"find"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
value
=
"find"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
@ResponseBody
public
ResultModel
findAll
(
@CurrentAccount
User
loginAccount
,
@PathVariable
String
platform
,
public
ResultModel
findAll
(
@CurrentAccount
User
loginAccount
,
@PathVariable
String
platform
,
@RequestParam
String
startDate
,
@RequestParam
String
endDate
)
{
@RequestParam
String
startDate
,
@RequestParam
String
endDate
)
{
return
ResultModel
.
OK
(
service
.
findAll
(
loginAccount
,
startDate
,
endDate
,
platform
));
return
ResultModel
.
OK
(
service
.
findAllContract
(
loginAccount
,
startDate
,
endDate
,
platform
));
}
}
@RequestMapping
(
value
=
"export"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_OCTET_STREAM_VALUE
)
@RequestMapping
(
value
=
"export"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_OCTET_STREAM_VALUE
)
...
@@ -161,8 +161,9 @@ public class ContractController {
...
@@ -161,8 +161,9 @@ public class ContractController {
@RequestMapping
(
value
=
"find/code"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
value
=
"find/code"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
@ResponseBody
public
ResultModel
findCode
(
@CurrentAccount
User
loginAccount
,
@RequestParam
String
code
)
{
public
ResultModel
findCode
(
@CurrentAccount
User
loginAccount
,
@RequestParam
String
code
,
@PathVariable
String
platform
,
String
company
)
{
return
ResultModel
.
OK
(
service
.
getContractCode
(
code
));
return
ResultModel
.
OK
(
service
.
getContractCode
(
code
,
platform
,
company
));
}
}
@RequestMapping
(
value
=
"find/pricelevel"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
value
=
"find/pricelevel"
,
method
=
RequestMethod
.
GET
)
...
@@ -264,10 +265,26 @@ public class ContractController {
...
@@ -264,10 +265,26 @@ public class ContractController {
@ResponseBody
@ResponseBody
public
ResultModel
build
(
@RequestBody
Contract
contract
,
HttpServletRequest
request
)
{
public
ResultModel
build
(
@RequestBody
Contract
contract
,
HttpServletRequest
request
)
{
// ContractSendEmailThread email = new ContractSendEmailThread(contract);
// email.start();
logger
.
error
(
"tkiio---------------"
+
contract
);
logger
.
error
(
"tkiio---------------"
+
contract
);
return
ResultModel
.
OK
(
service
.
build
(
contract
));
return
ResultModel
.
OK
(
service
.
build
(
contract
));
}
}
@RequestMapping
(
value
=
"trade"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
public
ResultModel
baseCreate
(
@RequestBody
Contract
contract
,
@PathVariable
String
platform
)
{
return
ResultModel
.
OK
(
service
.
getTradeData
(
platform
));
}
@RequestMapping
(
value
=
"code/all"
,
method
=
RequestMethod
.
POST
)
@ResponseBody
public
ResultModel
contractCodeAll
(
@RequestBody
Contract
contract
,
@PathVariable
String
platform
)
{
return
ResultModel
.
OK
(
service
.
contractCodeAll
(
platform
));
}
}
}
src/main/java/common/model/Contract.java
View file @
ca9d7978
...
@@ -16,7 +16,7 @@ public class Contract {
...
@@ -16,7 +16,7 @@ public class Contract {
private
String
myBodyName
;
private
String
myBodyName
;
private
String
myBodyCode
;
private
String
myBodyCode
;
private
String
customerBody
;
private
String
customerBody
;
private
String
email
;
private
String
email
;
//客户主账号
private
String
contractCode
;
private
String
contractCode
;
//是否首次签约
//是否首次签约
private
String
contractType
;
private
String
contractType
;
...
@@ -24,16 +24,18 @@ public class Contract {
...
@@ -24,16 +24,18 @@ public class Contract {
private
String
endDate
;
private
String
endDate
;
//套餐
//套餐
private
Long
priceLevel
;
private
Long
priceLevel
;
private
Long
money
;
private
String
priceLevelName
;
private
Double
rebate
;
private
Long
money
;
//合同金额
private
Double
rebate
;
//
private
Long
sale
;
private
Long
sale
;
//产品trackingio or adi ...
//产品trackingio or adi ...
private
String
platform
;
private
String
platform
;
private
String
status
;
private
String
status
;
private
String
saleName
;
private
String
saleName
;
private
String
priceLevelName
;
private
Long
payMoney
;
private
Long
payMoney
;
private
Long
invoice
;
private
Long
invoice
;
// 发票金额
private
String
createName
;
private
String
createName
;
//合同类型 主套餐 or 增值套餐
//合同类型 主套餐 or 增值套餐
private
String
type
;
private
String
type
;
...
@@ -48,6 +50,23 @@ public class Contract {
...
@@ -48,6 +50,23 @@ public class Contract {
private
String
ds
;
private
String
ds
;
private
Boolean
virtual
;
private
Boolean
virtual
;
/**
* 新增字段
*/
// private Long catogrey; //行业
private
Long
discountFlow
;
// 优惠流量
private
Long
discountTimeLong
;
// 优惠时长
private
Double
rebateMoney
;
//回款金额
private
String
customerShort
;
// 客户简称
private
String
customerThird
;
// 三方客户
private
int
tradeType
;
// 行业id
private
Long
relationContract
;
// 关联合同id
private
String
createrName
;
// 录入人
@Id
@Id
@GeneratedValue
@GeneratedValue
public
Long
getId
()
{
public
Long
getId
()
{
...
@@ -300,6 +319,70 @@ public class Contract {
...
@@ -300,6 +319,70 @@ public class Contract {
this
.
createName
=
createName
;
this
.
createName
=
createName
;
}
}
public
Long
getDiscountFlow
()
{
return
discountFlow
;
}
public
void
setDiscountFlow
(
Long
discountFlow
)
{
this
.
discountFlow
=
discountFlow
;
}
public
Long
getDiscountTimeLong
()
{
return
discountTimeLong
;
}
public
void
setDiscountTimeLong
(
Long
discountTimeLong
)
{
this
.
discountTimeLong
=
discountTimeLong
;
}
public
Double
getRebateMoney
()
{
return
rebateMoney
;
}
public
void
setRebateMoney
(
Double
rebateMoney
)
{
this
.
rebateMoney
=
rebateMoney
;
}
public
String
getCustomerShort
()
{
return
customerShort
;
}
public
void
setCustomerShort
(
String
customerShort
)
{
this
.
customerShort
=
customerShort
;
}
public
String
getCustomerThird
()
{
return
customerThird
;
}
public
void
setCustomerThird
(
String
customerThird
)
{
this
.
customerThird
=
customerThird
;
}
public
int
getTradeType
()
{
return
tradeType
;
}
public
void
setTradeType
(
int
tradeType
)
{
this
.
tradeType
=
tradeType
;
}
public
Long
getRelationContract
()
{
return
relationContract
;
}
public
void
setRelationContract
(
Long
relationContract
)
{
this
.
relationContract
=
relationContract
;
}
public
String
getCreaterName
()
{
return
createrName
;
}
public
void
setCreaterName
(
String
createrName
)
{
this
.
createrName
=
createrName
;
}
@Override
@Override
public
String
toString
()
{
public
String
toString
()
{
return
"Contract{"
+
return
"Contract{"
+
...
...
src/main/java/common/model/ContractRelation.java
0 → 100644
View file @
ca9d7978
package
common
.
model
;
import
javax.persistence.Entity
;
import
javax.persistence.GeneratedValue
;
import
javax.persistence.Id
;
import
javax.persistence.Transient
;
import
java.util.Date
;
/**
* Created .
* 合同 关联信息
*/
@Entity
public
class
ContractRelation
{
private
Long
id
;
private
Long
mainContract
;
private
Long
relationId
;
private
Date
createTime
;
@Id
@GeneratedValue
public
Long
getId
()
{
return
id
;
}
public
void
setId
(
Long
id
)
{
this
.
id
=
id
;
}
public
Long
getMainContract
()
{
return
mainContract
;
}
public
void
setMainContract
(
Long
mainContract
)
{
this
.
mainContract
=
mainContract
;
}
public
Long
getRelationId
()
{
return
relationId
;
}
public
void
setRelationId
(
Long
relationId
)
{
this
.
relationId
=
relationId
;
}
public
Date
getCreateTime
()
{
return
createTime
;
}
public
void
setCreateTime
(
Date
createTime
)
{
this
.
createTime
=
createTime
;
}
}
src/main/java/common/model/TradeType.java
0 → 100644
View file @
ca9d7978
package
common
.
model
;
import
javax.persistence.Entity
;
import
javax.persistence.GeneratedValue
;
import
javax.persistence.Id
;
@Entity
public
class
TradeType
{
private
Long
id
;
private
Long
parentId
;
private
String
name
;
private
String
code
;
private
String
platform
;
private
int
sort
;
@Id
@GeneratedValue
public
Long
getId
()
{
return
id
;
}
public
void
setId
(
Long
id
)
{
this
.
id
=
id
;
}
public
Long
getParentId
()
{
return
parentId
;
}
public
void
setParentId
(
Long
parentId
)
{
this
.
parentId
=
parentId
;
}
public
String
getName
()
{
return
name
;
}
public
void
setName
(
String
name
)
{
this
.
name
=
name
;
}
public
String
getCode
()
{
return
code
;
}
public
void
setCode
(
String
code
)
{
this
.
code
=
code
;
}
public
String
getPlatform
()
{
return
platform
;
}
public
void
setPlatform
(
String
platform
)
{
this
.
platform
=
platform
;
}
public
int
getSort
()
{
return
sort
;
}
public
void
setSort
(
int
sort
)
{
this
.
sort
=
sort
;
}
}
src/main/java/common/repository/ContractRelationRepository.java
0 → 100644
View file @
ca9d7978
package
common
.
repository
;
import
common.model.ContractRelation
;
import
org.springframework.data.jpa.repository.JpaRepository
;
/**
* 合同 关联信息
*/
public
interface
ContractRelationRepository
extends
JpaRepository
<
ContractRelation
,
Long
>
{
}
src/main/java/common/repository/ContractRepository.java
View file @
ca9d7978
...
@@ -8,6 +8,7 @@ import org.springframework.transaction.annotation.Transactional;
...
@@ -8,6 +8,7 @@ import org.springframework.transaction.annotation.Transactional;
import
java.math.BigInteger
;
import
java.math.BigInteger
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
@Transactional
@Transactional
public
interface
ContractRepository
extends
JpaRepository
<
Contract
,
Long
>
{
public
interface
ContractRepository
extends
JpaRepository
<
Contract
,
Long
>
{
...
@@ -47,4 +48,13 @@ public interface ContractRepository extends JpaRepository<Contract, Long> {
...
@@ -47,4 +48,13 @@ public interface ContractRepository extends JpaRepository<Contract, Long> {
@Query
(
value
=
"SELECT * from contract where end_date <= ?1 and (status <> 'end' or status <> 'cancel')"
,
nativeQuery
=
true
)
@Query
(
value
=
"SELECT * from contract where end_date <= ?1 and (status <> 'end' or status <> 'cancel')"
,
nativeQuery
=
true
)
List
<
Contract
>
findByEndDate
(
String
endDate
);
List
<
Contract
>
findByEndDate
(
String
endDate
);
@Query
(
value
=
"select count(*) from contract where platform = ?1"
,
nativeQuery
=
true
)
BigInteger
findcountContract
(
String
platform
);
@Query
(
value
=
"select new map( c.id as id, c.contractCode as contractCode ) from Contract c where c.platform = ?1"
)
Map
contractCodePlatform
(
String
platform
);
@Query
(
value
=
"select * from contract where platform = ?1 and contract_code = ?2"
,
nativeQuery
=
true
)
Contract
findByCodePlatform
(
String
contractCode
,
String
platform
);
}
}
src/main/java/common/repository/TradeTypeRepsitory.java
0 → 100644
View file @
ca9d7978
package
common
.
repository
;
import
common.model.TradeType
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.transaction.annotation.Transactional
;
@Transactional
public
interface
TradeTypeRepsitory
extends
JpaRepository
<
TradeType
,
Long
>{
}
src/main/java/common/service/ContractService.java
View file @
ca9d7978
...
@@ -48,4 +48,12 @@ public interface ContractService {
...
@@ -48,4 +48,12 @@ public interface ContractService {
List
<
ContractMoney
>
findPayAll
(
String
startDate
,
String
endDate
,
String
platform
);
List
<
ContractMoney
>
findPayAll
(
String
startDate
,
String
endDate
,
String
platform
);
Contract
build
(
Contract
contract
);
Contract
build
(
Contract
contract
);
String
getContractCode
(
String
code
,
String
platform
,
String
company
);
List
<
TradeType
>
getTradeData
(
String
platform
);
Map
contractCodeAll
(
String
platform
);
List
<
Contract
>
findAllContract
(
User
loginAccount
,
String
startDate
,
String
endDate
,
String
platform
);
}
}
\ No newline at end of file
src/main/java/common/service/impl/ContractServiceImpl.java
View file @
ca9d7978
...
@@ -85,6 +85,14 @@ public class ContractServiceImpl implements ContractService{
...
@@ -85,6 +85,14 @@ public class ContractServiceImpl implements ContractService{
@Autowired
@Autowired
ADIAccountService
adiAccountService
;
ADIAccountService
adiAccountService
;
@Autowired
TradeTypeRepsitory
tradeTypeRepsitory
;
@Autowired
ContractRelationRepository
contractRelationRepository
;
@Override
@Override
public
Map
<
String
,
Object
>
checkAccount
(
String
email
,
String
platfrom
)
{
public
Map
<
String
,
Object
>
checkAccount
(
String
email
,
String
platfrom
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
...
@@ -169,6 +177,23 @@ public class ContractServiceImpl implements ContractService{
...
@@ -169,6 +177,23 @@ public class ContractServiceImpl implements ContractService{
}
}
@Override
@Override
public
String
getContractCode
(
String
code
,
String
platform
,
String
company
)
{
BigInteger
countContract
=
contractRepository
.
findcountContract
(
platform
);
String
lastCode
=
""
;
int
codeInt
=
countContract
.
intValue
();
if
(
codeInt
<
9
){
lastCode
=
"0"
+(
codeInt
+
1
);
}
else
{
lastCode
=
""
+(
codeInt
+
1
);
}
return
company
+
"-"
+
platform
+
"-"
+
DateUtil
.
getDays2
(
0
)+
"-"
+
lastCode
;
}
@Override
public
List
findSetmeal
(
String
platform
)
{
public
List
findSetmeal
(
String
platform
)
{
List
list
=
new
ArrayList
();
List
list
=
new
ArrayList
();
if
(
"adi"
.
equals
(
platform
)){
if
(
"adi"
.
equals
(
platform
)){
...
@@ -239,6 +264,47 @@ public class ContractServiceImpl implements ContractService{
...
@@ -239,6 +264,47 @@ public class ContractServiceImpl implements ContractService{
}
}
@Override
@Override
public
Contract
create
(
User
loginUser
,
Contract
resource
)
{
public
Contract
create
(
User
loginUser
,
Contract
resource
)
{
if
(
resource
==
null
){
return
null
;
}
Contract
contractExist
=
contractRepository
.
findByCodePlatform
(
resource
.
getContractCode
(),
resource
.
getPlatform
());
if
(
contractExist
!=
null
){
// 合同编号已存在
return
null
;
}
resource
.
setPayMoney
(
0L
);
resource
.
setInvoice
(
0L
);
resource
.
setStatus
(
ContractStatusEnum
.
EXECUTING
.
getKey
());
resource
.
setCreateTime
(
new
Date
());
if
(
null
!=
loginUser
)
{
resource
.
setCreateAccount
(
loginUser
.
getId
());
resource
.
setCreaterName
(
loginUser
.
getName
());
}
resource
=
contractRepository
.
save
(
resource
);
if
(
resource
.
getRelationContract
()>
0
){
//保存关联合同信息
ContractRelation
relation
=
new
ContractRelation
();
relation
.
setCreateTime
(
new
Date
());
relation
.
setMainContract
(
resource
.
getId
());
relation
.
setRelationId
(
resource
.
getRelationContract
());
contractRelationRepository
.
save
(
relation
);
}
if
(
true
){
return
resource
;
}
// 老的逻辑
String
contractCode
=
getContractCode
(
resource
.
getMyBodyCode
());
String
contractCode
=
getContractCode
(
resource
.
getMyBodyCode
());
if
(!
contractCode
.
equals
(
resource
.
getContractCode
())){
if
(!
contractCode
.
equals
(
resource
.
getContractCode
())){
...
@@ -288,6 +354,7 @@ public class ContractServiceImpl implements ContractService{
...
@@ -288,6 +354,7 @@ public class ContractServiceImpl implements ContractService{
if
(
null
!=
loginUser
)
{
if
(
null
!=
loginUser
)
{
resource
.
setCreateAccount
(
loginUser
.
getId
());
resource
.
setCreateAccount
(
loginUser
.
getId
());
resource
.
setCreaterName
(
loginUser
.
getName
());
}
}
resource
.
setCreateTime
(
new
Date
());
resource
.
setCreateTime
(
new
Date
());
...
@@ -489,6 +556,28 @@ public class ContractServiceImpl implements ContractService{
...
@@ -489,6 +556,28 @@ public class ContractServiceImpl implements ContractService{
}
}
@Override
@Override
public
List
<
Contract
>
findAllContract
(
User
loginAccount
,
String
startDate
,
String
endDate
,
String
platform
)
{
List
<
Contract
>
contractList
;
if
(!
loginAccount
.
getRole
().
equals
(
RoleEnum
.
MANAGER
.
getKey
())){
//非 管理员
List
<
User
>
userList
=
userService
.
findAllSons
(
loginAccount
.
getId
());
List
<
Long
>
idList
=
new
ArrayList
<>();
idList
.
add
(
loginAccount
.
getId
());
for
(
User
u
:
userList
){
idList
.
add
(
u
.
getId
());
}
contractList
=
contractRepository
.
findByDsAndRoile
(
startDate
,
endDate
,
platform
,
idList
);
}
else
{
contractList
=
contractRepository
.
findByDs
(
startDate
,
endDate
,
platform
);
}
return
contractList
;
}
@Override
public
Contract
findOne
(
String
code
)
{
public
Contract
findOne
(
String
code
)
{
List
<
Contract
>
result
=
new
ArrayList
<>();
List
<
Contract
>
result
=
new
ArrayList
<>();
...
@@ -710,7 +799,19 @@ public class ContractServiceImpl implements ContractService{
...
@@ -710,7 +799,19 @@ public class ContractServiceImpl implements ContractService{
return
result
;
return
result
;
}
}
@Override
public
List
<
TradeType
>
getTradeData
(
String
platform
)
{
return
tradeTypeRepsitory
.
findAll
();
}
@Override
public
Map
contractCodeAll
(
String
platform
)
{
return
contractRepository
.
contractCodePlatform
(
platform
);
}
public
Map
<
Long
,
String
>
getPackageMap
(){
public
Map
<
Long
,
String
>
getPackageMap
(){
List
<
PackageType
>
typeList
=
packageTypeRepository
.
findAll
();
List
<
PackageType
>
typeList
=
packageTypeRepository
.
findAll
();
...
...
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