From 09c8120288ea7df454c10d67911ab8643f2f4235 Mon Sep 17 00:00:00 2001 From: hcong <1050828145@qq.com> Date: 星期二, 17 十二月 2024 11:06:33 +0800 Subject: [PATCH] 1. 完成数据产品中间结果基本信息和具体信息入库 --- src/main/kotlin/cn/flightfeather/supervision/business/report/BaseTemplate.kt | 45 +++++++++++++++++++++++++++++++++++++++++++-- 1 files changed, 43 insertions(+), 2 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..f143323 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 @@ -77,7 +86,7 @@ * 杈撳嚭鍒板璞� * hc 2024.12.06 */ - fun toObject(): MutableList<BaseTemplateResult> { + fun toObject() { if (!isExecuted) { execute() } @@ -97,7 +106,39 @@ resultObjects.clear() resultObjects.add(classType.createInstance()) } - return resultObjects + } + + /** + * 鐢熸垚涓棿缁撴灉鍏蜂綋淇℃伅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 } /** -- Gitblit v1.9.3