liusheng
2024-11-07 37b79cfd8e5ecdc6f9f09750583f998183c338fb
代码提交
已添加6个文件
已修改6个文件
819 ■■■■■ 文件已修改
ruoyi-admin/src/main/java/com/ruoyi/web/component/RedisMqReceiver.java 125 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceOutPathController.java 116 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/test/MQTest.java 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/resources/application-druid.yml 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/RyTask.java 127 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/domain/ServiceOutPath.java 66 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/mapper/ServiceOutPathMapper.java 63 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/service/IServiceOutPathService.java 61 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/java/com/smartor/service/impl/ServiceOutPathServiceImpl.java 87 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/resources/mapper/smartor/ServiceOutPathMapper.xml 137 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
smartor/src/main/resources/mapper/smartor/ServiceTaskMapper.xml 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/component/RedisMqReceiver.java
@@ -5,6 +5,7 @@
import com.google.gson.Gson;
import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.enums.ServiceFromEnum;
import com.ruoyi.common.utils.HttpUtil;
import com.ruoyi.common.utils.RSAPublicKeyExample;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.http.HttpUtils;
@@ -13,10 +14,7 @@
import com.smartor.domain.*;
import com.smartor.mapper.ServiceSubtaskMapper;
import com.smartor.mapper.ServiceTaskMapper;
import com.smartor.service.IBaseSmsaccountService;
import com.smartor.service.IIvrTaskTemplateService;
import com.smartor.service.IServiceSubtaskRecordService;
import com.smartor.service.ISvyTaskTemplateService;
import com.smartor.service.*;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
@@ -26,6 +24,7 @@
import org.springframework.data.redis.listener.RedisMessageListenerContainer;
import org.springframework.stereotype.Component;
import java.math.BigInteger;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.time.LocalDateTime;
@@ -55,9 +54,7 @@
    private String thirdWXUrl;
    @Autowired
    private IIvrTaskTemplateService ivrTaskTemplateService;
    @Autowired
    private ISvyTaskTemplateService svyTaskTemplateService;
    private IServiceOutPathService iServiceOutPathService;
    @Autowired
    private ServiceSubtaskMapper ivrTaskcallMapper;
@@ -88,6 +85,9 @@
    @Autowired
    IBaseSmsaccountService baseSmsaccountService;
    @Value("${xhsmsPath}")
    private String xhsmsPath;
    // åˆ›å»ºå›ºå®šå¤§å°çš„线程池
    private static final ExecutorService executorService = Executors.newFixedThreadPool(10);
