|
|
@@ -10,19 +10,16 @@ import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.github.therapi.runtimejavadoc.repack.com.eclipsesource.json.JsonObject;
|
|
|
-import com.inspur.device.domain.vo.SmsbDeviceChatKeyVo;
|
|
|
import com.inspur.device.domain.vo.SmsbDeviceGroupRelVo;
|
|
|
-import com.inspur.device.domain.vo.SmsbDeviceXfApiVo;
|
|
|
-import com.inspur.device.mapper.SmsbDeviceChatKeyMapper;
|
|
|
import com.inspur.device.mapper.SmsbDeviceGroupRelMapper;
|
|
|
-import com.inspur.device.mapper.SmsbDeviceMapper;
|
|
|
-import com.inspur.device.mapper.SmsbDeviceXfApiMapper;
|
|
|
import com.inspur.digital.domain.SmsbAppointmentInfo;
|
|
|
import com.inspur.digital.domain.SmsbDeviceChatScReport;
|
|
|
import com.inspur.digital.domain.bo.SmsbAppointmentInfoBo;
|
|
|
import com.inspur.digital.domain.bo.SmsbStartInfoBo;
|
|
|
import com.inspur.digital.domain.vo.SmsbAppointmentInfoVo;
|
|
|
-import com.inspur.digital.domain.vo.SmsbStartInfoVo;
|
|
|
+import com.inspur.digital.domain.vo.SmsbDeviceChatScReportVo;
|
|
|
+import com.inspur.digital.domain.vo.SmsbScDeviceStartInfoVo;
|
|
|
+import com.inspur.digital.domain.vo.SmsbScStartInfoVo;
|
|
|
import com.inspur.digital.mapper.SmsbAppointmentInfoMapper;
|
|
|
import com.inspur.digital.mapper.SmsbDeviceChatScReportMapper;
|
|
|
import com.inspur.digital.service.ISmsbAppointmentInfoService;
|
|
|
@@ -58,10 +55,7 @@ import java.util.Map;
|
|
|
public class SmsbAppointmentInfoServiceImpl implements ISmsbAppointmentInfoService {
|
|
|
|
|
|
private final SmsbAppointmentInfoMapper baseMapper;
|
|
|
- private final SmsbDeviceGroupRelMapper groupRelMapper;
|
|
|
- private final SmsbDeviceXfApiMapper xfApiMapper;
|
|
|
- private final SmsbDeviceChatKeyMapper chatKeyMapper;
|
|
|
- private final SmsbDeviceMapper deviceMapper;
|
|
|
+ private final SmsbDeviceGroupRelMapper smsbDeviceGroupRelMapper;
|
|
|
private final SmsbDeviceChatScReportMapper smsbDeviceChatScReportMapper;
|
|
|
@Autowired
|
|
|
private ThreadPoolTaskExecutor threadPoolTaskExecutor;
|
|
|
@@ -77,9 +71,24 @@ public class SmsbAppointmentInfoServiceImpl implements ISmsbAppointmentInfoServi
|
|
|
private String scApiAppId;
|
|
|
@Value("${dify.url}")
|
|
|
private String difyBaseUrl;
|
|
|
-
|
|
|
@Value("${dify.sc_agent.apiKey}")
|
|
|
private String difyScAgentApiKey;
|
|
|
+ /**
|
|
|
+ * 默认场景序号 诊断评估
|
|
|
+ */
|
|
|
+ private static final Long DEFAULT_SCENE_SORT_1 = 1L;
|
|
|
+ /**
|
|
|
+ * 默认场景序号 看样学样
|
|
|
+ */
|
|
|
+ private static final Long DEFAULT_SCENE_SORT_2 = 2L;
|
|
|
+ /**
|
|
|
+ * 默认场景序号 场景体验
|
|
|
+ */
|
|
|
+ private static final Long DEFAULT_SCENE_SORT_3 = 3L;
|
|
|
+ /**
|
|
|
+ * 默认场景序号 套餐推荐
|
|
|
+ */
|
|
|
+ private static final Long DEFAULT_SCENE_SORT_4 = 4L;
|
|
|
|
|
|
/**
|
|
|
* 查询预约信息
|
|
|
@@ -360,21 +369,52 @@ public class SmsbAppointmentInfoServiceImpl implements ISmsbAppointmentInfoServi
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public R<List<SmsbStartInfoVo>> getStartInfo(SmsbStartInfoBo smsbStartInfoBo) {
|
|
|
- ArrayList<SmsbStartInfoVo> smsbStartInfoVos = new ArrayList<>();
|
|
|
- List<SmsbDeviceGroupRelVo> smsbDeviceGroupRelVos = groupRelMapper.queryGroupRelVoListByGoupId(smsbStartInfoBo.getDeviceGroupId());
|
|
|
- smsbDeviceGroupRelVos.forEach(smsbDeviceGroupRelVo -> {
|
|
|
- SmsbStartInfoVo smsbStartInfoVo = new SmsbStartInfoVo();
|
|
|
- String identifier = smsbDeviceGroupRelVo.getDeviceIdentifier();
|
|
|
- Long id = deviceMapper.getDeviceVoByIdentifier(identifier).getId();
|
|
|
- SmsbDeviceXfApiVo xfApiVo = xfApiMapper.selectVoById(1922207254116798466L);
|
|
|
- SmsbDeviceChatKeyVo chatKeyVo = chatKeyMapper.selectVoByDeviceId(id);
|
|
|
- smsbStartInfoVo.setDeviceId(id);
|
|
|
- smsbStartInfoVo.setDeviceIdentifier(identifier);
|
|
|
- smsbStartInfoVo.setSmsbDeviceXfApiVo(xfApiVo);
|
|
|
- smsbStartInfoVo.setSmsbDeviceChatKeyVo(chatKeyVo);
|
|
|
- smsbStartInfoVos.add(smsbStartInfoVo);
|
|
|
- });
|
|
|
- return R.ok(smsbStartInfoVos);
|
|
|
+ public R<SmsbScStartInfoVo> getSmsbScStartInfoVo(SmsbStartInfoBo smsbStartInfoBo) {
|
|
|
+ SmsbScStartInfoVo result = new SmsbScStartInfoVo();
|
|
|
+ // 根据前端传递的企业名称和手机号查询预约信息
|
|
|
+ String enterprise = smsbStartInfoBo.getEnterprise();
|
|
|
+ String phone = smsbStartInfoBo.getPhone();
|
|
|
+ SmsbAppointmentInfo appointmentInfo = baseMapper.selectOne(new LambdaQueryWrapper<SmsbAppointmentInfo>()
|
|
|
+ .eq(SmsbAppointmentInfo::getEnterprise, enterprise)
|
|
|
+ .eq(SmsbAppointmentInfo::getPhone, phone).orderByDesc(SmsbAppointmentInfo::getId).last("limit 1"));
|
|
|
+ // 未查询到预约信息 返回
|
|
|
+ if (appointmentInfo == null) {
|
|
|
+ result.setBaseHelloWorld("你好,我是小数智能分析助手,有什么可以帮你?");
|
|
|
+ // TODO 同步下发所有的公共知识库内容
|
|
|
+ return R.ok(result);
|
|
|
+ }
|
|
|
+ // 存在预约
|
|
|
+ result.setPhone(appointmentInfo.getPhone());
|
|
|
+ result.setEnterprise(appointmentInfo.getEnterprise());
|
|
|
+ result.setAppointmentId(appointmentInfo.getId());
|
|
|
+ // 通过设备标识查询出关联的设备组所有设备信息
|
|
|
+ List<SmsbDeviceGroupRelVo> deviceGroupRelList = smsbDeviceGroupRelMapper.getRelListByIdentifier(smsbStartInfoBo.getIdentifier());
|
|
|
+ if (CollectionUtils.isEmpty(deviceGroupRelList)) {
|
|
|
+ return R.ok(result);
|
|
|
+ }
|
|
|
+ List<SmsbScDeviceStartInfoVo> deviceStartInfoList = new ArrayList<>();
|
|
|
+ for (SmsbDeviceGroupRelVo deviceGroupRel : deviceGroupRelList) {
|
|
|
+ SmsbScDeviceStartInfoVo deviceStartInfo = new SmsbScDeviceStartInfoVo();
|
|
|
+ deviceStartInfo.setIdentifier(deviceGroupRel.getDeviceIdentifier());
|
|
|
+ deviceStartInfo.setSceneName(deviceGroupRel.getSceneName());
|
|
|
+ deviceStartInfo.setSceneSort(deviceGroupRel.getSceneSort());
|
|
|
+ if (deviceGroupRel.getSceneSort().equals(DEFAULT_SCENE_SORT_1)) {
|
|
|
+ SmsbDeviceChatScReportVo report = smsbDeviceChatScReportMapper.selectVoOne(new LambdaQueryWrapper<SmsbDeviceChatScReport>()
|
|
|
+ .eq(SmsbDeviceChatScReport::getAppointmentId, appointmentInfo.getId())
|
|
|
+ .eq(SmsbDeviceChatScReport::getType, 1)
|
|
|
+ .orderByDesc(SmsbDeviceChatScReport::getAppointmentId).last("limit 1"));
|
|
|
+ deviceStartInfo.setHelloWorld(report.getContent());
|
|
|
+ } else if (deviceGroupRel.getSceneSort().equals(DEFAULT_SCENE_SORT_2)) {
|
|
|
+
|
|
|
+ } else if (deviceGroupRel.getSceneSort().equals(DEFAULT_SCENE_SORT_3)) {
|
|
|
+
|
|
|
+ } else if (deviceGroupRel.getSceneSort().equals(DEFAULT_SCENE_SORT_4)) {
|
|
|
+
|
|
|
+ }
|
|
|
+ deviceStartInfoList.add(deviceStartInfo);
|
|
|
+ }
|
|
|
+ result.setDeviceStartInfoList(deviceStartInfoList);
|
|
|
+ // TODO 异步现场启动 更新知识库
|
|
|
+ return R.ok(result);
|
|
|
}
|
|
|
}
|