|
|
@ -21,11 +21,10 @@ import com.alibaba.fastjson.JSON; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
|
|
|
import com.epmet.commons.tools.constant.MqConstant; |
|
|
|
import com.epmet.commons.tools.constant.NumConstant; |
|
|
|
import com.epmet.commons.tools.constant.ServiceConstant; |
|
|
|
import com.epmet.commons.tools.constant.StrConstant; |
|
|
|
import com.epmet.commons.tools.dto.form.mq.eventmsg.BasePointEventMsg; |
|
|
|
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; |
|
|
|
import com.epmet.commons.tools.dto.result.OptionDataResultDTO; |
|
|
|
import com.epmet.commons.tools.exception.EpmetErrorCode; |
|
|
|
import com.epmet.commons.tools.exception.EpmetException; |
|
|
|
import com.epmet.commons.tools.exception.RenException; |
|
|
@ -45,7 +44,6 @@ 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.PageVolunteerInfoResultDTO; |
|
|
|
import com.epmet.dto.result.resi.ResiVolunteerInfoResultDTO; |
|
|
@ -64,8 +62,8 @@ import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
import java.text.Collator; |
|
|
|
import java.util.*; |
|
|
|
import java.util.function.Function; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
/** |
|
|
@ -337,43 +335,16 @@ public class VolunteerInfoServiceImpl extends BaseServiceImpl<VolunteerInfoDao, |
|
|
|
if (null == staffInfo) { |
|
|
|
throw new EpmetException(EpmetErrorCode.SERVER_ERROR.getCode(), "查询工作人员信息异常"); |
|
|
|
} |
|
|
|
// 如果是根级组织的工作人员,agencyPids="";正常是以英文冒号隔开
|
|
|
|
String pids=""; |
|
|
|
if(StringUtils.isBlank(staffInfo.getAgencyPIds())||NumConstant.ZERO_STR.equals(staffInfo.getAgencyPIds())){ |
|
|
|
pids=staffInfo.getAgencyId(); |
|
|
|
}else{ |
|
|
|
pids=staffInfo.getAgencyPIds().concat(StrConstant.COLON).concat(staffInfo.getAgencyId()); |
|
|
|
} |
|
|
|
LambdaQueryWrapper<VolunteerInfoEntity> query=new LambdaQueryWrapper<>(); |
|
|
|
query.eq(VolunteerInfoEntity::getCustomerId,customerId); |
|
|
|
query.likeRight(VolunteerInfoEntity::getPids,pids); |
|
|
|
query.select(VolunteerInfoEntity::getUserId); |
|
|
|
query.orderByAsc(VolunteerInfoEntity::getCreatedTime); |
|
|
|
Set<String> userIds = baseDao.selectObjs(query).stream().map(o->o.toString()).collect(Collectors.toSet()); |
|
|
|
List<OptionDTO> resultList = new ArrayList<>(); |
|
|
|
if (CollectionUtils.isEmpty(userIds)) { |
|
|
|
return resultList; |
|
|
|
} |
|
|
|
Result<List<UserBaseInfoResultDTO>> userInfoRes = epmetUserOpenFeignClient.queryUserBaseInfo(new ArrayList<>(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)) { |
|
|
|
if (StringUtils.isNoneBlank(userRealName)) { |
|
|
|
if (userMap.get(userId).getRealName().contains(userRealName)) { |
|
|
|
OptionDTO optionDTO = new OptionDTO(); |
|
|
|
optionDTO.setLabel(userMap.get(userId).getRealName().concat("(").concat(userMap.get(userId).getMobile().concat(")"))); |
|
|
|
optionDTO.setValue(userId); |
|
|
|
resultList.add(optionDTO); |
|
|
|
} |
|
|
|
} else { |
|
|
|
OptionDTO optionDTO = new OptionDTO(); |
|
|
|
optionDTO.setLabel(userMap.get(userId).getRealName().concat("(").concat(userMap.get(userId).getMobile().concat(")"))); |
|
|
|
optionDTO.setValue(userId); |
|
|
|
resultList.add(optionDTO); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
IcResiUserDTO icUser = new IcResiUserDTO(); |
|
|
|
icUser.setCustomerId(customerId); |
|
|
|
icUser.setAgencyId(staffInfo.getAgencyId()); |
|
|
|
Result<List<OptionDataResultDTO>> volunteerRes = epmetUserOpenFeignClient.getVolunteerList(icUser); |
|
|
|
if (volunteerRes.success() && CollectionUtils.isNotEmpty(volunteerRes.getData())) { |
|
|
|
resultList = ConvertUtils.sourceToTarget(volunteerRes.getData(), OptionDTO.class); |
|
|
|
resultList = resultList.stream().sorted((o1, o2) -> |
|
|
|
Collator.getInstance(Locale.TRADITIONAL_CHINESE).compare(o1.getLabel(),o2.getLabel())) |
|
|
|
.collect(Collectors.toList()); |
|
|
|
} |
|
|
|
return resultList; |
|
|
|
} |
|
|
|