From 9c315b4dbbb9f25d5373d1f228ed441a4e8ccbf7 Mon Sep 17 00:00:00 2001 From: hcong <1050828145@qq.com> Date: 星期四, 12 十二月 2024 15:31:00 +0800 Subject: [PATCH] 1. 数据产品中间结果基本信息和具体信息入库 --- src/main/kotlin/cn/flightfeather/supervision/business/report/BaseTemplate.kt | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 42 insertions(+), 0 deletions(-) diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/report/BaseTemplate.kt b/src/main/kotlin/cn/flightfeather/supervision/business/report/BaseTemplate.kt index a053d99..0c8047d 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/business/report/BaseTemplate.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/business/report/BaseTemplate.kt @@ -2,10 +2,13 @@ import cn.flightfeather.supervision.common.utils.ExcelUtil import cn.flightfeather.supervision.business.report.bean.BaseTemplateResult +import cn.flightfeather.supervision.common.utils.UUIDGenerator +import cn.flightfeather.supervision.domain.ds1.entity.DataProduct import org.apache.poi.hssf.usermodel.HSSFWorkbook import java.io.FileOutputStream import java.io.OutputStream import java.util.* +import kotlin.collections.ArrayList import kotlin.reflect.full.createInstance /** @@ -23,6 +26,12 @@ // 涓棿缁撴灉瀵硅薄 by hc 2024.12.5 abstract var resultObjects: MutableList<BaseTemplateResult> + + // 涓棿缁撴灉鍩烘湰淇℃伅瀵瑰簲鏁版嵁搴撲腑鐨別ntity + var dataProduct = DataProduct() + + // 涓棿缁撴灉鍏蜂綋淇℃伅瀵瑰簲鏁版嵁搴撲腑鐨別ntity + val entities = ArrayList<Any>() // 鎵ц鐘舵�� by hc 2024.12.5 var isExecuted: Boolean = false @@ -101,6 +110,39 @@ } /** + * 鐢熸垚涓棿缁撴灉鍏蜂綋淇℃伅entity + * by hc 2024.12.12 + */ + fun toDBEntity() { + entities.clear() + if (!isExecuted) { + execute() + } + // 鍏堟墽琛宼oObject鍚庡皢toObject鐨勭粨鏋滆浆鍖栦负DBEntity + toObject() + resultObjects.forEach { + entities.add(it.convertToDBEntity()) + } + } + + /** + * 鐢熸垚涓棿缁撴灉鍩烘湰淇℃伅entity + * by hc 2024.12.12 + */ + fun toDBBaseInfoEntity() { + dataProduct = DataProduct() + dataProduct.guid = UUIDGenerator.generate16ShortUUID() + dataProduct.townCode = dataSource.config.townCode + dataProduct.cityCode = dataSource.config.cityCode + dataProduct.districtCode = dataSource.config.districtCode + dataProduct.endTime = dataSource.config.endTime + dataProduct.startTime = dataSource.config.startTime + dataProduct.provinceCode = dataSource.config.provinceCode + dataProduct.sceneTypeId = dataSource.config.sceneType?.toByte() ?: -1 + dataProduct.taskGuid = dataSource.config.topTaskGuid + } + + /** * 杈撳嚭涓烘枃妗� */ override fun toFile(path: String) { -- Gitblit v1.9.3