fix 增加修改门店区域
This commit is contained in:
@@ -6,10 +6,7 @@ import com.cool.store.enums.point.ShopSubStageStatusEnum;
|
|||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author zhangchenbiao
|
* @author zhangchenbiao
|
||||||
@@ -35,15 +32,22 @@ public class MiniShopPageVO {
|
|||||||
@ApiModelProperty("铺位id")
|
@ApiModelProperty("铺位id")
|
||||||
private Long pointId;
|
private Long pointId;
|
||||||
|
|
||||||
public MiniShopPageVO(Long shopId, String shopName,String shopCode,Boolean flag,Long pointId) {
|
@ApiModelProperty("门店所属区域id")
|
||||||
|
private Long regionId;
|
||||||
|
@ApiModelProperty("门店所属区域name")
|
||||||
|
private String regionName;
|
||||||
|
|
||||||
|
public MiniShopPageVO(Long shopId, String shopName,String shopCode,Boolean flag,Long pointId,Long regionId,String regionName) {
|
||||||
this.shopId = shopId;
|
this.shopId = shopId;
|
||||||
this.shopName = shopName;
|
this.shopName = shopName;
|
||||||
this.shopCode = shopCode;
|
this.shopCode = shopCode;
|
||||||
this.flag = flag;
|
this.flag = flag;
|
||||||
this.pointId = pointId;
|
this.pointId = pointId;
|
||||||
|
this.regionId = regionId;
|
||||||
|
this.regionName = regionName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<MiniShopPageVO> convertList(List<ShopInfoDO> shopInfoList, Map<Long, ShopStageInfoDO> stageMap ) {
|
public static List<MiniShopPageVO> convertList(List<ShopInfoDO> shopInfoList, Map<Long, ShopStageInfoDO> stageMap, Map<Long, String> regionNameMap ) {
|
||||||
List<MiniShopPageVO> resultList = new ArrayList<>();
|
List<MiniShopPageVO> resultList = new ArrayList<>();
|
||||||
for (ShopInfoDO shopInfo : shopInfoList) {
|
for (ShopInfoDO shopInfo : shopInfoList) {
|
||||||
ShopStageInfoDO stageInfoDO = stageMap.get(shopInfo.getId());
|
ShopStageInfoDO stageInfoDO = stageMap.get(shopInfo.getId());
|
||||||
@@ -53,7 +57,10 @@ public class MiniShopPageVO {
|
|||||||
flag = Boolean.TRUE;
|
flag = Boolean.TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
resultList.add(new MiniShopPageVO(shopInfo.getId(), shopInfo.getShopName(),shopInfo.getShopCode(),flag,shopInfo.getPointId()));
|
if(Objects.isNull(regionNameMap)){
|
||||||
|
regionNameMap = new HashMap<>();
|
||||||
|
}
|
||||||
|
resultList.add(new MiniShopPageVO(shopInfo.getId(), shopInfo.getShopName(),shopInfo.getShopCode(),flag,shopInfo.getPointId(),shopInfo.getRegionId(), regionNameMap.getOrDefault(shopInfo.getRegionId(),"")));
|
||||||
}
|
}
|
||||||
return resultList;
|
return resultList;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ import com.cool.store.utils.RandomEightCharCodeUtils;
|
|||||||
import com.cool.store.vo.shop.MiniShopPageVO;
|
import com.cool.store.vo.shop.MiniShopPageVO;
|
||||||
import com.cool.store.vo.shop.ShopStageInfoVO;
|
import com.cool.store.vo.shop.ShopStageInfoVO;
|
||||||
import com.cool.store.vo.shop.StageShopCountVO;
|
import com.cool.store.vo.shop.StageShopCountVO;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
@@ -51,6 +52,8 @@ public class ShopServiceImpl implements ShopService {
|
|||||||
private CommonService commonService;
|
private CommonService commonService;
|
||||||
@Resource
|
@Resource
|
||||||
UserAuthMappingService userAuthMappingService;
|
UserAuthMappingService userAuthMappingService;
|
||||||
|
@Autowired
|
||||||
|
private RegionDao regionDao;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
@@ -96,7 +99,9 @@ public class ShopServiceImpl implements ShopService {
|
|||||||
List<Long> shopIds = shopList.stream().map(ShopInfoDO::getId).collect(Collectors.toList());
|
List<Long> shopIds = shopList.stream().map(ShopInfoDO::getId).collect(Collectors.toList());
|
||||||
List<ShopStageInfoDO> subStageList = shopStageInfoDAO.getSubStageList(shopIds, ShopSubStageEnum.SHOP_STAGE_8.getShopSubStage());
|
List<ShopStageInfoDO> subStageList = shopStageInfoDAO.getSubStageList(shopIds, ShopSubStageEnum.SHOP_STAGE_8.getShopSubStage());
|
||||||
Map<Long, ShopStageInfoDO> stageMap = subStageList.stream().collect(Collectors.toMap(ShopStageInfoDO::getShopId, Function.identity()));
|
Map<Long, ShopStageInfoDO> stageMap = subStageList.stream().collect(Collectors.toMap(ShopStageInfoDO::getShopId, Function.identity()));
|
||||||
return MiniShopPageVO.convertList(shopList,stageMap);
|
List<Long> regionIds = shopList.stream().map(ShopInfoDO::getRegionId).collect(Collectors.toList());
|
||||||
|
Map<Long, String> regionNameMap = regionDao.getRegionNameMap(regionIds);
|
||||||
|
return MiniShopPageVO.convertList(shopList,stageMap,regionNameMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user