Compare commits
4 Commits
4c3009126f
...
8188f46fbd
Author | SHA1 | Date | |
---|---|---|---|
|
8188f46fbd | ||
|
076e33fb1c | ||
|
80a6780857 | ||
|
61a4c5f912 |
@ -57,7 +57,7 @@ if [ ! -d "$APP" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! "$3" == "nb" ]; then
|
if [ ! "$3" == "nb" ]; then
|
||||||
mvn -T 4C clean package -pl $APP -am -DskipTests
|
mvn clean package -pl $APP -am -DskipTests
|
||||||
fi
|
fi
|
||||||
|
|
||||||
TARGET_DIR=$APP/target
|
TARGET_DIR=$APP/target
|
||||||
@ -68,6 +68,10 @@ echo "JAR [$JAR] found"
|
|||||||
if [ "$2" == "test" ]; then
|
if [ "$2" == "test" ]; then
|
||||||
echo "Deploy test."
|
echo "Deploy test."
|
||||||
deploy_server 'xiadou@118.24.251.131' $APP $JAR
|
deploy_server 'xiadou@118.24.251.131' $APP $JAR
|
||||||
|
elif [ "$2" == "cd" ]; then
|
||||||
|
echo "Deploy chengdu prod."
|
||||||
|
PORT=3022
|
||||||
|
deploy_server 'xiandou@171.217.82.63' $APP $JAR $PORT
|
||||||
elif [ "$2" == "prod" ]; then
|
elif [ "$2" == "prod" ]; then
|
||||||
echo "Deploy prod."
|
echo "Deploy prod."
|
||||||
PORT=4026
|
PORT=4026
|
||||||
|
@ -22,8 +22,8 @@ public class BaseReqDial implements Serializable {
|
|||||||
@NotNull
|
@NotNull
|
||||||
private DialType dialType = DialType.MANUAL;
|
private DialType dialType = DialType.MANUAL;
|
||||||
|
|
||||||
private String bizKey;
|
private String caseKey;
|
||||||
private String attachedData;
|
private String metaData;
|
||||||
private String attrs;
|
private String attrs;
|
||||||
|
|
||||||
private int timeout = 60;
|
private int timeout = 60;
|
||||||
|
@ -237,6 +237,7 @@
|
|||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="cmsCount" resultType="int">
|
<select id="cmsCount" resultType="int">
|
||||||
|
<bind name="__set_table__" value="__search__.table('s')" />
|
||||||
select count(1)
|
select count(1)
|
||||||
from <include refid="table"/> s
|
from <include refid="table"/> s
|
||||||
left join br_queue_agent qa
|
left join br_queue_agent qa
|
||||||
@ -245,6 +246,7 @@
|
|||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="cmsList" resultType="com.pudonghot.yo.model.domain.AgentStatus">
|
<select id="cmsList" resultType="com.pudonghot.yo.model.domain.AgentStatus">
|
||||||
|
<bind name="__set_table__" value="__search__.table('s')" />
|
||||||
select s.*, qa.queue_id
|
select s.*, qa.queue_id
|
||||||
from <include refid="table"/> s
|
from <include refid="table"/> s
|
||||||
left join br_queue_agent qa
|
left join br_queue_agent qa
|
||||||
|
@ -4,6 +4,7 @@ import org.apache.ibatis.annotations.Param;
|
|||||||
import me.chyxion.tigon.mybatis.BaseMapper;
|
import me.chyxion.tigon.mybatis.BaseMapper;
|
||||||
import com.pudonghot.yo.model.domain.CallDetailRecord;
|
import com.pudonghot.yo.model.domain.CallDetailRecord;
|
||||||
import com.pudonghot.yo.model.domain.CallDetailRecordBase;
|
import com.pudonghot.yo.model.domain.CallDetailRecordBase;
|
||||||
|
import com.pudonghot.yo.mapper.response.CallDetailRecordDailyQueryDbResp;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Donghuang <br>
|
* @author Donghuang <br>
|
||||||
@ -37,4 +38,22 @@ public interface CallDetailRecordMapper extends BaseMapper<Integer, CallDetailRe
|
|||||||
* @return delete row
|
* @return delete row
|
||||||
*/
|
*/
|
||||||
int deleteExpired();
|
int deleteExpired();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* daily query by case key
|
||||||
|
*
|
||||||
|
* @param tenantId tenant id
|
||||||
|
* @param caseKey case key
|
||||||
|
* @return resp
|
||||||
|
*/
|
||||||
|
CallDetailRecordDailyQueryDbResp dailyQueryByCaseKey(@Param("tenantId") Integer tenantId, @Param("caseKey") String caseKey);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* daily query by phone
|
||||||
|
*
|
||||||
|
* @param tenantId tenant id
|
||||||
|
* @param called called
|
||||||
|
* @return resp
|
||||||
|
*/
|
||||||
|
CallDetailRecordDailyQueryDbResp dailyQueryByPhone(@Param("tenantId") Integer tenantId, @Param("calledNumber") String called);
|
||||||
}
|
}
|
||||||
|
@ -42,4 +42,25 @@
|
|||||||
start_stamp < date(now() - interval 31 day)
|
start_stamp < date(now() - interval 31 day)
|
||||||
]]>
|
]]>
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
|
<select id="dailyQueryByCaseKey" resultType="com.pudonghot.yo.mapper.response.CallDetailRecordDailyQueryDbResp">
|
||||||
|
select count(1) total,
|
||||||
|
count(r.answer_stamp) answered
|
||||||
|
from br_call_detail_record r
|
||||||
|
where r.tenant_id = #{tenantId}
|
||||||
|
and r.case_key = #{caseKey}
|
||||||
|
and r.start_stamp between date(now())
|
||||||
|
and date(now() + interval 1 day)
|
||||||
|
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="dailyQueryByPhone" resultType="com.pudonghot.yo.mapper.response.CallDetailRecordDailyQueryDbResp">
|
||||||
|
select count(1) total,
|
||||||
|
count(r.answer_stamp) answered
|
||||||
|
from br_call_detail_record r
|
||||||
|
where r.tenant_id = #{tenantId}
|
||||||
|
and r.called_number = #{calledNumber}
|
||||||
|
and r.start_stamp between date(now())
|
||||||
|
and date(now() + interval 1 day)
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
@ -0,0 +1,20 @@
|
|||||||
|
package com.pudonghot.yo.mapper.response;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.ToString;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Donghuang
|
||||||
|
* @date Dec 05, 2021 23:04:17
|
||||||
|
*/
|
||||||
|
@Setter
|
||||||
|
@Getter
|
||||||
|
@ToString
|
||||||
|
public class CallDetailRecordDailyQueryDbResp implements Serializable {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
private Integer total;
|
||||||
|
private Integer answered;
|
||||||
|
}
|
@ -96,4 +96,10 @@ public class CallDetailRecordMapperTest {
|
|||||||
public void testDeleteExpired() {
|
public void testDeleteExpired() {
|
||||||
mapper.deleteExpired();
|
mapper.deleteExpired();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testQuery() {
|
||||||
|
mapper.dailyQueryByCaseKey(1, "XXX");
|
||||||
|
mapper.dailyQueryByPhone(1, "XXX");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.pudonghot.yo.fsagent.service.dubbo.impl;
|
package com.pudonghot.yo.fsagent.service.dubbo.impl;
|
||||||
|
|
||||||
|
import lombok.val;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -7,7 +8,6 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
import org.springframework.util.Assert;
|
import org.springframework.util.Assert;
|
||||||
import com.pudonghot.yo.model.domain.Agent;
|
import com.pudonghot.yo.model.domain.Agent;
|
||||||
import com.wacai.tigon.sequence.IdSequence;
|
import com.wacai.tigon.sequence.IdSequence;
|
||||||
import com.pudonghot.yo.model.domain.Tenant;
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import com.pudonghot.yo.mapper.AgentGroupMapper;
|
import com.pudonghot.yo.mapper.AgentGroupMapper;
|
||||||
import com.pudonghot.yo.model.domain.AgentGroup;
|
import com.pudonghot.yo.model.domain.AgentGroup;
|
||||||
@ -45,21 +45,21 @@ abstract class AbstractDialer<LegB> {
|
|||||||
* @param arg dial arg
|
* @param arg dial arg
|
||||||
*/
|
*/
|
||||||
public void dial(DialArg<LegB> arg) {
|
public void dial(DialArg<LegB> arg) {
|
||||||
final BaseReqDial req = arg.getReq();
|
val req = arg.getReq();
|
||||||
final Agent agent = arg.getAgentLegA();
|
val agent = arg.getAgentLegA();
|
||||||
// validate only
|
// validate only
|
||||||
findValidAgentGroup(agent);
|
findValidAgentGroup(agent);
|
||||||
|
|
||||||
final List<String> varsLegA = varsLegA(arg);
|
val varsLegA = varsLegA(arg);
|
||||||
extVarsLegA(arg, varsLegA);
|
extVarsLegA(arg, varsLegA);
|
||||||
|
|
||||||
final List<String> varsLegB = varsLegB(arg);
|
val varsLegB = varsLegB(arg);
|
||||||
extVarsLegB(arg, varsLegB);
|
extVarsLegB(arg, varsLegB);
|
||||||
|
|
||||||
final List<String> varsGlobal = varsGlobal(req);
|
val varsGlobal = varsGlobal(req);
|
||||||
extVarsGlobal(arg, varsGlobal);
|
extVarsGlobal(arg, varsGlobal);
|
||||||
|
|
||||||
final String commandArg =
|
val commandArg =
|
||||||
format("{{}}{} &bridge({})",
|
format("{{}}{} &bridge({})",
|
||||||
join(varsGlobal, ","),
|
join(varsGlobal, ","),
|
||||||
format("[{}]{}", join(varsLegB, ","), dialStrLegB(arg)),
|
format("[{}]{}", join(varsLegB, ","), dialStrLegB(arg)),
|
||||||
@ -122,7 +122,7 @@ abstract class AbstractDialer<LegB> {
|
|||||||
*/
|
*/
|
||||||
protected List<String> varsGlobal(final BaseReqDial req) {
|
protected List<String> varsGlobal(final BaseReqDial req) {
|
||||||
// Global vars
|
// Global vars
|
||||||
final List<String> vars = new ArrayList<>(16);
|
val vars = new ArrayList<String>(16);
|
||||||
if (req.isIgnoreEarlyMedia()) {
|
if (req.isIgnoreEarlyMedia()) {
|
||||||
vars.add("ignore_early_media=true");
|
vars.add("ignore_early_media=true");
|
||||||
}
|
}
|
||||||
@ -137,30 +137,30 @@ abstract class AbstractDialer<LegB> {
|
|||||||
* @return vars leg A
|
* @return vars leg A
|
||||||
*/
|
*/
|
||||||
protected List<String> varsLegA(final DialArg<LegB> arg) {
|
protected List<String> varsLegA(final DialArg<LegB> arg) {
|
||||||
final List<String> vars = new ArrayList<>(16);
|
val vars = new ArrayList<String>(16);
|
||||||
final BaseReqDial req = arg.getReq();
|
val req = arg.getReq();
|
||||||
final Agent agent = arg.getAgentLegA();
|
val agent = arg.getAgentLegA();
|
||||||
vars.add(agentTypeVar(agent.getType()));
|
vars.add(agentTypeVar(agent.getType()));
|
||||||
if (agent.getWebrtc()) {
|
if (agent.getWebrtc()) {
|
||||||
vars.add("media_webrtc=true");
|
vars.add("media_webrtc=true");
|
||||||
}
|
}
|
||||||
vars.add("odbc-cdr-ignore-leg=true");
|
vars.add("odbc-cdr-ignore-leg=true");
|
||||||
vars.add("x_logic_role=CALLER");
|
vars.add("x_logic_role=CALLER");
|
||||||
final String connId = arg.getConnId();
|
val connId = arg.getConnId();
|
||||||
vars.add("x_conn_id=" + connId);
|
vars.add("x_conn_id=" + connId);
|
||||||
final Tenant tenant = arg.getTenant();
|
val tenant = arg.getTenant();
|
||||||
vars.add("x_tenant_id=" + tenant.getId());
|
vars.add("x_tenant_id=" + tenant.getId());
|
||||||
vars.add("x_tenant_code=" + tenant.getCode());
|
vars.add("x_tenant_code=" + tenant.getCode());
|
||||||
vars.add("x_account=" + agent.getAccount());
|
vars.add("x_account=" + agent.getAccount());
|
||||||
|
|
||||||
final CallDetailRecord.DialType dialType = req.getDialType();
|
val dialType = req.getDialType();
|
||||||
vars.add(dialTypeVar(dialType));
|
vars.add(dialTypeVar(dialType));
|
||||||
vars.add(headerDialTypeVar(dialType));
|
vars.add(headerDialTypeVar(dialType));
|
||||||
|
|
||||||
// for compatible
|
// for compatible
|
||||||
// vars.add("sip_h_X-Genesys-CallUUID=" + connId);
|
// vars.add("sip_h_X-Genesys-CallUUID=" + connId);
|
||||||
|
|
||||||
bizKey(vars, req.getBizKey());
|
addCaseKey(vars, req.getCaseKey());
|
||||||
// self
|
// self
|
||||||
vars.add("callee_id_number=" + agent.getAgent());
|
vars.add("callee_id_number=" + agent.getAgent());
|
||||||
vars.add("callee_id_name=" + agent.getAccount());
|
vars.add("callee_id_name=" + agent.getAccount());
|
||||||
@ -168,9 +168,9 @@ abstract class AbstractDialer<LegB> {
|
|||||||
vars.add("sip_auto_answer=true");
|
vars.add("sip_auto_answer=true");
|
||||||
vars.add("origination_uuid=" + idSeq.get());
|
vars.add("origination_uuid=" + idSeq.get());
|
||||||
vars.add("sip_invite_call_id=" + connId);
|
vars.add("sip_invite_call_id=" + connId);
|
||||||
final String attachedData = req.getAttachedData();
|
val metaData = req.getMetaData();
|
||||||
if (StringUtils.isNotBlank(attachedData)) {
|
if (StringUtils.isNotBlank(metaData)) {
|
||||||
vars.add("sip_h_X-Meta-Data=" + attachedData);
|
vars.add("sip_h_X-Meta-Data=" + metaData);
|
||||||
}
|
}
|
||||||
return vars;
|
return vars;
|
||||||
}
|
}
|
||||||
@ -183,14 +183,14 @@ abstract class AbstractDialer<LegB> {
|
|||||||
*/
|
*/
|
||||||
protected List<String> varsLegB(final DialArg<LegB> arg) {
|
protected List<String> varsLegB(final DialArg<LegB> arg) {
|
||||||
|
|
||||||
final BaseReqDial req = arg.getReq();
|
val req = arg.getReq();
|
||||||
final Tenant tenant = arg.getTenant();
|
val tenant = arg.getTenant();
|
||||||
final Agent agent = arg.getAgentLegA();
|
val agent = arg.getAgentLegA();
|
||||||
final String userUri = agent.getAgent() + "@" + tenant.getRealm();
|
val userUri = agent.getAgent() + "@" + tenant.getRealm();
|
||||||
// Global vars
|
// Global vars
|
||||||
final List<String> vars = new ArrayList<>(16);
|
val vars = new ArrayList<String>(16);
|
||||||
final String recLoc = recLoc(arg);
|
val recLoc = recLoc(arg);
|
||||||
final String connId = arg.getConnId();
|
val connId = arg.getConnId();
|
||||||
vars.addAll(Arrays.asList(new String[] {
|
vars.addAll(Arrays.asList(new String[] {
|
||||||
"x_logic_role=CALLED",
|
"x_logic_role=CALLED",
|
||||||
"x_tenant_id=" + tenant.getId(),
|
"x_tenant_id=" + tenant.getId(),
|
||||||
@ -223,14 +223,14 @@ abstract class AbstractDialer<LegB> {
|
|||||||
"record_post_process_exec_api='curl:" + localApiService.getPostRecUrl() + " post tenantId=" + tenant.getId() + "&loc=" + recLoc + "'"
|
"record_post_process_exec_api='curl:" + localApiService.getPostRecUrl() + " post tenantId=" + tenant.getId() + "&loc=" + recLoc + "'"
|
||||||
}));
|
}));
|
||||||
|
|
||||||
bizKey(vars, req.getBizKey());
|
addCaseKey(vars, req.getCaseKey());
|
||||||
|
|
||||||
return vars;
|
return vars;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void bizKey(final List<String> vars, String bizKey) {
|
protected void addCaseKey(final List<String> vars, String caseKey) {
|
||||||
if (StringUtils.isNotBlank(bizKey)) {
|
if (StringUtils.isNotBlank(caseKey)) {
|
||||||
vars.add("x_biz_key=" + bizKey);
|
vars.add("x_case_key=" + caseKey);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -263,7 +263,7 @@ abstract class AbstractDialer<LegB> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
AgentGroup findValidAgentGroup(final Agent agent) {
|
AgentGroup findValidAgentGroup(final Agent agent) {
|
||||||
final AgentGroup agentGroup = agentGroupMapper.find(agent.getGroupId());
|
val agentGroup = agentGroupMapper.find(agent.getGroupId());
|
||||||
Assert.state(agentGroup != null,
|
Assert.state(agentGroup != null,
|
||||||
() -> "No agent [" + agent.getAccount() + "] group found");
|
() -> "No agent [" + agent.getAccount() + "] group found");
|
||||||
Assert.state(agentGroup.getActive(),
|
Assert.state(agentGroup.getActive(),
|
||||||
|
@ -2,6 +2,7 @@ package com.pudonghot.yo.fsagent.service.dubbo.impl;
|
|||||||
|
|
||||||
import com.pudonghot.yo.mapper.*;
|
import com.pudonghot.yo.mapper.*;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import lombok.val;
|
||||||
import me.chyxion.tigon.mybatis.Search;
|
import me.chyxion.tigon.mybatis.Search;
|
||||||
import com.pudonghot.yo.model.domain.*;
|
import com.pudonghot.yo.model.domain.*;
|
||||||
import org.springframework.util.Assert;
|
import org.springframework.util.Assert;
|
||||||
@ -108,11 +109,11 @@ public class DialServiceImpl implements DialService {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public RespDial agentDial(final ReqAgentDial req) {
|
public RespDial agentDial(final ReqAgentDial req) {
|
||||||
final Integer tenantId = req.getTenantId();
|
val tenantId = req.getTenantId();
|
||||||
final Tenant tenant = findValidTenant(tenantId);
|
val tenant = findValidTenant(tenantId);
|
||||||
|
|
||||||
final String account = req.getAccount();
|
val account = req.getAccount();
|
||||||
final Agent agent = agentMapper.find(
|
val agent = agentMapper.find(
|
||||||
new Search(Agent.TENANT_ID, tenantId)
|
new Search(Agent.TENANT_ID, tenantId)
|
||||||
.eq(Agent.ACCOUNT, account));
|
.eq(Agent.ACCOUNT, account));
|
||||||
Assert.state(agent != null,
|
Assert.state(agent != null,
|
||||||
@ -120,23 +121,23 @@ public class DialServiceImpl implements DialService {
|
|||||||
Assert.state(agent.getActive(),
|
Assert.state(agent.getActive(),
|
||||||
() -> "Agent [" + account + "] is not active");
|
() -> "Agent [" + account + "] is not active");
|
||||||
|
|
||||||
final String calledNumber = req.getCalledNumber();
|
val calledNumber = req.getCalledNumber();
|
||||||
|
|
||||||
final Agent otherAgent = agentMapper.find(
|
val otherAgent = agentMapper.find(
|
||||||
new Search(Agent.TENANT_ID, tenantId)
|
new Search(Agent.TENANT_ID, tenantId)
|
||||||
.eq(StringUtils.isNumeric(calledNumber) ?
|
.eq(StringUtils.isNumeric(calledNumber) ?
|
||||||
Agent.AGENT : Agent.ACCOUNT, calledNumber));
|
Agent.AGENT : Agent.ACCOUNT, calledNumber));
|
||||||
|
|
||||||
if (otherAgent != null) {
|
if (otherAgent != null) {
|
||||||
log.info("Dial internal agent [{}].", otherAgent);
|
log.info("Dial internal agent [{}].", otherAgent);
|
||||||
final String otherAgentAccount = otherAgent.getAccount();
|
val otherAgentAccount = otherAgent.getAccount();
|
||||||
Assert.state(otherAgent.getActive(),
|
Assert.state(otherAgent.getActive(),
|
||||||
() -> "Other agent [" + otherAgentAccount + "] is not active");
|
() -> "Other agent [" + otherAgentAccount + "] is not active");
|
||||||
req.setCalledNumber(otherAgent.getAgent());
|
req.setCalledNumber(otherAgent.getAgent());
|
||||||
return dialInternal(idSeq.get(), req, tenant, agent, otherAgent);
|
return dialInternal(idSeq.get(), req, tenant, agent, otherAgent);
|
||||||
}
|
}
|
||||||
|
|
||||||
final Trunk trunk =
|
val trunk =
|
||||||
trunkMapper.findOfAgentGroup(agent.getGroupId());
|
trunkMapper.findOfAgentGroup(agent.getGroupId());
|
||||||
Assert.state(trunk != null,
|
Assert.state(trunk != null,
|
||||||
() -> "No trunk of agent [" + agent.getAccount() + "] found");
|
() -> "No trunk of agent [" + agent.getAccount() + "] found");
|
||||||
|
@ -1,46 +0,0 @@
|
|||||||
package com.pudonghot.yo.fsagent.service.request;
|
|
||||||
|
|
||||||
import lombok.Getter;
|
|
||||||
import lombok.Setter;
|
|
||||||
import java.util.Date;
|
|
||||||
import lombok.ToString;
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Donghuang
|
|
||||||
* @date Sep 08, 2021 10:50:55
|
|
||||||
*/
|
|
||||||
@Setter
|
|
||||||
@Getter
|
|
||||||
@ToString
|
|
||||||
public class CallDetailtRecordCreateServReq implements Serializable {
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
private Integer tenantId;
|
|
||||||
private String tenantCode;
|
|
||||||
private String account;
|
|
||||||
private String connId;
|
|
||||||
private String dialType;
|
|
||||||
private String callType;
|
|
||||||
private String agentType;
|
|
||||||
private Integer campaignId;
|
|
||||||
private String caseKey;
|
|
||||||
|
|
||||||
private String uuid;
|
|
||||||
private String callUuid;
|
|
||||||
private String sipCallId;
|
|
||||||
private String callerNumber;
|
|
||||||
private String calledNumber;
|
|
||||||
private Integer trunkId;
|
|
||||||
private String callingPartyNumber;
|
|
||||||
private Date startStamp;
|
|
||||||
private Date answerStamp;
|
|
||||||
private Date endStamp;
|
|
||||||
private Long duration;
|
|
||||||
private Long mduration;
|
|
||||||
private Long billsec;
|
|
||||||
private Long billmsec;
|
|
||||||
private String endpointDisposition;
|
|
||||||
private String hangupCause;
|
|
||||||
private String hangupDisposition;
|
|
||||||
}
|
|
@ -1,6 +1,5 @@
|
|||||||
package com.pudonghot.yo.openapi.controller;
|
package com.pudonghot.yo.openapi.controller;
|
||||||
|
|
||||||
import com.pudonghot.yo.config.ConfigService;
|
|
||||||
import lombok.val;
|
import lombok.val;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
@ -10,6 +9,7 @@ import me.chyxion.tigon.mybatis.Search;
|
|||||||
import com.pudonghot.yo.model.domain.*;
|
import com.pudonghot.yo.model.domain.*;
|
||||||
import org.apache.commons.lang3.tuple.Pair;
|
import org.apache.commons.lang3.tuple.Pair;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import com.pudonghot.yo.config.ConfigService;
|
||||||
import com.pudonghot.yo.util.PhoneNumberUtils;
|
import com.pudonghot.yo.util.PhoneNumberUtils;
|
||||||
import org.apache.commons.lang3.time.DateUtils;
|
import org.apache.commons.lang3.time.DateUtils;
|
||||||
import com.pudonghot.yo.fs.model.domain.Channel;
|
import com.pudonghot.yo.fs.model.domain.Channel;
|
||||||
@ -121,17 +121,18 @@ public class CallController implements SessionAbility {
|
|||||||
ErrorCode.DIAL_CITIC_BLACKLIST);
|
ErrorCode.DIAL_CITIC_BLACKLIST);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val caseKey = args.getCaseKey();
|
||||||
// 白名单
|
// 白名单
|
||||||
if (phoneWhitelistMapper.exists(
|
if (phoneWhitelistMapper.exists(
|
||||||
new Search(PhoneWhitelist.TENANT_ID, tenantId)
|
new Search(PhoneWhitelist.TENANT_ID, tenantId)
|
||||||
.eq(PhoneWhitelist.PHONE, calledNumber)
|
.eq(PhoneWhitelist.PHONE, calledNumber)
|
||||||
.eq(PhoneWhitelist.ACTIVE, true))) {
|
.eq(PhoneWhitelist.ACTIVE, true))) {
|
||||||
return doDial(account, calledNumber);
|
return doDial(account, caseKey, calledNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 灰名单
|
// 灰名单
|
||||||
if (callDetailRecordMapper.calledNumberValidOfGreylist(tenantId, calledNumber)) {
|
if (callDetailRecordMapper.calledNumberValidOfGreylist(tenantId, calledNumber)) {
|
||||||
return doDial(account, calledNumber);
|
return doDial(account, caseKey, calledNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
val calledRecordsIn30Days = callDetailRecordMapper.list(
|
val calledRecordsIn30Days = callDetailRecordMapper.list(
|
||||||
@ -145,7 +146,7 @@ public class CallController implements SessionAbility {
|
|||||||
.limit(8));
|
.limit(8));
|
||||||
|
|
||||||
if (calledRecordsIn30Days.isEmpty()) {
|
if (calledRecordsIn30Days.isEmpty()) {
|
||||||
return doDial(account, calledNumber);
|
return doDial(account, caseKey, calledNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
val recSize = calledRecordsIn30Days.size();
|
val recSize = calledRecordsIn30Days.size();
|
||||||
@ -194,7 +195,7 @@ public class CallController implements SessionAbility {
|
|||||||
AssertUtils.state(!check ||
|
AssertUtils.state(!check ||
|
||||||
lastDialStamp.before(DateUtils.addDays(new Date(), -2)), ErrorCode.DIAL_EXCEED_IN_T2);
|
lastDialStamp.before(DateUtils.addDays(new Date(), -2)), ErrorCode.DIAL_EXCEED_IN_T2);
|
||||||
|
|
||||||
return doDial(account, calledNumber);
|
return doDial(account, caseKey, calledNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequestMapping("/answer")
|
@RequestMapping("/answer")
|
||||||
@ -379,11 +380,13 @@ public class CallController implements SessionAbility {
|
|||||||
|
|
||||||
private RespAgentDialout doDial(
|
private RespAgentDialout doDial(
|
||||||
final String account,
|
final String account,
|
||||||
|
final String caseKey,
|
||||||
final String calledNumber) {
|
final String calledNumber) {
|
||||||
|
|
||||||
val arg = new ReqAgentDial();
|
val arg = new ReqAgentDial();
|
||||||
arg.setTenantId(getTenantId());
|
arg.setTenantId(getTenantId());
|
||||||
arg.setAccount(account);
|
arg.setAccount(account);
|
||||||
|
arg.setCaseKey(caseKey);
|
||||||
arg.setCalledNumber(calledNumber);
|
arg.setCalledNumber(calledNumber);
|
||||||
return new RespAgentDialout(dialService.agentDial(arg).getUuid());
|
return new RespAgentDialout(dialService.agentDial(arg).getUuid());
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,42 @@
|
|||||||
|
package com.pudonghot.yo.openapi.controller;
|
||||||
|
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import com.wacai.tigon.json.JsonService;
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import com.pudonghot.yo.openapi.auth.SessionAbility;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import com.pudonghot.yo.openapi.service.CallDetailRecordService;
|
||||||
|
import com.pudonghot.yo.openapi.response.CallDetailRecordDailyQueryCtrlrResp;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Donghuang
|
||||||
|
* @date Dec 05, 2021 22:57:16
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Controller
|
||||||
|
@RequestMapping("/resource/cdr")
|
||||||
|
public class CallDetailRecordController implements SessionAbility {
|
||||||
|
@Autowired
|
||||||
|
private CallDetailRecordService service;
|
||||||
|
@Autowired
|
||||||
|
private JsonService jsonService;
|
||||||
|
|
||||||
|
@RequestMapping("/case-daily-report")
|
||||||
|
public CallDetailRecordDailyQueryCtrlrResp caseDailyReport(
|
||||||
|
@NotBlank
|
||||||
|
@RequestParam("caseKey")
|
||||||
|
final String caseKey) {
|
||||||
|
return jsonService.convert(service.dailyQueryByCaseKey(getTenantId(), caseKey), CallDetailRecordDailyQueryCtrlrResp.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequestMapping("/number-daily-report")
|
||||||
|
public CallDetailRecordDailyQueryCtrlrResp numberDailyReport(
|
||||||
|
@NotBlank
|
||||||
|
@RequestParam("number")
|
||||||
|
final String number) {
|
||||||
|
return jsonService.convert(service.dailyQueryByPhone(getTenantId(), number), CallDetailRecordDailyQueryCtrlrResp.class);
|
||||||
|
}
|
||||||
|
}
|
@ -4,6 +4,7 @@ import lombok.Getter;
|
|||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import lombok.ToString;
|
import lombok.ToString;
|
||||||
import javax.validation.constraints.NotBlank;
|
import javax.validation.constraints.NotBlank;
|
||||||
|
import com.wacai.tigon.format.annotation.Trim;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Donghuang
|
* @author Donghuang
|
||||||
@ -13,7 +14,9 @@ import javax.validation.constraints.NotBlank;
|
|||||||
@Setter
|
@Setter
|
||||||
@ToString
|
@ToString
|
||||||
public class ReqAgentDialout {
|
public class ReqAgentDialout {
|
||||||
private String caller;
|
@Trim
|
||||||
|
private String caseKey;
|
||||||
|
@Trim
|
||||||
@NotBlank
|
@NotBlank
|
||||||
private String called;
|
private String called;
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,20 @@
|
|||||||
|
package com.pudonghot.yo.openapi.response;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.ToString;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Donghuang
|
||||||
|
* @date Dec 05, 2021 23:22:49
|
||||||
|
*/
|
||||||
|
@Setter
|
||||||
|
@Getter
|
||||||
|
@ToString
|
||||||
|
public class CallDetailRecordDailyQueryCtrlrResp implements Serializable {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
private Integer total;
|
||||||
|
private Integer answered;
|
||||||
|
}
|
@ -0,0 +1,16 @@
|
|||||||
|
package com.pudonghot.yo.openapi.service;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
import com.pudonghot.yo.openapi.service.response.CallDetailRecordDailyQueryServResp;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Donghuang
|
||||||
|
* @date Jul 13, 2020 10:24:57
|
||||||
|
*/
|
||||||
|
public interface CallDetailRecordService {
|
||||||
|
|
||||||
|
CallDetailRecordDailyQueryServResp dailyQueryByCaseKey(@NotNull Integer tenantId, @NotBlank String caseKey);
|
||||||
|
|
||||||
|
CallDetailRecordDailyQueryServResp dailyQueryByPhone(@NotNull Integer tenantId, @NotBlank String called);
|
||||||
|
}
|
@ -0,0 +1,40 @@
|
|||||||
|
package com.pudonghot.yo.openapi.service.impl;
|
||||||
|
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import com.wacai.tigon.json.JsonService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import com.pudonghot.yo.mapper.CallDetailRecordMapper;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import com.pudonghot.yo.openapi.service.CallDetailRecordService;
|
||||||
|
import com.pudonghot.yo.openapi.service.response.CallDetailRecordDailyQueryServResp;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Donghuang
|
||||||
|
* @date Jul 13, 2020 10:25:41
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Service("openApiCallDetailRecordServiceImpl")
|
||||||
|
public class CallDetailRecordServiceImpl
|
||||||
|
implements CallDetailRecordService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private CallDetailRecordMapper mapper;
|
||||||
|
@Autowired
|
||||||
|
private JsonService jsonService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public CallDetailRecordDailyQueryServResp dailyQueryByCaseKey(final Integer tenantId, final String caseKey) {
|
||||||
|
return jsonService.convert(mapper.dailyQueryByCaseKey(tenantId, caseKey), CallDetailRecordDailyQueryServResp.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public CallDetailRecordDailyQueryServResp dailyQueryByPhone(final Integer tenantId, final String called) {
|
||||||
|
return jsonService.convert(mapper.dailyQueryByPhone(tenantId, called), CallDetailRecordDailyQueryServResp.class);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
package com.pudonghot.yo.openapi.service.response;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.ToString;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Donghuang
|
||||||
|
* @date Dec 05, 2021 23:04:17
|
||||||
|
*/
|
||||||
|
@Setter
|
||||||
|
@Getter
|
||||||
|
@ToString
|
||||||
|
public class CallDetailRecordDailyQueryServResp implements Serializable {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
private Integer total;
|
||||||
|
private Integer answered;
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user