| | |
| | | import cc.mrbird.febs.mall.service.IApiMallMemberWalletService; |
| | | import cc.mrbird.febs.mall.vo.*; |
| | | import cc.mrbird.febs.mall.dto.ApiOperateDoDto; |
| | | import cc.mrbird.febs.mall.vo.activity.ApiActivityOrderInfoVo; |
| | | import cc.mrbird.febs.mall.vo.activity.ApiActivityOrderListVo; |
| | | import cc.mrbird.febs.mall.vo.activity.ApiCheckOrderVo; |
| | | import cc.mrbird.febs.mall.vo.activity.ApiVoteActivityHotVo; |
| | | import cc.mrbird.febs.mall.vo.activity.*; |
| | | import cc.mrbird.febs.pay.model.BrandWCPayRequestData; |
| | | import cc.mrbird.febs.pay.service.IXcxPayService; |
| | | import cc.mrbird.febs.rabbit.producter.AgentProducer; |
| | |
| | | private final HappyActivityOptionMapper happyActivityOptionMapper; |
| | | private final HappyActivityConnectMapper happyActivityConnectMapper; |
| | | private final HappyActivityOrderMapper happyActivityOrderMapper; |
| | | private final HappyActivityCommentMapper happyActivityCommentMapper; |
| | | private final HappyActivityOrderItemMapper happyActivityOrderItemMapper; |
| | | private final IXcxPayService iXcxPayService; |
| | | private final IApiMallMemberWalletService iApiMallMemberWalletService; |
| | |
| | | ); |
| | | if(happyActivity != null){ |
| | | BeanUtil.copyProperties(happyActivity,apiActivityVo); |
| | | |
| | | Integer commentCount = happyActivityCommentMapper.selectCount( |
| | | new LambdaQueryWrapper<HappyActivityComment>() |
| | | .eq(HappyActivityComment::getActivityId, happyActivity.getId()) |
| | | .eq(HappyActivityComment::getShowState, StateUpDownEnum.UP.getCode()) |
| | | ); |
| | | apiActivityVo.setCommentCount(commentCount); |
| | | |
| | | List<HappyFollow> happyFollows = happyFollowMapper.selectList( |
| | | new LambdaQueryWrapper<HappyFollow>() |
| | | .select(HappyFollow::getId, HappyFollow::getType) |
| | |
| | | if(amount.compareTo(BigDecimal.ZERO) < 0){ |
| | | throw new FebsException("支付金额错误"); |
| | | } |
| | | DateTime failTime = DateUtil.offsetMinute(new Date(), StateUpDownEnum.ORDER_OVERTIME.getCode()); |
| | | HappyActivityOrder happyActivityOrder = new HappyActivityOrder(); |
| | | happyActivityOrder.setOrderNo(MallUtils.getOrderNum()); |
| | | happyActivityOrder.setMemberId(memberId); |
| | |
| | | happyActivityOrder.setNumCnt(dto.getNumCnt()); |
| | | happyActivityOrder.setAmount(amount); |
| | | happyActivityOrder.setPayState(StateUpDownEnum.PAY_STATE_NOT_PAY.getCode()); |
| | | happyActivityOrder.setPayType(StateUpDownEnum.PAY_METHOD_WECHAT.getCode()); |
| | | happyActivityOrder.setFailTime(failTime); |
| | | log.info("创建订单,订单号="+JSONUtil.parse(happyActivityOrder)); |
| | | happyActivityOrderMapper.insert(happyActivityOrder); |
| | | |
| | | for(Long connectId : connectIds){ |
| | |
| | | HashMap<String, Object> stringObjectHashMap = new HashMap<>(); |
| | | stringObjectHashMap.put("orderId",happyActivityOrder.getId()); |
| | | stringObjectHashMap.put("amount",amount); |
| | | stringObjectHashMap.put("failTime",failTime); |
| | | |
| | | return new FebsResponse().success().data(stringObjectHashMap); |
| | | } |
| | |
| | | log.error("支付失败,订单ID:{},支付类型:{}", orderId, payType, e); |
| | | throw new FebsException("支付失败:" + e.getMessage()); |
| | | } |
| | | |
| | | // todo 支付失败要把对应的人数加回来 |
| | | |
| | | // 构造返回结果,包含支付相关信息 |
| | | Map<String, Object> map = new HashMap<>(); |
| | |
| | | List<HappyActivityOrder> happyActivityOrders = happyActivityOrderMapper.selectList( |
| | | new LambdaQueryWrapper<HappyActivityOrder>() |
| | | .eq(HappyActivityOrder::getState, StateUpDownEnum.ORDER_STATE_WAIT_PAY.getCode()) |
| | | .lt(HappyActivityOrder::getCreatedTime, DateUtil.offsetMinute(new Date(), -10)) |
| | | .lt(HappyActivityOrder::getFailTime, new Date()) |
| | | ); |
| | | if(CollUtil.isNotEmpty(happyActivityOrders)){ |
| | | happyActivityOrders.forEach(happyActivityOrder -> { |
| | |
| | | Long activityId = happyActivityOrder.getActivityId(); |
| | | Integer numCnt = happyActivityOrder.getNumCnt(); |
| | | this.baseMapper.updateHappyActivitySurplusCnt(activityId,numCnt); |
| | | }); |
| | | |
| | | happyActivityOrder.setState(StateUpDownEnum.ORDER_STATE_OVERTIME.getCode()); |
| | | happyActivityOrderMapper.updateById(happyActivityOrder); |
| | | }); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public FebsResponse addComment(ApiPayOrderAddCommentDto dto) { |
| | | // 获取当前登录用户的ID |
| | | Long memberId = LoginUserUtil.getLoginUser().getId(); |
| | | Long orderId = dto.getOrderId(); |
| | | |
| | | HappyActivityOrder happyActivityOrder = happyActivityOrderMapper.selectById(orderId); |
| | | if(StateUpDownEnum.ORDER_STATE_USED.getCode() != happyActivityOrder.getState()){ |
| | | throw new FebsException("该订单状态不是已使用状态!"); |
| | | } |
| | | |
| | | happyActivityOrder.setState(StateUpDownEnum.ORDER_STATE_COMMENT.getCode()); |
| | | happyActivityOrderMapper.updateById(happyActivityOrder); |
| | | |
| | | HappyActivity happyActivity = this.baseMapper.selectById(happyActivityOrder.getActivityId()); |
| | | |
| | | HappyActivityComment happyActivityComment = new HappyActivityComment(); |
| | | happyActivityComment.setActivityId(happyActivity.getId()); |
| | | happyActivityComment.setActivityName(happyActivity.getName()); |
| | | happyActivityComment.setMemberId(memberId); |
| | | happyActivityComment.setOrderId(orderId); |
| | | happyActivityComment.setStar(dto.getStar()); |
| | | happyActivityComment.setComment(dto.getComment()); |
| | | happyActivityComment.setImages(dto.getImages()); |
| | | happyActivityCommentMapper.insert(happyActivityComment); |
| | | |
| | | return new FebsResponse().success().message("操作成功"); |
| | | } |
| | | |
| | | @Override |
| | | public List<ApiActivityCommentVo> commentByActivityId(ApiActivityCommentDto dto) { |
| | | Page<ApiActivityCommentVo> page = new Page<>(dto.getPageNow(), dto.getPageSize()); |
| | | return this.baseMapper.selectActivityCommentPage(page,dto); |
| | | } |
| | | |
| | | @Override |
| | | public FebsResponse voteActivityHot(Long id) { |
| | | |
| | | ApiVoteActivityHotVo apiVoteActivityHotVo = new ApiVoteActivityHotVo(); |