Commit bf2c1eb4 by zhiwj

门店导出优化

parent 20073a1f
......@@ -83,6 +83,18 @@ public interface StoreApiService {
ServiceResponse<Map<Integer, List<String>>> listStorePhotoByStoreIds(Integer enterpriseId, List<Integer> storeIdList);
/**
* 按id查询门店图片 key:storeInfoIdList value:门店图片列表
* @Title: listStorePhotoByIds
* @Description:
* @author zhiwj
* @param enterpriseId
* @param storeInfoIdList
* @return com.gic.api.base.commons.ServiceResponse<java.util.Map<java.lang.Integer,java.util.List<java.lang.String>>>
* @throws
*/
ServiceResponse<Map<Integer, List<String>>> listStorePhotoByStoreInfoIds(Integer enterpriseId, List<Integer> storeInfoIdList);
/**
* @Title: getStoreById
* @Description: 查询门店详情
* @author zhiwj
......
......@@ -529,6 +529,30 @@ public class StoreApiServiceImpl implements StoreApiService {
}
@Override
public ServiceResponse<Map<Integer, List<String>>> listStorePhotoByStoreInfoIds(Integer enterpriseId, List<Integer> storeInfoIdList) {
StoreSearchDTO storeSearchDTO = new StoreSearchDTO();
storeSearchDTO.setEnterpriseId(enterpriseId);
storeSearchDTO.setStoreInfoIds(Joiner.on(" ").join(storeInfoIdList));
ServiceResponse<Page<StoreDTO>> serviceResponse = this.listStore(storeSearchDTO, 1, 20);
if (!serviceResponse.isSuccess()) {
return ServiceResponse.failure(serviceResponse.getCode(), serviceResponse.getMessage());
}
Map<Integer, List<String>> resultMap = new HashMap<>(16);
List<StoreDTO> storeDTOList = serviceResponse.getResult().getResult();
for (StoreDTO storeDTO : storeDTOList) {
List<StorePhotoDTO> photoList = storeDTO.getPhotoList();
List<String> list = Optional.ofNullable(photoList).orElse(Collections.emptyList()).stream().map(StorePhotoDTO::getImageUrl).collect(Collectors.toList());
// 给一个门店图片默认值测试
if (CollectionUtils.isNotEmpty(list)) {
list = Arrays.asList(Constants.DEFAULT_PHOTO);
}
resultMap.put(storeDTO.getStoreInfoId(), list);
}
return EnterpriseServiceResponse.success(resultMap);
}
@Override
public ServiceResponse queryStoreFromES(JSONObject jsonObject, Integer pageNum, Integer pageSize, JSONObject sortJson, String returnFileds) {
if (StringUtils.isBlank(returnFileds)) {
returnFileds = StoreESFieldsEnum.STOREID.getField();
......
......@@ -328,8 +328,11 @@ public class StoreController extends DownloadUtils {
// 如果是批量修改状态 要转移门店
StoreSearchDTO storeSearchDTO = new StoreSearchDTO();
storeSearchDTO.setStoreIds(storeIds.replace(',', ' '));
List<String> list = this.storeApiService.listStore(storeSearchDTO, 1, 1000, "storeInfoId").getResult().getResult()
.stream().map(e -> e.getStoreInfoId().toString()).collect(Collectors.toList());
Page<StoreDTO> page = this.storeApiService.listStore(storeSearchDTO, 1, 1000, "storeInfoId").getResult();
if (page == null || page.getResult() == null) {
return EnterpriseRestResponse.failure(ErrorCode.NOTEXISTS);
}
List<String> list = page.getResult().stream().map(e -> e.getStoreInfoId().toString()).collect(Collectors.toList());
Integer storeInfoId = storeApiService.getStoreById(UserDetailUtils.getUserDetail().getEnterpriseId(), toStoreId).getResult().getStoreInfoId();
StoreBatchUpdateDTO storeBatchUpdateDTO = new StoreBatchUpdateDTO();
storeBatchUpdateDTO.setEnterpriseId(UserDetailUtils.getUserDetail().getEnterpriseId());
......
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