diff --git a/epdc-cloud-heart/src/main/java/com/elink/esua/epdc/modules/volunteer/controller/VolunteerController.java b/epdc-cloud-heart/src/main/java/com/elink/esua/epdc/modules/volunteer/controller/VolunteerController.java index 595c63c..4e62e55 100644 --- a/epdc-cloud-heart/src/main/java/com/elink/esua/epdc/modules/volunteer/controller/VolunteerController.java +++ b/epdc-cloud-heart/src/main/java/com/elink/esua/epdc/modules/volunteer/controller/VolunteerController.java @@ -28,6 +28,7 @@ import com.elink.esua.epdc.commons.tools.validator.group.UpdateGroup; import com.elink.esua.epdc.modules.volunteer.dao.VolunteerDao; import com.elink.esua.epdc.modules.volunteer.excel.VolunteerExcel; import com.elink.esua.epdc.modules.volunteer.service.VolunteerService; +import com.elink.esua.epdc.volunteer.AppVolunteerApplyDTO; import com.elink.esua.epdc.volunteer.VolunteerDTO; import com.elink.esua.epdc.volunteer.VolunteerPageDTO; import org.springframework.beans.factory.annotation.Autowired; @@ -108,4 +109,28 @@ public class VolunteerController { return volunteerService.handleApply(dto); } + /** + * @describe: 小程序-志愿者申请 + * @author wangtong + * @date 2021/8/30 10:43 + * @params [userDetail, formDto] + * @return com.elink.esua.epdc.commons.tools.utils.Result + */ + @PostMapping("applyVolunteer") + public Result applyVolunteer(@RequestBody AppVolunteerApplyDTO formDto) { + return volunteerService.applyVolunteer(formDto); + } + + /** + * @describe: 小程序-志愿者详情 + * @author wangtong + * @date 2021/8/30 11:00 + * @params [userDetail] + * @return com.elink.esua.epdc.commons.tools.utils.Result + */ + @GetMapping("getVolunteerDetail") + public Result getVolunteerDetail(@RequestBody AppVolunteerApplyDTO formDto) { + return volunteerService.getVolunteerDetail(formDto); + } + } \ No newline at end of file diff --git a/epdc-cloud-heart/src/main/java/com/elink/esua/epdc/modules/volunteer/dao/VolunteerDao.java b/epdc-cloud-heart/src/main/java/com/elink/esua/epdc/modules/volunteer/dao/VolunteerDao.java index 3d5be26..1eb62d9 100644 --- a/epdc-cloud-heart/src/main/java/com/elink/esua/epdc/modules/volunteer/dao/VolunteerDao.java +++ b/epdc-cloud-heart/src/main/java/com/elink/esua/epdc/modules/volunteer/dao/VolunteerDao.java @@ -19,6 +19,7 @@ package com.elink.esua.epdc.modules.volunteer.dao; import com.elink.esua.epdc.commons.mybatis.dao.BaseDao; import com.elink.esua.epdc.modules.volunteer.entity.VolunteerEntity; +import com.elink.esua.epdc.volunteer.AppVolunteerDetailDTO; import com.elink.esua.epdc.volunteer.VolunteerPageDTO; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -61,4 +62,13 @@ public interface VolunteerDao extends BaseDao { * @return com.elink.esua.epdc.modules.volunteer.entity.VolunteerEntity */ VolunteerEntity selectEntityById(@Param("id") String id); + + /** + * @describe: 小程序-志愿者详情 + * @author wangtong + * @date 2021/8/30 14:30 + * @params [userId] + * @return com.elink.esua.epdc.volunteer.AppVolunteerDetailDTO + */ + AppVolunteerDetailDTO selectAppDetailById(@Param("userId") String userId); } \ No newline at end of file diff --git a/epdc-cloud-heart/src/main/java/com/elink/esua/epdc/modules/volunteer/dao/VolunteerOrgRelationDao.java b/epdc-cloud-heart/src/main/java/com/elink/esua/epdc/modules/volunteer/dao/VolunteerOrgRelationDao.java index b19818a..3e04608 100644 --- a/epdc-cloud-heart/src/main/java/com/elink/esua/epdc/modules/volunteer/dao/VolunteerOrgRelationDao.java +++ b/epdc-cloud-heart/src/main/java/com/elink/esua/epdc/modules/volunteer/dao/VolunteerOrgRelationDao.java @@ -20,6 +20,9 @@ package com.elink.esua.epdc.modules.volunteer.dao; import com.elink.esua.epdc.commons.mybatis.dao.BaseDao; import com.elink.esua.epdc.modules.volunteer.entity.VolunteerOrgRelationEntity; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; + +import java.util.List; /** * 志愿者组织关系表 @@ -29,5 +32,15 @@ import org.apache.ibatis.annotations.Mapper; */ @Mapper public interface VolunteerOrgRelationDao extends BaseDao { - + + void deleteByVolunteerId(@Param("volunteerId") String volunteerId); + + /** + * @describe: 通过志愿者查询与之绑定的组织id + * @author wangtong + * @date 2021/8/30 14:32 + * @params [volunteerId] + * @return java.util.List + */ + List selectOrgIdByVolunteerId(@Param("volunteerId") String volunteerId); } \ No newline at end of file diff --git a/epdc-cloud-heart/src/main/java/com/elink/esua/epdc/modules/volunteer/entity/VolunteerEntity.java b/epdc-cloud-heart/src/main/java/com/elink/esua/epdc/modules/volunteer/entity/VolunteerEntity.java index 33ec768..c8c61ee 100644 --- a/epdc-cloud-heart/src/main/java/com/elink/esua/epdc/modules/volunteer/entity/VolunteerEntity.java +++ b/epdc-cloud-heart/src/main/java/com/elink/esua/epdc/modules/volunteer/entity/VolunteerEntity.java @@ -73,7 +73,7 @@ public class VolunteerEntity extends BaseEpdcEntity { /** * 头像地址 */ - private String url; + private String faceImg; /** * 党员标识:0否1是 diff --git a/epdc-cloud-heart/src/main/java/com/elink/esua/epdc/modules/volunteer/entity/VolunteerOrgRelationEntity.java b/epdc-cloud-heart/src/main/java/com/elink/esua/epdc/modules/volunteer/entity/VolunteerOrgRelationEntity.java index cc7b1d0..af5ca2a 100644 --- a/epdc-cloud-heart/src/main/java/com/elink/esua/epdc/modules/volunteer/entity/VolunteerOrgRelationEntity.java +++ b/epdc-cloud-heart/src/main/java/com/elink/esua/epdc/modules/volunteer/entity/VolunteerOrgRelationEntity.java @@ -18,13 +18,10 @@ package com.elink.esua.epdc.modules.volunteer.entity; import com.baomidou.mybatisplus.annotation.TableName; - import com.elink.esua.epdc.commons.mybatis.entity.BaseEpdcEntity; import lombok.Data; import lombok.EqualsAndHashCode; -import java.util.Date; - /** * 志愿者组织关系表 * @@ -46,6 +43,6 @@ public class VolunteerOrgRelationEntity extends BaseEpdcEntity { /** * 志愿组织id */ - private Integer volunteerOrgId; + private Long volunteerOrgId; } \ No newline at end of file diff --git a/epdc-cloud-heart/src/main/java/com/elink/esua/epdc/modules/volunteer/service/VolunteerService.java b/epdc-cloud-heart/src/main/java/com/elink/esua/epdc/modules/volunteer/service/VolunteerService.java index 332b721..7393b68 100644 --- a/epdc-cloud-heart/src/main/java/com/elink/esua/epdc/modules/volunteer/service/VolunteerService.java +++ b/epdc-cloud-heart/src/main/java/com/elink/esua/epdc/modules/volunteer/service/VolunteerService.java @@ -22,6 +22,7 @@ import com.elink.esua.epdc.commons.mybatis.service.BaseService; import com.elink.esua.epdc.commons.tools.page.PageData; import com.elink.esua.epdc.commons.tools.utils.Result; import com.elink.esua.epdc.modules.volunteer.entity.VolunteerEntity; +import com.elink.esua.epdc.volunteer.AppVolunteerApplyDTO; import com.elink.esua.epdc.volunteer.VolunteerDTO; import com.elink.esua.epdc.volunteer.VolunteerPageDTO; @@ -113,4 +114,23 @@ public interface VolunteerService extends BaseService { * @return com.elink.esua.epdc.commons.tools.utils.Result */ Result handleApply(VolunteerDTO dto); + + /** + * @describe: 小程序-志愿者申请 + * @author wangtong + * @date 2021/8/30 10:43 + * @params [userDetail, formDto] + * @return com.elink.esua.epdc.commons.tools.utils.Result + */ + Result applyVolunteer(AppVolunteerApplyDTO formDto); + + + /** + * @describe: 小程序-志愿者详情 + * @author wangtong + * @date 2021/8/30 11:00 + * @params [userDetail] + * @return com.elink.esua.epdc.commons.tools.utils.Result + */ + Result getVolunteerDetail(AppVolunteerApplyDTO formDto); } \ No newline at end of file diff --git a/epdc-cloud-heart/src/main/java/com/elink/esua/epdc/modules/volunteer/service/impl/VolunteerServiceImpl.java b/epdc-cloud-heart/src/main/java/com/elink/esua/epdc/modules/volunteer/service/impl/VolunteerServiceImpl.java index 64e60f4..dbfacc7 100644 --- a/epdc-cloud-heart/src/main/java/com/elink/esua/epdc/modules/volunteer/service/impl/VolunteerServiceImpl.java +++ b/epdc-cloud-heart/src/main/java/com/elink/esua/epdc/modules/volunteer/service/impl/VolunteerServiceImpl.java @@ -25,9 +25,14 @@ 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.modules.volunteer.dao.VolunteerDao; +import com.elink.esua.epdc.modules.volunteer.dao.VolunteerOrgRelationDao; import com.elink.esua.epdc.modules.volunteer.entity.VolunteerEntity; +import com.elink.esua.epdc.modules.volunteer.entity.VolunteerOrgRelationEntity; import com.elink.esua.epdc.modules.volunteer.redis.VolunteerRedis; +import com.elink.esua.epdc.modules.volunteer.service.VolunteerOrgRelationService; import com.elink.esua.epdc.modules.volunteer.service.VolunteerService; +import com.elink.esua.epdc.volunteer.AppVolunteerApplyDTO; +import com.elink.esua.epdc.volunteer.AppVolunteerDetailDTO; import com.elink.esua.epdc.volunteer.VolunteerDTO; import com.elink.esua.epdc.volunteer.VolunteerPageDTO; import org.apache.commons.lang3.StringUtils; @@ -35,6 +40,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.Map; @@ -51,6 +57,12 @@ public class VolunteerServiceImpl extends BaseServiceImpl page(Map params) { IPage page = baseDao.selectPage( @@ -76,6 +88,37 @@ public class VolunteerServiceImpl extends BaseServiceImpl relationList = new ArrayList(); + for(Long orgId : formDto.getVolunteerOrgIds()){ + VolunteerOrgRelationEntity en = new VolunteerOrgRelationEntity(); + en.setVolunteerId(entity.getId()); + en.setVolunteerOrgId(orgId); + relationList.add(en); + } + volunteerOrgRelationService.insertBatch(relationList); + return new Result().ok("提交成功"); + } + + @Override + public Result getVolunteerDetail(AppVolunteerApplyDTO formDto) { + AppVolunteerDetailDTO result = baseDao.selectAppDetailById(formDto.getUserId()); + result.setVolunteerOrgIds(volunteerOrgRelationDao.selectOrgIdByVolunteerId(result.getId())); + return new Result().ok(result); + } + @Override public List list(Map params) { List entityList = baseDao.selectList(getWrapper(params)); diff --git a/epdc-cloud-heart/src/main/resources/mapper/volunteer/VolunteerDao.xml b/epdc-cloud-heart/src/main/resources/mapper/volunteer/VolunteerDao.xml index 09bffbd..244e549 100644 --- a/epdc-cloud-heart/src/main/resources/mapper/volunteer/VolunteerDao.xml +++ b/epdc-cloud-heart/src/main/resources/mapper/volunteer/VolunteerDao.xml @@ -85,6 +85,26 @@ id = #{id} AND del_flag = '0' + \ No newline at end of file diff --git a/epdc-cloud-heart/src/main/resources/mapper/volunteer/VolunteerOrgRelationDao.xml b/epdc-cloud-heart/src/main/resources/mapper/volunteer/VolunteerOrgRelationDao.xml index b82930e..22ac5ca 100644 --- a/epdc-cloud-heart/src/main/resources/mapper/volunteer/VolunteerOrgRelationDao.xml +++ b/epdc-cloud-heart/src/main/resources/mapper/volunteer/VolunteerOrgRelationDao.xml @@ -14,6 +14,17 @@ + + update epdc_volunteer_org_relation set del_flag='1',UPDATED_TIME=now() + where del_flag='0' + and VOLUNTEER_ID=#{volunteerId} + + \ No newline at end of file