| | |
| | | import com.ruoyi.system.api.domain.vo.MgtSimpleShopVo; |
| | | import com.ruoyi.system.api.domain.vo.MgtUserIdByKeywordVo; |
| | | import com.ruoyi.system.api.service.RemoteConfigService; |
| | | import com.ruoyi.system.api.service.RemoteFileService; |
| | | import com.ruoyi.system.api.service.RemoteMemberService; |
| | | import com.ruoyi.system.api.service.RemoteShopService; |
| | | import org.redisson.api.RLock; |
| | |
| | | @Resource |
| | | private RedisService redisService; |
| | | |
| | | |
| | | @Autowired |
| | | private RedissonClient redissonClient; |
| | | |
| | | @Resource |
| | | private RemoteFileService remoteFileService; |
| | | |
| | | /** |
| | | * @param mgtActivityEditDto |
| | |
| | | activityTotal.setRefundTotal(0); |
| | | activityTotal.setOrderMoneyTotal(BigDecimal.ZERO); |
| | | activityTotalService.save(activityTotal); |
| | | CodeGetDto codeGetDto = new CodeGetDto(); |
| | | String url = "https://wxapp.hhhrt.cn/mini/activity?activityId="+activityId; |
| | | codeGetDto.setUrl(url); |
| | | codeGetDto.setFileName("activity-"+activityId); |
| | | String codeUrl = remoteFileService.getAppOrderTotal(codeGetDto).getData(); |
| | | activity.setActivityCode(codeUrl); |
| | | } |
| | | // 获取活动开始时间和结束时间 |
| | | Date activityStartTime = mgtActivityEditDto.getActivityStartTime(); |
| | |
| | | if(checkTime.compareTo(activityStartTime)>0){ |
| | | String activityId = activity.getActivityId(); |
| | | long currentTimeMillis = System.currentTimeMillis(); |
| | | long startTimeDifference = currentTimeMillis - activityStartTime.getTime(); |
| | | long endTimeDifference = currentTimeMillis - activityEndTime.getTime(); |
| | | long startTimeDifference = activityStartTime.getTime() - currentTimeMillis; |
| | | long endTimeDifference = activityEndTime.getTime() - currentTimeMillis; |
| | | // 查询延时任务 |
| | | DelayTask startDelayTask = remoteConfigService.getDelayTask(DelayTaskEnum.ACTIVITY_START_TASK.getCode() + "-" + activityId).getData(); |
| | | // 如果延时任务为空,创建延时任务控制活动定时开始和结束 |
| | |
| | | startDelayTask.setEndTime(activityStartTime); |
| | | startDelayTask.setRedisKey(DelayTaskEnum.ACTIVITY_START_TASK.getCode() + "-" + activityId); |
| | | remoteConfigService.addDelayTask(startDelayTask); |
| | | }else{ |
| | | if(startDelayTask.getEndTime().compareTo(activityStartTime)!=0){ |
| | | remoteConfigService.deleteDelayTask(DelayTaskEnum.ACTIVITY_START_TASK.getCode() + "-" + activityId); |
| | | redisService.deleteObject(DelayTaskEnum.ACTIVITY_START_TASK.getCode() + "-" + activityId); |
| | | redisService.setCacheObject(DelayTaskEnum.ACTIVITY_START_TASK.getCode() + "-" + activityId, activityStartTime, startTimeDifference, TimeUnit.MILLISECONDS); |
| | | startDelayTask = new DelayTask(); |
| | | startDelayTask.setDelFlag(0); |
| | | startDelayTask.setCreateTime(new Date()); |
| | | startDelayTask.setEndTime(activityStartTime); |
| | | startDelayTask.setRedisKey(DelayTaskEnum.ACTIVITY_START_TASK.getCode() + "-" + activityId); |
| | | remoteConfigService.addDelayTask(startDelayTask); |
| | | } |
| | | } |
| | | // 查询延时任务 |
| | | DelayTask endDelayTask = remoteConfigService.getDelayTask(DelayTaskEnum.ACTIVITY_START_TASK.getCode() + "-" + activityId).getData(); |
| | | DelayTask endDelayTask = remoteConfigService.getDelayTask(DelayTaskEnum.ACTIVITY_END_TASK.getCode() + "-" + activityId).getData(); |
| | | // 如果延时任务为空,创建延时任务控制活动定时开始和结束 |
| | | if (endDelayTask == null) { |
| | | redisService.setCacheObject(DelayTaskEnum.ACTIVITY_END_TASK.getCode() + "-" + activityId, activityEndTime, endTimeDifference, TimeUnit.MILLISECONDS); |
| | |
| | | endDelayTask.setEndTime(activityEndTime); |
| | | endDelayTask.setRedisKey(DelayTaskEnum.ACTIVITY_END_TASK.getCode() + "-" + activityId); |
| | | remoteConfigService.addDelayTask(endDelayTask); |
| | | }else{ |
| | | if(endDelayTask.getEndTime().compareTo(activityEndTime)!=0){ |
| | | remoteConfigService.deleteDelayTask(DelayTaskEnum.ACTIVITY_END_TASK.getCode() + "-" + activityId); |
| | | redisService.deleteObject(DelayTaskEnum.ACTIVITY_END_TASK.getCode() + "-" + activityId); |
| | | redisService.setCacheObject(DelayTaskEnum.ACTIVITY_END_TASK.getCode() + "-" + activityId, activityEndTime, startTimeDifference, TimeUnit.MILLISECONDS); |
| | | endDelayTask = new DelayTask(); |
| | | endDelayTask.setDelFlag(0); |
| | | endDelayTask.setCreateTime(new Date()); |
| | | endDelayTask.setEndTime(activityStartTime); |
| | | endDelayTask.setRedisKey(DelayTaskEnum.ACTIVITY_END_TASK.getCode() + "-" + activityId); |
| | | remoteConfigService.addDelayTask(endDelayTask); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | String goodsId = activityGoodsGetDto.getGoodsId(); |
| | | Activity activity = this.getById(activityId); |
| | | ActivityGoods activityGoods = activityGoodsService.getByGoodsId(activityId,goodsId); |
| | | activityGoodsGetVo.setActivityName(activity.getActivityName()); |
| | | activityGoodsGetVo.setActivityPrice(activityGoods.getActivityPrice()); |
| | | activityGoodsGetVo.setActivitySubscription(activityGoods.getActivitySubscription()); |
| | | activityGoodsGetVo.setActivityStatus(activity.getActivityStatus()); |
| | |
| | | Date activityStartTime = activity.getActivityStartTime(); |
| | | Date activityEndTime = activity.getActivityEndTime(); |
| | | long currentTimeMillis = System.currentTimeMillis(); |
| | | long startTimeDifference = currentTimeMillis - activityStartTime.getTime(); |
| | | long endTimeDifference = currentTimeMillis - activityEndTime.getTime(); |
| | | long startTimeDifference = activityStartTime.getTime() - currentTimeMillis; |
| | | long endTimeDifference = activityEndTime.getTime() - currentTimeMillis; |
| | | // 查询延时任务 |
| | | DelayTask startDelayTask = remoteConfigService.getDelayTask(DelayTaskEnum.ACTIVITY_START_TASK.getCode() + "-" + activityId).getData(); |
| | | // 如果延时任务为空,创建延时任务控制活动定时开始和结束 |
| | |
| | | */ |
| | | @Override |
| | | public void startActivity(String activityId){ |
| | | log.debug(activityId+"活动开始"); |
| | | Activity activity = this.getById(activityId); |
| | | if(activity!=null&&activity.getActivityStatus()==0){ |
| | | activity.setActivityStatus(1); |
| | |
| | | public List<MgtActivityListVo> listStaffActivity(StaffActivityListDto staffActivityListDto){ |
| | | return activityMapper.listStaffActivity(staffActivityListDto); |
| | | } |
| | | |
| | | private void createActivityCode(String activityId){ |
| | | |
| | | |
| | | |
| | | |
| | | } |
| | | } |