buli
2022-05-14 ead4df22dca33a867279471821ca675f91dec760
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
62
63
64
65
66
67
68
/**********************************************************************
通话记录
*************************************************************************/
@RestResource(urlMapping='/SBGCallLog/*')
global with sharing class SBGCallLogRest {
    
    global class GeDatasRest {
        public GeDatas GeDatas;
    }
 
    global class GeDatas {
        public NFMUtil.Monitoring Monitoring;
        public GeData[] GeData;
    }
    /*
    通话记录:  1 呼叫标识(callid) 2 呼叫类型(callType  0呼入 1 呼出)3 主叫号码(callerNo)  4  被叫号码( calleeNo) 5 呼叫时间   6.接听时间  7 挂机时间  8 录音文件名地址
未接电话:  1呼叫标识(callid) 2 来电号码   3  来电时间
    */
    global class GeData {
 
        public String callid; //呼叫标识
        public String callType; //呼叫类型
        public String callerNo; //主叫号码
        public String calleeNo; //被叫号码
        public String callTime; //呼叫时间
        public String answerTime; //接听时间
        public String hangUpTime; //挂机时间
        public String recordingAddress; //录音文件名地址
        public String callLogType;//通话状态
        
    }
 
    @HttpPost
    global static void execute() {
        // 取得接口传输内容
        String strData = RestContext.request.requestBody.toString();
        GeDatasRest ges = (GeDatasRest) JSON.deserializeStrict(strData, GeDatasRest.class);
 
        if (ges == null ) {
            return;
        }
 
        NFMUtil.Monitoring Monitoring = ges.GeDatas.Monitoring;
        if (Monitoring == null) {
            return;
        }
 
        BatchIF_Log__c rowData = NFMUtil.saveRowData(Monitoring, 'SBGCallLog', ges.GeDatas.GeData);
        if (String.isBlank(rowData.Log__c) == false) {
            executefuture(rowData.Id);
        }
        // JSONを戻す
        RestResponse res = RestContext.response;
        res.addHeader('Content-Type', 'application/json');
        res.statusCode = 200;
        String jsonResponse = '{"status": "Success", "Message":""}';
        res.responseBody = blob.valueOf(jsonResponse);
        return;
    }
 
    @future
    global static void executefuture(String rowData_Id) {
        main(rowData_Id);
    }
 
    global static void main(String rowData_Id) {
    }
}