Commit 6182e195 authored by kongfm's avatar kongfm

tzs 更新通话

parent 0c831aa9
...@@ -604,7 +604,7 @@ public class DateUtils { ...@@ -604,7 +604,7 @@ public class DateUtils {
System.out.println(dateTimeToDateStringIfTimeEndZero(dateTimeToDate(new Date())));*/ System.out.println(dateTimeToDateStringIfTimeEndZero(dateTimeToDate(new Date())));*/
//System.out.println(dateBetween(dateParse("2017-01-30", null), dateParse("2017-02-01", null))); //System.out.println(dateBetween(dateParse("2017-01-30", null), dateParse("2017-02-01", null)));
//System.out.println(dateBetweenIncludeToday(dateParse("2017-01-30", null), dateParse("2017-02-01", null))); //System.out.println(dateBetweenIncludeToday(dateParse("2017-01-30", null), dateParse("2017-02-01", null)));
System.out.println(getDate(dateParse("2017-01-17", null))); //System.out.println(getDate(dateParse("2017-01-17", null)));
/* /*
System.out.println(getDaysOfMonth(dateParse("2017-02-01", null))); System.out.println(getDaysOfMonth(dateParse("2017-02-01", null)));
System.out.println(getDaysOfYear(dateParse("2017-01-30", null)));*/ System.out.println(getDaysOfYear(dateParse("2017-01-30", null)));*/
...@@ -612,6 +612,7 @@ public class DateUtils { ...@@ -612,6 +612,7 @@ public class DateUtils {
// .MONTH_PATTERN)); // .MONTH_PATTERN));
/*System.out.println(dateFormat(maxDateOfMonth(dateParse("2016-02", "yyyy-MM")), null)); /*System.out.println(dateFormat(maxDateOfMonth(dateParse("2016-02", "yyyy-MM")), null));
System.out.println(dateFormat(minDateOfMonth(dateParse("2016-03-31", null)), null));*/ System.out.println(dateFormat(minDateOfMonth(dateParse("2016-03-31", null)), null));*/
System.out.println(secondsToTimeStr(3600));
} }
/** /**
...@@ -720,4 +721,23 @@ public class DateUtils { ...@@ -720,4 +721,23 @@ public class DateUtils {
String dateString = formatter.format(currentTime); String dateString = formatter.format(currentTime);
return dateString; return dateString;
} }
/**
* 将秒数转换为时分秒格式
* @param times
* @return
*/
public static String secondsToTimeStr(int times) {
if(times <= 0){
return "00:00:00";
}
int h = times/3600;
int m = (times-h*3600)/60;
int s = times - h*3600-m*60;
String time = "%02d:%02d:%02d";
time = String.format(time,h,m,s);
return time;
}
} }
...@@ -54,4 +54,13 @@ public class VoiceRecordFileDto extends BaseDto { ...@@ -54,4 +54,13 @@ public class VoiceRecordFileDto extends BaseDto {
@ApiModelProperty(value = "通话记录id") @ApiModelProperty(value = "通话记录id")
private String connectId; private String connectId;
@ApiModelProperty(value = "关联工单编号")
private String workNum;
@ApiModelProperty(value = "通话开始时间str")
private String telStartTimeStr;
@ApiModelProperty(value = "通话结束时间str")
private String telEndTimeStr;
} }
...@@ -76,4 +76,11 @@ public class VoiceRecordFile extends BaseEntity { ...@@ -76,4 +76,11 @@ public class VoiceRecordFile extends BaseEntity {
@TableField("alert_stage_code") @TableField("alert_stage_code")
private String alertStageCode; private String alertStageCode;
/**
* 通话时长
*/
@TableField("tel_time")
private String telTime;
} }
package com.yeejoin.amos.boot.module.tzs.api.mapper; package com.yeejoin.amos.boot.module.tzs.api.mapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.tzs.api.dto.VoiceRecordFileDto;
import com.yeejoin.amos.boot.module.tzs.api.entity.VoiceRecordFile; import com.yeejoin.amos.boot.module.tzs.api.entity.VoiceRecordFile;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/** /**
* 通话记录附件 Mapper 接口 * 通话记录附件 Mapper 接口
...@@ -11,4 +16,12 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; ...@@ -11,4 +16,12 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
*/ */
public interface VoiceRecordFileMapper extends BaseMapper<VoiceRecordFile> { public interface VoiceRecordFileMapper extends BaseMapper<VoiceRecordFile> {
Page<List<VoiceRecordFileDto>> queryRecordListByQueryDto(Page<VoiceRecordFileDto> page,
@Param("telStartTimeStr") String telStartTimeStr,
@Param("telEndTimeStr") String telEndTimeStr,
@Param("fileType") String fileType,
@Param("tel") String tel,
@Param("workNum") String workNum,
@Param("sortParam") String sortParam,
@Param("sortRule") String sortRule);
} }
package com.yeejoin.amos.boot.module.tzs.api.service; package com.yeejoin.amos.boot.module.tzs.api.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.tzs.api.dto.VoiceRecordFileDto; import com.yeejoin.amos.boot.module.tzs.api.dto.VoiceRecordFileDto;
/** /**
...@@ -13,4 +14,5 @@ public interface IVoiceRecordFileService { ...@@ -13,4 +14,5 @@ public interface IVoiceRecordFileService {
void publishRecord(VoiceRecordFileDto model); void publishRecord(VoiceRecordFileDto model);
Page<VoiceRecordFileDto> queryRecordListByQueryDto(Page<VoiceRecordFileDto> page, String telEndTimeStr, String telEndTimeStr1, String fileType, String tel, String workNum, String sortParam, String sortRule);
} }
...@@ -2,4 +2,46 @@ ...@@ -2,4 +2,46 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yeejoin.amos.boot.module.tzs.api.mapper.VoiceRecordFileMapper"> <mapper namespace="com.yeejoin.amos.boot.module.tzs.api.mapper.VoiceRecordFileMapper">
<select id="queryRecordListByQueryDto" resultType="java.util.Map">
SELECT
r.sequence_nbr AS sequenceNbr,
r.file_path AS filePath,
r.file_type AS fileType,
r.tel AS tel,
r.tel_start_time AS telStartTime,
r.tel_end_time AS telEndTime,
r.alert_id AS alertId,
r.alert_stage AS alertStage,
r.alert_stage_code AS alertStageCode,
r.tel_time AS telTime,
a.work_order_number AS workNum
FROM
tz_voice_record_file r
LEFT JOIN tz_alert_called a ON a.sequence_nbr =
r.alert_id
WHERE r.is_delete = 0
<if test="workNum != null and workNum != ''">
AND a.work_order_number like
CONCAT(CONCAT('%',#{workNum}),'%')
</if>
<if test="telStartTimeStr != null ">
and #{telStartTimeStr} <![CDATA[ <= ]]>
r.tel_start_time
</if>
<if test="telEndTimeStr != null ">
and r.tel_end_time <![CDATA[ <= ]]>
#{telEndTimeStr}
</if>
<if test="tel != null and tel != ''">
AND r.tel like
CONCAT(CONCAT('%',#{tel}),'%')
</if>
<if test="fileType != null and fileType != ''">
AND r.file_type = #{fileType}
</if>
<if test="sortParam != null and sortParam != '' and sortRule != null and sortRule != '' ">
ORDER BY ${sortParam} ${sortRule}
</if>
</select>
</mapper> </mapper>
...@@ -697,20 +697,6 @@ public class AlertCalledController extends BaseController { ...@@ -697,20 +697,6 @@ public class AlertCalledController extends BaseController {
return ResponseHelper.buildResponse(iAlertCalledService.getAlertPaperInfoList(regionCodes,true)); return ResponseHelper.buildResponse(iAlertCalledService.getAlertPaperInfoList(regionCodes,true));
} }
/**
* 根据regionCode 获取区域内历史警情 七日内
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getUserRegincode")
@ApiOperation(httpMethod = "GET", value = "获取用户regionCode", notes = "获取用户regionCode")
public ResponseModel<List<String>> getHistoryAlert() {
List<String> regionList = new ArrayList<>();
AgencyUserModel me = Privilege.agencyUserClient.getme().getResult();
logger.error(me.getRealName());
regionList.add("610100");
regionList.add("610300");
return ResponseHelper.buildResponse(regionList);
}
......
...@@ -15,6 +15,9 @@ import org.typroject.tyboot.core.restful.doc.TycloudOperation; ...@@ -15,6 +15,9 @@ import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper; import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel; import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.util.ArrayList;
import java.util.List;
/** /**
* 特种设备权限controller * 特种设备权限controller
*/ */
...@@ -44,5 +47,18 @@ public class TzsAuthController extends BaseController { ...@@ -44,5 +47,18 @@ public class TzsAuthController extends BaseController {
return ResponseHelper.buildResponse(flag); return ResponseHelper.buildResponse(flag);
} }
/**
* 获取用户regionCode
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getUserRegincode")
@ApiOperation(httpMethod = "GET", value = "获取用户regionCode", notes = "获取用户regionCode")
public ResponseModel<List<String>> getHistoryAlert() {
List<String> regionList = new ArrayList<>();
AgencyUserModel me = Privilege.agencyUserClient.getme().getResult();
regionList.add("610100");
regionList.add("610300");
return ResponseHelper.buildResponse(regionList);
}
} }
package com.yeejoin.amos.boot.module.tzs.biz.controller; package com.yeejoin.amos.boot.module.tzs.biz.controller;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.controller.BaseController; import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils; import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.module.tzs.api.dto.AlertCalledDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.AlertCalledFormDto; import com.yeejoin.amos.boot.module.tzs.api.dto.AlertCalledFormDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.AlertCalledQueryDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.VoiceRecordFileDto; import com.yeejoin.amos.boot.module.tzs.api.dto.VoiceRecordFileDto;
import com.yeejoin.amos.boot.module.tzs.api.entity.AlertCalled;
import com.yeejoin.amos.boot.module.tzs.api.entity.VoiceRecordFile; import com.yeejoin.amos.boot.module.tzs.api.entity.VoiceRecordFile;
import com.yeejoin.amos.boot.module.tzs.api.service.ICtiService;
import com.yeejoin.amos.boot.module.tzs.biz.service.impl.AlertCalledServiceImpl; import com.yeejoin.amos.boot.module.tzs.biz.service.impl.AlertCalledServiceImpl;
import com.yeejoin.amos.boot.module.tzs.biz.service.impl.VoiceRecordFileServiceImpl; import com.yeejoin.amos.boot.module.tzs.biz.service.impl.VoiceRecordFileServiceImpl;
import com.yeejoin.amos.boot.module.tzs.biz.utils.AlertBeanDtoVoUtils;
import com.yeejoin.amos.boot.module.tzs.biz.utils.BeanDtoVoUtils;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.core.foundation.enumeration.UserType; import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil; import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
...@@ -29,13 +36,9 @@ import org.typroject.tyboot.core.restful.exception.instance.BadRequest; ...@@ -29,13 +36,9 @@ import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import org.typroject.tyboot.core.restful.utils.ResponseHelper; import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel; import org.typroject.tyboot.core.restful.utils.ResponseModel;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Calendar; import java.util.Calendar;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.UUID; import java.util.UUID;
/** /**
...@@ -104,9 +107,6 @@ public class VoiceRecordFileController extends BaseController { ...@@ -104,9 +107,6 @@ public class VoiceRecordFileController extends BaseController {
VoiceRecordFileDto target = new VoiceRecordFileDto(); VoiceRecordFileDto target = new VoiceRecordFileDto();
// 把原对象数据拷贝到新对象 // 把原对象数据拷贝到新对象
BeanUtils.copyProperties(voiceRecord, target); BeanUtils.copyProperties(voiceRecord, target);
if(voiceRecord.getTelStartTime() != null && voiceRecord.getTelEndTime() != null) {
target.setTelTime(DateUtils.getTimestr( voiceRecord.getTelEndTime(),voiceRecord.getTelStartTime()));
}
dtoList.add(target); dtoList.add(target);
}); });
return ResponseHelper.buildResponse(dtoList); return ResponseHelper.buildResponse(dtoList);
...@@ -132,4 +132,38 @@ public class VoiceRecordFileController extends BaseController { ...@@ -132,4 +132,38 @@ public class VoiceRecordFileController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "查询通话记录", notes = "查询通话记录")
@GetMapping("/selectRecord")
public ResponseModel<Page<VoiceRecordFileDto>> queryVoiceCodeByPager(VoiceRecordFileDto model,
@RequestParam(value = "pageNum") int pageNum, @RequestParam(value = "pageSize") int pageSize, String sort ) {
Page<VoiceRecordFileDto> page = new Page<VoiceRecordFileDto>();
page.setCurrent(pageNum);
page.setSize(pageSize);
String sortParam = "";
String sortRule = "";
if(sort!=null) { // 排序失效
String[] date= sort.split(",");
if(date[1].equals("ascend")) {
sortParam = RedisKey.humpToLine(date[0]);
sortRule = "asc";
}else {
sortParam =RedisKey.humpToLine(date[0]);
sortRule = "desc";
}
}else {
sortParam = "call_time";
sortRule = "desc";
}
Page<VoiceRecordFileDto> pageBean = voiceRecordFileServiceImpl.queryRecordListByQueryDto(page,
model.getTelStartTimeStr(),model.getTelEndTimeStr(),model.getFileType(),model.getTel(),
model.getWorkNum(),sortParam,sortRule);
Page<VoiceRecordFileDto> result = new Page<VoiceRecordFileDto>(pageNum,pageSize);
long totle = pageBean.getTotal();
result.setRecords(pageBean.getRecords());
result.setTotal(totle);
return ResponseHelper.buildResponse(result);
}
} }
...@@ -136,7 +136,7 @@ public class CtiServiceImpl implements ICtiService { ...@@ -136,7 +136,7 @@ public class CtiServiceImpl implements ICtiService {
JSONArray loginData = response.getJSONArray("data"); JSONArray loginData = response.getJSONArray("data");
return loginData; return loginData;
} catch (Exception e) { } catch (Exception e) {
throw new BadRequest("获取loginData 出错:" + e.getMessage()); throw new BadRequest("获取话单出错: " + e.getMessage());
} }
} else { //登陆失败 } else { //登陆失败
throw new BadRequest("获取话单出错:" + response.getString("msg")); throw new BadRequest("获取话单出错:" + response.getString("msg"));
......
...@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; ...@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.feign.AmosFeignService; import com.yeejoin.amos.boot.biz.common.feign.AmosFeignService;
import com.yeejoin.amos.boot.biz.common.utils.DateUtils; import com.yeejoin.amos.boot.biz.common.utils.DateUtils;
import com.yeejoin.amos.boot.module.tzs.api.dto.AlertCalledFormDto; import com.yeejoin.amos.boot.module.tzs.api.dto.AlertCalledFormDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.AlertCalledQueryDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.VoiceRecordFileDto; import com.yeejoin.amos.boot.module.tzs.api.dto.VoiceRecordFileDto;
import com.yeejoin.amos.boot.module.tzs.api.entity.VoiceRecordFile; import com.yeejoin.amos.boot.module.tzs.api.entity.VoiceRecordFile;
import com.yeejoin.amos.boot.module.tzs.api.mapper.VoiceRecordFileMapper; import com.yeejoin.amos.boot.module.tzs.api.mapper.VoiceRecordFileMapper;
...@@ -92,6 +93,8 @@ public class VoiceRecordFileServiceImpl extends BaseService<VoiceRecordFileDto,V ...@@ -92,6 +93,8 @@ public class VoiceRecordFileServiceImpl extends BaseService<VoiceRecordFileDto,V
} catch (Exception e) { } catch (Exception e) {
logger.error("日期转换错误"); logger.error("日期转换错误");
} }
int times = recordInfo.getIntValue("times");
model.setTelTime(DateUtils.secondsToTimeStr(times));
model.setTelStartTime(telStartTime); model.setTelStartTime(telStartTime);
model.setTelEndTime(telEndTime); model.setTelEndTime(telEndTime);
if(1 == recordInfo.getInteger("callType")) { if(1 == recordInfo.getInteger("callType")) {
...@@ -128,4 +131,18 @@ public class VoiceRecordFileServiceImpl extends BaseService<VoiceRecordFileDto,V ...@@ -128,4 +131,18 @@ public class VoiceRecordFileServiceImpl extends BaseService<VoiceRecordFileDto,V
} }
@Override
public Page<VoiceRecordFileDto> queryRecordListByQueryDto(Page<VoiceRecordFileDto> page, String telStartTimeStr, String telEndTimeStr, String fileType, String tel, String workNum, String sortParam, String sortRule) {
Page<List<VoiceRecordFileDto>>list = baseMapper.queryRecordListByQueryDto(page,
telStartTimeStr,telEndTimeStr,fileType,tel,
workNum,sortParam,sortRule);
Page<VoiceRecordFileDto> page1 = new Page<>();
List<VoiceRecordFileDto> resultDtoList = JSONArray.parseArray(JSONArray.toJSONString(list.getRecords()),VoiceRecordFileDto.class);
page1.setCurrent(page.getCurrent());
page1.setSize(page.getSize());
page1.setTotal(list.getTotal());
page1.setRecords(resultDtoList);
return page1;
}
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment