| | |
| | | |
| | | @Bean |
| | | fun runner() = ApplicationRunner { |
| | | fetchController.run() |
| | | // fetchController.run() |
| | | } |
| | | } |
| | | |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.flightfeather.supervision.business.report |
| | | |
| | | import cn.flightfeather.supervision.common.utils.ExcelUtil |
| | | import kotlin.math.max |
| | | |
| | | /** |
| | | * ç»è®¡æ°æ®ååºç±» |
| | | */ |
| | | abstract class BaseCols(){ |
| | | |
| | | protected var heads = mutableListOf<MutableList<ExcelUtil.MyCell>>() |
| | | |
| | | //çæè¡¨å¤´ |
| | | fun getHeads(dataSource: DataSource): MutableList<MutableList<ExcelUtil.MyCell>> { |
| | | heads = onHeads(dataSource) |
| | | return heads |
| | | } |
| | | |
| | | abstract fun onHeads(dataSource: DataSource): MutableList<MutableList<ExcelUtil.MyCell>> |
| | | |
| | | //çæä¸è¡å
容 |
| | | fun getOneRow(rowData: DataSource.RowData): List<Any> { |
| | | return if (rowData.noRecord()) { |
| | | val r = mutableListOf<String>() |
| | | repeat(heads.last().size) { r.add(("")) } |
| | | r |
| | | } else { |
| | | onOneRow(rowData) |
| | | } |
| | | } |
| | | |
| | | abstract fun onOneRow(rowData: DataSource.RowData): List<Any> |
| | | |
| | | fun emptyJudge() { |
| | | |
| | | } |
| | | |
| | | /** |
| | | * æ°è表头åå¹¶ |
| | | */ |
| | | fun combineHead(oldHeads: MutableList<MutableList<ExcelUtil.MyCell>>, dataSource: DataSource) { |
| | | //å并表头ï¼éåç®åé»è¾ï¼åªæç¬¬ä¸è¡ç表头ä¼è¿è¡åå
æ ¼çè·¨è¡åå¹¶ |
| | | val newHeads = getHeads(dataSource) |
| | | if (oldHeads.isEmpty()) { |
| | | newHeads.forEach { oldHeads.add(it) } |
| | | } else { |
| | | val maxRow = max(oldHeads.size, newHeads.size) |
| | | for (i in 0 until maxRow) { |
| | | val oH = |
| | | //åå·²æè¡¨å¤´ä¸çè¡ |
| | | if (i < oldHeads.size) { |
| | | oldHeads[i] |
| | | } |
| | | //åæ°ä¸è¡ï¼åæ¶ç¬¬ä¸è¡è¡¨å¤´è·¨è¡æ°å ä¸ |
| | | else { |
| | | if (i > 0) { |
| | | oldHeads.first().forEach { it.rowSpan++ } |
| | | } |
| | | val h = mutableListOf<ExcelUtil.MyCell>() |
| | | repeat(oldHeads.size) { h.add(ExcelUtil.MyCell("")) } |
| | | oldHeads.add(h) |
| | | h |
| | | } |
| | | |
| | | val nH = |
| | | if (i < newHeads.size) { |
| | | newHeads[i] |
| | | } else { |
| | | if (i > 0) { |
| | | newHeads.first().forEach { it.rowSpan++ } |
| | | } |
| | | val h = mutableListOf<ExcelUtil.MyCell>() |
| | | repeat(newHeads.size) { h.add(ExcelUtil.MyCell("")) } |
| | | newHeads.add(h) |
| | | h |
| | | } |
| | | |
| | | oH.addAll(nH) |
| | | } |
| | | } |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.flightfeather.supervision.business.report |
| | | |
| | | import org.apache.poi.hssf.usermodel.HSSFWorkbook |
| | | import java.io.FileOutputStream |
| | | import java.io.OutputStream |
| | | import java.util.* |
| | | |
| | | /** |
| | | * 忍¡æ¿åå¹¶è¾åºä¸ºæ´ä½ææ¡£ |
| | | */ |
| | | abstract class BaseExcel(val dataSource: DataSource) { |
| | | |
| | | abstract val templates: List<BaseTemplate> |
| | | |
| | | abstract val fileName: String |
| | | |
| | | // excelææ¡£ |
| | | private var workbook = HSSFWorkbook() |
| | | |
| | | fun toFile(path: String) { |
| | | val fileName = "${dataSource.areaName()}-${fileName}-${Date().time}.xls" |
| | | val out = FileOutputStream(path + fileName) |
| | | toOutputStream(out) |
| | | } |
| | | |
| | | fun toOutputStream(out: OutputStream) { |
| | | templates.forEach { |
| | | it.execute() |
| | | it.toWorkBook(workbook) |
| | | } |
| | | workbook.write(out) |
| | | workbook.close() |
| | | out.flush() |
| | | out.close() |
| | | } |
| | | } |
| | |
| | | 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æ¥å模æ¿åºç±» |
| | | */ |
| | | abstract class BaseTemplate { |
| | | // FIXME: 2022/7/15 模æ¿ç®åï¼åªæè¡¨å¤´ä¼æ¶ååå
æ ¼åå¹¶ï¼é»è®¤è¡¨å
容䏿²¡æåå¹¶ |
| | | abstract class BaseTemplate(val dataSource: DataSource){ |
| | | |
| | | //åç»å |
| | | abstract val cols: List<BaseCols> |
| | | |
| | | //模æ¿åç§° |
| | | abstract val templateName: String |
| | | |
| | | //表头 |
| | | val head = mutableListOf<MutableList<ExcelUtil.MyCell>>() |
| | | //å
容 |
| | | val contents = mutableListOf<MutableList<Any>>() |
| | | |
| | | |
| | | open fun execute() { |
| | | //æ°æ®æºéç½® |
| | | dataSource.reset() |
| | | //åæè¡¨å¤´ |
| | | cols.forEach { |
| | | it.combineHead(head,dataSource) |
| | | } |
| | | //åææ°æ® |
| | | dataSource.loop { index, rowData -> |
| | | cols.forEach {col -> |
| | | val r = col.getOneRow(rowData) |
| | | if (index >= contents.size) { |
| | | contents.add(mutableListOf()) |
| | | } |
| | | contents[index].addAll(r) |
| | | } |
| | | } |
| | | } |
| | | |
| | | fun toWorkBook(wb: HSSFWorkbook) { |
| | | val f = tableFormat() |
| | | ExcelUtil.write(f.first, f.second, wb, templateName) |
| | | } |
| | | |
| | | fun toOutputStream(out: OutputStream, sheetName: String? = null) { |
| | | val f = tableFormat() |
| | | ExcelUtil.write2(out, f.first, f.second, sheetName ?: templateName) |
| | | } |
| | | |
| | | /** |
| | | * è¾åºä¸ºææ¡£ |
| | | */ |
| | | fun toFile(path: String) { |
| | | val fileName = "${dataSource.areaName()}-${templateName}-${Date().time}.xls" |
| | | val out = FileOutputStream(path + fileName) |
| | | toOutputStream(out) |
| | | } |
| | | |
| | | /** |
| | | * 表头å表å
å®¹æ ¼å¼è½¬å |
| | | */ |
| | | private 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) |
| | | } |
| | | } |
| | | |
| | | //åºå®åç»å |
| | | //åç§° |
| | | |
| | | |
| | | //åºæ¬ä¿¡æ¯ |
| | | //é®é¢æ£ååå¸ |
| | | //é®é¢æ´æ¹åå¸ |
| | | //ç管详æ
|
| | | } |
| | | |
| | | |
| | |
| | | package cn.flightfeather.supervision.business.report |
| | | |
| | | import cn.flightfeather.supervision.domain.ds1.entity.Problemlist |
| | | import cn.flightfeather.supervision.domain.ds1.entity.Problemtype |
| | | import cn.flightfeather.supervision.domain.ds1.entity.Scense |
| | | import cn.flightfeather.supervision.domain.ds1.entity.Subtask |
| | | import cn.flightfeather.supervision.common.utils.Constant |
| | | import cn.flightfeather.supervision.common.utils.DateUtil |
| | | import cn.flightfeather.supervision.domain.ds1.entity.* |
| | | import cn.flightfeather.supervision.domain.ds1.mapper.* |
| | | import cn.flightfeather.supervision.lightshare.vo.ExcelConfigVo |
| | | import org.springframework.beans.factory.annotation.Autowired |
| | | import org.springframework.stereotype.Component |
| | | import tk.mybatis.mapper.entity.Example |
| | | import javax.annotation.PostConstruct |
| | | |
| | | /** |
| | | * æ¥åæéæºæ°æ® |
| | | * çææ¥åæ¶ï¼æéè¦çæ°æ®æº |
| | | * çææ¥åæ¶ï¼ç»ä¸è·åååºç¡æ°æ® |
| | | * @param config çææ¥åçåæ° |
| | | */ |
| | | class DataSource { |
| | | class DataSource(val config: ExcelConfigVo, val dbMapper: DbMapper){ |
| | | |
| | | private var subTask: Subtask? = null |
| | | private val dateUtil = DateUtil() |
| | | |
| | | private val sourceList = mutableListOf<Subtask>() |
| | | |
| | | val rowData = RowData() |
| | | |
| | | init { |
| | | if (config.districtCode == null) { |
| | | throw IllegalStateException("åæ°ç¼ºå°åºå¿ç¼ç :[districtCode]") |
| | | } |
| | | if (config.sceneType == null) { |
| | | throw IllegalStateException("åæ°ç¼ºå°åºæ¯ç±»å:[sceneType]") |
| | | } |
| | | getSource(config) |
| | | } |
| | | |
| | | fun loop(callback: (index:Int, rowData: RowData) -> Unit) { |
| | | reset() |
| | | for (i in sourceList.indices) { |
| | | rowData.clear() |
| | | rowData.subTask = sourceList[i] |
| | | callback(i, rowData) |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * æå®å½åè¿è¡ç»è®¡ç主ä½å¯¹è±¡ |
| | | * éç½® |
| | | */ |
| | | fun mainObj(subtask: Subtask) { |
| | | this.subTask = subTask |
| | | fun reset() { |
| | | rowData.subTask = sourceList.first() |
| | | rowData.clear() |
| | | } |
| | | |
| | | /** |
| | | * æ°æ®ç»è®¡çæ¶é´ååºååç§° |
| | | */ |
| | | fun areaName(): String { |
| | | val t = dbMapper.taskMapper.selectByPrimaryKey(config.topTaskGuid) |
| | | return "${dateUtil.DateToString(t.starttime, DateUtil.DateStyle.YYYY_MM_CN)}${t.districtname}${Constant.ScenseType.getDes(config.sceneType)}" |
| | | } |
| | | |
| | | /** |
| | | * è·åæ¥åæ°æ®æº |
| | | */ |
| | | private fun getSource(config: ExcelConfigVo) { |
| | | if (config.sceneType == null) return |
| | | |
| | | val result = mutableListOf<Subtask>() |
| | | |
| | | //1. æ¥æ¾ç¹å®çå·¡æ¥ä»»å¡æè
ææç计åå·¡æ¥ä»»å¡ |
| | | var taskSceneIdList = listOf<String>() |
| | | val subTaskList = if (config.subTaskIdList?.isNotEmpty() == true || |
| | | (config.startTime != null || config.endTime != null) |
| | | ) { |
| | | dbMapper.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 = dbMapper.monitorobjectversionMapper.getSceneByType(config.topTaskGuid, config.sceneType) |
| | | dbMapper.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) |
| | | } |
| | | |
| | | sourceList.addAll(result) |
| | | } |
| | | |
| | | |
| | | inner class RowData(){ |
| | | var subTask: Subtask? = null |
| | | |
| | | //åºæ¯åºæ¬ä¿¡æ¯ |
| | | var scene: Scense? = null |
| | | val scene: Scense? |
| | | get() { |
| | | if (_scene == null) { |
| | | _scene = dbMapper.scenseMapper.selectByPrimaryKey(subTask?.scenseid) |
| | | } |
| | | return _scene |
| | | } |
| | | private var _scene: Scense? = null |
| | | |
| | | //é®é¢ç±»å |
| | | var problemTypes = mutableListOf<Problemtype>() |
| | | //ååºæ¯ç¹æçåºæ¬ä¿¡æ¯ |
| | | val baseScene: BaseScene? |
| | | get() { |
| | | if (_baseScene == null) { |
| | | _baseScene = when (this.scene?.typeid.toString()) { |
| | | Constant.ScenseType.TYPE1.value -> { |
| | | dbMapper.sceneConstructionSiteMapper.selectByPrimaryKey(scene?.guid) |
| | | } |
| | | Constant.ScenseType.TYPE2.value -> { |
| | | dbMapper.sceneWharfMapper.selectByPrimaryKey(scene?.guid) |
| | | } |
| | | Constant.ScenseType.TYPE3.value -> { |
| | | dbMapper.sceneMixingPlantMapper.selectByPrimaryKey(scene?.guid) |
| | | } |
| | | Constant.ScenseType.TYPE14.value -> { |
| | | dbMapper.sceneStorageYardMapper.selectByPrimaryKey(scene?.guid) |
| | | } |
| | | else -> null |
| | | } |
| | | } |
| | | return _baseScene |
| | | } |
| | | private var _baseScene: BaseScene? = null |
| | | |
| | | //å
·ä½çé®é¢ |
| | | var problems = mutableListOf<Problemlist>() |
| | | val problems: MutableList<Problemlist> |
| | | get() { |
| | | if (noRecord()) return mutableListOf() |
| | | |
| | | if (_problems.isEmpty()) { |
| | | val r = dbMapper.problemlistMapper.selectByExample(Example(Problemlist::class.java).apply { |
| | | createCriteria().andEqualTo("stguid", subTask?.stguid) |
| | | }) |
| | | _problems.addAll(r) |
| | | } |
| | | return _problems |
| | | } |
| | | private var _problems = mutableListOf<Problemlist>() |
| | | |
| | | val evaluation: Evaluation? |
| | | get() { |
| | | if (_evaluation == null) { |
| | | if (noRecord()) return null |
| | | |
| | | dbMapper.evaluationMapper.selectByExample(Example(Evaluation::class.java).apply { |
| | | createCriteria().andEqualTo("stguid", subTask?.stguid) |
| | | })?.takeIf { it.isNotEmpty() }?.let { _evaluation = it[0] } |
| | | } |
| | | return _evaluation |
| | | } |
| | | private var _evaluation: Evaluation? = null |
| | | |
| | | val itemevaluationList: MutableList<Itemevaluation> |
| | | get() { |
| | | if (_itemevaluationList.isEmpty()) { |
| | | val r = dbMapper.itemevaluationMapper.selectByExample(Example(Itemevaluation::class.java).apply { |
| | | createCriteria().andEqualTo("stguid", subTask?.stguid) |
| | | }) |
| | | _itemevaluationList.addAll(r) |
| | | println("-------------------itemevaluationList--------------------------------") |
| | | } |
| | | return _itemevaluationList |
| | | } |
| | | private var _itemevaluationList = mutableListOf<Itemevaluation>() |
| | | |
| | | //é®é¢ç±»å |
| | | val problemTypes: MutableList<Problemtype> |
| | | get() { |
| | | if (_problemTypes.isEmpty()) { |
| | | val r = dbMapper.problemtypeMapper.selectByExample(Example(Problemtype::class.java).apply { |
| | | createCriteria().andEqualTo("scensetypeid", config.sceneType) |
| | | .andEqualTo("districtcode", config.districtCode) |
| | | orderBy("extension1") |
| | | }) |
| | | _problemTypes.addAll(r) |
| | | } |
| | | return _problemTypes |
| | | } |
| | | private var _problemTypes = mutableListOf<Problemtype>() |
| | | |
| | | //èªå¨è¯åè§åä¸çº§åç±» |
| | | val topItems: MutableList<Evaluationsubrule2> |
| | | get() { |
| | | if (_topItems.isEmpty()) { |
| | | val rule = dbMapper.evaluationruleMapper.selectByExample(Example(Evaluationrule::class.java).apply { |
| | | createCriteria() |
| | | .andEqualTo("tasktypeid", 99) |
| | | .andEqualTo("scensetypeid", config.sceneType) |
| | | }) |
| | | if (rule.isNotEmpty()) { |
| | | val ruleId = rule[0].guid |
| | | val rules = dbMapper.evaluationsubruleMapper.selectByExample(Example(Evaluationsubrule2::class.java).apply { |
| | | createCriteria().andEqualTo("erguid", ruleId) |
| | | }) |
| | | rules.forEach { |
| | | if (it.ertype == 2) { |
| | | _topItems.add(it) |
| | | } |
| | | } |
| | | _topItems.sortBy { it.displayid } |
| | | |
| | | var t = 0 |
| | | _topItems.forEach { |
| | | t += it.maxscore ?: 0 |
| | | val tempRules = mutableListOf<Evaluationsubrule2>() |
| | | for (i in rules) { |
| | | if (i.fatherid == it.guid && i.ertype == 3) { |
| | | tempRules.add(i) |
| | | } |
| | | } |
| | | //è¯åå¤§é¡¹å¦ææ²¡ææ¾å°è¯åå°é¡¹ï¼å说æå
¶ç´æ¥å¯¹åºæå°è¯å项ï¼å
¶æ¬èº«åæè¯å项 |
| | | if (tempRules.isEmpty()) { |
| | | tempRules.add(it) |
| | | } |
| | | tempRules.sortBy { t -> t.displayid } |
| | | tempRules.forEach { temp -> |
| | | val tempSubRules = mutableListOf<Evaluationsubrule2>() |
| | | for (i in rules) { |
| | | if (i.fatherid == temp.guid && i.ertype == 4) { |
| | | tempSubRules.add(i) |
| | | } |
| | | } |
| | | tempSubRules.sortBy { ts -> ts.displayid } |
| | | this._rules.add(Pair(temp, tempSubRules)) |
| | | } |
| | | } |
| | | } |
| | | } |
| | | return _topItems |
| | | } |
| | | private var _topItems = mutableListOf<Evaluationsubrule2>() |
| | | |
| | | //èªå¨è¯åè§åäºçº§åä¸çº§åç±» |
| | | val rules: MutableList<Pair<Evaluationsubrule2, MutableList<Evaluationsubrule2>>> |
| | | get() { |
| | | if (_rules.isEmpty()) { |
| | | this.topItems |
| | | } |
| | | return _rules |
| | | } |
| | | private var _rules = mutableListOf<Pair<Evaluationsubrule2, MutableList<Evaluationsubrule2>>>() |
| | | |
| | | /** |
| | | * æ¸
空å½åå¤çç对象çç¸å
³æ°æ®æº |
| | | */ |
| | | fun clear() { |
| | | _scene = null |
| | | _baseScene = null |
| | | _problems.clear() |
| | | _evaluation = null |
| | | _itemevaluationList.clear() |
| | | } |
| | | |
| | | /** |
| | | * å¤æåºæ¯æ¯å¦å·¡æ¥çç®¡ï¼ææ å·¡æ¥è®°å½ |
| | | */ |
| | | fun noRecord() = subTask?.stguid == null |
| | | } |
| | | } |
| | | |
| | | data class DbMapper( |
| | | val scenseMapper: ScenseMapper, |
| | | val problemlistMapper: ProblemlistMapper, |
| | | val problemtypeMapper: ProblemtypeMapper, |
| | | val subtaskMapper: SubtaskMapper, |
| | | val monitorobjectversionMapper: MonitorobjectversionMapper, |
| | | val sceneConstructionSiteMapper: SceneConstructionSiteMapper, |
| | | val sceneMixingPlantMapper: SceneMixingPlantMapper, |
| | | val sceneStorageYardMapper: SceneStorageYardMapper, |
| | | val sceneWharfMapper: SceneWharfMapper, |
| | | val taskMapper: TaskMapper, |
| | | val evaluationruleMapper: EvaluationruleMapper, |
| | | val evaluationsubruleMapper: EvaluationsubruleMapper2, |
| | | val evaluationMapper: EvaluationMapper, |
| | | val itemevaluationMapper: ItemevaluationMapper |
| | | ) |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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 |
| | | import cn.flightfeather.supervision.domain.ds1.entity.Itemevaluation |
| | | import org.apache.poi.hssf.util.HSSFColor |
| | | |
| | | class ColGrade(private val hasHead3: Boolean = true) : BaseCols() { |
| | | |
| | | override fun onHeads(dataSource: DataSource): MutableList<MutableList<ExcelUtil.MyCell>> { |
| | | val h1 = mutableListOf<ExcelUtil.MyCell>() |
| | | h1.add(ExcelUtil.MyCell("ç¯ä¿¡ç ", 3, 1)) |
| | | h1.add(ExcelUtil.MyCell("鲿²»è§èæ§", 3, 1)) |
| | | h1.add(ExcelUtil.MyCell("æ»å", 3, 1)) |
| | | val h2 = mutableListOf<ExcelUtil.MyCell>() |
| | | h2.add(ExcelUtil.MyCell("")) |
| | | h2.add(ExcelUtil.MyCell("")) |
| | | h2.add(ExcelUtil.MyCell("")) |
| | | val h3 = mutableListOf<ExcelUtil.MyCell>() |
| | | h3.add(ExcelUtil.MyCell("")) |
| | | h3.add(ExcelUtil.MyCell("")) |
| | | h3.add(ExcelUtil.MyCell("")) |
| | | dataSource.rowData.topItems.forEach { |
| | | h1.add(ExcelUtil.MyCell(it.itemname ?: "", 1, 0)) |
| | | for (r in dataSource.rowData.rules) { |
| | | if (r.first.fatherid == it.guid || r.first.guid == it.guid) { |
| | | h2.add(ExcelUtil.MyCell(r.first.itemname ?: "", 1, 0)) |
| | | if (hasHead3) { |
| | | r.second.forEach { s -> |
| | | h3.add(ExcelUtil.MyCell(s.itemname ?: "")) |
| | | h2.last().colSpan++ |
| | | h1.last().colSpan++ |
| | | } |
| | | } else { |
| | | h2.last().colSpan++ |
| | | h1.last().colSpan++ |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | return mutableListOf(h1, h2, h3) |
| | | } |
| | | |
| | | override fun onOneRow(rowData: DataSource.RowData): List<Any> { |
| | | val row = mutableListOf<Any>() |
| | | |
| | | if (rowData.noRecord()) { |
| | | repeat(heads.last().size) { row.add(("")) } |
| | | } else { |
| | | row.apply { |
| | | //æ»ååç¯ä¿¡ç |
| | | rowData.evaluation.let { e -> |
| | | val s = e?.resultscorebef?.toIntOrNull() ?: "" |
| | | val code = when (s) { |
| | | in 0..59 -> ExcelUtil.MyCell("红ç ", fontColor = HSSFColor.HSSFColorPredefined.RED.index) |
| | | in 60..89 -> ExcelUtil.MyCell("é»ç ", fontColor = HSSFColor.HSSFColorPredefined.GOLD.index) |
| | | in 90..100 -> ExcelUtil.MyCell("绿ç ", fontColor = HSSFColor.HSSFColorPredefined.BRIGHT_GREEN.index) |
| | | "" -> ExcelUtil.MyCell("", fontColor = HSSFColor.HSSFColorPredefined.BLACK.index) |
| | | else -> ExcelUtil.MyCell("è¶
åºèå´ï¼${s}", fontColor = HSSFColor.HSSFColorPredefined.BLACK.index) |
| | | } |
| | | val normalization = when (s) { |
| | | in 0..59 -> ExcelUtil.MyCell("严éä¸è§è", fontColor = HSSFColor.HSSFColorPredefined.ROSE.index) |
| | | in 60..89 -> ExcelUtil.MyCell("ä¸è§è", fontColor = HSSFColor.HSSFColorPredefined.RED.index) |
| | | in 90..99 -> ExcelUtil.MyCell("åºæ¬è§è", fontColor = HSSFColor.HSSFColorPredefined.GOLD.index) |
| | | 100 -> ExcelUtil.MyCell("è§è", fontColor = HSSFColor.HSSFColorPredefined.BRIGHT_GREEN.index) |
| | | "" -> ExcelUtil.MyCell("", fontColor = HSSFColor.HSSFColorPredefined.BLACK.index) |
| | | else -> ExcelUtil.MyCell("è¶
åºèå´ï¼${s}", fontColor = HSSFColor.HSSFColorPredefined.BLACK.index) |
| | | } |
| | | add(code) |
| | | add(normalization) |
| | | add(s) |
| | | } |
| | | |
| | | |
| | | //æ¯ä¸é¡¹å
·ä½å¾å |
| | | rowData.topItems.forEach { |
| | | for (r in rowData.rules) { |
| | | if (r.first.fatherid == it.guid || r.first.guid == it.guid) { |
| | | // FIXME: 2021/4/25 å³å®æ¯å¦åh3 |
| | | if (hasHead3) { |
| | | r.second.forEach { s -> |
| | | val v = searchScore(s.guid, rowData.itemevaluationList) |
| | | add(v.toIntOrNull() ?: "") |
| | | } |
| | | } else { |
| | | val v = searchScore(r.first.guid, rowData.itemevaluationList) |
| | | add(v.toIntOrNull() ?: "") |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | return row |
| | | } |
| | | |
| | | //æ¥æ¾å¾åè®°å½å
对åºè§åçå¾å |
| | | private fun searchScore(ruleId: String?, itemevaluations: List<Itemevaluation>): String { |
| | | var score = "" |
| | | for (e in itemevaluations) { |
| | | if (ruleId == e.esrguid) { |
| | | score = e.value ?: "" |
| | | break |
| | | } |
| | | } |
| | | return score |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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.Constant |
| | | import cn.flightfeather.supervision.common.utils.DateUtil |
| | | import cn.flightfeather.supervision.common.utils.ExcelUtil |
| | | |
| | | //ç管详æ
|
| | | class ColInspectionInfo() : BaseCols() { |
| | | override fun onHeads(dataSource: DataSource): MutableList<MutableList<ExcelUtil.MyCell>> { |
| | | return mutableListOf(mutableListOf( |
| | | ExcelUtil.MyCell("ç管æ¶é´"), |
| | | ExcelUtil.MyCell("å·¡æ¥äººå"), |
| | | ExcelUtil.MyCell("é®é¢ç±»å"), |
| | | ExcelUtil.MyCell("é®é¢æè¿°"), |
| | | ExcelUtil.MyCell("é®é¢ä½ç½®"), |
| | | ExcelUtil.MyCell("é®é¢æ°"), |
| | | ExcelUtil.MyCell("æ´æ¹æ¶é´"), |
| | | ExcelUtil.MyCell("æ´æ¹æ
åµ"), |
| | | ExcelUtil.MyCell("æ´æ¹é®é¢"), |
| | | ExcelUtil.MyCell("æ´æ¹æ°"), |
| | | ExcelUtil.MyCell("æªæ´æ¹é®é¢"), |
| | | ExcelUtil.MyCell("æªæ´æ¹æ°"), |
| | | ExcelUtil.MyCell("å®¡æ ¸æ
åµ"), |
| | | ExcelUtil.MyCell("é®é¢å®¡æ ¸æ¶é´"), |
| | | ExcelUtil.MyCell("æ´æ¹å®¡æ ¸æ¶é´"), |
| | | ExcelUtil.MyCell("é®é¢æ´æ¹ç"), |
| | | )) |
| | | } |
| | | |
| | | override fun onOneRow(rowData: DataSource.RowData): List<Any> { |
| | | val dateUtil = DateUtil() |
| | | val row = mutableListOf<Any>() |
| | | if (rowData.noRecord()) { |
| | | repeat(heads.last().size) { row.add(("")) } |
| | | } else { |
| | | row.apply { |
| | | // 表头ï¼å·¡æ¥æ
åµåé®é¢ãæ´æ¹ç»è®¡ |
| | | //ç管æ¶é´ |
| | | add(dateUtil.DateToString(rowData.subTask?.planstarttime, DateUtil.DateStyle.MM_DD) ?: "") |
| | | //å·¡æ¥äººå |
| | | add(rowData.subTask?.executorrealtimes?.replace("#", "ã") ?: "") |
| | | //æ¥è¯¢åä»»å¡å¯¹åºçé®é¢ï¼å¹¶ä¸æ ¹æ®æ¡ä»¶è¿è¡çé |
| | | var y = 1 |
| | | var pType = ""//é®é¢ç±»å |
| | | var pDes = ""//é®é¢æè¿° |
| | | var pLoc = ""//é®é¢ä½ç½® |
| | | var pNum = 0//é®é¢æ° |
| | | var changeTime = ""//æ´æ¹æ¶é´ |
| | | var pChanged = ""//æ´æ¹æ
åµ |
| | | var changedProblem = ""//æ´æ¹é®é¢ |
| | | var cNum = 0//æ´æ¹æ° |
| | | var unChangedProblem = ""//æªæ´æ¹é®é¢ |
| | | var unChangeNum = 0//æªæ´æ¹æ° |
| | | var checkStatus = ""//å®¡æ ¸æ
åµ |
| | | var pCheckTime = ""//é®é¢å®¡æ ¸æ¶é´ |
| | | var cCheckTime = ""//æ´æ¹å®¡æ ¸æ¶é´ |
| | | var changePercent = ""//é®é¢æ´æ¹ç |
| | | rowData.problems.forEach { p -> |
| | | var typeName = "" |
| | | for (t in rowData.problemTypes) { |
| | | if (t.guid == p.ptguid) { |
| | | typeName = t.typename ?: "" |
| | | break |
| | | } |
| | | } |
| | | val lr = if (y > 1) "\n" else "" |
| | | //å·¡æ¥æ
åµåé®é¢ãæ´æ¹ç»è®¡ |
| | | pType += "${lr}$yã${typeName}" |
| | | pDes += "${lr}$yã${p.problemname}" |
| | | pLoc += "${lr}$yã${p.location}" |
| | | pNum++ |
| | | changeTime = "${lr}$yã${dateUtil.DateToString(p.changedtime, DateUtil.DateStyle.YYYY_MM_DD_HH_MM_CN)}" |
| | | 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}" |
| | | changePercent = if (pNum == 0) "" else "${(cNum * 100 / pNum)}%" |
| | | y++ |
| | | } |
| | | addAll( |
| | | listOf( |
| | | pType, pDes, pLoc, pNum, changeTime, pChanged, changedProblem, cNum, |
| | | unChangedProblem, unChangeNum, checkStatus, pCheckTime, cCheckTime, changePercent |
| | | ) |
| | | ) |
| | | } |
| | | } |
| | | return row |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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 ColLedger : BaseCols() { |
| | | override fun onHeads(dataSource: DataSource): MutableList<MutableList<ExcelUtil.MyCell>> { |
| | | return mutableListOf(mutableListOf( |
| | | ExcelUtil.MyCell("å°è´¦æäº¤ç¾åæ¯"), |
| | | ExcelUtil.MyCell("å°è´¦æäº¤æ¶é´"), |
| | | ExcelUtil.MyCell("å°è´¦å®¡æ ¸æ¶é´"), |
| | | )) |
| | | } |
| | | |
| | | override fun onOneRow(rowData: DataSource.RowData): List<Any> { |
| | | return listOf("", "", "") |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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 ColProChange : BaseCols() { |
| | | override fun onHeads(dataSource: DataSource): MutableList<MutableList<ExcelUtil.MyCell>> { |
| | | return mutableListOf( |
| | | mutableListOf(ExcelUtil.MyCell("é®é¢ä¸æ´æ¹", colSpan = 2)), |
| | | mutableListOf(ExcelUtil.MyCell("é®é¢æ°"), ExcelUtil.MyCell("æ´æ¹æ°")) |
| | | ) |
| | | } |
| | | |
| | | override fun onOneRow(rowData: DataSource.RowData): List<Any> { |
| | | var pNum = 0//é®é¢æ° |
| | | var cNum = 0//æ´æ¹æ° |
| | | rowData.problems.forEach { |
| | | pNum++ |
| | | if (it.ischanged == true) cNum++ |
| | | } |
| | | return listOf(pNum, cNum) |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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 ColProblemDistribution() : BaseCols() { |
| | | private var h2 = mutableListOf<ExcelUtil.MyCell>() |
| | | private val currentProblemType = mutableMapOf<String, String>() |
| | | private val currentProblemHead = mutableListOf<String>() |
| | | |
| | | override fun onHeads(dataSource: DataSource): MutableList<MutableList<ExcelUtil.MyCell>> { |
| | | val h1 = mutableListOf<ExcelUtil.MyCell>() |
| | | |
| | | dataSource.rowData.problemTypes.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(ExcelUtil.MyCell(it.description ?: "")) |
| | | h1.last().colSpan++ |
| | | |
| | | h2.add(ExcelUtil.MyCell("æ¯å¦æ´æ¹")) |
| | | h1.last().colSpan++ |
| | | } |
| | | } |
| | | |
| | | return mutableListOf(h1, h2) |
| | | } |
| | | |
| | | override fun onOneRow(rowData: DataSource.RowData): List<Any> { |
| | | val pDis = mutableListOf<Any>()//å
·ä½é®é¢åå¸åæ´æ¹æ
åµ |
| | | repeat(h2.size) { pDis.add("")} |
| | | rowData.problems.forEach {p -> |
| | | val des = currentProblemType[p.ptguid] |
| | | |
| | | //å
·ä½é®é¢åå¸ |
| | | for (t in h2.indices) { |
| | | if (des == h2[t].text) { |
| | | //å
·ä½é®é¢è¿ä¸åæ·»å ææ¬ï¼è¡¨ç¤ºé®é¢åå¨ |
| | | pDis[t] = 1 |
| | | //é®é¢åçä¸ä¸åæ¯è¯¥é®é¢çæ´æ¹æ
åµ |
| | | pDis[t + 1] = if (p.ischanged == true) 1 else 0 |
| | | break |
| | | } |
| | | } |
| | | } |
| | | |
| | | return pDis |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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 ColSceneName() : BaseCols() { |
| | | override fun onHeads(dataSource: DataSource): MutableList<MutableList<ExcelUtil.MyCell>> { |
| | | return mutableListOf( |
| | | mutableListOf(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 ?: "") |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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.Constant |
| | | import cn.flightfeather.supervision.common.utils.ExcelUtil |
| | | import cn.flightfeather.supervision.domain.ds1.entity.SceneConstructionSite |
| | | import cn.flightfeather.supervision.domain.ds1.entity.SceneMixingPlant |
| | | import cn.flightfeather.supervision.domain.ds1.entity.SceneStorageYard |
| | | import cn.flightfeather.supervision.domain.ds1.entity.SceneWharf |
| | | |
| | | class ColStatus : BaseCols() { |
| | | override fun onHeads(dataSource: DataSource): MutableList<MutableList<ExcelUtil.MyCell>> { |
| | | return mutableListOf(mutableListOf( |
| | | ExcelUtil.MyCell("æ½å·¥/è¥è¿ç¶æ"), |
| | | ExcelUtil.MyCell("æ½å·¥é¶æ®µ") |
| | | )) |
| | | } |
| | | |
| | | override fun onOneRow(rowData: DataSource.RowData): List<Any> { |
| | | val status = when (rowData.scene?.typeid.toString()) { |
| | | Constant.ScenseType.TYPE1.value -> { |
| | | (rowData.baseScene as SceneConstructionSite?)?.csStatus |
| | | } |
| | | Constant.ScenseType.TYPE2.value -> { |
| | | (rowData.baseScene as SceneWharf?)?.getwStatus() |
| | | } |
| | | Constant.ScenseType.TYPE3.value -> { |
| | | (rowData.baseScene as SceneMixingPlant?)?.mpStatus |
| | | } |
| | | Constant.ScenseType.TYPE14.value -> { |
| | | (rowData.baseScene as SceneStorageYard?)?.syStatus |
| | | } |
| | | else -> "" |
| | | } |
| | | val s = status ?: "" |
| | | return listOf(s, s) |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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 ColTown : BaseCols() { |
| | | override fun onHeads(dataSource: DataSource): MutableList<MutableList<ExcelUtil.MyCell>> { |
| | | return mutableListOf(mutableListOf(ExcelUtil.MyCell("è¡é/å·¥ä¸åº"))) |
| | | } |
| | | |
| | | override fun onOneRow(rowData: DataSource.RowData): List<Any> { |
| | | return listOf(rowData.scene?.townname ?: "") |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.flightfeather.supervision.business.report.file |
| | | |
| | | import cn.flightfeather.supervision.business.report.BaseExcel |
| | | import cn.flightfeather.supervision.business.report.BaseTemplate |
| | | import cn.flightfeather.supervision.business.report.DataSource |
| | | import cn.flightfeather.supervision.business.report.template.ProAnalysisSummary |
| | | import cn.flightfeather.supervision.business.report.template.ProDetailSummary |
| | | |
| | | class ReportOne(dataSource: DataSource) : BaseExcel(dataSource) { |
| | | override val templates: List<BaseTemplate> = listOf(ProDetailSummary(dataSource), ProAnalysisSummary(dataSource)) |
| | | override val fileName: String = "é®é¢ä¸æ´æ¹æ±æ»åæä¸å¨æè·è¸ªæ¸
å" |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.flightfeather.supervision.business.report.file |
| | | |
| | | import cn.flightfeather.supervision.business.report.BaseExcel |
| | | import cn.flightfeather.supervision.business.report.BaseTemplate |
| | | import cn.flightfeather.supervision.business.report.DataSource |
| | | 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 fileName: String = "é®é¢ä¸æ´æ¹åå¸åææ¸
å" |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.flightfeather.supervision.business.report.file |
| | | |
| | | import cn.flightfeather.supervision.business.report.BaseExcel |
| | | import cn.flightfeather.supervision.business.report.BaseTemplate |
| | | import cn.flightfeather.supervision.business.report.DataSource |
| | | import cn.flightfeather.supervision.business.report.template.ScoreAnalysisSummary |
| | | import cn.flightfeather.supervision.business.report.template.ScoreDetailSummary |
| | | |
| | | class ReportTwo(dataSource: DataSource) : BaseExcel(dataSource) { |
| | | override val templates: List<BaseTemplate> = listOf(ScoreDetailSummary(dataSource), ScoreAnalysisSummary(dataSource)) |
| | | override val fileName: String = "è§èæ§è¯ä¼°ä¸åææ¸
å" |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.flightfeather.supervision.business.report.template |
| | | |
| | | import cn.flightfeather.supervision.business.report.BaseCols |
| | | import cn.flightfeather.supervision.business.report.BaseTemplate |
| | | import cn.flightfeather.supervision.business.report.DataSource |
| | | import cn.flightfeather.supervision.business.report.cols.ColInspectionInfo |
| | | import cn.flightfeather.supervision.common.utils.Constant |
| | | import cn.flightfeather.supervision.common.utils.ExcelUtil |
| | | import cn.flightfeather.supervision.domain.ds1.entity.SceneConstructionSite |
| | | import cn.flightfeather.supervision.domain.ds1.entity.SceneMixingPlant |
| | | import cn.flightfeather.supervision.domain.ds1.entity.SceneStorageYard |
| | | import cn.flightfeather.supervision.domain.ds1.entity.SceneWharf |
| | | import kotlin.math.round |
| | | |
| | | /** |
| | | * åè¡éé®é¢æ´æ¹åææ±æ»è¡¨ |
| | | */ |
| | | class ProAnalysisSummary(dataSource: DataSource) : BaseTemplate(dataSource) { |
| | | override val cols: List<BaseCols> = listOf(ColInspectionInfo()) |
| | | |
| | | override val templateName: String = "åè¡éé®é¢æ´æ¹åææ±æ»è¡¨" |
| | | |
| | | override fun execute() { |
| | | //æ°æ®æºéç½® |
| | | dataSource.reset() |
| | | |
| | | cols.forEach { it.combineHead(head,dataSource) } |
| | | |
| | | val districtMap = mutableMapOf<String?, Summary>() |
| | | dataSource.loop { _, rowData -> |
| | | if (rowData.noRecord()) return@loop |
| | | |
| | | val r = cols[0].getOneRow(rowData) |
| | | |
| | | val k = rowData.scene?.townname |
| | | if (!districtMap.containsKey(k)) { |
| | | districtMap[k] = Summary().apply { |
| | | townCode = rowData.scene?.towncode ?: "" |
| | | townName = rowData.scene?.townname ?: "" |
| | | type = rowData.scene?.type ?: "" |
| | | } |
| | | } |
| | | districtMap[k]?.apply { |
| | | sceneCount++ |
| | | val status = when (dataSource.config.sceneType.toString()) { |
| | | Constant.ScenseType.TYPE1.value -> { |
| | | (rowData.baseScene as SceneConstructionSite?)?.csStatus |
| | | } |
| | | Constant.ScenseType.TYPE2.value -> { |
| | | (rowData.baseScene as SceneWharf?)?.getwStatus() |
| | | } |
| | | Constant.ScenseType.TYPE3.value -> { |
| | | (rowData.baseScene as SceneMixingPlant?)?.mpStatus |
| | | } |
| | | Constant.ScenseType.TYPE14.value -> { |
| | | (rowData.baseScene as SceneStorageYard?)?.syStatus |
| | | } |
| | | else -> "" |
| | | } |
| | | // FIXME: 2022/7/18 åç»åºæ¯çæ½å·¥ç¶ææ¹ä¸ºå¸å°å¼åå¨ |
| | | if ((status?.contains("å®å·¥") == true) || (status?.contains("æªæ½å·¥") == true) || (status?.contains("å") == true) |
| | | || (status?.contains("å
³") == true) |
| | | ) { |
| | | inactiveScenes++ |
| | | } else { |
| | | activeScenes++ |
| | | } |
| | | val pNum = r[5] as Int |
| | | val cNum = r[9] as Int |
| | | if (pNum > 0 && cNum > 0) changeScenes++ |
| | | proNum += pNum |
| | | changeNum += cNum |
| | | } |
| | | } |
| | | |
| | | val summarys = mutableListOf<Summary>() |
| | | var totalPro = 0 |
| | | districtMap.forEach { |
| | | summarys.add(it.value) |
| | | totalPro += it.value.proNum |
| | | } |
| | | districtMap.forEach { |
| | | val v = it.value |
| | | v.changeScenePer = round(v.changeScenes.toDouble() / v.sceneCount * 1000) / 1000 |
| | | v.proPer = round(v.proNum.toDouble() / totalPro * 1000) / 1000 |
| | | v.changePer = round(v.changeNum.toDouble() / v.proNum * 1000) / 1000 |
| | | } |
| | | //æ´æ¹å使¯æå |
| | | summarys.sortByDescending { |
| | | it.changeScenePer |
| | | } |
| | | for (i in summarys.indices) { |
| | | summarys[i].changeSceneRank = i + 1 |
| | | } |
| | | //é®é¢æ´æ¹çæå |
| | | summarys.sortByDescending { |
| | | it.changePer |
| | | } |
| | | for (i in summarys.indices) { |
| | | summarys[i].proChangeRank = i + 1 |
| | | } |
| | | |
| | | //æ´æ°è¡¨å¤´ |
| | | head.clear() |
| | | head.add(mutableListOf( |
| | | ExcelUtil.MyCell("è¡éåºå·", rowSpan = 2), |
| | | ExcelUtil.MyCell("åºå"), |
| | | ExcelUtil.MyCell("åºæ¯ç±»å«", rowSpan = 2), |
| | | ExcelUtil.MyCell("åºæ¯ç¶æ", colSpan = 3), |
| | | ExcelUtil.MyCell("æ´æ¹åä½", colSpan = 2), |
| | | ExcelUtil.MyCell("é®é¢ä¸æ´æ¹", colSpan = 4), |
| | | ExcelUtil.MyCell("æå", colSpan = 2), |
| | | ExcelUtil.MyCell("åºåç管çç¥", colSpan = 2), |
| | | )) |
| | | head.add(mutableListOf( |
| | | ExcelUtil.MyCell(""), |
| | | ExcelUtil.MyCell("è¡é/å·¥ä¸åº"), |
| | | ExcelUtil.MyCell(""), |
| | | ExcelUtil.MyCell("åºæ¯æ°"), |
| | | ExcelUtil.MyCell("å®å·¥ãæªæ½å·¥ãåå·¥æåä¸ãå
³éç"), |
| | | ExcelUtil.MyCell("æ½å·¥ä¸ãè¿è¥ä¸æ»æ°"), |
| | | ExcelUtil.MyCell("æ´æ¹å使°"), |
| | | ExcelUtil.MyCell("æ´æ¹åä½å æ¯"), |
| | | ExcelUtil.MyCell("é®é¢æ°"), |
| | | ExcelUtil.MyCell("é®é¢å æ¯"), |
| | | ExcelUtil.MyCell("æ´æ¹æ°"), |
| | | ExcelUtil.MyCell("æ´æ¹ç"), |
| | | ExcelUtil.MyCell("æ´æ¹å使¯æå"), |
| | | ExcelUtil.MyCell("é®é¢æ´æ¹çæå"), |
| | | ExcelUtil.MyCell("æåå
¥éç¹ç管æ°"), |
| | | ExcelUtil.MyCell("æåå
¥éç¹çç®¡å æ¯"), |
| | | )) |
| | | //æ´æ°å
容 |
| | | summarys.forEach { |
| | | contents.add( |
| | | mutableListOf( |
| | | it.townCode, it.townName, it.type, it.sceneCount, it.inactiveScenes, it.activeScenes, it.changeScenes, |
| | | "${round(it.changeScenePer * 1000) / 10}%", |
| | | it.proNum, "${round(it.proPer * 1000) / 10}%", it.changeNum, "${round(it.changePer * 1000) / 10}%", it.changeSceneRank, it.proChangeRank |
| | | ) |
| | | ) |
| | | } |
| | | } |
| | | |
| | | inner class Summary(){ |
| | | var townCode = "" |
| | | var townName = "" |
| | | var type = "" |
| | | var sceneCount = 0 |
| | | //åè¿çåºæ¯æ° |
| | | var inactiveScenes = 0 |
| | | var activeScenes = 0 |
| | | |
| | | var changeScenes = 0 |
| | | var changeScenePer = .0 |
| | | set(value) { field = if (value.isNaN()) .0 else value } |
| | | |
| | | var proNum = 0 |
| | | var proPer = .0 |
| | | set(value) { field = if (value.isNaN()) .0 else value } |
| | | |
| | | var changeNum = 0 |
| | | var changePer = .0 |
| | | set(value) { field = if (value.isNaN()) .0 else value } |
| | | |
| | | var changeSceneRank = 0 |
| | | var proChangeRank = 0 |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.flightfeather.supervision.business.report.template |
| | | |
| | | import cn.flightfeather.supervision.business.report.BaseCols |
| | | import cn.flightfeather.supervision.business.report.BaseTemplate |
| | | import cn.flightfeather.supervision.business.report.DataSource |
| | | import cn.flightfeather.supervision.business.report.cols.ColInspectionInfo |
| | | import cn.flightfeather.supervision.business.report.cols.ColSceneName |
| | | |
| | | class ProDetailSummary(dataSource: DataSource) : BaseTemplate(dataSource) { |
| | | override val cols: List<BaseCols> = listOf(ColSceneName(), ColInspectionInfo()) |
| | | override val templateName: String = "é®é¢ä¸æ´æ¹è·è¸ªæ±æ»è¡¨" |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.flightfeather.supervision.business.report.template |
| | | |
| | | import cn.flightfeather.supervision.business.report.BaseCols |
| | | import cn.flightfeather.supervision.business.report.BaseTemplate |
| | | import cn.flightfeather.supervision.business.report.DataSource |
| | | import cn.flightfeather.supervision.business.report.cols.* |
| | | |
| | | class ProTypeDetailSummary(dataSource: DataSource) : BaseTemplate(dataSource) { |
| | | override val cols: List<BaseCols> = listOf(ColSceneName(), ColTown(), ColStatus(), ColProChange(), ColProblemDistribution()) |
| | | |
| | | override val templateName: String = "é®é¢ä¸æ´æ¹åç±»ç»è®¡è¡¨" |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.flightfeather.supervision.business.report.template |
| | | |
| | | import cn.flightfeather.supervision.business.report.DataSource |
| | | import cn.flightfeather.supervision.common.utils.ExcelUtil |
| | | import kotlin.math.round |
| | | |
| | | class ProTypeRankMainSummary(dataSource: DataSource) : ProTypeRankSummary(dataSource) { |
| | | override val templateName: String = "æåº¦ä¸»è¦æå
¸åé®é¢åæè¡¨" |
| | | |
| | | override fun formatTable(summarys: List<Summary>) { |
| | | summarys.sortedByDescending { it.count } |
| | | |
| | | head.clear() |
| | | head.add( |
| | | mutableListOf( |
| | | ExcelUtil.MyCell("åºå·", rowSpan = 2), |
| | | ExcelUtil.MyCell("年度", rowSpan = 2), |
| | | ExcelUtil.MyCell("æä»½", rowSpan = 2), |
| | | ExcelUtil.MyCell("åºæ¯ç±»å«", rowSpan = 2), |
| | | ExcelUtil.MyCell("åºå", rowSpan = 2), |
| | | ExcelUtil.MyCell("é®é¢æ°", rowSpan = 2), |
| | | ExcelUtil.MyCell("ä¸»è¦æå
¸åé®é¢åæ", colSpan = 3), |
| | | ) |
| | | ) |
| | | head.add( |
| | | mutableListOf( |
| | | ExcelUtil.MyCell(""), |
| | | ExcelUtil.MyCell(""), |
| | | ExcelUtil.MyCell(""), |
| | | ExcelUtil.MyCell(""), |
| | | ExcelUtil.MyCell(""), |
| | | ExcelUtil.MyCell(""), |
| | | ExcelUtil.MyCell("主è¦é®é¢ç±»å«ï¼ä¸çº§ææ ï¼"), |
| | | ExcelUtil.MyCell("主è¦é®é¢å计æ°"), |
| | | ExcelUtil.MyCell("主è¦é®é¢å æ¯"), |
| | | ) |
| | | ) |
| | | for (i in summarys.indices) { |
| | | val s = summarys[i] |
| | | contents.add( |
| | | mutableListOf( |
| | | i + 1, "", "", dataSource.rowData.scene?.type ?: "", "", s.count, |
| | | s.proDes, s.count, "${round(s.countPer * 1000) / 10}%" |
| | | ) |
| | | ) |
| | | } |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.flightfeather.supervision.business.report.template |
| | | |
| | | import cn.flightfeather.supervision.business.report.BaseCols |
| | | import cn.flightfeather.supervision.business.report.BaseTemplate |
| | | import cn.flightfeather.supervision.business.report.DataSource |
| | | import cn.flightfeather.supervision.business.report.cols.* |
| | | import cn.flightfeather.supervision.common.utils.ExcelUtil |
| | | import kotlin.math.round |
| | | |
| | | open class ProTypeRankSummary(dataSource: DataSource) : BaseTemplate(dataSource) { |
| | | override val cols: List<BaseCols> = listOf() |
| | | override val templateName: String = "é®é¢ä¸æ´æ¹åç±»æå" |
| | | |
| | | override fun execute() { |
| | | dataSource.reset() |
| | | |
| | | val proMap = mutableMapOf<String?, Summary>() |
| | | dataSource.loop { _, rowData -> |
| | | rowData.problems.forEach { |
| | | val k = it.ptguid |
| | | if (!proMap.containsKey(k)) { |
| | | proMap[k] = Summary().apply { |
| | | for (p in rowData.problemTypes) { |
| | | if (p.guid == k) { |
| | | proType = p.typename ?: "" |
| | | proDes = p.description ?: "" |
| | | break |
| | | } |
| | | } |
| | | } |
| | | } |
| | | proMap[k]?.apply { |
| | | count++ |
| | | if (it.ischanged == true) changeNum++ |
| | | } |
| | | } |
| | | } |
| | | |
| | | //å æ¯ç»è®¡ |
| | | val summarys = mutableListOf<Summary>() |
| | | var tPros = 0 |
| | | proMap.forEach { |
| | | val v = it.value |
| | | summarys.add(v) |
| | | tPros += v.count |
| | | } |
| | | summarys.sortByDescending { it.count } |
| | | for (i in summarys.indices) { |
| | | val it = summarys[i] |
| | | it.countPer = it.count.toDouble() / tPros |
| | | it.countRank = i + 1 |
| | | it.changePer = it.changeNum.toDouble() / it.count |
| | | } |
| | | summarys.sortByDescending { it.changePer } |
| | | for (i in summarys.indices) { |
| | | val it = summarys[i] |
| | | it.changeRank = i + 1 |
| | | } |
| | | |
| | | formatTable(summarys) |
| | | } |
| | | |
| | | open fun formatTable(summarys: List<Summary>) { |
| | | head.clear() |
| | | head.add( |
| | | mutableListOf( |
| | | ExcelUtil.MyCell("åºå·", rowSpan = 2), |
| | | ExcelUtil.MyCell("年度", rowSpan = 2), |
| | | ExcelUtil.MyCell("æä»½", rowSpan = 2), |
| | | ExcelUtil.MyCell("åºæ¯ç±»å«", rowSpan = 2), |
| | | ExcelUtil.MyCell("åºå", rowSpan = 2), |
| | | ExcelUtil.MyCell("é®é¢å¤§ç±»ï¼äºçº§ææ ï¼", rowSpan = 2), |
| | | ExcelUtil.MyCell("é®é¢å°ç±»ï¼ä¸çº§ææ ï¼", rowSpan = 2), |
| | | ExcelUtil.MyCell("é®é¢å æ¯æååæ", colSpan = 3), |
| | | ExcelUtil.MyCell("æ´æ¹çæååæ", colSpan = 3), |
| | | ) |
| | | ) |
| | | head.add( |
| | | mutableListOf( |
| | | ExcelUtil.MyCell(""), |
| | | ExcelUtil.MyCell(""), |
| | | ExcelUtil.MyCell(""), |
| | | ExcelUtil.MyCell(""), |
| | | ExcelUtil.MyCell(""), |
| | | ExcelUtil.MyCell(""), |
| | | ExcelUtil.MyCell(""), |
| | | ExcelUtil.MyCell("å计é®é¢æ°"), |
| | | ExcelUtil.MyCell("é®é¢å æ¯"), |
| | | ExcelUtil.MyCell("é®é¢æå"), |
| | | ExcelUtil.MyCell("æ´æ¹æ°"), |
| | | ExcelUtil.MyCell("æ´æ¹ç"), |
| | | ExcelUtil.MyCell("æ´æ¹æå"), |
| | | ) |
| | | ) |
| | | for (i in summarys.indices) { |
| | | val s = summarys[i] |
| | | contents.add( |
| | | mutableListOf( |
| | | i + 1, "", "", dataSource.rowData.scene?.type ?: "", "", |
| | | s.proType, s.proDes, |
| | | s.count, "${round(s.countPer * 1000) / 10}%", s.countRank, |
| | | s.changeNum, "${round(s.changePer * 1000) / 10}%", s.changeRank |
| | | ) |
| | | ) |
| | | } |
| | | } |
| | | |
| | | inner class Summary() { |
| | | var proType = "" |
| | | var proDes = "" |
| | | var count = 0 |
| | | var countPer = .0 |
| | | set(value) { |
| | | field = if (value.isNaN()) .0 else value |
| | | } |
| | | var countRank = 0 |
| | | |
| | | var changeNum = 0 |
| | | var changePer = .0 |
| | | set(value) { |
| | | field = if (value.isNaN()) .0 else value |
| | | } |
| | | var changeRank = 0 |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.flightfeather.supervision.business.report.template |
| | | |
| | | import cn.flightfeather.supervision.business.report.BaseCols |
| | | import cn.flightfeather.supervision.business.report.BaseTemplate |
| | | import cn.flightfeather.supervision.business.report.DataSource |
| | | import cn.flightfeather.supervision.common.utils.Constant |
| | | import cn.flightfeather.supervision.common.utils.ExcelUtil |
| | | import cn.flightfeather.supervision.domain.ds1.entity.SceneConstructionSite |
| | | import kotlin.math.round |
| | | |
| | | class ProTypeStatusSummary(dataSource: DataSource) : BaseTemplate(dataSource) { |
| | | override val cols: List<BaseCols> = listOf() |
| | | override val templateName: String = "工尿½å·¥é¶æ®µé®é¢åç±»åæè¡¨" |
| | | |
| | | @Throws(Exception::class) |
| | | override fun execute() { |
| | | if (dataSource.config.sceneType.toString() != Constant.ScenseType.TYPE1.value) { |
| | | throw IllegalStateException("${templateName}åªè½é对工å°è¿è¡åæï¼å½åä¼ å
¥åºæ¯ç±»åç¼å·ä¸º${dataSource.config.sceneType}") |
| | | } |
| | | |
| | | dataSource.reset() |
| | | |
| | | val proMap = mutableMapOf<String?, MutableMap<String?, Summary>>() |
| | | dataSource.loop { _, rowData -> |
| | | rowData.problems.forEach { |
| | | val s = (rowData.baseScene as SceneConstructionSite?)?.csStatus |
| | | if (!proMap.containsKey(s)) { |
| | | proMap[s] = mutableMapOf() |
| | | } |
| | | val pt = it.ptguid |
| | | if (proMap[s]?.containsKey(pt) == false) { |
| | | proMap[s]?.put(pt, Summary().apply { |
| | | for (p in rowData.problemTypes) { |
| | | if (p.guid == pt) { |
| | | status = s ?: "" |
| | | proType = p.typename ?: "" |
| | | proDes = p.description ?: "" |
| | | break |
| | | } |
| | | } |
| | | }) |
| | | } |
| | | proMap[s]?.get(pt)?.apply { |
| | | count++ |
| | | if (it.ischanged == true) changeNum++ |
| | | } |
| | | } |
| | | } |
| | | |
| | | //å æ¯ç»è®¡ |
| | | val summarys = mutableListOf<Summary>() |
| | | var tPros = 0 |
| | | proMap.forEach { |
| | | it.value.forEach {e -> |
| | | val v = e.value |
| | | summarys.add(v) |
| | | tPros += v.count |
| | | } |
| | | } |
| | | summarys.forEach { |
| | | it.countPer = it.count.toDouble() / tPros |
| | | it.changePer = it.changeNum.toDouble() / it.count |
| | | } |
| | | |
| | | |
| | | head.clear() |
| | | head.add( |
| | | mutableListOf( |
| | | ExcelUtil.MyCell("åºå·", rowSpan = 2), |
| | | ExcelUtil.MyCell("年度", rowSpan = 2), |
| | | ExcelUtil.MyCell("æä»½", rowSpan = 2), |
| | | ExcelUtil.MyCell("åºæ¯ç±»å«", rowSpan = 2), |
| | | ExcelUtil.MyCell("åºå", rowSpan = 2), |
| | | ExcelUtil.MyCell("æ½å·¥æè¿è¥ç¶æ", rowSpan = 2), |
| | | ExcelUtil.MyCell("æ½å·¥é¶æ®µ", rowSpan = 2), |
| | | ExcelUtil.MyCell("é®é¢å¤§ç±»ï¼äºçº§ææ ï¼", rowSpan = 2), |
| | | ExcelUtil.MyCell("é®é¢å°ç±»ï¼ä¸çº§ææ ï¼", rowSpan = 2), |
| | | ExcelUtil.MyCell("é®é¢å æ¯æååæ", colSpan = 2), |
| | | ExcelUtil.MyCell("æ´æ¹çæååæ", colSpan = 2), |
| | | ) |
| | | ) |
| | | head.add( |
| | | mutableListOf( |
| | | ExcelUtil.MyCell(""), |
| | | ExcelUtil.MyCell(""), |
| | | ExcelUtil.MyCell(""), |
| | | ExcelUtil.MyCell(""), |
| | | ExcelUtil.MyCell(""), |
| | | ExcelUtil.MyCell(""), |
| | | ExcelUtil.MyCell(""), |
| | | ExcelUtil.MyCell(""), |
| | | ExcelUtil.MyCell(""), |
| | | ExcelUtil.MyCell("å计é®é¢æ°"), |
| | | ExcelUtil.MyCell("é®é¢å æ¯"), |
| | | ExcelUtil.MyCell("æ´æ¹æ°"), |
| | | ExcelUtil.MyCell("æ´æ¹ç"), |
| | | ) |
| | | ) |
| | | for (i in summarys.indices) { |
| | | val s = summarys[i] |
| | | contents.add( |
| | | mutableListOf( |
| | | i + 1, "", "", dataSource.rowData.scene?.type ?: "", "", s.status, s.status, |
| | | s.proType, s.proDes, |
| | | s.count, "${round(s.countPer * 1000) / 10}%", |
| | | s.changeNum, "${round(s.changePer * 1000) / 10}%", |
| | | ) |
| | | ) |
| | | } |
| | | } |
| | | |
| | | inner class Summary() { |
| | | var status = "" |
| | | var proType = "" |
| | | var proDes = "" |
| | | var count = 0 |
| | | var countPer = .0 |
| | | set(value) { |
| | | field = if (value.isNaN()) .0 else value |
| | | } |
| | | |
| | | var changeNum = 0 |
| | | var changePer = .0 |
| | | set(value) { |
| | | field = if (value.isNaN()) .0 else value |
| | | } |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.flightfeather.supervision.business.report.template |
| | | |
| | | import cn.flightfeather.supervision.business.report.BaseCols |
| | | import cn.flightfeather.supervision.business.report.BaseTemplate |
| | | import cn.flightfeather.supervision.business.report.DataSource |
| | | import cn.flightfeather.supervision.business.report.cols.ColGrade |
| | | import cn.flightfeather.supervision.common.utils.ExcelUtil |
| | | import kotlin.math.round |
| | | |
| | | class ScoreAnalysisSummary(dataSource: DataSource) : BaseTemplate(dataSource) { |
| | | override val cols: List<BaseCols> = listOf(ColGrade()) |
| | | |
| | | override val templateName: String = "åè¡éè§èæ§åæè¡¨" |
| | | |
| | | override fun execute() { |
| | | dataSource.reset() |
| | | cols.forEach { it.combineHead(head,dataSource) } |
| | | |
| | | val districtMap = mutableMapOf<String?, Summary>() |
| | | dataSource.loop { index, rowData -> |
| | | |
| | | val r = cols[0].getOneRow(rowData) |
| | | |
| | | val k = rowData.scene?.townname |
| | | if (!districtMap.containsKey(k)) { |
| | | districtMap[k] = Summary().apply { |
| | | townCode = rowData.scene?.towncode ?: "" |
| | | townName = rowData.scene?.townname ?: "" |
| | | type = rowData.scene?.type ?: "" |
| | | } |
| | | } |
| | | if (r[1] is String) { |
| | | val s = r[1] |
| | | } |
| | | districtMap[k]?.apply { |
| | | sceneCount++ |
| | | rowData.evaluation?.run { gradeCount++ } |
| | | if ((r[1] is String) && (r[1] as String).isBlank()) return@loop |
| | | when ((r[1] as ExcelUtil.MyCell).text) { |
| | | "è§è" -> { |
| | | level1++ |
| | | standard++ |
| | | } |
| | | "åºæ¬è§è" -> { |
| | | level2++ |
| | | standard++ |
| | | } |
| | | "ä¸è§è" -> { |
| | | level3++ |
| | | nonstandard++ |
| | | } |
| | | "严éä¸è§è" -> { |
| | | level4++ |
| | | nonstandard++ |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | //å æ¯ç»è®¡ |
| | | val summarys = mutableListOf<Summary>() |
| | | var tLevel1 = 0 |
| | | var tLevel2 = 0 |
| | | var tLevel3 = 0 |
| | | var tLevel4 = 0 |
| | | var tNonstandard = 0 |
| | | var tStandard = 0 |
| | | districtMap.forEach { |
| | | val v = it.value |
| | | summarys.add(v) |
| | | tLevel1 += v.level1 |
| | | tLevel2 += v.level2 |
| | | tLevel3 += v.level3 |
| | | tLevel4 += v.level4 |
| | | tNonstandard += v.nonstandard |
| | | tStandard += v.standard |
| | | } |
| | | summarys.sortByDescending { it.standardPer } |
| | | for (i in summarys.indices) { |
| | | val it = summarys[i] |
| | | //åè¯ç¾åæ¯ |
| | | it.gradePer = it.gradeCount.toDouble() / it.sceneCount |
| | | //è§èãåºæ¬è§èãä¸è§èå严éä¸è§èåºåå æ¯ |
| | | it.level1Per = it.level1.toDouble() / tLevel1 |
| | | it.level2Per = it.level2.toDouble() / tLevel2 |
| | | it.level3Per = it.level3.toDouble() / tLevel3 |
| | | it.level4Per = it.level4.toDouble() / tLevel4 |
| | | //ä¸è§èåºåå æ¯ |
| | | it.nonstandardPer = it.nonstandard.toDouble() / tNonstandard |
| | | //è§èåºåå æ¯ |
| | | it.standardPer = it.standard.toDouble() / tStandard |
| | | //è§èå æ¯æå |
| | | it.rank = i + 1 |
| | | } |
| | | |
| | | head.clear() |
| | | head.add(mutableListOf( |
| | | ExcelUtil.MyCell("è¡éåºå·", rowSpan = 2), |
| | | ExcelUtil.MyCell("è¡é/å·¥ä¸åº", rowSpan = 2), |
| | | ExcelUtil.MyCell("åºæ¯ç±»å«", rowSpan = 2), |
| | | ExcelUtil.MyCell("åè¯æ
åµ", colSpan = 3), |
| | | ExcelUtil.MyCell("è§èæ§åç±»åæ", colSpan = 8), |
| | | ExcelUtil.MyCell("è§èæ§æ±æ»åæ", colSpan = 5), |
| | | )) |
| | | head.add(mutableListOf( |
| | | ExcelUtil.MyCell(""), |
| | | ExcelUtil.MyCell(""), |
| | | ExcelUtil.MyCell(""), |
| | | ExcelUtil.MyCell("åºæ¯æ»æ°"), |
| | | ExcelUtil.MyCell("åè¯æ°"), |
| | | ExcelUtil.MyCell("åè¯ç¾åæ¯"), |
| | | ExcelUtil.MyCell("鲿²»è§è"), |
| | | ExcelUtil.MyCell("åºåå æ¯"), |
| | | ExcelUtil.MyCell("鲿²»åºæ¬è§è"), |
| | | ExcelUtil.MyCell("åºåå æ¯"), |
| | | ExcelUtil.MyCell("鲿²»ä¸è§è"), |
| | | ExcelUtil.MyCell("åºåå æ¯"), |
| | | ExcelUtil.MyCell("鲿²»ä¸¥éä¸è§è"), |
| | | ExcelUtil.MyCell("åºåå æ¯"), |
| | | ExcelUtil.MyCell("åç±»ä¸è§èå计"), |
| | | ExcelUtil.MyCell("åç±»ä¸è§èå计åºåå æ¯"), |
| | | ExcelUtil.MyCell("åç±»è§èå计"), |
| | | ExcelUtil.MyCell("åç±»è§èå计åºåå æ¯"), |
| | | ExcelUtil.MyCell("è§èæ§æå"), |
| | | )) |
| | | |
| | | summarys.forEach { |
| | | contents.add( |
| | | mutableListOf( |
| | | it.townCode, it.townName, it.type, it.sceneCount, it.gradeCount, "${round(it.gradePer * 1000) / 10}%", |
| | | it.level1, "${round(it.level1Per * 1000) / 10}%", |
| | | it.level2, "${round(it.level2Per * 1000) / 10}%", |
| | | it.level3, "${round(it.level3Per * 1000) / 10}%", |
| | | it.level4, "${round(it.level4Per * 1000) / 10}%", |
| | | it.nonstandard, "${round(it.nonstandardPer * 1000) / 10}%", |
| | | it.standard, "${round(it.standardPer * 1000) / 10}%", |
| | | it.rank |
| | | ) |
| | | ) |
| | | } |
| | | } |
| | | |
| | | inner class Summary(){ |
| | | var townCode = "" |
| | | var townName = "" |
| | | var type = "" |
| | | var sceneCount = 0 |
| | | //åè¯æ° |
| | | var gradeCount = 0 |
| | | var gradePer = .0 |
| | | set(value) { field = if (value.isNaN()) .0 else value } |
| | | //è§èãåºæ¬è§èãä¸è§èå严éä¸è§èæ°éååºåå æ¯ |
| | | var level1 = 0 |
| | | var level1Per = .0 |
| | | set(value) { field = if (value.isNaN()) .0 else value } |
| | | var level2 = 0 |
| | | var level2Per = .0 |
| | | set(value) { field = if (value.isNaN()) .0 else value } |
| | | var level3 = 0 |
| | | var level3Per = .0 |
| | | set(value) { field = if (value.isNaN()) .0 else value } |
| | | var level4 = 0 |
| | | var level4Per = .0 |
| | | set(value) { field = if (value.isNaN()) .0 else value } |
| | | //ä¸è§èå计ååºåå æ¯ |
| | | var nonstandard = 0 |
| | | var nonstandardPer = .0 |
| | | set(value) { field = if (value.isNaN()) .0 else value } |
| | | //è§èå计ååºåå æ¯ |
| | | var standard = 0 |
| | | var standardPer = .0 |
| | | set(value) { field = if (value.isNaN()) .0 else value } |
| | | //è§èå æ¯æå |
| | | var rank = 0 |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.flightfeather.supervision.business.report.template |
| | | |
| | | import cn.flightfeather.supervision.business.report.BaseCols |
| | | import cn.flightfeather.supervision.business.report.BaseTemplate |
| | | import cn.flightfeather.supervision.business.report.DataSource |
| | | import cn.flightfeather.supervision.business.report.cols.ColGrade |
| | | import cn.flightfeather.supervision.business.report.cols.ColSceneName |
| | | import cn.flightfeather.supervision.business.report.cols.ColTown |
| | | |
| | | class ScoreDetailSummary(dataSource: DataSource) : BaseTemplate(dataSource) { |
| | | override val cols: List<BaseCols> = listOf(ColSceneName(), ColTown(), ColGrade()) |
| | | override val templateName: String = "è§èæ§è¯ä¼°è¯¦æ
表" |
| | | } |
| | |
| | | fun topTaskGrade(topTaskId:String) { |
| | | rows.clear() |
| | | subtaskMapper.selectByTopTask2(topTaskId, sceneType.value.toInt()).forEach { |
| | | // sceneGrade(it) |
| | | sceneGradeToFile(it) |
| | | sceneGrade(it) |
| | | // sceneGradeToFile(it) |
| | | } |
| | | toFile() |
| | | // toFile() |
| | | } |
| | | |
| | | /** |
| | |
| | | TYPE14.value -> 4 |
| | | else -> sceneTypeId |
| | | } |
| | | |
| | | fun getDes(value: Int?) = when (value.toString()) { |
| | | "1" -> TYPE1.text |
| | | "2" -> TYPE2.text |
| | | "3" -> TYPE3.text |
| | | "4" -> TYPE4.text |
| | | "5" -> TYPE5.text |
| | | "6" -> TYPE6.text |
| | | "7" -> TYPE7.text |
| | | "8" -> TYPE8.text |
| | | "9" -> TYPE9.text |
| | | "10" -> TYPE10.text |
| | | "11" -> TYPE11.text |
| | | "12" -> TYPE12.text |
| | | "13" -> TYPE13.text |
| | | "14" -> TYPE14.text |
| | | "99" -> TYPE99.text |
| | | else -> "" |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | /** |
| | | * èªå¨å¤çè¡åå¹¶æ°æ® |
| | | */ |
| | | fun write2(out: OutputStream, heads: List<Array<Any>>, contents: MutableList<Array<Any>>) { |
| | | fun write2(out: OutputStream, heads: List<Array<Any>>, contents: MutableList<Array<Any>>, sheetName: String = "sheet1") { |
| | | |
| | | val workbook = HSSFWorkbook() |
| | | |
| | | write(heads, contents, workbook) |
| | | write(heads, contents, workbook, sheetName) |
| | | |
| | | workbook.write(out) |
| | | workbook.close() |
| | |
| | | out.close() |
| | | } |
| | | |
| | | fun write3() { |
| | | |
| | | } |
| | | |
| | | private fun getMaxRows(rowArray: Array<Any>): Int { |
| | | var maxRows = 1 |
| | | rowArray.forEach { |
| | |
| | | package cn.flightfeather.supervision.common.utils |
| | | |
| | | import java.io.File |
| | | import java.io.FileOutputStream |
| | | import java.io.FileInputStream |
| | | |
| | | |
| | | import java.awt.Image |
| | | import java.awt.image.BufferedImage |
| | | import java.io.* |
| | | import java.util.* |
| | | import javax.imageio.ImageIO |
| | | |
| | | |
| | | object FileUtil { |
| | |
| | | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * æç
§åºå®å®½åº¦å缩å¾çè³base64å½¢å¼ |
| | | */ |
| | | // fun compressImage2(bytes: ByteArray): String { |
| | | // val length = 1440//å¾çé¿è¾¹åºå®å缩为1440åç´ |
| | | // |
| | | // val input = ByteArrayInputStream(bytes) |
| | | // val srcImg = ImageIO.read(input) |
| | | // var srcLong = 0 |
| | | // var srcShort = 0 |
| | | // if (srcImg.width <= srcImg.height) { |
| | | // srcLong = srcImg.height |
| | | // srcShort = srcImg.width |
| | | // |
| | | // } else { |
| | | // |
| | | // } |
| | | // val scale = w.toFloat() / srcW |
| | | // val h = (srcImg.height * scale).toInt() |
| | | // |
| | | // val buffImg = BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB) |
| | | // buffImg.graphics.drawImage(srcImg.getScaledInstance(w, h, Image.SCALE_SMOOTH), 0, 0, null) |
| | | // val out = ByteArrayOutputStream() |
| | | // ImageIO.write(buffImg, "PNG", out) |
| | | // |
| | | // return SCHEME_PNG + Base64.getEncoder().encodeToString(out.toByteArray()) |
| | | // } |
| | | } |
| | |
| | | */ |
| | | interface SearchService { |
| | | |
| | | fun writeToFile(config: ExcelConfigVo) |
| | | fun writeToFile(config: ExcelConfigVo, mode: Int) |
| | | |
| | | fun getExcel(config: ExcelConfigVo, response: HttpServletResponse): HttpServletResponse |
| | | |
| | |
| | | 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.* |
| | |
| | | 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 { |
| | |
| | | //åæç第ä¸è¡è¡¨å¤´å¢å 1è¡è¡è·¨åº¦,åæ¶æ°ç第äºè¡è¡¨å¤´æ·»å ç©ºä½ |
| | | head[0].forEach { |
| | | (it as ExcelUtil.MyCell).rowSpan++ |
| | | h2.add(0, "") |
| | | // h2.add(0, "") |
| | | } |
| | | //å并表头 |
| | | head[0].addAll(h1) |
| | |
| | | <property name="suppressAllComments" value="true"/> |
| | | </commentGenerator> |
| | | <!--æ°æ®åºé¾æ¥URLï¼ç¨æ·åãå¯ç --> |
| | | <jdbcConnection driverClass="com.mysql.jdbc.Driver" connectionURL="jdbc:mysql://47.100.191.150:3306/ledger?serverTimezone=Asia/Shanghai" |
| | | <jdbcConnection driverClass="com.mysql.jdbc.Driver" connectionURL="jdbc:mysql://47.100.191.150:3306/supervision?serverTimezone=Asia/Shanghai" |
| | | userId="remoteU1" |
| | | password="eSoF8DnzfGTlhAjE"> |
| | | </jdbcConnection> |
| | |
| | | <property name="forceBigDecimals" value="false"/> |
| | | </javaTypeResolver> |
| | | <!-- çææ¨¡åçå
ååä½ç½®--> |
| | | <javaModelGenerator targetPackage="cn.flightfeather.supervision.domain.ds2.entity" targetProject="src/main/kotlin"> |
| | | <javaModelGenerator targetPackage="cn.flightfeather.supervision.domain.ds1.entity" targetProject="src/main/kotlin"> |
| | | <property name="enableSubPackages" value="true"/> |
| | | <property name="trimStrings" value="true"/> |
| | | </javaModelGenerator> |
| | | <!-- çææ å°æä»¶çå
ååä½ç½®--> |
| | | <sqlMapGenerator targetPackage="ds2" targetProject="src/main/resources/mapper"> |
| | | <sqlMapGenerator targetPackage="ds1" targetProject="src/main/resources/mapper"> |
| | | <property name="enableSubPackages" value="true"/> |
| | | </sqlMapGenerator> |
| | | <!-- çæDAOçå
ååä½ç½®--> |
| | | <javaClientGenerator type="XMLMAPPER" targetPackage="cn.flightfeather.supervision.domain.ds2.mapper" targetProject="src/main/kotlin"> |
| | | <javaClientGenerator type="XMLMAPPER" targetPackage="cn.flightfeather.supervision.domain.ds1.mapper" targetProject="src/main/kotlin"> |
| | | <property name="enableSubPackages" value="true"/> |
| | | </javaClientGenerator> |
| | | <!-- è¦çæç表 tableNameæ¯æ°æ®åºä¸ç表åæè§å¾å domainObjectNameæ¯å®ä½ç±»å--> |
| | |
| | | <!-- <table tableName="sm_t_night_construction" domainObjectName="NightConstruction" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"></table>--> |
| | | <!-- <table tableName="sm_t_score" domainObjectName="Score" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"/>--> |
| | | <!-- <table tableName="sm_t_scense" domainObjectName="Scense" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"/>--> |
| | | <table tableName="ea_t_mediafile" domainObjectName="LedgerMediaFile" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"/> |
| | | <!-- <table tableName="ea_t_mediafile" domainObjectName="LedgerMediaFile" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" enableSelectByExample="false" selectByExampleQueryId="false"/>--> |
| | | <table tableName="ea_t_dust_data_result" domainObjectName="DustDataResult" enableCountByExample="false" enableUpdateByExample="false" enableDeleteByExample="false" |
| | | enableSelectByExample="false" selectByExampleQueryId="false"/> |
| | | </context> |
| | | </generatorConfiguration> |
| | |
| | | @Test |
| | | fun go() { |
| | | autoScore.sceneType = Constant.ScenseType.TYPE1 |
| | | autoScore.topTaskGrade("Z3RwJ5jF123sjDsj") |
| | | autoScore.topTaskGrade("tgfMJWdUJqWE6bWo") |
| | | // val subtask = subtaskMapper.selectByPrimaryKey("1DxdkFdVAdQD5Mce") |
| | | // autoScore.sceneGrade(subtask) |
| | | // autoScore3.go(2022, 1, 2) |
| | | // val t = problemlistMapper.getStatisticalResult("310116", "2021-09-01 00:00:00", "2021-09-30 00:00:00", "1") |
| | | // println() |
| | |
| | | val localTimeE = LocalDateTime.of(2021, 3, 31, 23, 59, 59) |
| | | val sD = Date.from(localTimeS.atZone(ZoneId.systemDefault()).toInstant()) |
| | | val eD = Date.from(localTimeE.atZone(ZoneId.systemDefault()).toInstant()) |
| | | searchService.writeToFile(ExcelConfigVo("Z3RwJ5jF123sjDsj", districtCode = "310106", sceneType = 1)) |
| | | |
| | | val mode = 10 |
| | | //éå±±2022å¹´6æ |
| | | searchService.writeToFile(ExcelConfigVo("tgfMJWdUJqWE6bWo", districtCode = "310116", sceneType = 1), mode) |
| | | //éå±±2021å¹´3æ |
| | | // searchService.writeToFile(ExcelConfigVo("o7jdSzr79fe0NH3I", districtCode = "310116", sceneType = 1)) |
| | | } |
| | | } |