Commit 9e1f6b59 authored by lisong's avatar lisong

添加物联报表--月分析报表生成pdf接口

parent 0852cbf5
...@@ -12,7 +12,10 @@ public enum WordTemplateTypeEum { ...@@ -12,7 +12,10 @@ public enum WordTemplateTypeEum {
*/ */
resume("简历","jianli.ftl"), resume("简历","jianli.ftl"),
firePatrolReport("消防巡查报表","FirePatrolReport.ftl"), firePatrolReport("消防巡查报表","FirePatrolReport.ftl"),
fireAutoSysManageReport("消防自动化综合管理报表","fireAutoSysManageReport.ftl"); fireAutoSysManageReport("消防自动化综合管理报表","fireAutoSysManageReport.ftl"),
iotMonthReport("物联报表-月分析报表","iotMonthReport.ftl");
private String label; private String label;
......
...@@ -634,4 +634,25 @@ public class ConfigureController extends AbstractBaseController { ...@@ -634,4 +634,25 @@ public class ConfigureController extends AbstractBaseController {
} }
@PersonIdentify
@TycloudOperation(ApiLevel = UserType.AGENCY)
@GetMapping(value = "/iotMonthReport")
@ApiOperation(httpMethod = "GET", value = "物联报表-月", notes = "物联报表-月")
public ResponseModel equipList(@RequestParam(value = "bizOrgCode", required = false) String bizOrgCode,
@RequestParam(value = "startDate") String startDate,
@RequestParam(value = "endDate") String endDate) {
if (ObjectUtils.isEmpty(bizOrgCode)) {
ReginParams reginParams = getSelectedOrgInfo();
ReginParams.PersonIdentity personIdentity = reginParams.getPersonIdentity();
if (!ValidationUtil.isEmpty(personIdentity)) {
bizOrgCode = personIdentity.getBizOrgCode();
}
}
if (ObjectUtils.isEmpty(bizOrgCode)){
return CommonResponseUtil.success(null);
}
return CommonResponseUtil.success(iFireFightingSystemService.iotMonthReport(bizOrgCode, startDate, endDate));
}
} }
...@@ -468,4 +468,17 @@ public interface FireFightingSystemMapper extends BaseMapper<FireFightingSystemE ...@@ -468,4 +468,17 @@ public interface FireFightingSystemMapper extends BaseMapper<FireFightingSystemE
String queryByCompanyCode(@Param("companyCode") String companyCode); String queryByCompanyCode(@Param("companyCode") String companyCode);
List<Map<String, Object>> selectSystemByBizOrgCode(@Param("bizOrgCode") String bizOrgCode);
List<Map<String, Object>> selectAlarmList(@Param("bizOrgCode") String bizOrgCode, @Param("month")String month, @Param("systemId") String systemId);
Map<String, Object> selectMonthSummarize(@Param("month")String month, @Param("systemId") String systemId);
List<Map<String, Object>> selectMonthPieChart(@Param("systemCode")String month, @Param("startDate") String startDate, @Param("endDate") String endDate);
List<Map<String, Object>> selectMonthPieChartTwo(@Param("systemCode") String sysCode, @Param("startDate") String startDate, @Param("endDate") String endDate, @Param("indicator") List<String> indicator);
List<Map<String, Object>> selectMonthPolyline(@Param("systemCode") String sysCode, @Param("startDate") String startDate, @Param("endDate") String endDate, @Param("indicator") List<String> indicator);
} }
...@@ -273,4 +273,7 @@ public interface IFireFightingSystemService extends IService<FireFightingSystemE ...@@ -273,4 +273,7 @@ public interface IFireFightingSystemService extends IService<FireFightingSystemE
BigScreenVo getSystemAlarmInfoNum(String companyCode); BigScreenVo getSystemAlarmInfoNum(String companyCode);
BigScreenVo getCarInfo(String companyCode); BigScreenVo getCarInfo(String companyCode);
String iotMonthReport(String bizOrgCode, String startDate, String endDate);
} }
This source diff could not be displayed because it is too large. You can view the blob instead.
[
{
"code": "92040000",
"index": "FireAlarm,Fault,Shield"
},
{
"code": "92990000",
"index": "FireAlarm,Fault,Shield"
}
]
\ No newline at end of file
...@@ -3520,4 +3520,174 @@ ...@@ -3520,4 +3520,174 @@
AND code = #{companyCode} AND code = #{companyCode}
</if> </if>
</select> </select>
<select id="selectSystemByBizOrgCode" resultType="java.util.Map">
SELECT ffs.id,ffs.`code`,ffs.system_type as type,ffs.biz_org_name as stationName, ffs.name,wec.code AS typeCode
FROM `f_fire_fighting_system` ffs
LEFT JOIN wl_equipment_category wec
on ffs.system_type = wec.id
WHERE biz_org_code = #{bizOrgCode}
</select>
<select id="selectAlarmList" resultType="java.util.Map">
select
a1.*,
(a1.num - a1.alarm_equip_num) as normalEquipNum,
if(a1.num > 0 , concat(ROUND((a1.num - a1.alarm_equip_num)/a1.num,2)*100,'%'), '-') as normalEquipPercent,
if(a1.num > 0 , concat(ROUND(a1.fault_equip_num/a1.num,2)*100,'%'), '-') as faultEquipPercent,
if(a1.num > 0 , concat(ROUND(a1.alarm_equip_num/a1.num,2)*100,'%'), '-') as alarmEquipPercent
from
wl_analysis_report_month a1
where
a1.report_month = #{month} and system_id = #{systemId}
</select>
<select id="selectMonthSummarize" resultType="java.util.Map">
SELECT
rs.system_id,
rs.summary_info,
rs.report_date,
rs.report_type
FROM
`wl_analysis_report_summary` rs
where
rs.report_date like concat(#{month},'%')
and rs.report_type = 3
and system_id = #{systemId}
</select>
<select id="selectMonthPieChart" resultType="java.util.Map">
SELECT
`name` as `type`,
(SELECT count(distinct equipment_specific_id)
FROM wl_equipment_alarm_report_day report
where report.equipment_code = a.code and FIND_IN_SET(a.system_id,report.system_ids)
and report.index_type LIKE CONCAT('%','Fault')
and report.index_true_num >0
and report.report_date BETWEEN #{startDate}
and #{endDate}
) as `value`
FROM(
SELECT
s.id as system_id,
equipment.code,
equipment.name
FROM
wl_equipment_specific spec
LEFT JOIN wl_equipment_detail detail ON spec.equipment_detail_id = detail.id
LEFT JOIN wl_equipment equipment ON equipment.id =detail.equipment_id
left join f_fire_fighting_system s on FIND_IN_SET(s.id,spec.system_id)
where spec.system_id is not null
AND s.code = #{systemCode}
GROUP BY code,s.id, name ORDER BY system_id, code ) a
</select>
<select id="selectMonthPieChartTwo" resultType="java.util.Map">
SELECT
ss.alarm_type_name as type,
SUM(index_true_num) as value
from
(
SELECT
rep.alarm_type,
rep.alarm_type_name,
rep.index_true_num
FROM
wl_equipment_alarm_report_day rep,
(
SELECT
s.id as system_id,
equipment.code,
equipment.name
FROM
wl_equipment_specific spec
LEFT JOIN wl_equipment_detail detail ON spec.equipment_detail_id = detail.id
LEFT JOIN wl_equipment equipment ON equipment.id =detail.equipment_id
left join f_fire_fighting_system s on FIND_IN_SET(s.id,spec.system_id)
where spec.system_id is not null
and s.code = #{systemCode}
GROUP BY s.id, code, name ORDER BY s.id, code
) a
where rep.equipment_code = a.code and FIND_IN_SET(a.system_id,rep.system_ids)
<foreach collection="indicator" item="index" open="AND(" separator="or" close=")">
rep.index_type like concat ('%', #{index})
</foreach>
and rep.index_true_num >0
and rep.alarm_type is not null
and rep.report_date BETWEEN #{startDate}
and #{endDate}
) ss
GROUP BY ss.alarm_type_name
</select>
<select id="selectMonthPolyline" resultType="java.util.Map">
SELECT * FROM (
SELECT A.name as title, A.date as x, IFNULL(B.num,0) AS y from
(
SELECT * from (
SELECT
DATE( DATE_ADD(#{startDate}, INTERVAL @s DAY ) ) AS date,
'报警总条数' as name,
@s := @s + 1 AS `index`
FROM
mysql.help_topic,
( SELECT @s := 0 ) temp ) s1
WHERE
s1.`index` &lt;= DATEDIFF(#{endDate},#{startDate})
) A
LEFT JOIN (
SELECT
SUM( report.index_true_num ) AS num,
report.report_date AS reportDate
FROM
wl_equipment_alarm_report_day report
LEFT JOIN f_fire_fighting_system s ON FIND_IN_SET( s.id, report.system_ids)
WHERE report.system_ids is not null
<foreach collection="indicator" item="index" open="AND(" separator="or" close=")">
report.index_type like concat ('%', #{index})
</foreach>
and s.code = #{systemCode}
GROUP BY
report.report_date,
s.id
) B on B.reportDate = A.date
UNION all
SELECT A.name, A.date , IFNULL(B.num,0) AS num from
(
select * from (
SELECT
DATE( DATE_ADD( #{startDate}, INTERVAL @s2 DAY ) ) AS date,
'报警设备总数' as name,
@s2 := @s2 + 1 AS `index`
FROM
mysql.help_topic,
( SELECT @s2 := 0 ) temp ) s1
WHERE
s1.`index` &lt;= DATEDIFF(#{endDate},#{startDate})
) A
LEFT JOIN (
SELECT
COUNT( distinct(report.equipment_specific_id)) AS num,
report.report_date AS reportDate
FROM
wl_equipment_alarm_report_day report
LEFT JOIN f_fire_fighting_system s ON FIND_IN_SET( s.id, report.system_ids)
WHERE
report.system_ids is not null
and s.code = #{systemCode}
and report.index_true_num >0
<foreach collection="indicator" item="index" open="AND(" separator="or" close=")">
report.index_type like concat ('%', #{index})
</foreach>
GROUP BY
report.report_date,
s.id
) B on B.reportDate = A.date ) C
ORDER BY title,x
</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