From b6c29718e10e25a6a49fe9538f554371e1560720 Mon Sep 17 00:00:00 2001
From: feiyu02 <risaku@163.com>
Date: 星期一, 25 七月 2022 15:50:22 +0800
Subject: [PATCH] 1. 调试监管统计文件下载接口; 2. 新增自动评分刷新接口; 3. 针对前端页面,调整部分接口

---
 src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/TownServiceImpl.kt        |   17 ++
 src/main/kotlin/cn/flightfeather/supervision/lightshare/service/EvaluationService.kt           |    2 
 src/main/kotlin/cn/flightfeather/supervision/lightshare/service/SearchService.kt               |    2 
 src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/SubTaskSummary.kt                   |    1 
 src/main/kotlin/cn/flightfeather/supervision/domain/ds1/mapper/SubtaskMapper.kt                |    3 
 src/main/kotlin/cn/flightfeather/supervision/lightshare/web/ProblemlistController.kt           |    6 +
 src/main/kotlin/cn/flightfeather/supervision/business/report/BaseExcel.kt                      |   11 +
 src/main/kotlin/cn/flightfeather/supervision/SupervisionApplication.kt                         |    2 
 src/main/kotlin/cn/flightfeather/supervision/common/net/NCHttpService.kt                       |    2 
 src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/EvaluationServiceImpl.kt  |   14 ++
 src/main/resources/mapper/ds1/SubtaskMapper.xml                                                |   44 +++++++
 src/main/kotlin/cn/flightfeather/supervision/business/report/cols/ColStrategy.kt               |    3 
 src/main/kotlin/cn/flightfeather/supervision/lightshare/service/TownService.kt                 |    3 
 src/main/kotlin/cn/flightfeather/supervision/lightshare/service/ProblemlistService.kt          |    2 
 src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/SubtaskServiceImpl.kt     |   74 +++++++----
 src/main/kotlin/cn/flightfeather/supervision/lightshare/web/EvaluationController.kt            |    6 +
 src/main/kotlin/cn/flightfeather/supervision/business/storage/StAutoScore.kt                   |    1 
 src/main/kotlin/cn/flightfeather/supervision/common/utils/Constant.kt                          |   19 +++
 src/main/kotlin/cn/flightfeather/supervision/lightshare/web/TownController.kt                  |    5 
 src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/ProblemlistServiceImpl.kt |   18 +++
 src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/ExcelConfigVo.kt                    |    5 
 src/main/resources/application.yml                                                             |   24 ++--
 src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/SearchServiceImpl.kt      |   47 ++++++-
 23 files changed, 252 insertions(+), 59 deletions(-)

diff --git a/src/main/kotlin/cn/flightfeather/supervision/SupervisionApplication.kt b/src/main/kotlin/cn/flightfeather/supervision/SupervisionApplication.kt
index 6bd2f4e..821485c 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/SupervisionApplication.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/SupervisionApplication.kt
@@ -18,7 +18,7 @@
 
     @Bean
     fun runner() = ApplicationRunner {
-//        fetchController.run()
+        fetchController.run()
     }
 }
 
diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/report/BaseExcel.kt b/src/main/kotlin/cn/flightfeather/supervision/business/report/BaseExcel.kt
index 6f4c5b7..844726b 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/business/report/BaseExcel.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/business/report/BaseExcel.kt
@@ -1,6 +1,7 @@
 package cn.flightfeather.supervision.business.report
 
 import org.apache.poi.hssf.usermodel.HSSFWorkbook
+import java.io.File
 import java.io.FileOutputStream
 import java.io.OutputStream
 import java.util.*
@@ -17,9 +18,15 @@
     // excel鏂囨。
     private var workbook = HSSFWorkbook()
 
