From 4c7e2d8f8d4a93f318ada0e728dbc370e7504e92 Mon Sep 17 00:00:00 2001 From: feiyu02 <risaku@163.com> Date: 星期四, 14 七月 2022 17:49:40 +0800 Subject: [PATCH] 1. 自动评分优化; 2. 巡查汇总报告功能编写中 --- src/main/kotlin/cn/flightfeather/supervision/business/storage/StAutoScore.kt | 551 ++++++++++++++++++++++++++++-------------------------- 1 files changed, 289 insertions(+), 262 deletions(-) diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/storage/StAutoScore.kt b/src/main/kotlin/cn/flightfeather/supervision/business/storage/StAutoScore.kt index 507918b..c776371 100644 --- a/src/main/kotlin/cn/flightfeather/supervision/business/storage/StAutoScore.kt +++ b/src/main/kotlin/cn/flightfeather/supervision/business/storage/StAutoScore.kt @@ -2,7 +2,6 @@ import cn.flightfeather.supervision.business.Info import cn.flightfeather.supervision.business.ScoreItem -import cn.flightfeather.supervision.business.fume.AutoScore3 import cn.flightfeather.supervision.common.utils.Constant import cn.flightfeather.supervision.common.utils.DateUtil import cn.flightfeather.supervision.common.utils.ExcelUtil @@ -30,16 +29,12 @@ * 宸ュ湴鑷姩璇勫垎 */ @Component -class StAutoScore(val stScoreItem_1: ScoreItem) { +class StAutoScore( + stScoreItem_1: ScoreItem, + var sceneType: Constant.ScenseType = Constant.ScenseType.TYPE1, ) +{ companion object { private lateinit var instance: StAutoScore - private val SCENE_TYPE = Constant.ScenseType.TYPE1 - private const val DISTRICT = "閲戝北鍖�" - } - - @PostConstruct - fun init() { - instance = this } @Autowired @@ -72,8 +67,14 @@ @Autowired lateinit var taskMapper: TaskMapper + @Autowired + lateinit var inspectionMapper: InspectionMapper + + @Autowired + lateinit var subtaskMapper: SubtaskMapper + //鍐冲畾鏄惁鍐檋3 - private val hasHead3 = false + private val hasHead3 = true private var totalScore = 100//婊″垎 @@ -85,31 +86,279 @@ private val topItems = mutableListOf<Evaluationsubrule2>() + // excel鏂囨。 private var workbook = HSSFWorkbook() + // 鏂囨。琛屾暟鎹� + private val rows = mutableListOf<Array<Any>>() init { itemList.add(stScoreItem_1) } - fun go(_year: Int? = null, _month: Int? = null, _period: Int = 1) { - val now = LocalDate.now() - val year = _year ?: now.year - val month = _month ?: now.monthValue - val sMonth = DateUtil().getStartMonthByPeriod(month, _period) ?: 1 - val eMonth = sMonth + _period - 1 - val sTime = LocalDateTime.of(year, sMonth, 1, 0, 0) - val eTime = sTime.plusMonths(_period.toLong()) - val period = "${year}/$sMonth-$eMonth" + @PostConstruct + fun init() { + instance = this + } + + + /** + * 鎬讳换鍔℃墦鍒� + * 鏍规嵁鎬讳换鍔★紝瀵逛笅灞炴墍鏈夌殑宸℃煡浠诲姟鎸ㄤ釜鎵撳垎 + * @param topTaskId 鎬讳换鍔d + */ + fun topTaskGrade(topTaskId:String) { + rows.clear() + subtaskMapper.selectByTopTask2(topTaskId, sceneType.value.toInt()).forEach { +// sceneGrade(it) + sceneGradeToFile(it) + } + toFile() + } + + /** + * 鍗曞満鏅墦鍒� + * @param subtask 宸℃煡浠诲姟 + */ + fun sceneGrade(subtask: Subtask) { + // 鑾峰彇璇勫垎瑙勫垯 getScoreItem() + val info = itemGrade(subtask) + val result = totalGrade(info) ?: return + toDb(info, result) +// addToFile(rows, info, result.first) +// toFile() + } + + fun sceneGradeToFile(subtask: Subtask) { + // 鑾峰彇璇勫垎瑙勫垯 + getScoreItem() + + val info = itemGrade(subtask) + val result = totalGrade(info) ?: return + addToFile(rows, info, result.first) + + } + + /** + * 鏉$洰鎵撳垎 + */ + private fun itemGrade(subtask: Subtask): Info { + // 瑙勫垯鏉$洰寰楀垎鍒濆鍖� + topItems.forEach { s -> s.extension1 = null } + rules.forEach { p -> + p.first.extension1 = null + p.second.forEach { e -> e.extension1 = null } + } + + + // 鑾峰彇椋炵窘鐩戠绯荤粺鐢ㄦ埛淇℃伅 + val userInfo = userinfoMapper.selectByExample(Example(Userinfo::class.java).apply { + createCriteria().andEqualTo("dGuid", subtask.scenseid) + })?.takeIf { l -> l.isNotEmpty() }?.get(0) + // 鑾峰彇椋炵窘鐜绯荤粺鐢ㄦ埛淇℃伅 + val tzUserId = userMapMapper.selectByExample(Example(UserMap::class.java).apply { + createCriteria().andEqualTo("svUserId", userInfo?.guid) + })?.takeIf { m -> m.isNotEmpty() }?.get(0)?.tzUserId + val scene = scenseMapper.selectByPrimaryKey(subtask.scenseid) + + val info = + Info(userInfo?.guid, tzUserId, subtask.scenseid, subtask.scensename, sceneType, subTask = subtask, sceneIndex = scene.index) + + /** 1. 鏍规嵁璇勫垎瑙勫垯瀵瑰簲鐨勯棶棰樿嚜鍔ㄥ垽鏂槸鍚︽墸鍒�***************************************************************/ + // 鑾峰彇璇ユ宸℃煡浠诲姟涓嬬殑鎵�鏈夐棶棰� + val pList = problemlistMapper.selectByExample(Example(Problemlist::class.java).apply { + createCriteria().andEqualTo("stguid", info.subTask?.stguid) + }).map { it.ptguid } + // 璁$畻姣忔潯璇勫垎瑙勫垯鐨勫緱鍒� + rules.forEach { r -> + // 璇勫垎鏉$洰 + val rule = r.first + // 鍏蜂綋璇勫垎閫夐」 + val subRule = r.second + subRule.forEach { sr -> + sr.problemlist?.split(",")?.forEach { pId -> + if (pList.contains(pId)) { + sr.extension1 = (0 - (sr.maxscore ?: 0)).toString() + } + } + } + var total: Int? = null + subRule.forEach { sr -> + if (!sr.extension1.isNullOrBlank()) { + total = (total ?: 0) + sr.extension1!!.toInt() + } + } + if (total == null) { + rule.extension1 = "0" + } else { + val s = if (abs(total!!) > rule.maxscore!!) { + 0 - rule.maxscore!! + } else { + total + } + rule.extension1 = s.toString() + } + } + /** 2.閮ㄥ垎鏈夌壒娈婅瘎鍒嗛�昏緫鐨勮鍒欒繘琛岃绠�*************************************************************************/ + itemList.forEach { item -> item.execute2(info, rules) } + + /** 3. 琛ュ叏鍚勪笂绾ц瘎鍒嗛」鐨勮鍒�*************************************************************************/ + this.rules.forEach { r -> + val fatherId = r.first.fatherid + for (t in topItems) { + if (t.guid == fatherId) { + var s = t.extension1?.toIntOrNull() ?: 0 + s += r.first.extension1?.toIntOrNull() ?: 0 + // 闄愬埗鏈�楂樻墸鍒� + if (abs(s) > (t.maxscore ?: 0)) { + s = 0 - (t.maxscore ?: 0) + } + t.extension1 = s.toString() + break + } + } + } + return info + } + + /** + * 璁$畻鎬诲垎 + */ + private fun totalGrade(info: Info): Pair<Evaluation, List<Itemevaluation>>? { + /** 4. 璁$畻鎬诲垎*************************************************************************/ + val scene = scenseMapper.selectByPrimaryKey(info.subTask?.scenseid) ?: return null + val inspection = inspectionMapper.selectByExample(Example(Inspection::class.java).apply { + createCriteria().andEqualTo("stguid", info.subTask?.stguid) + })?.takeIf { it.isNotEmpty() }?.let { it[0] } + var total = 0//鎬绘墸闄ょ殑鍒嗘暟 + topItems.forEach top@{ top -> + total += top.extension1?.toIntOrNull() ?: 0 + } + val evaluation = Evaluation() + baseRules.forEach { + evaluation.apply { + guid = UUIDGenerator.generate16ShortUUID() + iguid = inspection?.guid + stguid = info.subTask?.stguid + sguid = info.subTask?.scenseid + scensetypeid = scene.typeid + scensetype = scene.type + subscensetypeid = scene.scensesubtypeid + subscensetype = scene.scensesubtype + ertype = it.ruletype?.toByte() + provincecode = scene.provincecode + provincename = scene.provincename + citycode = scene.citycode + cityname = scene.cityname + districtcode = scene.districtcode + districtname = scene.districtname + towncode = scene.towncode + townname = scene.townname + scensename = scene.name + scenseaddress = scene.location + evaluatetime = Date() + evaluatorguid = "admin" + evaluatorusername = "admin" + evaluatorrealname = "admin" + resultscorebef = (totalScore - abs(total)).toString() + createdate = Date() + updatedate = Date() + } + } + //瀛愰」鍏蜂綋寰楀垎 + val itemevaluationList = mutableListOf<Itemevaluation>() + topItems.forEach { subRule -> + val item = newItemEvaluation(info, subRule, inspection) + itemevaluationList.add(item) + } + rules.forEach { p -> + if (p.first.ertype != 2) { + val item = newItemEvaluation(info, p.first, inspection) + itemevaluationList.add(item) + } + p.second.forEach { r -> + val item1 = newItemEvaluation(info, r, inspection) + itemevaluationList.add(item1) + } + } + return Pair(evaluation, itemevaluationList) + } + + /** + * 灏嗚瘎鍒嗚褰曡緭鍑鸿嚦鏁版嵁搴� + */ + private fun toDb(info: Info, p: Pair<Evaluation, List<Itemevaluation>>) { + //鍘婚櫎宸叉湁璁板綍 + evaluationMapper.deleteByExample(Example(Evaluation::class.java).apply { + createCriteria().andEqualTo("stguid", info.subTask?.stguid) + }) + itemevaluationMapper.deleteByExample(Example(Itemevaluation::class.java).apply { + createCriteria().andEqualTo("stguid", info.subTask?.stguid) + }) + + //鍐欏叆鏁版嵁搴� + evaluationMapper.insert(p.first) + p.second.forEach { il -> itemevaluationMapper.insert(il) } + } + + /** + * 杞崲涓�鏉¤瘎鍒嗚嚦excel涓殑涓�琛� + */ + private fun addToFile(contents: MutableList<Array<Any>>, info: Info, evaluations: Evaluation) { + val cList = mutableListOf<Any>() + // FIXME: 2021/4/28 鐢ㄦ埛鍚嶆槸鍚︽坊鍔犺处鍙� +// cList.add("${info.userName}\t${info.userId}") + cList.add(info.sceneIndex ?: -99) + cList.add("") + cList.add("${info.sceneName}") + //姣忎竴椤瑰叿浣撳緱鍒� + topItems.forEach { + for (r in rules) { + if (r.first.fatherid == it.guid || r.first.guid == it.guid) { + // FIXME: 2021/4/25 鍐冲畾鏄惁鍐檋3 + if (hasHead3) { + r.second.forEach { s -> + cList.add(s.extension1?.toInt() ?: "") + } + } else { + cList.add(r.first.extension1?.toInt() ?: "") + } + } + } + } + //鎬诲垎鍜岀幆淇$爜 + evaluations.let { + cList.add(it.resultscorebef?.toDoubleOrNull() ?: .0) + val code = when (it.resultscorebef?.toIntOrNull() ?: 0) { + 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) + else -> ExcelUtil.MyCell("瓒呭嚭鑼冨洿锛�${it.resultscoreaft}", fontColor = HSSFColor.HSSFColorPredefined.BLACK.index) + } + cList.add(code) + } + contents.add(cList.toTypedArray()) + } + + /** + * 灏嗚瘎鍒嗚褰曡緭鍑轰负excel + */ + private fun toFile() { val contents = mutableListOf<Array<Any>>() val h1 = mutableListOf<ExcelUtil.MyCell>() - h1.add(ExcelUtil.MyCell("")) + h1.add(ExcelUtil.MyCell("琛ㄥ崟缂栧彿", if (hasHead3) 3 else 2)) + h1.add(ExcelUtil.MyCell("鍞竴搴忓彿", if (hasHead3) 3 else 2)) + h1.add(ExcelUtil.MyCell("鍦烘櫙鍚嶇О", if (hasHead3) 3 else 2)) val h2 = mutableListOf<ExcelUtil.MyCell>() h2.add(ExcelUtil.MyCell("")) + h2.add(ExcelUtil.MyCell("")) + h2.add(ExcelUtil.MyCell("")) val h3 = mutableListOf<String>() + h3.add("") + h3.add("") h3.add("") topItems.forEach { h1.add(ExcelUtil.MyCell(it.itemname ?: "", 1, 0)) @@ -130,220 +379,32 @@ } } } - // FIXME: 2021/4/25 鍐冲畾鏄惁鍐檋3 + // 鍐冲畾鏄惁鍐檋3 if (hasHead3) { h1.add(ExcelUtil.MyCell("鎬诲垎", 3, 1)) - h1.add(ExcelUtil.MyCell("鐜俊鐮�", 3, 1)) + h1.add(ExcelUtil.MyCell("闃叉不瑙勮寖鎬�", 3, 1)) } else { h1.add(ExcelUtil.MyCell("鎬诲垎", 2, 1)) - h1.add(ExcelUtil.MyCell("鐜俊鐮�", 2, 1)) + h1.add(ExcelUtil.MyCell("闃叉不瑙勮寖鎬�", 2, 1)) } contents.add(h1.toTypedArray()) contents.add(h2.toTypedArray()) - // FIXME: 2021/4/25 鍐冲畾鏄惁鍐檋3 + // 鍐冲畾鏄惁鍐檋3 if (hasHead3) { contents.add(h3.toTypedArray()) } - /** 2. 绛涢�夋墦鍒嗗満鏅�*************************************************************************/ - val tasks = taskMapper.selectByExample(Example(Task::class.java).apply { - createCriteria().andEqualTo("levelnum", 2) - .andEqualTo("districtname", DISTRICT) - .andGreaterThanOrEqualTo("starttime", sTime) - .andLessThanOrEqualTo("endtime", eTime) - }) - val mList = if (tasks.isNotEmpty()) { - val taskId = tasks[0].tguid - monitorobjectversionMapper.selectByExample(Example(Monitorobjectversion::class.java).apply { - createCriteria().andEqualTo("tid", taskId) - }) - } else { - emptyList() - } -// val sceneList = scenseMapper.selectByExample(Example(Scense::class.java).apply { -// createCriteria().andEqualTo("typeid", SCENE_TYPE.value.toByte()) -// .andEqualTo("districtname", DISTRICT) -// .andNotEqualTo("extension1", '0') -//// createCriteria().andEqualTo("guid", "XcRAQtiD4tTU90sA") -// }) - - /** 3. 寰幆澶勭悊姣忎釜鍦烘櫙锛岀粰姣忎釜鍦烘櫙鎵撳垎*************************************************************************/ - val sceneList = listOf( - "q4qOX4kU0aa8J6W2", - "Syu177gGk1dkiFD1", - "7GQ53boTPxIPKFv5", - "zIAoNkridReTEFs9", - "q4qOX4kU0aa8J6W2", - "7vz7deflv1bXfVLq", - "F1f4FXrQ8Knd9UuS", - "5wufBlqzNPy5z9hs", - "y0t0XulzkNILtEr3", - "F7oulQiTCyVZAoJY" - ) - mList.forEach { - if (!sceneList.contains(it.sguid)) return@forEach - - //绛涢�夋墍闇�瑕佺殑鍦烘櫙绫诲瀷 - val scene = scenseMapper.selectByPrimaryKey(it.sguid) - if (scene.type != SCENE_TYPE.text) return@forEach - - topItems.forEach { s -> s.extension1 = null } - rules.forEach { p -> - p.first.extension1 = null - p.second.forEach { e -> e.extension1 = null } - } - - val userInfo = userinfoMapper.selectByExample(Example(Userinfo::class.java).apply { - createCriteria().andEqualTo("dGuid", it.sguid) - })?.takeIf { l -> l.isNotEmpty() }?.get(0) - - val tzUserId = userMapMapper.selectByExample(Example(UserMap::class.java).apply { - createCriteria().andEqualTo("svUserId", userInfo?.guid) - })?.takeIf { m -> m.isNotEmpty() }?.get(0)?.tzUserId - - val info = - Info(userInfo?.guid, tzUserId, it.sguid, it.sensename, SCENE_TYPE, year, sMonth, _period, sTime, eTime) - - /** 1. 鏍规嵁璇勫垎瑙勫垯瀵瑰簲鐨勯棶棰樿嚜鍔ㄥ垽鏂槸鍚︽墸鍒�***************************************************************/ - rules.forEach {r -> - // 璇勫垎鏉$洰 - val rule = r.first - // 鍏蜂綋璇勫垎閫夐」 - val subRule = r.second - subRule.forEach {sr -> - sr.problemlist?.let {pId -> - problemlistMapper.selectByExample(Example(Problemlist::class.java).apply { - createCriteria().andEqualTo("sguid", info.sceneId) - .andEqualTo("ptguid", pId) - .andGreaterThanOrEqualTo("time", info.sTime) - .andLessThan("time", info.eTime) - })?.takeIf { p-> p.isNotEmpty() }?.run { - sr.extension1 = (0 - (sr.maxscore ?: 0)).toString() - } - } - } - var total: Int? = null - subRule.forEach {sr -> - if (!sr.extension1.isNullOrBlank()) { - total = (total ?: 0) + sr.extension1!!.toInt() - } - } - if (total == null) { - rule.extension1 = "0" - } else { - val s = if (abs(total!!) > rule.maxscore!!) { - 0 - rule.maxscore!! - } else { - total - } - rule.extension1 = s.toString() - } - } - /** 2.閮ㄥ垎鏈夌壒娈婅瘎鍒嗛�昏緫鐨勮鍒欒繘琛岃绠�*************************************************************************/ - itemList.forEach { item-> item.execute2(info, rules) } - - /** 3. 琛ュ叏鍚勪笂绾ц瘎鍒嗛」鐨勮鍒�*************************************************************************/ - this.rules.forEach { r -> - val fatherId = r.first.fatherid - for (t in topItems) { - if (t.guid == fatherId) { - var s = t.extension1?.toIntOrNull() ?: 0 - s += r.first.extension1?.toIntOrNull() ?: 0 - // 闄愬埗鏈�楂樻墸鍒� - if (abs(s) > (t.maxscore ?: 0)) { - s = 0 - (t.maxscore ?: 0) - } - t.extension1 = s.toString() - break - } - } - } - - /** 4. 璁$畻鎬诲垎*************************************************************************/ - var total = 0//鎬绘墸闄ょ殑鍒嗘暟 - topItems.forEach top@{ top -> - total += top.extension1?.toIntOrNull() ?: 0 - } - val evaluationList = mutableListOf<Evaluation>() - var evaluationId: String? = null - baseRules.forEach { - val evaluation = Evaluation().apply { - guid = UUIDGenerator.generate16ShortUUID() - iguid = info.userId - stguid = it.guid - scensetypeid = info.sceneType.value.toByte() - ertype = it.ruletype?.toByte() - scensename = period - evaluatorguid = "system" - evaluatorusername = "system" - evaluatorrealname = "2" - resultscorebef = (totalScore - abs(total)).toString() - createdate = Date() - updatedate = Date() - } - if (evaluation.ertype?.toInt() == 1) { - evaluationId = evaluation.guid - } - evaluationList.add(evaluation) - } - //瀛愰」鍏蜂綋寰楀垎 - val itemevaluationList = mutableListOf<Itemevaluation>() - topItems.forEach { subRule -> - val item = newItemEvaluation(info, subRule, evaluationId) - itemevaluationList.add(item) - } - rules.forEach { p -> - if (p.first.ertype != 2) { - val item = newItemEvaluation(info, p.first, evaluationId) - itemevaluationList.add(item) - } - p.second.forEach { r -> - val item1 = newItemEvaluation(info, r, evaluationId) - itemevaluationList.add(item1) - } - } - // 娣诲姞鑷虫枃妗� - addToFile(contents, info, evaluationList, topItems, this.rules) -// val r = evaluationMapper.selectByExample(Example(Evaluation::class.java).apply { -// createCriteria().andEqualTo("scensename", period) -// .andEqualTo("evaluatorguid", "system") -// .andEqualTo("iguid", info.userId) -//// .andEqualTo("ertype", 1) -// }).let { eList -> -// var guid: String? = null -// for (e in eList) { -// if (e.ertype?.toInt() == 1) { -// guid = e.guid -// break -// } -// } -// guid?.let { -// eList.forEach { e -> -// evaluationMapper.delete(e) -// } -// itemevaluationMapper.deleteByExample(Example(Itemevaluation::class.java).apply { -// createCriteria().andEqualTo("sguid", guid) -// }) -// } -// } ?: 0 - // 鍐欏叆鏁版嵁搴� -// if (r > 0) { -// evaluationList.forEach { el -> evaluationMapper.insert(el) } -// itemevaluationList.forEach { il -> itemevaluationMapper.insert(il) } -// for (e in evaluationList) { -// if (e.ertype?.toInt()?.equals(0) == true) { -// finalScore(e, year, eMonth, period) -// break -// } -// } -// } - } + rows.sortBy { it[0] as Int } + contents.addAll(rows) // 鍐欏叆鏂囨。 - val fileName = "${year}骞�${if (_period == 1) "${sMonth}鏈�" else "${sMonth}-${eMonth}鏈�"}${SCENE_TYPE.text}鑷姩璇勫垎-${DateUtil().DateToString(Date(), "yyyy-MM-ddhhmmss")}.xls" -// val filePath = "E:\\宸ヤ綔\\寮�鍙慭\绗笁鏂圭洃绠pp\\鑷姩璇勫垎\\宸ュ湴\\$fileName" - val filePath = "C:\\work\\宸ヤ綔\\绗笁鏂圭洃绠\鑷姩璇勫垎\\${SCENE_TYPE.text}\\$fileName" + val fileName = "${sceneType.text}鑷姩璇勫垎-${DateUtil().DateToString(Date(), "yyyy-MM-ddhhmmss")}.xls" + val filePath = "C:\\work\\宸ヤ綔\\绗笁鏂圭洃绠\鑷姩璇勫垎\\${sceneType.text}\\$fileName" + val file = File(filePath) + if (!file.parentFile.exists()) { + file.parentFile.mkdirs() + } val out = FileOutputStream(File(filePath)) ExcelUtil.write(emptyList(), contents, workbook) workbook.write(out) @@ -358,11 +419,12 @@ private fun getScoreItem() { this.rules.clear() baseRules.clear() + topItems.clear() val rule = evaluationruleMapper.selectByExample(Example(Evaluationrule::class.java).apply { createCriteria() .andEqualTo("tasktypeid", 99) - .andEqualTo("scensetypeid", SCENE_TYPE.value.toByte()) + .andEqualTo("scensetypeid", sceneType.value.toByte()) }) if (rule.isNotEmpty()) { baseRules.addAll(rule) @@ -403,14 +465,14 @@ this.rules.add(Pair(temp, tempSubRules)) } } -// this.totalScore = t + this.totalScore = t } } /** * 鐢熸垚鏂扮殑涓�鏉¤瘎鍒嗚褰� */ - private fun newItemEvaluation(info: Info, itemRule: Evaluationsubrule2, evaluationId: String?) = cn.flightfeather.supervision.domain.ds1.entity.Itemevaluation() + private fun newItemEvaluation(info: Info, itemRule: Evaluationsubrule2, inspection: Inspection?) = Itemevaluation() .apply { var rule: Evaluationrule? = null for (r in baseRules) { @@ -420,8 +482,10 @@ } } ieguid = UUIDGenerator.generate16ShortUUID() - iguid = info.userId - sguid = evaluationId + iguid = inspection?.guid + stguid = info.subTask?.stguid + sguid = info.subTask?.scenseid + sensename = info.subTask?.scensename erguid = rule?.guid rulename = rule?.rulename ruletype = rule?.ruletype?.toInt() @@ -431,41 +495,4 @@ value = itemRule.extension1 ?: "0" extension1 = (itemRule.extension1 != null).toString() } - - private fun addToFile(contents: MutableList<Array<Any>>, info: Info, evaluations: List<Evaluation>, topItems: MutableList<Evaluationsubrule2>, - rules: MutableList<Pair<Evaluationsubrule2, MutableList<Evaluationsubrule2>>>) { - val cList = mutableListOf<Any>() - // FIXME: 2021/4/28 鐢ㄦ埛鍚嶆槸鍚︽坊鍔犺处鍙� -// cList.add("${info.userName}\t${info.userId}") - cList.add("${info.sceneName}") - //姣忎竴椤瑰叿浣撳緱鍒� - topItems.forEach { - for (r in rules) { - if (r.first.fatherid == it.guid || r.first.guid == it.guid) { - // FIXME: 2021/4/25 鍐冲畾鏄惁鍐檋3 - if (hasHead3) { - r.second.forEach {s -> - cList.add(s.extension1 ?: "") - } - } else { - cList.add(r.first.extension1?.toDoubleOrNull() ?: .0) - } - } - } - } - //鎬诲垎鍜岀幆淇$爜 - evaluations.forEach { - if ((it.ertype?.toInt() == 2)) { - cList.add(it.resultscorebef?.toDoubleOrNull() ?: .0) - val code = when (it.resultscorebef?.toIntOrNull() ?: 0) { - 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) - else -> ExcelUtil.MyCell("瓒呭嚭鑼冨洿锛�${it.resultscoreaft}", fontColor = HSSFColor.HSSFColorPredefined.BLACK.index) - } - cList.add(code) - } - } - contents.add(cList.toTypedArray()) - } } \ No newline at end of file -- Gitblit v1.9.3