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
01b5fc0a
Commit
01b5fc0a
authored
Jul 08, 2019
by
guojuxing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
策略命中接口调整
parent
1b27c126
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
7 deletions
+41
-7
StoreStrategyService.java
...main/java/com/gic/store/service/StoreStrategyService.java
+10
-0
StoreStrategyServiceImpl.java
.../com/gic/store/service/impl/StoreStrategyServiceImpl.java
+31
-7
No files found.
gic-store-service/src/main/java/com/gic/store/service/StoreStrategyService.java
View file @
01b5fc0a
package
com
.
gic
.
store
.
service
;
import
com.gic.store.dto.StoreDTO
;
import
com.gic.store.dto.StoreStrategyDTO
;
import
com.gic.store.entity.TabStore
;
import
com.gic.store.entity.TabStoreStrategy
;
import
com.github.pagehelper.Page
;
...
...
@@ -122,4 +124,12 @@ public interface StoreStrategyService {
*/
String
isHitStrategy
(
int
storeId
,
int
enterpriseId
,
int
strategyType
);
/**
* 验证是否命中,如果命中,返回的result值就是命中值,否则是空字符串
* @param storeDTO
* @param strategyType 1:门店启用状态策略 2:分组策略
* @return
*/
String
isHitStrategy
(
StoreDTO
storeDTO
,
int
strategyType
);
}
gic-store-service/src/main/java/com/gic/store/service/impl/StoreStrategyServiceImpl.java
View file @
01b5fc0a
...
...
@@ -6,6 +6,8 @@ import com.gic.commons.util.EntityUtil;
import
com.gic.store.constant.StoreGroupConstant
;
import
com.gic.store.constant.StrategyStoreFieldEnum
;
import
com.gic.store.dao.mapper.TabStoreStrategyMapper
;
import
com.gic.store.dto.StoreDTO
;
import
com.gic.store.dto.StoreExtendDTO
;
import
com.gic.store.dto.StoreStrategyDTO
;
import
com.gic.store.entity.TabStore
;
import
com.gic.store.entity.TabStoreExtend
;
...
...
@@ -16,10 +18,13 @@ import com.gic.store.service.StoreStrategyService;
import
com.github.pagehelper.Page
;
import
com.github.pagehelper.PageHelper
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
* @author guojx
...
...
@@ -152,12 +157,25 @@ public class StoreStrategyServiceImpl implements StoreStrategyService{
@Override
public
String
isHitStrategy
(
int
storeId
,
int
enterpriseId
,
int
strategyType
)
{
List
<
TabStoreStrategy
>
strategyList
=
listStoreStrategy
(
enterpriseId
,
strategyType
);
TabStore
store
=
storeService
.
getById
(
storeId
);
return
validIsHit
(
strategyType
,
store
,
null
);
}
@Override
public
String
isHitStrategy
(
StoreDTO
storeDTO
,
int
strategyType
)
{
return
validIsHit
(
strategyType
,
EntityUtil
.
changeEntityNew
(
TabStore
.
class
,
storeDTO
),
storeDTO
.
getStoreExtendList
());
}
private
String
validIsHit
(
int
strategyType
,
TabStore
store
,
List
<
StoreExtendDTO
>
extendDTOList
)
{
Map
<
Integer
,
String
>
extendMap
=
new
HashMap
<>(
16
);
if
(
extendDTOList
!=
null
)
{
for
(
StoreExtendDTO
extendDTO
:
extendDTOList
)
{
extendMap
.
put
(
extendDTO
.
getStoreFieldId
(),
extendDTO
.
getValue
());
}
}
//命中值
String
result
=
""
;
TabStore
store
=
storeService
.
getById
(
storeId
);
List
<
TabStoreStrategy
>
strategyList
=
listStoreStrategy
(
store
.
getEnterpriseId
(),
strategyType
);
for
(
int
num
=
0
,
strategyLength
=
strategyList
.
size
();
num
<
strategyLength
;
num
++)
{
//如果数值对上,则说明命中
int
validSize
=
0
;
...
...
@@ -198,9 +216,16 @@ public class StoreStrategyServiceImpl implements StoreStrategyService{
}
}
else
{
//单选或者多选
TabStoreExtend
storeExtend
=
storeExtendService
.
getStoreExtendByStoreIdAndFieldId
(
storeId
,
Integer
.
parseInt
(
key
));
if
(!
isBrandIdHitStrategy
(
storeExtend
.
getValue
(),
value
))
{
continue
;
if
(
extendDTOList
!=
null
)
{
TabStoreExtend
storeExtend
=
storeExtendService
.
getStoreExtendByStoreIdAndFieldId
(
store
.
getStoreId
(),
Integer
.
parseInt
(
key
));
if
(
storeExtend
!=
null
&&
!
isBrandIdHitStrategy
(
storeExtend
.
getValue
(),
value
))
{
continue
;
}
}
else
{
String
storeFieldValue
=
extendMap
.
get
(
Integer
.
parseInt
(
key
));
if
(
StringUtils
.
isNotBlank
(
storeFieldValue
)
&&
!
isBrandIdHitStrategy
(
storeFieldValue
,
value
))
{
continue
;
}
}
}
...
...
@@ -226,7 +251,6 @@ public class StoreStrategyServiceImpl implements StoreStrategyService{
break
;
}
}
return
result
;
}
...
...
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