+    fun getReportName(): String = "${dataSource.areaName()}-${fileName}.xls"
+
     fun toFile(path: String) {
-        val fileName = "${dataSource.areaName()}-${fileName}-${Date().time}.xls"
-        val out = FileOutputStream(path + fileName)
+        val fileName = getReportName()
+        val file = File(path + fileName)
+        if (!file.parentFile.exists()) {
+            file.parentFile.mkdirs()
+        }
+        val out = FileOutputStream(file)
         toOutputStream(out)
     }
 
diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/report/cols/ColStrategy.kt b/src/main/kotlin/cn/flightfeather/supervision/business/report/cols/ColStrategy.kt
index 4f12b5c..874a17b 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/business/report/cols/ColStrategy.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/business/report/cols/ColStrategy.kt
@@ -96,6 +96,9 @@
 
         //7銆佸綋鏈堥棶棰樻暟瓒�3涓笖鍏ㄩ儴鏈暣鏀规垨杩炵画涓ゆ湀闂鏁存敼鐜囦綆浜�50%鐨勫満鏅紝鍒椾负閲嶇偣鐩戠锛岀敱鎶�鏈湇鍔¢儴褰撴湀澧炲姞涓嶅皯浜庝竴娆$幇鍦哄鏍革紱
         if (rowData.problems.size > 3 && cPros == 0) {
+            result += strategyList[6] + "\n"
+        } else if (cPer < .5) {
+
         }
 
         //8銆佽繛缁袱鏈堝彴璐︽彁浜ゆ瘮渚嬩綆浜�50%鐨勶紝鐢辨妧鏈湇鍔¢儴褰撴湀澧炲姞涓�娆$幇鍦烘垨绾夸笂鎿嶄綔鎸囧锛�
diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/storage/StAutoScore.kt b/src/main/kotlin/cn/flightfeather/supervision/business/storage/StAutoScore.kt
index 979bcc0..81d8739 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/business/storage/StAutoScore.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/business/storage/StAutoScore.kt
@@ -29,6 +29,7 @@
  * 宸ュ湴鑷姩璇勫垎
  */
 @Component
+
 class StAutoScore(
     stScoreItem_1: StScoreItem_1,
     stScoreItem_2: StScoreItem_2,
diff --git a/src/main/kotlin/cn/flightfeather/supervision/common/net/NCHttpService.kt b/src/main/kotlin/cn/flightfeather/supervision/common/net/NCHttpService.kt
index d406eea..80543b4 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/common/net/NCHttpService.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/common/net/NCHttpService.kt
@@ -14,7 +14,7 @@
             val time: String
     )
 
-    private val httpMethod = HttpMethod("101.230.224.89", 8085)
+    private val httpMethod = HttpMethod("101.230.224.89", 9006)
 
     fun getFile(time: String): JsonArray? {
         val params = Params(time)
diff --git a/src/main/kotlin/cn/flightfeather/supervision/common/utils/Constant.kt b/src/main/kotlin/cn/flightfeather/supervision/common/utils/Constant.kt
index 921170e..5b5e162 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/common/utils/Constant.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/common/utils/Constant.kt
@@ -59,6 +59,25 @@
                 "99" -> TYPE99.text
                 else -> ""
             }
+
+            fun getByValue(value: String?) = when (value.toString()) {
+                "1" -> TYPE1
+                "2" -> TYPE2
+                "3" -> TYPE3
+                "4" -> TYPE4
+                "5" -> TYPE5
+                "6" -> TYPE6
+                "7" -> TYPE7
+                "8" -> TYPE8
+                "9" -> TYPE9
+                "10" -> TYPE10
+                "11" -> TYPE11
+                "12" -> TYPE12
+                "13" -> TYPE13
+                "14" -> TYPE14
+                "99" -> TYPE99
+                else -> TYPE99
+            }
         }
     }
 
diff --git a/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/mapper/SubtaskMapper.kt b/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/mapper/SubtaskMapper.kt
index 3a49785..145fddb 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/mapper/SubtaskMapper.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/domain/ds1/mapper/SubtaskMapper.kt
@@ -3,6 +3,7 @@
 import cn.flightfeather.supervision.domain.ds1.entity.Subtask
 import cn.flightfeather.supervision.domain.util.MyMapper
 import cn.flightfeather.supervision.lightshare.vo.SubTaskSearchResultVo2
