提交 e8b4f915 编写于 作者:  Peijun.zhao's avatar Peijun.zhao

add inner org docids,add cache

上级 b636783d
流水线 #32010 已失败 于阶段
in 0 second
package com.pica.cloud.account.account.server.service.impl;
import com.alibaba.fastjson.JSONObject;
import com.google.gson.JsonObject;
import com.pica.cloud.account.account.server.constants.Constants;
import com.pica.cloud.account.account.server.entity.AccountInfoEntity;
import com.pica.cloud.account.account.server.entity.Doctor;
......@@ -15,18 +14,15 @@ import com.pica.cloud.account.account.server.util.AccountUtils;
import com.pica.cloud.foundation.encryption.common.constants.EncryptConstants;
import com.pica.cloud.foundation.encryption.util.EncryptUtils;
import com.pica.cloud.foundation.redis.ICacheClient;
import com.pica.cloud.foundation.utils.entity.PicaDoctor;
import com.pica.cloud.foundation.utils.utils.StringUtil;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
......@@ -214,7 +210,21 @@ public class DoctorServiceImpl implements DoctorService {
@Override
public List<Integer> getDoctorsByInnerOrg() {
List<Integer> dbIds = doctorMapper.getDoctorsByInnerOrg(null);
return dbIds;
String ids = cacheClient.get(Constants.INNER_ORG_IDS);
if(StringUtil.isEmpty(ids)){
List<Integer> dbIds = doctorMapper.getDoctorsByInnerOrg(null);
String arrStr = "";
for(Integer i : dbIds){
arrStr = arrStr + i + ",";
}
cacheClient.setex(Constants.INNER_ORG_IDS,arrStr,3600);
return dbIds;
}else {
List<Integer> rtnIds = Arrays.asList(ids.split(",")).stream().filter(s -> !"".equals(s)).map(s -> Integer.parseInt(s)).collect(Collectors.toList());
return rtnIds;
}
}
}
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册