Commit 91b78305 authored by zhangsen's avatar zhangsen

组态API和数据同步所需字段

parent 311e47c6
package com.yeejoin.equipmanage.controller; package com.yeejoin.equipmanage.controller;
import com.yeejoin.equipmanage.mapper.FireFightingSystemMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams; import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.equipmanage.common.utils.*; import com.yeejoin.equipmanage.common.utils.*;
import com.yeejoin.equipmanage.service.IEquipmentSpecificAlarmService; import com.yeejoin.equipmanage.service.IEquipmentSpecificAlarmService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.core.foundation.enumeration.UserType; import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import java.util.List;
import java.util.Map;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.foundation.utils.ValidationUtil; import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import org.typroject.tyboot.core.restful.doc.TycloudOperation; import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import org.typroject.tyboot.core.restful.utils.ResponseModel; import org.typroject.tyboot.core.restful.utils.ResponseModel;
...@@ -28,6 +38,10 @@ import java.util.Map; ...@@ -28,6 +38,10 @@ import java.util.Map;
@RequestMapping(value = "/configure", produces = MediaType.APPLICATION_JSON_UTF8_VALUE) @RequestMapping(value = "/configure", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public class ConfigureController extends AbstractBaseController { public class ConfigureController extends AbstractBaseController {
@Autowired
private FireFightingSystemMapper fireFightingSystemMapper;
@Autowired @Autowired
private IEquipmentSpecificAlarmService equipmentSpecificAlarmService; private IEquipmentSpecificAlarmService equipmentSpecificAlarmService;
...@@ -96,4 +110,25 @@ public class ConfigureController extends AbstractBaseController { ...@@ -96,4 +110,25 @@ public class ConfigureController extends AbstractBaseController {
return CommonResponseUtil.success(equipmentSpecificAlarmService.equipAlarmLine(hashMap)); return CommonResponseUtil.success(equipmentSpecificAlarmService.equipAlarmLine(hashMap));
} }
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "获取系统告警信息")
@GetMapping("/getSystemAlarmInfo")
public ResponseModel getSystemAlarmInfo() {
ReginParams reginParams = getSelectedOrgInfo();
String bizOrgCode = !ValidationUtil.isEmpty(reginParams.getPersonIdentity()) && StringUtil.isNotEmpty(reginParams.getPersonIdentity().getBizOrgCode()) ? reginParams.getPersonIdentity().getBizOrgCode() : null;
return CommonResponseUtil.success(fireFightingSystemMapper.getSystemAlarmInfo(bizOrgCode));
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(value = "获取设备告警待确认和未处理信息")
@GetMapping("/getEquipAlarmInfoNum")
public ResponseModel getEquipAlarmInfoNum() {
ReginParams reginParams = getSelectedOrgInfo();
String bizOrgCode = !ValidationUtil.isEmpty(reginParams.getPersonIdentity()) && StringUtil.isNotEmpty(reginParams.getPersonIdentity().getBizOrgCode()) ? reginParams.getPersonIdentity().getBizOrgCode() : null;
return CommonResponseUtil.success(fireFightingSystemMapper.getEquipAlarmInfoNum(bizOrgCode));
}
} }
...@@ -237,4 +237,7 @@ public interface FireFightingSystemMapper extends BaseMapper<FireFightingSystemE ...@@ -237,4 +237,7 @@ public interface FireFightingSystemMapper extends BaseMapper<FireFightingSystemE
*/ */
List<Map<String, Object>> listByBizOrgCode(@Param("bizOrgCode") String bizOrgCode); List<Map<String, Object>> listByBizOrgCode(@Param("bizOrgCode") String bizOrgCode);
List<Map<String, Object>> getSystemAlarmInfo(@Param("bizOrgCode") String bizOrgCode);
List<Map<String, Object>> getEquipAlarmInfoNum(@Param("bizOrgCode") String bizOrgCode);
} }
...@@ -39,4 +39,31 @@ ...@@ -39,4 +39,31 @@
alter table `wl_equipment_specific_alarm_log` add column `trace_id` varchar(64) DEFAULT NULL COMMENT 'iot数据上报唯一id'; alter table `wl_equipment_specific_alarm_log` add column `trace_id` varchar(64) DEFAULT NULL COMMENT 'iot数据上报唯一id';
</sql> </sql>
</changeSet> </changeSet>
<changeSet author="zs" id="20220719-1417-1">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="wl_equipment_category" columnName="image"/>
</not>
</preConditions>
<comment>新增属性字段 image</comment>
<sql>
alter table `wl_equipment_category` add column `image` varchar(1000) DEFAULT NULL COMMENT '图片';
</sql>
</changeSet>
<changeSet author="zs" id="20220719-1417-2">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="cb_org_usr" columnName="is_firefighters"/>
</not>
</preConditions>
<comment>新增属性字段 is_firefighters 和 type_code</comment>
<sql>
alter table `cb_org_usr` add column `is_firefighters` varchar(10) DEFAULT '0' COMMENT '是否是消防人员0-否 1-是';
alter table `cb_org_usr` add column `type_code` varchar(255) DEFAULT NULL COMMENT '消防队类型';
alter table `cb_org_usr` add column `is_certificate` int(10) DEFAULT 0 COMMENT '是否持证';
</sql>
</changeSet>
</databaseChangeLog> </databaseChangeLog>
\ No newline at end of file
...@@ -2345,6 +2345,77 @@ ...@@ -2345,6 +2345,77 @@
order by createDate DESC order by createDate DESC
</select> </select>
<select id="getSystemAlarmInfo" resultType="java.util.Map">
SELECT
`fs`.`id` AS `id`,
`fs`.`name` AS `name`,
count( `wes`.`id` ) AS `totalEquipNum`,(
SELECT
count( DISTINCT `eqlog`.`equipment_specific_id` )
FROM
`wl_equipment_specific_alarm_log` `eqlog`
WHERE
((
0 != find_in_set( `fs`.`id`, `eqlog`.`system_ids` ))
AND (
`eqlog`.`create_date` LIKE concat( date_format( curdate(), '%Y-%m-%d' ), '%' )))) AS `todayAlarmNum`,
IF
(((
SELECT
count( `eqlog`.`equipment_specific_id` )
FROM
`wl_equipment_specific_alarm_log` `eqlog`
WHERE
((
0 != find_in_set( `fs`.`id`, `eqlog`.`system_ids` ))
AND ( `eqlog`.`status` = 1 ))) > 0
),
'异常',
'正常'
) AS `stateDesc`,
ec.image
FROM
`f_fire_fighting_system` `fs`
LEFT JOIN `wl_equipment_specific` `wes` ON (
0 != find_in_set( `fs`.`id`, `wes`.`system_id` ))
LEFT JOIN wl_equipment_category ec ON ec.id = fs.system_type
<where>
1=1
<if test="bizOrgCode!=null and bizOrgCode!=''">
and fs.biz_org_code = #{bizOrgCode,jdbcType=VARCHAR}
</if>
</where>
GROUP BY
`fs`.`id`
</select>
<select id="getEquipAlarmInfoNum" resultType="java.util.Map">
SELECT
(
SELECT
count( log.id )
FROM
`wl_equipment_specific_alarm_log` log
LEFT JOIN wl_equipment_specific es ON log.equipment_specific_id = es.id
<where>
log.`status` = 1
<if test="bizOrgCode!=null and bizOrgCode!=''">
and es.biz_org_code = #{bizOrgCode,jdbcType=VARCHAR}
</if>
</where>
) AS unclearInfoNum,
(
SELECT
count( log.id )
FROM
`wl_equipment_specific_alarm_log` log
LEFT JOIN wl_equipment_specific es ON log.equipment_specific_id = es.id
<where>
log.`confirm_date` IS NULL
<if test="bizOrgCode!=null and bizOrgCode!=''">
and es.biz_org_code = #{bizOrgCode,jdbcType=VARCHAR}
</if>
</where>
) AS unConfirmInfoNum
</select>
</mapper> </mapper>
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