diff --git a/hzims-biz-common/pom.xml b/hzims-biz-common/pom.xml index 5255f48..be7e8e8 100644 --- a/hzims-biz-common/pom.xml +++ b/hzims-biz-common/pom.xml @@ -41,6 +41,12 @@ blade-starter-datascope + + + cn.afterturn + easypoi-spring-boot-starter + 4.4.0 + diff --git a/hzims-service/assets/pom.xml b/hzims-service/assets/pom.xml index 80a5994..3304ecc 100644 --- a/hzims-service/assets/pom.xml +++ b/hzims-service/assets/pom.xml @@ -64,10 +64,10 @@ message-api compile - - cn.afterturn - easypoi-base - + + + + diff --git a/hzims-service/assets/src/main/java/com/hnac/hzims/spare/service/impl/WtSpBasicServiceImpl.java b/hzims-service/assets/src/main/java/com/hnac/hzims/spare/service/impl/WtSpBasicServiceImpl.java index c33c23e..3cd4818 100644 --- a/hzims-service/assets/src/main/java/com/hnac/hzims/spare/service/impl/WtSpBasicServiceImpl.java +++ b/hzims-service/assets/src/main/java/com/hnac/hzims/spare/service/impl/WtSpBasicServiceImpl.java @@ -1,6 +1,7 @@ package com.hnac.hzims.spare.service.impl; +import cn.afterturn.easypoi.excel.entity.ImportParams; import com.alibaba.druid.support.json.JSONUtils; import com.alibaba.excel.EasyExcel; import com.alibaba.excel.ExcelWriter; diff --git a/hzims-service/equipment/src/main/resources/db/1.0.0.sql b/hzims-service/equipment/src/main/resources/db/1.0.0.sql new file mode 100644 index 0000000..0725615 --- /dev/null +++ b/hzims-service/equipment/src/main/resources/db/1.0.0.sql @@ -0,0 +1,73 @@ +SET FOREIGN_KEY_CHECKS=0; + +CREATE TABLE `dev_equipment`.`hzims_em_association` ( + `ID` bigint(20) NOT NULL COMMENT '主键Id', + `EM_ID` bigint(20) NULL DEFAULT NULL COMMENT '设备Id', + `FDP_EM_ID` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT 'FDP设备Id', + `FDP_EM_NAME` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT 'PDF设备名称', + `TENANT_ID` varchar(12) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '租户ID', + `CREATE_TIME` datetime NULL DEFAULT NULL COMMENT '创建时间', + `UPDATE_TIME` datetime NULL DEFAULT NULL COMMENT '更新时间', + `CREATE_USER` bigint(64) NULL DEFAULT NULL COMMENT '创建人', + `UPDATE_USER` bigint(64) NULL DEFAULT NULL COMMENT '修改人', + `CREATE_DEPT` bigint(64) NULL DEFAULT NULL COMMENT '创建部门', + `STATUS` int(2) NULL DEFAULT 0 COMMENT '状态', + `IS_DELETED` int(2) NULL DEFAULT 0 COMMENT '是否已删除: 0、否; 1、是', + PRIMARY KEY (`ID`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '设备关联表' ROW_FORMAT = Dynamic; + +CREATE TABLE `dev_equipment`.`hzims_em_association_detail` ( + `PID` bigint(20) NOT NULL COMMENT '父id', + `ID` bigint(20) NOT NULL COMMENT '主键Id', + `EM_POINT_ID` bigint(20) NOT NULL COMMENT '设备点Id', + `FDP_EM_POINT_ID` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT 'FDP点Id', + `FDP_EM_POINT_NAME` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT 'FDP监测点名称', + `FDP_EM_POINT_ORD` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT 'FDP监测点位置', + `PRO_TYPE` varchar(10) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '属性类型:yc、yx、soe', + `TENANT_ID` varchar(12) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '租户ID', + `CREATE_TIME` datetime NULL DEFAULT NULL COMMENT '创建时间', + `UPDATE_TIME` datetime NULL DEFAULT NULL COMMENT '更新时间', + `CREATE_USER` bigint(64) NULL DEFAULT NULL COMMENT '创建人', + `UPDATE_USER` bigint(64) NULL DEFAULT NULL COMMENT '修改人', + `CREATE_DEPT` bigint(64) NULL DEFAULT NULL COMMENT '创建部门', + `STATUS` int(2) NULL DEFAULT 0 COMMENT '状态', + `IS_DELETED` int(2) NULL DEFAULT 0 COMMENT '是否已删除: 0、否; 1、是', + PRIMARY KEY (`ID`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '设备关联明细表' ROW_FORMAT = Dynamic; + +ALTER TABLE `dev_equipment`.`hzims_em_info` ADD COLUMN `em_index` tinyint(4) NULL DEFAULT NULL COMMENT '设备序号' AFTER `CREATE_DEPT`; + +ALTER TABLE `dev_equipment`.`hzims_em_info` ADD COLUMN `DEVICE_INSTANCE_ID` bigint(20) NULL DEFAULT NULL COMMENT '设备实例化Id' AFTER `em_index`; + +ALTER TABLE `dev_equipment`.`hzims_em_info` ADD COLUMN `em_type` varchar(2) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '设备类型' AFTER `DEVICE_INSTANCE_ID`; + +ALTER TABLE `dev_equipment`.`hzims_em_info` ADD COLUMN `set_type` varchar(2) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '机组类型' AFTER `em_type`; + +ALTER TABLE `dev_equipment`.`hzims_em_info` MODIFY COLUMN `NUMBER` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL COMMENT '设备编号' AFTER `ID`; + +ALTER TABLE `dev_equipment`.`hzims_em_info` MODIFY COLUMN `HOME_PAGE_DISPLAY` char(2) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '0' COMMENT '首页展示' AFTER `LINKER_PHONE`; + +ALTER TABLE `dev_equipment`.`hzims_em_info` MODIFY COLUMN `GRADE_CODE` varchar(2) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '设备等级' AFTER `MANAGER`; + +ALTER TABLE `dev_equipment`.`hzims_em_info` MODIFY COLUMN `RUN_STATUS` varchar(2) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '2' COMMENT '运行状态' AFTER `INS_LOCATION`; + +CREATE TABLE `dev_equipment`.`hzims_workshop_equipment` ( + `ID` bigint(20) NOT NULL COMMENT '主键ID', + `WORKSHOP_ID` bigint(20) NOT NULL COMMENT '厂房ID', + `WORKSHOP_NAME` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '厂房名称', + `EM_ID` bigint(20) NOT NULL COMMENT '设备ID', + `EM_NAME` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '设备名称', + `TENANT_ID` varchar(12) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '租户ID', + `CREATE_TIME` datetime NOT NULL COMMENT '创建时间', + `UPDATE_TIME` datetime NULL DEFAULT NULL COMMENT '更新时间', + `CREATE_USER` bigint(20) NOT NULL COMMENT '创建人', + `UPDATE_USER` bigint(20) NULL DEFAULT NULL COMMENT '更新人', + `IS_DELETED` tinyint(4) NOT NULL COMMENT '是否删除', + `STATUS` tinyint(4) NULL DEFAULT NULL COMMENT '状态 0-启用 1-停用', + `CREATE_DEPT` bigint(20) NULL DEFAULT NULL COMMENT '创建部门', + PRIMARY KEY (`ID`) USING BTREE +) ENGINE = InnoDB CHARACTER SET = utf8 COLLATE = utf8_general_ci ROW_FORMAT = DYNAMIC; + +CREATE ALGORITHM = UNDEFINED DEFINER = `root`@`%` SQL SECURITY DEFINER VIEW `dev_equipment`.`v_hzims_fdp_fualt` AS (select `t1`.`ID` AS `ID`,`t1`.`FDP_ID` AS `FDP_ID`,`t1`.`NAME` AS `NAME`,`t1`.`INFO` AS `INFO`,`t1`.`EM_CODE` AS `EM_CODE`,`t1`.`DETECTABILITY` AS `DETECTABILITY`,`t1`.`SEVERITY` AS `SEVERITY`,`t1`.`FDP_DEVICE_ID` AS `FDP_DEVICE_ID`,`t1`.`FDP_DEVICE_NAME` AS `FDP_DEVICE_NAME`,`t1`.`ORD` AS `ORD`,`t1`.`DISPLAY` AS `DISPLAY`,`t1`.`TENANT_ID` AS `TENANT_ID`,`t1`.`CREATE_TIME` AS `CREATE_TIME`,`t1`.`UPDATE_TIME` AS `UPDATE_TIME`,`t1`.`CREATE_USER` AS `CREATE_USER`,`t1`.`UPDATE_USER` AS `UPDATE_USER`,`t1`.`IS_DELETED` AS `IS_DELETED`,`t1`.`STATUS` AS `STATUS`,`t1`.`CREATE_DEPT` AS `CREATE_DEPT`,`t2`.`FAULT_AMOUNT` AS `FAULT_AMOUNT` from (`dev_equipment`.`hzims_fdp_fault` `t1` join (select `t`.`NAME` AS `name`,count(`t`.`NAME`) AS `FAULT_AMOUNT` from `dev_equipment`.`hzims_fdp_fault` `t` group by `t`.`NAME` order by count(`t`.`NAME`) desc) `t2`) where (`t1`.`NAME` = `t2`.`name`) order by `t2`.`FAULT_AMOUNT` desc); + +SET FOREIGN_KEY_CHECKS=1; \ No newline at end of file diff --git a/hzims-service/operational/pom.xml b/hzims-service/operational/pom.xml index 8e5a5fd..2eb0339 100644 --- a/hzims-service/operational/pom.xml +++ b/hzims-service/operational/pom.xml @@ -18,19 +18,19 @@ - - - org.apache.poi - poi - - - org.apache.poi - poi-ooxml - - - org.apache.poi - poi-ooxml-schemas - + + + + + + + + + + + + + org.springblade @@ -88,10 +88,10 @@ easypoi-web 3.2.0 --> - - cn.afterturn - easypoi-base - + + + + org.apache.poi @@ -108,10 +108,10 @@ jfreechart 1.5.0 - - cn.afterturn - easypoi-annotation - + + + + com.hikvision.ga artemis-http-client diff --git a/hzims-service/ticket/pom.xml b/hzims-service/ticket/pom.xml index 33b15c7..7f5c8c1 100644 --- a/hzims-service/ticket/pom.xml +++ b/hzims-service/ticket/pom.xml @@ -66,25 +66,36 @@ org.apache.poi poi + 4.0.0 org.apache.poi poi-ooxml + 4.0.0 - - org.apache.poi - poi-ooxml-schemas - - - org.apache.poi - poi-scratchpad - + + + + + + + + + + + + + + + + cn.afterturn - easypoi-web - ${easypoi.version} + easypoi-spring-boot-starter + 4.0.0 + cn.hutool hutool-core @@ -285,11 +296,6 @@ swagger-bootstrap-ui ${swagger-bootstrap-ui.version} - - - com.hnac.hzims - hzims-operational-api - diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/TicketProcessServiceImpl.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/TicketProcessServiceImpl.java index 0770a20..c1f675e 100644 --- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/TicketProcessServiceImpl.java +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/TicketProcessServiceImpl.java @@ -1,5 +1,6 @@ package com.hnac.hzims.ticket.twoTicket.service.impl; + import cn.afterturn.easypoi.excel.ExcelExportUtil; import cn.afterturn.easypoi.excel.entity.TemplateExportParams; import com.alibaba.fastjson.JSON; @@ -612,38 +613,41 @@ public class TicketProcessServiceImpl implements TicketProcessService { * @param ticketType * @param ticketId */ + @SneakyThrows @Override public void preview(String ticketType, Long ticketId) { WorkTicketVo workTicketVo = ticketInfoService.selectDetailsById(ticketId); //将查询的数据转换为map Map workTicketInfoMap = this.convertMap(workTicketVo); - + workTicketInfoMap.put("name", 22); String fileName = TicketConstants.WordFileNameEnum.getFileNameByType(ticketType) + PdfUtils.XLSX_SUFFIX; log.info("工作票模板为:{}", fileName); TemplateExportParams templateExportParams = new TemplateExportParams("template/新电气第一种工作票模板.xlsx", true); Workbook workbook = null; - Map map = new HashMap(); - map.put("name", "你好"); try { - workbook = ExcelExportUtil.exportExcel(templateExportParams, map); + workbook = ExcelExportUtil.exportExcel(templateExportParams, workTicketInfoMap); } catch (Exception e) { e.printStackTrace(); } - //上传xlsx至服务器 - try { - ExcelUtil.upload(workbook, xlsSavePath, workTicketVo.getWorkTicket().getWorkContent() + PdfUtils.XLSX_SUFFIX); - } catch (Exception e) { - e.printStackTrace(); - } - //将xlsx文件转换为pdf并保存 - String pdfFileName = workTicketVo.getWorkTicket().getWorkContent() + PdfUtils.PDF_SUFFIX; - String xlsFileName = workTicketVo.getWorkTicket().getWorkContent() + PdfUtils.XLSX_SUFFIX; - PdfUtils.convertPdf(xlsSavePath, xlsFileName, pdfSavePath, pdfFileName); - String savePath = pdfSavePath + pdfFileName; - // 设置response参数,可以打开下载页面 - ServletRequestAttributes servletRequestAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes(); - HttpServletResponse response = servletRequestAttributes.getResponse(); - PdfUtils.readPdf(response, savePath); + + FileOutputStream fos = new FileOutputStream("F:\\idea项目\\flowable\\demo\\src\\main\\resources\\新电气第一种工作票模板5" + + ".xlsx"); + workbook.write(fos); + // //上传xlsx至服务器 + // try { + // ExcelUtil.upload(workbook, xlsSavePath, workTicketVo.getWorkTicket().getWorkContent() + PdfUtils.XLSX_SUFFIX); + // } catch (Exception e) { + // e.printStackTrace(); + // } + // //将xlsx文件转换为pdf并保存 + // String pdfFileName = workTicketVo.getWorkTicket().getWorkContent() + PdfUtils.PDF_SUFFIX; + // String xlsFileName = workTicketVo.getWorkTicket().getWorkContent() + PdfUtils.XLSX_SUFFIX; + // PdfUtils.convertPdf(xlsSavePath, xlsFileName, pdfSavePath, pdfFileName); + // String savePath = pdfSavePath + pdfFileName; + // // 设置response参数,可以打开下载页面 + // ServletRequestAttributes servletRequestAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes(); + // HttpServletResponse response = servletRequestAttributes.getResponse(); + // PdfUtils.readPdf(response, savePath); } @@ -709,42 +713,6 @@ public class TicketProcessServiceImpl implements TicketProcessService { return JSONObject.parseObject(JSONObject.toJSONString(target), Map.class); } - - public static void main(String[] args) throws IOException { - //System.out.println(DateTimeFormatter.ofPattern("YYYY-MM-dd HH:mm:ss").format(LocalDateTime.now())); - TemplateExportParams params = new TemplateExportParams( - "template/新电气第一种工作票模板.xlsx"); - - Map map = new HashMap(); - map.put("name", "你好"); - // map.put("money", 2000000.00); - // map.put("upperMoney", "贰佰万"); - // map.put("company", "执笔潜行科技有限公司"); - // map.put("bureau", "财政局"); - // map.put("person", "JueYue"); - // map.put("phone", "1879740****"); - // List> listMap = new ArrayList>(); - // for (int i = 0; i < 4; i++) { - // Map lm = new HashMap(); - // lm.put("id", i + 1 + ""); - // lm.put("zijin", i * 10000 + ""); - // lm.put("bianma", "A001"); - // lm.put("mingcheng", "设计"); - // lm.put("xiangmumingcheng", "EasyPoi " + i + "期"); - // lm.put("quancheng", "开源项目"); - // lm.put("sqje", i * 10000 + ""); - // lm.put("hdje", i * 10000 + ""); - // - // listMap.add(lm); - // } - // map.put("maplist", listMap); - - Workbook workbook = ExcelExportUtil.exportExcel(params, map); - FileOutputStream fos = new FileOutputStream("F:\\idea项目\\flowable\\demo\\src\\main\\resources\\新电气第一种工作票模板2" + - ".xlsx"); - workbook.write(fos); - fos.close(); - } } diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/utils/PdfUtils.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/utils/PdfUtils.java index de9d013..33475ee 100644 --- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/utils/PdfUtils.java +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/utils/PdfUtils.java @@ -1,5 +1,6 @@ package com.hnac.hzims.ticket.utils; +import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; import com.documents4j.api.DocumentType; import com.documents4j.api.IConverter; import com.documents4j.job.LocalConverter; @@ -130,6 +131,11 @@ public class PdfUtils { if(value instanceof Date){ value = DateUtil.format((Date) value, TicketConstants.TICKET_DATE_PATTERN); } + + if ((ObjectUtils.isEmpty(value) || value == "") && StringUtil.isNoneBlank(field.getName())){ + return; + } + //属性上是否加入DefaultValue注解 若加入 则判断是否定义属性名以及值 若未定义则取原属性名及值 if(ObjectUtil.isNotEmpty(defaultValue)){ result.put(StringUtil.isNoneBlank(defaultValue.name()) ? defaultValue.name() : field.getName(), diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/dto/WorkTicketInfoDto.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/dto/WorkTicketInfoDto.java index 4e6655d..cb7f418 100644 --- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/dto/WorkTicketInfoDto.java +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/workTicket/dto/WorkTicketInfoDto.java @@ -1,9 +1,6 @@ package com.hnac.hzims.ticket.workTicket.dto; import com.fasterxml.jackson.annotation.JsonFormat; -import com.hnac.hzims.operational.access.dto.OperAccessMaterialDTO; -import com.hnac.hzims.operational.access.dto.OperAccessTaskDetailDTO; -import com.hnac.hzims.ticket.workTicket.entity.WorkTicketContentEntity; import com.hnac.hzims.ticket.workTicket.entity.WorkTicketInfoEntity; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @@ -11,7 +8,6 @@ import lombok.EqualsAndHashCode; import org.springframework.format.annotation.DateTimeFormat; import java.io.Serializable; -import java.time.LocalDateTime; import java.util.List; /** diff --git a/pom.xml b/pom.xml index ea3c8ef..53f9bdd 100644 --- a/pom.xml +++ b/pom.xml @@ -37,7 +37,7 @@ blade 1.4.13 - 3.17 + 5.2.3 UTF-8 @@ -225,27 +225,27 @@ poi-ooxml ${poi.version} - - org.apache.poi - poi-ooxml-schemas - ${poi.version} - - - org.apache.poi - poi-scratchpad - ${poi.version} - + + + + + + + + + + - - cn.afterturn - easypoi-base - 3.2.0 - - - cn.afterturn - easypoi-annotation - 3.2.0 - + + + + + + + + + + com.hikvision.ga artemis-http-client