+import cn.flightfeather.supervision.lightshare.vo.SubTaskSummary
 import cn.flightfeather.supervision.lightshare.vo.SubtaskSearchResultVo
 import cn.flightfeather.supervision.lightshare.vo.SubtaskVo
 import org.apache.ibatis.annotations.Mapper
@@ -19,5 +20,5 @@
 
     fun selectByTopTask2(topTaskId: String, sceneTypeId: Int? = null): List<Subtask>
 
-
+    fun getSummary(topTaskId: String, sceneTypeId: Int?): List<SubTaskSummary>
 }
\ No newline at end of file
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 4eb2aef..38b81f4 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/EvaluationService.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/EvaluationService.kt
@@ -25,5 +25,7 @@
 
     fun autoScore2(subTaskId: String): List<String>
 
+    fun autoScore3(tGuid: String, sceneTypeId: String): String
+
     fun findByInspectionId(inspectionId:String):List<Evaluation>
 }
\ No newline at end of file
diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/ProblemlistService.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/ProblemlistService.kt
index 400cb81..9b989bd 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/ProblemlistService.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/ProblemlistService.kt
@@ -44,4 +44,6 @@
     fun newProblem(problem: String, files: Array<MultipartFile>): BaseResponse<String>
 
     fun changeProblem(problemId: String, files: Array<MultipartFile>): BaseResponse<String>
+
+    fun getBySubTask(stGuid: String): List<ProblemlistVo>
 }
\ No newline at end of file
diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/SearchService.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/SearchService.kt
index 214eb3a..1810e8b 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/SearchService.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/SearchService.kt
@@ -11,7 +11,7 @@
 
     fun writeToFile(config: ExcelConfigVo, mode: Int)
 
-    fun getExcel(config: ExcelConfigVo, response: HttpServletResponse): HttpServletResponse
+    fun getExcel(config: ExcelConfigVo, response: HttpServletResponse): Boolean
 
     fun getSubTaskDetail(config: ExcelConfigVo): SubTaskTableVo
 
diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/TownService.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/TownService.kt
index 6601841..b08935b 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/TownService.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/TownService.kt
@@ -1,5 +1,6 @@
 package cn.flightfeather.supervision.lightshare.service
 
+import cn.flightfeather.supervision.domain.ds1.entity.District
 import cn.flightfeather.supervision.domain.ds1.entity.Town
 
 
@@ -13,4 +14,6 @@
     fun update(town: Town): Int
 
     fun delete(id: String): Int
+
+    fun getByDistrict(districtCode: String): List<Town>
 }
\ No newline at end of file
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 6858f47..43af688 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,6 +1,7 @@
 package cn.flightfeather.supervision.lightshare.service.impl
 
 import cn.flightfeather.supervision.business.AutoScore2
+import cn.flightfeather.supervision.business.storage.StAutoScore
 import cn.flightfeather.supervision.domain.ds1.entity.Domainitem
 import cn.flightfeather.supervision.domain.ds1.entity.Evaluation
 import cn.flightfeather.supervision.domain.ds1.entity.Subtask
@@ -29,6 +30,9 @@
     lateinit var domainitemMapper: DomainitemMapper
     @Autowired
     lateinit var subtaskMapper: SubtaskMapper
+    @Autowired
+    lateinit var autoScore: StAutoScore
+    private var isAutoScoreRunning = false
 
     //鑾峰彇鏌愰《灞備换鍔′笅鏌愪釜鍦烘櫙鐨勮閬撹瘎鍒嗘帓鍚�
     override fun getRankOfTown(tguid: String, scensetypeid: String?): List<AreaVo> {
@@ -244,6 +248,16 @@
         return resultList
     }
 
