|
|
@@ -4,10 +4,10 @@ import java.io.FileOutputStream;
|
|
|
import java.io.IOException;
|
|
|
import java.io.InputStream;
|
|
|
import java.net.URL;
|
|
|
-import java.util.Date;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
+import java.util.*;
|
|
|
|
|
|
+import cn.hutool.http.HttpRequest;
|
|
|
+import cn.hutool.json.JSONUtil;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
|
|
import com.fasterxml.jackson.databind.JsonNode;
|
|
|
@@ -16,13 +16,17 @@ import com.fasterxml.jackson.databind.json.JsonMapper;
|
|
|
import com.fs.common.service.impl.SmsServiceImpl;
|
|
|
import com.fs.common.utils.DateUtils;
|
|
|
import com.fs.common.utils.StringUtils;
|
|
|
+import com.fs.company.domain.CompanyUser;
|
|
|
+import com.fs.company.mapper.CompanyUserMapper;
|
|
|
import com.fs.event.TemplateBean;
|
|
|
import com.fs.event.TemplateEvent;
|
|
|
import com.fs.event.TemplateListenEnum;
|
|
|
import com.fs.event.TemplateListener;
|
|
|
+import com.fs.gtPush.service.uniPush2Service;
|
|
|
import com.fs.his.domain.*;
|
|
|
import com.fs.his.dto.FsInquiryOrderPatientDTO;
|
|
|
import com.fs.his.dto.PayloadDTO;
|
|
|
+import com.fs.his.enums.PushLogDesTypeEnum;
|
|
|
import com.fs.his.mapper.*;
|
|
|
import com.fs.his.param.FsFollowReportParam;
|
|
|
import com.fs.his.param.FsInquiryOrderMsgListDParam;
|
|
|
@@ -33,7 +37,10 @@ import com.fs.his.vo.FsInquiryOrderMsgListDVO;
|
|
|
import com.fs.im.config.IMConfig;
|
|
|
import com.fs.im.dto.OpenImMsgCallBackResponse;
|
|
|
import com.fs.im.service.IImService;
|
|
|
+import com.fs.im.service.OpenIMService;
|
|
|
+import com.fs.im.service.impl.OpenIMServiceImpl;
|
|
|
import com.fs.im.vo.OpenImMsgCallBackVO;
|
|
|
+import com.fs.im.vo.OpenImResponseDTOTest;
|
|
|
import com.fs.system.oss.CloudStorageService;
|
|
|
import com.fs.system.oss.OSSFactory;
|
|
|
import com.fs.watch.domain.WatchDeviceInfo;
|
|
|
@@ -83,6 +90,14 @@ public class FsInquiryOrderMsgServiceImpl implements IFsInquiryOrderMsgService
|
|
|
@Autowired
|
|
|
private DeviceSetUpService deviceSetUpService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private uniPush2Service uniPush2Service;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private OpenIMService openIMService;
|
|
|
+ @Autowired
|
|
|
+ private CompanyUserMapper companyUserMapper;
|
|
|
+
|
|
|
// @Autowired
|
|
|
// TemplateListener publisher;
|
|
|
Logger logger= LoggerFactory.getLogger(getClass());
|
|
|
@@ -335,36 +350,36 @@ public class FsInquiryOrderMsgServiceImpl implements IFsInquiryOrderMsgService
|
|
|
OpenImMsgCallBackResponse openImMsgCallBackResponse = new OpenImMsgCallBackResponse();
|
|
|
ObjectMapper objectMapper = new ObjectMapper();
|
|
|
try {
|
|
|
- if (openImMsgCallBackVO.getCallbackCommand().equals("callbackBeforeAfterMsgCommand")){
|
|
|
+ if (openImMsgCallBackVO.getCallbackCommand().equals("callbackBeforeAfterMsgCommand")) {
|
|
|
fsInquiryOrderMsgMapper.deleteFsInquiryOrderMsgByMsgKey(openImMsgCallBackVO.getClientMsgID());
|
|
|
return openImMsgCallBackResponse;
|
|
|
}
|
|
|
- String send =openImMsgCallBackVO.getSendID();
|
|
|
- String to =openImMsgCallBackVO.getRecvID();
|
|
|
- Long time =openImMsgCallBackVO.getSendTime();
|
|
|
+ String send = openImMsgCallBackVO.getSendID();
|
|
|
+ String to = openImMsgCallBackVO.getRecvID();
|
|
|
+ Long time = openImMsgCallBackVO.getSendTime();
|
|
|
Date date = new Date(time);
|
|
|
String content = openImMsgCallBackVO.getContent();
|
|
|
|
|
|
|
|
|
- String userId="";
|
|
|
- String doctorId="";
|
|
|
- String companyUserId="";
|
|
|
- String msgType="2";
|
|
|
+ String userId = "";
|
|
|
+ String doctorId = "";
|
|
|
+ String companyUserId = "";
|
|
|
+ String msgType = "2";
|
|
|
//用户发送消息
|
|
|
- if (send.contains("U")){
|
|
|
- msgType="1";
|
|
|
- userId=send.replace("U","");
|
|
|
- if (to.contains("D")){
|
|
|
- doctorId=to.replace("D","");
|
|
|
- fsFollowReportService.addReport(userId,doctorId);
|
|
|
- }else if (to.contains("C")){
|
|
|
- companyUserId=to.replace("C","");
|
|
|
+ if (send.contains("U")) {
|
|
|
+ msgType = "1";
|
|
|
+ userId = send.replace("U", "");
|
|
|
+ if (to.contains("D")) {
|
|
|
+ doctorId = to.replace("D", "");
|
|
|
+ fsFollowReportService.addReport(userId, doctorId);
|
|
|
+ } else if (to.contains("C")) {
|
|
|
+ companyUserId = to.replace("C", "");
|
|
|
}
|
|
|
//医生发送消息
|
|
|
- }else if (send.contains("D")){
|
|
|
- doctorId=send.replace("D","");
|
|
|
- if (to.contains("U")){
|
|
|
- userId=to.replace("U","");
|
|
|
+ } else if (send.contains("D")) {
|
|
|
+ doctorId = send.replace("D", "");
|
|
|
+ if (to.contains("U")) {
|
|
|
+ userId = to.replace("U", "");
|
|
|
TemplateBean templateBean = TemplateBean.builder()
|
|
|
.title("您收到咨询回复")
|
|
|
.remark("您的咨询已回复")
|
|
|
@@ -372,31 +387,31 @@ public class FsInquiryOrderMsgServiceImpl implements IFsInquiryOrderMsgService
|
|
|
.templateType(TemplateListenEnum.TYPE_5.getValue())
|
|
|
.build();
|
|
|
publisher.publishEvent(new TemplateEvent(this, templateBean));
|
|
|
- if (openImMsgCallBackVO.getContentType()==101){
|
|
|
- if (content.contains("您的信息我已收到")){
|
|
|
+ if (openImMsgCallBackVO.getContentType() == 101) {
|
|
|
+ if (content.contains("您的信息我已收到")) {
|
|
|
long doctorIdL = Long.parseLong(doctorId);
|
|
|
long userIdL = Long.parseLong(userId);
|
|
|
int count = fsFollowReportMapper.selectFollowByUserIdAndDoctorIdAndType(userIdL, doctorIdL);
|
|
|
- if (count==0){
|
|
|
+ if (count == 0) {
|
|
|
FsUser fsUser = fsUserMapper.selectFsUserByUserId(userIdL);
|
|
|
- if (fsUser!=null&&fsUser.getPhone()!=null){
|
|
|
+ if (fsUser != null && fsUser.getPhone() != null) {
|
|
|
FsInquiryOrder order = fsFollowReportMapper.selectFsInquiryOrderByUserAndDoc(userIdL, doctorIdL);
|
|
|
- if (order!=null){
|
|
|
- FsInquiryOrderPatientDTO patientDTO = JSON.parseObject(order.getPatientJson(),FsInquiryOrderPatientDTO.class);
|
|
|
- if (patientDTO!=null&&patientDTO.getPatientName()!=null){
|
|
|
- FsDoctor doctor=doctorMapper.selectFsDoctorByDoctorId(doctorIdL);
|
|
|
- if (doctor.getDeptId()!=null&&doctor.getDeptId().compareTo(39L)==0){
|
|
|
- logger.info("药师回复发送短信:"+fsUser.getPhone()+patientDTO.getPatientName());
|
|
|
+ if (order != null) {
|
|
|
+ FsInquiryOrderPatientDTO patientDTO = JSON.parseObject(order.getPatientJson(), FsInquiryOrderPatientDTO.class);
|
|
|
+ if (patientDTO != null && patientDTO.getPatientName() != null) {
|
|
|
+ FsDoctor doctor = doctorMapper.selectFsDoctorByDoctorId(doctorIdL);
|
|
|
+ if (doctor.getDeptId() != null && doctor.getDeptId().compareTo(39L) == 0) {
|
|
|
+ logger.info("药师回复发送短信:" + fsUser.getPhone() + patientDTO.getPatientName());
|
|
|
smsService.sendUserSms(fsUser.getPhone(), patientDTO.getPatientName(), "7");
|
|
|
- }else {
|
|
|
- logger.info("医生回复发送短信:"+patientDTO.getMobile()+patientDTO.getPatientName());
|
|
|
+ } else {
|
|
|
+ logger.info("医生回复发送短信:" + patientDTO.getMobile() + patientDTO.getPatientName());
|
|
|
smsService.sendUserSms(fsUser.getPhone(), patientDTO.getPatientName(), "4");
|
|
|
}
|
|
|
}
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
FsFollow fo = fsFollowReportMapper.selectFsFollowById(userIdL, doctorIdL);
|
|
|
- if (fo!=null&&fo.getPatientName()!=null){
|
|
|
- logger.info("药师回复发送短信:"+fsUser.getPhone()+fo.getPatientName());
|
|
|
+ if (fo != null && fo.getPatientName() != null) {
|
|
|
+ logger.info("药师回复发送短信:" + fsUser.getPhone() + fo.getPatientName());
|
|
|
smsService.sendUserSms(fsUser.getPhone(), fo.getPatientName(), "7");
|
|
|
}
|
|
|
}
|
|
|
@@ -406,34 +421,78 @@ public class FsInquiryOrderMsgServiceImpl implements IFsInquiryOrderMsgService
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- }else {
|
|
|
- companyUserId = to.replace("C","");
|
|
|
+ } else {
|
|
|
+ companyUserId = to.replace("C", "");
|
|
|
}
|
|
|
- //销售发送消息
|
|
|
- }else if (send.contains("C")){
|
|
|
- companyUserId=send.replace("C","");
|
|
|
- if (to.contains("U")){
|
|
|
- userId=to.replace("U","");
|
|
|
- }else {
|
|
|
- doctorId = to.replace("D","");
|
|
|
+ //客服发送消息
|
|
|
+ } else if (send.contains("C")) {
|
|
|
+ companyUserId = send.replace("C", "");
|
|
|
+ if (to.contains("U")) {
|
|
|
+ userId = to.replace("U", "");
|
|
|
+ } else {
|
|
|
+ doctorId = to.replace("D", "");
|
|
|
}
|
|
|
}
|
|
|
Long orderId = fsInquiryOrderMsgMapper.selectFsInquiryOrderMsgOrderId(doctorId, userId);
|
|
|
- if (orderId==null){
|
|
|
- orderId = fsInquiryOrderMsgMapper.selectFsInquiryOrderMsgOrderIdByDate(doctorId, userId,date);
|
|
|
+ if (orderId == null) {
|
|
|
+ orderId = fsInquiryOrderMsgMapper.selectFsInquiryOrderMsgOrderIdByDate(doctorId, userId, date);
|
|
|
}
|
|
|
|
|
|
Integer msgContentType = openImMsgCallBackVO.getContentType();
|
|
|
- Integer type=0;
|
|
|
- String cont="";
|
|
|
+ Integer type = 0;
|
|
|
+ String cont = "";
|
|
|
JsonNode jsonNode = null;
|
|
|
- if (msgContentType != null ) {
|
|
|
+ String a = "";
|
|
|
+ openImMsgCallBackVO.setType("im");
|
|
|
+ if (send.contains("C") && StringUtils.isEmpty(openImMsgCallBackVO.getSenderNickname())) {
|
|
|
+ CompanyUser companyUser = companyUserMapper.selectCompanyUserById(Long.parseLong(openImMsgCallBackVO.getSendID().replace("C", "")));
|
|
|
+ openImMsgCallBackVO.setSenderNickname(StringUtils.isNotEmpty(companyUser.getImNickName()) ? companyUser.getImNickName() : companyUser.getNickName());
|
|
|
+ }
|
|
|
+ if (send.contains("D")) {
|
|
|
+ FsDoctor fsDoctor = doctorMapper.selectFsDoctorByDoctorId(Long.parseLong(openImMsgCallBackVO.getSendID().replace("D", "")));
|
|
|
+ openImMsgCallBackVO.setSenderNickname(fsDoctor.getDoctorName());
|
|
|
+
|
|
|
+ }
|
|
|
+ String jsonStr = objectMapper.writeValueAsString(openImMsgCallBackVO);
|
|
|
+ if (msgContentType != null) {
|
|
|
+ if (to.startsWith("U")) {
|
|
|
+ a = to.replace("U", "");
|
|
|
+ } else if (to.startsWith("C")) {
|
|
|
+ a = to.replace("C", "");
|
|
|
+ }
|
|
|
switch (msgContentType) {
|
|
|
+ case 1601:
|
|
|
+ log.info("执行音视频通话推送");
|
|
|
+ cont = "通话消息";
|
|
|
+ type = 1;
|
|
|
+ //jsonNode = objectMapper.readTree(content);
|
|
|
+ String adminToken = openIMService.getAdminToken();
|
|
|
+ Map<String, Object> paramMap = new HashMap<>();
|
|
|
+ ArrayList<String> userIDs = new ArrayList<>();
|
|
|
+ userIDs.add(send);
|
|
|
+ paramMap.put("userIDs", userIDs);
|
|
|
+
|
|
|
+ String jsonBody = JSONUtil.toJsonStr(paramMap);
|
|
|
+ String result1 = HttpRequest.post("https://web.im.cdwjyyh.com/api/user/get_users_info")
|
|
|
+ .header("operationID", String.valueOf(time))
|
|
|
+ .header("token", adminToken)
|
|
|
+ .body(jsonBody)
|
|
|
+ .execute()
|
|
|
+ .body();
|
|
|
+ OpenIMServiceImpl.UpdateUserInfo updateUserInfo = new OpenIMServiceImpl.UpdateUserInfo();
|
|
|
+ OpenImResponseDTOTest responseDTO1 = JSONUtil.toBean(result1, OpenImResponseDTOTest.class);
|
|
|
+ List<OpenIMServiceImpl.UserInfo> users = responseDTO1.getData().getUsersInfo();
|
|
|
+
|
|
|
+ uniPush2Service.pushIm(Long.parseLong(a), 0l, "", users.get(0).getNickname(), "通话消息", 1f, PushLogDesTypeEnum.IM_MSG.getValue(), jsonStr);
|
|
|
+
|
|
|
+ break;
|
|
|
//普通消息
|
|
|
case 101:
|
|
|
- type=1;
|
|
|
+ type = 1;
|
|
|
jsonNode = objectMapper.readTree(content);
|
|
|
- cont=jsonNode.get("content").asText();
|
|
|
+ cont = jsonNode.get("content").asText();
|
|
|
+ uniPush2Service.pushIm(Long.parseLong(a), 0l, "", openImMsgCallBackVO.getSenderNickname(), cont, 1f, PushLogDesTypeEnum.IM_MSG.getValue(), jsonStr);
|
|
|
+
|
|
|
break;
|
|
|
//语音消息
|
|
|
case 103:
|
|
|
@@ -442,24 +501,25 @@ public class FsInquiryOrderMsgServiceImpl implements IFsInquiryOrderMsgService
|
|
|
try {
|
|
|
// 创建URL对象
|
|
|
URL url = new URL(soundUrl);
|
|
|
- InputStream in = url.openStream();
|
|
|
+ InputStream in = url.openStream();
|
|
|
CloudStorageService storage = OSSFactory.build();
|
|
|
cont = storage.uploadSuffix(in, ".m4a");
|
|
|
} catch (IOException e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
- type=2;
|
|
|
- //医生发送的语音消息,这一段是同步语音消息到腕表的
|
|
|
- /*if (send.contains("D")){
|
|
|
- WatchDeviceInfo u = watchDeviceInfoMapper.selectByUserId(to.replace("U", ""));
|
|
|
- if (u!=null&& StringUtils.isNotEmpty(u.getDeviceNumber())){
|
|
|
- DeviceSendParam deviceSendParam = new DeviceSendParam();
|
|
|
- deviceSendParam.setDeviceId(u.getDeviceNumber());
|
|
|
- deviceSendParam.setFileUrl(soundUrl);
|
|
|
- deviceSendParam.setSendUserName(openImMsgCallBackVO.getSenderNickname());
|
|
|
- deviceSetUpService.sendMp3(deviceSendParam);
|
|
|
- }
|
|
|
- }*/
|
|
|
+ type = 2;
|
|
|
+ //医生发送的语音消息
|
|
|
+// if (send.contains("D")) {
|
|
|
+// WatchDeviceInfo u = watchDeviceInfoMapper.selectByUserId(to.replace("U", ""));
|
|
|
+// if (u != null && StringUtils.isNotEmpty(u.getDeviceNumber())) {
|
|
|
+// DeviceSendParam deviceSendParam = new DeviceSendParam();
|
|
|
+// deviceSendParam.setDeviceId(u.getDeviceNumber());
|
|
|
+// deviceSendParam.setFileUrl(soundUrl);
|
|
|
+// deviceSendParam.setSendUserName(openImMsgCallBackVO.getSenderNickname());
|
|
|
+//// deviceSetUpService.sendMp3(deviceSendParam);
|
|
|
+// }
|
|
|
+// }
|
|
|
+ uniPush2Service.pushIm(Long.parseLong(a), 0l, "", openImMsgCallBackVO.getSenderNickname(), "语音消息", 1f, PushLogDesTypeEnum.IM_MSG.getValue(), jsonStr);
|
|
|
break;
|
|
|
//图片消息
|
|
|
case 102:
|
|
|
@@ -467,13 +527,16 @@ public class FsInquiryOrderMsgServiceImpl implements IFsInquiryOrderMsgService
|
|
|
String imgUrl = jsonNode.get("sourcePicture").get("url").asText();
|
|
|
try {
|
|
|
URL url = new URL(imgUrl);
|
|
|
- InputStream in = url.openStream();
|
|
|
+ InputStream in = url.openStream();
|
|
|
CloudStorageService storage = OSSFactory.build();
|
|
|
cont = storage.uploadSuffix(in, ".jpg");
|
|
|
} catch (IOException e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
- type=3;
|
|
|
+ openImMsgCallBackVO.setContent("");
|
|
|
+ jsonStr = objectMapper.writeValueAsString(openImMsgCallBackVO);
|
|
|
+ type = 3;
|
|
|
+ uniPush2Service.pushIm(Long.parseLong(a), 0l, "", openImMsgCallBackVO.getSenderNickname(), "图片消息", 1f, PushLogDesTypeEnum.IM_MSG.getValue(), jsonStr);
|
|
|
break;
|
|
|
//视频消息
|
|
|
case 104:
|
|
|
@@ -481,77 +544,139 @@ public class FsInquiryOrderMsgServiceImpl implements IFsInquiryOrderMsgService
|
|
|
String videoUrl = jsonNode.get("videoUrl").asText();
|
|
|
try {
|
|
|
URL url = new URL(videoUrl);
|
|
|
- InputStream in = url.openStream();
|
|
|
+ InputStream in = url.openStream();
|
|
|
CloudStorageService storage = OSSFactory.build();
|
|
|
- cont = storage.uploadSuffix(in, "."+jsonNode.get("videoType").asText());
|
|
|
+ cont = storage.uploadSuffix(in, "." + jsonNode.get("videoType").asText());
|
|
|
} catch (IOException e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
- type=4;
|
|
|
+ openImMsgCallBackVO.setContent("");
|
|
|
+ jsonStr = objectMapper.writeValueAsString(openImMsgCallBackVO);
|
|
|
+ type = 4;
|
|
|
+ uniPush2Service.pushIm(Long.parseLong(a), 0l, "", openImMsgCallBackVO.getSenderNickname(), "视频消息", 1f, PushLogDesTypeEnum.IM_MSG.getValue(), jsonStr);
|
|
|
+ break;
|
|
|
+ //文件消息
|
|
|
+ case 105:
|
|
|
+ jsonNode = objectMapper.readTree(content); // 转为 JsonNode
|
|
|
+ cont = jsonNode.get("fileName").asText();
|
|
|
+ type = 4;
|
|
|
+ openImMsgCallBackVO.setContent("");
|
|
|
+ jsonStr = objectMapper.writeValueAsString(openImMsgCallBackVO);
|
|
|
+ uniPush2Service.pushIm(Long.parseLong(a), 0l, "", openImMsgCallBackVO.getSenderNickname(), "文件消息", 1f, PushLogDesTypeEnum.IM_MSG.getValue(), jsonStr);
|
|
|
break;
|
|
|
//自定义消息
|
|
|
case 110:
|
|
|
- PayloadDTO payloadDTO = objectMapper.readValue(content, PayloadDTO.class);
|
|
|
-
|
|
|
- jsonNode = objectMapper.readTree(payloadDTO.getData());
|
|
|
- JsonNode payload = jsonNode.get("payload");
|
|
|
+ JsonNode rootNode = objectMapper.readTree(content);
|
|
|
+ String dataStr = rootNode.get("data").asText();
|
|
|
+ JsonNode innerNode = objectMapper.readTree(dataStr);
|
|
|
+ JsonNode payload = innerNode.get("payload");
|
|
|
String data = payload.get("data").asText();
|
|
|
JsonNode extension = payload.get("extension");
|
|
|
- if (data.equals("prescribe")){
|
|
|
+ FsUser user = null;
|
|
|
+ if (data.equals("prescribe")) {
|
|
|
String prescribeId = extension.get("prescribeId").asText();
|
|
|
FsPrescribe fsPrescribe = fsPrescribeMapper.selectFsPrescribeByPrescribeId(Long.parseLong(prescribeId));
|
|
|
- cont=objectMapper.writeValueAsString(fsPrescribe);
|
|
|
+ cont = objectMapper.writeValueAsString(fsPrescribe);
|
|
|
//orderId = fsPrescribe.getInquiryOrderId();
|
|
|
- type=5;
|
|
|
+ type = 5;
|
|
|
+ user = fsUserMapper.selectFsUserByUserId(Long.parseLong(a));
|
|
|
+ if (StringUtils.isNotEmpty(user.getJpushId())) {
|
|
|
+ uniPush2Service.pushIm(Long.parseLong(a), 0l, "", openImMsgCallBackVO.getSenderNickname(), "电子处方单", 1f, PushLogDesTypeEnum.IM_MSG.getValue(), jsonStr);
|
|
|
+ }
|
|
|
break;
|
|
|
- }else if (data.equals("report")){
|
|
|
+ } else if (data.equals("report")) {
|
|
|
|
|
|
String description = payload.get("description").asText();
|
|
|
FsInquiryOrderReport fsInquiryOrderReport = fsInquiryOrderReportService.selectFsInquiryOrderReportByOrderId(Long.parseLong(description));
|
|
|
- if (fsInquiryOrderReport!=null){
|
|
|
+ if (fsInquiryOrderReport != null) {
|
|
|
cont = fsInquiryOrderReport.getOrderId().toString();
|
|
|
}
|
|
|
- type=6;
|
|
|
+ type = 6;
|
|
|
+ user = fsUserMapper.selectFsUserByUserId(Long.parseLong(a));
|
|
|
+ if (StringUtils.isNotEmpty(user.getJpushId())) {
|
|
|
+ uniPush2Service.pushIm(Long.parseLong(a), 0l, "", openImMsgCallBackVO.getSenderNickname(), "问诊报告单", 1f, PushLogDesTypeEnum.IM_MSG.getValue(), jsonStr);
|
|
|
+ }
|
|
|
break;
|
|
|
- }else if (data.equals("follow")){
|
|
|
- cont=payload.get("extension").get("followId").asText();
|
|
|
- type= 7;
|
|
|
+ } else if (data.equals("follow")) {
|
|
|
+ cont = payload.get("extension").get("followId").asText();
|
|
|
+ type = 7;
|
|
|
//orderId = payload.get("extension").get("followId").asLong();
|
|
|
+ user = fsUserMapper.selectFsUserByUserId(Long.parseLong(a));
|
|
|
+ if (StringUtils.isNotEmpty(user.getJpushId())) {
|
|
|
+ uniPush2Service.pushIm(Long.parseLong(a), 0l, "", openImMsgCallBackVO.getSenderNickname(), "随访单", 1f, PushLogDesTypeEnum.IM_MSG.getValue(), jsonStr);
|
|
|
+ }
|
|
|
break;
|
|
|
- }else if (data.equals("drugReport")){
|
|
|
- cont=payload.get("description").asText();
|
|
|
+ } else if (data.equals("drugReport")) {
|
|
|
+ cont = payload.get("description").asText();
|
|
|
//orderId = payload.get("description").asLong();
|
|
|
- type= 8;
|
|
|
+ type = 8;
|
|
|
+ user = fsUserMapper.selectFsUserByUserId(Long.parseLong(a));
|
|
|
+ if (StringUtils.isNotEmpty(user.getJpushId())) {
|
|
|
+ uniPush2Service.pushIm(Long.parseLong(a), 0l, "", openImMsgCallBackVO.getSenderNickname(), "用药报告单", 1f, PushLogDesTypeEnum.IM_MSG.getValue(), jsonStr);
|
|
|
+ }
|
|
|
break;
|
|
|
- } else if (data.equals("package")){
|
|
|
- cont=payload.get("extension").get("title").asText();
|
|
|
- //orderId = payload.get("description").asLong();
|
|
|
- type= 9;
|
|
|
+ } else if (data.equals("package")) {
|
|
|
+ cont = payload.get("extension").get("title").asText();
|
|
|
+ openImMsgCallBackVO.setSendTime(null);
|
|
|
+ openImMsgCallBackVO.setCreateTime(null);
|
|
|
+ openImMsgCallBackVO.setFaceURL("");
|
|
|
+ jsonStr = objectMapper.writeValueAsString(openImMsgCallBackVO);
|
|
|
+ type = 9;
|
|
|
+ user = fsUserMapper.selectFsUserByUserId(Long.parseLong(a));
|
|
|
+ openImMsgCallBackVO.setContent("");
|
|
|
+ jsonStr = objectMapper.writeValueAsString(openImMsgCallBackVO);
|
|
|
+ if (StringUtils.isNotEmpty(user.getJpushId())) {
|
|
|
+ uniPush2Service.pushIm(Long.parseLong(a), 0l, "", openImMsgCallBackVO.getSenderNickname(), "套餐包", 1f, PushLogDesTypeEnum.IM_MSG.getValue(), jsonStr);
|
|
|
+ }
|
|
|
break;
|
|
|
- }else if (data.equals("couponPackage")){
|
|
|
- cont=payload.get("extension").get("title").asText();
|
|
|
+ } else if (data.equals("couponPackage")) {
|
|
|
+ cont = payload.get("extension").get("title").asText();
|
|
|
//orderId = payload.get("description").asLong();
|
|
|
- type= 10;
|
|
|
+ type = 10;
|
|
|
+ user = fsUserMapper.selectFsUserByUserId(Long.parseLong(a));
|
|
|
+ openImMsgCallBackVO.setContent("");
|
|
|
+ jsonStr = objectMapper.writeValueAsString(openImMsgCallBackVO);
|
|
|
+ if (StringUtils.isNotEmpty(user.getJpushId())) {
|
|
|
+ uniPush2Service.pushIm(Long.parseLong(a), 0l, "", openImMsgCallBackVO.getSenderNickname(), "私域疗法券", 1f, PushLogDesTypeEnum.IM_MSG.getValue(), jsonStr);
|
|
|
+ }
|
|
|
break;
|
|
|
- }else if (data.equals("inquirySelect")){
|
|
|
- cont=payload.get("extension").get("title").asText();
|
|
|
+ } else if (data.equals("inquirySelect")) {
|
|
|
+ cont = payload.get("extension").get("title").asText();
|
|
|
//orderId = payload.get("description").asLong();
|
|
|
- type= 11;
|
|
|
+ type = 11;
|
|
|
+ user = fsUserMapper.selectFsUserByUserId(Long.parseLong(a));
|
|
|
+ openImMsgCallBackVO.setContent("");
|
|
|
+ jsonStr = objectMapper.writeValueAsString(openImMsgCallBackVO);
|
|
|
+ if (StringUtils.isNotEmpty(user.getJpushId())) {
|
|
|
+ uniPush2Service.pushIm(Long.parseLong(a), 0l, "", openImMsgCallBackVO.getSenderNickname(), "会诊", 1f, PushLogDesTypeEnum.IM_MSG.getValue(), jsonStr);
|
|
|
+ }
|
|
|
break;
|
|
|
- }else if (data.equals("startInquiry")||data.equals("finishInquiry")){
|
|
|
- cont =payload.get("extension").get("title").asText();
|
|
|
- type=1;
|
|
|
+ } else if (data.equals("startInquiry") || data.equals("finishInquiry")) {
|
|
|
+ cont = payload.get("extension").get("title").asText();
|
|
|
+ type = 1;
|
|
|
+ user = fsUserMapper.selectFsUserByUserId(Long.parseLong(a));
|
|
|
+ if (StringUtils.isNotEmpty(user.getJpushId())) {
|
|
|
+ uniPush2Service.pushIm(Long.parseLong(a), 0l, "", openImMsgCallBackVO.getSenderNickname(), "接诊通知", 1f, PushLogDesTypeEnum.IM_MSG.getValue(), jsonStr);
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ } else if (data.equals("course")) {
|
|
|
+ cont = payload.get("extension").get("title").asText();
|
|
|
+ type = 1;
|
|
|
+ user = fsUserMapper.selectFsUserByUserId(Long.parseLong(a));
|
|
|
+ if (StringUtils.isNotEmpty(user.getJpushId())) {
|
|
|
+ uniPush2Service.pushIm(Long.parseLong(a), 0l, "", openImMsgCallBackVO.getSenderNickname(), cont, 1f, PushLogDesTypeEnum.IM_MSG.getValue(), jsonStr);
|
|
|
+ }
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|
|
|
}
|
|
|
- if (StringUtils.isEmpty(cont)){
|
|
|
+ if (StringUtils.isEmpty(cont)) {
|
|
|
openImMsgCallBackResponse.setErrMsg("无消息内容,未保存到数据库");
|
|
|
return openImMsgCallBackResponse;
|
|
|
}
|
|
|
- if (orderId==null&&StringUtils.isNotEmpty(openImMsgCallBackVO.getEx())){
|
|
|
+ if (orderId == null && StringUtils.isNotEmpty(openImMsgCallBackVO.getEx())) {
|
|
|
JsonNode exJson = objectMapper.readTree(openImMsgCallBackVO.getEx());
|
|
|
orderId = exJson.get("orderId").asLong();
|
|
|
}
|
|
|
@@ -567,11 +692,11 @@ public class FsInquiryOrderMsgServiceImpl implements IFsInquiryOrderMsgService
|
|
|
msg.setMsgType(msgType);
|
|
|
fsInquiryOrderMsgMapper.insertFsInquiryOrderMsg(msg);
|
|
|
// 极光推送
|
|
|
- //String pushContent = (type == 1) ? content :"您有一条新消息";
|
|
|
- //uniPush2Service.pushOne(Long.parseLong(to.replace("U","")), orderId, null, "新消息提醒", pushContent, PushLogTypeEnum.MARKET.getValue(), PushLogDesTypeEnum.MARKET_PUSH.getValue());
|
|
|
- log.info("返回的参数 {}", JSON.toJSONString(openImMsgCallBackResponse));
|
|
|
+ String pushContent = (type == 1) ? content : "您有一条新消息";
|
|
|
+// uniPush2Service.pushIm(Long.parseLong(to.replace("U","")), orderId, null, "新消息提醒", pushContent, PushLogTypeEnum.MARKET.getValue(), PushLogDesTypeEnum.IM_MSG.getValue());
|
|
|
+// log.info("返回的参数 {}", JSON.toJSONString(openImMsgCallBackResponse));
|
|
|
return openImMsgCallBackResponse;
|
|
|
- } catch (Exception e){
|
|
|
+ } catch (Exception e) {
|
|
|
openImMsgCallBackResponse.setActionCode(202);
|
|
|
openImMsgCallBackResponse.setErrCode(100);
|
|
|
openImMsgCallBackResponse.setErrDlt("");
|
|
|
@@ -579,7 +704,6 @@ public class FsInquiryOrderMsgServiceImpl implements IFsInquiryOrderMsgService
|
|
|
log.info("返回的参数 {}", JSON.toJSONString(openImMsgCallBackResponse));
|
|
|
return openImMsgCallBackResponse;
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
|
|
|
}
|