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
2871f2df
Commit
2871f2df
authored
Apr 27, 2019
by
kangxiaoshan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
大后台更新2
parent
9dc2bb7f
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
104 additions
and
58 deletions
+104
-58
workspace.xml
.idea/workspace.xml
+0
-0
pom.xml
pom.xml
+1
-1
ContractController.java
src/main/java/common/controller/ContractController.java
+3
-3
Contract.java
src/main/java/common/model/Contract.java
+12
-5
ContractRelation.java
src/main/java/common/model/ContractRelation.java
+9
-0
ContractRelationRepository.java
...in/java/common/repository/ContractRelationRepository.java
+6
-0
ContractRepository.java
src/main/java/common/repository/ContractRepository.java
+6
-0
ContractService.java
src/main/java/common/service/ContractService.java
+3
-2
ContractServiceImpl.java
src/main/java/common/service/impl/ContractServiceImpl.java
+63
-47
TkioAccountController.java
src/main/java/tkio/controller/TkioAccountController.java
+1
-0
No files found.
.idea/workspace.xml
View file @
2871f2df
This diff is collapsed.
Click to expand it.
pom.xml
View file @
2871f2df
...
...
@@ -129,7 +129,7 @@
<mail.valid_time>
3
</mail.valid_time>
<!--<report.url>http://localhost:9010</report.url>-->
<report.url>
http://
http://
10.3.20.41:11010
</report.url>
<report.url>
http://10.3.20.41:11010
</report.url>
<!--Redis setting-->
<redis.key.validtime>
120
</redis.key.validtime>
<redis.ip.requesttimes>
5
</redis.ip.requesttimes>
...
...
src/main/java/common/controller/ContractController.java
View file @
2871f2df
...
...
@@ -53,16 +53,16 @@ public class ContractController {
@RequestMapping
(
value
=
"find"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
public
ResultModel
findAll
(
@CurrentAccount
User
loginAccount
,
@PathVariable
String
platform
,
@RequestParam
String
startDate
,
@RequestParam
String
endDate
)
{
@RequestParam
String
startDate
,
@RequestParam
String
endDate
,
String
contractId
)
{
return
ResultModel
.
OK
(
service
.
findAll
Contract
(
loginAccount
,
startDate
,
endDate
,
platform
));
return
ResultModel
.
OK
(
service
.
findAll
(
loginAccount
,
startDate
,
endDate
,
platform
,
contractId
));
}
@RequestMapping
(
value
=
"export"
,
method
=
RequestMethod
.
GET
,
produces
=
MediaType
.
APPLICATION_OCTET_STREAM_VALUE
)
@ResponseBody
public
ResponseEntity
<
byte
[]>
export
(
@CurrentAccount
User
loginAccount
,
@PathVariable
String
platform
,
@RequestParam
String
startDate
,
@RequestParam
String
endDate
,
HttpServletRequest
request
,
HttpServletResponse
response
)
{
List
<
Contract
>
contractList
=
service
.
findAll
(
loginAccount
,
startDate
,
endDate
,
platform
);
List
<
Contract
>
contractList
=
service
.
findAll
(
loginAccount
,
startDate
,
endDate
,
platform
,
null
);
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"wait"
,
"未执行"
);
map
.
put
(
"executing"
,
"执行中"
);
...
...
src/main/java/common/model/Contract.java
View file @
2871f2df
...
...
@@ -4,6 +4,7 @@ import javax.persistence.Entity;
import
javax.persistence.GeneratedValue
;
import
javax.persistence.Id
;
import
javax.persistence.Transient
;
import
java.math.BigDecimal
;
import
java.util.Date
;
/**
...
...
@@ -29,13 +30,14 @@ public class Contract {
private
Double
rebate
;
//
private
Long
sale
;
//产品trackingio or adi ...
//产品
trackingio or adi ...
private
String
platform
;
private
String
status
;
private
String
saleName
;
private
Long
payMoney
;
private
Long
invoice
;
// 发票金额
private
Long
invoice
;
// 开票次数
private
String
invoiceMoney
;
// 发票金额
private
String
createName
;
//合同类型 主套餐 or 增值套餐
private
String
type
;
...
...
@@ -53,7 +55,6 @@ public class Contract {
/**
* 新增字段
*/
// private Long catogrey; //行业
private
Long
discountFlow
;
// 优惠流量
private
Long
discountTimeLong
;
// 优惠时长
private
Double
rebateMoney
;
//回款金额
...
...
@@ -65,8 +66,6 @@ public class Contract {
private
String
createrName
;
// 录入人
@Id
@GeneratedValue
public
Long
getId
()
{
...
...
@@ -257,6 +256,14 @@ public class Contract {
return
invoice
;
}
public
String
getInvoiceMoney
()
{
return
invoiceMoney
;
}
public
void
setInvoiceMoney
(
String
invoiceMoney
)
{
this
.
invoiceMoney
=
invoiceMoney
;
}
public
void
setInvoice
(
Long
invoice
)
{
this
.
invoice
=
invoice
;
}
...
...
src/main/java/common/model/ContractRelation.java
View file @
2871f2df
...
...
@@ -16,6 +16,7 @@ public class ContractRelation {
private
Long
mainContract
;
private
Long
relationId
;
private
Date
createTime
;
private
String
platform
;
@Id
@GeneratedValue
...
...
@@ -49,4 +50,12 @@ public class ContractRelation {
public
void
setCreateTime
(
Date
createTime
)
{
this
.
createTime
=
createTime
;
}
public
String
getPlatform
()
{
return
platform
;
}
public
void
setPlatform
(
String
platform
)
{
this
.
platform
=
platform
;
}
}
src/main/java/common/repository/ContractRelationRepository.java
View file @
2871f2df
...
...
@@ -2,10 +2,16 @@ package common.repository;
import
common.model.ContractRelation
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.data.jpa.repository.Query
;
import
java.util.List
;
/**
* 合同 关联信息
*/
public
interface
ContractRelationRepository
extends
JpaRepository
<
ContractRelation
,
Long
>
{
@Query
(
value
=
"select relation_id from contract_relation where main_contract = ?1"
,
nativeQuery
=
true
)
List
<
Long
>
findRelationIds
(
String
contractId
);
}
src/main/java/common/repository/ContractRepository.java
View file @
2871f2df
...
...
@@ -57,4 +57,10 @@ public interface ContractRepository extends JpaRepository<Contract, Long> {
@Query
(
value
=
"select * from contract where platform = ?1 and contract_code = ?2"
,
nativeQuery
=
true
)
Contract
findByCodePlatform
(
String
contractCode
,
String
platform
);
@Query
(
value
=
"select * from contract where start_date >= ?1 and start_date <= ?2 and platform = ?3 and id in ?4 order by ds desc"
,
nativeQuery
=
true
)
List
<
Contract
>
findByDsRelation
(
String
startDate
,
String
endDate
,
String
platform
,
List
<
Long
>
contractIds
);
@Query
(
value
=
"select * from contract where start_date >= ?1 and start_date <= ?2 and platform = ?3 and sale in ?4 and id in ?5 order by ds desc"
,
nativeQuery
=
true
)
List
<
Contract
>
findByDsAndRoileRelation
(
String
startDate
,
String
endDate
,
String
platform
,
List
<
Long
>
idList
,
List
<
Long
>
contractIds
);
}
src/main/java/common/service/ContractService.java
View file @
2871f2df
...
...
@@ -31,7 +31,7 @@ public interface ContractService {
Contract
update
(
User
loginUser
,
Contract
resource
);
List
<
Contract
>
findAll
(
User
loginAccount
,
String
startDate
,
String
endDate
,
String
platfrom
);
List
<
Contract
>
findAll
(
User
loginAccount
,
String
startDate
,
String
endDate
,
String
platfrom
,
String
contractId
);
Contract
findOne
(
String
code
);
...
...
@@ -55,5 +55,5 @@ public interface ContractService {
Map
contractCodeAll
(
String
platform
);
List
<
Contract
>
findAllContract
(
User
loginAccount
,
String
startDate
,
String
endDate
,
String
platform
);
List
<
Contract
>
findAllContract
(
User
loginAccount
,
String
startDate
,
String
endDate
,
String
platform
,
String
contractId
);
}
\ No newline at end of file
src/main/java/common/service/impl/ContractServiceImpl.java
View file @
2871f2df
...
...
@@ -3,8 +3,6 @@ package common.service.impl;
import
adi.dic.PackageEnum
;
import
adi.model.ADIUser
;
import
adi.service.ADIAccountService
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.google.api.ads.adwords.lib.AdWordsProductFrameworkModule
;
import
common.model.*
;
import
common.repository.*
;
import
common.service.ContractService
;
...
...
@@ -12,11 +10,9 @@ import common.service.UserService;
import
dic.ContractStatusEnum
;
import
dic.ContractTypeEnum
;
import
dic.RoleEnum
;
import
dic.RoleTypeEnum
;
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.Account
;
import
tkio.model.IncrementFlow
;
import
tkio.model.PackageType
;
...
...
@@ -33,7 +29,6 @@ import java.beans.BeanInfo;
import
java.beans.IntrospectionException
;
import
java.beans.Introspector
;
import
java.beans.PropertyDescriptor
;
import
java.io.IOException
;
import
java.lang.reflect.InvocationTargetException
;
import
java.lang.reflect.Method
;
import
java.math.BigDecimal
;
...
...
@@ -190,7 +185,7 @@ public class ContractServiceImpl implements ContractService{
}
else
{
lastCode
=
""
+(
codeInt
+
1
);
}
return
company
+
"-"
+
platform
+
"-"
+
DateUtil
.
getDays2
(
0
)+
"-"
+
lastCode
;
return
(
company
+
"-"
+
platform
+
"-"
+
DateUtil
.
getDays2
(
0
)
+
"-"
+
lastCode
).
toUpperCase
()
;
}
@Override
...
...
@@ -214,6 +209,7 @@ public class ContractServiceImpl implements ContractService{
p
.
setType
(
"main"
);
list
.
add
(
p
);
}
// 增值套餐
List
<
ContractIncrement
>
increments
=
contractIncrementRepository
.
findAll
();
list
.
addAll
(
increments
);
}
else
if
(
"userdesk"
.
equals
(
platform
)
||
"dmp"
.
equals
(
platform
)
||
"fake"
.
equals
(
platform
))
{
...
...
@@ -276,34 +272,6 @@ public class ContractServiceImpl implements ContractService{
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
());
...
...
@@ -390,7 +358,21 @@ public class ContractServiceImpl implements ContractService{
}
}
return
contractRepository
.
save
(
resource
);
resource
=
contractRepository
.
save
(
resource
);
if
(
resource
.
getRelationContract
()!=
null
&&
resource
.
getRelationContract
()>
0
){
//保存关联合同信息
ContractRelation
relation
=
new
ContractRelation
();
relation
.
setCreateTime
(
new
Date
());
relation
.
setMainContract
(
resource
.
getId
());
relation
.
setRelationId
(
resource
.
getRelationContract
());
relation
.
setPlatform
(
resource
.
getPlatform
());
contractRelationRepository
.
save
(
relation
);
}
return
resource
;
}
@Override
...
...
@@ -491,8 +473,9 @@ public class ContractServiceImpl implements ContractService{
return
contractRepository
.
save
(
contract
);
}
@Override
public
List
<
Contract
>
findAll
(
User
loginAccount
,
String
startDate
,
String
endDate
,
String
platf
rom
)
{
public
List
<
Contract
>
findAll
(
User
loginAccount
,
String
startDate
,
String
endDate
,
String
platf
orm
,
String
contractId
)
{
List
<
Contract
>
result
=
new
ArrayList
<>();
List
<
User
>
sales
=
userRepository
.
findAll
();
Map
<
Long
,
String
>
saleMap
=
new
HashMap
<>();
...
...
@@ -522,6 +505,14 @@ public class ContractServiceImpl implements ContractService{
bpuMap
.
put
(
s
.
getId
(),
s
.
getPackageName
());
}
}
List
<
Long
>
contractIds
=
null
;
if
(!
StringUtils
.
isEmpty
(
contractId
)){
//获取 关联合同列表
contractIds
=
contractRelationRepository
.
findRelationIds
(
contractId
);
}
List
<
Contract
>
contractList
=
null
;
if
(
loginAccount
.
getRole
().
equals
(
RoleEnum
.
SOUTH_BUSSINUSS
.
getKey
())
||
loginAccount
.
getRole
().
equals
(
RoleEnum
.
NORTH_BUSSINUSS
.
getKey
())){
...
...
@@ -532,15 +523,26 @@ public class ContractServiceImpl implements ContractService{
idList
.
add
(
u
.
getId
());
}
contractList
=
contractRepository
.
findByDsAndRoile
(
startDate
,
endDate
,
platfrom
,
idList
);
// contractList = contractRepository.findByDsAndRoile(startDate, endDate, platfrom, idList);
if
(
contractIds
!=
null
&&
contractIds
.
size
()>
0
){
contractList
=
contractRepository
.
findByDsAndRoileRelation
(
startDate
,
endDate
,
platform
,
idList
,
contractIds
);
}
else
{
contractList
=
contractRepository
.
findByDsAndRoile
(
startDate
,
endDate
,
platform
,
idList
);
}
}
else
{
contractList
=
contractRepository
.
findByDs
(
startDate
,
endDate
,
platfrom
);
// contractList = contractRepository.findByDs(startDate, endDate, platform);
if
(
contractIds
!=
null
&&
contractIds
.
size
()>
0
){
contractList
=
contractRepository
.
findByDsRelation
(
startDate
,
endDate
,
platform
,
contractIds
);
}
else
{
contractList
=
contractRepository
.
findByDs
(
startDate
,
endDate
,
platform
);
}
}
if
(
ValidateUtil
.
isValid
(
contractList
)){
for
(
Contract
c
:
contractList
){
c
.
setSaleName
(
saleMap
.
containsKey
(
c
.
getSale
())
?
saleMap
.
get
(
c
.
getSale
())
:
""
);
if
(
c
.
getType
().
equals
(
ContractTypeEnum
.
MAIN
.
getKey
())
&&
platf
ro
m
.
contains
(
"io"
)){
if
(
c
.
getType
().
equals
(
ContractTypeEnum
.
MAIN
.
getKey
())
&&
platf
or
m
.
contains
(
"io"
)){
c
.
setPriceLevelName
(
typeMap
.
containsKey
(
c
.
getPriceLevel
())
?
typeMap
.
get
(
c
.
getPriceLevel
())
:
""
);
}
else
if
(
c
.
getType
().
equals
(
ContractTypeEnum
.
MAIN
.
getKey
())){
c
.
setPriceLevelName
(
bpuMap
.
containsKey
(
c
.
getPriceLevel
())
?
bpuMap
.
get
(
c
.
getPriceLevel
())
:
""
);
...
...
@@ -556,7 +558,14 @@ public class ContractServiceImpl implements ContractService{
}
@Override
public
List
<
Contract
>
findAllContract
(
User
loginAccount
,
String
startDate
,
String
endDate
,
String
platform
)
{
public
List
<
Contract
>
findAllContract
(
User
loginAccount
,
String
startDate
,
String
endDate
,
String
platform
,
String
contractId
)
{
List
<
Long
>
contractIds
=
null
;
if
(!
StringUtils
.
isEmpty
(
contractId
)){
//获取 关联合同列表
contractIds
=
contractRelationRepository
.
findRelationIds
(
contractId
);
}
List
<
Contract
>
contractList
;
if
(!
loginAccount
.
getRole
().
equals
(
RoleEnum
.
MANAGER
.
getKey
())){
...
...
@@ -567,10 +576,21 @@ public class ContractServiceImpl implements ContractService{
for
(
User
u
:
userList
){
idList
.
add
(
u
.
getId
());
}
contractList
=
contractRepository
.
findByDsAndRoile
(
startDate
,
endDate
,
platform
,
idList
);
if
(
contractIds
!=
null
&&
contractIds
.
size
()>
0
){
contractList
=
contractRepository
.
findByDsAndRoileRelation
(
startDate
,
endDate
,
platform
,
idList
,
contractIds
);
}
else
{
contractList
=
contractRepository
.
findByDsAndRoile
(
startDate
,
endDate
,
platform
,
idList
);
}
}
else
{
contractList
=
contractRepository
.
findByDs
(
startDate
,
endDate
,
platform
);
if
(
contractIds
!=
null
&&
contractIds
.
size
()>
0
){
contractList
=
contractRepository
.
findByDsRelation
(
startDate
,
endDate
,
platform
,
contractIds
);
}
else
{
contractList
=
contractRepository
.
findByDs
(
startDate
,
endDate
,
platform
);
}
}
...
...
@@ -801,15 +821,11 @@ public class ContractServiceImpl implements ContractService{
@Override
public
List
<
TradeType
>
getTradeData
(
String
platform
)
{
return
tradeTypeRepsitory
.
findAll
();
}
@Override
public
Map
contractCodeAll
(
String
platform
)
{
return
contractRepository
.
contractCodePlatform
(
platform
);
}
...
...
src/main/java/tkio/controller/TkioAccountController.java
View file @
2871f2df
...
...
@@ -118,6 +118,7 @@ public class TkioAccountController {
userlog
.
start
();
return
ResultModel
.
OK
(
tkioAccountService
.
visit
(
loginAccount
,
resource
));
}
//功能使用查询
@RequestMapping
(
value
=
"/find/function/{accountId}"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
...
...
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