+    override fun autoScore3(tGuid: String, sceneTypeId: String): String {
+        if (isAutoScoreRunning) return "鑷姩璇勫垎鎵ц涓紝璇风瓑寰呭畬鎴�"
+        isAutoScoreRunning = true
+        val t = Constant.ScenseType.getByValue(sceneTypeId)
+        autoScore.sceneType = t
+        autoScore.topTaskGrade(tGuid)
+        isAutoScoreRunning = false
+        return "鑷姩璇勫垎瀹屾垚"
+    }
+
     override fun findByInspectionId(inspectionId: String): List<Evaluation> {
         return evaluationMapper.selectByExample(Example(Evaluation::class.java).apply {
             createCriteria().andEqualTo("iguid", inspectionId)
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 a56fe6a..d49e29f 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
@@ -556,4 +556,22 @@
 
         return BaseResponse(true)
     }
+
+    override fun getBySubTask(stGuid: String): List<ProblemlistVo> {
+        //鏍规嵁瀛愪换鍔D鑾峰彇闂鍒楄〃
+        val problemListVo = findBySubtaskId(stGuid)
+        //鍒ゆ柇鏄惁鏈夐棶棰樺垪琛�
+        if (!problemListVo.isEmpty()) {
+            //鏍规嵁姣忎釜闂,鑾峰彇濯掍綋鏂囦欢
+            problemListVo.forEach {
+                val mediafileVo = mediafileService.findByBusinessGUID(it.guid!!)
+                //鍒ゆ柇鏄惁鏈夊獟浣撹祫鏂�
+                if (!mediafileVo.isEmpty()) {
+                    //璧嬪��
+                    it.mediafileList = mediafileVo
+                }
+            }
+        }
+        return problemListVo
+    }
 }
\ No newline at end of file
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 1025cf9..4aee9a5 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
@@ -21,6 +21,9 @@
 import java.io.File
 import java.io.FileInputStream
 import java.io.FileOutputStream
+import java.io.OutputStream
+import java.net.URLEncoder
+import java.nio.charset.Charset
 import java.nio.charset.StandardCharsets
 import java.util.*
 import javax.servlet.http.HttpServletResponse
@@ -103,25 +106,49 @@
         t?.toFile("target/")
     }
 
-    override fun getExcel(config: ExcelConfigVo, response: HttpServletResponse): HttpServletResponse {
+    override fun getExcel(config: ExcelConfigVo, response: HttpServletResponse): Boolean {
+        val dbMapper = DbMapper(
+            scenseMapper,
+            problemlistMapper,
+            problemtypeMapper,
+            subtaskMapper,
+            monitorobjectversionMapper,
+            sceneConstructionSiteMapper,
+            sceneMixingPlantMapper,
+            sceneStorageYardMapper,
+            sceneWharfMapper,
+            taskMapper,
+            evaluationruleMapper, evaluationsubruleMapper, evaluationMapper, itemevaluationMapper,
+            ledgerSubTypeMapper, ledgerRecordMapper, userinfoMapper, userMapMapper, townMapper
+        )
+        val dataSource = DataSource(config, dbMapper)
+        val t = when (config.mode) {
+            1 -> ReportOne(dataSource)
+            2 -> ReportTwo(dataSource)
+            3 -> ReportThree(dataSource)
 
-        val fileName = "${dateUtil.DateToString(Date(), "yyyy-MM-dd hh:mm:ss")}.xls"
+            else -> ReportOne(dataSource)
+        }
+        val fileName = t.getReportName()
+        val fName = URLEncoder.encode(fileName, "UTF-8")
         response.apply {
-            setHeader("Content-Disposition", "attachment;filename=$fileName")
-            setHeader("fileName", fileName)
+            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)
         }
 
-//        val heads = getTableTitles(config.sceneType, config.districtCode)
-//        val contents = getTableContents(config, heads.size)
-        val r = getTable(1, config)
-        val out = response.outputStream
-        ExcelUtil.write2(out, r.first, r.second)
+        val p = Constant.DEFAULT_FILE_PATH + "/files/autoscore/"
+        val file = File(p + fileName)
+        if (config.forceUpdate || !file.exists()) {
+            t.toFile(p)
+        }
+        response.outputStream.write(file.readBytes())
 
-        return response
+        return true
     }
 
     override fun getSubTaskDetail(config: ExcelConfigVo): SubTaskTableVo {
diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/SubtaskServiceImpl.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/SubtaskServiceImpl.kt
index 3372dde..2a26187 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/SubtaskServiceImpl.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/SubtaskServiceImpl.kt
@@ -2,6 +2,9 @@
 
 import cn.flightfeather.supervision.business.AutoScore
 import cn.flightfeather.supervision.business.AutoScore2
+import cn.flightfeather.supervision.business.storage.StAutoScore
+import cn.flightfeather.supervision.business.storage.item.StScoreItem_1
+import cn.flightfeather.supervision.business.storage.item.StScoreItem_2
 import cn.flightfeather.supervision.domain.ds1.entity.*
 import cn.flightfeather.supervision.domain.ds1.mapper.*
 import cn.flightfeather.supervision.common.utils.Constant
@@ -24,6 +27,10 @@
 
     val dateUtil = DateUtil()
 
+    @Autowired
+    lateinit var scoreItem1: StScoreItem_1
+    @Autowired
+    lateinit var scoreItem2: StScoreItem_2
     @Autowired
     lateinit var taskService: TaskService
     @Autowired
@@ -474,6 +481,8 @@
                     autoScore.subtask = subtask
                     autoScore.calculateScore()
                 }
