| | |
| | | package com.panzhihua.service_community.service.impl; |
| | | |
| | | import static java.util.Objects.nonNull; |
| | | |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | import javax.annotation.Resource; |
| | | |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | |
| | | import com.panzhihua.common.model.dtos.property.CommonPage; |
| | | import com.panzhihua.common.model.vos.R; |
| | | import com.panzhihua.common.model.vos.community.social.ComActSocialProjectMemberVO; |
| | | import com.panzhihua.common.model.vos.partybuilding.ComPbServiceTeamVO; |
| | | import com.panzhihua.common.utlis.DateUtils; |
| | | import com.panzhihua.service_community.dao.ComActSocialMemberDao; |
| | | import com.panzhihua.service_community.dao.ComActSocialProjectMemberDao; |
| | | import com.panzhihua.service_community.dao.ComActSocialWorkerDao; |
| | | import com.panzhihua.service_community.dao.ComMngVolunteerMngDAO; |
| | | import com.panzhihua.service_community.entity.ComActSocialMember; |
| | | import com.panzhihua.service_community.entity.ComActSocialProjectMember; |
| | | import com.panzhihua.service_community.dao.ComActSocialProjectMemberDao; |
| | | import com.panzhihua.service_community.entity.ComActSocialWorker; |
| | | import com.panzhihua.service_community.model.dos.ComMngVolunteerMngDO; |
| | | import com.panzhihua.service_community.service.ComActSocialProjectMemberService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | |
| | | /** |
| | | * 项目人员(ComActSocialProjectMember)表服务实现类 |
| | |
| | | private ComActSocialWorkerDao comActSocialWorkerDao; |
| | | @Resource |
| | | private ComMngVolunteerMngDAO comMngVolunteerMngDAO; |
| | | @Resource |
| | | private ComActSocialMemberDao comActSocialMemberDao; |
| | | |
| | | @Override |
| | | public R pageList(CommonPage commonPage) { |
| | | return R.ok(this.comActSocialProjectMemberDao.pageList(new Page(commonPage.getPage(),commonPage.getSize()),commonPage)); |
| | |
| | | @Override |
| | | public R insertBatch(ComActSocialProjectMemberVO comActSocialProjectMemberVO) { |
| | | if(CollectionUtils.isNotEmpty(comActSocialProjectMemberVO.getIds())){ |
| | | Integer type = comActSocialProjectMemberVO.getType(); |
| | | comActSocialProjectMemberVO.getIds().forEach(id ->{ |
| | | if(comActSocialProjectMemberVO.getType()==1){ |
| | | if(type ==1) { |
| | | ComActSocialWorker comActSocialWorker=comActSocialWorkerDao.selectById(id); |
| | | if(comActSocialWorker!=null){ |
| | | List<ComActSocialProjectMember> list= comActSocialProjectMemberDao.selectList(new QueryWrapper<ComActSocialProjectMember>().lambda().eq(ComActSocialProjectMember::getPhone,comActSocialWorker.getTelephone()).eq(ComActSocialProjectMember::getType,comActSocialProjectMemberVO.getType()).eq(ComActSocialProjectMember::getProjectId,comActSocialProjectMemberVO.getParamId())); |
| | | List<ComActSocialProjectMember> list= comActSocialProjectMemberDao.selectList(new QueryWrapper<ComActSocialProjectMember>().lambda().eq(ComActSocialProjectMember::getPhone,comActSocialWorker.getTelephone()).eq(ComActSocialProjectMember::getType, type).eq(ComActSocialProjectMember::getProjectId,comActSocialProjectMemberVO.getParamId())); |
| | | if(CollectionUtils.isEmpty(list)){ |
| | | ComActSocialProjectMember comActSocialProjectMember=new ComActSocialProjectMember(); |
| | | BeanUtils.copyProperties(comActSocialProjectMemberVO,comActSocialProjectMember); |
| | |
| | | comActSocialProjectMember.setPhone(comActSocialWorker.getTelephone()); |
| | | comActSocialProjectMember.setCreateTime(new Date()); |
| | | comActSocialProjectMember.setType(1); |
| | | comActSocialProjectMember.setCommunityId(comActSocialProjectMemberVO.getCommunityId()); |
| | | comActSocialProjectMember.setCommunityId(comActSocialWorker.getCommunityId()); |
| | | comActSocialProjectMember.setProjectId(comActSocialProjectMemberVO.getParamId()); |
| | | comActSocialProjectMemberDao.insert(comActSocialProjectMember); |
| | | } |
| | | } |
| | | } |
| | | else { |
| | | } else if (type == 2) { |
| | | ComMngVolunteerMngDO comMngVolunteerMngDO=comMngVolunteerMngDAO.selectById(id); |
| | | if(comMngVolunteerMngDO!=null){ |
| | | List<ComActSocialProjectMember> list= comActSocialProjectMemberDao.selectList(new QueryWrapper<ComActSocialProjectMember>().lambda().eq(ComActSocialProjectMember::getPhone,comMngVolunteerMngDO.getPhone()).eq(ComActSocialProjectMember::getType,comActSocialProjectMemberVO.getType()).eq(ComActSocialProjectMember::getProjectId,comActSocialProjectMemberVO.getProjectId())); |
| | | List<ComActSocialProjectMember> list= comActSocialProjectMemberDao.selectList(new QueryWrapper<ComActSocialProjectMember>().lambda().eq(ComActSocialProjectMember::getPhone,comMngVolunteerMngDO.getPhone()).eq(ComActSocialProjectMember::getType, type).eq(ComActSocialProjectMember::getProjectId,comActSocialProjectMemberVO.getParamId())); |
| | | if(CollectionUtils.isEmpty(list)){ |
| | | ComActSocialProjectMember comActSocialProjectMember=new ComActSocialProjectMember(); |
| | | BeanUtils.copyProperties(comActSocialProjectMemberVO,comActSocialProjectMember); |
| | |
| | | comActSocialProjectMember.setPhone(comMngVolunteerMngDO.getPhone()); |
| | | comActSocialProjectMember.setCreateTime(new Date()); |
| | | comActSocialProjectMember.setType(2); |
| | | comActSocialProjectMember.setCommunityId(comMngVolunteerMngDO.getCommunityId()); |
| | | comActSocialProjectMember.setProjectId(comActSocialProjectMemberVO.getParamId()); |
| | | comActSocialProjectMemberDao.insert(comActSocialProjectMember); |
| | | } |
| | | } |
| | | } else if (type == 3) { |
| | | ComPbServiceTeamVO comPbServiceTeamVO = comActSocialMemberDao.selectPbServiceTeamById(id); |
| | | if (nonNull(comPbServiceTeamVO)) { |
| | | List<ComActSocialProjectMember> list= comActSocialProjectMemberDao.selectList(new QueryWrapper<ComActSocialProjectMember>().lambda().eq(ComActSocialProjectMember::getPhone,comPbServiceTeamVO.getPhone()).eq(ComActSocialProjectMember::getType, type).eq(ComActSocialProjectMember::getProjectId,comActSocialProjectMemberVO.getParamId())); |
| | | if(CollectionUtils.isEmpty(list)) { |
| | | ComActSocialProjectMember comActSocialProjectMember=new ComActSocialProjectMember(); |
| | | BeanUtils.copyProperties(comActSocialProjectMemberVO,comActSocialProjectMember); |
| | | comActSocialProjectMember.setImage(comPbServiceTeamVO.getUrl()); |
| | | comActSocialProjectMember.setName(comPbServiceTeamVO.getName()); |
| | | comActSocialProjectMember.setPhone(comPbServiceTeamVO.getPhone()); |
| | | comActSocialProjectMember.setCreateTime(new Date()); |
| | | comActSocialProjectMember.setType(3); |
| | | comActSocialProjectMember.setCommunityId(comPbServiceTeamVO.getCommunityId()); |
| | | comActSocialProjectMember.setProjectId(comActSocialProjectMemberVO.getParamId()); |
| | | comActSocialProjectMemberDao.insert(comActSocialProjectMember); |
| | | } |
| | | } |
| | | } else { |
| | | ComActSocialMember comActSocialMember = comActSocialMemberDao.selectById(id); |
| | | if (nonNull(comActSocialMember)) { |
| | | List<ComActSocialProjectMember> list= comActSocialProjectMemberDao.selectList(new QueryWrapper<ComActSocialProjectMember>().lambda().eq(ComActSocialProjectMember::getPhone,comActSocialMember.getPhone()).eq(ComActSocialProjectMember::getType, type).eq(ComActSocialProjectMember::getProjectId,comActSocialProjectMemberVO.getParamId())); |
| | | if(CollectionUtils.isEmpty(list)) { |
| | | ComActSocialProjectMember comActSocialProjectMember=new ComActSocialProjectMember(); |
| | | BeanUtils.copyProperties(comActSocialProjectMemberVO,comActSocialProjectMember); |
| | | comActSocialProjectMember.setAge(getAge(comActSocialMember.getIdCard())); |
| | | comActSocialProjectMember.setImage(comActSocialMember.getImage()); |
| | | comActSocialProjectMember.setName(comActSocialMember.getName()); |
| | | comActSocialProjectMember.setPhone(comActSocialMember.getPhone()); |
| | | comActSocialProjectMember.setCreateTime(new Date()); |
| | | comActSocialProjectMember.setType(4); |
| | | comActSocialProjectMember.setCommunityId(comActSocialProjectMemberVO.getCommunityId()); |
| | | comActSocialProjectMember.setProjectId(comActSocialProjectMemberVO.getParamId()); |
| | | comActSocialProjectMemberDao.insert(comActSocialProjectMember); |