代客下单 单位回填

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")
private Integer unitId;
@Transient
@TableField(exist = false)
private String unitName;
@Column(name = "`cover_img`")
@ApiModelProperty(value = "商品封面图")
private String coverImg;

View File

@ -321,7 +321,7 @@ public class TbProductServiceImpl implements TbProductService {
BeanUtils.copyProperties(tbProduct, tbProductVo);
//套餐
if(tbProduct.getType().equals("package")){
if (tbProduct.getType().equals("package")) {
if (tbProduct.getGroupSnap() == null) {
tbProductVo.setProGroupVo(null);
} else {
@ -448,7 +448,7 @@ public class TbProductServiceImpl implements TbProductService {
}
}
}
if("package".equals(resources.getType())){
if ("package".equals(resources.getType())) {
//套餐内容
if (!resources.getProGroupVo().isEmpty()) {
product.setGroupSnap(ListUtil.listToJsonString(resources.getProGroupVo()));
@ -563,7 +563,7 @@ public class TbProductServiceImpl implements TbProductService {
} else {
product.setCategoryId(resources.getCategoryId().toString());
}
if("package".equals(resources.getType())){
if ("package".equals(resources.getType())) {
//套餐内容
if (CollectionUtil.isNotEmpty(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);
QueryWrapper<TbProduct> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("is_del", 0)
.eq(false,"type", "coupon")
.eq(false, "type", "coupon")
.eq("shop_id", shopId)
.eq("status", 1)
.eq("is_del", 0)
@ -790,12 +790,19 @@ public class TbProductServiceImpl implements TbProductService {
if (productId != null) {
queryWrapper.eq("id", productId);
}
Map<Integer, String> unitMap = new HashMap<>();
com.baomidou.mybatisplus.extension.plugins.pagination.Page<TbProduct> tbProductPage = productMapper.selectPage(page1, queryWrapper);
tbProductPage.getRecords().forEach(item -> {
if("package".equals(item.getType())){
if ("package".equals(item.getType())) {
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);
List<TbProductSku> tbProductSkus = producSkutMapper.selectList(new LambdaQueryWrapper<TbProductSku>().eq(TbProductSku::getIsDel, 0)
.eq(TbProductSku::getIsPauseSale, 0)

View File

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