Commit 279859f6 by 陶光胜

Merge branch 'developer' into 'master'

观云台小程序

See merge request !19
parents e8cf3030 0db06a43
......@@ -7,6 +7,7 @@ import com.gic.cloud.web.constant.StoreChannelEnum;
import com.gic.cloud.web.utils.LevelUtil;
import com.gic.cloud.web.vo.BaseSalesVo;
import com.gic.cloud.web.vo.LevelVo;
import com.gic.commons.util.CollectionUtil;
import com.gic.data.api.dto.BaseDTO;
import com.gic.data.api.dto.BaseSalesDTO;
import com.gic.data.api.qo.common.CommonQO;
......@@ -15,11 +16,17 @@ import com.gic.enterprise.service.WmStoreApiService;
import com.gic.mall.share.api.dto.shop.ShopDTO;
import com.gic.mall.share.api.enums.ShopTypeEnum;
import com.gic.mall.share.api.service.ShopApiService;
import com.gic.store.dto.ClerkDTO;
import com.gic.store.service.ClerkApiService;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Component
public class GoDownComponent {
......@@ -31,6 +38,8 @@ public class GoDownComponent {
private StoreSearchUtils storeSearchUtils;
@Autowired
private DataAuthUtils dataAuthUtils;
@Autowired
private ClerkApiService clerkApiService;
public void parseTotal(ServiceResponse<?> response, BaseSalesVo vo){
if(response.isSuccess() && response.getResult() != null){
......@@ -172,11 +181,28 @@ public class GoDownComponent {
}
}
if(channel == StoreChannelEnum.OFFLINE.getChannel()){
List<ClerkDTO> clerkDTOS = new ArrayList<>();
if(level.intValue() == 8){
List<String> clerkIdList = page.getResult().stream().map(b -> {
BaseDTO baseSalesDTO = (BaseDTO) b;
return baseSalesDTO.getAreaId() == null ? baseSalesDTO.getId() : baseSalesDTO.getAreaId();
}).collect(Collectors.toList());
clerkDTOS = this.clerkApiService.listClerkByIds(enterpriseId, StringUtils.join(clerkIdList, ",")).getResult();
}
final Map<Integer, ClerkDTO> clerkDTOMap = CollectionUtil.toMap(clerkDTOS, "clerkId");
page.getResult().stream().forEach(b -> {
BaseDTO baseSalesDTO = (BaseDTO) b;
baseSalesDTO.setLevel(level);
baseSalesDTO.setChannel(StoreChannelEnum.OFFLINE.getChannel());
baseSalesDTO.setHasChildren(level <= maxLevel ? 1 : 0);
if(clerkDTOMap != null && level.intValue() == 8){
ClerkDTO clerkDTO = clerkDTOMap.get(baseSalesDTO.getAreaId() == null ? baseSalesDTO.getId() : baseSalesDTO.getAreaId());
if(clerkDTO != null){
baseSalesDTO.setName(clerkDTO.getClerkName());
}else{
baseSalesDTO.setName("未知");
}
}
});
}
}
......
......@@ -5,6 +5,8 @@ import com.alibaba.fastjson.JSON;
import com.gic.api.base.commons.Page;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.cloud.dto.AttentionStoreDTO;
import com.gic.cloud.dto.DataAuthDTO;
import com.gic.cloud.service.DataAuthApiService;
import com.gic.cloud.service.StoreAttentionApiService;
import com.gic.cloud.web.auth.DataAuthUtils;
import com.gic.cloud.web.auth.OnLineAuth;
......@@ -56,6 +58,8 @@ public class StoreWidgetController {
private StoreAttentionApiService storeAttentionApiService;
@Autowired
private StoreSearchUtils storeSearchUtils;
@Autowired
private DataAuthApiService dataAuthApiService;
@RequestMapping("store-widget-index")
public RestResponse storeWidgetIndex(Integer userId, Integer enterpriseId){
......@@ -96,6 +100,10 @@ public class StoreWidgetController {
if(CollectionUtils.isNotEmpty(result.getResult())){
vo.setAttentionCount(result.getTotalCount());
}
DataAuthDTO dataAuthDTO = this.dataAuthApiService.ggetDataAuthByUserId(enterpriseId, userId).getResult();
if(dataAuthDTO != null){
vo.setHasWgs(dataAuthDTO.getNoOwnerStore() == null ? 0 : dataAuthDTO.getNoOwnerStore());
}
return RestResponse.success(vo);
}
......
......@@ -8,6 +8,7 @@ public class StoreWidgetIndexVo {
private List<IndexItemVo> items;
private Integer attentionCount = 0;
private Integer singleRegion = 0;
private Integer hasWgs = 0;
public Integer getType() {
return type;
......@@ -40,4 +41,12 @@ public class StoreWidgetIndexVo {
public void setSingleRegion(Integer singleRegion) {
this.singleRegion = singleRegion;
}
public Integer getHasWgs() {
return hasWgs;
}
public void setHasWgs(Integer hasWgs) {
this.hasWgs = hasWgs;
}
}
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