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
e057689a
Commit
e057689a
authored
Jun 11, 2020
by
陶光胜
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'developer' into 'master'
Developer See merge request
!18
parents
ce4fdfd3
c3faae68
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
78 additions
and
21 deletions
+78
-21
StoreApiService.java
.../src/main/java/com/gic/store/service/StoreApiService.java
+11
-0
ProvincesApiServiceImpl.java
...gic/store/service/outer/impl/ProvincesApiServiceImpl.java
+40
-15
StoreApiServiceImpl.java
...com/gic/store/service/outer/impl/StoreApiServiceImpl.java
+9
-0
StoreWidgetApiServiceImpl.java
...c/store/service/outer/impl/StoreWidgetApiServiceImpl.java
+10
-2
StoreController.java
...in/java/com/gic/store/web/controller/StoreController.java
+6
-4
StoreImportController.java
...a/com/gic/store/web/controller/StoreImportController.java
+2
-0
No files found.
gic-store-api/src/main/java/com/gic/store/service/StoreApiService.java
View file @
e057689a
...
...
@@ -45,6 +45,17 @@ public interface StoreApiService {
* @throws
*/
ServiceResponse
<
Integer
>
saveStoreForPosMember
(
Integer
enterpriseId
,
String
storeCode
,
String
storeName
,
Integer
regionId
,
String
cardNO
);
/**
* @Title: countByOverflowStatus
* @Description:
* @author zhiwj
* @param enterpriseId
* @return com.gic.api.base.commons.ServiceResponse<java.lang.Integer>
* @throws
*/
ServiceResponse
<
Integer
>
countByOverflowStatus
(
Integer
enterpriseId
);
/**
* @Title: listStore
* @Description: 分页门店列表 查es
...
...
gic-store-service/src/main/java/com/gic/store/service/outer/impl/ProvincesApiServiceImpl.java
View file @
e057689a
...
...
@@ -14,6 +14,9 @@ import com.gic.store.entity.TabProvince;
import
com.gic.store.service.ProvincesApiService
;
import
com.gic.store.service.ProvincesService
;
import
com.gic.store.service.StoreService
;
import
com.google.common.cache.CacheBuilder
;
import
com.google.common.cache.CacheLoader
;
import
com.google.common.cache.LoadingCache
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.logging.log4j.LogManager
;
...
...
@@ -21,6 +24,7 @@ import org.apache.logging.log4j.Logger;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.PostConstruct
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.List
;
...
...
@@ -31,30 +35,55 @@ import java.util.stream.Collectors;
@Service
(
"provincesApiService"
)
public
class
ProvincesApiServiceImpl
implements
ProvincesApiService
{
private
static
final
Logger
log
=
LogManager
.
getLogger
(
ProvincesApiServiceImpl
.
class
);
private
LoadingCache
<
String
,
List
<
ProvinceDTO
>>
provinceCache
=
null
;
private
LoadingCache
<
String
,
List
<
CityDTO
>>
cityCache
=
null
;
private
LoadingCache
<
String
,
List
<
CountyDTO
>>
countyCache
=
null
;
private
static
final
int
EXPIRE_SECONDS
=
7
;
@Autowired
private
ProvincesService
provincesService
;
@Autowired
private
StoreService
storeService
;
@PostConstruct
public
void
init
(){
provinceCache
=
CacheBuilder
.
newBuilder
().
maximumSize
(
10
).
expireAfterAccess
(
EXPIRE_SECONDS
,
TimeUnit
.
DAYS
)
.
build
(
new
CacheLoader
<
String
,
List
<
ProvinceDTO
>>()
{
@Override
public
List
<
ProvinceDTO
>
load
(
String
key
)
{
return
EntityUtil
.
changeEntityListByJSON
(
ProvinceDTO
.
class
,
provincesService
.
selectAllProvince
());
}
});
cityCache
=
CacheBuilder
.
newBuilder
().
maximumSize
(
10
).
expireAfterAccess
(
EXPIRE_SECONDS
,
TimeUnit
.
DAYS
)
.
build
(
new
CacheLoader
<
String
,
List
<
CityDTO
>>()
{
@Override
public
List
<
CityDTO
>
load
(
String
key
)
{
return
EntityUtil
.
changeEntityListByJSON
(
CityDTO
.
class
,
provincesService
.
selectAllCity
());
}
});
countyCache
=
CacheBuilder
.
newBuilder
().
maximumSize
(
10
).
expireAfterAccess
(
EXPIRE_SECONDS
,
TimeUnit
.
DAYS
)
.
build
(
new
CacheLoader
<
String
,
List
<
CountyDTO
>>()
{
@Override
public
List
<
CountyDTO
>
load
(
String
key
)
{
return
EntityUtil
.
changeEntityListByJSON
(
CountyDTO
.
class
,
provincesService
.
selectAllCounty
());
}
});
}
@Override
public
ServiceResponse
<
List
<
ProvinceDTO
>>
selectAllProvince
()
{
String
key
=
"enterprise:province"
;
List
<
ProvinceDTO
>
list
=
(
List
<
ProvinceDTO
>)
RedisUtil
.
getCache
(
key
);
if
(
CollectionUtils
.
isEmpty
(
list
)){
list
=
EntityUtil
.
changeEntityListByJSON
(
ProvinceDTO
.
class
,
this
.
provincesService
.
selectAllProvince
());
RedisUtil
.
setCache
(
key
,
list
,
6
*
30
l
,
TimeUnit
.
DAYS
);
}
List
<
ProvinceDTO
>
list
=
provinceCache
.
getUnchecked
(
key
);
return
ServiceResponse
.
success
(
list
);
}
@Override
public
ServiceResponse
<
List
<
CityDTO
>>
selectAllCity
()
{
String
key
=
"enterprise:city"
;
List
<
CityDTO
>
list
=
(
List
<
CityDTO
>)
RedisUtil
.
getCache
(
key
);
if
(
CollectionUtils
.
isEmpty
(
list
)){
list
=
EntityUtil
.
changeEntityListByJSON
(
CityDTO
.
class
,
this
.
provincesService
.
selectAllCity
());
RedisUtil
.
setCache
(
key
,
list
,
6
*
30
l
,
TimeUnit
.
DAYS
);
}
List
<
CityDTO
>
list
=
cityCache
.
getUnchecked
(
key
);
log
.
info
(
"allcity:{}"
,
list
.
size
());
return
ServiceResponse
.
success
(
list
);
}
...
...
@@ -95,11 +124,7 @@ public class ProvincesApiServiceImpl implements ProvincesApiService {
@Override
public
ServiceResponse
<
List
<
CountyDTO
>>
selectAllCounty
()
{
String
key
=
"enterprise:county"
;
List
<
CountyDTO
>
list
=
(
List
<
CountyDTO
>)
RedisUtil
.
getCache
(
key
);
if
(
CollectionUtils
.
isEmpty
(
list
)){
list
=
EntityUtil
.
changeEntityListByJSON
(
CountyDTO
.
class
,
this
.
provincesService
.
selectAllCounty
());
RedisUtil
.
setCache
(
key
,
list
,
6
*
30
l
,
TimeUnit
.
DAYS
);
}
List
<
CountyDTO
>
list
=
countyCache
.
getUnchecked
(
key
);
return
ServiceResponse
.
success
(
list
);
}
...
...
gic-store-service/src/main/java/com/gic/store/service/outer/impl/StoreApiServiceImpl.java
View file @
e057689a
...
...
@@ -284,6 +284,12 @@ public class StoreApiServiceImpl implements StoreApiService {
return
EnterpriseServiceResponse
.
failure
(
ErrorCode
.
UNKNOWN_ERROR
.
getCode
(),
"商户没有门店license"
);
}
@Override
public
ServiceResponse
<
Integer
>
countByOverflowStatus
(
Integer
enterpriseId
)
{
this
.
storeService
.
countByOverflowStatus
(
enterpriseId
,
0
);
return
EnterpriseServiceResponse
.
success
(
this
.
storeService
.
countByOverflowStatus
(
enterpriseId
,
0
));
}
/**
* 修改日志
*/
...
...
@@ -1056,6 +1062,9 @@ public class StoreApiServiceImpl implements StoreApiService {
ServiceResponse
<
StoreDTO
>
result
=
getStoreByStoreCode
(
enterpriseId
,
regionId
,
storeCode
);
if
(
result
.
isSuccess
())
{
StoreDTO
storeDTO
=
result
.
getResult
();
if
(
storeDTO
==
null
)
{
return
ServiceResponse
.
success
();
}
List
<
TabStoreBusinessTime
>
list
=
storeBusinessTimeService
.
listBusinessTime
(
storeDTO
.
getStoreInfoId
());
List
<
StoreBusinessTimeDTO
>
businessTimeDTOList
=
EntityUtil
.
changeEntityListByOrika
(
StoreBusinessTimeDTO
.
class
,
list
);
storeDTO
.
setBusinessTimeList
(
businessTimeDTOList
);
...
...
gic-store-service/src/main/java/com/gic/store/service/outer/impl/StoreWidgetApiServiceImpl.java
View file @
e057689a
...
...
@@ -2,6 +2,7 @@ package com.gic.store.service.outer.impl;
import
com.gic.api.base.commons.Page
;
import
com.gic.api.base.commons.ServiceResponse
;
import
com.gic.commons.util.EntityUtil
;
import
com.gic.enterprise.error.ErrorCode
;
import
com.gic.enterprise.response.EnterpriseServiceResponse
;
import
com.gic.store.constant.StoreESFieldsEnum
;
...
...
@@ -9,7 +10,9 @@ import com.gic.store.dto.StoreBrandDTO;
import
com.gic.store.dto.StoreDTO
;
import
com.gic.store.dto.StoreSearchDTO
;
import
com.gic.store.dto.StoreWidgetDTO
;
import
com.gic.store.entity.TabStoreBrand
;
import
com.gic.store.service.StoreApiService
;
import
com.gic.store.service.StoreBrandService
;
import
com.gic.store.service.StoreWidgetApiService
;
import
com.gic.store.service.StoreWidgetService
;
import
org.apache.commons.collections.CollectionUtils
;
...
...
@@ -26,6 +29,8 @@ public class StoreWidgetApiServiceImpl implements StoreWidgetApiService {
private
StoreWidgetService
storeWidgetService
;
@Autowired
private
StoreApiService
storeApiService
;
@Autowired
private
StoreBrandService
storeBrandService
;
@Override
public
ServiceResponse
<
Integer
>
saveStoreWidget
(
StoreWidgetDTO
storeWidgetDTO
)
{
...
...
@@ -167,13 +172,16 @@ public class StoreWidgetApiServiceImpl implements StoreWidgetApiService {
return
EnterpriseServiceResponse
.
failure
(
serviceResponse
.
getCode
(),
serviceResponse
.
getMessage
());
}
List
<
StoreDTO
>
list
=
serviceResponse
.
getResult
().
getResult
();
List
<
Integer
>
brandIdList
=
new
ArrayList
<>();
List
<
StoreBrandDTO
>
brandList
=
new
ArrayList
<>();
if
(
CollectionUtils
.
isNotEmpty
(
list
))
{
for
(
StoreDTO
storeDTO
:
list
)
{
if
(
CollectionUtils
.
isNotEmpty
(
storeDTO
.
get
Bran
dList
()))
{
brand
List
.
addAll
(
storeDTO
.
getBran
dList
());
if
(
CollectionUtils
.
isNotEmpty
(
storeDTO
.
get
StoreBrandI
dList
()))
{
brand
IdList
.
addAll
(
storeDTO
.
getStoreBrandI
dList
());
}
}
List
<
TabStoreBrand
>
tabStoreBrands
=
storeBrandService
.
listStoreBrandByIds
(
brandIdList
);
brandList
=
EntityUtil
.
changeEntityListByJSON
(
StoreBrandDTO
.
class
,
tabStoreBrands
);
}
return
EnterpriseServiceResponse
.
success
(
brandList
);
}
...
...
gic-store-web/src/main/java/com/gic/store/web/controller/StoreController.java
View file @
e057689a
...
...
@@ -173,7 +173,7 @@ public class StoreController extends DownloadUtils {
String
key
=
StoreRedisKeyUtils
.
getStoreListSourceKey
(
enterpriseId
,
userId
);
Object
obj
=
RedisUtil
.
getCache
(
key
);
String
returnFileds
=
StoreESFieldsEnum
.
STOREID
.
getField
();
String
returnFileds
=
StoreESFieldsEnum
.
STOREID
.
getField
()
+
","
+
StoreESFieldsEnum
.
STOREINFOID
.
getField
()
;
if
(
obj
==
null
){
List
<
StoreListSourceVO
>
list
=
this
.
getStoreAllListSource
(
enterpriseId
);
for
(
StoreListSourceVO
vo
:
list
){
...
...
@@ -280,10 +280,12 @@ public class StoreController extends DownloadUtils {
@RequestMapping
(
"store-license-limit"
)
public
RestResponse
storeLicenseLimit
()
{
ServiceResponse
<
List
<
EnterpriseLicenseDTO
>>
listEnterpriseLicense
=
this
.
enterpriseApiService
.
listEnterpriseLicense
(
UserDetailUtils
.
getUserDetail
().
getEnterpriseId
());
Integer
enterpriseId
=
UserDetailUtils
.
getUserDetail
().
getEnterpriseId
();
ServiceResponse
<
List
<
EnterpriseLicenseDTO
>>
listEnterpriseLicense
=
this
.
enterpriseApiService
.
listEnterpriseLicense
(
enterpriseId
);
if
(
listEnterpriseLicense
.
isSuccess
()
&&
CollectionUtils
.
isNotEmpty
(
listEnterpriseLicense
.
getResult
()))
{
if
(
listEnterpriseLicense
.
getResult
().
size
()
==
4
)
{
return
RestResponse
.
success
(
listEnterpriseLicense
.
getResult
().
get
(
3
).
getUpperLimit
());
Integer
result
=
this
.
storeApiService
.
countByOverflowStatus
(
enterpriseId
).
getResult
();
return
RestResponse
.
success
(
listEnterpriseLicense
.
getResult
().
get
(
3
).
getUpperLimit
()
-
result
);
}
}
return
RestResponse
.
success
();
...
...
@@ -508,7 +510,7 @@ public class StoreController extends DownloadUtils {
List
<
QrcodeContent
>
list
=
new
ArrayList
<>();
for
(
StoreDTO
dto
:
result
.
getResult
()){
QrcodeContent
qrcodeContent
=
new
QrcodeContent
();
qrcodeContent
.
setCustomParams
(
dto
.
getStoreId
()+
""
);
qrcodeContent
.
setCustomParams
(
dto
.
getStoreI
nfoI
d
()+
""
);
qrcodeContent
.
setTitle
(
dto
.
getStoreName
());
list
.
add
(
qrcodeContent
);
}
...
...
gic-store-web/src/main/java/com/gic/store/web/controller/StoreImportController.java
View file @
e057689a
...
...
@@ -5,6 +5,7 @@ import com.gic.api.base.commons.Page;
import
com.gic.api.base.commons.ServiceResponse
;
import
com.gic.commons.webapi.reponse.RestResponse
;
import
com.gic.download.utils.log.LogUtils
;
import
com.gic.enterprise.ano.IgnoreLogin
;
import
com.gic.enterprise.error.ErrorCode
;
import
com.gic.enterprise.utils.UserDetailUtils
;
import
com.gic.store.constant.StoreImportEnum
;
...
...
@@ -68,6 +69,7 @@ public class StoreImportController {
* @return
* @throws Exception
*/
@IgnoreLogin
@RequestMapping
(
"/store-import-template-download"
)
public
Object
download
(
HttpServletRequest
request
,
HttpServletResponse
response
)
throws
Exception
{
// ClassPathResource res = new ClassPathResource("门店资料导入模板.xlsx");
...
...
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