src/main/kotlin/cn/flightfeather/supervision/business/autooutput/datasource/AopDataSource.kt
@@ -7,6 +7,7 @@ import cn.flightfeather.supervision.domain.ds2.entity.LedgerSubType import cn.flightfeather.supervision.domain.ds2.entity.UserMap import cn.flightfeather.supervision.domain.ds2.entity.UserinfoTZ import cn.flightfeather.supervision.lightshare.vo.AreaVo import cn.flightfeather.supervision.lightshare.vo.EvaluationSubRuleVo import org.springframework.beans.BeanUtils import tk.mybatis.mapper.entity.Example @@ -39,6 +40,12 @@ } } // fun setResource(areaVo: AreaVo) { // val task = taskRep.findOneTask(areaVo) // val taskId = task?.tguid // val sceneType = areaVo.scensetypeid?.toInt() ?: throw BizException("åºæ¯ç±»åæªè®¾ç½®ï¼æ æ³è¯ä¼°") // } fun setResource(config: AopDataConfig) { config.sceneType ?: return evaluationScene.config = config src/main/kotlin/cn/flightfeather/supervision/lightshare/service/ItemevaluationService.kt
@@ -1,6 +1,8 @@ package cn.flightfeather.supervision.lightshare.service import cn.flightfeather.supervision.domain.ds1.entity.Itemevaluation import cn.flightfeather.supervision.lightshare.vo.AreaVo import cn.flightfeather.supervision.lightshare.vo.EvaluationUpdateVo import cn.flightfeather.supervision.lightshare.vo.ItemEvaluationVo @@ -29,4 +31,6 @@ fun createItemEvaluation(subTaskId: String, ruleId: String?, itemList: List<String>): Boolean fun updateItemEvaluation(subTaskId: String, ruleId: String?, itemList: List<String>): Boolean fun updateMonitorDataEva(evaVo: EvaluationUpdateVo): Boolean } src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/ItemevaluationServiceImpl.kt
@@ -9,7 +9,10 @@ import cn.flightfeather.supervision.domain.ds1.entity.Itemevaluation import cn.flightfeather.supervision.domain.ds1.mapper.ItemevaluationMapper import cn.flightfeather.supervision.domain.ds1.repository.SubTaskRep import cn.flightfeather.supervision.domain.ds1.repository.TaskRep import cn.flightfeather.supervision.lightshare.service.ItemevaluationService import cn.flightfeather.supervision.lightshare.vo.AreaVo import cn.flightfeather.supervision.lightshare.vo.EvaluationUpdateVo import cn.flightfeather.supervision.lightshare.vo.ItemEvaluationVo import org.springframework.beans.BeanUtils import org.springframework.stereotype.Service @@ -22,6 +25,7 @@ private val aopOutput: AopOutput, private val aopSceneTypeCheck: AopSceneTypeCheck, private val subTaskRep: SubTaskRep, private val taskRep: TaskRep, ) : ItemevaluationService { //æ¹éä¿®æ¹å项è¯ä¼° @@ -106,4 +110,24 @@ throw BizException("åºç°ç³»ç»å é¨é误") } } override fun updateMonitorDataEva(evaVo: EvaluationUpdateVo): Boolean { val task = taskRep.findOneTask(evaVo) val taskId = task?.tguid val sceneType = evaVo.scensetypeid?.toInt() ?: throw BizException("åºæ¯ç±»åæªè®¾ç½®ï¼æ æ³æ´æ°åæ°") val source = AopDataSource(aopDbMapper, aopSceneTypeCheck) source.setResource(taskId, sceneType, null, null) try { source.loop() { _, evaluationScene -> if (evaluationScene.noRecord()) throw BizException("å·¡æ¥ä»»å¡ä¸åå¨") // å°åæ°èµå¼å°å¯¹åºçè¯ä¼°è§åä¸ï¼å¹¶ä¸èªå¨è®¡ç®å ¶ä½è§åçå¾å ScoreUtil.scoreAssign(evaluationScene, itemList) // è·åæ»ååå项å¾åæ°æ®åºè¡¨ç»æä½ï¼å¹¶å ¥åº ScoreUtil.updateEvaRecord(evaluationScene)?.let { aopOutput.updateDbEvaluation(evaluationScene, it) } } return true } catch (e: Exception) { throw BizException("åºç°ç³»ç»å é¨é误") } } } src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/AreaEvaVo.kt
@@ -6,7 +6,7 @@ * è¯ä¼°è§åæ¥è¯¢æ¡ä»¶ */ @JsonInclude(JsonInclude.Include.NON_NULL) class AreaEvaVo : AreaVo() { open class AreaEvaVo : AreaVo() { // è¯ä¼°è§åç±»åï¼1ï¼å·¡æ¥æ åµè¯ä¼°ï¼99ï¼èªå¨è¯ä¼° var taskTypeId: Int = 1 } src/main/kotlin/cn/flightfeather/supervision/lightshare/vo/EvaluationUpdateVo.kt
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,22 @@ package cn.flightfeather.supervision.lightshare.vo import io.swagger.annotations.ApiModel import io.swagger.annotations.ApiModelProperty /** * å·¡æ¥ä»»å¡çæµæ°æ®å¼å¸¸æ£å * @date 2024/9/28 * @author feiyu02 */ @ApiModel("å·¡æ¥ä»»å¡çæµæ°æ®å¼å¸¸æ£å") class EvaluationUpdateVo : AreaEvaVo() { @ApiModelProperty("å·¡æ¥ä»»å¡ä¸»é®") var subTaskId: String? = null @ApiModelProperty("è¯ä¼°è§åid") var ruleId: String? = null @ApiModelProperty("å ·ä½è¯ä¼°æ¡ç®æ¯å¦å¾é", notes = "å¯¹è±¡ç»æä¸ºè¯ä¼°æ¡ç®ç主é®åæ¯å¦å¾éå½¢æçé®å¼å¯¹å表") var subRule: List<Pair<String, Boolean>>? = null } src/main/kotlin/cn/flightfeather/supervision/lightshare/web/ItemevaluationController.kt
@@ -3,12 +3,11 @@ import cn.flightfeather.supervision.domain.ds1.entity.Itemevaluation import cn.flightfeather.supervision.lightshare.service.ItemevaluationService import cn.flightfeather.supervision.lightshare.vo.AreaVo import cn.flightfeather.supervision.lightshare.vo.EvaluationUpdateVo import io.swagger.annotations.Api import io.swagger.annotations.ApiOperation import io.swagger.annotations.ApiParam import org.springframework.web.bind.annotation.* import springfox.documentation.annotations.ApiIgnore import javax.servlet.http.HttpServletResponse @Api(tags = ["ItemevaluationController"], description = "è¯ä¼°å项å¾åAPIæ¥å£") @RestController @@ -55,4 +54,10 @@ @RequestParam(required = false) ruleId: String?, @ApiParam(value = "å ·ä½æ£åæ¡ç®ä¸»é®ï¼åªä¼ æå°çº§å«çè¯ä¼°é¡¹ï¼") @RequestBody itemList: List<String>, ) = resPack { itemevaluationService.updateItemEvaluation(subTaskId, ruleId, itemList) } @ApiOperation(value = "æ¹éæ´æ°è¯ä¼°ç»æ") @PostMapping("/update/multiple") fun updateMonitorDataEva( @ApiParam("å¾åä¿®æ¹ç»è") @RequestBody evaVo: EvaluationUpdateVo, ) = resPack { itemevaluationService.updateMonitorDataEva(evaVo) } }