|
|
@ -27,6 +27,7 @@ import com.elink.esua.epdc.commons.tools.utils.ConvertUtils; |
|
|
|
import com.elink.esua.epdc.commons.tools.utils.Result; |
|
|
|
import com.elink.esua.epdc.constant.VolunteerInfoConsant; |
|
|
|
import com.elink.esua.epdc.dao.VolunteerInfoDao; |
|
|
|
import com.elink.esua.epdc.dto.ParentAndAllDeptDTO; |
|
|
|
import com.elink.esua.epdc.dto.UserTagDTO; |
|
|
|
import com.elink.esua.epdc.dto.VolunteerInfoDTO; |
|
|
|
import com.elink.esua.epdc.dto.epdc.form.EpdcCompleteVolunteerInfoFormDTO; |
|
|
@ -34,6 +35,7 @@ import com.elink.esua.epdc.dto.epdc.form.EpdcInformationFormDTO; |
|
|
|
import com.elink.esua.epdc.dto.epdc.result.EpdcAdjustVolunteerPointsDTO; |
|
|
|
import com.elink.esua.epdc.dto.epdc.result.EpdcGetVolunteerRankDTO; |
|
|
|
import com.elink.esua.epdc.entity.VolunteerInfoEntity; |
|
|
|
import com.elink.esua.epdc.feign.AdminFeignClient; |
|
|
|
import com.elink.esua.epdc.redis.VolunteerInfoRedis; |
|
|
|
import com.elink.esua.epdc.service.UserService; |
|
|
|
import com.elink.esua.epdc.service.VolunteerInfoService; |
|
|
@ -43,6 +45,7 @@ import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
import java.util.Arrays; |
|
|
|
import java.util.Date; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
|
|
|
@ -67,6 +70,9 @@ public class VolunteerInfoServiceImpl extends BaseServiceImpl<VolunteerInfoDao, |
|
|
|
@Autowired |
|
|
|
private NewsTask newsTask; |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private AdminFeignClient adminFeignClient; |
|
|
|
|
|
|
|
/** |
|
|
|
* 根据查询条件,返回首页 志愿者信息列表 |
|
|
|
* @param params |
|
|
@ -219,10 +225,36 @@ public class VolunteerInfoServiceImpl extends BaseServiceImpl<VolunteerInfoDao, |
|
|
|
return new Result<Integer>().ok(baseDao.getVolunteerCountById(userId)); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 新增志愿者 |
|
|
|
* @param epdcCompleteVolunteerInfoFormDTO |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public Result<Integer> insertVolunteerInfo(EpdcCompleteVolunteerInfoFormDTO epdcCompleteVolunteerInfoFormDTO) { |
|
|
|
VolunteerInfoEntity volunteerEntity = ConvertUtils.sourceToTarget(epdcCompleteVolunteerInfoFormDTO, VolunteerInfoEntity.class); |
|
|
|
// 补全其他字段
|
|
|
|
volunteerEntity.setRegistTime(new Date());// 注册时间
|
|
|
|
volunteerEntity.setAuditStatus("1"); // 审核状态 默认审核通过
|
|
|
|
volunteerEntity.setAuditTime(new Date()); // 审核时间
|
|
|
|
volunteerEntity.setKindnessTime(0); // 爱心时长(单位:分钟)
|
|
|
|
volunteerEntity.setParticipationNum(0); // 参加活动次数
|
|
|
|
String address = volunteerEntity.getRoad() |
|
|
|
.concat(StringUtils.isNotBlank(volunteerEntity.getVillageName()) ? volunteerEntity.getVillageName() : "") |
|
|
|
.concat(StringUtils.isNotBlank(volunteerEntity.getDwellingPlace()) ? volunteerEntity.getDwellingPlace() : ""); |
|
|
|
volunteerEntity.setAddress(address); // 居住地址
|
|
|
|
|
|
|
|
// 获取部门信息
|
|
|
|
Result<ParentAndAllDeptDTO> dtoResult = adminFeignClient.getParentAndAllDept(volunteerEntity.getGirdId()+""); |
|
|
|
ParentAndAllDeptDTO parentAndAllDeptDTO = dtoResult.getData(); |
|
|
|
|
|
|
|
volunteerEntity.setParentDeptIds(parentAndAllDeptDTO.getParentDeptIds()); // 父所有部门ID
|
|
|
|
volunteerEntity.setParentDeptNames(parentAndAllDeptDTO.getParentDeptNames());// 父所有部门
|
|
|
|
volunteerEntity.setAllDeptIds(parentAndAllDeptDTO.getAllDeptIds()); // 所有部门ID
|
|
|
|
volunteerEntity.setAllDeptNames(parentAndAllDeptDTO.getAllDeptNames()); // 所有部门
|
|
|
|
|
|
|
|
|
|
|
|
insert(volunteerEntity); |
|
|
|
return new Result<Integer>().ok(1); |
|
|
|
} |
|
|
|