| | |
| | | if (!Dictionary.ORDER_STATU_DFK.equals(pageOrder.getStatu())) { |
| | | throw new GlobleException("该订单已经收过款,请刷新页面再试!"); |
| | | } |
| | | |
| | | //交易业绩设置是否合理 |
| | | |
| | | checkAchieveIsOk(pageOrder); |
| | | |
| | | |
| | | // 更新收款时间 |
| | | pageOrder.setPayTime(new Date()); |
| | | pageOrder.setStatu(Dictionary.ORDER_STATU_YFK); |
| | |
| | | } |
| | | |
| | | /** |
| | | * 交易业绩设置是否合理 |
| | | * @param pageOrder |
| | | */ |
| | | private void checkAchieveIsOk(SysOrder pageOrder) { |
| | | double huakouSum = pageOrder.getItems().stream() |
| | | .mapToDouble( |
| | | item -> |
| | | item.getAchieveList().stream() |
| | | .filter(achieveNew -> "划扣".equals(achieveNew.getPayMethod())) |
| | | .mapToDouble(achieve -> achieve.getGoodsCash()).sum() |
| | | ).sum(); |
| | | |
| | | double czkPay= pageOrder.getFlows().stream() |
| | | .filter(sysOrderFlow -> "储值卡".equals(sysOrderFlow.getPayMethod())) |
| | | .mapToDouble(sysOrderFlow ->sysOrderFlow.getAmount().doubleValue()).sum(); |
| | | |
| | | if(czkPay!=huakouSum){ |
| | | throw new GlobleException("划扣业绩不等于储值卡扣款金额,请修改业绩设置!"); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 设置会员消费积分 |
| | | * @param pageOrder |
| | | */ |
| | |
| | | &&StringUtils.isNotBlank(cashConsumption.getParamValue())){ |
| | | |
| | | BigDecimal scoreSetting0 = new BigDecimal(cashConsumption.getParamValue()); |
| | | cashScore[0]= cashPayAmount.divide(scoreSetting0).intValue(); |
| | | if(scoreSetting0.compareTo(BigDecimal.ZERO)>0) { |
| | | cashScore[0] = cashPayAmount.divide(scoreSetting0).intValue(); |
| | | } |
| | | |
| | | if(StringUtils.isNotBlank(cashConsumption.getParamValue1())){ |
| | | BigDecimal scoreSetting1 = new BigDecimal(cashConsumption.getParamValue1()); |
| | | cashScore[1]= cashPayAmount.divide(scoreSetting1).intValue(); |
| | | if(scoreSetting1.compareTo(BigDecimal.ZERO)>0){ |
| | | cashScore[1]= cashPayAmount.divide(scoreSetting1).intValue(); |
| | | } |
| | | |
| | | } |
| | | |
| | | if(StringUtils.isNotBlank(cashConsumption.getParamValue2())){ |
| | | BigDecimal scoreSetting2 = new BigDecimal(cashConsumption.getParamValue2()); |
| | | cashScore[2]= cashPayAmount.divide(scoreSetting2).intValue(); |
| | | if(scoreSetting2.compareTo(BigDecimal.ZERO)>0){ |
| | | cashScore[2]= cashPayAmount.divide(scoreSetting2).intValue(); |
| | | } |
| | | |
| | | } |
| | | } |
| | | |
| | |
| | | &&StringUtils.isNotBlank(principalBalanceConsumption.getParamValue())){ |
| | | |
| | | BigDecimal scoreSetting0 = new BigDecimal(principalBalanceConsumption.getParamValue()); |
| | | cardScore[0]= cardPayAmount.divide(scoreSetting0).intValue(); |
| | | if(scoreSetting0.compareTo(BigDecimal.ZERO)>0) { |
| | | cardScore[0] = cardPayAmount.divide(scoreSetting0).intValue(); |
| | | } |
| | | |
| | | if(StringUtils.isNotBlank(principalBalanceConsumption.getParamValue1())){ |
| | | BigDecimal scoreSetting1 = new BigDecimal(principalBalanceConsumption.getParamValue1()); |
| | | cardScore[1]= cardPayAmount.divide(scoreSetting1).intValue(); |
| | | if(scoreSetting1.compareTo(BigDecimal.ZERO)>0) { |
| | | cardScore[1] = cardPayAmount.divide(scoreSetting1).intValue(); |
| | | } |
| | | } |
| | | |
| | | if(StringUtils.isNotBlank(principalBalanceConsumption.getParamValue2())){ |
| | | BigDecimal scoreSetting2 = new BigDecimal(principalBalanceConsumption.getParamValue2()); |
| | | cardScore[2]= cardPayAmount.divide(scoreSetting2).intValue(); |
| | | if(scoreSetting2.compareTo(BigDecimal.ZERO)>0) { |
| | | cardScore[2] = cardPayAmount.divide(scoreSetting2).intValue(); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | &&StringUtils.isNotBlank(bonusBalanceConsumption.getParamValue())){ |
| | | |
| | | BigDecimal scoreSetting0 = new BigDecimal(bonusBalanceConsumption.getParamValue()); |
| | | giftScore[0]= giftPayAmount.divide(scoreSetting0).intValue(); |
| | | if(scoreSetting0.compareTo(BigDecimal.ZERO)>0) { |
| | | giftScore[0] = giftPayAmount.divide(scoreSetting0).intValue(); |
| | | } |
| | | |
| | | if(StringUtils.isNotBlank(bonusBalanceConsumption.getParamValue1())){ |
| | | BigDecimal scoreSetting1 = new BigDecimal(bonusBalanceConsumption.getParamValue1()); |
| | | giftScore[1]= giftPayAmount.divide(scoreSetting1).intValue(); |
| | | if(scoreSetting1.compareTo(BigDecimal.ZERO)>0) { |
| | | giftScore[1] = giftPayAmount.divide(scoreSetting1).intValue(); |
| | | } |
| | | } |
| | | |
| | | if(StringUtils.isNotBlank(bonusBalanceConsumption.getParamValue2())){ |
| | | BigDecimal scoreSetting2 = new BigDecimal(bonusBalanceConsumption.getParamValue2()); |
| | | giftScore[2]= giftPayAmount.divide(scoreSetting2).intValue(); |
| | | if(scoreSetting2.compareTo(BigDecimal.ZERO)>0) { |
| | | giftScore[2] = giftPayAmount.divide(scoreSetting2).intValue(); |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | } else { |
| | | puse.setPrice(goodsAssemble.getPrice() * zk); |
| | | } |
| | | puse.setBalance(MoneyUtil.mul(puse.getPrice(), Double.valueOf(puse.getSurplusCount()))); |
| | | |
| | | // 赠送和打折后金额为0的都视为赠送项目 |
| | | if (sysOrderItem.getIsFree().equals(Dictionary.FLAG_NO) && sysOrderItem.getZkPrice() > 0) { |
| | | puse.setSource(Dictionary.TAOCAN_SOURCE_GM); |
| | | } else { |
| | | |
| | | puse.setSource(Dictionary.TAOCAN_SOURCE_ZS); |
| | | //赠送项目是否计算消耗业绩否则 赠送产品按原价计算消耗 |
| | | boolean zsConsumeAchieve = projServicesService.skipServiceOrderStep(Dictionary.ZS_CONSUME_ACHIEVE); |
| | | if(zsConsumeAchieve){ |
| | | if (taocanId == null) { |
| | | puse.setPrice(goodsAssemble.getShoppingGoods().getPrice() ); |
| | | } else { |
| | | puse.setPrice(goodsAssemble.getPrice()); |
| | | } |
| | | }else{ |
| | | puse.setPrice(0D); |
| | | } |
| | | |
| | | |
| | | } |
| | | puse.setBalance(MoneyUtil.mul(puse.getPrice(), Double.valueOf(puse.getSurplusCount()))); |
| | | puse.setFailTime(failTime); |
| | | sysProjUseDao.insert(puse); |
| | | return puse; |
| | |
| | | sysProjUseDao.update(taocanProjUse); |
| | | } |
| | | |
| | | @Autowired |
| | | private SysProjServicesService projServicesService; |
| | | |
| | | /** |
| | | * 根据订单创建用户项目使用情况 |
| | | * |
| | |
| | | puse.setVipId(order.getVipId()); |
| | | puse.setStatus(Dictionary.TAOCAN_STATUS_YX); |
| | | puse.setType(Dictionary.SHOPPING_GOODS_TYPE_XM); |
| | | puse.setBalance(sysOrderItem.getZkPrice()); |
| | | puse.setPrice(sysOrderItem.getZkPrice()); |
| | | |
| | | |
| | | puse.setProjName(sysOrderItem.getShoppingGoods().getName()); |
| | | // 赠送和打折后金额为0的都视为赠送项目 |
| | | if (sysOrderItem.getIsFree().equals(Dictionary.FLAG_NO) && sysOrderItem.getZkPrice() > 0) { |
| | | puse.setSource(Dictionary.TAOCAN_SOURCE_GM); |
| | | puse.setPrice(sysOrderItem.getZkPrice()); |
| | | } else { |
| | | puse.setSource(Dictionary.TAOCAN_SOURCE_ZS); |
| | | //赠送项目是否计算消耗业绩否则 赠送产品按原价计算消耗 |
| | | boolean zsConsumeAchieve = projServicesService.skipServiceOrderStep(Dictionary.ZS_CONSUME_ACHIEVE); |
| | | if(zsConsumeAchieve){ |
| | | puse.setPrice(sysOrderItem.getShoppingGoods().getSealPice()); |
| | | }else{ |
| | | puse.setPrice(0D); |
| | | } |
| | | |
| | | |
| | | } |
| | | // 设置失效时间 |
| | | Date invalidTime = shoppingGoodsService.calInvalidTime(sysOrderItem.getShoppingGoods(), 1, null); |
| | | puse.setFailTime(invalidTime); |
| | | puse.setBalance(sysOrderItem.getShoppingGoods().getSealPice()*puse.getSurplusCount()); |
| | | sysProjUseDao.insert(puse); |
| | | } |
| | | |
| | |
| | | orderItem.setPrice(czVo.getBjmoney()); |
| | | orderItem.setStatus(Dictionary.ORDER_STATU_YFK); |
| | | orderItem.setAchieveList(czVo.getAchaeveList()); |
| | | orderItem.setShoppingGoods(shoppingGoods); |
| | | orderItemDao.insert(orderItem); |
| | | List<SysOrderItem> items = new ArrayList<>(); |
| | | items.add(orderItem); |
| | |
| | | moneyCardUseFlowDao.insert(moneyCardUseFlow); |
| | | |
| | | order.setFlows(czVo.getFlows()); |
| | | |
| | | addOrderFlow(order); |
| | | |
| | | // 添加员工业绩 |
| | | achieveNewService.addAchaeveByOrder(order); |
| | | |
| | | return order; |
| | | |
| | | } |