| | |
| | | |
| | | 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 |
| | | |
| | | /** |
| | |
| | | |
| | | // 中间结果对象 by hc 2024.12.5 |
| | | abstract var resultObjects: MutableList<BaseTemplateResult> |
| | | |
| | | // 中间结果基本信息对应数据库中的entity |
| | | var dataProduct = DataProduct() |
| | | |
| | | // 中间结果具体信息对应数据库中的entity |
| | | val entities = ArrayList<Any>() |
| | | |
| | | // 执行状态 by hc 2024.12.5 |
| | | var isExecuted: Boolean = false |
| | |
| | | } |
| | | |
| | | /** |
| | | * 生成中间结果具体信息entity |
| | | * by hc 2024.12.12 |
| | | */ |
| | | fun toDBEntity() { |
| | | entities.clear() |
| | | if (!isExecuted) { |
| | | execute() |
| | | } |
| | | // 先执行toObject后将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) { |