刘韬 5 years ago
parent
commit
b8d7fcf0fd

+ 18 - 9
PacsOnline_Wechat_Patient/src/main/java/com/zskk/controller/WeixinMsgController.java

@@ -120,13 +120,15 @@ public class WeixinMsgController extends MsgControllerAdapter {
 					inFollowEvent.getFromUserName());
 			if (findUser == null) {
 				UserService aService = ServiceFactory.getService(UserService.class);
-				UserWechat users = aService.createWxUserByGH(inFollowEvent.getFromUserName(), inFollowEvent.getToUserName());
+				UserWechat users = aService.createWxUserByGH(inFollowEvent.getFromUserName(),
+						inFollowEvent.getToUserName());
 
 				List<Articles> list = new ArrayList<Articles>();
 				Articles articles1 = new Articles();
 				articles1.setTitle("欢迎关注中世康恺电子胶片平台,点此进入");
 				articles1.setDescription("点击页面绑定手机号或检查信息,立即查看电子胶片");
-				articles1.setUrl("https://wechatclient3.pacsonline.cn/#/bind?openid=" + inFollowEvent.getFromUserName());
+				articles1
+						.setUrl("https://wechatclient3.pacsonline.cn/#/bind?openid=" + inFollowEvent.getFromUserName());
 				articles1.setPicurl("http://work.pacsonline.cn/static/img/banner.e8ee043.png");
 				list.add(articles1);
 				CustomServiceApi.sendNews(inFollowEvent.getFromUserName(), list);
@@ -157,6 +159,11 @@ public class WeixinMsgController extends MsgControllerAdapter {
 			String rid = inQrCodeEvent.getEventKey();
 			String[] arr = rid.split("_");
 			if (arr[2].equals("DEMOCT")) {
+				if (findUser == null) {
+					UserService uService = ServiceFactory.getService(UserService.class);
+					UserWechat users = uService.createWxUserByGH(inQrCodeEvent.getFromUserName(),
+							inQrCodeEvent.getToUserName());
+				}
 				CustomServiceApi.sendText(inQrCodeEvent.getFromUserName(),
 						"【声明】为保证客户数据隐私安全,电子胶片示例涉及检查信息、用户信息、医疗机构信息等均已经过数据脱敏处理。\n通过以下途径了解更多或联系我们:\n官方网站:<a href=\"http://www.pacsonline.cn\">点击进入</a>\n咨询热线:010-53932350\n电子邮箱:company@pacsonline.cn\n您即将收到数字影像示例,请点击下方消息查看,谢谢您的使用!");
 
@@ -174,7 +181,7 @@ public class WeixinMsgController extends MsgControllerAdapter {
 				CustomServiceApi.sendNews(inQrCodeEvent.getFromUserName(), list);
 				return;
 			}
-			CustomServiceApi.sendText(inQrCodeEvent.getFromUserName(),"t");
+			CustomServiceApi.sendText(inQrCodeEvent.getFromUserName(), "t");
 
 			Exams exams = Exams.dao.findById(arr[2]);
 			if (exams == null) {
@@ -185,9 +192,10 @@ public class WeixinMsgController extends MsgControllerAdapter {
 					inQrCodeEvent.getFromUserName(), exams.getId(), exams.getStudyId());
 			if (findUser == null) {
 				UserService uService = ServiceFactory.getService(UserService.class);
-				UserWechat users = uService.createWxUserByGH(inQrCodeEvent.getFromUserName(), inQrCodeEvent.getToUserName());
-				WechatBind userBind = WechatBind.dao.findFirst("select * from wechat_bind where user_id=? and exam_id=?",
-						users.getId(), exams.getId());
+				UserWechat users = uService.createWxUserByGH(inQrCodeEvent.getFromUserName(),
+						inQrCodeEvent.getToUserName());
+				WechatBind userBind = WechatBind.dao.findFirst(
+						"select * from wechat_bind where user_id=? and exam_id=?", users.getId(), exams.getId());
 				if (userBind == null) {
 					uService.bindUserReport(users.getId(), exams);
 				}
@@ -215,8 +223,8 @@ public class WeixinMsgController extends MsgControllerAdapter {
 				findUser.setSubscribeStatus(2);
 				findUser.update();
 
-				WechatBind userBind = WechatBind.dao.findFirst("select * from wechat_bind where user_id=? and exam_id=?",
-						findUser.getId(), exams.getId());
+				WechatBind userBind = WechatBind.dao.findFirst(
+						"select * from wechat_bind where user_id=? and exam_id=?", findUser.getId(), exams.getId());
 				if (userBind == null) {
 					uService.bindUserReport(findUser.getId(), exams);
 				}
@@ -258,7 +266,8 @@ public class WeixinMsgController extends MsgControllerAdapter {
 
 			}
 
-			UserWechat user = UserWechat.dao.findFirst("select * from user_wechat where wx_openid = ?", inQrCodeEvent.getFromUserName());
+			UserWechat user = UserWechat.dao.findFirst("select * from user_wechat where wx_openid = ?",
+					inQrCodeEvent.getFromUserName());
 
 			UserService uService = ServiceFactory.getService(UserService.class);