| | |
| | | package com.panzhihua.service_community.service.impl; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.text.DecimalFormat; |
| | | import java.util.*; |
| | | import java.util.concurrent.TimeUnit; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import com.panzhihua.common.model.vos.community.*; |
| | | import com.panzhihua.common.model.vos.screen.ComActPopulationCultureVO; |
| | | import com.panzhihua.service_community.dao.*; |
| | | import com.panzhihua.service_community.model.dos.ComActActEvaluateDO; |
| | | import com.panzhihua.service_community.model.dos.ComActActPictureDO; |
| | | import org.apache.commons.lang3.time.DateUtils; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.data.redis.core.StringRedisTemplate; |
| | |
| | | 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.ComActActRegistVO; |
| | | import com.panzhihua.common.model.vos.community.ActivitySignVO; |
| | | import com.panzhihua.common.model.vos.community.ComActActEvaluateVO; |
| | | import com.panzhihua.common.model.vos.community.ComActActivityVO; |
| | | import com.panzhihua.common.model.vos.community.CommunityActivitiesVO; |
| | | import com.panzhihua.common.model.vos.community.CommunityGovernanceTrendsVO; |
| | | import com.panzhihua.common.model.vos.community.SignactivityVO; |
| | | import com.panzhihua.common.model.vos.community.screen.work.ActActivityListVO; |
| | | import com.panzhihua.common.service.user.UserService; |
| | | import com.panzhihua.common.utlis.WxUtil; |
| | |
| | | @Resource |
| | | private ComActActEvaluateDAO comActActEvaluateDAO; |
| | | @Resource |
| | | private ComActActRegistDAO comActActRegistDAO; |
| | | @Resource |
| | | private StringRedisTemplate stringRedisTemplate; |
| | | @Resource |
| | | private ComActActRegistDAO comActActRegistDAO; |
| | | private ComActActPictureDAO comActActPictureDAO; |
| | | |
| | | /** |
| | | * 新增社区活动 |
| | |
| | | .eq(ComActActivityDO::getActivityName, comActActivityDO.getActivityName()) |
| | | .orderByDesc(ComActActivityDO::getCreateAt).last(" limit 1 ")); |
| | | Long activityId = one.getId(); |
| | | |
| | | //保存上传照片 |
| | | ComActActPictureDO comActActPictureDO = new ComActActPictureDO(); |
| | | comActActPictureDO.setActivityId(activityId); |
| | | comActActPictureDO.setUserId(comActActivityVO.getUserId()); |
| | | comActActPictureDO.setUploadPicture(comActActivityVO.getCover()); |
| | | comActActPictureDO.setSysFlag(0); |
| | | comActActPictureDAO.insert(comActActPictureDO); |
| | | return R.ok(activityId); |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | @Override |
| | | public R pageActivityRegists(ComActActEvaluateVO comActActEvaluateVO) { |
| | | public R getSignLists(ActivitySignVO activitySignVO) { |
| | | return R.ok(comActActSignDAO.getSignLists(activitySignVO)); |
| | | } |
| | | |
| | | @Override |
| | | public R pageActivityEvaluates(ComActActEvaluateVO comActActEvaluateVO) { |
| | | IPage<ComActActEvaluateVO> comActActEvaluateVOIPage = comActActEvaluateDAO |
| | | .pageActivityRegists(new Page(comActActEvaluateVO.getPageNum(), comActActEvaluateVO.getPageSize()), comActActEvaluateVO); |
| | | .pageActivityEvaluates(new Page(comActActEvaluateVO.getPageNum(), comActActEvaluateVO.getPageSize()), comActActEvaluateVO); |
| | | return R.ok(comActActEvaluateVOIPage); |
| | | } |
| | | |
| | | @Override |
| | | public R getEvaluateListsByIds(List<Long> ids) { |
| | | return R.ok(comActActEvaluateDAO.getEvaluateListsByIds(ids)); |
| | | public R getEvaluateLists(ComActActEvaluateVO comActActEvaluateVO) { |
| | | return R.ok(comActActEvaluateDAO.getEvaluateLists(comActActEvaluateVO)); |
| | | } |
| | | |
| | | @Override |
| | | public R pageActivityRegists(ComActActRegistVO comActActRegistVO) { |
| | | IPage<ComActActRegistVO> comActActRegistVOIPage = comActActRegistDAO.pageActivityRegists(new Page(comActActRegistVO.getPageNum(), comActActRegistVO.getPageSize()), comActActRegistVO); |
| | | return R.ok(comActActRegistVOIPage); |
| | | } |
| | | |
| | | @Override |
| | | public R getRegistLists(ComActActRegistVO comActActRegistVO) { |
| | | return R.ok(comActActRegistDAO.getRegistLists(comActActRegistVO)); |
| | | } |
| | | |
| | | @Override |
| | | public R getNoRegistLists(ComActActRegistVO comActActRegistVO) { |
| | | return R.ok(comActActRegistDAO.getNoRegistLists(comActActRegistVO)); |
| | | } |
| | | |
| | | @Override |
| | | public R activityStatistics(Long activityId) { |
| | | ComActActivityStatisticsVO comActActivityStatisticsVO = comActActivityDAO.activityStatistics(activityId); |
| | | if (comActActivityStatisticsVO != null) { |
| | | if (comActActivityStatisticsVO.getSignTotal().equals(0)){ |
| | | comActActivityStatisticsVO.setSignTotalStr("不限"); |
| | | comActActivityStatisticsVO.setNoSignTotalStr(""); |
| | | comActActivityStatisticsVO.setSignPersent(""); |
| | | }else { |
| | | comActActivityStatisticsVO.setSignTotalStr(String.valueOf(comActActivityStatisticsVO.getSignTotal())); |
| | | comActActivityStatisticsVO.setNoSignTotalStr(String.valueOf(Integer.valueOf(comActActivityStatisticsVO.getSignTotalStr()) - comActActivityStatisticsVO.getReallySignTotal())); |
| | | comActActivityStatisticsVO.setSignPersent(getPersent(comActActivityStatisticsVO.getReallySignTotal(),comActActivityStatisticsVO.getSignTotal())); |
| | | } |
| | | comActActivityStatisticsVO.setRegistPersent(getPersent(comActActivityStatisticsVO.getReallyRegistTotal(),comActActivityStatisticsVO.getRegistTotal())); |
| | | comActActivityStatisticsVO.setEvaluatePersent(getPersent(comActActivityStatisticsVO.getReallyEvaluateTotal(),comActActivityStatisticsVO.getEvaluateTotal())); |
| | | } |
| | | return R.ok(comActActivityStatisticsVO); |
| | | } |
| | | |
| | | @Override |
| | | public R getPictureList(Long userId) { |
| | | List<ComActActPictureVO> comActActPictureVOS = new ArrayList<>(); |
| | | List<ComActActPictureDO> comActActPictureDOS = comActActPictureDAO.selectList(new QueryWrapper<ComActActPictureDO>().lambda(). |
| | | eq(ComActActPictureDO::getUserId, userId)); |
| | | if (comActActPictureDOS != null && comActActPictureDOS.size() != 0) { |
| | | comActActPictureDOS.forEach(comActActPictureDO -> { |
| | | ComActActPictureVO comActActPictureVO = new ComActActPictureVO(); |
| | | BeanUtils.copyProperties(comActActPictureDO, comActActPictureVO); |
| | | comActActPictureVOS.add(comActActPictureVO); |
| | | }); |
| | | } |
| | | return R.ok(comActActPictureVOS); |
| | | } |
| | | |
| | | @Override |
| | | public R getSysPictureList(Integer type) { |
| | | List<ComActActPictureVO> comActActPictureVOS = new ArrayList<>(); |
| | | List<ComActActPictureDO> comActActPictureDOS = comActActPictureDAO.selectList(new QueryWrapper<ComActActPictureDO>().lambda(). |
| | | eq(ComActActPictureDO::getSysFlag, 1).eq(ComActActPictureDO :: getType, type)); |
| | | if (comActActPictureDOS != null && comActActPictureDOS.size() != 0) { |
| | | comActActPictureDOS.forEach(comActActPictureDO -> { |
| | | ComActActPictureVO comActActPictureVO = new ComActActPictureVO(); |
| | | BeanUtils.copyProperties(comActActPictureDO, comActActPictureVO); |
| | | comActActPictureVOS.add(comActActPictureVO); |
| | | }); |
| | | } |
| | | return R.ok(comActActPictureVOS); |
| | | } |
| | | |
| | | /** |
| | |
| | | return R.ok(); |
| | | } |
| | | |
| | | private String getPersent(int x, int y){ |
| | | if (y == 0) { |
| | | return ""; |
| | | } |
| | | if (x == 0) { |
| | | return "0.00%"; |
| | | } |
| | | double d1 = x * 1.0; |
| | | double d2 = y * 1.0; |
| | | DecimalFormat decimalFormat = new DecimalFormat("##.00%"); |
| | | return decimalFormat.format(d1 / d2); |
| | | } |
| | | |
| | | /** |
| | | * 用户签到 |
| | | * |