提交权限修改
This commit is contained in:
@@ -161,6 +161,10 @@
|
||||
<artifactId>commons-jexl3</artifactId>
|
||||
<version>3.2.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.xinda</groupId>
|
||||
<artifactId>xinda-itsm</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.xinda.iot.domain;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.xinda.itsm.domain.RepairOrder;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
@@ -57,6 +58,10 @@ public class AlertLog extends BaseEntity
|
||||
|
||||
private Long userId;
|
||||
|
||||
private Integer enable;
|
||||
private Long orderId;
|
||||
private RepairOrder order;
|
||||
|
||||
private String deviceName;
|
||||
|
||||
private Long deviceId;
|
||||
|
||||
@@ -148,4 +148,6 @@ public interface AlertMapper
|
||||
* @return 设备告警集合
|
||||
*/
|
||||
List<AlertSceneSendVO> listByAlertIds(Long sceneId);
|
||||
|
||||
List<Long> selectSceneByAlert(Long[] alertIds);
|
||||
}
|
||||
|
||||
@@ -37,6 +37,9 @@ public class ThingsModelDTO extends BaseEntity
|
||||
/** 标识符,产品下唯一 */
|
||||
private String identifier;
|
||||
|
||||
/** 排序 */
|
||||
private Integer order;
|
||||
|
||||
/** 模型类别(1-属性,2-功能,3-事件) */
|
||||
private Integer type;
|
||||
|
||||
|
||||
@@ -14,6 +14,8 @@ import com.xinda.iot.domain.Device;
|
||||
import com.xinda.iot.model.AlertCountVO;
|
||||
import com.xinda.iot.model.param.DataCenterParam;
|
||||
import com.xinda.iot.model.DeviceAlertCount;
|
||||
import com.xinda.itsm.domain.RepairOrder;
|
||||
import com.xinda.itsm.mapper.RepairOrderMapper;
|
||||
import com.xinda.system.mapper.SysUserMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
@@ -42,6 +44,9 @@ public class AlertLogServiceImpl implements IAlertLogService {
|
||||
|
||||
@Resource
|
||||
private SysUserMapper sysUserMapper;
|
||||
|
||||
@Resource
|
||||
private RepairOrderMapper repairOrderMapper;
|
||||
/**
|
||||
* 查询设备告警
|
||||
*
|
||||
@@ -184,6 +189,11 @@ public class AlertLogServiceImpl implements IAlertLogService {
|
||||
// 1=不需要处理,2=未处理,3=已处理
|
||||
alertLog.setStatus(3);
|
||||
}
|
||||
if (alertLog.getEnable()==1) {
|
||||
RepairOrder order = alertLog.getOrder();
|
||||
repairOrderMapper.insertRepairOrder(order);
|
||||
alertLog.setOrderId(order.getId());
|
||||
}
|
||||
return alertLogMapper.updateAlertLog(alertLog);
|
||||
}
|
||||
|
||||
|
||||
@@ -242,6 +242,9 @@ public class AlertServiceImpl implements IAlertService {
|
||||
}
|
||||
alertMapper.deleteAlertSceneByAlertIds(alertIds);
|
||||
}
|
||||
// 将 List<Long> 转换为 Long[]
|
||||
Long[] sceneIds = alertMapper.selectSceneByAlert(alertIds).toArray(new Long[0]);
|
||||
sceneService.deleteSceneBySceneIds(sceneIds);
|
||||
// 批量删除告警场景
|
||||
alertMapper.deleteAlertSceneByAlertIds(alertIds);
|
||||
// 批量删除告警通知模版配置
|
||||
@@ -259,6 +262,8 @@ public class AlertServiceImpl implements IAlertService {
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public int deleteAlertByAlertId(Long alertId) {
|
||||
Long[] sceneIds = alertMapper.selectSceneByAlert(new Long[]{alertId}).toArray(new Long[0]);
|
||||
sceneService.deleteSceneBySceneIds(sceneIds);
|
||||
// 批量删除告警场景
|
||||
alertMapper.deleteAlertSceneByAlertIds(new Long[]{alertId});
|
||||
// 批量删除告警通知模版配置
|
||||
|
||||
@@ -22,6 +22,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="userId" column="user_id"/>
|
||||
<result property="sceneId" column="scene_id"/>
|
||||
<result property="sceneName" column="scene_name"/>
|
||||
<result property="enable" column="enable"/>
|
||||
<result property="orderId" column="order_id"/>
|
||||
</resultMap>
|
||||
|
||||
<resultMap type="com.xinda.iot.model.DeviceAlertCount" id="DeviceAlertCount">
|
||||
@@ -34,11 +36,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectAlertLogVo">
|
||||
select alert_log_id, alert_name, alert_level, status, product_id, detail, serial_number, create_by, create_time, remark, device_name, user_id from iot_alert_log
|
||||
select alert_log_id, alert_name, alert_level, status, product_id, detail, serial_number, create_by, create_time, remark, device_name, user_id,enable,order_id from iot_alert_log
|
||||
</sql>
|
||||
|
||||
<select id="selectAlertLogList" parameterType="com.xinda.iot.domain.AlertLog" resultMap="AlertLogResult">
|
||||
select distinct al.alert_log_id, al.alert_name, al.alert_level, al.status, al.product_id, al.detail, al.serial_number, al.create_time, al.remark, al.device_name, al.user_id
|
||||
select distinct al.alert_log_id, al.alert_name, al.alert_level, al.status, al.product_id, al.detail, al.serial_number, al.create_time, al.remark, al.device_name, al.user_id,al.enable,al.order_id
|
||||
from iot_alert_log al
|
||||
<where>
|
||||
<if test="alertName != null and alertName != ''"> and al.alert_name like concat('%', #{alertName}, '%')</if>
|
||||
@@ -55,7 +57,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
|
||||
<select id="selectAlertLogListAndScene" parameterType="com.xinda.iot.domain.AlertLog" resultMap="AlertLogResult">
|
||||
select al.alert_log_id, al.alert_name, al.alert_level, al.status, al.product_id, al.detail,
|
||||
al.serial_number, al.create_time, al.remark, al.device_name, al.user_id,
|
||||
al.serial_number, al.create_time, al.remark, al.device_name, al.user_id,al.enable,al.order_id,
|
||||
s.scene_id,s.scene_name
|
||||
from iot_alert_log al
|
||||
left join iot_scene s on CAST(COALESCE(NULLIF(TRIM(al.create_by), ''), 0) AS signed) = s.scene_id
|
||||
@@ -204,6 +206,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="remark != null">#{remark},</if>
|
||||
<if test="userId != null">#{userId},</if>
|
||||
<if test="deviceName != null and deviceName != ''">#{deviceName},</if>
|
||||
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
@@ -238,6 +241,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
<if test="enable != null">enable =#{enable},</if>
|
||||
<if test="orderId != null">orderId =#{orderId},</if>
|
||||
</trim>
|
||||
where alert_log_id = #{alertLogId}
|
||||
</update>
|
||||
|
||||
@@ -221,4 +221,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<select id="selectSceneByAlert" resultType="Long">
|
||||
select scene_id
|
||||
from iot_alert_scene
|
||||
where alert_id in
|
||||
<foreach item="alertId" collection="array" open="(" separator="," close=")">
|
||||
#{alertId}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -750,17 +750,17 @@
|
||||
|
||||
(
|
||||
select count(product_id)
|
||||
from iot_product
|
||||
<!-- <where>-->
|
||||
<!-- <if test="deptId != null and deptId != 0">-->
|
||||
<!-- and d.user_id in (SELECT-->
|
||||
<!-- u.user_id-->
|
||||
<!-- FROM-->
|
||||
<!-- sys_user u-->
|
||||
<!-- WHERE-->
|
||||
<!-- u.dept_id IN ( SELECT dept_id FROM sys_dept WHERE find_in_set(#{deptId}, ancestors) OR dept_id = #{deptId}))-->
|
||||
<!-- </if>-->
|
||||
<!-- </where>-->
|
||||
from iot_product p
|
||||
<where>
|
||||
<if test="deptId != null and deptId != 0">
|
||||
and p.tenant_id in (SELECT
|
||||
u.user_id
|
||||
FROM
|
||||
sys_user u
|
||||
WHERE
|
||||
u.dept_id IN ( SELECT dept_id FROM sys_dept WHERE find_in_set(#{deptId}, ancestors) OR dept_id = #{deptId}))
|
||||
</if>
|
||||
</where>
|
||||
) as productCount,
|
||||
|
||||
<!-- <!–告警设备数量–>-->
|
||||
|
||||
Reference in New Issue
Block a user