From 6c7f45871b93ef26d353a5a3596701ac2f39ed9c Mon Sep 17 00:00:00 2001
From: feiyu02 <risaku@163.com>
Date: 星期二, 10 九月 2024 17:48:27 +0800
Subject: [PATCH] 1. 新增问题更新接口

---
 src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/TaskServiceImpl.kt |   80 ++++++++++++++++++++++++++++-----------
 1 files changed, 57 insertions(+), 23 deletions(-)

diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/TaskServiceImpl.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/TaskServiceImpl.kt
index e80a61c..bc6354d 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/TaskServiceImpl.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/TaskServiceImpl.kt
@@ -8,10 +8,9 @@
 import cn.flightfeather.supervision.domain.ds1.mapper.TaskMapper
 import cn.flightfeather.supervision.common.utils.Constant
 import cn.flightfeather.supervision.common.utils.DateUtil
-import cn.flightfeather.supervision.lightshare.service.EvaluationService
-import cn.flightfeather.supervision.lightshare.service.SubtaskService
-import cn.flightfeather.supervision.lightshare.service.TaskService
-import cn.flightfeather.supervision.lightshare.service.UserinfoService
+import cn.flightfeather.supervision.domain.ds1.repository.SubTaskRep
+import cn.flightfeather.supervision.domain.ds1.repository.TaskRep
+import cn.flightfeather.supervision.lightshare.service.*
 import cn.flightfeather.supervision.lightshare.vo.*
 import org.springframework.beans.BeanUtils
 import org.springframework.beans.factory.annotation.Autowired
@@ -21,7 +20,11 @@
 import kotlin.collections.ArrayList
 
 @Service
