临时提交
parent
a6a9c1926a
commit
67788c9ffe
|
|
@ -24,7 +24,7 @@ import java.util.stream.Collectors;
|
||||||
*/
|
*/
|
||||||
@Component
|
@Component
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Profile("default")
|
@Profile({"dev"})
|
||||||
public class AutoCallTaskScheduled {
|
public class AutoCallTaskScheduled {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
|
|
@ -65,9 +65,21 @@ public class AutoCallTaskScheduled {
|
||||||
log.info("AutoCallTaskScheduled {}个外呼人, {}", personList.size(), personList.stream().map(AutoCallPerson::getUploadCustName).collect(Collectors.toList()));
|
log.info("AutoCallTaskScheduled {}个外呼人, {}", personList.size(), personList.stream().map(AutoCallPerson::getUploadCustName).collect(Collectors.toList()));
|
||||||
try {
|
try {
|
||||||
for (AutoCallPerson person : personList) {
|
for (AutoCallPerson person : personList) {
|
||||||
autoCallTaskService.step3UploadAICCTask(person);
|
if (person.getUploadedTimes() < 2) {
|
||||||
|
autoCallTaskService.step3UploadAICCTask(person);
|
||||||
|
} else {
|
||||||
|
autoCallTaskService.cancelPerson(person);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// else if (person.getUploadedTimes() == 1) {
|
||||||
|
// autoCallTaskService.resetPerson(person);
|
||||||
|
// autoCallTaskService.step3UploadAICCTask(person);
|
||||||
|
// } else {
|
||||||
|
// autoCallTaskService.cancelPerson(person);
|
||||||
|
// continue;
|
||||||
|
// }
|
||||||
|
|
||||||
int pendingDuration = 60 * 1000 * 2;
|
int pendingDuration = 60 * 1000 * 3;
|
||||||
int loopGap = 1000;
|
int loopGap = 1000;
|
||||||
boolean success = false;
|
boolean success = false;
|
||||||
while (pendingDuration > 0) {
|
while (pendingDuration > 0) {
|
||||||
|
|
|
||||||
|
|
@ -1,19 +1,19 @@
|
||||||
package com.whdc.controller;
|
package com.whdc.controller;
|
||||||
|
|
||||||
import cn.hutool.http.HttpResponse;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.itextpdf.io.font.PdfEncodings;
|
import com.whdc.mapper.WarningResponderMapper;
|
||||||
import com.itextpdf.kernel.font.PdfFont;
|
|
||||||
import com.itextpdf.kernel.font.PdfFontFactory;
|
|
||||||
import com.whdc.model.dto.AutoCallDto;
|
import com.whdc.model.dto.AutoCallDto;
|
||||||
import com.whdc.model.dto.CallPutDto;
|
import com.whdc.model.dto.CallPutDto;
|
||||||
import com.whdc.model.entity.AutoCallPerson;
|
import com.whdc.model.entity.AutoCallPerson;
|
||||||
import com.whdc.model.entity.AutoCallTask;
|
import com.whdc.model.entity.AutoCallTask;
|
||||||
import com.whdc.model.entity.WarnCallMap;
|
import com.whdc.model.entity.WarnCallMap;
|
||||||
|
import com.whdc.model.entity.WarningResponder;
|
||||||
import com.whdc.service.AutoCallApiService;
|
import com.whdc.service.AutoCallApiService;
|
||||||
import com.whdc.service.AutoCallTaskService;
|
import com.whdc.service.AutoCallTaskService;
|
||||||
import com.whdc.service.AutoCallTaskService2;
|
import com.whdc.service.AutoCallTaskService2;
|
||||||
import com.whdc.utils.ResultJson;
|
import com.whdc.utils.ResultJson;
|
||||||
|
import com.whdc.utils.SmsHelper;
|
||||||
import org.apache.poi.util.IOUtils;
|
import org.apache.poi.util.IOUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
@ -24,6 +24,8 @@ import java.io.ByteArrayInputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -112,11 +114,17 @@ public class AutoCallController {
|
||||||
return ResultJson.ok(true);
|
return ResultJson.ok(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/manualClose")
|
||||||
|
public ResultJson<Boolean> manualClose(@RequestParam("taskId") Integer taskId, @RequestParam("personId") Integer personId) {
|
||||||
|
return ResultJson.ok(autoCallTaskService2.manualClose(taskId, personId));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据ID关闭预警
|
* 根据ID关闭预警
|
||||||
* @param taskId
|
* @param taskId
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
@GetMapping("/setCallIsPut")
|
@GetMapping("/setCallIsPut")
|
||||||
public ResultJson<Boolean> setCallIsPut(@RequestParam("taskId") Integer taskId) {
|
public ResultJson<Boolean> setCallIsPut(@RequestParam("taskId") Integer taskId) {
|
||||||
autoCallTaskService.setCallIsPut(taskId);
|
autoCallTaskService.setCallIsPut(taskId);
|
||||||
|
|
@ -128,6 +136,7 @@ public class AutoCallController {
|
||||||
* @param dto
|
* @param dto
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
@PostMapping("/setCallIsPutList")
|
@PostMapping("/setCallIsPutList")
|
||||||
public ResultJson<Boolean> setCallIsPutList(@RequestBody CallPutDto dto) {
|
public ResultJson<Boolean> setCallIsPutList(@RequestBody CallPutDto dto) {
|
||||||
autoCallTaskService.setCallIsPutList(dto);
|
autoCallTaskService.setCallIsPutList(dto);
|
||||||
|
|
@ -138,7 +147,7 @@ public class AutoCallController {
|
||||||
public void exportPDF(@RequestBody AutoCallDto dto,
|
public void exportPDF(@RequestBody AutoCallDto dto,
|
||||||
HttpServletResponse response,
|
HttpServletResponse response,
|
||||||
HttpServletRequest request) {
|
HttpServletRequest request) {
|
||||||
Page<AutoCallTask> autoCallTaskPage = autoCallApiService.page3(dto);
|
Page<AutoCallTask> autoCallTaskPage = autoCallApiService.pageForPdf(dto);
|
||||||
List<AutoCallTask> records = autoCallTaskPage.getRecords();
|
List<AutoCallTask> records = autoCallTaskPage.getRecords();
|
||||||
ByteArrayInputStream pdfStream = autoCallApiService.exportPDF(records, response, dto.getStm(), dto.getEtm());
|
ByteArrayInputStream pdfStream = autoCallApiService.exportPDF(records, response, dto.getStm(), dto.getEtm());
|
||||||
// 3. 设置响应头
|
// 3. 设置响应头
|
||||||
|
|
@ -167,4 +176,25 @@ public class AutoCallController {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private WarningResponderMapper wrm;
|
||||||
|
@Autowired
|
||||||
|
private SmsHelper smsHelper;
|
||||||
|
@GetMapping("/temp")
|
||||||
|
public ResultJson temp() {
|
||||||
|
String content = "领导您好!省防汛抗旱指挥部办公室将于8月7日启用预警叫应智能外呼系统。收到橙色以上气象预警后,系统将自动根据预警级别叫应相关责任人,来电显示“省防办值班室”,电话接通后,系统将播报AI预警信息并询问“如您已知晓上述信息,请按#号键”。请领导在收到预警叫应后,收听完整预警信息并根据语音提示按“#”号键进行确认。若未完成操作,系统将在1分钟内重拨,两次失败后将呼叫上一级责任人。特此报告。\n" +
|
||||||
|
"\n" +
|
||||||
|
"湖北省防汛抗旱指挥部办公室\n" +
|
||||||
|
"2025年8月6日";
|
||||||
|
List<WarningResponder> wrs = wrm.selectList(new QueryWrapper<WarningResponder>()
|
||||||
|
.ge("level", 0));
|
||||||
|
List<String> ret = new ArrayList<>();
|
||||||
|
wrs.forEach(wr -> {
|
||||||
|
wr.decryptPhone();
|
||||||
|
String s = smsHelper.send(Collections.singletonList(wr.getPhone()), content);
|
||||||
|
ret.add(wr.getPhone() + "-" + s);
|
||||||
|
});
|
||||||
|
return ResultJson.ok(wrs);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,8 @@ public interface AutoCallPersonMapper extends BaseMapper<AutoCallPerson> {
|
||||||
default List<AutoCallPerson> listUnUploaded() {
|
default List<AutoCallPerson> listUnUploaded() {
|
||||||
return selectList(
|
return selectList(
|
||||||
new QueryWrapper<AutoCallPerson>()
|
new QueryWrapper<AutoCallPerson>()
|
||||||
.eq("status", AutoCallPerson.STATUS_DEFAULT)
|
.in("status", AutoCallPerson.STATUS_DEFAULT, AutoCallPerson.STATUS_UPLOADED, AutoCallPerson.STATUS_CALLED)
|
||||||
|
.lt("uploaded_times", 2)
|
||||||
.orderByAsc("id")
|
.orderByAsc("id")
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
@ -25,6 +26,7 @@ public interface AutoCallPersonMapper extends BaseMapper<AutoCallPerson> {
|
||||||
new QueryWrapper<AutoCallPerson>()
|
new QueryWrapper<AutoCallPerson>()
|
||||||
.eq("task_id", taskId)
|
.eq("task_id", taskId)
|
||||||
.eq("status", AutoCallPerson.STATUS_PUT)
|
.eq("status", AutoCallPerson.STATUS_PUT)
|
||||||
|
.eq("__tag", "已知晓")
|
||||||
) > 0;
|
) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -36,13 +38,13 @@ public interface AutoCallPersonMapper extends BaseMapper<AutoCallPerson> {
|
||||||
long failCnt = selectCount(
|
long failCnt = selectCount(
|
||||||
new QueryWrapper<AutoCallPerson>()
|
new QueryWrapper<AutoCallPerson>()
|
||||||
.eq("task_id", taskId)
|
.eq("task_id", taskId)
|
||||||
.in("status", AutoCallPerson.STATUS_CALLED, AutoCallPerson.STATUS_CANCELLED)
|
.in("status", AutoCallPerson.STATUS_CALLED, AutoCallPerson.STATUS_CANCELLED,AutoCallPerson.STATUS_PUT)
|
||||||
|
//__tag == null or __tag != "已知晓"
|
||||||
|
.and(wrapper -> wrapper.isNull("__tag").or().ne("__tag", "已知晓"))
|
||||||
);
|
);
|
||||||
return personCnt == failCnt;
|
return personCnt == failCnt;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<AutoCallPerson> selectListByTaskId(@Param("taskId") Integer taskId);
|
List<AutoCallPerson> selectListByTaskId(@Param("taskId") Integer taskId);
|
||||||
|
|
||||||
String selectPositionByPhone(@Param("phone") String uploadNumber);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,4 +25,7 @@ public interface AutoCallTaskMapper extends BaseMapper<AutoCallTask> {
|
||||||
|
|
||||||
@Select("update auto_call_task set status = #{status} where id = #{taskId}")
|
@Select("update auto_call_task set status = #{status} where id = #{taskId}")
|
||||||
void setStatus(Integer taskId, int status);
|
void setStatus(Integer taskId, int status);
|
||||||
|
|
||||||
|
@Select("update auto_call_task set __tag = #{tag} where id = #{taskId}")
|
||||||
|
void setTag(Integer taskId, String tag);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ package com.whdc.model.entity;
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
|
@ -13,12 +14,14 @@ import java.util.Date;
|
||||||
* @since 2025-07-08
|
* @since 2025-07-08
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
|
@TableName("FXKH_TXL.AUTO_CALL_PERSON")
|
||||||
public class AutoCallPerson {
|
public class AutoCallPerson {
|
||||||
public static final int STATUS_DEFAULT = 0;
|
public static final int STATUS_DEFAULT = 0;
|
||||||
public static final int STATUS_UPLOADED = 1;
|
public static final int STATUS_UPLOADED = 1;
|
||||||
public static final int STATUS_CALLED = 2;
|
public static final int STATUS_CALLED = 2;
|
||||||
public static final int STATUS_PUT = 3;
|
public static final int STATUS_PUT = 3;
|
||||||
public static final int STATUS_CANCELLED = 4;
|
public static final int STATUS_CANCELLED = 4;
|
||||||
|
public static final int STATUS_MANUAL_CLOSE = 6;
|
||||||
public static final int ERRCODE_ENCODE = 1;
|
public static final int ERRCODE_ENCODE = 1;
|
||||||
public static final int ERRCODE_UPLOAD_FAIL = 2;
|
public static final int ERRCODE_UPLOAD_FAIL = 2;
|
||||||
|
|
||||||
|
|
@ -35,6 +38,14 @@ public class AutoCallPerson {
|
||||||
private Date createTm;
|
private Date createTm;
|
||||||
@TableField(value = "error_code")
|
@TableField(value = "error_code")
|
||||||
private Integer errorCode; //default 0
|
private Integer errorCode; //default 0
|
||||||
|
@TableField(value = "uploaded_times")
|
||||||
|
private Integer uploadedTimes; //default 0
|
||||||
|
@TableField(value = "sms_content")
|
||||||
|
private String smsContent; //短信内容
|
||||||
|
@TableField(value = "manual_close")
|
||||||
|
private Integer manualClose; //default 0
|
||||||
|
@TableField(value = "position")
|
||||||
|
private String position;
|
||||||
|
|
||||||
@TableField(value = "__request_id")
|
@TableField(value = "__request_id")
|
||||||
private String uploadRequestId; //任务名,同时作为参数的taskName,用custId
|
private String uploadRequestId; //任务名,同时作为参数的taskName,用custId
|
||||||
|
|
@ -43,7 +54,7 @@ public class AutoCallPerson {
|
||||||
@TableField(value = "__cust_name")
|
@TableField(value = "__cust_name")
|
||||||
private String uploadCustName; //联系人
|
private String uploadCustName; //联系人
|
||||||
@TableField(value = "__content")
|
@TableField(value = "__content")
|
||||||
private String uploadContent; //联系人
|
private String uploadContent; //外呼内容
|
||||||
@TableField(value = "__number")
|
@TableField(value = "__number")
|
||||||
private String uploadNumber;
|
private String uploadNumber;
|
||||||
@TableField(value = "__upload_resp_msg")
|
@TableField(value = "__upload_resp_msg")
|
||||||
|
|
@ -54,6 +65,8 @@ public class AutoCallPerson {
|
||||||
private Integer detailTalkTimes;//通话时长,单位秒
|
private Integer detailTalkTimes;//通话时长,单位秒
|
||||||
@TableField(value = "__sip_term_cause")
|
@TableField(value = "__sip_term_cause")
|
||||||
private String detailSipTermCause; //例如”对方挂机“
|
private String detailSipTermCause; //例如”对方挂机“
|
||||||
|
@TableField(value = "__tag")
|
||||||
|
private String tag; //话术识别:未识别,已知晓
|
||||||
|
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||||
@TableField(value = "__startring_at")
|
@TableField(value = "__startring_at")
|
||||||
|
|
@ -76,6 +89,4 @@ public class AutoCallPerson {
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||||
@TableField(value = "__last_modify")
|
@TableField(value = "__last_modify")
|
||||||
private Date detailLastModify;
|
private Date detailLastModify;
|
||||||
@TableField(exist = false)
|
|
||||||
private String position;
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ package com.whdc.model.entity;
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
|
|
@ -14,6 +15,7 @@ import java.util.List;
|
||||||
* @since 2025-07-08
|
* @since 2025-07-08
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
|
@TableName("FXKH_TXL.AUTO_CALL_TASK")
|
||||||
public class AutoCallTask {
|
public class AutoCallTask {
|
||||||
public static final int STATUS_DEFAULT = 0; // 不生成
|
public static final int STATUS_DEFAULT = 0; // 不生成
|
||||||
public static final int STATUS_SHOULD_GENERATE = 1;
|
public static final int STATUS_SHOULD_GENERATE = 1;
|
||||||
|
|
@ -21,11 +23,10 @@ public class AutoCallTask {
|
||||||
public static final int STATUS_ANY_SUCCESS = 3;
|
public static final int STATUS_ANY_SUCCESS = 3;
|
||||||
public static final int STATUS_ALL_FAIL = 4;
|
public static final int STATUS_ALL_FAIL = 4;
|
||||||
public static final int STATUS_CANCELLED = 5;
|
public static final int STATUS_CANCELLED = 5;
|
||||||
|
public static final int STATUS_MANUAL_CLOSE = 6; //人工处置
|
||||||
public static final int ERRCODE_NO_PERSON = 1;
|
public static final int ERRCODE_NO_PERSON = 1;
|
||||||
public static final int ERRCODE_DB_ERROR = 2;
|
public static final int ERRCODE_DB_ERROR = 2;
|
||||||
|
|
||||||
public static final int TASK_CANCEL = 6; //任务取消
|
|
||||||
|
|
||||||
@TableId(value = "ID", type = IdType.AUTO)
|
@TableId(value = "ID", type = IdType.AUTO)
|
||||||
private Integer id;
|
private Integer id;
|
||||||
@TableField(value = "warn_id")
|
@TableField(value = "warn_id")
|
||||||
|
|
@ -47,6 +48,8 @@ public class AutoCallTask {
|
||||||
private String warnCnnm;
|
private String warnCnnm;
|
||||||
@TableField(value = "warn_content")
|
@TableField(value = "warn_content")
|
||||||
private String warnContent;
|
private String warnContent;
|
||||||
|
@TableField(value = "__tag")
|
||||||
|
private String tag; //话术识别:未识别,已知晓
|
||||||
|
|
||||||
@TableField(value = "_create_tm")
|
@TableField(value = "_create_tm")
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
|
||||||
|
|
@ -56,4 +59,7 @@ public class AutoCallTask {
|
||||||
|
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private List<AutoCallPerson> callList;
|
private List<AutoCallPerson> callList;
|
||||||
|
|
||||||
|
@TableField(exist = false)
|
||||||
|
private AutoCallPerson successPerson;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -109,7 +109,7 @@ public class WarningResponder extends Model<WarningResponder> implements Seriali
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
WarningResponder a = new WarningResponder();
|
WarningResponder a = new WarningResponder();
|
||||||
a.setPhone("15623775829");
|
a.setPhone("13933930962");
|
||||||
a.encryptPhone();
|
a.encryptPhone();
|
||||||
System.out.println(a.salt);
|
System.out.println(a.salt);
|
||||||
System.out.println(a.phone);
|
System.out.println(a.phone);
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,7 @@ public class AICCCallRespDetail {
|
||||||
private Integer sendCount;
|
private Integer sendCount;
|
||||||
|
|
||||||
private RawVarListMap rawVarListMap;
|
private RawVarListMap rawVarListMap;
|
||||||
|
private List<Tag> tags;
|
||||||
}
|
}
|
||||||
|
|
||||||
@lombok.Data
|
@lombok.Data
|
||||||
|
|
@ -60,5 +61,10 @@ public class AICCCallRespDetail {
|
||||||
private String lastModify;
|
private String lastModify;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@lombok.Data
|
||||||
|
@ToString
|
||||||
|
public static class Tag {
|
||||||
|
@JSONField(name = "tag_name")
|
||||||
|
private String tagName;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -45,10 +45,10 @@ public class AICCUploadTask {
|
||||||
private String processId;
|
private String processId;
|
||||||
private String callerGroup;
|
private String callerGroup;
|
||||||
private String requestId;
|
private String requestId;
|
||||||
private int calleeType = 1; //默认0 重乎1 顺乎2 默认为0
|
private int calleeType = 0; //默认0 重乎1 顺乎2 默认为0
|
||||||
private int repeatTimes = 1;//呼叫次数,CallType=0不传; CalleeType=1重乎必传; CalleeType=2顺乎并且autoCall为0必传
|
// private int repeatTimes = 1;//呼叫次数,CallType=0不传; CalleeType=1重乎必传; CalleeType=2顺乎并且autoCall为0必传
|
||||||
private String autoCall = "0";//顺乎未接通是否重乎,开启=0; 关闭=1; CalleeType=2顺乎必传
|
private String autoCall = "1";//顺乎未接通是否重乎,开启=0; 关闭=1; CalleeType=2顺乎必传
|
||||||
private int spanSeconds = 3;//重乎间隔时间(秒),CallType=0不传; CalleeType=1重乎必传; CalleeType=2顺乎并且autoCall为0必传
|
// private int spanSeconds = 3;//重乎间隔时间(秒),CallType=0不传; CalleeType=1重乎必传; CalleeType=2顺乎并且autoCall为0必传
|
||||||
private String processType = "3";
|
private String processType = "3";
|
||||||
private String mutiTimeRange;
|
private String mutiTimeRange;
|
||||||
private List<Cust> param;
|
private List<Cust> param;
|
||||||
|
|
|
||||||
|
|
@ -93,7 +93,7 @@ public class AutoCallApiService {
|
||||||
AutoCallTask.STATUS_ANY_SUCCESS,
|
AutoCallTask.STATUS_ANY_SUCCESS,
|
||||||
AutoCallTask.STATUS_ALL_FAIL,
|
AutoCallTask.STATUS_ALL_FAIL,
|
||||||
AutoCallTask.STATUS_CANCELLED,
|
AutoCallTask.STATUS_CANCELLED,
|
||||||
AutoCallTask.TASK_CANCEL
|
AutoCallTask.STATUS_MANUAL_CLOSE
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
Page pageParam = dto.getPage().getPage();
|
Page pageParam = dto.getPage().getPage();
|
||||||
|
|
@ -106,11 +106,25 @@ public class AutoCallApiService {
|
||||||
if (records.size() > 0) {
|
if (records.size() > 0) {
|
||||||
for (AutoCallTask task : records) {
|
for (AutoCallTask task : records) {
|
||||||
Integer taskId = task.getId();
|
Integer taskId = task.getId();
|
||||||
List<AutoCallPerson> autoCallList = personMapper.selectList(
|
List<AutoCallPerson> personList = personMapper.selectList(
|
||||||
new QueryWrapper<AutoCallPerson>()
|
new QueryWrapper<AutoCallPerson>()
|
||||||
.eq("task_id", taskId)
|
.eq("task_id", taskId)
|
||||||
);
|
);
|
||||||
task.setCallList(autoCallList);
|
|
||||||
|
if ("已知晓".equals(task.getTag())) {
|
||||||
|
AutoCallPerson successPerson = null;
|
||||||
|
for (AutoCallPerson person : personList) {
|
||||||
|
if ("已知晓".equals(person.getTag())) {
|
||||||
|
successPerson = person;
|
||||||
|
task.setSuccessPerson(successPerson);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
personList.remove(successPerson);
|
||||||
|
}
|
||||||
|
personList.removeIf(p -> "已呼通其他联系人".equals(p.getDetailRemark()));
|
||||||
|
|
||||||
|
task.setCallList(personList);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return pageResult;
|
return pageResult;
|
||||||
|
|
@ -180,7 +194,7 @@ public class AutoCallApiService {
|
||||||
private QXWarningMapper warningMapper;
|
private QXWarningMapper warningMapper;
|
||||||
|
|
||||||
|
|
||||||
public Page<AutoCallTask> page3(AutoCallDto dto) {
|
public Page<AutoCallTask> pageForPdf(AutoCallDto dto) {
|
||||||
Date stm = null;
|
Date stm = null;
|
||||||
Date etm = null;
|
Date etm = null;
|
||||||
try {
|
try {
|
||||||
|
|
@ -214,10 +228,11 @@ public class AutoCallApiService {
|
||||||
AutoCallTask.STATUS_ANY_SUCCESS,
|
AutoCallTask.STATUS_ANY_SUCCESS,
|
||||||
AutoCallTask.STATUS_ALL_FAIL,
|
AutoCallTask.STATUS_ALL_FAIL,
|
||||||
AutoCallTask.STATUS_CANCELLED,
|
AutoCallTask.STATUS_CANCELLED,
|
||||||
AutoCallTask.TASK_CANCEL
|
AutoCallTask.STATUS_MANUAL_CLOSE
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
Page pageParam = dto.getPage().getPage();
|
Page pageParam = dto.getPage().getPage();
|
||||||
|
pageParam.setSize(9999);
|
||||||
Page<AutoCallTask> pageResult = taskMapper.selectPage(
|
Page<AutoCallTask> pageResult = taskMapper.selectPage(
|
||||||
pageParam,
|
pageParam,
|
||||||
query
|
query
|
||||||
|
|
@ -227,15 +242,13 @@ public class AutoCallApiService {
|
||||||
if (records.size() > 0) {
|
if (records.size() > 0) {
|
||||||
for (AutoCallTask task : records) {
|
for (AutoCallTask task : records) {
|
||||||
Integer taskId = task.getId();
|
Integer taskId = task.getId();
|
||||||
List<AutoCallPerson> autoCallList = personMapper.selectList(
|
List<AutoCallPerson> personList = personMapper.selectList(
|
||||||
new QueryWrapper<AutoCallPerson>()
|
new QueryWrapper<AutoCallPerson>()
|
||||||
.eq("task_id", taskId)
|
.eq("task_id", taskId)
|
||||||
);
|
);
|
||||||
for (AutoCallPerson autoCallPerson : autoCallList) {
|
|
||||||
String position = personMapper.selectPositionByPhone(autoCallPerson.getUploadNumber());
|
personList.removeIf(p -> !"已知晓".equals(p.getTag()));
|
||||||
autoCallPerson.setPosition(position);
|
task.setCallList(personList);
|
||||||
}
|
|
||||||
task.setCallList(autoCallList);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return pageResult;
|
return pageResult;
|
||||||
|
|
@ -442,7 +455,7 @@ private void addTableHeader(Table table) {
|
||||||
//处理结束拨打时间
|
//处理结束拨打时间
|
||||||
StringBuilder endTime = new StringBuilder();
|
StringBuilder endTime = new StringBuilder();
|
||||||
for (AutoCallPerson item : record.getCallList()) {
|
for (AutoCallPerson item : record.getCallList()) {
|
||||||
String s = formatTime(item.getDetailEndringAt());
|
String s = formatTime(item.getDetailDisconnectedAt());
|
||||||
endTime.append(s).append("\n");
|
endTime.append(s).append("\n");
|
||||||
}
|
}
|
||||||
// 格式化时间
|
// 格式化时间
|
||||||
|
|
@ -495,10 +508,13 @@ private void addTableHeader(Table table) {
|
||||||
.orderByDesc("id");
|
.orderByDesc("id");
|
||||||
query.in("status",
|
query.in("status",
|
||||||
AutoCallTask.STATUS_ALL_FAIL,
|
AutoCallTask.STATUS_ALL_FAIL,
|
||||||
AutoCallTask.STATUS_SHOULD_GENERATE,
|
// AutoCallTask.STATUS_SHOULD_GENERATE,
|
||||||
AutoCallTask.STATUS_CANCELLED,
|
// AutoCallTask.STATUS_CANCELLED,
|
||||||
AutoCallTask.STATUS_GENERATED
|
AutoCallTask.STATUS_GENERATED,
|
||||||
|
AutoCallTask.STATUS_ANY_SUCCESS
|
||||||
);
|
);
|
||||||
|
//__tag is null or __tag != "已知晓"
|
||||||
|
query.and(wrapper -> wrapper.isNull("__tag").or().ne("__tag", "已知晓"));
|
||||||
List<AutoCallTask> autoCallTasks = taskMapper.selectList(query);
|
List<AutoCallTask> autoCallTasks = taskMapper.selectList(query);
|
||||||
for (AutoCallTask task : autoCallTasks) {
|
for (AutoCallTask task : autoCallTasks) {
|
||||||
Integer taskId = task.getId();
|
Integer taskId = task.getId();
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ import java.util.*;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static com.whdc.model.entity.AutoCallTask.TASK_CANCEL;
|
import static com.whdc.model.entity.AutoCallTask.STATUS_MANUAL_CLOSE;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author lyf
|
* @author lyf
|
||||||
|
|
@ -514,8 +514,8 @@ public class AutoCallTaskService {
|
||||||
List<AutoCallTask> autoCallTasks = autoCallTaskMapper.selectList(queryWrapper);
|
List<AutoCallTask> autoCallTasks = autoCallTaskMapper.selectList(queryWrapper);
|
||||||
for (AutoCallTask autoCallTask : autoCallTasks) {
|
for (AutoCallTask autoCallTask : autoCallTasks) {
|
||||||
//告警任务取消
|
//告警任务取消
|
||||||
autoCallTask.setStatus(TASK_CANCEL);
|
autoCallTask.setStatus(STATUS_MANUAL_CLOSE);
|
||||||
autoCallTask.setRemark("告警任务取消");
|
autoCallTask.setRemark("人工处置");
|
||||||
autoCallTaskMapper.updateById(autoCallTask);
|
autoCallTaskMapper.updateById(autoCallTask);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,10 @@ package com.whdc.service;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.whdc.mapper.*;
|
import com.whdc.mapper.*;
|
||||||
import com.whdc.model.entity.*;
|
import com.whdc.model.entity.AutoCallPerson;
|
||||||
|
import com.whdc.model.entity.AutoCallTask;
|
||||||
|
import com.whdc.model.entity.QXWarning;
|
||||||
|
import com.whdc.model.entity.WarningResponder;
|
||||||
import com.whdc.model.entity.autocall.AICCCallRespDetail;
|
import com.whdc.model.entity.autocall.AICCCallRespDetail;
|
||||||
import com.whdc.model.entity.autocall.AICCCallRespTask;
|
import com.whdc.model.entity.autocall.AICCCallRespTask;
|
||||||
import com.whdc.model.entity.autocall.AICCCallRespWrapper;
|
import com.whdc.model.entity.autocall.AICCCallRespWrapper;
|
||||||
|
|
@ -15,6 +18,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.PlatformTransactionManager;
|
import org.springframework.transaction.PlatformTransactionManager;
|
||||||
import org.springframework.transaction.TransactionStatus;
|
import org.springframework.transaction.TransactionStatus;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.transaction.support.DefaultTransactionDefinition;
|
import org.springframework.transaction.support.DefaultTransactionDefinition;
|
||||||
|
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
|
|
@ -51,7 +55,7 @@ public class AutoCallTaskService2 {
|
||||||
public void generateFakeCall() {
|
public void generateFakeCall() {
|
||||||
QXWarning warn = qxWarningMapper.selectOne(
|
QXWarning warn = qxWarningMapper.selectOne(
|
||||||
new QueryWrapper<QXWarning>()
|
new QueryWrapper<QXWarning>()
|
||||||
.like("CNNM", "洪湖")
|
// .like("CNNM", "洪湖")
|
||||||
.orderByDesc("WARNID")
|
.orderByDesc("WARNID")
|
||||||
.last("limit 1")
|
.last("limit 1")
|
||||||
);
|
);
|
||||||
|
|
@ -280,6 +284,7 @@ public class AutoCallTaskService2 {
|
||||||
person.setUploadCustId(uniqueId);
|
person.setUploadCustId(uniqueId);
|
||||||
person.setUploadCustName(wr.getName());
|
person.setUploadCustName(wr.getName());
|
||||||
person.setLevel(wrLevel);
|
person.setLevel(wrLevel);
|
||||||
|
person.setPosition(wr.getPosition());
|
||||||
person.setUploadNumber(wr.getPhone());
|
person.setUploadNumber(wr.getPhone());
|
||||||
person.setUploadContent(
|
person.setUploadContent(
|
||||||
"我是省防办智能外呼系统," +
|
"我是省防办智能外呼系统," +
|
||||||
|
|
@ -290,7 +295,18 @@ public class AutoCallTaskService2 {
|
||||||
task.getWarnLevel() +
|
task.getWarnLevel() +
|
||||||
"预警信号:" +
|
"预警信号:" +
|
||||||
task.getWarnContent() +
|
task.getWarnContent() +
|
||||||
"如需咨询请拨打02787221781,相关信息以短信发送给您。"
|
",相关信息以短信发送给您。"
|
||||||
|
);
|
||||||
|
person.setSmsContent(
|
||||||
|
"我是省防办智能外呼系统," +
|
||||||
|
wr.getName() + "同志您好," +
|
||||||
|
task.getWarnCtnm() +
|
||||||
|
sdf.format(task.getWarnTm()) +
|
||||||
|
"发布暴雨" +
|
||||||
|
task.getWarnLevel() +
|
||||||
|
"预警信号:" +
|
||||||
|
task.getWarnContent() +
|
||||||
|
"如需咨询请拨打省防办值班电话027-87221781。"
|
||||||
);
|
);
|
||||||
person.setCreateTm(task.getCreateTm());
|
person.setCreateTm(task.getCreateTm());
|
||||||
personList.add(person);
|
personList.add(person);
|
||||||
|
|
@ -322,6 +338,21 @@ public class AutoCallTaskService2 {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
|
if (person.getUploadedTimes() == 2) {
|
||||||
|
cancelPerson(person);
|
||||||
|
try {
|
||||||
|
Thread.sleep(10000);
|
||||||
|
} catch (InterruptedException ignore) {
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
} else if (person.getUploadedTimes() == 1) {
|
||||||
|
try {
|
||||||
|
Thread.sleep(10000);
|
||||||
|
} catch (InterruptedException ignore) {
|
||||||
|
}
|
||||||
|
resetPerson(person);
|
||||||
|
}
|
||||||
|
|
||||||
List<String> numbers = Collections.singletonList(person.getUploadNumber());
|
List<String> numbers = Collections.singletonList(person.getUploadNumber());
|
||||||
AICCUploadTask uploadTask = aiccHelper.newTask(
|
AICCUploadTask uploadTask = aiccHelper.newTask(
|
||||||
person.getUploadRequestId(),
|
person.getUploadRequestId(),
|
||||||
|
|
@ -330,6 +361,7 @@ public class AutoCallTaskService2 {
|
||||||
person.getUploadContent(),
|
person.getUploadContent(),
|
||||||
numbers
|
numbers
|
||||||
);
|
);
|
||||||
|
|
||||||
AICCCallRespWrapper<AICCCallRespTask> AICCCallRespWrapper = null;
|
AICCCallRespWrapper<AICCCallRespTask> AICCCallRespWrapper = null;
|
||||||
try {
|
try {
|
||||||
AICCCallRespWrapper = aiccHelper.apiUploadCallData(uploadTask);
|
AICCCallRespWrapper = aiccHelper.apiUploadCallData(uploadTask);
|
||||||
|
|
@ -347,8 +379,9 @@ public class AutoCallTaskService2 {
|
||||||
String msg = AICCCallRespWrapper.getResult().getMsg();
|
String msg = AICCCallRespWrapper.getResult().getMsg();
|
||||||
person.setStatus(AutoCallPerson.STATUS_UPLOADED);
|
person.setStatus(AutoCallPerson.STATUS_UPLOADED);
|
||||||
person.setUploadRespMsg(msg);
|
person.setUploadRespMsg(msg);
|
||||||
|
person.setUploadedTimes(person.getUploadedTimes() + 1);
|
||||||
personMapper.updateById(person);
|
personMapper.updateById(person);
|
||||||
smsHelper.send(numbers, person.getUploadContent());
|
smsHelper.send(numbers, person.getSmsContent());
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
isCalling.set(false);
|
isCalling.set(false);
|
||||||
|
|
@ -356,89 +389,201 @@ public class AutoCallTaskService2 {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean step4QueryAICCTaskResult(AutoCallPerson person) {
|
public boolean step4QueryAICCTaskResult(AutoCallPerson person) {
|
||||||
|
person = personMapper.selectById(person.getId());
|
||||||
//切记要设置person的status和task的status
|
//切记要设置person的status和task的status
|
||||||
AICCCallRespWrapper<AICCCallRespDetail> detail = aiccHelper.apiGetTaskCallDetail(person.getUploadRequestId(), person.getUploadCustId());
|
AICCCallRespWrapper<AICCCallRespDetail> detail = aiccHelper.apiGetTaskCallDetail(person.getUploadRequestId(), person.getUploadCustId());
|
||||||
List<AICCCallRespDetail.Record> records = detail.getResult().getData().getRecords();
|
|
||||||
if (records.isEmpty()) return false; //这个false是平台还未有拨打,应继续刷接口
|
if (detail == null ||
|
||||||
AICCCallRespDetail.Record record = records.get(0);
|
detail.getResult() == null ||
|
||||||
|
detail.getResult().getData() == null ||
|
||||||
|
detail.getResult().getData().getRecords() == null ||
|
||||||
|
detail.getResult().getData().getRecords().isEmpty() ||
|
||||||
|
detail.getResult().getData().getRecords().get(0).getRemark() == null
|
||||||
|
) {
|
||||||
|
return false; //remark为空代表联通平台还未或正在呼叫,还没有结果信息,应继续刷接口
|
||||||
|
}
|
||||||
|
|
||||||
|
Integer taskId = person.getTaskId();
|
||||||
|
AICCCallRespDetail.Record record = detail.getResult().getData().getRecords().get(0);
|
||||||
String dialRemark = record.getRemark();
|
String dialRemark = record.getRemark();
|
||||||
boolean done = false;
|
AICCCallRespDetail.RawVarListMap rawVarListMap = record.getRawVarListMap();
|
||||||
|
//已产生结果信息
|
||||||
|
person.setDetailRemark(dialRemark);
|
||||||
|
person.setDetailTalkTimes(record.getTalkTimes());
|
||||||
|
person.setDetailSipTermCause(rawVarListMap.getSipTermCause());
|
||||||
|
fillTimeData(person, record);
|
||||||
|
//话术部分
|
||||||
|
String tag = null;
|
||||||
|
if (record.getTags() != null &&
|
||||||
|
!record.getTags().isEmpty() &&
|
||||||
|
record.getTags().get(0).getTagName() != null
|
||||||
|
) {
|
||||||
|
tag = record.getTags().get(0).getTagName();
|
||||||
|
person.setTag(tag);
|
||||||
|
}
|
||||||
|
//再判断状态
|
||||||
if ("接通".equals(dialRemark)) {
|
if ("接通".equals(dialRemark)) {
|
||||||
person.setStatus(AutoCallPerson.STATUS_PUT);
|
person.setStatus(AutoCallPerson.STATUS_PUT);
|
||||||
done = true;
|
} else {
|
||||||
} else if (records.size() > 1) {
|
if (person.getUploadedTimes() < 2) {
|
||||||
person.setStatus(AutoCallPerson.STATUS_CALLED);
|
person.setStatus(AutoCallPerson.STATUS_CALLED);
|
||||||
done = true;
|
} else {
|
||||||
}
|
person.setStatus(AutoCallPerson.STATUS_CANCELLED);
|
||||||
if (done) {
|
|
||||||
person.setDetailRemark(dialRemark);
|
|
||||||
person.setDetailTalkTimes(record.getTalkTimes());
|
|
||||||
AICCCallRespDetail.RawVarListMap rawVarListMap = record.getRawVarListMap();
|
|
||||||
person.setDetailSipTermCause(rawVarListMap.getSipTermCause());
|
|
||||||
|
|
||||||
{
|
|
||||||
Date d;
|
|
||||||
long l;
|
|
||||||
if (rawVarListMap.getStartringAt() != null) {
|
|
||||||
d = new Date();
|
|
||||||
l = Long.parseLong(rawVarListMap.getStartringAt().substring(0, 13));
|
|
||||||
d.setTime(l);
|
|
||||||
person.setDetailStartringAt(d);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (rawVarListMap.getConnectedAt() != null) {
|
|
||||||
d = new Date();
|
|
||||||
l = Long.parseLong(rawVarListMap.getConnectedAt().substring(0, 13));
|
|
||||||
d.setTime(l);
|
|
||||||
person.setDetailConnectedAt(d);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (rawVarListMap.getStartedAt() != null) {
|
|
||||||
d = new Date();
|
|
||||||
l = Long.parseLong(rawVarListMap.getStartedAt());
|
|
||||||
d.setTime(l);
|
|
||||||
person.setDetailStartedAt(d);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (rawVarListMap.getEndringAt() != null) {
|
|
||||||
d = new Date();
|
|
||||||
l = Long.parseLong(rawVarListMap.getEndringAt().substring(0, 13));
|
|
||||||
d.setTime(l);
|
|
||||||
person.setDetailEndringAt(d);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (rawVarListMap.getDisconnectedAt() != null) {
|
|
||||||
d = new Date();
|
|
||||||
l = Long.parseLong(rawVarListMap.getDisconnectedAt().substring(0, 13));
|
|
||||||
d.setTime(l);
|
|
||||||
person.setDetailDisconnectedAt(d);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (rawVarListMap.getStopedAt() != null) {
|
|
||||||
d = new Date();
|
|
||||||
l = Long.parseLong(rawVarListMap.getStopedAt());
|
|
||||||
d.setTime(l);
|
|
||||||
person.setDetailStopedAt(d);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (rawVarListMap.getLastModify() != null) {
|
|
||||||
d = new Date();
|
|
||||||
l = Long.parseLong(rawVarListMap.getLastModify());
|
|
||||||
d.setTime(l);
|
|
||||||
person.setDetailLastModify(d);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
personMapper.updateById(person);
|
|
||||||
boolean anySuccess = markTaskStatus(person.getTaskId());
|
|
||||||
if (anySuccess) {
|
|
||||||
markRemanentPersonStatus(person.getTaskId());
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
return false; //这个false是平台还未完成重呼,应继续刷接口
|
personMapper.updateById(person);
|
||||||
|
if ("已知晓".equals(tag)) {
|
||||||
|
markRemnantPersonStatus(taskId);
|
||||||
|
taskMapper.setTag(taskId, tag);
|
||||||
|
taskMapper.setStatus(taskId, AutoCallTask.STATUS_ANY_SUCCESS);
|
||||||
|
} else {
|
||||||
|
boolean allFail = personMapper.isAllFail(taskId);
|
||||||
|
if (allFail) {
|
||||||
|
taskMapper.setStatus(taskId, AutoCallTask.STATUS_ALL_FAIL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
|
||||||
|
// boolean done = false;
|
||||||
|
// log.info("{}", JSON.toJSONString(record));
|
||||||
|
// if ("接通".equals(dialRemark)) {
|
||||||
|
// if (record.getTags() != null && record.getTags().size() > 0) {
|
||||||
|
// String tag = record.getTags().get(0).getTagName();
|
||||||
|
// person.setTag(tag);
|
||||||
|
// personMapper.updateById(person);
|
||||||
|
// taskMapper.setTag(taskId, tag);
|
||||||
|
// if ("已知晓".equals(tag)) {
|
||||||
|
// person.setStatus(AutoCallPerson.STATUS_PUT);
|
||||||
|
// done = true;
|
||||||
|
// } else {
|
||||||
|
// return true;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
// } else if (dialRemark != null) {
|
||||||
|
// done = true;
|
||||||
|
// }
|
||||||
|
// if (done) {
|
||||||
|
// personMapper.updateById(person);
|
||||||
|
// boolean anySuccess = markTaskStatus(taskId);
|
||||||
|
// if (anySuccess) {
|
||||||
|
// markRemnantPersonStatus(taskId);
|
||||||
|
// }
|
||||||
|
// return true;
|
||||||
|
// }
|
||||||
|
// return false; //这个false是平台还未完成重呼,应继续刷接口
|
||||||
}
|
}
|
||||||
|
|
||||||
private void markRemanentPersonStatus(Integer taskId) {
|
@Transactional
|
||||||
|
public boolean manualClose(Integer taskId, Integer personId) {
|
||||||
|
AutoCallTask task = taskMapper.selectById(taskId);
|
||||||
|
if (task == null) return false;
|
||||||
|
List<AutoCallPerson> personList = personMapper.selectList(new QueryWrapper<AutoCallPerson>().eq("task_id", taskId));
|
||||||
|
if (personList == null || personList.isEmpty()) return false;
|
||||||
|
AutoCallPerson person = null;
|
||||||
|
for (AutoCallPerson p : personList) {
|
||||||
|
if (p.getId().equals(personId)) {
|
||||||
|
person = p;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (person == null) return false;
|
||||||
|
|
||||||
|
person.setStatus(AutoCallPerson.STATUS_MANUAL_CLOSE);
|
||||||
|
person.setTag("已知晓");
|
||||||
|
personMapper.updateById(person);
|
||||||
|
task.setTag("已知晓");
|
||||||
|
task.setStatus(AutoCallTask.STATUS_MANUAL_CLOSE);
|
||||||
|
taskMapper.updateById(task);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void fillTimeData(AutoCallPerson person, AICCCallRespDetail.Record record) {
|
||||||
|
AICCCallRespDetail.RawVarListMap rawVarListMap = record.getRawVarListMap();
|
||||||
|
|
||||||
|
Date d;
|
||||||
|
long l;
|
||||||
|
if (rawVarListMap.getStartringAt() != null) {
|
||||||
|
d = new Date();
|
||||||
|
l = Long.parseLong(rawVarListMap.getStartringAt().substring(0, 13));
|
||||||
|
d.setTime(l);
|
||||||
|
person.setDetailStartringAt(d);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rawVarListMap.getConnectedAt() != null) {
|
||||||
|
d = new Date();
|
||||||
|
l = Long.parseLong(rawVarListMap.getConnectedAt().substring(0, 13));
|
||||||
|
d.setTime(l);
|
||||||
|
person.setDetailConnectedAt(d);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rawVarListMap.getStartedAt() != null) {
|
||||||
|
d = new Date();
|
||||||
|
l = Long.parseLong(rawVarListMap.getStartedAt());
|
||||||
|
d.setTime(l);
|
||||||
|
person.setDetailStartedAt(d);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rawVarListMap.getEndringAt() != null) {
|
||||||
|
d = new Date();
|
||||||
|
l = Long.parseLong(rawVarListMap.getEndringAt().substring(0, 13));
|
||||||
|
d.setTime(l);
|
||||||
|
person.setDetailEndringAt(d);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rawVarListMap.getDisconnectedAt() != null) {
|
||||||
|
d = new Date();
|
||||||
|
l = Long.parseLong(rawVarListMap.getDisconnectedAt().substring(0, 13));
|
||||||
|
d.setTime(l);
|
||||||
|
person.setDetailDisconnectedAt(d);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rawVarListMap.getStopedAt() != null) {
|
||||||
|
d = new Date();
|
||||||
|
l = Long.parseLong(rawVarListMap.getStopedAt());
|
||||||
|
d.setTime(l);
|
||||||
|
person.setDetailStopedAt(d);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rawVarListMap.getLastModify() != null) {
|
||||||
|
d = new Date();
|
||||||
|
l = Long.parseLong(rawVarListMap.getLastModify());
|
||||||
|
d.setTime(l);
|
||||||
|
person.setDetailLastModify(d);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void resetPerson(AutoCallPerson person) {
|
||||||
|
long millis = System.currentTimeMillis();
|
||||||
|
String uniqueId = millis + "-" + person.getUploadRequestId().split("-")[1];
|
||||||
|
person.setUploadRequestId(uniqueId);
|
||||||
|
person.setUploadCustId(uniqueId);
|
||||||
|
person.setErrorCode(0);
|
||||||
|
person.setUploadRespMsg(null);
|
||||||
|
person.setDetailRemark(null);
|
||||||
|
person.setDetailTalkTimes(null);
|
||||||
|
person.setDetailSipTermCause(null);
|
||||||
|
person.setTag(null);
|
||||||
|
|
||||||
|
person.setStatus(AutoCallPerson.STATUS_DEFAULT);
|
||||||
|
// person.setDetailStartringAt(null);
|
||||||
|
// person.setDetailConnectedAt(null);
|
||||||
|
// person.setDetailStartedAt(null);
|
||||||
|
// person.setDetailEndringAt(null);
|
||||||
|
// person.setDetailDisconnectedAt(null);
|
||||||
|
// person.setDetailStopedAt(null);
|
||||||
|
|
||||||
|
personMapper.updateById(person);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void cancelPerson(AutoCallPerson person) {
|
||||||
|
person.setStatus(AutoCallPerson.STATUS_CANCELLED);
|
||||||
|
personMapper.updateById(person);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void markRemnantPersonStatus(Integer taskId) {
|
||||||
personMapper.update(new AutoCallPerson() {{
|
personMapper.update(new AutoCallPerson() {{
|
||||||
setStatus(AutoCallPerson.STATUS_CANCELLED);
|
setStatus(AutoCallPerson.STATUS_CANCELLED);
|
||||||
setDetailRemark("已呼通其他联系人");
|
setDetailRemark("已呼通其他联系人");
|
||||||
|
|
|
||||||
|
|
@ -117,18 +117,27 @@ public class AICCHelper {
|
||||||
TypeReference<AICCCallRespWrapper<AICCCallRespTask>> type = new TypeReference<AICCCallRespWrapper<AICCCallRespTask>>() {
|
TypeReference<AICCCallRespWrapper<AICCCallRespTask>> type = new TypeReference<AICCCallRespWrapper<AICCCallRespTask>>() {
|
||||||
};
|
};
|
||||||
AICCCallRespWrapper<AICCCallRespTask> AICCCallRespWrapper = null;
|
AICCCallRespWrapper<AICCCallRespTask> AICCCallRespWrapper = null;
|
||||||
try {
|
if (!resp.contains("请求失败") || !resp.contains("网络异常")) {
|
||||||
AICCCallRespWrapper = JSON.parseObject(resp, type);
|
try {
|
||||||
} catch (Exception ex) {
|
AICCCallRespWrapper = JSON.parseObject(resp, type);
|
||||||
log.error("apiUploadCallData: {}", resp);
|
} catch (Exception ex) {
|
||||||
log.error("error: ", ex);
|
log.error("apiUploadCallData first time: {}", resp);
|
||||||
throw ex;
|
log.error("error: ", ex);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (AICCCallRespWrapper == null || !AICCCallRespWrapper.isSuccess()) {
|
if (AICCCallRespWrapper == null || !AICCCallRespWrapper.isSuccess()) {
|
||||||
initToken();
|
initToken();
|
||||||
headers.put("X-Access-Token", getToken());
|
headers.put("X-Access-Token", getToken());
|
||||||
resp = httpHelper.postJsonString("https://aicc.cuopen.net:9801/aicc-api/ssb/callout/thirdParty/task/uploadCallData", request.toJSONString(), headers);
|
resp = httpHelper.postJsonString("https://aicc.cuopen.net:9801/aicc-api/ssb/callout/thirdParty/task/uploadCallData", request.toJSONString(), headers);
|
||||||
AICCCallRespWrapper = JSON.parseObject(resp, type);
|
if (!resp.contains("请求失败") || !resp.contains("网络异常")) {
|
||||||
|
try {
|
||||||
|
AICCCallRespWrapper = JSON.parseObject(resp, type);
|
||||||
|
} catch (Exception ex) {
|
||||||
|
log.error("apiUploadCallData second time: {}", resp);
|
||||||
|
log.error("error: ", ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (AICCCallRespWrapper == null || !AICCCallRespWrapper.isSuccess()) {
|
if (AICCCallRespWrapper == null || !AICCCallRespWrapper.isSuccess()) {
|
||||||
|
|
@ -138,11 +147,15 @@ public class AICCHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
public AICCCallRespWrapper<AICCCallRespDetail> apiGetTaskCallDetail(String requestId, String custId) {
|
public AICCCallRespWrapper<AICCCallRespDetail> apiGetTaskCallDetail(String requestId, String custId) {
|
||||||
|
return apiGetTaskCallDetail(requestId, custId, getToken());
|
||||||
|
}
|
||||||
|
|
||||||
|
public AICCCallRespWrapper<AICCCallRespDetail> apiGetTaskCallDetail(String requestId, String custId, String token) {
|
||||||
JSONObject request = new JSONObject();
|
JSONObject request = new JSONObject();
|
||||||
request.put("requestId", requestId);
|
request.put("requestId", requestId);
|
||||||
request.put("custId", custId);
|
request.put("custId", custId);
|
||||||
Map<String, String> headers = new HashMap<>();
|
Map<String, String> headers = new HashMap<>();
|
||||||
headers.put("X-Access-Token", getToken());
|
headers.put("X-Access-Token", token);
|
||||||
String resp = httpHelper.postJsonString("https://aicc.cuopen.net:9801/aicc-api/ssb/callout/thirdParty/task/getTaskCallDetail", request.toJSONString(),headers);
|
String resp = httpHelper.postJsonString("https://aicc.cuopen.net:9801/aicc-api/ssb/callout/thirdParty/task/getTaskCallDetail", request.toJSONString(),headers);
|
||||||
|
|
||||||
TypeReference<AICCCallRespWrapper<AICCCallRespDetail>> type = new TypeReference<AICCCallRespWrapper<AICCCallRespDetail>>() {
|
TypeReference<AICCCallRespWrapper<AICCCallRespDetail>> type = new TypeReference<AICCCallRespWrapper<AICCCallRespDetail>>() {
|
||||||
|
|
|
||||||
|
|
@ -93,7 +93,7 @@ getGroupWarning: http://127.0.0.1:20000/shzh/met/zyqxfw/api/warning/getGroupWarn
|
||||||
|
|
||||||
autocall:
|
autocall:
|
||||||
sysUserId: HBSL01
|
sysUserId: HBSL01
|
||||||
processId: 1935233125932101634
|
processId: 1952550108058906626
|
||||||
# processId: 1934801506242949122
|
# processId: 1934801506242949122
|
||||||
# callerGroup: 02160980358
|
# callerGroup: 02160980358
|
||||||
callerGroup: 02759325005
|
callerGroup: 02759325005
|
||||||
|
|
|
||||||
|
|
@ -93,8 +93,8 @@ getGroupWarning: http://127.0.0.1:20000/shzh/met/zyqxfw/api/warning/getGroupWarn
|
||||||
|
|
||||||
autocall:
|
autocall:
|
||||||
sysUserId: HBSL01 # 平台网页https://aicc.cuopen.net:9801/login 密码Gswl@2025
|
sysUserId: HBSL01 # 平台网页https://aicc.cuopen.net:9801/login 密码Gswl@2025
|
||||||
processId: 1935233125932101634
|
# processId: 1935233125932101634
|
||||||
# processId: 1934801506242949122
|
processId: 1952550108058906626
|
||||||
# callerGroup: 02160980358
|
# callerGroup: 02160980358
|
||||||
callerGroup: 02759325005
|
callerGroup: 02759325005
|
||||||
secret: yxt@2024-1234567
|
secret: yxt@2024-1234567
|
||||||
|
|
|
||||||
|
|
@ -10,15 +10,5 @@
|
||||||
where T1.TASK_ID = #{taskId}
|
where T1.TASK_ID = #{taskId}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectPositionByPhone" resultType="String">
|
|
||||||
select t.POSITION
|
|
||||||
from FXKH_TXL.SH_ADDRESS_BOOK t
|
|
||||||
where
|
|
||||||
t.DEL = 1
|
|
||||||
AND t.PHONE = #{phone}
|
|
||||||
ORDER BY
|
|
||||||
t.SORT ASC
|
|
||||||
LIMIT 1
|
|
||||||
</select>
|
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|
@ -24,7 +24,7 @@ import java.util.List;
|
||||||
class AICCHelperTest {
|
class AICCHelperTest {
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(AICCHelperTest.class);
|
private static final Logger LOG = LoggerFactory.getLogger(AICCHelperTest.class);
|
||||||
|
|
||||||
public static void main(String[] args) throws InterruptedException, ParseException, GeneralSecurityException, UnsupportedEncodingException {
|
public static void main2(String[] args) throws InterruptedException, ParseException, GeneralSecurityException, UnsupportedEncodingException {
|
||||||
AICCHelper helper = new AICCHelper();
|
AICCHelper helper = new AICCHelper();
|
||||||
helper.setProcessId("1935233125932101634");
|
helper.setProcessId("1935233125932101634");
|
||||||
helper.setCallerGroup("02759325005");
|
helper.setCallerGroup("02759325005");
|
||||||
|
|
@ -74,9 +74,9 @@ class AICCHelperTest {
|
||||||
uploadTask.setParam(Lists.newArrayList(param));
|
uploadTask.setParam(Lists.newArrayList(param));
|
||||||
|
|
||||||
uploadTask.setCalleeType(1);
|
uploadTask.setCalleeType(1);
|
||||||
uploadTask.setRepeatTimes(1);
|
// uploadTask.setRepeatTimes(1);
|
||||||
uploadTask.setAutoCall("0");
|
uploadTask.setAutoCall("0");
|
||||||
uploadTask.setSpanSeconds(10);
|
// uploadTask.setSpanSeconds(10);
|
||||||
|
|
||||||
LOG.info("上传外呼任务: {}", JSON.toJSONString(uploadTask));
|
LOG.info("上传外呼任务: {}", JSON.toJSONString(uploadTask));
|
||||||
AICCCallRespWrapper<AICCCallRespTask> AICCCallRespWrapper = helper.apiUploadCallData(uploadTask);
|
AICCCallRespWrapper<AICCCallRespTask> AICCCallRespWrapper = helper.apiUploadCallData(uploadTask);
|
||||||
|
|
@ -172,46 +172,42 @@ class AICCHelperTest {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void main2(String[] args) throws GeneralSecurityException, UnsupportedEncodingException {
|
public static void main3(String[] args) throws GeneralSecurityException, UnsupportedEncodingException {
|
||||||
AICCHelper helper = new AICCHelper();
|
AICCHelper helper = new AICCHelper();
|
||||||
helper.setProcessId("1935233125932101634");
|
helper.setProcessId("1952550108058906626");
|
||||||
helper.setCallerGroup("02759325005");
|
helper.setCallerGroup("02759325005");
|
||||||
helper.setSecret("yxt@2024-1234567");
|
helper.setSecret("yxt@2024-1234567");
|
||||||
helper.setSysUserId("HBSL01");
|
helper.setSysUserId("HBSL01");
|
||||||
String token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6IkhCU0wwMSIsInRlbmFudElkIjoiOTYzOTM2NTE3IiwiZXhwIjoxNzUyMTU0NTE0fQ.R4Yg7OhZek9YbJ7xGj2rQTe_YY0KLPQDM2zRebLkRdY";
|
String token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6IkhCU0wwMSIsInRlbmFudElkIjoiOTYzOTM2NTE3IiwiZXhwIjoxNzU0NjU5ODI0fQ.08Axf2DVQokcl8gDw1061ljq1EHyhxElx4-OBKx0TGw";
|
||||||
|
|
||||||
String prefix = System.currentTimeMillis() + "";
|
String prefix = System.currentTimeMillis() + "";
|
||||||
|
|
||||||
AICCUploadTask task = new AICCUploadTask();
|
AICCUploadTask task = new AICCUploadTask();
|
||||||
task.setTaskName("requestId" + prefix);
|
task.setTaskName("requestId" + prefix);
|
||||||
task.setProcessId("1935233125932101634");
|
task.setProcessId("1952550108058906626");
|
||||||
task.setCallerGroup("02759325005");
|
task.setCallerGroup("02759325005");
|
||||||
task.setRequestId("requestId" + prefix);
|
task.setRequestId("requestId" + prefix);
|
||||||
task.genMutiTimeRange();
|
task.genMutiTimeRange();
|
||||||
AICCUploadTask.Cust param1 = AICCUploadTask.Cust.builder()
|
AICCUploadTask.Cust param1 = AICCUploadTask.Cust.builder()
|
||||||
.setCustName("秦")
|
|
||||||
.setCustId("秦" + prefix)
|
|
||||||
.setContent("测试测试测试,这是第一个联系人")
|
|
||||||
.set_numbers(Collections.singletonList("13933930962"))
|
|
||||||
.build();
|
|
||||||
AICCUploadTask.Cust param2 = AICCUploadTask.Cust.builder()
|
|
||||||
.setCustName("李")
|
.setCustName("李")
|
||||||
.setCustId("李" + prefix)
|
.setCustId(prefix + "-15671545233")
|
||||||
.setContent("测试测试测试,这是第二个联系人")
|
// .setContent("ai话术测试")
|
||||||
|
.setContent("过去1小时黄陂李家集街道已出现64.4毫米降水,受强降雨云团持续影响,预计未来3小时,黄陂中北部部分街道(乡镇)将出现暴雨到大暴雨,伴有雷电和短时强降水,局地7-9级雷暴大风,山区山洪、地质灾害、中小河流洪水、城乡积涝风险高,请加强防范。")
|
||||||
.set_numbers(Collections.singletonList("15671545233"))
|
.set_numbers(Collections.singletonList("15671545233"))
|
||||||
.build();
|
.build();
|
||||||
task.setParam(Lists.newArrayList(param1, param2));
|
task.setParam(Collections.singletonList(param1));
|
||||||
|
System.out.println(JSON.toJSONString(task));
|
||||||
|
|
||||||
AICCCallRespWrapper<AICCCallRespTask> AICCCallRespWrapper = helper.apiUploadCallData(task);
|
AICCCallRespWrapper<AICCCallRespTask> AICCCallRespWrapper = helper.apiUploadCallData(task, token);
|
||||||
String msg = AICCCallRespWrapper.getResult().getMsg();
|
String msg = AICCCallRespWrapper.getResult().getMsg();
|
||||||
System.out.println(msg);
|
System.out.println(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) throws GeneralSecurityException, UnsupportedEncodingException {
|
||||||
class Cust {
|
String token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6IkhCU0wwMSIsInRlbmFudElkIjoiOTYzOTM2NTE3IiwiZXhwIjoxNzU0NjU5ODI0fQ.08Axf2DVQokcl8gDw1061ljq1EHyhxElx4-OBKx0TGw";
|
||||||
private String custName;
|
AICCHelper helper = new AICCHelper();
|
||||||
private String custId;
|
AICCCallRespWrapper<AICCCallRespDetail> detail = helper.apiGetTaskCallDetail("requestId1754361918060", "1754361918060-15671545233", token);
|
||||||
private String content;
|
System.out.println(JSON.toJSONString(detail));
|
||||||
private String number;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue