diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/impl/OilOrderServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/impl/OilOrderServiceImpl.java index d4a711b5d..a06a6aa5a 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/impl/OilOrderServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/order/service/impl/OilOrderServiceImpl.java @@ -189,42 +189,44 @@ public class OilOrderServiceImpl extends ServiceImpl i AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo(); List 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 activeDiscountChildList = oneById.getActiveDiscountChildList(); - for (ActiveDiscountChild activeDiscountChild : activeDiscountChildList) { - if (activeDiscountChild.getAmount()<=oilOrderVo.getOrderAmount()){ + if (oilOrderVo.getActiveType().equals("1")) { + ActiveFullminusVO oneById = activeFullminusService.getOneById(oilOrderVo.getActiveId()); + List 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 activeDiscountChildList = oneById.getActiveDiscountChildList(); - for (ActiveDiscountChild activeDiscountChild : activeDiscountChildList) { - if (activeDiscountChild.getAmount()<=oilOrderVo.getOrderAmount()){ + if (oilOrderVo.getActiveType().equals("2")) { + ActiveDiscountVO oneById = activeDiscountService.getOneById(oilOrderVo.getActiveId()); + List 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 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 i String balanceAmountSale = map.get("balanceAmountSale"); String oilCardAmountSale = map.get("oilCardAmountSale"); Integer tankId = Integer.valueOf(map.get("tankId")); +// 是否登录 + String ifLogin = map.get("ifLogin"); Map applet = new HashMap<>(); applet.put("success","");