| | |
| | | import com.github.binarywang.wxpay.service.WxPayService; |
| | | import com.google.common.collect.Lists; |
| | | import com.google.gson.Gson; |
| | | import com.ruoyi.common.core.constant.CacheConstants; |
| | | import com.ruoyi.common.core.constant.Constants; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.enums.UserStatus; |
| | | import com.ruoyi.common.core.exception.ServiceException; |
| | | import com.ruoyi.common.core.text.Convert; |
| | | import com.ruoyi.common.core.utils.DateUtils; |
| | | import com.ruoyi.common.core.utils.StringUtils; |
| | | import com.ruoyi.common.core.utils.ip.IpUtils; |
| | | import com.ruoyi.common.core.utils.uuid.IdUtils; |
| | | import com.ruoyi.common.redis.service.RedisService; |
| | | import com.ruoyi.common.security.utils.CodeFactoryUtil; |
| | |
| | | import com.ruoyi.system.api.constant.DelayTaskEnum; |
| | | import com.ruoyi.system.api.constant.SecurityConstant; |
| | | import com.ruoyi.system.api.domain.dto.*; |
| | | import com.ruoyi.system.api.domain.poji.activity.Activity; |
| | | import com.ruoyi.system.api.domain.poji.activity.ActivityRecord; |
| | | import com.ruoyi.system.api.domain.poji.config.DelayTask; |
| | | import com.ruoyi.system.api.domain.poji.goods.Goods; |
| | |
| | | import com.ruoyi.system.api.domain.poji.shop.Shop; |
| | | import com.ruoyi.system.api.domain.poji.sys.SysUser; |
| | | import com.ruoyi.system.api.domain.vo.*; |
| | | import com.ruoyi.system.api.model.QwH5LoginVo; |
| | | import com.ruoyi.system.api.model.QwUserDetailDto; |
| | | import com.ruoyi.system.api.service.*; |
| | | import io.seata.spring.annotation.GlobalTransactional; |
| | | import lombok.extern.log4j.Log4j2; |
| | | import org.redisson.api.RLock; |
| | | import org.redisson.api.RedissonClient; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | |
| | | @Value("${wx.pay.callbackPath}") |
| | | private String callbackPath; |
| | | |
| | | |
| | | |
| | | /** |
| | |
| | | String goodsId; |
| | | Integer buyNum; |
| | | BigDecimal buyNumBig; |
| | | String memberCouponId; |
| | | Long memberCouponId; |
| | | Goods goods; |
| | | BigDecimal goodsPrice; |
| | | BigDecimal goodsTotalPrice; |
| | |
| | | BigDecimal orderPayDeposit = new BigDecimal("0.00"); |
| | | BigDecimal orderPayMoney = new BigDecimal("0.00"); |
| | | // 遍历购买商品列表 |
| | | HashSet<String> userCouponIdSet = new HashSet<>(); |
| | | HashSet<Long> userCouponIdSet = new HashSet<>(); |
| | | for (AppBuyGoodsDto appBuyGoodsDto : appBuyGoodsDtoList) { |
| | | appSureOrderGoodsVo = new AppSureOrderGoodsVo(); |
| | | discountMoney = BigDecimal.ZERO; |
| | |
| | | goodsTotalPrice = goodsPrice.multiply(buyNumBig); |
| | | goodsRealPrice = goodsTotalPrice; |
| | | // 处理优惠券 |
| | | if (StringUtils.isNotBlank(memberCouponId)) { |
| | | appMemberCouponVo = appMemberCouponVoMap.get(memberCouponId); |
| | | if (null != memberCouponId) { |
| | | appMemberCouponVo = appMemberCouponVoMap.get(memberCouponId.toString()); |
| | | System.err.println(JSON.toJSONString(appMemberCouponVoMap)); |
| | | System.err.println(memberCouponId); |
| | | System.err.println(JSON.toJSONString(appMemberCouponVo)); |
| | | if (StringUtils.isBlank(appMemberCouponVo.getRelGoodsIds()) || appMemberCouponVo.getRelGoodsIds().contains(goodsId)) { |
| | | couponType = appMemberCouponVo.getCouponType(); |
| | | if (couponType == 1 && appMemberCouponVo.getMoneyThreshold() != null && appMemberCouponVo.getDiscountMoney() != null) { |
| | |
| | | goodsRealPrice = goodsTotalPrice.subtract(discountMoney); |
| | | useCoupon = 1; |
| | | userCouponIdSet.add(memberCouponId); |
| | | appSureOrderGoodsVo.setMemberCouponId(memberCouponId); |
| | | appSureOrderGoodsVo.setMemberCouponId(memberCouponId.toString()); |
| | | } |
| | | } else if (couponType == 2 && appMemberCouponVo.getDiscountPercent() != null) { |
| | | discountPercent = appMemberCouponVo.getDiscountPercent(); |
| | |
| | | discountMoney = goodsTotalPrice.subtract(goodsRealPrice); |
| | | useCoupon = 1; |
| | | userCouponIdSet.add(memberCouponId); |
| | | appSureOrderGoodsVo.setMemberCouponId(memberCouponId); |
| | | appSureOrderGoodsVo.setMemberCouponId(memberCouponId.toString()); |
| | | } else if (couponType == 3 && appMemberCouponVo.getDiscountMoney() != null) { |
| | | discountMoney = appMemberCouponVo.getDiscountMoney(); |
| | | if (goodsTotalPrice.compareTo(discountMoney) > 0) { |
| | |
| | | } |
| | | useCoupon = 1; |
| | | userCouponIdSet.add(memberCouponId); |
| | | appSureOrderGoodsVo.setMemberCouponId(memberCouponId); |
| | | appSureOrderGoodsVo.setMemberCouponId(memberCouponId.toString()); |
| | | } |
| | | } |
| | | } |
| | |
| | | sureOrderGoodsVo.setAppMemberCouponVoList(appGoodsMemberCouponVoList); |
| | | } |
| | | } |
| | | /*if (appMemberCouponVoList != null && !appMemberCouponVoList.isEmpty()) { |
| | | // 获取商品关联优惠券 |
| | | appGoodsMemberCouponVoList = new ArrayList<>(); |
| | | for(AppSureOrderGoodsVo sureOrderGoodsVo : appSureOrderGoodsVoList){ |
| | | for (AppMemberCouponVo entity : appMemberCouponVoList) { |
| | | if (StringUtils.isBlank(entity.getRelGoodsIds())) { |
| | | if (entity.getCouponType() == 1 && entity.getMoneyThreshold() != null && entity.getDiscountMoney() != null) { |
| | | moneyThreshold = entity.getMoneyThreshold(); |
| | | if (sureOrderGoodsVo.getGoodsTotalPrice().compareTo(moneyThreshold) >= 0) { |
| | | if(userCouponIdSet==null||!userCouponIdSet.contains(entity.getMemberCouponId())){ |
| | | appGoodsMemberCouponVoList.add(entity); |
| | | }else{ |
| | | if(sureOrderGoodsVo.getMemberCouponId()!=null&&sureOrderGoodsVo.getMemberCouponId().equals(entity.getMemberCouponId())){ |
| | | appGoodsMemberCouponVoList.add(entity); |
| | | } |
| | | } |
| | | } |
| | | }else{ |
| | | if(userCouponIdSet==null||!userCouponIdSet.contains(entity.getMemberCouponId())){ |
| | | appGoodsMemberCouponVoList.add(entity); |
| | | }else{ |
| | | if(sureOrderGoodsVo.getMemberCouponId()!=null&&sureOrderGoodsVo.getMemberCouponId().equals(entity.getMemberCouponId())){ |
| | | appGoodsMemberCouponVoList.add(entity); |
| | | } |
| | | } |
| | | } |
| | | } else if (entity.getRelGoodsIds().contains(sureOrderGoodsVo.getGoodsId())) { |
| | | if (entity.getCouponType() == 1 && entity.getMoneyThreshold() != null && entity.getDiscountMoney() != null) { |
| | | moneyThreshold = entity.getMoneyThreshold(); |
| | | if (sureOrderGoodsVo.getGoodsTotalPrice().compareTo(moneyThreshold) >= 0) { |
| | | if(userCouponIdSet==null||!userCouponIdSet.contains(entity.getMemberCouponId())){ |
| | | appGoodsMemberCouponVoList.add(entity); |
| | | }else{ |
| | | if(sureOrderGoodsVo.getMemberCouponId()!=null&&sureOrderGoodsVo.getMemberCouponId().equals(entity.getMemberCouponId())){ |
| | | appGoodsMemberCouponVoList.add(entity); |
| | | } |
| | | } |
| | | } |
| | | }else{ |
| | | if(userCouponIdSet==null||!userCouponIdSet.contains(entity.getMemberCouponId())){ |
| | | appGoodsMemberCouponVoList.add(entity); |
| | | }else{ |
| | | if(sureOrderGoodsVo.getMemberCouponId()!=null&&sureOrderGoodsVo.getMemberCouponId().equals(entity.getMemberCouponId())){ |
| | | appGoodsMemberCouponVoList.add(entity); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | sureOrderGoodsVo.setAppMemberCouponVoList(appGoodsMemberCouponVoList); |
| | | } |
| | | }*/ |
| | | // 设置订单相关金额 |
| | | appSureOrderVo.setOrderGoodsMoney(orderGoodsMoney); |
| | | appSureOrderVo.setCouponDiscount(couponDiscount); |
| | |
| | | BigDecimal buyNumBig; |
| | | Integer serviceNum; |
| | | Integer goodsNum = 0; |
| | | String memberCouponId; |
| | | Long memberCouponId; |
| | | Goods goods = null; |
| | | GoodsFile goodsFile; |
| | | BigDecimal goodsPrice; |
| | |
| | | goodsRealPrice = goodsTotalPrice; |
| | | // 如果使用了优惠券,计算优惠后的价格 |
| | | if (memberCouponId != null) { |
| | | appMemberCouponVo = appMemberCouponVoMap.get(memberCouponId); |
| | | appMemberCouponVo = appMemberCouponVoMap.get(memberCouponId.toString()); |
| | | if(null == appMemberCouponVo){ |
| | | throw new ServiceException("优惠券已使用"); |
| | | } |
| | | // 如果优惠券适用于该商品 |
| | | if (StringUtils.isBlank(appMemberCouponVo.getRelGoodsIds()) || appMemberCouponVo.getRelGoodsIds().contains(goodsId)) { |
| | | couponType = appMemberCouponVo.getCouponType(); |
| | |
| | | discountMoney = goodsTotalPrice; |
| | | } |
| | | } |
| | | memberCouponSJ.add(memberCouponId); |
| | | memberCouponSJ.add(memberCouponId + ""); |
| | | } |
| | | appSureOrderGoodsVo.setUseCoupon(useCoupon); |
| | | appSureOrderGoodsVo.setGoodsTotalPrice(goodsTotalPrice); |
| | |
| | | //处理订单回显 |
| | | for (AppUserOrderPageVo appUserOrderPageVo : appUserOrderPageVoList) { |
| | | if(member.getBindingFlag()==0&&appUserOrderPageVo.getOrderFrom()==2){ |
| | | appUserOrderPageVo.setShopName("全部店铺"); |
| | | //查询秒杀活动的参与店铺 |
| | | R<Activity> activity = remoteActivityService.getActivity(appUserOrderPageVo.getActivityId()); |
| | | if(activity.getCode() != 200){ |
| | | throw new RuntimeException(activity.getMsg()); |
| | | } |
| | | Activity data = activity.getData(); |
| | | if(data.getAreaFlag() == 1){ |
| | | appUserOrderPageVo.setShopNumber(0); |
| | | appUserOrderPageVo.setShopName("全部店铺"); |
| | | } |
| | | if(data.getAreaFlag() == 2 && data.getShopFlag() == 1){ |
| | | String designatedArea = data.getDesignatedArea(); |
| | | String[] split = designatedArea.split(","); |
| | | List<String> list = Arrays.asList(split); |
| | | R<List<Shop>> listR = remoteShopService.listShopByCityCode(list); |
| | | if(listR.getCode() != 200){ |
| | | throw new RuntimeException(listR.getMsg()); |
| | | } |
| | | List<Shop> data1 = listR.getData(); |
| | | appUserOrderPageVo.setShopNumber(1); |
| | | appUserOrderPageVo.setShopName(JSON.toJSONString(data1)); |
| | | } |
| | | if(data.getShopFlag() == 2){ |
| | | String applicableShop = data.getApplicableShop(); |
| | | String[] split = applicableShop.split(","); |
| | | List<String> list = Arrays.asList(split); |
| | | R<List<Shop>> listR = remoteShopService.listShopByIds(list); |
| | | if(listR.getCode() != 200){ |
| | | throw new RuntimeException(listR.getMsg()); |
| | | } |
| | | List<Shop> data1 = listR.getData(); |
| | | appUserOrderPageVo.setShopNumber(1); |
| | | appUserOrderPageVo.setShopName(JSON.toJSONString(data1)); |
| | | } |
| | | }else if(member.getBindingFlag()==1&&appUserOrderPageVo.getOrderFrom()==2){ |
| | | Long relationShopId = member.getRelationShopId(); |
| | | R<Shop> shop = remoteShopService.getShop(relationShopId); |
| | | if(shop.getCode() != 200){ |
| | | throw new RuntimeException(shop.getMsg()); |
| | | } |
| | | Shop data1 = shop.getData(); |
| | | //查询秒杀活动的参与店铺 |
| | | R<Activity> activity = remoteActivityService.getActivity(appUserOrderPageVo.getActivityId()); |
| | | if(activity.getCode() != 200){ |
| | | throw new RuntimeException(activity.getMsg()); |
| | | } |
| | | Activity data = activity.getData(); |
| | | if(data.getAreaFlag() == 1){ |
| | | appUserOrderPageVo.setShopNumber(2); |
| | | appUserOrderPageVo.setShopName(data1.getShopName()); |
| | | appUserOrderPageVo.setShopServicePhone(data1.getShopServicePhone()); |
| | | } |
| | | if(data.getAreaFlag() == 2 && data.getShopFlag() == 1){ |
| | | String designatedArea = data.getDesignatedArea(); |
| | | String[] split = designatedArea.split(","); |
| | | List<String> list = Arrays.asList(split); |
| | | R<List<Shop>> listR = remoteShopService.listShopByCityCode(list); |
| | | if(listR.getCode() != 200){ |
| | | throw new RuntimeException(listR.getMsg()); |
| | | } |
| | | List<Shop> data2 = listR.getData(); |
| | | List<Long> collect = data2.stream().map(Shop::getShopId).collect(Collectors.toList()); |
| | | if(collect.contains(relationShopId)){ |
| | | appUserOrderPageVo.setShopNumber(2); |
| | | appUserOrderPageVo.setShopName(data1.getShopName()); |
| | | appUserOrderPageVo.setShopServicePhone(data1.getShopServicePhone()); |
| | | }else{ |
| | | appUserOrderPageVo.setShopNumber(1); |
| | | appUserOrderPageVo.setShopName(JSON.toJSONString(data2)); |
| | | } |
| | | } |
| | | if(data.getShopFlag() == 2){ |
| | | String applicableShop = data.getApplicableShop(); |
| | | String[] split = applicableShop.split(","); |
| | | List<String> list = Arrays.asList(split); |
| | | R<List<Shop>> listR = remoteShopService.listShopByIds(list); |
| | | if(listR.getCode() != 200){ |
| | | throw new RuntimeException(listR.getMsg()); |
| | | } |
| | | List<Shop> data2 = listR.getData(); |
| | | List<Long> collect = data2.stream().map(Shop::getShopId).collect(Collectors.toList()); |
| | | if(collect.contains(relationShopId)){ |
| | | appUserOrderPageVo.setShopNumber(2); |
| | | appUserOrderPageVo.setShopName(data1.getShopName()); |
| | | appUserOrderPageVo.setShopServicePhone(data1.getShopServicePhone()); |
| | | }else{ |
| | | appUserOrderPageVo.setShopNumber(1); |
| | | appUserOrderPageVo.setShopName(JSON.toJSONString(data2)); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | }else{ |
| | | simpleShopVo = shopMap.get(appUserOrderPageVo.getShopId()); |
| | | appUserOrderPageVo.setShopName(simpleShopVo.getShopName()); |
| | | appUserOrderPageVo.setShopServicePhone(simpleShopVo.getShopServicePhone()); |
| | | appUserOrderPageVo.setShopNumber(2); |
| | | if (appUserOrderPageVo.getShopId().equals(appUserOrderPageDto.getShopId())) { |
| | | appUserOrderPageVo.setSameShop(1); |
| | | } else { |
| | |
| | | */ |
| | | @Override |
| | | public MerHomeShopTotalVo getMerHomeTotal(MerHomeShopTotalVo merHomeShopTotalVo) { |
| | | Long shopId = merHomeShopTotalVo.getShopId(); |
| | | // 查询用户信息 |
| | | QwUserDetailDto qwUserDetail = new QwUserDetailDto(); |
| | | Long userId = SecurityUtils.getUserId(); |
| | | qwUserDetail.setUserid(userId.toString()); |
| | | // 查询用户信息 |
| | | R<QwH5LoginVo> userResult = remoteShopService.qwH5Login(qwUserDetail); |
| | | if(userResult==null){ |
| | | throw new ServiceException(AppErrorConstant.USER_NO_SHOP); |
| | | } |
| | | if (R.FAIL == userResult.getCode()) |
| | | { |
| | | throw new ServiceException(userResult.getMsg()); |
| | | } |
| | | if (401 == userResult.getCode()) |
| | | { |
| | | throw new ServiceException("商户已被冻结,请联系管理员",401); |
| | | } |
| | | QwH5LoginVo userInfo = userResult.getData(); |
| | | SysUser user = userInfo.getSysUser(); |
| | | String username = user.getUserName(); |
| | | // IP黑名单校验 |
| | | String blackStr = Convert.toStr(redisService.getCacheObject(CacheConstants.SYS_LOGIN_BLACKIPLIST)); |
| | | if (IpUtils.isMatchedIp(blackStr, IpUtils.getIpAddr())) |
| | | { |
| | | throw new ServiceException("很遗憾,访问IP已被列入系统黑名单"); |
| | | } |
| | | if (UserStatus.DELETED.getCode().equals(user.getDelFlag())) |
| | | { |
| | | throw new ServiceException("对不起,您的账号:" + username + " 已被删除"); |
| | | } |
| | | if (UserStatus.DISABLE.getCode().equals(user.getStatus())) |
| | | { |
| | | throw new ServiceException("对不起,您的账号:" + username + " 已停用"); |
| | | } |
| | | // 查询用户商户 |
| | | R<ShopRelUserVo> shopResult = remoteShopService.getShopByUserId(user.getUserId()); |
| | | if (R.FAIL == userResult.getCode()) { |
| | | throw new ServiceException(userResult.getMsg()); |
| | | } |
| | | ShopRelUserVo shopInfo = shopResult.getData(); |
| | | if(null == shopInfo){ |
| | | throw new ServiceException("未查询到商户信息"); |
| | | } |
| | | Long shopId = shopInfo.getShopId(); |
| | | Shop shop = remoteShopService.getShop(shopId).getData(); |
| | | if(-1 == shop.getShopStatus()){ |
| | | throw new ServiceException("对应商户已删除,请联系管理员"); |
| | | } |
| | | if(0 == shop.getShopStatus()){ |
| | | throw new ServiceException("对应商户已冻结,请联系管理员"); |
| | | } |
| | | if(2 == shop.getShopStatus()){ |
| | | throw new ServiceException("对应商户已终止合作,请联系管理员"); |
| | | } |
| | | |
| | | |
| | | shopId = merHomeShopTotalVo.getShopId(); |
| | | |
| | | //获取今日到店 |
| | | Integer todayShop = userServiceRecordService.countShopServicePerson(shopId); |
| | | //获取待处理订单和营业额 |
| | |
| | | //判断用户是否绑定 |
| | | if(member.getBindingFlag()==1){ |
| | | //绑定用户判断核销商户 |
| | | if(order.getOrderFrom()==2&&order.getUnbindingFlag()==1){ |
| | | if (!member.getRelationShopId().equals(shopId)) { |
| | | throw new ServiceException(AppErrorConstant.VERIFY_SHOP_ERROR); |
| | | } |
| | | //未绑定时下的活动订单只需要判断店铺是否支持 |
| | | String activityId = order.getActivityId(); |
| | | MerActivityShopDto merActivityShopDto = new MerActivityShopDto(); |
| | | merActivityShopDto.setShopId(shopId); |
| | | merActivityShopDto.setActivityId(activityId); |
| | | Boolean judge = remoteActivityService.judgeActivityShop(merActivityShopDto).getData(); |
| | | if(!judge){ |
| | | throw new ServiceException(AppErrorConstant.SHOP_NO_ACTIVITY); |
| | | } |
| | | }else{ |
| | | if (order.getOrderFrom()==2&&!member.getRelationShopId().equals(shopId)) { |
| | | throw new ServiceException(AppErrorConstant.VERIFY_SHOP_ERROR); |
| | | } |
| | | if(order.getOrderFrom() == 1){ |
| | | //商城订单和绑定后活动订单判断核销商户和订单商户和用户关联商户是否统一 |
| | | if (!order.getShopId().equals(shopId)) { |
| | | throw new ServiceException(AppErrorConstant.VERIFY_SHOP_ERROR); |
| | |
| | | //获取核销商户 |
| | | ShopRelUserVo shopRelUserVo = remoteShopService.getShopByUserId(merVerifyOrderDto.getUserId()).getData(); |
| | | Long shopId = shopRelUserVo.getShopId(); |
| | | log.info("当前核销员工【" + shopRelUserVo.getUserName() + "】门店ID:" + shopId); |
| | | //获取订单商品列表 |
| | | List<AppUserOrderGoodsPageVo> appUserOrderGoodsPageVoList = orderGoodsService.listAppVoByOrderId(orderId); |
| | | //绑定用户判断核销商户 |
| | | if(member.getBindingFlag()==1){ |
| | | //未绑定的活动订单只需要判断店铺是否支持 |
| | | if(order.getOrderFrom()==2&&order.getUnbindingFlag()==1){ |
| | | if(order.getOrderFrom()==2 && !member.getRelationShopId().equals(shopId)){ |
| | | throw new ServiceException(AppErrorConstant.VERIFY_SHOP_ERROR); |
| | | } |
| | | if(order.getOrderFrom()==2 && member.getRelationShopId().equals(shopId)){ |
| | | String activityId = order.getActivityId(); |
| | | MerActivityShopDto merActivityShopDto = new MerActivityShopDto(); |
| | | merActivityShopDto.setShopId(shopId); |
| | |
| | | Boolean judge = remoteActivityService.judgeActivityShop(merActivityShopDto).getData(); |
| | | if(!judge){ |
| | | throw new ServiceException(AppErrorConstant.SHOP_NO_ACTIVITY); |
| | | } |
| | | }else{ |
| | | //绑定用户需直接判断商户一致 |
| | | if (!order.getShopId().equals(shopId)) { |
| | | throw new ServiceException(AppErrorConstant.VERIFY_SHOP_ERROR); |
| | | } |
| | | } |
| | | }else{ |
| | |
| | | throw new ServiceException(AppErrorConstant.SHOP_NO_ACTIVITY); |
| | | } |
| | | } |
| | | //未绑定用户需判断核销商城订单判断商品单价和优惠券 |
| | | /*StringJoiner goodsIdSJ = new StringJoiner(","); |
| | | for (AppUserOrderGoodsPageVo appUserOrderGoodsPageVo : appUserOrderGoodsPageVoList) { |
| | | goodsIdSJ.add(appUserOrderGoodsPageVo.getGoodsId()); |
| | | } |
| | | //获取商品列表 |
| | | List<Goods> goodsList = remoteGoodsService.listGoodsByGoodsId(goodsIdSJ.toString()).getData(); |
| | | Map<String, Goods> goodsMap = goodsList.stream() |
| | | .collect(Collectors.toMap(Goods::getGoodsId, Function.identity())); |
| | | Goods goods; |
| | | ShopGoods shopGoods; |
| | | AppShopGoodsGetDto appShopGoodsGetDto; |
| | | for (AppUserOrderGoodsPageVo appUserOrderGoodsPageVo : appUserOrderGoodsPageVoList) { |
| | | appShopGoodsGetDto= new AppShopGoodsGetDto(); |
| | | appShopGoodsGetDto.setShopId(shopId); |
| | | appShopGoodsGetDto.setGoodsId(appUserOrderGoodsPageVo.getGoodsId()); |
| | | shopGoods = remoteGoodsService.getShopGoods(appShopGoodsGetDto).getData(); |
| | | goods = goodsMap.get(appUserOrderGoodsPageVo.getGoodsId()); |
| | | //当商户定制价格不为空时判断商品定制价格否则判断商品价格是否一致 |
| | | if(shopGoods!=null){ |
| | | if(shopGoods.getSalesPrice().compareTo(appUserOrderGoodsPageVo.getGoodsPrice())!=0){ |
| | | throw new ServiceException(AppErrorConstant.VERIFY_SHOP_ERROR); |
| | | } |
| | | if(appUserOrderGoodsPageVo.getCycleNumFlag()==0){ |
| | | if(shopGoods.getServiceNum()!=null){ |
| | | throw new ServiceException(AppErrorConstant.VERIFY_SHOP_ERROR); |
| | | } |
| | | }else{ |
| | | if(shopGoods.getServiceNum()!=appUserOrderGoodsPageVo.getServiceNum()){ |
| | | throw new ServiceException(AppErrorConstant.VERIFY_SHOP_ERROR); |
| | | } |
| | | } |
| | | }else{ |
| | | if(goods.getSalesPrice().compareTo(appUserOrderGoodsPageVo.getGoodsPrice())!=0){ |
| | | throw new ServiceException(AppErrorConstant.VERIFY_SHOP_ERROR); |
| | | } |
| | | if(appUserOrderGoodsPageVo.getCycleNumFlag()==0){ |
| | | if(goods.getServiceNum()!=null){ |
| | | throw new ServiceException(AppErrorConstant.VERIFY_SHOP_ERROR); |
| | | } |
| | | }else{ |
| | | if(goods.getServiceNum()!=appUserOrderGoodsPageVo.getServiceNum()){ |
| | | throw new ServiceException(AppErrorConstant.VERIFY_SHOP_ERROR); |
| | | } |
| | | } |
| | | } |
| | | }*/ |
| | | } |
| | | order.setShopId(shopId); |
| | | order.setOrderStatus(3); |
| | |
| | | @Transactional |
| | | @GlobalTransactional(rollbackFor = Exception.class) |
| | | public MerVerifyCouponVo sureVerifyCoupon(MerVerifyCouponDto merVerifyCouponDto) { |
| | | MerVerifyCouponGetVo verifyCouponGetVo = remoteCouponService.getVerifyCoupon(merVerifyCouponDto.getMemberCouponId()).getData(); |
| | | R<MerVerifyCouponGetVo> verifyCoupon = remoteCouponService.getVerifyCoupon(merVerifyCouponDto.getMemberCouponId()); |
| | | if(verifyCoupon.getCode() != 200){ |
| | | throw new ServiceException(verifyCoupon.getMsg()); |
| | | } |
| | | MerVerifyCouponGetVo verifyCouponGetVo = verifyCoupon.getData(); |
| | | MemberCoupon memberCoupon = verifyCouponGetVo.getMemberCoupon(); |
| | | ShopRelUserVo shopRelUserVo = remoteShopService.getShopByUserId(merVerifyCouponDto.getUserId()).getData(); |
| | | Long userId = verifyCouponGetVo.getUserId(); |
| | |
| | | BigDecimal buyNumBig; |
| | | Integer serviceNum; |
| | | Integer goodsNum = 0; |
| | | String memberCouponId; |
| | | Long memberCouponId; |
| | | Goods goods; |
| | | BigDecimal goodsPrice; |
| | | BigDecimal goodsTotalPrice; |
| | |
| | | OrderGoods orderGoods; |
| | | String orderGoodsId; |
| | | GoodsFile goodsFile; |
| | | //BigDecimal cycleMoney = new BigDecimal("0.00"); |
| | | //BigDecimal experienceMoney = new BigDecimal("0.00"); |
| | | //BigDecimal serviceMoney = new BigDecimal("0.00"); |
| | | //BigDecimal goodsMoney = new BigDecimal("0.00"); |
| | | List<OrderGoods> orderGoodsList = new ArrayList<>(); |
| | | ConsumerGoods consumerGoods; |
| | | String consumerGoodsId; |
| | |
| | | goodsRealPrice = BigDecimal.ZERO; |
| | | discountMoney = goodsTotalPrice.subtract(goodsRealPrice); |
| | | } |
| | | memberCouponSJ.add(memberCouponId); |
| | | memberCouponSJ.add(memberCouponId + ","); |
| | | } |
| | | } |
| | | goodsDeposit = goods.getSubscription(); |
| | |
| | | consumerGoodsList.add(consumerGoods); |
| | | } |
| | | } |
| | | |
| | | //商户变更计算 |
| | | /*switch (orderGoods.getGoodsType()) { |
| | | case 1: |
| | | cycleMoney = cycleMoney.add(orderGoods.getGoodsReceivableMoney()); |
| | | break; |
| | | case 2: |
| | | serviceMoney = serviceMoney.add(orderGoods.getGoodsReceivableMoney()); |
| | | break; |
| | | case 3: |
| | | experienceMoney = experienceMoney.add(orderGoods.getGoodsReceivableMoney()); |
| | | break; |
| | | case 4: |
| | | goodsMoney = goodsMoney.add(orderGoods.getGoodsReceivableMoney()); |
| | | break; |
| | | default: |
| | | break; |
| | | }*/ |
| | | } |
| | | //创建订单 |
| | | Order order = new Order(); |
| | |
| | | memberTotalChangeDto.setUserId(order.getUserId()); |
| | | memberTotalChangeDto.setConsumeTime(nowTime); |
| | | remoteMemberService.changeMemberTotal(memberTotalChangeDto); |
| | | //更新商户统计 |
| | | /*ShopTotalChangeDto shopTotalChangeDto = new ShopTotalChangeDto(); |
| | | shopTotalChangeDto.setShopId(order.getShopId()); |
| | | shopTotalChangeDto.setOrderType(1); |
| | | shopTotalChangeDto.setCycleMoney(cycleMoney); |
| | | shopTotalChangeDto.setServiceMoney(serviceMoney); |
| | | shopTotalChangeDto.setExperienceMoney(experienceMoney); |
| | | shopTotalChangeDto.setGoodsMoney(goodsMoney); |
| | | remoteShopService.changeShopTotal(shopTotalChangeDto);*/ |
| | | //创建支付记录 |
| | | PayRecord payRecord = new PayRecord(); |
| | | payRecord.setDelFlag(0); |
| | |
| | | mgtShopOrderPageDto.setUserIds(mgtUserIdByKeywordVo.getUserIds()); |
| | | } |
| | | } |
| | | //数据权限 |
| | | List<Long> userId = remoteUserService.getScopeOfAuthorityUserId(); |
| | | BoardMemberTotalDto boardMemberTotalDto = new BoardMemberTotalDto(); |
| | | boardMemberTotalDto.setUserIds(userId); |
| | | List<Shop> shops = remoteShopService.getShopBySysUserIds(boardMemberTotalDto); |
| | | if (!shops.isEmpty()) { |
| | | List<Long> collect = shops.stream().map(Shop::getShopId).collect(Collectors.toList()); |
| | | String join = collect.stream().map(Object::toString).collect(Collectors.joining(",")); |
| | | String shopIds = mgtShopOrderPageDto.getShopIds(); |
| | | if(StringUtils.isNotEmpty(shopIds)){ |
| | | shopIds = shopIds + "," + join; |
| | | }else{ |
| | | shopIds = join; |
| | | } |
| | | mgtShopOrderPageDto.setShopIds(shopIds); |
| | | } |
| | | |
| | | |
| | | // 从数据库中获取活动订单列表 |
| | | List<MgtActivityOrderPageVo> activityOrderPageVoList = orderMapper.pageMgtActivityOrder(page, mgtShopOrderPageDto); |
| | | // 如果列表不为空 |
| | |
| | | mgtShopOrderPageDto.setUserIds(mgtUserIdByKeywordVo.getUserIds()); |
| | | } |
| | | } |
| | | //数据权限 |
| | | List<Long> userId = remoteUserService.getScopeOfAuthorityUserId(); |
| | | BoardMemberTotalDto boardMemberTotalDto = new BoardMemberTotalDto(); |
| | | boardMemberTotalDto.setUserIds(userId); |
| | | List<Shop> shops = remoteShopService.getShopBySysUserIds(boardMemberTotalDto); |
| | | if (!shops.isEmpty()) { |
| | | List<Long> collect = shops.stream().map(Shop::getShopId).collect(Collectors.toList()); |
| | | String join = collect.stream().map(Object::toString).collect(Collectors.joining(",")); |
| | | String shopIds = mgtShopOrderPageDto.getShopIds(); |
| | | if(StringUtils.isNotEmpty(shopIds)){ |
| | | shopIds = shopIds + "," + join; |
| | | }else{ |
| | | shopIds = join; |
| | | } |
| | | mgtShopOrderPageDto.setShopIds(shopIds); |
| | | } |
| | | MgtOrderTotal mgtOrderTotal = new MgtOrderTotal(); |
| | | MgtOrderTotal mgtOrderTotalFirst = orderMapper.totalOrderFirst(mgtShopOrderPageDto); |
| | | MgtOrderTotal mgtOrderTotalSecond = orderMapper.totalOrderSecond(mgtShopOrderPageDto); |
| | |
| | | if (StringUtils.isNotBlank(mgtUserIdByKeywordVo.getUserIds())) { |
| | | mgtShopOrderPageDto.setUserIds(mgtUserIdByKeywordVo.getUserIds()); |
| | | } |
| | | } |
| | | //数据权限 |
| | | List<Long> userId = remoteUserService.getScopeOfAuthorityUserId(); |
| | | BoardMemberTotalDto boardMemberTotalDto = new BoardMemberTotalDto(); |
| | | boardMemberTotalDto.setUserIds(userId); |
| | | List<Shop> shops = remoteShopService.getShopBySysUserIds(boardMemberTotalDto); |
| | | if (!shops.isEmpty()) { |
| | | List<Long> collect = shops.stream().map(Shop::getShopId).collect(Collectors.toList()); |
| | | String join = collect.stream().map(Object::toString).collect(Collectors.joining(",")); |
| | | String shopIds = mgtShopOrderPageDto.getShopIds(); |
| | | if(StringUtils.isNotEmpty(shopIds)){ |
| | | shopIds = shopIds + "," + join; |
| | | }else{ |
| | | shopIds = join; |
| | | } |
| | | mgtShopOrderPageDto.setShopIds(shopIds); |
| | | } |
| | | List<MgtShopOrderPageVo> shopOrderPageVoList = orderMapper.pageMgtShopOrder(page, mgtShopOrderPageDto); |
| | | // 如果列表不为空 |
| | |
| | | * @date 2023/6/18 17:20 |
| | | */ |
| | | @Override |
| | | public MgtBulletinBoardVo boardOrderTotal() { |
| | | MgtBulletinBoardVo mgtBulletinBoardVo = orderMapper.boardOrderTotal(); |
| | | Integer activityUserTotal = orderMapper.activityUserTotal(); |
| | | public MgtBulletinBoardVo boardOrderTotal(List<Long> userIds) { |
| | | BoardMemberTotalDto boardMemberTotalDto = new BoardMemberTotalDto(); |
| | | boardMemberTotalDto.setUserIds(userIds); |
| | | List<Shop> shopList = remoteShopService.getShopBySysUserIds(boardMemberTotalDto); |
| | | List<Long> collect = shopList.stream().map(Shop::getShopId).collect(Collectors.toList()); |
| | | MgtBulletinBoardVo mgtBulletinBoardVo = orderMapper.boardOrderTotal(collect); |
| | | Integer activityUserTotal = orderMapper.activityUserTotal(collect); |
| | | mgtBulletinBoardVo.setActivityUserTotal(activityUserTotal); |
| | | return mgtBulletinBoardVo; |
| | | } |
| | |
| | | userIdList.add(mgtBasePlatformDto.getUserId()); |
| | | } else { |
| | | MgtUserIdByDept mgtUserIdByDept = new MgtUserIdByDept(); |
| | | mgtUserIdByDept.setDeptId(mgtBasePlatformDto.getUserId()); |
| | | mgtUserIdByDept.setDeptId(mgtBasePlatformDto.getDeptId()); |
| | | mgtUserIdByDept = remoteConfigService.getUserIdByDept(mgtUserIdByDept).getData(); |
| | | userIdList = mgtUserIdByDept.getUserIdList(); |
| | | } |
| | |
| | | mgtBasePlatformDto.setUserIdList(userIdList); |
| | | } |
| | | } |
| | | //数据权限 |
| | | List<Long> userIds = remoteUserService.getScopeOfAuthorityUserId(); |
| | | if(null != userIds){ |
| | | List<Long> userIdList = mgtBasePlatformDto.getUserIdList(); |
| | | if(null != userIdList){ |
| | | userIdList.addAll(userIds); |
| | | }else{ |
| | | userIdList = userIds; |
| | | } |
| | | mgtBasePlatformDto.setUserIdList(userIdList); |
| | | } |
| | | |
| | | |
| | | List<Long> shopIdList = new ArrayList<>(); |
| | | if(mgtBasePlatformDto.getShopId()!=null){ |
| | | shopIdList.add(mgtBasePlatformDto.getShopId()); |
| | |
| | | MgtSimpleShopVo simpleShopVo; |
| | | HashSet<String> set = new HashSet<>(); |
| | | // 遍历MgtMemberOrderPageVoList,获取shopId并添加到set中 |
| | | for (Long entity : shopIdList) { |
| | | set.add(entity.toString()); |
| | | if(null != shopIdList){ |
| | | for (Long entity : shopIdList) { |
| | | set.add(entity.toString()); |
| | | } |
| | | } |
| | | String joinedString = String.join(",", set); |
| | | MgtBaseBathDto mgtBaseBathDto = new MgtBaseBathDto(); |
| | |
| | | if (mgtBasePlatformDto.getUserId() != null) { |
| | | userIdList.add(mgtBasePlatformDto.getUserId()); |
| | | } else { |
| | | MgtUserIdByDept mgtUserIdByDept = new MgtUserIdByDept(); |
| | | mgtUserIdByDept.setDeptId(mgtBasePlatformDto.getUserId()); |
| | | mgtUserIdByDept = remoteConfigService.getUserIdByDept(mgtUserIdByDept).getData(); |
| | | userIdList = mgtUserIdByDept.getUserIdList(); |
| | | List<SysUser> data = remoteUserService.getUsersByDeptId(mgtBasePlatformDto.getDeptId()).getData(); |
| | | userIdList.addAll(data.stream().map(SysUser::getUserId).collect(Collectors.toList())); |
| | | } |
| | | if (!userIdList.isEmpty()) { |
| | | mgtBasePlatformDto.setUserIdList(userIdList); |
| | | } |
| | | } |
| | | //数据权限 |
| | | List<Long> userIdList = mgtBasePlatformDto.getUserIdList(); |
| | | List<Long> userIds = remoteUserService.getScopeOfAuthorityUserId(); |
| | | if(null != userIds){ |
| | | if(null != userIdList){ |
| | | userIdList.addAll(userIds); |
| | | }else{ |
| | | userIdList = userIds; |
| | | } |
| | | mgtBasePlatformDto.setUserIdList(userIdList); |
| | | } |
| | | |
| | | |
| | | MgtTotalOrderTotalVo mgtTotalOrderTotalVo = new MgtTotalOrderTotalVo(); |
| | | mgtTotalOrderTotalVo.setOrderTotal(0); |
| | | mgtTotalOrderTotalVo.setOnlineTotal(0); |
| | |
| | | mgtTotalOrderTotalVo.setCycleTotal(0); |
| | | mgtTotalOrderTotalVo.setExperienceTotal(0); |
| | | mgtTotalOrderTotalVo.setServiceTotal(0); |
| | | mgtTotalOrderTotalVo.setItemTotal(0); |
| | | mgtTotalOrderTotalVo.setOrderMoney(new BigDecimal("0")); |
| | | mgtTotalOrderTotalVo.setOnlineMoney(new BigDecimal("0")); |
| | | mgtTotalOrderTotalVo.setOfflineMoney(new BigDecimal("0")); |
| | |
| | | mgtTotalOrderTotalVo.setCycleMoney(new BigDecimal("0")); |
| | | mgtTotalOrderTotalVo.setExperienceMoney(new BigDecimal("0")); |
| | | mgtTotalOrderTotalVo.setServiceMoney(new BigDecimal("0")); |
| | | mgtTotalOrderTotalVo.setItemMoney(new BigDecimal("0")); |
| | | mgtTotalOrderTotalVo.setOrderTotalKey(new String[0]); |
| | | mgtTotalOrderTotalVo.setOrderTotalValue(new Integer[0]); |
| | | mgtTotalOrderTotalVo.setOrderMoneyValue(new BigDecimal[0]); |
| | |
| | | mgtTotalOrderTotalVo.setGoodsTypeMoneyList(Lists.newArrayList()); |
| | | mgtTotalOrderTotalVo.setGoodsRankList(Lists.newArrayList()); |
| | | mgtTotalOrderTotalVo.setOrderFromRankList(Lists.newArrayList()); |
| | | |
| | | List<Long> shopIdList = remoteShopService.listShopIdByPlTotal(mgtBasePlatformDto).getData(); |
| | | if (mgtBasePlatformDto.getUserId() != null || StringUtils.isNotBlank(mgtBasePlatformDto.getShopProvinceCode()) || StringUtils.isNotBlank(mgtBasePlatformDto.getShopCityCode()) || StringUtils.isNotBlank(mgtBasePlatformDto.getShopAreaCode())) { |
| | | if(shopIdList==null||shopIdList.isEmpty()){ |
| | |
| | | mgtTotalOrderTotalVo.setCycleMoney(BigDecimal.ZERO); |
| | | mgtTotalOrderTotalVo.setServiceTotal(0); |
| | | mgtTotalOrderTotalVo.setServiceMoney(BigDecimal.ZERO); |
| | | mgtTotalOrderTotalVo.setItemTotal(0); |
| | | mgtTotalOrderTotalVo.setItemMoney(BigDecimal.ZERO); |
| | | mgtTotalOrderTotalVo.setExperienceTotal(0); |
| | | mgtTotalOrderTotalVo.setExperienceMoney(BigDecimal.ZERO); |
| | | if (MgtMapIntTotalVoGoodsType != null && MgtMapIntTotalVoGoodsType.size() > 0) { |
| | |
| | | } else if (MgtMapIntTotalVoGoodsType.get(i).getMapKey().equals("4")) { |
| | | mgtMapIntTotalVo.setMapKey("单品"); |
| | | mgtMapBigTotalVo.setMapKey("单品"); |
| | | mgtTotalOrderTotalVo.setItemTotal(mgtTotalOrderTotalVo.getItemTotal() + MgtMapIntTotalVoGoodsType.get(i).getMapValueFirst()); |
| | | mgtTotalOrderTotalVo.setItemMoney(mgtTotalOrderTotalVo.getItemMoney().add(MgtMapIntTotalVoGoodsType.get(i).getMapValueSecond())); |
| | | noGoods = false; |
| | | } |
| | | goodsTypeTotalList.add(mgtMapIntTotalVo); |
| | |
| | | if(mgtBasePlatformDto.getActivityFrom()!=null&&mgtBasePlatformDto.getActivityFrom()==2){ |
| | | return totalActivityTotalVo; |
| | | } |
| | | |
| | | //数据权限 |
| | | List<Long> userIds = remoteUserService.getScopeOfAuthorityUserId(); |
| | | if(null != userIds){ |
| | | List<Long> userIdList = mgtBasePlatformDto.getUserIdList(); |
| | | if(null == userIdList){ |
| | | userIdList = new ArrayList<>(); |
| | | } |
| | | userIdList.addAll(userIds); |
| | | mgtBasePlatformDto.setUserIdList(userIdList); |
| | | } |
| | | |
| | | List<Long> shopIdList = remoteShopService.listShopIdByPlTotal(mgtBasePlatformDto).getData(); |
| | | if (StringUtils.isNotBlank(mgtBasePlatformDto.getShopProvinceCode()) || StringUtils.isNotBlank(mgtBasePlatformDto.getShopCityCode()) || StringUtils.isNotBlank(mgtBasePlatformDto.getShopAreaCode())) { |
| | | if(shopIdList==null||shopIdList.isEmpty()){ |
| | |
| | | shopIdList.add(mgtBasePlatformDto.getShopId()); |
| | | } |
| | | mgtBasePlatformDto.setShopIdList(shopIdList); |
| | | |
| | | //获取基础统计 |
| | | MgtPlTotalActivityTotalVo mgtTotalActivityTotalVo = orderMapper.getPlTotalActivityTotal(mgtBasePlatformDto); |
| | | totalActivityTotalVo.setOrderTotal(mgtTotalActivityTotalVo.getOrderTotal()); |
| | |
| | | } |
| | | HashSet<String> set = new HashSet<>(); |
| | | // 遍历MgtMemberOrderPageVoList,获取shopId并添加到set中 |
| | | for (Long shopId : mgtBasePlatformDto.getShopIdList()) { |
| | | set.add(shopId.toString()); |
| | | if(null != mgtBasePlatformDto.getShopIdList()){ |
| | | for (Long shopId : mgtBasePlatformDto.getShopIdList()) { |
| | | set.add(shopId.toString()); |
| | | } |
| | | } |
| | | // 将set中的shopId转换为逗号分隔的字符串 |
| | | String joinedString = String.join(",", set); |
| | |
| | | totalActivityTotalVo.setOrderTotalValue(orderTotalValue); |
| | | totalActivityTotalVo.setOrderMoneyValue(orderMoneyValue); |
| | | } |
| | | |
| | | //参与人数 2023-09-06 另开接口 |
| | | /*List<MgtMapIntTotalVo> joinList = orderMapper.getMgtActivityMemberTotal(mgtBasePlatformDto); |
| | | // 将查询结果转为Map |
| | | Map<String, Integer> mgtMapIntTotalVoMap = new HashMap<>(); |
| | | if (joinList != null && !joinList.isEmpty()) { |
| | | mgtMapIntTotalVoMap = joinList.stream() |
| | | .collect(Collectors.toMap(MgtMapIntTotalVo::getMapKey, MgtMapIntTotalVo::getMapValue)); |
| | | } |
| | | // 获取日期范围 |
| | | List<String> dateList = getDateRange(mgtBasePlatformDto.getStartDate(), mgtBasePlatformDto.getEndDate()); |
| | | int size = dateList.size(); |
| | | // 创建日期和成员总数的数组 |
| | | String[] joinMemberTotalKey = new String[size]; |
| | | Integer[] joinMemberTotalValue = new Integer[size]; |
| | | // 遍历日期列表,设置日期和成员总数的数组 |
| | | String str; |
| | | Integer value; |
| | | for (int i = 0; i < size; i++) { |
| | | str = dateList.get(i); |
| | | joinMemberTotalKey[i] = str; |
| | | value = mgtMapIntTotalVoMap.get(str); |
| | | joinMemberTotalValue[i] = (value != null) ? value : 0; |
| | | } |
| | | totalActivityTotalVo.setJoinMemberTotalKey(joinMemberTotalKey); |
| | | totalActivityTotalVo.setJoinMemberTotalValue(joinMemberTotalValue); |
| | | //获客人数 |
| | | List<MgtMapIntTotalVo> getList = orderMapper.getMgtActivityGetMemberTotal(mgtBasePlatformDto); |
| | | // 将查询结果转为Map |
| | | Map<String, Integer> getMemberMap = new HashMap<>(); |
| | | if (getList != null && !getList.isEmpty()) { |
| | | getMemberMap = getList.stream() |
| | | .collect(Collectors.toMap(MgtMapIntTotalVo::getMapKey, MgtMapIntTotalVo::getMapValue)); |
| | | } |
| | | // 创建日期和成员总数的数组 |
| | | String[] getMemberTotalKey = new String[size]; |
| | | Integer[] getMemberTotalValue = new Integer[size]; |
| | | // 遍历日期列表,设置日期和成员总数的数组 |
| | | for (int i = 0; i < size; i++) { |
| | | str = dateList.get(i); |
| | | getMemberTotalKey[i] = str; |
| | | value = getMemberMap.get(str); |
| | | getMemberTotalValue[i] = (value != null) ? value : 0; |
| | | } |
| | | totalActivityTotalVo.setGetMemberTotalKey(getMemberTotalKey); |
| | | totalActivityTotalVo.setGetMemberTotalValue(getMemberTotalValue);*/ |
| | | return totalActivityTotalVo; |
| | | } |
| | | |
| | |
| | | if(mgtBasePlatformDto.getActivityFrom()!=null&&mgtBasePlatformDto.getActivityFrom()==2){ |
| | | return totalActivityTotalVo; |
| | | } |
| | | /*if(mgtBasePlatformDto.getActivityType()!=null&&mgtBasePlatformDto.getActivityType()!=1){ |
| | | return new MgtPlTotalActivityTotalVo(); |
| | | }*/ |
| | | //获取需要关联的用户id集合 |
| | | /*if (mgtBasePlatformDto.getDeptId() != null) { |
| | | List<Long> userIdList = new ArrayList<>(); |
| | | if (mgtBasePlatformDto.getUserId() != null) { |
| | | userIdList.add(mgtBasePlatformDto.getUserId()); |
| | | } else { |
| | | MgtUserIdByDept mgtUserIdByDept = new MgtUserIdByDept(); |
| | | mgtUserIdByDept.setDeptId(mgtBasePlatformDto.getUserId()); |
| | | mgtUserIdByDept = remoteConfigService.getUserIdByDept(mgtUserIdByDept).getData(); |
| | | userIdList = mgtUserIdByDept.getUserIdList(); |
| | | } |
| | | if (!userIdList.isEmpty()) { |
| | | mgtBasePlatformDto.setUserIdList(userIdList); |
| | | } |
| | | }*/ |
| | | |
| | | List<Long> shopIdList = remoteShopService.listShopIdByPlTotal(mgtBasePlatformDto).getData(); |
| | | log.info("shopIdList1-----"+shopIdList.toString()); |
| | |
| | | if(mgtBasePlatformDto.getShopId()!=null){ |
| | | shopIdList = new ArrayList<>(); |
| | | shopIdList.add(mgtBasePlatformDto.getShopId()); |
| | | } |
| | | |
| | | List<Long> userIds = remoteUserService.getScopeOfAuthorityUserId(); |
| | | BoardMemberTotalDto boardMemberTotalDto = new BoardMemberTotalDto(); |
| | | boardMemberTotalDto.setUserIds(userIds); |
| | | List<Shop> shopList = remoteShopService.getShopBySysUserIds(boardMemberTotalDto); |
| | | List<Long> collect = shopList.stream().map(Shop::getShopId).collect(Collectors.toList()); |
| | | if(null != shopIdList){ |
| | | shopIdList.addAll(collect); |
| | | }else{ |
| | | shopIdList = collect; |
| | | } |
| | | mgtBasePlatformDto.setShopIdList(shopIdList); |
| | | if(mgtBasePlatformDto.getAgeType()!=null){ |
| | |
| | | if(mgtBasePlatformDto.getActivityFrom()!=null&&mgtBasePlatformDto.getActivityFrom()==2){ |
| | | return totalActivityTotalVo; |
| | | } |
| | | /*if(mgtBasePlatformDto.getActivityType()!=null&&mgtBasePlatformDto.getActivityType()!=1){ |
| | | return new MgtPlTotalActivityTotalVo(); |
| | | }*/ |
| | | //获取需要关联的用户id集合 |
| | | /*if (mgtBasePlatformDto.getDeptId() != null) { |
| | | List<Long> userIdList = new ArrayList<>(); |
| | | if (mgtBasePlatformDto.getUserId() != null) { |
| | | userIdList.add(mgtBasePlatformDto.getUserId()); |
| | | } else { |
| | | MgtUserIdByDept mgtUserIdByDept = new MgtUserIdByDept(); |
| | | mgtUserIdByDept.setDeptId(mgtBasePlatformDto.getUserId()); |
| | | mgtUserIdByDept = remoteConfigService.getUserIdByDept(mgtUserIdByDept).getData(); |
| | | userIdList = mgtUserIdByDept.getUserIdList(); |
| | | } |
| | | if (!userIdList.isEmpty()) { |
| | | mgtBasePlatformDto.setUserIdList(userIdList); |
| | | } |
| | | }*/ |
| | | List<Long> shopIdList = remoteShopService.listShopIdByPlTotal(mgtBasePlatformDto).getData(); |
| | | if (StringUtils.isNotBlank(mgtBasePlatformDto.getShopProvinceCode()) || StringUtils.isNotBlank(mgtBasePlatformDto.getShopCityCode()) || StringUtils.isNotBlank(mgtBasePlatformDto.getShopAreaCode())) { |
| | | if(shopIdList==null||shopIdList.isEmpty()){ |
| | |
| | | if(mgtBasePlatformDto.getShopId()!=null){ |
| | | shopIdList = new ArrayList<>(); |
| | | shopIdList.add(mgtBasePlatformDto.getShopId()); |
| | | } |
| | | //数据权限 |
| | | List<Long> userIds = remoteUserService.getScopeOfAuthorityUserId(); |
| | | BoardMemberTotalDto boardMemberTotalDto = new BoardMemberTotalDto(); |
| | | boardMemberTotalDto.setUserIds(userIds); |
| | | List<Shop> shopList = remoteShopService.getShopBySysUserIds(boardMemberTotalDto); |
| | | List<Long> collect = shopList.stream().map(Shop::getShopId).collect(Collectors.toList()); |
| | | if(null != shopIdList){ |
| | | shopIdList.addAll(collect); |
| | | }else{ |
| | | shopIdList = collect; |
| | | } |
| | | mgtBasePlatformDto.setShopIdList(shopIdList); |
| | | if(mgtBasePlatformDto.getAgeType()!=null){ |
| | |
| | | // 创建MerVerifyCouponVo对象 |
| | | MerVerifyCouponVo merVerifyCouponVo = new MerVerifyCouponVo(); |
| | | // 调用remoteCouponService的getVerifyCoupon方法获取MerVerifyCouponGetVo对象 |
| | | MerVerifyCouponGetVo verifyCouponGetVo = remoteCouponService.getVerifyCoupon(verifyCode).getData(); |
| | | R<MerVerifyCouponGetVo> verifyCoupon = remoteCouponService.getVerifyCoupon(Long.valueOf(verifyCode)); |
| | | if(verifyCoupon.getCode() != 200){ |
| | | throw new ServiceException(verifyCoupon.getMsg()); |
| | | } |
| | | MerVerifyCouponGetVo verifyCouponGetVo = verifyCoupon.getData(); |
| | | MemberCoupon memberCoupon = verifyCouponGetVo.getMemberCoupon(); |
| | | // 检查优惠券状态 |
| | | int couponStatus = memberCoupon.getCouponStatus(); |
| | |
| | | @GlobalTransactional(rollbackFor = Exception.class) |
| | | public void payBack(PartnerTransactionsResult transaction, BigDecimal feeAmount) { |
| | | log.info("订单支付回调---"+transaction.toString()); |
| | | // Order order = this.getById(orderId); |
| | | // 更新订单状态 outTradeNo |
| | | String outTradeNo = transaction.getOutTradeNo(); |
| | | Order order = this.getByOutTradeNo(outTradeNo); |
| | |
| | | } |
| | | //更新商品统计 |
| | | remoteGoodsService.changeGoodsTotal(goodsTotalChangeDtoList); |
| | | // 更新商户统计信息 |
| | | /*ShopTotalChangeDto shopTotalChangeDto = new ShopTotalChangeDto(); |
| | | shopTotalChangeDto.setShopId(order.getShopId()); |
| | | shopTotalChangeDto.setOrderType(1); |
| | | shopTotalChangeDto.setCycleMoney(cycleMoney); |
| | | shopTotalChangeDto.setServiceMoney(serviceMoney); |
| | | shopTotalChangeDto.setExperienceMoney(experienceMoney); |
| | | shopTotalChangeDto.setGoodsMoney(goodsMoney); |
| | | remoteShopService.changeShopTotal(shopTotalChangeDto);*/ |
| | | // 初始化会员统计信息 |
| | | MemberTotalChangeDto memberTotalChangeDto = new MemberTotalChangeDto(); |
| | | memberTotalChangeDto.setUserId(order.getUserId()); |
| | | // 如果存在积分兑换比例,则计算积分 2023-09-14改为核销后获取积分 |
| | | /*if (redisService.hasKey(SecurityConstant.PAY_MONEY_INTEGRAL)) { |
| | | Integer moneyValue = redisService.getCacheObject(SecurityConstant.PAY_MONEY_INTEGRAL); |
| | | BigDecimal moneyValueBig = BigDecimal.valueOf(moneyValue); |
| | | BigDecimal integralBig = moneyValueBig.multiply(order.getPayMoney()).setScale(0,BigDecimal.ROUND_HALF_UP); |
| | | Integer integral = Integer.valueOf(integralBig.toString()); |
| | | if(integral>0){ |
| | | memberTotalChangeDto.setChangeIntegral(integral); |
| | | memberTotalChangeDto.setTypeIntegral(1); |
| | | memberTotalChangeDto.setOrderId(orderId); |
| | | memberTotalChangeDto.setOrderNo(order.getOrderNo()); |
| | | } |
| | | }*/ |
| | | // 设置会员支付金额和支付时间 |
| | | memberTotalChangeDto.setPayMoney(order.getPayMoney()); |
| | | memberTotalChangeDto.setPayTime(new Date()); |
| | |
| | | remoteCouponService.backMemberCoupon(memberCouponSJ.toString()); |
| | | } |
| | | } |
| | | // 更新商户统计信息 |
| | | /*ShopTotalChangeDto shopTotalChangeDto = new ShopTotalChangeDto(); |
| | | shopTotalChangeDto.setOrderType(2); |
| | | shopTotalChangeDto.setShopId(order.getShopId()); |
| | | shopTotalChangeDto.setCycleMoney(cycleMoney); |
| | | shopTotalChangeDto.setServiceMoney(serviceMoney); |
| | | shopTotalChangeDto.setExperienceMoney(experienceMoney); |
| | | shopTotalChangeDto.setGoodsMoney(goodsMoney); |
| | | remoteShopService.changeShopTotal(shopTotalChangeDto);*/ |
| | | // 初始化会员统计信息 |
| | | MemberTotalChangeDto memberTotalChangeDto = new MemberTotalChangeDto(); |
| | | memberTotalChangeDto.setUserId(order.getUserId()); |
| | | // 如果存在积分兑换比例,则计算积分 2023-09-14改为核销后获取积分 |
| | | /*if (redisService.hasKey(SecurityConstant.PAY_MONEY_INTEGRAL)) { |
| | | Integer moneyValue = redisService.getCacheObject(SecurityConstant.PAY_MONEY_INTEGRAL); |
| | | BigDecimal moneyValueBig = BigDecimal.valueOf(moneyValue); |
| | | BigDecimal integralBig = moneyValueBig.multiply(order.getPayMoney()); |
| | | Integer integral = Integer.valueOf(integralBig.toString()); |
| | | memberTotalChangeDto.setChangeIntegral(integral); |
| | | memberTotalChangeDto.setTypeIntegral(2); |
| | | }*/ |
| | | // 设置会员支付金额和支付时间 |
| | | memberTotalChangeDto.setPayMoney(order.getPayMoney().negate()); |
| | | // 根据商品存在状态,设置会员统计信息 |