202506211807
This commit is contained in:
parent
395170f9b4
commit
cf1bf2609d
|
|
@ -22,6 +22,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.math.RoundingMode;
|
||||
import java.text.DateFormat;
|
||||
import java.time.LocalDate;
|
||||
import java.util.*;
|
||||
|
|
@ -4582,18 +4583,25 @@ public AjaxResult createServiceOrder(@RequestBody Map<String, Object> params, Ht
|
|||
totalAmount = totalAmount.add(itemPrice);
|
||||
|
||||
// 判断商品类型并创建相应订单
|
||||
BigDecimal DeductionPrice = new BigDecimal("0");
|
||||
if (serviceGoods.getType() == 2) {
|
||||
// 创建服务订单
|
||||
String coupon_id = orderParams.get("coupon_id") != null ? orderParams.get("coupon_id").toString() : "";
|
||||
CouponUser coupon=null;
|
||||
if (coupon_id!=null){
|
||||
CouponUser coupon = couponUserService.selectCouponUserById(Long.valueOf(coupon_id));
|
||||
coupon = couponUserService.selectCouponUserById(Long.valueOf(coupon_id));
|
||||
if (coupon==null){
|
||||
return AppletControllerUtil.appletWarning("优惠券不存在");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (coupon != null) {
|
||||
DeductionPrice= new BigDecimal(coupon.getCouponPrice()).divide(new BigDecimal(params.size()),2, RoundingMode.HALF_UP);
|
||||
}
|
||||
if (coupon != null) {
|
||||
coupon.setStatus(2L);
|
||||
}
|
||||
//coupon.setUseTime(new Date().getTime());
|
||||
couponUserService.updateCouponUser(coupon) ;
|
||||
// 创建商品订单
|
||||
GoodsOrder goodsOrder = new GoodsOrder();
|
||||
goodsOrder.setType(2);
|
||||
|
|
@ -4608,7 +4616,7 @@ public AjaxResult createServiceOrder(@RequestBody Map<String, Object> params, Ht
|
|||
goodsOrder.setTotalPrice(itemPrice);
|
||||
goodsOrder.setGoodPrice(serviceGoods.getPrice());
|
||||
goodsOrder.setPayPrice(itemPrice);
|
||||
goodsOrder.setDeduction(new BigDecimal(0));
|
||||
goodsOrder.setDeduction(DeductionPrice);
|
||||
goodsOrder.setStatus(1L); // 待支付状态
|
||||
goodsOrder.setAddressId(addressId);
|
||||
goodsOrder.setSku(sku);
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue