|
@ -86,7 +86,10 @@ import com.yihu.jw.util.wechat.WeixinMessagePushUtils;
|
|
import com.yihu.jw.utils.*;
|
|
import com.yihu.jw.utils.*;
|
|
import com.yihu.jw.utils.Pkis.PKIService_PortType;
|
|
import com.yihu.jw.utils.Pkis.PKIService_PortType;
|
|
import com.yihu.jw.utils.Pkis.PKIService_ServiceLocator;
|
|
import com.yihu.jw.utils.Pkis.PKIService_ServiceLocator;
|
|
|
|
import com.yihu.jw.utils.encode.*;
|
|
|
|
import com.yihu.jw.utils.encode.Base64;
|
|
import com.yihu.jw.utils.hibernate.HibenateUtils;
|
|
import com.yihu.jw.utils.hibernate.HibenateUtils;
|
|
|
|
import com.yihu.jw.utils.sfutils.HttpClientUtils;
|
|
import com.yihu.jw.wechat.dao.BasePatientWechatDao;
|
|
import com.yihu.jw.wechat.dao.BasePatientWechatDao;
|
|
import com.yihu.jw.wechat.dao.WechatDao;
|
|
import com.yihu.jw.wechat.dao.WechatDao;
|
|
import com.yihu.jw.wechat.dao.WxPushLogDao;
|
|
import com.yihu.jw.wechat.dao.WxPushLogDao;
|
|
@ -11395,4 +11398,57 @@ public class PrescriptionService extends BaseJpaService<WlyyPrescriptionDO, Pres
|
|
public void updateChannelId(String id,String channelId){
|
|
public void updateChannelId(String id,String channelId){
|
|
outpatientDao.updateChannelId(id,channelId);
|
|
outpatientDao.updateChannelId(id,channelId);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @param userId 用户id 实例:["22222"]
|
|
|
|
* @param alert 通知内容
|
|
|
|
* @param title 通知标题
|
|
|
|
* @param extras 扩展参数 {"type","","id":""}
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
public String jPushMessage(String userId, String alert, String title, com.alibaba.fastjson.JSONObject extras){
|
|
|
|
List<WlyyHospitalSysDictDO> hospitalSysDictDOList = hospitalSysDictDao.findByDictName("JPUSH");
|
|
|
|
String appKey = null;
|
|
|
|
String masterSecret =null;
|
|
|
|
for (WlyyHospitalSysDictDO hospitalSysDictDO:hospitalSysDictDOList){
|
|
|
|
if (hospitalSysDictDO.getDictCode().equalsIgnoreCase("appKey")){
|
|
|
|
appKey=hospitalSysDictDO.getDictValue();
|
|
|
|
}
|
|
|
|
if (hospitalSysDictDO.getDictCode().equalsIgnoreCase("masterSecret")){
|
|
|
|
masterSecret = hospitalSysDictDO.getDictValue();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
logger.info("appKey"+appKey+"======"+"masterSecret"+masterSecret);
|
|
|
|
String enctryMessage = appKey+":"+masterSecret;
|
|
|
|
byte[] bytes = enctryMessage.getBytes();
|
|
|
|
String auth = "Basic "+Base64.encode(bytes);
|
|
|
|
com.alibaba.fastjson.JSONObject jsonObject = new com.alibaba.fastjson.JSONObject();
|
|
|
|
jsonObject.put("platform","all");
|
|
|
|
com.alibaba.fastjson.JSONObject audience = new com.alibaba.fastjson.JSONObject();
|
|
|
|
audience.put("alias",userId);
|
|
|
|
jsonObject.put("audience",audience);
|
|
|
|
com.alibaba.fastjson.JSONObject notification = new com.alibaba.fastjson.JSONObject();
|
|
|
|
com.alibaba.fastjson.JSONObject android = new com.alibaba.fastjson.JSONObject();
|
|
|
|
android.put("alert",alert);
|
|
|
|
android.put("title",title);
|
|
|
|
android.put("extras",extras);
|
|
|
|
android.put("builder_id","1");
|
|
|
|
com.alibaba.fastjson.JSONObject ios = new com.alibaba.fastjson.JSONObject();
|
|
|
|
ios.put("alert",alert);
|
|
|
|
ios.put("sound","default");
|
|
|
|
ios.put("extras",extras);
|
|
|
|
ios.put("badge","+1");
|
|
|
|
notification.put("android",android);
|
|
|
|
notification.put("ios",ios);
|
|
|
|
jsonObject.put("notification",notification);
|
|
|
|
String url = "https://api.jpush.cn/v3/push";
|
|
|
|
Map<String, Object> headerMap = new HashedMap();
|
|
|
|
headerMap.put("Authorization",auth);
|
|
|
|
headerMap.put("Content-Type","application/json");
|
|
|
|
String response = httpClientUtil.postBodyHead(url,jsonObject,headerMap);
|
|
|
|
logger.info("极光推送返回日志==="+response);
|
|
|
|
return response;
|
|
|
|
|
|
|
|
}
|
|
}
|
|
}
|