Commit fa5ab702 authored by wujiang's avatar wujiang

提交报表代码

parent af7ac8fb
package com.yeejoin.equipmanage.mapper;
import java.util.Date;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.annotations.Param;
......@@ -19,8 +20,11 @@ import com.yeejoin.equipmanage.common.entity.AnalysisReportLog;
*/
public interface AnalysisReportLogMapper extends BaseMapper<AnalysisReportLog> {
IPage<AnalysisReportLogDto> allPage(Page<AnalysisReportLogDto> page, @Param("analysisReportLog")AnalysisReportLog analysisReportLog);
IPage<AnalysisReportLogDto> allPage(Page<AnalysisReportLogDto> page, @Param("analysisReportLog")AnalysisReportLogDto analysisReportLog);
Map<String,Object> getStation(String stationCode);
Map<String, Object> getReport(@Param("analysisReportLog")AnalysisReportLogDto analysisReportLog);
List<Map<String, Object>> getDefect(@Param("analysisReportLog")AnalysisReportLogDto analysisReportLog);
}
......@@ -7,6 +7,8 @@ import java.awt.image.BufferedImage;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.math.BigDecimal;
import java.text.NumberFormat;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
......@@ -45,6 +47,7 @@ import com.github.xiaoymin.knife4j.core.util.StrUtil;
import com.yeejoin.amos.component.feign.model.FeignClientResult;
import com.yeejoin.amos.feign.systemctl.Systemctl;
import com.yeejoin.equipmanage.common.dto.AnalysisReportLogDto;
import com.yeejoin.equipmanage.common.entity.AnalysisReportLog;
import com.yeejoin.equipmanage.common.entity.MyByteArrayMultipartFile;
import com.yeejoin.equipmanage.common.enums.WordTemplateTypeEum;
import com.yeejoin.equipmanage.common.exception.BaseException;
......@@ -82,6 +85,11 @@ public class FilePatrolReportServiceImpl implements IFirePatrolReportService {
{
throw new BaseException("换流站编码不存在");
}
AnalysisReportLogDto analysisReportLog = new AnalysisReportLogDto();
analysisReportLog.setStationCode(code);
analysisReportLog.setStartDate(startDate);
analysisReportLog.setEndDate(endDate);
Map<String, Object> report = analysisReportLogMapper.getReport(analysisReportLog);
// 文档编号
String timeStr1 = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss"));
String documentNumber = "ZD-XFSBXC" + timeStr1;
......@@ -101,62 +109,105 @@ public class FilePatrolReportServiceImpl implements IFirePatrolReportService {
if (timeStr2.contains("年0")) {
timeStr2 = timeStr2.replaceAll("年0", "年");
}
NumberFormat nf = NumberFormat.getNumberInstance();
nf.setMaximumFractionDigits(0);
SimpleDateFormat dateFm = new SimpleDateFormat("EEEE");
String currSun = dateFm.format(new Date());
map.put("create_date", timeStr2 + currSun);
map.put("create_date2", timeStr2);
// 统计时间2
map.put("statistical_time2", statisticalTime.replaceAll("-", "至"));
// 合格数
int qualified = 0;
// 未合格数
int no_qualified = 0;
// 巡查任务数
map.put("task_count", "10");
int task_count = ((BigDecimal) report.get("task_count")).intValue();
map.put("task_count", task_count);
// 完成任务数
map.put("complete_task_count", "5");
int uncomplete_task_count = 2;
int complete_task_count = ((BigDecimal) report.get("complete_task_count")).intValue();
map.put("complete_task_count", complete_task_count);
int uncomplete_task_count = task_count - complete_task_count;
// 未完成任务数
map.put("uncomplete_task_count", uncomplete_task_count);
double complete_task_percent = 0.4;
double complete_task_percent = (complete_task_count/task_count)*100;
// 任务完成率
map.put("complete_task_percent", "40%");
map.put("complete_task_percent", nf.format(complete_task_percent)+"%");
// 任务合格
map.put("task_qualified", uncomplete_task_count!=0?"不合格":"合格");
if(uncomplete_task_count!=0)
{
no_qualified++;
}else
{
qualified++;
}
// 任务完成率合格
map.put("task_percent_qualified", complete_task_percent!=1?"不合格":"合格");
map.put("task_percent_qualified", complete_task_percent!=100?"不合格":"合格");
if(complete_task_percent!=100 )
{
no_qualified++;
}else
{
qualified++;
}
// 巡查人员数
map.put("person_count", "5");
int person_count = ((BigDecimal) report.get("person_count")).intValue();
map.put("person_count", person_count);
int certified_person_count = ((BigDecimal) report.get("certified_person_count")).intValue();
// 持证人员数
map.put("certified_person_count", "3");
double certified_percent = 0.6;
map.put("certified_person_count", certified_person_count);
double certified_percent = (certified_person_count/person_count)*100;
// 持证率
map.put("certified_percent", "60%");
map.put("certified_percent", nf.format(certified_percent)+"%");
// 人员合格
map.put("person_qualified", certified_percent!=1?"不合格":"合格");
map.put("person_qualified", certified_percent!=100?"不合格":"合格");
if(certified_percent!=100 )
{
no_qualified++;
}else
{
qualified++;
}
// 应巡查设备总数
int equipment_count = 12;
int equipment_count = ((BigDecimal) report.get("equipment_count")).intValue();
map.put("equipment_count", equipment_count);
int checked_equipment_count = 7;
int checked_equipment_count = ((BigDecimal) report.get("checked_equipment_count")).intValue();
// 实际巡查设备总数
map.put("checked_equipment_count", checked_equipment_count);
// 实际巡查设备总数-合格
map.put("checked_equipment_qualified", checked_equipment_count!=equipment_count?"不合格":"合格");
if(checked_equipment_count!=equipment_count )
{
no_qualified++;
}else
{
qualified++;
}
// 漏查设备总数
int unchecked_equipment_count = 5;
int unchecked_equipment_count = equipment_count- checked_equipment_count;
map.put("unchecked_equipment_count", unchecked_equipment_count);
// 漏查设备总数-合格
map.put("unchecked_equipment_qualified", unchecked_equipment_count>0?"不合格":"合格");
if(unchecked_equipment_count>0)
{
no_qualified++;
}else
{
qualified++;
}
// 发现问题总数
map.put("problem_count", "5");
int problem_count = ((BigDecimal) report.get("problem_count")).intValue();
map.put("problem_count", problem_count);
// 修复问题总数
map.put("fixed_problem_count", "3");
int fixed_problem_count = ((BigDecimal) report.get("fixed_problem_count")).intValue();
map.put("fixed_problem_count", fixed_problem_count);
// 未修复问题总数
map.put("unfixed_problem_count", "2");
int unfixed_problem_count = problem_count-fixed_problem_count;
map.put("unfixed_problem_count", unfixed_problem_count);
// 巡查点位数
map.put("checked_location_count", "2");
// 缺陷总数
map.put("defect_count", "2");
// 合格数
int qualified = 3;
// 未合格数
int no_qualified = 3;
int checked_point_count = ((BigDecimal) report.get("checked_point_count")).intValue();
map.put("checked_point_count", checked_point_count);
// 合格饼图
DefaultPieDataset pds = new DefaultPieDataset();
pds.setValue("合格", qualified);
......@@ -172,25 +223,33 @@ public class FilePatrolReportServiceImpl implements IFirePatrolReportService {
// 业务主题
map.put("business_title", "消防巡查");
// 缺陷清单
List<Map<String, Object>> defect_list = new ArrayList<>();
Map<String, Object> defectMap = new HashMap<>();
defectMap.put("defect_location", "主控楼一层");
defectMap.put("defect_description", "仅有一条疏散通道,存在重大火灾隐患,不满足规范要求。");
defectMap.put("rectified_progress", "待评审");
defectMap.put("remark", "无法整改");
defect_list.add(defectMap);
Map<String, Object> defectMap2 = new HashMap<>();
defectMap2.put("defect_location", "主控楼一层");
defectMap2.put("defect_description", "防火卷帘门故障;11个水泵接合器存在问题;");
defectMap2.put("rectified_progress", "待治理");
defectMap2.put("remark", "防火卷帘已完成维修,水泵接合器未整改");
defect_list.add(defectMap2);
Map<String, Object> defectMap3 = new HashMap<>();
defectMap3.put("defect_location", "主控楼一层库房区域");
defectMap3.put("defect_description", "将办公用房作为库房使用,使用性质与原设计不符,耐火等级和相应消防设施不满足规范要求。");
defectMap3.put("rectified_progress", "治理完毕");
defectMap3.put("remark", "");
defect_list.add(defectMap3);
List<Map<String, Object>> defect_list = analysisReportLogMapper.getDefect(analysisReportLog);
// 缺陷总数
map.put("defect_count", defect_list.size());
defect_list.forEach(i->{
i.put("defect_location", i.get("danger_position"));
i.put("defect_description", i.get("problem_description"));
i.put("rectified_progress", i.get("danger_state"));
i.put("remark", i.get("remark"));
});
// Map<String, Object> defectMap = new HashMap<>();
// defectMap.put("defect_location", "主控楼一层");
// defectMap.put("defect_description", "仅有一条疏散通道,存在重大火灾隐患,不满足规范要求。");
// defectMap.put("rectified_progress", "待评审");
// defectMap.put("remark", "无法整改");
// defect_list.add(defectMap);
// Map<String, Object> defectMap2 = new HashMap<>();
// defectMap2.put("defect_location", "主控楼一层");
// defectMap2.put("defect_description", "防火卷帘门故障;11个水泵接合器存在问题;");
// defectMap2.put("rectified_progress", "待治理");
// defectMap2.put("remark", "防火卷帘已完成维修,水泵接合器未整改");
// defect_list.add(defectMap2);
// Map<String, Object> defectMap3 = new HashMap<>();
// defectMap3.put("defect_location", "主控楼一层库房区域");
// defectMap3.put("defect_description", "将办公用房作为库房使用,使用性质与原设计不符,耐火等级和相应消防设施不满足规范要求。");
// defectMap3.put("rectified_progress", "治理完毕");
// defectMap3.put("remark", "");
// defect_list.add(defectMap3);
map.put("defect_list", defect_list);
return map;
}
......
......@@ -2,7 +2,7 @@ spring.application.name=AMOS-EQUIPMANAGE-WJ
server.servlet.context-path=/equip
server.port=8100
#server.servlet.context-path=/case
spring.profiles.active=dev
spring.profiles.active=dev2
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
#mybatis mapper file
mybatis.mapper-locations=classpath:mapper/*.xml
......
......@@ -2858,8 +2858,73 @@
`code` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '唯一编号 : 临时用',
`pcz_code` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '测试字段 稍后删除',
`pcz_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci DEFAULT NULL COMMENT '测试字段 稍后删除',
`is_certificate` int(10) DEFAULT 0 COMMENT '是否持证',
PRIMARY KEY (`sequence_nbr`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='机构/部门/人员表';
</sql>
</changeSet>
<changeSet author="wujiang" id="2022-05-011-1" runAlways="true">
<preConditions onFail="MARK_RAN">
<not>
<tableExists tableName="idx_width_report"/>
</not>
</preConditions>
<comment>add idx_width_report</comment>
<sql>
CREATE TABLE `idx_width_report` (
`id` varchar(50) NOT NULL,
`valid` bit(1) DEFAULT NULL,
`record` varchar(50) DEFAULT NULL,
`creator` varchar(64) DEFAULT NULL,
`creatorName` varchar(64) DEFAULT NULL,
`biz_org_code` varchar(32) DEFAULT NULL,
`biz_org_name` varchar(255) DEFAULT NULL,
`complete_task_percent` double DEFAULT NULL,
`task_count` int(11) DEFAULT NULL,
`complete_task_count` int(11) DEFAULT NULL,
`uncomplete_task_count` int(11) DEFAULT NULL,
`date` varchar(32) DEFAULT NULL,
`problem_count` int(11) DEFAULT NULL,
`fixed_problem_count` int(11) DEFAULT NULL,
`unfixed_problem_count` int(11) DEFAULT NULL,
`checked_equipment_count` int(11) DEFAULT NULL,
`equipment_count` int(11) DEFAULT NULL,
`unchecked_equipment_count` int(11) DEFAULT NULL,
`certified_percent` double DEFAULT NULL,
`person_count` int(11) DEFAULT NULL,
`certified_person_count` int(11) DEFAULT NULL,
`checked_point_count` int(11) DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
</sql>
</changeSet>
<changeSet author="wujiang" id="2022-05-011-2" runAlways="true">
<preConditions onFail="MARK_RAN">
<not>
<tableExists tableName="idx_width_defect"/>
</not>
</preConditions>
<comment>add idx_width_defect</comment>
<sql>
CREATE TABLE `idx_width_defect` (
`id` varchar(50) NOT NULL,
`valid` bit(1) DEFAULT NULL,
`record` varchar(50) DEFAULT NULL,
`creator` varchar(64) DEFAULT NULL,
`creatorName` varchar(64) DEFAULT NULL,
`biz_org_name` varchar(255) DEFAULT NULL,
`biz_org_code` varchar(255) DEFAULT NULL,
`org_code` varchar(255) DEFAULT NULL,
`defect_name` varchar(255) DEFAULT NULL,
`date` varchar(255) DEFAULT NULL,
`danger_position` varchar(255) NOT NULL,
`problem_description` varchar(255) NOT NULL,
`remark` varchar(255) NOT NULL,
`danger_state` varchar(255) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
</sql>
</changeSet>
</databaseChangeLog>
\ No newline at end of file
......@@ -1004,7 +1004,7 @@
<w:sz-cs w:val="30"/>
<w:lang w:val="EN-US" w:fareast="ZH-CN" w:bidi="AR-SA"/>
</w:rPr>
<w:t>${(statistical_time2)!'XXXX年XX月XX日-XXXX年XX月XX日'}消防设施巡查,巡查任务数${(task_count)!'X'}个,完成 ${(complete_task_count)!'X'}个;巡查人员 ${(person_count)!'X'}人,持证人数${(certified_person_count)!'X'}人;应巡查设备设施${(equipment_count)!'X'}台,完成巡查${(checked_equipment_count)!'X'}台,巡查点位${(checked_location_count)!'X'};</w:t>
<w:t>${(statistical_time2)!'XXXX年XX月XX日-XXXX年XX月XX日'}消防设施巡查,巡查任务数${(task_count)!'X'}个,完成 ${(complete_task_count)!'X'}个;巡查人员 ${(person_count)!'X'}人,持证人数${(certified_person_count)!'X'}人;应巡查设备设施${(equipment_count)!'X'}台,完成巡查${(checked_equipment_count)!'X'}台,巡查点位${(checked_point_count)!'X'};</w:t>
</w:r>
</w:p>
<w:p>
......@@ -2222,7 +2222,7 @@
<w:sz-cs w:val="20"/>
<w:lang w:val="EN-US" w:fareast="ZH-CN" w:bidi="AR-SA"/>
</w:rPr>
<w:t>2</w:t>
<w:t>${(certified_person_count)!'XX'}</w:t>
</w:r>
</w:p>
</w:tc>
......
......@@ -36,4 +36,54 @@
<select id="getStation" resultType="Map">
SELECT * FROM cb_org_usr WHERE biz_org_code = #{stationCode}
</select>
<select id="getReport" resultType="Map">
SELECT
IFNULL(SUM( task_count ),0) AS task_count,
IFNULL(SUM( complete_task_count ),0) AS complete_task_count,
IFNULL(SUM( uncomplete_task_count ),0) AS uncomplete_task_count,
IFNULL(SUM( problem_count ),0) AS problem_count,
IFNULL(SUM( fixed_problem_count ),0) AS fixed_problem_count,
IFNULL(SUM( unfixed_problem_count ),0) AS unfixed_problem_count,
IFNULL(SUM( checked_equipment_count ),0) AS checked_equipment_count,
IFNULL(SUM( equipment_count ),0) AS equipment_count,
IFNULL(SUM( unchecked_equipment_count ),0) AS unchecked_equipment_count,
IFNULL(SUM( person_count ),0) AS person_count,
IFNULL(SUM( checked_point_count ),0) AS checked_point_count,
IFNULL(SUM( certified_person_count ),0) AS certified_person_count,
biz_org_name
FROM
idx_width_report
<where>
<if test="analysisReportLog.startDate != null">
AND DATE_FORMAT(idx_width_report.date, '%Y-%m-%d') &gt;= DATE_FORMAT(#{analysisReportLog.startDate}, '%Y-%m-%d')
</if>
<if test="analysisReportLog.endDate != null">
AND DATE_FORMAT(idx_width_report.date, '%Y-%m-%d') &lt;= DATE_FORMAT(#{analysisReportLog.endDate}, '%Y-%m-%d')
</if>
<if test="analysisReportLog.stationCode != null">
AND idx_width_report.biz_org_code = #{analysisReportLog.stationCode}
</if>
</where>
LIMIT 1
</select>
<select id="getDefect" resultType="Map">
SELECT
*
FROM
idx_width_defect
<where>
<if test="analysisReportLog.startDate != null">
AND DATE_FORMAT(idx_width_defect.date, '%Y-%m-%d') &gt;= DATE_FORMAT(#{analysisReportLog.startDate}, '%Y-%m-%d')
</if>
<if test="analysisReportLog.endDate != null">
AND DATE_FORMAT(idx_width_defect.date, '%Y-%m-%d') &lt;= DATE_FORMAT(#{analysisReportLog.endDate}, '%Y-%m-%d')
</if>
<if test="analysisReportLog.stationCode != null">
AND idx_width_defect.biz_org_code = #{analysisReportLog.stationCode}
</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