Commit 6f63c71d by 陶光胜

门店控件修复

parent ac0ce295
...@@ -71,6 +71,11 @@ public class DataAuthUtils { ...@@ -71,6 +71,11 @@ public class DataAuthUtils {
if(storeResourceDTO.getType() == 1){ if(storeResourceDTO.getType() == 1){
//所有门店权限 //所有门店权限
storeAuth.setHasAuth(true); storeAuth.setHasAuth(true);
List<StoreDTO> storeList = storeApiService.listStore(null, enterpriseId).getResult();
if(CollectionUtils.isNotEmpty(storeList)){
List<Integer> storeInfoIdList = storeList.stream().map(storeDTO -> storeDTO.getStoreInfoId()).collect(Collectors.toList());
storeAuth.setStoreInfoIdList(storeInfoIdList);
}
return storeAuth; return storeAuth;
} }
if(CollectionUtils.isEmpty(storeResourceDTO.getStoreIdList())){ if(CollectionUtils.isEmpty(storeResourceDTO.getStoreIdList())){
...@@ -113,7 +118,7 @@ public class DataAuthUtils { ...@@ -113,7 +118,7 @@ public class DataAuthUtils {
//查询当前商户下所有门店 //查询当前商户下所有门店
List<WmStoreDTO> result = wmStoreApiService.listWmStore(enterpriseId).getResult(); List<WmStoreDTO> result = wmStoreApiService.listWmStore(enterpriseId).getResult();
if(CollectionUtils.isNotEmpty(result)){ if(CollectionUtils.isNotEmpty(result)){
result.stream().forEach(wmStoreDTO -> storeIdList.add(wmStoreDTO.getWmStoreId())); result.stream().forEach(wmStoreDTO -> storeIdList.add(wmStoreDTO.getWmMallStoreId()+""));
} }
onLineStore.setStoreIdList(storeIdList); onLineStore.setStoreIdList(storeIdList);
list.add(onLineStore); list.add(onLineStore);
......
package com.gic.cloud.web.constant;
public class Constants {
/**
* 第0层级
*/
public final static Integer ZERO = 0;
/**
* 第1层级
*/
public final static Integer FIRST = 1;
/**
* 第2层级
*/
public final static Integer TWO = 2;
/**
* 第3层级
*/
public final static Integer THREE = 3;
/**
* 第4层级
*/
public final static Integer FOUR = 4;
/**
* 第5层级
*/
public final static Integer FIVE = 5;
/**
* 第6层级
*/
public final static Integer SIX = 6;
/**
* 第7层级
*/
public final static Integer SEV = 7;
/**
* 第8层级
*/
public final static Integer EIGHT = 8;
}
...@@ -8,6 +8,10 @@ package com.gic.cloud.web.constant; ...@@ -8,6 +8,10 @@ package com.gic.cloud.web.constant;
*/ */
public enum StoreChannelEnum { public enum StoreChannelEnum {
/** /**
* 全渠道
*/
ALL(0, "所有渠道"),
/**
* 线下 * 线下
*/ */
OFFLINE(1, "线下"), OFFLINE(1, "线下"),
......
...@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON; ...@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON;
import com.gic.api.base.commons.Page; import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse; import com.gic.api.base.commons.ServiceResponse;
import com.gic.cloud.web.auth.DataAuthUtils; import com.gic.cloud.web.auth.DataAuthUtils;
import com.gic.cloud.web.constant.Constants;
import com.gic.cloud.web.constant.StoreChannelEnum; import com.gic.cloud.web.constant.StoreChannelEnum;
import com.gic.cloud.web.qo.BaseSalesParamQo; import com.gic.cloud.web.qo.BaseSalesParamQo;
import com.gic.cloud.web.qo.DateTypeQo; import com.gic.cloud.web.qo.DateTypeQo;
...@@ -56,29 +57,29 @@ public class BaseSalesController { ...@@ -56,29 +57,29 @@ public class BaseSalesController {
/******线下渠道需要点击下钻,该值只会在线下时才会使用********/ /******线下渠道需要点击下钻,该值只会在线下时才会使用********/
LevelVo levelVo = this.storeSearchUtils.getLevel(qo.getUserId(), qo.getEnterpriseId(), qo.getSearchJson()); LevelVo levelVo = this.storeSearchUtils.getLevel(qo.getUserId(), qo.getEnterpriseId(), qo.getSearchJson());
maxLevel = levelVo.getMaxLevel(); maxLevel = levelVo.getMaxLevel();
if(qo.getLevel() == null){ if(qo.getLevel() == Constants.ZERO){
qo.setLevel(levelVo.getLevel()); qo.setLevel(levelVo.getLevel());
} }
if(qo.getLevel().intValue() > levelVo.getMaxLevel().intValue()){ if(qo.getLevel() > levelVo.getMaxLevel()){
if(qo.getLevel().intValue()- levelVo.getMaxLevel().intValue() == 1){ if(qo.getLevel()- levelVo.getMaxLevel() == 1){
qo.setLevel(7); qo.setLevel(7);
} }
} }
List<Integer> childrenStoreGroupIdList = this.storeSearchUtils.getChildrenStoreGroupIdList(qo.getEnterpriseId(), qo.getParentId(), qo.getLevel()); List<Integer> childrenStoreGroupIdList = this.storeSearchUtils.getChildrenStoreGroupIdList(qo.getEnterpriseId(), qo.getParentId(), qo.getLevel(), qo.getChannel());
/****首页进入基础页面时,如果渠道为空,根据当前条件判断渠道,channel==null表示多渠道***/ /****首页进入基础页面时,如果渠道为空,根据当前条件判断渠道,channel==0表示多渠道***/
if(qo.getChannel() == null){ if(qo.getChannel() == StoreChannelEnum.ALL.getChannel()){
/**********设置层级名称,只有在首次进入页面会展示,下钻均显示返回上一级*********/ /**********设置层级名称,只有在首次进入页面会展示,下钻均显示返回上一级*********/
Integer newChannel = this.storeSearchUtils.getChannel(qo.getUserId(), qo.getEnterpriseId(), qo.getSearchJson()); Integer newChannel = this.storeSearchUtils.getChannel(qo.getUserId(), qo.getEnterpriseId(), qo.getSearchJson());
qo.setChannel(newChannel); qo.setChannel(newChannel);
} }
/***********如果是线下的第一层级或者门店导购层级,需要展示切换层级按钮*************/ /***********如果是线下的第一层级或者门店导购层级,需要展示切换层级按钮*************/
boolean isFirstLevel = (StoreChannelEnum.OFFLINE.getChannel().equals(qo.getChannel()) && qo.getLevel().intValue() == levelVo.getLevel()) boolean isFirstLevel = (StoreChannelEnum.OFFLINE.getChannel().equals(qo.getChannel()) && qo.getLevel() == levelVo.getLevel())
|| (qo.getLevel() == 7 || qo.getLevel() == 8); || (qo.getLevel() == Constants.SEV || qo.getLevel() == Constants.EIGHT);
if(isFirstLevel){ if(isFirstLevel){
vo.setChangeLevel(1); vo.setChangeLevel(1);
} }
if(qo.getChannel() == null){ if(qo.getChannel() == StoreChannelEnum.ALL.getChannel()){
vo.setLevelName("所有渠道"); vo.setLevelName(StoreChannelEnum.ALL.getMessage());
} else if(StoreChannelEnum.OFFLINE.getChannel().equals(qo.getChannel())){ } else if(StoreChannelEnum.OFFLINE.getChannel().equals(qo.getChannel())){
vo.setLevelName(LevelUtil.getLevelName(qo.getLevel())); vo.setLevelName(LevelUtil.getLevelName(qo.getLevel()));
} else { } else {
...@@ -94,7 +95,7 @@ public class BaseSalesController { ...@@ -94,7 +95,7 @@ public class BaseSalesController {
dto.setCountType(2); dto.setCountType(2);
Integer wgs = storeSearchUtils.isWgs(qo.getUserId(), qo.getEnterpriseId(), qo.getSearchJson()); Integer wgs = storeSearchUtils.isWgs(qo.getUserId(), qo.getEnterpriseId(), qo.getSearchJson());
/**所有渠道或者线下渠道第一层级 合计算上无归属数据**/ /**所有渠道或者线下渠道第一层级 合计算上无归属数据**/
boolean isContainNoOwnership = (qo.getChannel() == null || (StoreChannelEnum.OFFLINE.getChannel().equals(qo.getChannel()) && qo.getLevel().intValue() == levelVo.getLevel())) && wgs == 1; boolean isContainNoOwnership = (qo.getChannel() == StoreChannelEnum.ALL.getChannel() || (StoreChannelEnum.OFFLINE.getChannel().equals(qo.getChannel()) && qo.getLevel() == levelVo.getLevel())) && wgs == 1;
if(isContainNoOwnership){ if(isContainNoOwnership){
dto.getStoreInfoIdList().add(-1); dto.getStoreInfoIdList().add(-1);
dto.getOnLine().add("-1"); dto.getOnLine().add("-1");
...@@ -102,10 +103,10 @@ public class BaseSalesController { ...@@ -102,10 +103,10 @@ public class BaseSalesController {
ServiceResponse<Page<BaseSalesDTO>> totalResponse = this.baseSalesApiService.pageBaseSales(dto); ServiceResponse<Page<BaseSalesDTO>> totalResponse = this.baseSalesApiService.pageBaseSales(dto);
log.info("totalResponse:{}", JSON.toJSONString(totalResponse)); log.info("totalResponse:{}", JSON.toJSONString(totalResponse));
this.goDownComponent.parseTotal(totalResponse, vo); this.goDownComponent.parseTotal(totalResponse, vo);
if(qo.getChannel() != null && qo.getChannel() == 1 && qo.getLevel().intValue() == levelVo.getLevel() && wgs == 1){ if(qo.getChannel() == StoreChannelEnum.OFFLINE.getChannel() && qo.getLevel() == levelVo.getLevel() && wgs == 1){
//无归属 //无归属
dto.setCountType(3); dto.setCountType(3);
dto.setChannel(null); dto.setChannel(StoreChannelEnum.ALL.getChannel());
dto.getStoreInfoIdList().clear(); dto.getStoreInfoIdList().clear();
dto.getOnLine().clear(); dto.getOnLine().clear();
dto.getStoreInfoIdList().add(-1); dto.getStoreInfoIdList().add(-1);
......
...@@ -5,6 +5,7 @@ import java.util.List; ...@@ -5,6 +5,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import com.gic.cloud.web.constant.Constants;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.LogManager;
...@@ -92,15 +93,15 @@ public class GoDownComponent { ...@@ -92,15 +93,15 @@ public class GoDownComponent {
params.setMemberCardIdList(dataAuthUtils.getMbrAreaId(params.getUserId(), params.getEnterpriseId())); params.setMemberCardIdList(dataAuthUtils.getMbrAreaId(params.getUserId(), params.getEnterpriseId()));
/******线下渠道需要点击下钻,该值只会在线下时才会使用********/ /******线下渠道需要点击下钻,该值只会在线下时才会使用********/
LevelVo levelVo = this.storeSearchUtils.getLevel(params.getUserId(), params.getEnterpriseId(), params.getSearchJson()); LevelVo levelVo = this.storeSearchUtils.getLevel(params.getUserId(), params.getEnterpriseId(), params.getSearchJson());
if(params.getLevel() == null){ if(params.getLevel() == StoreChannelEnum.ALL.getChannel()){
params.setLevel(levelVo.getLevel()); params.setLevel(levelVo.getLevel());
} }
if(params.getLevel().intValue() > levelVo.getMaxLevel().intValue()){ if(params.getLevel() > levelVo.getMaxLevel()){
if(params.getLevel().intValue()- levelVo.getMaxLevel().intValue() == 1){ if(params.getLevel()- levelVo.getMaxLevel() == 1){
params.setLevel(7); params.setLevel(7);
} }
} }
List<Integer> childrenStoreGroupIdList = this.storeSearchUtils.getChildrenStoreGroupIdList(params.getEnterpriseId(), params.getParentId(), params.getLevel()); List<Integer> childrenStoreGroupIdList = this.storeSearchUtils.getChildrenStoreGroupIdList(params.getEnterpriseId(), params.getParentId(), params.getLevel(), params.getChannel());
params.setGroupIdList(childrenStoreGroupIdList); params.setGroupIdList(childrenStoreGroupIdList);
/****首页进入基础页面时,如果渠道为空,根据当前条件判断渠道,channel==null表示多渠道***/ /****首页进入基础页面时,如果渠道为空,根据当前条件判断渠道,channel==null表示多渠道***/
if(params.getChannel() == null){ if(params.getChannel() == null){
...@@ -110,12 +111,12 @@ public class GoDownComponent { ...@@ -110,12 +111,12 @@ public class GoDownComponent {
} }
/***********如果是线下的第一层级,需要展示切换层级按钮*************/ /***********如果是线下的第一层级,需要展示切换层级按钮*************/
boolean isFirstLevel = StoreChannelEnum.OFFLINE.getChannel().equals(params.getChannel()) && params.getLevel().intValue() == levelVo.getLevel() boolean isFirstLevel = StoreChannelEnum.OFFLINE.getChannel().equals(params.getChannel()) && params.getLevel().intValue() == levelVo.getLevel()
|| (params.getLevel() == 7 || params.getLevel() == 8); || (params.getLevel() == Constants.SEV || params.getLevel() == Constants.EIGHT);
if(isFirstLevel){ if(isFirstLevel){
vo.setChangeLevel(1); vo.setChangeLevel(1);
} }
if(params.getChannel() == null){ if(params.getChannel() == StoreChannelEnum.ALL.getChannel()){
vo.setLevelName("所有渠道"); vo.setLevelName(StoreChannelEnum.ALL.getMessage());
} else if(StoreChannelEnum.OFFLINE.getChannel().equals(params.getChannel())){ } else if(StoreChannelEnum.OFFLINE.getChannel().equals(params.getChannel())){
vo.setLevelName(LevelUtil.getLevelName(params.getLevel())); vo.setLevelName(LevelUtil.getLevelName(params.getLevel()));
} else { } else {
...@@ -224,7 +225,7 @@ public class GoDownComponent { ...@@ -224,7 +225,7 @@ public class GoDownComponent {
int clerkLevel = 8; int clerkLevel = 8;
if(page != null && CollectionUtils.isNotEmpty(page.getResult())){ if(page != null && CollectionUtils.isNotEmpty(page.getResult())){
if(channel == null){ if(channel == Constants.ZERO){
//全渠道 //全渠道
allChannel(page, level); allChannel(page, level);
} }
...@@ -236,12 +237,13 @@ public class GoDownComponent { ...@@ -236,12 +237,13 @@ public class GoDownComponent {
if(CollectionUtils.isNotEmpty(wmStoreList)){ if(CollectionUtils.isNotEmpty(wmStoreList)){
page.getResult().stream().forEach(b -> { page.getResult().stream().forEach(b -> {
BaseDTO baseSalesDTO = (BaseDTO) b; BaseDTO baseSalesDTO = (BaseDTO) b;
baseSalesDTO.setLevel(level - 1); baseSalesDTO.setLevel(level);
for(WmStoreDTO dto : wmStoreList){ for(WmStoreDTO dto : wmStoreList){
if(baseSalesDTO instanceof BaseSalesDTO){ if(baseSalesDTO instanceof BaseSalesDTO){
if(baseSalesDTO.getId().equals(dto.getWmMallStoreId()+"")){ if(baseSalesDTO.getId().equals(dto.getWmMallStoreId()+"")){
baseSalesDTO.setName(dto.getWmMainAccount()); baseSalesDTO.setName(dto.getWmMainAccount());
baseSalesDTO.setChannel(channel); baseSalesDTO.setChannel(channel);
} }
}else { }else {
if(baseSalesDTO.getAreaId().equals(dto.getWmMallStoreId()+"")){ if(baseSalesDTO.getAreaId().equals(dto.getWmMallStoreId()+"")){
......
...@@ -14,6 +14,7 @@ import com.gic.cloud.web.auth.DataAuthUtils; ...@@ -14,6 +14,7 @@ import com.gic.cloud.web.auth.DataAuthUtils;
import com.gic.cloud.web.auth.OnLineAuth; import com.gic.cloud.web.auth.OnLineAuth;
import com.gic.cloud.web.auth.OnLineStore; import com.gic.cloud.web.auth.OnLineStore;
import com.gic.cloud.web.auth.StoreAuth; import com.gic.cloud.web.auth.StoreAuth;
import com.gic.cloud.web.constant.Constants;
import com.gic.cloud.web.constant.StoreChannelEnum; import com.gic.cloud.web.constant.StoreChannelEnum;
import com.gic.cloud.web.qo.StoreSearchQo; import com.gic.cloud.web.qo.StoreSearchQo;
import com.gic.cloud.web.vo.LevelVo; import com.gic.cloud.web.vo.LevelVo;
...@@ -24,6 +25,8 @@ import com.gic.store.dto.StoreSearchDTO; ...@@ -24,6 +25,8 @@ import com.gic.store.dto.StoreSearchDTO;
import com.gic.store.service.StoreApiService; import com.gic.store.service.StoreApiService;
import com.gic.store.service.StoreGroupApiService; import com.gic.store.service.StoreGroupApiService;
import com.gic.store.service.StoreWidgetApiService; import com.gic.store.service.StoreWidgetApiService;
import com.gic.weimob.api.dto.WeimobStoreGicInfoDTO;
import com.gic.weimob.api.service.WeimobStoreSiteApiService;
import com.google.inject.internal.cglib.core.$ClassEmitter; import com.google.inject.internal.cglib.core.$ClassEmitter;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
...@@ -52,8 +55,6 @@ public class StoreSearchUtils { ...@@ -52,8 +55,6 @@ public class StoreSearchUtils {
@Autowired @Autowired
private StoreAttentionApiService storeAttentionApiService; private StoreAttentionApiService storeAttentionApiService;
@Autowired @Autowired
private TempStoreConditionApiService tempStoreConditionApiService;
@Autowired
private StoreWidgetApiService storeWidgetApiService; private StoreWidgetApiService storeWidgetApiService;
@Autowired @Autowired
private StoreApiService storeApiService; private StoreApiService storeApiService;
...@@ -61,6 +62,8 @@ public class StoreSearchUtils { ...@@ -61,6 +62,8 @@ public class StoreSearchUtils {
private StoreGroupApiService storeGroupApiService; private StoreGroupApiService storeGroupApiService;
@Autowired @Autowired
private DataAuthApiService dataAuthApiService; private DataAuthApiService dataAuthApiService;
@Autowired
private WeimobStoreSiteApiService weimobStoreSiteApiService;
public Integer isWgs(Integer userId, Integer enterpriseId, String searchJson){ public Integer isWgs(Integer userId, Integer enterpriseId, String searchJson){
ServiceResponse<DataAuthDTO> response = this.dataAuthApiService.ggetDataAuthByUserId(enterpriseId, userId); ServiceResponse<DataAuthDTO> response = this.dataAuthApiService.ggetDataAuthByUserId(enterpriseId, userId);
...@@ -135,6 +138,9 @@ public class StoreSearchUtils { ...@@ -135,6 +138,9 @@ public class StoreSearchUtils {
} }
} }
} }
} else {
RedisUtil.setCache(key, 1, 10L, TimeUnit.MINUTES);
return storeAuth.getStoreInfoIdList();
} }
if(CollectionUtils.isNotEmpty(resultList)){ if(CollectionUtils.isNotEmpty(resultList)){
RedisUtil.setCache(key, 1, 10L, TimeUnit.MINUTES); RedisUtil.setCache(key, 1, 10L, TimeUnit.MINUTES);
...@@ -214,7 +220,7 @@ public class StoreSearchUtils { ...@@ -214,7 +220,7 @@ public class StoreSearchUtils {
int tm = RedisUtil.getCache(tmKey) == null ? 0 : 1; int tm = RedisUtil.getCache(tmKey) == null ? 0 : 1;
if((offline + gicMall + wm + tm) > 1){ if((offline + gicMall + wm + tm) > 1){
//多渠道 //多渠道
return null; return Constants.ZERO;
}else if((offline + gicMall + wm + tm) == 1){ }else if((offline + gicMall + wm + tm) == 1){
if(offline == 1){ if(offline == 1){
return offline; return offline;
...@@ -232,24 +238,32 @@ public class StoreSearchUtils { ...@@ -232,24 +238,32 @@ public class StoreSearchUtils {
return null; return null;
} }
public List<Integer> getChildrenStoreGroupIdList(Integer enterpriseId, Integer storeGroupId, Integer level){ public List<Integer> getChildrenStoreGroupIdList(Integer enterpriseId, Integer parentId, Integer level, Integer channel){
int storeGroupLevel = 7; if(channel == StoreChannelEnum.OFFLINE.getChannel()){
if(level < storeGroupLevel){ int storeGroupLevel = 7;
if(storeGroupId != null){ if(level < storeGroupLevel){
List<StoreGroupDTO> result = this.storeGroupApiService.listStoreGroupAndChildren(storeGroupId).getResult(); if(parentId != null){
if(CollectionUtils.isNotEmpty(result)){ List<StoreGroupDTO> result = this.storeGroupApiService.listStoreGroupAndChildren(parentId).getResult();
return result.stream().map(storeGroupDTO -> storeGroupDTO.getStoreGroupId()).collect(Collectors.toList()); if(CollectionUtils.isNotEmpty(result)){
return result.stream().map(storeGroupDTO -> storeGroupDTO.getStoreGroupId()).collect(Collectors.toList());
}
}
}else {
StoreSearchDTO storeSearchDTO = new StoreSearchDTO();
storeSearchDTO.setEnterpriseId(enterpriseId);
storeSearchDTO.setStoreGroupId(parentId);
ServiceResponse<Page<StoreDTO>> response = this.storeApiService.listStore(storeSearchDTO, 1, 10000);
if(response.isSuccess() && response.getResult() != null){
return response.getResult().getResult().stream().map(storeDTO -> storeDTO.getStoreInfoId()).collect(Collectors.toList());
} }
}
}else {
StoreSearchDTO storeSearchDTO = new StoreSearchDTO();
storeSearchDTO.setEnterpriseId(enterpriseId);
storeSearchDTO.setStoreGroupId(storeGroupId);
ServiceResponse<Page<StoreDTO>> response = this.storeApiService.listStore(storeSearchDTO, 1, 10000);
if(response.isSuccess() && response.getResult() != null){
return response.getResult().getResult().stream().map(storeDTO -> storeDTO.getStoreInfoId()).collect(Collectors.toList());
} }
} }
if(channel == StoreChannelEnum.WMMALL.getChannel()){
List<WeimobStoreGicInfoDTO> list = weimobStoreSiteApiService.listStoreId(parentId).getResult();
List<Integer> storeInfoIdList = list.stream().map(s -> s.getStoreInfoId()).collect(Collectors.toList());
return storeInfoIdList;
}
return new ArrayList<>(); return new ArrayList<>();
} }
...@@ -279,5 +293,4 @@ public class StoreSearchUtils { ...@@ -279,5 +293,4 @@ public class StoreSearchUtils {
} }
} }
} }
} }
...@@ -7,14 +7,14 @@ package com.gic.cloud.web.qo; ...@@ -7,14 +7,14 @@ package com.gic.cloud.web.qo;
* @date 2020/9/7 1:37 PM
 * @date 2020/9/7 1:37 PM

*/ */
public class BaseSalesParamQo { public class BaseSalesParamQo {
private Integer channel; private Integer channel = 0;
private Integer userId; private Integer userId;
private Integer enterpriseId; private Integer enterpriseId;
private String searchJson; private String searchJson;
private Integer type; private Integer type;
private String date; private String date;
private String mbrAreaId; private String mbrAreaId;
private Integer level; private Integer level = 0;
private Integer parentId; private Integer parentId;
private String sortField; private String sortField;
private Integer sortType; private Integer sortType;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment