This commit is contained in:
cun-nan 2024-02-20 10:54:06 +08:00
parent 87b4f3595b
commit 3b64908eb7

View File

@ -189,42 +189,44 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
List<OilOrderVo> oilOrderVos = baseMapper.selectOilOrderByOrderNo(orderNo,nowAccountInfo.getStoreId());
Double deductionAmount = 0.0;
for (OilOrderVo oilOrderVo : oilOrderVos) {
if (ObjectUtil.isNotEmpty(oilOrderVo.getActiveId()) && ObjectUtil.isNotEmpty(oilOrderVo.getActiveType())){
if (oilOrderVos.size()>0) {
for (OilOrderVo oilOrderVo : oilOrderVos) {
if (ObjectUtil.isNotEmpty(oilOrderVo.getActiveId()) && ObjectUtil.isNotEmpty(oilOrderVo.getActiveType())) {
// 满减
if (oilOrderVo.getActiveType().equals("1")){
ActiveFullminusVO oneById = activeFullminusService.getOneById(oilOrderVo.getActiveId());
List<ActiveDiscountChild> activeDiscountChildList = oneById.getActiveDiscountChildList();
for (ActiveDiscountChild activeDiscountChild : activeDiscountChildList) {
if (activeDiscountChild.getAmount()<=oilOrderVo.getOrderAmount()){
if (oilOrderVo.getActiveType().equals("1")) {
ActiveFullminusVO oneById = activeFullminusService.getOneById(oilOrderVo.getActiveId());
List<ActiveDiscountChild> activeDiscountChildList = oneById.getActiveDiscountChildList();
for (ActiveDiscountChild activeDiscountChild : activeDiscountChildList) {
if (activeDiscountChild.getAmount() <= oilOrderVo.getOrderAmount()) {
// oilOrderVo.setDeductionAmount(activeDiscountChild.getDeductionAmount());
deductionAmount += activeDiscountChild.getDeductionAmount();
break;
deductionAmount += activeDiscountChild.getDeductionAmount();
break;
}
}
}
}
// 折扣
if (oilOrderVo.getActiveType().equals("2")){
ActiveDiscountVO oneById = activeDiscountService.getOneById(oilOrderVo.getActiveId());
List<ActiveDiscountChild> activeDiscountChildList = oneById.getActiveDiscountChildList();
for (ActiveDiscountChild activeDiscountChild : activeDiscountChildList) {
if (activeDiscountChild.getAmount()<=oilOrderVo.getOrderAmount()){
if (oilOrderVo.getActiveType().equals("2")) {
ActiveDiscountVO oneById = activeDiscountService.getOneById(oilOrderVo.getActiveId());
List<ActiveDiscountChild> activeDiscountChildList = oneById.getActiveDiscountChildList();
for (ActiveDiscountChild activeDiscountChild : activeDiscountChildList) {
if (activeDiscountChild.getAmount() <= oilOrderVo.getOrderAmount()) {
// oilOrderVo.setDeductionAmount(oilOrderVo.getOrderAmount() - (oilOrderVo.getOrderAmount()*activeDiscountChild.getDiscount()));
deductionAmount += oilOrderVo.getOrderAmount() - (oilOrderVo.getOrderAmount()*activeDiscountChild.getDiscount());
break;
deductionAmount += oilOrderVo.getOrderAmount() - (oilOrderVo.getOrderAmount() * activeDiscountChild.getDiscount());
break;
}
}
}
}
}
// 优惠券
if (ObjectUtil.isNotEmpty(oilOrderVo.getCouponId())){
CardFavorableVO cardFavorableVO = cardFavorableService.selectOneById(oilOrderVo.getCouponId());
oilOrderVo.setCouponAmount(cardFavorableVO.getDiscountAmount());
}else {
oilOrderVo.setCouponAmount(0.0);
if (ObjectUtil.isNotEmpty(oilOrderVo.getCouponId())) {
CardFavorableVO cardFavorableVO = cardFavorableService.selectOneById(oilOrderVo.getCouponId());
oilOrderVo.setCouponAmount(cardFavorableVO.getDiscountAmount());
} else {
oilOrderVo.setCouponAmount(0.0);
}
}
oilOrderVos.get(0).setDeductionAmount(deductionAmount);
}
oilOrderVos.get(0).setDeductionAmount(deductionAmount);
return oilOrderVos;
}
@ -1016,7 +1018,8 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
@Override
public String addOilOrder(OilOrder oilOrder) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
// AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo1();
// 根据日期生成订单信息
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
String timestamp = dateFormat.format(new Date());
@ -1068,6 +1071,8 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
String balanceAmountSale = map.get("balanceAmountSale");
String oilCardAmountSale = map.get("oilCardAmountSale");
Integer tankId = Integer.valueOf(map.get("tankId"));
// 是否登录
String ifLogin = map.get("ifLogin");
Map<String, Object> applet = new HashMap<>();
applet.put("success","");