|
|
@ -17,6 +17,7 @@ |
|
|
|
|
|
|
|
package com.elink.esua.epdc.modules.volunteer.service.impl; |
|
|
|
|
|
|
|
import com.alibaba.nacos.client.naming.utils.CollectionUtils; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
import com.elink.esua.epdc.commons.mybatis.service.impl.BaseServiceImpl; |
|
|
@ -27,7 +28,10 @@ import com.elink.esua.epdc.commons.tools.page.PageData; |
|
|
|
import com.elink.esua.epdc.commons.tools.utils.ConvertUtils; |
|
|
|
import com.elink.esua.epdc.commons.tools.utils.Result; |
|
|
|
import com.elink.esua.epdc.dto.VolunteerDetailResultDTO; |
|
|
|
import com.elink.esua.epdc.dto.VolunteerInfoDTO; |
|
|
|
import com.elink.esua.epdc.dto.VolunteerUnionFormDTO; |
|
|
|
import com.elink.esua.epdc.modules.activity.dao.ActInfoDao; |
|
|
|
import com.elink.esua.epdc.modules.activity.entity.ActInfoEntity; |
|
|
|
import com.elink.esua.epdc.modules.feign.UserInfoFeignClient; |
|
|
|
import com.elink.esua.epdc.modules.volunteer.dao.VolunteerTeamDao; |
|
|
|
import com.elink.esua.epdc.modules.volunteer.entity.VolunteerTeamEntity; |
|
|
@ -60,6 +64,9 @@ public class VolunteerTeamServiceImpl extends BaseServiceImpl<VolunteerTeamDao, |
|
|
|
@Autowired |
|
|
|
private UserInfoFeignClient userInfoFeignClient; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private ActInfoDao actInfoDao; |
|
|
|
|
|
|
|
@Override |
|
|
|
public PageData<VolunteerTeamDTO> page(Map<String, Object> params) { |
|
|
|
IPage<VolunteerTeamEntity> page = baseDao.selectPage( |
|
|
@ -97,11 +104,12 @@ public class VolunteerTeamServiceImpl extends BaseServiceImpl<VolunteerTeamDao, |
|
|
|
|
|
|
|
Result<VolunteerDetailResultDTO> volunteerResult = userInfoFeignClient.getVolunteerWithTeamState(dto); |
|
|
|
if (!volunteerResult.success() || volunteerResult.getData() == null) { |
|
|
|
throw new RenException("获取志愿者信息失败"); |
|
|
|
result.setJoinFlag(false); |
|
|
|
}else{ |
|
|
|
VolunteerDetailResultDTO volunteerDTO = volunteerResult.getData(); |
|
|
|
result.setJoinFlag(volunteerDTO.getJoinFlag()); |
|
|
|
result.setVolunteerId(volunteerDTO.getVolunteerId()); |
|
|
|
} |
|
|
|
VolunteerDetailResultDTO volunteerDTO = volunteerResult.getData(); |
|
|
|
result.setJoinFlag(volunteerDTO.getJoinFlag()); |
|
|
|
result.setVolunteerId(volunteerDTO.getVolunteerId()); |
|
|
|
return new Result().ok(result); |
|
|
|
} |
|
|
|
|
|
|
@ -144,6 +152,24 @@ public class VolunteerTeamServiceImpl extends BaseServiceImpl<VolunteerTeamDao, |
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void delete(String[] ids) { |
|
|
|
for(String id : ids){ |
|
|
|
//检测是否关联活动
|
|
|
|
List<ActInfoEntity> actList = actInfoDao.selectByTeamId(id); |
|
|
|
if(!CollectionUtils.isEmpty(actList)){ |
|
|
|
throw new RenException("该团队已关联活动,暂时不可删除"); |
|
|
|
} |
|
|
|
//检测是否有团队成员
|
|
|
|
VolunteerUnionFormDTO dto = new VolunteerUnionFormDTO(); |
|
|
|
dto.setId(id); |
|
|
|
Result<List<VolunteerInfoDTO>> volunteerList = userInfoFeignClient.selectVolunteerByTeamId(dto); |
|
|
|
if (!volunteerList.success() ) { |
|
|
|
throw new RenException("获取团队成员信息有误,请稍后再试"); |
|
|
|
} |
|
|
|
List<VolunteerInfoDTO> vList = volunteerList.getData(); |
|
|
|
if(!CollectionUtils.isEmpty(vList)){ |
|
|
|
throw new RenException("该团队已关联团队成员,暂时不可删除"); |
|
|
|
} |
|
|
|
} |
|
|
|
// 逻辑删除(@TableLogic 注解)
|
|
|
|
baseDao.deleteBatchIds(Arrays.asList(ids)); |
|
|
|
} |
|
|
|