| | |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.fasterxml.jackson.core.JsonProcessingException; |
| | | import com.fasterxml.jackson.core.type.TypeReference; |
| | | import com.fasterxml.jackson.databind.JsonNode; |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import com.google.gson.Gson; |
| | | import com.google.gson.GsonBuilder; |
| | |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.utils.http.HttpUtils; |
| | | import com.ruoyi.common.utils.sign.Md5Utils; |
| | | import com.ruoyi.common.utils.sms.smsUtils; |
| | | import com.ruoyi.system.domain.SysConfig; |
| | | import com.ruoyi.system.service.ISysConfigService; |
| | | import com.smartor.common.LSHospTokenUtil; |
| | |
| | | } else if (active.equals("sltd")) { |
| | | //省立同德的短信发送方式 |
| | | String data = MessageSend.sendMsg(sendMagParam.getContent(), "6", sendMagParam.getPhone(), LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss"))); |
| | | if (StringUtils.isNotEmpty(data) && data.contains("result=0")) { |
| | | s = "true"; |
| | | if (StringUtils.isNotEmpty(data)) { |
| | | ObjectMapper mapper = new ObjectMapper(); |
| | | JsonNode root = mapper.readTree(data); |
| | | String status = root.get("result").get(0).get("status").asText(); |
| | | if (status.equals("00000")) { |
| | | s = "true"; |
| | | } else { |
| | | setFailPreachForm(serviceSubtask, sendPreachform, "短信发送失败: " + data, "5"); |
| | | throw new BaseException("短信发送失败"); |
| | | } |
| | | } else { |
| | | setFailPreachForm(serviceSubtask, sendPreachform, "短信发送失败: " + data, "5"); |
| | | throw new BaseException("短信发送失败"); |
| | |
| | | log.error("获取微信公众号请求信息根据机构ID:{}", patArchive.getOrgid()); |
| | | List<String> wxqqxx = WxGZHEnum.getDescByCode(patArchive.getOrgid()); |
| | | //市一医院 不校验 |
| | | if(active.equals("hzszlyy")){ |
| | | if (CollectionUtils.isEmpty(wxqqxx) || wxqqxx.size() < 4) { |
| | | serviceSubtask.setCurrentPreachform(sendPreachform); |
| | | serviceSubtask.setVisitTime(getNextVisitTime(serviceSubtask.getId(), serviceSubtask.getTaskid(), serviceSubtask.getVisitTime(), serviceSubtask.getCurrentPreachform())); |
| | | serviceSubtaskMapper.updateServiceSubtask(serviceSubtask); |
| | | |
| | | }else { |
| | | if (CollectionUtils.isEmpty(wxqqxx) || wxqqxx.size() < 4) { |
| | | serviceSubtask.setCurrentPreachform(sendPreachform); |
| | | serviceSubtask.setVisitTime(getNextVisitTime(serviceSubtask.getId(), serviceSubtask.getTaskid(), serviceSubtask.getVisitTime(), serviceSubtask.getCurrentPreachform())); |
| | | serviceSubtaskMapper.updateServiceSubtask(serviceSubtask); |
| | | |
| | | //失败记录 |
| | | setFailPreachForm(serviceSubtask, sendPreachform, "该机构的公众号配置信息不全,无法通过公众号发送", "5"); |
| | | continue; |
| | | } |
| | | //失败记录 |
| | | setFailPreachForm(serviceSubtask, sendPreachform, "该机构的公众号配置信息不全,无法通过公众号发送", "5"); |
| | | continue; |
| | | } |
| | | |
| | | String wxCode = getWXCode(serviceSubtask.getSfzh(), url, serviceSubtask.getTaskName(), serviceSubtask.getTaskName(), patArchive.getTelcode(), patArchive.getName(), patArchive.getPatidHis(), wxqqxx); |
| | | log.error("wxCode的值为:{}", wxCode); |
| | | Map<String, Object> map = JSONObject.parseObject(wxCode, Map.class); |
| | | log.error("map的值为:{}", map); |
| | | if (!map.isEmpty()) { |
| | | serviceSubtask.setResult("success"); |
| | | serviceSubtask.setSendstate(3L); |
| | | log.error("aBoolean的值为:{}", aBoolean); |
| | | if (map.get("succ").toString().equals("true")) { |
| | | aBoolean = true; |
| | | } |
| | | if (aBoolean == false) { |
| | | ServiceSubtaskRecord serviceSubtaskRecord = new ServiceSubtaskRecord(); |
| | | serviceSubtaskRecord.setTaskid(serviceSubtask.getTaskid().toString()); |
| | | serviceSubtaskRecord.setSubtaskId(serviceSubtask.getId()); |
| | | serviceSubtaskRecord.setUuid(UUID.randomUUID().toString()); |
| | | serviceSubtaskRecord.setTasktype(serviceSubtask.getType()); |
| | | serviceSubtaskRecord.setPreachform("5"); |
| | | serviceSubtaskRecord.setStartTime(System.currentTimeMillis()); |
| | | serviceSubtaskRecord.setRemark(ObjectUtils.isNotEmpty(map.get("msg")) ? map.get("msg").toString() : null); |
| | | serviceSubtaskRecordService.insertServiceSubtaskRecord(serviceSubtaskRecord); |
| | | //在子任务表里记录一下 |
| | | setFailPreachForm(serviceSubtask, sendPreachform, "公众号发送失败", "5"); |
| | | continue; |
| | | String wxCode = ""; |
| | | if (active.equals("hzszlyy")) { |
| | | wxCode = smsUtils.sendChat(url, patArchive.getTelcode(), serviceSubtask.getSfzh()); |
| | | log.info(wxCode); |
| | | } else { |
| | | wxCode = getWXCode(serviceSubtask.getSfzh(), url, serviceSubtask.getTaskName(), serviceSubtask.getTaskName(), patArchive.getTelcode(), patArchive.getName(), patArchive.getPatidHis(), wxqqxx); |
| | | log.error("wxCode的值为:{}", wxCode); |
| | | Map<String, Object> map = JSONObject.parseObject(wxCode, Map.class); |
| | | log.error("map的值为:{}", map); |
| | | if (!map.isEmpty()) { |
| | | serviceSubtask.setResult("success"); |
| | | serviceSubtask.setSendstate(3L); |
| | | log.error("aBoolean的值为:{}", aBoolean); |
| | | if (map.get("succ").toString().equals("true")) { |
| | | aBoolean = true; |
| | | } |
| | | if (aBoolean == false) { |
| | | ServiceSubtaskRecord serviceSubtaskRecord = new ServiceSubtaskRecord(); |
| | | serviceSubtaskRecord.setTaskid(serviceSubtask.getTaskid().toString()); |
| | | serviceSubtaskRecord.setSubtaskId(serviceSubtask.getId()); |
| | | serviceSubtaskRecord.setUuid(UUID.randomUUID().toString()); |
| | | serviceSubtaskRecord.setTasktype(serviceSubtask.getType()); |
| | | serviceSubtaskRecord.setPreachform("5"); |
| | | serviceSubtaskRecord.setStartTime(System.currentTimeMillis()); |
| | | serviceSubtaskRecord.setRemark(ObjectUtils.isNotEmpty(map.get("msg")) ? map.get("msg").toString() : null); |
| | | serviceSubtaskRecordService.insertServiceSubtaskRecord(serviceSubtaskRecord); |
| | | //在子任务表里记录一下 |
| | | setFailPreachForm(serviceSubtask, sendPreachform, "公众号发送失败", "5"); |
| | | continue; |
| | | } |
| | | } |
| | | } |
| | | } catch (Exception e) { |