feiyu02
2022-11-15 909fd8929d7906f1dca68acc05e36e29b0b9192c
2022.11.15
已修改35个文件
已添加10个文件
已复制2个文件
已重命名1个文件
1458 ■■■■■ 文件已修改
src/main/kotlin/cn/flightfeather/supervision/business/fume/AutoScore3.kt 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/business/fume/item/ScoreItem_5.kt 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/business/report/BaseCols.kt 35 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/business/report/BaseExcel.kt 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/business/report/BaseExcelMulti.kt 44 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/business/report/BaseOutputInterface.kt 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/business/report/BaseTemplate.kt 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/business/report/BaseTemplateMulti.kt 135 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/business/report/DataSource.kt 38 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/business/report/ReportUtil.kt 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/business/report/cols/ColInspectionInfo.kt 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/business/report/cols/ColItemGrade.kt 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/business/report/cols/ColLedger.kt 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/business/report/cols/ColProChange.kt 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/business/report/cols/ColProblemDistribution.kt 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/business/report/cols/ColSceneBaseInfo.kt 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/business/report/cols/ColSceneName.kt 18 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/business/report/cols/ColStatus.kt 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/business/report/cols/ColStrategy.kt 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/business/report/cols/ColTotalGrade.kt 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/business/report/cols/ColTown.kt 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/business/report/file/ReportThree.kt 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/business/report/template/DailyReportSummary.kt 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/business/report/template/ProAnalysisSummary.kt 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/business/report/template/ProTypeRankMainSummary.kt 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/business/report/template/ProTypeStatusSummary.kt 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/business/storage/StAutoScore.kt 31 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/business/storage/item/CsScoreItem_1.kt 57 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/business/storage/item/CsScoreItem_2.kt 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/business/storage/item/MpScoreItem_1.kt 57 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/business/storage/item/MpScoreItem_2.kt 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/business/storage/item/StScoreItem_1.kt 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/business/storage/item/WhScoreItem_1.kt 57 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/business/storage/item/WhScoreItem_2.kt 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/datafetch/FetchNightConstruction.kt 69 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/domain/ds1/mapper/MonitorobjectversionMapper.kt 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/SearchService.kt 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/SearchServiceImpl.kt 563 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/SubtaskServiceImpl.kt 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/UserinfoServiceImpl.kt 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/BaseTableVo.kt 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/ExcelConfigVo.kt 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/lightshare/web/SearchController.kt 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/application.yml 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/ds1/MonitorobjectversionMapper.xml 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/test/kotlin/cn/flightfeather/supervision/business/fume/AutoScoreTest.kt 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/test/kotlin/cn/flightfeather/supervision/lightshare/service/impl/EvaluationServiceImplTest.kt 25 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/test/kotlin/cn/flightfeather/supervision/lightshare/service/impl/SearchServiceImplTest.kt 46 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/kotlin/cn/flightfeather/supervision/business/fume/AutoScore3.kt
@@ -104,8 +104,8 @@
    fun go(_year: Int? = null, _month: Int? = null, _period: Int = 1) {
        /** 1.excel文件准备*************************************************************************/
        val fileName = "${SCENE_TYPE.text}自动评分-${DateUtil().DateToString(Date(), "yyyy-MM-ddhhmmss")}.xls"
        val filePath = "E:\\工作\\开发\\第三方监管app\\自动评分\\餐饮\\$fileName"
//        val filePath = "C:\\work\\工作\\第三方监管\\自动评分\\餐饮\\$fileName"
//        val filePath = "E:\\工作\\开发\\第三方监管app\\自动评分\\餐饮\\$fileName"
        val filePath = "C:\\work\\工作\\第三方监管\\自动评分\\餐饮\\$fileName"
        val out = FileOutputStream(File(filePath))
        getScoreItem()
@@ -387,7 +387,7 @@
            createCriteria()
                    .andEqualTo("tasktypeid", 99)
                    .andEqualTo("scensetypeid", SCENE_TYPE.value.toByte())
                    .andEqualTo("districtcode", "310104")
//                    .andEqualTo("districtcode", "310104")
        })
        if (rule.isNotEmpty()) {
            baseRules.addAll(rule)
src/main/kotlin/cn/flightfeather/supervision/business/fume/item/ScoreItem_5.kt
@@ -1,8 +1,14 @@
package cn.flightfeather.supervision.business.fume.item
import cn.flightfeather.supervision.business.ScoreItem
import cn.flightfeather.supervision.domain.ds1.entity.DustDataResult
import cn.flightfeather.supervision.domain.ds1.entity.Evaluationsubrule2
import cn.flightfeather.supervision.domain.ds1.mapper.DustDataResultMapper
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.stereotype.Component
import tk.mybatis.mapper.entity.Example
import java.time.LocalDateTime
import java.time.ZoneId
import javax.annotation.PostConstruct
@Component
@@ -19,6 +25,9 @@
    override var id: String = "PSQUi9f0f7JK6w9d"
    override var name: String="油烟在线监测数据量级"
    @Autowired
    lateinit var dustDataResultMapper: DustDataResultMapper
    /**
     * å¾æ±‡åŒºé¤é¥®ç›‘管平台联网记录、在线率分析数据和高峰经营时段小时超标情况
@@ -60,7 +69,19 @@
     * @return true  å½“月高峰经营时段出现三次及以上10分钟均值超标或显示净化装置较脏
     */
    private fun condition2(): Boolean {
        return false
        val r = dustDataResultMapper.selectByExample(Example(DustDataResult::class.java).apply {
            createCriteria().andGreaterThanOrEqualTo("drTime", info.sTime)
                .andLessThan("drTime", info.eTime)
                .andEqualTo("drSceneId", info.sceneId)
        })
        var result = false
        r.forEach {
            if (it.drExceedTimes > 0) {
                result = true
            }
        }
        return result
    }
    /**
src/main/kotlin/cn/flightfeather/supervision/business/report/BaseCols.kt
@@ -5,15 +5,31 @@
/**
 * ç»Ÿè®¡æ•°æ®åˆ—基类
 * @param chooseIndexList é€‰æ‹©éœ€è¦è¾“出的列序号,不填写时表示默认输出所有列
 */
abstract class BaseCols(){
abstract class BaseCols(private val chooseIndexList: List<Int>){
    protected var heads = mutableListOf<MutableList<ExcelUtil.MyCell>>()
    //生成表头
    fun getHeads(dataSource: DataSource): MutableList<MutableList<ExcelUtil.MyCell>> {
        heads = onHeads(dataSource)
        return heads
        val _heads = if (chooseIndexList.isNotEmpty()) {
            val __heads = mutableListOf<MutableList<ExcelUtil.MyCell>>()
            heads.forEach {head ->
                val h = mutableListOf<ExcelUtil.MyCell>()
                chooseIndexList.forEach {i ->
                    if (i < head.size) {
                        h.add(head[i])
                    }
                }
                __heads.add(h)
            }
            __heads
        } else {
            heads
        }
        return _heads
    }
    abstract fun onHeads(dataSource: DataSource): MutableList<MutableList<ExcelUtil.MyCell>>
@@ -27,7 +43,20 @@
//        } else {
//            onOneRow(rowData)
//        }
        return onOneRow(rowData)
        val row = onOneRow(rowData)
        val _row = if (chooseIndexList.isNotEmpty()) {
            val r = mutableListOf<Any>()
            chooseIndexList.forEach {i ->
                if (i < row.size) {
                    r.add(row[i])
                }
            }
            r
        } else {
            row
        }
        return _row
    }
    abstract fun onOneRow(rowData: DataSource.RowData): List<Any>
src/main/kotlin/cn/flightfeather/supervision/business/report/BaseExcel.kt
@@ -8,6 +8,7 @@
/**
 * å„模板合并输出为整体文档
 * å•个数据源
 */
abstract class BaseExcel(val dataSource: DataSource) {
src/main/kotlin/cn/flightfeather/supervision/business/report/BaseExcelMulti.kt
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,44 @@
package cn.flightfeather.supervision.business.report
import org.apache.poi.hssf.usermodel.HSSFWorkbook
import java.io.File
import java.io.FileOutputStream
import java.io.OutputStream
import java.util.*
/**
 * å„模板合并输出为整体文档
 * å•个数据源
 */
abstract class BaseExcelMulti(private val dataSourceList: List<DataSource>) {
    abstract val templates: List<BaseTemplateMulti>
    abstract val fileName: String
    // excel文档
    private var workbook = HSSFWorkbook()
    fun getReportName(): String = "${dataSourceList[0].areaName()}-${fileName}.xls"
    fun toFile(path: String) {
        val fileName = getReportName()
        val file = File(path + fileName)
        if (!file.parentFile.exists()) {
            file.parentFile.mkdirs()
        }
        val out = FileOutputStream(file)
        toOutputStream(out)
    }
    fun toOutputStream(out: OutputStream) {
        templates.forEach {
            it.execute()
            it.toWorkBook(workbook)
        }
        workbook.write(out)
        workbook.close()
        out.flush()
        out.close()
    }
}
src/main/kotlin/cn/flightfeather/supervision/business/report/BaseOutputInterface.kt
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,19 @@
package cn.flightfeather.supervision.business.report
import org.apache.poi.hssf.usermodel.HSSFWorkbook
import java.io.OutputStream
/**
 * æŠ¥å‘Šè¾“出接口
 */
interface BaseOutputInterface {
    fun toWorkBook(wb: HSSFWorkbook)
    fun toOutputStream(out: OutputStream, sheetName: String? = null)
    /**
     * è¾“出为文档
     */
    fun toFile(path: String)
}
src/main/kotlin/cn/flightfeather/supervision/business/report/BaseTemplate.kt
@@ -12,9 +12,10 @@
/**
 * excel报告模板基类
 * å•个数据源
 */
// FIXME: 2022/7/15 æ¨¡æ¿ç®€åŒ–:只有表头会涉及单元格合并,默认表内容中没有合并
abstract class BaseTemplate(val dataSource: DataSource){
abstract class BaseTemplate(val dataSource: DataSource) : BaseOutputInterface {
    //列组合
    abstract val cols: List<BaseCols>
@@ -24,6 +25,7 @@
    //表头
    val head = mutableListOf<MutableList<ExcelUtil.MyCell>>()
    //内容
    val contents = mutableListOf<MutableList<Any>>()
@@ -33,11 +35,11 @@
        dataSource.reset()
        //合成表头
        cols.forEach {
            it.combineHead(head,dataSource)
            it.combineHead(head, dataSource)
        }
        //合成数据
        dataSource.loop { index, rowData ->
            cols.forEach {col ->
            cols.forEach { col ->
                val r = col.getOneRow(rowData)
                if (index >= contents.size) {
                    contents.add(mutableListOf())
@@ -47,12 +49,12 @@
        }
    }
    fun toWorkBook(wb: HSSFWorkbook) {
    override fun toWorkBook(wb: HSSFWorkbook) {
        val f = tableFormat()
        ExcelUtil.write(f.first, f.second, wb, templateName)
    }
    fun toOutputStream(out: OutputStream, sheetName: String? = null) {
    override fun toOutputStream(out: OutputStream, sheetName: String?) {
        val f = tableFormat()
        ExcelUtil.write2(out, f.first, f.second, sheetName ?: templateName)
    }
@@ -60,7 +62,7 @@
    /**
     * è¾“出为文档
     */
    fun toFile(path: String) {
    override fun toFile(path: String) {
        val fileName = "${dataSource.areaName()}-${templateName}-${Date().time}.xls"
        val out = FileOutputStream(path + fileName)
        toOutputStream(out)
@@ -69,12 +71,13 @@
    /**
     * è¡¨å¤´å’Œè¡¨å†…容格式转化
     */
    private fun tableFormat(): Pair<MutableList<Array<Any>>, MutableList<Array<Any>>> {
    fun tableFormat(): Pair<MutableList<Array<Any>>, MutableList<Array<Any>>> {
        val h = mutableListOf<Array<Any>>()
        val c = mutableListOf<Array<Any>>()
        head.forEach { h.add(it.toTypedArray()) }
        contents.forEach { c.add(it.toTypedArray()) }
        val index = c[0][0]
        //按照第一列进行排序
        if (index is Int) {
            c.sortBy {
                if (it[0] is Int) {
@@ -91,11 +94,3 @@
        return Pair(h, c)
    }
}
//固定列组合
//基本信息
//问题扣分分布
src/main/kotlin/cn/flightfeather/supervision/business/report/BaseTemplateMulti.kt
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,135 @@
package cn.flightfeather.supervision.business.report
import cn.flightfeather.supervision.common.utils.Constant
import cn.flightfeather.supervision.common.utils.DateUtil
import cn.flightfeather.supervision.common.utils.ExcelUtil
import cn.flightfeather.supervision.domain.ds1.entity.Problemlist
import org.apache.poi.hssf.usermodel.HSSFWorkbook
import tk.mybatis.mapper.entity.Example
import java.io.FileOutputStream
import java.io.OutputStream
import java.util.*
/**
 * excel报告模板基类
 * å¤šä¸ªæ•°æ®æº
 */
// FIXME: 2022/7/15 æ¨¡æ¿ç®€åŒ–:只有表头会涉及单元格合并,默认表内容中没有合并
abstract class BaseTemplateMulti(private val dataSourceList: List<DataSource>) : BaseOutputInterface {
    //列组合
    abstract val cols: List<BaseCols>
    //模板名称
    abstract val templateName: String
    //表头
    val head = mutableListOf<MutableList<ExcelUtil.MyCell>>()
    //内容
    val contents = mutableListOf<MutableList<Any>>()
    open fun execute() {
        if (dataSourceList.isEmpty()) throw IllegalStateException("${templateName}: æ•°æ®æºä¸ºç©º")
        //合成表头
        cols.forEach {
            it.combineHead(head, dataSourceList[0])
        }
        var i = 0
        dataSourceList.forEach { dataSource ->
            //数据源重置
            dataSource.reset()
            //合成数据
            dataSource.loop { _, rowData ->
                cols.forEach { col ->
                    val r = col.getOneRow(rowData)
                    if (i >= contents.size) {
                        contents.add(mutableListOf())
                    }
                    contents[i].addAll(r)
                }
                i++
            }
        }
    }
    override fun toWorkBook(wb: HSSFWorkbook) {
        val f = tableFormat()
        ExcelUtil.write(f.first, f.second, wb, templateName)
    }
    override fun toOutputStream(out: OutputStream, sheetName: String?) {
        val f = tableFormat()
        ExcelUtil.write2(out, f.first, f.second, sheetName ?: templateName)
    }
    /**
     * è¾“出为文档
     */
    override fun toFile(path: String) {
//        val fileName = "${dataSource.areaName()}-${templateName}-${Date().time}.xls"
        val fileName = "${templateName}-${Date().time}.xls"
        val out = FileOutputStream(path + fileName)
        toOutputStream(out)
    }
    /**
     * è¡¨å¤´å’Œè¡¨å†…容格式转化
     */
    fun tableFormat(): Pair<MutableList<Array<Any>>, MutableList<Array<Any>>> {
        val h = mutableListOf<Array<Any>>()
        val c = mutableListOf<Array<Any>>()
        head.forEach { h.add(it.toTypedArray()) }
        contents.forEach { c.add(it.toTypedArray()) }
        val index = c[0][0]
        //按照第一列进行排序
        if (index is Int) {
            c.sortBy {
                if (it[0] is Int) {
                    it[0] as Int
                } else {
                    0
                }
            }
        } else {
            c.sortBy {
                it[0].toString()
            }
        }
        return Pair(h, c)
    }
    fun toTableRows(): Pair<MutableList<Array<Any>>, MutableList<Array<Any>>> {
        val h = mutableListOf<Array<Any>>()
        val c = mutableListOf<Array<Any>>()
        head.forEach { d ->
            val tempH = mutableListOf<Any>()
            d.forEach {
                tempH.add(it.text)
            }
            h.add(tempH.toTypedArray())
        }
        contents.forEach {
            c.add(it.toTypedArray())
        }
        val index = c[0][0]
        //按照第一列进行排序
        if (index is Int) {
            c.sortBy {
                if (it[0] is Int) {
                    it[0] as Int
                } else {
                    0
                }
            }
        } else {
            c.sortBy {
                it[0].toString()
            }
        }
        return Pair(h, c)
    }
}
src/main/kotlin/cn/flightfeather/supervision/business/report/DataSource.kt
@@ -39,12 +39,12 @@
    val rowData = RowData()
    init {
        if (config.districtCode == null) {
            throw IllegalStateException("参数缺少区县编码:[districtCode]")
        }
        if (config.sceneType == null) {
            throw IllegalStateException("参数缺少场景类型:[sceneType]")
        }
//        if (config.districtCode == null) {
//            throw IllegalStateException("参数缺少区县编码:[districtCode]")
//        }
//        if (config.sceneType == null) {
//            throw IllegalStateException("参数缺少场景类型:[sceneType]")
//        }
        getSource(config)
    }
@@ -76,10 +76,10 @@
    }
    /**
     * èŽ·å–æŠ¥å‘Šæ•°æ®æº
     * èŽ·å–æŠ¥å‘Šæ•°æ®æºï¼ˆå·¡æŸ¥ä»»åŠ¡ï¼‰
     */
    private fun getSource(config: ExcelConfigVo) {
        if (config.sceneType == null) return
//        if (config.sceneType == null) return
        val result = mutableListOf<Subtask>()
@@ -108,6 +108,8 @@
                    }
                    config.startTime?.let { andGreaterThanOrEqualTo("planstarttime", it) }
                    config.endTime?.let { andLessThanOrEqualTo("planendtime", it) }
                    config.districtCode?.let { andEqualTo("districtcode", it) }
//                    andEqualTo("tguid", config.topTaskGuid)
                }
            })
        } else {
@@ -142,6 +144,8 @@
        var index = 0
        var subTask: Subtask? = null
        private var lastScene: Scense? = null
        //场景基本信息
        val scene: Scense?
@@ -192,6 +196,7 @@
            }
        private var _problems = mutableListOf<Problemlist>()
        //评估总分
        val evaluation: Evaluation?
            get() {
                if (_evaluation == null) {
@@ -205,6 +210,7 @@
            }
        private var _evaluation: Evaluation? = null
        //评估细则得分
        val itemevaluationList: MutableList<Itemevaluation>
            get() {
                if (_itemevaluationList.isEmpty()) {
@@ -223,8 +229,8 @@
            get() {
                if (_problemTypes.isEmpty()) {
                    val r = dbMapper.problemtypeMapper.selectByExample(Example(Problemtype::class.java).apply {
                        createCriteria().andEqualTo("scensetypeid", config.sceneType)
                            .andEqualTo("districtcode", config.districtCode)
                        createCriteria().andEqualTo("scensetypeid", scene?.typeid)
                            .andEqualTo("districtcode", scene?.districtcode)
                        orderBy("extension1")
                    })
                    _problemTypes.addAll(r)
@@ -240,7 +246,7 @@
                    val rule = dbMapper.evaluationruleMapper.selectByExample(Example(Evaluationrule::class.java).apply {
                        createCriteria()
                            .andEqualTo("tasktypeid", 99)
                            .andEqualTo("scensetypeid", config.sceneType)
                            .andEqualTo("scensetypeid", scene?.typeid)
                    })
                    if (rule.isNotEmpty()) {
                        val ruleId = rule[0].guid
@@ -299,7 +305,7 @@
        val ledgerCount: Int
            get() {
                if (_ledgerCount == -1) {
                    val tzSceneType = Constant.ScenseType.typeMap(config.sceneType?.toByte())
                    val tzSceneType = Constant.ScenseType.typeMap(scene?.typeid)
                    _ledgerCount = dbMapper.ledgerSubTypeMapper.selectCountByExample(Example(LedgerSubType::class.java).apply {
                        createCriteria().andEqualTo("lScenetype", tzSceneType).andEqualTo("lNeedupdate", true)
                    })
@@ -356,6 +362,14 @@
         * æ¸…空当前处理的对象的相关数据源
         */
        fun clear() {
            if (lastScene != null && lastScene?.typeid != _scene?.typeid) {
                _problemTypes.clear()
                _topItems.clear()
                _rules.clear()
                _ledgerCount = -1
            } else {
                lastScene = _scene
            }
            _scene = null
            _baseScene = null
            _problems.clear()
src/main/kotlin/cn/flightfeather/supervision/business/report/ReportUtil.kt
@@ -4,4 +4,5 @@
 * æŠ¥å‘Šç”Ÿæˆå·¥å…·
 */
class ReportUtil {
}
src/main/kotlin/cn/flightfeather/supervision/business/report/cols/ColInspectionInfo.kt
@@ -7,9 +7,10 @@
import cn.flightfeather.supervision.common.utils.ExcelUtil
//监管详情
class ColInspectionInfo() : BaseCols() {
class ColInspectionInfo(chooseIndexList: List<Int> = emptyList()) : BaseCols(chooseIndexList) {
    override fun onHeads(dataSource: DataSource): MutableList<MutableList<ExcelUtil.MyCell>> {
        return mutableListOf(mutableListOf(
        return mutableListOf(
            mutableListOf(
                ExcelUtil.MyCell("监管时间"),
                ExcelUtil.MyCell("巡查人员"),
                ExcelUtil.MyCell("问题类型"),
@@ -30,7 +31,8 @@
                ExcelUtil.MyCell("问题审核占比"),
                ExcelUtil.MyCell("整改审核数"),
                ExcelUtil.MyCell("整改审核占比"),
        ))
            )
        )
    }
    override fun onOneRow(rowData: DataSource.RowData): List<Any> {
@@ -136,7 +138,7 @@
                    listOf(
                        pType, pDes, pLoc, pNum, changeTime, pChanged, changedProblem, cNum,
                        unChangedProblem, unChangeNum, changePercent, checkStatus, pCheckTime, cCheckTime,
                            pCheckNum, pCheckPer, cCheckNum, cCheckPer
                        pCheckNum, pCheckPer, cCheckNum, cCheckPer
                    )
                )
            }
src/main/kotlin/cn/flightfeather/supervision/business/report/cols/ColItemGrade.kt
@@ -6,7 +6,8 @@
import cn.flightfeather.supervision.domain.ds1.entity.Itemevaluation
import org.apache.poi.hssf.util.HSSFColor
class ColItemGrade(private val hasHead3: Boolean = true) : BaseCols() {
//评估得分
class ColItemGrade(private val hasHead3: Boolean = true, chooseIndexList: List<Int> = emptyList()) : BaseCols(chooseIndexList) {
    override fun onHeads(dataSource: DataSource): MutableList<MutableList<ExcelUtil.MyCell>> {
        val h1 = mutableListOf<ExcelUtil.MyCell>()
src/main/kotlin/cn/flightfeather/supervision/business/report/cols/ColLedger.kt
@@ -10,7 +10,8 @@
import java.util.*
import kotlin.random.Random
class ColLedger : BaseCols() {
//台账上传情况
class ColLedger(chooseIndexList: List<Int> = emptyList()) : BaseCols(chooseIndexList) {
    override fun onHeads(dataSource: DataSource): MutableList<MutableList<ExcelUtil.MyCell>> {
        return mutableListOf(mutableListOf(
            ExcelUtil.MyCell("台账提交百分比"),
src/main/kotlin/cn/flightfeather/supervision/business/report/cols/ColProChange.kt
@@ -4,7 +4,8 @@
import cn.flightfeather.supervision.business.report.DataSource
import cn.flightfeather.supervision.common.utils.ExcelUtil
class ColProChange : BaseCols() {
//问题整改计数
class ColProChange(chooseIndexList: List<Int> = emptyList()) : BaseCols(chooseIndexList) {
    override fun onHeads(dataSource: DataSource): MutableList<MutableList<ExcelUtil.MyCell>> {
        return mutableListOf(
            mutableListOf(ExcelUtil.MyCell("问题与整改", colSpan = 2)),
src/main/kotlin/cn/flightfeather/supervision/business/report/cols/ColProblemDistribution.kt
@@ -5,7 +5,7 @@
import cn.flightfeather.supervision.common.utils.ExcelUtil
//问题整改分布
class ColProblemDistribution() : BaseCols() {
class ColProblemDistribution(chooseIndexList: List<Int> = emptyList()) : BaseCols(chooseIndexList) {
    private var h2 = mutableListOf<ExcelUtil.MyCell>()
    private val currentProblemType = mutableMapOf<String, String>()
    private val currentProblemHead = mutableListOf<String>()
src/main/kotlin/cn/flightfeather/supervision/business/report/cols/ColSceneBaseInfo.kt
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,31 @@
package cn.flightfeather.supervision.business.report.cols
import cn.flightfeather.supervision.business.report.BaseCols
import cn.flightfeather.supervision.business.report.DataSource
import cn.flightfeather.supervision.common.utils.ExcelUtil
//场景基础信息
class ColSceneBaseInfo(chooseIndexList: List<Int> = emptyList()) : BaseCols(chooseIndexList) {
    override fun onHeads(dataSource: DataSource): MutableList<MutableList<ExcelUtil.MyCell>> {
        return mutableListOf(
            mutableListOf(
                ExcelUtil.MyCell("地址"),
//                ExcelUtil.MyCell("业主单位"),
//                ExcelUtil.MyCell("施工单位"),
//                ExcelUtil.MyCell("建筑面积(m²)"),
//                ExcelUtil.MyCell("施工起始时间"),
//                ExcelUtil.MyCell("施工结束时间"),
//                ExcelUtil.MyCell("工程类型"),
//                ExcelUtil.MyCell("联系人"),
//                ExcelUtil.MyCell("联系方式"),
            )
        )
    }
    override fun onOneRow(rowData: DataSource.RowData): List<Any> {
//        return listOf(rowData.scene?.index ?: -99, rowData.scene?.extension2 ?: "", rowData.scene?.name ?: "")
        return listOf(
            rowData.scene?.location ?: ""
        )
    }
}
src/main/kotlin/cn/flightfeather/supervision/business/report/cols/ColSceneName.kt
@@ -4,16 +4,26 @@
import cn.flightfeather.supervision.business.report.DataSource
import cn.flightfeather.supervision.common.utils.ExcelUtil
//名称
class ColSceneName() : BaseCols() {
//场景名称及类型
class ColSceneName(chooseIndexList: List<Int> = emptyList()) : BaseCols(chooseIndexList) {
    override fun onHeads(dataSource: DataSource): MutableList<MutableList<ExcelUtil.MyCell>> {
        return mutableListOf(
            mutableListOf(ExcelUtil.MyCell("表单编号"), ExcelUtil.MyCell("唯一序号"), ExcelUtil.MyCell("场景名称"))
            mutableListOf(
                ExcelUtil.MyCell("表单编号"),
                ExcelUtil.MyCell("唯一序号"),
                ExcelUtil.MyCell("场景类型"),
                ExcelUtil.MyCell("场景名称")
            )
        )
    }
    override fun onOneRow(rowData: DataSource.RowData): List<Any> {
//        return listOf(rowData.scene?.index ?: -99, rowData.scene?.extension2 ?: "", rowData.scene?.name ?: "")
        return listOf(rowData.index + 1, rowData.scene?.index ?: -99, rowData.scene?.name ?: "")
        return listOf(
            rowData.index + 1,
            rowData.scene?.index ?: -99,
            rowData.scene?.type ?: "",
            rowData.scene?.name ?: ""
        )
    }
}
src/main/kotlin/cn/flightfeather/supervision/business/report/cols/ColStatus.kt
@@ -9,7 +9,7 @@
import cn.flightfeather.supervision.domain.ds1.entity.SceneStorageYard
import cn.flightfeather.supervision.domain.ds1.entity.SceneWharf
class ColStatus : BaseCols() {
class ColStatus(chooseIndexList: List<Int> = emptyList()) : BaseCols(chooseIndexList) {
    override fun onHeads(dataSource: DataSource): MutableList<MutableList<ExcelUtil.MyCell>> {
        return mutableListOf(mutableListOf(
            ExcelUtil.MyCell("施工/营运状态"),
src/main/kotlin/cn/flightfeather/supervision/business/report/cols/ColStrategy.kt
@@ -9,7 +9,7 @@
import java.time.ZoneId
import java.time.temporal.ChronoUnit
class ColStrategy : BaseCols() {
class ColStrategy(chooseIndexList: List<Int> = emptyList()) : BaseCols(chooseIndexList) {
    override fun onHeads(dataSource: DataSource): MutableList<MutableList<ExcelUtil.MyCell>> {
        return mutableListOf(mutableListOf(
            ExcelUtil.MyCell("整改跟踪提醒")
src/main/kotlin/cn/flightfeather/supervision/business/report/cols/ColTotalGrade.kt
@@ -6,7 +6,7 @@
import cn.flightfeather.supervision.domain.ds1.entity.Itemevaluation
import org.apache.poi.hssf.util.HSSFColor
class ColTotalGrade() : BaseCols() {
class ColTotalGrade(chooseIndexList: List<Int> = emptyList()) : BaseCols(chooseIndexList) {
    override fun onHeads(dataSource: DataSource): MutableList<MutableList<ExcelUtil.MyCell>> {
        val h1 = mutableListOf<ExcelUtil.MyCell>()
src/main/kotlin/cn/flightfeather/supervision/business/report/cols/ColTown.kt
@@ -4,7 +4,7 @@
import cn.flightfeather.supervision.business.report.DataSource
import cn.flightfeather.supervision.common.utils.ExcelUtil
class ColTown : BaseCols() {
class ColTown(chooseIndexList: List<Int> = emptyList()) : BaseCols(chooseIndexList) {
    override fun onHeads(dataSource: DataSource): MutableList<MutableList<ExcelUtil.MyCell>> {
        return mutableListOf(mutableListOf(ExcelUtil.MyCell("街镇/工业区")))
    }
src/main/kotlin/cn/flightfeather/supervision/business/report/file/ReportThree.kt
@@ -6,6 +6,7 @@
import cn.flightfeather.supervision.business.report.template.*
class ReportThree(dataSource: DataSource) : BaseExcel(dataSource) {
    override val templates: List<BaseTemplate> = listOf(ProTypeDetailSummary(dataSource), ProTypeRankSummary(dataSource), ProTypeRankMainSummary(dataSource), ProTypeStatusSummary(dataSource))
    override val templates: List<BaseTemplate> = listOf(ProTypeDetailSummary(dataSource),
        ProTypeRankSummary(dataSource), ProTypeRankMainSummary(dataSource), ProTypeStatusSummary(dataSource))
    override val fileName: String = "问题与整改分布分析清单"
}
src/main/kotlin/cn/flightfeather/supervision/business/report/template/DailyReportSummary.kt
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,22 @@
package cn.flightfeather.supervision.business.report.template
import cn.flightfeather.supervision.business.report.BaseCols
import cn.flightfeather.supervision.business.report.BaseTemplateMulti
import cn.flightfeather.supervision.business.report.DataSource
import cn.flightfeather.supervision.business.report.cols.ColInspectionInfo
import cn.flightfeather.supervision.business.report.cols.ColSceneBaseInfo
import cn.flightfeather.supervision.business.report.cols.ColSceneName
import cn.flightfeather.supervision.business.report.cols.ColTown
class DailyReportSummary(dataSourceList: List<DataSource>) : BaseTemplateMulti(dataSourceList) {
    override val cols: List<BaseCols> = listOf(
        ColSceneName(),
        ColSceneBaseInfo(),
        ColTown(),
        ColInspectionInfo(listOf(2, 3, 4, 5, 7, 8, 9))
    )
    override val templateName: String = "日报统计"
}
src/main/kotlin/cn/flightfeather/supervision/business/report/template/ProAnalysisSummary.kt
@@ -34,7 +34,7 @@
            val r = cols[0].getOneRow(rowData)
            val r1 = cols[1].getOneRow(rowData)
//            val r2 = cols[2].getOneRow(rowData)
            val r2 = cols[2].getOneRow(rowData)
            val k = rowData.scene?.townname
            if (!districtMap.containsKey(k)) {
@@ -76,15 +76,11 @@
                changeNum += cNum
                //根据规范性和监管策略结果判断是否为重点监管对象
                val standard = r1[1] as ExcelUtil.MyCell
                if (standard.text.contains("严重不规范")) {
                if (standard.text.contains("严重不规范") || r2[0].toString().contains("7、")) {
                    focusSceneNum++
                }
                //根据监管策略结果判断是否为重点监管对象
//                if (r2[0].toString().contains("7、")) {
//                    focusSceneNum++
//                }
            }
        }
src/main/kotlin/cn/flightfeather/supervision/business/report/template/ProTypeRankMainSummary.kt
@@ -9,6 +9,7 @@
    override val templateName: String = "月度主要或典型问题分析表"
    override fun formatTable(summarys: MutableList<Summary>) {
        //排名靠前的max个问题被认定为主要或典型问题
        val max = when (dataSource.config.sceneType.toString()) {
            Constant.ScenseType.TYPE1.value -> 5
            else -> 4
src/main/kotlin/cn/flightfeather/supervision/business/report/template/ProTypeStatusSummary.kt
@@ -15,7 +15,8 @@
    @Throws(Exception::class)
    override fun execute() {
        if (dataSource.config.sceneType.toString() != Constant.ScenseType.TYPE1.value) {
            throw IllegalStateException("${templateName}只能针对工地进行分析,当前传入场景类型编号为${dataSource.config.sceneType}")
//            throw IllegalStateException("${templateName}只能针对工地进行分析,当前传入场景类型编号为${dataSource.config.sceneType}")
            println("sadas")
        }
        dataSource.reset()
src/main/kotlin/cn/flightfeather/supervision/business/storage/StAutoScore.kt
@@ -2,8 +2,7 @@
import cn.flightfeather.supervision.business.Info
import cn.flightfeather.supervision.business.ScoreItem
import cn.flightfeather.supervision.business.storage.item.StScoreItem_1
import cn.flightfeather.supervision.business.storage.item.StScoreItem_2
import cn.flightfeather.supervision.business.storage.item.*
import cn.flightfeather.supervision.common.utils.Constant
import cn.flightfeather.supervision.common.utils.DateUtil
import cn.flightfeather.supervision.common.utils.ExcelUtil
@@ -31,8 +30,13 @@
@Component
class StAutoScore(
    csScoreItem_1: CsScoreItem_1,
    csScoreItem_2: CsScoreItem_2,
    mpScoreItem_1: MpScoreItem_1,
    mpScoreItem_2: MpScoreItem_2,
    stScoreItem_1: StScoreItem_1,
    stScoreItem_2: StScoreItem_2,
    whScoreItem_1: WhScoreItem_1,
    whScoreItem_2: WhScoreItem_2,
    var sceneType: Constant.ScenseType = Constant.ScenseType.TYPE1, )
{
    companion object {
@@ -94,8 +98,15 @@
    private val rows = mutableListOf<Array<Any>>()
    init {
        itemList.add(stScoreItem_1)
        itemList.add(stScoreItem_2)
        itemList.apply {
            add(csScoreItem_1)
            add(csScoreItem_2)
            add(mpScoreItem_1)
            add(mpScoreItem_2)
            add(stScoreItem_1)
            add(whScoreItem_1)
            add(whScoreItem_2)
        }
    }
    @PostConstruct
@@ -112,8 +123,9 @@
     */
    fun topTaskGrade(topTaskId:String) {
        rows.clear()
        getScoreItem()
        subtaskMapper.selectByTopTask2(topTaskId, sceneType.value.toInt()).forEach {
            sceneGrade(it)
            sceneGradeP(it)
//            sceneGradeToFile(it)
        }
//        toFile()
@@ -127,6 +139,10 @@
        // èŽ·å–è¯„åˆ†è§„åˆ™
        getScoreItem()
        sceneGradeP(subtask)
    }
    private fun sceneGradeP(subtask: Subtask) {
        val info = itemGrade(subtask)
        val result = totalGrade(info) ?: return
        toDb(info, result)
@@ -141,6 +157,9 @@
        val info = itemGrade(subtask)
        val result = totalGrade(info) ?: return
        addToFile(rows, info, result.first)
    }
    fun grade(subtask: Subtask) {
    }
src/main/kotlin/cn/flightfeather/supervision/business/storage/item/CsScoreItem_1.kt
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,57 @@
package cn.flightfeather.supervision.business.storage.item
import cn.flightfeather.supervision.business.ScoreItem
import cn.flightfeather.supervision.domain.ds1.entity.Problemlist
import org.springframework.stereotype.Component
import tk.mybatis.mapper.entity.Example
import javax.annotation.PostConstruct
/**
 * Date 2022/1/20 16:14
 * Created by feiyu
 * å·¥åœ°
 */
@Component
class CsScoreItem_1:ScoreItem() {
    companion object {
        private lateinit var instance: CsScoreItem_1
    }
    @PostConstruct
    fun init() {
        instance = this
    }
    override var id: String = "amSNTZfXs2XXR1td"
    override var name: String = "整改措施及效果"
    /**
     * æ‰§æ³•检查汇总情况
     * é€‰é¡¹å¦‚下:
     *      1.问题部分整改或不及时提供材料
     *      2.问题无整改
     */
    override fun otherProblem(size: Int): Int? {
        val p = problemlistMapper.selectByExample(Example(Problemlist::class.java).apply {
            createCriteria().andEqualTo("stguid", info.subTask?.stguid)
//                .andGreaterThanOrEqualTo("time", info.sTime)
//                .andLessThan("time", info.eTime)
        })
        var i = 0
        val total = p.size
        var changed = 0
        p.forEach {
            if (it.ischanged == true) {
                changed++
            }
        }
        return when {
            changed == 0 && total > 0 -> 1
            changed < total -> 0
            else -> null
        }
    }
}
src/main/kotlin/cn/flightfeather/supervision/business/storage/item/CsScoreItem_2.kt
ÎļþÃû´Ó src/main/kotlin/cn/flightfeather/supervision/business/storage/item/StScoreItem_2.kt ÐÞ¸Ä
@@ -2,9 +2,7 @@
import cn.flightfeather.supervision.business.ScoreItem
import cn.flightfeather.supervision.domain.ds1.entity.DustDataResult
import cn.flightfeather.supervision.domain.ds1.entity.Problemlist
import cn.flightfeather.supervision.domain.ds1.mapper.DustDataResultMapper
import cn.flightfeather.supervision.domain.ds1.mapper.ProblemlistMapper
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.stereotype.Component
import tk.mybatis.mapper.entity.Example
@@ -15,12 +13,13 @@
/**
 * Date 2022/1/20 16:14
 * Created by feiyu
 * å·¥åœ°
 */
@Component
class StScoreItem_2:ScoreItem() {
class CsScoreItem_2:ScoreItem() {
    companion object {
        private lateinit var instance: StScoreItem_2
        private lateinit var instance: CsScoreItem_2
    }
    @PostConstruct
src/main/kotlin/cn/flightfeather/supervision/business/storage/item/MpScoreItem_1.kt
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,57 @@
package cn.flightfeather.supervision.business.storage.item
import cn.flightfeather.supervision.business.ScoreItem
import cn.flightfeather.supervision.domain.ds1.entity.Problemlist
import org.springframework.stereotype.Component
import tk.mybatis.mapper.entity.Example
import javax.annotation.PostConstruct
/**
 * Date 2022/1/20 16:14
 * Created by feiyu
 * æ…拌站
 */
@Component
class MpScoreItem_1:ScoreItem() {
    companion object {
        private lateinit var instance: MpScoreItem_1
    }
    @PostConstruct
    fun init() {
        instance = this
    }
    override var id: String = "KxWcuelbrnCtzw6n"
    override var name: String = "整改措施及效果"
    /**
     * æ‰§æ³•检查汇总情况
     * é€‰é¡¹å¦‚下:
     *      1.问题部分整改或不及时提供材料
     *      2.问题无整改
     */
    override fun otherProblem(size: Int): Int? {
        val p = problemlistMapper.selectByExample(Example(Problemlist::class.java).apply {
            createCriteria().andEqualTo("stguid", info.subTask?.stguid)
//                .andGreaterThanOrEqualTo("time", info.sTime)
//                .andLessThan("time", info.eTime)
        })
        var i = 0
        val total = p.size
        var changed = 0
        p.forEach {
            if (it.ischanged == true) {
                changed++
            }
        }
        return when {
            changed == 0 && total > 0 -> 1
            changed < total -> 0
            else -> null
        }
    }
}
src/main/kotlin/cn/flightfeather/supervision/business/storage/item/MpScoreItem_2.kt
copy from src/main/kotlin/cn/flightfeather/supervision/business/storage/item/StScoreItem_2.kt copy to src/main/kotlin/cn/flightfeather/supervision/business/storage/item/MpScoreItem_2.kt
Îļþ´Ó src/main/kotlin/cn/flightfeather/supervision/business/storage/item/StScoreItem_2.kt ¸´ÖÆ
@@ -2,9 +2,7 @@
import cn.flightfeather.supervision.business.ScoreItem
import cn.flightfeather.supervision.domain.ds1.entity.DustDataResult
import cn.flightfeather.supervision.domain.ds1.entity.Problemlist
import cn.flightfeather.supervision.domain.ds1.mapper.DustDataResultMapper
import cn.flightfeather.supervision.domain.ds1.mapper.ProblemlistMapper
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.stereotype.Component
import tk.mybatis.mapper.entity.Example
@@ -15,12 +13,13 @@
/**
 * Date 2022/1/20 16:14
 * Created by feiyu
 * å·¥åœ°
 */
@Component
class StScoreItem_2:ScoreItem() {
class MpScoreItem_2:ScoreItem() {
    companion object {
        private lateinit var instance: StScoreItem_2
        private lateinit var instance: MpScoreItem_2
    }
    @PostConstruct
@@ -28,7 +27,7 @@
        instance = this
    }
    override var id: String = "dCQbQ8ibc6nexiJo"
    override var id: String = "BoVfRjr5r7RtsqGC"
    override var name: String = "扬尘在线监测数据量级"
src/main/kotlin/cn/flightfeather/supervision/business/storage/item/StScoreItem_1.kt
@@ -9,6 +9,7 @@
/**
 * Date 2022/1/20 16:14
 * Created by feiyu
 * å †åœº
 */
@Component
class StScoreItem_1:ScoreItem() {
@@ -22,7 +23,7 @@
        instance = this
    }
    override var id: String = "amSNTZfXs2XXR1td"
    override var id: String = "csInMYhgbBqWRyeB"
    override var name: String = "整改措施及效果"
src/main/kotlin/cn/flightfeather/supervision/business/storage/item/WhScoreItem_1.kt
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,57 @@
package cn.flightfeather.supervision.business.storage.item
import cn.flightfeather.supervision.business.ScoreItem
import cn.flightfeather.supervision.domain.ds1.entity.Problemlist
import org.springframework.stereotype.Component
import tk.mybatis.mapper.entity.Example
import javax.annotation.PostConstruct
/**
 * Date 2022/1/20 16:14
 * Created by feiyu
 * ç å¤´
 */
@Component
class WhScoreItem_1:ScoreItem() {
    companion object {
        private lateinit var instance: WhScoreItem_1
    }
    @PostConstruct
    fun init() {
        instance = this
    }
    override var id: String = "mgvVEecYRV8xrnf2"
    override var name: String = "整改措施及效果"
    /**
     * æ‰§æ³•检查汇总情况
     * é€‰é¡¹å¦‚下:
     *      1.问题部分整改或不及时提供材料
     *      2.问题无整改
     */
    override fun otherProblem(size: Int): Int? {
        val p = problemlistMapper.selectByExample(Example(Problemlist::class.java).apply {
            createCriteria().andEqualTo("stguid", info.subTask?.stguid)
//                .andGreaterThanOrEqualTo("time", info.sTime)
//                .andLessThan("time", info.eTime)
        })
        var i = 0
        val total = p.size
        var changed = 0
        p.forEach {
            if (it.ischanged == true) {
                changed++
            }
        }
        return when {
            changed == 0 && total > 0 -> 1
            changed < total -> 0
            else -> null
        }
    }
}
src/main/kotlin/cn/flightfeather/supervision/business/storage/item/WhScoreItem_2.kt
copy from src/main/kotlin/cn/flightfeather/supervision/business/storage/item/StScoreItem_2.kt copy to src/main/kotlin/cn/flightfeather/supervision/business/storage/item/WhScoreItem_2.kt
Îļþ´Ó src/main/kotlin/cn/flightfeather/supervision/business/storage/item/StScoreItem_2.kt ¸´ÖÆ
@@ -2,9 +2,7 @@
import cn.flightfeather.supervision.business.ScoreItem
import cn.flightfeather.supervision.domain.ds1.entity.DustDataResult
import cn.flightfeather.supervision.domain.ds1.entity.Problemlist
import cn.flightfeather.supervision.domain.ds1.mapper.DustDataResultMapper
import cn.flightfeather.supervision.domain.ds1.mapper.ProblemlistMapper
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.stereotype.Component
import tk.mybatis.mapper.entity.Example
@@ -15,12 +13,13 @@
/**
 * Date 2022/1/20 16:14
 * Created by feiyu
 * å·¥åœ°
 */
@Component
class StScoreItem_2:ScoreItem() {
class WhScoreItem_2:ScoreItem() {
    companion object {
        private lateinit var instance: StScoreItem_2
        private lateinit var instance: WhScoreItem_2
    }
    @PostConstruct
@@ -28,7 +27,7 @@
        instance = this
    }
    override var id: String = "dCQbQ8ibc6nexiJo"
    override var id: String = "5NNLSvkVRFfASMhc"
    override var name: String = "扬尘在线监测数据量级"
src/main/kotlin/cn/flightfeather/supervision/datafetch/FetchNightConstruction.kt
@@ -57,47 +57,48 @@
                DEFAULT_TIME
            }
            NCHttpService.getFile(timeStr)?.forEach {e ->
                if (e.isJsonObject) {
                    val vo = e.asJsonObject
                    val nightConstruction = NightConstruction().apply {
                        ncNum = vo["nightallnum"].asString
                        ncItemName = vo["itemName"].asString
                        ncItemUnit = vo["itemUnit"].asString
                        ncConstructionUnit = vo["constructionUnit"].asString
                        ncPerson = vo["person"].asString
                        ncApplyContent = vo["applyContent"].asString
                        ncStartDate = dateUtil.StringToDate(vo["startDate"].asString)
                        ncEndDate = dateUtil.StringToDate(vo["endDate"].asString)
                        ncFileName = vo["filename"].asString
                        ncCreateTime = dateUtil.StringToDate(vo["createtime"].asString)
                        ncUrl = vo["url"].asString
                        ncProvinceCode = PROVINCE_CODE
                        ncProvinceName = PROVINCE_NAME
                        ncCityCode = CITY_CODE
                        ncCityName = CITY_NAME
                        ncDistrictCode = DISTRICT_CODE
                        ncDistrictName = DISTRICT_NAME
                    }
                    nightConstructionMapper.selectByExample(Example(NightConstruction::class.java).apply {
                        createCriteria().andEqualTo("ncNum", nightConstruction.ncNum)
                    }).run {
                        nightConstructionMapper.selectByExample(Example(NightConstruction::class.java).apply {
                            createCriteria().andEqualTo("ncItemName", nightConstruction.ncItemName)
                        }).takeIf { l-> l.isNotEmpty() }?.get(0)?.let { r->
                            nightConstruction.ncUserId = r.ncUserId
                            nightConstruction.ncSceneId = r.ncSceneId
            try {
                NCHttpService.getFile(timeStr)?.forEach {e ->
                    if (e.isJsonObject) {
                        val vo = e.asJsonObject
                        val nightConstruction = NightConstruction().apply {
                            ncNum = vo["nightallnum"].asString
                            ncItemName = vo["itemName"].asString
                            ncItemUnit = vo["itemUnit"].asString
                            ncConstructionUnit = vo["constructionUnit"].asString
                            ncPerson = vo["person"].asString
                            ncApplyContent = vo["applyContent"].asString
                            ncStartDate = dateUtil.StringToDate(vo["startDate"].asString)
                            ncEndDate = dateUtil.StringToDate(vo["endDate"].asString)
                            ncFileName = vo["filename"].asString
                            ncCreateTime = dateUtil.StringToDate(vo["createtime"].asString)
                            ncUrl = vo["url"].asString
                            ncProvinceCode = PROVINCE_CODE
                            ncProvinceName = PROVINCE_NAME
                            ncCityCode = CITY_CODE
                            ncCityName = CITY_NAME
                            ncDistrictCode = DISTRICT_CODE
                            ncDistrictName = DISTRICT_NAME
                        }
                        if (isEmpty()) {
                            try {
                        nightConstructionMapper.selectByExample(Example(NightConstruction::class.java).apply {
                            createCriteria().andEqualTo("ncNum", nightConstruction.ncNum)
                        }).run {
                            nightConstructionMapper.selectByExample(Example(NightConstruction::class.java).apply {
                                createCriteria().andEqualTo("ncItemName", nightConstruction.ncItemName)
                            }).takeIf { l-> l.isNotEmpty() }?.get(0)?.let { r->
                                nightConstruction.ncUserId = r.ncUserId
                                nightConstruction.ncSceneId = r.ncSceneId
                            }
                            if (isEmpty()) {
                                nightConstructionMapper.insert(nightConstruction)
                            } catch (e: Exception) {
                                e.printStackTrace()
                            }
                        }
                    }
                }
            } catch (e: Exception) {
                e.printStackTrace()
            }
        }
    }
src/main/kotlin/cn/flightfeather/supervision/domain/ds1/mapper/MonitorobjectversionMapper.kt
@@ -10,5 +10,5 @@
    //    @Select("select b.S_GUID from sm_t_monitorobjectversion as a left join sm_t_scense as b on a.S_GUID = b.S_GUID" +
//            " where a.T_ID = #{param1} and b.S_TypeID = #{param2}")
    fun getSceneByType(topTaskId: String, sceneTypeId: Int, townCode: String? = null): List<String>
    fun getSceneByType(topTaskId: String, sceneTypeId: Int? = null, townCode: String? = null): List<String>
}
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/SearchService.kt
@@ -22,4 +22,6 @@
    fun searchScore4JingAn(token: String, year: Int, month: Int, page: Int? = 1, perPage: Int?): BaseResponse<List<ScoreVo>>
    fun searchSubTaskByKeyword(userId: String, keyword: String, page: Int, perPage: Int): BaseResponse<List<SubtaskVo>>
    fun getDailyReport(config: ExcelConfigVo): BaseTableVo
}
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/SearchServiceImpl.kt
@@ -13,6 +13,7 @@
import cn.flightfeather.supervision.domain.ds2.mapper.LedgerSubTypeMapper
import cn.flightfeather.supervision.domain.ds2.mapper.UserMapMapper
import cn.flightfeather.supervision.lightshare.service.SearchService
import cn.flightfeather.supervision.lightshare.service.TaskService
import cn.flightfeather.supervision.lightshare.vo.*
import com.github.pagehelper.PageHelper
import org.springframework.beans.BeanUtils
@@ -56,6 +57,7 @@
        val ledgerSubTypeMapper: LedgerSubTypeMapper,
        val ledgerRecordMapper: LedgerRecordMapper,
        val userMapMapper: UserMapMapper,
        val taskService: TaskService
) : SearchService {
    private val dateUtil = DateUtil()
@@ -152,10 +154,38 @@
    }
    override fun getSubTaskDetail(config: ExcelConfigVo): SubTaskTableVo {
        val titles = getTableTitles(config.sceneType, config.districtCode)
        val content = getTableContents(config, titles.size)
        val dbMapper = DbMapper(
            scenseMapper,
            problemlistMapper,
            problemtypeMapper,
            subtaskMapper,
            monitorobjectversionMapper,
            sceneConstructionSiteMapper,
            sceneMixingPlantMapper,
            sceneStorageYardMapper,
            sceneWharfMapper,
            taskMapper,
            evaluationruleMapper, evaluationsubruleMapper, evaluationMapper, itemevaluationMapper,
            ledgerSubTypeMapper, ledgerRecordMapper, userinfoMapper, userMapMapper, townMapper
        )
//        val dataSource = DataSource(config, dbMapper)
//        val t = when (config.mode) {
////            1 -> ReportOne(dataSource)
////            2 -> ReportTwo(dataSource)
////            3 -> ReportThree(dataSource)
//            4->DailyReportSummary()
//            else -> ReportOne(dataSource)
//        }
//        val fileName = t.getReportName()
//        val fName = URLEncoder.encode(fileName, "UTF-8")
//
//        val p = Constant.DEFAULT_FILE_PATH + "/files/autoscore/"
//        val file = File(p + fileName)
//        if (config.forceUpdate || !file.exists()) {
//            t.toFile(p)
//        }
        return SubTaskTableVo(titles, content)
        return SubTaskTableVo(emptyList(), emptyList())
    }
    override fun downloadPic(config: ExcelConfigVo, response: HttpServletResponse): HttpServletResponse {
@@ -204,7 +234,7 @@
            //根据场景条件筛选
            val need = if (config.sceneType != null) {
                scene.typeid == config.sceneType.toByte()
                scene.typeid == config.sceneType?.toByte()
            } else {
                true
            }
@@ -488,501 +518,42 @@
        return BaseResponse(true, head = DataHead(pageInfo.pageNum, pageInfo.pages), data = result)
    }
    override fun getDailyReport(config: ExcelConfigVo): BaseTableVo {
        if (config.districtCode == null || config.startTime == null) return BaseTableVo(emptyList(), emptyList())
    private fun getTable(mode: Int, config: ExcelConfigVo): Pair<MutableList<Array<Any>>, MutableList<Array<Any>>> {
        //数据源
        val dataList = getTableDataSource(config)
        //生成表格
        val head = mutableListOf<MutableList<Any>>()
        val contents = mutableListOf<MutableList<Any>>()
        val dbMapper = DbMapper(
            scenseMapper,
            problemlistMapper,
            problemtypeMapper,
            subtaskMapper,
            monitorobjectversionMapper,
            sceneConstructionSiteMapper,
            sceneMixingPlantMapper,
            sceneStorageYardMapper,
            sceneWharfMapper,
            taskMapper,
            evaluationruleMapper, evaluationsubruleMapper, evaluationMapper, itemevaluationMapper,
            ledgerSubTypeMapper, ledgerRecordMapper, userinfoMapper, userMapMapper, townMapper
        )
        val task = taskService.getByDistrictCode(config.districtCode, config.startTime)?.takeIf { it.isNotEmpty() }?.get(0)
        config.topTaskGuid = task?.tguid ?: ""
        val dataSource = mutableListOf<DataSource>()
        config.sceneType = Constant.ScenseType.TYPE1.value.toInt()
        dataSource.add(DataSource(config, dbMapper))
        getSceneName(head, contents, dataList)
//        val config2 = config.copy(sceneType = Constant.ScenseType.TYPE2.value.toInt())
//        dataSource.add(DataSource(config2, dbMapper))
//
//        val config3 = config.copy(sceneType = Constant.ScenseType.TYPE3.value.toInt())
//        dataSource.add(DataSource(config3, dbMapper))
//
//        val config4 = config.copy(sceneType = Constant.ScenseType.TYPE14.value.toInt())
//        dataSource.add(DataSource(config4, dbMapper))
        when (mode) {
            // é—®é¢˜åˆ†å¸ƒ
            1 -> {
                getProblemDistribution(head, contents, dataList, config)
            }
            2 -> {
                getInspectionInfo(head, contents, dataList, config)
            }
            3 -> {
        val t = DailyReportSummary(dataSource)
        t.execute()
        val result = t.toTableRows()
            }
        }
        val h = mutableListOf<Array<Any>>()
        val c = mutableListOf<Array<Any>>()
        head.forEach { h.add(it.toTypedArray()) }
        contents.forEach { c.add(it.toTypedArray()) }
        c.sortBy {
            it[0] as Int
        }
        return Pair(h, c)
    }
    // è¡¨å¤´ï¼šåœºæ™¯å
    private fun getSceneName(head: MutableList<MutableList<Any>>, contents: MutableList<MutableList<Any>>, dataList: List<Subtask>) {
        head.add(mutableListOf(ExcelUtil.MyCell("表单编号"), ExcelUtil.MyCell("唯一序号"), ExcelUtil.MyCell("场景名称")))
        dataList.forEach {subtask ->
            val row = mutableListOf<Any>()
            //查询该任务对应的场景
            val scene = scenseMapper.selectByPrimaryKey(subtask.scenseid)
            row.apply {
                add(scene.index ?: -99)
                add(scene.extension2 ?: "")
                add(scene.name ?: "")
            }
            contents.add(row)
        }
    }
    // è¡¨å¤´ï¼šå…·ä½“问题分布
    private fun getProblemDistribution(head: MutableList<MutableList<Any>>, contents: MutableList<MutableList<Any>>,
                                       dataList: List<Subtask>, config: ExcelConfigVo) {
        val h1 = mutableListOf<ExcelUtil.MyCell>()
        val h2 = mutableListOf<Any>()
        currentProblemType.clear()
        currentProblemHead.clear()
        // é—®é¢˜åˆ†ä¸ºä¸¤å±‚,新增一行表头
        problemtypeMapper.selectByExample(Example(Problemtype::class.java).apply {
            createCriteria().andEqualTo("scensetypeid", config.sceneType)
                .andEqualTo("districtcode", config.districtCode)
            orderBy("extension1")
        }).forEach {
            if (!currentProblemHead.contains(it.typename)) {
                currentProblemHead.add(it.typename ?: "")
                h1.add(ExcelUtil.MyCell(it.typename ?: "", colSpan = 0))
            }
            currentProblemType[it.guid ?: ""] = it.description ?: ""
            if (currentProblemHead.contains(it.typename)) {
                h2.add(it.description ?: "")
                h1.last().colSpan++
                h2.add("是否整改")
                h1.last().colSpan++
            }
        }
        //问题分布
        for (i in dataList.indices) {
            val subtask = dataList[i]
            val pDis = mutableListOf<Any>()//具体问题分布及整改情况
            repeat(h2.size) { pDis.add("")}
            if (subtask.stguid != null) {
                problemlistMapper.selectByExample(Example(Problemlist::class.java).apply {
                    createCriteria().andEqualTo("stguid", subtask.stguid)
                }).forEach problemType@{ p ->
                    val des = currentProblemType[p.ptguid]
                    //具体问题分布
                    for (t in h2.indices) {
                        if (des == h2[t]) {
                            //具体问题这一列添加文本,表示问题存在
                            pDis[t] = 1
                            //问题列的下一列是该问题的整改情况
                            pDis[t + 1] = if (p.ischanged == true) 1 else 0
                            break
                        }
                    }
                }
            }
            contents[i].addAll(pDis)
        }
        //原有的第一行表头增加1行行跨度,同时新的第二行表头添加空位
        head[0].forEach {
            (it as ExcelUtil.MyCell).rowSpan++
//            h2.add(0, "")
        }
        //合并表头
        head[0].addAll(h1)
        head.add(h2)
    }
    // è¡¨å¤´ï¼šå·¡æŸ¥æƒ…况及问题、整改统计
    private fun getInspectionInfo(head: MutableList<MutableList<Any>>, contents: MutableList<MutableList<Any>>, dataList: List<Subtask>, config: ExcelConfigVo) {
        val h1 = listOf("监管时间", "问题类型", "问题描述", "问题位置", "问题数", "整改情况", "整改问题", "整改数", "未整改问题", "未整改数", "审核情况")
        for (i in dataList.indices) {
            val subtask = dataList[i]
            val row = mutableListOf<Any>()
            if (subtask.stguid == null) {
                repeat(h1.size) { row.add("")}
            } else {
                row.apply {
                    // è¡¨å¤´ï¼šå·¡æŸ¥æƒ…况及问题、整改统计
                    add(dateUtil.DateToString(subtask.planstarttime, DateUtil.DateStyle.MM_DD) ?: "")//监管时间
                    //查询子任务对应的问题,并且根据条件进行筛选
                    var y = 1
                    var pType = ""//问题类型
                    var pDes = ""//问题描述
                    var pLoc = ""//问题位置
                    var pNum = 0//问题数
                    var pChanged = ""//整改情况
                    var changedProblem = ""//整改问题
                    var cNum = 0//整改数
                    var unChangedProblem = ""//未整改问题
                    var unChangeNum = 0//未整改数
                    var checkStatus = ""//审核情况
                    problemlistMapper.selectByExample(Example(Problemlist::class.java).apply {
                        createCriteria().andEqualTo("stguid", subtask.stguid)
                    }).forEach problemType@{ p ->
                        val problemType = problemtypeMapper.selectByPrimaryKey(p.ptguid)
                        val typeName = if (problemType == null) {
                            val a = ""
                            a
                        } else {
                            problemType.typename
                        }
                        val lr = if (y > 1) "\n" else ""
                        //巡查情况及问题、整改统计
                        pType += "${lr}$y、${typeName}"
                        pDes += "${lr}$y、${p.problemname}"
                        pLoc += "${lr}$y、${p.location}"
                        pNum++
                        pChanged += "${lr}$y、${if (p.ischanged == true) "✓" else "×"}"
                        if (p.ischanged == true) {
                            if (changedProblem.isNotBlank()) {
                                changedProblem += "\n"
                            }
                            changedProblem += "$y、${p.problemname}"
                            cNum++
                        } else {
                            if (unChangedProblem.isNotBlank()) {
                                unChangedProblem += "\n"
                            }
                            unChangedProblem += "$y、${p.problemname}"
                            unChangeNum++
                        }
                        val status = when (p.extension3) {
                            Constant.PROBLEM_CHECK_PASS -> "问题审核通过"//
                            Constant.PROBLEM_CHECK_FAIL -> "问题审核未通过"//
                            Constant.PROBLEM_UNCHECKED -> "问题未审核"//
                            Constant.CHANGE_UNCHECKED -> "整改未审核"//
                            Constant.CHANGE_CHECK_PASS -> "整改审核通过"//
                            Constant.CHANGE_CHECK_FAIL -> "整改审核未通过"//
                            else -> "问题未审核"
                        }
                        checkStatus += "${lr}$y、${status}"
                        y++
                    }
                    addAll(listOf(pType, pDes, pLoc, pNum, pChanged, changedProblem, cNum, unChangedProblem, unChangeNum, checkStatus))
                }
            }
            contents[i].addAll(row)
        }
        head[0].addAll(h1)
    }
    private fun getTableTitles(sceneType: Int?, districtCode: String?): List<String> {
        if (sceneType == null || districtCode == null) return emptyList()
        val heads = mutableListOf<String>()
        heads.run {
            addAll(getSceneName())
            addAll(getLocation())
            addAll(getBaseInfo(sceneType))
            addAll(getContactInfo(sceneType))
            addAll(getRealTimeStatus(sceneType))
            addAll(getInspectionInfo(sceneType))
            addAll(getProblemDistribution(sceneType, districtCode))
        }
        return heads
    }
    // è¡¨å¤´ï¼šåœºæ™¯å
    private fun getSceneName() = listOf("表单编号", "唯一序号", "场景名称")
    // è¡¨å¤´ï¼šåœºæ™¯åœ°ç†ä½ç½®
    private fun getLocation(): List<String> = listOf(
        "街镇", "地址"
    )
    // è¡¨å¤´ï¼šåœºæ™¯ä¸“属基础信息
    private fun getBaseInfo(sceneType: Int): List<String> = when (sceneType.toString()) {
        Constant.ScenseType.TYPE1.value -> listOf("业主单位", "施工单位", "建筑面积(m²)", "施工起始时间", "施工结束时间", "施工阶段", "工程类型")
        Constant.ScenseType.TYPE2.value -> listOf("业主单位", "租赁单位", "占地面积(m²)", "营运状态", "类型")
        Constant.ScenseType.TYPE3.value -> listOf("业主单位", "文明场站", "绿色环保站厂", "占地面积(m²)", "营运状态")
        Constant.ScenseType.TYPE14.value -> listOf("业主单位", "租赁单位", "占地面积(m²)", "营运状态", "类型")
        else -> listOf()
    }
    // è¡¨å¤´ï¼šåœºæ™¯è”系方式
    private fun getContactInfo(sceneType: Int): List<String> = when (sceneType) {
        else -> listOf("联系人", "联系方式")
    }
    // è¡¨å¤´ï¼šåœºæ™¯çŽ°åœºæƒ…å†µ
    private fun getRealTimeStatus(sceneType: Int): List<String> = when (sceneType) {
        else -> listOf()
    }
    // è¡¨å¤´ï¼šå·¡æŸ¥æƒ…况及问题、整改统计
    private fun getInspectionInfo(sceneType: Int): List<String> = when (sceneType) {
        else -> listOf("监管时间", "防治考核评分", "防治规范性", "扣分项","问题类型", "问题描述", "问题位置", "问题数", "整改情况", "整改数", "审核情况")
    }
    // è¡¨å¤´ï¼šå…·ä½“问题分布
    private val currentProblemType = mutableMapOf<String, String>()
    private val currentProblemHead = mutableListOf<String>()
    private fun getProblemDistribution(sceneType: Int, districtCode: String): List<String> {
        val heads = mutableListOf<String>()
        currentProblemType.clear()
        currentProblemHead.clear()
        problemtypeMapper.selectByExample(Example(Problemtype::class.java).apply {
            createCriteria().andEqualTo("scensetypeid", sceneType)
                .andEqualTo("districtcode", districtCode)
            orderBy("typeid")
        }).forEach {
            if (!heads.contains(it.typename)) {
                heads.add(it.typename ?: "")
            }
            currentProblemType[it.guid ?: ""] = it.typename ?: ""
        }
        currentProblemHead.addAll(heads)
        return heads
    }
    /**
     * èŽ·å–è¡¨æ ¼æ•°æ®æº
     */
    private fun getTableDataSource(config: ExcelConfigVo): List<Subtask> {
        if (config.sceneType == null) return emptyList()
        val result = mutableListOf<Subtask>()
        //1. æŸ¥æ‰¾ç‰¹å®šçš„巡查任务或者所有的计划巡查任务
        var taskSceneIdList = listOf<String>()
        val subTaskList = if (config.subTaskIdList?.isNotEmpty() == true ||
            (config.startTime != null || config.endTime != null)
        ) {
            subtaskMapper.selectByExample(Example(Subtask::class.java).apply {
                createCriteria().apply {
                    if (config.subTaskIdList?.isNotEmpty() == true) {
                        andIn("stguid", config.subTaskIdList)
                    }
                    config.startTime?.let { andGreaterThanOrEqualTo("planstarttime", it) }
                    config.endTime?.let { andLessThanOrEqualTo("planendtime", it) }
                }
            })
        } else {
            taskSceneIdList = monitorobjectversionMapper.getSceneByType(config.topTaskGuid, config.sceneType)
            subtaskMapper.selectByExample(Example(Subtask::class.java).apply {
                createCriteria().andIn("scenseid", taskSceneIdList)
                    .andEqualTo("tguid", config.topTaskGuid)
            })
        }
        if (taskSceneIdList.isNotEmpty()) {
            taskSceneIdList.forEach {
                var subtask: Subtask? = null
                for (s in subTaskList) {
                    if (s.scenseid == it) {
                        subtask = s
                        break
                    }
                }
                if (subtask == null) subtask = Subtask().apply { scenseid = it }
                result.add(subtask)
            }
        } else {
            result.addAll(subTaskList)
        }
        return result
    }
    private fun getTableContents(config: ExcelConfigVo, colCounts: Int = 0): List<Array<Any>> {
        if (config.sceneType == null) return emptyList()
        //1. æŸ¥æ‰¾ç‰¹å®šçš„巡查任务或者所有的计划巡查任务
        var taskSceneIdList = listOf<String>()
        val subTaskList = if (config.subTaskIdList?.isNotEmpty() == true ||
            (config.startTime != null || config.endTime != null)
        ) {
            subtaskMapper.selectByExample(Example(Subtask::class.java).apply {
                createCriteria().apply {
                    if (config.subTaskIdList?.isNotEmpty() == true) {
                        andIn("stguid", config.subTaskIdList)
                    }
                    config.startTime?.let { andGreaterThanOrEqualTo("planstarttime", it) }
                    config.endTime?.let { andLessThanOrEqualTo("planendtime", it) }
                }
            })
        } else {
            taskSceneIdList = monitorobjectversionMapper.getSceneByType(config.topTaskGuid, config.sceneType)
            subtaskMapper.selectByExample(Example(Subtask::class.java).apply {
                createCriteria().andIn("scenseid", taskSceneIdList)
                    .andEqualTo("tguid", config.topTaskGuid)
            })
        }
        val contents = mutableListOf<Array<Any>>()
        val subTasks = mutableListOf<Subtask>()
        if (taskSceneIdList.isNotEmpty()) {
            taskSceneIdList.forEach {
                val rowContent = mutableListOf<Any>()
                var subtask: Subtask? = null
                for (s in subTaskList) {
                    if (s.scenseid == it) {
                        subtask = s
                        break
                    }
                }
                //该场景未巡查
                if (subtask == null) {
                    val scene = scenseMapper.selectByPrimaryKey(it)
                    rowContent.apply {
                        add(scene.index?.toString() ?: "")
                        add(scene.extension2 ?: "")
                        add(scene.name ?: "")
                    }
                    val left = colCounts - getSceneName().size
                    repeat(left) {
                        rowContent.add("")
                    }
                } else {
                    rowContent.addAll(tableContent(subtask))
                }
                contents.add(rowContent.toTypedArray())
            }
        } else {
            subTaskList.forEach {
                val c = tableContent(it)
                contents.add(c)
            }
        }
        return contents
    }
    private fun tableContent(subtask: Subtask): Array<Any> {
        val row = mutableListOf<Any>()
        //查询该任务对应的场景
        val scene = scenseMapper.selectByPrimaryKey(subtask.scenseid)
        row.apply {
            // è¡¨å¤´ï¼šåœºæ™¯å
            add(scene.index?.toString() ?: "")
            add(scene.extension2 ?: "")
            add(scene.name ?: "")
            // è¡¨å¤´ï¼šåœºæ™¯åœ°ç†ä½ç½®
            add(scene.townname ?: "")
            add(scene.location ?: "")
            // è¡¨å¤´ï¼šåœºæ™¯ä¸“属基础信息
            addAll(when (scene.typeid.toString()) {
                Constant.ScenseType.TYPE1.value -> {
//                    listOf("业主单位", "施工单位", "建筑面积(m²)", "施工起始时间", "施工结束时间", "施工阶段", "工程类型")
                    var r = listOf("-", "-", "-", "-", "-", "-", "-")
                    sceneConstructionSiteMapper.selectByPrimaryKey(scene.guid)?.let {
                        r = listOf(it.csEmployerUnit?:"", it.csConstructionUnit?:"", it.csFloorSpace?:"",
                            it.csStartTime?:"", it.csEndTime?:"", it.csStatus?:"", it.csProjectType?:"")
                    }
                    r
                }
                Constant.ScenseType.TYPE2.value -> {
//                    listOf("业主单位", "租赁单位", "占地面积(m²)", "营运状态", "类型")
                    var r = listOf("-", "-", "-", "-", "-")
                    sceneWharfMapper.selectByPrimaryKey(scene.guid)?.let {
                        r = listOf(it.getwEmployerUnit()?:"", it.getwRentUnit()?:"", it.getwFloorSpace()?:"", it.getwStatus()?:"",
                            it.getwProjectType()?:"")
                    }
                    r
                }
                Constant.ScenseType.TYPE3.value -> {
//                    listOf("业主单位", "文明场站", "绿色环保站厂", "占地面积(m²)", "营运状态")
                    var r = listOf("-", "-", "-", "-", "-")
                    sceneMixingPlantMapper.selectByPrimaryKey(scene.guid)?.let {
                        r = listOf(
                            it.mpEmployerUnit?:"", if (it.mpCivillyPlant == true) "是" else "否", if (it.mpGreenPlant == true) "是" else "否",
                            it.mpFloorSpace?:"", it.mpStatus?:""
                        )
                    }
                    r
                }
                Constant.ScenseType.TYPE14.value -> {
//                    listOf("业主单位", "租赁单位", "占地面积(m²)", "营运状态", "类型")
                    var r = listOf("-", "-", "-", "-", "-")
                    sceneStorageYardMapper.selectByPrimaryKey(scene.guid)?.let {
                        r = listOf(it.syEmployerUnit?:"", it.syRentUnit?:"", it.syFloorSpace?:"", it.syStatus?:"", it.syProjectType?:"")
                    }
                    r
                }
                else -> listOf()
            })
            // è¡¨å¤´ï¼šåœºæ™¯è”系方式
            add(scene.contacts ?: "")
            add(scene.contactst ?: "")
            // è¡¨å¤´ï¼šåœºæ™¯çŽ°åœºæƒ…å†µ
            // TODO: 2022/7/10 æš‚æ— 
            // è¡¨å¤´ï¼šå·¡æŸ¥æƒ…况及问题、整改统计 å’Œ è¡¨å¤´ï¼šå…·ä½“问题分布
            listOf("监管时间", "防治考核评分", "防治规范性", "扣分项","问题类型", "问题描述", "问题位置", "问题数", "整改情况", "整改数", "审核情况")
            add(dateUtil.DateToString(subtask.planstarttime, DateUtil.DateStyle.MM_DD) ?: "")
            add("")
            add("")
            add("")
            //查询子任务对应的问题,并且根据条件进行筛选
            var y = 1
            var pType = ""//问题类型
            var pDes = ""//问题描述
            var pLoc = ""//问题位置
            var pNum = 0//问题数
            var pChanged = ""//整改情况
            var cNum = 0//整改数
            var checkStatus = ""//审核情况
            var pDis = mutableListOf<String>()//具体问题分布
            repeat(currentProblemHead.size) { pDis.add("")}
            problemlistMapper.selectByExample(Example(Problemlist::class.java).apply {
                createCriteria().andEqualTo("stguid", subtask.stguid)
            }).forEach problemType@{ p ->
                val typeName = currentProblemType[p.ptguid]
                val lr = if (y > 1) "\n" else ""
                //巡查情况及问题、整改统计
                pType += "${lr}$y、${typeName}"
                pDes += "${lr}$y、${p.problemname}"
                pLoc += "${lr}$y、${p.location}"
                pNum++
                pChanged += "${lr}$y、${if (p.ischanged == true) "✓" else "×"}"
                if (p.ischanged == true) cNum++
                val status = when (p.extension3) {
                    Constant.PROBLEM_CHECK_PASS -> "问题审核通过"//
                    Constant.PROBLEM_CHECK_FAIL -> "问题审核未通过"//
                    Constant.PROBLEM_UNCHECKED -> "问题未审核"//
                    Constant.CHANGE_UNCHECKED -> "整改未审核"//
                    Constant.CHANGE_CHECK_PASS -> "整改审核通过"//
                    Constant.CHANGE_CHECK_FAIL -> "整改审核未通过"//
                    else -> "问题未审核"
                }
                checkStatus += "${lr}$y、${status}"
                y++
                //具体问题分布
                for (t in currentProblemHead.indices) {
                    if (typeName == currentProblemHead[t]) {
                        pDis[t] = if (p.ischanged == true) "1" else "0"
                        break
                    }
                }
            }
            addAll(listOf(pType, pDes, pLoc, pNum, pChanged, cNum, checkStatus))
            addAll(pDis)
        }
        return row.toTypedArray()
        return BaseTableVo(result.first, result.second)
    }
}
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/SubtaskServiceImpl.kt
@@ -1,10 +1,7 @@
package cn.flightfeather.supervision.lightshare.service.impl
import cn.flightfeather.supervision.business.AutoScore
import cn.flightfeather.supervision.business.AutoScore2
import cn.flightfeather.supervision.business.storage.StAutoScore
import cn.flightfeather.supervision.business.storage.item.StScoreItem_1
import cn.flightfeather.supervision.business.storage.item.StScoreItem_2
import cn.flightfeather.supervision.business.storage.item.*
import cn.flightfeather.supervision.domain.ds1.entity.*
import cn.flightfeather.supervision.domain.ds1.mapper.*
import cn.flightfeather.supervision.common.utils.Constant
@@ -23,14 +20,21 @@
import java.util.*
@Service
class SubtaskServiceImpl(val subtaskMapper: SubtaskMapper) : SubtaskService {
class SubtaskServiceImpl(
    private val subtaskMapper: SubtaskMapper,
    private val mpScoreItem_1: MpScoreItem_1,
    private val mpScoreItem_2: MpScoreItem_2,
    private val stScoreItem_1: StScoreItem_1,
    private val whScoreItem_1: WhScoreItem_1,
    private val whScoreItem_2: WhScoreItem_2,
) : SubtaskService {
    val dateUtil = DateUtil()
    @Autowired
    lateinit var scoreItem1: StScoreItem_1
    lateinit var scoreItem1: CsScoreItem_1
    @Autowired
    lateinit var scoreItem2: StScoreItem_2
    lateinit var scoreItem2: CsScoreItem_2
    @Autowired
    lateinit var taskService: TaskService
    @Autowired
@@ -482,7 +486,7 @@
//                    autoScore.calculateScore()
//                }
                val s = scenseMapper.selectByPrimaryKey(subtask.scenseid)
                val autoScore = StAutoScore(scoreItem1, scoreItem2)
                val autoScore = StAutoScore(scoreItem1, scoreItem2, mpScoreItem_1, mpScoreItem_2, stScoreItem_1, whScoreItem_1, whScoreItem_2)
                autoScore.sceneType = Constant.ScenseType.getByValue(s.typeid?.toString())
                autoScore.sceneGrade(subtask)
            }
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/UserinfoServiceImpl.kt
@@ -44,7 +44,13 @@
    override fun save(userinfo: Userinfo): Int = userinfoMapper.insert(userinfo)
    override fun update(userinfo: Userinfo): Int = userinfoMapper.updateByPrimaryKey(userinfo)
    override fun update(userinfo: Userinfo): Int {
        return if (userinfo.guid.isNullOrBlank() || userinfo.acountname.isNullOrBlank() || userinfo.password.isNullOrBlank()) {
            0
        } else {
            userinfoMapper.updateByPrimaryKeySelective(userinfo)
        }
    }
    override fun delete(id: String): Int = userinfoMapper.deleteByPrimaryKey(id)
@@ -98,6 +104,7 @@
            }
            i++
        } while (repeated && i < 20)
        if (repeated) uName = UUIDGenerator.generateShortUUID()
        return uName
    }
src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/BaseTableVo.kt
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,10 @@
package cn.flightfeather.supervision.lightshare.vo
/**
 * @author riku
 * Date: 2020/7/27
 */
data class BaseTableVo(
        val tableTitle: List<Array<Any>>,
        val tableContent: List<Array<Any>>
)
src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/ExcelConfigVo.kt
@@ -8,7 +8,7 @@
 * å¯¼å‡ºå·¡æŸ¥ä»»åŠ¡excel文件 æ¡ä»¶ç±»
 */
data class ExcelConfigVo(
        val topTaskGuid: String,
        var topTaskGuid: String = "",
        val startTime: Date? = null,
        val endTime: Date? = null,
@@ -18,7 +18,7 @@
        val districtCode: String? = null,
        val townCode: String? = null,
        val sceneType: Int? = null,
        var sceneType: Int? = null,
        val subTaskIdList: List<String>? = null,
src/main/kotlin/cn/flightfeather/supervision/lightshare/web/SearchController.kt
@@ -66,6 +66,7 @@
        @RequestParam("per_page", required = false) perPage: Int?
    ) = subtaskService.searchSubTask3(token, updateTime, sceneType, districtCode, startTime, endTime, page, perPage)
    @ApiOperation(value = "获取巡查任务统计报告")
    @PostMapping("/subtask/excel")
    fun getExcel(
        @RequestBody config: ExcelConfigVo,
@@ -98,4 +99,9 @@
        @RequestParam("page") page: Int,
        @RequestParam("perPage") perPage: Int
    ) = searchService.searchSubTaskByKeyword(userId, keyword, page, perPage)
    @PostMapping("/dailyreport")
    fun getDailyReport(
        @RequestBody config: ExcelConfigVo
    ) = searchService.getDailyReport(config)
}
src/main/resources/application.yml
@@ -14,14 +14,14 @@
  #    password: cn.FLIGHTFEATHER
      #-远程测试服务器-
      url: jdbc:mysql://47.100.191.150:3306/supervision?serverTimezone=Asia/Shanghai&prepStmtCacheSize=517&cachePrepStmts=true&autoReconnect=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false
      username: remoteU1
      password: eSoF8DnzfGTlhAjE
#      url: jdbc:mysql://47.100.191.150:3306/supervision?serverTimezone=Asia/Shanghai&prepStmtCacheSize=517&cachePrepStmts=true&autoReconnect=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false
#      username: remoteU1
#      password: eSoF8DnzfGTlhAjE
      #-发布服务器-
#      url: jdbc:mysql://localhost:3306/supervision?serverTimezone=Asia/Shanghai&prepStmtCacheSize=517&cachePrepStmts=true&autoReconnect=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false
#      username: supervision
#      password: supervision_feiyu2021
      url: jdbc:mysql://localhost:3306/supervision?serverTimezone=Asia/Shanghai&prepStmtCacheSize=517&cachePrepStmts=true&autoReconnect=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false
      username: supervision
      password: supervision_feiyu2021
      #-环境督察测试服务器-
  #    url: jdbc:mysql://192.168.0.200:3306/supervision_ii?serverTimezone=Asia/Shanghai&prepStmtCacheSize=517&cachePrepStmts=true&autoReconnect=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false
src/main/resources/mapper/ds1/MonitorobjectversionMapper.xml
@@ -39,7 +39,10 @@
    from sm_t_monitorobjectversion as a
    left join sm_t_scense as b
    on a.S_GUID = b.S_GUID
    where a.T_ID = #{param1} and b.S_TypeID = #{param2}
    where a.T_ID = #{param1}
    <if test="param2 != null">
      and b.S_TypeID = #{param2}
    </if>
    <if test="param3 != null">
      and b.S_TownCode = #{param3}
    </if>
src/test/kotlin/cn/flightfeather/supervision/business/fume/AutoScoreTest.kt
@@ -38,15 +38,18 @@
    @Test
    fun go() {
        val s = "abcdefg"
        val t = s.substring(0, s.length - 2)
        println(t)
//        val s = "abcdefg"
//        val t = s.substring(0, s.length - 2)
//        println(t)
//        autoScore.sceneType = Constant.ScenseType.TYPE1
//        autoScore.topTaskGrade("8QN1VzftuhBJmrF8")
//        val subtask = subtaskMapper.selectByPrimaryKey("OPmza2ddEAKiQHqz")
//        autoScore.sceneGrade(subtask)
//        autoScore.sceneGradeToFile(subtask)
//        autoScore3.go(2022, 1, 2)
        autoScore3.go(2022, 9, 1)
//        val t = problemlistMapper.getStatisticalResult("310116", "2021-09-01 00:00:00", "2021-09-30 00:00:00", "1")
//        println()
src/test/kotlin/cn/flightfeather/supervision/lightshare/service/impl/EvaluationServiceImplTest.kt
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,25 @@
package cn.flightfeather.supervision.lightshare.service.impl
import cn.flightfeather.supervision.lightshare.service.EvaluationService
import org.junit.Test
import org.junit.jupiter.api.Assertions.*
import org.junit.jupiter.api.extension.ExtendWith
import org.junit.runner.RunWith
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.boot.test.context.SpringBootTest
import org.springframework.test.context.junit.jupiter.SpringExtension
import org.springframework.test.context.junit4.SpringRunner
@RunWith(SpringRunner::class)
@ExtendWith(SpringExtension::class)
@SpringBootTest
class EvaluationServiceImplTest {
    @Autowired
    lateinit var evaluationService: EvaluationService
    @Test
    fun foo1() {
        evaluationService.autoScore3("Xx4FKxdic2lzaZJl", "2")
    }
}
src/test/kotlin/cn/flightfeather/supervision/lightshare/service/impl/SearchServiceImplTest.kt
@@ -1,6 +1,8 @@
package cn.flightfeather.supervision.lightshare.service.impl
import cn.flightfeather.supervision.SupervisionApplication
import cn.flightfeather.supervision.domain.ds1.entity.Subtask
import cn.flightfeather.supervision.domain.ds1.mapper.SubtaskMapper
import cn.flightfeather.supervision.lightshare.service.SearchService
import cn.flightfeather.supervision.lightshare.vo.ExcelConfigVo
import org.junit.Test
@@ -12,6 +14,7 @@
import org.springframework.test.context.junit.jupiter.SpringExtension
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner
import org.springframework.test.context.junit4.SpringRunner
import tk.mybatis.mapper.entity.Example
import java.time.LocalDateTime
import java.time.ZoneId
import java.util.*
@@ -24,6 +27,9 @@
    @Autowired
    lateinit var searchService: SearchService
    @Autowired
    lateinit var subtaskMapper: SubtaskMapper
    @Test
    fun getExcel() {
        val localTimeS = LocalDateTime.of(2021, 3, 1, 0, 0, 0)
@@ -34,11 +40,47 @@
        val mode = 8
        //金山2022å¹´6月
        searchService.writeToFile(ExcelConfigVo(
            "tgfMJWdUJqWE6bWo",
            districtCode = "310116",
            "udXAWrrRbM2MvZ5u",
            districtCode = "310106",
//            townCode = "310116113",
            sceneType = 1), mode)
        //金山2021å¹´3月
//        searchService.writeToFile(ExcelConfigVo("o7jdSzr79fe0NH3I", districtCode = "310116", sceneType = 1))
    }
    @Test
    fun getDailyReport() {
        val cal = Calendar.getInstance()
        cal.set(2022, 10, 2, 0, 0, 0)
        cal.set(Calendar.MILLISECOND, 0)
        val sDate = cal.time
        cal.add(Calendar.DAY_OF_MONTH, 1)
        val eDate = cal.time
        val r = searchService.getDailyReport(ExcelConfigVo(districtCode = "310116", startTime = sDate, endTime = eDate))
        println(r)
    }
    @Test
    fun foo1() {
        val cal = Calendar.getInstance()
        cal.set(2022, 10, 2, 0, 0, 0)
        cal.set(Calendar.MILLISECOND, 0)
        val sDate = cal.time
        cal.add(Calendar.DAY_OF_MONTH, 1)
        val eDate = cal.time
        val config = ExcelConfigVo(districtCode = "310116", startTime = sDate, endTime = eDate)
        val r = subtaskMapper.selectByExample(Example(Subtask::class.java).apply {
            createCriteria().apply {
                if (config.subTaskIdList?.isNotEmpty() == true) {
                    andIn("stguid", config.subTaskIdList)
                }
                config.startTime?.let { andEqualTo("planstarttime", it) }
//                config.endTime?.let { andLessThanOrEqualTo("planendtime", it) }
                config.districtCode?.let { andEqualTo("districtcode", it) }
//                andEqualTo("tguid", config.topTaskGuid)
            }
        })
        println(r)
    }
}