| | |
| | | import com.ruoyi.common.core.domain.entity.SysDept; |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | import com.ruoyi.common.core.domain.model.LoginUser; |
| | | import com.ruoyi.common.utils.DateUtils; |
| | | import com.ruoyi.common.utils.DtoConversionUtils; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.common.utils.*; |
| | | import com.smartor.common.RandomStringGenerator; |
| | | import com.smartor.domain.*; |
| | | import com.smartor.mapper.*; |
| | | import com.smartor.service.IServiceOutPathService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.commons.collections4.CollectionUtils; |
| | | import org.apache.commons.lang3.ObjectUtils; |
| | |
| | | |
| | | @Autowired |
| | | private ServiceSubtaskMapper serviceSubtaskMapper; |
| | | |
| | | @Autowired |
| | | private SysUserDeptMapper sysUserDeptMapper; |
| | | private IServiceOutPathService iServiceOutPathService; |
| | | |
| | | @Value("${createTaskServiceType}") |
| | | private List<String> createTaskServiceType; |
| | | |
| | | @Value("${localIP}") |
| | | private String localIP; |
| | | |
| | | @Value("${req_path}") |
| | | private String req_path; |
| | | |
| | | @Value("${pub_key}") |
| | | private String pub_key; |
| | | |
| | | //记录长期任务基础信息 |
| | | List<IvrLibaTemplate> libaTemplates = new ArrayList<>(); |
| | |
| | | serviceSubtask1.setSendstate(4L); |
| | | serviceSubtask1.setRemark("患者再入院"); |
| | | serviceSubtask1.setResult("error"); |
| | | // serviceSubtask1.setFinishtime(new Date()); |
| | | Boolean aBoolean = serviceSubtaskMapper.updateServiceSubtask(serviceSubtask1); |
| | | if (aBoolean) i = 1; |
| | | } else { |
| | |
| | | } |
| | | } |
| | | } |
| | | //生成外链地址 |
| | | String outPath = null; |
| | | if (serviceTask.getType().equals("1")) |
| | | outPath = getOutPath(serviceSubtask.getPhone(), serviceSubtask.getTaskid(), serviceSubtask.getTaskName(), serviceSubtask.getPatid(), 1); |
| | | else if (serviceTask.getType().equals("2")) |
| | | outPath = getOutPath(serviceSubtask.getPhone(), serviceSubtask.getTaskid(), serviceSubtask.getTaskName(), serviceSubtask.getPatid(), 2); |
| | | else if (serviceTask.getType().equals("3")) |
| | | outPath = getOutPath(serviceSubtask.getPhone(), serviceSubtask.getTaskid(), serviceSubtask.getTaskName(), serviceSubtask.getPatid(), 3); |
| | | serviceSubtask.setOutPath(outPath); |
| | | |
| | | i = serviceSubtaskMapper.insertServiceSubtask(serviceSubtask); |
| | | if (i == 1) { |
| | | //将check_flag改成1(已处理) |
| | |
| | | return calendar.getTime(); |
| | | } |
| | | |
| | | |
| | | private String getOutPath(String phone, Long tid, String taskName, Long pId, Integer type) { |
| | | //对url中两个参数加密 |
| | | RSAPublicKeyExample rsaPublicKeyExample = new RSAPublicKeyExample(); |
| | | String taskId = rsaPublicKeyExample.encryptedData(tid.toString(), pub_key); |
| | | String outpath = null; |
| | | try { |
| | | String patid = rsaPublicKeyExample.encryptedData(pId.toString(), pub_key); |
| | | SendMagParam sendMagParam = new SendMagParam(); |
| | | sendMagParam.setType("4"); |
| | | if (type == 1) { |
| | | //随访 |
| | | ServiceOutPath serviceOutPath = new ServiceOutPath(); |
| | | serviceOutPath.setParam1(taskId); |
| | | serviceOutPath.setParam2(patid); |
| | | serviceOutPath.setCreateTime(new Date()); |
| | | serviceOutPath.setType(1); |
| | | iServiceOutPathService.insertServiceOutPath(serviceOutPath); |
| | | //转成16进制 |
| | | String format = String.format("%03X", serviceOutPath.getId()) + RandomStringGenerator.generateRandomString(); |
| | | serviceOutPath.setRadix(format); |
| | | outpath = localIP + ":" + req_path + "/sf?p=" + format; |
| | | serviceOutPath.setUpdateTime(new Date()); |
| | | iServiceOutPathService.updateServiceOutPath(serviceOutPath); |
| | | sendMagParam.setPhone(phone); |
| | | sendMagParam.setUrl(outpath); |
| | | sendMagParam.setContent("您好,邀请您填写出院随访调查表,请点击" + sendMagParam.getUrl() + " 填写。感谢您配合!"); |
| | | } else if (type == 2) { |
| | | //问券(问题) |
| | | ServiceOutPath serviceOutPath = new ServiceOutPath(); |
| | | serviceOutPath.setParam1(taskId); |
| | | serviceOutPath.setParam2(patid); |
| | | serviceOutPath.setParam3(taskName); |
| | | serviceOutPath.setCreateTime(new Date()); |
| | | serviceOutPath.setType(2); |
| | | iServiceOutPathService.insertServiceOutPath(serviceOutPath); |
| | | String format = String.format("%03X", serviceOutPath.getId()) + RandomStringGenerator.generateRandomString(); |
| | | serviceOutPath.setRadix(format); |
| | | serviceOutPath.setUpdateTime(new Date()); |
| | | outpath = localIP + ":" + req_path + "/wt?p=" + format; |
| | | iServiceOutPathService.updateServiceOutPath(serviceOutPath); |
| | | |
| | | // sendMagParam.setUrl(ip + ":" + req_path + "/outsideChainwt?param1=" + taskId + "¶m2=" + patid + "¶m3=" + URLEncoder.encode(ivrTask1.getTaskName(), StandardCharsets.UTF_8.toString()) + "¶m5=false"); |
| | | sendMagParam.setPhone(phone); |
| | | sendMagParam.setUrl(outpath); |
| | | sendMagParam.setContent("您好,邀请您填写出院调查表,请点击" + sendMagParam.getUrl() + " 填写。感谢您配合!"); |
| | | log.info("您好,邀请您填写出院调查表,请点击,{}", sendMagParam.getUrl()); |
| | | } else if (type == 3) { |
| | | //宣教 |
| | | ServiceOutPath serviceOutPath = new ServiceOutPath(); |
| | | serviceOutPath.setParam1(taskId); |
| | | serviceOutPath.setParam2(patid); |
| | | serviceOutPath.setParam3(taskName); |
| | | serviceOutPath.setCreateTime(new Date()); |
| | | serviceOutPath.setType(3); |
| | | iServiceOutPathService.insertServiceOutPath(serviceOutPath); |
| | | String format = String.format("%03X", serviceOutPath.getId()) + RandomStringGenerator.generateRandomString(); |
| | | serviceOutPath.setRadix(format); |
| | | serviceOutPath.setUpdateTime(new Date()); |
| | | outpath = localIP + ":" + req_path + "/xj?p=" + format; |
| | | iServiceOutPathService.updateServiceOutPath(serviceOutPath); |
| | | sendMagParam.setPhone(phone); |
| | | sendMagParam.setUrl(outpath); |
| | | sendMagParam.setContent("您好,邀请您填写出院宣教调查表,请点击" + sendMagParam.getUrl() + "查看。感谢您配合!"); |
| | | log.info("-----------sendMagParam的值为:{}", sendMagParam); |
| | | } |
| | | } catch (Exception e) { |
| | | log.error("生成失败了:{}", e.getMessage()); |
| | | } |
| | | return outpath; |
| | | } |
| | | |
| | | } |