优化小助手端咨询列表接口
This commit is contained in:
+3
@@ -12,6 +12,7 @@ import org.apache.ibatis.annotations.Update;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @Description: con_doctor
|
||||
@@ -71,6 +72,8 @@ public interface ConDoctorMapper extends BaseMapper<ConDoctor> , MPJBaseMapper<C
|
||||
@Select("SELECT * FROM con_doctor WHERE status = '1' and del_flag = '0' and id = #{doctorId}")
|
||||
public ConDoctorDO selectDoctorInfoById(String doctorId);
|
||||
|
||||
public List<ConDoctorDO> selectDoctorInfoByIds(@Param("doctorIds") Set<String> doctorIds);
|
||||
|
||||
@Select("SELECT * FROM con_doctor WHERE status = '1' and del_flag = '0' and id = #{doctorId} and is_accept = '1'")
|
||||
public ConDoctorDO selectDoctorInfoByIdNew(String doctorId);
|
||||
|
||||
|
||||
+14
@@ -532,4 +532,18 @@
|
||||
and id != #{doctorId}
|
||||
</if>
|
||||
</select>
|
||||
<select id="selectDoctorInfoByIds" resultType="com.renkang.consultation.entity.ConDoctorDO">
|
||||
SELECT * FROM con_doctor
|
||||
WHERE status = '1'
|
||||
AND del_flag = '0'
|
||||
<if test="doctorIds != null and doctorIds.size() > 0">
|
||||
AND id IN
|
||||
<foreach collection="doctorIds" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="doctorIds == null or doctorIds.size() == 0">
|
||||
AND 1=0
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
+99
-30
@@ -28,6 +28,7 @@ import com.renkang.im.entity.ImGroupMsgTextReqDO;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.jeecg.bean.request.ListUser;
|
||||
import org.jeecg.bean.response.BaseEmployeeInfo;
|
||||
import org.jeecg.common.api.vo.Result;
|
||||
import org.jeecg.common.constant.CommonConstant;
|
||||
import org.jeecg.common.system.api.ISysBaseAPI;
|
||||
@@ -767,44 +768,112 @@ public class ConSessionServiceImpl extends ServiceImpl<ConSessionMapper, ConSess
|
||||
}
|
||||
String imIds = String.join(",", list.getImIds());
|
||||
List<ConSession> conSessionDOList = conSessionMapper.companySessionList(imIds);
|
||||
if (CollUtil.isNotEmpty(conSessionDOList)) {
|
||||
Set<String> fromAccount = conSessionDOList.stream().map(ConSession::getFromAccount).collect(Collectors.toSet());
|
||||
Set<String> toAccount = conSessionDOList.stream().map(ConSession::getToAccount).collect(Collectors.toSet());
|
||||
Set<String> userIds = new HashSet<>(fromAccount);
|
||||
userIds.addAll(toAccount);
|
||||
List<BaseEmployeeInfo> baseUsers = sysBaseAPI.queryBaseEmployeeInfo(userIds);
|
||||
List<ConDoctorDO> doctors = conDoctorMapper.selectDoctorInfoByIds(userIds);
|
||||
List<DictModel> sexModels = dictUtil.queryDictItemListByCode("sex2");
|
||||
// 根据key转成map
|
||||
Map<String, DictModel> sexMap = sexModels.stream()
|
||||
.filter(model -> model != null && StrUtil.isNotBlank(model.getValue()))
|
||||
.collect(Collectors.toMap(DictModel::getValue, model -> model,
|
||||
(existing, replacement) -> existing));
|
||||
// 根据id转成map
|
||||
Map<String, BaseEmployeeInfo> userMap = baseUsers.stream()
|
||||
.filter(user -> user != null && StrUtil.isNotBlank(user.getUserId()))
|
||||
.collect(Collectors.toMap(BaseEmployeeInfo::getUserId, user -> user,
|
||||
(existing, replacement) -> existing));
|
||||
// 根据id转成map
|
||||
Map<String, ConDoctorDO> doctorMap = doctors.stream()
|
||||
.filter(doctor -> doctor != null && StrUtil.isNotBlank(doctor.getId()))
|
||||
.collect(Collectors.toMap(ConDoctorDO::getId, doctor -> doctor,
|
||||
(existing, replacement) -> existing));
|
||||
|
||||
for (ConSession conSessionDO : conSessionDOList) {
|
||||
LoginUser loginUser = sysBaseAPI.getUserById(conSessionDO.getFromAccount());
|
||||
if (loginUser != null) {
|
||||
conSessionDO.setToAccountName(loginUser.getRealname());
|
||||
conSessionDO.setToAccountHead(loginUser.getAvatar());
|
||||
String gen = dictUtil.queryDictItemListByCodeAndType("sex2", String.valueOf(loginUser.getSex()));
|
||||
conSessionDO.setMemberSex(gen);
|
||||
}
|
||||
|
||||
if (StrUtil.equals(conSessionDO.getSessionType(), "1")) {
|
||||
CompletableFuture<LoginUser> future = CompletableFuture.supplyAsync(() -> sysBaseAPI.getUserById(conSessionDO.getToAccount()));
|
||||
LoginUser toLoginUser = future.join();
|
||||
if(toLoginUser != null){
|
||||
conSessionDO.setFromAccountName(toLoginUser.getRealname());
|
||||
for (ConSession conSessionDO : conSessionDOList) {
|
||||
// 根据原接口取值默认fromAccount
|
||||
BaseEmployeeInfo user = userMap.get(conSessionDO.getFromAccount());
|
||||
if (null != user) {
|
||||
conSessionDO.setToAccountName(user.getRealName());
|
||||
conSessionDO.setToAccountHead(user.getAvatar());
|
||||
conSessionDO.setOrgCode(user.getSecondDeptName() + "-" + user.getThirdDeptName());
|
||||
if (null != user.getSex()){
|
||||
DictModel dictModel = sexMap.get(user.getSex().toString());
|
||||
if (null != dictModel) {
|
||||
conSessionDO.setMemberSex(dictModel.getText());
|
||||
}
|
||||
}
|
||||
}
|
||||
ConDoctorDO conDoctorDO = conDoctorMapper.selectDoctorInfoById(conSessionDO.getToAccount());
|
||||
conSessionDO.setDoctorInfo(conDoctorDO);
|
||||
}
|
||||
if (StrUtil.equals(conSessionDO.getSessionType(), "3")) {
|
||||
CompletableFuture<LoginUser> future = CompletableFuture.supplyAsync(() -> sysBaseAPI.getUserById(conSessionDO.getFromAccount()));
|
||||
LoginUser toLoginUser = future.join();
|
||||
if (toLoginUser != null) {
|
||||
conSessionDO.setFromAccountName(toLoginUser.getRealname());
|
||||
}
|
||||
ConDoctorDO conDoctorDO = conDoctorMapper.selectDoctorInfoById(conSessionDO.getFromAccount());
|
||||
conSessionDO.setDoctorInfo(conDoctorDO);
|
||||
}
|
||||
SysDepart secondDepartOrgCode = sysCache.getDepartByOrgCode(GlobalUtils.getSecondDepartOrgCode(conSessionDO.getOrgCode()));
|
||||
SysDepart thridDepartOrgCode = sysCache.getDepartByOrgCode(GlobalUtils.getThirdDepartOrgCode(conSessionDO.getOrgCode()));
|
||||
|
||||
if (secondDepartOrgCode != null && thridDepartOrgCode != null) {
|
||||
conSessionDO.setOrgCode(secondDepartOrgCode.getDepartName() + "-" + thridDepartOrgCode.getDepartName());
|
||||
if (StrUtil.equals(conSessionDO.getSessionType(), "1")) {
|
||||
BaseEmployeeInfo toUser = userMap.get(conSessionDO.getToAccount());
|
||||
if (toUser != null) {
|
||||
conSessionDO.setFromAccountName(toUser.getRealName());
|
||||
}
|
||||
ConDoctorDO conDoctorDO = doctorMap.get(conSessionDO.getToAccount());
|
||||
conSessionDO.setDoctorInfo(conDoctorDO);
|
||||
}
|
||||
|
||||
if (StrUtil.equals(conSessionDO.getSessionType(), "3")) {
|
||||
BaseEmployeeInfo formUser = userMap.get(conSessionDO.getFromAccount());
|
||||
if (formUser != null) {
|
||||
conSessionDO.setFromAccountName(formUser.getRealName());
|
||||
}
|
||||
ConDoctorDO conDoctorDO = doctorMap.get(conSessionDO.getFromAccount());
|
||||
conSessionDO.setDoctorInfo(conDoctorDO);
|
||||
}
|
||||
}
|
||||
}
|
||||
return conSessionDOList;
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public List<ConSession> companySessionList(ListImIds list) {
|
||||
// if (ObjectUtil.isNull(list) || CollectionUtil.isEmpty(list.getImIds())) {
|
||||
// return Collections.emptyList();
|
||||
// }
|
||||
// String imIds = String.join(",", list.getImIds());
|
||||
// List<ConSession> conSessionDOList = conSessionMapper.companySessionList(imIds);
|
||||
//
|
||||
// for (ConSession conSessionDO : conSessionDOList) {
|
||||
// LoginUser loginUser = sysBaseAPI.getUserById(conSessionDO.getFromAccount());
|
||||
// if (loginUser != null) {
|
||||
// conSessionDO.setToAccountName(loginUser.getRealname());
|
||||
// conSessionDO.setToAccountHead(loginUser.getAvatar());
|
||||
// String gen = dictUtil.queryDictItemListByCodeAndType("sex2", String.valueOf(loginUser.getSex()));
|
||||
// conSessionDO.setMemberSex(gen);
|
||||
// }
|
||||
//
|
||||
// if (StrUtil.equals(conSessionDO.getSessionType(), "1")) {
|
||||
// CompletableFuture<LoginUser> future = CompletableFuture.supplyAsync(() -> sysBaseAPI.getUserById(conSessionDO.getToAccount()));
|
||||
// LoginUser toLoginUser = future.join();
|
||||
// if(toLoginUser != null){
|
||||
// conSessionDO.setFromAccountName(toLoginUser.getRealname());
|
||||
// }
|
||||
// ConDoctorDO conDoctorDO = conDoctorMapper.selectDoctorInfoById(conSessionDO.getToAccount());
|
||||
// conSessionDO.setDoctorInfo(conDoctorDO);
|
||||
// }
|
||||
// if (StrUtil.equals(conSessionDO.getSessionType(), "3")) {
|
||||
// CompletableFuture<LoginUser> future = CompletableFuture.supplyAsync(() -> sysBaseAPI.getUserById(conSessionDO.getFromAccount()));
|
||||
// LoginUser toLoginUser = future.join();
|
||||
// if (toLoginUser != null) {
|
||||
// conSessionDO.setFromAccountName(toLoginUser.getRealname());
|
||||
// }
|
||||
// ConDoctorDO conDoctorDO = conDoctorMapper.selectDoctorInfoById(conSessionDO.getFromAccount());
|
||||
// conSessionDO.setDoctorInfo(conDoctorDO);
|
||||
// }
|
||||
// SysDepart secondDepartOrgCode = sysCache.getDepartByOrgCode(GlobalUtils.getSecondDepartOrgCode(conSessionDO.getOrgCode()));
|
||||
// SysDepart thridDepartOrgCode = sysCache.getDepartByOrgCode(GlobalUtils.getThirdDepartOrgCode(conSessionDO.getOrgCode()));
|
||||
//
|
||||
// if (secondDepartOrgCode != null && thridDepartOrgCode != null) {
|
||||
// conSessionDO.setOrgCode(secondDepartOrgCode.getDepartName() + "-" + thridDepartOrgCode.getDepartName());
|
||||
// }
|
||||
// }
|
||||
// return conSessionDOList;
|
||||
// }
|
||||
|
||||
@Override
|
||||
public List<ConSession> professorSessionList(ListImIds list) {
|
||||
if (ObjectUtil.isNull(list) || CollectionUtil.isEmpty(list.getImIds())) {
|
||||
|
||||
Reference in New Issue
Block a user