Commit 51b12cf6 authored by lisong's avatar lisong

添加四横八纵数据源接口

parent 8803d6eb
......@@ -3,17 +3,21 @@ package com.yeejoin.equipmanage.controller;
import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import com.yeejoin.equipmanage.common.vo.UnitAreaTreeVo;
import com.yeejoin.equipmanage.service.IAreaService;
import com.yeejoin.equipmanage.service.IEmergencyService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
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.restful.doc.TycloudOperation;
import java.util.List;
import java.util.Map;
/**
*
......@@ -29,6 +33,8 @@ public class EmergencyController extends AbstractBaseController {
@Autowired
IAreaService iAreaService;
@Autowired
IEmergencyService iEmergencyService;
/**
* 通过bizOrgCode过滤
*/
......@@ -41,4 +47,49 @@ public class EmergencyController extends AbstractBaseController {
return null;
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation("应急物资")
@GetMapping(value = "/emergencyMaterials")
public Map<String, Object> emergencyMaterials(@RequestParam(value = "bizOrgCode", required = false) String bizOrgCode ) {
if (ObjectUtils.isEmpty(bizOrgCode)){
ReginParams reginParams = getSelectedOrgInfo();
bizOrgCode = reginParams.getPersonIdentity().getBizOrgCode();
}
return iEmergencyService.emergencyMaterials(bizOrgCode);
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation("应急物资-详情")
@GetMapping(value = "/emergencyMaterialsDetails")
public List<Map<String, Object>> emergencyMaterialsDetails(@RequestParam(value = "bizOrgCode", required = false) String bizOrgCode ) {
if (ObjectUtils.isEmpty(bizOrgCode)){
ReginParams reginParams = getSelectedOrgInfo();
bizOrgCode = reginParams.getPersonIdentity().getBizOrgCode();
}
return iEmergencyService.emergencyMaterialsDetails(bizOrgCode);
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation("消防炮列表")
@GetMapping(value = "/fireMonitor")
public List<Map<String, Object>> selectFireMonitor(@RequestParam(value = "bizOrgCode", required = false) String bizOrgCode ) {
if (ObjectUtils.isEmpty(bizOrgCode)){
ReginParams reginParams = getSelectedOrgInfo();
bizOrgCode = reginParams.getPersonIdentity().getBizOrgCode();
}
return iEmergencyService.selectFireMonitor(bizOrgCode);
}
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation("消防炮列表")
@GetMapping(value = "/selectFoamTank")
public List<Map<String, Object>> selectFoamTank(@RequestParam(value = "bizOrgCode", required = false) String bizOrgCode ) {
if (ObjectUtils.isEmpty(bizOrgCode)){
ReginParams reginParams = getSelectedOrgInfo();
bizOrgCode = reginParams.getPersonIdentity().getBizOrgCode();
}
return iEmergencyService.selectFoamTank(bizOrgCode);
}
}
......@@ -2,6 +2,10 @@ package com.yeejoin.equipmanage.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.equipmanage.common.entity.CarInfo;
import feign.Param;
import java.util.List;
import java.util.Map;
/**
* Mapper 接口
......@@ -9,4 +13,33 @@ import com.yeejoin.equipmanage.common.entity.CarInfo;
*/
public interface EmergencyMapper {
/**
* 应急物资列表
* @param bizOrgCode
* @return
*/
Map<String, Object> selectEmergencyMaterials(@Param("bizOrgCode") String bizOrgCode);
/**
* 应急物资详情
* @param bizOrgCode
* @return
*/
List<Map<String, Object>> selectEmergencyMaterialsDetails(@Param("bizOrgCode") String bizOrgCode);
/**
* 消防炮列表
* @param bizOrgCode
* @return
*/
List<Map<String, Object>> selectFireMonitor(@Param("bizOrgCode") String bizOrgCode);
/**
* 泡沫罐
* @param bizOrgCode
* @return
*/
List<Map<String, Object>> selectFoamTank(@Param("bizOrgCode") String bizOrgCode);
}
......@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
import com.yeejoin.equipmanage.common.vo.UnitAreaTreeVo;
import java.util.List;
import java.util.Map;
/**
*
......@@ -16,4 +17,12 @@ public interface IEmergencyService {
* @return
*/
List getAll();
Map<String, Object> emergencyMaterials(String bizOrgCode);
List<Map<String, Object>> emergencyMaterialsDetails(String bizOrgCode);
List<Map<String, Object>> selectFireMonitor(String bizOrgCode);
List<Map<String, Object>> selectFoamTank(String bizOrgCode);
}
......@@ -8,6 +8,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
/**
*
......@@ -25,4 +26,24 @@ public class EmergencyServiceImpl implements IEmergencyService {
public List getAll() {
return null;
}
@Override
public Map<String, Object> emergencyMaterials(String bizOrgCode) {
return emergencyMapper.selectEmergencyMaterials(bizOrgCode);
}
@Override
public List<Map<String, Object>> emergencyMaterialsDetails(String bizOrgCode) {
return emergencyMapper.selectEmergencyMaterialsDetails(bizOrgCode);
}
@Override
public List<Map<String, Object>> selectFireMonitor(String bizOrgCode) {
return emergencyMapper.selectFireMonitor(bizOrgCode);
}
@Override
public List<Map<String, Object>> selectFoamTank(String bizOrgCode) {
return emergencyMapper.selectFoamTank(bizOrgCode);
}
}
......@@ -3,4 +3,111 @@
<mapper namespace="com.yeejoin.equipmanage.mapper.EmergencyMapper">
<select id="selectEmergencyMaterials" resultType="java.util.Map">
SELECT
( SELECT COUNT( 1 ) FROM `wl_equipment_specific` wel WHERE wel.equipment_code LIKE CONCAT( '3104', '%' )
and wel.biz_org_code like concat(#{bizOrgCode} , '%') ) AS fireExtinguisher,
( SELECT COUNT( 1 ) FROM `wl_equipment_specific` wel WHERE wel.equipment_code LIKE CONCAT( '3105', '%' )
and wel.biz_org_code like concat(#{bizOrgCode} , '%')) AS fireHydrant,
( SELECT COUNT( 1 ) FROM `wl_equipment_specific` wel WHERE wel.equipment_code LIKE CONCAT( '3910', '%' )
and wel.biz_org_code like concat(#{bizOrgCode} , '%')) AS fireShovel,
( SELECT COUNT( 1 ) FROM `wl_equipment_specific` wel WHERE wel.equipment_code LIKE CONCAT( '3904', '%' )
and wel.biz_org_code like concat(#{bizOrgCode} , '%')) AS fireAxe,
( SELECT COUNT( 1 ) FROM `wl_equipment_specific` wel WHERE wel.equipment_code LIKE CONCAT( '3911', '%' )
and wel.biz_org_code like concat(#{bizOrgCode} , '%')) AS fireBucket,
( SELECT COUNT( 1 ) FROM `wl_equipment_specific` wel WHERE wel.equipment_code LIKE CONCAT( '53022', '%' )
and wel.biz_org_code like concat(#{bizOrgCode} , '%')) AS respirator
</select>
<select id="selectEmergencyMaterialsDetails" resultType="java.util.Map">
SELECT
IFNULL(ec.name,'') AS name ,
count( 1 ) AS num,
IFNULL(ws.`name`,'') AS buildingname
FROM
`wl_equipment_specific` wel
LEFT JOIN wl_warehouse_structure ws ON wel.warehouse_structure_id = ws.id
LEFT JOIN wl_equipment_detail wed ON wel.equipment_detail_id = wed.id
LEFT JOIN wl_equipment we ON wed.equipment_Id = we.id
LEFT JOIN wl_equipment_category ec ON we.category_id = ec.id
WHERE
(
wel.equipment_code LIKE CONCAT( '3104', '%' )
OR wel.equipment_code LIKE CONCAT( '3105', '%' )
OR wel.equipment_code LIKE CONCAT( '3910', '%' )
OR wel.equipment_code LIKE CONCAT( '3904', '%' )
OR wel.equipment_code LIKE CONCAT( '3911', '%' )
OR wel.equipment_code LIKE CONCAT( '53022', '%' )
)
AND wel.biz_org_code LIKE CONCAT( #{bizOrgCode}, '%' )
GROUP BY
wel.warehouse_structure_id
</select>
<select id="selectFireMonitor" resultType="java.util.Map">
SELECT temp.name, temp.alarm ,
IFNULL((SELECT wesi.value FROM wl_equipment_specific_index wesi WHERE wesi.equipment_specific_id = temp.id AND wesi.equipment_index_key = 'CAFS_CAFSFireGun_FireGunPressure'
ORDER BY wesi.update_date desc LIMIT 1),0) AS value,
IFNULL((SELECT wesi.equipment_index_name FROM wl_equipment_specific_index wesi WHERE wesi.equipment_specific_id = temp.id AND wesi.is_alarm = 1
ORDER BY wesi.update_date desc LIMIT 1),'--') AS status,
'--' AS flow
FROM(
SELECT wes.id,wes.name ,
CASE
WHEN ( SELECT is_alarm FROM wl_equipment_specific_index wesi WHERE wesi.equipment_specific_id = wes.id AND wesi.equipment_index_key = wes.realtime_iot_index_key ) = 1
AND wes.realtime_iot_index_value = 'true' THEN
1 ELSE 0
END AS alarm
FROM wl_equipment_specific wes
WHERE
wes.equipment_code LIKE concat( '920322', '%' )
AND wes.biz_org_code LIKE CONCAT( #{bizOrgCode}, '%' )
) temp
</select>
<select id="selectFoamTank" resultType="java.util.Map">
SELECT
wes.id,
wes.name,
wes.realtime_iot_index_value ,
CASE
WHEN ( wes.realtime_iot_index_value > (SELECT IFNULL(field_value,0) FROM wl_form_instance_equip WHERE instance_id = wes.id AND field_name = 'maxLevel'))
THEN '液位高' WHEN ( wes.realtime_iot_index_value &lt; (SELECT IFNULL(field_value,0) FROM wl_form_instance_equip WHERE instance_id = wes.id AND field_name = 'minLevel')) then '液位低'
ELSE '正常'
end AS status,
IF((
abs(
(
( wes.realtime_iot_index_value ) /
IF
( ( (SELECT IFNULL(field_value,0) FROM wl_form_instance_equip WHERE instance_id = wes.id AND field_name = 'maxLevel') = 0 ), 1, (SELECT IFNULL(field_value,0) FROM wl_form_instance_equip WHERE instance_id = wes.id AND field_name = 'maxLevel') )
)
) * 100
),100,(
abs(
(
( wes.realtime_iot_index_value ) /
IF
( ( (SELECT IFNULL(field_value,0) FROM wl_form_instance_equip WHERE instance_id = wes.id AND field_name = 'maxLevel') = 0 ), 1, (SELECT IFNULL(field_value,0) FROM wl_form_instance_equip WHERE instance_id = wes.id AND field_name = 'maxLevel') )
)
) * 100
)) AS abs
FROM
wl_equipment_specific wes
JOIN f_equipment_fire_equipment fire ON wes.id = fire.fire_equipment_id
WHERE wes.equipment_code LIKE concat('920319' , '%')
AND wes.biz_org_code LIKE CONCAT( #{bizOrgCode}, '%' )
</select>
</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