| | |
| | | import com.google.common.collect.Lists; |
| | | import com.matrix.core.constance.MatrixConstance; |
| | | import com.matrix.core.exception.GlobleException; |
| | | import com.matrix.core.tools.DateUtil; |
| | | import com.matrix.core.tools.LogUtil; |
| | | import com.matrix.core.tools.StringUtils; |
| | | import com.matrix.core.tools.WebUtil; |
| | |
| | | import com.matrix.system.common.dao.BusParameterSettingsDao; |
| | | import com.matrix.system.common.service.OperationLogService; |
| | | import com.matrix.system.constance.Dictionary; |
| | | import com.matrix.system.enums.BooleanEnum; |
| | | import com.matrix.system.enums.OperationButtonEnum; |
| | | import com.matrix.system.enums.OperationFunctionEnum; |
| | | import com.matrix.system.hive.bean.*; |
| | |
| | | import com.matrix.system.hive.plugin.util.CollectionUtils; |
| | | import com.matrix.system.hive.plugin.util.MoneyUtil; |
| | | import com.matrix.system.hive.pojo.CzXkVo; |
| | | import com.matrix.system.hive.service.*; |
| | | import com.matrix.system.hive.service.CodeService; |
| | | import com.matrix.system.hive.service.MoneyCardUseService; |
| | | import com.matrix.system.hive.service.SysInstoreInfoService; |
| | | import com.matrix.system.hive.service.SysProjUseService; |
| | | import com.matrix.system.score.constant.ScoreSettingConstant; |
| | | import com.matrix.system.score.entity.ScoreVipDetail; |
| | | import com.matrix.system.score.service.ScoreVipDetailService; |
| | |
| | | */ |
| | | 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("无效的储值卡支付方式"); |
| | |
| | | public void addOutStore(SysOrder order) { |
| | | |
| | | BusParameterSettings manageStockSetting = busParameterSettingsDao.selectCompanyParamByCode(AppConstance.WAREHOUSE_MANAGE_STOCK, order.getCompanyId()); |
| | | if (AppConstance.IS_Y.equals(manageStockSetting.getParamValue())) { |
| | | // if (AppConstance.IS_Y.equals(manageStockSetting.getParamValue())) { |
| | | if (BooleanEnum.TRUE.getValue() == manageStockSetting.getIntParamValue()) { |
| | | |
| | | List<SysOutStoreItem> storeItemList = new ArrayList<>(); |
| | | |
| | |
| | | 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); |
| | | } |