From f565fbc09724992d53ec6632c3e5d1de3325f328 Mon Sep 17 00:00:00 2001
From: feiyu02 <risaku@163.com>
Date: 星期四, 11 一月 2024 17:33:44 +0800
Subject: [PATCH] 1. 调整返回接口的异常捕获类为自定义异常类; 2. 修改AreaVo类中时间参数的类型; 3. 新增文档生成任务类型,并新增文档后台生成任务逻辑;

---
 src/main/kotlin/cn/flightfeather/supervision/common/executor/BgTaskType.kt                      |    5 
 src/main/kotlin/cn/flightfeather/supervision/common/executor/BgTaskStatus.kt                    |    3 
 src/main/kotlin/cn/flightfeather/supervision/lightshare/service/EvaluationService.kt            |    4 
 src/main/resources/application-pro.yml                                                          |    3 
 src/main/kotlin/cn/flightfeather/supervision/business/bgtask/ReportTaskCtrl.kt                  |   41 ++++++
 src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/EvaluationServiceImpl.kt   |  104 +++++++++++++----
 src/test/kotlin/cn/flightfeather/supervision/CommonTest.kt                                      |   15 ++
 src/main/kotlin/cn/flightfeather/supervision/common/executor/BackgroundTaskCtrl.kt              |   29 ++--
 src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/BgTaskServiceImpl.kt       |   11 +
 src/main/kotlin/cn/flightfeather/supervision/lightshare/web/EvaluationController.kt             |    7 +
 src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/EvaluationRuleRep.kt         |    8 
 src/main/resources/application-dev.yml                                                          |    3 
 src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/ProblemlistServiceImpl.kt  |   11 +
 src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/UserMapServiceImpl.kt      |    3 
 src/main/kotlin/cn/flightfeather/supervision/business/autooutput/datasource/AopDataSource.kt    |    3 
 src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/AopCreditCode.kt         |    3 
 src/main/kotlin/cn/flightfeather/supervision/domain/ds2/repository/ComplaintAndPunishmentRep.kt |   14 ++
 src/main/resources/application-test.yml                                                         |    3 
 src/main/kotlin/cn/flightfeather/supervision/business/bgtask/AopTaskCtrl.kt                     |   11 +
 src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/TaskRep.kt                   |    4 
 src/main/kotlin/cn/flightfeather/supervision/common/exception/ResponseErrorException.kt         |   13 ++
 src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/ComplaintServiceImpl.kt    |    3 
 src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/AreaVo.kt                            |   10 +
 src/main/kotlin/cn/flightfeather/supervision/lightshare/web/BaseResPack.kt                      |    3 
 src/main/kotlin/cn/flightfeather/supervision/business/report/DataSource.kt                      |    2 
 src/main/kotlin/cn/flightfeather/supervision/business/report/BaseTemplateMulti.kt               |    3 
 src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/SearchServiceImpl.kt       |    7 
 27 files changed, 255 insertions(+), 71 deletions(-)

diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/datasource/AopDataSource.kt b/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/datasource/AopDataSource.kt
index 20fcc11..f557b32 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/datasource/AopDataSource.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/datasource/AopDataSource.kt
@@ -1,5 +1,6 @@
 package cn.flightfeather.supervision.business.autooutput.datasource
 
+import cn.flightfeather.supervision.common.exception.ResponseErrorException
 import cn.flightfeather.supervision.common.utils.Constant
 import cn.flightfeather.supervision.domain.ds1.entity.*
 import cn.flightfeather.supervision.domain.ds2.entity.LedgerRecord
