|
|
@ -15,9 +15,12 @@ import org.springframework.context.ApplicationContext;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* 报告服务实现类
|
|
|
|
* 报告服务实现类
|
|
|
|
|
|
|
|
*
|
|
|
|
* @author wyb
|
|
|
|
* @author wyb
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
@Slf4j
|
|
|
|
@Slf4j
|
|
|
@ -84,4 +87,33 @@ public class ReportServiceImpl implements ReportService {
|
|
|
|
// 都成功后发布下载事件
|
|
|
|
// 都成功后发布下载事件
|
|
|
|
applicationContext.publishEvent(new ReportDownEvent(this, afReportRecord.getTaskId()));
|
|
|
|
applicationContext.publishEvent(new ReportDownEvent(this, afReportRecord.getTaskId()));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public void makeupReportByTaskIds(List<Long> taskIds) throws Exception {
|
|
|
|
|
|
|
|
int taskIdLength = taskIds.size();
|
|
|
|
|
|
|
|
// 定义一批200查询,分批次
|
|
|
|
|
|
|
|
final int oneBatchCount = 200;
|
|
|
|
|
|
|
|
int startIndex;
|
|
|
|
|
|
|
|
int toIndex = 0;
|
|
|
|
|
|
|
|
do {
|
|
|
|
|
|
|
|
startIndex = toIndex;
|
|
|
|
|
|
|
|
toIndex = startIndex + oneBatchCount;
|
|
|
|
|
|
|
|
// 如果大于原来集合长度,最大截取就是集合长度
|
|
|
|
|
|
|
|
if (toIndex >= taskIdLength) {
|
|
|
|
|
|
|
|
toIndex = taskIdLength;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// 截取每一批
|
|
|
|
|
|
|
|
List<Long> makeupTaskIds = taskIds.subList(startIndex, toIndex);
|
|
|
|
|
|
|
|
makeupTaskIds = afReportRecordMapper.getHasPatientIdTaskIdsByTaskIds(makeupTaskIds);
|
|
|
|
|
|
|
|
if (Func.isNotEmpty(makeupTaskIds)) {
|
|
|
|
|
|
|
|
for (Long taskId : makeupTaskIds) {
|
|
|
|
|
|
|
|
// 发布下载事件
|
|
|
|
|
|
|
|
applicationContext.publishEvent(new ReportDownEvent(this, taskId));
|
|
|
|
|
|
|
|
// 等待防止过快
|
|
|
|
|
|
|
|
TimeUnit.MILLISECONDS.sleep(50);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// 当截取长度小于集合长度,可以进行下次循环截取
|
|
|
|
|
|
|
|
} while (toIndex < taskIdLength);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|