| | |
| | | |
| | | //çæä¸è¡å
容 |
| | | 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) |
| | | } |
| | | // return if (rowData.noRecord()) { |
| | | // val r = mutableListOf<String>() |
| | | // repeat(heads.last().size) { r.add(("")) } |
| | | // r |
| | | // } else { |
| | | // onOneRow(rowData) |
| | | // } |
| | | return onOneRow(rowData) |
| | | } |
| | | |
| | | abstract fun onOneRow(rowData: DataSource.RowData): List<Any> |
| | |
| | | oldHeads.first().forEach { it.rowSpan++ } |
| | | } |
| | | val h = mutableListOf<ExcelUtil.MyCell>() |
| | | repeat(oldHeads.size) { h.add(ExcelUtil.MyCell("")) } |
| | | |
| | | var cols = 0 |
| | | oldHeads.last().forEach { |
| | | cols += it.colSpan |
| | | } |
| | | repeat(cols) { h.add(ExcelUtil.MyCell("")) } |
| | | oldHeads.add(h) |
| | | h |
| | | } |
| | |
| | | newHeads.first().forEach { it.rowSpan++ } |
| | | } |
| | | val h = mutableListOf<ExcelUtil.MyCell>() |
| | | repeat(newHeads.size) { h.add(ExcelUtil.MyCell("")) } |
| | | |
| | | var cols = 0 |
| | | newHeads.last().forEach { |
| | | cols += it.colSpan |
| | | } |
| | | repeat(cols) { h.add(ExcelUtil.MyCell("")) } |
| | | newHeads.add(h) |
| | | h |
| | | } |
| | | } |
| | | |
| | | oH.addAll(nH) |
| | | for (i in oldHeads.indices) { |
| | | oldHeads[i].addAll(newHeads[i]) |
| | | } |
| | | } |
| | | } |
| | |
| | | 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.domain.ds2.entity.LedgerRecord |
| | | import cn.flightfeather.supervision.domain.ds2.entity.LedgerSubType |
| | | import cn.flightfeather.supervision.domain.ds2.entity.UserMap |
| | | import cn.flightfeather.supervision.domain.ds2.mapper.LedgerRecordMapper |
| | | import cn.flightfeather.supervision.domain.ds2.mapper.LedgerSubTypeMapper |
| | | import cn.flightfeather.supervision.domain.ds2.mapper.UserMapMapper |
| | | 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 java.time.LocalDateTime |
| | | import java.time.ZoneId |
| | | import javax.annotation.PostConstruct |
| | | |
| | | /** |
| | |
| | | private val dateUtil = DateUtil() |
| | | |
| | | private val sourceList = mutableListOf<Subtask>() |
| | | |
| | | var year = 0 |
| | | |
| | | var month = 0 |
| | | |
| | | var area = "" |
| | | |
| | | val rowData = RowData() |
| | | |
| | |
| | | fun loop(callback: (index:Int, rowData: RowData) -> Unit) { |
| | | reset() |
| | | for (i in sourceList.indices) { |
| | | rowData.index = i |
| | | rowData.clear() |
| | | rowData.subTask = sourceList[i] |
| | | callback(i, rowData) |
| | |
| | | * éç½® |
| | | */ |
| | | fun reset() { |
| | | rowData.index = 0 |
| | | 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)}" |
| | | return "${dateUtil.DateToString(t.starttime, DateUtil.DateStyle.YYYY_MM_CN)}${t.districtname}${if (area != t.districtname) area else ""}${Constant.ScenseType.getDes(config.sceneType)}" |
| | | } |
| | | |
| | | /** |
| | |
| | | if (config.sceneType == null) return |
| | | |
| | | val result = mutableListOf<Subtask>() |
| | | |
| | | if (config.townCode != null) { |
| | | dbMapper.townMapper.selectByExample(Example(Town::class.java).apply { |
| | | createCriteria().andEqualTo("towncode", config.townCode) |
| | | })?.takeIf { it.isNotEmpty() }?.get(0)?.let { area = it.townname ?: "" } |
| | | } |
| | | |
| | | dbMapper.taskMapper.selectByPrimaryKey(config.topTaskGuid).let { |
| | | val time = LocalDateTime.ofInstant(it.starttime?.toInstant(), ZoneId.systemDefault()) |
| | | this.year = time.year |
| | | this.month = time.monthValue |
| | | if (area.isBlank()) area = it.districtname ?: "" |
| | | } |
| | | |
| | | //1. æ¥æ¾ç¹å®çå·¡æ¥ä»»å¡æè
ææç计åå·¡æ¥ä»»å¡ |
| | | var taskSceneIdList = listOf<String>() |
| | |
| | | |
| | | |
| | | inner class RowData(){ |
| | | var index = 0 |
| | | |
| | | var subTask: Subtask? = null |
| | | |
| | | //åºæ¯åºæ¬ä¿¡æ¯ |
| | |
| | | } |
| | | private var _rules = mutableListOf<Pair<Evaluationsubrule2, MutableList<Evaluationsubrule2>>>() |
| | | |
| | | //å¿
å¡«å°è´¦æ°é |
| | | val ledgerCount: Int |
| | | get() { |
| | | if (_ledgerCount == -1) { |
| | | val tzSceneType = Constant.ScenseType.typeMap(config.sceneType?.toByte()) |
| | | _ledgerCount = dbMapper.ledgerSubTypeMapper.selectCountByExample(Example(LedgerSubType::class.java).apply { |
| | | createCriteria().andEqualTo("lScenetype", tzSceneType).andEqualTo("lNeedupdate", true) |
| | | }) |
| | | } |
| | | return _ledgerCount |
| | | } |
| | | private var _ledgerCount = -1 |
| | | |
| | | //ç¨æ·å®é
æäº¤å°è´¦æ°é |
| | | val ledgerRecords: List<LedgerRecord> |
| | | get() { |
| | | if (_ledgerRecordNum == null) { |
| | | val userInfo = dbMapper.userinfoMapper.selectByExample(Example(Userinfo::class.java).apply { |
| | | createCriteria().andEqualTo("dGuid", subTask?.scenseid) |
| | | })?.takeIf { l -> l.isNotEmpty() }?.get(0) |
| | | |
| | | val tzUserId = dbMapper.userMapMapper.selectByExample(Example(UserMap::class.java).apply { |
| | | createCriteria().andEqualTo("svUserId", userInfo?.guid) |
| | | })?.takeIf { m-> m.isNotEmpty() }?.get(0)?.tzUserId |
| | | |
| | | if (tzUserId != null) { |
| | | _ledgerRecordNum = dbMapper.ledgerRecordMapper.selectByExample(Example(LedgerRecord::class.java).apply { |
| | | createCriteria().andEqualTo("lrYear", year) |
| | | .andEqualTo("lrMonth", month) |
| | | .andEqualTo("lrSubmitid", tzUserId) |
| | | }) |
| | | } |
| | | } |
| | | return _ledgerRecordNum ?: emptyList() |
| | | } |
| | | private var _ledgerRecordNum: List<LedgerRecord>? = null |
| | | |
| | | /** |
| | | * æ¸
空å½åå¤çç对象çç¸å
³æ°æ®æº |
| | | */ |
| | |
| | | _problems.clear() |
| | | _evaluation = null |
| | | _itemevaluationList.clear() |
| | | _ledgerRecordNum = null |
| | | } |
| | | |
| | | /** |
| | |
| | | val evaluationruleMapper: EvaluationruleMapper, |
| | | val evaluationsubruleMapper: EvaluationsubruleMapper2, |
| | | val evaluationMapper: EvaluationMapper, |
| | | val itemevaluationMapper: ItemevaluationMapper |
| | | val itemevaluationMapper: ItemevaluationMapper, |
| | | val ledgerSubTypeMapper: LedgerSubTypeMapper, |
| | | val ledgerRecordMapper: LedgerRecordMapper, |
| | | val userinfoMapper: UserinfoMapper, |
| | | val userMapMapper: UserMapMapper, |
| | | val townMapper: TownMapper, |
| | | ) |
| | |
| | | ExcelUtil.MyCell("æ´æ¹æ°"), |
| | | ExcelUtil.MyCell("æªæ´æ¹é®é¢"), |
| | | ExcelUtil.MyCell("æªæ´æ¹æ°"), |
| | | ExcelUtil.MyCell("é®é¢æ´æ¹ç"), |
| | | ExcelUtil.MyCell("å®¡æ ¸æ
åµ"), |
| | | ExcelUtil.MyCell("é®é¢å®¡æ ¸æ¶é´"), |
| | | ExcelUtil.MyCell("æ´æ¹å®¡æ ¸æ¶é´"), |
| | | ExcelUtil.MyCell("é®é¢æ´æ¹ç"), |
| | | ExcelUtil.MyCell("é®é¢å®¡æ ¸æ°"), |
| | | ExcelUtil.MyCell("é®é¢å®¡æ ¸å æ¯"), |
| | | ExcelUtil.MyCell("æ´æ¹å®¡æ ¸æ°"), |
| | | ExcelUtil.MyCell("æ´æ¹å®¡æ ¸å æ¯"), |
| | | )) |
| | | } |
| | | |
| | |
| | | var cNum = 0//æ´æ¹æ° |
| | | var unChangedProblem = ""//æªæ´æ¹é®é¢ |
| | | var unChangeNum = 0//æªæ´æ¹æ° |
| | | var changePercent: Any = ""//é®é¢æ´æ¹ç |
| | | |
| | | var checkStatus = ""//å®¡æ ¸æ
åµ |
| | | var pCheckTime = ""//é®é¢å®¡æ ¸æ¶é´ |
| | | var cCheckTime = ""//æ´æ¹å®¡æ ¸æ¶é´ |
| | | var changePercent = ""//é®é¢æ´æ¹ç |
| | | var pCheckNum = 0//é®é¢å®¡æ ¸æ° |
| | | var pCheckPer: Any = ""//é®é¢å®¡æ ¸å æ¯ |
| | | var cCheckNum = 0//æ´æ¹å®¡æ ¸æ° |
| | | var cCheckPer: Any = ""//æ´æ¹å®¡æ ¸å æ¯F |
| | | rowData.problems.forEach { p -> |
| | | var typeName = "" |
| | | for (t in rowData.problemTypes) { |
| | |
| | | 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)}" |
| | | 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()) { |
| | |
| | | unChangedProblem += "$yã${p.problemname}" |
| | | unChangeNum++ |
| | | } |
| | | changePercent = if (pNum == 0) "" else ExcelUtil.MyCell((cNum.toDouble() / pNum).toString(), isPercent = true) |
| | | |
| | | 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 -> "æ´æ¹å®¡æ ¸æªéè¿"// |
| | | Constant.PROBLEM_CHECK_PASS -> { |
| | | pCheckNum++ |
| | | "é®é¢å®¡æ ¸éè¿" |
| | | }// |
| | | Constant.PROBLEM_CHECK_FAIL -> { |
| | | pCheckNum++ |
| | | "é®é¢å®¡æ ¸æªéè¿" |
| | | }// |
| | | Constant.CHANGE_UNCHECKED -> { |
| | | pCheckNum++ |
| | | "æ´æ¹æªå®¡æ ¸" |
| | | }// |
| | | Constant.CHANGE_CHECK_PASS -> { |
| | | pCheckNum++ |
| | | cCheckNum++ |
| | | "æ´æ¹å®¡æ ¸éè¿" |
| | | }// |
| | | Constant.CHANGE_CHECK_FAIL -> { |
| | | pCheckNum++ |
| | | cCheckNum++ |
| | | "æ´æ¹å®¡æ ¸æªéè¿" |
| | | }// |
| | | else -> "é®é¢æªå®¡æ ¸" |
| | | } |
| | | checkStatus += "${lr}$yã${status}" |
| | | changePercent = if (pNum == 0) "" else "${(cNum * 100 / pNum)}%" |
| | | pCheckTime += "${lr}$yã/" |
| | | cCheckTime += "${lr}$yã/" |
| | | pCheckPer = if (pNum == 0) "" else ExcelUtil.MyCell((pCheckNum.toDouble() / pNum).toString(), isPercent = true) |
| | | cCheckPer = if (cNum == 0) "" else ExcelUtil.MyCell((cCheckNum.toDouble() / cNum).toString(), isPercent = true) |
| | | |
| | | |
| | | y++ |
| | | } |
| | | addAll( |
| | | listOf( |
| | | pType, pDes, pLoc, pNum, changeTime, pChanged, changedProblem, cNum, |
| | | unChangedProblem, unChangeNum, checkStatus, pCheckTime, cCheckTime, changePercent |
| | | unChangedProblem, unChangeNum, changePercent, checkStatus, pCheckTime, cCheckTime, |
| | | pCheckNum, pCheckPer, cCheckNum, cCheckPer |
| | | ) |
| | | ) |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | 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 ColItemGrade(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 if (score == "0") "" else score |
| | | } |
| | | } |
| | |
| | | |
| | | import cn.flightfeather.supervision.business.report.BaseCols |
| | | import cn.flightfeather.supervision.business.report.DataSource |
| | | import cn.flightfeather.supervision.common.utils.DateUtil |
| | | import cn.flightfeather.supervision.common.utils.ExcelUtil |
| | | import kotlin.math.round |
| | | |
| | | class ColLedger : BaseCols() { |
| | | override fun onHeads(dataSource: DataSource): MutableList<MutableList<ExcelUtil.MyCell>> { |
| | |
| | | } |
| | | |
| | | override fun onOneRow(rowData: DataSource.RowData): List<Any> { |
| | | return listOf("", "", "") |
| | | val dateUtil = DateUtil() |
| | | rowData.ledgerRecords.sortedByDescending { |
| | | it.lrSubmitdate |
| | | } |
| | | val per = rowData.ledgerRecords.size.toDouble() / rowData.ledgerCount |
| | | var t1 = "" |
| | | var t2 = "/" |
| | | if (rowData.ledgerRecords.isNotEmpty()) { |
| | | val r = rowData.ledgerRecords[0] |
| | | t1 = "${dateUtil.DateToString(r.lrSubmitdate, DateUtil.DateStyle.YYYY_MM_DD_HH_MM_CN)}" |
| | | } |
| | | return listOf(ExcelUtil.MyCell(per.toString(), isPercent = true), t1, t2) |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | override fun onOneRow(rowData: DataSource.RowData): List<Any> { |
| | | return listOf(rowData.scene?.index ?: -99, rowData.scene?.extension2 ?: "", rowData.scene?.name ?: "") |
| | | // return listOf(rowData.scene?.index ?: -99, rowData.scene?.extension2 ?: "", rowData.scene?.name ?: "") |
| | | return listOf(rowData.index + 1, rowData.scene?.index ?: -99, 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.ExcelUtil |
| | | import cn.flightfeather.supervision.domain.ds1.entity.Itemevaluation |
| | | import org.apache.poi.hssf.util.HSSFColor |
| | | |
| | | class ColTotalGrade() : BaseCols() { |
| | | |
| | | override fun onHeads(dataSource: DataSource): MutableList<MutableList<ExcelUtil.MyCell>> { |
| | | val h1 = mutableListOf<ExcelUtil.MyCell>() |
| | | h1.add(ExcelUtil.MyCell("ç¯ä¿¡ç ")) |
| | | h1.add(ExcelUtil.MyCell("鲿²»è§èæ§")) |
| | | h1.add(ExcelUtil.MyCell("æ»å")) |
| | | |
| | | return mutableListOf(h1) |
| | | } |
| | | |
| | | 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() ?: -1 |
| | | 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) |
| | | -1 -> 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.RED.index) |
| | | in 60..89 -> ExcelUtil.MyCell("ä¸è§è", fontColor = HSSFColor.HSSFColorPredefined.ROSE.index) |
| | | in 90..99 -> ExcelUtil.MyCell("åºæ¬è§è", fontColor = HSSFColor.HSSFColorPredefined.GOLD.index) |
| | | 100 -> ExcelUtil.MyCell("è§è", fontColor = HSSFColor.HSSFColorPredefined.BRIGHT_GREEN.index) |
| | | -1 -> ExcelUtil.MyCell("", fontColor = HSSFColor.HSSFColorPredefined.BLACK.index) |
| | | else -> ExcelUtil.MyCell("è¶
åºèå´ï¼${s}", fontColor = HSSFColor.HSSFColorPredefined.BLACK.index) |
| | | } |
| | | add(code) |
| | | add(normalization) |
| | | add(s) |
| | | } |
| | | } |
| | | } |
| | | |
| | | return row |
| | | } |
| | | } |
| | |
| | | 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.ColTotalGrade |
| | | import cn.flightfeather.supervision.common.utils.Constant |
| | | import cn.flightfeather.supervision.common.utils.ExcelUtil |
| | | import cn.flightfeather.supervision.domain.ds1.entity.SceneConstructionSite |
| | |
| | | * åè¡éé®é¢æ´æ¹åææ±æ»è¡¨ |
| | | */ |
| | | class ProAnalysisSummary(dataSource: DataSource) : BaseTemplate(dataSource) { |
| | | override val cols: List<BaseCols> = listOf(ColInspectionInfo()) |
| | | override val cols: List<BaseCols> = listOf(ColInspectionInfo(), ColTotalGrade()) |
| | | |
| | | override val templateName: String = "åè¡éé®é¢æ´æ¹åææ±æ»è¡¨" |
| | | |
| | |
| | | if (rowData.noRecord()) return@loop |
| | | |
| | | val r = cols[0].getOneRow(rowData) |
| | | val r1 = cols[1].getOneRow(rowData) |
| | | |
| | | val k = rowData.scene?.townname |
| | | if (!districtMap.containsKey(k)) { |
| | |
| | | if (pNum > 0 && cNum > 0) changeScenes++ |
| | | proNum += pNum |
| | | changeNum += cNum |
| | | |
| | | |
| | | val standard = r1[1] as ExcelUtil.MyCell |
| | | if (standard.text.contains("ä¸è§è")) { |
| | | focusSceneNum++ |
| | | } |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | 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 |
| | | v.changeScenePer = v.changeScenes.toDouble() / v.sceneCount |
| | | v.proPer = v.proNum.toDouble() / totalPro |
| | | v.changePer = v.changeNum.toDouble() / v.proNum |
| | | v.focusScenePer = v.focusSceneNum.toDouble() / v.sceneCount |
| | | } |
| | | //æ´æ¹å使¯æå |
| | | summarys.sortByDescending { |
| | | it.changeScenePer |
| | | } |
| | | for (i in summarys.indices) { |
| | | if (i > 0 && summarys[i - 1].changeScenePer == summarys[i].changeScenePer) { |
| | | summarys[i].changeSceneRank = summarys[i - 1].changeSceneRank |
| | | } else { |
| | | summarys[i].changeSceneRank = i + 1 |
| | | } |
| | | } |
| | | //é®é¢æ´æ¹çæå |
| | | summarys.sortByDescending { |
| | | it.changePer |
| | | } |
| | | for (i in summarys.indices) { |
| | | if (i > 0 && summarys[i - 1].changePer == summarys[i].changePer) { |
| | | summarys[i].proChangeRank = summarys[i - 1].proChangeRank |
| | | } else { |
| | | summarys[i].proChangeRank = i + 1 |
| | | } |
| | | } |
| | | |
| | | //æ´æ°è¡¨å¤´ |
| | |
| | | ExcelUtil.MyCell("æåå
¥éç¹çç®¡å æ¯"), |
| | | )) |
| | | //æ´æ°å
容 |
| | | summarys.forEach { |
| | | summarys.sortBy { it.townCode } |
| | | for (i in summarys.indices) { |
| | | val it = summarys[i] |
| | | 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 |
| | | i+1, it.townName, it.type, it.sceneCount, it.inactiveScenes, it.activeScenes, it.changeScenes, |
| | | ExcelUtil.MyCell(it.changeScenePer.toString(), isPercent = true), |
| | | it.proNum, ExcelUtil.MyCell(it.proPer.toString(), isPercent = true), it.changeNum, ExcelUtil.MyCell(it.changePer.toString(), isPercent = true), it.changeSceneRank, it.proChangeRank, |
| | | it.focusSceneNum, ExcelUtil.MyCell(it.focusScenePer.toString(), isPercent = true) |
| | | ) |
| | | ) |
| | | } |
| | |
| | | |
| | | var changeSceneRank = 0 |
| | | var proChangeRank = 0 |
| | | |
| | | var focusSceneNum = 0 |
| | | var focusScenePer = .0 |
| | | } |
| | | } |
| | |
| | | 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.ColLedger |
| | | import cn.flightfeather.supervision.business.report.cols.ColSceneName |
| | | |
| | | class ProDetailSummary(dataSource: DataSource) : BaseTemplate(dataSource) { |
| | | override val cols: List<BaseCols> = listOf(ColSceneName(), ColInspectionInfo()) |
| | | override val cols: List<BaseCols> = listOf(ColSceneName(), ColInspectionInfo(), ColLedger()) |
| | | |
| | | override val templateName: String = "é®é¢ä¸æ´æ¹è·è¸ªæ±æ»è¡¨" |
| | | } |
| | |
| | | package cn.flightfeather.supervision.business.report.template |
| | | |
| | | import cn.flightfeather.supervision.business.report.DataSource |
| | | import cn.flightfeather.supervision.common.utils.Constant |
| | | 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 } |
| | | override fun formatTable(summarys: MutableList<Summary>) { |
| | | val max = when (dataSource.config.sceneType.toString()) { |
| | | Constant.ScenseType.TYPE1.value -> 5 |
| | | else -> 4 |
| | | } |
| | | |
| | | summarys.sortByDescending { it.count } |
| | | |
| | | head.clear() |
| | | head.add( |
| | |
| | | ) |
| | | ) |
| | | for (i in summarys.indices) { |
| | | if (i >= max) break |
| | | |
| | | val s = summarys[i] |
| | | contents.add( |
| | | mutableListOf( |
| | | i + 1, "", "", dataSource.rowData.scene?.type ?: "", "", s.count, |
| | | s.proDes, s.count, "${round(s.countPer * 1000) / 10}%" |
| | | i + 1, dataSource.year, dataSource.month, dataSource.rowData.scene?.type ?: "", dataSource.area, s.count, |
| | | s.proDes, s.count, ExcelUtil.MyCell(s.countPer.toString(), isPercent = true) |
| | | ) |
| | | ) |
| | | } |
| | |
| | | for (i in summarys.indices) { |
| | | val it = summarys[i] |
| | | it.countPer = it.count.toDouble() / tPros |
| | | if (i > 0 && summarys[i - 1].countPer == it.countPer) { |
| | | it.countRank = summarys[i - 1].countRank |
| | | } else { |
| | | it.countRank = i + 1 |
| | | } |
| | | it.changePer = it.changeNum.toDouble() / it.count |
| | | } |
| | | summarys.sortByDescending { it.changePer } |
| | | for (i in summarys.indices) { |
| | | val it = summarys[i] |
| | | if (i > 0 && summarys[i - 1].changePer == it.changePer) { |
| | | it.changeRank = summarys[i - 1].changeRank |
| | | } else { |
| | | it.changeRank = i + 1 |
| | | } |
| | | } |
| | | |
| | | formatTable(summarys) |
| | | } |
| | | |
| | | open fun formatTable(summarys: List<Summary>) { |
| | | open fun formatTable(summarys: MutableList<Summary>) { |
| | | head.clear() |
| | | head.add( |
| | | mutableListOf( |
| | |
| | | ) |
| | | for (i in summarys.indices) { |
| | | val s = summarys[i] |
| | | // contents.add( |
| | | // mutableListOf( |
| | | // i + 1, dataSource.year, dataSource.month, dataSource.rowData.scene?.type ?: "", dataSource.area, |
| | | // s.proType, s.proDes, |
| | | // s.count, "${round(s.countPer * 1000) / 10}%", s.countRank, |
| | | // s.changeNum, "${round(s.changePer * 1000) / 10}%", s.changeRank |
| | | // ) |
| | | // ) |
| | | contents.add( |
| | | mutableListOf( |
| | | i + 1, "", "", dataSource.rowData.scene?.type ?: "", "", |
| | | i + 1, dataSource.year, dataSource.month, dataSource.rowData.scene?.type ?: "", dataSource.area, |
| | | s.proType, s.proDes, |
| | | s.count, "${round(s.countPer * 1000) / 10}%", s.countRank, |
| | | s.changeNum, "${round(s.changePer * 1000) / 10}%", s.changeRank |
| | | s.count, ExcelUtil.MyCell(s.countPer.toString(), isPercent = true), s.countRank, |
| | | s.changeNum, ExcelUtil.MyCell(s.changePer.toString(), isPercent = true), s.changeRank |
| | | ) |
| | | ) |
| | | } |
| | |
| | | val s = summarys[i] |
| | | contents.add( |
| | | mutableListOf( |
| | | i + 1, "", "", dataSource.rowData.scene?.type ?: "", "", s.status, s.status, |
| | | i + 1, dataSource.year, dataSource.month, dataSource.rowData.scene?.type ?: "", dataSource.area, s.status, s.status, |
| | | s.proType, s.proDes, |
| | | s.count, "${round(s.countPer * 1000) / 10}%", |
| | | s.changeNum, "${round(s.changePer * 1000) / 10}%", |
| | | s.count, ExcelUtil.MyCell(s.countPer.toString(), isPercent = true), |
| | | s.changeNum, ExcelUtil.MyCell(s.changePer.toString(), isPercent = true), |
| | | ) |
| | | ) |
| | | } |
| | |
| | | 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.ColTotalGrade |
| | | 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 cols: List<BaseCols> = listOf(ColTotalGrade()) |
| | | |
| | | override val templateName: String = "åè¡éè§èæ§åæè¡¨" |
| | | |
| | |
| | | tNonstandard += v.nonstandard |
| | | tStandard += v.standard |
| | | } |
| | | summarys.sortByDescending { it.standardPer } |
| | | summarys.sortByDescending { it.standard } |
| | | for (i in summarys.indices) { |
| | | val it = summarys[i] |
| | | //åè¯ç¾åæ¯ |
| | |
| | | //è§èåºåå æ¯ |
| | | it.standardPer = it.standard.toDouble() / tStandard |
| | | //è§èå æ¯æå |
| | | if (i > 0 && summarys[i - 1].standard == it.standard) { |
| | | it.rank = summarys[i - 1].rank |
| | | } else { |
| | | it.rank = i + 1 |
| | | } |
| | | } |
| | | |
| | | head.clear() |
| | |
| | | ExcelUtil.MyCell("è§èæ§æå"), |
| | | )) |
| | | |
| | | summarys.forEach { |
| | | summarys.sortBy { it.townCode } |
| | | for (i in summarys.indices) { |
| | | val it = summarys[i] |
| | | 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}%", |
| | | i + 1, it.townName, it.type, it.sceneCount, it.gradeCount, ExcelUtil.MyCell(it.gradePer.toString(), isPercent = true), |
| | | it.level1, ExcelUtil.MyCell(it.level1Per.toString(), isPercent = true), |
| | | it.level2, ExcelUtil.MyCell(it.level2Per.toString(), isPercent = true), |
| | | it.level3, ExcelUtil.MyCell(it.level3Per.toString(), isPercent = true), |
| | | it.level4, ExcelUtil.MyCell(it.level4Per.toString(), isPercent = true), |
| | | it.nonstandard, ExcelUtil.MyCell(it.nonstandardPer.toString(), isPercent = true), |
| | | it.standard, ExcelUtil.MyCell(it.standardPer.toString(), isPercent = true), |
| | | it.rank |
| | | ) |
| | | ) |
| | |
| | | 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.ColItemGrade |
| | | import cn.flightfeather.supervision.business.report.cols.ColSceneName |
| | | import cn.flightfeather.supervision.business.report.cols.ColTotalGrade |
| | | 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 cols: List<BaseCols> = listOf(ColSceneName(), ColTown(), ColTotalGrade(), ColItemGrade()) |
| | | override val templateName: String = "è§èæ§è¯ä¼°è¯¦æ
表" |
| | | } |
| | |
| | | * @return æ¥æå符串 |
| | | */ |
| | | fun DateToString(date: Date?, pattern: String): String? { |
| | | var dateString: String? = null |
| | | var dateString: String? = "" |
| | | if (date != null) { |
| | | try { |
| | | dateString = getDateFormat(pattern).format(date) |
| | |
| | | |
| | | import org.apache.poi.hssf.usermodel.HSSFWorkbook |
| | | import org.apache.poi.ss.util.CellRangeAddress |
| | | import java.io.File |
| | | import java.io.OutputStream |
| | | import java.time.LocalDate |
| | | import java.util.* |
| | | import kotlin.math.max |
| | | |
| | | |
| | | /** |
| | | * @author riku |
| | |
| | | var text: String, |
| | | var rowSpan: Int = 1, |
| | | var colSpan: Int = 1, |
| | | var fontColor: Short? = null |
| | | var fontColor: Short? = null, |
| | | var isPercent:Boolean = false |
| | | ) |
| | | |
| | | /** |
| | |
| | | when (c) { |
| | | is MyCell -> { |
| | | rows.createCell(col).apply { |
| | | if (c.isPercent) { |
| | | val cellStyle = workbook.createCellStyle() |
| | | val format = workbook.createDataFormat() |
| | | cellStyle.dataFormat = format.getFormat("0.0%") |
| | | setCellStyle(cellStyle) |
| | | val v = c.text.toDoubleOrNull() |
| | | if (v != null) { |
| | | setCellValue(v) |
| | | } |
| | | } else { |
| | | c.fontColor?.let {fC -> |
| | | val font = workbook.createFont() |
| | | val cellStyle = workbook.createCellStyle() |
| | |
| | | setCellStyle(cellStyle) |
| | | } |
| | | setCellValue(c.text) |
| | | } |
| | | } |
| | | println("write1-1: ${c.text};($rowIndex, ${col})") |
| | | } |
| | |
| | | |
| | | when (c) { |
| | | is MyCell -> { |
| | | rows.createCell(map.key).setCellValue(c.text) |
| | | rows.createCell(col).apply { |
| | | if (c.isPercent) { |
| | | val cellStyle = workbook.createCellStyle() |
| | | val format = workbook.createDataFormat() |
| | | cellStyle.dataFormat = format.getFormat("0.0%") |
| | | setCellStyle(cellStyle) |
| | | val v = c.text.toDoubleOrNull() |
| | | if (v != null) { |
| | | setCellValue(v) |
| | | } |
| | | } else { |
| | | c.fontColor?.let {fC -> |
| | | val font = workbook.createFont() |
| | | val cellStyle = workbook.createCellStyle() |
| | | |
| | | font.color = fC |
| | | cellStyle.setFont(font) |
| | | setCellStyle(cellStyle) |
| | | } |
| | | setCellValue(c.text) |
| | | } |
| | | } |
| | | println("write2-1: ${c.text};($_rowIndex, ${map.key})") |
| | | } |
| | | is String -> { |
| | |
| | | workbook.close() |
| | | out.flush() |
| | | out.close() |
| | | } |
| | | |
| | | fun write3() { |
| | | |
| | | } |
| | | |
| | | private fun getMaxRows(rowArray: Array<Any>): Int { |
| | |
| | | * åºæ¯åç§° |
| | | */ |
| | | @Column(name = "DR_Scene_Name") |
| | | private Integer drSceneName; |
| | | private String drSceneName; |
| | | |
| | | /** |
| | | * è®°å½æä»½ |
| | |
| | | * |
| | | * @return DR_Scene_Name - åºæ¯åç§° |
| | | */ |
| | | public Integer getDrSceneName() { |
| | | public String getDrSceneName() { |
| | | return drSceneName; |
| | | } |
| | | |
| | |
| | | * |
| | | * @param drSceneName åºæ¯åç§° |
| | | */ |
| | | public void setDrSceneName(Integer drSceneName) { |
| | | public void setDrSceneName(String drSceneName) { |
| | | this.drSceneName = drSceneName; |
| | | } |
| | | |
| | |
| | | import cn.flightfeather.supervision.common.utils.* |
| | | import cn.flightfeather.supervision.domain.ds1.entity.* |
| | | import cn.flightfeather.supervision.domain.ds1.mapper.* |
| | | import cn.flightfeather.supervision.domain.ds2.mapper.LedgerRecordMapper |
| | | 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.vo.* |
| | | import com.github.pagehelper.PageHelper |
| | |
| | | val evaluationruleMapper: EvaluationruleMapper, |
| | | val evaluationsubruleMapper: EvaluationsubruleMapper2, |
| | | val evaluationMapper: EvaluationMapper, |
| | | val itemevaluationMapper: ItemevaluationMapper |
| | | val itemevaluationMapper: ItemevaluationMapper, |
| | | val ledgerSubTypeMapper: LedgerSubTypeMapper, |
| | | val ledgerRecordMapper: LedgerRecordMapper, |
| | | val userMapMapper: UserMapMapper, |
| | | ) : SearchService { |
| | | |
| | | private val dateUtil = DateUtil() |
| | |
| | | sceneStorageYardMapper, |
| | | sceneWharfMapper, |
| | | taskMapper, |
| | | evaluationruleMapper, evaluationsubruleMapper, evaluationMapper, itemevaluationMapper |
| | | evaluationruleMapper, evaluationsubruleMapper, evaluationMapper, itemevaluationMapper, |
| | | ledgerSubTypeMapper, ledgerRecordMapper, userinfoMapper, userMapMapper, townMapper |
| | | ) |
| | | val dataSource = DataSource(config, dbMapper) |
| | | val t = when (mode) { |
| | |
| | | --> |
| | | <id column="DR_Id" property="drId" jdbcType="INTEGER" /> |
| | | <result column="DR_Scene_Id" property="drSceneId" jdbcType="VARCHAR" /> |
| | | <result column="DR_Scene_Name" property="drSceneName" jdbcType="INTEGER" /> |
| | | <result column="DR_Scene_Name" property="drSceneName" jdbcType="VARCHAR" /> |
| | | <result column="DR_Time" property="drTime" jdbcType="DATE" /> |
| | | <result column="DR_Exceed_Times" property="drExceedTimes" jdbcType="INTEGER" /> |
| | | <result column="DR_Avg" property="drAvg" jdbcType="DOUBLE" /> |