This commit is contained in:
zhangchenbiao
2024-05-07 10:30:29 +08:00
parent f58bf80cf2
commit 64ddcfcbb9
2 changed files with 10 additions and 13 deletions

View File

@@ -18,6 +18,10 @@ import java.util.Objects;
@Data
public class MiniAddPointRequest {
@NotNull
@ApiModelProperty("店铺id")
private Long shopId;
@NotBlank
@ApiModelProperty("铺位名称")
private String pointName;

View File

@@ -789,10 +789,12 @@ public class PointServiceImpl implements PointService {
if(Objects.isNull(lineInfo)){
throw new ServiceException(ErrorCodeEnum.LINE_ID_IS_NOT_EXIST);
}
List<ShopInfoDO> shopList = shopInfoDAO.getShopList(lineId);
List<Long> unSelectShopIds = shopList.stream().filter(o -> o.getShopStage().equals(ShopStageEnum.SHOP_STAGE_1.getShopStage())).filter(o -> Objects.isNull(o.getPointId())).map(ShopInfoDO::getId).collect(Collectors.toList());
if(CollectionUtils.isEmpty(unSelectShopIds)){
throw new ServiceException(ErrorCodeEnum.NOT_EXIST_UNSELECT_POINT);
ShopInfoDO shopInfo = shopInfoDAO.getShopInfo(request.getShopId());
if(Objects.isNull(shopInfo)){
throw new ServiceException(ErrorCodeEnum.SHOP_NOT_EXIST);
}
if(Objects.nonNull(shopInfo.getPointId())){
throw new ServiceException(ErrorCodeEnum.SHOP_IS_SELECTED);
}
PointDetailInfoDO pointDetailInfo = MiniAddPointRequest.convertDO(request);
PointInfoDO pointInfo = MiniAddPointRequest.convertPointDO(request);
@@ -806,15 +808,6 @@ public class PointServiceImpl implements PointService {
Long pointId = pointInfoDAO.addPointInfo(pointInfo);
pointDetailInfo.setPointId(pointId);
pointDetailInfoDAO.addPointDetailInfo(pointDetailInfo);
//门店占铺
Integer result = shopInfoDAO.occupyShopPoint(unSelectShopIds, pointId);
if(result != CommonConstants.ONE){
throw new ServiceException(ErrorCodeEnum.SELECT_POINT_ERROR);
}
ShopInfoDO shopInfo = shopInfoDAO.getShopInfoByPointId(lineId, pointId);
if(Objects.isNull(shopInfo)){
throw new ServiceException(ErrorCodeEnum.SELECT_POINT_ERROR);
}
shopInfo.setShopName(pointInfo.getPointName());
shopInfoDAO.updateShopInfo(shopInfo);
PointRecommendDO pointRecommendDO = new PointRecommendDO();