| | |
| | | package com.panzhihua.service_community.service.impl; |
| | | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.panzhihua.common.model.dtos.community.ExcelElderAuthDTO; |
| | | import com.panzhihua.common.model.vos.IndexDataVO; |
| | | import com.panzhihua.common.model.vos.LoginUserInfoVO; |
| | | import com.panzhihua.common.model.vos.R; |
| | | import com.panzhihua.common.model.vos.community.*; |
| | | import com.panzhihua.common.service.user.UserService; |
| | | import com.panzhihua.service_community.dao.ComActActSignDAO; |
| | | import com.panzhihua.service_community.dao.ComActActivityDAO; |
| | | import com.panzhihua.service_community.dao.ComActDiscussOptionUserDAO; |
| | |
| | | private ComActActivityDAO comActActivityDAO; |
| | | @Resource |
| | | private ComActActSignDAO comActActSignDAO; |
| | | @Resource |
| | | private UserService userService; |
| | | |
| | | /** |
| | | * 新增社区活动 |
| | |
| | | ComActActivityDO comActActivityDO=new ComActActivityDO(); |
| | | BeanUtils.copyProperties(comActActivityVO,comActActivityDO); |
| | | Integer status = comActActivityVO.getStatus(); |
| | | Date now = new Date(); |
| | | if (status.intValue()!=1) { |
| | | comActActivityDO.setPublishAt(new Date());//发布时间 |
| | | comActActivityDO.setPublishAt(now);//发布时间 |
| | | } |
| | | //如果发布时间大于现在时间状态改为进行中 |
| | | /*if(now.getTime()<comActActivityVO.getBeginAt().getTime()){ |
| | | comActActivityDO.setStatus(3); |
| | | }*/ |
| | | if(status.intValue()==2) {//点击‘保存并发布’ 按钮 |
| | | //报名结束时间大于当前时间则设置为“进行中” |
| | | if (comActActivityVO.getSignUpEnd() != null && now.getTime() < comActActivityVO.getSignUpEnd().getTime()) { |
| | | comActActivityDO.setStatus(4); |
| | | } |
| | | } |
| | | |
| | | boolean save = this.save(comActActivityDO); |
| | | if(!save){ |
| | | return R.fail(); |
| | |
| | | public R putActivity(ComActActivityVO comActActivityVO) { |
| | | ComActActivityDO comActActivityDO=new ComActActivityDO(); |
| | | BeanUtils.copyProperties(comActActivityVO,comActActivityDO); |
| | | |
| | | //结束时间大于当前时间则设置为“进行中” |
| | | Date now = new Date(); |
| | | if(comActActivityVO.getSignUpEnd()!=null && now.getTime()<comActActivityVO.getSignUpEnd().getTime()){ |
| | | comActActivityDO.setStatus(4); |
| | | } |
| | | boolean b = this.updateById(comActActivityDO); |
| | | if (b) { |
| | | return R.ok(); |
| | |
| | | Integer type = signactivityVO.getType(); |
| | | Long userId = signactivityVO.getUserId(); |
| | | Integer isVolunteer = signactivityVO.getIsVolunteer(); |
| | | |
| | | int num=0; |
| | | if (1==type) { |
| | | R<LoginUserInfoVO> userInfoR = userService.getUserInfoByUserId(String.valueOf(userId)); |
| | | LoginUserInfoVO loginUserInfoVO = JSONObject.parseObject(JSONObject.toJSONString(userInfoR.getData()), LoginUserInfoVO.class); |
| | | boolean userNotVolunteer = !(loginUserInfoVO.getIsVolunteer()==1); |
| | | if(isVolunteer == 1 && userNotVolunteer){ |
| | | return R.fail("只有志愿者才能报名"); |
| | | } |
| | | |
| | | ComActActSignDO comActActSignDO=new ComActActSignDO(); |
| | | comActActSignDO.setActivityId(activityId); |
| | | comActActSignDO.setUserId(userId); |