|
@@ -113,8 +113,8 @@ public class WeixinMsgController extends MsgControllerAdapter {
|
|
|
if (InFollowEvent.EVENT_INFOLLOW_SUBSCRIBE.equals(inFollowEvent.getEvent()))
|
|
|
{
|
|
|
log.debug("关注:" + inFollowEvent.getFromUserName());
|
|
|
- User findUserWechats = User.dao.findFirst("select * from user where wx_openid = ?",inFollowEvent.getFromUserName());
|
|
|
- if (findUserWechats == null) {
|
|
|
+ User findUser = User.dao.findFirst("select * from user where wx_openid = ?",inFollowEvent.getFromUserName());
|
|
|
+ if (findUser == null) {
|
|
|
UserService aService = ServiceFactory.getService(UserService.class);
|
|
|
User users = aService.createWxUserByGH(inFollowEvent.getFromUserName(), inFollowEvent.getToUserName());
|
|
|
|
|
@@ -127,8 +127,8 @@ public class WeixinMsgController extends MsgControllerAdapter {
|
|
|
list.add(articles1);
|
|
|
CustomServiceApi.sendNews(inFollowEvent.getFromUserName(), list);
|
|
|
}else {
|
|
|
- findUserWechats.setSubscribeStatus(2);
|
|
|
- findUserWechats.update();
|
|
|
+ findUser.setSubscribeStatus(2);
|
|
|
+ findUser.update();
|
|
|
OutTextMsg outMsgs = new OutTextMsg(inFollowEvent);
|
|
|
outMsgs.setContent("欢迎关注中世康恺电子胶片平台!\n使用微信或者本公众号内的\"扫一扫\",扫描报告上的二维码,即可查看电子影像和报告");
|
|
|
render(outMsgs);
|
|
@@ -138,9 +138,9 @@ public class WeixinMsgController extends MsgControllerAdapter {
|
|
|
if (InFollowEvent.EVENT_INFOLLOW_UNSUBSCRIBE.equals(inFollowEvent.getEvent()))
|
|
|
{
|
|
|
log.debug("取消关注:" + inFollowEvent.getFromUserName());
|
|
|
- User findUserWechats = User.dao.findFirst("select * from user where wx_openid = ?",inFollowEvent.getFromUserName());
|
|
|
- findUserWechats.setSubscribeStatus(1);
|
|
|
- findUserWechats.update();
|
|
|
+ User findUser = User.dao.findFirst("select * from user where wx_openid = ?",inFollowEvent.getFromUserName());
|
|
|
+ findUser.setSubscribeStatus(1);
|
|
|
+ findUser.update();
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -150,7 +150,7 @@ public class WeixinMsgController extends MsgControllerAdapter {
|
|
|
if (InQrCodeEvent.EVENT_INQRCODE_SUBSCRIBE.equals(inQrCodeEvent.getEvent()))
|
|
|
{
|
|
|
log.debug("扫码未关注:" + inQrCodeEvent.getFromUserName());
|
|
|
- User findUserWechats = User.dao.findFirst("select * from user where wx_openid = ?",inQrCodeEvent.getFromUserName());
|
|
|
+ User findUser = User.dao.findFirst("select * from user where wx_openid = ?",inQrCodeEvent.getFromUserName());
|
|
|
String rid = inQrCodeEvent.getEventKey();
|
|
|
String[] arr = rid.split("_");
|
|
|
Exams exams = Exams.dao.findById(arr[2]);
|
|
@@ -158,12 +158,12 @@ public class WeixinMsgController extends MsgControllerAdapter {
|
|
|
renderNull();
|
|
|
}
|
|
|
String toUrlString = String.format("http://wechat.client.pacsonline.cn/#/reportInfo/report?openid=%s&exam_id=%s&study_id=%s",inQrCodeEvent.getFromUserName(),exams.getId(),exams.getStudyId());
|
|
|
- if (findUserWechats == null) {
|
|
|
- UserService aService = ServiceFactory.getService(UserService.class);
|
|
|
- User users = aService.createWxUserByGH(inQrCodeEvent.getFromUserName(), inQrCodeEvent.getToUserName());
|
|
|
+ if (findUser == null) {
|
|
|
+ UserService uService = ServiceFactory.getService(UserService.class);
|
|
|
+ User users = uService.createWxUserByGH(inQrCodeEvent.getFromUserName(), inQrCodeEvent.getToUserName());
|
|
|
UserBind userBind = UserBind.dao.findFirst("select * from user_bind where user_id=? and exam_id=?",users.getId(),exams.getId());
|
|
|
if (userBind == null) {
|
|
|
- aService.bindUserReport(users.getId(), exams);
|
|
|
+ uService.bindUserReport(users.getId(), exams);
|
|
|
}
|
|
|
|
|
|
List<Articles> listgz = new ArrayList<Articles>();
|
|
@@ -185,14 +185,14 @@ public class WeixinMsgController extends MsgControllerAdapter {
|
|
|
CustomServiceApi.sendNews(inQrCodeEvent.getFromUserName(), list);
|
|
|
renderNull();
|
|
|
}else {
|
|
|
- UserService aService = ServiceFactory.getService(UserService.class);
|
|
|
+ UserService uService = ServiceFactory.getService(UserService.class);
|
|
|
|
|
|
- findUserWechats.setSubscribeStatus(2);
|
|
|
- findUserWechats.update();
|
|
|
+ findUser.setSubscribeStatus(2);
|
|
|
+ findUser.update();
|
|
|
|
|
|
- UserBind userBind = UserBind.dao.findFirst("select * from user_bind where user_id=? and exam_id=?",findUserWechats.getId(),exams.getId());
|
|
|
+ UserBind userBind = UserBind.dao.findFirst("select * from user_bind where user_id=? and exam_id=?",findUser.getId(),exams.getId());
|
|
|
if (userBind == null) {
|
|
|
- aService.bindUserReport(findUserWechats.getId(), exams);
|
|
|
+ uService.bindUserReport(findUser.getId(), exams);
|
|
|
}
|
|
|
CustomServiceApi.sendText(inQrCodeEvent.getFromUserName(), "欢迎关注中世康恺电子胶片平台!\n使用微信-\"扫一扫\",扫描报告上的二维码,即可查看电子影像和报告");
|
|
|
|
|
@@ -213,20 +213,20 @@ public class WeixinMsgController extends MsgControllerAdapter {
|
|
|
log.debug("扫码已关注:" + inQrCodeEvent.getFromUserName());
|
|
|
String rid = inQrCodeEvent.getEventKey();
|
|
|
String[] arr = rid.split("_");
|
|
|
- User userWechats = User.dao.findFirst("select * from user where wx_openid = ?",inQrCodeEvent.getFromUserName());
|
|
|
+ User user = User.dao.findFirst("select * from user where wx_openid = ?",inQrCodeEvent.getFromUserName());
|
|
|
|
|
|
UserService uService = ServiceFactory.getService(UserService.class);
|
|
|
|
|
|
- if (userWechats == null) {
|
|
|
- userWechats = uService.createWxUserByGH(inQrCodeEvent.getFromUserName(), inQrCodeEvent.getToUserName());
|
|
|
+ if (user == null) {
|
|
|
+ user = uService.createWxUserByGH(inQrCodeEvent.getFromUserName(), inQrCodeEvent.getToUserName());
|
|
|
}
|
|
|
|
|
|
Exams exams = Exams.dao.findById(arr[1]);
|
|
|
|
|
|
- UserBind userBind = UserBind.dao.findFirst("select * from user_bind where user_id=? and exam_id=?",userWechats.getId(),exams.getId());
|
|
|
+ UserBind userBind = UserBind.dao.findFirst("select * from user_bind where user_id=? and exam_id=?",user.getId(),exams.getId());
|
|
|
|
|
|
if (userBind == null) {
|
|
|
- uService.bindUserReport(userWechats.getId(), exams);
|
|
|
+ uService.bindUserReport(user.getId(), exams);
|
|
|
}
|
|
|
|
|
|
String toUrlString = String.format("http://wechat.client.pacsonline.cn/#/reportInfo/report?openid=%s&exam_id=%s&study_id=%s",inQrCodeEvent.getFromUserName(),exams.getId(),exams.getStudyId());
|