+//                val autoScore = StAutoScore(scoreItem1, scoreItem2)
+//                autoScore.sceneType = Constant.ScenseType.TYPE1
             }
         }
 
@@ -992,36 +1001,43 @@
     }
 
     override fun getSummary(topTaskId: String, sceneTypeId: Int?): List<SubTaskSummary> {
-        val result = mutableListOf<SubTaskSummary>()
+//        val result = mutableListOf<SubTaskSummary>()
 
-        subtaskMapper.selectByTopTask2(topTaskId, sceneTypeId).forEach {
-            val scene = scenseMapper.selectByPrimaryKey(it.scenseid)
-            var p = 0
-            var c = 0
-            var pc = 0
-            var cc = 0
-            problemlistMapper.selectByExample(Example(Problemlist::class.java).apply {
-                createCriteria().andEqualTo("stguid", it.stguid)
-            }).forEach {pro ->
-                p++
-                if (pro.ischanged == true) c++
-                if (pro.extension3 != Constant.PROBLEM_UNCHECKED) pc++
-                if (pro.extension3 == Constant.CHANGE_CHECK_PASS || pro.extension3 == Constant.CHANGE_CHECK_FAIL) cc++
-            }
-            result.add(SubTaskSummary().apply {
-                stGuid = it.stguid
-                stName = it.name
-                sceneId = it.scenseid
-                sceneName = scene.name
-                sceneType = scene.type
-                stPlanTime = it.planstarttime
-                proNum = p
-                changeNum = c
-                proCheckedNum = pc
-                changeCheckedNum = cc
-            })
-        }
+//        subtaskMapper.selectByTopTask2(topTaskId, sceneTypeId).forEach {
+//            val scene = scenseMapper.selectByPrimaryKey(it.scenseid)
+//            var p = 0
+//            var c = 0
+//            var pc = 0
+//            var cc = 0
+//            problemlistMapper.selectByExample(Example(Problemlist::class.java).apply {
+//                createCriteria().andEqualTo("stguid", it.stguid)
+//            }).forEach {pro ->
+//                p++
+//                if (pro.ischanged == true) c++
+//                if (pro.extension3 != Constant.PROBLEM_UNCHECKED) pc++
+//                if (pro.extension3 == Constant.CHANGE_CHECK_PASS || pro.extension3 == Constant.CHANGE_CHECK_FAIL) cc++
+//            }
+//            val ins = inspectionMapper.selectByExample(Example(Inspection::class.java).apply {
+//                createCriteria().andEqualTo("stguid", it.stguid)
+//            })
+//            result.add(SubTaskSummary().apply {
+//                stGuid = it.stguid
+//                stName = it.name
+//                if (ins.isNotEmpty()) insGuid = ins[0].guid
+//                sceneId = it.scenseid
+//                sceneName = scene.name
+//                sceneType = scene.type
+//                stPlanTime = it.planstarttime
+//                proNum = p
+//                changeNum = c
+//                proCheckedNum = pc
+//                changeCheckedNum = cc
+//            })
+//        }
 
-        return result
+//        return result
+
+        return subtaskMapper.getSummary(topTaskId, sceneTypeId)
+
     }
 }
