Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gic-store
Overview
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
base_platform_enterprise
gic-store
Commits
91f0f42c
Commit
91f0f42c
authored
Jun 24, 2021
by
guojuxing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
店招品牌添加共享标志
parent
3d720276
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
210 additions
and
4 deletions
+210
-4
StoreBrandDTO.java
...re-api/src/main/java/com/gic/store/dto/StoreBrandDTO.java
+34
-0
StoreRegionDTO.java
...e-api/src/main/java/com/gic/store/dto/StoreRegionDTO.java
+36
-1
StoreBrandShareDTO.java
...main/java/com/gic/store/dto/union/StoreBrandShareDTO.java
+62
-0
StoreBrandApiService.java
...main/java/com/gic/store/service/StoreBrandApiService.java
+9
-0
StoreBrandApiServiceImpl.java
...ic/store/service/outer/impl/StoreBrandApiServiceImpl.java
+69
-3
No files found.
gic-store-api/src/main/java/com/gic/store/dto/StoreBrandDTO.java
View file @
91f0f42c
...
...
@@ -57,6 +57,17 @@ public class StoreBrandDTO implements Serializable {
/**1自有 2共享*/
private
Integer
type
;
/***********前端使用字段*********/
/**
* 共享标记 1:自有 0:共享
*/
private
Integer
ownerFlag
;
/**
* 自有商户名称
*/
private
String
ownerEntName
;
public
Integer
getStoreBrandId
()
{
return
storeBrandId
;
}
...
...
@@ -153,6 +164,27 @@ public class StoreBrandDTO implements Serializable {
this
.
type
=
type
;
}
public
Integer
getOwnerFlag
()
{
if
(
type
!=
null
&&
type
==
2
)
{
return
0
;
}
return
1
;
}
public
StoreBrandDTO
setOwnerFlag
(
Integer
ownerFlag
)
{
this
.
ownerFlag
=
ownerFlag
;
return
this
;
}
public
String
getOwnerEntName
()
{
return
ownerEntName
;
}
public
StoreBrandDTO
setOwnerEntName
(
String
ownerEntName
)
{
this
.
ownerEntName
=
ownerEntName
;
return
this
;
}
@Override
public
String
toString
()
{
return
"StoreBrandDTO{"
+
...
...
@@ -168,6 +200,8 @@ public class StoreBrandDTO implements Serializable {
", seq="
+
seq
+
", hasRel="
+
hasRel
+
", type="
+
type
+
", ownerFlag="
+
ownerFlag
+
", ownerEntName='"
+
ownerEntName
+
'\''
+
'}'
;
}
}
gic-store-api/src/main/java/com/gic/store/dto/StoreRegionDTO.java
View file @
91f0f42c
...
...
@@ -55,6 +55,17 @@ public class StoreRegionDTO implements Serializable {
private
Integer
ownType
;
private
String
shareEnterpriseName
;
/***********前端使用字段*********/
/**
* 共享标记 1:自有 0:共享
*/
private
Integer
ownerFlag
;
/**
* 自有商户名称
*/
private
String
ownerEntName
;
public
Integer
getRegionId
()
{
return
regionId
;
}
...
...
@@ -143,19 +154,43 @@ public class StoreRegionDTO implements Serializable {
this
.
erpFlag
=
erpFlag
;
}
public
Integer
getOwnerFlag
()
{
if
(
ownType
!=
null
&&
ownType
==
1
)
{
return
0
;
}
return
1
;
}
public
StoreRegionDTO
setOwnerFlag
(
Integer
ownerFlag
)
{
this
.
ownerFlag
=
ownerFlag
;
return
this
;
}
public
String
getOwnerEntName
()
{
return
shareEnterpriseName
;
}
public
StoreRegionDTO
setOwnerEntName
(
String
ownerEntName
)
{
this
.
ownerEntName
=
ownerEntName
;
return
this
;
}
@Override
public
String
toString
()
{
return
"StoreRegionDTO{"
+
"regionId="
+
regionId
+
", regionCode='"
+
regionCode
+
'\''
+
", regionName='"
+
regionName
+
'\''
+
", status="
+
deleteFlag
+
", erpFlag="
+
erpFlag
+
", deleteFlag="
+
deleteFlag
+
", createTime="
+
createTime
+
", updateTime="
+
updateTime
+
", enterpriseId="
+
enterpriseId
+
", fromEnterpriseId="
+
fromEnterpriseId
+
", ownType="
+
ownType
+
", shareEnterpriseName='"
+
shareEnterpriseName
+
'\''
+
", ownerFlag="
+
ownerFlag
+
", ownerEntName='"
+
ownerEntName
+
'\''
+
'}'
;
}
}
gic-store-api/src/main/java/com/gic/store/dto/union/StoreBrandShareDTO.java
0 → 100644
View file @
91f0f42c
package
com
.
gic
.
store
.
dto
.
union
;
import
java.io.Serializable
;
/**
* 店招品牌
* @ClassName:
* @Description:
* @author guojuxing
* @date 2021/6/24 3:47 PM
*/
public
class
StoreBrandShareDTO
implements
Serializable
{
private
static
final
long
serialVersionUID
=
7242053220313579132L
;
/***********前端使用字段*********/
/**
* 共享标记 1:自有 0:共享
*/
private
Integer
ownerFlag
;
/**
* 自有商户名称
*/
private
String
ownerEntName
;
private
Integer
storeBrandId
;
public
Integer
getOwnerFlag
()
{
return
ownerFlag
;
}
public
StoreBrandShareDTO
setOwnerFlag
(
Integer
ownerFlag
)
{
this
.
ownerFlag
=
ownerFlag
;
return
this
;
}
public
String
getOwnerEntName
()
{
return
ownerEntName
;
}
public
StoreBrandShareDTO
setOwnerEntName
(
String
ownerEntName
)
{
this
.
ownerEntName
=
ownerEntName
;
return
this
;
}
public
Integer
getStoreBrandId
()
{
return
storeBrandId
;
}
public
StoreBrandShareDTO
setStoreBrandId
(
Integer
storeBrandId
)
{
this
.
storeBrandId
=
storeBrandId
;
return
this
;
}
@Override
public
String
toString
()
{
return
"StoreBrandShareDTO{"
+
"ownerFlag="
+
ownerFlag
+
", ownerEntName='"
+
ownerEntName
+
'\''
+
", storeBrandId="
+
storeBrandId
+
'}'
;
}
}
gic-store-api/src/main/java/com/gic/store/service/StoreBrandApiService.java
View file @
91f0f42c
...
...
@@ -3,8 +3,10 @@ package com.gic.store.service;
import
com.gic.api.base.commons.Page
;
import
com.gic.api.base.commons.ServiceResponse
;
import
com.gic.store.dto.StoreBrandDTO
;
import
com.gic.store.dto.union.StoreBrandShareDTO
;
import
java.util.List
;
import
java.util.Map
;
/**
* @ClassName: StoreBrandApiService
...
...
@@ -50,6 +52,13 @@ public interface StoreBrandApiService {
* @throws
*/
ServiceResponse
<
List
<
StoreBrandDTO
>>
listAllStoreBrand
(
Integer
enterpriseId
,
String
search
);
/**
* 获取品牌自有商户信息
* @param storeBrandList
* @return
*/
ServiceResponse
<
Map
<
Integer
,
StoreBrandShareDTO
>>
getStoreBrandShareEnterprise
(
List
<
StoreBrandDTO
>
storeBrandList
);
/**
* 删除全部
...
...
gic-store-service/src/main/java/com/gic/store/service/outer/impl/StoreBrandApiServiceImpl.java
View file @
91f0f42c
...
...
@@ -7,11 +7,14 @@ import com.gic.commons.util.EntityUtil;
import
com.gic.commons.util.GlobalInfo
;
import
com.gic.commons.util.PageHelperUtils
;
import
com.gic.enterprise.constants.Constants
;
import
com.gic.enterprise.dto.EnterpriseDTO
;
import
com.gic.enterprise.error.ErrorCode
;
import
com.gic.enterprise.response.EnterpriseServiceResponse
;
import
com.gic.enterprise.service.EnterpriseApiService
;
import
com.gic.enterprise.service.EnterpriseInitApiService
;
import
com.gic.enterprise.service.PlatformBrandApiService
;
import
com.gic.store.dto.StoreBrandDTO
;
import
com.gic.store.dto.union.StoreBrandShareDTO
;
import
com.gic.store.entity.TabStoreBrand
;
import
com.gic.store.service.StoreBrandApiService
;
import
com.gic.store.service.StoreBrandService
;
...
...
@@ -24,8 +27,7 @@ import org.apache.logging.log4j.Logger;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.*
;
import
java.util.stream.Collectors
;
import
java.util.stream.Stream
;
...
...
@@ -47,6 +49,8 @@ public class StoreBrandApiServiceImpl implements StoreBrandApiService {
private
PlatformBrandApiService
platformBrandApiService
;
@Autowired
private
EnterpriseInitApiService
enterpriseInitApiService
;
@Autowired
private
EnterpriseApiService
enterpriseApiService
;
@Override
...
...
@@ -81,8 +85,16 @@ public class StoreBrandApiServiceImpl implements StoreBrandApiService {
Page
<
StoreBrandDTO
>
page
=
PageHelperUtils
.
changePageHelperToCurrentPage
(
storeBrandList
,
StoreBrandDTO
.
class
);
List
<
StoreBrandDTO
>
resultList
=
page
.
getResult
();
int
index
=
(
pageNum
-
1
)
*
pageSize
+
1
;
Map
<
Integer
,
StoreBrandShareDTO
>
storeBrandShareDTOMap
=
getStoreBrandShareEnterprise
(
resultList
).
getResult
();
for
(
int
i
=
0
;
i
<
resultList
.
size
();
i
++)
{
resultList
.
get
(
i
).
setSeq
(
index
+
i
);
StoreBrandDTO
storeBrandDTO
=
resultList
.
get
(
i
);
StoreBrandShareDTO
temp
=
storeBrandShareDTOMap
.
get
(
storeBrandDTO
.
getStoreBrandId
());
if
(
temp
!=
null
)
{
storeBrandDTO
.
setOwnerFlag
(
temp
.
getOwnerFlag
());
storeBrandDTO
.
setOwnerEntName
(
temp
.
getOwnerEntName
());
}
storeBrandDTO
.
setSeq
(
index
+
i
);
}
return
ServiceResponse
.
success
(
page
);
}
...
...
@@ -95,6 +107,60 @@ public class StoreBrandApiServiceImpl implements StoreBrandApiService {
}
@Override
public
ServiceResponse
<
Map
<
Integer
,
StoreBrandShareDTO
>>
getStoreBrandShareEnterprise
(
List
<
StoreBrandDTO
>
storeBrandList
)
{
List
<
StoreBrandShareDTO
>
voList
=
new
ArrayList
<>();
if
(
CollectionUtils
.
isNotEmpty
(
storeBrandList
))
{
//共享类型
List
<
Integer
>
brandIdList
=
storeBrandList
.
stream
().
filter
(
e
->
Objects
.
equals
(
e
.
getType
(),
2
))
.
mapToInt
(
e
->
e
.
getStoreBrandId
())
.
boxed
()
.
collect
(
Collectors
.
toList
());
Map
<
Integer
,
String
>
enterpriseMap
=
new
HashMap
<>();
Map
<
Integer
,
Integer
>
brandIdMap
=
new
HashMap
<>();
ServiceResponse
<
List
<
StoreBrandDTO
>>
brandResponse
=
listAllStoreBrandInfoByIds
(
brandIdList
);
if
(
brandResponse
.
isSuccess
()
&&
CollectionUtils
.
isNotEmpty
(
brandResponse
.
getResult
()))
{
List
<
StoreBrandDTO
>
brandList
=
brandResponse
.
getResult
();
//自有品牌的商户ID
List
<
Integer
>
enterpriseIdList
=
brandList
.
stream
()
.
filter
(
e
->
Objects
.
equals
(
e
.
getType
(),
1
))
.
mapToInt
(
e
->
e
.
getEnterpriseId
()).
boxed
()
.
collect
(
Collectors
.
toList
());
//自有品牌
brandIdMap
=
brandList
.
stream
().
filter
(
e
->
Objects
.
equals
(
e
.
getType
(),
1
))
.
collect
(
Collectors
.
toMap
(
e
->
e
.
getStoreBrandId
(),
e
->
e
.
getEnterpriseId
()));
ServiceResponse
<
List
<
EnterpriseDTO
>>
enterpriseResponse
=
enterpriseApiService
.
listEnterpriseByIds
(
enterpriseIdList
);
if
(
enterpriseResponse
.
isSuccess
())
{
enterpriseMap
=
enterpriseResponse
.
getResult
().
stream
().
collect
(
Collectors
.
toMap
(
e
->
e
.
getEnterpriseId
(),
e
->
e
.
getEnterpriseName
()));
}
}
Map
<
Integer
,
String
>
finalEnterpriseMap
=
enterpriseMap
;
Map
<
Integer
,
Integer
>
finalBrandIdMap
=
brandIdMap
;
voList
=
storeBrandList
.
stream
()
.
map
(
e
->
{
StoreBrandShareDTO
vo
=
new
StoreBrandShareDTO
();
vo
.
setStoreBrandId
(
e
.
getStoreBrandId
());
//共享类型
if
(
Objects
.
equals
(
e
.
getType
(),
2
))
{
Integer
tempEnterpriseId
=
finalBrandIdMap
.
get
(
e
.
getStoreBrandId
());
vo
.
setOwnerEntName
(
finalEnterpriseMap
.
get
(
tempEnterpriseId
));
vo
.
setOwnerFlag
(
0
);
}
else
{
//自有
vo
.
setOwnerFlag
(
1
);
}
return
vo
;
})
.
collect
(
Collectors
.
toList
());
return
ServiceResponse
.
success
(
voList
.
stream
().
collect
(
Collectors
.
toMap
(
StoreBrandShareDTO:
:
getStoreBrandId
,
e
->
e
)));
}
return
ServiceResponse
.
success
(
new
HashMap
<>(
2
));
}
@Override
public
ServiceResponse
deleteAll
(
Integer
enterpriseId
)
{
List
<
TabStoreBrand
>
storeBrandList
=
storeBrandService
.
listAllStoreBrand
(
enterpriseId
,
null
);
if
(
CollectionUtils
.
isEmpty
(
storeBrandList
))
{
...
...
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