批量任务

This commit is contained in:
zhangheng 2026-04-29 17:09:16 +08:00
parent 07c54ef256
commit d7080dd8f3
2 changed files with 22 additions and 30 deletions

View File

@ -239,11 +239,9 @@ aliyun-sms:
# 地域ID # 地域ID
regionId: cn-qingdao regionId: cn-qingdao
# 阿里云登录确认验证模板-短信签名 # 阿里云登录确认验证模板-短信签名
signName: 新医路 signName: 山东新医路信息科技有限公司
# 阿里云登录确认验证模板-模板CODE # 任务执行回调地址--正式
templateCode: SMS_152466667 callBackUrl: http://47.104.245.3:8105/api/taskMessageBack
# 阿里云登录确认验证模板-模板内容
templateContent: 验证码${code},您正在登录,若非本人操作,请勿泄露。
# 阿里云参数配置 # 阿里云参数配置
aliyun-sms2: aliyun-sms2:
@ -258,11 +256,9 @@ aliyun-sms2:
# 地域ID # 地域ID
regionId: cn-qingdao regionId: cn-qingdao
# 阿里云登录确认验证模板-短信签名 # 阿里云登录确认验证模板-短信签名
signName: 山东新医路信息科技 signName: 河口区第二人民医院
# 阿里云登录确认验证模板-模板CODE # 任务执行回调地址--正式
templateCode: SMS_499195589 callBackUrl: http://47.104.245.3:8105/api/taskMessageBack
# 阿里云登录确认验证模板-模板内容
templateContent: 尊敬的用户,馨医健康致电您未成功接通,请放心接听。也可通过馨医健康小程序消息中心查看相关信息;
# 小程序首页路径 # 小程序首页路径
applet-page-config: applet-page-config:

View File

