| | |
| | | * @author riku |
| | | * Date: 2020/8/7 |
| | | */ |
| | | |
| | | @Deprecated("2024.9.25 æ¤èªå¨è¯åèå¼") |
| | | @Component |
| | | class AutoScore2 { |
| | | |
| | |
| | | |
| | | private var problems: ArrayList<ProblemListVo> = ArrayList() |
| | | |
| | | private var allRules: ArrayList<Evaluationsubrule> = ArrayList() |
| | | private var allRules = listOf<Evaluationsubrule2>() |
| | | |
| | | private var inspection = InspectionVo() |
| | | |
| | |
| | | if (evaluationrule === null) return |
| | | this.evaluationrule = evaluationrule |
| | | //è·å对åºçå
·ä½è¯åç»å |
| | | allRules = autoScore.evaluationsubruleService.findByRuleId(evaluationrule.guid!!) as ArrayList<Evaluationsubrule> |
| | | allRules = autoScore.evaluationsubruleService.findByRuleId(evaluationrule.guid!!) |
| | | //è·åå·¡æ¥ä¿¡æ¯ |
| | | inspection = autoScore.inspectionService.findBySubTaskID(subtask.stguid!!) |
| | | |
| | | |
| | | val titleRule = Evaluationsubrule() |
| | | val titleRule = Evaluationsubrule2() |
| | | val titleOptionRange = ArrayList<Int>() |
| | | val titleIsGood = true |
| | | |
| | |
| | | * @param rule å½åè¯å项 |
| | | * @param maxScore ç¶é¡¹çæå¤§å |
| | | */ |
| | | fun autoGeneration(rule: Evaluationsubrule, maxScore: Int): Int? { |
| | | fun autoGeneration(rule: Evaluationsubrule2, maxScore: Int): Int? { |
| | | |
| | | val nextSubRules = getSubRulesByFatherId(allRules, rule.guid) |
| | | //æ å项çæå°è¯å项ï¼ç»åºå¾å |
| | |
| | | } |
| | | |
| | | //å¡«å详ç»è¯å项çåæ° |
| | | fun writeScore4th(rule: Evaluationsubrule, maxScore: Int): Pair<Int, Boolean> { |
| | | fun writeScore4th(rule: Evaluationsubrule2, maxScore: Int): Pair<Int, Boolean> { |
| | | |
| | | problems.forEach { |
| | | if (it.guid != null) { |
| | |
| | | } |
| | | |
| | | //æç
§ç¶idæ¥æ¾åè¯å项 |
| | | fun getSubRulesByFatherId(rules: ArrayList<Evaluationsubrule>, fatherId: String?): List<Evaluationsubrule> { |
| | | val subRules = mutableListOf<Evaluationsubrule>() |
| | | fun getSubRulesByFatherId(rules: List<Evaluationsubrule2>, fatherId: String?): List<Evaluationsubrule2> { |
| | | val subRules = mutableListOf<Evaluationsubrule2>() |
| | | rules.forEach { |
| | | if (it.fatherid == fatherId |
| | | || (fatherId.isNullOrBlank() && it.fatherid.isNullOrBlank())) { |
| | |
| | | } |
| | | |
| | | //å建å项è¯å对象 |
| | | fun createNewChildScore(subRule: Evaluationsubrule, score: Int, isSelected: Boolean): Int? { |
| | | fun createNewChildScore(subRule: Evaluationsubrule2, score: Int, isSelected: Boolean): Int? { |
| | | val itemevaluation = Itemevaluation() |
| | | itemevaluation.ieguid = UUIDGenerator.generate16ShortUUID() |
| | | itemevaluation.iguid = inspection.guid |
| | |
| | | } |
| | | |
| | | //è·åæ»å |
| | | fun getTotalPoint(rules: ArrayList<Evaluationsubrule>, fatherId: String?): Int { |
| | | fun getTotalPoint(rules: List<Evaluationsubrule2>, fatherId: String?): Int { |
| | | val rules1 = getSubRulesByFatherId(rules, fatherId) |
| | | var point = 0 |
| | | rules1.forEach { |
| | |
| | | package cn.flightfeather.supervision.business.autooutput |
| | | |
| | | import cn.flightfeather.supervision.business.Info |
| | | import cn.flightfeather.supervision.business.autooutput.datasource.AopDataSource |
| | | import cn.flightfeather.supervision.domain.ds1.entity.DustDataResult |
| | | import cn.flightfeather.supervision.domain.ds1.entity.Evaluation |
| | |
| | | } |
| | | |
| | | /** |
| | | * å°è¯åè®°å½æ´æ°è³æ°æ®åº |
| | | */ |
| | | fun updateDbEvaluation(evaluationScene: AopDataSource.EvaluationScene, p: Pair<Evaluation, List<Itemevaluation>>) { |
| | | evaluationMapper.updateByPrimaryKey(p.first) |
| | | p.second.forEach { il -> itemevaluationMapper.updateByPrimaryKey(il) } |
| | | } |
| | | |
| | | /** |
| | | * å°çæµæ°æ®ç»è®¡ç»æå
¥åº |
| | | */ |
| | | fun toDbDataResult(dustDataResult: DustDataResult) { |
| | |
| | | // ç管æ»ä»»å¡ |
| | | val task = taskRep.findOneTask(areaVo) ?: throw BizException("å½åæ¥è¯¢æ¡ä»¶ä¸æªæ¾å°å¯¹åºé¡¶å±ä»»å¡") |
| | | // æ»ä»»å¡å
å«å¯¹åºç±»åçåºæ¯ |
| | | val scenes = sceneRep.findScene(task.tguid!!, areaVo.scensetypeid?.toInt(), areaVo.towncode) |
| | | val scenes = sceneRep.findSceneList(task.tguid!!, areaVo.scensetypeid?.toInt(), areaVo.towncode) |
| | | val sceneIds = scenes.map { it?.guid } |
| | | val userIdList = userInfoSVRep.findUser(sceneIds).map { it?.guid } |
| | | // åºæ¯åçæµç¹çå¹é
å
³ç³» |
| | |
| | | if (dustSiteMaps.isEmpty()) return emptyList() |
| | | |
| | | val mnCodeList = dustSiteMaps.map { it?.jaMnCode } |
| | | if (mnCodeList.isEmpty()) return emptyList() |
| | | |
| | | val map = mutableMapOf<String?, MutableList<HourDustData?>>() |
| | | hourDustDataMapper.selectByExample(Example(HourDustData::class.java).apply { |
| | | createCriteria().andBetween("lst", evaluationScene.config?.startTime, evaluationScene.config?.endTime) |
| | |
| | | import cn.flightfeather.supervision.domain.ds2.entity.LedgerSubType |
| | | import cn.flightfeather.supervision.domain.ds2.entity.UserMap |
| | | import cn.flightfeather.supervision.domain.ds2.entity.UserinfoTZ |
| | | import cn.flightfeather.supervision.lightshare.vo.EvaluationSubRuleVo |
| | | import org.springframework.beans.BeanUtils |
| | | import tk.mybatis.mapper.entity.Example |
| | | import java.time.LocalDateTime |
| | | import java.time.ZoneId |
| | |
| | | do { |
| | | callback(i, evaluationScene) |
| | | } while (evaluationScene.gotoNextSubTask()) |
| | | } |
| | | } |
| | | 1 -> { |
| | | userSourceList.forEachIndexed { i, user -> |
| | | evaluationScene.clear() |
| | | evaluationScene.index = i |
| | | evaluationScene.setDefaultUserTZ(user) |
| | | callback(i, evaluationScene) |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ®åä»»å¡åªè½®è¯¢ä¸æ¬¡ |
| | | * 彿°æ®æºæ¯éè¿[setResource]ä¼ å
¥[Subtask]æ¶å³å®æ¶ |
| | | */ |
| | | fun runBySubTask(callback: (index: Int, evaluationScene: EvaluationScene) -> Unit) { |
| | | when (mode) { |
| | | 0 -> { |
| | | sceneSourceList.forEachIndexed { i, scene -> |
| | | evaluationScene.clear() |
| | | evaluationScene.index = i |
| | | evaluationScene.setDefaultScene(scene) |
| | | callback(i, evaluationScene) |
| | | } |
| | | } |
| | | 1 -> { |
| | |
| | | val totalScore = InfoProxy<Int>() |
| | | |
| | | //èªå¨è¯åè§åä¸çº§åç±» |
| | | val topItems = InfoProxy<MutableList<Evaluationsubrule2>>(config?.sceneType.toString()) { _, cacheMap -> |
| | | val _topItems = mutableListOf<Evaluationsubrule2>() |
| | | val _rules = mutableListOf<Pair<Evaluationsubrule2, MutableList<Evaluationsubrule2>>>() |
| | | val topRules = InfoProxy<MutableList<EvaluationSubRuleVo>>(config?.sceneType.toString()) { _, cacheMap -> |
| | | val _topItems = mutableListOf<EvaluationSubRuleVo>() |
| | | val _rules = mutableListOf<Pair<EvaluationSubRuleVo, MutableList<EvaluationSubRuleVo>>>() |
| | | val rule = aopDbMapper.evaluationruleMapper.selectByExample(Example(Evaluationrule::class.java).apply { |
| | | createCriteria() |
| | | .andEqualTo("tasktypeid", 99) |
| | |
| | | val rules = |
| | | aopDbMapper.evaluationsubruleMapper.selectByExample(Example(Evaluationsubrule2::class.java).apply { |
| | | createCriteria().andEqualTo("erguid", ruleId) |
| | | }) |
| | | }).map { |
| | | val vo = EvaluationSubRuleVo() |
| | | BeanUtils.copyProperties(it, vo) |
| | | vo |
| | | } |
| | | rules.forEach { |
| | | if (it.ertype == 2) { |
| | | _topItems.add(it) |
| | |
| | | var t = 0 |
| | | _topItems.forEach { |
| | | t += it.maxscore ?: 0 |
| | | val tempRules = mutableListOf<Evaluationsubrule2>() |
| | | val tempRules = mutableListOf<EvaluationSubRuleVo>() |
| | | for (i in rules) { |
| | | if (i.fatherid == it.guid && i.ertype == 3) { |
| | | tempRules.add(i) |
| | |
| | | } |
| | | tempRules.sortBy { t -> t.displayid } |
| | | tempRules.forEach { temp -> |
| | | val tempSubRules = mutableListOf<Evaluationsubrule2>() |
| | | val tempSubRules = mutableListOf<EvaluationSubRuleVo>() |
| | | for (i in rules) { |
| | | if (i.fatherid == temp.guid && i.ertype == 4) { |
| | | tempSubRules.add(i) |
| | |
| | | |
| | | // FIXME: 2023/8/9 åè§åçè·åå¿
é¡»å¨[topItems]è°ç¨ä¹åï¼å¦å为空 |
| | | //èªå¨è¯åè§åäºçº§åä¸çº§åç±» |
| | | val rules = InfoProxy<MutableList<Pair<Evaluationsubrule2, MutableList<Evaluationsubrule2>>>>() |
| | | val rules = InfoProxy<MutableList<Pair<EvaluationSubRuleVo, MutableList<EvaluationSubRuleVo>>>>() |
| | | |
| | | //å¿
å¡«å°è´¦æ°é |
| | | val ledgerCount = InfoProxy<Int>(config?.sceneType.toString()) {_, cacheMap -> |
| | |
| | | evaluation.clear() |
| | | itemevaluationList.clear() |
| | | totalScore.clear() |
| | | topItems.clear() |
| | | topRules.clear() |
| | | baseRule.clear() |
| | | rules.clear() |
| | | } |
| | |
| | | /** |
| | | * æ§è¡è¯åé»è¾ |
| | | */ |
| | | private fun execute(source: AopDataSource) { |
| | | //è·åæ°æ®æºï¼å¾
è¯ä¼°çåºæ¯ï¼ |
| | | private fun execute(source: AopDataSource, isBySubtask: Boolean = false) { |
| | | // å½éè¦åªé对åè¯å·¡æ¥ä»»å¡è¿è¡è¯ä¼°æ¶ |
| | | if (isBySubtask) { |
| | | source.runBySubTask { index, evaluationScene -> |
| | | if (evaluationScene.noRecord()) return@runBySubTask |
| | | |
| | | itemGrade(index, evaluationScene) |
| | | totalGrade(index, evaluationScene)?.run { |
| | | aopOutput.toDbEvaluation(evaluationScene, this) |
| | | } |
| | | } |
| | | } |
| | | // å½éå¯¹åºæ¯è¿è¡è¯ä¼°æ¶ï¼è¦å
æ¬è¯¥åºæ¯å½æå¯è½åå¨ç夿 ¸å·¡æ¥æ
åµ |
| | | else { |
| | | //循ç¯å¤çæ¯ä¸ªåºæ¯ |
| | | source.loop { index, evaluationScene -> |
| | | if (evaluationScene.noRecord()) return@loop |
| | |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * æ¡ç®æå |
| | | */ |
| | | private fun itemGrade(index: Int, evaluationScene: AopDataSource.EvaluationScene) { |
| | | // è§åæ¡ç®å¾ååå§å |
| | | evaluationScene.topItems.value?.forEach { s -> s.extension1 = null } |
| | | evaluationScene.topRules.value?.forEach { s -> s.clear() } |
| | | evaluationScene.rules.value?.forEach { p -> |
| | | p.first.extension1 = null |
| | | p.second.forEach { e -> e.extension1 = null } |
| | | p.first.clear() |
| | | p.second.forEach { e -> e.clear() } |
| | | } |
| | | |
| | | /** 1. æ ¹æ®è¯åè§å对åºçé®é¢èªå¨å¤ææ¯å¦æ£å***************************************************************/ |
| | |
| | | // åå¨å¤ä¸ªè¯å项ååä¸ä¸ªé®é¢å
³èï¼å æ¤å¿
é¡»å
¨é¨è¯å项é½å¤å®ä¸é |
| | | sr.problemlist?.split(",")?.forEach { pId -> |
| | | if (pList.contains(pId)) { |
| | | sr.extension1 = (0 - (sr.maxscore ?: 0)).toString() |
| | | sr.setMaxScore() |
| | | } |
| | | } |
| | | } |
| | |
| | | /** 2.é¨åæç¹æ®è¯åé»è¾çè§åè¿è¡è®¡ç®*************************************************************************/ |
| | | itemList.forEach { item -> item.execute(evaluationScene) } |
| | | |
| | | /** 3. è¡¥å
¨åä¸çº§è¯å项ç计å*************************************************************************/ |
| | | /** 3. è¡¥å
åä¸çº§è¯å项ç计å*************************************************************************/ |
| | | evaluationScene.rules.value?.forEach { r -> |
| | | val fatherId = r.first.fatherid |
| | | for (t in (evaluationScene.topItems.value ?: emptyList())) { |
| | | for (t in (evaluationScene.topRules.value ?: emptyList())) { |
| | | if (t.guid == fatherId) { |
| | | var s = t.extension1?.toIntOrNull() ?: 0 |
| | | s += r.first.extension1?.toIntOrNull() ?: 0 |
| | | var s = t.score |
| | | s += r.first.score |
| | | // é嶿髿£å |
| | | if (abs(s) > (t.maxscore ?: 0)) { |
| | | s = 0 - (t.maxscore ?: 0) |
| | | } |
| | | t.extension1 = s.toString() |
| | | // if (abs(s) > (t.maxscore ?: 0)) { |
| | | //// s = 0 - (t.maxscore ?: 0) |
| | | // t.setMaxScore() |
| | | // } else { |
| | | // t.score = s |
| | | // } |
| | | t.score = s |
| | | break |
| | | } |
| | | } |
| | |
| | | evaluationScene: AopDataSource.EvaluationScene, |
| | | ): Pair<Evaluation, List<Itemevaluation>>? { |
| | | val scene = evaluationScene.scene.value ?: return null |
| | | val topItems = evaluationScene.topItems.value ?: return null |
| | | val topItems = evaluationScene.topRules.value ?: return null |
| | | val rules = evaluationScene.rules.value ?: return null |
| | | val subTask = evaluationScene.subTask.value |
| | | val inspection = evaluationScene.inspection.value |
| | | val totalScore = evaluationScene.totalScore.value ?: return null |
| | | |
| | | var total = 0//æ»æ£é¤çåæ° |
| | | evaluationScene.topItems.value?.forEach top@{ top -> |
| | | total += top.extension1?.toIntOrNull() ?: 0 |
| | | evaluationScene.topRules.value?.forEach top@{ top -> |
| | | total += top.score |
| | | } |
| | | val evaluation = Evaluation().apply { |
| | | evaluationScene.baseRule.value?.let { |
| | |
| | | package cn.flightfeather.supervision.business.autooutput.score |
| | | |
| | | import cn.flightfeather.supervision.business.autooutput.datasource.AopDataSource |
| | | import cn.flightfeather.supervision.common.utils.DateUtil |
| | | import cn.flightfeather.supervision.domain.ds1.entity.Evaluationsubrule2 |
| | | import cn.flightfeather.supervision.domain.ds1.entity.Problemlist |
| | | import cn.flightfeather.supervision.domain.ds1.mapper.ProblemlistMapper |
| | | import cn.flightfeather.supervision.lightshare.vo.EvaluationSubRuleVo |
| | | import org.springframework.beans.factory.annotation.Autowired |
| | | import tk.mybatis.mapper.entity.Example |
| | | import kotlin.math.abs |
| | | |
| | | /** |
| | | * èªå¨è¯åæ¡ç® |
| | |
| | | |
| | | lateinit var evaluationScene: AopDataSource.EvaluationScene |
| | | |
| | | private var rulePair: Pair<Evaluationsubrule2, MutableList<Evaluationsubrule2>>? = null |
| | | private var rulePair: Pair<EvaluationSubRuleVo, MutableList<EvaluationSubRuleVo>>? = null |
| | | |
| | | @Autowired |
| | | lateinit var problemlistMapper: ProblemlistMapper |
| | |
| | | fun execute(evaluationScene: AopDataSource.EvaluationScene) { |
| | | this.evaluationScene = evaluationScene |
| | | if (!exemption && !evaluationScene.noRecord()) { |
| | | val a = evaluationScene.topRules.value |
| | | getRule(evaluationScene.rules.value) |
| | | calScore() |
| | | } |
| | |
| | | /** |
| | | * è·åè¯åè§å |
| | | */ |
| | | private fun getRule(eList: MutableList<Pair<Evaluationsubrule2, MutableList<Evaluationsubrule2>>>?) { |
| | | private fun getRule(eList: MutableList<Pair<EvaluationSubRuleVo, MutableList<EvaluationSubRuleVo>>>?) { |
| | | if (eList == null) return |
| | | for (e in eList) { |
| | | if (e.first.guid == id) { |
| | |
| | | } |
| | | |
| | | otherProblem(rulePair?.second!!.size)?.let { it.forEach {i -> |
| | | rulePair?.second!![i].getScore() |
| | | rulePair?.second!![i].setMaxScore() |
| | | } } |
| | | |
| | | ScoreUtil.subRuleCal(rulePair) |
| | | } |
| | | |
| | | /** |
| | | * å忍¡å¼ä¸ï¼è®¡ç®å
·ä½é项çå¾å |
| | | */ |
| | | fun Evaluationsubrule2.getScore() { |
| | | extension1 = (0 - (maxscore ?: 0)).toString() |
| | | } |
| | | } |
| | |
| | | package cn.flightfeather.supervision.business.autooutput.score |
| | | |
| | | import cn.flightfeather.supervision.business.Info |
| | | import cn.flightfeather.supervision.business.autooutput.datasource.AopDataSource |
| | | import cn.flightfeather.supervision.common.utils.ExcelUtil |
| | | import cn.flightfeather.supervision.common.utils.UUIDGenerator |
| | | import cn.flightfeather.supervision.domain.ds1.entity.Evaluationrule |
| | | import cn.flightfeather.supervision.domain.ds1.entity.Evaluationsubrule2 |
| | | import cn.flightfeather.supervision.domain.ds1.entity.Inspection |
| | | import cn.flightfeather.supervision.domain.ds1.entity.Evaluation |
| | | import cn.flightfeather.supervision.lightshare.vo.EvaluationSubRuleVo |
| | | import cn.flightfeather.supervision.domain.ds1.entity.Itemevaluation |
| | | import org.apache.poi.hssf.util.HSSFColor |
| | | import kotlin.math.abs |
| | | import cn.flightfeather.supervision.lightshare.vo.EvaluationVo |
| | | import cn.flightfeather.supervision.lightshare.vo.ItemEvaluationVo |
| | | import java.util.* |
| | | |
| | | /** |
| | | * å¾å计ç®å·¥å
· |
| | | * è¯åè¡¨æ ¼å为ä¸ä¸ªå±çº§ |
| | | * 第ä¸å±ä¸ºå¤§åç±»ï¼ç¬¬äºå±ä¸ºè¯ä¼°æ åï¼ç¬¬ä¸å±ä¸ºæ å对åºçä¸åç¨åº¦çè¯ä¼°ç»æ |
| | | */ |
| | | // FIXME: 2024/9/23 ç®åææç
§ä¸å±è¯ä¼°è§åè¿è¡è¯ä¼°ï¼åç»åºè¯¥ä¼å为ä¸é屿° |
| | | object ScoreUtil { |
| | | |
| | | /** |
| | | * è®¡ç®æä¸å
·ä½è¯åæ åçå¾å |
| | | * é对å忍¡å¼ |
| | | * æ ¹æ®æéææ·±å±è¯ä¼°é项ï¼ç»è§åèµå¼å¯¹åºåæ°åèªå¨è®¡ç®å
¶ä½æææ¡ç®å¾å |
| | | * @param evaluationScene éè¦è¯ä¼°ç对象 |
| | | * @param selected è¯ä¼°è¡¨ä¸éä¸çè¯ä¼°æ¡ç®ä¸»é®idéåï¼å¿
é¡»æ¯ææ·±ä¸å±çè¯ä¼°æ¡ç®ï¼ |
| | | */ |
| | | fun subRuleCal(rulePair: Pair<Evaluationsubrule2, MutableList<Evaluationsubrule2>>?) { |
| | | fun scoreAssign(evaluationScene: AopDataSource.EvaluationScene, selected: List<String>) { |
| | | val topRules = evaluationScene.topRules.value |
| | | val subRules = evaluationScene.rules.value |
| | | subRules?.forEach { r -> |
| | | // æ ¹æ®ä¼ å
¥çéä¸è¯ä¼°æ¡ç®ä¸»é®idï¼ä¿®æ¹å
¶å¾å |
| | | r.second.forEach { e -> |
| | | if (selected.contains(e.guid)) { |
| | | e.setMaxScore() |
| | | } |
| | | } |
| | | // æ ¹æ®å项çéæ©æ
åµï¼èªå¨è®¡ç®è¯¥æ¡è¯ä¼°çæ»å¾å |
| | | subRuleCal(r) |
| | | |
| | | // è¡¥å
åæä¸çº§è¯å项ç计å |
| | | val fatherId = r.first.fatherid |
| | | for (t in (evaluationScene.topRules.value ?: emptyList())) { |
| | | if (t.guid == fatherId) { |
| | | t.score += r.first.score |
| | | break |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * è®¡ç®æä¸å
·ä½è¯åæ åçå¾åï¼å¹¶ä¸æ ¹æ®é项ååæ°ä¸éè®¡ç®æç»å¾å |
| | | * @param rulePair äºçº§åä¸çº§è¯åè§åç对åºç»æ |
| | | */ |
| | | fun subRuleCal(rulePair: Pair<EvaluationSubRuleVo, MutableList<EvaluationSubRuleVo>>?) { |
| | | val rule = rulePair?.first |
| | | val itemList = rulePair?.second |
| | | var total: Int? = null |
| | | var total = 0 |
| | | itemList?.forEach { |
| | | if (!it.extension1.isNullOrBlank()) { |
| | | total = (total ?: 0) + it.extension1!!.toInt() |
| | | total += it.score |
| | | } |
| | | // val s = if (abs(total) > rule?.maxscore!!) { |
| | | // when (rule.extension2) { |
| | | // // å忍¡å¼ï¼è®°å½ä¸ºæ£åï¼è´æ°ï¼ |
| | | // Constant.EvaGradeMode.MINUS_MODE.value -> { |
| | | // 0 - rule.maxscore!! |
| | | // } |
| | | // // å 忍¡å¼ï¼è®°å½ä¸ºå¾åï¼æ£æ°ï¼ |
| | | // Constant.EvaGradeMode.ADD_MODE.value -> { |
| | | // rule.maxscore!! |
| | | // } |
| | | // // é»è®¤å忍¡å¼ |
| | | // else -> { |
| | | // 0 - rule.maxscore!! |
| | | // } |
| | | // } |
| | | // } else { |
| | | // total |
| | | // } |
| | | // rule.score = s |
| | | rule?.score = total |
| | | } |
| | | |
| | | /** |
| | | * çæè¯ä¼°è®°å½ç»æ |
| | | * @param evaluationScene éè¦è¯ä¼°ç对象 |
| | | * @return è¯ä¼°æ»åå对åºç»åå¾åçæ°æ®åºç»æ |
| | | */ |
| | | fun genEvaRecord(evaluationScene: AopDataSource.EvaluationScene): Pair<Evaluation, List<Itemevaluation>>? { |
| | | val scene = evaluationScene.scene.value ?: return null |
| | | val topRules = evaluationScene.topRules.value ?: return null |
| | | val baseRule = evaluationScene.baseRule.value |
| | | val rules = evaluationScene.rules.value ?: return null |
| | | val subTask = evaluationScene.subTask.value |
| | | val inspection = evaluationScene.inspection.value |
| | | |
| | | var total = 0 //æ»å¾å |
| | | topRules.forEach top@{ top -> |
| | | total += top.getFinalScore() |
| | | } |
| | | val evaluation = EvaluationVo.newAutoEvaluation(inspection, subTask, scene, baseRule, total) |
| | | //å项å
·ä½å¾å |
| | | val itemList = mutableListOf<Itemevaluation>() |
| | | topRules.forEach { subRule -> |
| | | val item = ItemEvaluationVo.newItemEvaluation(baseRule, subTask, inspection, subRule) |
| | | itemList.add(item) |
| | | } |
| | | rules.forEach { p -> |
| | | if (p.first.ertype != 2) { |
| | | val item = ItemEvaluationVo.newItemEvaluation(baseRule, subTask, inspection, p.first) |
| | | itemList.add(item) |
| | | } |
| | | p.second.forEach { r -> |
| | | val item1 = ItemEvaluationVo.newItemEvaluation(baseRule, subTask, inspection, r) |
| | | itemList.add(item1) |
| | | } |
| | | } |
| | | if (total == null) { |
| | | rule?.extension1 = "0" |
| | | } else { |
| | | val s = if (abs(total!!) > rule?.maxscore!!) { |
| | | 0 - rule.maxscore!! |
| | | } else { |
| | | total |
| | | return Pair(evaluation, itemList) |
| | | } |
| | | rule.extension1 = s.toString() |
| | | |
| | | /** |
| | | * æ´æ°è¯ä¼°è®°å½ç»æ |
| | | * @param evaluationScene éè¦è¯ä¼°ç对象 |
| | | * @return è¯ä¼°æ»åå对åºç»åå¾åçæ°æ®åºç»æ |
| | | */ |
| | | fun updateEvaRecord(evaluationScene: AopDataSource.EvaluationScene): Pair<Evaluation, List<Itemevaluation>>? { |
| | | val topRules = evaluationScene.topRules.value ?: return null |
| | | val rules = evaluationScene.rules.value ?: return null |
| | | |
| | | val evaluation = evaluationScene.evaluation.value ?: return null |
| | | val itemevaluationList = evaluationScene.itemevaluationList.value ?: return null |
| | | |
| | | var total = 0 //æ»å¾å |
| | | topRules.forEach top@{ top -> |
| | | total += top.getFinalScore() |
| | | } |
| | | evaluation.apply { |
| | | resultscorebef = total.toString() |
| | | updatedate = Date() |
| | | } |
| | | //å项å
·ä½å¾å |
| | | topRules.forEach { subRule -> |
| | | itemevaluationList.find { it.esrguid == subRule.guid }?.let { |
| | | it.value = subRule.score.toString() |
| | | it.extension1 = subRule.selected.toString() |
| | | } |
| | | } |
| | | rules.forEach { p -> |
| | | // å¯è½åå¨ç¬¬ä¸å±çº§ä¸å±ç´æ¥ä¸ºç¬¬ä¸å±çº§çæ
åµ |
| | | if (p.first.ertype != 2) { |
| | | itemevaluationList.find { it.esrguid == p.first.guid }?.let { |
| | | it.value = p.first.score.toString() |
| | | it.extension1 = p.first.selected.toString() |
| | | } |
| | | } |
| | | p.second.forEach { r -> |
| | | itemevaluationList.find { it.esrguid == r.guid }?.let { |
| | | it.value = r.score.toString() |
| | | it.extension1 = r.selected.toString() |
| | | } |
| | | } |
| | | } |
| | | return Pair(evaluation, itemevaluationList) |
| | | } |
| | | |
| | | /** |
| | | * çææ°ç䏿¡è¯åè®°å½ |
| | | */ |
| | | fun newItemEvaluation(evaluationScene: AopDataSource.EvaluationScene, itemRule: Evaluationsubrule2) = |
| | | fun newItemEvaluation(evaluationScene: AopDataSource.EvaluationScene, itemRule: EvaluationSubRuleVo) = |
| | | Itemevaluation().apply { |
| | | val rule = evaluationScene.baseRule.value |
| | | val subTask = evaluationScene.subTask.value |
| | |
| | | ertype = itemRule.ertype |
| | | esrguid = itemRule.guid |
| | | name = itemRule.itemname |
| | | value = itemRule.extension1 ?: "0" |
| | | extension1 = (itemRule.extension1 != null).toString() |
| | | value = itemRule.score.toString() |
| | | extension1 = itemRule.selected.toString() |
| | | } |
| | | |
| | | /** |
| | |
| | | |
| | | import cn.flightfeather.supervision.business.autooutput.dataanalysis.XHFuDataAnalysis |
| | | import cn.flightfeather.supervision.business.autooutput.score.ScoreItem |
| | | import cn.flightfeather.supervision.domain.ds1.entity.DustDataResult |
| | | import cn.flightfeather.supervision.domain.ds1.entity.Evaluationsubrule2 |
| | | import cn.flightfeather.supervision.domain.ds1.mapper.DustDataResultMapper |
| | | import cn.flightfeather.supervision.domain.ds3.entity.FumeDailyAnalysis |
| | | import cn.flightfeather.supervision.domain.ds3.entity.FumeExceptionData |
| | | import cn.flightfeather.supervision.domain.ds3.mapper.FumeDailyAnalysisMapper |
| | | 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 java.util.* |
| | |
| | | package cn.flightfeather.supervision.business.autooutput.score.restaurant |
| | | |
| | | import cn.flightfeather.supervision.business.autooutput.score.ScoreItem |
| | | import cn.flightfeather.supervision.domain.ds1.entity.Evaluationsubrule |
| | | import cn.flightfeather.supervision.domain.ds1.entity.Evaluationsubrule2 |
| | | import cn.flightfeather.supervision.domain.ds2.entity.LedgerRecord |
| | | import cn.flightfeather.supervision.domain.ds2.entity.LedgerSubType |
| | | import cn.flightfeather.supervision.domain.ds2.mapper.LedgerRecordMapper |
| | |
| | | import tk.mybatis.mapper.entity.Example |
| | | import java.time.LocalDateTime |
| | | import java.time.ZoneId |
| | | import javax.annotation.PostConstruct |
| | | |
| | | @Deprecated(level = DeprecationLevel.HIDDEN, message = "å°è´¦çè¯ä¼°éè¿å·¡æ¥é®é¢èªå¨å¯¹åº") |
| | | @Component |
| | |
| | | } |
| | | } |
| | | |
| | | // å¤åªä½æä»¶ |
| | | enum class MediaFileType(val value: Int, val des: String){ |
| | | Problem(1, "é®é¢"), |
| | | TechnicalPrevention(2, "æé²æªæ½"), |
| | | |
| | | MonitorDevice(3, "çæµè®¾å¤"), |
| | | TreatmentDevice(4, "æ²»ç设å¤"), |
| | | |
| | | RoutineRecord(5, "常è§è®°å½"), |
| | | Signature(6, "ç¾å"), |
| | | Nameplate(7, "éç"), |
| | | |
| | | TYPE_1(51, "æ©å±ç±»ä¸"), |
| | | TYPE_2(52, "æ©å±ç±»äº"), |
| | | TYPE_3(53, "æ©å±ç±»ä¸"), |
| | | TYPE_4(54, "æ©å±ç±»å"), |
| | | TYPE_5(55, "æ©å±ç±»äº"), |
| | | TYPE_6(56, "æ©å±ç±»å
"), |
| | | TYPE_7(57, "æ©å±ç±»ä¸"), |
| | | TYPE_8(58, "æ©å±ç±»å
«"), |
| | | TYPE_9(59, "æ©å±ç±»ä¹"), |
| | | TYPE_10(60, "æ©å±ç±»å"); |
| | | |
| | | companion object { |
| | | fun getList(sceneTypeId: Byte?): List<MediaFileType> { |
| | | val type = SceneType.getByValue(sceneTypeId?.toString()) |
| | | return getList(type) |
| | | } |
| | | fun getList(sceneType: SceneType) = when (sceneType) { |
| | | SceneType.TYPE5 -> listOf(RoutineRecord, TYPE_1, TYPE_2, TYPE_3, TYPE_4, TYPE_5, |
| | | TYPE_6, TYPE_7, TYPE_8, TYPE_9, TYPE_10) |
| | | else -> listOf(RoutineRecord, MonitorDevice, Nameplate) |
| | | } |
| | | } |
| | | } |
| | | |
| | | // è¯åæ¡ç®ç±»å |
| | | enum class EvaScoreMode(val value: String, val des: String){ |
| | | BASIC_SCORE("basic_score", "åºç¡å"), |
| | | ADDITION_SCORE("addition_score", "éå å"), |
| | | } |
| | | |
| | | // å¾åæ¨¡å¼ |
| | | enum class EvaGradeMode(val value: String, val des: String){ |
| | | MINUS_MODE("minus_mode", "å忍¡å¼"), |
| | | ADD_MODE("add_mode", "å 忍¡å¼"), |
| | | } |
| | | |
| | | // è¯ä¼°éæ©æ¨¡å¼ |
| | | enum class EvaSelectMode(val value: String, val des: String){ |
| | | SINGLE_MODE("single_mode", "å鿍¡å¼"), |
| | | MULTI_MODE("multi_mode", "å¤é模å¼"), |
| | | } |
| | | |
| | | |
| | | companion object { |
| | | //é®é¢å®¡æ ¸ |
| | |
| | | |
| | | @Table(name = "ea_t_evaluation") |
| | | @JsonInclude(JsonInclude.Include.NON_NULL) |
| | | public class Evaluation { |
| | | open class Evaluation { |
| | | @Id |
| | | @Column(name = "E_GUID") |
| | | var guid: String? = null |
| | |
| | | /** |
| | | * @date 2024.4.25 |
| | | * ç¨äºææ¶æ¿ä»£[Evaluationsubrule]çç±» |
| | | * å ä¸ºåæ°[Evaluationsubrule.ertype]被é误ç设å®ä¸º[Boolean]ç±»åï¼å®é
åºä¸º[Int]ç±»åï¼ |
| | | * å ä¸ºåæ°[Evaluationsubrule.ertype]被é误ç设å®ä¸º[Boolean]ç±»åï¼å®é
[ertype]åºä¸º[Int]ç±»åï¼ |
| | | * ç®å主è¦å½±åäºå®åAPPç¨åºï¼å°APPç¨åºå¯¹åºåæ°è°æ´åæ¬ç±»å¯å®å
¨æ¿æ¢[Evaluationsubrule] |
| | | */ |
| | | @Table(name = "sm_t_evaluationsubrule") |
| | | @JsonInclude(JsonInclude.Include.NON_NULL) |
| | | public class Evaluationsubrule2 { |
| | | open class Evaluationsubrule2 { |
| | | @Id |
| | | @Column(name = "ESR_GUID") |
| | | var guid: String? = null |
| | |
| | | @Column(name = "ESR_UpdateDate") |
| | | var updatedate: Date? = null |
| | | |
| | | /** |
| | | * è§åç±»å |
| | | * basic_score: åºç¡åï¼å¿
é |
| | | * addition_score: éå åï¼å¯é |
| | | */ |
| | | @Column(name = "ESR_Extension1") |
| | | var extension1: String? = null |
| | | |
| | | /** |
| | | * è¯åæ¨¡å¼ |
| | | * minus_mode: å忍¡å¼ |
| | | * add_mode: å 忍¡å¼ |
| | | * null: 说æè¯¥æ¡è¯ä¼°è§åå·²ç»æ¯æå
·ä½çæ¡ç®ï¼æ²¡æå项 |
| | | */ |
| | | @Column(name = "ESR_Extension2") |
| | | var extension2: String? = null |
| | | |
| | | /** |
| | | * éæ©æ¨¡å¼ |
| | | * single_mode: å鿍¡å¼ |
| | | * multi_mode: å¤éæ¨¡å¼ |
| | | * null: 说æè¯¥æ¡è¯ä¼°è§åå·²ç»æ¯æå
·ä½çæ¡ç®ï¼æ²¡æå项 |
| | | */ |
| | | @Column(name = "ESR_Extension3") |
| | | var extension3: String? = null |
| | | |
| | |
| | | |
| | | @Table(name = "ea_t_itemevaluation") |
| | | @JsonInclude(JsonInclude.Include.NON_NULL) |
| | | public class Itemevaluation { |
| | | open class Itemevaluation { |
| | | @Id |
| | | @Column(name = "IE_GUID") |
| | | var ieguid: String? = null |
| | |
| | | import org.apache.ibatis.annotations.Mapper |
| | | |
| | | @Mapper |
| | | interface SceneDeviceMapper : MyMapper<SceneDevice> |
| | | interface SceneDeviceMapper : MyMapper<SceneDevice?> |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.flightfeather.supervision.domain.ds1.repository |
| | | |
| | | import cn.flightfeather.supervision.domain.ds1.entity.Inspection |
| | | import cn.flightfeather.supervision.domain.ds1.mapper.InspectionMapper |
| | | import org.springframework.stereotype.Repository |
| | | |
| | | /** |
| | | * å·¡æ¥è®°å½æ°æ®åºæä½ |
| | | * @date 2024/9/12 |
| | | * @author feiyu02 |
| | | */ |
| | | @Repository |
| | | class InspectionRep(private val inspectionMapper: InspectionMapper) { |
| | | |
| | | fun findOne(primaryKey: String): Inspection? { |
| | | return inspectionMapper.selectByPrimaryKey(primaryKey) |
| | | } |
| | | |
| | | fun findOne(inspection: Inspection): Inspection? { |
| | | return inspectionMapper.selectOne(inspection) |
| | | } |
| | | } |
| | |
| | | package cn.flightfeather.supervision.domain.ds1.repository |
| | | |
| | | import cn.flightfeather.supervision.common.utils.Constant |
| | | import cn.flightfeather.supervision.domain.ds1.entity.Mediafile |
| | | import cn.flightfeather.supervision.domain.ds1.mapper.MediafileMapper |
| | | import org.springframework.beans.factory.annotation.Value |
| | | import org.springframework.stereotype.Repository |
| | | import tk.mybatis.mapper.entity.Example |
| | | import java.io.File |
| | | |
| | | /** |
| | | * å¤åªä½æä»¶æ°æ®åºæä½ |
| | |
| | | @Repository |
| | | class MediaFileRep(private val mediaFileMapper: MediafileMapper, @Value("\${imgPath}") var imgPath: String,) { |
| | | |
| | | /** |
| | | * æ ¹æ®ä¸»é®å é¤ |
| | | */ |
| | | fun deleteOne(guid: String?): Int { |
| | | return mediaFileMapper.deleteByPrimaryKey(guid) |
| | | } |
| | | |
| | | fun findList(idList: List<String>): List<Mediafile?> { |
| | | /** |
| | | * æ ¹æ®ä¸»é®æ¥è¯¢ |
| | | */ |
| | | fun findList(primaryKeyList: List<String>): List<Mediafile?> { |
| | | return mediaFileMapper.selectByExample(Example(Mediafile::class.java).apply { |
| | | createCriteria().andIn("guid", idList) |
| | | createCriteria().andIn("guid", primaryKeyList) |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * æ ¹æ®å·¡æ¥è®°å½åæä»¶ä¸å¡ç±»åæ¥è¯¢ |
| | | */ |
| | | fun findList(iGuid: String?, typeList: List<Int>): List<Mediafile?> { |
| | | return mediaFileMapper.selectByExample(Example(Mediafile::class.java).apply { |
| | | createCriteria().andEqualTo("iguid", iGuid) |
| | | .andIn("businesstypeid", typeList) |
| | | }) |
| | | } |
| | | } |
| | |
| | | @Repository |
| | | class ProblemRep(private val problemlistMapper: ProblemlistMapper) { |
| | | |
| | | |
| | | fun insert(problemlist: Problemlist): Int { |
| | | return problemlistMapper.insert(problemlist) |
| | | } |
| | | |
| | | fun update(problemlist: Problemlist): Int { |
| | | return problemlistMapper.updateByPrimaryKey(problemlist) |
| | | } |
| | | |
| | | /** |
| | | * è·åååºæ¯çé®é¢åæ´æ¹æ°éç»è®¡ |
| | | */ |
| | |
| | | return scenseMapper.insertSelective(scene) |
| | | } |
| | | |
| | | /** |
| | | * æ¥æ¾åºæ¯ |
| | | */ |
| | | fun findScene(topTaskId: String, sceneTypeId: Int? = null, townCode: String? = null): List<Scense?> { |
| | | return scenseMapper.getSceneByType(topTaskId, sceneTypeId, townCode) |
| | | } |
| | | |
| | | fun findScene(userId: String?): Scense? { |
| | | val user = userinfoMapper.selectByPrimaryKey(userId) ?: throw BizException("ç¨æ·idä¸åå¨") |
| | | return scenseMapper.selectByPrimaryKey(user.dGuid) |
| | |
| | | }) |
| | | } |
| | | |
| | | fun findScenes(nameList: List<String?>): List<Scense?> { |
| | | fun findSceneList(nameList: List<String?>): List<Scense?> { |
| | | return scenseMapper.selectByExample(Example(Scense::class.java).apply { |
| | | createCriteria().andIn("name", nameList) |
| | | }) |
| | | } |
| | | |
| | | /** |
| | | * æ¥æ¾åºæ¯ |
| | | */ |
| | | fun findSceneList(topTaskId: String, sceneTypeId: Int? = null, townCode: String? = null): List<Scense?> { |
| | | return scenseMapper.getSceneByType(topTaskId, sceneTypeId, townCode) |
| | | } |
| | | |
| | | fun findBySubTask(subTaskId: String): Scense? { |
| | | val subtask = subTaskRep.findOne(subTaskId) |
| | | return scenseMapper.selectByPrimaryKey(subtask?.scenseid) |
| | |
| | | return subtaskMapper.updateByPrimaryKey(subtask) |
| | | } |
| | | |
| | | fun findOne(id:String): Subtask? { |
| | | return subtaskMapper.selectByPrimaryKey(id) |
| | | fun findOne(primaryKey:String): Subtask? { |
| | | return subtaskMapper.selectByPrimaryKey(primaryKey) |
| | | } |
| | | |
| | | fun findAll(subtask: Subtask): List<Subtask?> { |
| | |
| | | * æ¥æ¾ç¨æ· |
| | | */ |
| | | fun findUser(sceneIdList: List<String?>): List<Userinfo?> { |
| | | if (sceneIdList.isEmpty()) return emptyList() |
| | | return userinfoMapper.selectByExample(Example(Userinfo::class.java).apply { |
| | | createCriteria().andIn("dGuid", sceneIdList) |
| | | }) |
| | |
| | | package cn.flightfeather.supervision.lightshare.service |
| | | |
| | | import cn.flightfeather.supervision.domain.ds1.entity.Evaluationsubrule |
| | | import cn.flightfeather.supervision.lightshare.vo.EvaluationVo |
| | | import cn.flightfeather.supervision.domain.ds1.entity.Evaluationsubrule2 |
| | | import cn.flightfeather.supervision.lightshare.vo.ScoreDetail |
| | | |
| | | |
| | | interface EvaluationsubruleService { |
| | |
| | | |
| | | fun delete(id:String): Int |
| | | |
| | | fun findByRuleId(erguid: String): List<Evaluationsubrule> |
| | | fun findByRuleId(erguid: String): List<Evaluationsubrule2> |
| | | |
| | | fun search(districtCode: String, sceneTypeId: String, version: String? = null): List<Evaluationsubrule> |
| | | |
| | | fun getAutoScore(subTaskId: String): List<EvaluationVo> |
| | | fun getAutoScore(subTaskId: String): ScoreDetail |
| | | |
| | | } |
| | |
| | | package cn.flightfeather.supervision.lightshare.service |
| | | |
| | | import cn.flightfeather.supervision.domain.ds1.entity.Itemevaluation |
| | | import cn.flightfeather.supervision.lightshare.vo.ItemevaluationVo |
| | | import cn.flightfeather.supervision.lightshare.vo.ItemEvaluationVo |
| | | |
| | | |
| | | interface ItemevaluationService { |
| | |
| | | |
| | | fun delete(id: String): Int |
| | | |
| | | fun findBySubTaskID(subTaskID: String): List<ItemevaluationVo> |
| | | fun findBySubTaskID(subTaskID: String): List<ItemEvaluationVo> |
| | | |
| | | fun savelist(itemevaluationlist: List<Itemevaluation>): Int |
| | | |
| | | /** |
| | | * æ°å¢ä¸ä¸ªå·¡æ¥ä»»å¡ç对åºè¯å |
| | | * @param subTaskId å·¡æ¥ä»»å¡id |
| | | * @param ruleId 使ç¨çè¯ä¼°è§åid |
| | | */ |
| | | fun createItemEvaluation(subTaskId: String, ruleId: String?, itemList: List<String>): Boolean |
| | | |
| | | fun updateItemEvaluation(subTaskId: String, ruleId: String?, itemList: List<String>): Boolean |
| | | } |
| | |
| | | |
| | | fun save(mediafile: Mediafile): Int |
| | | |
| | | /** |
| | | * ä¿åå¾ç |
| | | */ |
| | | fun saveMediaFile(files: Array<MultipartFile>, getMediaFile: () -> Mediafile): Int |
| | | |
| | | fun update(mediafile: Mediafile): Int |
| | | |
| | | fun delete(id: String): Int |
| | |
| | | fun findByProblemID(id: String): List<MediaFileVo> |
| | | |
| | | fun findBysubtaskbtid(id: String, btid: String): MutableList<Mediafile>? |
| | | |
| | | fun getRoutineRecord(iGuid: String?, stGuid: String?): List<Mediafile?> |
| | | } |
| | |
| | | package cn.flightfeather.supervision.lightshare.service |
| | | |
| | | import cn.flightfeather.supervision.domain.ds1.entity.Inspection |
| | | import cn.flightfeather.supervision.domain.ds1.entity.Problemlist |
| | | import cn.flightfeather.supervision.domain.ds1.entity.Scense |
| | | import cn.flightfeather.supervision.domain.ds1.entity.Subtask |
| | | import cn.flightfeather.supervision.domain.ds1.entity.* |
| | | import cn.flightfeather.supervision.lightshare.vo.* |
| | | import org.springframework.web.multipart.MultipartFile |
| | | |
| | |
| | | |
| | | fun updateProblem(problem: ProblemListVo, deleteImg: List<String>, files: Array<MultipartFile>): String |
| | | |
| | | /** |
| | | * ä¿åé®é¢å¾ç |
| | | */ |
| | | fun saveProFile( |
| | | problemlist: Problemlist, inspection: Inspection, |
| | | scene: Scense, files: Array<MultipartFile>, |
| | | ): Int |
| | | |
| | | fun changeProblem(problemId: String, files: Array<MultipartFile>): BaseResponse<String> |
| | | |
| | | /** |
| | | * æ´æ°æ´æ¹ |
| | | */ |
| | | fun updateChange(problemId: String, deleteImg: List<String>, files: Array<MultipartFile>): String |
| | | |
| | | fun getBySubTask(stGuid: String, all:Boolean?): List<ProblemListVo> |
| | | |
| | | fun getSceneByProType(areaVo: AreaVo, pType:String):List<Subtask?> |
| | |
| | | //以é£ç¾½ç管系ç»ä¸çç¨æ·ä¸ºä¸»ä½ |
| | | 2 -> { |
| | | val task = taskRep.findOneTask(areaVo) ?: throw BizException("å½åæ¥è¯¢æ¡ä»¶ä¸æªæ¾å°å¯¹åºé¡¶å±ä»»å¡") |
| | | val scenes = sceneRep.findScene(task.tguid!!, areaVo.scensetypeid?.toInt(), areaVo.towncode) |
| | | val scenes = sceneRep.findSceneList(task.tguid!!, areaVo.scensetypeid?.toInt(), areaVo.towncode) |
| | | .map { it?.guid } |
| | | val idList = userInfoSVRep.findUser(scenes).map { it?.guid } |
| | | userMapRep.findBySVUserId(idList).map { it?.tzUserId } |
| | |
| | | package cn.flightfeather.supervision.lightshare.service.impl |
| | | |
| | | import cn.flightfeather.supervision.common.exception.BizException |
| | | import cn.flightfeather.supervision.domain.ds1.entity.* |
| | | import cn.flightfeather.supervision.domain.ds1.entity.Evaluationrule |
| | | import cn.flightfeather.supervision.domain.ds1.entity.Evaluationsubrule |
| | | import cn.flightfeather.supervision.domain.ds1.entity.Evaluationsubrule2 |
| | | import cn.flightfeather.supervision.domain.ds1.mapper.EvaluationruleMapper |
| | | import cn.flightfeather.supervision.domain.ds1.mapper.EvaluationsubruleMapper |
| | | import cn.flightfeather.supervision.domain.ds1.repository.EvaluationRep |
| | | import cn.flightfeather.supervision.domain.ds1.repository.EvaluationRuleRep |
| | | import cn.flightfeather.supervision.domain.ds1.repository.SceneRep |
| | | import cn.flightfeather.supervision.lightshare.service.EvaluationsubruleService |
| | | import cn.flightfeather.supervision.lightshare.vo.EvaluationVo |
| | | import cn.flightfeather.supervision.lightshare.vo.SubEvaluationVo |
| | | import cn.flightfeather.supervision.lightshare.vo.ThirdEvaluationVo |
| | | import cn.flightfeather.supervision.lightshare.vo.ScoreDetail |
| | | import org.springframework.stereotype.Service |
| | | import tk.mybatis.mapper.entity.Example |
| | | |
| | |
| | | val evaluationruleMapper: EvaluationruleMapper, |
| | | private val evaluationRep: EvaluationRep, |
| | | private val evaluationRuleRep: EvaluationRuleRep, |
| | | private val sceneRep: SceneRep, |
| | | ) : EvaluationsubruleService { |
| | | |
| | | override fun findOne(id: String): Evaluationsubrule = evaluationsubruleMapper.selectByPrimaryKey(id) |
| | |
| | | |
| | | override fun delete(id: String): Int = evaluationsubruleMapper.deleteByPrimaryKey(id) |
| | | |
| | | override fun findByRuleId(erguid: String): List<Evaluationsubrule> { |
| | | val example = Example(Evaluationsubrule::class.java) |
| | | val criteria = example.createCriteria() |
| | | criteria.andEqualTo("erguid", erguid) |
| | | example.orderBy("extension1").desc() |
| | | return evaluationsubruleMapper.selectByExample(example) |
| | | override fun findByRuleId(erguid: String): List<Evaluationsubrule2> { |
| | | return evaluationRuleRep.findSubRule(erguid) |
| | | } |
| | | |
| | | override fun search(districtCode: String, sceneTypeId: String, version: String?): List<Evaluationsubrule> { |
| | |
| | | return result |
| | | } |
| | | |
| | | override fun getAutoScore(subTaskId: String): List<EvaluationVo> { |
| | | override fun getAutoScore(subTaskId: String): ScoreDetail { |
| | | //åºæ¯ä¿¡æ¯ |
| | | val scene = sceneRep.findBySubTask(subTaskId) |
| | | //æ»å |
| | | val evaluation = evaluationRep.findBySubtask(subTaskId) |
| | | //åè§åéæ¡å¾å |
| | | val subRuleScores = evaluationRep.findItemEvaluation(subTaskId) |
| | | if (subRuleScores.isEmpty()) throw BizException("æ è¯ä¼°è®°å½") |
| | | //è¯åæ»è§å |
| | | val rule = evaluationRuleRep.findAutoEvaluationRule(subTaskId) ?: throw BizException("æªæ¾å°ç¸å
³èªå¨è¯ä¼°è§å") |
| | | //æ»è§å对åºçè¯ååè§å |
| | | val subRules = evaluationRuleRep.findSubRule(rule.guid) |
| | | //æ¥è¯¢ç»æ |
| | | val resultList = mutableListOf<EvaluationVo>() |
| | | val result = ScoreDetail() |
| | | result.status = if (scene?.extension1.equals("1")) "å¨å»º" else "å®å·¥" |
| | | |
| | | var _group = 0 |
| | | result.updateTime = evaluation?.updatedate |
| | | subRules.forEach { |
| | | when (it.ertype) { |
| | | 2 -> resultList.add(EvaluationVo().apply { |
| | | id = it.guid |
| | | title = it.itemname |
| | | scoreMode = it.extension1 |
| | | gradeMode = it.extension2 |
| | | maxScore = when (gradeMode) { |
| | | "minus_mode" -> it.minscore?.minus(it.maxscore ?: 0) ?: 0 |
| | | "add_mode" -> it.maxscore ?: 0 |
| | | else -> it.minscore?.minus(it.maxscore ?: 0) ?: 0 |
| | | it.ertype ?: return@forEach |
| | | result.addDetail(result.details, it, it.ertype!! - 1, subRuleScores, false) |
| | | } |
| | | selectMode = it.extension3 |
| | | result.calScore() |
| | | |
| | | //妿æå¾åè®°å½ï¼åæ¹åç¶æä¸ºéä¸ |
| | | for (s in subRuleScores) { |
| | | if (it.guid == s.esrguid) { |
| | | select = s.extension1 == "true" |
| | | break |
| | | } |
| | | } |
| | | }) |
| | | 3 -> { |
| | | for (r in resultList) { |
| | | if (it.fatherid == r.id) { |
| | | r.subList.add(SubEvaluationVo().apply { |
| | | id = it.guid |
| | | title2 = it.itemname |
| | | gradeMode = it.extension2 |
| | | selectMode = it.extension3 |
| | | score = when (gradeMode) { |
| | | "minus_mode" -> it.minscore?.minus(it.maxscore ?: 0) ?: 0 |
| | | "add_mode" -> it.maxscore ?: 0 |
| | | else -> it.minscore?.minus(it.maxscore ?: 0) ?: 0 |
| | | } |
| | | group = _group++ |
| | | |
| | | //妿æå¾åè®°å½ï¼åæ¹åç¶æä¸ºéä¸ |
| | | for (s in subRuleScores) { |
| | | if (it.guid == s.esrguid) { |
| | | select = s.extension1 == "true" |
| | | break |
| | | } |
| | | } |
| | | }) |
| | | break |
| | | } |
| | | } |
| | | } |
| | | 4 -> { |
| | | resultList.forEach{ r -> |
| | | //4级çè¯ä¼°é¡¹ç´æ¥éå±äº2级è¯ä¼°é¡¹ |
| | | if (r.id == it.fatherid) { |
| | | if (r.subList.isEmpty()) { |
| | | r.subList.add(SubEvaluationVo().apply { |
| | | placeholder = true |
| | | id = it.guid |
| | | title2 = r.title |
| | | score = r.maxScore |
| | | gradeMode = r.gradeMode |
| | | selectMode = r.selectMode |
| | | group = _group++ |
| | | }) |
| | | } |
| | | r.subList[0].sub2.add(ThirdEvaluationVo().apply { |
| | | id = it.guid |
| | | content = it.itemname |
| | | score = when (r.subList[0].gradeMode) { |
| | | "minus_mode" -> r.maxScore.plus(it.maxscore ?: 0) |
| | | "add_mode" -> it.maxscore ?: 0 |
| | | else -> r.maxScore.plus(it.maxscore ?: 0) |
| | | } |
| | | //妿æå¾åè®°å½ï¼åæ¹åç¶æä¸ºéä¸ |
| | | for (s in subRuleScores) { |
| | | if (it.guid == s.esrguid) { |
| | | select = s.extension1 == "true" |
| | | break |
| | | } |
| | | } |
| | | }) |
| | | } else { |
| | | r.subList.forEach { sr -> |
| | | if (sr.id == it.fatherid){ |
| | | sr.sub2.add(ThirdEvaluationVo().apply { |
| | | id = it.guid |
| | | content = it.itemname |
| | | score = when (sr.gradeMode) { |
| | | "minus_mode" -> sr.score.plus(it.maxscore ?: 0) |
| | | "add_mode" -> it.maxscore ?: 0 |
| | | else -> sr.score.plus(it.maxscore ?: 0) |
| | | } |
| | | //妿æå¾åè®°å½ï¼åæ¹åç¶æä¸ºéä¸ |
| | | for (s in subRuleScores) { |
| | | if (it.guid == s.esrguid) { |
| | | select = s.extension1 == "true" |
| | | break |
| | | } |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | return resultList |
| | | |
| | | return result |
| | | } |
| | | } |
| | |
| | | package cn.flightfeather.supervision.lightshare.service.impl |
| | | |
| | | import cn.flightfeather.supervision.business.autooutput.AopOutput |
| | | import cn.flightfeather.supervision.business.autooutput.datasource.AopDataSource |
| | | import cn.flightfeather.supervision.business.autooutput.datasource.AopDbMapper |
| | | import cn.flightfeather.supervision.business.autooutput.datasource.AopSceneTypeCheck |
| | | import cn.flightfeather.supervision.business.autooutput.score.ScoreUtil |
| | | import cn.flightfeather.supervision.common.exception.BizException |
| | | import cn.flightfeather.supervision.domain.ds1.entity.Itemevaluation |
| | | import cn.flightfeather.supervision.domain.ds1.mapper.ItemevaluationMapper |
| | | import cn.flightfeather.supervision.domain.ds1.repository.SubTaskRep |
| | | import cn.flightfeather.supervision.lightshare.service.ItemevaluationService |
| | | import cn.flightfeather.supervision.lightshare.vo.ItemevaluationVo |
| | | import cn.flightfeather.supervision.lightshare.vo.ItemEvaluationVo |
| | | import org.springframework.beans.BeanUtils |
| | | import org.springframework.stereotype.Service |
| | | import org.springframework.transaction.annotation.Transactional |
| | | |
| | | @Service |
| | | class ItemevaluationServiceImpl(val itemevaluationMapper: ItemevaluationMapper) : ItemevaluationService { |
| | | class ItemevaluationServiceImpl( |
| | | private val itemevaluationMapper: ItemevaluationMapper, |
| | | private val aopDbMapper: AopDbMapper, |
| | | private val aopOutput: AopOutput, |
| | | private val aopSceneTypeCheck: AopSceneTypeCheck, |
| | | private val subTaskRep: SubTaskRep, |
| | | ) : ItemevaluationService { |
| | | |
| | | //æ¹éä¿®æ¹å项è¯ä¼° |
| | | @Transactional |
| | |
| | | } |
| | | |
| | | //æ ¹æ®åä»»å¡IDè·åå项è¯ä¼°å表 |
| | | override fun findBySubTaskID(subTaskID: String): List<ItemevaluationVo> { |
| | | val itemvaluationVoList = mutableListOf<ItemevaluationVo>() |
| | | override fun findBySubTaskID(subTaskID: String): List<ItemEvaluationVo> { |
| | | val itemvaluationVoList = mutableListOf<ItemEvaluationVo>() |
| | | val itemvaluation = Itemevaluation() |
| | | itemvaluation.stguid = subTaskID |
| | | val itemvaluationList = itemevaluationMapper.select(itemvaluation) |
| | | itemvaluationList.forEach { |
| | | val itemvaluationVo = ItemevaluationVo() |
| | | val itemvaluationVo = ItemEvaluationVo() |
| | | BeanUtils.copyProperties(it, itemvaluationVo) |
| | | itemvaluationVoList.add(itemvaluationVo) |
| | | } |
| | |
| | | |
| | | override fun save(itemevaluation: Itemevaluation): Int = itemevaluationMapper.insert(itemevaluation) |
| | | |
| | | override fun update(itemevaluation: Itemevaluation): Int = itemevaluationMapper.updateByPrimaryKeySelective(itemevaluation) |
| | | override fun update(itemevaluation: Itemevaluation): Int = |
| | | itemevaluationMapper.updateByPrimaryKeySelective(itemevaluation) |
| | | |
| | | override fun delete(id: String): Int = itemevaluationMapper.deleteByPrimaryKey(id) |
| | | |
| | | @Transactional |
| | | override fun createItemEvaluation(subTaskId: String, ruleId: String?, itemList: List<String>): Boolean { |
| | | val source = AopDataSource(aopDbMapper, aopSceneTypeCheck) |
| | | val subTask = subTaskRep.findOne(subTaskId) ?: throw BizException("å·¡æ¥ä»»å¡ä¸åå¨") |
| | | source.setResource(subTask) |
| | | try { |
| | | source.runBySubTask { _, evaluationScene -> |
| | | if (evaluationScene.noRecord()) throw BizException("å·¡æ¥ä»»å¡ä¸åå¨") |
| | | // å°åæ°èµå¼å°å¯¹åºçè¯ä¼°è§åä¸ï¼å¹¶ä¸èªå¨è®¡ç®å
¶ä½è§åçå¾å |
| | | ScoreUtil.scoreAssign(evaluationScene, itemList) |
| | | // è·åæ»ååå项å¾åæ°æ®åºè¡¨ç»æä½ï¼å¹¶å
¥åº |
| | | ScoreUtil.genEvaRecord(evaluationScene)?.let { aopOutput.toDbEvaluation(evaluationScene, it) } |
| | | } |
| | | return true |
| | | } catch (e: Exception) { |
| | | throw BizException("åºç°ç³»ç»å
é¨é误") |
| | | } |
| | | } |
| | | |
| | | @Transactional |
| | | override fun updateItemEvaluation(subTaskId: String, ruleId: String?, itemList: List<String>): Boolean { |
| | | val source = AopDataSource(aopDbMapper, aopSceneTypeCheck) |
| | | val subTask = subTaskRep.findOne(subTaskId) ?: throw BizException("å·¡æ¥ä»»å¡ä¸åå¨") |
| | | source.setResource(subTask) |
| | | try { |
| | | source.runBySubTask { _, evaluationScene -> |
| | | if (evaluationScene.noRecord()) throw BizException("å·¡æ¥ä»»å¡ä¸åå¨") |
| | | // å°åæ°èµå¼å°å¯¹åºçè¯ä¼°è§åä¸ï¼å¹¶ä¸èªå¨è®¡ç®å
¶ä½è§åçå¾å |
| | | ScoreUtil.scoreAssign(evaluationScene, itemList) |
| | | // è·åæ»ååå项å¾åæ°æ®åºè¡¨ç»æä½ï¼å¹¶å
¥åº |
| | | ScoreUtil.updateEvaRecord(evaluationScene)?.let { aopOutput.updateDbEvaluation(evaluationScene, it) } |
| | | } |
| | | return true |
| | | } catch (e: Exception) { |
| | | throw BizException("åºç°ç³»ç»å
é¨é误") |
| | | } |
| | | } |
| | | } |
| | |
| | | package cn.flightfeather.supervision.lightshare.service.impl |
| | | |
| | | import cn.flightfeather.supervision.common.exception.BizException |
| | | import cn.flightfeather.supervision.domain.ds1.entity.Mediafile |
| | | import cn.flightfeather.supervision.domain.ds1.mapper.MediafileMapper |
| | | import cn.flightfeather.supervision.common.utils.Constant |
| | | import cn.flightfeather.supervision.common.utils.FileUtil |
| | | import cn.flightfeather.supervision.domain.ds1.entity.Inspection |
| | | import cn.flightfeather.supervision.domain.ds1.repository.InspectionRep |
| | | import cn.flightfeather.supervision.domain.ds1.repository.MediaFileRep |
| | | import cn.flightfeather.supervision.domain.ds1.repository.SceneRep |
| | | import cn.flightfeather.supervision.domain.ds1.repository.SubTaskRep |
| | | import cn.flightfeather.supervision.lightshare.service.MediafileService |
| | | import cn.flightfeather.supervision.lightshare.vo.MediaFileVo |
| | | import com.fasterxml.jackson.core.type.TypeReference |
| | |
| | | class MediafileServiceImpl( |
| | | val mediafileMapper: MediafileMapper, |
| | | private val mediaFileRep: MediaFileRep, |
| | | private val inspectionRep: InspectionRep, |
| | | private val subTaskRep: SubTaskRep, |
| | | private val sceneRep: SceneRep, |
| | | @Value("\${filePath}") var filePath: String, |
| | | @Value("\${imgPath}") var imgPath: String, |
| | | ) : MediafileService { |
| | |
| | | val mediafilelist = mediafileMapper.select(mediafile) |
| | | mediafilelist.sortBy { it.savetime } |
| | | return mediafilelist |
| | | } |
| | | |
| | | /** |
| | | * è·åææä»»ææå¸¸è§è®°å½å¾ç |
| | | * @param iGuid |
| | | */ |
| | | override fun getRoutineRecord(iGuid: String?, stGuid: String?): List<Mediafile?> { |
| | | var inspectionGuid = iGuid |
| | | val sceneId = if (iGuid != null) { |
| | | inspectionRep.findOne(iGuid)?.sguid |
| | | } else if (stGuid != null) { |
| | | val s = subTaskRep.findOne(stGuid) |
| | | val ins = inspectionRep.findOne(Inspection().apply { stguid = stGuid }) |
| | | inspectionGuid = ins?.guid |
| | | s?.scenseid |
| | | } else { |
| | | throw BizException("å·¡æ¥è®°å½idåå·¡æ¥ä»»å¡idè³å°å¡«åå
¶ä¸ä¸ä¸ª") |
| | | } |
| | | sceneId ?: throw BizException("è®°å½å¯¹åºçåºæ¯ä¸åå¨") |
| | | val sceneInfo = sceneRep.findScene(sceneId = sceneId) |
| | | val mediaFileTypeList = Constant.MediaFileType.getList(sceneInfo?.typeid).map { it.value } |
| | | return mediaFileRep.findList(inspectionGuid, mediaFileTypeList) |
| | | } |
| | | |
| | | //æ ¹æ®é®é¢idè·ååªä½æä»¶ |
| | |
| | | |
| | | override fun save(mediafile: Mediafile): Int = mediafileMapper.updateByPrimaryKey(mediafile) |
| | | |
| | | override fun saveMediaFile(files: Array<MultipartFile>, getMediaFile: () -> Mediafile): Int { |
| | | var res = 0 |
| | | // ä¿åå¾ç |
| | | for (image in files) { |
| | | val mediaFile = getMediaFile() |
| | | res += mediafileMapper.insert(mediaFile) |
| | | |
| | | val path = mediaFile.extension1 |
| | | val fileName = mediaFile.guid + ".jpg" |
| | | val filePath = "${imgPath}/$path/" |
| | | try { |
| | | //è°ç¨æä»¶ä¿åæ¹æ³ |
| | | FileUtil.uploadFile(image.bytes, filePath, fileName) |
| | | } catch (e: Exception) { |
| | | // TODO: handle exception |
| | | } |
| | | } |
| | | return res |
| | | } |
| | | |
| | | override fun update(mediafile: Mediafile): Int = mediafileMapper.updateByPrimaryKey(mediafile) |
| | | |
| | | //å é¤åªä½æä»¶ |
| | |
| | | |
| | | override fun deleteList(idList: List<String>): Int { |
| | | var res = 0 |
| | | if (idList.isEmpty()) return res |
| | | mediaFileRep.findList(idList).forEach { |
| | | //æå¡å¨ä¿åè·¯å¾ |
| | | val path = it?.extension1 |
| | |
| | | } |
| | | |
| | | override fun newProblem(problem: String, files: Array<MultipartFile>): BaseResponse<String> { |
| | | val mapper = ObjectMapper() |
| | | |
| | | //json转object |
| | | val problemVo = mapper.readValue(problem, object : TypeReference<ProblemVo>() {}) |
| | | val problemVo = ObjectMapper().readValue(problem, object : TypeReference<ProblemVo>() {}) |
| | | |
| | | val inspection = inspectionMapper.selectByPrimaryKey(problemVo.insGuid) ?: return BaseResponse(false, "å·¡æ¥è®°å½ä¸åå¨") |
| | | val scene = scenseMapper.selectByPrimaryKey(inspection.sguid) ?: return BaseResponse(false, "å·¡æ¥è®°å½å¯¹åºåºæ¯ä¸åå¨") |
| | | |
| | | // ä¿åé®é¢ |
| | | val problemlist = ProblemListVo.newPro(inspection, problemVo, scene) |
| | | problemlistMapper.insert(problemlist) |
| | | |
| | | // ä¿åå¾ç |
| | | saveProFile(problemlist, inspection, scene, files) |
| | | mediafileService.saveMediaFile(files) { MediaFileVo.newProFile(inspection, problemlist, scene) } |
| | | |
| | | //æ´æ°å·¡æ¥ä¿¡æ¯çé®é¢æ° |
| | | if (inspection.problemcount != null) { |
| | |
| | | |
| | | override fun updateProblem(problem: ProblemListVo, deleteImg: List<String>, files: Array<MultipartFile>): String { |
| | | problemRep.findOne(problem.guid) ?: throw BizException("该é®é¢ä¸åå¨") |
| | | val inspection = inspectionMapper.selectByPrimaryKey(problem.guid) ?: throw BizException("å·¡æ¥è®°å½ä¸åå¨") |
| | | problemRep.update(problem) |
| | | val inspection = inspectionMapper.selectByPrimaryKey(problem.iguid) ?: throw BizException("å·¡æ¥è®°å½ä¸åå¨") |
| | | val scene = scenseMapper.selectByPrimaryKey(inspection.sguid) ?: throw BizException("å·¡æ¥è®°å½å¯¹åºåºæ¯ä¸åå¨") |
| | | saveProFile(problem, inspection, scene, files) |
| | | mediafileService.saveMediaFile(files) { MediaFileVo.newProFile(inspection, problem, scene) } |
| | | mediafileService.deleteList(deleteImg) |
| | | return "success" |
| | | } |
| | | |
| | | override fun saveProFile( |
| | | problemlist: Problemlist, |
| | | inspection: Inspection, |
| | | scene: Scense, |
| | | files: Array<MultipartFile>, |
| | | ): Int { |
| | | var res = 0 |
| | | // ä¿åå¾ç |
| | | for (image in files) { |
| | | val mediaFile = MediaFileVo.newProFile(inspection, problemlist, scene) |
| | | res += mediafileMapper.insert(mediaFile) |
| | | |
| | | val path = mediaFile.extension1 |
| | | val fileName = mediaFile.guid + ".jpg" |
| | | val filePath = "${imgPath}/$path/" |
| | | try { |
| | | //è°ç¨æä»¶ä¿åæ¹æ³ |
| | | FileUtil.uploadFile(image.bytes, filePath, fileName) |
| | | } catch (e: Exception) { |
| | | // TODO: handle exception |
| | | } |
| | | } |
| | | return res |
| | | } |
| | | |
| | | override fun changeProblem(problemId: String, files: Array<MultipartFile>): BaseResponse<String> { |
| | | // æ´æ°é®é¢ |
| | | // é®é¢åé®é¢å¾çåæ³æ§æ£æ¥ |
| | | val p = problemlistMapper.selectByPrimaryKey(problemId) ?: return BaseResponse(false, "é®é¢ä¸åå¨") |
| | | val mediaFiles = mediafileMapper.selectByExample(Example(Mediafile::class.java).apply { |
| | | createCriteria().andEqualTo("businessguid", p.guid) |
| | | .andEqualTo("businesstypeid", 1) |
| | | .andEqualTo("ischanged", false) |
| | | }) |
| | | if (mediaFiles.isEmpty()) return BaseResponse(false, "é®é¢ä¸åå¨æå·²æ´æ¹ï¼æ æ³é夿´æ¹") |
| | | |
| | | // æ´æ°é®é¢ |
| | | p.apply { |
| | | ischanged = true |
| | | changedtime = Date() |
| | |
| | | } |
| | | problemlistMapper.updateByPrimaryKey(p) |
| | | |
| | | // ä¿åå¾ç |
| | | val now = LocalDateTime.now() |
| | | val mediaFiles = mediafileMapper.selectByExample(Example(Mediafile::class.java).apply { |
| | | createCriteria().andEqualTo("businessguid", p.guid) |
| | | .andEqualTo("businesstypeid", 1) |
| | | .andEqualTo("ischanged", false) |
| | | }) |
| | | if (mediaFiles.isEmpty()) return BaseResponse(false, "åºæ¯é®é¢æ°é为0ï¼æ æ³æ´æ¹") |
| | | // ä¿åæ´æ¹å¾ç |
| | | val m = mediaFiles[0] |
| | | m.path = m.path + "æ´æ¹/" |
| | | m.savetime = Date() |
| | | m.ischanged = true |
| | | |
| | | for (image in files) { |
| | | mediafileService.saveMediaFile(files) { |
| | | m.apply { |
| | | guid = UUIDGenerator.generate16ShortUUID() |
| | | description = p.problemname + " " + p.location + " æ´æ¹ " + UUIDGenerator.generateUUID(4) + ".jpg" |
| | | } |
| | | mediafileMapper.insert(m) |
| | | |
| | | val path = m.extension1 |
| | | val fileName = m.guid + ".jpg" |
| | | // val filePath = "E:\\work\\ç¬¬ä¸æ¹ç管app\\èªå¨è¯å\\é¤é¥®\\" |
| | | val filePath = "${imgPath}/$path" |
| | | try { |
| | | //è°ç¨æä»¶ä¿åæ¹æ³ |
| | | FileUtil.uploadFile(image.bytes, filePath, fileName) |
| | | } catch (e: Exception) { |
| | | println(e) |
| | | } |
| | | } |
| | | |
| | | return BaseResponse(true) |
| | | } |
| | | |
| | | override fun updateChange(problemId: String, deleteImg: List<String>, files: Array<MultipartFile>): String { |
| | | val p = problemRep.findOne(problemId) ?: throw BizException("该é®é¢ä¸åå¨") |
| | | val mediaFiles = mediafileMapper.selectByExample(Example(Mediafile::class.java).apply { |
| | | createCriteria().andEqualTo("businessguid", problemId) |
| | | .andEqualTo("businesstypeid", 1) |
| | | .andEqualTo("ischanged", true) |
| | | }) |
| | | if (mediaFiles.isEmpty()) throw BizException("é®é¢è¿æªæ´æ¹ï¼æ æ³ä¿®æ¹æ´æ¹") |
| | | |
| | | // ä¿åæ°çæ´æ¹å¾ç |
| | | val m = mediaFiles[0] |
| | | m.savetime = Date() |
| | | mediafileService.saveMediaFile(files) { |
| | | m.apply { |
| | | guid = UUIDGenerator.generate16ShortUUID() |
| | | description = p.problemname + " " + p.location + " æ´æ¹ " + UUIDGenerator.generateUUID(4) + ".jpg" |
| | | } |
| | | } |
| | | mediafileService.deleteList(deleteImg) |
| | | return "success" |
| | | } |
| | | |
| | | override fun getBySubTask(stGuid: String, all: Boolean?): List<ProblemListVo> { |
| | | //æ ¹æ®åä»»å¡IDè·åé®é¢å表 |
| | | val problemListVo = mutableListOf<ProblemListVo>() |
| | |
| | | override fun getSceneDetail(sceneId: String): BaseResponse<SceneDetail> { |
| | | val sceneDetail = SceneDetail() |
| | | |
| | | val scene = scenseMapper.selectByPrimaryKey(sceneId) |
| | | val scene = sceneRep.findScene(sceneId = sceneId) |
| | | sceneDetail.scense = scene |
| | | |
| | | val mapper = when (scene.typeid.toString()) { |
| | | val mapper = when (scene?.typeid.toString()) { |
| | | Constant.SceneType.TYPE1.value -> sceneConstructionSiteMapper |
| | | Constant.SceneType.TYPE2.value -> sceneWharfMapper |
| | | Constant.SceneType.TYPE3.value -> sceneMixingPlantMapper |
| | |
| | | val scenes = sceneImport.readFromFile(f) |
| | | // æ¥æ¾åºæ¯åç§°æ¯å¦éå¤ |
| | | val names = scenes.map { it.name } |
| | | sceneRep.findScenes(names).map { it?.name }.ifNotEmpty { |
| | | sceneRep.findSceneList(names).map { it?.name }.ifNotEmpty { |
| | | val str = this.joinToString("ï¼") |
| | | throw BizException("åå¨éå¤åºæ¯ï¼å¦ä¸ï¼${str}") |
| | | } |
| | |
| | | |
| | | override fun createScene(scense: Scense): Scense { |
| | | val names = listOf(scense.name) |
| | | sceneRep.findScenes(names).map { it?.name }.ifNotEmpty { |
| | | sceneRep.findSceneList(names).map { it?.name }.ifNotEmpty { |
| | | val str = this.joinToString("ï¼") |
| | | throw BizException("åå¨éå¤åºæ¯ï¼å¦ä¸ï¼${str}") |
| | | } |
| | |
| | | //以é£ç¾½ç管系ç»ä¸çç¨æ·ä¸ºä¸»ä½ |
| | | 2 -> { |
| | | val task = taskRep.findOneTask(areaVo) ?: throw BizException("å½åæ¥è¯¢æ¡ä»¶ä¸æªæ¾å°å¯¹åºé¡¶å±ä»»å¡") |
| | | val scenes = sceneRep.findScene(task.tguid!!, areaVo.scensetypeid?.toInt(), areaVo.towncode) |
| | | val scenes = sceneRep.findSceneList(task.tguid!!, areaVo.scensetypeid?.toInt(), areaVo.towncode) |
| | | .map { it?.guid } |
| | | userInfoSVRep.findUser(scenes).map { it?.guid } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.flightfeather.supervision.lightshare.vo |
| | | |
| | | import cn.flightfeather.supervision.common.utils.Constant |
| | | import cn.flightfeather.supervision.domain.ds1.entity.Evaluationsubrule2 |
| | | import kotlin.math.abs |
| | | |
| | | /** |
| | | * @date 2024.9.24 |
| | | * è¯ä¼°è¯¦ç»è§å |
| | | */ |
| | | class EvaluationSubRuleVo : Evaluationsubrule2() { |
| | | // å¾åè®°å½(æ ¹æ®æ¡ç®çè¯å模å¼ï¼å åæååï¼åå¨å¾åæè
æ£å) |
| | | var score: Int = 0 |
| | | // å¾åå¨èµå¼æ¶ï¼ä¸è½è¶
è¿å¾åä¸é |
| | | set(value) { |
| | | field = if (maxscore != null && abs(value) > maxscore!!) { |
| | | when (extension2) { |
| | | // å忍¡å¼ï¼è®°å½ä¸ºæ£åï¼è´æ°ï¼ |
| | | Constant.EvaGradeMode.MINUS_MODE.value -> { |
| | | (0 - (maxscore ?: 0)) |
| | | } |
| | | // å 忍¡å¼ï¼è®°å½ä¸ºå¾åï¼æ£æ°ï¼ |
| | | Constant.EvaGradeMode.ADD_MODE.value -> { |
| | | maxscore ?: 0 |
| | | } |
| | | // é»è®¤å忍¡å¼ |
| | | else -> { |
| | | (0 - (maxscore ?: 0)) |
| | | } |
| | | } |
| | | } else { |
| | | value |
| | | } |
| | | selected = true |
| | | } |
| | | |
| | | // æ¯å¦é䏿¬è¯ä¼°æ¡ç® |
| | | var selected: Boolean = false |
| | | |
| | | /** |
| | | * æ
åµå¾ååéä¸ç¶æ |
| | | */ |
| | | fun clear() { |
| | | score = 0 |
| | | selected = false |
| | | } |
| | | |
| | | /** |
| | | * ç´æ¥æ ¹æ®æ¡ç®çæ»ååå¾å模å¼è·åæç»å¾å |
| | | */ |
| | | fun setMaxScore() { |
| | | score = when (extension2) { |
| | | // å忍¡å¼ï¼è®°å½ä¸ºæ£åï¼è´æ°ï¼ |
| | | Constant.EvaGradeMode.MINUS_MODE.value -> { |
| | | (0 - (maxscore ?: 0)) |
| | | } |
| | | // å 忍¡å¼ï¼è®°å½ä¸ºå¾åï¼æ£æ°ï¼ |
| | | Constant.EvaGradeMode.ADD_MODE.value -> { |
| | | maxscore ?: 0 |
| | | } |
| | | // é»è®¤å忍¡å¼ |
| | | else -> { |
| | | (0 - (maxscore ?: 0)) |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * è·åæç»å¾åï¼æ£æ°ï¼ |
| | | * ä¸è¬ç¨äºè®¡ç®æ»åæ¶ï¼æ»åé常æ
åµä¸é½ä¸ºæ£æ°ï¼ |
| | | */ |
| | | fun getFinalScore(): Int { |
| | | return when (extension2) { |
| | | // å忍¡å¼ä¸ï¼è®°å½ä¸ºæ£åï¼æä»¥å¾å为æ»åå廿£å |
| | | Constant.EvaGradeMode.MINUS_MODE.value -> { |
| | | maxscore?.minus(abs(score)) ?: 0 |
| | | } |
| | | // å 忍¡å¼ï¼è®°å½ä¸ºå¾åï¼ç´æ¥å å
¥æ»å |
| | | Constant.EvaGradeMode.ADD_MODE.value -> { |
| | | score |
| | | } |
| | | // é»è®¤å忍¡å¼ |
| | | else -> { |
| | | maxscore?.minus(abs(score)) ?: 0 |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | package cn.flightfeather.supervision.lightshare.vo |
| | | |
| | | import cn.flightfeather.supervision.domain.ds1.entity.Evaluationsubrule2 |
| | | import cn.flightfeather.supervision.domain.ds1.entity.Itemevaluation |
| | | import com.fasterxml.jackson.annotation.JsonInclude |
| | | import cn.flightfeather.supervision.common.utils.UUIDGenerator |
| | | import cn.flightfeather.supervision.domain.ds1.entity.* |
| | | import java.util.* |
| | | |
| | | /** |
| | | * è¯åè§ååå¾å |
| | | * è¯ä¼°æ»å |
| | | * @date 2024/9/24 |
| | | * @author feiyu02 |
| | | */ |
| | | @JsonInclude(JsonInclude.Include.NON_NULL) |
| | | class ScoreDetail { |
| | | // å·¥å°ç¶æï¼å¨å»ºæå®å·¥ï¼ |
| | | var status: String? = null |
| | | |
| | | // æ»å |
| | | var totalScore: Int = 0 |
| | | |
| | | // å¾å |
| | | var score: Int = 0 |
| | | |
| | | // è§èæ§ç级 |
| | | var grade: String? = null |
| | | |
| | | // æ´æ°æ¶é´ |
| | | var updateTime: Date? = null |
| | | |
| | | // å¾åç»å |
| | | var details = mutableListOf<ScoreItem>() |
| | | class EvaluationVo : Evaluation() { |
| | | |
| | | /** |
| | | * æ°å¢ä¸æ¡è¯ä¼°è§åè®°å½ |
| | | * è¯ä¼°è§åçä¼ å
¥æé¡ºåºè¦æ±ï¼å¿
é¡»æ¯æç
§æµ
å±çº§è³æ·±å±çº§ç顺åºä¼ å
¥ï¼è¯ä¼°å±çº§ @see [Evaluationsubrule2.ertype] |
| | | * @param details ç»æ |
| | | * @param rule è¯ä¼°è§å |
| | | * @param level è¯ä¼°è§å对åºçå±çº§æ·±åº¦ï¼ä»1å¼å§éå¢ï¼1为æé¡¶å± |
| | | * @param resList åæ¡è§å对åºçè¯ä¼°ç»æ |
| | | * @param onlyShowSelected åªæ·»å éä¸çé项 |
| | | * æ´æ°å¾å |
| | | */ |
| | | fun addDetail( |
| | | details: MutableList<ScoreItem>, |
| | | rule: Evaluationsubrule2, |
| | | level: Int, |
| | | resList: List<Itemevaluation>, |
| | | onlyShowSelected: Boolean = false, |
| | | ) { |
| | | if (level == 1) { |
| | | val scoreItem = ScoreItem.fromRule(rule, resList) |
| | | if (onlyShowSelected) { |
| | | if (scoreItem.select) details.add(scoreItem) |
| | | } else { |
| | | details.add(scoreItem) |
| | | } |
| | | } else if (level > 1) { |
| | | var isFind = false |
| | | // 夿æå
¥è§åæ¯å¦æ¯å½åå±çº§è¯ä¼°éå䏿ä¸é¡¹çåè¯ä¼° |
| | | for (d in details) { |
| | | if (rule.fatherid == d.id) { |
| | | if (d.subList == null) d.subList = mutableListOf() |
| | | addDetail(d.subList!!, rule, 1, resList, onlyShowSelected) |
| | | isFind = true |
| | | break |
| | | } |
| | | } |
| | | // è¥æªæ¾å°ï¼åå¾ä¸ä¸å±çº§ç»§ç»æ¥æ¾ |
| | | if (!isFind && (level - 1 > 1)) { |
| | | details.forEach { d -> |
| | | d.subList?.let { |
| | | addDetail(it, rule, level - 1, resList, onlyShowSelected) |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | fun updateScore(score: Int) { |
| | | |
| | | /** |
| | | * è®¡ç®æ»ååå¾å |
| | | */ |
| | | fun calScore() { |
| | | details.forEach { |
| | | totalScore += it.maxScore |
| | | score += when (it.gradeMode) { |
| | | "minus_mode" -> { |
| | | (it.score + it.maxScore) |
| | | } |
| | | "add_mode" -> { |
| | | it.score |
| | | } |
| | | else -> { |
| | | (it.score + it.maxScore) |
| | | } |
| | | } |
| | | } |
| | | grade = when { |
| | | score >= 95 -> "è§è" |
| | | // åºæ¬è§è(90..94)åè§èï¼>=95ï¼ |
| | | score >= 90 -> "åºæ¬è§è" |
| | | // ä¸è§è |
| | | score >= 50 -> "ä¸è§è" |
| | | // 严éä¸è§è |
| | | else -> "严éä¸è§è" |
| | | } |
| | | } |
| | | } |
| | | |
| | | @JsonInclude(JsonInclude.Include.NON_NULL) |
| | | class ScoreItem { |
| | | //æåºç´¢å¼ |
| | | var index: Int? = null |
| | | |
| | | //è¯ä¼°è§å级å«ï¼2ï¼3ï¼4)ï¼å¼è¶å¤§çº§å«è¶ä½ |
| | | var level: Int? = null |
| | | |
| | | //è§åid |
| | | var id: String? = null |
| | | |
| | | //è§åæè¿° |
| | | var title: String? = null |
| | | |
| | | //æ»åå¼ |
| | | var maxScore: Int = 0 |
| | | |
| | | //å®é
å¾å |
| | | var score: Int = 0 |
| | | |
| | | //æ¯å¦éä¸ |
| | | var select: Boolean = false |
| | | |
| | | //basic_score: åºç¡åï¼å¿
éï¼addition_scoreï¼éå åï¼å¯éï¼nullï¼é»è®¤åºç¡å |
| | | var scoreMode: String? = null |
| | | |
| | | //minus_mode: å忍¡å¼ï¼add_modeï¼å 忍¡å¼ï¼nullï¼ä¸å设å®ï¼è¯´æå
¶å项䏿¯å
·ä½çè¯ä¼°ç»å |
| | | var gradeMode: String? = null |
| | | |
| | | //single_mode: å鿍¡å¼ï¼multi_modeï¼å¤é模å¼ï¼nullï¼ä¸å设å®ï¼è¯´æå
¶å项䏿¯å
·ä½çè¯ä¼°ç»å |
| | | var selectMode: String? = null |
| | | |
| | | //äºçº§åè§å |
| | | var subList: MutableList<ScoreItem>? = null |
| | | |
| | | companion object { |
| | | /** |
| | | * æ ¹æ®è§ååå¾åç»æçæå¾å项 |
| | | * @param rule |
| | | * @param resList |
| | | * æ°å¢ä¸æ¡èªå¨è¯åçæ»å¾åè®°å½ |
| | | * @param inspection å·¡æ¥è®°å½ |
| | | * @param subTask å·¡æ¥åä»»å¡ |
| | | * @param scene 被巡æ¥åºæ¯ |
| | | * @param rule 使ç¨çè¯åè§å |
| | | * @param totalScore æ»å¾å |
| | | */ |
| | | fun fromRule(rule: Evaluationsubrule2, resList: List<Itemevaluation>): ScoreItem { |
| | | return ScoreItem().apply { |
| | | index = rule.displayid?.toInt() |
| | | level = rule.ertype |
| | | id = rule.guid |
| | | title = rule.itemname |
| | | scoreMode = rule.extension1 |
| | | gradeMode = rule.extension2 |
| | | maxScore = rule.maxscore ?: 0 |
| | | selectMode = rule.extension3 |
| | | fun newAutoEvaluation( |
| | | inspection: Inspection?, subTask: Subtask?, scene: Scense, rule: Evaluationrule?, |
| | | totalScore: Int, |
| | | ) = newEvaluation(inspection, subTask, scene, rule, totalScore, Userinfo().apply { |
| | | guid = "admin" |
| | | acountname = "admin" |
| | | realname = "admin" |
| | | }) |
| | | |
| | | //妿æå¾åè®°å½ï¼åæ¹åç¶æä¸ºéä¸ |
| | | for (s in resList) { |
| | | if (rule.guid == s.esrguid) { |
| | | score = s.value?.toInt() ?: 0 |
| | | select = s.extension1 == "true" |
| | | break |
| | | /** |
| | | * æ°å¢ä¸æ¡è¯åçæ»å¾åè®°å½ |
| | | * @param inspection å·¡æ¥è®°å½ |
| | | * @param subTask å·¡æ¥åä»»å¡ |
| | | * @param scene 被巡æ¥åºæ¯ |
| | | * @param rule 使ç¨çè¯åè§å |
| | | * @param totalScore æ»å¾å |
| | | * @param userinfo è¯ä¼°ç¨æ· |
| | | */ |
| | | fun newEvaluation( |
| | | inspection: Inspection?, subTask: Subtask?, scene: Scense, |
| | | rule: Evaluationrule?, totalScore: Int, userinfo: Userinfo, |
| | | ) = Evaluation().apply { |
| | | guid = UUIDGenerator.generate16ShortUUID() |
| | | iguid = inspection?.guid |
| | | stguid = subTask?.stguid |
| | | sguid = subTask?.scenseid |
| | | scensetypeid = scene.typeid |
| | | scensetype = scene.type |
| | | subscensetypeid = scene.scensesubtypeid |
| | | subscensetype = scene.scensesubtype |
| | | ertype = rule?.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 = subTask?.planstarttime |
| | | evaluatorguid = userinfo.guid |
| | | evaluatorusername = userinfo.acountname |
| | | evaluatorrealname = userinfo.realname |
| | | resultscorebef = totalScore.toString() |
| | | createdate = subTask?.planstarttime |
| | | updatedate = Date() |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | @JsonInclude(JsonInclude.Include.NON_NULL) |
| | | class EvaluationVo { |
| | | //è§åid |
| | | var id: String? = null |
| | | |
| | | //è§åæè¿° |
| | | var title: String? = null |
| | | |
| | | //æ»åå¼ |
| | | var maxScore: Int = 0 |
| | | |
| | | //å®é
å¾å |
| | | var score: Int = 0 |
| | | |
| | | //æ¯å¦éä¸ |
| | | var select: Boolean = false |
| | | |
| | | //basic_score: åºç¡åï¼å¿
éï¼addition_scoreï¼éå åï¼å¯éï¼nullï¼é»è®¤åºç¡å |
| | | var scoreMode: String? = "basic_score" |
| | | |
| | | //minus_mode: å忍¡å¼ï¼add_modeï¼å 忍¡å¼ï¼nullï¼ä¸å设å®ï¼è¯´æå
¶å项䏿¯å
·ä½çè¯ä¼°ç»å |
| | | var gradeMode: String? = "minus_mode" |
| | | |
| | | //single_mode: å鿍¡å¼ï¼multi_modeï¼å¤é模å¼ï¼nullï¼ä¸å设å®ï¼è¯´æå
¶å项䏿¯å
·ä½çè¯ä¼°ç»å |
| | | var selectMode: String? = "single_mode" |
| | | |
| | | //äºçº§åè§å |
| | | var subList: MutableList<SubEvaluationVo> = mutableListOf() |
| | | } |
| | | |
| | | class SubEvaluationVo { |
| | | //ææ¶åä¸çº§çè§åä¸é¢ç´æ¥æ¯ä¸çº§è§åï¼æ²¡æäºçº§è§åï¼å æ¤æ¤æ¶çäºçº§è§ååªæ¯ä¸ºäºç»æå®æ´æ§èåºç°ç |
| | | var placeholder: Boolean = false |
| | | |
| | | //è§åid |
| | | var id: String? = null |
| | | |
| | | //è§åæè¿° |
| | | var title2: String? = null |
| | | |
| | | //åå¼ |
| | | var score: Int = 0 |
| | | |
| | | //æ¯å¦éä¸ |
| | | var select: Boolean = false |
| | | |
| | | //minus_mode: å忍¡å¼ï¼add_modeï¼å 忍¡å¼ï¼ |
| | | var gradeMode: String? = "minus_mode" |
| | | |
| | | //single_mode: å鿍¡å¼ï¼multi_modeï¼å¤é模å¼ï¼ |
| | | var selectMode: String? = "single_mode" |
| | | |
| | | //äºçº§è§ååç» |
| | | var group: Int? = null |
| | | |
| | | //ä¸çº§åè§å |
| | | var sub2: MutableList<ThirdEvaluationVo> = mutableListOf() |
| | | } |
| | | |
| | | class ThirdEvaluationVo { |
| | | //è§åid |
| | | var id: String? = null |
| | | |
| | | //è§åæè¿° |
| | | var content: String? = null |
| | | |
| | | //åå¼ |
| | | var score: Int = 0 |
| | | |
| | | //æ¯å¦éä¸ |
| | | var select: Boolean = false |
| | | } |
| | |
| | | var gitList:List<GitlistVo> ?= null |
| | | |
| | | //å项è¯å项 |
| | | var itemevaluationList:List<ItemevaluationVo> ?= null |
| | | var itemevaluationList:List<ItemEvaluationVo> ?= null |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.flightfeather.supervision.lightshare.vo |
| | | |
| | | import cn.flightfeather.supervision.business.autooutput.datasource.AopDataSource |
| | | import cn.flightfeather.supervision.common.utils.UUIDGenerator |
| | | import cn.flightfeather.supervision.domain.ds1.entity.Evaluationrule |
| | | import cn.flightfeather.supervision.domain.ds1.entity.Inspection |
| | | import cn.flightfeather.supervision.domain.ds1.entity.Itemevaluation |
| | | import cn.flightfeather.supervision.domain.ds1.entity.Subtask |
| | | import com.fasterxml.jackson.annotation.JsonInclude |
| | | |
| | | @JsonInclude(JsonInclude.Include.NON_NULL) |
| | | class ItemEvaluationVo : Itemevaluation() { |
| | | |
| | | companion object { |
| | | /** |
| | | * çææ°ç䏿¡è¯åè®°å½ |
| | | */ |
| | | fun newItemEvaluation( |
| | | rule: Evaluationrule?, subTask: Subtask?, inspection: Inspection?, |
| | | itemRule: EvaluationSubRuleVo, |
| | | ) = Itemevaluation().apply { |
| | | ieguid = UUIDGenerator.generate16ShortUUID() |
| | | iguid = inspection?.guid |
| | | stguid = subTask?.stguid |
| | | sguid = subTask?.scenseid |
| | | sensename = subTask?.scensename |
| | | erguid = rule?.guid |
| | | rulename = rule?.rulename |
| | | ruletype = rule?.ruletype?.toInt() |
| | | ertype = itemRule.ertype |
| | | esrguid = itemRule.guid |
| | | name = itemRule.itemname |
| | | value = itemRule.score.toString() |
| | | extension1 = itemRule.selected.toString() |
| | | } |
| | | } |
| | | } |
| | |
| | | |
| | | @JsonInclude(JsonInclude.Include.NON_NULL) |
| | | class MediaFileVo : Mediafile() { |
| | | |
| | | companion object { |
| | | /** |
| | | * çæä¸ä¸ªé®é¢å¾ç |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.flightfeather.supervision.lightshare.vo |
| | | |
| | | import cn.flightfeather.supervision.domain.ds1.entity.Evaluationsubrule2 |
| | | import cn.flightfeather.supervision.domain.ds1.entity.Itemevaluation |
| | | import com.fasterxml.jackson.annotation.JsonInclude |
| | | import java.util.* |
| | | |
| | | /** |
| | | * è¯åè§ååå¾å |
| | | */ |
| | | @JsonInclude(JsonInclude.Include.NON_NULL) |
| | | class ScoreDetail { |
| | | // å·¥å°ç¶æï¼å¨å»ºæå®å·¥ï¼ |
| | | var status: String? = null |
| | | |
| | | // æ»å |
| | | var totalScore: Int = 0 |
| | | |
| | | // å¾å |
| | | var score: Int = 0 |
| | | |
| | | // è§èæ§ç级 |
| | | var grade: String? = null |
| | | |
| | | // æ´æ°æ¶é´ |
| | | var updateTime: Date? = null |
| | | |
| | | // å¾åç»å |
| | | var details = mutableListOf<ScoreItem>() |
| | | |
| | | /** |
| | | * æ°å¢ä¸æ¡è¯ä¼°è§åè®°å½ |
| | | * è¯ä¼°è§åçä¼ å
¥æé¡ºåºè¦æ±ï¼å¿
é¡»æ¯æç
§æµ
å±çº§è³æ·±å±çº§ç顺åºä¼ å
¥ï¼è¯ä¼°å±çº§ @see [Evaluationsubrule2.ertype] |
| | | * @param details ç»æ |
| | | * @param rule è¯ä¼°è§å |
| | | * @param level è¯ä¼°è§å对åºçå±çº§æ·±åº¦ï¼ä»1å¼å§éå¢ï¼1为æé¡¶å± |
| | | * @param resList åæ¡è§å对åºçè¯ä¼°ç»æ |
| | | * @param onlyShowSelected åªæ·»å éä¸çé项 |
| | | */ |
| | | fun addDetail( |
| | | details: MutableList<ScoreItem>, |
| | | rule: Evaluationsubrule2, |
| | | level: Int, |
| | | resList: List<Itemevaluation>, |
| | | onlyShowSelected: Boolean = false, |
| | | ) { |
| | | if (level == 1) { |
| | | val scoreItem = ScoreItem.fromRule(rule, resList) |
| | | if (onlyShowSelected) { |
| | | if (scoreItem.select) details.add(scoreItem) |
| | | } else { |
| | | details.add(scoreItem) |
| | | } |
| | | } else if (level > 1) { |
| | | var isFind = false |
| | | // 夿æå
¥è§åæ¯å¦æ¯å½åå±çº§è¯ä¼°éå䏿ä¸é¡¹çåè¯ä¼° |
| | | for (d in details) { |
| | | if (rule.fatherid == d.id) { |
| | | if (d.subList == null) d.subList = mutableListOf() |
| | | addDetail(d.subList!!, rule, 1, resList, onlyShowSelected) |
| | | isFind = true |
| | | break |
| | | } |
| | | } |
| | | // è¥æªæ¾å°ï¼åå¾ä¸ä¸å±çº§ç»§ç»æ¥æ¾ |
| | | if (!isFind && (level - 1 > 1)) { |
| | | details.forEach { d -> |
| | | d.subList?.let { |
| | | addDetail(it, rule, level - 1, resList, onlyShowSelected) |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * è®¡ç®æ»ååå¾å |
| | | */ |
| | | fun calScore() { |
| | | details.forEach { |
| | | totalScore += it.maxScore |
| | | score += when (it.gradeMode) { |
| | | "minus_mode" -> { |
| | | (it.score + it.maxScore) |
| | | } |
| | | "add_mode" -> { |
| | | it.score |
| | | } |
| | | else -> { |
| | | (it.score + it.maxScore) |
| | | } |
| | | } |
| | | } |
| | | grade = when { |
| | | score >= 95 -> "è§è" |
| | | // åºæ¬è§è(90..94)åè§èï¼>=95ï¼ |
| | | score >= 90 -> "åºæ¬è§è" |
| | | // ä¸è§è |
| | | score >= 50 -> "ä¸è§è" |
| | | // 严éä¸è§è |
| | | else -> "严éä¸è§è" |
| | | } |
| | | } |
| | | } |
| | | |
| | | @JsonInclude(JsonInclude.Include.NON_NULL) |
| | | class ScoreItem { |
| | | //æåºç´¢å¼ |
| | | var index: Int? = null |
| | | |
| | | //è¯ä¼°è§å级å«ï¼2ï¼3ï¼4)ï¼å¼è¶å¤§çº§å«è¶ä½ |
| | | var level: Int? = null |
| | | |
| | | //è§åid |
| | | var id: String? = null |
| | | |
| | | //è§åæè¿° |
| | | var title: String? = null |
| | | |
| | | //æ»åå¼ |
| | | var maxScore: Int = 0 |
| | | |
| | | //å®é
å¾å |
| | | var score: Int = 0 |
| | | |
| | | //æ¯å¦éä¸ |
| | | var select: Boolean = false |
| | | |
| | | //basic_score: åºç¡åï¼å¿
éï¼addition_scoreï¼éå åï¼å¯éï¼nullï¼é»è®¤åºç¡å |
| | | var scoreMode: String? = null |
| | | |
| | | //minus_mode: å忍¡å¼ï¼add_modeï¼å 忍¡å¼ï¼nullï¼ä¸å设å®ï¼è¯´æå
¶å项䏿¯å
·ä½çè¯ä¼°ç»å |
| | | var gradeMode: String? = null |
| | | |
| | | //single_mode: å鿍¡å¼ï¼multi_modeï¼å¤é模å¼ï¼nullï¼ä¸å设å®ï¼è¯´æå
¶å项䏿¯å
·ä½çè¯ä¼°ç»å |
| | | var selectMode: String? = null |
| | | |
| | | //äºçº§åè§å |
| | | var subList: MutableList<ScoreItem>? = null |
| | | |
| | | companion object { |
| | | /** |
| | | * æ ¹æ®è§ååå¾åç»æçæå¾å项 |
| | | * @param rule |
| | | * @param resList |
| | | */ |
| | | fun fromRule(rule: Evaluationsubrule2, resList: List<Itemevaluation>): ScoreItem { |
| | | return ScoreItem().apply { |
| | | index = rule.displayid?.toInt() |
| | | level = rule.ertype |
| | | id = rule.guid |
| | | title = rule.itemname |
| | | scoreMode = rule.extension1 |
| | | gradeMode = rule.extension2 |
| | | maxScore = rule.maxscore ?: 0 |
| | | selectMode = rule.extension3 |
| | | |
| | | //妿æå¾åè®°å½ï¼åæ¹åç¶æä¸ºéä¸ |
| | | for (s in resList) { |
| | | if (rule.guid == s.esrguid) { |
| | | score = s.value?.toInt() ?: 0 |
| | | select = s.extension1 == "true" |
| | | break |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | @GetMapping |
| | | fun fetchDevice( |
| | | @ApiParam("åºæ¯id") @RequestParam sceneId: String, |
| | | @ApiParam("设å¤ç±»åid") @RequestParam deviceTypeId: Byte, |
| | | @ApiParam("设å¤ç±»åid", allowableValues = "0,1,2") @RequestParam deviceTypeId: Byte, |
| | | ) = resPack { deviceService.findDevices(sceneId, Constant.DeviceType.fromValue(deviceTypeId)) } |
| | | |
| | | @ApiOperation("æ°å¢åºæ¯è®¾å¤ä¿¡æ¯") |
| | |
| | | @DeleteMapping("/{id}") |
| | | fun delete(@PathVariable id: String) = evaluationsubruleService.delete(id) |
| | | |
| | | @ApiOperation("æ ¹æ®è¯ä¼°æ»è§åæ¥è¯¢ä¸å±çåè§å") |
| | | @GetMapping("/byRule") |
| | | fun getByBaseRule( |
| | | @ApiParam("è¯ä¼°æ»è§å主é®id") @RequestParam id: String |
| | | ) = resPack { evaluationsubruleService.findByRuleId(id) } |
| | | |
| | | @ApiOperation("æ ¹æ®åºå¿ååºæ¯ç±»åæ¥è¯¢è¯ååè§å") |
| | | @GetMapping("/search") |
| | | fun search( |
| | |
| | | |
| | | import cn.flightfeather.supervision.domain.ds1.entity.Itemevaluation |
| | | import cn.flightfeather.supervision.lightshare.service.ItemevaluationService |
| | | import cn.flightfeather.supervision.lightshare.vo.AreaVo |
| | | import io.swagger.annotations.Api |
| | | import io.swagger.annotations.ApiOperation |
| | | import io.swagger.annotations.ApiParam |
| | | import org.springframework.web.bind.annotation.* |
| | | import springfox.documentation.annotations.ApiIgnore |
| | | import javax.servlet.http.HttpServletResponse |
| | | |
| | | @Api(tags = ["ItemevaluationController"], description = "è¯ä¼°å项å¾åAPIæ¥å£") |
| | | @RestController |
| | |
| | | |
| | | @DeleteMapping("/{id}") |
| | | fun delete (@PathVariable id: String) = itemevaluationService.delete(id) |
| | | |
| | | @ApiOperation(value = "æ°å¢å
·ä½è¯ä¼°ç»æ") |
| | | @PostMapping("/create") |
| | | fun createItemEvaluation( |
| | | @ApiParam(value = "å·¡æ¥ä»»å¡ä¸»é®id") @RequestParam subTaskId: String, |
| | | @ApiParam(value = "è¯ä¼°è§å主é®id", name = "2024.9.24ï¼ç®åæ éä¼ å
¥æ¤åæ°ï¼æ¬æ¥å£ç»ä¸ä¸ºèªå¨è¯ä¼°è§å") |
| | | @RequestParam(required = false) ruleId: String?, |
| | | @ApiParam(value = "å
·ä½æ£åæ¡ç®ä¸»é®ï¼åªä¼ æå°çº§å«çè¯ä¼°é¡¹ï¼") @RequestBody itemList: List<String>, |
| | | ) = resPack { itemevaluationService.createItemEvaluation(subTaskId, ruleId, itemList) } |
| | | |
| | | @ApiOperation(value = "æ´æ°å
·ä½è¯ä¼°ç»æ") |
| | | @PostMapping("/update") |
| | | fun updateItemEvaluation( |
| | | @ApiParam(value = "å·¡æ¥ä»»å¡ä¸»é®id") @RequestParam subTaskId: String, |
| | | @ApiParam(value = "è¯ä¼°è§å主é®id", name = "2024.9.24ï¼ç®åæ éä¼ å
¥æ¤åæ°ï¼æ¬æ¥å£ç»ä¸ä¸ºèªå¨è¯ä¼°è§å") |
| | | @RequestParam(required = false) ruleId: String?, |
| | | @ApiParam(value = "å
·ä½æ£åæ¡ç®ä¸»é®ï¼åªä¼ æå°çº§å«çè¯ä¼°é¡¹ï¼") @RequestBody itemList: List<String>, |
| | | ) = resPack { itemevaluationService.updateItemEvaluation(subTaskId, ruleId, itemList) } |
| | | } |
| | |
| | | import cn.flightfeather.supervision.domain.ds1.entity.Mediafile |
| | | import cn.flightfeather.supervision.lightshare.service.MediafileService |
| | | import io.swagger.annotations.Api |
| | | import io.swagger.annotations.ApiOperation |
| | | import io.swagger.annotations.ApiParam |
| | | import org.springframework.web.bind.annotation.* |
| | | import org.springframework.web.multipart.MultipartFile |
| | | |
| | |
| | | @GetMapping("/{id}") |
| | | fun getById(@PathVariable id:String) = mediafileService.findOne(id) |
| | | |
| | | @ApiOperation("æ ¹æ®ä¸å¡ç±»åè·åæä»¶") |
| | | @GetMapping("/{id}/{btid}") |
| | | fun getBySubtaskId(@PathVariable id:String,@PathVariable btid:String) = mediafileService.findBysubtaskbtid(id,btid) |
| | | fun getBySubtaskId( |
| | | @ApiParam("å·¡æ¥id") @PathVariable iGuid: String, |
| | | @ApiParam("æä»¶ä¸å¡ç±»åid", allowableValues = "") @PathVariable btid: String, |
| | | ) = mediafileService.findBysubtaskbtid(iGuid, btid) |
| | | |
| | | @ApiOperation("è·åææä»»ææå¸¸è§è®°å½å¾ç", notes = "éè¿å·¡æ¥è®°å½idæå·¡æ¥ä»»å¡idè·å对åºçææä»»ææå¾çï¼ä¸¤ä¸ªåæ°ä»»éå
¶ä¸å³å¯") |
| | | @GetMapping("/routine") |
| | | fun getRoutineRecord( |
| | | @ApiParam("å·¡æ¥è®°å½id", required = false) @RequestParam(required = false) iGuid: String?, |
| | | @ApiParam("å·¡æ¥ä»»å¡id", required = false) @RequestParam(required = false) stGuid: String?, |
| | | ) = resPack { mediafileService.getRoutineRecord(iGuid, stGuid) } |
| | | |
| | | @DeleteMapping("/{id}") |
| | | fun delete (@PathVariable id: String) = mediafileService.delete(id) |
| | | |
| | | @PostMapping("/add") |
| | | fun addProblem(@RequestParam("mediafileVoList") mediafileVoList: String, @RequestPart("Photos") files: Array<MultipartFile>) { |
| | | fun addProblem( |
| | | @RequestParam("mediafileVoList") mediafileVoList: String, |
| | | @RequestPart("Photos") files: Array<MultipartFile>, |
| | | ) { |
| | | mediafileService.addMedifile(mediafileVoList,files) |
| | | } |
| | | } |
| | |
| | | |
| | | @ApiOperation("æ´æ°ä¸ä¸ªé®é¢") |
| | | @PostMapping("/updateProblem") |
| | | fun updateDeviceLocation( |
| | | fun updateProblem( |
| | | @ApiParam("é®é¢ä¿¡æ¯json") @RequestParam("problem") problem: String, |
| | | @ApiParam("å é¤çé®é¢å¾çid") @RequestParam("deleteImg") deleteImg: List<String>, |
| | | @ApiParam("é®é¢å¾ç") @RequestPart("images") images: Array<MultipartFile>, |
| | |
| | | @RequestPart("images") files: Array<MultipartFile>, |
| | | ) = problemlistService.changeProblem(problemId, files) |
| | | |
| | | @ApiOperation("æ´æ°ä¸ä¸ªé®é¢æ´æ¹") |
| | | @PostMapping("/updateChange") |
| | | fun updateChange( |
| | | @ApiParam("é®é¢id") @RequestParam problemId: String, |
| | | @ApiParam("å é¤çæ´æ¹å¾çid") @RequestParam("deleteImg") deleteImg: List<String>, |
| | | @ApiParam("æ°å¢æ´æ¹å¾ç") @RequestPart("images") images: Array<MultipartFile>, |
| | | ) = resPack { problemlistService.updateChange(problemId, deleteImg, images) } |
| | | |
| | | @ApiOperation(value = "éè¿ä»»å¡æ¥æ¾é®é¢") |
| | | @GetMapping("/subtask") |
| | | fun getBySubTask( |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.flightfeather.supervision.lightshare.service.impl |
| | | |
| | | import cn.flightfeather.supervision.lightshare.service.MediafileService |
| | | import org.junit.Test |
| | | import org.junit.jupiter.api.extension.ExtendWith |
| | | import org.junit.runner.RunWith |
| | | import org.springframework.beans.factory.annotation.Autowired |
| | | import org.springframework.boot.test.context.SpringBootTest |
| | | import org.springframework.test.context.junit.jupiter.SpringExtension |
| | | import org.springframework.test.context.junit4.SpringRunner |
| | | |
| | | @RunWith(SpringRunner::class) |
| | | @ExtendWith(SpringExtension::class) |
| | | @SpringBootTest |
| | | class MediafileServiceImplTest { |
| | | |
| | | @Autowired |
| | | lateinit var mediafileService: MediafileService |
| | | |
| | | @Test |
| | | fun getRoutineRecord() { |
| | | val res = mediafileService.getRoutineRecord("CbF8jgcNonfKjo2M", null) |
| | | res.forEach { |
| | | print(it?.businesstypeid) |
| | | print(": ") |
| | | print(it?.businesstype) |
| | | println() |
| | | } |
| | | } |
| | | } |