优化小助手端咨询列表接口
This commit is contained in:
+3
@@ -12,6 +12,7 @@ import org.apache.ibatis.annotations.Update;
|
|||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Description: con_doctor
|
* @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}")
|
@Select("SELECT * FROM con_doctor WHERE status = '1' and del_flag = '0' and id = #{doctorId}")
|
||||||
public ConDoctorDO selectDoctorInfoById(String 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'")
|
@Select("SELECT * FROM con_doctor WHERE status = '1' and del_flag = '0' and id = #{doctorId} and is_accept = '1'")
|
||||||
public ConDoctorDO selectDoctorInfoByIdNew(String doctorId);
|
public ConDoctorDO selectDoctorInfoByIdNew(String doctorId);
|
||||||
|
|
||||||
|
|||||||
+14
@@ -532,4 +532,18 @@
|
|||||||
and id != #{doctorId}
|
and id != #{doctorId}
|
||||||
</if>
|
</if>
|
||||||
</select>
|
</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>
|
</mapper>
|
||||||
|
|||||||
+99
-30
@@ -28,6 +28,7 @@ import com.renkang.im.entity.ImGroupMsgTextReqDO;
|
|||||||
import org.apache.poi.ss.usermodel.Workbook;
|
import org.apache.poi.ss.usermodel.Workbook;
|
||||||
import org.apache.shiro.SecurityUtils;
|
import org.apache.shiro.SecurityUtils;
|
||||||
import org.jeecg.bean.request.ListUser;
|
import org.jeecg.bean.request.ListUser;
|
||||||
|
import org.jeecg.bean.response.BaseEmployeeInfo;
|
||||||
import org.jeecg.common.api.vo.Result;
|
import org.jeecg.common.api.vo.Result;
|
||||||
import org.jeecg.common.constant.CommonConstant;
|
import org.jeecg.common.constant.CommonConstant;
|
||||||
import org.jeecg.common.system.api.ISysBaseAPI;
|
import org.jeecg.common.system.api.ISysBaseAPI;
|
||||||
@@ -767,44 +768,112 @@ public class ConSessionServiceImpl extends ServiceImpl<ConSessionMapper, ConSess
|
|||||||
}
|
}
|
||||||
String imIds = String.join(",", list.getImIds());
|
String imIds = String.join(",", list.getImIds());
|
||||||
List<ConSession> conSessionDOList = conSessionMapper.companySessionList(imIds);
|
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) {
|
for (ConSession conSessionDO : conSessionDOList) {
|
||||||
LoginUser loginUser = sysBaseAPI.getUserById(conSessionDO.getFromAccount());
|
// 根据原接口取值默认fromAccount
|
||||||
if (loginUser != null) {
|
BaseEmployeeInfo user = userMap.get(conSessionDO.getFromAccount());
|
||||||
conSessionDO.setToAccountName(loginUser.getRealname());
|
if (null != user) {
|
||||||
conSessionDO.setToAccountHead(loginUser.getAvatar());
|
conSessionDO.setToAccountName(user.getRealName());
|
||||||
String gen = dictUtil.queryDictItemListByCodeAndType("sex2", String.valueOf(loginUser.getSex()));
|
conSessionDO.setToAccountHead(user.getAvatar());
|
||||||
conSessionDO.setMemberSex(gen);
|
conSessionDO.setOrgCode(user.getSecondDeptName() + "-" + user.getThirdDeptName());
|
||||||
}
|
if (null != user.getSex()){
|
||||||
|
DictModel dictModel = sexMap.get(user.getSex().toString());
|
||||||
if (StrUtil.equals(conSessionDO.getSessionType(), "1")) {
|
if (null != dictModel) {
|
||||||
CompletableFuture<LoginUser> future = CompletableFuture.supplyAsync(() -> sysBaseAPI.getUserById(conSessionDO.getToAccount()));
|
conSessionDO.setMemberSex(dictModel.getText());
|
||||||
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) {
|
if (StrUtil.equals(conSessionDO.getSessionType(), "1")) {
|
||||||
conSessionDO.setOrgCode(secondDepartOrgCode.getDepartName() + "-" + thridDepartOrgCode.getDepartName());
|
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;
|
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
|
@Override
|
||||||
public List<ConSession> professorSessionList(ListImIds list) {
|
public List<ConSession> professorSessionList(ListImIds list) {
|
||||||
if (ObjectUtil.isNull(list) || CollectionUtil.isEmpty(list.getImIds())) {
|
if (ObjectUtil.isNull(list) || CollectionUtil.isEmpty(list.getImIds())) {
|
||||||
|
|||||||
Reference in New Issue
Block a user