@ -8,7 +8,6 @@ import com.aliyuncs.dysmsapi.model.v20170525.SendSmsResponse;
import com.aliyuncs.exceptions.ClientException; import com.aliyuncs.exceptions.ClientException;
import com.aliyuncs.profile.DefaultProfile; import com.aliyuncs.profile.DefaultProfile;
import com.aliyuncs.profile.IClientProfile; import com.aliyuncs.profile.IClientProfile;
import com.xinelu.common.config.AliYunSmsConfig;
import com.xinelu.common.config.AliYunSmsTwoConfig; import com.xinelu.common.config.AliYunSmsTwoConfig;
import com.xinelu.common.constant.Constants; import com.xinelu.common.constant.Constants;
import com.xinelu.common.core.domain.AjaxResult; import com.xinelu.common.core.domain.AjaxResult;
@ -99,8 +98,6 @@ public class BatchSendTaskInfoServiceImpl implements IBatchSendTaskInfoService {
@Value("${aiob.callBackUrl}") @Value("${aiob.callBackUrl}")
private String callBackUrl; private String callBackUrl;
@Resource @Resource
private AliYunSmsConfig aliyunSmsConfig;
@Resource
private BatchSendTaskLabelInfoMapper batchSendTaskLabelInfoMapper; private BatchSendTaskLabelInfoMapper batchSendTaskLabelInfoMapper;
@Resource @Resource
private ScriptInfoMapper scriptInfoMapper; private ScriptInfoMapper scriptInfoMapper;
@ -191,8 +188,10 @@ public class BatchSendTaskInfoServiceImpl implements IBatchSendTaskInfoService {
if (Objects.isNull(agency) || StringUtils.isEmpty(agency.getNodeType())) { if (Objects.isNull(agency) || StringUtils.isEmpty(agency.getNodeType())) {
return AjaxResult.error("该账号无所属医院信息,请先配置该账号所属的医院信息!"); return AjaxResult.error("该账号无所属医院信息,请先配置该账号所属的医院信息!");
} }
//流水号
String sn = "batch_" + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss")); String sn = "batch_" + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss"));
List<String> stringList = new ArrayList<>(); List<String> stringList = new ArrayList<>();
//遍历塞值
for (BatchSendTaskInfo batchSendTaskInfo : list) { for (BatchSendTaskInfo batchSendTaskInfo : list) {
batchSendTaskInfo.setSn(sn); batchSendTaskInfo.setSn(sn);
batchSendTaskInfo.setHospitalAgencyId(agency.getId()); batchSendTaskInfo.setHospitalAgencyId(agency.getId());
@ -207,6 +206,7 @@ public class BatchSendTaskInfoServiceImpl implements IBatchSendTaskInfoService {
if (StringUtils.isBlank(batchSendTaskInfo.getTeamName())) { if (StringUtils.isBlank(batchSendTaskInfo.getTeamName())) {
batchSendTaskInfo.setTeamName(""); batchSendTaskInfo.setTeamName("");
} }
//取标签
if (StringUtils.isNotBlank(batchSendTaskInfo.getPhysicalExaminationSummary())) { if (StringUtils.isNotBlank(batchSendTaskInfo.getPhysicalExaminationSummary())) {
String[] strings = BracketExtractor.extractToArray(batchSendTaskInfo.getPhysicalExaminationSummary()); String[] strings = BracketExtractor.extractToArray(batchSendTaskInfo.getPhysicalExaminationSummary());
stringList.addAll(Arrays.asList(strings)); stringList.addAll(Arrays.asList(strings));
@ -241,7 +241,7 @@ public class BatchSendTaskInfoServiceImpl implements IBatchSendTaskInfoService {
//新增批量推送任务记录 //新增批量推送任务记录
BatchSendTaskRecordInfo batchSendTaskRecordInfo = new BatchSendTaskRecordInfo(); BatchSendTaskRecordInfo batchSendTaskRecordInfo = new BatchSendTaskRecordInfo();
batchSendTaskRecordInfo.setBatchTaskName(batchSendTaskRecordDto.getManageRouteName()); batchSendTaskRecordInfo.setBatchTaskName(batchSendTaskRecordDto.getManageRouteName());
//新增批量推送任务记录编号 //新增批量推送任务记录编号 上传平台数据的任务名称
String batchTaskNumber = null; String batchTaskNumber = null;
if (batchSendTaskRecordDto.getBatchTaskSource().equals(BillSourceEnum.MESSAGE.getInfo())) { if (batchSendTaskRecordDto.getBatchTaskSource().equals(BillSourceEnum.MESSAGE.getInfo())) {
batchTaskNumber = "hkqdermyy_message_batch" + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss")); batchTaskNumber = "hkqdermyy_message_batch" + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss"));
@ -283,9 +283,8 @@ public class BatchSendTaskInfoServiceImpl implements IBatchSendTaskInfoService {
} }
List<SignPatientManageRoute> signPatientManageRoutes = new ArrayList<>(); List<SignPatientManageRoute> signPatientManageRoutes = new ArrayList<>();
List<SignPatientManageRouteNode> signPatientManageRouteNodes = new ArrayList<>(); List<SignPatientManageRouteNode> signPatientManageRouteNodes = new ArrayList<>();
List<ShortMessageSendRecord> shortMessageSendRecords = new ArrayList<>();
String[] keys = new String[0]; String[] keys = new String[0];
if (batchSendTaskRecordDto.getBatchTaskSource().equals(BillSourceEnum.TELEPHONE)) { if (batchSendTaskRecordDto.getBatchTaskSource().equals(BillSourceEnum.TELEPHONE.getInfo())) {
String s1 = scriptInfoMapper.selectVariablesByRobotPublishId(batchSendTaskRecordDto.getRobotPublishId()); String s1 = scriptInfoMapper.selectVariablesByRobotPublishId(batchSendTaskRecordDto.getRobotPublishId());
keys = s1.split("\\|"); keys = s1.split("\\|");
} }
@ -337,15 +336,6 @@ public class BatchSendTaskInfoServiceImpl implements IBatchSendTaskInfoService {
signPatientManageRouteNode.setCreateBy(SecurityUtils.getUsername()); signPatientManageRouteNode.setCreateBy(SecurityUtils.getUsername());
signPatientManageRouteNode.setCreateTime(LocalDateTime.now()); signPatientManageRouteNode.setCreateTime(LocalDateTime.now());
signPatientManageRouteNodes.add(signPatientManageRouteNode); 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())) { if (batchSendTaskRecordDto.getBatchTaskSource().equals(BillSourceEnum.TELEPHONE.getInfo())) {
for (String key : keys) { for (String key : keys) {
@ -362,6 +352,7 @@ public class BatchSendTaskInfoServiceImpl implements IBatchSendTaskInfoService {
batchSendTaskVariableInfo.setBatchSendTaskRecordId(batchSendTaskRecordInfo.getId()); batchSendTaskVariableInfo.setBatchSendTaskRecordId(batchSendTaskRecordInfo.getId());
batchSendTaskVariableInfo.setBatchSendTaskId(batchSendTaskInfo.getId()); batchSendTaskVariableInfo.setBatchSendTaskId(batchSendTaskInfo.getId());
batchSendTaskVariableInfo.setVariable(key); batchSendTaskVariableInfo.setVariable(key);
// 设置可以访问私有变量
field.setAccessible(true); field.setAccessible(true);
batchSendTaskVariableInfo.setVariableAttribute(field.get(batchSendTaskInfo).toString()); batchSendTaskVariableInfo.setVariableAttribute(field.get(batchSendTaskInfo).toString());
batchSendTaskVariableInfo.setCreateBy(SecurityUtils.getUsername()); batchSendTaskVariableInfo.setCreateBy(SecurityUtils.getUsername());
@ -370,20 +361,26 @@ public class BatchSendTaskInfoServiceImpl implements IBatchSendTaskInfoService {
} }
} }
} }
//新增节点表主表
signPatientManageRouteMapper.insertBatch(signPatientManageRoutes); signPatientManageRouteMapper.insertBatch(signPatientManageRoutes);
//筛如节点表主表id
for (int i = 0; i < signPatientManageRouteNodes.size(); i++) { for (int i = 0; i < signPatientManageRouteNodes.size(); i++) {
signPatientManageRouteNodes.get(i).setManageRouteId(signPatientManageRoutes.get(i).getId()); signPatientManageRouteNodes.get(i).setManageRouteId(signPatientManageRoutes.get(i).getId());
} }
//新增节点明细表
signPatientManageRouteNodeMapper.insertBatch(signPatientManageRouteNodes); signPatientManageRouteNodeMapper.insertBatch(signPatientManageRouteNodes);
//新增变量表
if (CollectionUtils.isNotEmpty(batchSendTaskVariableInfos)) { if (CollectionUtils.isNotEmpty(batchSendTaskVariableInfos)) {
batchSendTaskVariableInfoMapper.insertBatchSendTaskVariableInfos(batchSendTaskVariableInfos); batchSendTaskVariableInfoMapper.insertBatchSendTaskVariableInfos(batchSendTaskVariableInfos);
} }
//电话推送
if (batchSendTaskRecordDto.getBatchTaskSource().equals(BillSourceEnum.TELEPHONE.getInfo())) { if (batchSendTaskRecordDto.getBatchTaskSource().equals(BillSourceEnum.TELEPHONE.getInfo())) {
//获取医院拨打时间限制
SysUser sysUser = sysUserMapper.selectUserById(SecurityUtils.getUserId()); SysUser sysUser = sysUserMapper.selectUserById(SecurityUtils.getUserId());
Agency agency = agencyMapper.selectAgencyById(sysUser.getHospitalAgencyId()); Agency agency = agencyMapper.selectAgencyById(sysUser.getHospitalAgencyId());
DialTime dialTime = patientInfoImportMainMapper.selectDialTimeById(agency.getId()); DialTime dialTime = patientInfoImportMainMapper.selectDialTimeById(agency.getId());
LocalTime localStartTime = null; LocalTime localStartTime;
LocalTime localEndTime = null; LocalTime localEndTime;
LocalTime dateStartTime; LocalTime dateStartTime;
LocalTime dateEndTime; LocalTime dateEndTime;
if (Objects.nonNull(dialTime)) { if (Objects.nonNull(dialTime)) {
@ -492,7 +489,6 @@ public class BatchSendTaskInfoServiceImpl implements IBatchSendTaskInfoService {
if (!aBoolean) { if (!aBoolean) {
return AjaxResult.error("短信上传失败"); return AjaxResult.error("短信上传失败");
} }
//发送记录批量
log.info("创建批量短信推送任务执行完成......"); log.info("创建批量短信推送任务执行完成......");
return AjaxResult.success("短信上传成功"); return AjaxResult.success("短信上传成功");
} }
@ -537,8 +533,8 @@ public class BatchSendTaskInfoServiceImpl implements IBatchSendTaskInfoService {
System.setProperty("sun.net.client.defaultReadTimeout", "10000"); System.setProperty("sun.net.client.defaultReadTimeout", "10000");
// 初始化acsClient暂不支持region化 // 初始化acsClient暂不支持region化
IClientProfile profile = DefaultProfile.getProfile(aliyunSmsConfig.getRegionId(), aliyunSmsConfig.getAccessKeyId(), aliyunSmsConfig.getAccessKeySecret()); IClientProfile profile = DefaultProfile.getProfile(aliYunSmsTwoConfig.getRegionId(), aliYunSmsTwoConfig.getAccessKeyId(), aliYunSmsTwoConfig.getAccessKeySecret());
DefaultProfile.addEndpoint(aliyunSmsConfig.getRegionId(), aliyunSmsConfig.getProduct(), aliyunSmsConfig.getDomain()); DefaultProfile.addEndpoint(aliYunSmsTwoConfig.getRegionId(), aliYunSmsTwoConfig.getProduct(), aliYunSmsTwoConfig.getDomain());
IAcsClient acsClient = new DefaultAcsClient(profile); IAcsClient acsClient = new DefaultAcsClient(profile);
// 组装请求对象 // 组装请求对象