陈昶聿
2 天以前 fcb98e4558897945a316d04555923355b8e60605
ruoyi-admin/src/main/java/com/ruoyi/web/component/RedisMqReceiver.java
@@ -42,6 +42,7 @@
import org.springframework.stereotype.Component;
import java.io.IOException;
import java.net.URLEncoder;
import java.security.MessageDigest;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
@@ -110,6 +111,9 @@
    @Value("${xhsmsPwd}")
    private String xhsmsPwd;
    // 虚拟接入码
    @Value("${xhsmsjrm}")
    private String xhsmsjrm;
    @Value("${server.port}")
    private String port;
@@ -306,21 +310,26 @@
                        serviceOutPath.setParam6(subId);
                        serviceOutPath.setCreateTime(new Date());
                        serviceOutPath.setOrgid(serviceSubtask.getOrgid());
                        serviceOutPath.setDeptCode(serviceSubtask.getDeptcode());
                        serviceOutPath.setWardCode(serviceSubtask.getLeavehospitaldistrictcode());
                        serviceOutPath.setDeptName(serviceSubtask.getDeptname());
                        serviceOutPath.setWardName(serviceSubtask.getLeavehospitaldistrictname());
                        iServiceOutPathService.insertServiceOutPath(serviceOutPath);
//                                sendMagParam.setUrl(ip + ":" + req_path + "/followvisit/particty?param1=" + taskId + "&param2=" + patid + "&param5=false");
                        //转成16进制
                        String format = String.format("%03X", serviceOutPath.getId());
                        serviceOutPath.setRadix(format);
                        serviceOutPath.setUpdateTime(new Date());
                        serviceOutPath.setUrl(ip + ":" + req_path + "/sf?p=" + format);
                        iServiceOutPathService.updateServiceOutPath(serviceOutPath);
                        sendMagParam.setPhone(serviceSubtask.getPhone());
                        sendMagParam.setUrl(ip + ":" + req_path + "/sf?p=" + format);
                        SysConfig sysConfig = new SysConfig();
                        if (StringUtils.isNotEmpty(serviceSubtask.getServiceType()) && serviceSubtask.getServiceType().equals("6")) {
                            sysConfig = sysConfigMapper.checkConfigKeyUnique("zymyd.sms.template");
                        }else if (StringUtils.isNotEmpty(serviceSubtask.getServiceType()) && serviceSubtask.getServiceType().equals("14")) {
                        } else if (StringUtils.isNotEmpty(serviceSubtask.getServiceType()) && serviceSubtask.getServiceType().equals("14")) {
                            sysConfig = sysConfigMapper.checkConfigKeyUnique("mzmyd.sms.template");
                        }else {
                        } else {
                            sysConfig = sysConfigMapper.checkConfigKeyUnique("wj.sms.template");
                        }
                        if (!Objects.isNull(sysConfig)) {
@@ -339,10 +348,15 @@
                        serviceOutPath.setParam3(ivrTask1.getTaskName());
                        serviceOutPath.setCreateTime(new Date());
                        serviceOutPath.setOrgid(serviceSubtask.getOrgid());
                        serviceOutPath.setDeptCode(serviceSubtask.getDeptcode());
                        serviceOutPath.setWardCode(serviceSubtask.getLeavehospitaldistrictcode());
                        serviceOutPath.setDeptName(serviceSubtask.getDeptname());
                        serviceOutPath.setWardName(serviceSubtask.getLeavehospitaldistrictname());
                        iServiceOutPathService.insertServiceOutPath(serviceOutPath);
                        String format = String.format("%03X", serviceOutPath.getId());
                        serviceOutPath.setRadix(format);
                        serviceOutPath.setUpdateTime(new Date());
                        serviceOutPath.setUrl(StringUtils.isNotEmpty(req_path) ? ip + ":" + req_path + "/wt?p=" + format : ip + "/wt?p=" + format);
                        iServiceOutPathService.updateServiceOutPath(serviceOutPath);
//                                sendMagParam.setUrl(ip + ":" + req_path + "/outsideChainwt?param1=" + taskId + "&param2=" + patid + "&param3=" + URLEncoder.encode(ivrTask1.getTaskName(), StandardCharsets.UTF_8.toString()) + "&param5=false");
                        sendMagParam.setPhone(serviceSubtask.getPhone());
@@ -355,9 +369,9 @@
                        SysConfig sysConfig = new SysConfig();
                        if (StringUtils.isNotEmpty(serviceSubtask.getServiceType()) && serviceSubtask.getServiceType().equals("6")) {
                            sysConfig = sysConfigMapper.checkConfigKeyUnique("zymyd.sms.template");
                        }else if (StringUtils.isNotEmpty(serviceSubtask.getServiceType()) && serviceSubtask.getServiceType().equals("14")) {
                        } else if (StringUtils.isNotEmpty(serviceSubtask.getServiceType()) && serviceSubtask.getServiceType().equals("14")) {
                            sysConfig = sysConfigMapper.checkConfigKeyUnique("mzmyd.sms.template");
                        }else {
                        } else {
                            sysConfig = sysConfigMapper.checkConfigKeyUnique("wj.sms.template");
                        }
                        if (!Objects.isNull(sysConfig)) {
@@ -374,6 +388,10 @@
                        serviceOutPath.setParam3(ivrTask1.getTaskName());
                        serviceOutPath.setCreateTime(new Date());
                        serviceOutPath.setOrgid(serviceSubtask.getOrgid());
                        serviceOutPath.setDeptCode(serviceSubtask.getDeptcode());
                        serviceOutPath.setWardCode(serviceSubtask.getLeavehospitaldistrictcode());
                        serviceOutPath.setDeptName(serviceSubtask.getDeptname());
                        serviceOutPath.setWardName(serviceSubtask.getLeavehospitaldistrictname());
                        iServiceOutPathService.insertServiceOutPath(serviceOutPath);
                        String format = String.format("%03X", serviceOutPath.getId());
                        serviceOutPath.setRadix(format);
@@ -412,15 +430,28 @@
                    String s = null;
                    if (active.equals("xh")) {
                        //新华的短信发送方式
                        Map<String, String> req = new HashMap<>();
                        req.put("phone", sendMagParam.getPhone());
                        req.put("content", sendMagParam.getContent());
                        log.info("content返回值的内容是:{}", sendMagParam.getContent());
                        s = HttpUtil.postJsonRequest(xhsmsPath, new Gson().toJson(req));
                    } else if (active.equals("ls")) {
//                        String url = configService.selectConfigByKey("token.360", serviceSubtask.getOrgid());
//                        log.info("-------00token.360的URL为:{}", url);
                        Map<String, String> map2 = new HashMap<String, String>();
                        map2.put("action", "send");
                        map2.put("account", xhsmsAccount);
                        map2.put("password", xhsmsPwd);
                        map2.put("mobile", sendMagParam.getPhone());
                        map2.put("content", sendMagParam.getContent());
                        map2.put("extno", xhsmsjrm);
                        map2.put("rt", "json");
                        StringBuilder encodedParams = new StringBuilder();
                        for (Map.Entry<String, String> entry : map2.entrySet()) {
                            if (encodedParams.length() > 0) {
                                encodedParams.append("&");
                            }
                            // 对键和值进行URL编码
                            String encodedKey = URLEncoder.encode(entry.getKey(), "UTF-8");
                            String encodedValue = URLEncoder.encode(entry.getValue(), "UTF-8");
                            encodedParams.append(encodedKey).append("=").append(encodedValue);
                        }
                        Boolean isSuccess = HttpUtil.postJsonRequest(xhsmsPath, encodedParams.toString());
                        if (isSuccess) s = "true";
                    } else if (active.equals("ls")) {
                        //丽水的短信发送方式
                        SysConfig config = new SysConfig();
                        config.setConfigKey("ls.msg.info");
@@ -492,7 +523,8 @@
                        String sign = Md5Utils.hash(xhsmsAccount + timestamp + Md5Utils.hash(xhsmsPwd));
                        String content = sendMagParam.getContent();
                        String jsonMsg = "{" + "\"userName\": \"" + xhsmsAccount + "\"," + "\"content\": \"" + content + "\"," + "\"phoneList\": [" + sendMagParam.getPhone() + "]," + "\"timestamp\": " + timestamp + "," + "\"sign\": \"" + sign + "\"" + "}";
                        s = HttpUtil.postJsonRequest(xhsmsPath, jsonMsg);
                        Boolean b = HttpUtil.postJsonRequest(xhsmsPath, jsonMsg);
                        if (b) s = "true";
                        log.info("------市一短信发送的值为:{}", s);
                        if (StringUtils.isNotEmpty(s)) {
                            JSONObject jsonObject = JSONObject.parseObject(s);
@@ -559,6 +591,10 @@
                        serviceOutPath.setParam6(subId);
                        serviceOutPath.setCreateTime(new Date());
                        serviceOutPath.setOrgid(serviceSubtask.getOrgid());
                        serviceOutPath.setDeptCode(serviceSubtask.getDeptcode());
                        serviceOutPath.setWardCode(serviceSubtask.getLeavehospitaldistrictcode());
                        serviceOutPath.setDeptName(serviceSubtask.getDeptname());
                        serviceOutPath.setWardName(serviceSubtask.getLeavehospitaldistrictname());
                        iServiceOutPathService.insertServiceOutPath(serviceOutPath);
                        String format = String.format("%03X", serviceOutPath.getId());
                        serviceOutPath.setRadix(format);
@@ -574,6 +610,10 @@
                        serviceOutPath.setParam6(subId);
                        serviceOutPath.setCreateTime(new Date());
                        serviceOutPath.setOrgid(serviceSubtask.getOrgid());
                        serviceOutPath.setDeptCode(serviceSubtask.getDeptcode());
                        serviceOutPath.setWardCode(serviceSubtask.getLeavehospitaldistrictcode());
                        serviceOutPath.setDeptName(serviceSubtask.getDeptname());
                        serviceOutPath.setWardName(serviceSubtask.getLeavehospitaldistrictname());
                        iServiceOutPathService.insertServiceOutPath(serviceOutPath);
                        String format = String.format("%03X", serviceOutPath.getId());
                        serviceOutPath.setRadix(format);
@@ -591,6 +631,10 @@
                        serviceOutPath.setParam3(ivrTask1.getTaskName());
                        serviceOutPath.setParam6(subId);
                        serviceOutPath.setCreateTime(new Date());
                        serviceOutPath.setDeptCode(serviceSubtask.getDeptcode());
                        serviceOutPath.setWardCode(serviceSubtask.getLeavehospitaldistrictcode());
                        serviceOutPath.setDeptName(serviceSubtask.getDeptname());
                        serviceOutPath.setWardName(serviceSubtask.getLeavehospitaldistrictname());
                        serviceOutPath.setOrgid(serviceSubtask.getOrgid());
                        iServiceOutPathService.insertServiceOutPath(serviceOutPath);
                        String format = String.format("%03X", serviceOutPath.getId());