罗元桥
2021-08-05 cc1098fc00a50cb1591d182f04bc37066ff0a9e2
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActEasyPhotoServiceImpl.java
@@ -10,9 +10,7 @@
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;
@@ -27,6 +25,7 @@
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
 * @program: springcloud_k8s_panzhihuazhihuishequ
@@ -51,6 +50,8 @@
    private ComActEasyPhotoRewardMapper comActEasyPhotoRewardMapper;
    @Resource
    private ComActUserWalletService comActUserWalletService;
    @Resource
    private ComActActSignDAO comActActSignDAO;
    /**
     * 分页查询随手拍
     *
@@ -87,14 +88,18 @@
                if(comActEasyPhotoVO1.getActivityId() != null && comActEasyPhotoVO1.getStatus().equals(ComActEasyPhotoDO.status.ywc)){
                    //查询随手拍活动
                    ComActEasyPhotoActivityDO photoActivityDO = comActEasyPhotoActivityMapper.selectById(comActEasyPhotoVO1.getActivityId());
                    if(comActEasyPhotoVO1.getActivityType().equals(ComActEasyPhotoDO.activityType.yz)){
                        comActEasyPhotoVO1.setActivityAmount(photoActivityDO.getGoodReward());
                    }else if(comActEasyPhotoVO1.getActivityType().equals(ComActEasyPhotoDO.activityType.jl)){
                        comActEasyPhotoVO1.setActivityAmount(photoActivityDO.getExcellentReward());
                    }else if(comActEasyPhotoVO1.getActivityType().equals(ComActEasyPhotoDO.activityType.pt)){
                        comActEasyPhotoVO1.setActivityAmount(photoActivityDO.getOrdinaryReward());
                    }else if(comActEasyPhotoVO1.getActivityType().equals(ComActEasyPhotoDO.activityType.yb)){
                        comActEasyPhotoVO1.setActivityAmount(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());
                            }
                        }
                    }
                }
            });
@@ -133,6 +138,15 @@
        comActEasyPhotoVO.setPhone(SensitiveUtil.desensitizedPhoneNumber(comActEasyPhotoVO.getPhone()));
        if(comActEasyPhotoVO.getAddrRemark()==null){
            comActEasyPhotoVO.setAddrRemark("");
        }
        if(comActEasyPhotoVO.getActivityId() != null){
            ComActEasyPhotoActivityDO photoActivityDO = comActEasyPhotoActivityMapper.selectById(comActEasyPhotoVO.getActivityId());
            if(photoActivityDO != null){
                ComActEasyPhotoActivityVO easyPhotoActivityVO = new ComActEasyPhotoActivityVO();
                BeanUtils.copyProperties(photoActivityDO,easyPhotoActivityVO);
                comActEasyPhotoVO.setEasyPhotoActivityVO(easyPhotoActivityVO);
            }
        }
        return R.ok(comActEasyPhotoVO);
    }
@@ -214,7 +228,6 @@
//        操作类型 1审核通过 2驳回  3反馈
        ComActEasyPhotoDO cmActEasyPhotoDO=new ComActEasyPhotoDO();
        cmActEasyPhotoDO.setId(comActEasyPhotoVO.getId());
        cmActEasyPhotoDO.setHandlerId(comActEasyPhotoVO.getUserId());
//        cmActEasyPhotoDO.setActivityType(comActEasyPhotoVO.getActivityType());
        Date date = new Date();
        switch (type){
@@ -230,6 +243,7 @@
                }else{
                    cmActEasyPhotoDO.setStatus(4);//已完成
                }
                cmActEasyPhotoDO.setHandlerId(comActEasyPhotoVO.getUserId());
                cmActEasyPhotoDO.setExamineAt(date);
                cmActEasyPhotoDO.setActivityType(comActEasyPhotoVO.getActivityType());
                break;
@@ -238,6 +252,7 @@
                if(!cmActEasyPhotoDO.getStatus().equals(ComActEasyPhotoDO.status.dsh)){
                    return R.fail("该随手拍已审核,不可重复操作");
                }
                cmActEasyPhotoDO.setHandlerId(comActEasyPhotoVO.getUserId());
                cmActEasyPhotoDO.setStatus(3);//已驳回
                cmActEasyPhotoDO.setExamineAt(date);
                cmActEasyPhotoDO.setRejectReason(comActEasyPhotoVO.getRejectReason());
@@ -247,6 +262,7 @@
                if(!cmActEasyPhotoDO.getStatus().equals(ComActEasyPhotoDO.status.dfk)){
                    return R.fail("该随手拍不是待反馈状态,不可进行反馈");
                }
                cmActEasyPhotoDO.setHandlerId(comActEasyPhotoVO.getUserId());
                cmActEasyPhotoDO.setHandleResult(comActEasyPhotoVO.getHandleResult());
                cmActEasyPhotoDO.setHandlePhotoList(comActEasyPhotoVO.getHandlePhotoList());
                cmActEasyPhotoDO.setStatus(4);//已完成
@@ -446,6 +462,18 @@
                }
                //审核通过判断随手拍是否有活动并计算用户收益
                comActUserWalletService.examineAddMoney(easyPhotoDO.getActivityType(),easyPhotoDO.getId(),easyPhotoDO.getSponsorId(),grantRewardDTO.getAmount());
                //发放奖励以后给用户推送消息
                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(),easyPhotoDO.getDetail(),grantRewardDTO.getAmount(),"发放随手拍奖励");
                    }catch (Exception e){
                        log.error("消息推送失败,失败原因:" + e.getMessage());
                    }
                }
            }
        }
        return R.ok();