Commit 66588777 authored by maoying's avatar maoying

Merge branch 'developer' into develop_dl_plan6

parents ac42d664 252c4678
......@@ -39,55 +39,9 @@ public interface FailureDetailsMapper extends BaseMapper<FailureDetails> {
Long sequenceNbr);
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> {
* @return
*/
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> {
* @param submissionPid 报送人
* @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 状态
......@@ -120,10 +90,10 @@ public interface FailureDetailsMapper extends BaseMapper<FailureDetails> {
* @param endTime 结束时间
* @param submissionPid 报送人
* @return
*/
*//*
List<StatusDto> selectStatusFq(Long currentStatus, String startTime, String endTime, Integer submissionPid);
/**
*//**
* 统计 我发起
*
* @param currentStatus 状态
......@@ -131,10 +101,10 @@ public interface FailureDetailsMapper extends BaseMapper<FailureDetails> {
* @param endTime 结束时间
* @param submissionPid 报送人
* @return
*/
*//*
List<StatusDto> selectStatusFqp(Long currentStatus, String startTime, String endTime, Integer submissionPid);
/**
*//**
* 统计 领导
*
* @param currentStatus 状态
......@@ -142,22 +112,56 @@ public interface FailureDetailsMapper extends BaseMapper<FailureDetails> {
* @param endTime 结束时间
* @param submissionPid 报送人
* @return
*/
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<StatusDto> selectStatusLeader(Long currentStatus, String startTime, String endTime, Integer submissionPid);*/
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 @@
and submission_pid = #{submissionPid}
</if>
</where>
order by submission_time DESC limit #{current},#{size};
order by submission_time DESC limit #{current},#{size}
</select>
<select id="selectAllCount" resultType="int">
......@@ -72,10 +72,7 @@
order by submission_time DESC limit #{current},#{size}
</select>
<select id="selectISubPage" resultType="com.yeejoin.amos.boot.module.common.api.entity.FailureDetails">
<select id="queryForWaitManage" resultType="com.yeejoin.amos.boot.module.common.api.entity.FailureDetails">
SELECT sequence_nbr,
current_status,
failure_equipment_id,
......@@ -90,8 +87,16 @@
submission_branch_id
FROM cb_failure_details
<where>
<if test="currentStatus!= null ">
and current_status = #{currentStatus}
<choose>
<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 test="startTime!= null and endTime != null">
and submission_time between #{startTime} and #{endTime}
......@@ -105,26 +110,14 @@
</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
<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)
AS currentStatusCount
FROM cb_failure_details
<where>
<if test="currentStatus == null ">
and current_status in (0,3)
</if>
<if test="currentStatus != null ">
current_status = #{currentStatus}
<if test="currentStatus!= null ">
and current_status = #{currentStatus}
</if>
<if test="startTime!= null and endTime != null">
and submission_time between #{startTime} and #{endTime}
......@@ -133,28 +126,29 @@
and submission_pid = #{submissionPid}
</if>
</where>
order by submission_time DESC
limit #{current},#{size}
GROUP BY cb_failure_details.current_status
</select>
<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
<select id="queryStatusCount" resultType="com.yeejoin.amos.boot.module.common.api.dto.StatusDto">
SELECT cb_failure_details.current_status,
count(cb_failure_details.current_status)
AS currentStatusCount
FROM cb_failure_details
<where>
<if test="currentStatus != null ">
and current_status = #{currentStatus}
</if>
<choose>
<when test="currentStatus == null and ruleName == 'maintenance_department_maintenance_personnel'">
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">
and submission_time between #{startTime} and #{endTime}
</if>
......@@ -162,49 +156,63 @@
and submission_pid = #{submissionPid}
</if>
</where>
order by submission_time DESC
limit #{current},#{size}
GROUP BY cb_failure_details.current_status
</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,
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
count(current_status)
AS currentStatusCount
FROM
cb_failure_details d
<where>
<if test="currentStatus == null ">
current_status IN (2,6)
</if>
<if test="currentStatus != null ">
current_status = #{currentStatus}
<choose>
<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>
<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 test="startTime!= null and endTime != null">
and submission_time between #{startTime} and #{endTime}
</if>
<if test="submissionPid!= null ">
and submission_pid = #{submissionPid}
<if test="userId != null ">
and submission_pid = #{userId}
</if>
</where>
order by submission_time DESC
limit #{current},#{size}
GROUP BY current_status;
</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)
AS currentStatusCount
FROM cb_failure_details
<select id="selectForReceive" resultType="com.yeejoin.amos.boot.module.common.api.entity.FailureDetails">
SELECT
*
FROM
cb_failure_details d
<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}
</if>
<if test="startTime!= null and endTime != null">
......@@ -214,10 +222,13 @@
and submission_pid = #{submissionPid}
</if>
</where>
GROUP BY cb_failure_details.current_status
order by submission_time DESC
limit #{current},#{size};
</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,
count(cb_failure_details.current_status)
AS currentStatusCount
......@@ -296,16 +307,13 @@
</if>
</where>
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
current_status,
count(current_status)
AS currentStatusCount
*
FROM
cb_failure_details d
<where>
d.sequence_nbr in
(SELECT
......@@ -313,26 +321,25 @@
FROM
cb_failure_audit
where
rec_user_id = #{userId}
audit_result = 2
)
<if test="currentStatus!= null ">
<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 test="userId != null ">
and submission_pid = #{userId}
</if>
</where>
GROUP BY current_status;
order by submission_time DESC
limit #{current},#{size};
</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
current_status,
count(current_status)
AS currentStatusCount
*
FROM
cb_failure_details d
<where>
......@@ -340,11 +347,11 @@
(SELECT
fault_id
FROM
cb_failure_maintain
cb_failure_audit
where
rec_user_id = #{userId}
)
<if test="currentStatus!= null ">
<if test="currentStatus != null ">
and current_status = #{currentStatus}
</if>
<if test="startTime!= null and endTime != null">
......@@ -354,51 +361,23 @@
and submission_pid = #{submissionPid}
</if>
</where>
GROUP BY current_status;
</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;
order by submission_time DESC
limit #{current},#{size};
</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
*
*
FROM
cb_failure_details d
cb_failure_details d
<where>
d.sequence_nbr in
(SELECT
fault_id
FROM
cb_failure_audit
cb_failure_maintain
where
audit_result = 2
rec_user_id = #{userId}
)
<if test="currentStatus != null ">
and current_status = #{currentStatus}
......@@ -406,19 +385,142 @@
<if test="startTime!= null and endTime != null">
and submission_time between #{startTime} and #{endTime}
</if>
<if test="userId != null ">
and submission_pid = #{userId}
<if test="submissionPid!= null ">
and submission_pid = #{submissionPid}
</if>
</where>
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 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
*
current_status,
count(current_status)
AS currentStatusCount
FROM
cb_failure_details d
<where>
d.sequence_nbr in
(SELECT
......@@ -428,7 +530,7 @@
where
rec_user_id = #{userId}
)
<if test="currentStatus != null ">
<if test="currentStatus!= null ">
and current_status = #{currentStatus}
</if>
<if test="startTime!= null and endTime != null">
......@@ -438,15 +540,16 @@
and submission_pid = #{submissionPid}
</if>
</where>
order by submission_time DESC
limit #{current},#{size};
GROUP BY current_status;
</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
*
current_status,
count(current_status)
AS currentStatusCount
FROM
cb_failure_details d
cb_failure_details d
<where>
d.sequence_nbr in
(SELECT
......@@ -456,7 +559,7 @@
where
rec_user_id = #{userId}
)
<if test="currentStatus != null ">
<if test="currentStatus!= null ">
and current_status = #{currentStatus}
</if>
<if test="startTime!= null and endTime != null">
......@@ -466,9 +569,35 @@
and submission_pid = #{submissionPid}
</if>
</where>
order by submission_time DESC
limit #{current},#{size};
GROUP BY current_status;
</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>
......@@ -98,25 +98,37 @@ public class FailureDetailsServiceImpl extends BaseService<FailureDetailsDto, Fa
*/
public IPage<FailureDetails> queryForFailureDetailsPage(Page<FailureDetails> page, ReginParams userInfo, Long currentStatus,
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);
IPage<FailureDetails> iPage = new Page<>();
iPage.setRecords(list);
return iPage;
}
//当传递类型参数为我提交时
//当传递类型参数 为我提交时
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.setRecords(list);
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 (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());
IPage<FailureDetails> iPage = new Page<>();
iPage.setRecords(failureDetails);
......@@ -134,7 +146,7 @@ public class FailureDetailsServiceImpl extends BaseService<FailureDetailsDto, Fa
IPage<FailureDetails> iPage = new Page<>();
iPage.setRecords(failureDetails);
return iPage;
}
}*/
}
//否则就查询待处理
return this.queryForWaitManage(page, userInfo, currentStatus, startTime, endTime, userId);
......@@ -160,7 +172,7 @@ public class FailureDetailsServiceImpl extends BaseService<FailureDetailsDto, Fa
public IPage<FailureDetails> queryForWaitManage(Page<FailureDetails> page, ReginParams userInfo, Long currentStatus,
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>();
List<FailureDetails> list = baseMapper.selectStatusWaitWx(page.getCurrent(), page.getSize(), currentStatus, startTime, endTime, userId);
wxIpage.setRecords(list);
......@@ -171,8 +183,8 @@ public class FailureDetailsServiceImpl extends BaseService<FailureDetailsDto, Fa
IPage<FailureDetails> iPage = new Page<>();
iPage.setRecords(list);
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.setRecords(list);
return iPage;
......@@ -196,21 +208,8 @@ public class FailureDetailsServiceImpl extends BaseService<FailureDetailsDto, Fa
* 根据状态查询
*/
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.eq("current_status", status).orderByDesc("submission_time");
queryWrapper.eq("current_status",currentStatus).orderByDesc("submission_time");
return baseMapper.selectList(queryWrapper);
}
......@@ -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) {
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);
} else if (type.equals(SELECY_STATUS) && userInfo.getRole().getRoleName().equals(roleName[1])) {
statusDtos = baseMapper.selectStatusFq(currentStatus, startTime, endTime, userId);
......@@ -227,16 +226,17 @@ public class FailureDetailsServiceImpl extends BaseService<FailureDetailsDto, Fa
statusDtos = baseMapper.selectStatusFqp(currentStatus, startTime, endTime, Integer.parseInt(userInfo.getUserModel().getUserId()));
} else if (type.equals(SELECY_ALL)) {
statusDtos = baseMapper.selectStatusCount(currentStatus, startTime, endTime, userId);
} else if (type.equals(SELECY_ACCEPT)) {
if (userInfo.getRole().getRoleName().equals(roleName[2]) || userInfo.getRole().getRoleName().equals(roleName[3])){
} else*/ if (type.equals(SELECY_ACCEPT)) {
/* if (userInfo.getRole().getRoleName().equals(roleName[2]) || userInfo.getRole().getRoleName().equals(roleName[3])){
statusDtos = baseMapper.selectAudit(currentStatus, startTime, endTime, userId, userInfo.getUserModel().getUserId());
}else if (userInfo.getRole().getRoleName().equals(roleName[0])){
statusDtos = baseMapper.selectMaintain(currentStatus, startTime, endTime, userId, userInfo.getUserModel().getUserId());
}else {
statusDtos = baseMapper.selectUserId(currentStatus, startTime, endTime, userInfo.getUserModel().getUserId());
}
}*/
statusDtos= baseMapper.queryAcceptCount(currentStatus, startTime, endTime, userId, userInfo.getUserModel().getUserId(),userInfo.getRole().getRoleName());
} else {
statusDtos = baseMapper.selectStatusLeader(currentStatus, startTime, endTime, userId);
statusDtos = baseMapper.queryStatusCount(currentStatus, startTime, endTime, userId,userInfo.getRole().getRoleName());
}
List<CurrentStatusDto> currentStatusDtoList = new ArrayList<>();
statusDtos.forEach(e -> {
......@@ -331,10 +331,11 @@ public class FailureDetailsServiceImpl extends BaseService<FailureDetailsDto, Fa
failureDetailsDto.getAttachment());
}
// 添加至报修日志
OrgUsr orgUsr = iOrgUsrService.getById(failureDetailsDto.getBizCode());
Long faultId = model.getSequenceNbr();
Integer processAuditorId = model.getSubmissionPid();
String processResult = "重新提交报修单";
String processDepartment = userInfo.getDepartment().getDepartmentName();
String processDepartment = orgUsr.getBizOrgName() ;
Long departmentId = failureDetailsDto.getBizCode();
Date processTime = model.getSubmissionTime();
String processAuditorName = failureDetailsDto.getSubmissionName();
......
......@@ -31,6 +31,10 @@
<groupId>org.typroject</groupId>
<artifactId>*</artifactId>
</exclusion>
<exclusion>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
......
......@@ -17,6 +17,7 @@ import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
......@@ -156,10 +157,12 @@ public class EquipmentAlarmController extends AbstractBaseController {
request12.setName("isRemoveShield");
request12.setValue(StringUtil.isNotEmpty(isRemoveShield) ? StringUtils.trimToNull(isRemoveShield) : null);
queryRequests.add(request12);
CommonRequest request13 = new CommonRequest();
request13.setName("bizOrgCode");
request13.setValue(StringUtil.isNotEmpty(reginParams.getPersonIdentity().getBizOrgCode()) ? reginParams.getPersonIdentity().getBizOrgCode() : null );
queryRequests.add(request13);
if (!ValidationUtil.isEmpty(reginParams.getPersonIdentity())){
CommonRequest request13 = new CommonRequest();
request13.setName("bizOrgCode");
request13.setValue(StringUtil.isNotEmpty(reginParams.getPersonIdentity().getBizOrgCode()) ? reginParams.getPersonIdentity().getBizOrgCode() : null );
queryRequests.add(request13);
}
CommonPageInfoParam param = CommonPageParamUtil.fillCommonPageInfoParam(queryRequests, commonPageable);
Page<Map<String, Object>> list = iEquipmentSpecificAlarmService.listPage(param);
return CommonResponseUtil.success(list);
......@@ -276,10 +279,12 @@ public class EquipmentAlarmController extends AbstractBaseController {
request13.setName("isRemovedFire");
request13.setValue(StringUtil.isNotEmpty(isRemovedFire) ? StringUtils.trimToNull(isRemovedFire) : null);
queryRequests.add(request13);
CommonRequest request14 = new CommonRequest();
request13.setName("bizOrgCode");
request13.setValue(StringUtil.isNotEmpty(reginParams.getPersonIdentity().getBizOrgCode()) ? reginParams.getPersonIdentity().getBizOrgCode() : null );
queryRequests.add(request14);
if (!ValidationUtil.isEmpty(reginParams.getPersonIdentity())){
CommonRequest request14 = new CommonRequest();
request14.setName("bizOrgCode");
request14.setValue(StringUtil.isNotEmpty(reginParams.getPersonIdentity().getBizOrgCode()) ? reginParams.getPersonIdentity().getBizOrgCode() : null );
queryRequests.add(request14);
}
CommonPageInfoParam param = CommonPageParamUtil.fillCommonPageInfoParam(queryRequests, commonPageable);
org.springframework.data.domain.Page<AlarmListDataVO> list = iEquipmentSpecificAlarmService.listAlarmsPage(param);
return CommonResponseUtil.success(list);
......
......@@ -11,6 +11,8 @@ import java.io.OutputStream;
import java.net.*;
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;
public class SocketClient {
private static final Logger logger = LoggerFactory.getLogger(SocketClient.class);
private static final String[] testFilePath = {
"D:\\ffmpeg-4.4-full_build-shared\\bin\\out3.pcm",
"D:\\ffmpeg-4.4-full_build-shared\\bin\\out4.pcm",
"D:\\ffmpeg-4.4-full_build-shared\\bin\\record1.pcm",
"D:\\ffmpeg-4.4-full_build-shared\\bin\\record2.pcm",
"C:\\Users\\DELL\\Desktop\\yuyin\\out1.pcm",
"C:\\Users\\DELL\\Desktop\\yuyin\\out.pcm",
};
public static void main(String[] args) throws SocketException {
SocketClient socketClient = new SocketClient();
//socketClient.processTcp(0, 0);
socketClient.processUdp(10001, 2);
socketClient.processUdp(25002, 1);
}
@Async
......@@ -36,13 +36,15 @@ public class SocketClient {
if (type >= testFilePath.length) type -= 1;
DatagramSocket datagramSocket = new DatagramSocket();
try {
FileInputStream fis = new FileInputStream(new File(testFilePath[type]));
byte[] b = new byte[4096];
FileInputStream fis = new FileInputStream(new File("C:\\Users\\DELL\\Desktop\\ffmpeg-4.4-full_build-shared\\bin\\out.pcm"));
byte[] b = new byte[1280];
int len;
while ((len = fis.read(b)) > 0) {
logger.info("send data pack length: " + len);
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();
} 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
......@@ -94,17 +94,25 @@ public class PowerTransferCompanyResourcesServiceImpl extends BaseService<PowerT
try {
if (type == 2) {
powerTransferCompanyResources.setStatus(code);
powerTransferCompanyResources.setRemarks(remarks);
powerTransferCompanyResourcesMapper.updateById(powerTransferCompanyResources);
List<Object> carStatusInfoDtoList = new ArrayList();
//修改装备信息
CarStatusInfoDto carStatusInfo = new CarStatusInfoDto();
carStatusInfo.setSequenceNbr(carId + "");
carStatusInfo.setStatus(FireCarStatusEnum.执勤.getCode());
carStatusInfoDtoList.add(carStatusInfo);
// 更新所有车辆状态为执勤
equipFeignClient.updateCarStatus(carStatusInfoDtoList);
if("finished".equals(code)){
List<Object> carStatusInfoDtoList = new ArrayList();
//修改装备信息
CarStatusInfoDto carStatusInfo = new CarStatusInfoDto();
carStatusInfo.setSequenceNbr(carId + "");
carStatusInfo.setStatus(FireCarStatusEnum.执勤.getCode());
carStatusInfoDtoList.add(carStatusInfo);
// 更新所有车辆状态为执勤
equipFeignClient.updateCarStatus(carStatusInfoDtoList);
}
} else {
if (FireCarStatusEnum.到场.getCode().equals(code)){
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
......
......@@ -2,7 +2,12 @@ package com.yeejoin.amos.knowledgebase.config;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.HttpHost;
import org.apache.http.auth.AuthScope;
import org.apache.http.auth.UsernamePasswordCredentials;
import org.apache.http.client.CredentialsProvider;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.impl.client.BasicCredentialsProvider;
import org.apache.http.impl.nio.client.HttpAsyncClientBuilder;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestClientBuilder;
import org.elasticsearch.client.RestHighLevelClient;
......@@ -16,17 +21,31 @@ public class ElasticSearchClientConfig {
@Value("${spring.elasticsearch.rest.uris}")
private String uris;
@Value("${elasticsearch.username}")
private String username;
@Value("${elasticsearch.password}")
private String password;
@Bean
@Qualifier("highLevelClient")
public RestHighLevelClient restHighLevelClient() {
final CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
credentialsProvider.setCredentials(AuthScope.ANY,
new UsernamePasswordCredentials(username, password));
try {
String url = uris.replace("http://", "");
final String[] parts = StringUtils.split(url, ":");
HttpHost httpHost = new HttpHost(parts[0], Integer.parseInt(parts[1]), "http");
RestClientBuilder builder = RestClient.builder(httpHost);
builder.setHttpClientConfigCallback(new RestClientBuilder.HttpClientConfigCallback() {
@Override
public HttpAsyncClientBuilder customizeHttpClient(HttpAsyncClientBuilder httpClientBuilder) {
httpClientBuilder.disableAuthCaching();
return httpClientBuilder.setDefaultCredentialsProvider(credentialsProvider);
}
});
builder.setRequestConfigCallback(new RestClientBuilder.RequestConfigCallback() {
// 该方法接收一个RequestConfig.Builder对象,对该对象进行修改后然后返回。
@Override
......
......@@ -27,6 +27,10 @@
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-mock</artifactId>
<version>2.0.8</version>
......
......@@ -30,6 +30,10 @@
<artifactId>amos-feign-rule</artifactId>
<version>1.7.0</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
</dependency>
</dependencies>
<modules>
......
......@@ -15,6 +15,10 @@
<artifactId>amos-boot-module-equip-biz</artifactId>
<version>${amos-biz-boot.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
......
......@@ -26,6 +26,10 @@
<groupId>org.liquibase</groupId>
<artifactId>liquibase-core</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
</dependencies>
<build>
......
......@@ -39,8 +39,11 @@ rule.definition.localIp=172.16.3.35
file.url=http://39.98.45.134:9000/
video.url=https://11.11.16.4:443/
ifc.url=http://11.11.16.17/IFCInterface
ifc.call-back.localIp=11.11.16.1
elasticsearch.username= elastic
elasticsearch.password= 123456
......@@ -29,6 +29,13 @@ spring.datasource.hikari.max-lifetime=120000
spring.datasource.hikari.connection-timeout=30000
spring.datasource.hikari.connection-test-query=SELECT 1
endpoints.enabled = false
management.security.enabled=true
security.user.name=admin
security.user.password=admin
##liquibase
spring.liquibase.change-log = classpath:/db/changelog/changelog-master.xml
spring.liquibase.enabled= true
......
......@@ -15,7 +15,10 @@
<artifactId>amos-boot-module-knowledgebase-biz</artifactId>
<version>${amos-biz-boot.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
</dependencies>
<build>
......
......@@ -40,6 +40,8 @@ eureka.instance.metadata-map.management.api-docs=http://localhost:${server.port}
spring.data.elasticsearch.cluster-name=elasticsearch
spring.data.elasticsearch.cluster-nodes=172.16.10.66:9300
spring.elasticsearch.rest.uris=http://172.16.10.66:9200
elasticsearch.username= elastic
elasticsearch.password= 123456
#emqx v4.0
emqx.clean-session=true
......
......@@ -20,4 +20,10 @@ mybatis-plus.type-aliases-super-type=org.typroject.tyboot.core.rdbms.orm.entity.
mybatis-plus.global-config.db-config.id-type=id_worker
mybatis-plus.mapper-locations=classpath:mapper/*
## redis失效时间
redis.cache.failure.time=10800
\ No newline at end of file
redis.cache.failure.time=10800
endpoints.enabled = false
management.security.enabled=true
security.user.name=admin
security.user.password=admin
......@@ -23,6 +23,10 @@
<artifactId>pagehelper</artifactId>
<version>5.1.10</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
......
......@@ -61,4 +61,12 @@ feign.httpclient.connection-timeout=5000
video.fegin.name=video
latentDanger.feign.name=AMOS-LATENT-DANGER
Knowledgebase.fegin.name=AMOS-API-KNOWLEDGEBASE
\ No newline at end of file
Knowledgebase.fegin.name=AMOS-API-KNOWLEDGEBASE
## 消防救援保障部ID
fire-rescue=1432549862557130753
endpoints.enabled = false
management.security.enabled=true
security.user.name=admin
security.user.password=admin
......@@ -13,6 +13,10 @@
<artifactId>amos-boot-module-maintenance-biz</artifactId>
<version>${amos-biz-boot.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
......
......@@ -67,3 +67,8 @@ eureka.instance.metadata-map.management.context-path=${server.servlet.context-pa
eureka.instance.status-page-url-path=/actuator/info
eureka.instance.metadata-map.management.api-docs=http://localhost:${server.port}${server.servlet.context-path}/swagger-ui.html
endpoints.enabled = false
management.security.enabled=true
security.user.name=admin
security.user.password=admin
......@@ -16,6 +16,10 @@
<artifactId>amos-boot-module-patrol-biz</artifactId>
<version>${amos-biz-boot.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
......
......@@ -56,4 +56,10 @@ rule.definition.model-package=com.yeejoin.amos.patrol.business.entity.mybatis
rule.definition.default-agency=STATE_GRID
jcs.fegin.name=JCS
emergency.command.section.id=1418223840361709569
\ No newline at end of file
emergency.command.section.id=1418223840361709569
endpoints.enabled = false
management.security.enabled=true
security.user.name=admin
security.user.password=admin
......@@ -33,6 +33,10 @@
<groupId>cn.jpush.api</groupId>
<artifactId>jpush-client</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
......
......@@ -73,3 +73,8 @@ eureka.instance.metadata-map.management.context-path=${server.servlet.context-pa
eureka.instance.status-page-url-path=/actuator/info
eureka.instance.metadata-map.management.api-docs=http://localhost:${server.port}${server.servlet.context-path}/swagger-ui.html
endpoints.enabled = false
management.security.enabled=true
security.user.name=admin
security.user.password=admin
package com.yeejoin.amos.boot.module.tzs.api.dto;
import lombok.Data;
@Data
public class KV {
private String name;
private Object value;
}
package com.yeejoin.amos.boot.module.tzs.api.mapper;
import com.yeejoin.amos.boot.module.tzs.api.entity.MsgLog;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.boot.module.tzs.api.dto.KV;
import com.yeejoin.amos.boot.module.tzs.api.entity.MsgLog;
import java.util.List;
/**
* 消息流水表 Mapper 接口
......@@ -10,5 +13,5 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
* @date 2022-04-20
*/
public interface MsgLogMapper extends BaseMapper<MsgLog> {
List<KV> getMsgType();
}
......@@ -2,4 +2,10 @@
<!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.MsgLogMapper">
<select id="getMsgType" resultType="com.yeejoin.amos.boot.module.tzs.api.dto.KV">
SELECT msg_type AS value, msg_type_name AS name
FROM tz_msg_log
GROUP BY msg_type
</select>
</mapper>
package com.yeejoin.amos.boot.module.tzs.biz.controller;
import org.springframework.web.bind.annotation.RequestMapping;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RestController;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import java.util.List;
import com.yeejoin.amos.boot.module.tzs.api.dto.KV;
import com.yeejoin.amos.boot.module.tzs.api.dto.MsgLogDto;
import com.yeejoin.amos.boot.module.tzs.biz.service.impl.MsgLogServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseHelper;
import org.typroject.tyboot.core.restful.utils.ResponseModel;
import org.springframework.beans.factory.annotation.Autowired;
import javax.servlet.http.HttpServletRequest;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.module.tzs.api.dto.MsgLogDto;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import java.util.List;
import java.util.Map;
/**
* 消息流水表
......@@ -92,14 +89,13 @@ public class MsgLogController extends BaseController {
* 列表分页查询
*
* @param current 当前页
* @param current 每页大小
* @param size 每页大小
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/page")
@ApiOperation(httpMethod = "GET", value = "消息流水表分页查询", notes = "消息流水表分页查询")
public ResponseModel<Page<MsgLogDto>> queryForPage(@RequestParam(value = "current") int current, @RequestParam
(value = "size") int size) {
public ResponseModel<Page<MsgLogDto>> queryForPage(@RequestParam(value = "current") int current, @RequestParam(value = "size") int size) {
Page<MsgLogDto> page = new Page<MsgLogDto>();
page.setCurrent(current);
page.setSize(size);
......@@ -126,8 +122,7 @@ public class MsgLogController extends BaseController {
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "告警数量统计", notes = "告警数量统计")
@GetMapping(value = "/count")
public ResponseModel<Integer> countByTerminalType(
@RequestParam(value = "terminalType", required = false) String terminalType) {
public ResponseModel<Integer> countByTerminalType(@RequestParam(value = "terminalType", required = false) String terminalType) {
return ResponseHelper.buildResponse(msgLogServiceImpl.countByTerminalType(terminalType));
}
......@@ -135,21 +130,56 @@ public class MsgLogController extends BaseController {
* 列表分页查询
*
* @param current 当前页
* @param current 每页大小
* @param size 每页大小
* @param terminalType 终端类型
* @param isRead 是否未读
* @return
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/page/terminalType")
@ApiOperation(httpMethod = "GET", value = "消息流水表分页查询", notes = "消息流水表分页查询")
public ResponseModel<Page<MsgLogDto>> queryForPage(@RequestParam(value = "current") int current,
@RequestParam(value = "size") int size,
@RequestParam(value = "terminalType") String terminalType,
@RequestParam(value = "isRead") Boolean isRead) {
Page<MsgLogDto> page = new Page<MsgLogDto>();
public ResponseModel<Page<MsgLogDto>> queryForPage(
@RequestParam(value = "current") int current,
@RequestParam(value = "size") int size,
@RequestParam(required = false) String terminalType,
@RequestParam(required = false) Boolean isRead,
@RequestParam(required = false) String sendTimeStart,
@RequestParam(required = false) String sendTimeEnd,
@RequestParam(required = false) String msgType,
@RequestParam(required = false) String body
) {
Page<MsgLogDto> page = new Page<>();
page.setCurrent(current);
page.setSize(size);
return ResponseHelper.buildResponse(msgLogServiceImpl.queryForMsgLogByTerminalTypePage(page, terminalType, isRead));
return ResponseHelper.buildResponse(msgLogServiceImpl.queryForMsgLogByTerminalTypePage(page, terminalType, isRead, sendTimeStart, sendTimeEnd, msgType, body));
}
/**
* 获取消息类型
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/msgType")
@ApiOperation(httpMethod = "GET", value = "获取消息类型")
public ResponseModel<List<KV>> queryForPage() {
return ResponseHelper.buildResponse(msgLogServiceImpl.getType());
}
/**
* 全部已读
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/allRead")
@ApiOperation(httpMethod = "GET", value = "全部已读")
public ResponseModel<Boolean> allRead() {
return ResponseHelper.buildResponse(msgLogServiceImpl.allRead());
}
/**
* 批量删除
*/
@TycloudOperation(ApiLevel = UserType.AGENCY)
@PostMapping(value = "/deleteByIds")
@ApiOperation(httpMethod = "POST", value = "批量删除")
public ResponseModel<Boolean> deleteByIds(@RequestBody Map<String, List<Long>> body) {
return ResponseHelper.buildResponse(msgLogServiceImpl.deleteByIds(body.get("ids")));
}
}
\ No newline at end of file
}
package com.yeejoin.amos.boot.module.tzs.biz.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.collect.Lists;
import com.yeejoin.amos.boot.module.tzs.api.dto.AlertMsgDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.AlertPaperInfoDto;
import com.yeejoin.amos.boot.module.tzs.api.dto.KV;
import com.yeejoin.amos.boot.module.tzs.api.dto.MsgLogDto;
import com.yeejoin.amos.boot.module.tzs.api.entity.MsgLog;
import com.yeejoin.amos.boot.module.tzs.api.enums.TerminalTypeEnum;
import com.yeejoin.amos.boot.module.tzs.api.mapper.MsgLogMapper;
import com.yeejoin.amos.boot.module.tzs.api.service.IMsgLogService;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.rdbms.service.BaseService;
import java.util.LinkedList;
import java.util.List;
/**
......@@ -26,7 +31,7 @@ import java.util.List;
* @date 2022-04-20
*/
@Service
public class MsgLogServiceImpl extends BaseService<MsgLogDto,MsgLog,MsgLogMapper> implements IMsgLogService {
public class MsgLogServiceImpl extends BaseService<MsgLogDto, MsgLog, MsgLogMapper> implements IMsgLogService {
Logger logger = LoggerFactory.getLogger(MsgLogServiceImpl.class);
......@@ -36,26 +41,25 @@ public class MsgLogServiceImpl extends BaseService<MsgLogDto,MsgLog,MsgLogMapper
/**
* 分页查询
*/
public Page<MsgLogDto> queryForMsgLogPage(Page<MsgLogDto> page) {
public Page<MsgLogDto> queryForMsgLogPage(Page<MsgLogDto> page) {
return this.queryForPage(page, null, false);
}
/**
* 列表查询 示例
*/
public List<MsgLogDto> queryForMsgLogList() {
return this.queryForList("" , false);
public List<MsgLogDto> queryForMsgLogList() {
return this.queryForList("", false);
}
public List<MsgLogDto> queryForWebMsgLogList(String terminalType) {
return this.queryForList("" , false, terminalType);
public List<MsgLogDto> queryForWebMsgLogList(String terminalType) {
return this.queryForList("", false, terminalType);
}
public List<AlertMsgDto> queryForAlertMsg(List<String> regionCodes) {
List<AlertMsgDto> alertMsgDtoList = Lists.newArrayList();
// 查询电梯警情预报消息
List<AlertPaperInfoDto> alertPaperInfoDtoList =
alertCalledService.getAlertPaperInfoList(alertCalledService.authRegionCodeList(regionCodes), false);
List<AlertPaperInfoDto> alertPaperInfoDtoList = alertCalledService.getAlertPaperInfoList(alertCalledService.authRegionCodeList(regionCodes), false);
if (!ValidationUtil.isEmpty(alertPaperInfoDtoList)) {
alertPaperInfoDtoList.forEach(msg -> {
AlertMsgDto alertMsgDto = new AlertMsgDto();
......@@ -82,15 +86,51 @@ public class MsgLogServiceImpl extends BaseService<MsgLogDto,MsgLog,MsgLogMapper
alertMsgDtoList.add(alertMsgDto);
});
}
return alertMsgDtoList;
}
public Integer countByTerminalType(String terminalType) {
return this.list(new LambdaQueryWrapper<MsgLog>().eq(StringUtils.isNotEmpty(terminalType), MsgLog::getTerminalType, terminalType)).size();
return this.list(new LambdaQueryWrapper<MsgLog>().eq(StringUtils.hasText(terminalType), MsgLog::getTerminalType, terminalType)).size();
}
public Page<MsgLogDto> queryForMsgLogByTerminalTypePage(Page<MsgLogDto> page, String terminalType, Boolean isRead, String sendTimeStart, String sendTimeEnd, String msgType, String body) {
Page<MsgLog> msgLogPage = new Page<>(page.getCurrent(), page.getSize());
LambdaQueryWrapper<MsgLog> wrapper = new LambdaQueryWrapper<>();
if (!StringUtils.hasText(terminalType)) {
terminalType = TerminalTypeEnum.TERMINAL_TYPE_WEB.getCode();
}
wrapper.eq(MsgLog::getTerminalType, terminalType);
wrapper.eq(isRead != null, MsgLog::getIsRead, isRead);
wrapper.ge(StringUtils.hasText(sendTimeStart), MsgLog::getSendTime, sendTimeStart);
wrapper.le(StringUtils.hasText(sendTimeEnd), MsgLog::getSendTime, sendTimeEnd);
wrapper.eq(StringUtils.hasText(msgType), MsgLog::getMsgType, msgType);
wrapper.eq(MsgLog::getIsDelete, 0);
wrapper.like(StringUtils.hasText(body), MsgLog::getBody, body);
page(msgLogPage, wrapper);
LinkedList<MsgLogDto> msgLogDtos = new LinkedList<>();
for (MsgLog record : msgLogPage.getRecords()) {
MsgLogDto msgLogDto = new MsgLogDto();
BeanUtils.copyProperties(record, msgLogDto);
msgLogDtos.add(msgLogDto);
}
page.setRecords(msgLogDtos);
return page;
}
public Page<MsgLogDto> queryForMsgLogByTerminalTypePage(Page<MsgLogDto> page, String terminalType, Boolean isRead) {
return this.queryForPage(page, "rec_date", false, terminalType, isRead);
public List<KV> getType() {
return getBaseMapper().getMsgType();
}
}
\ No newline at end of file
public boolean allRead() {
LambdaUpdateWrapper<MsgLog> wrapper = new LambdaUpdateWrapper<>();
wrapper.eq(MsgLog::getIsRead, 0).set(MsgLog::getIsRead, 1);
return update(wrapper);
}
public boolean deleteByIds(List<Long> longs) {
LambdaUpdateWrapper<MsgLog> wrapper = new LambdaUpdateWrapper<>();
wrapper.in(MsgLog::getSequenceNbr, longs).set(MsgLog::getIsDelete, 1);
return update(wrapper);
}
}
......@@ -24,6 +24,11 @@ public class ElasticSearchClientConfig {
@Value("${spring.elasticsearch.rest.uris}")
private String uris;
@Value("${elasticsearch.username}")
private String username;
@Value("${elasticsearch.password}")
private String password;
@Bean
@Qualifier("highLevelClient")
......@@ -35,8 +40,9 @@ public class ElasticSearchClientConfig {
HttpHost httpHost = new HttpHost(parts[0], Integer.parseInt(parts[1]), "http");
RestClientBuilder builder = RestClient.builder(httpHost);
//增加安全配置,使用kibana,勿删
final CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
credentialsProvider.setCredentials(AuthScope.ANY, new UsernamePasswordCredentials("elastic","es123456"));
final CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
credentialsProvider.setCredentials(AuthScope.ANY,
new UsernamePasswordCredentials(username, password));
builder.setRequestConfigCallback(new RestClientBuilder.RequestConfigCallback() {
// 该方法接收一个RequestConfig.Builder对象,对该对象进行修改后然后返回。
@Override
......@@ -47,13 +53,13 @@ public class ElasticSearchClientConfig {
}
});// 调整最大重试超时时间(默认为30秒).setMaxRetryTimeoutMillis(60000);
//增加安全配置,使用kibana,勿删
// builder.setHttpClientConfigCallback(new RestClientBuilder.HttpClientConfigCallback() {
// @Override
// public HttpAsyncClientBuilder customizeHttpClient(HttpAsyncClientBuilder httpClientBuilder) {
// httpClientBuilder.disableAuthCaching();
// return httpClientBuilder.setDefaultCredentialsProvider(credentialsProvider);
// }
// });
builder.setHttpClientConfigCallback(new RestClientBuilder.HttpClientConfigCallback() {
@Override
public HttpAsyncClientBuilder customizeHttpClient(HttpAsyncClientBuilder httpClientBuilder) {
httpClientBuilder.disableAuthCaching();
return httpClientBuilder.setDefaultCredentialsProvider(credentialsProvider);
}
});
return new RestHighLevelClient(builder);
} catch (Exception e) {
throw new IllegalStateException("Invalid ES nodes " + "property '" + uris + "'", e);
......
......@@ -16,6 +16,8 @@ biz.elasticsearch.address=172.16.10.66
spring.data.elasticsearch.cluster-name=elasticsearch
spring.data.elasticsearch.cluster-nodes=${biz.elasticsearch.address}:9300
spring.elasticsearch.rest.uris=http://${biz.elasticsearch.address}:9200
elasticsearch.username= elastic
elasticsearch.password= 123456
##biz custem properties
biz.hk.video.url=http://11.11.16.12:9017/artemis-web/debug
......
......@@ -37,6 +37,12 @@
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.netflix.hystrix</groupId>
......@@ -279,6 +285,11 @@
<artifactId>json-lib</artifactId>
<version>2.4</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.17.0</version>
</dependency>
</dependencies>
</dependencyManagement>
<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