@@ -280,7 +280,6 @@
                    continue;
                } else if (descByCode.equals("短信")) {
                    //短信
//                        http://localhost:8099/followvisit/particty?param1=3&param2=348
                    //对url中两个参数加密
                    RSAPublicKeyExample rsaPublicKeyExample = new RSAPublicKeyExample();
                    String taskId = rsaPublicKeyExample.encryptedData(ivrTask1.getTaskid().toString(), pub_key);
@@ -298,17 +297,62 @@
                            SendMagParam sendMagParam = new SendMagParam();
                            sendMagParam.setType("4");
                            if (type == 1) {
                                sendMagParam.setUrl(ip + ":" + req_path + "/followvisit/particty?param1=" + taskId + "&param2=" + patid + "&param5=false");
                            } else if (type == 1) {
                                sendMagParam.setUrl(ip + ":" + req_path + "/outsideChainwt?param1=" + taskId + "&param2=" + patid + "&param3=" + URLEncoder.encode(ivrTask1.getTaskName(), StandardCharsets.UTF_8.toString()) + "&param5=false");
                                //随访
                                ServiceOutPath serviceOutPath = new ServiceOutPath();
                                serviceOutPath.setParam1(taskId);
                                serviceOutPath.setParam2(patid);
                                serviceOutPath.setCreateTime(new Date());
                                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());
                                iServiceOutPathService.updateServiceOutPath(serviceOutPath);
                                sendMagParam.setPhone(serviceSubtask.getPhone());
                                sendMagParam.setUrl(ip + ":" + req_path + "/sf?p=" + format);
                                sendMagParam.setContent("【新华医院】您好,邀请您填写出院随访调查表,请点击" + sendMagParam.getUrl() + "填写。感谢您配合!");
                            } else if (type == 2) {
                                //问券(问题)
                                ServiceOutPath serviceOutPath = new ServiceOutPath();
                                serviceOutPath.setParam1(taskId);
                                serviceOutPath.setParam2(patid);
//                                serviceOutPath.setParam3(URLEncoder.encode(ivrTask1.getTaskName(), StandardCharsets.UTF_8.toString()));
                                serviceOutPath.setParam3(ivrTask1.getTaskName());
                                serviceOutPath.setCreateTime(new Date());
                                iServiceOutPathService.insertServiceOutPath(serviceOutPath);
                                String format = String.format("%03X", serviceOutPath.getId());
                                serviceOutPath.setRadix(format);
                                serviceOutPath.setUpdateTime(new Date());
                                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());
                                sendMagParam.setUrl(ip + ":" + req_path + "/wt?p=" + format);
                                sendMagParam.setContent("【新华医院】您好,邀请您填写出院调查表,请点击" + sendMagParam.getUrl() + "填写。感谢您配合!");
                            } else if (type == 3) {
                                sendMagParam.setUrl(ip + ":" + req_path + "/outsideChainxj?param1=" + taskId + "&param2=" + patid + "&param3=" + URLEncoder.encode(ivrTask1.getTaskName(), StandardCharsets.UTF_8.toString()) + "&param5=false");
                                //宣教
                                ServiceOutPath serviceOutPath = new ServiceOutPath();
                                serviceOutPath.setParam1(taskId);
                                serviceOutPath.setParam2(patid);
//                                serviceOutPath.setParam3(URLEncoder.encode(ivrTask1.getTaskName(), StandardCharsets.UTF_8.toString()));
                                serviceOutPath.setParam3(ivrTask1.getTaskName());
                                serviceOutPath.setCreateTime(new Date());
                                iServiceOutPathService.insertServiceOutPath(serviceOutPath);
                                String format = String.format("%03X", serviceOutPath.getId());
                                serviceOutPath.setRadix(format);
                                serviceOutPath.setUpdateTime(new Date());
                                iServiceOutPathService.updateServiceOutPath(serviceOutPath);
//                                sendMagParam.setUrl(ip + ":" + req_path + "/outsideChainxj?param1=" + taskId + "&param2=" + patid + "&param3=" + URLEncoder.encode(ivrTask1.getTaskName(), StandardCharsets.UTF_8.toString()) + "&param5=false");
                                sendMagParam.setPhone(serviceSubtask.getPhone());
                                sendMagParam.setUrl(ip + ":" + req_path + "/xj?p=" + format);
                                sendMagParam.setContent("【新华医院】您好,邀请您填写出院宣教调查表,请点击" + sendMagParam.getUrl() + "查看。感谢您配合!");
                            }
                            //短信还需要模板
                            sendMagParam.setContent("【新华医院】+<a href="+sendMagParam.getUrl()+"链接测试</a>");
                            Boolean aBoolean = sendService.sendMsg(sendMagParam);
                            if (!aBoolean) {
                            Map<String, String> req = new HashMap<>();
                            req.put("phone", sendMagParam.getPhone());
                            req.put("content", sendMagParam.getContent());
                            String s = HttpUtil.postJsonRequest(xhsmsPath, new Gson().toJson(req));
                            if (s.equals("true")) {
                                ServiceSubtaskRecord serviceSubtaskRecord = new ServiceSubtaskRecord();
                                serviceSubtaskRecord.setTaskid(serviceSubtask.getTaskid().toString());
                                serviceSubtaskRecord.setSubtaskId(serviceSubtask.getId());
@@ -387,12 +431,55 @@
//                        Boolean aBoolean = sendService.sendMsg(sendMagParam);
                        String url = null;
                        try {
//                            if (type == 1) {
//                                url = ip + ":" + req_path + "/outsideChain?param1=" + taskId + "&param2=" + patid + "&param3=" + URLEncoder.encode(ivrTask1.getTaskName(), StandardCharsets.UTF_8.toString()) + "&param5=false";
//                            } else if (type == 2) {
//                                url = ip + ":" + req_path + "/outsideChainwt?param1=" + taskId + "&param2=" + patid + "&param3=" + URLEncoder.encode(ivrTask1.getTaskName(), StandardCharsets.UTF_8.toString()) + "&param5=false";
//                            } else if (type == 3) {
//                                url = ip + ":" + req_path + "/outsideChainxj?param1=" + taskId + "&param2=" + patid + "&param3=" + URLEncoder.encode(ivrTask1.getTaskName(), StandardCharsets.UTF_8.toString()) + "&param5=false";
//                            }
                            if (type == 1) {
                                url = ip + ":" + req_path + "/outsideChain?param1=" + taskId + "&param2=" + patid + "&param3=" + URLEncoder.encode(ivrTask1.getTaskName(), StandardCharsets.UTF_8.toString()) + "&param5=false";
                                //随访
                                ServiceOutPath serviceOutPath = new ServiceOutPath();
                                serviceOutPath.setParam1(taskId);
                                serviceOutPath.setParam2(patid);
                                serviceOutPath.setCreateTime(new Date());
                                iServiceOutPathService.insertServiceOutPath(serviceOutPath);
                                String format = String.format("%03X", serviceOutPath.getId());
                                serviceOutPath.setRadix(format);
                                serviceOutPath.setUpdateTime(new Date());
                                iServiceOutPathService.updateServiceOutPath(serviceOutPath);
//                                sendMagParam.setUrl(ip + ":" + req_path + "/followvisit/particty?param1=" + taskId + "&param2=" + patid + "&param5=false");
                                url = ip + ":" + req_path + "/sf?p=" + format;
                            } else if (type == 2) {
                                url = ip + ":" + req_path + "/outsideChainwt?param1=" + taskId + "&param2=" + patid + "&param3=" + URLEncoder.encode(ivrTask1.getTaskName(), StandardCharsets.UTF_8.toString()) + "&param5=false";
                                //问券
                                ServiceOutPath serviceOutPath = new ServiceOutPath();
                                serviceOutPath.setParam1(taskId);
                                serviceOutPath.setParam2(patid);
//                                serviceOutPath.setParam3(URLEncoder.encode(ivrTask1.getTaskName(), StandardCharsets.UTF_8.toString()));
                                serviceOutPath.setParam3(ivrTask1.getTaskName());
                                serviceOutPath.setCreateTime(new Date());
                                iServiceOutPathService.insertServiceOutPath(serviceOutPath);
                                String format = String.format("%03X", serviceOutPath.getId());
                                serviceOutPath.setRadix(format);
                                serviceOutPath.setUpdateTime(new Date());
                                iServiceOutPathService.updateServiceOutPath(serviceOutPath);
//                                sendMagParam.setUrl(ip + ":" + req_path + "/outsideChainwt?param1=" + taskId + "&param2=" + patid + "&param3=" + URLEncoder.encode(ivrTask1.getTaskName(), StandardCharsets.UTF_8.toString()) + "&param5=false");
                                url = ip + ":" + req_path + "/wt?p=" + format;
                            } else if (type == 3) {
                                url = ip + ":" + req_path + "/outsideChainxj?param1=" + taskId + "&param2=" + patid + "&param3=" + URLEncoder.encode(ivrTask1.getTaskName(), StandardCharsets.UTF_8.toString()) + "&param5=false";
                                //宣教
                                ServiceOutPath serviceOutPath = new ServiceOutPath();
                                serviceOutPath.setParam1(taskId);
                                serviceOutPath.setParam2(patid);
//                                serviceOutPath.setParam3(URLEncoder.encode(ivrTask1.getTaskName(), StandardCharsets.UTF_8.toString()));
                                serviceOutPath.setParam3(ivrTask1.getTaskName());
                                serviceOutPath.setCreateTime(new Date());
                                iServiceOutPathService.insertServiceOutPath(serviceOutPath);
                                String format = String.format("%03X", serviceOutPath.getId());
                                serviceOutPath.setRadix(format);
                                serviceOutPath.setUpdateTime(new Date());
                                iServiceOutPathService.updateServiceOutPath(serviceOutPath);
                                url = ip + ":" + req_path + "/xj?p=" + format;
                            }
                            String wxCode = getWXCode(serviceSubtask.getSfzh(), url, serviceSubtask.getTaskName(), serviceSubtask.getTaskDesc(), "无");
ruoyi-admin/src/main/java/com/ruoyi/web/controller/smartor/ServiceOutPathController.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,116 @@
package com.ruoyi.web.controller.smartor;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.smartor.domain.ServiceOutPath;
import com.smartor.service.IServiceOutPathService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
 * ä¸»é”®Controller
 *
 * @author lihu
 */
@Api("主键")
@RestController
@RequestMapping("/smartor/outPath")
public class ServiceOutPathController extends BaseController {
    @Autowired
    private IServiceOutPathService serviceOutPathService;
    /**
     * æŸ¥è¯¢ä¸»é”®åˆ—表
     */
    @ApiOperation("查询主键列表")
    //@PreAuthorize("@ss.hasPermi('smartor:path:list')")
    @GetMapping("/list")
    public TableDataInfo list(ServiceOutPath serviceOutPath) {
        startPage();
        List<ServiceOutPath> list = serviceOutPathService.selectServiceOutPathList(serviceOutPath);
        return getDataTable(list);
    }
    /**
     * param就是进制
     *
     * @param param
     * @return
     */
    @PostMapping("/getInfoByParam")
    public AjaxResult param(@Param("param") String param) {
        ServiceOutPath serviceOutPath=new ServiceOutPath();
        serviceOutPath.setRadix(param);
        List<ServiceOutPath> list = serviceOutPathService.selectServiceOutPathList(serviceOutPath);
        ServiceOutPath serviceOutPath1 = list.get(0);
        serviceOutPath1.setId(null);
        serviceOutPath1.setRadix(null);
        if (CollectionUtils.isNotEmpty(list)) return success(serviceOutPath1);
        return success(null);
    }
    /**
     * å¯¼å‡ºä¸»é”®åˆ—表
     */
    @ApiOperation("导出主键列表")
    //@PreAuthorize("@ss.hasPermi('smartor:path:export')")
    @Log(title = "主键", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, ServiceOutPath serviceOutPath) {
        List<ServiceOutPath> list = serviceOutPathService.selectServiceOutPathList(serviceOutPath);
        ExcelUtil<ServiceOutPath> util = new ExcelUtil<ServiceOutPath>(ServiceOutPath.class);
        util.exportExcel(response, list, "主键数据");
    }
    /**
     * èŽ·å–ä¸»é”®è¯¦ç»†ä¿¡æ¯
     */
    @ApiOperation("获取主键详细信息")
    @GetMapping(value = "/getInfo/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id) {
        return success(serviceOutPathService.selectServiceOutPathById(id));
    }
    /**
     * æ–°å¢žä¸»é”®
     */
    @ApiOperation("新增主键")
    @Log(title = "主键", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    public AjaxResult add(@RequestBody ServiceOutPath serviceOutPath) {
        return toAjax(serviceOutPathService.insertServiceOutPath(serviceOutPath));
    }
    /**
     * ä¿®æ”¹ä¸»é”®
     */
    @ApiOperation("修改主键")
    //@PreAuthorize("@ss.hasPermi('smartor:path:edit')")
    @Log(title = "主键", businessType = BusinessType.UPDATE)
    @PostMapping("/edit")
    public AjaxResult edit(@RequestBody ServiceOutPath serviceOutPath) {
        return toAjax(serviceOutPathService.updateServiceOutPath(serviceOutPath));
    }
    /**
     * åˆ é™¤ä¸»é”®
     */
    @ApiOperation("删除主键")
    //@PreAuthorize("@ss.hasPermi('smartor:path:remove')")
    @Log(title = "主键", businessType = BusinessType.DELETE)
    @GetMapping("/remove/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids) {
        return toAjax(serviceOutPathService.deleteServiceOutPathByIds(ids));
    }
}
ruoyi-admin/src/main/java/com/ruoyi/web/test/MQTest.java
@@ -4,12 +4,14 @@
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.file.FileUploadUtils;
import com.ruoyi.common.utils.file.FileUtils;
import com.smartor.domain.ThiedInhospInfo;
import io.swagger.models.auth.In;
import org.junit.Test;
import org.springframework.mock.web.MockMultipartFile;
import org.springframework.web.multipart.MultipartFile;
import java.io.*;
import java.math.BigInteger;
import java.nio.file.Files;
import java.util.ArrayList;
import java.util.List;
@@ -41,13 +43,15 @@
    }
    @Test
    public void bb(){
        for (int j = 0; j < 5; j++) {
            if(j==5-1){
                System.out.println("11111111111111111111");
            }
        }
    public void bb() {
//        int number = 99999; // ç¤ºä¾‹æ•°æ®
//        String format = String.format("%03X", number);
//        System.out.println(format);
//        for (int j = 0; j < 5; j++) {
//            if(j==5-1){
//                System.out.println("11111111111111111111");
//            }
//        }
    }
    public void aa(MultipartFile file) throws IOException {
ruoyi-admin/src/main/resources/application-druid.yml
@@ -11,8 +11,9 @@
        #        username: root
        #        password: 123456
        #        å…¬å¸
        url: jdbc:mysql://192.168.2.9:3308/smartor?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
        #        url: jdbc:mysql://192.168.191.181:3308/smartor?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
        #        url: jdbc:mysql://192.168.2.9:3308/smartor?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
        #        æ–°åŽ
        url: jdbc:mysql://192.168.191.181:3308/smartor?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
        username: smartor
        password: Smartor.2023
        driverClassName: com.mysql.cj.jdbc.Driver
@@ -155,9 +156,8 @@
hangup: http://192.168.2.10:8091/hangup
#新华短信
#请求地址
xhsmsPath: http://183.134.75.159:7862/sms
#新华短信请求地址(这个服务是我们自己写的)
xhsmsPath: http://192.16.4.220:8092/sendSms
#帐号
xhsmsAccount: 911124
#接口密码
ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java
@@ -108,7 +108,7 @@
                // è¿‡æ»¤è¯·æ±‚
                .authorizeRequests()
                // å¯¹äºŽç™»å½•login æ³¨å†Œregister éªŒè¯ç captchaImage å…è®¸åŒ¿åè®¿é—®
                .antMatchers("/login", "/register", "/captchaImage", "/qrcode/generateStaticHtml", "/qrcode/getQRcode", "/qrcode/getFormDate", "/chat", "/system/file/admin/uploadFile", "/smartor/dingtalk/sendNotification", "/patient/read/patientInfo", "/socket", "/API_ESB_Service", "/API_ESB_Service/Run", "/magic/web/**", "/smartor/serviceSubtask/phoneCallBack", "/smartor/serviceSubtask/taskPull", "/smartor/serviceSubtask/phoneCallBackYQ", "/smartor/robot/callstatus", "/smartor/robot/aidialog", "/smartor/robot/cdrinfo", "/getToken", "/smartor/subtaskAnswer/getQuestionCache", "/smartor/subtaskAnswer/saveQuestionCache", "/smartor/servicetask/getScriptInfoByCondition", "/smartor/subtaskAnswer/saveQuestionAnswer","/smartor/import/download","/smartor/serviceSubtask/recordAccept").permitAll()
                .antMatchers("/login", "/register", "/captchaImage", "/qrcode/generateStaticHtml", "/qrcode/getQRcode", "/qrcode/getFormDate", "/chat", "/system/file/admin/uploadFile", "/smartor/dingtalk/sendNotification", "/patient/read/patientInfo", "/socket", "/API_ESB_Service", "/API_ESB_Service/Run", "/magic/web/**", "/smartor/serviceSubtask/phoneCallBack", "/smartor/serviceSubtask/taskPull", "/smartor/serviceSubtask/phoneCallBackYQ", "/smartor/robot/callstatus", "/smartor/robot/aidialog", "/smartor/robot/cdrinfo", "/getToken", "/smartor/subtaskAnswer/getQuestionCache", "/smartor/subtaskAnswer/saveQuestionCache", "/smartor/servicetask/getScriptInfoByCondition", "/smartor/subtaskAnswer/saveQuestionAnswer","/smartor/import/download","/smartor/serviceSubtask/recordAccept","/smartor/outPath/getInfoByParam").permitAll()
                // é™æ€èµ„源,可匿名访问
                .antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll().antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll()
                // é™¤ä¸Šé¢å¤–的所有请求全部需要鉴权认证
ruoyi-quartz/src/main/java/com/ruoyi/quartz/task/RyTask.java
@@ -12,6 +12,7 @@
import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.enums.ServiceFromEnum;
import com.ruoyi.common.utils.DtoConversionUtils;
import com.ruoyi.common.utils.HttpUtil;
import com.ruoyi.common.utils.RSAPublicKeyExample;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.http.HttpUtils;
@@ -28,6 +29,8 @@
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.annotation.Transactional;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.lang.reflect.Type;
@@ -55,6 +58,9 @@
    private IServiceThirdDataService iServiceThirdDataService;
    @Autowired
    private IServiceOutPathService iServiceOutPathService;
    @Autowired
    private IServiceSubtaskAnswerService serviceSubtaskAnswerService;
    @Autowired
@@ -71,6 +77,9 @@
    @Value("${localIP}")
    private String localIP;
    @Value("${xhsmsPath}")
    private String xhsmsPath;
    @Value("${pub_key}")
    private String pub_key;
@@ -332,34 +341,76 @@
                } else if (descByCode.equals("纸质")) {
                    //纸质
                } else if (descByCode.equals("短信")) {
                    //短信
//                        http://localhost:8099/followvisit/particty?param1=3&param2=348
                    //对url中两个参数加密
                    RSAPublicKeyExample rsaPublicKeyExample = new RSAPublicKeyExample();
                    String taskId = rsaPublicKeyExample.encryptedData(ivrTask1.getTaskid().toString(), pub_key);
                    for (ServiceSubtask serviceSubtask : selectServiceSubtaskList) {
                        try {
                        log.error("短信长期任务发送---------进来了吗?{}", serviceSubtask);
                        boolean dateToday = isDateToday(serviceSubtask.getLongSendTime());
                        if (dateToday) {
                            try {
                                //先判断患者是不是还要发送
                                PatArchive patArchive = patArchiveService.selectPatArchiveByPatid(serviceSubtask.getPatid());
                                if (!Objects.isNull(patArchive) && patArchive.getNotrequiredFlag() == "1") {
                                    //不需要发送
                                    serviceSubtask.setResult("error");
                                    serviceSubtask.setRemark(patArchive.getNotrequiredreason());
                                    serviceSubtask.setSendstate(4L);
                                    serviceSubtask.setFinishtime(new Date());
                                    iServiceSubtaskService.insertServiceSubtask(serviceSubtask);
                                    continue;
                                }
                                String patid = rsaPublicKeyExample.encryptedData(serviceSubtask.getPatid().toString(), pub_key);
                                SendMagParam sendMagParam = new SendMagParam();
                                sendMagParam.setType("4");
                                ServiceOutPath serviceOutPath = new ServiceOutPath();
                                serviceOutPath.setParam1(taskId);
                                serviceOutPath.setParam2(patid);
                                serviceOutPath.setParam3(ivrTask1.getTaskName());
                                serviceOutPath.setCreateTime(new Date());
                                iServiceOutPathService.insertServiceOutPath(serviceOutPath);
                                String format = String.format("%03X", serviceOutPath.getId());
                                serviceOutPath.setRadix(format);
                                serviceOutPath.setUpdateTime(new Date());
                                iServiceOutPathService.updateServiceOutPath(serviceOutPath);
                                sendMagParam.setPhone(serviceSubtask.getPhone());
                                sendMagParam.setUrl(ip + ":" + req_path + "/wt?p=" + format);
                                sendMagParam.setContent("【新华医院】您好,邀请您填写出院调查表,请点击" + sendMagParam.getUrl() + "填写。感谢您配合!");
                                Map<String, String> req = new HashMap<>();
                                req.put("phone", sendMagParam.getPhone());
                                req.put("content", sendMagParam.getContent());
                                String isSuccess = HttpUtil.postJsonRequest(xhsmsPath, new Gson().toJson(req));
                                //任务发送记录
                                ServiceSubtaskRecord serviceSubtaskRecord = new ServiceSubtaskRecord();
                                serviceSubtaskRecord.setTaskid(serviceSubtask.getTaskid().toString());
                                serviceSubtaskRecord.setUuid(UUID.randomUUID().toString());
                                serviceSubtaskRecord.setTasktype(serviceSubtask.getType());
                                serviceSubtaskRecord.setPreachform("4");
                                serviceSubtaskRecord.setStartTime(System.currentTimeMillis());
                                serviceSubtaskRecord.setResult("success");
                                if (StringUtils.isNotEmpty(isSuccess) && !isSuccess.equals("true"))
                                    serviceSubtaskRecord.setResult("error");
                                serviceSubtaskRecordService.insertServiceSubtaskRecord(serviceSubtaskRecord);
                            String patid = rsaPublicKeyExample.encryptedData(serviceSubtask.getPatid().toString(), pub_key);
                            SendMagParam sendMagParam = new SendMagParam();
                            sendMagParam.setType("4");
                            sendMagParam.setPhone(serviceSubtask.getPhone());
                            sendMagParam.setUrl(ip + ":" + req_path + "/followvisit/particty?param1=" + taskId + "&param2=" + patid + "&param5=false");
                            Boolean aBoolean = sendService.sendMsg(sendMagParam);
                            //任务发送记录
                            ServiceSubtaskRecord serviceSubtaskRecord = new ServiceSubtaskRecord();
                            serviceSubtaskRecord.setTaskid(serviceSubtask.getTaskid().toString());
                            serviceSubtaskRecord.setUuid(UUID.randomUUID().toString());
                            serviceSubtaskRecord.setTasktype(serviceSubtask.getType());
                            serviceSubtaskRecord.setPreachform("4");
                            serviceSubtaskRecord.setStartTime(System.currentTimeMillis());
                            serviceSubtaskRecord.setResult(aBoolean == true ? "成功" : "失败");
                            serviceSubtaskRecordService.insertServiceSubtaskRecord(serviceSubtaskRecord);
                        } catch (Exception e) {
                            continue;
                                //发送完成后,修改状态
                                serviceSubtask.setSendstate(3L);
                                if (StringUtils.isNotEmpty(isSuccess) && !isSuccess.equals("true")) {
                                    serviceSubtask.setResult("success");
                                } else {
                                    serviceSubtask.setResult("error");
                                    serviceSubtask.setSendstate(5L);
                                    serviceSubtask.setRemark("短信发送失败");
                                }
                                iServiceSubtaskService.updateServiceSubtask(serviceSubtask);
                            } catch (Exception e) {
                                String guid = UUID.randomUUID().toString();
                                log.error("长期任务,发送失败原因:{},{}", e.getMessage(), guid);
                                serviceSubtask.setResult("error");
                                serviceSubtask.setRemark("系统错误");
                                serviceSubtask.setSendstate(5L);
                                serviceSubtask.setFinishtime(new Date());
                                serviceSubtask.setGuid(guid);
                                iServiceSubtaskService.updateServiceSubtask(serviceSubtask);
                            }
                        }
                    }
                } else if (descByCode.equals("公众号")) {
@@ -462,6 +513,32 @@
        Type resultType = new TypeToken<List<ThiedInhospInfo>>() {
        }.getType();
        List<ThiedInhospInfo> thiedInhospInfoList = gson.fromJson(resultArray, resultType);
        // åˆ›å»ºä¸€ä¸ªæ–°æ–‡ä»¶
        String filename = null;
        if (cry.equals("0")) filename = "入院信息" + System.currentTimeMillis();
        if (cry.equals("1")) filename = "出院信息" + System.currentTimeMillis();
        File file = new File("D:\\public\\华卓集成平台数据\\" + filename);
        if (!file.exists()) {
            // å¦‚果文件不存在,则创建新文件
            try {
                if (file.createNewFile()) {
                    System.out.println("成功创建了新文件!");
                } else {
                    System.out.println("失败!文件无法创建!");
                }
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        // å°†æ•°æ®å†™å…¥åˆ°æ–‡ä»¶ä¸­
        try {
            FileWriter writer = new FileWriter(file);
            writer.write(result);
        } catch (IOException e) {
            e.printStackTrace();
        }
        if (CollectionUtils.isNotEmpty(thiedInhospInfoList)) {
            for (ThiedInhospInfo thiedInhospInfo : thiedInhospInfoList) {
                //通过身份证号查询该患者在患者表是否存在
@@ -571,7 +648,9 @@
                inhosp.setPatno(patArchive.getPatientno());
                inhosp.setSerialnum(patMedInhosp.getSerialnum());
                List<PatMedInhosp> patMedInhosps = patMedInhospService.selectPatMedInhospList(inhosp);
                log.error("是否需要更新:{}", patMedInhosps.size());
                if (CollectionUtils.isNotEmpty(patMedInhosps)) {
                    patMedInhosp.setInhospid(patMedInhosps.get(0).getInhospid());
                    patMedInhospService.updatePatMedInhosp(patMedInhosp);
                } else {
                    patMedInhospService.insertPatMedInhosp(patMedInhosp);
smartor/src/main/java/com/smartor/domain/ServiceOutPath.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,66 @@
package com.smartor.domain;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
 * ä¸»é”®å¯¹è±¡ service_out_path
 *
 * @author lihu
 * @date 2024-11-04
 */
@Data
@ApiModel("主键")
public class ServiceOutPath extends BaseEntity {
    private static final long serialVersionUID = 1L;
    /**
     * ä¸»é”®
     */
    @ApiModelProperty("主键")
    private Long id;
    /**
     * taskID
     */
    @ApiModelProperty("taskID")
    @Excel(name = "taskID")
    private String param1;
    /**
     * pid
     */
    @ApiModelProperty("pid")
    @Excel(name = "pid")
    private String param2;
    /**
     * task_name
     */
    @ApiModelProperty("task_name")
    @Excel(name = "task_name")
    private String param3;
    /**
     * flag(前端定的,直接返回false就行)
     */
    @ApiModelProperty("flag(前端定的,直接返回false就行)")
    @Excel(name = "flag(前端定的,直接返回false就行)")
    private String param5 = "false";
    /**
     * åˆ é™¤æ ‡è®°
     */
    @ApiModelProperty(value = "删除标记")
    private String delFlag;
    @ApiModelProperty(value = "进制")
    private String radix;
}
smartor/src/main/java/com/smartor/mapper/ServiceOutPathMapper.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,63 @@
package com.smartor.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
import com.smartor.domain.ServiceOutPath;
/**
 * ä¸»é”®Mapper接口
 *
 * @author lihu
 * @date 2024-11-04
 */
@Mapper
public interface ServiceOutPathMapper {
    /**
     * æŸ¥è¯¢ä¸»é”®
     *
     * @param id ä¸»é”®ä¸»é”®
     * @return ä¸»é”®
     */
    public ServiceOutPath selectServiceOutPathById(Long id);
    /**
     * æŸ¥è¯¢ä¸»é”®åˆ—表
     *
     * @param serviceOutPath ä¸»é”®
     * @return ä¸»é”®é›†åˆ
     */
    public List<ServiceOutPath> selectServiceOutPathList(ServiceOutPath serviceOutPath);
    /**
     * æ–°å¢žä¸»é”®
     *
     * @param serviceOutPath ä¸»é”®
     * @return ç»“æžœ
     */
    public int insertServiceOutPath(ServiceOutPath serviceOutPath);
    /**
     * ä¿®æ”¹ä¸»é”®
     *
     * @param serviceOutPath ä¸»é”®
     * @return ç»“æžœ
     */
    public int updateServiceOutPath(ServiceOutPath serviceOutPath);
    /**
     * åˆ é™¤ä¸»é”®
     *
     * @param id ä¸»é”®ä¸»é”®
     * @return ç»“æžœ
     */
    public int deleteServiceOutPathById(Long id);
    /**
     * æ‰¹é‡åˆ é™¤ä¸»é”®
     *
     * @param ids éœ€è¦åˆ é™¤çš„æ•°æ®ä¸»é”®é›†åˆ
     * @return ç»“æžœ
     */
    public int deleteServiceOutPathByIds(Long[] ids);
}
smartor/src/main/java/com/smartor/service/IServiceOutPathService.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,61 @@
package com.smartor.service;
import java.util.List;
import com.smartor.domain.ServiceOutPath;
/**
 * ä¸»é”®Service接口
 *
 * @author lihu
 * @date 2024-11-04
 */
public interface IServiceOutPathService
{
    /**
     * æŸ¥è¯¢ä¸»é”®
     *
     * @param id ä¸»é”®ä¸»é”®
     * @return ä¸»é”®
     */
    public ServiceOutPath selectServiceOutPathById(Long id);
    /**
     * æŸ¥è¯¢ä¸»é”®åˆ—表
     *
     * @param serviceOutPath ä¸»é”®
     * @return ä¸»é”®é›†åˆ
     */
    public List<ServiceOutPath> selectServiceOutPathList(ServiceOutPath serviceOutPath);
    /**
     * æ–°å¢žä¸»é”®
     *
     * @param serviceOutPath ä¸»é”®
     * @return ç»“æžœ
     */
    public int insertServiceOutPath(ServiceOutPath serviceOutPath);
    /**
     * ä¿®æ”¹ä¸»é”®
     *
     * @param serviceOutPath ä¸»é”®
     * @return ç»“æžœ
     */
    public int updateServiceOutPath(ServiceOutPath serviceOutPath);
    /**
     * æ‰¹é‡åˆ é™¤ä¸»é”®
     *
     * @param ids éœ€è¦åˆ é™¤çš„主键主键集合
     * @return ç»“æžœ
     */
    public int deleteServiceOutPathByIds(Long[] ids);
    /**
     * åˆ é™¤ä¸»é”®ä¿¡æ¯
     *
     * @param id ä¸»é”®ä¸»é”®
     * @return ç»“æžœ
     */
    public int deleteServiceOutPathById(Long id);
}
smartor/src/main/java/com/smartor/service/impl/ServiceOutPathServiceImpl.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,87 @@
package com.smartor.service.impl;
import com.smartor.domain.ServiceOutPath;
import com.smartor.mapper.ServiceOutPathMapper;
import com.smartor.service.IServiceOutPathService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
 * ä¸»é”®Service业务层处理
 *
 * @author lihu
 * @date 2024-11-04
 */
@Service
public class ServiceOutPathServiceImpl implements IServiceOutPathService {
    @Autowired
    private ServiceOutPathMapper serviceOutPathMapper;
    /**
     * æŸ¥è¯¢ä¸»é”®
     *
     * @param id ä¸»é”®ä¸»é”®
     * @return ä¸»é”®
     */
    @Override
    public ServiceOutPath selectServiceOutPathById(Long id) {
        return serviceOutPathMapper.selectServiceOutPathById(id);
    }
    /**
     * æŸ¥è¯¢ä¸»é”®åˆ—表
     *
     * @param serviceOutPath ä¸»é”®
     * @return ä¸»é”®
     */
    @Override
    public List<ServiceOutPath> selectServiceOutPathList(ServiceOutPath serviceOutPath) {
        return serviceOutPathMapper.selectServiceOutPathList(serviceOutPath);
    }
    /**
     * æ–°å¢žä¸»é”®
     *
     * @param serviceOutPath ä¸»é”®
     * @return ç»“æžœ
     */
    @Override
    public int insertServiceOutPath(ServiceOutPath serviceOutPath) {
        return serviceOutPathMapper.insertServiceOutPath(serviceOutPath);
    }
    /**
     * ä¿®æ”¹ä¸»é”®
     *
     * @param serviceOutPath ä¸»é”®
     * @return ç»“æžœ
     */
    @Override
    public int updateServiceOutPath(ServiceOutPath serviceOutPath) {
        return serviceOutPathMapper.updateServiceOutPath(serviceOutPath);
    }
    /**
     * æ‰¹é‡åˆ é™¤ä¸»é”®
     *
     * @param ids éœ€è¦åˆ é™¤çš„主键主键
     * @return ç»“æžœ
     */
    @Override
    public int deleteServiceOutPathByIds(Long[] ids) {
        return serviceOutPathMapper.deleteServiceOutPathByIds(ids);
    }
    /**
     * åˆ é™¤ä¸»é”®ä¿¡æ¯
     *
     * @param id ä¸»é”®ä¸»é”®
     * @return ç»“æžœ
     */
    @Override
    public int deleteServiceOutPathById(Long id) {
        return serviceOutPathMapper.deleteServiceOutPathById(id);
    }
}
smartor/src/main/resources/mapper/smartor/ServiceOutPathMapper.xml
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,137 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.smartor.mapper.ServiceOutPathMapper">
    <resultMap type="com.smartor.domain.ServiceOutPath" id="ServiceOutPathResult">
        <result property="id" column="id"/>
        <result property="param1" column="param1"/>
        <result property="param2" column="param2"/>
        <result property="param3" column="param3"/>
        <result property="param5" column="param5"/>
        <result property="createTime" column="create_time"/>
        <result property="updateTime" column="update_time"/>
        <result property="delFlag" column="del_flag"/>
        <result property="radix" column="radix"/>
    </resultMap>
    <sql id="selectServiceOutPathVo">
        select id,
               param1,
               param2,
               param3,
               param5,
               create_time,
               update_time,
               radix,
               del_flag
        from service_out_path
    </sql>
    <select id="selectServiceOutPathList" parameterType="com.smartor.domain.ServiceOutPath"
            resultMap="ServiceOutPathResult">
        <include refid="selectServiceOutPathVo"/>
        <where>
            <if test="param1 != null ">
                and param1 = #{param1}
            </if>
            <if test="param2 != null ">
                and param2 = #{param2}
            </if>
            <if test="param3 != null  and param3 != ''">
                and param3 = #{param3}
            </if>
            <if test="param5 != null  and param5 != ''">
                and param5 = #{param5}
            </if>
            <if test="createTime != null">
                and create_time = #{createTime}
            </if>
            <if test="param5 != null  and param5 != ''">
                and param5 = #{param5}
            </if>
            <if test="radix != null  and radix != ''">
                and radix = #{radix}
            </if>
        </where>
    </select>
    <select id="selectServiceOutPathById" parameterType="Long"
            resultMap="ServiceOutPathResult">
        <include refid="selectServiceOutPathVo"/>
        where id = #{id}
    </select>
    <insert id="insertServiceOutPath" parameterType="com.smartor.domain.ServiceOutPath" useGeneratedKeys="true"
            keyProperty="id">
        insert into service_out_path
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="param1 != null">param1,
            </if>
            <if test="param2 != null">param2,
            </if>
            <if test="param3 != null">param3,
            </if>
            <if test="param5 != null">param5,
            </if>
            <if test="radix != null">radix,
            </if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="param1 != null">#{param1},
            </if>
            <if test="param2 != null">#{param2},
            </if>
            <if test="param3 != null">#{param3},
            </if>
            <if test="param5 != null">#{param5},
            </if>
            <if test="radix != null">#{radix},
            </if>
        </trim>
    </insert>
    <update id="updateServiceOutPath" parameterType="com.smartor.domain.ServiceOutPath">
        update service_out_path
        <trim prefix="SET" suffixOverrides=",">
            <if test="param1 != null">param1 =
                #{param1},
            </if>
            <if test="param2 != null">param2 =
                #{param2},
            </if>
            <if test="param3 != null">param3 =
                #{param3},
            </if>
            <if test="param5 != null">param5 =
                #{param5},
            </if>
            <if test="radix != null">radix =
                #{radix},
            </if>
        </trim>
        where id = #{id}
    </update>
    <update id="deleteServiceOutPathById" parameterType="Long">
        update service_out_path
        <trim prefix="SET" suffixOverrides=",">
            del_flag =1
        </trim>
        where id = #{id}
    </update>
    <update id="deleteServiceOutPathByIds" parameterType="String">
        update service_out_path
        <trim prefix="SET" suffixOverrides=",">
            del_flag =1
        </trim>
        where id in
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </update>
</mapper>
smartor/src/main/resources/mapper/smartor/ServiceTaskMapper.xml
@@ -52,6 +52,7 @@
        <result property="compensateDate" column="compensate_date"/>
        <result property="leavehospitaldistrictcode" column="leavehospitaldistrictcode"/>
        <result property="leavehospitaldistrictname" column="leavehospitaldistrictname"/>
        <result property="compensateDate" column="compensate_date"/>
    </resultMap>
    <sql id="selectServiceTaskVo">
@@ -147,6 +148,7 @@
            <if test="libtemplatename != null  and libtemplatename != ''">and libtemplatename = #{libtemplatename}</if>
            <if test="createBy != null  and createBy != ''">and create_by = #{createBy}</if>
            <if test="sendState != null  ">and send_state = #{sendState}</if>
            <if test="compensateDate != null  ">and compensate_date = #{compensateDate}</if>
            <if test="leavehospitaldistrictname != null  ">and leavehospitaldistrictname =
                #{leavehospitaldistrictname}
            </if>
@@ -228,7 +230,8 @@
            <if test="jsy != null  and jsy != ''">jsy,</if>
            <if test="leavehospitaldistrictname != null  ">leavehospitaldistrictname,</if>
            <if test="leavehospitaldistrictcode != null  ">leavehospitaldistrictcode,</if>
            <if test="compensateDate != null  and compensateDate != ''">compensate_date</if>
            <if test="compensateDate != null  and compensateDate != ''">compensate_date,</if>
            <if test="compensateDate != null  ">compensate_date,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="taskName != null">#{taskName},</if>
@@ -277,6 +280,7 @@
            <if test="leavehospitaldistrictname != null  ">#{leavehospitaldistrictname},</if>
            <if test="leavehospitaldistrictcode != null  ">#{leavehospitaldistrictcode},</if>
            <if test="compensateDate != null  and compensateDate != ''">#{compensateDate}</if>
            <if test="compensateDate != null  ">#{compensateDate},</if>
        </trim>
    </insert>
@@ -331,6 +335,7 @@
            <if test="leavehospitaldistrictcode != null  ">leavehospitaldistrictcode = #{leavehospitaldistrictcode},
            </if>
            <if test="compensateDate != null  and compensateDate != ''">compensate_date = #{compensateDate}</if>
            <if test="compensateDate != null  ">compensate_date = #{compensateDate}</if>
        </trim>
        where taskid = #{taskid}
    </update>