| | |
| | | List<ShoppingGoodsAssemble> assembleList = shoppingGoodsAssembleDao.selectGoodsByShoppingGoodsIdAndType(sysOrderItem.getGoodsId(), ShoppingGoods.SHOPPING_GOODS_TYPE_XM); |
| | | assembleList.forEach(item -> { |
| | | //TODO 补综合卡逻辑 |
| | | createProjuseByAssemble(order, sysOrderItem, item, null, null); |
| | | createProjuseByAssemble(order, sysOrderItem, item, null, null,null); |
| | | }); |
| | | |
| | | //处理综合卡中包含的套餐 |
| | |
| | | * 通过组合关系创建用户项目余次 |
| | | */ |
| | | private SysProjUse createProjuseByAssemble(SysOrder order, SysOrderItem sysOrderItem, |
| | | ShoppingGoodsAssemble goodsAssemble, Long taocanId, Date failTime) { |
| | | ShoppingGoodsAssemble goodsAssemble, Long taocanId, Date failTime,String source) { |
| | | //计算折扣 |
| | | Double zk = sysOrderItem.getZkPrice() / sysOrderItem.getPrice(); |
| | | |
| | |
| | | puse.setStatus(Dictionary.TAOCAN_STATUS_YX); |
| | | puse.setTaocanId(taocanId); |
| | | puse.setType(Dictionary.SHOPPING_GOODS_TYPE_XM); |
| | | puse.setSource(source); |
| | | |
| | | if (taocanId == null) { |
| | | puse.setPrice(goodsAssemble.getShoppingGoods().getPrice() * zk); |
| | | } else { |
| | | puse.setPrice(goodsAssemble.getPrice() * zk); |
| | | } |
| | | |
| | | // 赠送和打折后金额为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(sysOrderItem.getPrice()>0){ |
| | | |
| | | |
| | | |
| | | |
| | | }else{ |
| | | //等于0取原价 |
| | | if (taocanId == null) { |
| | | puse.setPrice(goodsAssemble.getShoppingGoods().getPrice() ); |
| | | } else { |
| | | puse.setPrice(goodsAssemble.getPrice()); |
| | | } |
| | | //赠送项目是否计算消耗业绩否则 赠送产品按原价计算消耗 |
| | | boolean zsConsumeAchieve = projServicesService.skipServiceOrderStep(Dictionary.ZS_CONSUME_ACHIEVE); |
| | | if(zsConsumeAchieve){ |
| | | if(sysOrderItem.getPrice()<=0){ |
| | | //等于0取原价 |
| | | if (taocanId == null) { |
| | | puse.setPrice(goodsAssemble.getShoppingGoods().getPrice() ); |
| | | } else { |
| | | puse.setPrice(goodsAssemble.getPrice()); |
| | | } |
| | | |
| | | }else{ |
| | | puse.setPrice(0D); |
| | | } |
| | | |
| | | |
| | | }else{ |
| | | puse.setPrice(0D); |
| | | } |
| | | |
| | | puse.setBalance(MoneyUtil.mul(puse.getPrice(), Double.valueOf(puse.getSurplusCount()))); |
| | | puse.setFailTime(failTime); |
| | | sysProjUseDao.insert(puse); |
| | |
| | | //创建套餐绑定的项目 |
| | | List<ShoppingGoodsAssemble> assembleList = shoppingGoodsAssembleDao.selectGoodsByShoppingGoodsIdAndType(projId, ShoppingGoods.SHOPPING_GOODS_TYPE_XM); |
| | | for (ShoppingGoodsAssemble assemble : assembleList) { |
| | | SysProjUse tempUse = createProjuseByAssemble(order, sysOrderItem, assemble, taocanProjUse.getId(),taocanProjUse.getFailTime()); |
| | | SysProjUse tempUse = createProjuseByAssemble(order, sysOrderItem, assemble, taocanProjUse.getId(),taocanProjUse.getFailTime(),taocanProjUse.getSource()); |
| | | sumBanance += tempUse.getBalance(); |
| | | surplusCount += tempUse.getSurplusCount(); |
| | | } |