Browse Source

添加志愿活动与组织关联关系

master
Jackwang 4 years ago
parent
commit
8453c34fa2
  1. 9
      epdc-cloud-heart/src/main/java/com/elink/esua/epdc/modules/volunteer/dao/VactOrgRelationDao.java
  2. 9
      epdc-cloud-heart/src/main/java/com/elink/esua/epdc/modules/volunteer/dao/VolunteerDao.java
  3. 24
      epdc-cloud-heart/src/main/java/com/elink/esua/epdc/modules/volunteer/service/impl/VactInfoServiceImpl.java
  4. 5
      epdc-cloud-heart/src/main/resources/mapper/volunteer/VactOrgRelationDao.xml
  5. 7
      epdc-cloud-heart/src/main/resources/mapper/volunteer/VolunteerDao.xml

9
epdc-cloud-heart/src/main/java/com/elink/esua/epdc/modules/volunteer/dao/VactOrgRelationDao.java

@ -20,6 +20,7 @@ package com.elink.esua.epdc.modules.volunteer.dao;
import com.elink.esua.epdc.commons.mybatis.dao.BaseDao; import com.elink.esua.epdc.commons.mybatis.dao.BaseDao;
import com.elink.esua.epdc.modules.volunteer.entity.VactOrgRelationEntity; import com.elink.esua.epdc.modules.volunteer.entity.VactOrgRelationEntity;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/** /**
* 志愿活动 志愿组织 关联表 * 志愿活动 志愿组织 关联表
@ -30,4 +31,12 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper @Mapper
public interface VactOrgRelationDao extends BaseDao<VactOrgRelationEntity> { public interface VactOrgRelationDao extends BaseDao<VactOrgRelationEntity> {
/**
* @describe: 删除公益活动 组织关联
* @author wangtong
* @date 2021/9/3 16:51
* @params [vactId]
* @return void
*/
void deleteByVactId(@Param("vactId") String vactId);
} }

9
epdc-cloud-heart/src/main/java/com/elink/esua/epdc/modules/volunteer/dao/VolunteerDao.java

@ -71,4 +71,13 @@ public interface VolunteerDao extends BaseDao<VolunteerEntity> {
* @return com.elink.esua.epdc.volunteer.AppVolunteerDetailDTO * @return com.elink.esua.epdc.volunteer.AppVolunteerDetailDTO
*/ */
AppVolunteerDetailDTO selectAppDetailById(@Param("userId") String userId); AppVolunteerDetailDTO selectAppDetailById(@Param("userId") String userId);
/**
* @describe: 通过用户id查询关联的组织id
* @author wangtong
* @date 2021/9/3 16:59
* @params [userId]
* @return java.util.List<java.lang.Long>
*/
List<Long> getOrgIdListByUserId(@Param("userId") String userId);
} }

24
epdc-cloud-heart/src/main/java/com/elink/esua/epdc/modules/volunteer/service/impl/VactInfoServiceImpl.java

@ -26,9 +26,13 @@ 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.ConvertUtils;
import com.elink.esua.epdc.commons.tools.utils.Result; import com.elink.esua.epdc.commons.tools.utils.Result;
import com.elink.esua.epdc.modules.volunteer.dao.VactInfoDao; import com.elink.esua.epdc.modules.volunteer.dao.VactInfoDao;
import com.elink.esua.epdc.modules.volunteer.dao.VactOrgRelationDao;
import com.elink.esua.epdc.modules.volunteer.dao.VolunteerDao;
import com.elink.esua.epdc.modules.volunteer.entity.VactInfoEntity; import com.elink.esua.epdc.modules.volunteer.entity.VactInfoEntity;
import com.elink.esua.epdc.modules.volunteer.entity.VactOrgRelationEntity;
import com.elink.esua.epdc.modules.volunteer.redis.VactInfoRedis; import com.elink.esua.epdc.modules.volunteer.redis.VactInfoRedis;
import com.elink.esua.epdc.modules.volunteer.service.VactInfoService; import com.elink.esua.epdc.modules.volunteer.service.VactInfoService;
import com.elink.esua.epdc.modules.volunteer.service.VactOrgRelationService;
import com.elink.esua.epdc.volunteer.*; import com.elink.esua.epdc.volunteer.*;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
@ -36,6 +40,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -53,6 +58,15 @@ public class VactInfoServiceImpl extends BaseServiceImpl<VactInfoDao, VactInfoEn
@Autowired @Autowired
private VactInfoRedis vactInfoRedis; private VactInfoRedis vactInfoRedis;
@Autowired
private VactOrgRelationDao VactOrgRelationDao;
@Autowired
private VolunteerDao volunteerDao;
@Autowired
private VactOrgRelationService vactOrgRelationService;
@Override @Override
public PageData<VactPageInfoDTO> page(Map<String, Object> params) { public PageData<VactPageInfoDTO> page(Map<String, Object> params) {
// IPage<VactInfoEntity> page = baseDao.selectPage( // IPage<VactInfoEntity> page = baseDao.selectPage(
@ -134,9 +148,19 @@ public class VactInfoServiceImpl extends BaseServiceImpl<VactInfoDao, VactInfoEn
if(StringUtils.isBlank(formDto.getId())){ if(StringUtils.isBlank(formDto.getId())){
insert(entity); insert(entity);
}else{//修改 }else{//修改
VactOrgRelationDao.deleteByVactId(formDto.getId());
entity.setReason(""); entity.setReason("");
updateById(entity); updateById(entity);
} }
List<VactOrgRelationEntity> relationList = new ArrayList();
List<Long> orgIdList = volunteerDao.getOrgIdListByUserId(formDto.getUserId());
for(Long orgId : orgIdList){
VactOrgRelationEntity relationEntity = new VactOrgRelationEntity();
relationEntity.setVactId(entity.getId());
relationEntity.setVolunteerOrgId(orgId);
relationList.add(relationEntity);
}
vactOrgRelationService.insertBatch(relationList);
return new Result().ok("提交成功"); return new Result().ok("提交成功");
} }

5
epdc-cloud-heart/src/main/resources/mapper/volunteer/VactOrgRelationDao.xml

@ -14,6 +14,11 @@
<result property="updatedBy" column="UPDATED_BY"/> <result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/> <result property="updatedTime" column="UPDATED_TIME"/>
</resultMap> </resultMap>
<update id="deleteByVactId">
update epdc_vact_org_relation set del_flag='1',UPDATED_TIME=now()
where del_flag='0'
and VACT_ID=#{vactId}
</update>
</mapper> </mapper>

7
epdc-cloud-heart/src/main/resources/mapper/volunteer/VolunteerDao.xml

@ -105,6 +105,13 @@
where v.DEL_FLAG='0' where v.DEL_FLAG='0'
and v.USER_ID=#{userId} and v.USER_ID=#{userId}
</select> </select>
<select id="getOrgIdListByUserId" resultType="java.lang.Long">
SELECT r.VOLUNTEER_ORG_ID
FROM `epdc_volunteer` v
left join epdc_volunteer_org_relation r on r.VOLUNTEER_ID=v.id and r.DEL_FLAG='0'
where USER_ID=#{userId}
and v.DEL_FLAG='0'
</select>
</mapper> </mapper>
Loading…
Cancel
Save