Commit d7e4ffcc by weijiguang

下单时校验订单中sku数量

parent 872bc8e2
......@@ -30,5 +30,5 @@ public class BannerListPo {
private String area;
@ApiModelProperty("店铺ID")
private Long shopId;
private String shopId;
}
......@@ -114,29 +114,20 @@ public class SysBannerServiceImpl implements ISysBannerService {
banner.setSort(bannerPo.getSort());
banner.setState(bannerPo.getState());
if (bannerPo.getProvince() != null && bannerPo.getProvince().length > 0) {
banner.setProvince(Arrays.asList(bannerPo.getProvince()).stream().collect(Collectors.joining(",")));
banner.setProvince("," + Arrays.asList(bannerPo.getProvince()).stream().collect(Collectors.joining(",")) + ",");
}
if (bannerPo.getCity() != null && bannerPo.getCity().length > 0) {
banner.setCity(Arrays.asList(bannerPo.getCity()).stream().collect(Collectors.joining(",")));
banner.setCity("," + Arrays.asList(bannerPo.getCity()).stream().collect(Collectors.joining(",")) + ",");
}
if (bannerPo.getArea() != null && bannerPo.getArea().length > 0) {
banner.setArea(Arrays.asList(bannerPo.getArea()).stream().collect(Collectors.joining(",")));
banner.setArea("," + Arrays.asList(bannerPo.getArea()).stream().collect(Collectors.joining(",")) + ",");
}
if (bannerPo.getShopIds() != null && bannerPo.getShopIds().length > 0) {
banner.setShopIds(Arrays.asList(bannerPo.getShopIds()).stream().map(x -> String.valueOf(x)).collect(Collectors.joining(",")));
banner.setShopIds("," + Arrays.asList(bannerPo.getShopIds()).stream().map(x -> String.valueOf(x)).collect(Collectors.joining(",")) + ",");
}
return banner;
}
public List<BannerVo> copyBanner(List<SysBanner> banners) {
List<BannerVo> bannerVos = new ArrayList<>();
if (CollectionUtils.isEmpty(banners)) {
return bannerVos;
}
banners.forEach(banner -> bannerVos.add(copyBanner(banner)));
return bannerVos;
}
private BannerVo copyBanner(SysBanner banner) {
BannerVo bannerVo = new BannerVo();
bannerVo.setId(banner.getId());
......@@ -146,21 +137,26 @@ public class SysBannerServiceImpl implements ISysBannerService {
bannerVo.setTarget(banner.getTarget());
bannerVo.setSort(banner.getSort());
bannerVo.setState(banner.getState());
bannerVo.setProvinceStr(banner.getProvince());
bannerVo.setCityStr(banner.getCity());
bannerVo.setAreaStr(banner.getArea());
bannerVo.setShopIdsStr(banner.getShopIds());
if (!StringUtils.isEmpty(banner.getProvince())) {
bannerVo.setProvince(banner.getProvince().split(","));
String str = banner.getProvince().substring(1, banner.getProvince().length() - 1);
bannerVo.setProvinceStr(str);
bannerVo.setProvince(str.split(","));
}
if (!StringUtils.isEmpty(banner.getCity())) {
bannerVo.setCity(banner.getCity().split(","));
String str = banner.getCity().substring(1, banner.getCity().length() - 1);
bannerVo.setCityStr(str);
bannerVo.setCity(str.split(","));
}
if (!StringUtils.isEmpty(banner.getArea())) {
bannerVo.setArea(banner.getArea().split(","));
String str = banner.getArea().substring(1, banner.getArea().length() - 1);
bannerVo.setAreaStr(str);
bannerVo.setArea(str.split(","));
}
if (!StringUtils.isEmpty(banner.getShopIds())) {
String[] shopIds = banner.getShopIds().split(",");
String str = banner.getShopIds().substring(1, banner.getShopIds().length() - 1);
bannerVo.setShopIdsStr(str);
String[] shopIds = str.split(",");
Long[] ids = new Long[shopIds.length];
for (int i = 0; i < shopIds.length; i++) {
ids[i] = Long.parseLong(shopIds[i]);
......@@ -170,6 +166,15 @@ public class SysBannerServiceImpl implements ISysBannerService {
return bannerVo;
}
public List<BannerVo> copyBanner(List<SysBanner> banners) {
List<BannerVo> bannerVos = new ArrayList<>();
if (CollectionUtils.isEmpty(banners)) {
return bannerVos;
}
banners.forEach(banner -> bannerVos.add(copyBanner(banner)));
return bannerVos;
}
@Override
public Boolean updateState(Long bannerId, Integer state) {
SysBanner banner = new SysBanner();
......@@ -295,7 +300,7 @@ public class SysBannerServiceImpl implements ISysBannerService {
}
public void translateArea(List<BannerVo> bannerVos) {
if(CollectionUtils.isEmpty(bannerVos)){
if (CollectionUtils.isEmpty(bannerVos)) {
return;
}
List<String> province = new ArrayList<>(16);
......
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