Commit 37c447e5 authored by kongfm's avatar kongfm

通话记录相关功能完善

parent 0c0820a2
......@@ -394,26 +394,13 @@ public class ExcelUtil {
* @param fileName 下载的文件名,
* @param sheetName sheet名
* @param data 导出的数据
* @param model 导出的头
* @param flag true模板填充下拉 false 不填充
*/
public static void createTemplateWithHeaders(HttpServletResponse response, String fileName, String sheetName,
List<? extends Object> data, Class<?> model, DataSources dataDictionaryMapper, boolean flag, List<List<String>> heads, List<String> headstr, String fileType) {
List<? extends Object> data, List<List<String>> heads, List<String> headstr, String fileType) {
HorizontalCellStyleStrategy horizontalCellStyleStrategy = setMyCellStyle();
try {
// 下拉列表集合
Map<Integer, String[]> explicitListConstraintMap = new HashMap<>();
if (flag) {
// 循环获取对应列得下拉列表信息
Field[] declaredFields = model.getDeclaredFields();
for (int i = 0; i < declaredFields.length; i++) {
Field field = declaredFields[i];
// 解析注解信息
ExplicitConstraint explicitConstraint = field.getAnnotation(ExplicitConstraint.class);
resolveExplicitConstraint(explicitListConstraintMap, explicitConstraint, dataDictionaryMapper);
}
}
List<List<Object>> listData = Lists.newArrayList();
for (Object t : data) {
List<Object> rowLine = new ArrayList<>();
......@@ -438,7 +425,6 @@ public class ExcelUtil {
EasyExcel.write(getOutputStream(fileName, response, typeEnum))
.excelType(typeEnum).sheet(sheetName)
.registerWriteHandler(new TemplateCellWriteHandlerDate(explicitListConstraintMap))
.registerWriteHandler(new TemplateCellWriteHandler())
.registerWriteHandler(horizontalCellStyleStrategy)
.head(heads).doWrite(listData);
......
......@@ -102,5 +102,7 @@ public interface AlertCalledMapper extends BaseMapper<AlertCalled> {
String alertSource,
String alarmType);
List<AlertPaperInfoDto> getAlertPaperInfoList(@Param("regionCodes") List<String> regionCodes,@Param("isHistory") Boolean isHistory);
List<AlertPaperInfoDto> getAlertPaperInfoList(@Param("regionCodes") List<String> regionCodes,@Param("isHistory") Boolean isHistory);
List<AlertPaperInfoDto> getEquipmentHistory(@Param("regionCodes") List<String> regionCodes,@Param("equipmentClassCode") String equipmentClassCode,@Param("current") Integer current, @Param("equipmentCode") String equipmentCode);
}
......@@ -26,4 +26,6 @@ public interface VoiceRecordFileMapper extends BaseMapper<VoiceRecordFile> {
@Param("sortRule") String sortRule);
VoiceRecordFileDto getRecordById(@Param("sequenceNbr") Long sequenceNbr);
List<VoiceRecordFileDto> selectExportData(@Param("ids") List<String> ids);
}
......@@ -8,6 +8,7 @@ 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.AlertCalledRecordDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.AlertHandlerDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.AlertPaperInfoDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.DutyPersonDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.DutySeatDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.WechatMyBusinessListDto;
......@@ -99,4 +100,6 @@ public interface IAlertCalledService {
* @return
*/
List<DutySeatDto> getSeatInfos();
List<AlertPaperInfoDto> getEquipmentHistory(List<String> useRegionCode, String equipmentClassCode, Integer pageNum, String equipmentCode);
}
......@@ -4,6 +4,8 @@ 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 java.util.List;
/**
* 通话记录附件接口类
*
......@@ -17,4 +19,6 @@ public interface IVoiceRecordFileService {
Page<VoiceRecordFileDto> queryRecordListByQueryDto(Page<VoiceRecordFileDto> page, String telEndTimeStr, String telEndTimeStr1, String fileType, String tel, String workNum, String sortParam, String sortRule);
VoiceRecordFileDto getRecordById(Long sequenceNbr);
List<VoiceRecordFileDto> selectExportData(String exportId);
}
......@@ -556,6 +556,53 @@
</if>
</select>
<select id="getEquipmentHistory" resultType="com.yeejoin.amos.boot.module.tzs.api.dto.AlertPaperInfoDto">
SELECT
a.sequence_nbr AS alertId,
a.region_code AS regionCode,
e.rescue_code AS rescueCode,
a.alarm_type_code AS alarmTypeCode,
a.alarm_type AS alarmType,
CONCAT(e.province ,e.city ,e.district) AS area,
a.address AS address,
a.call_time AS callTime,
e.longitude AS longitude,
e.latitude AS latitude,
a.alert_stage AS alertStatus,
e.sequence_nbr AS elevatorId,
e.register_code AS elevatorCode,
p.feedback_finish_time AS finishTime
FROM tz_alert_called a
<choose>
<when test="equipmentClassCode == '3000'">
LEFT JOIN tcb_elevator e ON e.sequence_nbr = a.equipment_id and a.equipment_classification_code = #{equipmentClassCode}
LEFT JOIN tz_dispatch_paper p ON p.alert_id = a.sequence_nbr
where a.is_delete = 0 AND a.alert_status = 1 AND e.rescue_code = #{equipmentCode}
</when>
<otherwise>
AND a.alert_status = 0
</otherwise>
</choose>
<if test="regionCodes != null">
AND
<foreach collection="regionCodes" index="index" item="item" open="(" separator=" OR " close=")">
a.region_code LIKE CONCAT('%', #{item}, '%')
</foreach>
</if>
order by a.call_time desc
<choose>
<when test="current == null ">
limit 0,3
</when>
<otherwise>
limit #{current},5
</otherwise>
</choose>
</select>
</mapper>
......@@ -39,9 +39,15 @@
<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>
<choose>
<when test="sortParam != null and sortParam != '' and sortRule != null and sortRule != '' ">
ORDER BY ${sortParam} ${sortRule}
</when>
<otherwise>
ORDER BY r.tel_start_time desc
</otherwise>
</choose>
</select>
......@@ -67,4 +73,29 @@
WHERE r.sequence_nbr = #{sequenceNbr}
</select>
<select id="selectExportData" resultType="com.yeejoin.amos.boot.module.tzs.api.dto.VoiceRecordFileDto">
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="ids != null and ids.size() > 0">
and r.sequence_nbr in
<foreach item="item" collection="ids" separator="," open="(" close=")" index=""> #{item}
</foreach>
</if>
</select>
</mapper>
......@@ -748,6 +748,25 @@ public class AlertCalledController extends BaseController {
}
/**
* 获取电梯历史事件
* 字段:事件类型、设备地址、报送时间。倒序排列,默认加载3条,向下翻动时每次可再加载5条。点击事件主屏打开该事件详情
* @param equipmentCode
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/getElevatorHistory/{equipmentCode}")
@ApiOperation(httpMethod = "GET", value = "获取电梯历史事件", notes = "获取电梯历史事件")
public ResponseModel<List<AlertPaperInfoDto>> getEquipmentHistory(@PathVariable String equipmentCode, @RequestParam(value = "pageNum", required = false) Integer pageNum) {
// 警情id 警情地址 警情状态 警情类型 警情发生时间
// 获取自己的regionCode
String equipmentClassCode = "3000";
List<String> useRegionCode = tzsAuthService.getUserRegionCode();
return ResponseHelper.buildResponse(iAlertCalledService.getEquipmentHistory(useRegionCode,equipmentClassCode,pageNum,equipmentCode));
}
}
......@@ -14,6 +14,7 @@ import com.yeejoin.amos.boot.module.tzs.api.service.IMaintenanceUnitService;
import com.yeejoin.amos.boot.module.tzs.api.service.IRescueStationService;
import com.yeejoin.amos.boot.module.tzs.api.service.IUseUnitService;
import com.yeejoin.amos.boot.module.tzs.biz.service.impl.ElevatorServiceImpl;
import com.yeejoin.amos.boot.module.tzs.biz.service.impl.VoiceRecordFileServiceImpl;
import org.apache.commons.lang3.StringUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import io.swagger.annotations.ApiOperation;
......@@ -66,6 +67,9 @@ public class TemplateExportController extends BaseController {
@Autowired
IRescueStationService iRescueStationService;
@Autowired
VoiceRecordFileServiceImpl voiceRecordFileServiceImpl;
/**
* 新增模板表
*
......@@ -162,6 +166,8 @@ public class TemplateExportController extends BaseController {
fileName = "使用单位";
} else if("RESCUE_STATION".equals(type)) { // 查询救援站数据
fileName = "救援站";
} else if("VOICE_RECORD".equals(type)) { // 查询通话录音数据
fileName = "通话录音";
}
fileName += DateUtils.getDateNowShortNumber();
result.put("fileName",fileName);
......@@ -213,8 +219,11 @@ public class TemplateExportController extends BaseController {
} else if("RESCUE_STATION".equals(exportDto.getExportType())) { // 查询救援站数据
sheetName = "救援站";
list = iRescueStationService.selectExportData(exportDto.getExportId());
} else if("VOICE_RECORD".equals(exportDto.getExportType())) { // 查询救援站数据
sheetName = "通话录音";
list = voiceRecordFileServiceImpl.selectExportData(exportDto.getExportId());
}
ExcelUtil.createTemplateWithHeaders(response, fileName, sheetName, list, ElevatorDto.class, null, false, heads, headstr, exportDto.getFileType());
ExcelUtil.createTemplateWithHeaders(response, fileName, sheetName, list, heads, headstr, exportDto.getFileType());
}
}
......@@ -62,12 +62,8 @@ public class TzsAuthController extends BaseController {
@GetMapping(value = "/getUserRegincode")
@ApiOperation(httpMethod = "GET", value = "获取用户regionCode", notes = "获取用户regionCode")
public ResponseModel<List<String>> getUserRegincode() {
List<String> regionList = new ArrayList<>();
List<String> regionList = tzsAuthService.getUserRegionCode();
AgencyUserModel me = Privilege.agencyUserClient.getme().getResult();
regionList.add("610100");
regionList.add("610300");
regionList.add("610725");
regionList.add("610822");
return ResponseHelper.buildResponse(regionList);
}
......@@ -78,11 +74,7 @@ public class TzsAuthController extends BaseController {
@GetMapping(value = "/getUserReginTree")
@ApiOperation(httpMethod = "GET", value = "获取用户组织机构树", notes = "获取用户组织机构树")
public ResponseModel<Collection<RegionModel>> getUserReginTree() {
List<String> regionList = new ArrayList<>();
regionList.add("610100");
regionList.add("610300");
regionList.add("610725");
regionList.add("610822");
List<String> regionList = tzsAuthService.getUserRegionCode();
AgencyUserModel me = Privilege.agencyUserClient.getme().getResult();
List<RegionModel> tree = (List<RegionModel>) Systemctl.regionClient.queryForTree(null).getResult();
// 循环list 将List 封装为 省市区 SET
......
......@@ -682,4 +682,14 @@ public class AlertCalledServiceImpl extends BaseService<AlertCalledDto,AlertCall
});
return temp;
}
@Override
public List<AlertPaperInfoDto> getEquipmentHistory(List<String> regionCodes, String equipmentClassCode, Integer pageNum, String equipmentCode) {
Integer current = null;
if(pageNum != null) {
current = 3+(5*pageNum);
}
List<AlertPaperInfoDto> temp = baseMapper.getEquipmentHistory(regionCodes, equipmentClassCode,current,equipmentCode);
return temp;
}
}
\ No newline at end of file
......@@ -71,6 +71,8 @@ public class TzsAuthServiceImpl implements TzsAuthService {
List<String> regionList = new ArrayList<>();
AgencyUserModel me = Privilege.agencyUserClient.getme().getResult();
regionList.add("610100");
regionList.add("610300");
regionList.add("610725");
regionList.add("610822");
return regionList;
}
......
......@@ -12,6 +12,7 @@ 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.service.ICtiService;
import com.yeejoin.amos.boot.module.tzs.api.service.IVoiceRecordFileService;
import org.apache.commons.lang3.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.eclipse.paho.client.mqttv3.MqttException;
......@@ -20,6 +21,7 @@ import org.springframework.stereotype.Service;
import org.typroject.tyboot.component.emq.EmqKeeper;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.Map;
......@@ -151,4 +153,14 @@ public class VoiceRecordFileServiceImpl extends BaseService<VoiceRecordFileDto,V
VoiceRecordFileDto record = baseMapper.getRecordById(sequenceNbr);
return record;
}
@Override
public List<VoiceRecordFileDto> selectExportData(String exportId) {
List<String> ids = null;
if(StringUtils.isNotEmpty(exportId)) {
String[] idStr = exportId.split(",");
ids = Arrays.asList(idStr);
}
return baseMapper.selectExportData(ids);
}
}
\ 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