lidongdong
2023-08-23 12c8636f6dcc2720ce0388ad11f58f5714ea4234
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/VolunteerActivitiesPeopleServiceImpl.java
@@ -1,13 +1,21 @@
package com.panzhihua.service_community.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.panzhihua.common.model.vos.R;
import com.panzhihua.common.model.vos.community.ComMngVolunteerMngVO;
import com.panzhihua.common.model.vos.community.GrantIntegral;
import com.panzhihua.common.model.vos.community.VolunteerActivitiesPeopleVO;
import com.panzhihua.common.model.vos.community.VolunteerActivityVO;
import com.panzhihua.common.utlis.StringUtils;
import com.panzhihua.service_community.dao.VolunteerActivitiesPeopleDao;
import com.panzhihua.service_community.entity.VolunteerActivitiesPeople;
import com.panzhihua.service_community.service.ComMngVolunteerMngService;
import com.panzhihua.service_community.service.VolunteerActivitiesPeopleService;
import com.panzhihua.service_community.service.VolunteerActivityService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
@Slf4j
@@ -15,6 +23,13 @@
public class VolunteerActivitiesPeopleServiceImpl extends ServiceImpl<VolunteerActivitiesPeopleDao,
        VolunteerActivitiesPeople> implements VolunteerActivitiesPeopleService
{
    @Resource
    private ComMngVolunteerMngService comMngVolunteerMngService;
    @Resource
    private VolunteerActivityService volunteerActivityService;
    @Override
    public VolunteerActivitiesPeople vapGetById(String id)
@@ -42,5 +57,42 @@
        return baseMapper.vapDelete(id);
    }
    @Override
    public R grantIntegral(GrantIntegral grantIntegral) {
        for (GrantIntegral item: grantIntegral.getPeopleAndGranList() )
        {
            if(StringUtils.isEmpty(grantIntegral.getId()))
            {
                return R.fail("奖励发放id不能为空!");
            }
            VolunteerActivitiesPeopleVO vla=new VolunteerActivitiesPeopleVO();
            vla.setId(item.getId());
            vla.setIssuePoints(item.getGrantIntegral());
            vla.setIssueStatus("1");
            baseMapper.vapUpdate(vla);
            ComMngVolunteerMngVO comMngVolunteerMngVO=new ComMngVolunteerMngVO();
            comMngVolunteerMngVO.setId(Long.valueOf(item.getVolunteerId()));
            int grant=0;
            if(!StringUtils.isNotEmpty(comMngVolunteerMngVO.getLoveIntegral()))
            {
                grant=Integer.valueOf(comMngVolunteerMngVO.getLoveIntegral());
            }
            grant+=Integer.valueOf(item.getGrantIntegral());
            comMngVolunteerMngVO.setLoveIntegral(grant+"");
            comMngVolunteerMngService.putVolunteer(comMngVolunteerMngVO);
        }
        VolunteerActivityVO activityVO=new VolunteerActivityVO();
        activityVO.setId(grantIntegral.getActivityId());
        activityVO.setAwardState("1");
        volunteerActivityService.updateById(activityVO);
        return R.ok();
    }
}