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
5fc737e7
Commit
5fc737e7
authored
Jan 22, 2018
by
manxiaoqiang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
合同
parent
9e50ac7b
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
211 additions
and
41 deletions
+211
-41
workspace.xml
.idea/workspace.xml
+0
-0
ContractController.java
src/main/java/common/controller/ContractController.java
+7
-0
Account4Web.java
src/main/java/common/model/Account4Web.java
+17
-21
ContractChange.java
src/main/java/common/model/ContractChange.java
+18
-0
ContractMoney.java
src/main/java/common/model/ContractMoney.java
+9
-0
ContractChangeRepository.java
...main/java/common/repository/ContractChangeRepository.java
+3
-0
ContractMoneyRepository.java
src/main/java/common/repository/ContractMoneyRepository.java
+6
-0
ContractRepository.java
src/main/java/common/repository/ContractRepository.java
+6
-0
ContractService.java
src/main/java/common/service/ContractService.java
+2
-0
ContractServiceImpl.java
src/main/java/common/service/impl/ContractServiceImpl.java
+24
-0
TkioAccountController.java
src/main/java/tkio/controller/TkioAccountController.java
+18
-2
TkioAccountService.java
src/main/java/tkio/service/TkioAccountService.java
+4
-1
TkioAccountServiceImpl.java
src/main/java/tkio/service/impl/TkioAccountServiceImpl.java
+97
-17
No files found.
.idea/workspace.xml
View file @
5fc737e7
This diff is collapsed.
Click to expand it.
src/main/java/common/controller/ContractController.java
View file @
5fc737e7
...
...
@@ -110,4 +110,11 @@ public class ContractController {
public
ResultModel
updatePay
(
@CurrentAccount
User
loginAccount
,
@RequestBody
ContractMoney
contract
)
{
return
ResultModel
.
OK
(
service
.
updatePay
(
loginAccount
,
contract
));
}
@RequestMapping
(
value
=
"find/payall"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
public
ResultModel
findPayAll
(
@CurrentAccount
User
loginAccount
,
@RequestParam
String
startDate
,
@RequestParam
String
endDate
)
{
return
ResultModel
.
OK
(
service
.
findPay
(
startDate
,
endDate
));
}
}
src/main/java/common/model/Account4Web.java
View file @
5fc737e7
...
...
@@ -28,6 +28,9 @@ public class Account4Web {
private
Boolean
trackStatus
;
private
Boolean
remStatus
;
private
Long
bussinessMan
;
private
String
contractStatus
;
private
Integer
contractTime
;
@Id
@GeneratedValue
public
Long
getId
()
{
...
...
@@ -198,26 +201,19 @@ public class Account4Web {
this
.
createDs
=
createDs
;
}
@Override
public
String
toString
()
{
return
"Account4Web{"
+
"id="
+
id
+
", email='"
+
email
+
'\''
+
", company='"
+
company
+
'\''
+
", createDate="
+
createDate
+
", status='"
+
status
+
'\''
+
", packageType='"
+
packageType
+
'\''
+
", pastDate='"
+
pastDate
+
'\''
+
", track="
+
track
+
", io="
+
io
+
", trackLimit="
+
trackLimit
+
", ioLimit="
+
ioLimit
+
", backTime="
+
backTime
+
", user='"
+
user
+
'\''
+
", tell='"
+
tell
+
'\''
+
", money="
+
money
+
", ioStatus="
+
ioStatus
+
", trackStatus="
+
trackStatus
+
'}'
;
public
String
getContractStatus
()
{
return
contractStatus
;
}
public
void
setContractStatus
(
String
contractStatus
)
{
this
.
contractStatus
=
contractStatus
;
}
public
Integer
getContractTime
()
{
return
contractTime
;
}
public
void
setContractTime
(
Integer
contractTime
)
{
this
.
contractTime
=
contractTime
;
}
}
src/main/java/common/model/ContractChange.java
View file @
5fc737e7
...
...
@@ -21,6 +21,8 @@ public class ContractChange {
private
Long
money
;
private
Long
user
;
private
String
createName
;
private
String
platform
;
private
String
levelName
;
private
Long
modifyAccount
;
private
Long
createAccount
;
...
...
@@ -148,4 +150,20 @@ public class ContractChange {
public
void
setCreateName
(
String
createName
)
{
this
.
createName
=
createName
;
}
public
String
getPlatform
()
{
return
platform
;
}
public
void
setPlatform
(
String
platform
)
{
this
.
platform
=
platform
;
}
public
String
getLevelName
()
{
return
levelName
;
}
public
void
setLevelName
(
String
levelName
)
{
this
.
levelName
=
levelName
;
}
}
src/main/java/common/model/ContractMoney.java
View file @
5fc737e7
...
...
@@ -19,6 +19,7 @@ public class ContractMoney {
private
Long
money
;
private
Long
user
;
private
String
createName
;
private
String
platform
;
private
Long
modifyAccount
;
private
Long
createAccount
;
...
...
@@ -130,4 +131,12 @@ public class ContractMoney {
public
void
setCreateName
(
String
createName
)
{
this
.
createName
=
createName
;
}
public
String
getPlatform
()
{
return
platform
;
}
public
void
setPlatform
(
String
platform
)
{
this
.
platform
=
platform
;
}
}
src/main/java/common/repository/ContractChangeRepository.java
View file @
5fc737e7
...
...
@@ -16,4 +16,7 @@ public interface ContractChangeRepository extends JpaRepository<ContractChange,
@Query
(
value
=
"select * from contract_change where ds >= ?1 and ds <= ?2 and contract_code = ?3 order by ds desc"
,
nativeQuery
=
true
)
List
<
ContractChange
>
findByDs
(
String
startDate
,
String
endDate
,
String
code
);
@Query
(
value
=
"SELECT * from contract_change where platform = ?1 and email = ?2 and ds >= ?3 and ds <= ?4 order by ds desc"
,
nativeQuery
=
true
)
List
<
ContractChange
>
findByPlatformAndEmail
(
String
platform
,
String
email
,
String
startDate
,
String
endDate
);
}
src/main/java/common/repository/ContractMoneyRepository.java
View file @
5fc737e7
...
...
@@ -14,4 +14,10 @@ public interface ContractMoneyRepository extends JpaRepository<ContractMoney, Lo
@Query
(
value
=
"select * from contract_money where ds >= ?1 and ds <= ?2 and contract_code = ?3 order by ds desc"
,
nativeQuery
=
true
)
List
<
ContractMoney
>
findByDs
(
String
startDate
,
String
endDate
,
String
code
);
@Query
(
value
=
"select * from contract_money where ds >= ?1 and ds <= ?2 order by ds desc"
,
nativeQuery
=
true
)
List
<
ContractMoney
>
findByDs
(
String
startDate
,
String
endDate
);
@Query
(
value
=
"select * from contract_money where ds >= ?1 and ds <= ?2 and email = ?3 and platform = ?4 order by ds desc"
,
nativeQuery
=
true
)
List
<
ContractMoney
>
findByDs
(
String
startDate
,
String
endDate
,
String
email
,
String
platform
);
}
src/main/java/common/repository/ContractRepository.java
View file @
5fc737e7
...
...
@@ -23,4 +23,10 @@ public interface ContractRepository extends JpaRepository<Contract, Long> {
@Query
(
value
=
"select * from contract where contract_code = ?1"
,
nativeQuery
=
true
)
Contract
findByCode
(
String
contract_code
);
@Query
(
value
=
"SELECT * from contract where platform = ?1"
,
nativeQuery
=
true
)
List
<
Contract
>
findByPlatform
(
String
platform
);
@Query
(
value
=
"SELECT * from contract where platform = ?1 and email = ?2"
,
nativeQuery
=
true
)
List
<
Contract
>
findByPlatformAndEmail
(
String
platform
,
String
email
);
}
src/main/java/common/service/ContractService.java
View file @
5fc737e7
...
...
@@ -38,4 +38,6 @@ public interface ContractService {
List
<
ContractChange
>
findChange
(
String
startDate
,
String
endDate
,
String
code
);
Contract
updatePay
(
User
loginUser
,
ContractMoney
resource
);
List
<
ContractMoney
>
findPay
(
String
startDate
,
String
endDate
);
}
src/main/java/common/service/impl/ContractServiceImpl.java
View file @
5fc737e7
...
...
@@ -160,6 +160,7 @@ public class ContractServiceImpl implements ContractService{
double
f1
=
bg
.
setScale
(
2
,
BigDecimal
.
ROUND_HALF_UP
).
doubleValue
();
contract
.
setRebate
(
f1
);
}
cc
.
setPlatform
(
contract
.
getPlatform
());
contractChangeRepository
.
save
(
cc
);
return
contractRepository
.
save
(
contract
);
...
...
@@ -204,6 +205,7 @@ public class ContractServiceImpl implements ContractService{
}
contractRepository
.
save
(
contract
);
resource
.
setPlatform
(
contract
.
getPlatform
());
resource
.
setCreateAccount
(
loginUser
.
getId
());
resource
.
setCreateTime
(
new
Date
());
resource
.
setUser
(
loginUser
.
getId
());
...
...
@@ -226,6 +228,7 @@ public class ContractServiceImpl implements ContractService{
}
else
{
contract
.
setStatus
(
"cancel"
);
}
resource
.
setPlatform
(
contract
.
getPlatform
());
resource
.
setCreateAccount
(
loginUser
.
getId
());
resource
.
setCreateTime
(
new
Date
());
resource
.
setDs
(
DateUtil
.
getBeforeDays
(
0
));
...
...
@@ -315,4 +318,25 @@ public class ContractServiceImpl implements ContractService{
save
.
setCreateName
(
saleMap
.
containsKey
(
save
.
getSale
())
?
saleMap
.
get
(
save
.
getSale
())
:
""
);
return
save
;
}
@Override
public
List
<
ContractMoney
>
findPay
(
String
startDate
,
String
endDate
)
{
List
<
User
>
sales
=
userRepository
.
findAll
();
Map
<
Long
,
String
>
saleMap
=
new
HashMap
<>();
if
(
ValidateUtil
.
isValid
(
sales
)){
for
(
User
s:
sales
){
saleMap
.
put
(
s
.
getId
(),
s
.
getName
());
}
}
List
<
ContractMoney
>
result
=
new
ArrayList
<>();
List
<
ContractMoney
>
list
=
contractMoneyRepository
.
findByDs
(
startDate
,
endDate
);
if
(
ValidateUtil
.
isValid
(
list
)){
for
(
ContractMoney
cm
:
list
){
cm
.
setCreateName
(
saleMap
.
containsKey
(
cm
.
getUser
())
?
saleMap
.
get
(
cm
.
getUser
())
:
""
);
result
.
add
(
cm
);
}
}
return
result
;
}
}
src/main/java/tkio/controller/TkioAccountController.java
View file @
5fc737e7
...
...
@@ -109,9 +109,25 @@ public class TkioAccountController {
@RequestMapping
(
value
=
"/find/pay/{accountId}"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
public
ResultModel
findPay
(
@CurrentAccount
User
loginAccount
,
@RequestParam
String
startDate
,
@RequestParam
String
endDate
,
@PathVariable
Long
accountId
)
{
@RequestParam
String
endDate
,
@RequestParam
String
email
,
@PathVariable
Long
accountId
)
{
return
ResultModel
.
OK
(
tkioAccountService
.
findPay
(
email
,
startDate
,
endDate
));
}
//套餐变更查询
@RequestMapping
(
value
=
"/find/contract/{accountId}"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
public
ResultModel
findChange
(
@CurrentAccount
User
loginAccount
,
@RequestParam
String
email
,
@PathVariable
Long
accountId
)
{
return
ResultModel
.
OK
(
tkioAccountService
.
find
Pay
(
accountId
,
startDate
,
endDate
));
return
ResultModel
.
OK
(
tkioAccountService
.
find
Contract
(
email
));
}
//合同查询
@RequestMapping
(
value
=
"/find/change/{accountId}"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
public
ResultModel
findContract
(
@CurrentAccount
User
loginAccount
,
@RequestParam
String
startDate
,
@RequestParam
String
endDate
,
@RequestParam
String
email
,
@PathVariable
Long
accountId
)
{
return
ResultModel
.
OK
(
tkioAccountService
.
findContractChange
(
email
,
startDate
,
endDate
));
}
}
src/main/java/tkio/service/TkioAccountService.java
View file @
5fc737e7
...
...
@@ -33,6 +33,9 @@ public interface TkioAccountService {
List
<
BackVisit
>
findVisit
(
Long
account
,
String
startDate
,
String
endDate
);
List
<
Payment
>
findPay
(
Long
account
,
String
startDate
,
String
endDate
);
List
<
ContractMoney
>
findPay
(
String
email
,
String
startDate
,
String
endDate
);
List
<
Contract
>
findContract
(
String
email
);
List
<
ContractChange
>
findContractChange
(
String
email
,
String
startDate
,
String
endDate
);
}
src/main/java/tkio/service/impl/TkioAccountServiceImpl.java
View file @
5fc737e7
...
...
@@ -6,6 +6,7 @@ import common.repository.*;
import
dic.RoleEnum
;
import
dic.RoleTypeEnum
;
import
org.apache.commons.collections.map.AbstractMapDecorator
;
import
org.apache.commons.collections4.list.TreeList
;
import
org.json.JSONArray
;
import
org.json.JSONException
;
import
org.json.JSONObject
;
...
...
@@ -13,6 +14,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.StringUtils
;
import
tkio.model.Account
;
import
tkio.model.PackageType
;
import
tkio.model.SalesManLeader
;
import
tkio.repository.*
;
import
tkio.service.AccountFlowRestrictService
;
...
...
@@ -57,7 +59,14 @@ public class TkioAccountServiceImpl implements TkioAccountService {
AccountFlowRestrictService
accountFlowRestrictService
;
@Autowired
UserRepository
userRepository
;
@Autowired
ContractMoneyRepository
contractMoneyRepository
;
@Autowired
ContractRepository
contractRepository
;
@Autowired
ContractChangeRepository
contractChangeRepository
;
@Autowired
PackageTypeRepository
packageTypeRepository
;
@Override
public
List
<
Account4Web
>
findAll
(
User
user
)
{
List
<
Account4Web
>
result
=
new
ArrayList
<>();
...
...
@@ -88,6 +97,8 @@ public class TkioAccountServiceImpl implements TkioAccountService {
}
}
}
List
<
Reminder
>
reminderList
=
reminderRepository
.
findAllDistinct
(
"tkio"
);
Map
<
Long
,
Boolean
>
reMap
=
new
HashMap
<>();
if
(
ValidateUtil
.
isValid
(
reminderList
)){
...
...
@@ -95,9 +106,11 @@ public class TkioAccountServiceImpl implements TkioAccountService {
reMap
.
put
(
re
.
getAccountId
(),
re
.
getRemindStatus
());
}
}
if
(
ValidateUtil
.
isValid
(
account4WebList
)){
Map
<
String
,
Integer
>
backTimeMap
=
getBackTime
();
Map
<
String
,
L
ong
>
payMap
=
getPayment
();
Map
<
String
,
L
ist
<
Contract
>>
payMap
=
getPay
();
for
(
Account4Web
aw
:
account4WebList
){
if
(
backTimeMap
.
containsKey
(
aw
.
getEmail
())){
aw
.
setBackTime
(
backTimeMap
.
get
(
aw
.
getEmail
()));
...
...
@@ -105,8 +118,13 @@ public class TkioAccountServiceImpl implements TkioAccountService {
aw
.
setBackTime
(
0
);
}
if
(
payMap
.
containsKey
(
aw
.
getEmail
())){
aw
.
setMoney
(
payMap
.
get
(
aw
.
getEmail
()));
List
<
Contract
>
contractList
=
payMap
.
get
(
aw
.
getEmail
());
aw
.
setMoney
(
contractList
.
get
(
contractList
.
size
()
-
1
).
getPayMoney
());
aw
.
setContractStatus
(
contractList
.
get
(
contractList
.
size
()
-
1
).
getStatus
());
aw
.
setContractTime
(
contractList
.
size
());
}
else
{
aw
.
setContractTime
(
0
);
aw
.
setContractStatus
(
"empty"
);
aw
.
setMoney
(
0L
);
}
if
(
reMap
.
containsKey
(
aw
.
getAccountId
())){
...
...
@@ -277,18 +295,73 @@ public class TkioAccountServiceImpl implements TkioAccountService {
}
@Override
public
List
<
Payment
>
findPay
(
Long
account
,
String
startDate
,
String
endDate
)
{
List
<
Payment
>
result
=
new
ArrayList
<>();
public
List
<
ContractMoney
>
findPay
(
String
email
,
String
startDate
,
String
endDate
)
{
List
<
ContractMoney
>
result
=
new
ArrayList
<>();
List
<
User
>
userList
=
userRepository
.
findAll
();
Map
<
Long
,
String
>
userMap
=
new
HashMap
<>();
for
(
User
u
:
userList
){
userMap
.
put
(
u
.
getId
(),
u
.
getName
());
}
List
<
Payment
>
list
=
paymentRepository
.
findAll
(
account
,
startDate
,
endDate
,
"tkio"
);
if
(
ValidateUtil
.
isValid
(
list
))
{
for
(
Payment
re
:
list
){
re
.
setUserName
(
userMap
.
get
(
re
.
getUser
()));
result
.
add
(
re
);
List
<
ContractMoney
>
list
=
contractMoneyRepository
.
findByDs
(
startDate
,
endDate
,
email
,
"tkio"
);
if
(
ValidateUtil
.
isValid
(
list
)){
for
(
ContractMoney
cm
:
list
){
Long
user
=
null
==
cm
.
getModifyAccount
()
?
cm
.
getUser
()
:
cm
.
getModifyAccount
();
cm
.
setCreateName
(
userMap
.
containsKey
(
user
)
?
userMap
.
get
(
user
)
:
""
);
result
.
add
(
cm
);
}
}
return
result
;
}
@Override
public
List
<
Contract
>
findContract
(
String
email
)
{
List
<
Contract
>
result
=
new
ArrayList
<>();
List
<
User
>
userList
=
userRepository
.
findAll
();
Map
<
Long
,
String
>
userMap
=
new
HashMap
<>();
for
(
User
u
:
userList
){
userMap
.
put
(
u
.
getId
(),
u
.
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
<
Contract
>
contractList
=
contractRepository
.
findByPlatformAndEmail
(
"tkio"
,
email
);
if
(
ValidateUtil
.
isValid
(
contractList
)){
for
(
Contract
cm
:
contractList
){
cm
.
setSaleName
(
userMap
.
containsKey
(
cm
.
getSale
())
?
userMap
.
get
(
cm
.
getSale
())
:
""
);
cm
.
setPriceLevelName
(
typeMap
.
containsKey
(
cm
.
getPriceLevel
())
?
typeMap
.
get
(
cm
.
getPriceLevel
())
:
""
);
result
.
add
(
cm
);
}
}
return
result
;
}
@Override
public
List
<
ContractChange
>
findContractChange
(
String
email
,
String
startDate
,
String
endDate
)
{
List
<
ContractChange
>
result
=
new
ArrayList
<>();
List
<
User
>
userList
=
userRepository
.
findAll
();
Map
<
Long
,
String
>
userMap
=
new
HashMap
<>();
for
(
User
u
:
userList
){
userMap
.
put
(
u
.
getId
(),
u
.
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
<
ContractChange
>
contractChangeList
=
contractChangeRepository
.
findByPlatformAndEmail
(
"tkio"
,
email
,
startDate
,
endDate
);
if
(
ValidateUtil
.
isValid
(
contractChangeList
)){
for
(
ContractChange
cm
:
contractChangeList
){
Long
user
=
null
==
cm
.
getModifyAccount
()
?
cm
.
getUser
()
:
cm
.
getModifyAccount
();
cm
.
setCreateName
(
userMap
.
containsKey
(
user
)
?
userMap
.
get
(
user
)
:
""
);
cm
.
setLevelName
(
typeMap
.
containsKey
(
cm
.
getLevel
())
?
typeMap
.
get
(
cm
.
getLevel
())
:
""
);
result
.
add
(
cm
);
}
}
return
result
;
...
...
@@ -310,18 +383,25 @@ public class TkioAccountServiceImpl implements TkioAccountService {
return
map
;
}
public
Map
<
String
,
Long
>
getPayment
(){
Map
<
String
,
Long
>
map
=
new
HashMap
<>();
List
<
Payment
>
all
=
paymentRepository
.
findAllByPlatform
(
"tkio"
);
if
(
ValidateUtil
.
isValid
(
all
)){
for
(
Payment
pa
:
all
){
public
Map
<
String
,
List
<
Contract
>>
getPay
(){
Map
<
String
,
List
<
Contract
>>
map
=
new
HashMap
<>();
List
<
Contract
>
contractList
=
contractRepository
.
findByPlatform
(
"tkio"
);
if
(
ValidateUtil
.
isValid
(
contractList
)){
for
(
Contract
pa
:
contractList
){
if
(
map
.
containsKey
(
pa
.
getEmail
())){
map
.
put
(
pa
.
getEmail
(),
map
.
get
(
pa
.
getEmail
())
+
pa
.
getMoney
());
List
<
Contract
>
list
=
map
.
get
(
pa
.
getEmail
());
list
.
add
(
pa
);
map
.
put
(
pa
.
getEmail
(),
list
);
}
else
{
map
.
put
(
pa
.
getEmail
(),
pa
.
getMoney
());
List
<
Contract
>
list
=
new
TreeList
<>();
list
.
add
(
pa
);
map
.
put
(
pa
.
getEmail
(),
list
);
}
}
}
return
map
;
}
}
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