| | |
| | | entity.setPublish(false); |
| | | //设置申请人id |
| | | entity.setMemberId(UserContext.getCurrentUserId()); |
| | | entity.setStoreId(UserContext.getCurrentUser().getStoreId()); |
| | | baseMapper.insert(entity); |
| | | mangerSaveOrUpdate(isManager,entity); |
| | | return Result.ok("添加成功"); |
| | |
| | | //添加审核记录 |
| | | if (isManager){ |
| | | //直接通过 |
| | | activityAuditRecordForm = ActivityAuditRecordForm.getEntityByManagerBuildForm(entity.getId()); |
| | | activityAuditRecordForm = ActivityAuditRecordForm.getFormByManager(entity.getId()); |
| | | }else { |
| | | activityAuditRecordForm = ActivityAuditRecordForm.getEntityByBuyerBuildForm(entity.getId()); |
| | | activityAuditRecordForm = ActivityAuditRecordForm.getFormByBuyer(entity.getId()); |
| | | } |
| | | activityAuditRecordService.addOrUpdateAuditActivity(activityAuditRecordForm); |
| | | } |
| | |
| | | public Result remove(List<String> ids) { |
| | | //判断活动id是否已经存在报名人员 |
| | | for(String id : ids){ |
| | | if(haveApplicationMembers(id)){ |
| | | return Result.error("该活动无法删除,已存在报名人员"); |
| | | if (isPublishActivity(id)){ |
| | | return Result.error("存在活动已发布删除前请下架该活动!"); |
| | | } |
| | | if(haveApplicationMembers(id)){ |
| | | return Result.error("存在活动已有报名人员,无法删除!"); |
| | | } |
| | | |
| | | } |
| | | //未经过return则删除 |
| | | for (String id : ids){ |
| | |
| | | activityMembersQuery.setId(id); |
| | | return (long) activityMembersPage(activityMembersQuery).get("total") > 0; |
| | | } |
| | | //判断互动是否发布 |
| | | public Boolean isPublishActivity(String id){ |
| | | Activity activity = baseMapper.selectById(id); |
| | | return activity.getPublish(); |
| | | } |
| | | |
| | | //删除活动同时删除活动的相关信息 |
| | | public void delActivityAndInformation(String id){ |
| | | ActivityVO vo = baseMapper.getById(id); |
| | |
| | | @Override |
| | | public Result removeById(String id) { |
| | | //先判断活动是否有报名人员 |
| | | if (isPublishActivity(id)){ |
| | | return Result.error("该活动已发布删除前请下架该活动!"); |
| | | } |
| | | |
| | | if(haveApplicationMembers(id)){ |
| | | return Result.error("该活动无法删除,已存在报名人员"); |
| | | return Result.error("该活动已有报名人员,无法删除!"); |
| | | } |
| | | //删除,同时判断该对象的封面是否存在 ,存在则在云服务器删除 |
| | | delActivityAndInformation(id); |
| | |
| | | |
| | | @Override |
| | | public Result getMyApplyActivityPage(ActivityQuery query){ |
| | | System.out.println(query); |
| | | |
| | | //传入当前请求用户的id |
| | | String storeId = UserContext.getCurrentUser().getStoreId(); |
| | | if (storeId == null){ |
| | | query.setMemberId(UserContext.getCurrentUserId()); |
| | | }else { |
| | | query.setStoreId(storeId); |
| | | } |
| | | |
| | | //更具用户id获得活动 |
| | | IPage<ActivityVO> page = PageUtil.getPage(query, ActivityVO.class); |
| | | baseMapper.getPage(page, query); |
| | | baseMapper.storeGetPage(page, query); |
| | | for (ActivityVO vo : page.getRecords()) { |
| | | if (!ActivityCoverTypeEnum.TEXT.getType().equals(vo.getCoverType())){ |
| | | vo.setUrl(cOSUtil.getPreviewUrl(vo.getCover())); |
| | | } |
| | | } |
| | | |
| | | return Result.ok().data(page.getRecords()).total(page.getTotal()); |
| | | } |
| | | |