修改获取回调数据接口
This commit is contained in:
parent
0e0c1c090b
commit
a86ae8e6bb
@ -9,13 +9,6 @@ spring:
|
|||||||
url: jdbc:mysql://127.0.0.1:3306/post-discharge-hkey?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&allowMultiQueries=true
|
url: jdbc:mysql://127.0.0.1:3306/post-discharge-hkey?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&allowMultiQueries=true
|
||||||
username: root
|
username: root
|
||||||
password: Hk2y!@#$
|
password: Hk2y!@#$
|
||||||
# 从库数据源
|
|
||||||
slave:
|
|
||||||
# 从数据源开关/默认关闭
|
|
||||||
enabled: true
|
|
||||||
url: jdbc:mysql://47.104.245.3:3306/aiob_callback?useSSL=false&serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8&allowPublicKeyRetrieval=true
|
|
||||||
username: root
|
|
||||||
password: Xyl_1024!@#$
|
|
||||||
hkhis:
|
hkhis:
|
||||||
# 从数据源开关/默认关闭
|
# 从数据源开关/默认关闭
|
||||||
enabled: true
|
enabled: true
|
||||||
|
|||||||
@ -35,14 +35,6 @@ public class DruidConfig {
|
|||||||
return druidProperties.dataSource(dataSource);
|
return druidProperties.dataSource(dataSource);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
|
||||||
@ConfigurationProperties("spring.datasource.druid.slave")
|
|
||||||
@ConditionalOnProperty(prefix = "spring.datasource.druid.slave", name = "enabled", havingValue = "true")
|
|
||||||
public DataSource slaveDataSource(DruidProperties druidProperties) {
|
|
||||||
DruidDataSource dataSource = DruidDataSourceBuilder.create().build();
|
|
||||||
return druidProperties.dataSource(dataSource);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
@ConfigurationProperties("spring.datasource.druid.hkhis")
|
@ConfigurationProperties("spring.datasource.druid.hkhis")
|
||||||
@ -57,7 +49,6 @@ public class DruidConfig {
|
|||||||
public DynamicDataSource dataSource(DataSource masterDataSource) {
|
public DynamicDataSource dataSource(DataSource masterDataSource) {
|
||||||
Map<Object, Object> targetDataSources = new HashMap<>();
|
Map<Object, Object> targetDataSources = new HashMap<>();
|
||||||
targetDataSources.put(DataSourceType.MASTER.name(), masterDataSource);
|
targetDataSources.put(DataSourceType.MASTER.name(), masterDataSource);
|
||||||
setDataSource(targetDataSources, DataSourceType.SLAVE.name(), "slaveDataSource");
|
|
||||||
setDataSource(targetDataSources, DataSourceType.HKHIS.name(), "hkhisDataSource");
|
setDataSource(targetDataSources, DataSourceType.HKHIS.name(), "hkhisDataSource");
|
||||||
return new DynamicDataSource(masterDataSource, targetDataSources);
|
return new DynamicDataSource(masterDataSource, targetDataSources);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,7 +11,7 @@ import org.apache.ibatis.annotations.Param;
|
|||||||
* @Author haown
|
* @Author haown
|
||||||
* @Date 2025-12-23 15:45
|
* @Date 2025-12-23 15:45
|
||||||
*/
|
*/
|
||||||
@DataSource(DataSourceType.SLAVE)
|
|
||||||
public interface AIOBCallbackMapper {
|
public interface AIOBCallbackMapper {
|
||||||
|
|
||||||
List<AIOBCallbackEntity> getList(AIOBCallbackEntity query);
|
List<AIOBCallbackEntity> getList(AIOBCallbackEntity query);
|
||||||
|
|||||||
@ -1,11 +1,24 @@
|
|||||||
package com.xinelu.manage.service.aiob.impl;
|
package com.xinelu.manage.service.aiob.impl;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson2.JSON;
|
||||||
|
import com.alibaba.fastjson2.JSONArray;
|
||||||
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
|
import com.xinelu.common.exception.ServiceException;
|
||||||
import com.xinelu.manage.domain.aiob.AIOBCallbackEntity;
|
import com.xinelu.manage.domain.aiob.AIOBCallbackEntity;
|
||||||
import com.xinelu.manage.mapper.aiob.AIOBCallbackMapper;
|
import com.xinelu.manage.mapper.aiob.AIOBCallbackMapper;
|
||||||
import com.xinelu.manage.service.aiob.IAIOBCallbackService;
|
import com.xinelu.manage.service.aiob.IAIOBCallbackService;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.http.HttpEntity;
|
||||||
|
import org.springframework.http.HttpMethod;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.web.client.RestTemplate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description: 阿里云服务器百度外呼回调Service实现
|
* @description: 阿里云服务器百度外呼回调Service实现
|
||||||
@ -13,16 +26,46 @@ import org.springframework.stereotype.Service;
|
|||||||
* @create: 2025-12-23 15:30
|
* @create: 2025-12-23 15:30
|
||||||
**/
|
**/
|
||||||
@Service
|
@Service
|
||||||
|
@Slf4j
|
||||||
public class AIOBCallbackServiceImpl implements IAIOBCallbackService {
|
public class AIOBCallbackServiceImpl implements IAIOBCallbackService {
|
||||||
@Resource
|
@Resource
|
||||||
private AIOBCallbackMapper aiobCallbackMapper;
|
private AIOBCallbackMapper aiobCallbackMapper;
|
||||||
|
@Value("${aiob.callBackUrl}")
|
||||||
|
private String callBackUrl;
|
||||||
@Override
|
@Override
|
||||||
public List<AIOBCallbackEntity> getList(AIOBCallbackEntity query) {
|
public List<AIOBCallbackEntity> getList(AIOBCallbackEntity query) {
|
||||||
return aiobCallbackMapper.getList(query);
|
// 接口获取外呼回调数据app
|
||||||
|
List<AIOBCallbackEntity> callbackEntityList = new ArrayList<>();
|
||||||
|
HttpEntity<JSONObject> requestEntity = new HttpEntity<>((JSONObject) JSON.toJSON(query));
|
||||||
|
RestTemplate restTemplate = new RestTemplate();
|
||||||
|
ResponseEntity<String> responseEntity = restTemplate.exchange(callBackUrl + "/getList", HttpMethod.POST, requestEntity, String.class);
|
||||||
|
JSONObject object = JSON.parseObject(responseEntity.getBody());
|
||||||
|
if (object == null || object.getInteger("code") == null || object.getInteger("code") != 0) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
if (object.containsKey("data")) {
|
||||||
|
JSONArray data = object.getJSONArray("data");
|
||||||
|
if (data != null && data.size() > 0) {
|
||||||
|
callbackEntityList = data.toJavaList(AIOBCallbackEntity.class);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return callbackEntityList;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public Integer updateReadState(Integer readState, Integer id) {
|
@Override public Integer updateReadState(Integer readState, Integer id) {
|
||||||
return aiobCallbackMapper.updateReadState(readState, id);
|
log.info("修改百度外呼回调数据已读状态--id:{}", id);
|
||||||
|
JSONObject TaskCallbackUpdateDto = new JSONObject();
|
||||||
|
TaskCallbackUpdateDto.fluentPut("id", id).fluentPut("readState", readState);
|
||||||
|
HttpEntity<JSONObject> requestEntity = new HttpEntity<>(TaskCallbackUpdateDto);
|
||||||
|
RestTemplate restTemplate = new RestTemplate();
|
||||||
|
ResponseEntity<String> responseEntity = restTemplate.exchange(callBackUrl + "/updateReadState", 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"));
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
log.info("修改百度外呼回调数据已读状态成功--id:{}", id);
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public Integer deleteData() {
|
@Override public Integer deleteData() {
|
||||||
|
|||||||
@ -204,7 +204,7 @@ public class UploadRobotPublishTask {
|
|||||||
createTaskDto.setRetryInterval(nodeFirstTemp.getPhoneTimeInterval());
|
createTaskDto.setRetryInterval(nodeFirstTemp.getPhoneTimeInterval());
|
||||||
createTaskDto.setNumTypeFilterList(Arrays.asList(1, 2));
|
createTaskDto.setNumTypeFilterList(Arrays.asList(1, 2));
|
||||||
createTaskDto.setTaskDataCallback(true);
|
createTaskDto.setTaskDataCallback(true);
|
||||||
createTaskDto.setCallBackUrl(callBackUrl);
|
createTaskDto.setCallBackUrl(callBackUrl+ "/taskCallBack");
|
||||||
createTaskDto.setDialStartTime(localStartTime.format(DateTimeFormatter.ofPattern("HH:mm")));
|
createTaskDto.setDialStartTime(localStartTime.format(DateTimeFormatter.ofPattern("HH:mm")));
|
||||||
createTaskDto.setDialEndTime(localEndTime.format(DateTimeFormatter.ofPattern("HH:mm")));
|
createTaskDto.setDialEndTime(localEndTime.format(DateTimeFormatter.ofPattern("HH:mm")));
|
||||||
taskId = aiobService.createTask(createTaskDto);
|
taskId = aiobService.createTask(createTaskDto);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user