Commit 764c84f446804dded0abf4587c693ef905835718
1 parent
de8fd3d7e2
Exists in
master
and in
1 other branch
update
Showing 2 changed files with 18 additions and 11 deletions
talkonlineweb/src/main/java/com/lyms/talkonlineweb/domain/LymsPatient.java
View file @
764c84f
talkonlineweb/src/main/java/com/lyms/talkonlineweb/task/PushArticleTask.java
View file @
764c84f
| ... | ... | @@ -39,7 +39,7 @@ |
| 39 | 39 | @Autowired |
| 40 | 40 | private LymsDictService lymsDictService; |
| 41 | 41 | |
| 42 | - final String gzopenid ="oQEmP6rFmf0lOb--mUf4_MAZPXEQ";//测试:公众号关注的微信openId | |
| 42 | +// final String gzopenid ="oQEmP6rFmf0lOb--mUf4_MAZPXEQ";//测试:公众号关注的微信openId | |
| 43 | 43 | final String template_id ="ZDxcRDJ3okC9Lbzpfhr_v4e8W1VWrho-f5uHW_VZHTg";//公众号模板:诊后注意事项id |
| 44 | 44 | |
| 45 | 45 | @Scheduled(cron = "0 0 9 * * ?")//每天上午9点执行文章推送 |
| 46 | 46 | |
| ... | ... | @@ -63,12 +63,17 @@ |
| 63 | 63 | pushedart.setIsread((byte) 0); |
| 64 | 64 | //PushedartId(如果null表示需要推送文章,否则需要推送短消息) |
| 65 | 65 | if(null!=lymsPushMessage.getPushedartId()){ |
| 66 | + if(StringUtil.isEmpty(token)){ | |
| 67 | + log.info("推送短消息1,获取token失败。。。"); | |
| 68 | + continue; | |
| 69 | + } | |
| 70 | + if(StringUtil.isEmpty(lymsPushMessage.getGzopenid())){ | |
| 71 | + log.info(lymsPushMessage.getPname()+":公众号openId为空。。。"); | |
| 72 | + continue; | |
| 73 | + } | |
| 74 | + //LymsPushedart的主键id赋值,表示修改。找到以前的推送记录,修改短文字的推送状态 | |
| 66 | 75 | pushedart.setId(lymsPushMessage.getPushedartId()); |
| 67 | 76 | if(lymsPushMessage.getIsweixinOne()==1){ |
| 68 | - if(StringUtil.isEmpty(token)){ | |
| 69 | - log.info("推送短消息1,获取token失败。。。"); | |
| 70 | - continue; | |
| 71 | - } | |
| 72 | 77 | //推送微信消息1 |
| 73 | 78 | Map<String,Object> map=new HashMap<>(); |
| 74 | 79 | map.put("first",new DataEntity(lymsPushMessage.getWeixTextOne(),"#173177")); |
| ... | ... | @@ -76,7 +81,7 @@ |
| 76 | 81 | map.put("keyword2",new DataEntity(lymsPushMessage.getHname(),"#173177")); |
| 77 | 82 | map.put("keyword3",new DataEntity(lymsPushMessage.getDname(),"#173177")); |
| 78 | 83 | map.put("remark",new DataEntity("预祝您早日康复","#173177")); |
| 79 | - Integer code= WeiXinUtil.SendWeChatMsg(token,gzopenid,template_id,map); | |
| 84 | + Integer code= WeiXinUtil.SendWeChatMsg(token,lymsPushMessage.getGzopenid(),template_id,map); | |
| 80 | 85 | if(null==code||code!=0){ |
| 81 | 86 | log.info("推送短消息1失败。。。"+lymsPushMessage.getPname()+"; code:"+code); |
| 82 | 87 | continue; |
| ... | ... | @@ -84,10 +89,6 @@ |
| 84 | 89 | //成功标记记录1 |
| 85 | 90 | pushedart.setIsweixinone(1);//0未推送1已推送 |
| 86 | 91 | }else if(lymsPushMessage.getIsweixinTwo()==1){ |
| 87 | - if(StringUtil.isEmpty(token)){ | |
| 88 | - log.info("推送短消息2,获取token失败。。。"); | |
| 89 | - continue; | |
| 90 | - } | |
| 91 | 92 | //推送微信消息2 |
| 92 | 93 | Map<String,Object> map=new HashMap<>(); |
| 93 | 94 | map.put("first",new DataEntity(lymsPushMessage.getWeixTextTwo(),"#173177")); |
| ... | ... | @@ -95,7 +96,7 @@ |
| 95 | 96 | map.put("keyword2",new DataEntity(lymsPushMessage.getHname(),"#173177")); |
| 96 | 97 | map.put("keyword3",new DataEntity(lymsPushMessage.getDname(),"#173177")); |
| 97 | 98 | map.put("remark",new DataEntity("预祝您早日康复","#173177")); |
| 98 | - Integer code= WeiXinUtil.SendWeChatMsg(token,gzopenid,template_id,map); | |
| 99 | + Integer code= WeiXinUtil.SendWeChatMsg(token,lymsPushMessage.getGzopenid(),template_id,map); | |
| 99 | 100 | if(null==code||code!=0){ |
| 100 | 101 | log.info("推送短消息2失败。。。"+lymsPushMessage.getPname()+"; code:"+code); |
| 101 | 102 | continue; |