|
|
@ -10,9 +10,13 @@ import org.jeecg.modules.api.bean.PageBean; |
|
|
|
import org.jeecg.modules.api.service.IndexService; |
|
|
|
import org.jeecg.modules.communityBanner.entity.CommunityBanner; |
|
|
|
import org.jeecg.modules.communityBanner.service.ICommunityBannerService; |
|
|
|
import org.jeecg.modules.communityCareer.entity.CommunityCareer; |
|
|
|
import org.jeecg.modules.communityCareer.service.ICommunityCareerService; |
|
|
|
import org.jeecg.modules.communityNotice.entity.CommunityNotice; |
|
|
|
import org.jeecg.modules.communityNotice.service.ICommunityNoticeService; |
|
|
|
import org.jeecg.modules.communityOrder.entity.CommunityOrder; |
|
|
|
import org.jeecg.modules.communityQualifications.entity.CommunityQualifications; |
|
|
|
import org.jeecg.modules.communityQualifications.service.ICommunityQualificationsService; |
|
|
|
import org.jeecg.modules.communityVolunteer.entity.CommunityVolunteer; |
|
|
|
import org.jeecg.modules.communityVolunteer.service.ICommunityVolunteerService; |
|
|
|
import org.jeecg.modules.hanHaiMember.entity.HanHaiMember; |
|
|
@ -41,6 +45,12 @@ public class IndexServiceImpl implements IndexService { |
|
|
|
//用户信息 |
|
|
|
@Resource |
|
|
|
private IHanHaiMemberService hanHaiMemberService; |
|
|
|
//职业信息 |
|
|
|
@Resource |
|
|
|
private ICommunityCareerService communityCareerService; |
|
|
|
//学历信息 |
|
|
|
@Resource |
|
|
|
private ICommunityQualificationsService communityQualificationsService; |
|
|
|
/******************************************************************************************************************/ |
|
|
|
|
|
|
|
//获取banner图列表 |
|
|
@ -156,6 +166,53 @@ public class IndexServiceImpl implements IndexService { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//查询志愿者信息 |
|
|
|
@Override |
|
|
|
public Result<?> queryVolunteer(String token) { |
|
|
|
log.info("开始查询志愿者信息"); |
|
|
|
//权限验证 |
|
|
|
HanHaiMember hanHaiMember = shiroRealm.checkUserTokenIsEffectHanHaiOpenId(token); |
|
|
|
//HanHaiMember hanHaiMember = hanHaiMemberService.getById(token); |
|
|
|
//返回信息 |
|
|
|
String massege = ""; |
|
|
|
|
|
|
|
try{ |
|
|
|
//1、查询公告详情 |
|
|
|
CommunityVolunteer one = communityVolunteerService |
|
|
|
.lambdaQuery() |
|
|
|
.eq(CommunityVolunteer::getUserId, hanHaiMember.getId()) |
|
|
|
.one(); |
|
|
|
if(null == one){ |
|
|
|
log.info("志愿者信息不存在"); |
|
|
|
return Result.OK("志愿者信息不存在", one); |
|
|
|
} |
|
|
|
//查询职业信息 |
|
|
|
CommunityCareer career = communityCareerService.getById(one.getCareer()); |
|
|
|
if(null != career){ |
|
|
|
one.setCareerName(career.getTitle()); |
|
|
|
}else { |
|
|
|
one.setCareerName("暂无职业"); |
|
|
|
} |
|
|
|
|
|
|
|
//查询学历信息 |
|
|
|
CommunityQualifications qualifications = communityQualificationsService.getById(one.getQualifications()); |
|
|
|
if(null != qualifications){ |
|
|
|
one.setQualificationsName(qualifications.getTitle()); |
|
|
|
}else { |
|
|
|
one.setCareerName("暂无学历"); |
|
|
|
} |
|
|
|
|
|
|
|
//2、返回公告信息 |
|
|
|
log.info("志愿者信息查询结束"); |
|
|
|
return Result.OK("志愿者信息", one); |
|
|
|
}catch (Exception e){ |
|
|
|
log.info("志愿者信息查询失败"); |
|
|
|
e.printStackTrace(); |
|
|
|
return Result.error("志愿者查询失败"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//申请成为志愿者 |
|
|
|
@Override |
|
|
|
public Result<?> applyVolunteer(String token, CommunityVolunteer communityVolunteer) { |
|
|
@ -173,24 +230,62 @@ public class IndexServiceImpl implements IndexService { |
|
|
|
.eq(CommunityVolunteer::getUserId, hanHaiMember.getId()) |
|
|
|
.one(); |
|
|
|
if(null != volunteer){ |
|
|
|
log.info("您已经是志愿者了!"); |
|
|
|
return Result.OK("您已经是志愿者了!"); |
|
|
|
communityVolunteer.setUserId(hanHaiMember.getId()); |
|
|
|
communityVolunteer.setId(volunteer.getId()); |
|
|
|
communityVolunteer.setStatus("0"); |
|
|
|
boolean result = communityVolunteerService.updateById(communityVolunteer); |
|
|
|
//判断是否修改成功 |
|
|
|
log.info("修改志愿者信息结束"); |
|
|
|
if(result){ |
|
|
|
return Result.OK("信息修改成功"); |
|
|
|
}else { |
|
|
|
return Result.OK("信息修改失败"); |
|
|
|
} |
|
|
|
}else { |
|
|
|
communityVolunteer.setUserId(hanHaiMember.getId()); |
|
|
|
boolean result = communityVolunteerService.save(communityVolunteer); |
|
|
|
//判断是否新增成功 |
|
|
|
log.info("申请成为志愿者表单提交结束"); |
|
|
|
if(result){ |
|
|
|
return Result.OK("信息添加成功"); |
|
|
|
}else { |
|
|
|
return Result.OK("信息添加失败"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
}catch (Exception e){ |
|
|
|
log.error("申请成为志愿者表单提交失败"); |
|
|
|
e.printStackTrace(); |
|
|
|
return Result.error("信息添加失败"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
//修改志愿者信息 |
|
|
|
@Override |
|
|
|
public Result<?> updateVolunteer(String token, CommunityVolunteer communityVolunteer) { |
|
|
|
log.info("修改志愿者信息开始"); |
|
|
|
//权限验证 |
|
|
|
HanHaiMember hanHaiMember = shiroRealm.checkUserTokenIsEffectHanHaiOpenId(token); |
|
|
|
//HanHaiMember hanHaiMember = hanHaiMemberService.getById(token); |
|
|
|
//返回信息 |
|
|
|
String massege = ""; |
|
|
|
|
|
|
|
try{ |
|
|
|
communityVolunteer.setUserId(hanHaiMember.getId()); |
|
|
|
boolean result = communityVolunteerService.save(communityVolunteer); |
|
|
|
//判断是否新增成功 |
|
|
|
log.info("申请成为志愿者表单提交结束"); |
|
|
|
communityVolunteer.setStatus("0"); |
|
|
|
boolean result = communityVolunteerService.updateById(communityVolunteer); |
|
|
|
//判断是否修改成功 |
|
|
|
log.info("修改志愿者信息结束"); |
|
|
|
if(result){ |
|
|
|
return Result.OK("信息添加成功"); |
|
|
|
return Result.OK("信息修改成功"); |
|
|
|
}else { |
|
|
|
return Result.OK("信息添加失败"); |
|
|
|
return Result.OK("信息修改失败"); |
|
|
|
} |
|
|
|
|
|
|
|
}catch (Exception e){ |
|
|
|
log.error("申请成为志愿者表单提交失败"); |
|
|
|
log.error("修改志愿者信息失败"); |
|
|
|
e.printStackTrace(); |
|
|
|
return Result.error("信息添加失败"); |
|
|
|
return Result.error("信息修改失败"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |