liusheng
5 天以前 0bbbd746e8c39d91ad7b47a4e36e29ab972dc98c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package com.ruoyi.task.api.contract;
 
import com.ruoyi.common.core.service.SubtaskOptionMatchApi;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
 
import java.util.List;
import com.ruoyi.task.service.IServiceSubtaskService;
 
/**
 * 【过渡实现·临时】{@link SubtaskOptionMatchApi} 在 smartor 侧的桥接。
 *
 * <h3>为什么需要它</h3>
 * 模板模块的 {@code IvrLibaTargetServiceImpl} 需要「AI 选项匹配」能力,
 * 而该能力目前实现在 smartor 的 {@code ServiceSubtaskServiceImpl#matchOptionIndex}
 * (同文件内还有 3 处自有调用,所以不能整体搬走)。
 * 模板模块不能依赖 smartor,于是按既有手法把接口放 ruoyi-common、实现留在这里。
 *
 * <h3>本类做什么</h3>
 * <b>纯转发</b>,零逻辑改动。
 *
 * <h3>⚠️ 泛型透传</h3>
 * 契约用泛型 {@code <T>} 让调用点的类型保持原样(他们拿到下标后要
 * {@code options.get(i).getOptiondesc()})。这里直接透传 {@code T},
 * smartor 侧那个方法按运行时类型序列化,结果与迁移前逐字一致。
 *
 * @see com.ruoyi.common.core.service.SubtaskOptionMatchApi
 */
@Slf4j
@Component
public class SubtaskOptionMatchApiImpl implements SubtaskOptionMatchApi {
 
    @Autowired
    private IServiceSubtaskService serviceSubtaskService;
 
    @Override
    public <T> Integer matchOptionIndex(String url, String questionText, String voiceText,
                                        java.util.List<T> options, String uuid) {
        return serviceSubtaskService.matchOptionIndex(url, questionText, voiceText, options, uuid);
    }
}