package com.ruoyi.admin.controller;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONObject;
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
import com.ruoyi.admin.entity.Order;
|
import com.ruoyi.admin.service.OrderService;
|
import com.ruoyi.common.core.domain.R;
|
import lombok.extern.slf4j.Slf4j;
|
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RestController;
|
|
import javax.annotation.Resource;
|
import java.util.Objects;
|
|
/**
|
* <p>
|
* 协议政策、司机操作指导 前端控制器
|
* </p>
|
*
|
* @author hjl
|
* @since 2024-05-29
|
*/
|
@Slf4j
|
@RestController
|
@RequestMapping("/privateNumber")
|
public class PrivateNumberCallBackController {
|
|
|
@Resource
|
private OrderService orderService;
|
|
/**
|
* 隐私号码回调
|
*/
|
@PostMapping(value = "/callBack")
|
public R<String> callBack(@RequestBody JSONObject jsonObject) {
|
JSONArray feeLst = jsonObject.getJSONArray("feeLst");
|
for (int i = 0; i < feeLst.size(); i++) {
|
JSONObject feeLstJson = feeLst.getJSONObject(i);
|
String subscriptionId = feeLstJson.getString("subscriptionId");
|
String recordDomain = feeLstJson.getString("recordDomain");
|
String recordObjectName = feeLstJson.getString("recordObjectName");
|
String recordBucketName = feeLstJson.getString("recordBucketName");
|
log.info("隐私号码回调:{},录音文件名:{},录音服务器名:{}", subscriptionId, recordObjectName, recordDomain);
|
Order order = orderService.getOne(Wrappers.lambdaQuery(Order.class)
|
.eq(Order::getSubscriptionId, subscriptionId)
|
.last("LIMIT 1"));
|
if(Objects.nonNull(order)){
|
order.setRecordDomain(recordDomain);
|
order.setRecordObjectName(recordObjectName);
|
orderService.updateById(order);
|
}
|
}
|
return R.ok("OK");
|
}
|
|
}
|