\ No newline at end of file
diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/TownServiceImpl.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/TownServiceImpl.kt
index 7a2058d..1595914 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/TownServiceImpl.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/TownServiceImpl.kt
@@ -1,12 +1,15 @@
 package cn.flightfeather.supervision.lightshare.service.impl
 
+import cn.flightfeather.supervision.domain.ds1.entity.District
 import cn.flightfeather.supervision.domain.ds1.entity.Town
+import cn.flightfeather.supervision.domain.ds1.mapper.DistrictMapper
 import cn.flightfeather.supervision.domain.ds1.mapper.TownMapper
 import cn.flightfeather.supervision.lightshare.service.TownService
 import org.springframework.stereotype.Service
+import tk.mybatis.mapper.entity.Example
 
 @Service
-class TownServiceImpl(val townMapper: TownMapper) : TownService {
+class TownServiceImpl(val townMapper: TownMapper, private val districtMapper: DistrictMapper) : TownService {
     override fun findOne(id: String): Town = townMapper.selectByPrimaryKey(id)
 
     override fun findAll(): MutableList<Town> = townMapper.selectAll()
@@ -16,4 +19,16 @@
     override fun update(town: Town): Int = townMapper.updateByPrimaryKey(town)
 
     override fun delete(id: String): Int = townMapper.deleteByPrimaryKey(id)
+
+    override fun getByDistrict(districtCode: String): List<Town> {
+        var result = mutableListOf<Town>()
+        districtMapper.selectByExample(Example(District::class.java).apply {
+            createCriteria().andEqualTo("districtcode", districtCode)
+        })?.takeIf { it.isNotEmpty() }?.get(0)?.let {
+            result = townMapper.selectByExample(Example(Town::class.java).apply {
+                createCriteria().andEqualTo("districtid", it.districtid)
+            })
+        }
+        return result
+    }
 }
\ No newline at end of file
diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/ExcelConfigVo.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/ExcelConfigVo.kt
index d12e8be..1d04f57 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/ExcelConfigVo.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/ExcelConfigVo.kt
@@ -23,5 +23,8 @@
         val subTaskIdList: List<String>? = null,
 
         val problemTypeName: String? = null,
-        val problemName: String? = null
+        val problemName: String? = null,
+
+        val mode: Int = 0,
+        val forceUpdate: Boolean = false
 )
\ No newline at end of file
diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/SubTaskSummary.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/SubTaskSummary.kt
index 58e7368..b8151aa 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/SubTaskSummary.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/SubTaskSummary.kt
@@ -5,6 +5,7 @@
 class SubTaskSummary {
     var stGuid: String? = null
     var stName: String? = null
+    var insGuid: String? = null
     var sceneId: String? = null
     var sceneName: String? = null
     var sceneType: String? = null
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 ef2e02c..1bc358c 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/EvaluationController.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/EvaluationController.kt
@@ -37,6 +37,12 @@
     fun autoScore(@RequestParam(value = "districtCode") districtCode: String,
                   @RequestParam(value = "time") time: String) = evaluationService.autoScore(districtCode, time)
 
+    @GetMapping("/autoScore3")
+    fun autoScore3(
+        @RequestParam(value = "topTaskId") tGuid: String,
+        @RequestParam(value = "sceneTypeId") sceneTypeId: String
+    ) = evaluationService.autoScore3(tGuid, sceneTypeId)
+
     @PostMapping("/autoScore")
     fun autoScore2(@RequestParam(value = "subTaskId") subTaskId: String) = evaluationService.autoScore2(subTaskId)
 
diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/ProblemlistController.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/ProblemlistController.kt
index 84dbad3..c5d280a 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/ProblemlistController.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/ProblemlistController.kt
@@ -83,4 +83,10 @@
         @RequestParam("problemId") problemId: String,
         @RequestPart("images") files: Array<MultipartFile>
     ) = problemlistService.changeProblem(problemId, files)