-class TaskServiceImpl(val taskMapper: TaskMapper) : TaskService {
+class TaskServiceImpl(
+    val taskMapper: TaskMapper,
+    private val taskRep: TaskRep,
+    private val subTaskRep: SubTaskRep,
+) : TaskService {
 
     @Autowired
     lateinit var subtaskService: SubtaskService
@@ -180,7 +183,7 @@
         val example = Example(Task::class.java)
         val criteria = example.createCriteria()
         //gsguid涓嶄负绌轰负鏃ヤ换鍔�,鏃ヤ换鍔″紑濮嬫椂闂村拰缁撴潫鏃堕棿鍦ㄥ悓涓�澶�,杩囨护寮�濮嬫椂闂村氨ok
-        criteria.andEqualTo("starttime", dateUtil.StringToDate(date.substring(0, 10)))
+        criteria.andEqualTo("starttime", DateUtil.StringToDate(date.substring(0, 10)))
         criteria.andIsNotNull("tsguid")
         val tasklist = taskMapper.selectByExample(example)
         if (tasklist.isNotEmpty()) {
@@ -286,8 +289,6 @@
         return if (tasks.isEmpty()) Task() else tasks[0]
     }
 
-    val dateUtil = DateUtil()
-
     //鏍规嵁椤跺眰鍒楄〃,鏃ユ湡,鍜屾墽琛屼汉鍛業D锛岀敤鎴风被鍨嬭幏鍙栨棩浠诲姟
     override fun getDayTaskList(taskVoList: List<TaskVo>, date: String, guid: String, userType: String): List<TaskVo> {
         if (taskVoList.isEmpty()) return taskVoList
@@ -296,9 +297,9 @@
             val criteria = example.createCriteria()
             //鏋勯�犳煡璇㈡潯浠�
             criteria.andEqualTo("tsguid", it.tguid)
-            val dateTemo = dateUtil.StringToDate(date)
+            val dateTemo = DateUtil.StringToDate(date)
             //鏉′欢杩囨护
-            criteria.andBetween("starttime", dateTemo, dateUtil.addSecond(dateUtil.addMonth(dateTemo!!, 1)!!, 1))
+            criteria.andBetween("starttime", dateTemo, DateUtil.addSecond(DateUtil.addMonth(dateTemo!!, 1)!!, 1))
             if (userType == "1") {
                 criteria.andLike("executorguids", "%$guid%")
             }
@@ -378,9 +379,9 @@
             val criteria = example.createCriteria()
             //鏋勯�犳煡璇㈡潯浠�
             criteria.andEqualTo("tsguid", it.tguid)
-            val dateTemo = dateUtil.StringToDate(date)
+            val dateTemo = DateUtil.StringToDate(date)
             //鏉′欢杩囨护
-            criteria.andBetween("starttime", dateTemo, dateUtil.addSecond(dateUtil.addMonth(dateTemo!!, 1)!!, 1))
+            criteria.andBetween("starttime", dateTemo, DateUtil.addSecond(DateUtil.addMonth(dateTemo!!, 1)!!, 1))
             criteria.andLike("executorguids", "%$guid%")
             //鏍规嵁sql鏉′欢鏌ヨ
             val taskList = taskMapper.selectByExample(example)
@@ -401,10 +402,10 @@
         if (date.length < 7) {
             return taskVoList
         }
-        val startDate = DateUtil().StringToDate(date.substring(0, 7)) ?: return taskVoList
+        val startDate = DateUtil.StringToDate(date.substring(0, 7)) ?: return taskVoList
         //鏌ヨ涓�涓湀浠诲姟
-        var endDate = DateUtil().addMonth(startDate, 1) ?: return taskVoList
-        endDate = DateUtil().addSecond(endDate, -1)!!
+        var endDate = DateUtil.addMonth(startDate, 1) ?: return taskVoList
+        endDate = DateUtil.addSecond(endDate, -1)!!
         //鏋勯�犳煡璇㈡潯浠�
         val example = Example(Task::class.java)
         val criteria = example.createCriteria()
@@ -453,22 +454,22 @@
 //            return taskVoList
 //        }
 //        //鏃堕棿杞崲
-//        val d1 = DateUtil().StringToDate(date.substring(0, 7)) ?: return taskVoList
+//        val d1 = DateUtil.StringToDate(date.substring(0, 7)) ?: return taskVoList
 //        var startDate: Date? = null
 //        var endDate: Date? = null
 //        //鏍规嵁type绫诲瀷,寰楀埌瑕佹煡璇㈢殑鑼冨洿
 //        when (type) {
 //            "Middle" -> {
-//                startDate = DateUtil().addMonth(d1, -1);endDate = DateUtil().addMonth(d1, 2)
+//                startDate = DateUtil.addMonth(d1, -1);endDate = DateUtil.addMonth(d1, 2)
 //            }
 //            "Left" -> {
-//                startDate = DateUtil().addMonth(d1, -3);endDate = d1
+//                startDate = DateUtil.addMonth(d1, -3);endDate = d1
 //            }
 //            "Right" -> {
-//                startDate = DateUtil().addMonth(d1, 1);endDate = DateUtil().addMonth(d1, 4)
+//                startDate = DateUtil.addMonth(d1, 1);endDate = DateUtil.addMonth(d1, 4)
 //            }
 //            else -> {
-//                startDate = d1;endDate = DateUtil().addMonth(d1, 1)
+//                startDate = d1;endDate = DateUtil.addMonth(d1, 1)
 //            }
 //        }
 //
@@ -497,10 +498,10 @@
         if (date.length < 7) {
             return taskVoList
         }
-        val startDate = DateUtil().StringToDate(date.substring(0, 7)) ?: return taskVoList
+        val startDate = DateUtil.StringToDate(date.substring(0, 7)) ?: return taskVoList
         //鏌ヨ涓�涓湀浠诲姟
-        var endDate = DateUtil().addMonth(startDate, 1) ?: return taskVoList
-        endDate = DateUtil().addSecond(endDate, -1)!!
+        var endDate = DateUtil.addMonth(startDate, 1) ?: return taskVoList
+        endDate = DateUtil.addSecond(endDate, -1)!!
         //鏋勯�犳煡璇㈡潯浠�
         val example = Example(Task::class.java)
         val criteria = example.createCriteria()
@@ -725,4 +726,37 @@
         return taskProgressVolist
     }
 
+    override fun findTask(areaVo: AreaVo): List<Task?> {
+        return taskRep.findTasks(areaVo)
+    }
+
+    override fun findTaskProgress(areaVo: AreaVo): List<TaskProgressVo?> {
+        val res = mutableListOf<TaskProgressVo?>()
+        taskRep.findTasks(areaVo).forEach {t->
+            if (t?.tguid == null) return@forEach
+            val pro = TaskProgressVo().apply {
+                tguid = t.tguid
+                name = t.name
+                levelnum = t.levelnum
+                provinceCode = t.provincecode
+                provinceName = t.provincename
+                cityCode = t.citycode
+                cityName = t.cityname
+                districtCode = t.districtcode
+                districtName = t.districtname
+                townCode = t.towncode
+                townName = t.townname
+                var count = 0
+                taskRep.findMonitorList(t.tguid!!, areaVo.scensetypeid).forEach {
+                    val c = if (it.extension1 != null) it.extension1!!.toInt() else 1
+                    count += c
+                }
+                totaltask = count
+                subTaskSummary = subTaskRep.findSummary(areaVo)
+                completetask = this.subTaskSummary?.size
+            }
+            res.add(pro)
+        }
+        return res
+    }
 }
\ No newline at end of file

--
Gitblit v1.9.3