Commit f2913d82 by guojuxing

门店域接口返回调整

parent 8f587d16
......@@ -3,7 +3,11 @@ package com.gic.plug.web.controller;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
import com.gic.api.base.commons.Page;
import com.gic.plug.web.vo.widget.StoreWidgetInterfaceVO;
import com.gic.store.dto.StoreDTO;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -71,17 +75,18 @@ public class StoreController {
ServiceResponse<List<StoreRegionDTO>> serviceResponse = storeRegionApiService.listStoreRegion(enterpriseId, search);
if (serviceResponse.isSuccess()) {
List<StoreRegionDTO> result = serviceResponse.getResult();
List<StoreRegionVO> regionList = new ArrayList<>();
List<StoreWidgetInterfaceVO> voList = new ArrayList<>();
for(StoreRegionDTO storeRegionDTO : result){
if(!authRegionSet.isEmpty()){
if (!authRegionSet.isEmpty()) {
if(authRegionSet.contains(storeRegionDTO.getRegionId()+"")){
regionList.add(EntityUtil.changeEntityByJSON(StoreRegionVO.class, storeRegionDTO));
voList.add(new StoreWidgetInterfaceVO().setLabel(storeRegionDTO.getRegionName()).setValue(storeRegionDTO.getRegionId().toString()));
}
}else {
regionList.add(EntityUtil.changeEntityByJSON(StoreRegionVO.class, storeRegionDTO));
}else {
voList.add(new StoreWidgetInterfaceVO().setLabel(storeRegionDTO.getRegionName()).setValue(storeRegionDTO.getRegionId().toString()));
}
}
return RestResponse.success(regionList);
return RestResponse.success(voList);
} else {
return RestResponse.failure(serviceResponse.getCode(), serviceResponse.getMessage());
}
......@@ -107,10 +112,21 @@ public class StoreController {
storeSearchDTO.setSearch(search);
storeSearchDTO.setStoreResource(UserDetailUtils.getUserDetail().getStoreResourceId());
String returnFields = StoreESFieldsEnum.STOREID.getField()+","+StoreESFieldsEnum.STORECODE.getField()+","+StoreESFieldsEnum.STORENAME.getField();
ServiceResponse serviceResponse = storeApiService.listStore(storeSearchDTO,
ServiceResponse<Page<StoreDTO>> serviceResponse = storeApiService.listStore(storeSearchDTO,
1, 100, returnFields);
if (serviceResponse.isSuccess()) {
return RestResponse.success(serviceResponse.getResult());
Page<StoreDTO> page = serviceResponse.getResult();
List<StoreDTO> list = page.getResult();
List<StoreWidgetInterfaceVO> voList = new ArrayList<>();
if (CollectionUtils.isNotEmpty(list)) {
if (CollectionUtils.isNotEmpty(list)) {
voList = list.stream()
.map(e -> new StoreWidgetInterfaceVO().setLabel(e.getStoreName()).setValue(e.getStoreId().toString()))
.collect(Collectors.toList());
}
}
return RestResponse.success(voList);
} else {
return RestResponse.failure(serviceResponse.getCode(), serviceResponse.getMessage());
}
......
......@@ -11,11 +11,9 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.gic.api.base.commons.ServiceResponse;
import com.gic.commons.util.EntityUtil;
import com.gic.commons.webapi.reponse.RestResponse;
import com.gic.enterprise.utils.UserDetailUtils;
import com.gic.plug.web.utils.storeresourceauth.StoreResourceUtils;
import com.gic.plug.web.vo.StoreTagVO;
import com.gic.store.constant.StoreESFieldsEnum;
import com.gic.store.dto.StoreTagDTO;
import com.gic.store.service.StoreTagApiService;
......
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