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
3e8a70ea
Commit
3e8a70ea
authored
Aug 21, 2020
by
zhiwj
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
转移会员
parent
52d73afc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
59 additions
and
2 deletions
+59
-2
StoreDTO.java
gic-store-api/src/main/java/com/gic/store/dto/StoreDTO.java
+11
-0
StoreController.java
...in/java/com/gic/store/web/controller/StoreController.java
+48
-2
No files found.
gic-store-api/src/main/java/com/gic/store/dto/StoreDTO.java
View file @
3e8a70ea
...
...
@@ -57,6 +57,8 @@ public class StoreDTO extends StoreInfoDTO implements Serializable {
private
String
statusName
;
private
String
erpStatusName
;
private
String
storeTypeName
;
// 有没有在转移中的会员 1有 0没有
private
int
hasTransMember
;
public
Integer
getStoreId
()
{
return
storeId
;
...
...
@@ -233,4 +235,12 @@ public class StoreDTO extends StoreInfoDTO implements Serializable {
public
String
getStoreTypeName
()
{
return
storeTypeName
;
}
public
void
setHasTransMember
(
int
hasTransMember
)
{
this
.
hasTransMember
=
hasTransMember
;
}
public
int
getHasTransMember
()
{
return
hasTransMember
;
}
}
\ No newline at end of file
gic-store-web/src/main/java/com/gic/store/web/controller/StoreController.java
View file @
3e8a70ea
...
...
@@ -45,6 +45,8 @@ import org.apache.commons.collections.CollectionUtils;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.logging.log4j.LogManager
;
import
org.apache.logging.log4j.Logger
;
import
org.redisson.api.RMap
;
import
org.redisson.api.RedissonClient
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.validation.annotation.Validated
;
import
org.springframework.web.bind.annotation.RequestBody
;
...
...
@@ -54,9 +56,13 @@ import org.springframework.web.bind.annotation.RestController;
import
javax.servlet.http.HttpServletRequest
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.concurrent.ConcurrentHashMap
;
import
java.util.stream.Collectors
;
import
java.util.stream.Stream
;
/**
* @author zhiwj
...
...
@@ -202,6 +208,7 @@ public class StoreController extends DownloadUtils {
List
<
StoreDTO
>
result
=
page
.
getResult
();
if
(
CollectionUtils
.
isNotEmpty
(
result
)){
this
.
convertCustomField
(
result
);
this
.
convertTranMember
(
result
);
}
page
.
setResult
(
result
);
}
...
...
@@ -583,6 +590,13 @@ public class StoreController extends DownloadUtils {
@RequestMapping
(
"transfer-store-member"
)
public
RestResponse
transferStoreMember
(
String
storeId
,
Integer
toStoreId
){
RedissonClient
redisClient
=
RedisUtil
.
getRedisClient
();
RMap
<
Integer
,
String
>
cacheMap
=
redisClient
.
getMap
(
"enterprise:store:transfermember:process"
);
String
cacheStoreId
=
cacheMap
.
get
(
UserDetailUtils
.
getUserDetail
().
getEnterpriseId
());
if
(
StringUtils
.
isNotBlank
(
cacheStoreId
))
{
return
RestResponse
.
failure
(
ErrorCode
.
OPERATION_FAILED
.
getCode
(),
"请其他门店会员转移完毕后再试"
);
}
// 把参数改成storeInfoId
StoreSearchDTO
storeSearchDTO
=
new
StoreSearchDTO
();
storeSearchDTO
.
setEnterpriseId
(
UserDetailUtils
.
getUserDetail
().
getEnterpriseId
());
...
...
@@ -606,6 +620,8 @@ public class StoreController extends DownloadUtils {
logger
.
info
(
"transfer-store-member:{}"
,
JSON
.
toJSONString
(
storeBatchUpdateDTO
));
ServiceResponse
<
Void
>
response
=
this
.
storeUpdateApiService
.
storeBatchUpdate
(
storeBatchUpdateDTO
);
logger
.
info
(
"transfer-store-member-result:{}"
,
JSON
.
toJSONString
(
response
));
cacheMap
.
put
(
UserDetailUtils
.
getUserDetail
().
getEnterpriseId
(),
storeId
);
for
(
String
store
:
list
)
{
StoreDTO
storeDTO
=
storeApiService
.
getStoreById
(
UserDetailUtils
.
getUserDetail
().
getEnterpriseId
(),
Integer
.
valueOf
(
store
)).
getResult
();
if
(
storeDTO
!=
null
)
{
...
...
@@ -629,7 +645,22 @@ public class StoreController extends DownloadUtils {
return
RestResponse
.
success
(
Collections
.
emptyList
());
}
public
boolean
hasTransMember
()
{
ServiceResponse
<
List
<
BatchTaskOperaInfDTO
>>
resp
=
batchOperationApiService
.
queryUnderwayTask
(
UserDetailUtils
.
getUserDetail
().
getEnterpriseId
());
if
(
resp
.
isSuccess
())
{
List
<
BatchTaskOperaInfDTO
>
list
=
resp
.
getResult
();
if
(
CollectionUtils
.
isNotEmpty
(
list
))
{
List
<
BatchTaskOperaInfDTO
>
processList
=
list
.
stream
().
filter
(
e
->
e
.
getTaskType
()
==
17
).
collect
(
Collectors
.
toList
());
if
(
CollectionUtils
.
isNotEmpty
(
processList
))
{
return
true
;
}
}
}
RedissonClient
redisClient
=
RedisUtil
.
getRedisClient
();
RMap
<
Integer
,
String
>
cacheMap
=
redisClient
.
getMap
(
"enterprise:store:transfermember:process"
);
cacheMap
.
remove
(
UserDetailUtils
.
getUserDetail
().
getEnterpriseId
());
return
false
;
}
private
List
<
StoreListSourceVO
>
getStoreAllListSource
(
Integer
enterpriseId
)
{
...
...
@@ -852,6 +883,21 @@ public class StoreController extends DownloadUtils {
return
simpleDateFormat
;
}
private
void
convertTranMember
(
List
<
StoreDTO
>
result
)
{
this
.
hasTransMember
();
RedissonClient
redisClient
=
RedisUtil
.
getRedisClient
();
RMap
<
Integer
,
String
>
cacheMap
=
redisClient
.
getMap
(
"enterprise:store:transfermember:process"
);
String
cacheStoreId
=
cacheMap
.
get
(
UserDetailUtils
.
getUserDetail
().
getEnterpriseId
());
if
(
StringUtils
.
isBlank
(
cacheStoreId
))
{
return
;
}
List
<
Integer
>
storeIdList
=
Stream
.
of
(
cacheStoreId
.
split
(
","
)).
map
(
Integer:
:
valueOf
).
collect
(
Collectors
.
toList
());
for
(
StoreDTO
storeDTO
:
result
)
{
storeDTO
.
setHasTransMember
(
storeIdList
.
contains
(
storeDTO
.
getStoreId
())
?
1
:
0
);
}
}
/**
* 小康那边跑非实时的分组 需要这个接口转换数据
*/
...
...
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