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
fe3bbb9d
Commit
fe3bbb9d
authored
Jul 24, 2019
by
kangxiaoshan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adi 套餐
parent
11866301
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
168 additions
and
34 deletions
+168
-34
ContractController.java
src/main/java/common/controller/ContractController.java
+2
-2
ContractBody.java
src/main/java/common/model/ContractBody.java
+9
-0
PackageBase.java
src/main/java/common/model/PackageBase.java
+59
-0
ContractBodyRepository.java
src/main/java/common/repository/ContractBodyRepository.java
+5
-0
PackageBaseRepository.java
src/main/java/common/repository/PackageBaseRepository.java
+18
-0
ContractService.java
src/main/java/common/service/ContractService.java
+1
-1
ContractServiceImpl.java
src/main/java/common/service/impl/ContractServiceImpl.java
+74
-31
No files found.
src/main/java/common/controller/ContractController.java
View file @
fe3bbb9d
...
@@ -168,8 +168,8 @@ public class ContractController {
...
@@ -168,8 +168,8 @@ public class ContractController {
@RequestMapping
(
value
=
"find/body"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
value
=
"find/body"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
@ResponseBody
public
ResultModel
findBody
(
@CurrentAccount
User
loginAccount
)
{
public
ResultModel
findBody
(
@CurrentAccount
User
loginAccount
,
@PathVariable
String
platform
)
{
return
ResultModel
.
OK
(
service
.
findBody
());
return
ResultModel
.
OK
(
service
.
findBody
(
platform
));
}
}
@RequestMapping
(
value
=
"find/code"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
value
=
"find/code"
,
method
=
RequestMethod
.
GET
)
...
...
src/main/java/common/model/ContractBody.java
View file @
fe3bbb9d
...
@@ -12,6 +12,7 @@ public class ContractBody {
...
@@ -12,6 +12,7 @@ public class ContractBody {
private
Long
id
;
private
Long
id
;
private
String
name
;
private
String
name
;
private
String
code
;
private
String
code
;
private
String
platform
;
@Id
@Id
@GeneratedValue
@GeneratedValue
...
@@ -38,4 +39,12 @@ public class ContractBody {
...
@@ -38,4 +39,12 @@ public class ContractBody {
public
void
setCode
(
String
code
)
{
public
void
setCode
(
String
code
)
{
this
.
code
=
code
;
this
.
code
=
code
;
}
}
public
String
getPlatform
()
{
return
platform
;
}
public
void
setPlatform
(
String
platform
)
{
this
.
platform
=
platform
;
}
}
}
src/main/java/common/model/PackageBase.java
0 → 100644
View file @
fe3bbb9d
package
common
.
model
;
import
javax.persistence.Entity
;
import
javax.persistence.GeneratedValue
;
import
javax.persistence.Id
;
@Entity
public
class
PackageBase
{
private
Long
id
;
private
String
packageName
;
private
String
platform
;
private
int
sort
;
private
int
status
;
@Id
@GeneratedValue
public
Long
getId
()
{
return
id
;
}
public
void
setId
(
Long
id
)
{
this
.
id
=
id
;
}
public
String
getPackageName
()
{
return
packageName
;
}
public
void
setPackageName
(
String
packageName
)
{
this
.
packageName
=
packageName
;
}
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
;
}
public
int
getStatus
()
{
return
status
;
}
public
void
setStatus
(
int
status
)
{
this
.
status
=
status
;
}
}
src/main/java/common/repository/ContractBodyRepository.java
View file @
fe3bbb9d
...
@@ -3,9 +3,14 @@ package common.repository;
...
@@ -3,9 +3,14 @@ package common.repository;
import
common.model.Contract
;
import
common.model.Contract
;
import
common.model.ContractBody
;
import
common.model.ContractBody
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.data.jpa.repository.Query
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.List
;
@Transactional
@Transactional
public
interface
ContractBodyRepository
extends
JpaRepository
<
ContractBody
,
Long
>
{
public
interface
ContractBodyRepository
extends
JpaRepository
<
ContractBody
,
Long
>
{
@Query
(
value
=
"select * from contract_body where platform = ?1 "
,
nativeQuery
=
true
)
List
<
ContractBody
>
findByPlatform
(
String
platform
);
}
}
src/main/java/common/repository/PackageBaseRepository.java
0 → 100644
View file @
fe3bbb9d
package
common
.
repository
;
import
common.model.PackageBase
;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.data.jpa.repository.Query
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.List
;
@Transactional
public
interface
PackageBaseRepository
extends
JpaRepository
<
PackageBase
,
Long
>
{
@Query
(
value
=
"select * from package_base where platform =?1 and status =?2"
,
nativeQuery
=
true
)
List
<
PackageBase
>
findByPlatAndStatus
(
String
platform
,
int
status
);
}
src/main/java/common/service/ContractService.java
View file @
fe3bbb9d
...
@@ -15,7 +15,7 @@ public interface ContractService {
...
@@ -15,7 +15,7 @@ public interface ContractService {
Boolean
checkTime
(
String
email
,
String
platfrom
,
String
type
,
String
product
);
Boolean
checkTime
(
String
email
,
String
platfrom
,
String
type
,
String
product
);
List
<
ContractBody
>
findBody
();
List
<
ContractBody
>
findBody
(
String
platform
);
String
getContractCode
(
String
code
);
String
getContractCode
(
String
code
);
...
...
src/main/java/common/service/impl/ContractServiceImpl.java
View file @
fe3bbb9d
package
common
.
service
.
impl
;
package
common
.
service
.
impl
;
import
adi.dic.PackageEnum
;
import
adi.model.ADIUser
;
import
adi.model.ADIUser
;
import
adi.service.ADIAccountService
;
import
adi.service.ADIAccountService
;
import
common.model.*
;
import
common.model.*
;
...
@@ -116,6 +115,10 @@ public class ContractServiceImpl implements ContractService {
...
@@ -116,6 +115,10 @@ public class ContractServiceImpl implements ContractService {
SalesRepository
salesRepository
;
SalesRepository
salesRepository
;
@Autowired
PackageBaseRepository
packageBaseRepository
;
@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
<>();
...
@@ -184,8 +187,13 @@ public class ContractServiceImpl implements ContractService {
...
@@ -184,8 +187,13 @@ public class ContractServiceImpl implements ContractService {
}
}
@Override
@Override
public
List
<
ContractBody
>
findBody
()
{
public
List
<
ContractBody
>
findBody
(
String
platform
)
{
return
contractBodyRepository
.
findAll
();
List
<
ContractBody
>
common
=
contractBodyRepository
.
findByPlatform
(
"common"
);
List
<
ContractBody
>
byPlatform
=
contractBodyRepository
.
findByPlatform
(
platform
);
common
.
addAll
(
byPlatform
);
return
common
;
}
}
@Override
@Override
...
@@ -256,37 +264,55 @@ public class ContractServiceImpl implements ContractService {
...
@@ -256,37 +264,55 @@ public class ContractServiceImpl implements ContractService {
@Override
@Override
public
List
findSetmeal
(
String
platform
)
{
public
List
findSetmeal
(
String
platform
)
{
platform
=
"tkio"
;
// platform = "tkio";
//
// List list = new ArrayList();
// if ("adi".equals(platform)) {
// for (int i = 1; i < 3; i++) {
// Map<String, String> packageMap = new HashMap<>();
// packageMap.put("id", i + "");
// if (i == 1) {
// packageMap.put("packageName", PackageEnum.PROBATION.getValue());
// } else {
// packageMap.put("packageName", PackageEnum.FORMAL.getValue());
// }
// list.add(packageMap);
// }
// } else {
// if ("tkio".equals(platform) || "io".equals(platform)) {
//// List<PackageType> packageTypeList = packageTypeRepository.findAll();
// List<PackageType> packageTypeList = packageTypeRepository.findIsNewAll();
// for (PackageType p : packageTypeList) {
// 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)) {
// list = bpuContractRepository.findByProduct(platform);
// }
// }
List
list
=
new
ArrayList
();
List
list
=
new
ArrayList
();
if
(
"adi"
.
equals
(
platform
))
{
if
(
"tkio"
.
equals
(
platform
)
||
"io"
.
equals
(
platform
))
{
for
(
int
i
=
1
;
i
<
3
;
i
++)
{
List
<
PackageType
>
packageTypeList
=
packageTypeRepository
.
findIsNewAll
();
Map
<
String
,
String
>
packageMap
=
new
HashMap
<>();
for
(
PackageType
p
:
packageTypeList
)
{
packageMap
.
put
(
"id"
,
i
+
""
);
p
.
setType
(
"main"
);
if
(
i
==
1
)
{
list
.
add
(
p
);
packageMap
.
put
(
"packageName"
,
PackageEnum
.
PROBATION
.
getValue
());
}
else
{
packageMap
.
put
(
"packageName"
,
PackageEnum
.
FORMAL
.
getValue
());
}
list
.
add
(
packageMap
);
}
}
else
{
if
(
"tkio"
.
equals
(
platform
)
||
"io"
.
equals
(
platform
))
{
// List<PackageType> packageTypeList = packageTypeRepository.findAll();
List
<
PackageType
>
packageTypeList
=
packageTypeRepository
.
findIsNewAll
();
for
(
PackageType
p
:
packageTypeList
)
{
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
))
{
list
=
bpuContractRepository
.
findByProduct
(
platform
);
}
}
return
list
;
}
else
{
List
<
PackageBase
>
packageBases
=
packageBaseRepository
.
findByPlatAndStatus
(
platform
,
1
);
return
packageBases
;
}
}
return
list
;
}
}
@Override
@Override
...
@@ -1023,6 +1049,15 @@ public class ContractServiceImpl implements ContractService {
...
@@ -1023,6 +1049,15 @@ public class ContractServiceImpl implements ContractService {
}
}
}
}
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
);
...
@@ -1094,8 +1129,7 @@ public class ContractServiceImpl implements ContractService {
...
@@ -1094,8 +1129,7 @@ public class ContractServiceImpl implements ContractService {
c
.
setRelationContract
(-
1L
);
c
.
setRelationContract
(-
1L
);
}
}
c
.
setSaleName
(
saleMap
.
containsKey
(
c
.
getSale
())
?
saleMap
.
get
(
c
.
getSale
())
:
""
);
c
.
setPriceLevelName
(
typeMap
.
containsKey
(
c
.
getPriceLevel
())
?
typeMap
.
get
(
c
.
getPriceLevel
())
:
""
);
// if (c.getType().equals(ContractTypeEnum.MAIN.getKey()) && platform.contains("io")) {
// if (c.getType().equals(ContractTypeEnum.MAIN.getKey()) && platform.contains("io")) {
//
//
// } else if (c.getType().equals(ContractTypeEnum.MAIN.getKey())) {
// } else if (c.getType().equals(ContractTypeEnum.MAIN.getKey())) {
...
@@ -1104,6 +1138,15 @@ public class ContractServiceImpl implements ContractService {
...
@@ -1104,6 +1138,15 @@ public class ContractServiceImpl implements ContractService {
// c.setPriceLevelName(incremenMap.containsKey(c.getPriceLevel()) ? incremenMap.get(c.getPriceLevel()) : "");
// c.setPriceLevelName(incremenMap.containsKey(c.getPriceLevel()) ? incremenMap.get(c.getPriceLevel()) : "");
// }
// }
c
.
setSaleName
(
saleMap
.
containsKey
(
c
.
getSale
())
?
saleMap
.
get
(
c
.
getSale
())
:
""
);
if
(
"tkio"
.
equals
(
platform
)){
c
.
setPriceLevelName
(
typeMap
.
containsKey
(
c
.
getPriceLevel
())
?
typeMap
.
get
(
c
.
getPriceLevel
())
:
""
);
}
else
{
c
.
setPriceLevelName
(
packageBaseMap
.
get
(
c
.
getPriceLevel
())==
null
?
""
:
packageBaseMap
.
get
(
c
.
getPriceLevel
()).
getPackageName
());
}
c
.
setCreateName
(
saleMap
.
containsKey
(
c
.
getCreateAccount
())
?
saleMap
.
get
(
c
.
getCreateAccount
())
:
""
);
c
.
setCreateName
(
saleMap
.
containsKey
(
c
.
getCreateAccount
())
?
saleMap
.
get
(
c
.
getCreateAccount
())
:
""
);
result
.
add
(
c
);
result
.
add
(
c
);
}
}
...
...
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