shopList增加能否修改shopCode 标识

This commit is contained in:
shuo.wang
2024-10-09 16:25:48 +08:00
parent 340bcf91a6
commit f7e3ef7679
2 changed files with 23 additions and 4 deletions

View File

@@ -1,11 +1,15 @@
package com.cool.store.vo.shop; package com.cool.store.vo.shop;
import com.cool.store.entity.ShopInfoDO; import com.cool.store.entity.ShopInfoDO;
import com.cool.store.entity.ShopStageInfoDO;
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.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.Objects;
/** /**
* @author zhangchenbiao * @author zhangchenbiao
@@ -25,16 +29,27 @@ public class MiniShopPageVO {
@ApiModelProperty("店铺编码") @ApiModelProperty("店铺编码")
private String shopCode; private String shopCode;
public MiniShopPageVO(Long shopId, String shopName,String shopCode) { @ApiModelProperty("加盟合同签约完成标识0-未完成1-完成")
private Boolean flag;
public MiniShopPageVO(Long shopId, String shopName,String shopCode,Boolean flag) {
this.shopId = shopId; this.shopId = shopId;
this.shopName = shopName; this.shopName = shopName;
this.shopCode = shopCode; this.shopCode = shopCode;
this.flag = flag;
} }
public static List<MiniShopPageVO> convertList(List<ShopInfoDO> shopInfoList) { public static List<MiniShopPageVO> convertList(List<ShopInfoDO> shopInfoList, Map<Long, ShopStageInfoDO> stageMap ) {
List<MiniShopPageVO> resultList = new ArrayList<>(); List<MiniShopPageVO> resultList = new ArrayList<>();
for (ShopInfoDO shopInfo : shopInfoList) { for (ShopInfoDO shopInfo : shopInfoList) {
resultList.add(new MiniShopPageVO(shopInfo.getId(), shopInfo.getShopName(),shopInfo.getShopCode())); ShopStageInfoDO stageInfoDO = stageMap.get(shopInfo.getId());
Boolean flag = Boolean.FALSE;
if (Objects.nonNull(stageInfoDO)) {
if (ShopSubStageStatusEnum.SHOP_SUB_STAGE_STATUS_84.getShopSubStageStatus().equals(stageInfoDO.getShopSubStageStatus())) {
flag = Boolean.TRUE;
}
}
resultList.add(new MiniShopPageVO(shopInfo.getId(), shopInfo.getShopName(),shopInfo.getShopCode(),flag));
} }
return resultList; return resultList;
} }

View File

@@ -23,6 +23,7 @@ import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.*; import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
@@ -92,7 +93,10 @@ public class ShopServiceImpl implements ShopService {
@Override @Override
public List<MiniShopPageVO> getShopList(Long lineId) { public List<MiniShopPageVO> getShopList(Long lineId) {
List<ShopInfoDO> shopList = shopInfoDAO.getShopList(lineId); List<ShopInfoDO> shopList = shopInfoDAO.getShopList(lineId);
return MiniShopPageVO.convertList(shopList); List<Long> shopIds = shopList.stream().map(ShopInfoDO::getId).collect(Collectors.toList());
List<ShopStageInfoDO> subStageList = shopStageInfoDAO.getSubStageList(shopIds, ShopSubStageEnum.SHOP_STAGE_8.getShopSubStage());
Map<Long, ShopStageInfoDO> stageMap = subStageList.stream().collect(Collectors.toMap(ShopStageInfoDO::getShopId, Function.identity()));
return MiniShopPageVO.convertList(shopList,stageMap);
} }
@Override @Override