|
@ -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.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.VolunteerDao; |
|
|
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.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.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.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.VolunteerDTO; |
|
|
import com.elink.esua.epdc.volunteer.VolunteerPageDTO; |
|
|
import com.elink.esua.epdc.volunteer.VolunteerPageDTO; |
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
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.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; |
|
@ -51,6 +57,12 @@ public class VolunteerServiceImpl extends BaseServiceImpl<VolunteerDao, Voluntee |
|
|
@Autowired |
|
|
@Autowired |
|
|
private VolunteerRedis volunteerRedis; |
|
|
private VolunteerRedis volunteerRedis; |
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
private VolunteerOrgRelationService volunteerOrgRelationService; |
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
private VolunteerOrgRelationDao volunteerOrgRelationDao; |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public PageData<VolunteerDTO> page(Map<String, Object> params) { |
|
|
public PageData<VolunteerDTO> page(Map<String, Object> params) { |
|
|
IPage<VolunteerEntity> page = baseDao.selectPage( |
|
|
IPage<VolunteerEntity> page = baseDao.selectPage( |
|
@ -76,6 +88,37 @@ public class VolunteerServiceImpl extends BaseServiceImpl<VolunteerDao, Voluntee |
|
|
return new Result().ok("审核成功"); |
|
|
return new Result().ok("审核成功"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
public Result applyVolunteer(AppVolunteerApplyDTO formDto) { |
|
|
|
|
|
VolunteerEntity entity = ConvertUtils.sourceToTarget(formDto, VolunteerEntity.class); |
|
|
|
|
|
entity.setState("0"); |
|
|
|
|
|
//新增
|
|
|
|
|
|
if(StringUtils.isBlank(formDto.getId())){ |
|
|
|
|
|
insert(entity); |
|
|
|
|
|
|
|
|
|
|
|
}else{//修改
|
|
|
|
|
|
volunteerOrgRelationDao.deleteByVolunteerId(formDto.getId()); |
|
|
|
|
|
entity.setReason(null); |
|
|
|
|
|
updateById(entity); |
|
|
|
|
|
} |
|
|
|
|
|
List<VolunteerOrgRelationEntity> 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 |
|
|
@Override |
|
|
public List<VolunteerDTO> list(Map<String, Object> params) { |
|
|
public List<VolunteerDTO> list(Map<String, Object> params) { |
|
|
List<VolunteerEntity> entityList = baseDao.selectList(getWrapper(params)); |
|
|
List<VolunteerEntity> entityList = baseDao.selectList(getWrapper(params)); |
|
|