From 00a59b93c16b24e7be77c6f1ce4866c75a2e0431 Mon Sep 17 00:00:00 2001 From: 101captain <237651143@qq.com> Date: 星期二, 19 四月 2022 16:32:21 +0800 Subject: [PATCH] 花城E+防疫修改 --- springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActSocialProjectMemberServiceImpl.java | 73 +++++++++++++++++++++++++++++++----- 1 files changed, 63 insertions(+), 10 deletions(-) diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActSocialProjectMemberServiceImpl.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActSocialProjectMemberServiceImpl.java index 4222d5d..75a4146 100644 --- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActSocialProjectMemberServiceImpl.java +++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActSocialProjectMemberServiceImpl.java @@ -1,5 +1,7 @@ package com.panzhihua.service_community.service.impl; +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.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.panzhihua.common.model.dtos.property.CommonPage; @@ -19,6 +21,7 @@ import javax.annotation.Resource; import java.util.Date; +import java.util.List; /** * 项目人员(ComActSocialProjectMember)表服务实现类 @@ -46,15 +49,18 @@ if(comActSocialProjectMemberVO.getType()==1){ ComActSocialWorker comActSocialWorker=comActSocialWorkerDao.selectById(comActSocialProjectMemberVO.getParamId()); if(comActSocialWorker!=null){ - ComActSocialProjectMember comActSocialProjectMember=new ComActSocialProjectMember(); - BeanUtils.copyProperties(comActSocialProjectMemberVO,comActSocialProjectMember); - comActSocialProjectMember.setAge(getAge(comActSocialWorker.getIdCard())); - comActSocialProjectMember.setImage(comActSocialWorker.getImage()); - comActSocialProjectMember.setName(comActSocialWorker.getName()); - comActSocialProjectMember.setPhone(comActSocialWorker.getTelephone()); - comActSocialProjectMember.setCreateTime(new Date()); - comActSocialProjectMemberDao.insert(comActSocialProjectMember); - return R.ok(); + List<ComActSocialProjectMember> list= comActSocialProjectMemberDao.selectList(new QueryWrapper<ComActSocialProjectMember>().lambda().eq(ComActSocialProjectMember::getPhone,comActSocialWorker.getTelephone()).eq(ComActSocialProjectMember::getType,comActSocialProjectMemberVO.getType()).eq(ComActSocialProjectMember::getProjectId,comActSocialProjectMemberVO.getProjectId())); + if(CollectionUtils.isEmpty(list)){ + ComActSocialProjectMember comActSocialProjectMember=new ComActSocialProjectMember(); + BeanUtils.copyProperties(comActSocialProjectMemberVO,comActSocialProjectMember); + comActSocialProjectMember.setAge(getAge(comActSocialWorker.getIdCard())); + comActSocialProjectMember.setImage(comActSocialWorker.getImage()); + comActSocialProjectMember.setName(comActSocialWorker.getName()); + comActSocialProjectMember.setPhone(comActSocialWorker.getTelephone()); + comActSocialProjectMember.setCreateTime(new Date()); + comActSocialProjectMemberDao.insert(comActSocialProjectMember); + return R.ok(); + } } } else { @@ -74,8 +80,55 @@ return R.fail("参数异常"); } + @Override + public R insertBatch(ComActSocialProjectMemberVO comActSocialProjectMemberVO) { + if(CollectionUtils.isNotEmpty(comActSocialProjectMemberVO.getIds())){ + comActSocialProjectMemberVO.getIds().forEach(id ->{ + if(comActSocialProjectMemberVO.getType()==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())); + if(CollectionUtils.isEmpty(list)){ + ComActSocialProjectMember comActSocialProjectMember=new ComActSocialProjectMember(); + BeanUtils.copyProperties(comActSocialProjectMemberVO,comActSocialProjectMember); + comActSocialProjectMember.setAge(getAge(comActSocialWorker.getIdCard())); + comActSocialProjectMember.setImage(comActSocialWorker.getImage()); + comActSocialProjectMember.setName(comActSocialWorker.getName()); + comActSocialProjectMember.setPhone(comActSocialWorker.getTelephone()); + comActSocialProjectMember.setCreateTime(new Date()); + comActSocialProjectMember.setType(1); + comActSocialProjectMember.setCommunityId(comActSocialProjectMemberVO.getCommunityId()); + comActSocialProjectMember.setProjectId(comActSocialProjectMemberVO.getParamId()); + comActSocialProjectMemberDao.insert(comActSocialProjectMember); + } + } + } + else { + 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())); + if(CollectionUtils.isEmpty(list)){ + ComActSocialProjectMember comActSocialProjectMember=new ComActSocialProjectMember(); + BeanUtils.copyProperties(comActSocialProjectMemberVO,comActSocialProjectMember); + comActSocialProjectMember.setAge(comMngVolunteerMngDO.getAge()); + comActSocialProjectMember.setImage(comMngVolunteerMngDO.getPhotoPath()); + comActSocialProjectMember.setName(comMngVolunteerMngDO.getName()); + comActSocialProjectMember.setPhone(comMngVolunteerMngDO.getPhone()); + comActSocialProjectMember.setCreateTime(new Date()); + comActSocialProjectMember.setType(2); + comActSocialProjectMember.setCommunityId(comActSocialProjectMemberVO.getCommunityId()); + comActSocialProjectMember.setProjectId(comActSocialProjectMemberVO.getParamId()); + comActSocialProjectMemberDao.insert(comActSocialProjectMember); + } + } + } + }); + } + return R.ok(); + } + public Integer getAge(String idCard){ - Integer year=Integer.parseInt(idCard.substring(5,9)); + Integer year=Integer.parseInt(idCard.substring(6,10)); Integer nowYear= DateUtils.getYear(new Date()); return nowYear-year; } -- Gitblit v1.7.1