1/23
This commit is contained in:
@@ -266,7 +266,7 @@ public class LpkGoodsService extends MybatisBaseService<LpkGoodsMapper, LpkGoods
|
|||||||
if(l.size()==0){
|
if(l.size()==0){
|
||||||
giftBagGoodss.forEach(d->{
|
giftBagGoodss.forEach(d->{
|
||||||
// d.setIconUrl(fileUploadComponent.getUrlPrefix()+d.getIconUrl());
|
// 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{
|
}else{
|
||||||
l.forEach(s->{
|
l.forEach(s->{
|
||||||
@@ -275,11 +275,25 @@ public class LpkGoodsService extends MybatisBaseService<LpkGoodsMapper, LpkGoods
|
|||||||
d.setGoodsNumber(s.getGoodsNumber());
|
d.setGoodsNumber(s.getGoodsNumber());
|
||||||
}
|
}
|
||||||
// d.setIconUrl(fileUploadComponent.getUrlPrefix()+d.getIconUrl());
|
// 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())))));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return rb.success().setData(giftBagGoodss);
|
return rb.success().setData(giftBagGoodss);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* 去除多余.0
|
||||||
|
* @param num
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static String removeZeros(String num) {
|
||||||
|
if (num.indexOf(".") > 0) {
|
||||||
|
// 去掉多余的0
|
||||||
|
num = num.replaceAll("0+?$", "");
|
||||||
|
// 如果最后一位是. 则去掉
|
||||||
|
num = num.replaceAll("[.]$", "");
|
||||||
|
}
|
||||||
|
return num;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ import org.springframework.stereotype.Service;
|
|||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.web.client.RestTemplate;
|
import org.springframework.web.client.RestTemplate;
|
||||||
|
|
||||||
|
import java.text.DecimalFormat;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
@@ -415,7 +416,8 @@ public class OrdOrderService extends MybatisBaseService<OrdOrderMapper, OrdOrder
|
|||||||
if(StringUtils.isBlank(pagging.getMeet())){
|
if(StringUtils.isBlank(pagging.getMeet())){
|
||||||
pagging.setMeet(pagging.getTotalTee());
|
pagging.setMeet(pagging.getTotalTee());
|
||||||
}
|
}
|
||||||
pagging.setSurcharge(removeZeros(String.valueOf(Double.valueOf(pagging.getTotalTee())-Double.valueOf(pagging.getMeet()))));
|
DecimalFormat decimalFormat = new DecimalFormat("#0.00");
|
||||||
|
pagging.setSurcharge(removeZeros(String.valueOf(decimalFormat.format(Double.valueOf(pagging.getTotalTee())-Double.valueOf(pagging.getMeet())))));
|
||||||
for (OrdOrderDetail detail : details) {
|
for (OrdOrderDetail detail : details) {
|
||||||
LpkGoods lpkGoods=lpkGoodsService.getOne(new QueryWrapper<LpkGoods>().eq("sid",detail.getGoodsSid()));
|
LpkGoods lpkGoods=lpkGoodsService.getOne(new QueryWrapper<LpkGoods>().eq("sid",detail.getGoodsSid()));
|
||||||
detail.setPicUrl(fileUploadComponent.getUrlPrefix()+lpkGoods.getPicUrl());
|
detail.setPicUrl(fileUploadComponent.getUrlPrefix()+lpkGoods.getPicUrl());
|
||||||
@@ -465,8 +467,10 @@ public class OrdOrderService extends MybatisBaseService<OrdOrderMapper, OrdOrder
|
|||||||
public ResultBean changePayState(String sid) {
|
public ResultBean changePayState(String sid) {
|
||||||
ResultBean rb=new ResultBean().fail();
|
ResultBean rb=new ResultBean().fail();
|
||||||
OrdOrder order=baseMapper.selectOne(new QueryWrapper<OrdOrder>().eq("sid",sid));
|
OrdOrder order=baseMapper.selectOne(new QueryWrapper<OrdOrder>().eq("sid",sid));
|
||||||
|
if(order.getPayStatus()==2){
|
||||||
order.setPayStatus(3);
|
order.setPayStatus(3);
|
||||||
baseMapper.updateById(order);
|
baseMapper.updateById(order);
|
||||||
|
}
|
||||||
return rb.success().setData(order);
|
return rb.success().setData(order);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ public class ShoppingCartService extends MybatisBaseService<ShoppingCartMapper,
|
|||||||
ShoppingCart entity=new ShoppingCart();
|
ShoppingCart entity=new ShoppingCart();
|
||||||
List<ShoppingCartVo> list= baseMapper.ShoppingCartList(query.getCustomerSid(),query.getBrandId());
|
List<ShoppingCartVo> list= baseMapper.ShoppingCartList(query.getCustomerSid(),query.getBrandId());
|
||||||
list.forEach(s->{
|
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());
|
s.setIconUrl(fileUploadComponent.getUrlPrefix() +s.getIconUrl());
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -121,7 +121,21 @@ public class ShoppingCartService extends MybatisBaseService<ShoppingCartMapper,
|
|||||||
int weight=Integer.parseInt(vo.getTotalWeight());
|
int weight=Integer.parseInt(vo.getTotalWeight());
|
||||||
LpkCustomer lpkCustomer=lpkCustomerService.getOne(new QueryWrapper<LpkCustomer>().eq("sid",vo.getCustomerSid()));
|
LpkCustomer lpkCustomer=lpkCustomerService.getOne(new QueryWrapper<LpkCustomer>().eq("sid",vo.getCustomerSid()));
|
||||||
vo.setRemarks("已减免附加费");
|
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(weight==20){
|
||||||
// if(lpkCustomer.getIsPurchase().equals("1")){
|
// if(lpkCustomer.getIsPurchase().equals("1")){
|
||||||
// double a =0.5;
|
// double a =0.5;
|
||||||
@@ -152,17 +166,8 @@ public class ShoppingCartService extends MybatisBaseService<ShoppingCartMapper,
|
|||||||
// String c =String.valueOf(bgd.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue());
|
// String c =String.valueOf(bgd.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue());
|
||||||
// vo.setRemarks("包含附加费"+removeZeros(c)+"元");
|
// vo.setRemarks("包含附加费"+removeZeros(c)+"元");
|
||||||
// }
|
// }
|
||||||
double a =1.1;
|
|
||||||
double d=Double.valueOf(vo.getTotalPrice());
|
}else if(weight>=100 && weight<=199){
|
||||||
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)+"元");
|
|
||||||
}else if(weight>=101 && weight<=200){
|
|
||||||
double a =1.05;
|
double a =1.05;
|
||||||
double d=Double.valueOf(vo.getTotalPrice());
|
double d=Double.valueOf(vo.getTotalPrice());
|
||||||
double t=Double.valueOf(vo.getTotalPrice())*a;
|
double t=Double.valueOf(vo.getTotalPrice())*a;
|
||||||
|
|||||||
Reference in New Issue
Block a user