|
@@ -14,12 +14,14 @@ import com.itextpdf.text.pdf.PdfWriter;
|
|
|
import com.usky.common.security.utils.SecurityUtils;
|
|
|
import com.usky.fire.domain.*;
|
|
|
import com.usky.fire.mapper.ReportIndexResultMapper;
|
|
|
+import com.usky.fire.mapper.ReportResultMapper;
|
|
|
import com.usky.fire.service.*;
|
|
|
import com.usky.common.mybatis.core.AbstractCrudService;
|
|
|
import com.usky.fire.service.config.pdf.MyHeaderFooter;
|
|
|
import com.usky.fire.service.util.OnlineMethod;
|
|
|
import com.usky.fire.service.vo.*;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.io.File;
|
|
@@ -74,19 +76,46 @@ public class ReportIndexResultServiceImpl extends AbstractCrudService<ReportInde
|
|
|
@Autowired
|
|
|
private ReportResultService reportResultService;
|
|
|
@Autowired
|
|
|
+ private ReportResultMapper reportResultMapper;
|
|
|
+ @Autowired
|
|
|
private BaseCompanyAttach1Service baseCompanyAttach1Service;
|
|
|
|
|
|
+ @Value("${report.domain}")
|
|
|
+ private String reportDomain;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private DemReportInfoService demReportInfoService;
|
|
|
+
|
|
|
@Override
|
|
|
- public void reportIndexResult() {
|
|
|
+ public void reportIndexResult(String companyId) {
|
|
|
+ List<BaseCompany> baseCompanies = new ArrayList<>();
|
|
|
try {
|
|
|
- List<BaseCompany> baseCompanies = baseCompanyService.companyIdByTypeList("1");
|
|
|
+ if (StringUtils.isNotBlank(companyId)) {
|
|
|
+ LambdaQueryWrapper<BaseCompany> queryWrapper = Wrappers.lambdaQuery();
|
|
|
+ queryWrapper.select(BaseCompany::getId, BaseCompany::getCompanyName, BaseCompany::getCompanyId,
|
|
|
+ BaseCompany::getCompanyCode, BaseCompany::getAddress)
|
|
|
+ .eq(BaseCompany::getCompanyId, companyId);
|
|
|
+ baseCompanies = baseCompanyService.list(queryWrapper);
|
|
|
+ } else {
|
|
|
+ baseCompanies = baseCompanyService.companyIdByTypeList("1");
|
|
|
+ }
|
|
|
if (CollectionUtils.isNotEmpty(baseCompanies)) {
|
|
|
Calendar now = Calendar.getInstance();
|
|
|
LocalDate date = LocalDate.now();
|
|
|
LocalDateTime dateTime = LocalDateTime.now();
|
|
|
+
|
|
|
+ // 上一年第一天
|
|
|
+ LocalDateTime lastYearFirstDateTime = date.minusYears(1)
|
|
|
+ .withDayOfYear(1)
|
|
|
+ .atStartOfDay();
|
|
|
+ // 上一年最后一天
|
|
|
+ LocalDateTime lastYearLastDateTime = date.minusYears(1)
|
|
|
+ .withDayOfYear(date.minusYears(1).lengthOfYear())
|
|
|
+ .atTime(23, 59, 59);
|
|
|
+
|
|
|
for (int i = 0; i < baseCompanies.size(); i++) {
|
|
|
// 1.新建document对象
|
|
|
- Document document = new Document(PageSize.A4);// 建立一个Document对象
|
|
|
+ Document document = new Document(PageSize.A4);
|
|
|
|
|
|
// 2.建立一个书写器(Writer)与document对象关联
|
|
|
// File file =
|
|
@@ -120,7 +149,7 @@ public class ReportIndexResultServiceImpl extends AbstractCrudService<ReportInde
|
|
|
document.addAuthor("mhzd");// 作者
|
|
|
DemReportDataVo demReportDataVo = new DemReportDataVo();
|
|
|
demReportDataVo.setCompanyName(baseCompanies.get(i).getCompanyName());
|
|
|
- demReportDataVo.setLastMonthEndTime(date.toString());
|
|
|
+ demReportDataVo.setLastMonthEndTime(lastYearLastDateTime.toString());
|
|
|
ReportResult reportResult = new ReportResult();
|
|
|
reportResult.setObjectId(baseCompanies.get(i).getId());
|
|
|
reportResult.setReportObject(baseCompanies.get(i).getCompanyName());
|
|
@@ -129,6 +158,15 @@ public class ReportIndexResultServiceImpl extends AbstractCrudService<ReportInde
|
|
|
reportResult.setConfigId(1);
|
|
|
reportResult.setCreateTime(dateTime);
|
|
|
reportResult.setCreateBy(SecurityUtils.getUsername());
|
|
|
+
|
|
|
+ String originalPath = file.getPath();
|
|
|
+ // 去掉/home/service前缀
|
|
|
+ String relativePath = originalPath.replaceFirst("/home/service", "");
|
|
|
+ // 使用配置的域名拼接完整URL
|
|
|
+ String reportUrl = reportDomain + relativePath;
|
|
|
+ // 设置处理后的URL
|
|
|
+ reportResult.setReportUrl(reportUrl);
|
|
|
+
|
|
|
List<BaseBuildAddVO> baseBuilds =
|
|
|
baseBuildService.baseBuildByIdList(baseCompanies.get(i).getCompanyId(), "");
|
|
|
List<ReportIndexConfig> indexConfig3 = reportIndexConfigService.indexConfigList(1, 3);
|
|
@@ -286,9 +324,9 @@ public class ReportIndexResultServiceImpl extends AbstractCrudService<ReportInde
|
|
|
List<DemEnforceInspectRecord> list10 = demEnforceInspectRecordService.list(queryWrapper10);
|
|
|
demReportDataVo.setDoubleRandomNum(list10.size());
|
|
|
Calendar lastYearFirstDateCal3 = Calendar.getInstance();
|
|
|
- lastYearFirstDateCal3.add(Calendar.YEAR, -3);
|
|
|
+ lastYearFirstDateCal3.add(Calendar.YEAR, -1);
|
|
|
String lastYearFirstTime3 = format.format(lastYearFirstDateCal3.getTime());
|
|
|
- demReportDataVo.setLastMonthFirstTime(lastYearFirstTime3);
|
|
|
+ demReportDataVo.setLastMonthFirstTime(lastYearFirstDateTime.toString());
|
|
|
LambdaQueryWrapper<DemLawSituation> queryWrapper11 = Wrappers.lambdaQuery();
|
|
|
queryWrapper11.select(DemLawSituation::getId)
|
|
|
.like(DemLawSituation::getPunishedPerson, baseCompanies.get(i).getCompanyName())
|
|
@@ -1032,6 +1070,18 @@ public class ReportIndexResultServiceImpl extends AbstractCrudService<ReportInde
|
|
|
this.generatePDF(document, demReportDataVo);
|
|
|
document.close();
|
|
|
reportResultService.save(reportResult);
|
|
|
+
|
|
|
+ DemReportInfo demReportInfo = new DemReportInfo();
|
|
|
+ demReportInfo.setCompanyId(baseCompanies.get(i).getCompanyId());
|
|
|
+ demReportInfo.setCompanyCode(baseCompanies.get(i).getCompanyCode());
|
|
|
+ demReportInfo.setReportName(now.get(Calendar.YEAR) + "年" + now.get(Calendar.MONTH) + "消防报告");
|
|
|
+ demReportInfo.setReportPath(reportResult.getReportUrl());
|
|
|
+ demReportInfo.setCreateTime(LocalDateTime.now());
|
|
|
+ demReportInfo.setStatisticsTime(now.get(Calendar.YEAR) + "-" + now.get(Calendar.MONTH));
|
|
|
+ demReportInfo.setReportStatus(0);
|
|
|
+ demReportInfo.setStartTime(lastYearFirstDateTime);
|
|
|
+ demReportInfo.setEndTime(lastYearLastDateTime);
|
|
|
+ demReportInfoService.save(demReportInfo);
|
|
|
}
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
@@ -1113,7 +1163,7 @@ public class ReportIndexResultServiceImpl extends AbstractCrudService<ReportInde
|
|
|
paragraph7.setAlignment(0); // 设置文字居中 0靠左 1,居中 2,靠右
|
|
|
paragraph7.setFirstLineIndent(24); // 设置首行缩进
|
|
|
|
|
|
- Paragraph paragraph8 = new Paragraph("(一)消防设施问题", textfont);
|
|
|
+ Paragraph paragraph8 = new Paragraph("(一)消防设施情况", textfont);
|
|
|
paragraph8.setAlignment(0); // 设置文字居中 0靠左 1,居中 2,靠右
|
|
|
paragraph8.setFirstLineIndent(24); // 设置首行缩进
|
|
|
paragraph8.setLeading(20f); // 行间距
|
|
@@ -1122,7 +1172,7 @@ public class ReportIndexResultServiceImpl extends AbstractCrudService<ReportInde
|
|
|
|
|
|
String fireText = "暂无问题";
|
|
|
if (demReportDataVo.getFireDeviceNum().equals(0)) {
|
|
|
- fireText = "暂无数据";
|
|
|
+ fireText = "暂未接入";
|
|
|
} else {
|
|
|
if (demReportDataVo.getFireOnlineRate() < 0.95 && demReportDataVo.getFireFaultRate() > 0.05 && demReportDataVo.getFireUnhandled() > 0) {
|
|
|
fireText = "在线率低于95%,故障率高于5%,存在未处理告警" + demReportDataVo.getFireUnhandled() + "条;";
|
|
@@ -1149,7 +1199,7 @@ public class ReportIndexResultServiceImpl extends AbstractCrudService<ReportInde
|
|
|
|
|
|
String waterText = "暂无问题";
|
|
|
if (demReportDataVo.getWaterDeviceNum().equals(0)) {
|
|
|
- waterText = "暂无数据";
|
|
|
+ waterText = "暂未接入";
|
|
|
} else {
|
|
|
if (demReportDataVo.getWaterOnlineRate() < 0.95 && demReportDataVo.getWaterFaultRate() > 0.05 && demReportDataVo.getWaterUnhandled() > 0) {
|
|
|
waterText = "在线率低于95%,故障率高于5%,存在未处理告警" + demReportDataVo.getWaterUnhandled() + "条;";
|
|
@@ -1177,7 +1227,7 @@ public class ReportIndexResultServiceImpl extends AbstractCrudService<ReportInde
|
|
|
|
|
|
String smokeText = "暂无问题";
|
|
|
if (demReportDataVo.getSmokeDeviceNum().equals(0)) {
|
|
|
- smokeText = "暂无数据";
|
|
|
+ smokeText = "暂未接入";
|
|
|
} else {
|
|
|
if (demReportDataVo.getSmokeOnlineRate() < 0.95 && demReportDataVo.getSmokeFaultRate() > 0.05 && demReportDataVo.getSmokeUnhandled() > 0) {
|
|
|
smokeText = "在线率低于95%,故障率高于5%,存在未处理告警" + demReportDataVo.getSmokeUnhandled() + "条;";
|
|
@@ -1203,13 +1253,27 @@ public class ReportIndexResultServiceImpl extends AbstractCrudService<ReportInde
|
|
|
paragraph10.setSpacingBefore(5f); // 设置段落上空白
|
|
|
paragraph10.setSpacingAfter(10f); // 设置段落下空白
|
|
|
|
|
|
- Paragraph paragraph11 = new Paragraph("维保单位履职情况:暂无数据。", textfont);
|
|
|
+ Paragraph paragraph11 = new Paragraph("维保单位履职情况:暂未接入。", textfont);
|
|
|
paragraph11.setAlignment(0); // 设置文字居中 0靠左 1,居中 2,靠右
|
|
|
paragraph11.setFirstLineIndent(24); // 设置首行缩进
|
|
|
paragraph11.setLeading(20f); // 行间距
|
|
|
paragraph11.setSpacingBefore(5f); // 设置段落上空白
|
|
|
paragraph11.setSpacingAfter(10f); // 设置段落下空白
|
|
|
|
|
|
+ Paragraph paragraph111 = new Paragraph("【管理建议】:", textfont);
|
|
|
+ paragraph111.setAlignment(0);
|
|
|
+ paragraph111.setFirstLineIndent(24);
|
|
|
+ paragraph111.setLeading(20f);
|
|
|
+ paragraph111.setSpacingBefore(5f);
|
|
|
+ paragraph111.setSpacingAfter(10f);
|
|
|
+
|
|
|
+ Paragraph paragraph66 = new Paragraph("消防设施管理不当存在许多未知风险,建议企业加强设施维保工作,聘请有资质的第三方机构做好消防设施维保工作,并建立数据化建档工作。可使用物联网传感器(如智能水压监测终端、火灾报警信号传输装置)实时采集设施状态数据,并接入统一平台管理,实现设施异常实时告警,变被动响应为主动预警。", textfont);
|
|
|
+ paragraph66.setAlignment(0);
|
|
|
+ paragraph66.setFirstLineIndent(24);
|
|
|
+ paragraph66.setLeading(20f);
|
|
|
+ paragraph66.setSpacingBefore(5f);
|
|
|
+ paragraph66.setSpacingAfter(10f);
|
|
|
+
|
|
|
Paragraph paragraph12 = new Paragraph("(二)消防自主管理问题", textfont);
|
|
|
paragraph12.setAlignment(0); // 设置文字居中 0靠左 1,居中 2,靠右
|
|
|
paragraph12.setFirstLineIndent(24); // 设置首行缩进
|
|
@@ -1217,27 +1281,41 @@ public class ReportIndexResultServiceImpl extends AbstractCrudService<ReportInde
|
|
|
paragraph12.setSpacingBefore(5f); // 设置段落上空白
|
|
|
paragraph12.setSpacingAfter(10f); // 设置段落下空白
|
|
|
|
|
|
- Paragraph paragraph13 = new Paragraph("组织制度落实情况:暂无数据;", textfont);
|
|
|
+ Paragraph paragraph13 = new Paragraph("组织制度落实情况:暂未接入;", textfont);
|
|
|
paragraph13.setAlignment(0); // 设置文字居中 0靠左 1,居中 2,靠右
|
|
|
paragraph13.setFirstLineIndent(24); // 设置首行缩进
|
|
|
paragraph13.setLeading(20f); // 行间距
|
|
|
paragraph13.setSpacingBefore(5f); // 设置段落上空白
|
|
|
paragraph13.setSpacingAfter(10f); // 设置段落下空白
|
|
|
|
|
|
- Paragraph paragraph14 = new Paragraph("消防档案:暂无数据;", textfont);
|
|
|
+ Paragraph paragraph14 = new Paragraph("消防档案:暂未接入;", textfont);
|
|
|
paragraph14.setAlignment(0); // 设置文字居中 0靠左 1,居中 2,靠右
|
|
|
paragraph14.setFirstLineIndent(24); // 设置首行缩进
|
|
|
paragraph14.setLeading(20f); // 行间距
|
|
|
paragraph14.setSpacingBefore(5f); // 设置段落上空白
|
|
|
paragraph14.setSpacingAfter(10f); // 设置段落下空白
|
|
|
|
|
|
- Paragraph paragraph15 = new Paragraph("消防重点部位:暂无数据。", textfont);
|
|
|
+ Paragraph paragraph15 = new Paragraph("消防重点部位:暂未接入。", textfont);
|
|
|
paragraph15.setAlignment(0); // 设置文字居中 0靠左 1,居中 2,靠右
|
|
|
paragraph15.setFirstLineIndent(24); // 设置首行缩进
|
|
|
paragraph15.setLeading(20f); // 行间距
|
|
|
paragraph15.setSpacingBefore(5f); // 设置段落上空白
|
|
|
paragraph15.setSpacingAfter(10f); // 设置段落下空白
|
|
|
|
|
|
+ Paragraph paragraph155 = new Paragraph("【管理建议】:", textfont);
|
|
|
+ paragraph155.setAlignment(0);
|
|
|
+ paragraph155.setFirstLineIndent(24);
|
|
|
+ paragraph155.setLeading(20f);
|
|
|
+ paragraph155.setSpacingBefore(5f);
|
|
|
+ paragraph155.setSpacingAfter(10f);
|
|
|
+
|
|
|
+ Paragraph paragraph1555 = new Paragraph("针对管理制度与档案缺失的风险,建议依据《上海市单位消防安全管理规定》等法规,搭建数字化消防档案管理系统。明确各部门、各岗位的消防安全职责,将培训、值班、巡查等记录电子化、流程化,确保各项制度可追溯、可考核,可在数字平台“重点单位预案”菜单提交以下制度文件(消控室值班人员、消控室持证照片、部门岗位消防安全职责、安全疏散设施管理制度消防安全教育培训制度、防火巡查检查制度、消防(控制室)值斑管理制度、消防设施器材维护管理制度、火灾隐患整改制度、用火用电安全管理制度、易燃易爆危险物品和场所防火防管理制度、专职消防队微型消防站或义务消防队组织管理制度、灭火和应急疏散预案演练制度、燃气和电气设备检査和管理制度(含防雷、防静电) 施工现场消防安全管理制度、消防安全工作考评和奖惩制度、租赁场所安全管理制度和消防安全管理分工文件、其他结合单位情况制定的消防安全制度)。", textfont);
|
|
|
+ paragraph1555.setAlignment(0);
|
|
|
+ paragraph1555.setFirstLineIndent(24);
|
|
|
+ paragraph1555.setLeading(20f);
|
|
|
+ paragraph1555.setSpacingBefore(5f);
|
|
|
+ paragraph1555.setSpacingAfter(10f);
|
|
|
+
|
|
|
Paragraph paragraph16 = new Paragraph("(三)监督执法情况", textfont);
|
|
|
paragraph16.setAlignment(0); // 设置文字居中 0靠左 1,居中 2,靠右
|
|
|
paragraph16.setFirstLineIndent(24); // 设置首行缩进
|
|
@@ -1255,6 +1333,21 @@ public class ReportIndexResultServiceImpl extends AbstractCrudService<ReportInde
|
|
|
paragraph17.setSpacingBefore(5f); // 设置段落上空白
|
|
|
paragraph17.setSpacingAfter(10f); // 设置段落下空白
|
|
|
|
|
|
+ Paragraph paragraph177 = new Paragraph("【管理建议】:", textfont);
|
|
|
+ paragraph177.setAlignment(0);
|
|
|
+ paragraph177.setFirstLineIndent(24);
|
|
|
+ paragraph177.setLeading(20f);
|
|
|
+ paragraph177.setSpacingBefore(5f);
|
|
|
+ paragraph177.setSpacingAfter(10f);
|
|
|
+
|
|
|
+ Paragraph paragraph1777 = new Paragraph("针对前期发现的隐患问题,要举一反三,严格落实日常巡查检查机制,确保发现的隐患问题及时消除,降低本单位火灾风险。\n" +
|
|
|
+ "如果满足“无事不扰白名单”条件,平台将对贵单位进行提示,按照平台流程上传相关资料即可完成申请,降低企业管理负担。", textfont);
|
|
|
+ paragraph1777.setAlignment(0);
|
|
|
+ paragraph1777.setFirstLineIndent(24);
|
|
|
+ paragraph1777.setLeading(20f);
|
|
|
+ paragraph1777.setSpacingBefore(5f);
|
|
|
+ paragraph1777.setSpacingAfter(10f);
|
|
|
+
|
|
|
Paragraph paragraph18 = new Paragraph("(四)火灾情况", textfont);
|
|
|
paragraph18.setAlignment(0); // 设置文字居中 0靠左 1,居中 2,靠右
|
|
|
paragraph18.setFirstLineIndent(24); // 设置首行缩进
|
|
@@ -1368,10 +1461,14 @@ public class ReportIndexResultServiceImpl extends AbstractCrudService<ReportInde
|
|
|
document.add(paragraph26);
|
|
|
document.add(paragraph10);
|
|
|
document.add(paragraph11);
|
|
|
+ document.add(paragraph111);
|
|
|
+ document.add(paragraph66);
|
|
|
document.add(paragraph12);
|
|
|
document.add(paragraph13);
|
|
|
document.add(paragraph14);
|
|
|
document.add(paragraph15);
|
|
|
+ document.add(paragraph155);
|
|
|
+ document.add(paragraph1555);
|
|
|
document.add(paragraph16);
|
|
|
document.add(paragraph17);
|
|
|
document.add(paragraph18);
|