刘韬 преди 5 години
родител
ревизия
f4c9a62895

+ 14 - 14
PacsOnline_Wechat_Doctor/src/main/java/com/zskk/controller/WxaUserApiController.java

@@ -80,20 +80,20 @@ public class WxaUserApiController extends WxaController {
 		accessTokenCache.set("wxa:session:" + sessionId, apiResult.getJson());
 		LoginBean loginBean = new LoginBean();
 		loginBean.setSessionId(sessionId);
-//		if (!doctorsWechatfind.getDoctorId().isBlank()) {
-//			Doctors doctors = Doctors.dao.findById(doctorsWechatfind.getDoctorId());
-//			doctors.setPassword("");
-//			DoctorBean doctorBean = JSON.parseObject(doctors.toJson(), DoctorBean.class);
-//			Institution institution = Institution.dao.findById(doctorBean.getInstitution_id());
-//			doctorBean.setInstitution(institution.getName());
-//			StringBuilder sb = new StringBuilder(doctorBean.getPhone());
-//			sb.replace(3, 7, "****");
-//			doctorBean.setPhone(sb.toString());
-//			String tokenKey = "TOKEN_WXA_" + StrKit.getRandomUUID();
-//			Redis.use("pc").setex("think" + tokenKey, 7200, doctors.toJson());
-//			loginBean.setDoctorBean(doctorBean);
-//			loginBean.setToken(tokenKey);
-//		}
+		if (doctorsWechatfind.getDoctorId() != null) {
+			Doctors doctors = Doctors.dao.findById(doctorsWechatfind.getDoctorId());
+			doctors.setPassword("");
+			DoctorBean doctorBean = JSON.parseObject(doctors.toJson(), DoctorBean.class);
+			Institution institution = Institution.dao.findById(doctorBean.getInstitution_id());
+			doctorBean.setInstitution(institution.getName());
+			StringBuilder sb = new StringBuilder(doctorBean.getPhone());
+			sb.replace(3, 7, "****");
+			doctorBean.setPhone(sb.toString());
+			String tokenKey = "TOKEN_WXA_" + StrKit.getRandomUUID();
+			Redis.use("pc").setex("think" + tokenKey, 7200, doctors.toJson());
+			loginBean.setDoctorBean(doctorBean);
+			loginBean.setToken(tokenKey);
+		}
 		renderJson(new ResultBean(loginBean));
 	}
 

+ 31 - 1
PacsOnline_Wechat_Doctor/src/main/java/com/zskk/service/SmsService.java

@@ -1,5 +1,6 @@
 package com.zskk.service;
 
+import java.util.Date;
 import java.util.Random;
 
 import com.alibaba.fastjson.JSON;
@@ -114,5 +115,34 @@ public class SmsService {
         sb.append(strNum);   
         return sb.toString();
 	}
-	
+	public static void main(String[] args) {
+		DoctorsWechat doctorsWechat = new DoctorsWechat();
+		doctorsWechat.setWxaOpenid("d");
+		
+		doctorsWechat.setCreateAt(new Date());
+		doctorsWechat.setUpdateAt(new Date());
+//		doctorsWechat.save();
+		doctorsWechat.getDoctorId();
+		System.out.println(doctorsWechat.getDoctorId()==null?"2":"1");
+		String doctirIdStr = doctorsWechat.getDoctorId();
+
+		if (doctorsWechat.getDoctorId() != null) {
+			
+			System.out.println(doctorsWechat.getDoctorId()==null?"3":"1");
+
+//			Doctors doctors = Doctors.dao.findById(doctorsWechatfind.getDoctorId());
+//			doctors.setPassword("");
+//			DoctorBean doctorBean = JSON.parseObject(doctors.toJson(), DoctorBean.class);
+//			Institution institution = Institution.dao.findById(doctorBean.getInstitution_id());
+//			doctorBean.setInstitution(institution.getName());
+//			StringBuilder sb = new StringBuilder(doctorBean.getPhone());
+//			sb.replace(3, 7, "****");
+//			doctorBean.setPhone(sb.toString());
+//			String tokenKey = "TOKEN_WXA_" + StrKit.getRandomUUID();
+//			Redis.use("pc").setex("think" + tokenKey, 7200, doctors.toJson());
+//			loginBean.setDoctorBean(doctorBean);
+//			loginBean.setToken(tokenKey);
+		}
+		
+	}
 }