xuhy
7 天以前 640d93c464c65a0ef128f7f357a3e9abe44fbd2c
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
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");
    }
 
}