+
+    @ApiOperation(value = "閫氳繃浠诲姟鏌ユ壘闂", notes = "绠�鍖栦笂浼犳墍闇�闂淇℃伅锛屽皢澶ч儴鍒嗘搷浣滀氦鐢卞悗鍙板畬鎴�")
+    @GetMapping("/subtask")
+    fun getBySubTask(
+        @RequestParam("stGuid") stGuid: String,
+    ) = problemlistService.getBySubTask(stGuid)
 }
\ No newline at end of file
diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/TownController.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/TownController.kt
index e423f56..3ed776b 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/TownController.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/TownController.kt
@@ -23,4 +23,9 @@
 
     @DeleteMapping("/{id}")
     fun delete (@PathVariable id: String) = townService.delete(id)
+
+    @GetMapping("/district")
+    fun getByDistrict(
+        @RequestParam("districtCode") districtCode: String,
+    ) = townService.getByDistrict(districtCode)
 }
\ No newline at end of file
diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml
index 2140918..438a354 100644
--- a/src/main/resources/application.yml
+++ b/src/main/resources/application.yml
@@ -14,14 +14,14 @@
   #    password: cn.FLIGHTFEATHER
 
       #-杩滅▼娴嬭瘯鏈嶅姟鍣�-
-      url: jdbc:mysql://47.100.191.150:3306/supervision?serverTimezone=Asia/Shanghai&prepStmtCacheSize=517&cachePrepStmts=true&autoReconnect=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false
-      username: remoteU1
-      password: eSoF8DnzfGTlhAjE
+#      url: jdbc:mysql://47.100.191.150:3306/supervision?serverTimezone=Asia/Shanghai&prepStmtCacheSize=517&cachePrepStmts=true&autoReconnect=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false
+#      username: remoteU1
+#      password: eSoF8DnzfGTlhAjE
 
       #-鍙戝竷鏈嶅姟鍣�-
-#      url: jdbc:mysql://localhost:3306/supervision?serverTimezone=Asia/Shanghai&prepStmtCacheSize=517&cachePrepStmts=true&autoReconnect=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false
-#      username: supervision
-#      password: supervision_feiyu2021
+      url: jdbc:mysql://localhost:3306/supervision?serverTimezone=Asia/Shanghai&prepStmtCacheSize=517&cachePrepStmts=true&autoReconnect=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false
+      username: supervision
+      password: supervision_feiyu2021
 
       #-鐜鐫e療娴嬭瘯鏈嶅姟鍣�-
   #    url: jdbc:mysql://192.168.0.200:3306/supervision_ii?serverTimezone=Asia/Shanghai&prepStmtCacheSize=517&cachePrepStmts=true&autoReconnect=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false
@@ -56,14 +56,14 @@
       #-TestEnd-
 
       #-鍙戝竷鏈嶅姟鍣�-
-#      url: jdbc:mysql://localhost:3306/ledger?serverTimezone=Asia/Shanghai&prepStmtCacheSize=517&cachePrepStmts=true&autoReconnect=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false
-#      username: ledger
-#      password: ledger_fxxchackxr
+      url: jdbc:mysql://localhost:3306/ledger?serverTimezone=Asia/Shanghai&prepStmtCacheSize=517&cachePrepStmts=true&autoReconnect=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false
+      username: ledger
+      password: ledger_fxxchackxr
 
       #   寮�鍙戣繙绋嬫湇鍔″櫒
