|
@@ -3,6 +3,7 @@ package com.szwl.controller;
|
|
|
|
|
|
import cn.com.crbank.ommo.esUtil.BeanUtils;
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
+import cn.hutool.core.util.RandomUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
@@ -1116,12 +1117,13 @@ public class TOrderController {
|
|
|
if (product == null) {
|
|
|
return JsonMessage.error("找不到商品");
|
|
|
}
|
|
|
- note.append(productNamea).append("-").append(product.getNo()).append(":");
|
|
|
+// note.append(productNamea).append("-").append(product.getNo()).append(":");
|
|
|
BigDecimal productPrice = product.getRmbPrice();
|
|
|
productNo = product.getNo();
|
|
|
if(promoCodeList.size()>0){
|
|
|
//有优惠码
|
|
|
BigDecimal onePrice = new BigDecimal("0.00");
|
|
|
+ Map<BigDecimal, Integer> priceMap = new HashMap<>();
|
|
|
int i;
|
|
|
for( i = 0;i<promoCodeList.size();i++){
|
|
|
BigDecimal discount = BigDecimal.valueOf(promoCodeList.get(i).getDiscount()).setScale(2, RoundingMode.HALF_DOWN);
|
|
@@ -1143,15 +1145,26 @@ public class TOrderController {
|
|
|
}
|
|
|
}
|
|
|
price = price.add(price1);
|
|
|
- onePrice = onePrice.add(price1);
|
|
|
+// onePrice = onePrice.add(price1);
|
|
|
+ if (priceMap.containsKey(price1)) {
|
|
|
+ priceMap.put(price1, priceMap.get(price1) + 1);
|
|
|
+ } else {
|
|
|
+ priceMap.put(price1, 1);
|
|
|
+ }
|
|
|
}
|
|
|
if(i<Integer.valueOf(num)){
|
|
|
int a = Integer.valueOf(num)-i;
|
|
|
BigDecimal price2 = productPrice.multiply(new BigDecimal(a)).setScale(2, RoundingMode.HALF_DOWN);
|
|
|
price =price.add(price2);
|
|
|
- onePrice = onePrice.add(price2);
|
|
|
+// onePrice = onePrice.add(price2);
|
|
|
+ priceMap.put(price2, a);
|
|
|
}
|
|
|
- note.append(onePrice).append("-").append(num).append(",");
|
|
|
+
|
|
|
+ for (BigDecimal priceKey : priceMap.keySet()) {
|
|
|
+ note.append(productNamea).append("-").append(product.getNo()).append("-").append(RandomUtil.randomNumbers(5)).append(":");
|
|
|
+ note.append(priceKey).append("-").append(priceMap.get(priceKey)).append(",");
|
|
|
+ }
|
|
|
+
|
|
|
}else {
|
|
|
//1,type=0,原始设定,没有第二件半价
|
|
|
int a = Integer.valueOf(num);
|
|
@@ -2489,6 +2502,7 @@ public class TOrderController {
|
|
|
if(promoCodeList.size()>0){
|
|
|
//有优惠码
|
|
|
BigDecimal onePrice = new BigDecimal("0.00");
|
|
|
+ Map<BigDecimal, Integer> priceMap = new HashMap<>();
|
|
|
int i;
|
|
|
for( i = 0;i<promoCodeList.size();i++){
|
|
|
BigDecimal discount = BigDecimal.valueOf(promoCodeList.get(i).getDiscount()).setScale(2, RoundingMode.HALF_DOWN);
|