feiyu02
2022-07-19 b041775dae4438e428d2b70d2b22cfe8c49844fe
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/SearchServiceImpl.kt
@@ -1,5 +1,11 @@
package cn.flightfeather.supervision.lightshare.service.impl
import cn.flightfeather.supervision.business.report.DataSource
import cn.flightfeather.supervision.business.report.DbMapper
import cn.flightfeather.supervision.business.report.file.ReportOne
import cn.flightfeather.supervision.business.report.file.ReportThree
import cn.flightfeather.supervision.business.report.file.ReportTwo
import cn.flightfeather.supervision.business.report.template.*
import cn.flightfeather.supervision.common.utils.*
import cn.flightfeather.supervision.domain.ds1.entity.*
import cn.flightfeather.supervision.domain.ds1.mapper.*
@@ -36,19 +42,58 @@
    val scoreMapper: ScoreMapper,
    val inspectionMapper: InspectionMapper,
    val taskMapper: TaskMapper,
    val monitorobjectversionMapper: MonitorobjectversionMapper
    val monitorobjectversionMapper: MonitorobjectversionMapper,
    val evaluationruleMapper: EvaluationruleMapper,
    val evaluationsubruleMapper: EvaluationsubruleMapper2,
    val evaluationMapper: EvaluationMapper,
    val itemevaluationMapper: ItemevaluationMapper
) : SearchService {
    private val dateUtil = DateUtil()
    override fun writeToFile(config: ExcelConfigVo) {
        val fileName = "target/${dateUtil.DateToString(Date(), "yyyy-MM-ddhhmmss")}.xls"
    override fun writeToFile(config: ExcelConfigVo, mode:Int) {
        val dbMapper = DbMapper(
            scenseMapper,
            problemlistMapper,
            problemtypeMapper,
            subtaskMapper,
            monitorobjectversionMapper,
            sceneConstructionSiteMapper,
            sceneMixingPlantMapper,
            sceneStorageYardMapper,
            sceneWharfMapper,
            taskMapper,
            evaluationruleMapper, evaluationsubruleMapper, evaluationMapper, itemevaluationMapper
        )
        val dataSource = DataSource(config, dbMapper)
        val t = when (mode) {
//            //问题与整改跟踪汇总表
//            0 -> ProDetailSummary(dataSource)
//            //分街镇问题整改分析汇总表
//            1 -> ProAnalysisSummary(dataSource)
//
//            //规范性评估详情表
//            2 -> ScoreDetailSummary(dataSource)
//            //分街镇规范性分析表
//            3 -> ScoreAnalysisSummary(dataSource)
//
//            //问题与整改分类统计表
//            4 -> ProTypeDetailSummary(dataSource)
//            //问题与整改分类排名
//            5 -> ProTypeRankSummary(dataSource)
//            //月度主要或典型问题分析表
//            6 -> ProTypeRankMainSummary(dataSource)
//            //工地施工阶段问题分类分析表
//            7 -> ProTypeStatusSummary(dataSource)
        val out = FileOutputStream(fileName)
//        val heads = getTableTitles(config.sceneType, config.districtCode)
//        val contents = getTableContents(config, heads.size)
        val r = getTable(2, config)
        ExcelUtil.write2(out, r.first, r.second)
            8 -> ReportOne(dataSource)
            9 -> ReportTwo(dataSource)
            10 -> ReportThree(dataSource)
            else -> null
        }
//        t?.execute()
        t?.toFile("target/")
    }
    override fun getExcel(config: ExcelConfigVo, response: HttpServletResponse): HttpServletResponse {
@@ -517,7 +562,7 @@
        //原有的第一行表头增加1行行跨度,同时新的第二行表头添加空位
        head[0].forEach {
            (it as ExcelUtil.MyCell).rowSpan++
            h2.add(0, "")
//            h2.add(0, "")
        }
        //合并表头
        head[0].addAll(h1)