diff --git a/src/main/java/com/yxt/yythmall/biz/lpkgoods/LpkGoodsService.java b/src/main/java/com/yxt/yythmall/biz/lpkgoods/LpkGoodsService.java index 3070e9c..03eac44 100644 --- a/src/main/java/com/yxt/yythmall/biz/lpkgoods/LpkGoodsService.java +++ b/src/main/java/com/yxt/yythmall/biz/lpkgoods/LpkGoodsService.java @@ -266,7 +266,7 @@ public class LpkGoodsService extends MybatisBaseService{ // d.setIconUrl(fileUploadComponent.getUrlPrefix()+d.getIconUrl()); - d.setMefenPrice(String.valueOf((int)(Double.valueOf(d.getPrice())* Double.valueOf(d.getWeight())))); + d.setMefenPrice(removeZeros(String.valueOf((Double.valueOf(d.getPrice())* Double.valueOf(d.getWeight()))))); }); }else{ l.forEach(s->{ @@ -275,11 +275,25 @@ public class LpkGoodsService extends MybatisBaseService 0) { + // 去掉多余的0 + num = num.replaceAll("0+?$", ""); + // 如果最后一位是. 则去掉 + num = num.replaceAll("[.]$", ""); + } + return num; + } } diff --git a/src/main/java/com/yxt/yythmall/biz/ordorder/OrdOrderService.java b/src/main/java/com/yxt/yythmall/biz/ordorder/OrdOrderService.java index 6e111f7..3a1d5d4 100644 --- a/src/main/java/com/yxt/yythmall/biz/ordorder/OrdOrderService.java +++ b/src/main/java/com/yxt/yythmall/biz/ordorder/OrdOrderService.java @@ -35,6 +35,7 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.client.RestTemplate; +import java.text.DecimalFormat; import java.text.SimpleDateFormat; import java.util.*; @@ -415,7 +416,8 @@ public class OrdOrderService extends MybatisBaseService().eq("sid",detail.getGoodsSid())); detail.setPicUrl(fileUploadComponent.getUrlPrefix()+lpkGoods.getPicUrl()); @@ -465,8 +467,10 @@ public class OrdOrderService extends MybatisBaseService().eq("sid",sid)); - order.setPayStatus(3); - baseMapper.updateById(order); + if(order.getPayStatus()==2){ + order.setPayStatus(3); + baseMapper.updateById(order); + } return rb.success().setData(order); } diff --git a/src/main/java/com/yxt/yythmall/biz/shoppingcart/ShoppingCartService.java b/src/main/java/com/yxt/yythmall/biz/shoppingcart/ShoppingCartService.java index 25d73ed..574f4f5 100644 --- a/src/main/java/com/yxt/yythmall/biz/shoppingcart/ShoppingCartService.java +++ b/src/main/java/com/yxt/yythmall/biz/shoppingcart/ShoppingCartService.java @@ -69,7 +69,7 @@ public class ShoppingCartService extends MybatisBaseService list= baseMapper.ShoppingCartList(query.getCustomerSid(),query.getBrandId()); list.forEach(s->{ - s.setTotalPrice(String.valueOf((int)(Double.valueOf(s.getPrice())* Double.valueOf(s.getGoodsNumber())))); + s.setTotalPrice(removeZeros(String.valueOf((Double.valueOf(s.getPrice())* Double.valueOf(s.getGoodsNumber()))))); s.setIconUrl(fileUploadComponent.getUrlPrefix() +s.getIconUrl()); }); @@ -121,7 +121,21 @@ public class ShoppingCartService extends MybatisBaseService().eq("sid",vo.getCustomerSid())); vo.setRemarks("已减免附加费"); - if(weight>=20 && weight<=100){ + if(weight<=99){ + if(weight<=20){ + vo.setRemarks("不足20斤,请继续选菜"); + }else{ + double a =1.1; + double d=Double.valueOf(vo.getTotalPrice()); + double t=Double.valueOf(vo.getTotalPrice())*a; + BigDecimal bg = new BigDecimal(t); + vo.setTotalPrice(String.valueOf(bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue())); +// String c =String.valueOf(Double.valueOf(vo.getTotalPrice())-d); + double f=Double.valueOf(vo.getTotalPrice())-d; + BigDecimal bgd = new BigDecimal(f); + String c =String.valueOf(bgd.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue()); + vo.setRemarks("包含附加费"+removeZeros(c)+"元"); + } // if(weight==20){ // if(lpkCustomer.getIsPurchase().equals("1")){ // double a =0.5; @@ -152,17 +166,8 @@ public class ShoppingCartService extends MybatisBaseService=101 && weight<=200){ + + }else if(weight>=100 && weight<=199){ double a =1.05; double d=Double.valueOf(vo.getTotalPrice()); double t=Double.valueOf(vo.getTotalPrice())*a;