|
|
@@ -39,6 +39,9 @@ import org.springframework.util.CollectionUtils;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
+import java.io.UnsupportedEncodingException;
|
|
|
+import java.net.URLDecoder;
|
|
|
+import java.net.URLEncoder;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
@@ -1542,7 +1545,9 @@ public class ApiController extends BaseController {
|
|
|
for (CcOutboundCdr data: list) {
|
|
|
data.setWavFileUrl("/recordings/files?filename=" + data.getRecordFilename());
|
|
|
try {
|
|
|
- data.setCallee(DESUtil.encrypt(data.getCallee()));
|
|
|
+ if(StringUtils.isNotEmpty(data.getCallee())){
|
|
|
+ data.setCallee(DESUtil.encrypt(URLEncoder.encode(data.getCallee(), "UTF-8")));
|
|
|
+ }
|
|
|
} catch (Throwable e) {
|
|
|
throw new RuntimeException(e);
|
|
|
}
|
|
|
@@ -1767,14 +1772,21 @@ public class ApiController extends BaseController {
|
|
|
}
|
|
|
List<CcCallPhone> list = ccCallPhoneService.selectCcCallPhoneListByIds(callPhoneIds);
|
|
|
if(!CollectionUtils.isEmpty(list)){
|
|
|
- //处理下大字段不要传输
|
|
|
list.forEach(callPhoneRecord -> {
|
|
|
- callPhoneRecord.setTelephone(CommonUtils.maskPhoneNumber(callPhoneRecord.getTelephone()));
|
|
|
- callPhoneRecord.setCallerNumber(CommonUtils.maskPhoneNumber(callPhoneRecord.getCallerNumber()));
|
|
|
- callPhoneRecord.setDialogue(null);
|
|
|
- callPhoneRecord.setBizJson(null);
|
|
|
- callPhoneRecord.setRecordServerUrl(null);
|
|
|
- callPhoneRecord.setIvrDtmfDigits( null);
|
|
|
+ callPhoneRecord.setBizJson("");
|
|
|
+ try {
|
|
|
+ if(StringUtils.isNotEmpty(callPhoneRecord.getTelephone())){
|
|
|
+ callPhoneRecord.setTelephone(DESUtil.encrypt(URLEncoder.encode(callPhoneRecord.getTelephone(), "UTF-8")));
|
|
|
+ }else{
|
|
|
+ callPhoneRecord.setTelephone("");
|
|
|
+ }
|
|
|
+ if(StringUtils.isNotEmpty(callPhoneRecord.getCallerNumber())){
|
|
|
+ callPhoneRecord.setCallerNumber(DESUtil.encrypt(URLEncoder.encode(callPhoneRecord.getCallerNumber(), "UTF-8")));
|
|
|
+ }else{
|
|
|
+ callPhoneRecord.setCallerNumber("");
|
|
|
+ }
|
|
|
+ } catch (UnsupportedEncodingException e) {
|
|
|
+ }
|
|
|
});
|
|
|
}
|
|
|
return AjaxResult.success(list);
|
|
|
@@ -1838,4 +1850,86 @@ public class ApiController extends BaseController {
|
|
|
|
|
|
return getDataTable(list);
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 追加外呼名单(不自动启动任务,数据加密传输)
|
|
|
+ * @param encryptedData
|
|
|
+ */
|
|
|
+ @PostMapping(value ="/import/autoCallData")
|
|
|
+ @ResponseBody
|
|
|
+ public AjaxResult addCommonCallList(@RequestBody String encryptedData) {
|
|
|
+ // 解密数据
|
|
|
+ String decryptedJson;
|
|
|
+ try {
|
|
|
+ //base64特殊处理
|
|
|
+ encryptedData = URLDecoder.decode(encryptedData, "UTF-8").replaceAll("=+$", "");
|
|
|
+ decryptedJson = DESUtil.decrypt(encryptedData);
|
|
|
+ } catch (Throwable e) {
|
|
|
+ return AjaxResult.error(AjaxResult.Type.INVALID_PARAM, "参数encryptedData解密失败", "");
|
|
|
+ }
|
|
|
+ // 2. 反序列化为 Java 对象
|
|
|
+ CommonCallListModel commonCallListModel = JSONObject.parseObject(decryptedJson, CommonCallListModel.class);
|
|
|
+
|
|
|
+ Long batchId = commonCallListModel.getBatchId();
|
|
|
+ if (null == batchId) {
|
|
|
+ return AjaxResult.error(AjaxResult.Type.INVALID_PARAM, "参数batchId不能为空", "");
|
|
|
+ }
|
|
|
+ if (CollectionUtils.isEmpty(commonCallListModel.getPhoneList())) {
|
|
|
+ return AjaxResult.error(AjaxResult.Type.INVALID_PARAM, "参数phoneList不能为空", "");
|
|
|
+ }
|
|
|
+ // 获取任务
|
|
|
+ CcCallTask ccCallTask = callTaskService.selectCcCallTaskByBatchId(batchId);
|
|
|
+ if (null == ccCallTask) {
|
|
|
+ return AjaxResult.error(AjaxResult.Type.INVALID_PARAM, "参数batchId不合法,请输入正确的batchId", "");
|
|
|
+ }
|
|
|
+ // 通知类的通知内容必填
|
|
|
+ if (ccCallTask.getTaskType() == 2) {
|
|
|
+ for (CommonPhoneModel commonPhoneModel : commonCallListModel.getPhoneList()) {
|
|
|
+ if (StringUtils.isBlank(commonPhoneModel.getNoticeContent())) {
|
|
|
+ return AjaxResult.error(AjaxResult.Type.INVALID_PARAM, "号码" + commonPhoneModel.getPhoneNum() + "的noticeContent不能为空!", "");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 追加名单
|
|
|
+ int successCount = 0;
|
|
|
+ List<CcCallPhone> callPhoneList = new ArrayList<>();
|
|
|
+ for (CommonPhoneModel commonPhoneModel : commonCallListModel.getPhoneList()) {
|
|
|
+ String phoneNum = commonPhoneModel.getPhoneNum();
|
|
|
+ if (StringUtils.isBlank(phoneNum)) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ CcCallPhone callPhone = buildCcCallPhone(ccCallTask, phoneNum, commonPhoneModel.getBizJson());
|
|
|
+ callPhone.setTtsText(commonPhoneModel.getNoticeContent());
|
|
|
+ callPhoneList.add(callPhone);
|
|
|
+ successCount ++;
|
|
|
+ if (callPhoneList.size() >= 200) {
|
|
|
+ ccCallPhoneService.batchInsertCcCallPhone(callPhoneList);
|
|
|
+ callPhoneList = new ArrayList<>();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (!callPhoneList.isEmpty()) {
|
|
|
+ ccCallPhoneService.batchInsertCcCallPhone(callPhoneList);
|
|
|
+ }
|
|
|
+ log.info("成功追加" + successCount + "个名单");
|
|
|
+ if(!CollectionUtils.isEmpty(callPhoneList)){
|
|
|
+ callPhoneList.forEach(callPhoneRecord -> {
|
|
|
+ callPhoneRecord.setBizJson("");
|
|
|
+ try {
|
|
|
+ if(StringUtils.isNotEmpty(callPhoneRecord.getTelephone())){
|
|
|
+ callPhoneRecord.setTelephone(DESUtil.encrypt(URLEncoder.encode(callPhoneRecord.getTelephone(), "UTF-8")));
|
|
|
+ }else{
|
|
|
+ callPhoneRecord.setTelephone("");
|
|
|
+ }
|
|
|
+ if(StringUtils.isNotEmpty(callPhoneRecord.getCallerNumber())){
|
|
|
+ callPhoneRecord.setCallerNumber(DESUtil.encrypt(URLEncoder.encode(callPhoneRecord.getCallerNumber(), "UTF-8")));
|
|
|
+ }else{
|
|
|
+ callPhoneRecord.setCallerNumber("");
|
|
|
+ }
|
|
|
+ } catch (UnsupportedEncodingException e) {
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ return AjaxResult.success("成功追加" + successCount + "个名单",callPhoneList);
|
|
|
+ }
|
|
|
}
|