代客下单 单位回填

This commit is contained in:
wangw 2024-12-02 15:43:37 +08:00
parent c7633ec875
commit 87804eba1b
3 changed files with 33 additions and 17 deletions

View File

@ -72,6 +72,10 @@ public class TbProduct implements Serializable {
@ApiModelProperty(value = "单位Id") @ApiModelProperty(value = "单位Id")
private Integer unitId; private Integer unitId;
@Transient
@TableField(exist = false)
private String unitName;
@Column(name = "`cover_img`") @Column(name = "`cover_img`")
@ApiModelProperty(value = "商品封面图") @ApiModelProperty(value = "商品封面图")
private String coverImg; private String coverImg;

View File

@ -321,7 +321,7 @@ public class TbProductServiceImpl implements TbProductService {
BeanUtils.copyProperties(tbProduct, tbProductVo); BeanUtils.copyProperties(tbProduct, tbProductVo);
//套餐 //套餐
if(tbProduct.getType().equals("package")){ if (tbProduct.getType().equals("package")) {
if (tbProduct.getGroupSnap() == null) { if (tbProduct.getGroupSnap() == null) {
tbProductVo.setProGroupVo(null); tbProductVo.setProGroupVo(null);
} else { } else {
@ -448,7 +448,7 @@ public class TbProductServiceImpl implements TbProductService {
} }
} }
} }
if("package".equals(resources.getType())){ if ("package".equals(resources.getType())) {
//套餐内容 //套餐内容
if (!resources.getProGroupVo().isEmpty()) { if (!resources.getProGroupVo().isEmpty()) {
product.setGroupSnap(ListUtil.listToJsonString(resources.getProGroupVo())); product.setGroupSnap(ListUtil.listToJsonString(resources.getProGroupVo()));
@ -563,7 +563,7 @@ public class TbProductServiceImpl implements TbProductService {
} else { } else {
product.setCategoryId(resources.getCategoryId().toString()); product.setCategoryId(resources.getCategoryId().toString());
} }
if("package".equals(resources.getType())){ if ("package".equals(resources.getType())) {
//套餐内容 //套餐内容
if (CollectionUtil.isNotEmpty(resources.getProGroupVo())) { if (CollectionUtil.isNotEmpty(resources.getProGroupVo())) {
product.setGroupSnap(ListUtil.listToJsonString(resources.getProGroupVo())); product.setGroupSnap(ListUtil.listToJsonString(resources.getProGroupVo()));
@ -771,7 +771,7 @@ public class TbProductServiceImpl implements TbProductService {
com.baomidou.mybatisplus.extension.plugins.pagination.Page<TbProduct> page1 = new com.baomidou.mybatisplus.extension.plugins.pagination.Page<>(page, size); com.baomidou.mybatisplus.extension.plugins.pagination.Page<TbProduct> page1 = new com.baomidou.mybatisplus.extension.plugins.pagination.Page<>(page, size);
QueryWrapper<TbProduct> queryWrapper = new QueryWrapper<>(); QueryWrapper<TbProduct> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("is_del", 0) queryWrapper.eq("is_del", 0)
.eq(false,"type", "coupon") .eq(false, "type", "coupon")
.eq("shop_id", shopId) .eq("shop_id", shopId)
.eq("status", 1) .eq("status", 1)
.eq("is_del", 0) .eq("is_del", 0)
@ -790,12 +790,19 @@ public class TbProductServiceImpl implements TbProductService {
if (productId != null) { if (productId != null) {
queryWrapper.eq("id", productId); queryWrapper.eq("id", productId);
} }
Map<Integer, String> unitMap = new HashMap<>();
com.baomidou.mybatisplus.extension.plugins.pagination.Page<TbProduct> tbProductPage = productMapper.selectPage(page1, queryWrapper); com.baomidou.mybatisplus.extension.plugins.pagination.Page<TbProduct> tbProductPage = productMapper.selectPage(page1, queryWrapper);
tbProductPage.getRecords().forEach(item -> { tbProductPage.getRecords().forEach(item -> {
if("package".equals(item.getType())){ if ("package".equals(item.getType())) {
item.setProGroupVo(JSONUtil.parseJSONStrTList(item.getGroupSnap(), ProductGroupVo.class)); item.setProGroupVo(JSONUtil.parseJSONStrTList(item.getGroupSnap(), ProductGroupVo.class));
} }
if (item.getUnitId() != null) {
if (!unitMap.containsKey(item.getUnitId())) {
TbShopUnit tbShopUnit = tbShopUnitRepository.searchUnit(item.getUnitId());
unitMap.put(item.getId(), tbShopUnit.getName());
}
item.setUnitName(unitMap.get(item.getUnitId()));
}
TbProductSkuResult skuResult = productSkuResultRepository.findById(item.getId()).orElse(null); TbProductSkuResult skuResult = productSkuResultRepository.findById(item.getId()).orElse(null);
List<TbProductSku> tbProductSkus = producSkutMapper.selectList(new LambdaQueryWrapper<TbProductSku>().eq(TbProductSku::getIsDel, 0) List<TbProductSku> tbProductSkus = producSkutMapper.selectList(new LambdaQueryWrapper<TbProductSku>().eq(TbProductSku::getIsDel, 0)
.eq(TbProductSku::getIsPauseSale, 0) .eq(TbProductSku::getIsPauseSale, 0)

View File

@ -28,6 +28,7 @@ public class TbProductNewVo {
private String name; private String name;
//售价 //售价
private String lowPrice; private String lowPrice;
private String type;
//类型 单规格/多规格 //类型 单规格/多规格
private String typeEnum; private String typeEnum;
//库存 //库存
@ -53,26 +54,30 @@ public class TbProductNewVo {
private Integer sort; private Integer sort;
public void setTypeEnum(String typeEnum) { public void setTypeEnum(String typeEnum) {
switch (typeEnum) { switch (this.type) {
case "normal": case "normal":
this.typeEnum = "单规格"; this.typeEnum = "普通商品";
break; case "weigh":
case "sku":
this.typeEnum = "多规格";
break;
case "weight":
this.typeEnum = "称重商品"; this.typeEnum = "称重商品";
break; break;
case "currentPrice": case "coupon":
this.typeEnum = "时价商品"; this.typeEnum = "优惠券";
break; break;
case "group": case "package":
this.typeEnum = "套餐商品/团购卷"; this.typeEnum = "套餐商品";
break; break;
default: default:
this.typeEnum = typeEnum; this.typeEnum = typeEnum;
break; break;
} }
switch (typeEnum) {
case "normal":
this.typeEnum = this.typeEnum + ":单规格";
break;
case "sku":
this.typeEnum = this.typeEnum + "多规格";
break;
}
} }
@Data @Data