| | |
| | | import com.ruoyi.common.redis.service.RedisService; |
| | | import com.ruoyi.common.security.utils.CodeFactoryUtil; |
| | | import com.ruoyi.common.security.utils.SecurityUtils; |
| | | import com.ruoyi.goods.api.domain.GetLotteryEventList; |
| | | import com.ruoyi.goods.api.domain.TLotteryEvent; |
| | | import com.ruoyi.goods.api.service.LotteryEventClient; |
| | | import com.ruoyi.order.config.WxPayConfiguration; |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.math.MathContext; |
| | | import java.math.RoundingMode; |
| | | import java.text.SimpleDateFormat; |
| | | import java.time.LocalDate; |
| | |
| | | appSureOrderVo.setOrderPayMoney(orderPayMoney); |
| | | // 设置订单商品列表 |
| | | appSureOrderVo.setAppSureOrderGoodsVoList(appSureOrderGoodsVoList); |
| | | appSureOrderVo.setLotteryDraw(false); |
| | | // 返回AppPlaceOrderVo对象 |
| | | GetLotteryEventList getLotteryEventList = new GetLotteryEventList(); |
| | | getLotteryEventList.setActivityType(2); |
| | | getLotteryEventList.setUserId(SecurityUtils.getUserId()); |
| | | List<TLotteryEvent> data = lotteryEventClient.getLotteryEventList(getLotteryEventList).getData(); |
| | | if (data.size() > 0) { |
| | | BigDecimal finalOrderPayMoney = orderPayMoney; |
| | | List<TLotteryEvent> collect = data.stream().filter(s -> s.getPayMoney().compareTo(finalOrderPayMoney) <= 0).collect(Collectors.toList()); |
| | | if (collect.size() > 0) { |
| | | appSureOrderVo.setLotteryDraw(true); |
| | | appSureOrderVo.setLotteryEventId(collect.get(0).getId()); |
| | | } |
| | | } |
| | | return appSureOrderVo; |
| | | } |
| | | |
| | |
| | | appPanicBuyVo.setOrderGoodsMoney(orderGoodsMoney); |
| | | appPanicBuyVo.setOrderPayDeposit(orderPayDeposit); |
| | | appPanicBuyVo.setOrderPayMoney(orderPayMoney); |
| | | appPanicBuyVo.setLotteryDraw(false); |
| | | // 返回AppPlaceOrderVo对象 |
| | | GetLotteryEventList getLotteryEventList = new GetLotteryEventList(); |
| | | getLotteryEventList.setActivityType(2); |
| | | getLotteryEventList.setUserId(SecurityUtils.getUserId()); |
| | | List<TLotteryEvent> data = lotteryEventClient.getLotteryEventList(getLotteryEventList).getData(); |
| | | if (data.size() > 0) { |
| | | BigDecimal finalOrderPayMoney = orderPayMoney; |
| | | List<TLotteryEvent> collect = data.stream().filter(s -> s.getPayMoney().compareTo(finalOrderPayMoney) <= 0).collect(Collectors.toList()); |
| | | if (collect.size() > 0) { |
| | | appPanicBuyVo.setLotteryDraw(true); |
| | | appPanicBuyVo.setLotteryEventId(collect.get(0).getId()); |
| | | } |
| | | } |
| | | return appPanicBuyVo; |
| | | } |
| | | |
| | |
| | | appMemberGoodsTypeDto.setUserId(userId); |
| | | appMemberGoodsTypeDto.setGoodsTypeSet(goodsTypeSet); |
| | | remoteMemberService.updateMemberGoodsType(appMemberGoodsTypeDto); |
| | | } |
| | | |
| | | appPlaceOrderVo.setLotteryDraw(false); |
| | | // 返回AppPlaceOrderVo对象 |
| | | GetLotteryEventList getLotteryEventList = new GetLotteryEventList(); |
| | | getLotteryEventList.setActivityType(2); |
| | | getLotteryEventList.setUserId(SecurityUtils.getUserId()); |
| | | List<TLotteryEvent> data = lotteryEventClient.getLotteryEventList(getLotteryEventList).getData(); |
| | | if (data.size() > 0) { |
| | | BigDecimal finalOrderPayMoney = orderPayMoney; |
| | | List<TLotteryEvent> collect = data.stream().filter(s -> s.getPayMoney().compareTo(finalOrderPayMoney) <= 0).collect(Collectors.toList()); |
| | | if (collect.size() > 0) { |
| | | appPlaceOrderVo.setLotteryDraw(true); |
| | | appPlaceOrderVo.setLotteryEventId(collect.get(0).getId()); |
| | | } |
| | | } |
| | | return appPlaceOrderVo; |
| | | } |
| | |
| | | remoteActivityService.addActivityRecord(activityRecord); |
| | | //扣除redis库存 |
| | | redisService.setCacheObject(SecurityConstant.ACTIVITY_GOODS + "-" + activityId + "-" + goodsId, surpNum - buyNum); |
| | | appPlaceOrderVo.setLotteryDraw(false); |
| | | // 返回AppPlaceOrderVo对象 |
| | | GetLotteryEventList getLotteryEventList = new GetLotteryEventList(); |
| | | getLotteryEventList.setActivityType(2); |
| | | getLotteryEventList.setUserId(SecurityUtils.getUserId()); |
| | | List<TLotteryEvent> data = lotteryEventClient.getLotteryEventList(getLotteryEventList).getData(); |
| | | if (data.size() > 0) { |
| | | BigDecimal finalOrderPayMoney = orderPayMoney; |
| | | List<TLotteryEvent> collect = data.stream().filter(s -> s.getPayMoney().compareTo(finalOrderPayMoney) <= 0).collect(Collectors.toList()); |
| | | if (collect.size() > 0) { |
| | | appPlaceOrderVo.setLotteryDraw(true); |
| | | appPlaceOrderVo.setLotteryEventId(collect.get(0).getId()); |
| | | } |
| | | } |
| | | } catch (Exception e){ |
| | | log.error("活动订单购买失败:"+e.getMessage()); |
| | | throw new ServiceException(e.getMessage()); |
| | |
| | | appPlaceOrderVo.setPrepayId(orderPayment.getPrepayId()); |
| | | appPlaceOrderVo.setLotteryDraw(false); |
| | | // 返回AppPlaceOrderVo对象 |
| | | List<TLotteryEvent> data = lotteryEventClient.getLotteryEventList(2).getData(); |
| | | GetLotteryEventList getLotteryEventList = new GetLotteryEventList(); |
| | | getLotteryEventList.setActivityType(2); |
| | | getLotteryEventList.setUserId(SecurityUtils.getUserId()); |
| | | List<TLotteryEvent> data = lotteryEventClient.getLotteryEventList(getLotteryEventList).getData(); |
| | | if (data.size() > 0) { |
| | | List<TLotteryEvent> collect = data.stream().filter(s -> s.getPayMoney().compareTo(order.getPayMoney()) >= 0).collect(Collectors.toList()); |
| | | List<TLotteryEvent> collect = data.stream().filter(s -> s.getPayMoney().compareTo(order.getPayMoney()) <= 0).collect(Collectors.toList()); |
| | | if (collect.size() > 0) { |
| | | appPlaceOrderVo.setLotteryDraw(true); |
| | | appPlaceOrderVo.setLotteryEventId(collect.get(0).getId()); |
| | |
| | | merVerifyOrderVo.setReceiveMoney(BigDecimal.ZERO); |
| | | } |
| | | } |
| | | if(null == merVerifyOrderVo.getRealReceiveMoney()){ |
| | | merVerifyOrderVo.setRealReceiveMoney(BigDecimal.ZERO); |
| | | } |
| | | if(null == merVerifyOrderVo.getReceiveMoney()){ |
| | | merVerifyOrderVo.setReceiveMoney(BigDecimal.ZERO); |
| | | } |
| | | merVerifyOrderVo.setUnReceiveMoney(merVerifyOrderVo.getRealReceiveMoney().subtract(merVerifyOrderVo.getReceiveMoney())); |
| | | merVerifyOrderVo.setUserId(order.getUserId()); |
| | | merVerifyOrderVo.setUserName(member.getRealName()); |
| | |
| | | } |
| | | Member member = remoteMemberService.getMember(order.getUserId()).getData(); |
| | | //获取核销商户 |
| | | ShopRelUserVo shopRelUserVo = remoteShopService.getShopByUserId(merVerifyOrderDto.getUserId()).getData(); |
| | | Long shopId = shopRelUserVo.getShopId(); |
| | | log.info("当前核销员工【" + shopRelUserVo.getUserName() + "】门店ID:" + shopId); |
| | | // ShopRelUserVo shopRelUserVo = remoteShopService.getShopByUserId(merVerifyOrderDto.getUserId()).getData(); |
| | | Long shopId = member.getRelationShopId(); |
| | | // log.info("当前核销员工【" + shopRelUserVo.getUserName() + "】门店ID:" + shopId); |
| | | //获取订单商品列表 |
| | | List<AppUserOrderGoodsPageVo> appUserOrderGoodsPageVoList = orderGoodsService.listAppVoByOrderId(orderId); |
| | | //绑定用户判断核销商户 |
| | |
| | | ConsumerGoods consumerGoods; |
| | | String consumerGoodsId; |
| | | Goods goods; |
| | | //循环生成商品服务 |
| | | List<ConsumerGoods> consumerGoodsList = new ArrayList<>(); |
| | | for (AppUserOrderGoodsPageVo appUserOrderGoodsPageVo : appUserOrderGoodsPageVoList) { |
| | | Integer buyNum = appUserOrderGoodsPageVo.getBuyNum(); |
| | | //判断是否次数未确认商品 是则创建未确认周期商品服务 否则循环创建商品服务 |
| | | if (appUserOrderGoodsPageVo.getCycleNumFlag() == 0) { |
| | | consumerGoods = new ConsumerGoods(); |
| | | goods = goodsMap.get(appUserOrderGoodsPageVo.getGoodsId()); |
| | | consumerGoodsId = IdUtils.simpleUUID(); |
| | | consumerGoods.setConsumerGoodsId(consumerGoodsId); |
| | | consumerGoods.setDelFlag(0); |
| | | consumerGoods.setServiceStatus(1); |
| | | consumerGoods.setShopId(order.getShopId()); |
| | | consumerGoods.setUserId(order.getUserId()); |
| | | consumerGoods.setOrderId(orderId); |
| | | consumerGoods.setOrderGoodsId(appUserOrderGoodsPageVo.getOrderGoodsId()); |
| | | consumerGoods.setGoodsId(appUserOrderGoodsPageVo.getGoodsId()); |
| | | consumerGoods.setGoodsName(appUserOrderGoodsPageVo.getGoodsName()); |
| | | consumerGoods.setCycleNumFlag(appUserOrderGoodsPageVo.getCycleNumFlag()); |
| | | consumerGoods.setServiceNum(appUserOrderGoodsPageVo.getServiceNum()); |
| | | consumerGoods.setUsedNum(0); |
| | | consumerGoods.setGoodsType(appUserOrderGoodsPageVo.getGoodsType()); |
| | | consumerGoods.setGoodsTag(appUserOrderGoodsPageVo.getGoodsTag()); |
| | | consumerGoods.setCreateTime(nowTime); |
| | | consumerGoods.setGoodsIntroduction(goods.getGoodsIntroduction()); |
| | | consumerGoods.setGoodsPicture(appUserOrderGoodsPageVo.getGoodsPicture()); |
| | | consumerGoods.setGoodsNurses(goods.getGoodsNurses()); |
| | | consumerGoods.setSourceFrom(1); |
| | | consumerGoods.setSureNum(buyNum); |
| | | consumerGoodsList.add(consumerGoods); |
| | | } else { |
| | | for (int i = 0; i < buyNum; i++) { |
| | | if(null != appUserOrderGoodsPageVoList.get(0).getGoodsId()){ |
| | | //循环生成商品服务 |
| | | List<ConsumerGoods> consumerGoodsList = new ArrayList<>(); |
| | | for (AppUserOrderGoodsPageVo appUserOrderGoodsPageVo : appUserOrderGoodsPageVoList) { |
| | | Integer buyNum = appUserOrderGoodsPageVo.getBuyNum(); |
| | | //判断是否次数未确认商品 是则创建未确认周期商品服务 否则循环创建商品服务 |
| | | if (appUserOrderGoodsPageVo.getCycleNumFlag() == 0) { |
| | | consumerGoods = new ConsumerGoods(); |
| | | goods = goodsMap.get(appUserOrderGoodsPageVo.getGoodsId()); |
| | | consumerGoodsId = IdUtils.simpleUUID(); |
| | |
| | | consumerGoods.setGoodsPicture(appUserOrderGoodsPageVo.getGoodsPicture()); |
| | | consumerGoods.setGoodsNurses(goods.getGoodsNurses()); |
| | | consumerGoods.setSourceFrom(1); |
| | | consumerGoods.setSureNum(buyNum); |
| | | consumerGoodsList.add(consumerGoods); |
| | | } else { |
| | | for (int i = 0; i < buyNum; i++) { |
| | | consumerGoods = new ConsumerGoods(); |
| | | goods = goodsMap.get(appUserOrderGoodsPageVo.getGoodsId()); |
| | | consumerGoodsId = IdUtils.simpleUUID(); |
| | | consumerGoods.setConsumerGoodsId(consumerGoodsId); |
| | | consumerGoods.setDelFlag(0); |
| | | consumerGoods.setServiceStatus(1); |
| | | consumerGoods.setShopId(order.getShopId()); |
| | | consumerGoods.setUserId(order.getUserId()); |
| | | consumerGoods.setOrderId(orderId); |
| | | consumerGoods.setOrderGoodsId(appUserOrderGoodsPageVo.getOrderGoodsId()); |
| | | consumerGoods.setGoodsId(appUserOrderGoodsPageVo.getGoodsId()); |
| | | consumerGoods.setGoodsName(appUserOrderGoodsPageVo.getGoodsName()); |
| | | consumerGoods.setCycleNumFlag(appUserOrderGoodsPageVo.getCycleNumFlag()); |
| | | consumerGoods.setServiceNum(appUserOrderGoodsPageVo.getServiceNum()); |
| | | consumerGoods.setUsedNum(0); |
| | | consumerGoods.setGoodsType(appUserOrderGoodsPageVo.getGoodsType()); |
| | | consumerGoods.setGoodsTag(appUserOrderGoodsPageVo.getGoodsTag()); |
| | | consumerGoods.setCreateTime(nowTime); |
| | | consumerGoods.setGoodsIntroduction(goods.getGoodsIntroduction()); |
| | | consumerGoods.setGoodsPicture(appUserOrderGoodsPageVo.getGoodsPicture()); |
| | | consumerGoods.setGoodsNurses(goods.getGoodsNurses()); |
| | | consumerGoods.setSourceFrom(1); |
| | | consumerGoodsList.add(consumerGoods); |
| | | } |
| | | } |
| | | } |
| | | consumerGoodsService.saveBatchConsumerGoods(consumerGoodsList); |
| | | } |
| | | consumerGoodsService.saveBatchConsumerGoods(consumerGoodsList); |
| | | //生成返回 |
| | | MerVerifyOrderVo merVerifyOrderVo = new MerVerifyOrderVo(); |
| | | merVerifyOrderVo.setOrderId(orderId); |
| | |
| | | order.setNewMemberFlag(0); |
| | | } |
| | | this.saveOrUpdate(order); |
| | | // 订单金额大于0时进行分账 |
| | | OrderPayment orderPayment = orderPaymentService.getOne(new QueryWrapper<OrderPayment>() |
| | | .eq("order_id", order.getOrderId()).eq("pay_status", 2) |
| | | .eq("del_flag", 0)); |
| | | BigDecimal bigDecimal = orderPayment.getPayMoney().subtract(orderPayment.getFeeAmount()).setScale(2, BigDecimal.ROUND_HALF_EVEN); |
| | | if (bigDecimal.compareTo(BigDecimal.ZERO)>0) { |
| | | // TODO: 2023/10/17 更换分账渠道(汇付天下) |
| | | if(4 != order.getOrderFrom()){ |
| | | // 订单金额大于0时进行分账 |
| | | OrderPayment orderPayment = orderPaymentService.getOne(new QueryWrapper<OrderPayment>() |
| | | .eq("order_id", order.getOrderId()).eq("pay_status", 2) |
| | | .eq("del_flag", 0)); |
| | | BigDecimal bigDecimal = orderPayment.getPayMoney().subtract(orderPayment.getFeeAmount()).setScale(2, BigDecimal.ROUND_HALF_EVEN); |
| | | if (bigDecimal.compareTo(BigDecimal.ZERO)>0) { |
| | | // TODO: 2023/10/17 更换分账渠道(汇付天下) |
| | | // submitProfitSharing(orderId, order.getOrderNo(), order.getShopId(), order.getOnlinePayMoney(),order.getOrderFrom()); |
| | | submitProfitSharing1(orderId, order.getOrderNo(), order.getShopId(), bigDecimal, order.getOrderFrom()); |
| | | } |
| | | //创建支付记录 |
| | | if(merVerifyOrderDto.getRelPayMoney().compareTo(BigDecimal.ZERO)>0){ |
| | | PayRecord payRecord = new PayRecord(); |
| | | payRecord.setDelFlag(0); |
| | | payRecord.setOrderId(order.getOrderId()); |
| | | payRecord.setPayMoney(merVerifyOrderDto.getRelPayMoney()); |
| | | payRecord.setPayTime(new Date()); |
| | | payRecord.setPayType(merVerifyOrderDto.getPayType()); |
| | | payRecordService.save(payRecord); |
| | | submitProfitSharing1(orderId, order.getOrderNo(), order.getShopId(), bigDecimal, order.getOrderFrom()); |
| | | } |
| | | //创建支付记录 |
| | | if(merVerifyOrderDto.getRelPayMoney().compareTo(BigDecimal.ZERO)>0){ |
| | | PayRecord payRecord = new PayRecord(); |
| | | payRecord.setDelFlag(0); |
| | | payRecord.setOrderId(order.getOrderId()); |
| | | payRecord.setPayMoney(merVerifyOrderDto.getRelPayMoney()); |
| | | payRecord.setPayTime(new Date()); |
| | | payRecord.setPayType(merVerifyOrderDto.getPayType()); |
| | | payRecordService.save(payRecord); |
| | | } |
| | | } |
| | | //更新用户积分和消费统计 |
| | | MemberTotalChangeDto memberTotalChangeDto = new MemberTotalChangeDto(); |
| | |
| | | orderGoods.setOrderGoodsId(IdUtils.simpleUUID()); |
| | | orderGoods.setDelFlag(0); |
| | | orderGoods.setOrderId(order.getOrderId()); |
| | | orderGoods.setGoodsPrice(originAmount); |
| | | orderGoods.setGoodsTotalMoney(originAmount); |
| | | orderGoods.setGoodsReceivableMoney(originAmount); |
| | | orderGoods.setBuyNum(1); |
| | | |
| | | ConsumerGoods consumerGoods = new ConsumerGoods(); |
| | | consumerGoods.setUsedNum(1); |
| | | if(null != timeCard){ |
| | | orderGoods.setBuyNum(timeCard.getTimesCount()); |
| | | orderGoods.setServiceNum(timeCard.getTimesCount()); |
| | | //核销一次加一次 |
| | | orderGoods.setBuyNum(1); |
| | | orderGoods.setServiceNum(1); |
| | | consumerGoods.setServiceNum(timeCard.getTimesCount()); |
| | | consumerGoods.setUsedNum(1); |
| | | consumerGoods.setUseTime(new Date()); |
| | | } |
| | | orderGoods.setCycleNumFlag(1); |
| | |
| | | consumerGoods.setServiceStatus(1); |
| | | consumerGoods.setShopId(order.getShopId()); |
| | | consumerGoods.setUserId(order.getUserId()); |
| | | consumerGoods.setOrderId(orderId); |
| | | consumerGoods.setOrderId(order.getOrderId()); |
| | | consumerGoods.setOrderGoodsId(orderGoods.getOrderGoodsId()); |
| | | consumerGoods.setGoodsName(sku.getTitle()); |
| | | consumerGoods.setCycleNumFlag(1); |
| | |
| | | |
| | | //生成返回 |
| | | MerVerifyOrderVo merVerifyOrderVo = new MerVerifyOrderVo(); |
| | | merVerifyOrderVo.setOrderId(orderId); |
| | | merVerifyOrderVo.setOrderId(order.getOrderId()); |
| | | merVerifyOrderVo.setOrderNo(order.getOrderNo()); |
| | | merVerifyOrderVo.setOrderStatus(order.getOrderStatus()); |
| | | merVerifyOrderVo.setOrderFrom(order.getOrderFrom()); |
| | |
| | | if (integral > 0) { |
| | | memberTotalChangeDto.setChangeIntegral(integral); |
| | | memberTotalChangeDto.setTypeIntegral(1); |
| | | memberTotalChangeDto.setOrderId(orderId); |
| | | memberTotalChangeDto.setOrderId(order.getOrderId()); |
| | | memberTotalChangeDto.setOrderNo(order.getOrderNo()); |
| | | } |
| | | } |
| | |
| | | }else{ |
| | | //扣减剩余次数 |
| | | OrderGoods orderGoods = orderGoodsService.getOne(new LambdaQueryWrapper<OrderGoods>().eq(OrderGoods::getOrderId, order.getOrderId())); |
| | | //核销一次加一次数量 |
| | | orderGoods.setBuyNum(orderGoods.getBuyNum() + 1); |
| | | if(null != orderGoods.getServiceNum()){ |
| | | orderGoods.setServiceNum(orderGoods.getServiceNum() + 1); |
| | | } |
| | | orderGoodsService.updateById(orderGoods); |
| | | ConsumerGoods consumerGoods = consumerGoodsService.getOne(new LambdaQueryWrapper<ConsumerGoods>().eq(ConsumerGoods::getOrderId, order.getOrderId()).eq(ConsumerGoods::getOrderGoodsId, orderGoods.getOrderGoodsId())); |
| | | consumerGoods.setUsedNum(consumerGoods.getUsedNum() + 1); |
| | | consumerGoods.setUseTime(new Date()); |
| | |
| | | consumerGoodsService.updateById(consumerGoods); |
| | | //生成返回 |
| | | MerVerifyOrderVo merVerifyOrderVo = new MerVerifyOrderVo(); |
| | | merVerifyOrderVo.setOrderId(orderId); |
| | | merVerifyOrderVo.setOrderId(order.getOrderId()); |
| | | merVerifyOrderVo.setOrderNo(order.getOrderNo()); |
| | | merVerifyOrderVo.setOrderStatus(order.getOrderStatus()); |
| | | merVerifyOrderVo.setOrderFrom(order.getOrderFrom()); |
| | |
| | | orderGoods.setDelFlag(0); |
| | | orderGoods.setOrderId(order.getOrderId()); |
| | | orderGoods.setGoodsId(sku.getSku_id()); |
| | | orderGoods.setBuyNum(sku.getTimes_count()); |
| | | orderGoods.setBuyNum(1); |
| | | orderGoods.setServiceNum(1); |
| | | orderGoods.setGoodsPrice(originAmount); |
| | | orderGoods.setGoodsTotalMoney(originAmount); |
| | | orderGoods.setGoodsReceivableMoney(originAmount); |
| | | orderGoods.setCycleNumFlag(1); |
| | | orderGoods.setServiceNum(sku.getTimes_count()); |
| | | orderGoods.setGoodsType(2); |
| | |
| | | consumerGoods.setServiceStatus(1); |
| | | consumerGoods.setShopId(order.getShopId()); |
| | | consumerGoods.setUserId(order.getUserId()); |
| | | consumerGoods.setOrderId(orderId); |
| | | consumerGoods.setOrderId(order.getOrderId()); |
| | | consumerGoods.setGoodsId(sku.getSku_id()); |
| | | consumerGoods.setOrderGoodsId(orderGoods.getOrderGoodsId()); |
| | | consumerGoods.setGoodsName(sku.getTitle()); |
| | |
| | | consumerGoodsService.save(consumerGoods); |
| | | //生成返回 |
| | | MerVerifyOrderVo merVerifyOrderVo = new MerVerifyOrderVo(); |
| | | merVerifyOrderVo.setOrderId(orderId); |
| | | merVerifyOrderVo.setOrderId(order.getOrderId()); |
| | | merVerifyOrderVo.setOrderNo(order.getOrderNo()); |
| | | merVerifyOrderVo.setOrderStatus(order.getOrderStatus()); |
| | | merVerifyOrderVo.setOrderFrom(order.getOrderFrom()); |
| | |
| | | if (integral > 0) { |
| | | memberTotalChangeDto.setChangeIntegral(integral); |
| | | memberTotalChangeDto.setTypeIntegral(1); |
| | | memberTotalChangeDto.setOrderId(orderId); |
| | | memberTotalChangeDto.setOrderId(order.getOrderId()); |
| | | memberTotalChangeDto.setOrderNo(order.getOrderNo()); |
| | | } |
| | | } |
| | |
| | | }else{ |
| | | //扣减剩余次数 |
| | | OrderGoods orderGoods = orderGoodsService.getOne(new LambdaQueryWrapper<OrderGoods>().eq(OrderGoods::getOrderId, order.getOrderId())); |
| | | orderGoods.setBuyNum(orderGoods.getBuyNum() + 1); |
| | | orderGoods.setServiceNum(orderGoods.getServiceNum() + 1); |
| | | orderGoodsService.updateById(orderGoods); |
| | | |
| | | ConsumerGoods consumerGoods = consumerGoodsService.getOne(new LambdaQueryWrapper<ConsumerGoods>().eq(ConsumerGoods::getOrderId, order.getOrderId()).eq(ConsumerGoods::getOrderGoodsId, orderGoods.getOrderGoodsId())); |
| | | consumerGoods.setUsedNum(consumerGoods.getUsedNum() + 1); |
| | | consumerGoods.setUseTime(new Date()); |
| | |
| | | consumerGoodsService.updateById(consumerGoods); |
| | | //生成返回 |
| | | MerVerifyOrderVo merVerifyOrderVo = new MerVerifyOrderVo(); |
| | | merVerifyOrderVo.setOrderId(orderId); |
| | | merVerifyOrderVo.setOrderId(order.getOrderId()); |
| | | merVerifyOrderVo.setOrderNo(order.getOrderNo()); |
| | | merVerifyOrderVo.setOrderStatus(order.getOrderStatus()); |
| | | merVerifyOrderVo.setOrderFrom(order.getOrderFrom()); |
| | |
| | | if (memberGiftRecord.getPrizeFrom() == 2) { |
| | | Order one = this.getOne(new QueryWrapper<Order>().eq("activity_id", memberGiftRecord.getGiftId()).eq("order_from", 4)); |
| | | if(null == one){ |
| | | addOrder(memberGiftRecord.getShopId(), memberGiftRecord.getUserId(), goods, memberGiftRecord.getGoodsNumber(), memberGiftRecord.getGiftId(), 3); |
| | | addOrder(memberGiftRecord.getShopId(), memberGiftRecord.getUserId(), goods, null, memberGiftRecord.getGoodsNumber(), memberGiftRecord.getGiftId(), 3); |
| | | }else{ |
| | | one.setOrderStatus(3); |
| | | this.updateById(one); |
| | |
| | | * @param goods |
| | | * @param goodsNum |
| | | */ |
| | | public void addOrder(Long shopId, Long userId, Goods goods, Integer goodsNum, String giftId, Integer status) { |
| | | public void addOrder(Long shopId, Long userId, Goods goods, String goodsName, Integer goodsNum, String giftId, Integer status) { |
| | | Order order = new Order(); |
| | | order.setOrderId(IdUtils.simpleUUID()); |
| | | order.setDelFlag(0); |
| | |
| | | order.setOrderFrom(4); |
| | | order.setShopId(shopId); |
| | | order.setUserId(userId); |
| | | order.setOrderMoney(goods.getSalesPrice()); |
| | | order.setOrderMoney(null == goods ? BigDecimal.ZERO : goods.getSalesPrice()); |
| | | order.setCouponMoney(BigDecimal.ZERO); |
| | | order.setDiscountMoney(BigDecimal.ZERO); |
| | | order.setReceivableMoney(BigDecimal.ZERO); |
| | |
| | | orderGoods.setOrderGoodsId(IdUtils.simpleUUID()); |
| | | orderGoods.setDelFlag(0); |
| | | orderGoods.setOrderId(order.getOrderId()); |
| | | orderGoods.setGoodsId(goods.getGoodsId()); |
| | | orderGoods.setBuyNum(goodsNum); |
| | | orderGoods.setGoodsPrice(goods.getSalesPrice()); |
| | | orderGoods.setGoodsDeposit(goods.getSubscription()); |
| | | orderGoods.setGoodsTotalMoney(goods.getSalesPrice().multiply(new BigDecimal(goodsNum))); |
| | | orderGoods.setGoodsReceivableMoney(BigDecimal.ZERO); |
| | | orderGoods.setCycleNumFlag(goods.getCycleNumFlag()); |
| | | orderGoods.setServiceNum(goods.getServiceNum()); |
| | | orderGoods.setGoodsType(goods.getGoodsType()); |
| | | orderGoods.setGoodsName(goods.getGoodsName()); |
| | | GoodsFile goodsFile = remoteGoodsService.getGoodsFile(goods.getGoodsId()).getData(); |
| | | if (null != goodsFile) { |
| | | orderGoods.setGoodsPicture(goodsFile.getFileUrl()); |
| | | if(null != goods){ |
| | | orderGoods.setGoodsId(goods.getGoodsId()); |
| | | orderGoods.setGoodsPrice(goods.getSalesPrice()); |
| | | orderGoods.setGoodsDeposit(goods.getSubscription()); |
| | | orderGoods.setGoodsTotalMoney(goods.getSalesPrice().multiply(new BigDecimal(goodsNum))); |
| | | orderGoods.setGoodsReceivableMoney(BigDecimal.ZERO); |
| | | orderGoods.setCycleNumFlag(goods.getCycleNumFlag()); |
| | | orderGoods.setServiceNum(goods.getServiceNum()); |
| | | orderGoods.setGoodsType(goods.getGoodsType()); |
| | | orderGoods.setGoodsName(goods.getGoodsName()); |
| | | GoodsFile goodsFile = remoteGoodsService.getGoodsFile(goods.getGoodsId()).getData(); |
| | | if (null != goodsFile) { |
| | | orderGoods.setGoodsPicture(goodsFile.getFileUrl()); |
| | | } |
| | | orderGoods.setGoodsIntroduction(goods.getGoodsIntroduction()); |
| | | orderGoods.setGoodsTag(goods.getGoodsTags()); |
| | | }else{ |
| | | orderGoods.setGoodsName(goodsName); |
| | | orderGoods.setBuyNum(1); |
| | | orderGoods.setGoodsPrice(BigDecimal.ZERO); |
| | | orderGoods.setGoodsTotalMoney(BigDecimal.ZERO); |
| | | orderGoods.setGoodsReceivableMoney(BigDecimal.ZERO); |
| | | } |
| | | orderGoods.setGoodsIntroduction(goods.getGoodsIntroduction()); |
| | | orderGoods.setGoodsTag(goods.getGoodsTags()); |
| | | orderGoodsService.save(orderGoods); |
| | | } |
| | | |
| | |
| | | mgtOrderTotal.setActivityOrderMoneyTotal(mgtOrderTotalThird.getActivityOrderMoneyTotal()); |
| | | mgtOrderTotal.setActivityPayMoneyTotal(mgtOrderTotalThird.getActivityPayMoneyTotal()); |
| | | mgtOrderTotal.setActivityUnPayMoneyTotal(mgtOrderTotalThird.getActivityOrderMoneyTotal().subtract(mgtOrderTotalThird.getActivityPayMoneyTotal())); |
| | | |
| | | mgtOrderTotal.setThirdOrderTotal(mgtOrderTotalFour.getThirdOrderTotal()); |
| | | mgtOrderTotal.setThirdOrderMoneyTotal(mgtOrderTotalFour.getThirdOrderMoneyTotal()); |
| | | mgtOrderTotal.setThirdPayMoneyTotal(mgtOrderTotalFour.getThirdPayMoneyTotal()); |
| | | mgtOrderTotal.setThirdUnPayMoneyTotal(mgtOrderTotalFour.getThirdOrderMoneyTotal().subtract(mgtOrderTotalFour.getThirdPayMoneyTotal())); |
| | | |
| | | return mgtOrderTotal; |
| | | } |
| | | |
| | |
| | | */ |
| | | private List<MgtMapBigTotalVo> bigListRemoveNull(List<MgtMapBigTotalVo> MgtMapIntTotalVos) { |
| | | for (int i = 0; i < MgtMapIntTotalVos.size(); i++) { |
| | | if(MgtMapIntTotalVos.get(i).getMapKey().isEmpty()){ |
| | | if(null == MgtMapIntTotalVos.get(i).getMapKey() || MgtMapIntTotalVos.get(i).getMapKey().isEmpty()){ |
| | | MgtMapIntTotalVos.remove(i); |
| | | } |
| | | } |
| | |
| | | if (memberGiftRecord.getGiftFrom() == 2 && !memberGiftRecord.getShopId().equals(shopId)) { |
| | | throw new ServiceException(AppErrorConstant.VERIFY_SHOP_ERROR); |
| | | } |
| | | |
| | | |
| | | merVerifyAwardVo.setUserId(member.getUserId()); |
| | | merVerifyAwardVo.setUserName(member.getRealName()); |
| | | merVerifyAwardVo.setUserMobile(member.getMobile()); |
| | | if (1 == memberGiftRecord.getPrizeFrom()) { |