diff --git a/postdischarge-admin/src/main/resources/application.yml b/postdischarge-admin/src/main/resources/application.yml index 32d6f112..c86e6b87 100644 --- a/postdischarge-admin/src/main/resources/application.yml +++ b/postdischarge-admin/src/main/resources/application.yml @@ -239,11 +239,9 @@ aliyun-sms: # 地域ID regionId: cn-qingdao # 阿里云登录确认验证模板-短信签名 - signName: 新医路 - # 阿里云登录确认验证模板-模板CODE - templateCode: SMS_152466667 - # 阿里云登录确认验证模板-模板内容 - templateContent: 验证码${code},您正在登录,若非本人操作,请勿泄露。 + signName: 山东新医路信息科技有限公司 + # 任务执行回调地址--正式 + callBackUrl: http://47.104.245.3:8105/api/taskMessageBack # 阿里云参数配置 aliyun-sms2: @@ -258,11 +256,9 @@ aliyun-sms2: # 地域ID regionId: cn-qingdao # 阿里云登录确认验证模板-短信签名 - signName: 山东新医路信息科技 - # 阿里云登录确认验证模板-模板CODE - templateCode: SMS_499195589 - # 阿里云登录确认验证模板-模板内容 - templateContent: 尊敬的用户,馨医健康致电您未成功接通,请放心接听。也可通过馨医健康小程序消息中心查看相关信息; + signName: 河口区第二人民医院 + # 任务执行回调地址--正式 + callBackUrl: http://47.104.245.3:8105/api/taskMessageBack # 小程序首页路径 applet-page-config: diff --git a/postdischarge-manage/src/main/java/com/xinelu/manage/service/batchsendtaskinfo/impl/BatchSendTaskInfoServiceImpl.java b/postdischarge-manage/src/main/java/com/xinelu/manage/service/batchsendtaskinfo/impl/BatchSendTaskInfoServiceImpl.java index 202c81a4..6f5d92fc 100644 --- a/postdischarge-manage/src/main/java/com/xinelu/manage/service/batchsendtaskinfo/impl/BatchSendTaskInfoServiceImpl.java +++ b/postdischarge-manage/src/main/java/com/xinelu/manage/service/batchsendtaskinfo/impl/BatchSendTaskInfoServiceImpl.java @@ -8,7 +8,6 @@ import com.aliyuncs.dysmsapi.model.v20170525.SendSmsResponse; import com.aliyuncs.exceptions.ClientException; import com.aliyuncs.profile.DefaultProfile; import com.aliyuncs.profile.IClientProfile; -import com.xinelu.common.config.AliYunSmsConfig; import com.xinelu.common.config.AliYunSmsTwoConfig; import com.xinelu.common.constant.Constants; import com.xinelu.common.core.domain.AjaxResult; @@ -99,8 +98,6 @@ public class BatchSendTaskInfoServiceImpl implements IBatchSendTaskInfoService { @Value("${aiob.callBackUrl}") private String callBackUrl; @Resource - private AliYunSmsConfig aliyunSmsConfig; - @Resource private BatchSendTaskLabelInfoMapper batchSendTaskLabelInfoMapper; @Resource private ScriptInfoMapper scriptInfoMapper; @@ -191,8 +188,10 @@ public class BatchSendTaskInfoServiceImpl implements IBatchSendTaskInfoService { if (Objects.isNull(agency) || StringUtils.isEmpty(agency.getNodeType())) { return AjaxResult.error("该账号无所属医院信息,请先配置该账号所属的医院信息!"); } + //流水号 String sn = "batch_" + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss")); List stringList = new ArrayList<>(); + //遍历塞值 for (BatchSendTaskInfo batchSendTaskInfo : list) { batchSendTaskInfo.setSn(sn); batchSendTaskInfo.setHospitalAgencyId(agency.getId()); @@ -207,6 +206,7 @@ public class BatchSendTaskInfoServiceImpl implements IBatchSendTaskInfoService { if (StringUtils.isBlank(batchSendTaskInfo.getTeamName())) { batchSendTaskInfo.setTeamName("无"); } + //取标签 if (StringUtils.isNotBlank(batchSendTaskInfo.getPhysicalExaminationSummary())) { String[] strings = BracketExtractor.extractToArray(batchSendTaskInfo.getPhysicalExaminationSummary()); stringList.addAll(Arrays.asList(strings)); @@ -241,7 +241,7 @@ public class BatchSendTaskInfoServiceImpl implements IBatchSendTaskInfoService { //新增批量推送任务记录 BatchSendTaskRecordInfo batchSendTaskRecordInfo = new BatchSendTaskRecordInfo(); batchSendTaskRecordInfo.setBatchTaskName(batchSendTaskRecordDto.getManageRouteName()); - //新增批量推送任务记录编号 + //新增批量推送任务记录编号 上传平台数据的任务名称 String batchTaskNumber = null; if (batchSendTaskRecordDto.getBatchTaskSource().equals(BillSourceEnum.MESSAGE.getInfo())) { batchTaskNumber = "hkqdermyy_message_batch" + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss")); @@ -283,9 +283,8 @@ public class BatchSendTaskInfoServiceImpl implements IBatchSendTaskInfoService { } List signPatientManageRoutes = new ArrayList<>(); List signPatientManageRouteNodes = new ArrayList<>(); - List shortMessageSendRecords = new ArrayList<>(); String[] keys = new String[0]; - if (batchSendTaskRecordDto.getBatchTaskSource().equals(BillSourceEnum.TELEPHONE)) { + if (batchSendTaskRecordDto.getBatchTaskSource().equals(BillSourceEnum.TELEPHONE.getInfo())) { String s1 = scriptInfoMapper.selectVariablesByRobotPublishId(batchSendTaskRecordDto.getRobotPublishId()); keys = s1.split("\\|"); } @@ -337,15 +336,6 @@ public class BatchSendTaskInfoServiceImpl implements IBatchSendTaskInfoService { signPatientManageRouteNode.setCreateBy(SecurityUtils.getUsername()); signPatientManageRouteNode.setCreateTime(LocalDateTime.now()); signPatientManageRouteNodes.add(signPatientManageRouteNode); - //短信发送记录表 - ShortMessageSendRecord shortMessageSendRecord = new ShortMessageSendRecord(); - shortMessageSendRecord.setMessageType(ShortMessageTypeEnum.COMMON.getInfo()); - shortMessageSendRecord.setPatientPhone(batchSendTaskInfo.getPatientPhone()); - shortMessageSendRecord.setSendTime(LocalDateTime.now()); - shortMessageSendRecord.setMessageTemplateId(batchSendTaskRecordDto.getMessageTemplateCode()); - shortMessageSendRecord.setMessageNodeContent(batchSendTaskRecordDto.getMessageNodeContent()); - shortMessageSendRecord.setCreateTime(LocalDateTime.now()); - shortMessageSendRecords.add(shortMessageSendRecord); //电话变量 if (batchSendTaskRecordDto.getBatchTaskSource().equals(BillSourceEnum.TELEPHONE.getInfo())) { for (String key : keys) { @@ -362,6 +352,7 @@ public class BatchSendTaskInfoServiceImpl implements IBatchSendTaskInfoService { batchSendTaskVariableInfo.setBatchSendTaskRecordId(batchSendTaskRecordInfo.getId()); batchSendTaskVariableInfo.setBatchSendTaskId(batchSendTaskInfo.getId()); batchSendTaskVariableInfo.setVariable(key); + // 设置可以访问私有变量 field.setAccessible(true); batchSendTaskVariableInfo.setVariableAttribute(field.get(batchSendTaskInfo).toString()); batchSendTaskVariableInfo.setCreateBy(SecurityUtils.getUsername()); @@ -370,20 +361,26 @@ public class BatchSendTaskInfoServiceImpl implements IBatchSendTaskInfoService { } } } + //新增节点表主表 signPatientManageRouteMapper.insertBatch(signPatientManageRoutes); + //筛如节点表主表id for (int i = 0; i < signPatientManageRouteNodes.size(); i++) { signPatientManageRouteNodes.get(i).setManageRouteId(signPatientManageRoutes.get(i).getId()); } + //新增节点明细表 signPatientManageRouteNodeMapper.insertBatch(signPatientManageRouteNodes); + //新增变量表 if (CollectionUtils.isNotEmpty(batchSendTaskVariableInfos)) { batchSendTaskVariableInfoMapper.insertBatchSendTaskVariableInfos(batchSendTaskVariableInfos); } + //电话推送 if (batchSendTaskRecordDto.getBatchTaskSource().equals(BillSourceEnum.TELEPHONE.getInfo())) { + //获取医院拨打时间限制 SysUser sysUser = sysUserMapper.selectUserById(SecurityUtils.getUserId()); Agency agency = agencyMapper.selectAgencyById(sysUser.getHospitalAgencyId()); DialTime dialTime = patientInfoImportMainMapper.selectDialTimeById(agency.getId()); - LocalTime localStartTime = null; - LocalTime localEndTime = null; + LocalTime localStartTime; + LocalTime localEndTime; LocalTime dateStartTime; LocalTime dateEndTime; if (Objects.nonNull(dialTime)) { @@ -492,7 +489,6 @@ public class BatchSendTaskInfoServiceImpl implements IBatchSendTaskInfoService { if (!aBoolean) { return AjaxResult.error("短信上传失败"); } - //发送记录批量 log.info("创建批量短信推送任务执行完成......"); return AjaxResult.success("短信上传成功"); } @@ -537,8 +533,8 @@ public class BatchSendTaskInfoServiceImpl implements IBatchSendTaskInfoService { System.setProperty("sun.net.client.defaultReadTimeout", "10000"); // 初始化acsClient,暂不支持region化 - IClientProfile profile = DefaultProfile.getProfile(aliyunSmsConfig.getRegionId(), aliyunSmsConfig.getAccessKeyId(), aliyunSmsConfig.getAccessKeySecret()); - DefaultProfile.addEndpoint(aliyunSmsConfig.getRegionId(), aliyunSmsConfig.getProduct(), aliyunSmsConfig.getDomain()); + IClientProfile profile = DefaultProfile.getProfile(aliYunSmsTwoConfig.getRegionId(), aliYunSmsTwoConfig.getAccessKeyId(), aliYunSmsTwoConfig.getAccessKeySecret()); + DefaultProfile.addEndpoint(aliYunSmsTwoConfig.getRegionId(), aliYunSmsTwoConfig.getProduct(), aliYunSmsTwoConfig.getDomain()); IAcsClient acsClient = new DefaultAcsClient(profile); // 组装请求对象