批量任务

This commit is contained in:
zhangheng 2026-05-09 18:04:49 +08:00
parent 1b6653f024
commit 4562d9f2fc
19 changed files with 364 additions and 33 deletions

View File

@ -0,0 +1,41 @@
package com.xinelu.common.enums;
public enum PersonnelTypeEnum {
/**
* 在院
*/
IN_HOSPITAL("IN_HOSPITAL", "在院"),
/**
* 门诊
*/
OUTPATIENT("OUTPATIENT", "门诊"),
/**
* 出院
*/
DISCHARGED("DISCHARGED", "出院"),
/**
* 体检
*/
PHYSICAL_EXAMINATION("PHYSICAL_EXAMINATION", "体检");
private final String code;
final private String info;
PersonnelTypeEnum(String code, String info) {
this.code = code;
this.info = info;
}
public String getCode() {
return code;
}
public String getInfo() {
return info;
}
}

View File

@ -8,6 +8,7 @@ import com.xinelu.common.core.page.TableDataInfo;
import com.xinelu.common.enums.BusinessType;
import com.xinelu.common.utils.poi.ExcelUtil;
import com.xinelu.manage.domain.batchsendtaskinfo.BatchSendTaskInfo;
import com.xinelu.manage.dto.batchsendtaskinfo.BatchSendTaskDto;
import com.xinelu.manage.dto.batchsendtaskrecordinfo.BatchSendTaskRecordDto;
import com.xinelu.manage.service.batchsendtaskinfo.IBatchSendTaskInfoService;
import io.swagger.annotations.ApiOperation;
@ -38,7 +39,7 @@ public class BatchSendTaskInfoController extends BaseController {
*/
@PreAuthorize("@ss.hasPermi('system:batchSendTaskInfo:list')")
@GetMapping("/list")
public TableDataInfo list(BatchSendTaskInfo batchSendTaskInfo) {
public TableDataInfo list(BatchSendTaskDto batchSendTaskInfo) {
startPage();
List<BatchSendTaskInfo> list = batchSendTaskInfoService.selectBatchSendTaskInfoList(batchSendTaskInfo);
return getDataTable(list);
@ -48,7 +49,7 @@ public class BatchSendTaskInfoController extends BaseController {
* 查询批量推送任务信息列表
*/
@GetMapping("/batchSendTaskList")
public List<BatchSendTaskInfo> batchSendTaskList(BatchSendTaskInfo batchSendTaskInfo) {
public List<BatchSendTaskInfo> batchSendTaskList(BatchSendTaskDto batchSendTaskInfo) {
return batchSendTaskInfoService.selectBatchSendTaskInfoList(batchSendTaskInfo);
}
@ -58,7 +59,7 @@ public class BatchSendTaskInfoController extends BaseController {
@PreAuthorize("@ss.hasPermi('system:batchSendTaskInfo:export')")
@Log(title = "批量推送任务信息", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, BatchSendTaskInfo batchSendTaskInfo) {
public void export(HttpServletResponse response, BatchSendTaskDto batchSendTaskInfo) {
List<BatchSendTaskInfo> list = batchSendTaskInfoService.selectBatchSendTaskInfoList(batchSendTaskInfo);
ExcelUtil<BatchSendTaskInfo> util = new ExcelUtil<>(BatchSendTaskInfo.class);
util.exportExcel(response, list, "批量推送任务信息数据");

View File

@ -11,7 +11,7 @@ import lombok.NoArgsConstructor;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import java.util.Date;
import java.time.LocalDateTime;
import java.util.Objects;
/**
@ -86,10 +86,10 @@ public class BatchSendTaskInfo extends BaseEntity {
/**
* 就诊/体检时间时间格式yyyy-MM-dd
*/
@ApiModelProperty(value = "就诊/体检时间时间格式yyyy-MM-dd")
@ApiModelProperty(value = "就诊/出院/体检时间时间格式yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "就诊/体检时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date visitDate;
@Excel(name = "就诊/出院/体检时间", width = 30, dateFormat = "yyyy-MM-dd")
private LocalDateTime visitDate;
/**
* 体检/门诊/住院号
@ -133,6 +133,13 @@ public class BatchSendTaskInfo extends BaseEntity {
@Excel(name = "身份证号")
private String cardNo;
/**
* 人员类型在院IN_HOSPITAL门诊OUTPATIENT出院DISCHARGED体检PHYSICAL_EXAMINATION
*/
@ApiModelProperty(value = "人员类型")
@Excel(name = "人员类型")
private String personnelType;
/**
* 人群id
*/

View File

@ -108,6 +108,11 @@ public class BatchSendTaskRecordInfo extends BaseEntity {
@Excel(name = "总结标签")
private String physicalExaminationLabel;
/**
* 删除标识0未删除1已删除
*/
private Integer delFlag;
@Override
public String toString() {
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)

View File

@ -0,0 +1,21 @@
package com.xinelu.manage.dto.batchsendtaskinfo;
import com.xinelu.manage.domain.batchsendtaskinfo.BatchSendTaskInfo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDate;
@Data
public class BatchSendTaskDto extends BatchSendTaskInfo {
@ApiModelProperty(value = "开始时间")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private LocalDate startDate;
@ApiModelProperty(value = "结束时间")
@DateTimeFormat(pattern = "yyyy-MM-dd")
private LocalDate endDate;
}

View File

@ -1,6 +1,7 @@
package com.xinelu.manage.mapper.batchsendtaskinfo;
import com.xinelu.manage.domain.batchsendtaskinfo.BatchSendTaskInfo;
import com.xinelu.manage.dto.batchsendtaskinfo.BatchSendTaskDto;
import java.util.List;
@ -25,7 +26,7 @@ public interface BatchSendTaskInfoMapper {
* @param batchSendTaskInfo 批量推送任务信息
* @return 批量推送任务信息集合
*/
List<BatchSendTaskInfo> selectBatchSendTaskInfoList(BatchSendTaskInfo batchSendTaskInfo);
List<BatchSendTaskInfo> selectBatchSendTaskInfoList(BatchSendTaskDto batchSendTaskInfo);
/**
* 新增批量推送任务信息

View File

@ -1,6 +1,7 @@
package com.xinelu.manage.mapper.batchsendtaskrecordinfo;
import com.xinelu.manage.domain.batchsendtaskrecordinfo.BatchSendTaskRecordInfo;
import com.xinelu.manage.vo.batchsendtaskrecordinfo.BatchSendTaskRecordVo;
import java.util.List;
@ -58,4 +59,12 @@ public interface BatchSendTaskRecordInfoMapper {
* @return 结果
*/
int deleteBatchSendTaskRecordInfoByIds(Long[] ids);
/**
* 查询批量推送任务记录
*
* @param id 批量推送任务记录主键
* @return 批量推送任务记录
*/
BatchSendTaskRecordVo selectBatchSendTaskRecordVoById(Long id);
}

View File

@ -3,6 +3,7 @@ package com.xinelu.manage.service.batchsendtaskinfo;
import com.aliyuncs.exceptions.ClientException;
import com.xinelu.common.core.domain.AjaxResult;
import com.xinelu.manage.domain.batchsendtaskinfo.BatchSendTaskInfo;
import com.xinelu.manage.dto.batchsendtaskinfo.BatchSendTaskDto;
import com.xinelu.manage.dto.batchsendtaskrecordinfo.BatchSendTaskRecordDto;
import java.util.List;
@ -28,7 +29,7 @@ public interface IBatchSendTaskInfoService {
* @param batchSendTaskInfo 批量推送任务信息
* @return 批量推送任务信息集合
*/
List<BatchSendTaskInfo> selectBatchSendTaskInfoList(BatchSendTaskInfo batchSendTaskInfo);
List<BatchSendTaskInfo> selectBatchSendTaskInfoList(BatchSendTaskDto batchSendTaskInfo);
/**
* 新增批量推送任务信息

View File

@ -24,13 +24,13 @@ import com.xinelu.manage.domain.batchsendtasklabelinfo.BatchSendTaskLabelInfo;
import com.xinelu.manage.domain.batchsendtaskrecordinfo.BatchSendTaskRecordInfo;
import com.xinelu.manage.domain.batchsendtaskvariableinfo.BatchSendTaskVariableInfo;
import com.xinelu.manage.domain.dialtime.DialTime;
import com.xinelu.manage.domain.shortmessagesendrecord.ShortMessageSendRecord;
import com.xinelu.manage.domain.signpatientmanageroute.SignPatientManageRoute;
import com.xinelu.manage.domain.signpatientmanageroutenode.SignPatientManageRouteNode;
import com.xinelu.manage.dto.aiob.CreateTaskDto;
import com.xinelu.manage.dto.aiob.CustomerInfoDto;
import com.xinelu.manage.dto.aiob.ImportTaskDto;
import com.xinelu.manage.dto.aiob.RetryRuleList;
import com.xinelu.manage.dto.batchsendtaskinfo.BatchSendTaskDto;
import com.xinelu.manage.dto.batchsendtaskrecordinfo.BatchSendTaskRecordDto;
import com.xinelu.manage.dto.smssend.SmsInfoDTO;
import com.xinelu.manage.mapper.agency.AgencyMapper;
@ -122,8 +122,27 @@ public class BatchSendTaskInfoServiceImpl implements IBatchSendTaskInfoService {
* @return 批量推送任务信息
*/
@Override
public List<BatchSendTaskInfo> selectBatchSendTaskInfoList(BatchSendTaskInfo batchSendTaskInfo) {
return batchSendTaskInfoMapper.selectBatchSendTaskInfoList(batchSendTaskInfo);
public List<BatchSendTaskInfo> selectBatchSendTaskInfoList(BatchSendTaskDto batchSendTaskInfo) {
List<BatchSendTaskInfo> batchSendTaskInfos = batchSendTaskInfoMapper.selectBatchSendTaskInfoList(batchSendTaskInfo);
if (CollectionUtils.isEmpty(batchSendTaskInfos)) {
return new ArrayList<>();
}
for (BatchSendTaskInfo sendTaskInfo : batchSendTaskInfos) {
if (sendTaskInfo.getPersonnelType().equals(PersonnelTypeEnum.DISCHARGED.getCode())) {
sendTaskInfo.setPersonnelType(PersonnelTypeEnum.DISCHARGED.getInfo());
}
if (sendTaskInfo.getPersonnelType().equals(PersonnelTypeEnum.OUTPATIENT.getCode())) {
sendTaskInfo.setPersonnelType(PersonnelTypeEnum.OUTPATIENT.getInfo());
}
if (sendTaskInfo.getPersonnelType().equals(PersonnelTypeEnum.IN_HOSPITAL.getCode())) {
sendTaskInfo.setPersonnelType(PersonnelTypeEnum.IN_HOSPITAL.getInfo());
}
if (sendTaskInfo.getPersonnelType().equals(PersonnelTypeEnum.PHYSICAL_EXAMINATION.getCode())) {
sendTaskInfo.setPersonnelType(PersonnelTypeEnum.PHYSICAL_EXAMINATION.getInfo());
}
}
return batchSendTaskInfos;
}
/**
@ -135,6 +154,19 @@ public class BatchSendTaskInfoServiceImpl implements IBatchSendTaskInfoService {
@Override
public int insertBatchSendTaskInfo(BatchSendTaskInfo batchSendTaskInfo) {
batchSendTaskInfo.setCreateTime(LocalDateTime.now());
if (batchSendTaskInfo.getPersonnelType().equals(PersonnelTypeEnum.DISCHARGED.getInfo())) {
batchSendTaskInfo.setPersonnelType(PersonnelTypeEnum.DISCHARGED.getCode());
}
if (batchSendTaskInfo.getPersonnelType().equals(PersonnelTypeEnum.OUTPATIENT.getInfo())) {
batchSendTaskInfo.setPersonnelType(PersonnelTypeEnum.OUTPATIENT.getCode());
}
if (batchSendTaskInfo.getPersonnelType().equals(PersonnelTypeEnum.IN_HOSPITAL.getInfo())) {
batchSendTaskInfo.setPersonnelType(PersonnelTypeEnum.IN_HOSPITAL.getCode());
}
if (batchSendTaskInfo.getPersonnelType().equals(PersonnelTypeEnum.PHYSICAL_EXAMINATION.getInfo())) {
batchSendTaskInfo.setPersonnelType(PersonnelTypeEnum.PHYSICAL_EXAMINATION.getCode());
}
return batchSendTaskInfoMapper.insertBatchSendTaskInfo(batchSendTaskInfo);
}
@ -179,7 +211,7 @@ public class BatchSendTaskInfoServiceImpl implements IBatchSendTaskInfoService {
if (Objects.isNull(isDistinct) || isDistinct == 1) {
list = list.stream().filter(Objects::nonNull).distinct().collect(Collectors.toList());
}
List<BatchSendTaskInfo> collect = list.stream().filter(Objects::nonNull).filter(item -> StringUtils.isEmpty(item.getPatientName()) || StringUtils.isEmpty(item.getPatientPhone()) || StringUtils.isEmpty(item.getInHospitalNumber())).collect(Collectors.toList());
List<BatchSendTaskInfo> collect = list.stream().filter(Objects::nonNull).filter(item -> StringUtils.isEmpty(item.getPatientName()) || StringUtils.isEmpty(item.getPatientPhone()) || StringUtils.isEmpty(item.getPersonnelType())).collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(collect)) {
return AjaxResult.error("用户信息不完整,姓名均不允许为空,请完善后重试;");
}
@ -200,6 +232,19 @@ public class BatchSendTaskInfoServiceImpl implements IBatchSendTaskInfoService {
batchSendTaskInfo.setCreateTime(LocalDateTime.now());
batchSendTaskInfo.setCreateBy(SecurityUtils.getUsername());
batchSendTaskInfo.setDelFlag(0);
if (batchSendTaskInfo.getPersonnelType().equals(PersonnelTypeEnum.DISCHARGED.getInfo())) {
batchSendTaskInfo.setPersonnelType(PersonnelTypeEnum.DISCHARGED.getCode());
}
if (batchSendTaskInfo.getPersonnelType().equals(PersonnelTypeEnum.OUTPATIENT.getInfo())) {
batchSendTaskInfo.setPersonnelType(PersonnelTypeEnum.OUTPATIENT.getCode());
}
if (batchSendTaskInfo.getPersonnelType().equals(PersonnelTypeEnum.IN_HOSPITAL.getInfo())) {
batchSendTaskInfo.setPersonnelType(PersonnelTypeEnum.IN_HOSPITAL.getCode());
}
if (batchSendTaskInfo.getPersonnelType().equals(PersonnelTypeEnum.PHYSICAL_EXAMINATION.getInfo())) {
batchSendTaskInfo.setPersonnelType(PersonnelTypeEnum.PHYSICAL_EXAMINATION.getCode());
}
if (StringUtils.isBlank(batchSendTaskInfo.getDepartmentName())) {
batchSendTaskInfo.setDepartmentName("");
}
@ -256,6 +301,8 @@ public class BatchSendTaskInfoServiceImpl implements IBatchSendTaskInfoService {
batchSendTaskRecordInfo.setTemplateName(batchSendTaskRecordDto.getPhoneTemplateName());
batchSendTaskRecordInfo.setRobotPublishId(batchSendTaskRecordDto.getRobotPublishId());
}
batchSendTaskRecordInfo.setNodeExecuteStatus(NodeExecuteStatusEnum.EXECUTING.getInfo());
batchSendTaskRecordInfo.setNodeContent(batchSendTaskRecordDto.getNodeContent());
batchSendTaskRecordInfo.setBatchTaskNumber(batchTaskNumber);
batchSendTaskRecordInfo.setTaskExecuteType(TaskExcuteTypeEnum.BATCH_TASK.getInfo());
batchSendTaskRecordInfo.setNodePlanTime(batchSendTaskRecordDto.getNodePlanTime());
@ -414,7 +461,7 @@ public class BatchSendTaskInfoServiceImpl implements IBatchSendTaskInfoService {
createTaskDto.setRobotId(batchSendTaskRecordDto.getRobotPublishId());
createTaskDto.setDialStartDate(batchSendTaskRecordDto.getNodePlanTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
//默认为空表示不限制终止时间
//createTaskDto.setDialEndDate(batchSendTaskRecordDto.getNodePlanTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
createTaskDto.setDialEndDate(batchSendTaskRecordDto.getNodePlanTime().plusDays(2).format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
createTaskDto.setForbidDialDate(Arrays.asList(99));
List<RetryRuleList> retryRuleLists = new ArrayList<>();
RetryRuleList retryRuleList = new RetryRuleList();

View File

@ -1,6 +1,7 @@
package com.xinelu.manage.service.batchsendtaskrecordinfo;
import com.xinelu.manage.domain.batchsendtaskrecordinfo.BatchSendTaskRecordInfo;
import com.xinelu.manage.vo.batchsendtaskrecordinfo.BatchSendTaskRecordVo;
import java.util.List;
@ -18,7 +19,7 @@ public interface IBatchSendTaskRecordInfoService {
* @param id 批量推送任务记录主键
* @return 批量推送任务记录
*/
BatchSendTaskRecordInfo selectBatchSendTaskRecordInfoById(Long id);
BatchSendTaskRecordVo selectBatchSendTaskRecordInfoById(Long id);
/**
* 查询批量推送任务记录列表

View File

@ -8,6 +8,7 @@ import com.xinelu.manage.mapper.batchsendtaskrecordinfo.BatchSendTaskRecordInfoM
import com.xinelu.manage.mapper.scriptInfo.ScriptInfoMapper;
import com.xinelu.manage.mapper.textmessage.TextMessageMapper;
import com.xinelu.manage.service.batchsendtaskrecordinfo.IBatchSendTaskRecordInfoService;
import com.xinelu.manage.vo.batchsendtaskrecordinfo.BatchSendTaskRecordVo;
import com.xinelu.manage.vo.textmessage.TextMessageVO;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
@ -39,8 +40,8 @@ public class BatchSendTaskRecordInfoServiceImpl implements IBatchSendTaskRecordI
* @return 批量推送任务记录
*/
@Override
public BatchSendTaskRecordInfo selectBatchSendTaskRecordInfoById(Long id) {
return batchSendTaskRecordInfoMapper.selectBatchSendTaskRecordInfoById(id);
public BatchSendTaskRecordVo selectBatchSendTaskRecordInfoById(Long id) {
return batchSendTaskRecordInfoMapper.selectBatchSendTaskRecordVoById(id);
}
/**

View File

@ -0,0 +1,38 @@
package com.xinelu.manage.vo.batchsendtaskinfo;
import com.xinelu.manage.domain.batchsendtaskinfo.BatchSendTaskInfo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* 批量推送任务查看vo
*/
@EqualsAndHashCode(callSuper = true)
@Data
public class BatchSendTaskVo extends BatchSendTaskInfo {
@ApiModelProperty(value = "拨打状态DIALED,已拨打NODIALED:未拨打默认NULL表示未拨打")
private String dialStatus;
/**
* 节点任务执行状态已执行EXECUTED未执行UNEXECUTED
*/
@ApiModelProperty(value = "节点任务执行状态已执行EXECUTED未执行UNEXECUTED")
private String nodeExecuteStatus;
@ApiModelProperty(value = "默认已接通CONNECTED未接通:NOTCONNECTED")
private String phoneConnectStatus;
/**
* 电话拨通情况SUCCESS成功FAILURE失败EXPIRED超期自动作废如超期一周NULL或空字符串缺省值表示未执行
*/
@ApiModelProperty(value = "电话拨通情况")
private String phoneNodeExecuteResultStatus;
/**
* 短信发送情况SUCCESS成功FAILURE失败EXPIRED超期自动作废如超期一周NULL或空字符串缺省值表示未执行
*/
@ApiModelProperty(value = "短信发送情况")
private String messageNodeExecuteResultStatus;
}

View File

@ -0,0 +1,18 @@
package com.xinelu.manage.vo.batchsendtaskrecordinfo;
import com.xinelu.manage.domain.batchsendtaskrecordinfo.BatchSendTaskRecordInfo;
import com.xinelu.manage.vo.batchsendtaskinfo.BatchSendTaskVo;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.List;
/**
* 批量推送任务查看vo
*/
@EqualsAndHashCode(callSuper = true)
@Data
public class BatchSendTaskRecordVo extends BatchSendTaskRecordInfo {
List<BatchSendTaskVo> batchSendTaskInfos;
}

View File

@ -21,6 +21,7 @@
<result property="age" column="age"/>
<result property="sex" column="sex"/>
<result property="cardNo" column="card_no"/>
<result property="personnelType" column="personnel_type"/>
<result property="crowdId" column="crowd_id"/>
<result property="crowdName" column="crowd_name"/>
<result property="physicalExaminationSummary" column="physical_examination_summary"/>
@ -47,6 +48,7 @@
age,
sex,
card_no,
personnel_type,
crowd_id,
crowd_name,
physical_examination_summary,
@ -58,7 +60,7 @@
</sql>
<select id="selectBatchSendTaskInfoList"
parameterType="com.xinelu.manage.domain.batchsendtaskinfo.BatchSendTaskInfo"
parameterType="com.xinelu.manage.dto.batchsendtaskinfo.BatchSendTaskDto"
resultMap="BatchSendTaskInfoResult">
<include refid="selectBatchSendTaskInfoVo"/>
<where>
@ -90,6 +92,12 @@
<if test="visitDate != null ">
and visit_date = #{visitDate}
</if>
<if test="startDate != null ">
and date_format(visit_date, '%y%m%d') >= date_format(#{startDate}, '%y%m%d')
</if>
<if test="endDate != null ">
and date_format(visit_date, '%y%m%d') &lt;= date_format(#{endDate}, '%y%m%d')
</if>
<if test="inHospitalNumber != null and inHospitalNumber != ''">
and in_hospital_number = #{inHospitalNumber}
</if>
@ -108,6 +116,9 @@
<if test="cardNo != null and cardNo != ''">
and card_no = #{cardNo}
</if>
<if test="personnelType != null and personnelType != ''">
and personnel_type = #{personnelType}
</if>
<if test="crowdId != null ">
and crowd_id = #{crowdId}
</if>
@ -164,6 +175,8 @@
</if>
<if test="cardNo != null">card_no,
</if>
<if test="personnelType != null">personnel_type,
</if>
<if test="crowdId != null">crowd_id,
</if>
<if test="crowdName != null">crowd_name,
@ -210,6 +223,8 @@
</if>
<if test="cardNo != null">#{cardNo},
</if>
<if test="personnelType != null">#{personnelType},
</if>
<if test="crowdId != null">#{crowdId},
</if>
<if test="crowdName != null">#{crowdName},
@ -275,6 +290,9 @@
<if test="cardNo != null">card_no =
#{cardNo},
</if>
<if test="personnelType != null">personnel_type =
#{personnelType},
</if>
<if test="crowdId != null">crowd_id =
#{crowdId},
</if>
@ -330,6 +348,7 @@
age,
sex,
card_no,
personnel_type,
crowd_id,
crowd_name,
physical_examination_summary,
@ -355,6 +374,7 @@
#{BatchSendTaskInfo.age},
#{BatchSendTaskInfo.sex},
#{BatchSendTaskInfo.cardNo},
#{BatchSendTaskInfo.personnelType},
#{BatchSendTaskInfo.crowdId},
#{BatchSendTaskInfo.crowdName},
#{BatchSendTaskInfo.physicalExaminationSummary},

View File

@ -21,6 +21,53 @@
<result property="createTime" column="create_time"/>
</resultMap>
<resultMap type="com.xinelu.manage.vo.batchsendtaskrecordinfo.BatchSendTaskRecordVo"
id="BatchSendTaskRecordVoResult">
<result property="id" column="id"/>
<result property="batchTaskNumber" column="batch_task_number"/>
<result property="batchTaskName" column="batch_task_name"/>
<result property="taskExecuteType" column="task_execute_type"/>
<result property="nodePlanTime" column="node_plan_time"/>
<result property="batchTaskSource" column="batch_task_source"/>
<result property="templateId" column="template_id"/>
<result property="templateName" column="template_name"/>
<result property="nodeContent" column="node_content"/>
<result property="nodeExecuteStatus" column="node_execute_status"/>
<result property="physicalExaminationLabel" column="physical_examination_label"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<collection property="batchSendTaskInfos" javaType="java.util.List"
resultMap="BatchSendTaskVoResult"/>
</resultMap>
<resultMap type="com.xinelu.manage.vo.batchsendtaskinfo.BatchSendTaskVo" id="BatchSendTaskVoResult">
<result property="id" column="id"/>
<result property="orderNum" column="order_num"/>
<result property="sn" column="sn"/>
<result property="importName" column="import_name"/>
<result property="teamName" column="team_name"/>
<result property="hospitalAgencyId" column="hospital_agency_id"/>
<result property="hospitalAgencyName" column="hospital_agency_name"/>
<result property="departmentId" column="department_id"/>
<result property="departmentName" column="department_name"/>
<result property="visitDate" column="visit_date"/>
<result property="inHospitalNumber" column="in_hospital_number"/>
<result property="patientName" column="patient_name"/>
<result property="patientPhone" column="patient_phone"/>
<result property="age" column="age"/>
<result property="sex" column="sex"/>
<result property="cardNo" column="card_no"/>
<result property="personnelType" column="personnel_type"/>
<result property="crowdId" column="crowd_id"/>
<result property="crowdName" column="crowd_name"/>
<result property="physicalExaminationLabel" column="physical_examination_label"/>
<result property="dialStatus" column="dial_status"/>
<result property="phoneNodeExecuteResultStatus" column="phone_node_execute_result_status"/>
<result property="messageNodeExecuteResultStatus" column="message_node_execute_result_status"/>
<result property="nodeExecuteStatus" column="node_execute_status"/>
<result property="phoneConnectStatus" column="phone_connect_status"/>
</resultMap>
<sql id="selectBatchSendTaskRecordInfoVo">
select id,
batch_task_number,
@ -30,9 +77,11 @@
batch_task_source,
template_id,
template_name,
robot_publish_id,
node_content,
node_execute_status,
physical_examination_label,
del_flag,
create_by,
create_time
from batch_send_task_record_info
@ -99,12 +148,16 @@
</if>
<if test="templateName != null">template_name,
</if>
<if test="robotPublishId != null">robot_publish_id,
</if>
<if test="nodeContent != null">node_content,
</if>
<if test="nodeExecuteStatus != null">node_execute_status,
</if>
<if test="physicalExaminationLabel != null">physical_examination_label,
</if>
<if test="delFlag != null">del_flag,
</if>
<if test="createBy != null">create_by,
</if>
<if test="createTime != null">create_time,
@ -125,12 +178,16 @@
</if>
<if test="templateName != null">#{templateName},
</if>
<if test="robotPublishId != null">#{robotPublishId},
</if>
<if test="nodeContent != null">#{nodeContent},
</if>
<if test="nodeExecuteStatus != null">#{nodeExecuteStatus},
</if>
<if test="physicalExaminationLabel != null">#{physicalExaminationLabel},
</if>
<if test="delFlag != null">#{delFlag},
</if>
<if test="createBy != null">#{createBy},
</if>
<if test="createTime != null">#{createTime},
@ -162,6 +219,9 @@
<if test="templateName != null">template_name =
#{templateName},
</if>
<if test="robotPublishId != null">robot_publish_id =
#{robotPublishId},
</if>
<if test="nodeContent != null">node_content =
#{nodeContent},
</if>
@ -171,6 +231,9 @@
<if test="physicalExaminationLabel != null">physical_examination_label =
#{physicalExaminationLabel},
</if>
<if test="delFlag != null">del_flag =
#{delFlag},
</if>
<if test="createBy != null">create_by =
#{createBy},
</if>
@ -193,4 +256,51 @@
#{id}
</foreach>
</delete>
<select id="selectBatchSendTaskRecordVoById"
resultMap="BatchSendTaskRecordVoResult">
select bstri.id,
bstri.batch_task_number,
bstri.batch_task_name,
bstri.task_execute_type,
bstri.node_plan_time,
bstri.batch_task_source,
bstri.template_id,
bstri.template_name,
bstri.node_content,
bstri.node_execute_status,
bstri.physical_examination_label,
bstri.create_by,
bstri.create_time,
bsti.id,
bsti.order_num,
bsti.sn,
bsti.import_name,
bsti.team_name,
bsti.hospital_agency_id,
bsti.hospital_agency_name,
bsti.department_id,
bsti.department_name,
bsti.visit_date,
bsti.in_hospital_number,
bsti.patient_name,
bsti.patient_phone,
bsti.age,
bsti.sex,
bsti.card_no,
bsti.personnel_type,
bsti.crowd_id,
bsti.crowd_name,
bsti.physical_examination_label,
spmrn.dial_status,
spmrn.node_execute_status,
spmrn.phone_connect_status,
spmrn.phone_node_execute_result_status,
spmrn.message_node_execute_result_status
from batch_send_task_record_info bstri
LEFT JOIN sign_patient_manage_route spmr on bstri.id = spmr.batch_send_task_record_id
LEFT JOIN sign_patient_manage_route_node spmrn on spmr.id = spmrn.manage_route_id
LEFT JOIN batch_send_task_info bsti on spmr.batch_send_task_id = bsti.id
where bstri.id = #{id}
</select>
</mapper>

View File

@ -30,7 +30,7 @@ public interface SendTextMessageService {
*/
JSONObject taskTextMessageSendBack(SmsReport data, List<ShortMessageSendRecord> shortMessageSendRecords);
Integer updateReadState(Integer readState, Integer id);
Integer updateReadState(Integer readState, List<Integer> ids);
Integer deleteData();
}

View File

@ -280,19 +280,19 @@ public class SendTextMessageServiceImpl implements SendTextMessageService {
}
@Override
public Integer updateReadState(Integer readState, Integer id) {
log.info("修改短信回调数据已读状态--id{}", id);
public Integer updateReadState(Integer readState, List<Integer> ids) {
log.info("修改短信回调数据已读状态--id{}", ids);
JSONObject TaskCallbackUpdateDto = new JSONObject();
TaskCallbackUpdateDto.fluentPut("id", id).fluentPut("readState", readState);
TaskCallbackUpdateDto.fluentPut("ids", ids).fluentPut("readState", readState);
HttpEntity<JSONObject> requestEntity = new HttpEntity<>(TaskCallbackUpdateDto);
RestTemplate restTemplate = new RestTemplate();
ResponseEntity<String> responseEntity = restTemplate.exchange(callBackUrl + "/updateMessageBackReadState", HttpMethod.POST, requestEntity, String.class);
JSONObject object = JSON.parseObject(responseEntity.getBody());
if (object == null || object.getInteger("code") == null || object.getInteger("code") != 0) {
log.info("修改百度外呼回调数据已读状态失败--id{},原因:{}", id, object.getString("message"));
log.info("修改百度外呼回调数据已读状态失败--id{},原因:{}", ids, object.getString("message"));
return null;
}
log.info("修改百度外呼回调数据已读状态成功--id{}", id);
log.info("修改百度外呼回调数据已读状态成功--id{}", ids);
return 1;
}

View File

@ -9,12 +9,14 @@ import com.xinelu.manage.domain.textmessage.TaskMessageBackEntity;
import com.xinelu.manage.mapper.shortmessagesendrecord.ShortMessageSendRecordMapper;
import com.xinelu.quartz.service.SendTextMessageService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
/**
* @Description 短信相关定时任务
@ -46,16 +48,24 @@ public class SendTextMessageTask {
List<TaskMessageBackEntity> taskMessageBackEntityList = sendTextMessageService.taskMessageBack(taskMessageBackEntity);
List<ShortMessageSendRecord> shortMessageSendRecords = new ArrayList<>();
if (!CollectionUtils.isEmpty(taskMessageBackEntityList)) {
// 回调数据解析
// 回调数据提取
List<SmsReport> smsReports = new ArrayList<>();
taskMessageBackEntityList.forEach(entity -> {
// JSONString TaskCallbackDataDto
SmsReport smsReport = JSON.parseObject(entity.getMessageBackData().toString(), SmsReport.class);
// 执行回调
sendTextMessageService.taskTextMessageSendBack(smsReport, shortMessageSendRecords);
// 修改阿里云服务器回调数据已读状态
sendTextMessageService.updateReadState(1, entity.getId());
// JSONString SmsReport
smsReports.addAll(JSON.parseArray(entity.getMessageBackData().toString(), SmsReport.class));
});
shortMessageSendRecordMapper.insertShortMessageSendRecords(shortMessageSendRecords);
if (CollectionUtils.isNotEmpty(smsReports)) {
for (SmsReport smsReport : smsReports) {
// 回调数据解析
sendTextMessageService.taskTextMessageSendBack(smsReport, shortMessageSendRecords);
}
}
if (CollectionUtils.isNotEmpty(shortMessageSendRecords)) {
shortMessageSendRecordMapper.insertShortMessageSendRecords(shortMessageSendRecords);
}
List<Integer> ids = taskMessageBackEntityList.stream().filter(Objects::nonNull).map(TaskMessageBackEntity::getId).collect(Collectors.toList());
// 修改阿里云服务器回调数据已读状态
sendTextMessageService.updateReadState(1, ids);
}
log.info("完成同步百度外呼回调数据定时任务......");
}