| | |
| | | import org.springframework.web.client.RestTemplate; |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | |
| | | |
| | | /** |
| | | * 创建任务 |
| | | * @param params |
| | | * @param map |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Object createTask(List<Map<String, String>> params) { |
| | | public Object createTask(Map<String,Object> map) { |
| | | List<Map<String, String>> params = (List<Map<String, String>>) map.get("list"); |
| | | String requestUrl = url + CREATE_TASK_URL; |
| | | LocalDateTime now = LocalDateTime.now(); |
| | | String timestamp = now.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss SSS")); |
| | | String transId = generateTransId(now); |
| | | String taskName = now.format(DateTimeFormatter.ofPattern("yyyy年MM月dd日HH:mm")) + "智能外呼"; |
| | | // String taskName = now.format(DateTimeFormatter.ofPattern("yyyy年MM月dd日HH:mm")) + "智能外呼"; |
| | | String taskName = map.get("taskName").toString(); |
| | | String[] numbers = StringUtils.split(callingNumbers,","); |
| | | String taskScheduleTime = LocalDateTime.now().plusHours(1).format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); |
| | | // String taskScheduleTime = LocalDateTime.now().plusHours(1).format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")); |
| | | String taskScheduleTime = map.get("taskScheduleTime").toString(); |
| | | JSONArray arr = getCalleeInfo(params); |
| | | HttpHeaders httpHeaders = new HttpHeaders(); |
| | | httpHeaders.add("Content-Type", CONTENT_TYPE); |
| | |
| | | */ |
| | | @Override |
| | | public IPage<CallTaskResultVO> getCallTaskResultListPage(IPage<CallTaskResultVO> page, CallTaskResultVO callTaskResult) { |
| | | List<CallTaskResultVO> resultListPage = callTaskMapper.getCallTaskResultListPage(page, callTaskResult); |
| | | //遍历 |
| | | if (resultListPage.size()>0) { |
| | | for (CallTaskResultVO resultVO : resultListPage) { |
| | | // 取出 jsonData 数据 |
| | | System.out.println("resultVO = " + resultVO); |
| | | String callTaskCalleeContent = resultVO.getCallTaskCalleeContent(); |
| | | JSONObject jsonObject = JSONObject.parseObject(callTaskCalleeContent); |
| | | String userName = jsonObject.getString("$用户名$"); |
| | | String adName = jsonObject.getString("$水库名称$"); |
| | | resultVO.setAdName(adName); |
| | | resultVO.setAreaName(getAreaNameByAdCode(jsonObject.getString("$水库编码$"))); |
| | | resultVO.setUserName(userName); |
| | | } |
| | | List<String> list = new ArrayList<>(); |
| | | if (null!= callTaskResult.getAreaName() && !callTaskResult.getAreaName().equals("")){ |
| | | // 查询所有下级区域code |
| | | list = getWaterNameByAreaCode(callTaskResult.getAreaName()); |
| | | } |
| | | List<CallTaskResultVO> resultListPage = callTaskMapper.getCallTaskResultListPage(page, callTaskResult,list); |
| | | return page.setRecords(resultListPage); |
| | | } |
| | | |
| | | /** |
| | | * 导出呼叫详情列表信息 |
| | | * @param callTaskResult |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Object getCallTaskResultList(CallTaskResultVO callTaskResult) { |
| | | List<String> list = new ArrayList<>(); |
| | | if (null!= callTaskResult.getAreaName() && !callTaskResult.getAreaName().equals("")){ |
| | | // 查询所有下级区域code |
| | | list = getWaterNameByAreaCode(callTaskResult.getAreaName()); |
| | | } |
| | | List<CallTaskResultVO> resultListPage = callTaskMapper.getCallTaskResultListPage(null, callTaskResult,list); |
| | | // 返回 |
| | | return resultListPage; |
| | | } |
| | | |
| | | /** |
| | |
| | | // 通过adCode查询区域名称 |
| | | return callTaskMapper.getAreaNameByAdCode(adCode); |
| | | } |
| | | |
| | | /** |
| | | * 通过行政区编号获取水库名称 |
| | | * @param areaCode |
| | | * @return |
| | | */ |
| | | private List<String> getWaterNameByAreaCode(String areaCode) { |
| | | // 通过行政区编号获取水库名称 |
| | | return callTaskMapper.getWaterNameByAreaCode(areaCode); |
| | | } |
| | | } |