Browse Source

志愿者列表

master
yinzuomei 4 years ago
parent
commit
59c769b41d
  1. 12
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiVolunteerController.java
  2. 10
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/VolunteerInfoService.java
  3. 28
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/VolunteerInfoServiceImpl.java
  4. 3
      epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/VolunteerInfoDao.xml

12
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/ResiVolunteerController.java

@ -25,6 +25,7 @@ import com.epmet.dto.VolunteerInfoDTO;
import com.epmet.dto.form.CommonCustomerFormDTO;
import com.epmet.dto.form.resi.ResiSendSmsCodeFormDTO;
import com.epmet.dto.form.resi.ResiVolunteerAuthenticateFormDTO;
import com.epmet.dto.result.demand.OptionDTO;
import com.epmet.dto.result.resi.ResiVolunteerInfoResultDTO;
import com.epmet.service.VolunteerInfoService;
import org.springframework.beans.factory.annotation.Autowired;
@ -112,4 +113,15 @@ public class ResiVolunteerController {
public Result<VolunteerInfoDTO> queryUserVolunteerInfo(@PathVariable("userId")String userId){
return new Result<VolunteerInfoDTO>().ok(volunteerInfoService.queryUserVolunteerInfo(userId));
}
/**
* 需求指派时服务对象选择志愿者调用此接口查询当前客户下所有的志愿者信息姓名手机号
*
* @param tokenDto
* @return
*/
@PostMapping("listprofile")
public Result<List<OptionDTO>> queryListVolunteer(@LoginUser TokenDto tokenDto){
return new Result<List<OptionDTO>>().ok(volunteerInfoService.queryListVolunteer(tokenDto.getCustomerId()));
}
}

10
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/VolunteerInfoService.java

@ -24,6 +24,7 @@ import com.epmet.dto.VolunteerInfoDTO;
import com.epmet.dto.form.CommonCustomerFormDTO;
import com.epmet.dto.form.resi.ResiSendSmsCodeFormDTO;
import com.epmet.dto.form.resi.ResiVolunteerAuthenticateFormDTO;
import com.epmet.dto.result.demand.OptionDTO;
import com.epmet.dto.result.resi.ResiVolunteerInfoResultDTO;
import com.epmet.entity.VolunteerInfoEntity;
@ -84,4 +85,13 @@ public interface VolunteerInfoService extends BaseService<VolunteerInfoEntity> {
* @return com.epmet.dto.VolunteerInfoDTO
*/
VolunteerInfoDTO queryUserVolunteerInfo(String userId);
/**
* label: 张三15764229697
* value:userId
*
* @param customerId
* @return
*/
List<OptionDTO> queryListVolunteer(String customerId);
}

28
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/VolunteerInfoServiceImpl.java

@ -42,12 +42,15 @@ import com.epmet.dto.form.resi.ResiSendSmsCodeFormDTO;
import com.epmet.dto.form.resi.ResiVolunteerAuthenticateFormDTO;
import com.epmet.dto.result.ResiUserBaseInfoResultDTO;
import com.epmet.dto.result.SendVerificationCodeResultDTO;
import com.epmet.dto.result.UserBaseInfoResultDTO;
import com.epmet.dto.result.demand.OptionDTO;
import com.epmet.dto.result.resi.ResiVolunteerInfoResultDTO;
import com.epmet.entity.VolunteerInfoEntity;
import com.epmet.feign.EpmetMessageOpenFeignClient;
import com.epmet.feign.EpmetUserOpenFeignClient;
import com.epmet.service.HeartUserInfoService;
import com.epmet.service.VolunteerInfoService;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
@ -56,6 +59,9 @@ import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
* 志愿者信息
@ -220,4 +226,26 @@ public class VolunteerInfoServiceImpl extends BaseServiceImpl<VolunteerInfoDao,
VolunteerInfoDTO volunteerInfoDTO=baseDao.selectVolunteerInfoByUserId(userId);
return volunteerInfoDTO;
}
@Override
public List<OptionDTO> queryListVolunteer(String customerId) {
List<OptionDTO> resultList = new ArrayList<>();
List<String> userIds = baseDao.selectVolunteerIds(customerId);
if (CollectionUtils.isEmpty(userIds)) {
return resultList;
}
Result<List<UserBaseInfoResultDTO>> userInfoRes = epmetUserOpenFeignClient.queryUserBaseInfo(userIds);
if (userInfoRes.success() && CollectionUtils.isNotEmpty(userInfoRes.getData())) {
Map<String, UserBaseInfoResultDTO> userMap = userInfoRes.getData().stream().collect(Collectors.toMap(UserBaseInfoResultDTO::getUserId, Function.identity()));
for (String userId : userIds) {
if (userMap.containsKey(userId)) {
OptionDTO optionDTO = new OptionDTO();
optionDTO.setLabel(userMap.get(userId).getRealName().concat("(").concat(userMap.get(userId).getMobile().concat(")")));
optionDTO.setValue(userId);
resultList.add(optionDTO);
}
}
}
return resultList;
}
}

3
epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/VolunteerInfoDao.xml

@ -69,9 +69,10 @@
<!-- 查询一个客户下的所有志愿者用户Id -->
<select id="selectVolunteerIds" resultType="string">
SELECT
USER_ID
distinct USER_ID
FROM volunteer_info
WHERE DEL_FLAG = '0'
AND CUSTOMER_ID = #{customerId}
order by CREATED_TIME asc
</select>
</mapper>

Loading…
Cancel
Save