| | |
| | | import com.panzhihua.common.model.dtos.community.ComActEasyPhotoCommentUserDTO; |
| | | import com.panzhihua.common.model.vos.R; |
| | | import com.panzhihua.common.model.vos.community.*; |
| | | import com.panzhihua.common.utlis.DateUtils; |
| | | import com.panzhihua.common.utlis.SensitiveUtil; |
| | | import com.panzhihua.common.utlis.StringUtils; |
| | | import com.panzhihua.common.utlis.*; |
| | | import com.panzhihua.service_community.dao.*; |
| | | import com.panzhihua.service_community.model.dos.*; |
| | | import com.panzhihua.service_community.service.ComActEasyPhotoService; |
| | |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * @program: springcloud_k8s_panzhihuazhihuishequ |
| | |
| | | private ComActEasyPhotoRewardMapper comActEasyPhotoRewardMapper; |
| | | @Resource |
| | | private ComActUserWalletService comActUserWalletService; |
| | | @Resource |
| | | private ComActActSignDAO comActActSignDAO; |
| | | /** |
| | | * 分页查询随手拍 |
| | | * |
| | |
| | | if(comActEasyPhotoVO1.getActivityId() != null && comActEasyPhotoVO1.getStatus().equals(ComActEasyPhotoDO.status.ywc)){ |
| | | //查询随手拍活动 |
| | | ComActEasyPhotoActivityDO photoActivityDO = comActEasyPhotoActivityMapper.selectById(comActEasyPhotoVO1.getActivityId()); |
| | | if(comActEasyPhotoVO1.getActivityType() != null){ |
| | | if(comActEasyPhotoVO1.getActivityType().equals(ComActEasyPhotoDO.activityType.yz)){ |
| | | comActEasyPhotoVO1.setActivityMoney(photoActivityDO.getGoodReward()); |
| | | }else if(comActEasyPhotoVO1.getActivityType().equals(ComActEasyPhotoDO.activityType.jl)){ |
| | | comActEasyPhotoVO1.setActivityMoney(photoActivityDO.getExcellentReward()); |
| | | }else if(comActEasyPhotoVO1.getActivityType().equals(ComActEasyPhotoDO.activityType.pt)){ |
| | | comActEasyPhotoVO1.setActivityMoney(photoActivityDO.getOrdinaryReward()); |
| | | }else if(comActEasyPhotoVO1.getActivityType().equals(ComActEasyPhotoDO.activityType.yb)){ |
| | | comActEasyPhotoVO1.setActivityMoney(photoActivityDO.getCommonlyReward()); |
| | | if(photoActivityDO != null){ |
| | | if(comActEasyPhotoVO1.getActivityType() != null){ |
| | | if(comActEasyPhotoVO1.getActivityType().equals(ComActEasyPhotoDO.activityType.yz)){ |
| | | comActEasyPhotoVO1.setActivityMoney(photoActivityDO.getGoodReward()); |
| | | }else if(comActEasyPhotoVO1.getActivityType().equals(ComActEasyPhotoDO.activityType.jl)){ |
| | | comActEasyPhotoVO1.setActivityMoney(photoActivityDO.getExcellentReward()); |
| | | }else if(comActEasyPhotoVO1.getActivityType().equals(ComActEasyPhotoDO.activityType.pt)){ |
| | | comActEasyPhotoVO1.setActivityMoney(photoActivityDO.getOrdinaryReward()); |
| | | }else if(comActEasyPhotoVO1.getActivityType().equals(ComActEasyPhotoDO.activityType.yb)){ |
| | | comActEasyPhotoVO1.setActivityMoney(photoActivityDO.getCommonlyReward()); |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | if (ObjectUtils.isEmpty(comActEasyPhotoVO)||null== status) { |
| | | return R.fail("随手拍不存在"); |
| | | } |
| | | ComActEasyPhotoUserDO comActEasyPhotoUserDO = comActEasyPhotoUserDAO.selectOne(new QueryWrapper<ComActEasyPhotoUserDO>().lambda().eq(ComActEasyPhotoUserDO::getEasyPhotoId, id).eq(ComActEasyPhotoUserDO::getUserId, userId)); |
| | | if (ObjectUtils.isEmpty(comActEasyPhotoUserDO)) { |
| | | comActEasyPhotoVO.setHaveGiveThumbsUp(0); |
| | | } else { |
| | | comActEasyPhotoVO.setHaveGiveThumbsUp(1); |
| | | if(!userId.equals(0L)){ |
| | | ComActEasyPhotoUserDO comActEasyPhotoUserDO = comActEasyPhotoUserDAO.selectOne(new QueryWrapper<ComActEasyPhotoUserDO>().lambda().eq(ComActEasyPhotoUserDO::getEasyPhotoId, id).eq(ComActEasyPhotoUserDO::getUserId, userId)); |
| | | if (ObjectUtils.isEmpty(comActEasyPhotoUserDO)) { |
| | | comActEasyPhotoVO.setHaveGiveThumbsUp(0); |
| | | } else { |
| | | comActEasyPhotoVO.setHaveGiveThumbsUp(1); |
| | | } |
| | | } |
| | | |
| | | if (status.intValue()==4) { |
| | |
| | | page.setCurrent(pageNum); |
| | | IPage<ComActEasyPhotoVO> iPage = comActEasyPhotoDAO.pageEasyPhotoApplets(page, comActEasyPhotoVO); |
| | | List<ComActEasyPhotoVO> records = iPage.getRecords(); |
| | | if (!ObjectUtils.isEmpty(records)) { |
| | | records.forEach(comActEasyPhotoVO1 -> { |
| | | Long id = comActEasyPhotoVO1.getId(); |
| | | Integer status = comActEasyPhotoVO1.getStatus(); |
| | | Date feedbackAt = comActEasyPhotoVO1.getFeedbackAt(); |
| | | List<ComActEasyPhotoUserDO> comActEasyPhotoUserDO = |
| | | comActEasyPhotoUserDAO.selectList(new QueryWrapper<ComActEasyPhotoUserDO>().lambda().eq(ComActEasyPhotoUserDO::getEasyPhotoId, id).eq(ComActEasyPhotoUserDO::getUserId, userId)); |
| | | if (comActEasyPhotoUserDO==null||comActEasyPhotoUserDO.size()==0) { |
| | | comActEasyPhotoVO1.setHaveGiveThumbsUp(0); |
| | | }else { |
| | | comActEasyPhotoVO1.setHaveGiveThumbsUp(1); |
| | | } |
| | | if(status.intValue()==4&&null==feedbackAt){ |
| | | comActEasyPhotoVO1.setFeedbackAt(comActEasyPhotoVO1.getExamineAt()); |
| | | } |
| | | }); |
| | | iPage.setRecords(records); |
| | | if(userId != null){ |
| | | if (!ObjectUtils.isEmpty(records)) { |
| | | records.forEach(comActEasyPhotoVO1 -> { |
| | | Long id = comActEasyPhotoVO1.getId(); |
| | | Integer status = comActEasyPhotoVO1.getStatus(); |
| | | Date feedbackAt = comActEasyPhotoVO1.getFeedbackAt(); |
| | | List<ComActEasyPhotoUserDO> comActEasyPhotoUserDO = |
| | | comActEasyPhotoUserDAO.selectList(new QueryWrapper<ComActEasyPhotoUserDO>().lambda().eq(ComActEasyPhotoUserDO::getEasyPhotoId, id).eq(ComActEasyPhotoUserDO::getUserId, userId)); |
| | | if (comActEasyPhotoUserDO==null||comActEasyPhotoUserDO.size()==0) { |
| | | comActEasyPhotoVO1.setHaveGiveThumbsUp(0); |
| | | }else { |
| | | comActEasyPhotoVO1.setHaveGiveThumbsUp(1); |
| | | } |
| | | if(status.intValue()==4&&null==feedbackAt){ |
| | | comActEasyPhotoVO1.setFeedbackAt(comActEasyPhotoVO1.getExamineAt()); |
| | | } |
| | | }); |
| | | iPage.setRecords(records); |
| | | } |
| | | } |
| | | return R.ok(iPage); |
| | | } |
| | |
| | | } |
| | | //审核通过判断随手拍是否有活动并计算用户收益 |
| | | comActUserWalletService.examineAddMoney(easyPhotoDO.getActivityType(),easyPhotoDO.getId(),easyPhotoDO.getSponsorId(),grantRewardDTO.getAmount()); |
| | | |
| | | String activityType = ""; |
| | | if(easyPhotoDO.getActivityType().equals(ComActEasyPhotoDO.activityType.yz)){ |
| | | activityType = "优质"; |
| | | }else if(easyPhotoDO.getActivityType().equals(ComActEasyPhotoDO.activityType.jl)){ |
| | | activityType = "精良"; |
| | | }else if(easyPhotoDO.getActivityType().equals(ComActEasyPhotoDO.activityType.pt)){ |
| | | activityType = "普通"; |
| | | }else if(easyPhotoDO.getActivityType().equals(ComActEasyPhotoDO.activityType.yb)){ |
| | | activityType = "一般"; |
| | | } |
| | | //发放奖励以后给用户推送消息 |
| | | Map<String,String> map = comActActSignDAO.getUserOpenId(easyPhotoDO.getSponsorId()); |
| | | if(map != null){ |
| | | String openid = map.get("openid"); |
| | | WxXCXTempSend util = new WxXCXTempSend(); |
| | | try { |
| | | WxUtil.sendSubscribeJLDZ(openid,util.getAppAccessToken(),"随手拍有奖活动",grantRewardDTO.getAmount(),activityType); |
| | | }catch (Exception e){ |
| | | log.error("消息推送失败,失败原因:" + e.getMessage()); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | return R.ok(); |