Commit 1f364474 authored by suhuiguang's avatar suhuiguang

Merge branch 'developer' into develop_dl_plan6

parents 2e4cd6b0 916edd10
...@@ -39,55 +39,9 @@ public interface FailureDetailsMapper extends BaseMapper<FailureDetails> { ...@@ -39,55 +39,9 @@ public interface FailureDetailsMapper extends BaseMapper<FailureDetails> {
Long sequenceNbr); Long sequenceNbr);
int selectAllCount(); int selectAllCount();
/**
* 查询我发起的 分页
* current 当前页
* size 条数
*
* @param currentStatus 当前任务状态
* * @param startTime 起始时间
* * @param endTime 结束时间
* * @param submissionPid 报送人
* @return
*/
List<FailureDetails> selectISubPage(Long current, Long size, Long currentStatus,
String startTime, String endTime, Integer submissionPid);
/**
* 查询待处理 分页
*
* @param currentStatus 当前任务状态
* * @param startTime 起始时间
* * @param endTime 结束时间
* * @param submissionPid 报送人
* @param
* @return
*/
List<FailureDetails> selectInProcessing(Long current, Long size, Long currentStatus,
String startTime, String endTime, Integer submissionPid);
/**
* 查询待处理 应急指挥科人员分页
*
* @param
* @return
*/
List<FailureDetails> selectStatusWaitTj(Long current, Long size, Long currentStatus,
String startTime, String endTime, Integer submissionPid);
/**
* 查询待处理 维修人员分页
*
* @param currentStatus 当前任务状态
* * @param startTime 起始时间
* * @param endTime 结束时间
* * @param submissionPid 报送人
* @param
* @return
*/
List<FailureDetails> selectStatusWaitWx(Long current, Long size, Long currentStatus,
String startTime, String endTime, Integer submissionPid);
List<FailureDetails> queryForWaitManage(Long current, Long size, Long currentStatus,
String startTime, String endTime, Integer submissionPid,String ruleName);
/** /**
* 统计 全部 * 统计 全部
...@@ -99,7 +53,23 @@ public interface FailureDetailsMapper extends BaseMapper<FailureDetails> { ...@@ -99,7 +53,23 @@ public interface FailureDetailsMapper extends BaseMapper<FailureDetails> {
* @return * @return
*/ */
List<StatusDto> selectStatusCount(Long currentStatus, String startTime, String endTime, Integer submissionPid); List<StatusDto> selectStatusCount(Long currentStatus, String startTime, String endTime, Integer submissionPid);
List<StatusDto> queryStatusCount(Long currentStatus, String startTime, String endTime, Integer submissionPid,String ruleName);
List<StatusDto> queryAcceptCount(Long currentStatus, String startTime, String endTime, Integer submissionPid, String userId,String ruleName);
List<FailureDetails> selectForReceive(Long currentStatus, String startTime, String endTime, Integer submissionPid, String userId,Long current, Long size,String ruleName);
/* List<StatusDto> selectAudit(Long currentStatus, String startTime, String endTime, Integer submissionPid, String userId);
List<StatusDto> selectMaintain(Long currentStatus, String startTime, String endTime, Integer submissionPid, String userId);
List<StatusDto> selectUserId(Long currentStatus, String startTime, String endTime, String userId);*/
/* List<FailureDetails> selectYJ(Long currentStatus, String startTime, String endTime, String userId,Long current, Long size);*/
/* List<FailureDetails> selectForAudit(Long currentStatus, String startTime, String endTime,Integer submissionPid, String userId,Long current, Long size);*/
/* List<FailureDetails> selectForMaintain(Long currentStatus, String startTime, String endTime, Integer submissionPid, String userId,Long current, Long size);*/
/** /**
* 统计 维修人员 * 统计 维修人员
...@@ -110,9 +80,9 @@ public interface FailureDetailsMapper extends BaseMapper<FailureDetails> { ...@@ -110,9 +80,9 @@ public interface FailureDetailsMapper extends BaseMapper<FailureDetails> {
* @param submissionPid 报送人 * @param submissionPid 报送人
* @return * @return
*/ */
List<StatusDto> selectStatusWx(Long currentStatus, String startTime, String endTime, Integer submissionPid); /* List<StatusDto> selectStatusWx(Long currentStatus, String startTime, String endTime, Integer submissionPid);
/** *//**
* 统计 应急指挥科人员 * 统计 应急指挥科人员
* *
* @param currentStatus 状态 * @param currentStatus 状态
...@@ -120,10 +90,10 @@ public interface FailureDetailsMapper extends BaseMapper<FailureDetails> { ...@@ -120,10 +90,10 @@ public interface FailureDetailsMapper extends BaseMapper<FailureDetails> {
* @param endTime 结束时间 * @param endTime 结束时间
* @param submissionPid 报送人 * @param submissionPid 报送人
* @return * @return
*/ *//*
List<StatusDto> selectStatusFq(Long currentStatus, String startTime, String endTime, Integer submissionPid); List<StatusDto> selectStatusFq(Long currentStatus, String startTime, String endTime, Integer submissionPid);
/** *//**
* 统计 我发起 * 统计 我发起
* *
* @param currentStatus 状态 * @param currentStatus 状态
...@@ -131,10 +101,10 @@ public interface FailureDetailsMapper extends BaseMapper<FailureDetails> { ...@@ -131,10 +101,10 @@ public interface FailureDetailsMapper extends BaseMapper<FailureDetails> {
* @param endTime 结束时间 * @param endTime 结束时间
* @param submissionPid 报送人 * @param submissionPid 报送人
* @return * @return
*/ *//*
List<StatusDto> selectStatusFqp(Long currentStatus, String startTime, String endTime, Integer submissionPid); List<StatusDto> selectStatusFqp(Long currentStatus, String startTime, String endTime, Integer submissionPid);
/** *//**
* 统计 领导 * 统计 领导
* *
* @param currentStatus 状态 * @param currentStatus 状态
...@@ -142,22 +112,56 @@ public interface FailureDetailsMapper extends BaseMapper<FailureDetails> { ...@@ -142,22 +112,56 @@ public interface FailureDetailsMapper extends BaseMapper<FailureDetails> {
* @param endTime 结束时间 * @param endTime 结束时间
* @param submissionPid 报送人 * @param submissionPid 报送人
* @return * @return
*/ *//*
List<StatusDto> selectStatusLeader(Long currentStatus, String startTime, String endTime, Integer submissionPid); List<StatusDto> selectStatusLeader(Long currentStatus, String startTime, String endTime, Integer submissionPid);*/
List<StatusDto> selectAudit(Long currentStatus, String startTime, String endTime, Integer submissionPid, String userId);
List<StatusDto> selectMaintain(Long currentStatus, String startTime, String endTime, Integer submissionPid, String userId);
List<StatusDto> selectUserId(Long currentStatus, String startTime, String endTime, String userId);
List<FailureDetails> selectYJ(Long currentStatus, String startTime, String endTime, String userId,Long current, Long size);
List<FailureDetails> selectForAudit(Long currentStatus, String startTime, String endTime,Integer submissionPid, String userId,Long current, Long size);
/* /**
* 查询待处理 分页
*
* @param currentStatus 当前任务状态
* * @param startTime 起始时间
* * @param endTime 结束时间
* * @param submissionPid 报送人
* @param
* @return
*//*
List<FailureDetails> selectInProcessing(Long current, Long size, Long currentStatus,
String startTime, String endTime, Integer submissionPid);
List<FailureDetails> selectForMaintain(Long currentStatus, String startTime, String endTime, Integer submissionPid, String userId,Long current, Long size); /**
* 查询待处理 应急指挥科人员分页
*
* @param
* @return
*//*
List<FailureDetails> selectStatusWaitTj(Long current, Long size, Long currentStatus,
String startTime, String endTime, Integer submissionPid);*/
/* /**
* 查询待处理 维修人员分页
*
* @param currentStatus 当前任务状态
* * @param startTime 起始时间
* * @param endTime 结束时间
* * @param submissionPid 报送人
* @param
* @return
*//*
List<FailureDetails> selectStatusWaitWx(Long current, Long size, Long currentStatus,
String startTime, String endTime, Integer submissionPid);*/
/* *//**
* 查询我发起的 分页
* current 当前页
* size 条数
*
* @param currentStatus 当前任务状态
* * @param startTime 起始时间
* * @param endTime 结束时间
* * @param submissionPid 报送人
* @return
*//*
List<FailureDetails> selectISubPage(Long current, Long size, Long currentStatus,
String startTime, String endTime, Integer submissionPid);*/
} }
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
and submission_pid = #{submissionPid} and submission_pid = #{submissionPid}
</if> </if>
</where> </where>
order by submission_time DESC limit #{current},#{size}; order by submission_time DESC limit #{current},#{size}
</select> </select>
<select id="selectAllCount" resultType="int"> <select id="selectAllCount" resultType="int">
...@@ -72,10 +72,7 @@ ...@@ -72,10 +72,7 @@
order by submission_time DESC limit #{current},#{size} order by submission_time DESC limit #{current},#{size}
</select> </select>
<select id="queryForWaitManage" resultType="com.yeejoin.amos.boot.module.common.api.entity.FailureDetails">
<select id="selectISubPage" resultType="com.yeejoin.amos.boot.module.common.api.entity.FailureDetails">
SELECT sequence_nbr, SELECT sequence_nbr,
current_status, current_status,
failure_equipment_id, failure_equipment_id,
...@@ -90,8 +87,16 @@ ...@@ -90,8 +87,16 @@
submission_branch_id submission_branch_id
FROM cb_failure_details FROM cb_failure_details
<where> <where>
<if test="currentStatus!= null "> <choose>
and current_status = #{currentStatus} <when test="currentStatus == null and ruleName == 'maintenance_department_maintenance_personnel'">
current_status IN (2,6)
</when>
<when test="currentStatus == null and ruleName == 'emergency_command_leader' || ruleName == 'maintenance_department'">
current_status IN (0,3)
</when>
</choose>
<if test="currentStatus != null">
current_status = #{currentStatus}
</if> </if>
<if test="startTime!= null and endTime != null"> <if test="startTime!= null and endTime != null">
and submission_time between #{startTime} and #{endTime} and submission_time between #{startTime} and #{endTime}
...@@ -105,26 +110,14 @@ ...@@ -105,26 +110,14 @@
</select> </select>
<select id="selectInProcessing" resultType="com.yeejoin.amos.boot.module.common.api.entity.FailureDetails"> <select id="selectStatusCount" resultType="com.yeejoin.amos.boot.module.common.api.dto.StatusDto">
SELECT sequence_nbr, SELECT cb_failure_details.current_status,
current_status, count(cb_failure_details.current_status)
failure_equipment_id, AS currentStatusCount
failure_equipment,
fault_time,
fault_phenomenon,
submission_name,
submission_pid,
biz_code,
submission_time,
submission_branch,
submission_branch_id
FROM cb_failure_details FROM cb_failure_details
<where> <where>
<if test="currentStatus == null "> <if test="currentStatus!= null ">
and current_status in (0,3) and current_status = #{currentStatus}
</if>
<if test="currentStatus != null ">
current_status = #{currentStatus}
</if> </if>
<if test="startTime!= null and endTime != null"> <if test="startTime!= null and endTime != null">
and submission_time between #{startTime} and #{endTime} and submission_time between #{startTime} and #{endTime}
...@@ -133,28 +126,29 @@ ...@@ -133,28 +126,29 @@
and submission_pid = #{submissionPid} and submission_pid = #{submissionPid}
</if> </if>
</where> </where>
order by submission_time DESC GROUP BY cb_failure_details.current_status
limit #{current},#{size}
</select> </select>
<select id="selectStatusWaitTj" resultType="com.yeejoin.amos.boot.module.common.api.entity.FailureDetails"> <select id="queryStatusCount" resultType="com.yeejoin.amos.boot.module.common.api.dto.StatusDto">
SELECT sequence_nbr, SELECT cb_failure_details.current_status,
current_status, count(cb_failure_details.current_status)
failure_equipment_id, AS currentStatusCount
failure_equipment,
fault_time,
fault_phenomenon,
submission_name,
submission_pid,
biz_code,
submission_time,
submission_branch,
submission_branch_id
FROM cb_failure_details FROM cb_failure_details
<where> <where>
<if test="currentStatus != null "> <choose>
and current_status = #{currentStatus} <when test="currentStatus == null and ruleName == 'maintenance_department_maintenance_personnel'">
</if> current_status in (2,6)
</when>
<when test="currentStatus == null and ruleName == 'emergency_command_staff'">
current_status = 1
</when>
<when test="currentStatus != null ">
current_status = #{currentStatus}
</when>
<otherwise>
current_status in (0,3)
</otherwise>
</choose>
<if test="startTime!= null and endTime != null"> <if test="startTime!= null and endTime != null">
and submission_time between #{startTime} and #{endTime} and submission_time between #{startTime} and #{endTime}
</if> </if>
...@@ -162,49 +156,63 @@ ...@@ -162,49 +156,63 @@
and submission_pid = #{submissionPid} and submission_pid = #{submissionPid}
</if> </if>
</where> </where>
order by submission_time DESC GROUP BY cb_failure_details.current_status
limit #{current},#{size}
</select> </select>
<select id="selectStatusWaitWx" resultType="com.yeejoin.amos.boot.module.common.api.entity.FailureDetails">
SELECT sequence_nbr,
<select id="queryAcceptCount" resultType="com.yeejoin.amos.boot.module.common.api.dto.StatusDto">
SELECT
current_status, current_status,
failure_equipment_id, count(current_status)
failure_equipment, AS currentStatusCount
fault_time, FROM
fault_phenomenon, cb_failure_details d
submission_name,
submission_pid,
biz_code,
submission_time,
submission_branch,
submission_branch_id
FROM cb_failure_details
<where> <where>
<if test="currentStatus == null "> <choose>
current_status IN (2,6) <when test="ruleName != null and ruleName == 'emergency_command_leader' || ruleName == 'maintenance_department'">
</if> d.sequence_nbr in (SELECT fault_id FROM cb_failure_audit where rec_user_id = #{userId} )
<if test="currentStatus != null "> </when>
current_status = #{currentStatus} <when test="ruleName != null and ruleName == 'maintenance_department_maintenance_personnel'">
d.sequence_nbr in (SELECT fault_id FROM cb_failure_maintain here rec_user_id = #{userId} ) </when>
<otherwise>
d.sequence_nbr in (SELECT fault_id FROM cb_failure_audit where audit_result = 2)
</otherwise>
</choose>
<if test="currentStatus!= null ">
and current_status = #{currentStatus}
</if> </if>
<if test="startTime!= null and endTime != null"> <if test="startTime!= null and endTime != null">
and submission_time between #{startTime} and #{endTime} and submission_time between #{startTime} and #{endTime}
</if> </if>
<if test="submissionPid!= null "> <if test="userId != null ">
and submission_pid = #{submissionPid} and submission_pid = #{userId}
</if> </if>
</where> </where>
order by submission_time DESC GROUP BY current_status;
limit #{current},#{size}
</select> </select>
<select id="selectStatusCount" resultType="com.yeejoin.amos.boot.module.common.api.dto.StatusDto">
SELECT cb_failure_details.current_status,
count(cb_failure_details.current_status) <select id="selectForReceive" resultType="com.yeejoin.amos.boot.module.common.api.entity.FailureDetails">
AS currentStatusCount SELECT
FROM cb_failure_details *
FROM
cb_failure_details d
<where> <where>
<if test="currentStatus!= null "> <choose>
<when test="ruleName != null and ruleName == 'maintenance_department_maintenance_personnel'">
d.sequence_nbr in (SELECT fault_id FROM cb_failure_maintain where rec_user_id = #{userId} )
</when>
<when test="ruleName != null and ruleName == 'emergency_command_leader' || ruleName == 'maintenance_department'">
d.sequence_nbr in (SELECT fault_id FROM cb_failure_audit where rec_user_id = #{userId} )
</when>
<otherwise>
d.sequence_nbr in (SELECT fault_id FROM cb_failure_audit where audit_result = 2 )
</otherwise>
</choose>
<if test="currentStatus != null ">
and current_status = #{currentStatus} and current_status = #{currentStatus}
</if> </if>
<if test="startTime!= null and endTime != null"> <if test="startTime!= null and endTime != null">
...@@ -214,10 +222,13 @@ ...@@ -214,10 +222,13 @@
and submission_pid = #{submissionPid} and submission_pid = #{submissionPid}
</if> </if>
</where> </where>
GROUP BY cb_failure_details.current_status order by submission_time DESC
limit #{current},#{size};
</select> </select>
<select id="selectStatusWx" resultType="com.yeejoin.amos.boot.module.common.api.dto.StatusDto">
<!-- <select id="selectStatusWx" resultType="com.yeejoin.amos.boot.module.common.api.dto.StatusDto">
SELECT cb_failure_details.current_status, SELECT cb_failure_details.current_status,
count(cb_failure_details.current_status) count(cb_failure_details.current_status)
AS currentStatusCount AS currentStatusCount
...@@ -296,16 +307,13 @@ ...@@ -296,16 +307,13 @@
</if> </if>
</where> </where>
GROUP BY cb_failure_details.current_status GROUP BY cb_failure_details.current_status
</select> </select>-->
<select id="selectAudit" resultType="com.yeejoin.amos.boot.module.common.api.dto.StatusDto"> <!-- <select id="selectYJ" resultType="com.yeejoin.amos.boot.module.common.api.entity.FailureDetails">
SELECT SELECT
current_status, *
count(current_status)
AS currentStatusCount
FROM FROM
cb_failure_details d cb_failure_details d
<where> <where>
d.sequence_nbr in d.sequence_nbr in
(SELECT (SELECT
...@@ -313,26 +321,25 @@ ...@@ -313,26 +321,25 @@
FROM FROM
cb_failure_audit cb_failure_audit
where where
rec_user_id = #{userId} audit_result = 2
) )
<if test="currentStatus!= null "> <if test="currentStatus != null ">
and current_status = #{currentStatus} and current_status = #{currentStatus}
</if> </if>
<if test="startTime!= null and endTime != null"> <if test="startTime!= null and endTime != null">
and submission_time between #{startTime} and #{endTime} and submission_time between #{startTime} and #{endTime}
</if> </if>
<if test="submissionPid!= null "> <if test="userId != null ">
and submission_pid = #{submissionPid} and submission_pid = #{userId}
</if> </if>
</where> </where>
GROUP BY current_status; order by submission_time DESC
limit #{current},#{size};
</select> </select>
<select id="selectMaintain" resultType="com.yeejoin.amos.boot.module.common.api.dto.StatusDto"> <select id="selectForAudit" resultType="com.yeejoin.amos.boot.module.common.api.entity.FailureDetails">
SELECT SELECT
current_status, *
count(current_status)
AS currentStatusCount
FROM FROM
cb_failure_details d cb_failure_details d
<where> <where>
...@@ -340,11 +347,11 @@ ...@@ -340,11 +347,11 @@
(SELECT (SELECT
fault_id fault_id
FROM FROM
cb_failure_maintain cb_failure_audit
where where
rec_user_id = #{userId} rec_user_id = #{userId}
) )
<if test="currentStatus!= null "> <if test="currentStatus != null ">
and current_status = #{currentStatus} and current_status = #{currentStatus}
</if> </if>
<if test="startTime!= null and endTime != null"> <if test="startTime!= null and endTime != null">
...@@ -354,51 +361,23 @@ ...@@ -354,51 +361,23 @@
and submission_pid = #{submissionPid} and submission_pid = #{submissionPid}
</if> </if>
</where> </where>
GROUP BY current_status; order by submission_time DESC
</select> limit #{current},#{size};
<select id="selectUserId" resultType="com.yeejoin.amos.boot.module.common.api.dto.StatusDto">
SELECT
current_status,
count(current_status)
AS currentStatusCount
FROM
cb_failure_details d
<where>
d.sequence_nbr in
(SELECT
fault_id
FROM
cb_failure_audit
where
audit_result = 2
)
<if test="currentStatus!= null ">
and current_status = #{currentStatus}
</if>
<if test="startTime!= null and endTime != null">
and submission_time between #{startTime} and #{endTime}
</if>
<if test="userId != null ">
and submission_pid = #{userId}
</if>
</where>
GROUP BY current_status;
</select> </select>
<select id="selectYJ" resultType="com.yeejoin.amos.boot.module.common.api.entity.FailureDetails"> <select id="selectForMaintain" resultType="com.yeejoin.amos.boot.module.common.api.entity.FailureDetails">
SELECT SELECT
* *
FROM FROM
cb_failure_details d cb_failure_details d
<where> <where>
d.sequence_nbr in d.sequence_nbr in
(SELECT (SELECT
fault_id fault_id
FROM FROM
cb_failure_audit cb_failure_maintain
where where
audit_result = 2 rec_user_id = #{userId}
) )
<if test="currentStatus != null "> <if test="currentStatus != null ">
and current_status = #{currentStatus} and current_status = #{currentStatus}
...@@ -406,19 +385,142 @@ ...@@ -406,19 +385,142 @@
<if test="startTime!= null and endTime != null"> <if test="startTime!= null and endTime != null">
and submission_time between #{startTime} and #{endTime} and submission_time between #{startTime} and #{endTime}
</if> </if>
<if test="userId != null "> <if test="submissionPid!= null ">
and submission_pid = #{userId} and submission_pid = #{submissionPid}
</if> </if>
</where> </where>
order by submission_time DESC order by submission_time DESC
limit #{current},#{size}; limit #{current},#{size};
</select>-->
<!-- <select id="selectInProcessing" resultType="com.yeejoin.amos.boot.module.common.api.entity.FailureDetails">
SELECT sequence_nbr,
current_status,
failure_equipment_id,
failure_equipment,
fault_time,
fault_phenomenon,
submission_name,
submission_pid,
biz_code,
submission_time,
submission_branch,
submission_branch_id
FROM cb_failure_details
<where>
<if test="currentStatus != null">
current_status = #{currentStatus}
</if>
<if test="startTime!= null and endTime != null">
and submission_time between #{startTime} and #{endTime}
</if>
<if test="submissionPid!= null ">
and submission_pid = #{submissionPid}
</if>
</where>
order by submission_time DESC
limit #{current},#{size}
</select> </select>
<select id="selectForAudit" resultType="com.yeejoin.amos.boot.module.common.api.entity.FailureDetails"> <select id="selectStatusWaitTj" resultType="com.yeejoin.amos.boot.module.common.api.entity.FailureDetails">
SELECT sequence_nbr,
current_status,
failure_equipment_id,
failure_equipment,
fault_time,
fault_phenomenon,
submission_name,
submission_pid,
biz_code,
submission_time,
submission_branch,
submission_branch_id
FROM cb_failure_details
<where>
<if test="currentStatus != null ">
and current_status = #{currentStatus}
</if>
<if test="startTime!= null and endTime != null">
and submission_time between #{startTime} and #{endTime}
</if>
<if test="submissionPid!= null ">
and submission_pid = #{submissionPid}
</if>
</where>
order by submission_time DESC
limit #{current},#{size}
</select>
<select id="selectStatusWaitWx" resultType="com.yeejoin.amos.boot.module.common.api.entity.FailureDetails">
SELECT sequence_nbr,
current_status,
failure_equipment_id,
failure_equipment,
fault_time,
fault_phenomenon,
submission_name,
submission_pid,
biz_code,
submission_time,
submission_branch,
submission_branch_id
FROM cb_failure_details
<where>
<if test="currentStatus == null ">
current_status IN (2,6)
</if>
<if test="currentStatus != null ">
current_status = #{currentStatus}
</if>
<if test="startTime!= null and endTime != null">
and submission_time between #{startTime} and #{endTime}
</if>
<if test="submissionPid!= null ">
and submission_pid = #{submissionPid}
</if>
</where>
order by submission_time DESC
limit #{current},#{size}
</select>
-->
<!-- <select id="selectISubPage" resultType="com.yeejoin.amos.boot.module.common.api.entity.FailureDetails">
SELECT
sequence_nbr,
current_status,
failure_equipment_id,
failure_equipment,
fault_time,
fault_phenomenon,
submission_name,
submission_pid,
biz_code,
submission_time,
submission_branch,
submission_branch_id
FROM
cb_failure_details
<where>
<if test="currentStatus!= null ">
and current_status = #{currentStatus}
</if>
<if test="startTime!= null and endTime != null">
and submission_time between #{startTime} and #{endTime}
</if>
<if test="submissionPid!= null ">
and submission_pid = #{submissionPid}
</if>
</where>
order by submission_time DESC limit #{current},#{size}
</select>-->
<!--
<select id="selectAudit" resultType="com.yeejoin.amos.boot.module.common.api.dto.StatusDto">
SELECT SELECT
* current_status,
count(current_status)
AS currentStatusCount
FROM FROM
cb_failure_details d cb_failure_details d
<where> <where>
d.sequence_nbr in d.sequence_nbr in
(SELECT (SELECT
...@@ -428,7 +530,7 @@ ...@@ -428,7 +530,7 @@
where where
rec_user_id = #{userId} rec_user_id = #{userId}
) )
<if test="currentStatus != null "> <if test="currentStatus!= null ">
and current_status = #{currentStatus} and current_status = #{currentStatus}
</if> </if>
<if test="startTime!= null and endTime != null"> <if test="startTime!= null and endTime != null">
...@@ -438,15 +540,16 @@ ...@@ -438,15 +540,16 @@
and submission_pid = #{submissionPid} and submission_pid = #{submissionPid}
</if> </if>
</where> </where>
order by submission_time DESC GROUP BY current_status;
limit #{current},#{size};
</select> </select>
<select id="selectForMaintain" resultType="com.yeejoin.amos.boot.module.common.api.entity.FailureDetails"> <select id="selectMaintain" resultType="com.yeejoin.amos.boot.module.common.api.dto.StatusDto">
SELECT SELECT
* current_status,
count(current_status)
AS currentStatusCount
FROM FROM
cb_failure_details d cb_failure_details d
<where> <where>
d.sequence_nbr in d.sequence_nbr in
(SELECT (SELECT
...@@ -456,7 +559,7 @@ ...@@ -456,7 +559,7 @@
where where
rec_user_id = #{userId} rec_user_id = #{userId}
) )
<if test="currentStatus != null "> <if test="currentStatus!= null ">
and current_status = #{currentStatus} and current_status = #{currentStatus}
</if> </if>
<if test="startTime!= null and endTime != null"> <if test="startTime!= null and endTime != null">
...@@ -466,9 +569,35 @@ ...@@ -466,9 +569,35 @@
and submission_pid = #{submissionPid} and submission_pid = #{submissionPid}
</if> </if>
</where> </where>
order by submission_time DESC GROUP BY current_status;
limit #{current},#{size};
</select> </select>
<select id="selectUserId" resultType="com.yeejoin.amos.boot.module.common.api.dto.StatusDto">
SELECT
current_status,
count(current_status)
AS currentStatusCount
FROM
cb_failure_details d
<where>
d.sequence_nbr in
(SELECT
fault_id
FROM
cb_failure_audit
where
audit_result = 2
)
<if test="currentStatus!= null ">
and current_status = #{currentStatus}
</if>
<if test="startTime!= null and endTime != null">
and submission_time between #{startTime} and #{endTime}
</if>
<if test="userId != null ">
and submission_pid = #{userId}
</if>
</where>
GROUP BY current_status;
</select>-->
</mapper> </mapper>
...@@ -98,25 +98,37 @@ public class FailureDetailsServiceImpl extends BaseService<FailureDetailsDto, Fa ...@@ -98,25 +98,37 @@ public class FailureDetailsServiceImpl extends BaseService<FailureDetailsDto, Fa
*/ */
public IPage<FailureDetails> queryForFailureDetailsPage(Page<FailureDetails> page, ReginParams userInfo, Long currentStatus, public IPage<FailureDetails> queryForFailureDetailsPage(Page<FailureDetails> page, ReginParams userInfo, Long currentStatus,
String startTime, String endTime, Integer userId, Integer type) { String startTime, String endTime, Integer userId, Integer type) {
//当传递类型参数为全部查询时 //当传递类型参数为全部查询 或者 为我提交
if (type.equals(SELECY_ALL)) { if (type.equals(SELECY_ALL) ) {
List<FailureDetails> list = this.baseMapper.selectAllPage(page.getCurrent(), page.getSize(), currentStatus, startTime, endTime, userId); List<FailureDetails> list = this.baseMapper.selectAllPage(page.getCurrent(), page.getSize(), currentStatus, startTime, endTime, userId);
IPage<FailureDetails> iPage = new Page<>(); IPage<FailureDetails> iPage = new Page<>();
iPage.setRecords(list); iPage.setRecords(list);
return iPage; return iPage;
} }
//当传递类型参数为我提交时
//当传递类型参数 为我提交时
if (type.equals(SELECY_ISUBMIT)) { if (type.equals(SELECY_ISUBMIT)) {
List<FailureDetails> list = baseMapper.selectISubPage(page.getCurrent(), page.getSize(), currentStatus, startTime, endTime, Integer.parseInt(userInfo.getUserModel().getUserId())); List<FailureDetails> list = this.baseMapper.selectAllPage(page.getCurrent(), page.getSize(), currentStatus, startTime, endTime, Integer.parseInt(userInfo.getUserModel().getUserId()));
IPage<FailureDetails> iPage = new Page<>(); IPage<FailureDetails> iPage = new Page<>();
iPage.setRecords(list); iPage.setRecords(list);
return iPage; return iPage;
} }
/* //当传递类型参数为我提交时
if (type.equals(SELECY_ISUBMIT)) {
List<FailureDetails> list = baseMapper.selectISubPage(page.getCurrent(), page.getSize(), currentStatus, startTime, endTime, Integer.parseInt(userInfo.getUserModel().getUserId()));
IPage<FailureDetails> iPage = new Page<>();
iPage.setRecords(list);
return iPage;
}*/
//当传递类型参数为我接收时 //当传递类型参数为我接收时
if (type.equals(SELECY_ACCEPT)) { if (type.equals(SELECY_ACCEPT)) {
//当角色为维修人员时 //当角色为维修人员时
if (userInfo.getRole().getRoleName().equals(roleName[0])) { List<FailureDetails> receiveList = baseMapper.selectForReceive(currentStatus, startTime, endTime, userId, userInfo.getUserModel().getUserId(), page.getCurrent(), page.getSize(),userInfo.getRole().getRoleName());
IPage<FailureDetails> iPage = new Page<>();
iPage.setRecords(receiveList);
return iPage;
/* if (userInfo.getRole().getRoleName().equals(roleName[0])) {
List<FailureDetails> failureDetails = baseMapper.selectForMaintain(currentStatus, startTime, endTime, userId, userInfo.getUserModel().getUserId(), page.getCurrent(), page.getSize()); List<FailureDetails> failureDetails = baseMapper.selectForMaintain(currentStatus, startTime, endTime, userId, userInfo.getUserModel().getUserId(), page.getCurrent(), page.getSize());
IPage<FailureDetails> iPage = new Page<>(); IPage<FailureDetails> iPage = new Page<>();
iPage.setRecords(failureDetails); iPage.setRecords(failureDetails);
...@@ -134,7 +146,7 @@ public class FailureDetailsServiceImpl extends BaseService<FailureDetailsDto, Fa ...@@ -134,7 +146,7 @@ public class FailureDetailsServiceImpl extends BaseService<FailureDetailsDto, Fa
IPage<FailureDetails> iPage = new Page<>(); IPage<FailureDetails> iPage = new Page<>();
iPage.setRecords(failureDetails); iPage.setRecords(failureDetails);
return iPage; return iPage;
} }*/
} }
//否则就查询待处理 //否则就查询待处理
return this.queryForWaitManage(page, userInfo, currentStatus, startTime, endTime, userId); return this.queryForWaitManage(page, userInfo, currentStatus, startTime, endTime, userId);
...@@ -160,7 +172,7 @@ public class FailureDetailsServiceImpl extends BaseService<FailureDetailsDto, Fa ...@@ -160,7 +172,7 @@ public class FailureDetailsServiceImpl extends BaseService<FailureDetailsDto, Fa
public IPage<FailureDetails> queryForWaitManage(Page<FailureDetails> page, ReginParams userInfo, Long currentStatus, public IPage<FailureDetails> queryForWaitManage(Page<FailureDetails> page, ReginParams userInfo, Long currentStatus,
String startTime, String endTime, Integer userId) { String startTime, String endTime, Integer userId) {
if (userInfo.getRole().getRoleName().equals(roleName[0])) { /* if (userInfo.getRole().getRoleName().equals(roleName[0])) {
IPage<FailureDetails> wxIpage = new Page<FailureDetails>(); IPage<FailureDetails> wxIpage = new Page<FailureDetails>();
List<FailureDetails> list = baseMapper.selectStatusWaitWx(page.getCurrent(), page.getSize(), currentStatus, startTime, endTime, userId); List<FailureDetails> list = baseMapper.selectStatusWaitWx(page.getCurrent(), page.getSize(), currentStatus, startTime, endTime, userId);
wxIpage.setRecords(list); wxIpage.setRecords(list);
...@@ -171,8 +183,8 @@ public class FailureDetailsServiceImpl extends BaseService<FailureDetailsDto, Fa ...@@ -171,8 +183,8 @@ public class FailureDetailsServiceImpl extends BaseService<FailureDetailsDto, Fa
IPage<FailureDetails> iPage = new Page<>(); IPage<FailureDetails> iPage = new Page<>();
iPage.setRecords(list); iPage.setRecords(list);
return iPage; return iPage;
} }*/
List<FailureDetails> list = baseMapper.selectInProcessing(page.getCurrent(), page.getSize(), currentStatus, startTime, endTime, userId); List<FailureDetails> list = baseMapper.queryForWaitManage(page.getCurrent(), page.getSize(), currentStatus, startTime, endTime, userId,userInfo.getRole().getRoleName());
IPage<FailureDetails> iPage = new Page<>(); IPage<FailureDetails> iPage = new Page<>();
iPage.setRecords(list); iPage.setRecords(list);
return iPage; return iPage;
...@@ -196,21 +208,8 @@ public class FailureDetailsServiceImpl extends BaseService<FailureDetailsDto, Fa ...@@ -196,21 +208,8 @@ public class FailureDetailsServiceImpl extends BaseService<FailureDetailsDto, Fa
* 根据状态查询 * 根据状态查询
*/ */
public List<FailureDetails> queryForFailureStatus(Long currentStatus) { public List<FailureDetails> queryForFailureStatus(Long currentStatus) {
String status = "";
List<FailureStatuEnum> list = new ArrayList<>();
list.add(FailureStatuEnum.WAITING_AUDIT);
list.add(FailureStatuEnum.WAITING_SUBMIT);
list.add(FailureStatuEnum.WAITING_MAINTAIN);
list.add(FailureStatuEnum.WAITING_ACCEPTANCE);
list.add(FailureStatuEnum.REFUSE);
list.add(FailureStatuEnum.FINISH);
for (int i = 0; i < list.size(); i++) {
if (currentStatus.equals(list.get(i).getCode())) {
status = list.get(i).getName();
}
}
QueryWrapper<FailureDetails> queryWrapper = new QueryWrapper<>(); QueryWrapper<FailureDetails> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("current_status", status).orderByDesc("submission_time"); queryWrapper.eq("current_status",currentStatus).orderByDesc("submission_time");
return baseMapper.selectList(queryWrapper); return baseMapper.selectList(queryWrapper);
} }
...@@ -219,7 +218,7 @@ public class FailureDetailsServiceImpl extends BaseService<FailureDetailsDto, Fa ...@@ -219,7 +218,7 @@ public class FailureDetailsServiceImpl extends BaseService<FailureDetailsDto, Fa
*/ */
public List<CurrentStatusDto> queryStatusCount(ReginParams userInfo, Integer type, Long currentStatus, String startTime, String endTime, Integer userId) { public List<CurrentStatusDto> queryStatusCount(ReginParams userInfo, Integer type, Long currentStatus, String startTime, String endTime, Integer userId) {
List<StatusDto> statusDtos = null; List<StatusDto> statusDtos = null;
if (type.equals(SELECY_STATUS) && userInfo.getRole().getRoleName().equals(roleName[0])) { /* if (type.equals(SELECY_STATUS) && userInfo.getRole().getRoleName().equals(roleName[0])) {
statusDtos = baseMapper.selectStatusWx(currentStatus, startTime, endTime, userId); statusDtos = baseMapper.selectStatusWx(currentStatus, startTime, endTime, userId);
} else if (type.equals(SELECY_STATUS) && userInfo.getRole().getRoleName().equals(roleName[1])) { } else if (type.equals(SELECY_STATUS) && userInfo.getRole().getRoleName().equals(roleName[1])) {
statusDtos = baseMapper.selectStatusFq(currentStatus, startTime, endTime, userId); statusDtos = baseMapper.selectStatusFq(currentStatus, startTime, endTime, userId);
...@@ -227,16 +226,17 @@ public class FailureDetailsServiceImpl extends BaseService<FailureDetailsDto, Fa ...@@ -227,16 +226,17 @@ public class FailureDetailsServiceImpl extends BaseService<FailureDetailsDto, Fa
statusDtos = baseMapper.selectStatusFqp(currentStatus, startTime, endTime, Integer.parseInt(userInfo.getUserModel().getUserId())); statusDtos = baseMapper.selectStatusFqp(currentStatus, startTime, endTime, Integer.parseInt(userInfo.getUserModel().getUserId()));
} else if (type.equals(SELECY_ALL)) { } else if (type.equals(SELECY_ALL)) {
statusDtos = baseMapper.selectStatusCount(currentStatus, startTime, endTime, userId); statusDtos = baseMapper.selectStatusCount(currentStatus, startTime, endTime, userId);
} else if (type.equals(SELECY_ACCEPT)) { } else*/ if (type.equals(SELECY_ACCEPT)) {
if (userInfo.getRole().getRoleName().equals(roleName[2]) || userInfo.getRole().getRoleName().equals(roleName[3])){ /* if (userInfo.getRole().getRoleName().equals(roleName[2]) || userInfo.getRole().getRoleName().equals(roleName[3])){
statusDtos = baseMapper.selectAudit(currentStatus, startTime, endTime, userId, userInfo.getUserModel().getUserId()); statusDtos = baseMapper.selectAudit(currentStatus, startTime, endTime, userId, userInfo.getUserModel().getUserId());
}else if (userInfo.getRole().getRoleName().equals(roleName[0])){ }else if (userInfo.getRole().getRoleName().equals(roleName[0])){
statusDtos = baseMapper.selectMaintain(currentStatus, startTime, endTime, userId, userInfo.getUserModel().getUserId()); statusDtos = baseMapper.selectMaintain(currentStatus, startTime, endTime, userId, userInfo.getUserModel().getUserId());
}else { }else {
statusDtos = baseMapper.selectUserId(currentStatus, startTime, endTime, userInfo.getUserModel().getUserId()); statusDtos = baseMapper.selectUserId(currentStatus, startTime, endTime, userInfo.getUserModel().getUserId());
} }*/
statusDtos= baseMapper.queryAcceptCount(currentStatus, startTime, endTime, userId, userInfo.getUserModel().getUserId(),userInfo.getRole().getRoleName());
} else { } else {
statusDtos = baseMapper.selectStatusLeader(currentStatus, startTime, endTime, userId); statusDtos = baseMapper.queryStatusCount(currentStatus, startTime, endTime, userId,userInfo.getRole().getRoleName());
} }
List<CurrentStatusDto> currentStatusDtoList = new ArrayList<>(); List<CurrentStatusDto> currentStatusDtoList = new ArrayList<>();
statusDtos.forEach(e -> { statusDtos.forEach(e -> {
...@@ -331,10 +331,11 @@ public class FailureDetailsServiceImpl extends BaseService<FailureDetailsDto, Fa ...@@ -331,10 +331,11 @@ public class FailureDetailsServiceImpl extends BaseService<FailureDetailsDto, Fa
failureDetailsDto.getAttachment()); failureDetailsDto.getAttachment());
} }
// 添加至报修日志 // 添加至报修日志
OrgUsr orgUsr = iOrgUsrService.getById(failureDetailsDto.getBizCode());
Long faultId = model.getSequenceNbr(); Long faultId = model.getSequenceNbr();
Integer processAuditorId = model.getSubmissionPid(); Integer processAuditorId = model.getSubmissionPid();
String processResult = "重新提交报修单"; String processResult = "重新提交报修单";
String processDepartment = userInfo.getDepartment().getDepartmentName(); String processDepartment = orgUsr.getBizOrgName() ;
Long departmentId = failureDetailsDto.getBizCode(); Long departmentId = failureDetailsDto.getBizCode();
Date processTime = model.getSubmissionTime(); Date processTime = model.getSubmissionTime();
String processAuditorName = failureDetailsDto.getSubmissionName(); String processAuditorName = failureDetailsDto.getSubmissionName();
......
...@@ -31,6 +31,10 @@ ...@@ -31,6 +31,10 @@
<groupId>org.typroject</groupId> <groupId>org.typroject</groupId>
<artifactId>*</artifactId> <artifactId>*</artifactId>
</exclusion> </exclusion>
<exclusion>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
</exclusion>
</exclusions> </exclusions>
</dependency> </dependency>
<dependency> <dependency>
......
...@@ -11,6 +11,8 @@ import java.io.OutputStream; ...@@ -11,6 +11,8 @@ import java.io.OutputStream;
import java.net.*; import java.net.*;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import static com.yeejoin.amos.boot.module.jcs.biz.audioToText.util.SpeechTranscriberDemo.getSleepDelta;
/** /**
* 模拟客户端发送数据 * 模拟客户端发送数据
*/ */
...@@ -18,16 +20,14 @@ import java.util.concurrent.TimeUnit; ...@@ -18,16 +20,14 @@ import java.util.concurrent.TimeUnit;
public class SocketClient { public class SocketClient {
private static final Logger logger = LoggerFactory.getLogger(SocketClient.class); private static final Logger logger = LoggerFactory.getLogger(SocketClient.class);
private static final String[] testFilePath = { private static final String[] testFilePath = {
"D:\\ffmpeg-4.4-full_build-shared\\bin\\out3.pcm", "C:\\Users\\DELL\\Desktop\\yuyin\\out1.pcm",
"D:\\ffmpeg-4.4-full_build-shared\\bin\\out4.pcm", "C:\\Users\\DELL\\Desktop\\yuyin\\out.pcm",
"D:\\ffmpeg-4.4-full_build-shared\\bin\\record1.pcm",
"D:\\ffmpeg-4.4-full_build-shared\\bin\\record2.pcm",
}; };
public static void main(String[] args) throws SocketException { public static void main(String[] args) throws SocketException {
SocketClient socketClient = new SocketClient(); SocketClient socketClient = new SocketClient();
//socketClient.processTcp(0, 0); //socketClient.processTcp(0, 0);
socketClient.processUdp(10001, 2); socketClient.processUdp(25002, 1);
} }
@Async @Async
...@@ -36,13 +36,15 @@ public class SocketClient { ...@@ -36,13 +36,15 @@ public class SocketClient {
if (type >= testFilePath.length) type -= 1; if (type >= testFilePath.length) type -= 1;
DatagramSocket datagramSocket = new DatagramSocket(); DatagramSocket datagramSocket = new DatagramSocket();
try { try {
FileInputStream fis = new FileInputStream(new File(testFilePath[type])); FileInputStream fis = new FileInputStream(new File("C:\\Users\\DELL\\Desktop\\ffmpeg-4.4-full_build-shared\\bin\\out.pcm"));
byte[] b = new byte[4096]; byte[] b = new byte[1280];
int len; int len;
while ((len = fis.read(b)) > 0) { while ((len = fis.read(b)) > 0) {
logger.info("send data pack length: " + len); logger.info("send data pack length: " + len);
datagramSocket.send(new DatagramPacket(b, b.length,InetAddress.getLocalHost(), port)); datagramSocket.send(new DatagramPacket(b, b.length,InetAddress.getLocalHost(), port));
TimeUnit.MILLISECONDS.sleep(200); int deltaSleep = getSleepDelta(len, 16000);
Thread.sleep(deltaSleep);
TimeUnit.MILLISECONDS.sleep(100);
} }
datagramSocket.close(); datagramSocket.close();
} catch (Exception e) { } catch (Exception e) {
......
package com.yeejoin.amos.boot.module.jcs.biz.audioToText.util;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;
import com.alibaba.nls.client.AccessToken;
import com.alibaba.nls.client.protocol.InputFormatEnum;
import com.alibaba.nls.client.protocol.NlsClient;
import com.alibaba.nls.client.protocol.SampleRateEnum;
import com.alibaba.nls.client.protocol.asr.SpeechTranscriber;
import com.alibaba.nls.client.protocol.asr.SpeechTranscriberListener;
import com.alibaba.nls.client.protocol.asr.SpeechTranscriberResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* 此示例演示了:
* ASR实时识别API调用。
* 动态获取token。
* 通过本地模拟实时流发送。
* 识别耗时计算。
*/
public class SpeechTranscriberDemo {
private String appKey;
private NlsClient client;
private static final Logger logger = LoggerFactory.getLogger(SpeechTranscriberDemo.class);
public SpeechTranscriberDemo(String appKey, String id, String secret, String url) {
this.appKey = appKey;
//应用全局创建一个NlsClient实例,默认服务地址为阿里云线上服务地址。
//获取token,实际使用时注意在accessToken.getExpireTime()过期前再次获取。
AccessToken accessToken = new AccessToken(id, secret);
try {
accessToken.apply();
System.out.println("get token: " + ", expire time: " + accessToken.getExpireTime());
if(url.isEmpty()) {
client = new NlsClient(accessToken.getToken());
}else {
client = new NlsClient(url, accessToken.getToken());
}
} catch (IOException e) {
e.printStackTrace();
}
}
private static SpeechTranscriberListener getTranscriberListener() {
SpeechTranscriberListener listener = new SpeechTranscriberListener() {
//识别出中间结果。仅当setEnableIntermediateResult为true时,才会返回该消息。
@Override
public void onTranscriptionResultChange(SpeechTranscriberResponse response) {
System.out.println("task_id: " + response.getTaskId() +
", name: " + response.getName() +
//状态码“20000000”表示正常识别。
", status: " + response.getStatus() +
//句子编号,从1开始递增。
", index: " + response.getTransSentenceIndex() +
//当前的识别结果。
", result: " + response.getTransSentenceText() +
//当前已处理的音频时长,单位为毫秒。
", time: " + response.getTransSentenceTime());
}
@Override
public void onTranscriberStart(SpeechTranscriberResponse response) {
//task_id是调用方和服务端通信的唯一标识,遇到问题时,需要提供此task_id。
System.out.println("task_id: " + response.getTaskId() + ", name: " + response.getName() + ", status: " + response.getStatus());
}
@Override
public void onSentenceBegin(SpeechTranscriberResponse response) {
System.out.println("task_id: " + response.getTaskId() + ", name: " + response.getName() + ", status: " + response.getStatus());
}
//识别出一句话。服务端会智能断句,当识别到一句话结束时会返回此消息。
@Override
public void onSentenceEnd(SpeechTranscriberResponse response) {
System.out.println("task_id: " + response.getTaskId() +
", name: " + response.getName() +
//状态码“20000000”表示正常识别。
", status: " + response.getStatus() +
//句子编号,从1开始递增。
", index: " + response.getTransSentenceIndex() +
//当前的识别结果。
", result: " + response.getTransSentenceText() +
//置信度
", confidence: " + response.getConfidence() +
//开始时间
", begin_time: " + response.getSentenceBeginTime() +
//当前已处理的音频时长,单位为毫秒。
", time: " + response.getTransSentenceTime());
}
//识别完毕
@Override
public void onTranscriptionComplete(SpeechTranscriberResponse response) {
System.out.println("task_id: " + response.getTaskId() + ", name: " + response.getName() + ", status: " + response.getStatus());
}
@Override
public void onFail(SpeechTranscriberResponse response) {
//task_id是调用方和服务端通信的唯一标识,遇到问题时,需要提供此task_id。
System.out.println("task_id: " + response.getTaskId() + ", status: " + response.getStatus() + ", status_text: " + response.getStatusText());
}
};
return listener;
}
//根据二进制数据大小计算对应的同等语音长度。
//sampleRate:支持8000或16000。
public static int getSleepDelta(int dataSize, int sampleRate) {
// 仅支持16位采样。
int sampleBytes = 16;
// 仅支持单通道。
int soundChannel = 1;
return (dataSize * 10 * 8000) / (160 * sampleRate);
}
public void process(String filepath) {
SpeechTranscriber transcriber = null;
try {
//创建实例、建立连接。
transcriber = new SpeechTranscriber(client, getTranscriberListener());
transcriber.setAppKey("89KKwpGXXN37Pn1G");
//输入音频编码方式。
transcriber.setFormat(InputFormatEnum.PCM);
//输入音频采样率。
transcriber.setSampleRate(SampleRateEnum.SAMPLE_RATE_16K);
//是否返回中间识别结果。
transcriber.setEnableIntermediateResult(false);
//是否生成并返回标点符号。
transcriber.setEnablePunctuation(true);
//是否将返回结果规整化,比如将一百返回为100。
transcriber.setEnableITN(false);
//设置vad断句参数。默认值:800ms,有效值:200ms~2000ms。
//transcriber.addCustomedParam("max_sentence_silence", 600);
//设置是否语义断句。
//transcriber.addCustomedParam("enable_semantic_sentence_detection",false);
//设置是否开启顺滑。
//transcriber.addCustomedParam("disfluency",true);
//设置是否开启词模式。
//transcriber.addCustomedParam("enable_words",true);
//设置vad噪音阈值参数,参数取值为-1~+1,如-0.9、-0.8、0.2、0.9。
//取值越趋于-1,判定为语音的概率越大,亦即有可能更多噪声被当成语音被误识别。
//取值越趋于+1,判定为噪音的越多,亦即有可能更多语音段被当成噪音被拒绝识别。
//该参数属高级参数,调整需慎重和重点测试。
//transcriber.addCustomedParam("speech_noise_threshold",0.3);
//设置训练后的定制语言模型id。
//transcriber.addCustomedParam("customization_id","你的定制语言模型id");
//设置训练后的定制热词id。
//transcriber.addCustomedParam("vocabulary_id","你的定制热词id");
//设置是否忽略单句超时。
transcriber.addCustomedParam("enable_ignore_sentence_timeout",false);
//vad断句开启后处理。
//transcriber.addCustomedParam("enable_vad_unify_post",false);
//此方法将以上参数设置序列化为JSON发送给服务端,并等待服务端确认。
transcriber.start();
File file = new File(filepath);
FileInputStream fis = new FileInputStream(file);
byte[] b = new byte[332];
int len;
DatagramSocket datagramSocket = new DatagramSocket();
while ((len = fis.read(b)) > 0) {
// logger.info("send data pack length: " + len);
datagramSocket.send(new DatagramPacket(b, b.length, InetAddress.getLocalHost(), 25006));
transcriber.send(b, len);
//本案例用读取本地文件的形式模拟实时获取语音流并发送的,因为读取速度较快,这里需要设置sleep。
//如果实时获取语音则无需设置sleep, 如果是8k采样率语音第二个参数设置为8000。
int deltaSleep = getSleepDelta(len, 16000);
Thread.sleep(deltaSleep);
// TimeUnit.MILLISECONDS.sleep(100);
}
//通知服务端语音数据发送完毕,等待服务端处理完成。
long now = System.currentTimeMillis();
logger.info("ASR wait for complete");
transcriber.stop();
datagramSocket.close();
logger.info("ASR latency : " + (System.currentTimeMillis() - now) + " ms");
} catch (Exception e) {
System.err.println(e.getMessage());
} finally {
if (null != transcriber) {
transcriber.close();
}
}
}
public void shutdown() {
client.shutdown();
}
public static void main(String[] args) throws Exception {
String appKey = "89KKwpGXXN37Pn1G";
String id = "LTAI5t8F2oYwmfoYXjCx5vbf";
String secret = "du6jOpdxlKNCkCo5QN6EVFiI5zSaAv";
String url = "wss://nls-gateway.cn-shanghai.aliyuncs.com/ws/v1"; // 默认值:wss://nls-gateway.cn-shanghai.aliyuncs.com/ws/v1。
/* if (args.length == 3) {
appKey = args[0];
id = args[1];
secret = args[2];
} else if (args.length == 4) {
appKey = args[0];
id = args[1];
secret = args[2];
url = args[3];
} else {
System.err.println("run error, need params(url is optional): " + "<app-key> <AccessKeyId> <AccessKeySecret> [url]");
System.exit(-1);
}*/
//本案例使用本地文件模拟发送实时流数据。您在实际使用时,可以实时采集或接收语音流并发送到ASR服务端。
String filepath = "C:\\Users\\DELL\\Desktop\\ffmpeg-4.4-full_build-shared\\bin\\jc06102.pcm";
SpeechTranscriberDemo demo = new SpeechTranscriberDemo(appKey, id, secret, url);
demo.process(filepath);
demo.shutdown();
}
}
\ No newline at end of file
...@@ -27,6 +27,10 @@ ...@@ -27,6 +27,10 @@
</exclusions> </exclusions>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId> <groupId>org.springframework</groupId>
<artifactId>spring-mock</artifactId> <artifactId>spring-mock</artifactId>
<version>2.0.8</version> <version>2.0.8</version>
......
...@@ -29,6 +29,10 @@ ...@@ -29,6 +29,10 @@
<groupId>com.yeejoin</groupId> <groupId>com.yeejoin</groupId>
<artifactId>amos-feign-rule</artifactId> <artifactId>amos-feign-rule</artifactId>
</dependency> </dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
</dependency>
</dependencies> </dependencies>
<modules> <modules>
......
...@@ -39,8 +39,11 @@ rule.definition.localIp=172.16.3.35 ...@@ -39,8 +39,11 @@ rule.definition.localIp=172.16.3.35
file.url=http://39.98.45.134:9000/ file.url=http://39.98.45.134:9000/
video.url=https://11.11.16.4:443/ video.url=https://11.11.16.4:443/
ifc.url=http://11.11.16.17/IFCInterface ifc.url=http://11.11.16.17/IFCInterface
ifc.call-back.localIp=11.11.16.1 ifc.call-back.localIp=11.11.16.1
elasticsearch.username= elastic
elasticsearch.password= 123456
...@@ -38,6 +38,12 @@ ...@@ -38,6 +38,12 @@
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId> <artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</exclusion>
</exclusions>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.netflix.hystrix</groupId> <groupId>com.netflix.hystrix</groupId>
...@@ -285,6 +291,11 @@ ...@@ -285,6 +291,11 @@
<artifactId>json-lib</artifactId> <artifactId>json-lib</artifactId>
<version>2.4</version> <version>2.4</version>
</dependency> </dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.17.0</version>
</dependency>
</dependencies> </dependencies>
</dependencyManagement> </dependencyManagement>
<repositories> <repositories>
......
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