提交 cad555c1 编写于 作者: rushui.chen's avatar rushui.chen

20191112 登录成功后补充缓存信息

上级 66e73f43
流水线 #16951 已失败 于阶段
in 1 second
...@@ -160,6 +160,7 @@ public class AccountServiceImpl implements AccountService { ...@@ -160,6 +160,7 @@ public class AccountServiceImpl implements AccountService {
} }
} }
//更新缓存中hospital_id,hospital信息 //更新缓存中hospital_id,hospital信息
//成功返回0,失败返回1 //成功返回0,失败返回1
private int refresh(Map<String, Object> doctorMap) { private int refresh(Map<String, Object> doctorMap) {
...@@ -167,6 +168,19 @@ public class AccountServiceImpl implements AccountService { ...@@ -167,6 +168,19 @@ public class AccountServiceImpl implements AccountService {
//String hospitalId = doctorMap.get("hospital_id") == null ? StringUtils.EMPTY : doctorMap.get("hospital_id").toString(); //String hospitalId = doctorMap.get("hospital_id") == null ? StringUtils.EMPTY : doctorMap.get("hospital_id").toString();
//String hospital = doctorMap.get("hospital") == null ? StringUtils.EMPTY : doctorMap.get("hospital").toString(); //String hospital = doctorMap.get("hospital") == null ? StringUtils.EMPTY : doctorMap.get("hospital").toString();
String mobile = doctorMap.get("mobile_phone") == null ? StringUtils.EMPTY : doctorMap.get("mobile_phone").toString(); String mobile = doctorMap.get("mobile_phone") == null ? StringUtils.EMPTY : doctorMap.get("mobile_phone").toString();
String status = doctorMap.get("status") == null ? StringUtils.EMPTY : doctorMap.get("status").toString();
String avatar_image_url = doctorMap.get("avatar_image_url") == null ? StringUtils.EMPTY : doctorMap.get("avatar_image_url").toString();
String email = doctorMap.get("email") == null ? StringUtils.EMPTY : doctorMap.get("email").toString();
String province = doctorMap.get("province") == null ? StringUtils.EMPTY : doctorMap.get("province").toString();
String province_name = doctorMap.get("province") == null ? StringUtils.EMPTY : doctorMap.get("province_name").toString();
String city = doctorMap.get("city") == null ? StringUtils.EMPTY : doctorMap.get("city").toString();
String city_name = doctorMap.get("city_name") == null ? StringUtils.EMPTY : doctorMap.get("city_name").toString();
String county = doctorMap.get("county") == null ? StringUtils.EMPTY : doctorMap.get("county").toString();
String county_name = doctorMap.get("county_name") == null ? StringUtils.EMPTY : doctorMap.get("county_name").toString();
String town = doctorMap.get("town") == null ? StringUtils.EMPTY : doctorMap.get("town").toString();
String town_name = doctorMap.get("town_name") == null ? StringUtils.EMPTY : doctorMap.get("town_name").toString();
String title = doctorMap.get("title") == null ? StringUtils.EMPTY : doctorMap.get("title").toString();
String title_id = doctorMap.get("title_id") == null ? StringUtils.EMPTY : doctorMap.get("title_id").toString();
String key = KEY_PREFIX + doctorId; String key = KEY_PREFIX + doctorId;
try { try {
...@@ -176,7 +190,20 @@ public class AccountServiceImpl implements AccountService { ...@@ -176,7 +190,20 @@ public class AccountServiceImpl implements AccountService {
} }
//cacheClient.hset(key, "hospital_id", StringUtils.isEmpty(hospitalId) ? "0" : hospitalId); //cacheClient.hset(key, "hospital_id", StringUtils.isEmpty(hospitalId) ? "0" : hospitalId);
//cacheClient.hset(key, "hospital", hospital); //cacheClient.hset(key, "hospital", hospital);
cacheClient.hset(key, "province_name", province_name);
cacheClient.hset(key, "city_name", city_name);
cacheClient.hset(key, "county_name", county_name);
cacheClient.hset(key, "town_name", town_name);
cacheClient.hset(key, "province_id", province);
cacheClient.hset(key, "city_id", city);
cacheClient.hset(key, "county_id", county);
cacheClient.hset(key, "town_id", town);
cacheClient.hset(key, "mobile", mobile); cacheClient.hset(key, "mobile", mobile);
cacheClient.hset(key, "status", status);
cacheClient.hset(key, "avatar_image_url", avatar_image_url);
cacheClient.hset(key, "email", email);
cacheClient.hset(key, "title_id", title_id);
cacheClient.hset(key, "title", title);
return 0; return 0;
} catch (Exception ex) { } catch (Exception ex) {
return 1; return 1;
......
package com.pica.cloud.account.account.server.util; package com.pica.cloud.account.account.server.util;
import com.pica.cloud.account.account.server.entity.Account; import com.pica.cloud.account.account.server.entity.Account;
import com.pica.cloud.account.account.server.entity.Doctor;
import com.pica.cloud.account.account.server.mapper.DoctorMapper;
import com.pica.cloud.foundation.redis.ICacheClient; import com.pica.cloud.foundation.redis.ICacheClient;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
...@@ -27,6 +29,8 @@ public class TokenUtils { ...@@ -27,6 +29,8 @@ public class TokenUtils {
@Qualifier("cacheMigrateClient") @Qualifier("cacheMigrateClient")
private ICacheClient cacheClient; private ICacheClient cacheClient;
@Autowired
private DoctorMapper doctorMapper;
/** /**
* 校验token的状态 * 校验token的状态
...@@ -70,10 +74,32 @@ public class TokenUtils { ...@@ -70,10 +74,32 @@ public class TokenUtils {
data.put("token", newToken); data.put("token", newToken);
data.put("id", account.getId() + ""); data.put("id", account.getId() + "");
data.put("acctId", account.getAcctId() + ""); data.put("acctId", account.getAcctId() + "");
data.put("mobile", account.getMobilePhone()); if (!StringUtils.isBlank(account.getMobilePhone())) {
data.put("mobile", AESUtil.encryptV0(account.getMobilePhone()));
} else {
data.put("mobile", "");
}
data.put("name", account.getMobilePhone().replaceAll("(\\d{3})\\d{4}(\\w{4})", "$1****$2")); data.put("name", account.getMobilePhone().replaceAll("(\\d{3})\\d{4}(\\w{4})", "$1****$2"));
data.put("created_time", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(account.getCreatTime())); data.put("created_time", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(account.getCreatTime()));
data.put("sysCode", sourceType); data.put("sysCode", sourceType);
if (account.getId()!=null){
Doctor doctor = doctorMapper.selectByPrimaryKey(account.getId().intValue());
data.put("town", doctor.getTown() + "");
data.put("town_name", doctor.getTownName()+"");
data.put("county", doctor.getCounty() + "");
data.put("county_name", doctor.getCountyName()+"");
data.put("city", doctor.getCity() + "");
data.put("city_name", doctor.getCityName()+"");
data.put("province", doctor.getProvince() + "");
data.put("province_name", doctor.getProvinceName() + "");
data.put("hospital", doctor.getHospital()+"");
data.put("hospital_id", doctor.getHospitalId() + "");
data.put("department", doctor.getDepartment()+"");
data.put("department_id", doctor.getDepartmentId() + "");
data.put("title", doctor.getTitle()+"");
data.put("title_id", doctor.getTitleId() + "");
data.put("status", doctor.getStatus() + "");
}
Iterator<Map.Entry<String, String>> iterator = data.entrySet().iterator(); Iterator<Map.Entry<String, String>> iterator = data.entrySet().iterator();
while (iterator.hasNext()) { while (iterator.hasNext()) {
Map.Entry<String, String> map = iterator.next(); Map.Entry<String, String> map = iterator.next();
......
...@@ -308,7 +308,10 @@ ...@@ -308,7 +308,10 @@
</select> </select>
<select id="getHospitalInfoByPage" resultType="map"> <select id="getHospitalInfoByPage" resultType="map">
select id, hospital_id, hospital, mobile_phone select id, hospital_id, hospital,mobile_phone,
status, avatar_image_url, email,
province, province_name,city, city_name, county, county_name,town, town_name,
title,title_id
from p_doctor from p_doctor
where delete_flag = 1 where delete_flag = 1
<if test="id != null"> <if test="id != null">
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册