-      url: jdbc:mysql://47.100.191.150:3306/ledger?serverTimezone=Asia/Shanghai&prepStmtCacheSize=517&cachePrepStmts=true&autoReconnect=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false
-      username: remoteU1
-      password: eSoF8DnzfGTlhAjE
+#      url: jdbc:mysql://47.100.191.150:3306/ledger?serverTimezone=Asia/Shanghai&prepStmtCacheSize=517&cachePrepStmts=true&autoReconnect=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false
+#      username: remoteU1
+#      password: eSoF8DnzfGTlhAjE
 
       initialSize: 5
       minIdle: 5
diff --git a/src/main/resources/mapper/ds1/SubtaskMapper.xml b/src/main/resources/mapper/ds1/SubtaskMapper.xml
index 719cf02..037dd56 100644
--- a/src/main/resources/mapper/ds1/SubtaskMapper.xml
+++ b/src/main/resources/mapper/ds1/SubtaskMapper.xml
@@ -148,6 +148,20 @@
         <result column="ST_Extension3" property="extension3" jdbcType="VARCHAR" />
         <result column="ST_Remark" property="remark" jdbcType="VARCHAR" />
     </resultMap>
+
+    <resultMap id="SubTaskSummary" type="cn.flightfeather.supervision.lightshare.vo.SubTaskSummary" >
+        <result column="ST_GUID" property="stGuid" jdbcType="VARCHAR" />
+        <result column="ST_name" property="stName" jdbcType="VARCHAR" />
+        <result column="ST_PlanStartTime" property="stPlanTime" jdbcType="TIMESTAMP" />
+        <result column="S_GUID" property="sceneId" jdbcType="VARCHAR" />
+        <result column="S_Name" property="sceneName" jdbcType="VARCHAR" />
+        <result column="S_Type" property="sceneType" jdbcType="VARCHAR" />
+        <result column="I_GUID" property="insGuid" jdbcType="VARCHAR" />
+        <result column="proNum" property="proNum" jdbcType="INTEGER" />
+        <result column="changeNum" property="changeNum" jdbcType="INTEGER" />
+        <result column="proCheckedNum" property="proCheckedNum" jdbcType="INTEGER" />
+        <result column="changeCheckedNum" property="changeCheckedNum" jdbcType="INTEGER" />
+    </resultMap>
   <sql id="Base_Column_List" >
     <!--
       WARNING - @mbg.generated
@@ -259,4 +273,34 @@
             and b.S_TypeID = #{param2}
         </if>
     </select>
+
+    <select id="getSummary" resultMap="SubTaskSummary">
+        SELECT
+        a.ST_GUID,
+        a.ST_name,
+        a.ST_PlanStartTime,
+        b.S_GUID,
+        b.S_Name,
+        b.S_Type,
+        c.I_GUID,
+        SUM(d.PL_GUID is NOT null) AS proNum,
+        SUM(d.PL_IsChanged = TRUE) AS changeNum,
+        SUM(d.PL_Extension3 != 'unCheck') AS proCheckedNum,
+        SUM(
+        d.PL_Extension3 = 'change_pass' || d.PL_Extension3 = 'change_fail'
+        ) AS changeCheckedNum
+
+        FROM
+        tm_t_subtask AS a
+        LEFT JOIN sm_t_scense AS b ON a.ST_ScenseID = b.S_GUID
+        LEFT JOIN im_t_inspection AS c ON a.ST_GUID = c.ST_GUID
+        LEFT JOIN im_t_problemlist AS d ON a.ST_GUID = d.ST_GUID
+        WHERE
+        a.T_GUID = #{param1}
+        <if test="param2 != null">
+            and b.S_TypeID = #{param2}
+        </if>
+        GROUP BY
+        a.ST_GUID
+    </select>
 </mapper>
\ No newline at end of file

--
Gitblit v1.9.3