@@ -85,7 +86,7 @@
 
     // 浠庣洃绠$郴缁熻幏鍙栧満鏅�
     private fun initSceneSource(config: AopDataConfig) {
-        config.topTaskGuid ?: throw IllegalStateException("椤跺眰浠诲姟id涓嶈兘涓簄ull")
+        config.topTaskGuid ?: throw ResponseErrorException("椤跺眰浠诲姟id涓嶈兘涓簄ull")
         this.config = config
         this.mode = 0
         sceneSourceList.clear()
diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/AopCreditCode.kt b/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/AopCreditCode.kt
index 4bfc770..6bff41d 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/AopCreditCode.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/score/AopCreditCode.kt
@@ -1,6 +1,7 @@
 package cn.flightfeather.supervision.business.autooutput.score
 
 import cn.flightfeather.supervision.business.autooutput.datasource.AopDataConfig
+import cn.flightfeather.supervision.common.exception.ResponseErrorException
 import cn.flightfeather.supervision.common.utils.Constant
 import cn.flightfeather.supervision.domain.ds1.repository.EvaluationRep
 import cn.flightfeather.supervision.domain.ds2.entity.UserinfoTZ
@@ -22,7 +23,7 @@
 ) {
 
     fun execute(config: AopDataConfig) {
-        if (config.year == null || config.month == null) throw IllegalStateException("鐜俊鐮佽瘎浼版椂蹇呴』浼犻�掓椂闂存潯浠�!")
+        if (config.year == null || config.month == null) throw ResponseErrorException("鐜俊鐮佽瘎浼版椂蹇呴』浼犻�掓椂闂存潯浠�!")
         // 鎵惧埌椋炵窘鐜涓渶瑕佺敓鎴愮幆淇$爜鐨勬墍鏈夌珯鐐�
         val sceneType = Constant.SceneType.getByValue(config.sceneType.toString())
         val userList = findUsers(config.districtName, sceneType)
diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/AopTaskCtrl.kt b/src/main/kotlin/cn/flightfeather/supervision/business/bgtask/AopTaskCtrl.kt
similarity index 87%
rename from src/main/kotlin/cn/flightfeather/supervision/business/autooutput/AopTaskCtrl.kt
rename to src/main/kotlin/cn/flightfeather/supervision/business/bgtask/AopTaskCtrl.kt
index c013604..bd04aa1 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/business/autooutput/AopTaskCtrl.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/business/bgtask/AopTaskCtrl.kt
@@ -1,9 +1,10 @@
-package cn.flightfeather.supervision.business.autooutput
+package cn.flightfeather.supervision.business.bgtask
 
 import cn.flightfeather.supervision.business.autooutput.dataanalysis.*
 import cn.flightfeather.supervision.business.autooutput.datasource.AopDataConfig
 import cn.flightfeather.supervision.business.autooutput.score.AopCreditCode
 import cn.flightfeather.supervision.business.autooutput.score.AopEvaluation
+import cn.flightfeather.supervision.common.exception.ResponseErrorException
 import cn.flightfeather.supervision.common.executor.BackgroundTaskCtrl
 import cn.flightfeather.supervision.common.executor.BgTaskStatus
 import cn.flightfeather.supervision.common.executor.BgTaskType
@@ -11,7 +12,6 @@
 import cn.flightfeather.supervision.domain.ds1.repository.TaskRep
 import cn.flightfeather.supervision.lightshare.vo.AreaVo
 import org.springframework.stereotype.Component
-import java.time.LocalDate
 
 /**
  * 鑷姩璇勪及浠诲姟绠$悊
@@ -45,10 +45,11 @@
         if (taskId != null) {
             val districtCode = areaVo.districtcode
             val districtName = areaVo.districtname
-            val d = LocalDate.parse(areaVo.starttime)
+//            val d = LocalDateTime.parse(areaVo.starttime, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))
+            val d = areaVo.starttime ?: throw ResponseErrorException("鑷姩璇勪及浠诲姟蹇呴』璁惧畾鏃堕棿")
             val year = d.year
             val month = d.monthValue
-            val sceneType = areaVo.scensetypeid?.toInt() ?: throw IllegalStateException("鍦烘櫙绫诲瀷鏈缃紝鏃犳硶璇勪及")
+            val sceneType = areaVo.scensetypeid?.toInt() ?: throw ResponseErrorException("鍦烘櫙绫诲瀷鏈缃紝鏃犳硶璇勪及")
 
             val id = "${BgTaskType.AUTO_SCORE.name}-${districtCode}-${sceneType}"
             val name = "${districtName}${Constant.SceneType.getDes(sceneType)}鑷姩璇勫垎"
@@ -68,7 +69,7 @@
             }
             return bgTask.taskStatus
         } else {
-            throw IllegalStateException("宸℃煡鎬讳换鍔′笉瀛樺湪锛屾棤娉曡瘎浼�")
+            throw ResponseErrorException("宸℃煡鎬讳换鍔′笉瀛樺湪锛屾棤娉曡瘎浼�")
         }
     }
 
diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/bgtask/ReportTaskCtrl.kt b/src/main/kotlin/cn/flightfeather/supervision/business/bgtask/ReportTaskCtrl.kt
new file mode 100644
index 0000000..3c126f5
--- /dev/null
+++ b/src/main/kotlin/cn/flightfeather/supervision/business/bgtask/ReportTaskCtrl.kt
@@ -0,0 +1,41 @@
+package cn.flightfeather.supervision.business.bgtask
+
+import cn.flightfeather.supervision.business.report.BaseExcel
+import cn.flightfeather.supervision.business.report.DataSource
+import cn.flightfeather.supervision.business.report.DbMapper
+import cn.flightfeather.supervision.business.report.file.ReportOne
+import cn.flightfeather.supervision.business.report.file.ReportThree
+import cn.flightfeather.supervision.business.report.file.ReportTwo
+import cn.flightfeather.supervision.common.executor.BackgroundTaskCtrl
+import cn.flightfeather.supervision.common.executor.BgTaskStatus
+import cn.flightfeather.supervision.common.executor.BgTaskType
+import cn.flightfeather.supervision.lightshare.vo.ExcelConfigVo
+import org.springframework.beans.factory.annotation.Value
+import org.springframework.stereotype.Component
+import java.io.File
+import java.net.URLEncoder
+
+/**
+ * 鑷姩鐢熸垚鎶ュ憡浠诲姟绠$悊
+ */
+@Component
+class ReportTaskCtrl(
+    private val backgroundTaskCtrl: BackgroundTaskCtrl,
+    private val dbMapper: DbMapper,
+    @Value("\${filePath}") private val filePath: String,
+) {
+
+    fun startTask(baseExcel: BaseExcel, downloadUrl: String): BgTaskStatus {
+        val id =
+            "${BgTaskType.DOCUMENT.name}-${baseExcel.dataSource.config.districtCode}-${baseExcel.dataSource.config.sceneType}"
+        val taskName = baseExcel.getReportName()
+        val bgTask = backgroundTaskCtrl.startNewTask(BgTaskType.DOCUMENT, id, taskName) {
+            val p = "$filePath/autoscore/"
+            baseExcel.toFile(p)
+            true
+        }
+        bgTask.taskStatus.extra = downloadUrl
+        return bgTask.taskStatus
+    }
+
+}
\ No newline at end of file
diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/report/BaseTemplateMulti.kt b/src/main/kotlin/cn/flightfeather/supervision/business/report/BaseTemplateMulti.kt
index 4ff70ed..6ac0c6a 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/business/report/BaseTemplateMulti.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/business/report/BaseTemplateMulti.kt
@@ -1,5 +1,6 @@
 package cn.flightfeather.supervision.business.report
 
+import cn.flightfeather.supervision.common.exception.ResponseErrorException
 import cn.flightfeather.supervision.common.utils.Constant
 import cn.flightfeather.supervision.common.utils.DateUtil
 import cn.flightfeather.supervision.common.utils.ExcelUtil
@@ -31,7 +32,7 @@
 
 
     open fun execute() {
-        if (dataSourceList.isEmpty()) throw IllegalStateException("${templateName}: 鏁版嵁婧愪负绌�")
+        if (dataSourceList.isEmpty()) throw ResponseErrorException("${templateName}: 鏁版嵁婧愪负绌�")
         //鍚堟垚琛ㄥご
         cols.forEach {
             it.combineHead(head, dataSourceList[0])
diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/report/DataSource.kt b/src/main/kotlin/cn/flightfeather/supervision/business/report/DataSource.kt
index 063368b..d334b56 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/business/report/DataSource.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/business/report/DataSource.kt
@@ -11,6 +11,7 @@
 import cn.flightfeather.supervision.domain.ds2.mapper.LedgerSubTypeMapper
 import cn.flightfeather.supervision.domain.ds2.mapper.UserMapMapper
 import cn.flightfeather.supervision.lightshare.vo.ExcelConfigVo
+import org.springframework.stereotype.Component
 import tk.mybatis.mapper.entity.Example
 import java.time.LocalDateTime
 import java.time.ZoneId
@@ -390,6 +391,7 @@
     }
 }
 
+@Component
 data class DbMapper(
     val scenseMapper: ScenseMapper,
     val problemlistMapper: ProblemlistMapper,
diff --git a/src/main/kotlin/cn/flightfeather/supervision/common/exception/ResponseErrorException.kt b/src/main/kotlin/cn/flightfeather/supervision/common/exception/ResponseErrorException.kt
new file mode 100644
index 0000000..e01d06e
--- /dev/null
+++ b/src/main/kotlin/cn/flightfeather/supervision/common/exception/ResponseErrorException.kt
@@ -0,0 +1,13 @@
+package cn.flightfeather.supervision.common.exception
+
+/**
+ * 鍏佽鎺ュ彛杩斿洖鐨勪笟鍔″眰闈㈢殑閿欒
+ */
+class ResponseErrorException : Exception {
+    constructor():super()
+    constructor(message: String) : super(message)
+    constructor(message: String, cause: Throwable) : super(message, cause)
+    constructor(cause: Throwable) : super(cause)
+    constructor(message: String, cause: Throwable, enableSuppression: Boolean, writableStackTrace: Boolean)
+            : super(message, cause, enableSuppression, writableStackTrace)
+}
\ No newline at end of file
diff --git a/src/main/kotlin/cn/flightfeather/supervision/common/executor/BackgroundTaskCtrl.kt b/src/main/kotlin/cn/flightfeather/supervision/common/executor/BackgroundTaskCtrl.kt
index 72423b9..a7c6250 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/common/executor/BackgroundTaskCtrl.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/common/executor/BackgroundTaskCtrl.kt
@@ -1,5 +1,6 @@
 package cn.flightfeather.supervision.common.executor
 
+import cn.flightfeather.supervision.common.exception.ResponseErrorException
 import org.springframework.stereotype.Component
 import java.time.LocalDateTime
 import java.util.concurrent.ConcurrentHashMap
@@ -20,13 +21,13 @@
     /**
      * 鏂板浠诲姟
      */
-    @Throws(IllegalStateException::class)
+    @Throws(ResponseErrorException::class)
     fun newTask(type: BgTaskType, id: String, name: String, task: () -> Boolean): BgTask {
         if (!taskCollection.containsKey(type)) {
             taskCollection[type] = ConcurrentHashMap<String, BgTask>()
         }
         val taskSet = taskCollection[type]!!
-        if (taskSet.containsKey(id)) throw IllegalStateException("鏃犳硶鍒涘缓浠诲姟锛� 浠诲姟[${name}]鐨刬d閲嶅")
+        if (taskSet.containsKey(id)) throw ResponseErrorException("鏃犳硶鍒涘缓浠诲姟锛� 浠诲姟[${name}]鐨刬d閲嶅")
         val t = BgTask(type, id, name, task)
         taskSet[id] = t
         return t
@@ -35,20 +36,20 @@
     /**
      * 寮�濮嬩换鍔�
      */
-    @Throws(IllegalStateException::class)
+    @Throws(ResponseErrorException::class)
     fun startTask(type: BgTaskType, id: String): BgTask {
-        val taskSet = taskCollection[type] ?: throw throw IllegalStateException("鏃犳硶寮�鍚换鍔★紝璇ヤ换鍔$被鍨媅${type.des}]涓嶅瓨鍦�")
-        val t = taskSet[id] ?: throw IllegalStateException("鏃犳硶寮�鍚换鍔★紝璇ヤ换鍔${id}]涓嶅瓨鍦�")
+        val taskSet = taskCollection[type] ?: throw throw ResponseErrorException("鏃犳硶寮�鍚换鍔★紝璇ヤ换鍔$被鍨媅${type.des}]涓嶅瓨鍦�")
+        val t = taskSet[id] ?: throw ResponseErrorException("鏃犳硶寮�鍚换鍔★紝璇ヤ换鍔${id}]涓嶅瓨鍦�")
         return startTask(t)
     }
 
-    @Throws(IllegalStateException::class)
+    @Throws(ResponseErrorException::class)
     fun startTask(task: BgTask): BgTask {
         if (task.taskStatus.status != TaskStatus.WAITING) {
             if (task.taskStatus.status == TaskStatus.RUNNING) {
-                throw IllegalStateException("鏃犳硶寮�鍚换鍔★紝浠诲姟[${task.name}]姝e湪鎵ц")
+                throw ResponseErrorException("鏃犳硶寮�鍚换鍔★紝浠诲姟[${task.name}]姝e湪鎵ц")
             } else {
-                throw IllegalStateException("鏃犳硶寮�鍚换鍔★紝浠诲姟[${task.name}]宸茬粨鏉�")
+                throw ResponseErrorException("鏃犳硶寮�鍚换鍔★紝浠诲姟[${task.name}]宸茬粨鏉�")
             }
         } else {
             task.ready()
@@ -60,7 +61,7 @@
     /**
      * 鏂板骞跺紑濮嬩换鍔�
      */
-    @Throws(IllegalStateException::class)
+    @Throws(ResponseErrorException::class)
     fun startNewTask(type: BgTaskType, id: String, name: String, task: () -> Boolean): BgTask {
         val t = newTask(type, id, name, task)
         return startTask(t)
@@ -95,11 +96,11 @@
     /**
      * 寮哄埗鍏抽棴浠诲姟
      */
-    @Throws(IllegalStateException::class)
+    @Throws(ResponseErrorException::class)
     fun shutDownTask(type: BgTaskType, id: String?): List<BgTaskStatus?> {
-        val taskMap = taskCollection[type] ?: throw IllegalStateException("鏃犳硶鍏抽棴浠诲姟锛屼换鍔$被鍨媅${type.des}]鏈垱寤�")
+        val taskMap = taskCollection[type] ?: throw ResponseErrorException("鏃犳硶鍏抽棴浠诲姟锛屼换鍔$被鍨媅${type.des}]鏈垱寤�")
         return if (id != null) {
-            val task = taskMap[id] ?: throw IllegalStateException("鏃犳硶鍏抽棴浠诲姟锛屼换鍔${id}]涓嶅瓨鍦�")
+            val task = taskMap[id] ?: throw ResponseErrorException("鏃犳硶鍏抽棴浠诲姟锛屼换鍔${id}]涓嶅瓨鍦�")
             task.shutdown()
             listOf(task.taskStatus)
         } else {
@@ -112,11 +113,11 @@
         }
     }
 
-    @Throws(IllegalStateException::class)
+    @Throws(ResponseErrorException::class)
     fun removeTask(type: BgTaskType, id: String): Boolean {
         val statusList = shutDownTask(type, id)
         if (statusList.isNotEmpty()) {
-            val s = statusList.first() ?: throw IllegalStateException("鏃犳硶绉婚櫎浠诲姟锛屼换鍔′笉瀛樺湪")
+            val s = statusList.first() ?: throw ResponseErrorException("鏃犳硶绉婚櫎浠诲姟锛屼换鍔′笉瀛樺湪")
             taskCollection[s.type]?.remove(s.id)
             return true
         }
diff --git a/src/main/kotlin/cn/flightfeather/supervision/common/executor/BgTaskStatus.kt b/src/main/kotlin/cn/flightfeather/supervision/common/executor/BgTaskStatus.kt
index 22d6fa9..60bfcf4 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/common/executor/BgTaskStatus.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/common/executor/BgTaskStatus.kt
@@ -45,6 +45,9 @@
             }
         }
 
+    // 棰濆鑷畾涔夐檮甯︿俊鎭�
+    var extra: Any? = null
+
 }
 
 enum class TaskStatus {
diff --git a/src/main/kotlin/cn/flightfeather/supervision/common/executor/BgTaskType.kt b/src/main/kotlin/cn/flightfeather/supervision/common/executor/BgTaskType.kt
index d1b471f..85b0bf5 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/common/executor/BgTaskType.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/common/executor/BgTaskType.kt
@@ -4,7 +4,9 @@
     //娴嬭瘯浠诲姟
     TEST(0, "娴嬭瘯浠诲姟"),
     //鑷姩璇勫垎
-    AUTO_SCORE(1, "鑷姩璇勪及浠诲姟");
+    AUTO_SCORE(1, "鑷姩璇勪及浠诲姟"),
+    //鏂囨。鐢熸垚
+    DOCUMENT(2, "鐢熸垚鏂囨。浠诲姟");
 
 
     companion object {
@@ -13,6 +15,7 @@
             return when (index) {
                 TEST.index -> TEST
                 AUTO_SCORE.index -> AUTO_SCORE
+                DOCUMENT.index -> DOCUMENT
                 else -> null
             }
         }
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..30fbccc 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
@@ -20,11 +20,11 @@
         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"))
         })
     }
 }
\ No newline at end of file
diff --git a/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/TaskRep.kt b/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/TaskRep.kt
index 8dba496..14eccea 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/TaskRep.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/repository/TaskRep.kt
@@ -5,7 +5,9 @@
 import cn.flightfeather.supervision.lightshare.vo.AreaVo
 import org.springframework.stereotype.Repository
 import java.time.LocalDate
+import java.time.LocalDateTime
 import java.time.ZoneId
+import java.time.format.DateTimeFormatter
 import java.util.*
 
 @Repository
@@ -13,7 +15,7 @@
 
     private fun exampleTask(areaVo: AreaVo): Task?{
         areaVo.starttime ?: return null
-        val mStart = LocalDate.parse(areaVo.starttime).withDayOfMonth(1).atStartOfDay()
+        val mStart = areaVo.starttime!!.withDayOfMonth(1).withHour(0).withMinute(0).withSecond(0)
         val mEnd = mStart.plusMonths(1).minusSeconds(1)
         return Task().apply {
             provincecode = areaVo.provincecode
diff --git a/src/main/kotlin/cn/flightfeather/supervision/domain/ds2/repository/ComplaintAndPunishmentRep.kt b/src/main/kotlin/cn/flightfeather/supervision/domain/ds2/repository/ComplaintAndPunishmentRep.kt
index 3c60c11..a5f7ef2 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/domain/ds2/repository/ComplaintAndPunishmentRep.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/domain/ds2/repository/ComplaintAndPunishmentRep.kt
@@ -6,6 +6,8 @@
 import cn.flightfeather.supervision.lightshare.vo.ComplaintVo
 import cn.flightfeather.supervision.lightshare.vo.PunishmentVo
 import org.springframework.stereotype.Repository
+import java.time.LocalDateTime
+import java.time.format.DateTimeFormatter
 import java.util.*
 
 /**
@@ -30,6 +32,12 @@
         return findComplaint(tzUserIdList, s, e)
     }
 
+    fun findComplaint(tzUserIdList: List<String?>, sTime: LocalDateTime?, eTime: LocalDateTime?): List<ComplaintVo?> {
+        val s = sTime?.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))
+        val e = eTime?.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))
+        return findComplaint(tzUserIdList, s, e)
+    }
+
     fun findComplaint(tzUserIdList: List<String?>, sTime: String?, eTime: String?): List<ComplaintVo?> {
         return complaintMapper.findComplaint(tzUserIdList, sTime, eTime)
     }
@@ -44,6 +52,12 @@
         return findPunishment(tzUserIdList, s, e)
     }
 
+    fun findPunishment(tzUserIdList: List<String?>, sTime: LocalDateTime?, eTime: LocalDateTime?): List<PunishmentVo?> {
+        val s = sTime?.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))
+        val e = eTime?.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))
+        return findPunishment(tzUserIdList, s, e)
+    }
+
     fun findPunishment(tzUserIdList: List<String?>, sTime: String?, eTime: String?): List<PunishmentVo?> {
         return punishmentMapper.findPunishment(tzUserIdList, sTime, eTime)
     }
diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/EvaluationService.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/EvaluationService.kt
index dd4b9d3..4fc2723 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/EvaluationService.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/EvaluationService.kt
@@ -7,6 +7,8 @@
 import cn.flightfeather.supervision.lightshare.vo.AutoScoreResultVo
 import cn.flightfeather.supervision.lightshare.vo.BaseResponse
 import cn.flightfeather.supervision.lightshare.vo.EvaluateResVo
+import springfox.documentation.annotations.ApiIgnore
+import javax.servlet.http.HttpServletResponse
 
 
 interface EvaluationService {
@@ -39,4 +41,6 @@
     fun autoEvaluate(areaVo: AreaVo): BgTaskStatus?
 
     fun findAutoEvaluation(areaVo: AreaVo): List<AutoScoreResultVo?>?
+
+    fun downloadAutoEvaluation(areaVo: AreaVo, response: HttpServletResponse): Boolean
 }
\ No newline at end of file
diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/BgTaskServiceImpl.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/BgTaskServiceImpl.kt
index 613e021..fedcdf2 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/BgTaskServiceImpl.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/BgTaskServiceImpl.kt
@@ -1,5 +1,6 @@
 package cn.flightfeather.supervision.lightshare.service.impl
 
+import cn.flightfeather.supervision.common.exception.ResponseErrorException
 import cn.flightfeather.supervision.common.executor.BackgroundTaskCtrl
 import cn.flightfeather.supervision.common.executor.BgTaskConditionVo
 import cn.flightfeather.supervision.common.executor.BgTaskStatus
@@ -15,21 +16,21 @@
     }
 
     override fun startTask(condition: BgTaskConditionVo): BgTaskStatus? {
-        condition.type ?: throw IllegalStateException("浠诲姟绫诲瀷涓嶈兘涓虹┖")
-        condition.id ?: throw IllegalStateException("浠诲姟id涓嶈兘涓虹┖")
+        condition.type ?: throw ResponseErrorException("浠诲姟绫诲瀷涓嶈兘涓虹┖")
+        condition.id ?: throw ResponseErrorException("浠诲姟id涓嶈兘涓虹┖")
 
         val task = backgroundTaskCtrl.startTask(condition.type!!, condition.id!!)
         return task.taskStatus
     }
 
     override fun shutDownTask(condition: BgTaskConditionVo): List<BgTaskStatus?> {
-        condition.type ?: throw IllegalStateException("浠诲姟绫诲瀷涓嶈兘涓虹┖")
+        condition.type ?: throw ResponseErrorException("浠诲姟绫诲瀷涓嶈兘涓虹┖")
         return backgroundTaskCtrl.shutDownTask(condition.type!!, condition.id)
     }
 
     override fun removeTask(condition: BgTaskConditionVo): Boolean {
-        condition.type ?: throw IllegalStateException("浠诲姟绫诲瀷涓嶈兘涓虹┖")
-        condition.id ?: throw IllegalStateException("浠诲姟id涓嶈兘涓虹┖")
+        condition.type ?: throw ResponseErrorException("浠诲姟绫诲瀷涓嶈兘涓虹┖")
+        condition.id ?: throw ResponseErrorException("浠诲姟id涓嶈兘涓虹┖")
         return backgroundTaskCtrl.removeTask(condition.type!!, condition.id!!)
     }
 
diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/ComplaintServiceImpl.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/ComplaintServiceImpl.kt
index f56a1a1..3c7a1bd 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/ComplaintServiceImpl.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/ComplaintServiceImpl.kt
@@ -1,5 +1,6 @@
 package cn.flightfeather.supervision.lightshare.service.impl
 
+import cn.flightfeather.supervision.common.exception.ResponseErrorException
 import cn.flightfeather.supervision.domain.ds1.repository.SceneRep
 import cn.flightfeather.supervision.domain.ds1.repository.TaskRep
 import cn.flightfeather.supervision.domain.ds1.repository.UserInfoSVRep
@@ -36,7 +37,7 @@
             }
             //浠ラ缇界洃绠$郴缁熶腑鐨勭敤鎴蜂负涓讳綋
             2 -> {
-                val task = taskRep.findOneTask(areaVo) ?: throw IllegalStateException("褰撳墠鏌ヨ鏉′欢涓嬫湭鎵惧埌瀵瑰簲椤跺眰浠诲姟")
+                val task = taskRep.findOneTask(areaVo) ?: throw ResponseErrorException("褰撳墠鏌ヨ鏉′欢涓嬫湭鎵惧埌瀵瑰簲椤跺眰浠诲姟")
                 val scenes = sceneRep.findScene(task.tguid!!, areaVo.scensetypeid?.toInt(), areaVo.towncode)
                     .map { it?.guid }
                 val idList = userInfoSVRep.findUser(scenes).map { it?.guid }
diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/EvaluationServiceImpl.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/EvaluationServiceImpl.kt
index b7db654..22a8fea 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/EvaluationServiceImpl.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/EvaluationServiceImpl.kt
@@ -1,11 +1,16 @@
 package cn.flightfeather.supervision.lightshare.service.impl
 
 import cn.flightfeather.supervision.business.AutoScore2
-import cn.flightfeather.supervision.business.autooutput.AopTaskCtrl
+import cn.flightfeather.supervision.business.bgtask.AopTaskCtrl
 import cn.flightfeather.supervision.business.autooutput.score.AopEvaluation
-import cn.flightfeather.supervision.common.executor.BackgroundTaskCtrl
+import cn.flightfeather.supervision.business.bgtask.ReportTaskCtrl
+import cn.flightfeather.supervision.business.report.DataSource
+import cn.flightfeather.supervision.business.report.DbMapper
+import cn.flightfeather.supervision.business.report.file.ReportOne
+import cn.flightfeather.supervision.business.report.file.ReportThree
+import cn.flightfeather.supervision.business.report.file.ReportTwo
+import cn.flightfeather.supervision.common.exception.ResponseErrorException
 import cn.flightfeather.supervision.common.executor.BgTaskStatus
-import cn.flightfeather.supervision.common.executor.BgTaskType
 import cn.flightfeather.supervision.domain.ds1.entity.Domainitem
 import cn.flightfeather.supervision.domain.ds1.entity.Evaluation
 import cn.flightfeather.supervision.domain.ds1.entity.Subtask
@@ -18,15 +23,17 @@
 import cn.flightfeather.supervision.domain.ds1.repository.EvaluationRep
 import cn.flightfeather.supervision.domain.ds1.repository.TaskRep
 import cn.flightfeather.supervision.lightshare.service.EvaluationService
+import cn.flightfeather.supervision.lightshare.service.SearchService
 import cn.flightfeather.supervision.lightshare.service.SubtaskService
-import cn.flightfeather.supervision.lightshare.vo.AreaVo
-import cn.flightfeather.supervision.lightshare.vo.AutoScoreResultVo
-import cn.flightfeather.supervision.lightshare.vo.BaseResponse
-import cn.flightfeather.supervision.lightshare.vo.EvaluateResVo
+import cn.flightfeather.supervision.lightshare.vo.*
 import org.springframework.beans.factory.annotation.Autowired
+import org.springframework.beans.factory.annotation.Value
 import org.springframework.stereotype.Service
 import tk.mybatis.mapper.entity.Example
+import java.io.File
+import java.net.URLEncoder
 import java.util.*
+import javax.servlet.http.HttpServletResponse
 import kotlin.Comparator
 
 @Service
@@ -35,14 +42,21 @@
     private val evaluationRep: EvaluationRep,
     private val taskRep: TaskRep,
     private val aopTaskCtrl: AopTaskCtrl,
+    private val searchService: SearchService,
+    private val dbMapper: DbMapper,
+    @Value("\${filePath}") private val filePath: String,
+    private val reportTaskCtrl: ReportTaskCtrl,
 ) : EvaluationService {
 
     @Autowired
     lateinit var subtaskService: SubtaskService
+
     @Autowired
     lateinit var domainitemMapper: DomainitemMapper
+
     @Autowired
     lateinit var subtaskMapper: SubtaskMapper
+
     @Autowired
     lateinit var aopEvaluation: AopEvaluation
     private var isAutoScoreRunning = false
@@ -53,12 +67,13 @@
         var areaVolist = mutableListOf<EvaluateResVo>()
         //鑰冩牳绫诲瀷鏄鑼冭�冩牳
         if (evaluationlist.isNotEmpty() &&
-                Objects.equals(evaluationlist.get(0).ertype, Constant.RuleType.STANDARD.value)) {
+            Objects.equals(evaluationlist.get(0).ertype, Constant.RuleType.STANDARD.value)
+        ) {
             //鑾峰彇瑙勮寖鑰冩牳鐨勮�冩牳鐣岄檺锛堥棶棰樻暟閲忥級
             val example = Example(Domainitem::class.java)
             val criteria = example.createCriteria()
             criteria.andEqualTo("dcguid", Domain.STANDARDLEVEL.value)
-            val standardlevel:String? = domainitemMapper.selectByExample(example).get(0).value
+            val standardlevel: String? = domainitemMapper.selectByExample(example).get(0).value
             //鎸夎闀囪绠椾弗閲嶄笉瑙勮寖鍦烘櫙鏁伴噺骞舵寜鐧惧垎姣旀帓搴�
             while (evaluationlist.isNotEmpty()) {
                 val tmplist = mutableListOf<Evaluation>()
@@ -68,9 +83,9 @@
                 val evaluation = evaluationlist.get(0)//鑾峰彇涓�绉嶈闀�
                 var areaVo = EvaluateResVo()
                 areaVo = transform(areaVo, evaluation)
-                while (iterator.hasNext()){
+                while (iterator.hasNext()) {
                     val tmp = iterator.next()
-                    if (Objects.equals(tmp.towncode, evaluation.towncode)){
+                    if (Objects.equals(tmp.towncode, evaluation.towncode)) {
                         if (tmp.resultscorebef!!.toInt() >= standardlevel!!.toInt())
                             areaVo.notstandardnum++
                         areaVo.allsensenum++
@@ -84,7 +99,8 @@
         }
         //鑰冩牳绫诲瀷鏄瘎鍒嗚�冩牳
         else if (evaluationlist.isNotEmpty() &&
-                Objects.equals(evaluationlist.get(0).ertype, Constant.RuleType.SCORE.value)){
+            Objects.equals(evaluationlist.get(0).ertype, Constant.RuleType.SCORE.value)
+        ) {
             //鑾峰彇璇勫垎鑰冩牳鐨勮瘎鍒嗙晫闄�
             val example = Example(Domainitem::class.java)
             val criteria = example.createCriteria()
@@ -100,7 +116,7 @@
                 val evaluation = evaluationlist.get(0)//鑾峰彇涓�绉嶈闀�
                 var areaVo = EvaluateResVo()
                 areaVo = transform(areaVo, evaluation)
-                while (iterator.hasNext()){
+                while (iterator.hasNext()) {
                     val tmp = iterator.next()
                     if (Objects.equals(tmp.towncode, evaluation.towncode)) {
                         if (tmp.resultscorebef!!.toInt() < scorelevellist.get(scorelevellist.size - 1).text!!.toInt())
@@ -136,7 +152,7 @@
     override fun delete(id: String): Int = evaluationMapper.deleteByPrimaryKey(id)
 
     //鑾峰彇鎸囧畾鍖哄煙锛堥《灞備换鍔★級鎸囧畾鍦烘櫙鐨勮瘎鍒嗕俊鎭�
-    fun getRankInfo(tguid: String, scensetypeid: String?, ruletypeid: ByteArray?):MutableList<Evaluation>{
+    fun getRankInfo(tguid: String, scensetypeid: String?, ruletypeid: ByteArray?): MutableList<Evaluation> {
         val evaluationlist = mutableListOf<Evaluation>()
         val subtaskVolist = subtaskService.findByTaskID(tguid)
         subtaskVolist.forEach {
@@ -148,11 +164,11 @@
                 criteria.andEqualTo("scensetypeid", scensetypeid)
             if (ruletypeid != null)//璇勫垎绫诲瀷
                 criteria.andEqualTo("ertype", ruletypeid)
-            else{
+            else {
                 criteria.andEqualTo("ertype", Constant.RuleType.STANDARD.value)
                 val result = evaluationMapper.selectByExample(example)//鏌ヨ鏄惁鏈夎鑼冩�ц瘎鍒嗚〃
                 //娌℃湁瑙勮寖琛ㄥ氨鏌ヨ璇勫垎琛�
-                if (result.isEmpty()){
+                if (result.isEmpty()) {
                     val example1 = Example(Evaluation::class.java)
                     val criteria1 = example1.createCriteria()
                     criteria1.andEqualTo("stguid", it.stguid)//瀛愪换鍔d
@@ -162,8 +178,7 @@
                     val result1 = evaluationMapper.selectByExample(example1)
                     if (result1.size == 1)
                         evaluationlist.add(result1.get(0))
-                }
-                else
+                } else
                     if (result.size == 1)
                         evaluationlist.add(result.get(0))
             }
@@ -172,7 +187,7 @@
     }
 
     //Evaluation浼犻�掓暟鎹粰AreaVo
-    fun transform(areaVo: EvaluateResVo, evaluation: Evaluation):EvaluateResVo{
+    fun transform(areaVo: EvaluateResVo, evaluation: Evaluation): EvaluateResVo {
         areaVo.provincecode = evaluation.provincecode
         areaVo.provincename = evaluation.provincename
         areaVo.citycode = evaluation.citycode
@@ -185,15 +200,15 @@
     }
 
     //鎸夎閬撲弗閲嶄笉瑙勮寖鍦烘櫙鐧惧垎姣旀帓搴�
-    fun sort(areaVolist: MutableList<EvaluateResVo>):MutableList<EvaluateResVo>{
-        Collections.sort(areaVolist, object : Comparator<EvaluateResVo>{
+    fun sort(areaVolist: MutableList<EvaluateResVo>): MutableList<EvaluateResVo> {
+        Collections.sort(areaVolist, object : Comparator<EvaluateResVo> {
             override fun compare(o1: EvaluateResVo?, o2: EvaluateResVo?): Int {
                 var num1 = 0.0
                 if (o1!!.allsensenum != 0)
-                    num1 = (o1.notstandardnum/o1.allsensenum).toDouble()
+                    num1 = (o1.notstandardnum / o1.allsensenum).toDouble()
                 var num2 = 0.0
                 if (o2!!.allsensenum != 0)
-                    num2 = (o2.notstandardnum/o2.allsensenum).toDouble()
+                    num2 = (o2.notstandardnum / o2.allsensenum).toDouble()
                 return compareValues(num1, num2)
             }
         })
@@ -270,8 +285,47 @@
 
     override fun findAutoEvaluation(areaVo: AreaVo): List<AutoScoreResultVo?>? {
         //1. 鏌ユ壘鍘嗗彶璁板綍锛屾煡鐪嬭瘎浼版槸鍚﹀凡瀛樺湪
-        areaVo.scensetypeid ?: throw IllegalStateException("鏌ヨ鏃跺繀椤婚�夋嫨涓�涓満鏅被鍨�")
-        val task = taskRep.findOneTask(areaVo) ?: throw IllegalStateException("鏌ヨ鏃跺繀椤婚�夋嫨涓�涓満鏅被鍨�")
+//        areaVo.scensetypeid ?: throw ResponseErrorException("鏌ヨ鏃跺繀椤婚�夋嫨涓�涓満鏅被鍨�")
+//        val task = taskRep.findOneTask(areaVo) ?: throw ResponseErrorException("鏌ヨ鏃跺繀椤婚�夋嫨涓�涓満鏅被鍨�")
         return evaluationRep.findAutoScore(areaVo)
     }
+
+    override fun downloadAutoEvaluation(areaVo: AreaVo, response: HttpServletResponse): Boolean {
+        areaVo.scensetypeid ?: throw ResponseErrorException("蹇呴』閫夋嫨涓�涓満鏅被鍨�")
+        val topTask = taskRep.findOneTask(areaVo) ?: throw ResponseErrorException("鏈壘鍒扮鍚堟潯浠剁殑椤跺眰浠诲姟")
+        val config = ExcelConfigVo(
+            topTask.tguid ?: "",
+            topTask.starttime,
+            topTask.endtime,
+            topTask.provincecode,
+            topTask.citycode,
+            topTask.districtcode,
+            topTask.towncode,
+            areaVo.scensetypeid?.toInt()
+        )
+
+        val dataSource = DataSource(config, dbMapper)
+        val t = ReportTwo(dataSource)
+        val fileName = t.getReportName()
+        val p = "$filePath/autoscore/"
+        val file = File(p + fileName)
+        if (config.forceUpdate || !file.exists()) {
+            val downloadUrl = "/autoscore/${fileName}"
+            reportTaskCtrl.startTask(t, downloadUrl)
+            return false
+        } else {
+            val fName = Base64.getEncoder().encodeToString(fileName.toByteArray())
+            response.apply {
+                setHeader("Content-Disposition", "attachment;filename=$fName")
+                setHeader("fileName", fName)
+                addHeader("Access-Control-Expose-Headers", "fileName")
+                contentType = "application/vnd.ms-excel;charset=UTF-8"
+                setHeader("Pragma", "no-cache")
+                setHeader("Cache-Control", "no-cache")
+                setDateHeader("Expires", 0)
+            }
+            response.outputStream.write(file.readBytes())
+            return true
+        }
+    }
 }
\ No newline at end of file
diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/ProblemlistServiceImpl.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/ProblemlistServiceImpl.kt
index d49e29f..eb2d02b 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/ProblemlistServiceImpl.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/ProblemlistServiceImpl.kt
@@ -116,8 +116,8 @@
     override fun getStatisticalResult(areaVo: AreaVo): List<StatisticsVo> {
         val districtcode = areaVo.districtcode
         val sceneType = areaVo.scensetypeid
-        val startTime = areaVo.starttime
-        val endTime = areaVo.endtime
+        val startTime = areaVo.starttime?.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))
+        val endTime = areaVo.endtime?.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))
         val maps = problemlistMapper.getStatisticalResult(districtcode,startTime, endTime, sceneType)
         val statisticsVos = mutableListOf<StatisticsVo>()
         maps.forEach {
@@ -146,7 +146,12 @@
 //                .andGreaterThanOrEqualTo("endtime", areaVo.endtime)
 //                .andEqualTo("districtcode", areaVo.districtcode)
         val chargeInfoVo = ChargeInfoVo()
-        val sql = "select T_GUID, T_Name from tm_t_task where TS_GUID IS NULL and T_StartTime <= '" + areaVo.starttime + "' and T_EndTime >= '" + areaVo.endtime + "' and T_DistrictCode = '" + areaVo.districtcode +"'"
+        val sTime = areaVo.starttime?.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))
+        val eTime = areaVo.endtime?.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))
+        val sql =
+            "select T_GUID, T_Name from tm_t_task where TS_GUID IS NULL and T_StartTime <= '" + sTime + "' and T_EndTime" +
+                    " >= '" + eTime + "' and T_DistrictCode = '" + areaVo.districtcode + "'"
+
         val maps1 = taskMapper.selectSE(sql)
         var topTaskId = String()
         var topTaskName = String()
diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/SearchServiceImpl.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/SearchServiceImpl.kt
index 3070b2e..8b0e284 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/SearchServiceImpl.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/SearchServiceImpl.kt
@@ -17,6 +17,7 @@
 import cn.flightfeather.supervision.lightshare.vo.*
 import com.github.pagehelper.PageHelper
 import org.springframework.beans.BeanUtils
+import org.springframework.beans.factory.annotation.Value
 import org.springframework.stereotype.Service
 import tk.mybatis.mapper.entity.Example
 import java.io.File
@@ -55,7 +56,9 @@
         val ledgerSubTypeMapper: LedgerSubTypeMapper,
         val ledgerRecordMapper: LedgerRecordMapper,
         val userMapMapper: UserMapMapper,
-        val taskService: TaskService
+        val taskService: TaskService,
+        @Value("\${filePath}") var filePath: String,
+        @Value("\${imgPath}") var imgPath: String
 ) : SearchService {
 
     private val dateUtil = DateUtil()
@@ -122,7 +125,7 @@
             setDateHeader("Expires", 0)
         }
 
-        val p = Constant.DEFAULT_FILE_PATH + "/files/autoscore/"
+        val p = "$filePath/autoscore/"
         val file = File(p + fileName)
         if (config.forceUpdate || !file.exists()) {
             t.toFile(p)
diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/UserMapServiceImpl.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/UserMapServiceImpl.kt
index 47e7b9e..6ef1a58 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/UserMapServiceImpl.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/UserMapServiceImpl.kt
@@ -1,6 +1,7 @@
 package cn.flightfeather.supervision.lightshare.service.impl
 
 import cn.flightfeather.supervision.business.autooutput.dataanalysis.AopDataDeviceMap
+import cn.flightfeather.supervision.common.exception.ResponseErrorException
 import cn.flightfeather.supervision.common.utils.Constant
 import cn.flightfeather.supervision.common.utils.UUIDGenerator
 import cn.flightfeather.supervision.domain.ds1.entity.Userinfo
@@ -97,7 +98,7 @@
             }
             //浠ラ缇界洃绠$郴缁熶腑鐨勭敤鎴蜂负涓讳綋
             2 -> {
-                val task = taskRep.findOneTask(areaVo) ?: throw IllegalStateException("褰撳墠鏌ヨ鏉′欢涓嬫湭鎵惧埌瀵瑰簲椤跺眰浠诲姟")
+                val task = taskRep.findOneTask(areaVo) ?: throw ResponseErrorException("褰撳墠鏌ヨ鏉′欢涓嬫湭鎵惧埌瀵瑰簲椤跺眰浠诲姟")
                 val scenes = sceneRep.findScene(task.tguid!!, areaVo.scensetypeid?.toInt(), areaVo.towncode)
                     .map { it?.guid }
                 userInfoSVRep.findUser(scenes).map { it?.guid }
diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/AreaVo.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/AreaVo.kt
index 348eedc..9068058 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/AreaVo.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/AreaVo.kt
@@ -1,6 +1,8 @@
 package cn.flightfeather.supervision.lightshare.vo
 
+import com.fasterxml.jackson.annotation.JsonFormat
 import com.fasterxml.jackson.annotation.JsonInclude
+import java.time.LocalDateTime
 
 /**
  * 鍖哄煙鏉′欢
@@ -17,9 +19,11 @@
     var towncode: String? = null
     var townname: String? = null
 
-    // 鏃堕棿鑼冨洿
-    var starttime: String? = null
-    var endtime: String? = null
+    // 鏃堕棿鑼冨洿,鏍煎紡yyyy-MM-dd HH:mm:ss
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    var starttime: LocalDateTime? = null
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    var endtime: LocalDateTime? = null
 
     // 鍦烘櫙鍚嶇О
     var sceneName: String? = null
diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/BaseResPack.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/BaseResPack.kt
index 9716c15..3cc30f6 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/BaseResPack.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/BaseResPack.kt
@@ -1,5 +1,6 @@
 package cn.flightfeather.supervision.lightshare.web
 
+import cn.flightfeather.supervision.common.exception.ResponseErrorException
 import cn.flightfeather.supervision.lightshare.vo.BaseResponse
 import cn.flightfeather.supervision.lightshare.vo.DataHead
 
@@ -19,7 +20,7 @@
         } else {
             BaseResponse(true, data = res)
         }
-    } catch (e: IllegalStateException) {
+    } catch (e: ResponseErrorException) {
         BaseResponse(false, message = e.message ?: "")
     }
 }
\ No newline at end of file
diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/EvaluationController.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/EvaluationController.kt
index c857357..ce1b46e 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/EvaluationController.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/EvaluationController.kt
@@ -6,6 +6,8 @@
 import io.swagger.annotations.Api
 import io.swagger.annotations.ApiOperation
 import org.springframework.web.bind.annotation.*
+import springfox.documentation.annotations.ApiIgnore
+import javax.servlet.http.HttpServletResponse
 
 @Api(tags = ["EvaluationController"], description = "璇勪及鎬诲垎API鎺ュ彛")
 @RestController
@@ -65,4 +67,9 @@
     @ApiOperation(value = "鏍规嵁鍖哄煙鑼冨洿鑾峰彇鑷姩璇勪及鍘嗗彶璁板綍")
     @PostMapping("/auto/record")
     fun findAutoEvaluation(@RequestBody areaVo: AreaVo) = resPack { evaluationService.findAutoEvaluation(areaVo) }
+
+    @ApiOperation(value = "涓嬭浇鑷姩璇勪及缁撴灉")
+    @PostMapping("/auto/record/download")
+    fun downloadAutoEvaluation(@RequestBody areaVo: AreaVo, @ApiIgnore response: HttpServletResponse) =
+        resPack { evaluationService.downloadAutoEvaluation(areaVo, response) }
 }
\ No newline at end of file
diff --git a/src/main/resources/application-dev.yml b/src/main/resources/application-dev.yml
index 89c651c..5af1db9 100644
--- a/src/main/resources/application-dev.yml
+++ b/src/main/resources/application-dev.yml
@@ -17,4 +17,5 @@
       v2:
         enabled: true
 
-
+imgPath: target
+filePath: target
diff --git a/src/main/resources/application-pro.yml b/src/main/resources/application-pro.yml
index 3aafb8b..b5a8da8 100644
--- a/src/main/resources/application-pro.yml
+++ b/src/main/resources/application-pro.yml
@@ -11,4 +11,5 @@
       username: ledger
       password: ledger_fxxchackxr
 
-
+imgPath: D:/02product/04supervision/images/
+filePath: D:/02product/04supervision/files/
\ No newline at end of file
diff --git a/src/main/resources/application-test.yml b/src/main/resources/application-test.yml
index 69cabda..9bf72d3 100644
--- a/src/main/resources/application-test.yml
+++ b/src/main/resources/application-test.yml
@@ -26,3 +26,6 @@
     swagger:
       v2:
         enabled: true
+
+imgPath: C:\02product\supervision\images
+filePath: C:\02product\supervision\files
\ No newline at end of file
diff --git a/src/test/kotlin/cn/flightfeather/supervision/CommonTest.kt b/src/test/kotlin/cn/flightfeather/supervision/CommonTest.kt
new file mode 100644
index 0000000..4b2f0e0
--- /dev/null
+++ b/src/test/kotlin/cn/flightfeather/supervision/CommonTest.kt
@@ -0,0 +1,15 @@
+package cn.flightfeather.supervision
+
+import org.junit.Test
+import java.util.*
+
+class CommonTest {
+
+    @Test
+    fun foo1() {
+        val fName = Base64.getEncoder().encodeToString("2024骞�01鏈堥潤瀹夊尯宸ュ湴-瑙勮寖鎬ц瘎浼颁笌鍒嗘瀽娓呭崟.xls".toByteArray())
+        val dName = String(Base64.getDecoder().decode(fName))
+        println(fName)
+        println(dName)
+    }
+}
\ No newline at end of file

--
Gitblit v1.9.3