fix: 订单保存优惠券信息修改

This commit is contained in:
张松
2024-11-21 11:43:10 +08:00
parent 43303a76af
commit eae6676b6c
3 changed files with 41 additions and 5 deletions

View File

@@ -0,0 +1,14 @@
package com.chaozhanggui.system.cashierservice.entity.dto;
import com.chaozhanggui.system.cashierservice.entity.TbActivateOutRecord;
import lombok.Data;
import java.util.Collection;
import java.util.List;
@Data
public class OrderInfoCouponInfoDTO {
private List<TbActivateOutRecord> outRecordList;
private Collection<OrderInfoUserCouponVo> fullReductionCoupon;
private Collection<OrderInfoUserCouponVo> productCoupon;
}

View File

@@ -0,0 +1,11 @@
package com.chaozhanggui.system.cashierservice.entity.dto;
import com.chaozhanggui.system.cashierservice.entity.vo.TbUserCouponVo;
import lombok.Data;
import lombok.EqualsAndHashCode;
@EqualsAndHashCode(callSuper = true)
@Data
public class OrderInfoUserCouponVo extends TbUserCouponVo {
private int returnNum = 0;
}

View File

@@ -1474,11 +1474,22 @@ public class CartService {
}
couponInfo.setProductCouponMap(BeanUtil.copyProperties(couponInfo.getProductCouponMap(), HashMap.class));
HashMap<String, Object> map = new HashMap<>();
map.put("outRecordList", couponInfo.getOutRecordList());
map.put("fullReductionCoupon", couponInfo.getFullReductionCouponMap().values());
map.put("productCoupon", couponInfo.getProductCouponMap().values());
orderInfo.setCouponInfoList(JSONObject.toJSONString(map));
OrderInfoCouponInfoDTO infoDTO = new OrderInfoCouponInfoDTO();
infoDTO.setOutRecordList(couponInfo.getOutRecordList());
ArrayList<OrderInfoUserCouponVo> productArr = new ArrayList<>();
couponInfo.getProductCouponMap().values().forEach(item -> {
productArr.add(BeanUtil.copyProperties(item, OrderInfoUserCouponVo.class));
});
infoDTO.setProductCoupon(productArr);
ArrayList<OrderInfoUserCouponVo> fullArr = new ArrayList<>();
couponInfo.getFullReductionCouponMap().values().forEach(item -> {
fullArr.add(BeanUtil.copyProperties(item, OrderInfoUserCouponVo.class));
});
infoDTO.setFullReductionCoupon(fullArr);
orderInfo.setCouponInfoList(JSONObject.toJSONString(infoDTO));
}
// 修改订单详情并打票