From 0392c333ed3d987cb2ab3dac4e1a972cff405f21 Mon Sep 17 00:00:00 2001
From: feiyu02 <risaku@163.com>
Date: 星期四, 25 四月 2024 17:42:08 +0800
Subject: [PATCH] 1. 新增后台任务关联模块 2. 新增自动评分后台任务; 3. 修复部分bug

---
 src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/EvaluationRuleRep.kt |   27 ++++++++++++++++++++++-----
 1 files changed, 22 insertions(+), 5 deletions(-)

diff --git a/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/EvaluationRuleRep.kt b/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/EvaluationRuleRep.kt
index 9014743..dd40759 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/EvaluationRuleRep.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/EvaluationRuleRep.kt
@@ -1,5 +1,6 @@
 package cn.flightfeather.supervision.domain.ds1.repository
 
+import cn.flightfeather.supervision.common.utils.Constant
 import cn.flightfeather.supervision.domain.ds1.entity.Evaluationrule
 import cn.flightfeather.supervision.domain.ds1.mapper.EvaluationruleMapper
 import cn.flightfeather.supervision.lightshare.vo.AreaEvaVo
@@ -10,7 +11,10 @@
  * 璇勪及瑙勫垯鏁版嵁搴撶浉鍏虫搷浣�
  */
 @Repository
-class EvaluationRuleRep(private val evaluationruleMapper: EvaluationruleMapper) {
+class EvaluationRuleRep(
+    private val evaluationruleMapper: EvaluationruleMapper,
+    private val sceneRep: SceneRep,
+) {
 
     /**
      * 鏍规嵁鍙傛暟鏌ヨ鎬昏鍒�
@@ -20,11 +24,24 @@
         return evaluationruleMapper.selectByExample(Example(Evaluationrule::class.java).apply {
             createCriteria().andEqualTo("tasktypeid", areaEvaVo.taskTypeId)
                 .andEqualTo("scensetypeid", areaEvaVo.scensetypeid)
-                .andEqualTo("provincecode", areaEvaVo.provincecode)
-                .andEqualTo("citycode", areaEvaVo.citycode)
-                .andEqualTo("districtcode", areaEvaVo.districtcode)
-                .andEqualTo("towncode", areaEvaVo.towncode)
                 .andEqualTo("isuse", true)
+            and(createCriteria().orEqualTo("provincecode", areaEvaVo.provincecode).orIsNull("provincecode"))
+            and(createCriteria().orEqualTo("citycode", areaEvaVo.citycode).orIsNull("citycode"))
+            and(createCriteria().orEqualTo("districtcode", areaEvaVo.districtcode).orIsNull("districtcode"))
+            and(createCriteria().orEqualTo("towncode", areaEvaVo.towncode).orIsNull("towncode"))
         })
     }
+
+    fun findAutoEvaluationRule(subTaskId:String): Evaluationrule? {
+        val scene = sceneRep.findBySubTask(subTaskId)
+        return findAutoEvaluationRule(Constant.SceneType.getByValue(scene?.typeid.toString()))
+    }
+
+    fun findAutoEvaluationRule(sceneType: Constant.SceneType): Evaluationrule? {
+        return evaluationruleMapper.selectOne(Evaluationrule().apply {
+            scensetypeid = sceneType.value.toByteOrNull()
+            tasktypeid = 99
+        })
+    }
+
 }
\ No newline at end of file

--
Gitblit v1.9.3