Commit 49a252d9 authored by KeYong's avatar KeYong

Merge branch 'develop_dl_plan6' of http://39.98.45.134:8090/moa/amos-boot-biz into develop_dl_plan6

parents 9ebda8a1 9b50a4da
This diff is collapsed.
......@@ -11,12 +11,12 @@
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<name>org.springframework.ide.eclipse.boot.validation.springbootbuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.springframework.ide.eclipse.boot.validation.springbootbuilder</name>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -11,12 +11,12 @@
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<name>org.springframework.ide.eclipse.boot.validation.springbootbuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.springframework.ide.eclipse.boot.validation.springbootbuilder</name>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
......
<factorypath>
<factorypathentry kind="EXTJAR" id="F:\git\amos-boot-biz_plan6\amos-boot-module\amos-boot-module-api\amos-boot-module-avic-api\lib\commons-io-2.4.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="EXTJAR" id="F:\git\amos-boot-biz_plan6\amos-boot-module\amos-boot-module-api\amos-boot-module-avic-api\lib\mailapi-1.5.2.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="EXTJAR" id="F:\git\amos-boot-biz_plan6\amos-boot-module\amos-boot-module-api\amos-boot-module-avic-api\lib\smtp-1.5.2.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/typroject/tyboot-core-rdbms/1.1.20/tyboot-core-rdbms-1.1.20.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/com/zaxxer/HikariCP/3.4.5/HikariCP-3.4.5.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/boot/spring-boot-starter-logging/2.3.11.RELEASE/spring-boot-starter-logging-2.3.11.RELEASE.jar" enabled="true" runInBatchMode="false"/>
......
......@@ -11,6 +11,11 @@
<dependencies>
<dependency>
<groupId>org.jfree</groupId>
<artifactId>jfreechart</artifactId>
<version>1.0.19</version>
</dependency>
<dependency>
<groupId>org.apache.tika</groupId>
<artifactId>tika-core</artifactId>
......
......@@ -6,8 +6,8 @@ package com.yeejoin.equipmanage.common.enums;
*
*/
public enum WordTemplateTypeEum {
resume("简历","jianli.ftl");
resume("简历","jianli.ftl"),
firePatrolReport("消防巡查报表","FirePatrolReport.ftl");
private String label;
private String templateFile;
......
......@@ -11,12 +11,12 @@
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<name>org.springframework.ide.eclipse.boot.validation.springbootbuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.springframework.ide.eclipse.boot.validation.springbootbuilder</name>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
......
<factorypath>
<factorypathentry kind="EXTJAR" id="F:\git\amos-boot-biz_plan6\amos-boot-module\amos-boot-module-api\amos-boot-module-avic-api\lib\commons-io-2.4.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="EXTJAR" id="F:\git\amos-boot-biz_plan6\amos-boot-module\amos-boot-module-api\amos-boot-module-avic-api\lib\mailapi-1.5.2.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="EXTJAR" id="F:\git\amos-boot-biz_plan6\amos-boot-module\amos-boot-module-api\amos-boot-module-avic-api\lib\smtp-1.5.2.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/apache/cxf/cxf-spring-boot-starter-jaxws/3.2.6/cxf-spring-boot-starter-jaxws-3.2.6.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/boot/spring-boot-starter/2.3.11.RELEASE/spring-boot-starter-2.3.11.RELEASE.jar" enabled="true" runInBatchMode="false"/>
<factorypathentry kind="VARJAR" id="M2_REPO/org/springframework/boot/spring-boot/2.3.11.RELEASE/spring-boot-2.3.11.RELEASE.jar" enabled="true" runInBatchMode="false"/>
......
......@@ -86,7 +86,7 @@ public class FileFransferServiceImpl implements FileFransferService {
String template = eMailSenderService.getEmailTemplate();
File file = new File(String.format("%s%s%s%s", baseDir,path.replace(":", ""), File.separator, fileName));
Multipart mp = new MimeMultipart();
eMailSenderService.send(userCode, userCode, template, mp);
//eMailSenderService.send(userCode, userCode, template, mp);
}
@Override
......
package com.yeejoin.equipmanage.controller;
import java.text.SimpleDateFormat;
import java.util.Date;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.propertyeditors.CustomDateEditor;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.ServletRequestDataBinder;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.InitBinder;
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 com.yeejoin.equipmanage.service.IFirePatrolReportService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
/**
* @author wj
* @date 2022-04-28
*/
@RestController
@Api(tags = "消防巡查报表Api")
@RequestMapping(value = "/fire-patrol-report")
@Slf4j
public class FirePatrolReportController {
@Autowired
IFirePatrolReportService iFirePatrolReportService;
@ApiOperation(value = "下载报表", notes = "下载报表")
@GetMapping(value = "/download")
@TycloudOperation(ApiLevel = UserType.PUBLIC, needAuth = false)
public void download(HttpServletRequest request, HttpServletResponse response,
@ApiParam(value = "换流站编码", required = true) @RequestParam String code,
@ApiParam(value = "开始日期", required = true) @RequestParam @DateTimeFormat(pattern="yyyy-MM-dd")Date startDate,
@ApiParam(value = "结束日期", required = true) @RequestParam @DateTimeFormat(pattern="yyyy-MM-dd")Date endDate) {
iFirePatrolReportService.download(request, response, code, startDate, endDate);
}
}
package com.yeejoin.equipmanage.service;
import java.util.Date;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public interface IFirePatrolReportService {
void download(HttpServletRequest request, HttpServletResponse response,String code,Date startDate,Date endDate);
}
package com.yeejoin.equipmanage.service.impl;
import java.awt.Font;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.Base64;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.jfree.chart.ChartFactory;
import org.jfree.chart.ChartUtilities;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.labels.StandardPieSectionLabelGenerator;
import org.jfree.chart.plot.PiePlot;
import org.jfree.data.general.DefaultPieDataset;
import org.springframework.stereotype.Service;
import com.yeejoin.equipmanage.common.enums.WordTemplateTypeEum;
import com.yeejoin.equipmanage.common.exception.CommonException;
import com.yeejoin.equipmanage.common.utils.WordTemplateUtils;
import com.yeejoin.equipmanage.service.IFirePatrolReportService;
@Service
public class FilePatrolReportServiceImpl implements IFirePatrolReportService {
@Override
public void download(HttpServletRequest request, HttpServletResponse response, String code, Date startDate,
Date endDate) {
WordTemplateUtils instance = WordTemplateUtils.getInstance();
Map<String, Object> map = new HashMap<String, Object>();
// 文档编号
String timeStr1 = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss"));
String documentNumber = "ZD-XFSBXC" + timeStr1;
map.put("document_number", documentNumber);
// 换流站名称
map.put("station_name", "测试");
// 统计时间
SimpleDateFormat dateStat = new SimpleDateFormat("yyyy年MM月dd日");
String statisticalTime = dateStat.format(startDate) + "-" + dateStat.format(endDate);
if (statisticalTime.contains("年0")) {
statisticalTime = statisticalTime.replaceAll("年0", "年");
}
map.put("statistical_time", statisticalTime);
// 生成日期
String timeStr2 = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy年MM月dd日"));
if (timeStr2.contains("年0")) {
timeStr2 = timeStr2.replaceAll("年0", "年");
}
SimpleDateFormat dateFm = new SimpleDateFormat("EEEE");
String currSun = dateFm.format(new Date());
map.put("create_date", timeStr2 + currSun);
// 统计时间2
map.put("statistical_time2", statisticalTime.replaceAll("-", "至"));
// 巡查任务数
map.put("task_count", "10");
// 完成任务数
map.put("complete_task_count", "5");
// 未完成任务数
map.put("uncomplete_task_count", "2");
// 任务完成率
map.put("complete_task_percent", "40%");
// 巡查人员数
map.put("person_count", "5");
// 持证人员数
map.put("certified_person_count", "3");
// 持证率
map.put("certified_percent", "60%");
// 应巡查设备总数
map.put("equipment_count", "12");
int checked_equipment_count = 7;
// 实际巡查设备总数
map.put("checked_equipment_count", checked_equipment_count);
int unchecked_equipment_count = 5;
// 漏查设备总数
map.put("unchecked_equipment_count", unchecked_equipment_count);
// 发现问题总数
map.put("problem_count", "5");
// 发现问题总数
map.put("fixed_problem_count", "3");
// 发现问题总数
map.put("unfixed_problem_count", "2");
// 巡查点位数
map.put("checked_location_count", "2");
// 缺陷总数
map.put("defect_count", "2");
// 合格数
int qualified = 3;
// 未合格数
int no_qualified = 3;
// 合格饼图
DefaultPieDataset pds = new DefaultPieDataset();
pds.setValue("合格", qualified);
pds.setValue("不合格", no_qualified);
String qualified_pie_chart = getChartString(pds);
map.put("qualified_pie_chart", qualified_pie_chart);
// 设备巡查饼图
DefaultPieDataset pds2 = new DefaultPieDataset();
pds.setValue("已查询设备", checked_equipment_count);
pds.setValue("漏查设备", unchecked_equipment_count);
String equip_pie_chart = getChartString(pds2);
map.put("equip_pie_chart", equip_pie_chart);
// 业务主题
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);
map.put("defect_list", defect_list);
try {
instance.exportMillCertificateWord(request, response, map, documentNumber,
WordTemplateTypeEum.firePatrolReport.getTemplateFile());
} catch (IOException e) {
throw new CommonException(0, "下载装备巡查报表失败");
}
}
/**
* 获取饼图base64字符串
* @param pds
* @return
*/
private String getChartString(DefaultPieDataset pds) {
JFreeChart chart = ChartFactory.createPieChart("测试", pds, false, false, true);
// 如果不使用Font,中文将显示不出来
Font font = new Font("宋体", Font.BOLD, 12);
// 设置图片标题的字体
chart.getTitle().setFont(font);
// 得到图块,准备设置标签的字体
PiePlot plot = (PiePlot) chart.getPlot();
// 设置标签字体
plot.setLabelFont(font);
plot.setStartAngle(new Float(3.14f / 2f));
//plot.setSectionPaint((Comparable) Color.BLUE,Color.RED); // 考虑自定义设置颜色——我不会
// 设置plot的前景色透明度
plot.setForegroundAlpha(0.7f);
// 设置plot的背景色透明度
plot.setBackgroundAlpha(0.0f);
// 设置标签生成器(默认{0})
// {0}:key {1}:value {2}:百分比 {3}:sum
plot.setLabelGenerator(new StandardPieSectionLabelGenerator("{0}\n{2}"));
BufferedImage image = chart.createBufferedImage(800, 600);
byte[] bytes = null;
try {
bytes = ChartUtilities.encodeAsPNG(image);
} catch (IOException e1) {
throw new CommonException(0, "生成饼图失败");
}
String base64 = Base64.getEncoder().encodeToString(bytes);
return base64;
}
}
......@@ -11,12 +11,12 @@
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<name>org.springframework.ide.eclipse.boot.validation.springbootbuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.springframework.ide.eclipse.boot.validation.springbootbuilder</name>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
......
......@@ -11,12 +11,12 @@
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<name>org.springframework.ide.eclipse.boot.validation.springbootbuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.springframework.ide.eclipse.boot.validation.springbootbuilder</name>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
......
This diff is collapsed.
This diff is collapsed.
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.url = jdbc:mysql://172.16.6.60:3306/xiy_amos_satety_business?useUnicode=true&allowMultiQueries=true&characterEncoding=utf-8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai
spring.datasource.url = jdbc:mysql://39.98.246.31/dl_business_v3.0.1.3?useUnicode=true&allowMultiQueries=true&characterEncoding=utf-8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai
spring.datasource.username=root
spring.datasource.password=root_123
spring.datasource.password=Yeejoin@2020
spring.datasource.type=com.zaxxer.hikari.HikariDataSource
spring.datasource.hikari.pool-name=DatebookHikariCP
spring.datasource.hikari.minimum-idle= 3
......@@ -17,7 +17,7 @@ spring.datasource.hikari.connection-test-query= SELECT 1
fileserver_domain=http://39.98.45.134:9000/
#eureka.instance.ip-address= 172.16.3.135
eureka.instance.hostname= 172.16.3.97
eureka.instance.hostname= 39.98.246.31
eureka.instance.prefer-ip-address = true
eureka.client.serviceUrl.defaultZone: http://${eureka.instance.hostname}:10001/eureka/
......@@ -33,7 +33,7 @@ security.appKeyApp=studio_normalapp_3056965
spring.redis.database=1
spring.redis.host=172.16.3.35
spring.redis.host=39.98.246.31
spring.redis.port=6379
spring.redis.password=yeejoin@2020
spring.redis.lettuce.pool.max-active=200
......@@ -45,10 +45,10 @@ spring.redis.expire.time=300
## emqx
emqx.clean-session=true
emqx.client-id=${spring.application.name}-${random.int[1024,65536]}
emqx.broker=tcp://172.16.3.35:2883
emqx.user-name=super
emqx.password=a123456
mqtt.scene.host=mqtt://172.16.3.35:8083/mqtt
emqx.broker=tcp://39.98.246.31:1883
emqx.user-name=admin
emqx.password=public
mqtt.scene.host=mqtt://39.98.246.31:8083/mqtt
mqtt.client.product.id=mqtt
mqtt.topic=topic_mqtt
spring.mqtt.completionTimeout=3000
......
spring.application.name=AMOS-EQUIPMANAGE
spring.application.name=AMOS-EQUIPMANAGE-WJ
server.servlet.context-path=/equip
server.port=8100
#server.servlet.context-path=/case
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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