Commit 240a5afb by 陶光胜

门店控件修复

parent 8267f210
......@@ -62,8 +62,8 @@ public class IndexController {
@RequestMapping("index-mbr")
public RestResponse indexMbr(Integer enterpriseId, Integer userId){
//List<MbrVo> mbrArea = this.dataAuthUtils.getMbrArea(userId, enterpriseId);
return RestResponse.success();
List<MbrVo> mbrArea = this.dataAuthUtils.getMbrArea(userId, enterpriseId);
return RestResponse.success(mbrArea);
}
@RequestMapping("index-sales")
......@@ -91,10 +91,10 @@ public class IndexController {
list.add(-1);
onLine.add("-1");
}
//List<Long> mbrAreaIdList = this.dataAuthUtils.getMbrAreaId(userId, enterpriseId);
List<Long> mbrAreaIdList = this.dataAuthUtils.getMbrAreaId(userId, enterpriseId);
ServiceResponse<IndexMemberDTO> indexMember = this.indexSalesApiService.getIndexMember(enterpriseId, list, onLine,
StringUtils.isNoneBlank(mbrAreaId) ? Long.valueOf(mbrAreaId) : null,
null, dateTypeQo.getType(), dateTypeQo.getDate());
mbrAreaIdList, dateTypeQo.getType(), dateTypeQo.getDate());
return RestResponse.success(indexMember.getResult());
}
......
......@@ -88,14 +88,6 @@ public class StoreSearchUtils {
return list;
}
List<Integer> resultList = new ArrayList<>();
TempStoreConditionDTO tempStoreConditionDTO = this.tempStoreConditionApiService.getTempStoreCondition(enterpriseId).getResult();
List<Integer> tempStoreIdList = new ArrayList<>();
if(tempStoreConditionDTO != null) {
Integer tempStoreId = tempStoreConditionDTO.getStoreWidgetId();
tempStoreIdList = this.storeWidgetApiService.listStoreInfoIdByStoreWidgetId(enterpriseId, tempStoreId).getResult();
}
final List<Integer> tempStoreIdListf = tempStoreIdList;
log.info("tempStoreIdList:{}", JSON.toJSONString(tempStoreIdListf));
if(StringUtils.isNotBlank(searchJson)){
JSONObject json = JSON.parseObject(searchJson);
StoreSearchQo storeSearchQo = json.getObject(StoreChannelEnum.OFFLINE.getChannel().toString(), StoreSearchQo.class);
......@@ -123,11 +115,6 @@ public class StoreSearchUtils {
String storeInfoIds = StringUtils.join(list, " ");
storeSearchDTO.setStoreInfoIds(StringUtils.isNotBlank(storeSearchDTO.getStoreInfoIds()) ? storeSearchDTO.getStoreInfoIds()+" "+ storeInfoIds : storeInfoIds);
}
if(storeSearchQo.getTmpStore() == 0){
if(CollectionUtils.isNotEmpty(tempStoreIdList)){
storeSearchDTO.setStoreInfoIdsOfNot(StringUtils.join(tempStoreIdList, " "));
}
}
ServiceResponse<Page<StoreDTO>> pageServiceResponse = this.storeApiService.listStore(storeSearchDTO, 1, 20000);
log.info("storeResule:{}", JSON.toJSONString(pageServiceResponse));
if(pageServiceResponse.isSuccess() && pageServiceResponse.getResult() != null && CollectionUtils.isNotEmpty(pageServiceResponse.getResult().getResult())){
......@@ -145,8 +132,6 @@ public class StoreSearchUtils {
}
}
}
} else {
resultList = storeSearchJsonWhenNull(storeAuth, tempStoreIdListf);
}
if(CollectionUtils.isNotEmpty(resultList)){
RedisUtil.setCache(key, 1, 10L, TimeUnit.MINUTES);
......@@ -157,23 +142,6 @@ public class StoreSearchUtils {
return resultList;
}
private List<Integer> storeSearchJsonWhenNull(StoreAuth storeAuth, final List<Integer> tempStoreIdListf) {
if(CollectionUtils.isNotEmpty(storeAuth.getStoreInfoIdList())){
return storeAuth.getStoreInfoIdList().stream().filter(s -> {
if(CollectionUtils.isNotEmpty(tempStoreIdListf)){
if(tempStoreIdListf.contains(s)){
return false;
}else {
return true;
}
} else {
return true;
}
}).collect(Collectors.toList());
}
return new ArrayList<>();
}
public List<String> onLineStoreSearch(Integer userId, Integer enterpriseId, String searchJson){
OnLineAuth onlineStoreAuth = this.dataAuthUtils.getOnlineStore(userId, enterpriseId);
log.info("onlineStoreAuth:{}", JSON.toJSONString(onlineStoreAuth));
......
......@@ -90,7 +90,7 @@ public class StoreWidgetController {
} else if(storeAuth.isHasAuth() && !onlineStoreAuth.isHasAuth()){
//线下单渠道
vo.setType(2);
} else if(onlineStoreAuth.getList().size() == 1){
} else if(onlineStoreAuth.isHasAuth() && onlineStoreAuth.getList().size() == 1){
//线上单渠道
vo.setType(3);
List<OnLineStore> list = onlineStoreAuth.getList();
......@@ -105,7 +105,7 @@ public class StoreWidgetController {
items.add(indexItemVo);
}
}
} else { //线上多渠道
} else if(onlineStoreAuth.isHasAuth() && onlineStoreAuth.getList().size() > 1){ //线上多渠道
vo.setType(1);
this.getOnlineItems(onlineStoreAuth, items);
}
......@@ -169,6 +169,7 @@ public class StoreWidgetController {
itemsVo.setIdChain(map.get(dto.getStoreGroupId()).getIdChain() + dto.getStoreInfoId() + "_");
itemsVo.setNameChain(map.get(dto.getStoreGroupId()).getNameChain() + dto.getStoreName() + "/");
itemsVo.setHasAttention(result.get(dto.getStoreInfoId()) == null ? 0 : 1);
itemsVo.setOwnType(dto.getOwnType() == 1 ? 2 : 1);
items.add(itemsVo);
}
groupVoPage.setTotalCount(response.getResult().getTotalCount());
......@@ -261,6 +262,7 @@ public class StoreWidgetController {
StoreTypeVo storeTypeVo = new StoreTypeVo();
storeTypeVo.setId(storeBrandDTO.getStoreBrandId()+"");
storeTypeVo.setName(storeBrandDTO.getStoreBrandName());
storeTypeVo.setOwnType(storeBrandDTO.getType());
list.add(storeTypeVo);
});
}
......@@ -330,6 +332,7 @@ public class StoreWidgetController {
searchVo.setIdChain((map.get(storeDTO.getStoreGroupId()) != null ? map.get(storeDTO.getStoreGroupId()).getIdChain() : "") + storeDTO.getStoreInfoId()+"_");
searchVo.setNameChain((map.get(storeDTO.getStoreGroupId())!= null ? map.get(storeDTO.getStoreGroupId()).getNameChain() : "") + storeDTO.getStoreName() + "/");
searchVo.setHasAttention(attentionStoreDtoMap.get(storeDTO.getStoreInfoId()) == null ? 0 : 1);
searchVo.setOwnType(storeDTO.getOwnType() == 1 ? 2 : 1);
storeSearchVoList.add(searchVo);
}
page.setResult(storeSearchVoList);
......@@ -344,51 +347,52 @@ public class StoreWidgetController {
}
private void onlineStore(Page<StoreSearchVo> page, Integer userId, Integer enterpriseId, String search) {
OnLineAuth onlineStore = this.dataAuthUtils.getOnlineStore(userId, enterpriseId);
if(onlineStore.isHasAuth()){
List<StoreSearchVo> list = new ArrayList<>();
List<OnLineStore> onlineStoreList = onlineStore.getList();
for(OnLineStore onLineStore : onlineStoreList){
if(StoreChannelEnum.GICMALL.getChannel().equals(onLineStore.getChannel())){
List<ShopDTO> result = shopApiService.getAllShopByEnterpriseIdAndName(enterpriseId, search, ShopTypeEnum.MALL_SHOP.getCode()).getResult();
if(CollectionUtils.isNotEmpty(result)){
for(ShopDTO dto : result){
if(onLineStore.getStoreIdList().contains(dto.getId().toString())){
StoreSearchVo storeSearchVo = new StoreSearchVo();
storeSearchVo.setId(dto.getId().toString());
storeSearchVo.setName(dto.getName());
storeSearchVo.setDesc(StoreChannelEnum.GICMALL.getMessage());
storeSearchVo.setIdChain("_" + StoreChannelEnum.GICMALL.getChannel() + "_" + dto.getId() +"_");
storeSearchVo.setNameChain(StoreChannelEnum.GICMALL.getMessage() + "/" + dto.getName());
storeSearchVo.setChannel(StoreChannelEnum.GICMALL.getChannel());
list.add(storeSearchVo);
}
OnLineAuth onlineStoreAuth = this.dataAuthUtils.getOnlineStore(userId, enterpriseId);
if(!onlineStoreAuth.isHasAuth()){
return;
}
List<StoreSearchVo> list = new ArrayList<>();
List<OnLineStore> onlineStoreList = onlineStoreAuth.getList();
for(OnLineStore onLineStore : onlineStoreList){
if(StoreChannelEnum.GICMALL.getChannel().equals(onLineStore.getChannel())){
List<ShopDTO> result = shopApiService.getAllShopByEnterpriseIdAndName(enterpriseId, search, ShopTypeEnum.MALL_SHOP.getCode()).getResult();
if(CollectionUtils.isNotEmpty(result)){
for(ShopDTO dto : result){
if(onLineStore.getStoreIdList().contains(dto.getId().toString())){
StoreSearchVo storeSearchVo = new StoreSearchVo();
storeSearchVo.setId(dto.getId().toString());
storeSearchVo.setName(dto.getName());
storeSearchVo.setDesc(StoreChannelEnum.GICMALL.getMessage());
storeSearchVo.setIdChain("_" + StoreChannelEnum.GICMALL.getChannel() + "_" + dto.getId() +"_");
storeSearchVo.setNameChain(StoreChannelEnum.GICMALL.getMessage() + "/" + dto.getName());
storeSearchVo.setChannel(StoreChannelEnum.GICMALL.getChannel());
list.add(storeSearchVo);
}
}
}
if(StoreChannelEnum.WMMALL.getChannel().equals(onLineStore.getChannel())){
List<WmStoreDTO> wmStoreList = wmStoreApiService.listWmStore(enterpriseId, search).getResult();
if(CollectionUtils.isNotEmpty(wmStoreList)){
for(WmStoreDTO wmStoreDTO : wmStoreList){
if(onLineStore.getStoreIdList().contains(wmStoreDTO.getWmStoreId())){
StoreSearchVo storeSearchVo = new StoreSearchVo();
storeSearchVo.setId(wmStoreDTO.getWmStoreId());
storeSearchVo.setName(wmStoreDTO.getWmMainAccount());
storeSearchVo.setDesc(StoreChannelEnum.WMMALL.getMessage());
storeSearchVo.setIdChain("_" + StoreChannelEnum.GICMALL.getChannel() + "_" + wmStoreDTO.getWmStoreId() +"_");
storeSearchVo.setNameChain(StoreChannelEnum.GICMALL.getMessage() + "/" + wmStoreDTO.getWmMainAccount());
storeSearchVo.setChannel(StoreChannelEnum.GICMALL.getChannel());
list.add(storeSearchVo);
}
}
if(StoreChannelEnum.WMMALL.getChannel().equals(onLineStore.getChannel())){
List<WmStoreDTO> wmStoreList = wmStoreApiService.listWmStore(onLineStore.getStoreIdList(),search).getResult();
if(CollectionUtils.isNotEmpty(wmStoreList)){
for(WmStoreDTO wmStoreDTO : wmStoreList){
if(onLineStore.getStoreIdList().contains(wmStoreDTO.getWmStoreId())){
StoreSearchVo storeSearchVo = new StoreSearchVo();
storeSearchVo.setId(wmStoreDTO.getWmStoreId());
storeSearchVo.setName(wmStoreDTO.getWmMainAccount());
storeSearchVo.setDesc(StoreChannelEnum.WMMALL.getMessage());
storeSearchVo.setIdChain("_" + StoreChannelEnum.WMMALL.getChannel() + "_" + wmStoreDTO.getWmStoreId() +"_");
storeSearchVo.setNameChain(StoreChannelEnum.WMMALL.getMessage() + "/" + wmStoreDTO.getWmMainAccount());
storeSearchVo.setChannel(StoreChannelEnum.WMMALL.getChannel());
storeSearchVo.setOwnType(wmStoreDTO.getEnterpriseId().equals(enterpriseId) ? 1 : 2);
list.add(storeSearchVo);
}
}
}
}
page.setResult(list);
page.setTotalCount(list.size());
page.setTotalPage(1);
}
page.setResult(list);
page.setTotalCount(list.size());
page.setTotalPage(1);
}
@RequestMapping("get-store-count")
......@@ -449,7 +453,7 @@ public class StoreWidgetController {
}
}
}else if(StoreChannelEnum.WMMALL.getChannel().equals(type)){
List<WmStoreDTO> result = wmStoreApiService.listWmStore(enterpriseId).getResult();
List<WmStoreDTO> result = wmStoreApiService.listWmStore(storeIdList, null).getResult();
if(CollectionUtils.isNotEmpty(result)){
for(WmStoreDTO wmStoreDTO : result){
if(storeIdList.contains(wmStoreDTO.getWmMallStoreId().toString())){
......@@ -458,6 +462,7 @@ public class StoreWidgetController {
onLineStoreVo.setName(wmStoreDTO.getWmPidName());
onLineStoreVo.setIdChain("_" + type + "_" + wmStoreDTO.getWmStoreId()+"_");
onLineStoreVo.setNameChain(StoreChannelEnum.WMMALL.getMessage() + "/" + wmStoreDTO.getWmPidName());
onLineStoreVo.setOwnType(enterpriseId == wmStoreDTO.getEnterpriseId() ? 1: 2);
list.add(onLineStoreVo);
}
}
......
......@@ -12,6 +12,7 @@ public class OnLineStoreVo {
private String idChain;
private String nameChain;
private Integer hasChildren = 0;
private Integer ownType;
public Integer getHasChildren() {
......@@ -53,4 +54,12 @@ public class OnLineStoreVo {
public void setNameChain(String nameChain) {
this.nameChain = nameChain;
}
public Integer getOwnType() {
return ownType;
}
public void setOwnType(Integer ownType) {
this.ownType = ownType;
}
}
......@@ -14,6 +14,10 @@ public class StoreGroupItemsVo {
private Integer isStore = 0;
private Integer hasChildren = 0;
private Integer hasAttention = 0;
/**
* 1自有 2共享
*/
private Integer ownType;
public Integer getId() {
return id;
......@@ -70,4 +74,12 @@ public class StoreGroupItemsVo {
public void setHasAttention(Integer hasAttention) {
this.hasAttention = hasAttention;
}
public Integer getOwnType() {
return ownType;
}
public void setOwnType(Integer ownType) {
this.ownType = ownType;
}
}
......@@ -15,6 +15,10 @@ public class StoreSearchVo {
private Integer channel;
private Integer hasAttention = 0;
private Integer hasChildren = 0;
/**
* 1自有 2共享
*/
private Integer ownType;
public String getId() {
return id;
......@@ -79,4 +83,12 @@ public class StoreSearchVo {
public void setHasChildren(Integer hasChildren) {
this.hasChildren = hasChildren;
}
public Integer getOwnType() {
return ownType;
}
public void setOwnType(Integer ownType) {
this.ownType = ownType;
}
}
......@@ -9,6 +9,10 @@ package com.gic.cloud.web.vo;
public class StoreTypeVo {
private String id;
private String name;
/**
* 1自有 2共享
*/
private Integer ownType;
public String getId() {
return id;
......@@ -25,4 +29,12 @@ public class StoreTypeVo {
public void setName(String name) {
this.name = name;
}
public Integer getOwnType() {
return ownType;
}
public void setOwnType(Integer ownType) {
this.ownType = ownType;
}
}
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