Browse Source

新人购买修改

master
wangpengfei 1 year ago
parent
commit
6ebc9bcfca
  1. 70
      src/main/java/com/yxt/yythmall/biz/shoppingcart/ShoppingCartService.java
  2. 7
      src/main/java/com/yxt/yythmall/biz/vegetablecellar/VegetableCellarService.java

70
src/main/java/com/yxt/yythmall/biz/shoppingcart/ShoppingCartService.java

@ -121,37 +121,47 @@ 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<=100){ if(weight>=20 && weight<=100){
if(weight==20){ // if(weight==20){
if(lpkCustomer.getIsPurchase().equals("1")){ // if(lpkCustomer.getIsPurchase().equals("1")){
double a =0.5; // double a =0.5;
double t=Double.valueOf(vo.getTotalPrice())*a; // double t=Double.valueOf(vo.getTotalPrice())*a;
BigDecimal bg = new BigDecimal(t); // BigDecimal bg = new BigDecimal(t);
vo.setTotalPrice(String.valueOf(bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue())); // vo.setTotalPrice(String.valueOf(bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue()));
vo.setRemarks("已享受新人专享5折优惠"); // vo.setRemarks("已享受新人专享5折优惠");
}else{ // }else{
double a =1.1; // double a =1.1;
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;
BigDecimal bg = new BigDecimal(t); // BigDecimal bg = new BigDecimal(t);
vo.setTotalPrice(String.valueOf(bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue())); // vo.setTotalPrice(String.valueOf(bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue()));
double f=Double.valueOf(vo.getTotalPrice())-d; // double f=Double.valueOf(vo.getTotalPrice())-d;
BigDecimal bgd = new BigDecimal(f); // BigDecimal bgd = new BigDecimal(f);
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)+"元");
} // }
}else{ // }else{
double a =1.1; // double a =1.1;
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;
BigDecimal bg = new BigDecimal(t); // BigDecimal bg = new BigDecimal(t);
vo.setTotalPrice(String.valueOf(bg.setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue())); // 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)+"元");
// }
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); // String c =String.valueOf(Double.valueOf(vo.getTotalPrice())-d);
double f=Double.valueOf(vo.getTotalPrice())-d; double f=Double.valueOf(vo.getTotalPrice())-d;
BigDecimal bgd = new BigDecimal(f); BigDecimal bgd = new BigDecimal(f);
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)+"元");
}
}else if(weight>=101 && weight<=200){ }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());

7
src/main/java/com/yxt/yythmall/biz/vegetablecellar/VegetableCellarService.java

@ -8,6 +8,7 @@ import com.yxt.common.base.utils.StringUtils;
import com.yxt.common.core.query.PagerQuery; import com.yxt.common.core.query.PagerQuery;
import com.yxt.common.core.result.ResultBean; import com.yxt.common.core.result.ResultBean;
import com.yxt.common.core.vo.PagerVo; import com.yxt.common.core.vo.PagerVo;
import com.yxt.yythmall.api.lpkcustomer.LpkCustomer;
import com.yxt.yythmall.api.lpkgoods.LpkGoods; import com.yxt.yythmall.api.lpkgoods.LpkGoods;
import com.yxt.yythmall.api.ordorder.OrdOrder; import com.yxt.yythmall.api.ordorder.OrdOrder;
import com.yxt.yythmall.api.ordorderdetails.OrdOrderDetail; import com.yxt.yythmall.api.ordorderdetails.OrdOrderDetail;
@ -16,6 +17,7 @@ import com.yxt.yythmall.api.transferrecords.TransferRecords;
import com.yxt.yythmall.api.transferrecordsgoodsdetails.TransferRecordsGoodsDetails; import com.yxt.yythmall.api.transferrecordsgoodsdetails.TransferRecordsGoodsDetails;
import com.yxt.yythmall.api.vegetablecellar.*; import com.yxt.yythmall.api.vegetablecellar.*;
import com.yxt.yythmall.biz.empcard.EmpCardService; import com.yxt.yythmall.biz.empcard.EmpCardService;
import com.yxt.yythmall.biz.lpkcustomer.LpkCustomerService;
import com.yxt.yythmall.biz.lpkgoods.LpkGoodsService; import com.yxt.yythmall.biz.lpkgoods.LpkGoodsService;
import com.yxt.yythmall.biz.ordorder.OrdOrderService; import com.yxt.yythmall.biz.ordorder.OrdOrderService;
import com.yxt.yythmall.biz.ordorderdetails.OrdOrderDetailService; import com.yxt.yythmall.biz.ordorderdetails.OrdOrderDetailService;
@ -48,6 +50,8 @@ public class VegetableCellarService extends MybatisBaseService<VegetableCellarMa
TransferRecordsGoodsDetailsService transferRecordsGoodsDetailsService; TransferRecordsGoodsDetailsService transferRecordsGoodsDetailsService;
@Autowired @Autowired
LpkGoodsService lpkGoodsService; LpkGoodsService lpkGoodsService;
@Autowired
LpkCustomerService lpkCustomerService;
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public ResultBean addGoods(String mainSid) { public ResultBean addGoods(String mainSid) {
ResultBean rb = ResultBean.fireFail(); ResultBean rb = ResultBean.fireFail();
@ -69,6 +73,9 @@ public class VegetableCellarService extends MybatisBaseService<VegetableCellarMa
baseMapper.updateById(vegetableCellar); baseMapper.updateById(vegetableCellar);
} }
} }
LpkCustomer customer=lpkCustomerService.getOne(new QueryWrapper<LpkCustomer>().eq("sid",ordOrder.getUserSid()));
customer.setIsPurchase("0");
lpkCustomerService.updateById(customer);
return rb.success().setMsg("成功"); return rb.success().setMsg("成功");
} }
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)

Loading…
Cancel
Save