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
16120f64
Commit
16120f64
authored
Feb 06, 2020
by
guojuxing
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/developer' into developer
parents
b3634786
55d2ba5d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
57 additions
and
7 deletions
+57
-7
StoreApiService.java
.../src/main/java/com/gic/store/service/StoreApiService.java
+14
-0
StoreApiServiceImpl.java
...com/gic/store/service/outer/impl/StoreApiServiceImpl.java
+43
-7
No files found.
gic-store-api/src/main/java/com/gic/store/service/StoreApiService.java
View file @
16120f64
...
...
@@ -6,6 +6,7 @@ import com.gic.api.base.commons.ServiceResponse;
import
com.gic.store.dto.*
;
import
java.util.List
;
import
java.util.Map
;
/**
* @author zhiwj
...
...
@@ -54,6 +55,19 @@ public interface StoreApiService {
* @throws
*/
ServiceResponse
<
Page
<
StoreDTO
>>
listStore
(
StoreSearchDTO
storeSearchDTO
,
Integer
pageNum
,
Integer
pageSize
);
/**
* 按id查询门店图片 key:storeId value:门店图片列表
* @Title: listStorePhotoByIds
* @Description:
* @author zhiwj
* @param enterpriseId
* @param storeIdList
* @return com.gic.api.base.commons.ServiceResponse<java.util.Map<java.lang.Integer,java.util.List<java.lang.String>>>
* @throws
*/
ServiceResponse
<
Map
<
Integer
,
List
<
String
>>>
listStorePhotoByStoreIds
(
Integer
enterpriseId
,
List
<
Integer
>
storeIdList
);
/**
* @Title: getStoreById
* @Description: 查询门店详情
...
...
gic-store-service/src/main/java/com/gic/store/service/outer/impl/StoreApiServiceImpl.java
View file @
16120f64
...
...
@@ -28,6 +28,7 @@ import com.gic.store.entity.*;
import
com.gic.store.service.*
;
import
com.gic.store.strategy.BulkUpdateStoreStrtegy
;
import
com.gic.store.utils.field.*
;
import
com.google.common.base.Joiner
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.logging.log4j.LogManager
;
...
...
@@ -439,6 +440,31 @@ public class StoreApiServiceImpl implements StoreApiService {
}
@Override
public
ServiceResponse
<
Map
<
Integer
,
List
<
String
>>>
listStorePhotoByStoreIds
(
Integer
enterpriseId
,
List
<
Integer
>
storeIdList
)
{
StoreSearchDTO
storeSearchDTO
=
new
StoreSearchDTO
();
storeSearchDTO
.
setEnterpriseId
(
enterpriseId
);
storeSearchDTO
.
setStoreIds
(
Joiner
.
on
(
" "
).
join
(
storeIdList
));
ServiceResponse
<
Page
<
StoreDTO
>>
serviceResponse
=
this
.
listStore
(
storeSearchDTO
,
1
,
20
);
if
(!
serviceResponse
.
isSuccess
())
{
return
ServiceResponse
.
failure
(
serviceResponse
.
getCode
(),
serviceResponse
.
getMessage
());
}
Map
<
Integer
,
List
<
String
>>
resultMap
=
new
HashMap
<>(
16
);
List
<
StoreDTO
>
storeDTOList
=
serviceResponse
.
getResult
().
getResult
();
for
(
StoreDTO
storeDTO
:
storeDTOList
)
{
List
<
StorePhotoDTO
>
photoList
=
storeDTO
.
getPhotoList
();
List
<
String
>
list
=
Optional
.
ofNullable
(
photoList
).
orElse
(
Collections
.
emptyList
()).
stream
().
map
(
StorePhotoDTO:
:
getImageUrl
).
collect
(
Collectors
.
toList
());
// todo 给一个门店图片默认值测试
if
(
CollectionUtils
.
isNotEmpty
(
list
))
{
list
=
Arrays
.
asList
(
"http://gicdev.demogic.com/gic-web/static/img/side-img.dc95242.png"
);
}
resultMap
.
put
(
storeDTO
.
getStoreId
(),
list
);
}
return
EnterpriseServiceResponse
.
success
(
resultMap
);
}
@Override
public
ServiceResponse
queryStoreFromES
(
JSONObject
jsonObject
,
Integer
pageNum
,
Integer
pageSize
,
JSONObject
sortJson
,
String
returnFileds
)
{
if
(
StringUtils
.
isBlank
(
returnFileds
))
{
returnFileds
=
StoreESFieldsEnum
.
STOREID
.
getField
();
...
...
@@ -658,13 +684,19 @@ public class StoreApiServiceImpl implements StoreApiService {
List
<
CountyDTO
>
countyDTOList
=
countyResponse
.
getResult
();
String
finalCounty
=
processBatchStoreDTO
.
getCounty
();
CountyDTO
countyDTO
=
countyDTOList
.
stream
().
filter
(
e
->
StringUtils
.
equals
(
e
.
getCountyName
(),
finalCounty
)).
findFirst
().
orElse
(
null
);
if
(
countyDTO
==
null
||
cityDTO
==
null
||
provinceDTO
==
null
)
{
return
responseErrorElement
(
ImportStoreBatchResultEnum
.
B4
);
if
(
provinceDTO
!=
null
&&
cityDTO
!=
null
&&
countyDTO
!=
null
)
{
storeDTO
.
setProvinceId
(
countyDTO
.
getProvinceId
());
storeDTO
.
setCityId
(
countyDTO
.
getCityId
());
storeDTO
.
setAreaId
(
countyDTO
.
getCountyId
());
storeDTO
.
setProvinces
(
provinceDTO
.
getProvinceName
()
+
"/"
+
countyDTO
.
getCountyName
()
+
"/"
+
cityDTO
.
getCityName
());
}
storeDTO
.
setProvinceId
(
countyDTO
.
getProvinceId
());
storeDTO
.
setCityId
(
countyDTO
.
getCityId
());
storeDTO
.
setAreaId
(
countyDTO
.
getCountyId
());
storeDTO
.
setProvinces
(
provinceDTO
.
getProvinceName
()
+
"/"
+
countyDTO
.
getCountyName
()
+
"/"
+
cityDTO
.
getCityName
());
}
storeDTO
.
setStoreGroupName
(
processBatchStoreDTO
.
getStoreGroupName
());
TabStoreGroup
group
=
storeGroupService
.
getStoreGroupByName
(
processBatchStoreDTO
.
getStoreGroupName
(),
processBatchStoreDTO
.
getEnterpriseId
());
if
(
group
!=
null
)
{
storeDTO
.
setStoreGroupId
(
group
.
getStoreGroupId
());
}
List
<
StoreFieldDTO
>
fieldList
=
storeFieldService
.
listStoreFieldByRegionId
(
processBatchStoreDTO
.
getRegionId
());
...
...
@@ -706,7 +738,11 @@ public class StoreApiServiceImpl implements StoreApiService {
storeDTO
.
setReason
(
StoreLogReasonEnum
.
EXTERNAL
.
getCode
());
// 保存门店
// this.storeService.save(storeDTO);
this
.
saveOrUpdate
(
storeDTO
);
ServiceResponse
<
Integer
>
serviceResponse
=
this
.
saveOrUpdate
(
storeDTO
);
if
(!
serviceResponse
.
isSuccess
())
{
return
EnterpriseServiceResponse
.
failure
(
serviceResponse
.
getCode
(),
serviceResponse
.
getMessage
());
}
if
((
StringUtils
.
isBlank
(
processBatchStoreDTO
.
getProvince
())
&&
StringUtils
.
isBlank
(
processBatchStoreDTO
.
getCity
())
&&
StringUtils
.
isBlank
(
processBatchStoreDTO
.
getCounty
())))
{
return
responseErrorElement
(
ImportStoreBatchResultEnum
.
B3
);
...
...
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