| | |
| | | |
| | | //获取折扣----- |
| | | Double zk = zk = 1.0; |
| | | //验证商品是否只购买了一次 |
| | | checkBuyOnce(car, info.getId()); |
| | | |
| | | SysOrder order = new SysOrder(); |
| | | SysUsers user = (SysUsers) WebUtil.getSession().getAttribute(MatrixConstance.LOGIN_KEY); |
| | |
| | | int count = 0; |
| | | // 设置订单条目 |
| | | for (ShoppingCarItem carItem : car.getCarItems()) { |
| | | // 检测最大销售数量 |
| | | checkIsArrivedMax(carItem); |
| | | |
| | | SysOrderItem orderItem = new SysOrderItem(); |
| | | orderItem.setOrderId(order.getId()); |
| | | orderItem.setCount(carItem.getCount()); |
| | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 验证商品是否购买过一次 |
| | | * |
| | | * @Title: checkBuyOnce @author:jyy @param car void 返回类型 @date |
| | | * 2016年9月22日 上午10:05:33 @throws |
| | | */ |
| | | private void checkBuyOnce(ShoppingCarItemsVo car, Long vipId) { |
| | | for (ShoppingCarItem carItem : car.getCarItems()) { |
| | | if (shoppingGoodsDao.selectBuyCount(carItem.getGoodsId(), vipId) > 0) { |
| | | ShoppingGoods goods = shoppingGoodsDao.selectById(carItem.getGoodsId()); |
| | | throw new GlobleException(goods.getName() + "只能购买一次!"); |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * jyy 收款 |
| | |
| | | taocanProjUse.setIsCourse(taocanShoppingGoods.getIsCourse()); |
| | | taocanProjUse.setIsInfinite(taocanShoppingGoods.getIsInfinite()); |
| | | // 赠送和打折后金额为0的都视为赠送项目 |
| | | if (sysOrderItem.getIsFree().equals(Dictionary.FLAG_NO) && sysOrderItem.getZkPrice() > 0) { |
| | | if (sysOrderItem.getIsFree().equals(Dictionary.FLAG_NO) && sysOrderItem.getZkPrice() > 0 && !isGiftMoneyPay(order)) { |
| | | taocanProjUse.setSource(Dictionary.TAOCAN_SOURCE_GM); |
| | | } else { |
| | | taocanProjUse.setSource(Dictionary.TAOCAN_SOURCE_ZS); |
| | |
| | | |
| | | |
| | | puse.setProjName(sysOrderItem.getShoppingGoods().getName()); |
| | | |
| | | |
| | | // 赠送和打折后金额为0的都视为赠送项目 |
| | | if (sysOrderItem.getIsFree().equals(Dictionary.FLAG_NO) && sysOrderItem.getZkPrice() > 0) { |
| | | if (sysOrderItem.getIsFree().equals(Dictionary.FLAG_NO) && sysOrderItem.getZkPrice() > 0 && !isGiftMoneyPay(order)) { |
| | | puse.setSource(Dictionary.TAOCAN_SOURCE_GM); |
| | | puse.setPrice(sysOrderItem.getZkPrice()); |
| | | } else { |
| | |
| | | sysProjUseDao.insert(puse); |
| | | } |
| | | |
| | | /** |
| | | * 全是赠送金额,且配置了赠送金额购买计算为赠送 |
| | | * @param order |
| | | * @return |
| | | */ |
| | | private boolean isGiftMoneyPay(SysOrder order) { |
| | | BusParameterSettings giftiIsfree = busParameterSettingsDao.selectCompanyParamByCode(AppConstance.SHOP_MANAGE_GIFTISFREE, order.getCompanyId()); |
| | | if(giftiIsfree.getParamValue().equals("是")){ |
| | | return order.getFlows().stream().allMatch(item -> SysOrderFlow.IS_GIFT_Y.equals(item.getIsGift()) |
| | | && item.getAmount().doubleValue() >0D); |
| | | }else{ |
| | | return false; |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 会员卡充值 |