Merge branch 'feature' of https://gitee.com/liuyingfang/cashier-admin into feature
This commit is contained in:
@@ -80,7 +80,6 @@ public class ListUtil {
|
|||||||
for (String s : listString) {
|
for (String s : listString) {
|
||||||
integerList.add(Integer.parseInt(s));
|
integerList.add(Integer.parseInt(s));
|
||||||
}
|
}
|
||||||
System.out.println(integerList);
|
|
||||||
return integerList;
|
return integerList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -105,4 +105,6 @@ public class TbCashierCartDto implements Serializable {
|
|||||||
private String isGift;
|
private String isGift;
|
||||||
|
|
||||||
private Long pendingAt;
|
private Long pendingAt;
|
||||||
|
|
||||||
|
private String uuid;
|
||||||
}
|
}
|
||||||
@@ -157,4 +157,6 @@ public class TbOrderInfoDto implements Serializable {
|
|||||||
private String remark;
|
private String remark;
|
||||||
|
|
||||||
private List<TbOrderDetail> detailList;
|
private List<TbOrderDetail> detailList;
|
||||||
|
|
||||||
|
private String payRemark;
|
||||||
}
|
}
|
||||||
@@ -17,6 +17,7 @@ package cn.ysk.cashier.dto.product;
|
|||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @website https://eladmin.vip
|
* @website https://eladmin.vip
|
||||||
@@ -54,7 +55,7 @@ public class TbProductGroupDto implements Serializable {
|
|||||||
private Integer sort;
|
private Integer sort;
|
||||||
|
|
||||||
/** 商品列表 */
|
/** 商品列表 */
|
||||||
private String productIds;
|
private List<String> productIds;
|
||||||
|
|
||||||
private Long createdAt;
|
private Long createdAt;
|
||||||
|
|
||||||
|
|||||||
@@ -21,8 +21,14 @@ import cn.ysk.cashier.dto.product.TbProductGroupDto;
|
|||||||
|
|
||||||
import org.mapstruct.Mapper;
|
import org.mapstruct.Mapper;
|
||||||
|
|
||||||
|
import org.mapstruct.Mapping;
|
||||||
import org.mapstruct.ReportingPolicy;
|
import org.mapstruct.ReportingPolicy;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @website https://eladmin.vip
|
* @website https://eladmin.vip
|
||||||
* @author lyf
|
* @author lyf
|
||||||
@@ -31,4 +37,29 @@ import org.mapstruct.ReportingPolicy;
|
|||||||
@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||||
public interface TbProductGroupMapper extends BaseMapper<TbProductGroupDto, TbProductGroup> {
|
public interface TbProductGroupMapper extends BaseMapper<TbProductGroupDto, TbProductGroup> {
|
||||||
|
|
||||||
|
@Mapping(target = "productIds", source = "productIds")
|
||||||
|
TbProductGroupDto toDto(TbProductGroup entity);
|
||||||
|
|
||||||
|
// 自定义的字符串到整数列表的转换方法
|
||||||
|
default List<Integer> map(String value) {
|
||||||
|
if (value == null || value.isEmpty()) {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
// 分割字符串,然后将每个数字字符串转换为Integer,收集到List中
|
||||||
|
return Arrays.stream(value.split(","))
|
||||||
|
.map(Integer::valueOf)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
// 如果需要从DTO转回实体,也可能需要实现反向的映射方法
|
||||||
|
default String map(List<Integer> values) {
|
||||||
|
if (values == null || values.isEmpty()) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
// 将整数列表转换为由逗号分隔的字符串
|
||||||
|
return values.stream()
|
||||||
|
.map(String::valueOf)
|
||||||
|
.collect(Collectors.joining(","));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -150,6 +150,10 @@ public class TbCashierCart implements Serializable {
|
|||||||
@ApiModelProperty(value = "pendingAt")
|
@ApiModelProperty(value = "pendingAt")
|
||||||
private Long pendingAt;
|
private Long pendingAt;
|
||||||
|
|
||||||
|
@Column(name = "`uuid`")
|
||||||
|
@ApiModelProperty(value = "uuid")
|
||||||
|
private String uuid;
|
||||||
|
|
||||||
public void copy(TbCashierCart source){
|
public void copy(TbCashierCart source){
|
||||||
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
|
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -145,7 +145,7 @@ public class TbOrderInfo implements Serializable {
|
|||||||
private BigDecimal userCouponAmount;
|
private BigDecimal userCouponAmount;
|
||||||
|
|
||||||
@Column(name = "`master_id`")
|
@Column(name = "`master_id`")
|
||||||
@ApiModelProperty(value = "如果为退单时,主单号")
|
@ApiModelProperty(value = "取餐码")
|
||||||
private String masterId;
|
private String masterId;
|
||||||
|
|
||||||
@Column(name = "`refund_able`")
|
@Column(name = "`refund_able`")
|
||||||
@@ -208,6 +208,10 @@ public class TbOrderInfo implements Serializable {
|
|||||||
@ApiModelProperty(value = "remark")
|
@ApiModelProperty(value = "remark")
|
||||||
private String remark;
|
private String remark;
|
||||||
|
|
||||||
|
@Column(name = "`pay_remark`")
|
||||||
|
@ApiModelProperty(value = "payRemark")
|
||||||
|
private String payRemark;
|
||||||
|
|
||||||
public void copy(TbOrderInfo source){
|
public void copy(TbOrderInfo source){
|
||||||
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
|
BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ import org.springframework.stereotype.Service;
|
|||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.data.domain.Page;
|
import org.springframework.data.domain.Page;
|
||||||
import org.springframework.data.domain.Pageable;
|
import org.springframework.data.domain.Pageable;
|
||||||
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -77,16 +78,9 @@ public class TbProductGroupServiceImpl implements TbProductGroupService {
|
|||||||
@Override
|
@Override
|
||||||
public List<TbProduct> findByIdProduct(Integer productGroup) {
|
public List<TbProduct> findByIdProduct(Integer productGroup) {
|
||||||
TbProductGroup tbProductGroup = tbProductGroupRepository.findById(productGroup).orElseGet(TbProductGroup::new);
|
TbProductGroup tbProductGroup = tbProductGroupRepository.findById(productGroup).orElseGet(TbProductGroup::new);
|
||||||
if (tbProductGroup.getProductIds() != null){
|
TbProductGroupDto dto = tbProductGroupMapper.toDto(tbProductGroup);
|
||||||
List<String> list = ListUtil.stringChangeStringList(tbProductGroup.getProductIds());
|
if (!CollectionUtils.isEmpty(dto.getProductIds())){
|
||||||
|
return tbProductRepository.findByIds(ListUtil.stringChangeIntegerList(dto.getProductIds()));
|
||||||
List<Integer> intList = new ArrayList<>();
|
|
||||||
for (String str : list) {
|
|
||||||
intList.add(Integer.parseInt(str));
|
|
||||||
}
|
|
||||||
System.out.println(intList);
|
|
||||||
|
|
||||||
return tbProductRepository.findByIds(ListUtil.stringChangeIntegerList(list));
|
|
||||||
}
|
}
|
||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user