| | |
| | | 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; |
| | |
| | | //处理订单回显 |
| | | 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 { |
| | |
| | | // 根据用户ID列表获取用户信息 |
| | | MgtBaseBathDto mgtBaseBathDto = new MgtBaseBathDto(); |
| | | mgtBaseBathDto.setIds(userIdSj.toString()); |
| | | List<MgtSimpleMemberVo> simpleMemberVoList = remoteMemberService.listSimpleVoByIds(mgtBaseBathDto).getData(); |
| | | List<MgtSimpleMemberVo> simpleMemberVoList = remoteMemberService.listSimpleVoByIds(userIdSj.toString()).getData(); |
| | | Map<Long, MgtSimpleMemberVo> userMap = simpleMemberVoList.stream() |
| | | .collect(Collectors.toMap(MgtSimpleMemberVo::getUserId, Function.identity())); |
| | | // 遍历订单列表,设置用户信息 |
| | |
| | | .collect(Collectors.toMap(MgtSimpleShopVo::getShopId, Function.identity())); |
| | | mgtBaseBathDto = new MgtBaseBathDto(); |
| | | mgtBaseBathDto.setIds(userJoinedString); |
| | | List<MgtSimpleMemberVo> simpleMemberVoList = remoteMemberService.listSimpleVoByIds(mgtBaseBathDto).getData(); |
| | | List<MgtSimpleMemberVo> simpleMemberVoList = remoteMemberService.listSimpleVoByIds(userJoinedString).getData(); |
| | | Map<Long, MgtSimpleMemberVo> userMap = simpleMemberVoList.stream() |
| | | .collect(Collectors.toMap(MgtSimpleMemberVo::getUserId, Function.identity())); |
| | | // 遍历列表,设置店铺名称、用户名称和未支付金额 |
| | | for (MgtActivityOrderPageVo mgtActivityOrderPageVo : activityOrderPageVoList) { |
| | | if(mgtActivityOrderPageVo.getShopId()!=null){ |
| | | mgtActivityOrderPageVo.setShopName(shopMap.get(mgtActivityOrderPageVo.getShopId()).getShopName()); |
| | | MgtSimpleShopVo mgtSimpleShopVo = shopMap.get(mgtActivityOrderPageVo.getShopId()); |
| | | mgtActivityOrderPageVo.setShopName(null == mgtSimpleShopVo ? "" : mgtSimpleShopVo.getShopName()); |
| | | |
| | | } |
| | | if (userMap.get(mgtActivityOrderPageVo.getUserId()) != null) { |
| | |
| | | String userJoinedString = String.join(",", userIdSet.stream().map(Object::toString).collect(Collectors.toList())); |
| | | MgtBaseBathDto mgtBaseBathDto = new MgtBaseBathDto(); |
| | | mgtBaseBathDto.setIds(userJoinedString); |
| | | List<MgtSimpleMemberVo> simpleMemberVoList = remoteMemberService.listSimpleVoByIds(mgtBaseBathDto).getData(); |
| | | List<MgtSimpleMemberVo> simpleMemberVoList = remoteMemberService.listSimpleVoByIds(userJoinedString).getData(); |
| | | userMap = simpleMemberVoList.stream() |
| | | .collect(Collectors.toMap(MgtSimpleMemberVo::getUserId, Function.identity())); |
| | | } |
| | |
| | | mgtTotalOrderTotalVo.setOrderTotal(totalOrderTotalVo.getOrderTotal()); |
| | | mgtTotalOrderTotalVo.setOnlineTotal(totalOrderTotalVo.getOnlineTotal()); |
| | | mgtTotalOrderTotalVo.setOfflineTotal(totalOrderTotalVo.getOfflineTotal()); |
| | | mgtTotalOrderTotalVo.setActivityTotal(0); |
| | | mgtTotalOrderTotalVo.setActivityTotal(totalOrderTotalVo.getActivityTotal()); |
| | | mgtTotalOrderTotalVo.setOrderMoney(totalOrderTotalVo.getOrderMoney()); |
| | | mgtTotalOrderTotalVo.setOnlineMoney(totalOrderTotalVo.getOnlineMoney()); |
| | | mgtTotalOrderTotalVo.setOfflineMoney(totalOrderTotalVo.getOfflineMoney()); |
| | |
| | | String userJoinedString = String.join(",", userIdSet.stream().map(Object::toString).collect(Collectors.toList())); |
| | | MgtBaseBathDto mgtBaseBathDto = new MgtBaseBathDto(); |
| | | mgtBaseBathDto.setIds(userJoinedString); |
| | | List<MgtSimpleMemberVo> simpleMemberVoList = remoteMemberService.listSimpleVoByIds(mgtBaseBathDto).getData(); |
| | | List<MgtSimpleMemberVo> simpleMemberVoList = remoteMemberService.listSimpleVoByIds(userJoinedString).getData(); |
| | | userMap = simpleMemberVoList.stream() |
| | | .collect(Collectors.toMap(MgtSimpleMemberVo::getUserId, Function.identity())); |
| | | } |
| | |
| | | try { |
| | | redissonLock.lock(30, TimeUnit.SECONDS); |
| | | Integer surpNum = redisService.getCacheObject(SecurityConstant.ACTIVITY_GOODS + "-" + order.getActivityId() + "-" + orderGoods.getGoodsId()); |
| | | if(null == surpNum){ |
| | | surpNum = 0; |
| | | } |
| | | redisService.setCacheObject(SecurityConstant.ACTIVITY_GOODS + "-" + order.getActivityId() + "-" + orderGoods.getGoodsId(), surpNum + orderGoods.getBuyNum()); |
| | | } finally { |
| | | redissonLock.unlock(); |
| | |
| | | try { |
| | | redissonLock.lock(30, TimeUnit.SECONDS); |
| | | Integer surpNum = redisService.getCacheObject(SecurityConstant.ACTIVITY_GOODS + "-" + order.getActivityId() + "-" + orderGoods.getGoodsId()); |
| | | if(null == surpNum){ |
| | | surpNum = 0; |
| | | } |
| | | redisService.setCacheObject(SecurityConstant.ACTIVITY_GOODS + "-" + order.getActivityId() + "-" + orderGoods.getGoodsId(), surpNum + orderGoods.getBuyNum()); |
| | | } finally { |
| | | redissonLock.unlock(); |
| | |
| | | try { |
| | | redissonLock.lock(30, TimeUnit.SECONDS); |
| | | Integer surpNum = redisService.getCacheObject(SecurityConstant.ACTIVITY_GOODS + "-" + order.getActivityId() + "-" + orderGoods.getGoodsId()); |
| | | if(null == surpNum){ |
| | | surpNum = 0; |
| | | } |
| | | redisService.setCacheObject(SecurityConstant.ACTIVITY_GOODS + "-" + order.getActivityId() + "-" + orderGoods.getGoodsId(), surpNum + orderGoods.getBuyNum()); |
| | | } finally { |
| | | redissonLock.unlock(); |
| | |
| | | // 获取用户列表 |
| | | MgtBaseBathDto mgtBaseBathDto = new MgtBaseBathDto(); |
| | | mgtBaseBathDto.setIds(userIdSj.toString()); |
| | | List<MgtSimpleMemberVo> simpleMemberVoList = remoteMemberService.listSimpleVoByIds(mgtBaseBathDto).getData(); |
| | | List<MgtSimpleMemberVo> simpleMemberVoList = remoteMemberService.listSimpleVoByIds(userIdSj.toString()).getData(); |
| | | // 将用户列表转换为Map,以便根据用户ID快速查找用户信息 |
| | | Map<Long, MgtSimpleMemberVo> userMap = simpleMemberVoList.stream() |
| | | .collect(Collectors.toMap(MgtSimpleMemberVo::getUserId, Function.identity())); |