Commit 85a2391c authored by litengwei's avatar litengwei

Merge remote-tracking branch 'origin/develop_dl_plan6' into develop_dl_plan6

parents a787c647 4c1793e0
package com.yeejoin.amos.boot.module.common.api.dto;
import lombok.Data;
import java.util.List;
import java.util.Map;
@Data
public class BigScreen1VO {
private Map<String, Object> firefightersInfo;
private Integer teamNum;
}
......@@ -42,4 +42,8 @@ public interface FirefightersMapper extends BaseMapper<Firefighters> {
List<Firefighters> getPersonByCodes(@Param("list") List<String> list);
List<OrgUsrFireExcelDto> exportToExcelNew(Boolean isDelete, String name, String postQualification, String fireTeamId, String state, String areasExpertise, String jobTitle, String bizOrgCode);
Integer getTeamCountByCode(@Param("companyCode") String companyCode);
Map<String, Object> getFireForceInfoByCode(@Param("companyCode") String companyCode);
}
......@@ -4,10 +4,7 @@ import java.util.List;
import java.util.Map;
import com.yeejoin.amos.boot.biz.common.utils.Menu;
import com.yeejoin.amos.boot.module.common.api.dto.FirefightersDto;
import com.yeejoin.amos.boot.module.common.api.dto.FirefightersInfoDto;
import com.yeejoin.amos.boot.module.common.api.dto.FirefightersZhDto;
import com.yeejoin.amos.boot.module.common.api.dto.PeopleInfoDto;
import com.yeejoin.amos.boot.module.common.api.dto.*;
import com.yeejoin.amos.boot.module.common.api.entity.Firefighters;
......@@ -37,4 +34,6 @@ public interface IFirefightersService {
Firefighters getFirefightersByUserId(String sequenceNbr);
void saveFirefightersByUser(PeopleInfoDto firefighters);
BigScreen1VO getFireForceInfoByCode(String companyCode);
}
......@@ -451,4 +451,56 @@ LEFT JOIN cb_fire_team cft ON cff.fire_team_id = cft.sequence_nbr
<if test='jobTitle!=null'>and f.job_title_code = #{jobTitle}</if>
<if test='bizOrgCode!=null'>and f.biz_org_code like concat ('%',#{bizOrgCode},'%') </if>
</select>
<select id="getTeamCountByCode" resultType="java.lang.Integer">
SELECT
count( cft.sequence_nbr ) as teamNum
FROM
cb_fire_team cft
LEFT JOIN cb_org_usr ou ON ou.biz_org_code = cft.biz_org_code
WHERE
cft.is_delete = 0
<if test="companyCode != null and companyCode != ''">
AND ou.`code` = #{companyCode}
</if>
</select>
<select id="getFireForceInfoByCode" resultType="java.util.Map">
SELECT
b.*,
( b.firefightersNum - b.fireCer ) AS unfireCer,
( b.opertNum - b.operCer ) AS unoperCer,
TRUNCATE ( abs(( b.fireCer ) / IF (( b.firefightersNum ) = 0, 1, b.firefightersNum )), 2 ) * 100 AS fireAbs,
TRUNCATE ( abs(( b.operCer ) / IF (( b.opertNum ) = 0, 1, b.opertNum )), 2 ) * 100 AS operAbs
FROM
(
SELECT
count( a.is_firefighters = 1 OR NULL ) AS firefightersNum,
count( a.is_firefighters = 0 OR NULL ) AS opertNum,
COUNT(( a.is_firefighters = 1 AND a.certificate_type IS NOT NULL ) OR NULL ) AS fireCer,
COUNT(( a.is_firefighters = 0 AND a.certificate_type IS NOT NULL ) OR NULL ) AS operCer
FROM
(
SELECT
u.sequence_nbr,
cfp.fire_management_post,
( CASE WHEN cf.fire_team_id IS NULL THEN 0 ELSE 1 END ) AS is_firefighters,
cfp.certificate_type
FROM
cb_org_usr u
LEFT JOIN cb_firefighters_post cfp ON cfp.org_usr_id = u.sequence_nbr
AND cfp.is_delete = 0
LEFT JOIN cb_firefighters cf ON cf.org_usr_id = u.sequence_nbr
AND cf.is_delete = 0
WHERE
u.is_delete = 0
AND u.biz_org_type = 'PERSON'
<if test="companyCode != null and companyCode != ''">
AND u.`code` = #{companyCode}
</if>
GROUP BY
u.sequence_nbr
) a
) b
</select>
</mapper>
package com.yeejoin.equipmanage.common.vo;
import lombok.Data;
import java.util.Map;
@Data
public class BigScreenVo {
private Map<String, Object> systemAlarmInfoNum;
private Map<String, Object> pool;
private Map<String, Object> industryPool;
private Integer carNum;
}
......@@ -273,4 +273,14 @@ public class FirefightersServiceImpl extends BaseService<FirefightersDto, Firefi
}
return personGenderMap;
}
@Override
public BigScreen1VO getFireForceInfoByCode(String companyCode) {
BigScreen1VO bigScreen1VO = new BigScreen1VO();
Integer teamCount = firefightersMapper.getTeamCountByCode(companyCode);
Map<String, Object> fireForceInfoByCode = firefightersMapper.getFireForceInfoByCode(companyCode);
bigScreen1VO.setTeamNum(teamCount);
bigScreen1VO.setFirefightersInfo(fireForceInfoByCode);
return bigScreen1VO;
}
}
package com.yeejoin.equipmanage.controller;
import com.yeejoin.equipmanage.common.utils.CommonResponseUtil;
import com.yeejoin.equipmanage.common.vo.BigScreenVo;
import com.yeejoin.equipmanage.service.IFireFightingSystemService;
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.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 org.typroject.tyboot.core.restful.utils.ResponseModel;
@RestController
@Api(tags = "一张图大屏API")
@RequestMapping(value = "/bigScreen", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public class BigScreenController {
@Autowired
private IFireFightingSystemService iFireFightingSystemService;
@GetMapping(value = "/list")
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "系统、消防水池、工业水池、水源总容积、消防车辆", notes = "系统、消防水池、工业水池、水源总容积、消防车辆")
public ResponseModel<BigScreenVo> getSystemAlarmInfoNum(@RequestParam(required = false, value = "companyCode") String companyCode) {
return CommonResponseUtil.success(iFireFightingSystemService.getSystemAlarmInfoNum(companyCode));
}
}
......@@ -371,4 +371,32 @@ public interface FireFightingSystemMapper extends BaseMapper<FireFightingSystemE
* @return
*/
List<EquipmentExportVO> exportEquipmentList(@Param("dto") EquipTypeAmountPageDTO dto);
/**
* 获取系统告警信息
* @param companyCode
* @return
*/
Map<String, Object> getSystemAlarmInfoNum(@Param("companyCode") String companyCode);
/**
* 消防水池或者工业水池信息
* @param companyCode
* @return
*/
Map<String, Object> getWaterPoolInfoNum(@Param("companyCode") String companyCode, @Param("poolType") String poolType);
/**
* 消防水源总量统计
* @param companyCode
* @return
*/
Map<String, Object> getWaterPoolVolumeInfo(@Param("companyCode") String companyCode);
/**
* 获取车辆总数
* @param companyCode
* @return
*/
Integer getCarNum(@Param("companyCode") String companyCode);
}
......@@ -17,13 +17,7 @@ import com.yeejoin.equipmanage.common.entity.vo.EquipTypeImgAmountVO;
import com.yeejoin.equipmanage.common.entity.vo.EquiplistSpecificBySystemVO;
import com.yeejoin.equipmanage.common.entity.vo.EquipmentAlarmBySystemIdOrSourceIdVO;
import com.yeejoin.equipmanage.common.entity.vo.PointTreeVo;
import com.yeejoin.equipmanage.common.vo.AlarmDataVO;
import com.yeejoin.equipmanage.common.vo.EquipmentManageVo;
import com.yeejoin.equipmanage.common.vo.FireFightingSystem3dVo;
import com.yeejoin.equipmanage.common.vo.FireFightingSystemTreeVo;
import com.yeejoin.equipmanage.common.vo.FireFightingSystemTypeTreeVo;
import com.yeejoin.equipmanage.common.vo.FireFightingSystemVo;
import com.yeejoin.equipmanage.common.vo.SpeIndexVo;
import com.yeejoin.equipmanage.common.vo.*;
public interface IFireFightingSystemService extends IService<FireFightingSystemEntity> {
......@@ -254,4 +248,11 @@ public interface IFireFightingSystemService extends IService<FireFightingSystemE
Page<Map<String, Object>> equipmentState(Page result, HashMap<String, Object> hashMap);
/**
* 获取系统告警数量等信息
* @param companyCode
* @return
*/
BigScreenVo getSystemAlarmInfoNum(String companyCode);
}
......@@ -1322,4 +1322,17 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
return fireFightingSystemMapper.getWaterInfo(page, bizOrgCode, systemCode);
}
@Override
public BigScreenVo getSystemAlarmInfoNum(String companyCode) {
BigScreenVo bigScreenVo = new BigScreenVo();
Map<String, Object> systemAlarmInfoNum = fireFightingSystemMapper.getSystemAlarmInfoNum(companyCode);
bigScreenVo.setSystemAlarmInfoNum(systemAlarmInfoNum);
Map<String, Object> pool = fireFightingSystemMapper.getWaterPoolInfoNum(companyCode, "pool");
bigScreenVo.setPool(pool);
Map<String, Object> industryPool = fireFightingSystemMapper.getWaterPoolInfoNum(companyCode, "industryPool");
bigScreenVo.setIndustryPool(industryPool);
Integer carNum = fireFightingSystemMapper.getCarNum(companyCode);
bigScreenVo.setCarNum(carNum);
return bigScreenVo;
}
}
package com.yeejoin.amos.boot.module.jcs.biz.controller;
import com.yeejoin.amos.boot.module.common.api.service.IFirefightersService;
import com.yeejoin.amos.boot.module.common.biz.utils.CommonResponseUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
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 org.typroject.tyboot.core.restful.utils.ResponseModel;
@RestController
@Api(tags = "一张图大屏Api")
@RequestMapping(value = "/bigScreen")
public class BigScreenController {
@Autowired
private IFirefightersService iFirefightersService;
@GetMapping(value = "/getFireForceInfoByCode")
@TycloudOperation(ApiLevel = UserType.AGENCY)
@ApiOperation(httpMethod = "GET", value = "消防车、消防力量信息(专职消防队、运维人员)", notes = "消防车、消防力量信息(专职消防队、运维人员)")
public ResponseModel getFireForceInfoByCode(@RequestParam(required = false, value = "companyCode") String companyCode) {
return CommonResponseUtil.success(iFirefightersService.getFireForceInfoByCode(companyCode));
}
}
......@@ -2654,4 +2654,146 @@
</select>
<select id="getSystemAlarmInfoNum" resultType="java.util.Map">
SELECT
count( a.alarmNum > 0 OR NULL ) AS exceptionNum,
count( a.id ) AS totalSystemNum,
(
count( a.id ) - count( a.alarmNum &gt; 0 OR NULL )) AS normalNum,
(
TRUNCATE (
abs(((
count( a.id ) - count( a.alarmNum > 0 OR NULL )) /
IF
(( count( a.id ) = 0 ), 1, count( a.id ) ))),
2
) * 100
) AS normalAbs
FROM
(
SELECT
fs.id,
IFNULL( sum( esa.`status` ), 0 ) AS alarmNum
FROM
f_fire_fighting_system fs
LEFT JOIN cb_org_usr ou ON ou.biz_org_code = fs.biz_org_code
LEFT JOIN wl_equipment_specific_alarm esa ON FIND_IN_SET( fs.id, esa.system_ids )
<where>
<if test="companyCode != null and companyCode != ''">
ou.`code` = #{companyCode}
</if>
</where>
GROUP BY
fs.id
) a
</select>
<select id="getWaterPoolInfoNum" resultType="java.util.Map">
SELECT
count( 1 ) AS totalNum,
count( a.nowLevel &lt; a.minLevel OR NULL ) AS abnomalNum,
count( a.nowLevel &gt;= a.minLevel OR NULL ) AS nomalNum,
(
TRUNCATE (
abs(((
count( a.nowLevel &gt;= a.minLevel OR NULL )) /
IF
(( count( 1 ) = 0 ), 1, count( 1 ) ))),
2
) * 100
) AS normalAbs
FROM
(
SELECT
`ou`.`code` AS `code`,
ifnull( `rp`.`min_water_level`, 0 ) AS `minLevel`,
ifnull( `rp`.`max_water_level`, 0 ) AS `maxLevel`,
ifnull(
max((
CASE
WHEN ( `ei`.`name_key` = 'FHS_WirelessliquidDetector_WaterLevel' ) THEN
`ei`.`perf_value`
END
)),
ifnull( `rp`.`min_water_level`, 0 )) AS `nowLevel`
FROM
`cb_water_resource` `r`
LEFT JOIN `cb_org_usr` `ou` ON `ou`.`biz_org_code` = `r`.`biz_org_code`
LEFT JOIN `cb_water_resource_pool` `rp` ON `rp`.`resource_id` = `r`.`sequence_nbr`
LEFT JOIN `wl_equipment_specific` `es` ON `es`.`id` = `rp`.`level_device_id`
LEFT JOIN `wl_equipment_detail` `ed` ON `ed`.`id` = `es`.`equipment_detail_id`
LEFT JOIN `wl_equipment_index` `ei` ON `ei`.`equipment_id` = `ed`.`equipment_id`
WHERE
`r`.`is_delete` = 1
AND `ou`.`code` IS NOT NULL
<if test="companyCode != null and companyCode != ''">
AND ou.`code` = #{companyCode}
</if>
AND `r`.`resource_type` = #{poolType}
GROUP BY
`r`.`sequence_nbr`
) a
</select>
<select id="getWaterPoolVolumeInfo" resultType="java.util.Map">
SELECT
IFNULL( sum( a.margin ), 0 ) AS margin,
IFNULL( sum( volume ), 0 ) AS volume
FROM
(
SELECT
`ou`.`code` AS `code`,
ifnull((
abs((
ifnull(
max((
CASE
WHEN ( `ei`.`name_key` = 'FHS_WirelessliquidDetector_WaterLevel' ) THEN
`ei`.`perf_value`
END
)),
ifnull( `rp`.`min_water_level`, 0 )) /
IF
((
ifnull( `rp`.`max_water_level`, 0 ) = 0
),
1,
ifnull( `rp`.`max_water_level`, 0 )))) * ifnull( `rp`.`volume`, 0 )),
0
) AS `margin`,
ifnull( `rp`.`volume`, 0 ) AS `volume`
FROM
`cb_water_resource` `r`
LEFT JOIN `cb_org_usr` `ou` ON `ou`.`biz_org_code` = `r`.`biz_org_code`
LEFT JOIN `cb_water_resource_pool` `rp` ON `rp`.`resource_id` = `r`.`sequence_nbr`
LEFT JOIN `wl_equipment_specific` `es` ON `es`.`id` = `rp`.`level_device_id`
LEFT JOIN `wl_equipment_detail` `ed` ON `ed`.`id` = `es`.`equipment_detail_id`
LEFT JOIN `wl_equipment_index` `ei` ON `ei`.`equipment_id` = `ed`.`equipment_id`
WHERE
`r`.`resource_type` IN ( 'pool', 'industryPool' )
AND `r`.`is_delete` = 1
AND `ou`.`code` IS NOT NULL
<if test="companyCode != null and companyCode != ''">
AND ou.`code` = #{companyCode}
</if>
GROUP BY
`r`.`sequence_nbr`
) a
</select>
<select id="getCarNum" resultType="java.lang.Integer">
SELECT
count( wc.id ) as carNum
FROM
wl_car wc
LEFT JOIN cb_org_usr ou ON ou.amos_org_code = wc.org_code
<where>
<if test="companyCode != null and companyCode != ''">
ou.`code` = #{companyCode}
</if>
</where>
</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