From 84569abda51ecf6c5549dec4cadee8d043422379 Mon Sep 17 00:00:00 2001
From: feiyu02 <risaku@163.com>
Date: 星期二, 30 九月 2025 09:33:28 +0800
Subject: [PATCH] 2025.9.30

---
 src/main/kotlin/com/flightfeather/grid/service/impl/ClueTaskServiceImpl.kt |   46 ++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 46 insertions(+), 0 deletions(-)

diff --git a/src/main/kotlin/com/flightfeather/grid/service/impl/ClueTaskServiceImpl.kt b/src/main/kotlin/com/flightfeather/grid/service/impl/ClueTaskServiceImpl.kt
index 114e1db..142f99f 100644
--- a/src/main/kotlin/com/flightfeather/grid/service/impl/ClueTaskServiceImpl.kt
+++ b/src/main/kotlin/com/flightfeather/grid/service/impl/ClueTaskServiceImpl.kt
@@ -1,13 +1,20 @@
 package com.flightfeather.grid.service.impl
 
 import com.flightfeather.grid.config.exception.BizException
+import com.flightfeather.grid.constant.ConstantHttp
 import com.flightfeather.grid.domain.ds1.entity.ClueTask
 import com.flightfeather.grid.domain.ds1.mapper.ClueInternalMapper
 import com.flightfeather.grid.domain.ds1.mapper.ClueTaskMapper
 import com.flightfeather.grid.service.ClueTaskService
 import com.flightfeather.grid.vo.ClueInternalTaskVo
+import com.flightfeather.grid.vo.ClueTaskOptions
+import com.flightfeather.grid.vo.ClueTaskSummaryVo
+import com.flightfeather.grid.vo.DataHead
+import com.flightfeather.grid.web.responsePack
+import com.github.pagehelper.PageHelper
 import org.springframework.stereotype.Service
 import org.springframework.transaction.annotation.Transactional
+import tk.mybatis.mapper.entity.Example
 import java.util.*
 
 /**
@@ -39,6 +46,7 @@
         clueInternalTaskVo.clueTask?.createTime = Date()
         clueInternalTaskVo.clueTask?.updateTime = Date()
         clueInternalTaskVo.clueTask?.internalTask = true
+        clueInternalTaskVo.clueTask?.finished = false
         return clueTaskMapper.insert(clueInternalTaskVo.clueTask)
     }
 
@@ -49,6 +57,7 @@
         clueTask.createTime = Date()
         clueTask.updateTime = Date()
         clueTask.internalTask = false
+        clueTask.finished = false
         return clueTaskMapper.insert(clueTask)
     }
 
@@ -63,8 +72,45 @@
         return clueTaskMapper.select(clueTask)
     }
 
+    override fun searchClueTask(options: ClueTaskOptions, page: Int?, perPage: Int?): Pair<DataHead, List<ClueTask?>> {
+        val p = PageHelper.startPage<ClueTask>(
+            page ?: ConstantHttp.DEFAULT_PAGE_NUM,
+            perPage ?: ConstantHttp.DEFAULT_PAGE_SIZE
+        )
+        clueTaskMapper.selectByExample(Example(ClueTask::class.java).apply {
+            createCriteria().apply {
+                andEqualTo("internalTask", options.internal)
+                andGreaterThanOrEqualTo("taskTime", options.startTime)
+                andLessThanOrEqualTo("taskTime", options.endTime)
+                andEqualTo("provinceCode", options.provinceCode)
+                andEqualTo("provinceName", options.provinceName)
+                andEqualTo("cityCode", options.cityCode)
+                andEqualTo("cityName", options.cityName)
+                andEqualTo("districtCode", options.districtCode)
+                andEqualTo("districtName", options.districtName)
+                andEqualTo("townCode", options.townCode)
+                andEqualTo("townName", options.townName)
+                andEqualTo("finished", options.finished)
+            }
+            orderBy(options.sortBy ?: "taskTime").apply { if (options.sort == "desc") desc() else asc() }
+        })
+
+        return responsePack(p)
+    }
+
     override fun deleteClueTask(clueTask: ClueTask): Int {
         clueTask.guid ?: throw BizException("鍒犻櫎绾跨储浠诲姟澶辫触锛岀己灏戜换鍔′富閿甮uid")
         return clueTaskMapper.delete(clueTask)
     }
+
+    override fun getClueTaskSummary(options: ClueTaskOptions): ClueTaskSummaryVo {
+        return clueTaskMapper.selectSummaryCount(options)
+    }
+
+    override fun finishClueTask(clueTaskId: String): Int {
+        return clueTaskMapper.updateByPrimaryKeySelective(ClueTask().apply {
+            guid = clueTaskId
+            finished = true
+        })
+    }
 }
\ No newline at end of file

--
Gitblit v1.9.3