Commit 2400ef70 by guojuxing

Merge remote-tracking branch 'origin/developer' into developer

parents 2318b7f7 ac0ce295
......@@ -147,6 +147,7 @@ public class DataAuthUtils {
MbrVo vo = new MbrVo();
vo.setMbrAreaId(dto.getAreaId().toString());
vo.setMbrAreaName(dto.getName());
vo.setOwnType(dto.getOwnerFlag());
return vo;
}).collect(Collectors.toList());
}
......
......@@ -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);
......@@ -111,6 +103,7 @@ public class StoreSearchUtils {
storeSearchDTO.setStoreStatuss(StringUtils.isBlank(storeSearchQo.getStoreStatus()) ? null :storeSearchQo.getStoreStatus().replaceAll(",", " "));
storeSearchDTO.setRealStatuss(StringUtils.isBlank(storeSearchQo.getErpStatus()) ? null :storeSearchQo.getErpStatus().replaceAll(",", " "));
storeSearchDTO.setStoreTags(StringUtils.isBlank(storeSearchQo.getStoreTag()) ? null :storeSearchQo.getStoreTag().replaceAll(",", " "));
storeSearchDTO.setStoreBrandIds(StringUtils.isBlank(storeSearchQo.getStoreBrand()) ? null :storeSearchQo.getStoreBrand().replaceAll(",", " "));
if(storeSearchQo.getAttentionStore() == 1){
List<AttentionStoreDTO> result = this.storeAttentionApiService.pageStoreAttention(userId, enterpriseId, 1, Integer.MAX_VALUE).getResult().getResult();
List<Integer> list = result.stream().filter(t -> {
......@@ -123,11 +116,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())){
......@@ -142,11 +130,11 @@ public class StoreSearchUtils {
}
return false;
}).collect(Collectors.toList());
} else {
resultList = storeInfoIdList;
}
}
}
} else {
resultList = storeSearchJsonWhenNull(storeAuth, tempStoreIdListf);
}
if(CollectionUtils.isNotEmpty(resultList)){
RedisUtil.setCache(key, 1, 10L, TimeUnit.MINUTES);
......@@ -157,23 +145,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));
......
......@@ -18,6 +18,8 @@ import com.gic.cloud.web.constant.StoreChannelEnum;
import com.gic.cloud.web.vo.*;
import com.gic.commons.webapi.reponse.RestResponse;
import com.gic.enterprise.dto.WmStoreDTO;
import com.gic.enterprise.dto.union.UnionEnterpriseAuthDTO;
import com.gic.enterprise.service.UnionEnterpriseAuthApiService;
import com.gic.enterprise.service.WmStoreApiService;
import com.gic.mall.share.api.dto.shop.ShopDTO;
import com.gic.mall.share.api.enums.ShopTypeEnum;
......@@ -70,6 +72,8 @@ public class StoreWidgetController {
private MenuApiService menuApiService;
@Autowired
private StoreBrandApiService storeBrandApiService;
@Autowired
private UnionEnterpriseAuthApiService unionEnterpriseAuthApiService;
@RequestMapping("store-widget-index")
public RestResponse storeWidgetIndex(Integer userId, Integer enterpriseId){
......@@ -90,7 +94,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 +109,7 @@ public class StoreWidgetController {
items.add(indexItemVo);
}
}
} else { //线上多渠道
} else if(onlineStoreAuth.isHasAuth() && onlineStoreAuth.getList().size() > 1){ //线上多渠道
vo.setType(1);
this.getOnlineItems(onlineStoreAuth, items);
}
......@@ -122,6 +126,8 @@ public class StoreWidgetController {
}
}
}
List<UnionEnterpriseAuthDTO> ownEnterpriseList = this.unionEnterpriseAuthApiService.listOwnEnterpriseAuth(enterpriseId).getResult();
vo.setResourceType(CollectionUtils.isNotEmpty(ownEnterpriseList) ? 1 : 0);
return RestResponse.success(vo);
}
......@@ -157,7 +163,9 @@ public class StoreWidgetController {
StoreSearchDTO storeSearchDTO = new StoreSearchDTO();
storeSearchDTO.setEnterpriseId(enterpriseId);
storeSearchDTO.setStoreGroupId(parentId);
if(storeAuth.getStoreWidgetId() != null){
storeSearchDTO.setStoreResource(Long.valueOf(storeAuth.getStoreWidgetId()));
}
ServiceResponse<Page<StoreDTO>> response = this.storeApiService.listStore(storeSearchDTO, pageNum, pageSize);
Map<Integer, AttentionStoreDTO> result = this.storeAttentionApiService.getAllAttenttionStore(userId, enterpriseId).getResult();
if(CollectionUtils.isNotEmpty(response.getResult().getResult())){
......@@ -169,6 +177,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 +270,7 @@ public class StoreWidgetController {
StoreTypeVo storeTypeVo = new StoreTypeVo();
storeTypeVo.setId(storeBrandDTO.getStoreBrandId()+"");
storeTypeVo.setName(storeBrandDTO.getStoreBrandName());
storeTypeVo.setOwnType(storeBrandDTO.getType());
list.add(storeTypeVo);
});
}
......@@ -294,12 +304,14 @@ public class StoreWidgetController {
int typeOfStoreGroup = 1;
//线下门店
int typeOfOfflineStore = 2;
//线上店铺
int typeOfShop = 3;
List<StoreSearchVo> storeSearchVoList = new ArrayList<>();
if(type == typeOfStoreGroup){
Page<StoreGroupDTO> result = this.storeGroupApiService.pageStoreGroupByIds(null, enterpriseId, null, search, pageSize, pageNum).getResult();
page.setTotalPage(result.getTotalPage());
page.setTotalCount(result.getTotalCount());
if(CollectionUtils.isNotEmpty(result.getResult())){
List<StoreSearchVo> storeSearchVoList = new ArrayList<>();
for(StoreGroupDTO storeGroupDTO : result.getResult()){
StoreSearchVo searchVo = new StoreSearchVo();
searchVo.setId(storeGroupDTO.getStoreGroupId()+"");
......@@ -308,7 +320,6 @@ public class StoreWidgetController {
searchVo.setNameChain(map.get(storeGroupDTO.getStoreGroupId()).getNameChain());
storeSearchVoList.add(searchVo);
}
page.setResult(storeSearchVoList);
}
}else if(type == typeOfOfflineStore){
StoreAuth storeAuth = this.dataAuthUtils.getStoreAuth(userId, enterpriseId);
......@@ -322,7 +333,6 @@ public class StoreWidgetController {
page.setTotalCount(result.getTotalCount());
page.setTotalPage(result.getTotalPage());
if(CollectionUtils.isNotEmpty(result.getResult())){
List<StoreSearchVo> storeSearchVoList = new ArrayList<>();
for(StoreDTO storeDTO : result.getResult()){
StoreSearchVo searchVo = new StoreSearchVo();
searchVo.setId(storeDTO.getStoreInfoId()+"");
......@@ -330,25 +340,40 @@ 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);
}
}
}else{
}else if(typeOfShop == type){
//线上店铺
onlineStore(page, userId, enterpriseId, search);
} else {
List<StoreTagDTO> storeTagDTOList = this.storeTagApiService.listByEnterprise(enterpriseId, search).getResult();
if(CollectionUtils.isNotEmpty(storeTagDTOList)){
for(StoreTagDTO dto : storeTagDTOList){
StoreSearchVo storeSearchVo = new StoreSearchVo();
storeSearchVo.setId(dto.getStoreTagId().toString());
storeSearchVo.setName(dto.getStoreTagName());
storeSearchVo.setDesc(StoreChannelEnum.OFFLINE.getMessage());
storeSearchVo.setIdChain("_" + StoreChannelEnum.OFFLINE.getChannel() + "_" + dto.getStoreTagId() +"_");
storeSearchVo.setNameChain(StoreChannelEnum.OFFLINE.getMessage() + "/" + dto.getStoreTagName());
storeSearchVo.setChannel(StoreChannelEnum.OFFLINE.getChannel());
storeSearchVoList.add(storeSearchVo);
}
}
}
page.setResult(storeSearchVoList);
return RestResponse.success(page);
}
private void onlineStore(Page<StoreSearchVo> page, Integer userId, Integer enterpriseId, String search) {
OnLineAuth onlineStore = this.dataAuthUtils.getOnlineStore(userId, enterpriseId);
if(onlineStore.isHasAuth()){
OnLineAuth onlineStoreAuth = this.dataAuthUtils.getOnlineStore(userId, enterpriseId);
if(!onlineStoreAuth.isHasAuth()){
return;
}
List<StoreSearchVo> list = new ArrayList<>();
List<OnLineStore> onlineStoreList = onlineStore.getList();
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();
......@@ -368,7 +393,7 @@ public class StoreWidgetController {
}
}
if(StoreChannelEnum.WMMALL.getChannel().equals(onLineStore.getChannel())){
List<WmStoreDTO> wmStoreList = wmStoreApiService.listWmStore(enterpriseId, search).getResult();
List<WmStoreDTO> wmStoreList = wmStoreApiService.listWmStore(onLineStore.getStoreIdList(),search).getResult();
if(CollectionUtils.isNotEmpty(wmStoreList)){
for(WmStoreDTO wmStoreDTO : wmStoreList){
if(onLineStore.getStoreIdList().contains(wmStoreDTO.getWmStoreId())){
......@@ -376,9 +401,10 @@ public class StoreWidgetController {
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());
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);
}
}
......@@ -389,7 +415,6 @@ public class StoreWidgetController {
page.setTotalCount(list.size());
page.setTotalPage(1);
}
}
@RequestMapping("get-store-count")
public RestResponse getStoreCount(String searchJson, Integer userId, Integer enterpriseId){
......@@ -449,7 +474,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 +483,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);
}
}
......
......@@ -28,6 +28,10 @@ public class StoreSearchQo {
*/
private Integer hasWgs = 0;
private String storeBrand;
private String resourceType;
public Integer getAll() {
return all;
}
......@@ -115,4 +119,20 @@ public class StoreSearchQo {
public void setHasWgs(Integer hasWgs) {
this.hasWgs = hasWgs;
}
public String getStoreBrand() {
return storeBrand;
}
public void setStoreBrand(String storeBrand) {
this.storeBrand = storeBrand;
}
public String getResourceType() {
return resourceType;
}
public void setResourceType(String resourceType) {
this.resourceType = resourceType;
}
}
......@@ -9,6 +9,7 @@ package com.gic.cloud.web.vo;
public class MbrVo {
private String mbrAreaId;
private String mbrAreaName;
private Integer ownType;
public String getMbrAreaId() {
return mbrAreaId;
......@@ -25,4 +26,12 @@ public class MbrVo {
public void setMbrAreaName(String mbrAreaName) {
this.mbrAreaName = mbrAreaName;
}
public Integer getOwnType() {
return ownType;
}
public void setOwnType(Integer ownType) {
this.ownType = ownType;
}
}
......@@ -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;
}
}
......@@ -15,6 +15,10 @@ public class StoreWidgetIndexVo {
private Integer attentionCount = 0;
private Integer singleRegion = 0;
private Integer hasWgs = 0;
/**
* 是否显示资源类型 1是 0否
*/
private Integer resourceType=0;
public Integer getType() {
return type;
......@@ -55,4 +59,12 @@ public class StoreWidgetIndexVo {
public void setHasWgs(Integer hasWgs) {
this.hasWgs = hasWgs;
}
public Integer getResourceType() {
return resourceType;
}
public void setResourceType(Integer resourceType) {
this.resourceType = resourceType;
}
}
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