From 72a384981ec78139dbe919597b54efedcc7f33aa Mon Sep 17 00:00:00 2001
From: feiyu02 <risaku@163.com>
Date: 星期五, 27 九月 2024 17:42:55 +0800
Subject: [PATCH] 1. 新增评估结果批量修改相关接口
---
src/main/kotlin/cn/flightfeather/supervision/business/bgtask/AopTaskCtrl.kt | 2
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/EvaluationServiceImpl.kt | 9 ++++
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/EvaluationService.kt | 5 ++
src/main/kotlin/cn/flightfeather/supervision/lightshare/web/EvaluationsubruleController.kt | 6 +-
src/main/kotlin/cn/flightfeather/supervision/business/report/file/TemplateScore.kt | 17 ++++++++
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/EvaluationsubruleServiceImpl.kt | 18 ++++----
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/EvaluationsubruleService.kt | 11 ++---
src/main/kotlin/cn/flightfeather/supervision/lightshare/web/EvaluationController.kt | 19 +++++++++
src/main/kotlin/cn/flightfeather/supervision/business/report/DataSource.kt | 13 ++----
src/main/kotlin/cn/flightfeather/supervision/common/utils/ExcelUtil.kt | 4 +-
10 files changed, 74 insertions(+), 30 deletions(-)
diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/bgtask/AopTaskCtrl.kt b/src/main/kotlin/cn/flightfeather/supervision/business/bgtask/AopTaskCtrl.kt
index 4de46d6..f125125 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/business/bgtask/AopTaskCtrl.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/business/bgtask/AopTaskCtrl.kt
@@ -79,7 +79,7 @@
val name = "${districtName}${Constant.SceneType.getDes(sceneType)}鑷姩璇勫垎"
val bgTask = backgroundTaskCtrl.startNewTask(BgTaskType.AUTO_SCORE, id, name) {
// 鐩戞祴鏁版嵁鍒嗘瀽鍏ュ簱
- dataAnalysis(districtCode, sceneType, taskId, year, month)
+// dataAnalysis(districtCode, sceneType, taskId, year, month)
// 鑷姩璇勪及璁$畻鍏ュ簱
aopEvaluation.executeByTopTask(taskId, sceneType)
// 鐜俊鐮佺粨鏋滆浆鎹㈠叆搴�
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 92f0633..f91d3f6 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/business/report/DataSource.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/business/report/DataSource.kt
@@ -94,14 +94,10 @@
//1. 鏌ユ壘鐗瑰畾鐨勫贰鏌ヤ换鍔℃垨鑰呮墍鏈夌殑璁″垝宸℃煡浠诲姟
var taskSceneIdList = listOf<String>()
- val subTaskList = if (config.subTaskIdList?.isNotEmpty() == true ||
- (config.startTime != null || config.endTime != null)
- ) {
+ val subTaskList = if (config.subTaskIdList?.isNotEmpty() == true) {
dbMapper.subtaskMapper.selectByExample(Example(Subtask::class.java).apply {
createCriteria().apply {
- if (config.subTaskIdList?.isNotEmpty() == true) {
- andIn("stguid", config.subTaskIdList)
- }
+ andIn("stguid", config.subTaskIdList)
config.startTime?.let { andGreaterThanOrEqualTo("planstarttime", it) }
config.endTime?.let { andLessThanOrEqualTo("planendtime", it) }
config.districtCode?.let { andEqualTo("districtcode", it) }
@@ -112,8 +108,9 @@
taskSceneIdList = dbMapper.scenseMapper.getSceneByType(config.topTaskGuid, config
.sceneType, config.townCode).map { it.guid ?: "" }
dbMapper.subtaskMapper.selectByExample(Example(Subtask::class.java).apply {
- createCriteria().andIn("scenseid", taskSceneIdList)
- .andEqualTo("tguid", config.topTaskGuid)
+ createCriteria().apply {
+ if (taskSceneIdList.isNotEmpty()) andIn("scenseid", taskSceneIdList)
+ }.andEqualTo("tguid", config.topTaskGuid)
})
}
diff --git a/src/main/kotlin/cn/flightfeather/supervision/business/report/file/TemplateScore.kt b/src/main/kotlin/cn/flightfeather/supervision/business/report/file/TemplateScore.kt
new file mode 100644
index 0000000..ff90f3f
--- /dev/null
+++ b/src/main/kotlin/cn/flightfeather/supervision/business/report/file/TemplateScore.kt
@@ -0,0 +1,17 @@
+package cn.flightfeather.supervision.business.report.file
+
+import cn.flightfeather.supervision.business.report.BaseExcel
+import cn.flightfeather.supervision.business.report.BaseTemplate
+import cn.flightfeather.supervision.business.report.DataSource
+import cn.flightfeather.supervision.business.report.template.ScoreAnalysisSummary
+import cn.flightfeather.supervision.business.report.template.ScoreDetailSummary
+
+/**
+ * 鑷姩璇勪及缁撴灉涓婁紶妯℃澘
+ * @date 2024/9/27
+ * @author feiyu02
+ */
+class TemplateScore(dataSource: DataSource) : BaseExcel(dataSource) {
+ override val templates: List<BaseTemplate> = listOf(ScoreDetailSummary(dataSource), ScoreAnalysisSummary(dataSource))
+ override val fileName: String = "瑙勮寖鎬ц瘎浼版ā鏉�"
+}
\ No newline at end of file
diff --git a/src/main/kotlin/cn/flightfeather/supervision/common/utils/ExcelUtil.kt b/src/main/kotlin/cn/flightfeather/supervision/common/utils/ExcelUtil.kt
index 7bd1347..fc653ac 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/common/utils/ExcelUtil.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/common/utils/ExcelUtil.kt
@@ -84,7 +84,7 @@
}
/**
- * 鑷姩澶勭悊琛屽悎骞舵暟鎹�
+ * 鍐欏叆excel
*/
fun write(heads: List<Array<Any>>, contents: MutableList<Array<Any>>, workbook: HSSFWorkbook, sheetName: String
= "sheet1") {
@@ -274,7 +274,7 @@
}
/**
- * 鑷姩澶勭悊琛屽悎骞舵暟鎹�
+ * 鍐欏叆excel
*/
fun write2(out: OutputStream, heads: List<Array<Any>>, contents: MutableList<Array<Any>>, sheetName: String = "sheet1") {
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 90dca46..0d16126 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,7 @@
import cn.flightfeather.supervision.lightshare.vo.AutoScoreResultVo
import cn.flightfeather.supervision.lightshare.vo.BaseResponse
import cn.flightfeather.supervision.lightshare.vo.EvaluateResVo
+import org.springframework.web.multipart.MultipartFile
import springfox.documentation.annotations.ApiIgnore
import javax.servlet.http.HttpServletResponse
@@ -43,4 +44,8 @@
fun findAutoEvaluation(areaVo: AreaVo): List<AutoScoreResultVo?>?
fun downloadAutoEvaluation(areaVo: AreaVo, forceUpdate: Boolean, response: HttpServletResponse): Boolean
+
+ fun downloadAutoEvaTemplate(areaVo: AreaVo, response: HttpServletResponse)
+
+ fun uploadAutoEvaluation(areaVo: AreaVo, file: MultipartFile): Boolean
}
\ No newline at end of file
diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/EvaluationsubruleService.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/EvaluationsubruleService.kt
index e8c050c..d96c2aa 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/EvaluationsubruleService.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/EvaluationsubruleService.kt
@@ -1,24 +1,23 @@
package cn.flightfeather.supervision.lightshare.service
-import cn.flightfeather.supervision.domain.ds1.entity.Evaluationsubrule
import cn.flightfeather.supervision.domain.ds1.entity.Evaluationsubrule2
import cn.flightfeather.supervision.lightshare.vo.ScoreDetail
interface EvaluationsubruleService {
- fun findOne(id:String): Evaluationsubrule
+ fun findOne(id:String): Evaluationsubrule2
- fun findAll(): MutableList<Evaluationsubrule>
+ fun findAll(): MutableList<Evaluationsubrule2>
- fun save(evaluationsubrule: Evaluationsubrule): Int
+ fun save(evaluationsubrule: Evaluationsubrule2): Int
- fun update(evaluationsubrule: Evaluationsubrule): Int
+ fun update(evaluationsubrule: Evaluationsubrule2): Int
fun delete(id:String): Int
fun findByRuleId(erguid: String): List<Evaluationsubrule2>
- fun search(districtCode: String, sceneTypeId: String, version: String? = null): List<Evaluationsubrule>
+ fun search(districtCode: String, sceneTypeId: String, version: String? = null): List<Evaluationsubrule2>
fun getAutoScore(subTaskId: String): ScoreDetail
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 346b362..84991cd 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
@@ -27,6 +27,7 @@
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.beans.factory.annotation.Value
import org.springframework.stereotype.Service
+import org.springframework.web.multipart.MultipartFile
import tk.mybatis.mapper.entity.Example
import java.io.File
import java.util.*
@@ -326,4 +327,12 @@
return true
}
}
+
+ override fun downloadAutoEvaTemplate(areaVo: AreaVo, response: HttpServletResponse) {
+ TODO("Not yet implemented")
+ }
+
+ override fun uploadAutoEvaluation(areaVo: AreaVo, file: MultipartFile): Boolean {
+ TODO("Not yet implemented")
+ }
}
\ No newline at end of file
diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/EvaluationsubruleServiceImpl.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/EvaluationsubruleServiceImpl.kt
index e972031..1c53c7b 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/EvaluationsubruleServiceImpl.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/EvaluationsubruleServiceImpl.kt
@@ -2,10 +2,10 @@
import cn.flightfeather.supervision.common.exception.BizException
import cn.flightfeather.supervision.domain.ds1.entity.Evaluationrule
-import cn.flightfeather.supervision.domain.ds1.entity.Evaluationsubrule
import cn.flightfeather.supervision.domain.ds1.entity.Evaluationsubrule2
import cn.flightfeather.supervision.domain.ds1.mapper.EvaluationruleMapper
import cn.flightfeather.supervision.domain.ds1.mapper.EvaluationsubruleMapper
+import cn.flightfeather.supervision.domain.ds1.mapper.EvaluationsubruleMapper2
import cn.flightfeather.supervision.domain.ds1.repository.EvaluationRep
import cn.flightfeather.supervision.domain.ds1.repository.EvaluationRuleRep
import cn.flightfeather.supervision.domain.ds1.repository.SceneRep
@@ -16,20 +16,20 @@
@Service
class EvaluationsubruleServiceImpl(
- val evaluationsubruleMapper: EvaluationsubruleMapper,
+ val evaluationsubruleMapper: EvaluationsubruleMapper2,
val evaluationruleMapper: EvaluationruleMapper,
private val evaluationRep: EvaluationRep,
private val evaluationRuleRep: EvaluationRuleRep,
private val sceneRep: SceneRep,
) : EvaluationsubruleService {
- override fun findOne(id: String): Evaluationsubrule = evaluationsubruleMapper.selectByPrimaryKey(id)
+ override fun findOne(id: String): Evaluationsubrule2 = evaluationsubruleMapper.selectByPrimaryKey(id)
- override fun findAll(): MutableList<Evaluationsubrule> = evaluationsubruleMapper.selectAll()
+ override fun findAll(): MutableList<Evaluationsubrule2> = evaluationsubruleMapper.selectAll()
- override fun save(evaluationsubrule: Evaluationsubrule): Int = evaluationsubruleMapper.insert(evaluationsubrule)
+ override fun save(evaluationsubrule: Evaluationsubrule2): Int = evaluationsubruleMapper.insert(evaluationsubrule)
- override fun update(evaluationsubrule: Evaluationsubrule): Int =
+ override fun update(evaluationsubrule: Evaluationsubrule2): Int =
evaluationsubruleMapper.updateByPrimaryKey(evaluationsubrule)
override fun delete(id: String): Int = evaluationsubruleMapper.deleteByPrimaryKey(id)
@@ -38,13 +38,13 @@
return evaluationRuleRep.findSubRule(erguid)
}
- override fun search(districtCode: String, sceneTypeId: String, version: String?): List<Evaluationsubrule> {
- val result = mutableListOf<Evaluationsubrule>()
+ override fun search(districtCode: String, sceneTypeId: String, version: String?): List<Evaluationsubrule2> {
+ val result = mutableListOf<Evaluationsubrule2>()
evaluationruleMapper.selectByExample(Example(Evaluationrule::class.java).apply {
createCriteria().andEqualTo("districtcode", districtCode)
.andEqualTo("scensetypeid", sceneTypeId)
}).takeIf { it.isNotEmpty() }?.get(0)?.let { rule ->
- evaluationsubruleMapper.selectByExample(Example(Evaluationsubrule::class.java).apply {
+ evaluationsubruleMapper.selectByExample(Example(Evaluationsubrule2::class.java).apply {
createCriteria().andEqualTo("erguid", rule.guid)
})
}?.also {
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 00c861d..7515ab9 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/EvaluationController.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/EvaluationController.kt
@@ -5,7 +5,9 @@
import cn.flightfeather.supervision.lightshare.vo.AreaVo
import io.swagger.annotations.Api
import io.swagger.annotations.ApiOperation
+import io.swagger.annotations.ApiParam
import org.springframework.web.bind.annotation.*
+import org.springframework.web.multipart.MultipartFile
import springfox.documentation.annotations.ApiIgnore
import javax.servlet.http.HttpServletResponse
@@ -71,7 +73,22 @@
@ApiOperation(value = "涓嬭浇鑷姩璇勪及缁撴灉")
@PostMapping("/auto/record/download")
fun downloadAutoEvaluation(
- @RequestBody areaVo: AreaVo, @RequestParam forceUpdate: Boolean,
+ @ApiParam("鍖哄煙鏉′欢淇℃伅") @RequestBody areaVo: AreaVo,
+ @ApiParam("鏄惁寮哄埗鐢熸垚鏂扮殑鎶ュ憡") @RequestParam forceUpdate: Boolean,
@ApiIgnore response: HttpServletResponse,
) = resPack { evaluationService.downloadAutoEvaluation(areaVo, forceUpdate, response) }
+
+ @ApiOperation(value = "涓嬭浇鑷姩璇勪及缁撴灉瀵煎叆妯℃澘")
+ @PostMapping("/auto/record/template")
+ fun downloadAutoEvaTemplate(
+ @ApiParam("鍖哄煙鏉′欢淇℃伅") @RequestBody areaVo: AreaVo,
+ @ApiIgnore response: HttpServletResponse,
+ ) = resPack { evaluationService.downloadAutoEvaTemplate(areaVo, response) }
+
+ @ApiOperation(value = "涓婁紶鑷姩璇勪及缁撴灉")
+ @PutMapping("/auto/record/upload")
+ fun uploadAutoEvaluation(
+ @ApiParam("鍖哄煙鏉′欢淇℃伅") @RequestBody areaVo: AreaVo,
+ @ApiParam("excel鏂囦欢") @RequestPart("excel") file: MultipartFile,
+ ) = resPack { evaluationService.uploadAutoEvaluation(areaVo, file) }
}
\ No newline at end of file
diff --git a/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/EvaluationsubruleController.kt b/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/EvaluationsubruleController.kt
index f19a551..8fc1806 100644
--- a/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/EvaluationsubruleController.kt
+++ b/src/main/kotlin/cn/flightfeather/supervision/lightshare/web/EvaluationsubruleController.kt
@@ -1,6 +1,6 @@
package cn.flightfeather.supervision.lightshare.web
-import cn.flightfeather.supervision.domain.ds1.entity.Evaluationsubrule
+import cn.flightfeather.supervision.domain.ds1.entity.Evaluationsubrule2
import cn.flightfeather.supervision.lightshare.service.EvaluationsubruleService
import io.swagger.annotations.Api
import io.swagger.annotations.ApiOperation
@@ -15,10 +15,10 @@
fun getAll() = evaluationsubruleService.findAll()
@PutMapping
- fun add(@RequestBody evaluationsubrule: Evaluationsubrule) = evaluationsubruleService.save(evaluationsubrule)
+ fun add(@RequestBody evaluationsubrule: Evaluationsubrule2) = evaluationsubruleService.save(evaluationsubrule)
@PostMapping
- fun update(@RequestBody evaluationsubrule: Evaluationsubrule) = evaluationsubruleService.update(evaluationsubrule)
+ fun update(@RequestBody evaluationsubrule: Evaluationsubrule2) = evaluationsubruleService.update(evaluationsubrule)
@GetMapping("/{id}")
fun getById(@PathVariable id: String) = evaluationsubruleService.findOne(id)
--
Gitblit v1.9.3