| | |
| | | */ |
| | | private boolean isGiftMoneyPay(SysOrder order) { |
| | | BusParameterSettings giftiIsfree = busParameterSettingsDao.selectCompanyParamByCode(AppConstance.SHOP_MANAGE_GIFTISFREE, order.getCompanyId()); |
| | | if (giftiIsfree.getParamValue().equals("是")) { |
| | | if (BooleanEnum.TRUE.getValue() == giftiIsfree.getIntParamValue()) { |
| | | return order.getFlows().stream().allMatch(item -> SysOrderFlow.IS_GIFT_Y.equals(item.getIsGift()) |
| | | && item.getAmount().doubleValue() > 0D); |
| | | } else { |
| | |
| | | /** |
| | | * 储值卡退款 |
| | | * @param order |
| | | * @param isWholeOrder 是否整个订单退款 |
| | | */ |
| | | public void returnMoneyCardPay(SysOrder order) { |
| | | public void returnMoneyCardPay(SysOrder order, boolean isWholeOrder) { |
| | | SysUsers user = (SysUsers) WebUtil.getSession().getAttribute(MatrixConstance.LOGIN_KEY); |
| | | List<MoneyCardOperationDto> moneyCardOperationDtos = Lists.newArrayList(); |
| | | |
| | | List<SysOrderFlow> flows = sysOrderFlowDao.selectByOrderId(order.getId()); |
| | | List<SysOrderFlow> flows = null; |
| | | if (isWholeOrder) { |
| | | flows = sysOrderFlowDao.selectByOrderId(order.getId()); |
| | | } else { |
| | | flows = order.getFlows(); |
| | | } |
| | | |
| | | // 非现金收款退回扣卡余额 |
| | | for (SysOrderFlow flow : flows) { |
| | | if (SysOrderFlow.PAY_METHOD_CARD.equals(flow.getPayMethod())) { |
| | |
| | | dto.setCarUseId(flow.getCardId()); |
| | | dto.setType(MoneyCardUseFlow.USE_TYPE_ORDRE_CANCEL); |
| | | if (SysOrderFlow.IS_GIFT_Y.equals(flow.getIsGift())) { |
| | | dto.setGiftMoney(flow.getAmount().doubleValue()); |
| | | dto.setGiftMoney(flow.getAmount().abs().doubleValue()); |
| | | } else { |
| | | dto.setRealMoney(flow.getAmount().doubleValue()); |
| | | dto.setRealMoney(flow.getAmount().abs().doubleValue()); |
| | | } |
| | | dto.setUpdateUser(user.getSuId()); |
| | | |
| | | // 用于通过校验 |
| | | dto.setOrderItemId(-1L); |
| | | moneyCardOperationDtos.add(dto); |
| | | } else { |
| | | throw new GlobleException("无效的储值卡支付方式"); |
| | |
| | | for (SysOrderItem item : sysOrder.getItems()) { |
| | | ShoppingGoods shoppingGoods = shoppingGoodsDao.selectById(item.getGoodsId()); |
| | | item.setType(shoppingGoods.getGoodType()); |
| | | if (item.getZkPrice() == null) { |
| | | item.setZkPrice(shoppingGoods.getSealPice()); |
| | | } |
| | | |
| | | if (item.getZkPrice() == 0) { |
| | | item.setIsFree(Dictionary.FLAG_YES); |
| | | } |
| | | Double itemZkTotal = MoneyUtil.mul(item.getZkPrice(), Double.valueOf(item.getCount())); |
| | | zkTotal = MoneyUtil.add(zkTotal, itemZkTotal); |
| | | |
| | | if (item.getPrice() == null) { |
| | | item.setPrice(shoppingGoods.getSealPice()); |
| | | } |
| | | item.setStatus(Dictionary.ORDER_STATU_DFK); |
| | | item.setRefundCount(0); |
| | | } |