| | |
| | | import cn.flightfeather.supervision.domain.ds1.mapper.EvaluationMapper |
| | | import cn.flightfeather.supervision.domain.ds1.mapper.ItemevaluationMapper |
| | | import org.springframework.stereotype.Component |
| | | import org.springframework.transaction.annotation.Transactional |
| | | import tk.mybatis.mapper.entity.Example |
| | | |
| | | /** |
| | |
| | | /** |
| | | * å°è¯åè®°å½è¾åºè³æ°æ®åº |
| | | */ |
| | | @Transactional |
| | | fun toDbEvaluation(evaluationScene: AopDataSource.EvaluationScene, p: Pair<Evaluation, List<Itemevaluation>>) { |
| | | //å»é¤å·²æè®°å½ |
| | | evaluationMapper.deleteByExample(Example(Evaluation::class.java).apply { |
| | |
| | | /** |
| | | * å°è¯åè®°å½æ´æ°è³æ°æ®åº |
| | | */ |
| | | @Transactional |
| | | fun updateDbEvaluation(evaluationScene: AopDataSource.EvaluationScene, p: Pair<Evaluation, List<Itemevaluation>>) { |
| | | evaluationMapper.updateByPrimaryKey(p.first) |
| | | p.second.forEach { il -> itemevaluationMapper.updateByPrimaryKey(il) } |
| | |
| | | import cn.flightfeather.supervision.domain.ds2.repository.UserMapRep |
| | | import org.springframework.stereotype.Component |
| | | import java.time.LocalDate |
| | | import java.time.ZoneId |
| | | import java.util.* |
| | | |
| | | /** |
| | | * æ ¹æ®èªå¨è¯ä¼°[AopEvaluation]ç»æçæç¯ä¿¡ç |
| | |
| | | userMapRep.findFromSupervision(it)?.let { s -> |
| | | // ä»é£ç¾½ç管系ç»ä¸æ¥æ¾è¯å |
| | | val e = evaluationRep.findByScene(s.guid, date) |
| | | e?.resultscorebef?.toInt()?.let {score -> |
| | | if (e.isNotEmpty()) { |
| | | // æ ¹æ®è¯åçæå¯¹åºçç¯ä¿¡ç |
| | | var score = 0 |
| | | e.forEach {eva -> |
| | | val s = eva?.resultscorebef?.toInt() ?: 0 |
| | | if (s > score) score = s |
| | | } |
| | | overallEvaluationRep.insertOrUpdateOne(it?.guid, score, sceneType, date, endDate) |
| | | } else { |
| | | // TODO: 2024/12/6 彿²¡ææ¾å°èªå¨è¯åè®°å½æ¶ï¼éç¨å岿æ°çç¯ä¿¡ç è®°å½ä½ä¸ºæ¬æè®°å½ |
| | | overallEvaluationRep.selectLatest(it?.guid)?.let {o -> |
| | | overallEvaluationRep.insertOrUpdateOne(o.biGuid, o.oeScore, sceneType, date, endDate) |
| | | } |
| | | } |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.flightfeather.supervision.business.crosstimechange |
| | | |
| | | import cn.flightfeather.supervision.common.utils.DateUtil |
| | | import cn.flightfeather.supervision.common.utils.ExcelUtil |
| | | import cn.flightfeather.supervision.domain.ds1.entity.Problemlist |
| | | import cn.flightfeather.supervision.domain.ds1.repository.ProblemRep |
| | | import cn.flightfeather.supervision.domain.ds1.repository.SubTaskRep |
| | | import cn.flightfeather.supervision.lightshare.vo.AreaVo |
| | | import org.springframework.stereotype.Component |
| | | import java.io.File |
| | | import java.io.FileOutputStream |
| | | import java.time.format.DateTimeFormatter |
| | | |
| | | /** |
| | | * è·¨æ¶é´è·¨æåº¦æ´æ¹ |
| | | * @date 2024/12/20 |
| | | * @author feiyu02 |
| | | */ |
| | | @Component |
| | | class CrossTimeChangeManager(private val subTaskRep: SubTaskRep, private val problemRep: ProblemRep) { |
| | | |
| | | /** |
| | | * æ§è¡è·¨æåº¦è·¨æ¶é´æ´æ¹åæ |
| | | * @param areaVo ç鿡件ï¼å
æ¬åºåãåºæ¯ç±»åãæ¶é´èå´ |
| | | */ |
| | | fun execute(areaVo: AreaVo, fileName: String) { |
| | | val pbGroupList = searchProblem(areaVo) |
| | | pbGroupList.forEach { changeAnalysis(it) } |
| | | formatToExcel(areaVo, pbGroupList, fileName) |
| | | } |
| | | |
| | | /** |
| | | * æ¥è¯¢èå´å
çåºæ¯ååæåº¦é®é¢ |
| | | */ |
| | | fun searchProblem(areaVo: AreaVo): List<ScenePbGroup> { |
| | | // è·åèå´å
ææçå·¡æ¥è®°å½åå
·ä½é®é¢ |
| | | val summary = subTaskRep.findSummary(areaVo) |
| | | // æç
§åºæ¯è¿è¡å½ç±» |
| | | val sceneMap = mutableMapOf<String?, ScenePbGroup>() |
| | | summary.forEach { |
| | | if (!sceneMap.containsKey(it.sceneId)) { |
| | | sceneMap[it.sceneId] = ScenePbGroup().apply { |
| | | scene = it.scene |
| | | } |
| | | } |
| | | sceneMap[it.sceneId]?.apply { |
| | | pbGroup.add(ProblemInfo().apply { |
| | | subtask = it.subtask |
| | | val pList = problemRep.find(Problemlist().apply { |
| | | stguid = it.stGuid |
| | | }) |
| | | pbList.addAll(pList) |
| | | }) |
| | | } |
| | | } |
| | | // å°å½ç±»å¥½çååºæ¯é®é¢æç
§å·¡æ¥æ¶é´ååºæå并转æ¢ä¸ºæ°ç»ç»æ |
| | | val res = mutableListOf<ScenePbGroup>() |
| | | sceneMap.forEach { (t, u) -> |
| | | u.pbGroup.sortBy { it?.subtask?.planstarttime } |
| | | res.add(u) |
| | | } |
| | | // å°åºæ¯æç
§å¯ä¸ç¼å·ååºæåï¼éå¿
è¦ï¼ |
| | | res.sortBy { it.scene?.index } |
| | | |
| | | return res |
| | | } |
| | | |
| | | /** |
| | | * åæåä¸ªåºæ¯åæé®é¢æ¯å¦å¯ä»¥æ´æ¹ |
| | | */ |
| | | fun changeAnalysis(scenePbGroup: ScenePbGroup) { |
| | | scenePbGroup.pbGroup.forEachIndexed {i,it -> |
| | | it?.pbList?.forEach { p -> |
| | | // å·²æ´æ¹çé®é¢ç¥è¿ |
| | | if (p?.ischanged == true) return@forEach |
| | | |
| | | // æ¾å°ç»æï¼ææä¸ä¸ªææªåºç°æ¤é®é¢ï¼æè
åºç°äºæ¤é®é¢ä½å·²æ´æ¹ï¼ï¼åå
è®¸å°æ¤åå²é®é¢ä½ä¸ºå·²æ´æ¹ |
| | | var found = false |
| | | |
| | | // ååç»æåº¦æ¥æ¾æ¯å¦æç¸åçé®é¢åºç° |
| | | var index = i + 1 |
| | | while (!found && index < scenePbGroup.pbGroup.size) { |
| | | val nextGroup = scenePbGroup.pbGroup[index] |
| | | val result = nextGroup?.pbList?.find { nP -> |
| | | nP?.ptguid == p?.ptguid |
| | | } |
| | | // è¯¥ææªåºç°æ¤é®é¢ï¼æè
åºç°äºæ¤é®é¢ä½å·²æ´æ¹ |
| | | if (result == null || result.ischanged == true) { |
| | | found = true |
| | | } |
| | | index++ |
| | | } |
| | | |
| | | // è¥è¯¥é®é¢ç¬¦åæ´æ¹æ¡ä»¶ï¼åæ·»å è³å¯æ´æ¹å表 |
| | | if (found) { |
| | | it.pbChangeList.add(p) |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * æ ¼å¼åè¾åºè³excelæä»¶ |
| | | */ |
| | | fun formatToExcel(areaVo: AreaVo, pbGroupList: List<ScenePbGroup>, fileName: String) { |
| | | if (pbGroupList.isEmpty()) return |
| | | |
| | | val h = mutableListOf<MutableList<Any>>() |
| | | val c = mutableListOf<MutableList<Any>>() |
| | | |
| | | // çæè¡¨å¤´ |
| | | val h1 = mutableListOf<Any>("å¯ä¸ç¼å·", "åºæ¯") |
| | | val monHead = mutableListOf<String>() |
| | | var time = areaVo.starttime?.toLocalDate() |
| | | val end = areaVo.endtime?.toLocalDate() |
| | | // æ¤å¤å¼å§æ¶é´åºä¸ºæåï¼ç»ææ¶é´åºä¸ºææ«ï¼åå¯ä»¥ç´æ¥ç¨isBeforeæ¯è¾ |
| | | while (time?.isBefore(end) == true) { |
| | | monHead.add(time.format(DateTimeFormatter.ofPattern("YYYY-MM"))) |
| | | time = time.plusMonths(1) |
| | | } |
| | | monHead.forEach { |
| | | val str = it.split("-")[1] + "æ" |
| | | h1.addAll(listOf(str + "é®é¢", str + "æªæ´æ¹", str + "æªæ´æ¹æ°")) |
| | | } |
| | | monHead.forEach { |
| | | val str = it.split("-")[1] + "æ" |
| | | h1.addAll(listOf(str + "坿´æ¹", str + "åæ´æ¹æ°", str + "æ°å¢å¯æ´æ¹æ°")) |
| | | } |
| | | h.add(h1) |
| | | |
| | | // çæå
容 |
| | | pbGroupList.forEach {pbg -> |
| | | val index = pbg.scene?.index ?: "" |
| | | val name = pbg.scene?.name ?: "" |
| | | |
| | | val problemContent = mutableListOf<Any>() |
| | | monHead.forEach {mH -> |
| | | val stp = pbg.pbGroup.find { pbi -> |
| | | DateUtil.DateToString(pbi?.subtask?.planstarttime, DateUtil.DateStyle.YYYY_MM) == mH |
| | | } |
| | | |
| | | if (stp == null) { |
| | | problemContent.addAll(listOf("/", "/", "/")) |
| | | } else { |
| | | // é®é¢ |
| | | problemContent.add(stp.pbList.mapIndexed { i, pb -> "${i+1}ã${pb?.problemname}" }.joinToString |
| | | ("\n")) |
| | | val unchanged = stp.pbList.filter { pb-> pb?.ischanged != true } |
| | | // æªæ´æ¹ |
| | | problemContent.add(unchanged.mapIndexed { i, pb -> "${i+1}ã${pb?.problemname}" }.joinToString("\n")) |
| | | // æªæ´æ¹æ° |
| | | problemContent.add(unchanged.size) |
| | | } |
| | | } |
| | | |
| | | val willChangeContent = mutableListOf<Any>() |
| | | monHead.forEach {mH -> |
| | | val stp = pbg.pbGroup.find { pbi -> |
| | | DateUtil.DateToString(pbi?.subtask?.planstarttime, DateUtil.DateStyle.YYYY_MM) == mH |
| | | } |
| | | |
| | | if (stp == null) { |
| | | willChangeContent.addAll(listOf("/", "/", "/")) |
| | | } else { |
| | | // 坿´æ¹ |
| | | willChangeContent.add(stp.pbChangeList.mapIndexed { i, pb -> "${i+1}ã${pb?.problemname}" } |
| | | .joinToString("\n")) |
| | | val changed = stp.pbList.filter { pb-> pb?.ischanged == true } |
| | | // åæ´æ¹æ° |
| | | willChangeContent.add(changed.size) |
| | | // æ°å¢å¯æ´æ¹æ° |
| | | willChangeContent.add(stp.pbChangeList.size) |
| | | } |
| | | } |
| | | |
| | | val row = mutableListOf<Any>() |
| | | row.add(index) |
| | | row.add(name) |
| | | row.addAll(problemContent) |
| | | row.addAll(willChangeContent) |
| | | |
| | | c.add(row) |
| | | } |
| | | |
| | | // çææä»¶ |
| | | val file = File("target/${fileName}") |
| | | val out = FileOutputStream(file) |
| | | ExcelUtil.write2(out, h.map { it.toTypedArray() }, c.map { it.toTypedArray() }.toMutableList()) |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.flightfeather.supervision.business.crosstimechange |
| | | |
| | | import cn.flightfeather.supervision.domain.ds1.entity.Problemlist |
| | | import cn.flightfeather.supervision.domain.ds1.entity.Subtask |
| | | |
| | | /** |
| | | * é®é¢æ´æ¹æ
åµ |
| | | * @date 2024/12/20 |
| | | * @author feiyu02 |
| | | */ |
| | | class ProblemInfo { |
| | | |
| | | // å·¡æ¥ä»»å¡ |
| | | var subtask: Subtask? = null |
| | | |
| | | // åå²é®é¢ |
| | | val pbList = mutableListOf<Problemlist?>() |
| | | |
| | | // å¯è¢«è·¨æ¶é´è·¨æåº¦æ´æ¹çé®é¢ |
| | | val pbChangeList = mutableListOf<Problemlist?>() |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.flightfeather.supervision.business.crosstimechange |
| | | |
| | | import cn.flightfeather.supervision.domain.ds1.entity.Scense |
| | | |
| | | /** |
| | | * åºæ¯è·¨æåº¦é®é¢ç» |
| | | * @date 2024/12/20 |
| | | * @author feiyu02 |
| | | */ |
| | | class ScenePbGroup { |
| | | |
| | | // åºæ¯ |
| | | var scene: Scense? = null |
| | | |
| | | // 忥åæä»½çé®é¢æ
åµ |
| | | val pbGroup = mutableListOf<ProblemInfo?>() |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | è·¨æ¶é´è·¨æåº¦æ´æ¹ |
| | | |
| | | 对äºåä¸å®¶åºæ¯ï¼ä»¥N个æä¸ºå¨æï¼éè¦å¤ææ¯ä¸ªææªæ´æ¹çé®é¢å¨åç»æä»½çç®¡ä¸æ¯å¦æªåºç°ï¼è¥æªåºç°ï¼å认为该é®é¢å·²æ´æ¹ |
| | | |
| | | å
·ä½é»è¾ |
| | | 1. çéè¿N个æçé®é¢ï¼ |
| | | 2. 循ç¯å¤ææ¯ä¸ªæçæ¯ä¸ªæªæ´æ¹é®é¢ï¼å¨åç»æä»½ä¸ï¼è¥è³å°æä¸ä¸ªææªåºç°è¿è¯¥é®é¢ï¼å认为该é®é¢å·²æ´æ¹ |
| | |
| | | */ |
| | | fun areaName(): String { |
| | | val t = dbMapper.taskMapper.selectByPrimaryKey(config.topTaskGuid) |
| | | return "${DateUtil.DateToString(t.starttime, DateUtil.DateStyle.YYYY_MM_CN)}${t.districtname}${if (area != t.districtname) area else ""}${Constant.SceneType.getDes(config.sceneType)}" |
| | | return "${DateUtil.DateToString(config.startTime, DateUtil.DateStyle.YYYY_MM_CN)}${t.districtname}${if (area != t.districtname) area else ""}${Constant.SceneType.getDes(config.sceneType)}" |
| | | } |
| | | |
| | | /** |
| | |
| | | if (area.isBlank()) area = it.districtname ?: "" |
| | | } |
| | | |
| | | //1. æ¥æ¾ç¹å®çå·¡æ¥ä»»å¡æè
ææç计åå·¡æ¥ä»»å¡ |
| | | val taskSceneIdList = dbMapper.scenseMapper.getSceneByType(config.topTaskGuid, config.sceneType, |
| | | config.townCode).map { it.guid ?: "" } |
| | | |
| | | // ç»è®¡æ»ä»»å¡ä¸ææåºæ¯ |
| | | if (config.allScene) { |
| | | //1. æ¥æ¾ç¹å®çå·¡æ¥ä»»å¡æè
ææç计åå·¡æ¥ä»»å¡ |
| | | val taskSceneIdList = dbMapper.scenseMapper.getSceneByType(config.topTaskGuid, config.sceneType, |
| | | config.townCode).map { it.guid ?: "" } |
| | | |
| | | val subTaskList = dbMapper.subtaskMapper.selectByExample(Example(Subtask::class.java).apply { |
| | | createCriteria().apply { |
| | | if (taskSceneIdList.isNotEmpty()) andIn("scenseid", taskSceneIdList) |
| | |
| | | package cn.flightfeather.supervision.common.executor |
| | | |
| | | import cn.flightfeather.supervision.common.exception.BizException |
| | | import cn.flightfeather.supervision.socket.WebSocketSendMessageUtil |
| | | import org.springframework.stereotype.Component |
| | | import java.util.concurrent.ConcurrentHashMap |
| | | import java.util.concurrent.Executors |
| | |
| | | throw BizException("æ æ³éå¤å建任å¡") |
| | | } |
| | | } |
| | | val t = BgTask(type, id, name, task) |
| | | val t = BgTask(type, id, name, task) { status -> |
| | | // åéæ¶æ¯ |
| | | WebSocketSendMessageUtil.sendBgTaskMessage(status) |
| | | } |
| | | taskSet[id] = t |
| | | return t |
| | | } |
| | |
| | | } |
| | | } else { |
| | | task.ready() |
| | | task.future = executorService.submit { task.execute() } |
| | | task.future = executorService.submit { |
| | | task.execute() |
| | | } |
| | | return task |
| | | } |
| | | } |
| | |
| | | val id: String, |
| | | val name: String, |
| | | private val task: () -> Boolean, |
| | | private val onStatusChange: (status: BgTaskStatus) -> Unit |
| | | ) { |
| | | var taskStatus = BgTaskStatus(type, id, name) |
| | | var future: Future<*>? = null |
| | | |
| | | fun ready() { |
| | | taskStatus.status = TaskStatus.RUNNING |
| | | taskStatus.startTime = LocalDateTime.now() |
| | | setStatus(TaskStatus.RUNNING) |
| | | } |
| | | |
| | | fun execute() { |
| | |
| | | } |
| | | |
| | | fun success() { |
| | | taskStatus.status = TaskStatus.SUCCESS |
| | | complete() |
| | | setStatus(TaskStatus.SUCCESS) |
| | | } |
| | | |
| | | fun fail() { |
| | | taskStatus.status = TaskStatus.FAIL |
| | | complete() |
| | | setStatus(TaskStatus.FAIL) |
| | | } |
| | | |
| | | fun shutdown() { |
| | | if (future?.isCancelled == false && !future!!.isDone) { |
| | | future!!.cancel(true) |
| | | } |
| | | taskStatus.status = TaskStatus.SHUTDOWN |
| | | complete() |
| | | setStatus(TaskStatus.SHUTDOWN) |
| | | } |
| | | |
| | | fun complete() { |
| | | taskStatus.endTime = LocalDateTime.now() |
| | | } |
| | | |
| | | fun setStatus(status: TaskStatus) { |
| | | taskStatus.status = status |
| | | onStatusChange(taskStatus) |
| | | } |
| | | } |
| | |
| | | package cn.flightfeather.supervision.common.executor |
| | | |
| | | import cn.flightfeather.supervision.socket.LocalDateTimeAdapter |
| | | import com.google.gson.annotations.JsonAdapter |
| | | import java.time.Duration |
| | | import java.time.LocalDateTime |
| | | |
| | |
| | | var status: TaskStatus = TaskStatus.WAITING |
| | | |
| | | // å¼å§æ¶é´ |
| | | @JsonAdapter(LocalDateTimeAdapter::class) |
| | | var startTime: LocalDateTime? = null |
| | | |
| | | // ç»ææ¶é´ |
| | | @JsonAdapter(LocalDateTimeAdapter::class) |
| | | var endTime: LocalDateTime? = null |
| | | |
| | | // å建æ¶é´ |
| | | @JsonAdapter(LocalDateTimeAdapter::class) |
| | | var createTime: LocalDateTime = LocalDateTime.now() |
| | | |
| | | // è¿è¡æ¶é¿ï¼ç§ï¼ |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.flightfeather.supervision.common.executor; |
| | | |
| | | import com.google.gson.JsonElement; |
| | | import com.google.gson.JsonObject; |
| | | import com.google.gson.JsonSerializationContext; |
| | | import com.google.gson.JsonSerializer; |
| | | import java.lang.reflect.Type; |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | |
| | | /** |
| | | * BgTaskStatusç±»çèªå®ä¹åºååç±» è§£å³äºè®¡ç®å±æ§æ æ³åºååçé®é¢ |
| | | * by hc 2024.12.10 |
| | | */ |
| | | public class BgTaskStatusJsonSerializer implements JsonSerializer<BgTaskStatus> { |
| | | |
| | | @Override |
| | | public JsonElement serialize(BgTaskStatus bgTaskStatus, Type typeOfSrc, JsonSerializationContext context) { |
| | | JsonObject jsonObject = new JsonObject(); |
| | | // åºååtype |
| | | jsonObject.addProperty("type", String.valueOf(bgTaskStatus.getType())); |
| | | // åºååid |
| | | jsonObject.addProperty("id", bgTaskStatus.getId()); |
| | | // åºååname |
| | | jsonObject.addProperty("name", bgTaskStatus.getName()); |
| | | // åºååstatus |
| | | jsonObject.addProperty("status", String.valueOf(bgTaskStatus.getStatus())); |
| | | // åºååstartTime |
| | | jsonObject.addProperty("startTime", formatLocalDateTime(bgTaskStatus.getStartTime())); |
| | | // åºååendTime |
| | | jsonObject.addProperty("endTime", formatLocalDateTime(bgTaskStatus.getEndTime())); |
| | | // åºååcreateTime |
| | | jsonObject.addProperty("createTime", formatLocalDateTime(bgTaskStatus.getCreateTime())); |
| | | // åºåå 计ç®å±æ§runTime |
| | | jsonObject.addProperty("runTime", bgTaskStatus.getRunTime()); |
| | | // åºååextra |
| | | if (bgTaskStatus.getExtra() != null) { |
| | | jsonObject.add("extra", context.serialize(bgTaskStatus.getExtra())); |
| | | } |
| | | return jsonObject; |
| | | } |
| | | |
| | | private String formatLocalDateTime(LocalDateTime localDateTime) { |
| | | // 妿LocalDateTime为nullï¼åè¿ånull |
| | | if (localDateTime == null) { |
| | | return null; |
| | | } |
| | | // æ ¼å¼åLocalDateTime |
| | | return DateTimeFormatter.ISO_LOCAL_DATE_TIME.format(localDateTime); |
| | | } |
| | | } |
| | |
| | | TYPE9("9","éè·¯æ¬å°çæµç¹"), TYPE10("10","éè·¯"), |
| | | TYPE11("11","æ²³æµæé¢"), TYPE12("12","å·¥ä¸ååº"), |
| | | TYPE13("13","æ åºå®åºæ¯"),TYPE14("14","å åº"), |
| | | TYPE15("15","ç²¾åå°åº"), |
| | | TYPE99("99","å
¶ä»"); |
| | | |
| | | companion object { |
| | |
| | | MULTI_MODE("multi_mode", "å¤é模å¼"), |
| | | } |
| | | |
| | | // socketæ¶æ¯ç±»å |
| | | enum class SocketMessageType(val value: Int, val des: String){ |
| | | BG_TASK(1, "åå°ä»»å¡"), |
| | | BUSINESS_LOG(2, "ä¸å¡æ¥å¿"), |
| | | } |
| | | |
| | | // socketå¿è·³æ¶æ¯ç±»å |
| | | enum class SocketHeartMessageType(val value: Int, val des: String){ |
| | | HEART_MESSAGE_TYPE(0, "å¿è·³æºå¶") |
| | | } |
| | | |
| | | |
| | | companion object { |
| | | //é®é¢å®¡æ ¸ |
| | |
| | | package cn.flightfeather.supervision.common.utils |
| | | |
| | | import cn.flightfeather.supervision.common.executor.BgTaskStatus |
| | | import cn.flightfeather.supervision.common.executor.BgTaskStatusJsonSerializer |
| | | import com.google.gson.Gson |
| | | import com.google.gson.GsonBuilder |
| | | |
| | | object JsonUtil { |
| | | |
| | | val gson: Gson = GsonBuilder().setDateFormat("yyyy-MM-dd HH:mm:ss").create() |
| | | val gson: Gson = GsonBuilder().setDateFormat("yyyy-MM-dd HH:mm:ss") |
| | | .registerTypeAdapter(BgTaskStatus::class.java, BgTaskStatusJsonSerializer()) |
| | | .create() |
| | | } |
| | |
| | | |
| | | import cn.flightfeather.supervision.domain.ds1.entity.DustDataResult |
| | | import cn.flightfeather.supervision.domain.util.MyMapper |
| | | import cn.flightfeather.supervision.lightshare.vo.AreaVo |
| | | import org.apache.ibatis.annotations.Mapper |
| | | |
| | | @Mapper |
| | | interface DustDataResultMapper : MyMapper<DustDataResult?> |
| | | interface DustDataResultMapper : MyMapper<DustDataResult?> { |
| | | |
| | | fun selectByArea(areaVo: AreaVo): List<DustDataResult?> |
| | | } |
| | |
| | | |
| | | import cn.flightfeather.supervision.domain.ds1.entity.Problemlist |
| | | import cn.flightfeather.supervision.domain.util.MyMapper |
| | | import cn.flightfeather.supervision.lightshare.vo.AreaVo |
| | | import cn.flightfeather.supervision.lightshare.vo.SceneProblemSummary |
| | | import cn.flightfeather.supervision.lightshare.vo.StatisticsVo |
| | | import cn.flightfeather.supervision.lightshare.vo.UnChangedPro |
| | |
| | | |
| | | /** |
| | | * è·åææ¶é´æ®µå
ãæä¸ªåºå¿çæç§åºæ¯ä¸ï¼åç±»åçé®é¢æ°éç»è®¡ |
| | | * @param districtCode åºå¿è¡æ¿ç¼ç |
| | | * @param startTime å¼å§æ¶é´ |
| | | * @param endTime ç»ææ¶é´ |
| | | * @param sceneType åºæ¯ç±»å |
| | | */ |
| | | fun getStatisticalResult( |
| | | districtCode: String?, |
| | | startTime: String?, |
| | | endTime: String?, |
| | | sceneType: String?, |
| | | sceneId: String?, |
| | | ): List<StatisticsVo> |
| | | fun getStatisticalResult(areaVo: AreaVo): List<StatisticsVo> |
| | | |
| | | fun getStatisticalResultById(topTaskId: String?, sceneTypeId: String?): List<Map<String, JvmType.Object>> |
| | | |
| | |
| | | fun getUnChangedProblem(deadLine: String): List<UnChangedPro> |
| | | |
| | | /** |
| | | * è·åæ»ä»»å¡ |
| | | * è·ååºæ¯é®é¢ç»è®¡ |
| | | */ |
| | | fun getSceneProSummary( |
| | | topTaskId: String, |
| | | sceneTypeId: String?, |
| | | sort: String?, |
| | | sortBy: String, |
| | | ): List<SceneProblemSummary> |
| | | fun getSceneProSummary(areaVo: AreaVo): List<SceneProblemSummary> |
| | | } |
| | |
| | | * @param date æ¥æï¼åªä½¿ç¨å¹´åæ |
| | | * @return |
| | | */ |
| | | fun findByScene(sceneId: String?, date: LocalDate): Evaluation? { |
| | | fun findByScene(sceneId: String?, date: LocalDate): List<Evaluation?> { |
| | | val sT = date.withDayOfMonth(1).atStartOfDay() |
| | | val eT = sT.plusMonths(1).minusSeconds(1) |
| | | val res = evaluationMapper.selectByExample(Example(Evaluation::class.java).apply { |
| | | createCriteria().andEqualTo("sguid", sceneId) |
| | | .andBetween("evaluatetime", sT, eT) |
| | | }) |
| | | return if (res.isNotEmpty()) res[0] else null |
| | | return res |
| | | } |
| | | |
| | | fun findBySubtask(subTaskId: String?): Evaluation? { |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.flightfeather.supervision.domain.ds1.repository |
| | | |
| | | import cn.flightfeather.supervision.domain.ds1.entity.DustDataResult |
| | | import cn.flightfeather.supervision.domain.ds1.mapper.DustDataResultMapper |
| | | import cn.flightfeather.supervision.lightshare.vo.AreaVo |
| | | import org.springframework.stereotype.Repository |
| | | |
| | | /** |
| | | * çæµæ°æ®æ°æ®åºæ¥è¯¢ |
| | | * @date 2025/3/19 |
| | | * @author feiyu02 |
| | | */ |
| | | @Repository |
| | | class MonitorDataRep( |
| | | private val dataResultMapper: DustDataResultMapper, |
| | | ) { |
| | | |
| | | /** |
| | | * æ ¹æ®è¡æ¿åºåãæ¶é´ã以ååºæ¯ç±»åæ¥è¯¢ç»æ |
| | | */ |
| | | fun fetchDustDataResult(areaVo: AreaVo): List<DustDataResult?> { |
| | | return dataResultMapper.selectByArea(areaVo) |
| | | } |
| | | } |
| | |
| | | |
| | | import cn.flightfeather.supervision.domain.ds1.entity.Problemlist |
| | | import cn.flightfeather.supervision.domain.ds1.mapper.ProblemlistMapper |
| | | import cn.flightfeather.supervision.lightshare.vo.AreaVo |
| | | import cn.flightfeather.supervision.lightshare.vo.SceneProblemSummary |
| | | import org.springframework.stereotype.Repository |
| | | |
| | |
| | | return problemlistMapper.updateByPrimaryKey(problemlist) |
| | | } |
| | | |
| | | fun find(problemlist: Problemlist): List<Problemlist?> { |
| | | return problemlistMapper.select(problemlist) |
| | | } |
| | | |
| | | /** |
| | | * è·åååºæ¯çé®é¢åæ´æ¹æ°éç»è®¡ |
| | | */ |
| | | fun selectSceneProSummary(topTaskId: String, sceneTypeId: String?, sort: String?, sortBy: String): |
| | | List<SceneProblemSummary> { |
| | | return problemlistMapper.getSceneProSummary(topTaskId, sceneTypeId, sort, sortBy) |
| | | fun selectSceneProSummary(areaVo: AreaVo): List<SceneProblemSummary> { |
| | | return problemlistMapper.getSceneProSummary(areaVo) |
| | | } |
| | | |
| | | fun findOne(guid: String?): Problemlist? { |
| | |
| | | @Repository |
| | | class TaskRep(private val taskMapper: TaskMapper, private val monitorobjectversionMapper: MonitorobjectversionMapper) { |
| | | |
| | | private fun exampleTask(areaVo: AreaVo): Task?{ |
| | | private fun exampleTask(areaVo: AreaVo, levelNum: Int? = null): Example? { |
| | | areaVo.starttime ?: return null |
| | | 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 |
| | | citycode = areaVo.citycode |
| | | districtcode = areaVo.districtcode |
| | | starttime = Date.from(mStart.atZone(ZoneId.systemDefault()).toInstant()) |
| | | endtime = Date.from(mEnd.atZone(ZoneId.systemDefault()).toInstant()) |
| | | // return Task().apply { |
| | | // provincecode = areaVo.provincecode |
| | | // citycode = areaVo.citycode |
| | | // districtcode = areaVo.districtcode |
| | | // starttime = Date.from(mStart.atZone(ZoneId.systemDefault()).toInstant()) |
| | | // endtime = Date.from(mEnd.atZone(ZoneId.systemDefault()).toInstant()) |
| | | // } |
| | | |
| | | return Example(Task::class.java).apply { |
| | | createCriteria() |
| | | .apply { |
| | | if (levelNum != null) { |
| | | andEqualTo("levelnum", levelNum) |
| | | } else { |
| | | andIsNull("levelnum") |
| | | } |
| | | } |
| | | .andEqualTo("provincecode", areaVo.provincecode) |
| | | .andEqualTo("citycode", areaVo.citycode) |
| | | .andEqualTo("districtcode", areaVo.districtcode) |
| | | .andGreaterThanOrEqualTo("starttime", mStart) |
| | | .andLessThanOrEqualTo("endtime", mEnd) |
| | | orderBy("starttime") |
| | | } |
| | | } |
| | | |
| | |
| | | * æ¥æ¾ä¸ä¸ªæ»ä»»å¡ |
| | | */ |
| | | fun findOneTask(areaVo: AreaVo): Task? { |
| | | val example = exampleTask(areaVo) ?: return null |
| | | return taskMapper.selectOne(example) |
| | | val list = findTasks(areaVo) |
| | | return if (list.isEmpty()) { |
| | | null |
| | | } else { |
| | | list[0] |
| | | } |
| | | } |
| | | |
| | | fun findTasks(areaVo: AreaVo): List<Task?> { |
| | | val example = exampleTask(areaVo) ?: return emptyList() |
| | | return taskMapper.select(example) |
| | | val example = exampleTask(areaVo, 2) ?: return emptyList() |
| | | return taskMapper.selectByExample(example) |
| | | } |
| | | |
| | | fun findTasks(task: Task): List<Task?> { |
| | |
| | | /** |
| | | * è·åæ¥ä»»å¡ |
| | | * @param taskId é¡¶å±ä»»å¡id |
| | | * @param userId æ§è¡ç¨æ·id |
| | | */ |
| | | fun findDayTasks(taskId: String?): List<Task?> { |
| | | fun findDayTasks(taskId: String?, userId: String? = null): List<Task?> { |
| | | return taskMapper.selectByExample(Example(Task::class.java).apply { |
| | | createCriteria().andEqualTo("tsguid", taskId) |
| | | createCriteria().andEqualTo("tsguid", taskId).apply { |
| | | userId?.let { andLike("executorguids", "%$it%") } |
| | | } |
| | | orderBy("starttime").desc() |
| | | }) |
| | | } |
| | |
| | | import cn.flightfeather.supervision.domain.ds2.entity.OverallEvaluation |
| | | import cn.flightfeather.supervision.domain.ds2.mapper.OverallEvaluationMapper |
| | | import org.springframework.stereotype.Repository |
| | | import tk.mybatis.mapper.entity.Example |
| | | import java.time.LocalDate |
| | | import java.time.ZoneId |
| | | import java.util.* |
| | |
| | | class OverallEvaluationRep(private val overallEvaluationMapper: OverallEvaluationMapper){ |
| | | |
| | | /** |
| | | * è·åææ°è®°å½ |
| | | */ |
| | | fun selectLatest(userId: String?): OverallEvaluation? { |
| | | val res = overallEvaluationMapper.selectByExample(Example(OverallEvaluation::class.java).apply { |
| | | createCriteria().andEqualTo("biGuid", userId) |
| | | orderBy("oeUpdateTime").desc() |
| | | }) |
| | | return if (res.isNotEmpty()) res[0] else null |
| | | } |
| | | |
| | | /** |
| | | * æå
¥ä¸æ¡ç¯ä¿¡ç è®°å½ |
| | | * @param userId |
| | | * @param score |
| | |
| | | package cn.flightfeather.supervision.lightshare.service |
| | | |
| | | import cn.flightfeather.supervision.common.utils.Constant |
| | | import cn.flightfeather.supervision.domain.ds1.entity.Domaincatalog |
| | | import cn.flightfeather.supervision.lightshare.vo.AreaVo |
| | | import cn.flightfeather.supervision.lightshare.vo.DomaincatalogVo |
| | | |
| | | |
| | |
| | | fun update(domaincatalog: Domaincatalog): Int |
| | | |
| | | fun delete(id: String): Int |
| | | |
| | | /** |
| | | * å¿«æ·é
ç½® |
| | | * é对ä¸ç§æ°çåºæ¯ç±»åï¼è¿è¡å¿«éé
ç½® |
| | | */ |
| | | fun quickConfiguration( |
| | | target: Constant.SceneType, targetArea: AreaVo, source: Constant.SceneType, |
| | | sourceArea: AreaVo, |
| | | ): Boolean |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.flightfeather.supervision.lightshare.service |
| | | |
| | | import cn.flightfeather.supervision.domain.ds1.entity.DustDataResult |
| | | import cn.flightfeather.supervision.lightshare.vo.AreaVo |
| | | |
| | | /** |
| | | * çæµæ°æ®ï¼å
嫿¬å°çæµãæ²¹ççæµççææçæµæ°æ®ï¼æå¡ |
| | | * @date 2025/3/19 |
| | | * @author feiyu02 |
| | | */ |
| | | interface MonitorDataService { |
| | | |
| | | fun uploadDustDataResult(dataList: List<DustDataResult>): Boolean |
| | | |
| | | fun fetchDustDataResult(areaVo: AreaVo): List<DustDataResult?> |
| | | } |
| | |
| | | |
| | | fun getSceneByProType(areaVo: AreaVo, pType:String):List<Subtask?> |
| | | |
| | | fun getSceneProSummary(areaVo: AreaVo, sortBy: String, page: Int, per_page: Int): Pair<DataHead?, |
| | | List<SceneProblemSummary>?> |
| | | fun getSceneProSummary(areaVo: AreaVo, page: Int, per_page: Int): Pair<DataHead?, List<SceneProblemSummary>?> |
| | | } |
| | |
| | | package cn.flightfeather.supervision.lightshare.service |
| | | |
| | | import cn.flightfeather.supervision.common.utils.Constant |
| | | import cn.flightfeather.supervision.domain.ds1.entity.Problemtype |
| | | import cn.flightfeather.supervision.lightshare.vo.ProblemDetailVo |
| | | import cn.flightfeather.supervision.lightshare.vo.ProblemtypeVo |
| | |
| | | |
| | | fun getDayTaskList(taskVoList: List<TaskVo>, date: String, guid: String, userType: String): List<TaskVo> |
| | | |
| | | fun getDayTask(taskId: String, userId: String, userType: String): List<DayTaskProgressVo> |
| | | fun getDayTask(taskId: String, userId: String?, userType: String): List<DayTaskProgressVo> |
| | | |
| | | fun findByName(name: String): TaskVo |
| | | |
| | |
| | | package cn.flightfeather.supervision.lightshare.service.impl |
| | | |
| | | import cn.flightfeather.supervision.domain.ds1.entity.Domaincatalog |
| | | import cn.flightfeather.supervision.domain.ds1.mapper.DomaincatalogMapper |
| | | import cn.flightfeather.supervision.common.utils.Constant |
| | | import cn.flightfeather.supervision.common.utils.UUIDGenerator |
| | | import cn.flightfeather.supervision.domain.ds1.entity.* |
| | | import cn.flightfeather.supervision.domain.ds1.mapper.* |
| | | import cn.flightfeather.supervision.lightshare.service.DomaincatalogService |
| | | import cn.flightfeather.supervision.lightshare.vo.AreaVo |
| | | import cn.flightfeather.supervision.lightshare.vo.DomaincatalogVo |
| | | import org.springframework.beans.BeanUtils |
| | | import org.springframework.stereotype.Service |
| | | import org.springframework.transaction.annotation.Transactional |
| | | import tk.mybatis.mapper.entity.Example |
| | | import java.util.* |
| | | |
| | | @Service |
| | | class DomaincatalogServiceImpl(val domaincatalogMapper: DomaincatalogMapper) : DomaincatalogService { |
| | | class DomaincatalogServiceImpl( |
| | | private val domaincatalogMapper: DomaincatalogMapper, |
| | | private val problemtypeMapper: ProblemtypeMapper, |
| | | private val changeAdviceMapper: ChangeAdviceMapper, |
| | | private val evaluationruleMapper: EvaluationruleMapper, |
| | | private val evaluationsubruleMapper: EvaluationsubruleMapper, |
| | | ) : DomaincatalogService { |
| | | //æ ¹æ®nameæ¥è¯¢ |
| | | override fun findOneByName(name: String): Domaincatalog? { |
| | | val domaincatalog = Domaincatalog() |
| | |
| | | override fun update(domaincatalog: Domaincatalog): Int = domaincatalogMapper.updateByPrimaryKey(domaincatalog) |
| | | |
| | | override fun delete(id: String): Int = domaincatalogMapper.deleteByPrimaryKey(id) |
| | | |
| | | @Transactional |
| | | override fun quickConfiguration( |
| | | target: Constant.SceneType, |
| | | targetArea: AreaVo, |
| | | source: Constant.SceneType, |
| | | sourceArea: AreaVo, |
| | | ): Boolean { |
| | | //1. é®é¢ç±»ååæ´æ¹å»ºè®® |
| | | val adviceList = changeAdviceMapper.selectByExample(Example(ChangeAdvice::class.java).apply { |
| | | createCriteria().andEqualTo("adExtension1", sourceArea.districtname) |
| | | .andEqualTo("adExtension2", source.text) |
| | | }) |
| | | problemtypeMapper.selectByExample(Example(Problemtype::class.java).apply { |
| | | createCriteria().andEqualTo("scensetypeid", source.value.toByte()) |
| | | .andEqualTo("districtname", sourceArea.districtname) |
| | | }).forEach { |
| | | val newProblemGuid = UUIDGenerator.generate16ShortUUID() |
| | | adviceList.find { ad -> ad.adProblemtypeguid == it.guid }?.let { ad -> |
| | | ad.adGuid = UUIDGenerator.generate16ShortUUID() |
| | | ad.adProblemtypeguid = newProblemGuid |
| | | ad.adCreatedate = Date() |
| | | ad.adUpdatedate = Date() |
| | | ad.adExtension1 = targetArea.districtname |
| | | ad.adExtension2 = target.text |
| | | changeAdviceMapper.insert(ad) |
| | | } |
| | | |
| | | it.guid = newProblemGuid |
| | | it.scensetypeid = target.value.toByte() |
| | | it.scensetype = target.text |
| | | it.createdate = Date() |
| | | it.updatedate = Date() |
| | | it.provincecode = targetArea.provincecode |
| | | it.provincename = targetArea.provincename |
| | | it.citycode = targetArea.citycode |
| | | it.cityname = targetArea.cityname |
| | | it.districtcode = targetArea.districtcode |
| | | it.districtname = targetArea.districtname |
| | | |
| | | problemtypeMapper.insert(it) |
| | | } |
| | | |
| | | return true |
| | | |
| | | //2. é®é¢ä½ç½®ï¼é»è®¤å·¥å°ï¼å¯ä¸ä¿®æ¹ï¼ |
| | | //3. èªè¯è§å表 |
| | | // evaluationruleMapper.selectByExample(Example(Evaluationrule::class.java).apply { |
| | | // createCriteria().andEqualTo("tasktypeid", 99) |
| | | // .andEqualTo("scensetypeid", source.value) |
| | | // and(createCriteria().orEqualTo("provincecode", sourceArea.provincecode).orIsNull("provincecode")) |
| | | // and(createCriteria().orEqualTo("citycode", sourceArea.citycode).orIsNull("citycode")) |
| | | // and(createCriteria().orEqualTo("districtcode", sourceArea.districtcode).orIsNull("districtcode")) |
| | | // and(createCriteria().orEqualTo("towncode", sourceArea.towncode).orIsNull("towncode")) |
| | | // }).takeIf { it.isNotEmpty() }?.get(0).let {sourceRule -> |
| | | // if (sourceRule != null) { |
| | | // evaluationsubruleMapper.selectByExample(Example(Evaluationsubrule::class.java).apply { |
| | | // createCriteria().andEqualTo("", sourceRule) |
| | | // }) |
| | | // } |
| | | // } |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.flightfeather.supervision.lightshare.service.impl |
| | | |
| | | import cn.flightfeather.supervision.business.autooutput.AopOutput |
| | | import cn.flightfeather.supervision.domain.ds1.entity.DustDataResult |
| | | import cn.flightfeather.supervision.domain.ds1.repository.MonitorDataRep |
| | | import cn.flightfeather.supervision.lightshare.service.MonitorDataService |
| | | import cn.flightfeather.supervision.lightshare.vo.AreaVo |
| | | import org.springframework.stereotype.Service |
| | | import org.springframework.transaction.annotation.Transactional |
| | | |
| | | /** |
| | | * |
| | | * @date 2025/3/19 |
| | | * @author feiyu02 |
| | | */ |
| | | @Service |
| | | class MonitorDataServiceImpl( |
| | | private val aopOutput: AopOutput, |
| | | private val monitorDataRep: MonitorDataRep, |
| | | ) : MonitorDataService { |
| | | |
| | | @Transactional |
| | | override fun uploadDustDataResult(dataList: List<DustDataResult>): Boolean { |
| | | dataList.forEach { aopOutput.toDbDataResult(it) } |
| | | return true |
| | | } |
| | | |
| | | override fun fetchDustDataResult(areaVo: AreaVo): List<DustDataResult?> { |
| | | return monitorDataRep.fetchDustDataResult(areaVo) |
| | | } |
| | | } |
| | |
| | | |
| | | //æ ¹æ®åºå¿ãåºæ¯ç±»åãæ¶é´è·åå个é®é¢æ°é |
| | | override fun getStatisticalResult(areaVo: AreaVo): List<StatisticsVo> { |
| | | val districtcode = areaVo.districtcode |
| | | val sceneType = areaVo.scensetypeid |
| | | 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")) |
| | | return problemlistMapper.getStatisticalResult(districtcode, startTime, endTime, sceneType, areaVo.sceneId) |
| | | // val districtcode = areaVo.districtcode |
| | | // val sceneType = areaVo.scensetypeid |
| | | // 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")) |
| | | return problemlistMapper.getStatisticalResult(areaVo) |
| | | } |
| | | |
| | | override fun getChargeResult(areaVo: AreaVo): ChargeInfoVo { |
| | |
| | | userId: String, |
| | | userName: String, |
| | | ): BaseResponse<String> { |
| | | if (action !in 0..3) { |
| | | if (action !in 0..5) { |
| | | return BaseResponse(false, "éæ³çæä½æä»¤") |
| | | } |
| | | val p = problemlistMapper.selectByPrimaryKey(pId) ?: return BaseResponse(false, "é®é¢ä¸åå¨") |
| | |
| | | response.success = false |
| | | response.message = "é®é¢æäº¤è¿æªå®¡æ ¸ï¼æ æ³è¿è¡æ´æ¹å®¡æ ¸ï¼" |
| | | } |
| | | 4.toByte() -> { |
| | | response.success = false |
| | | response.message = "é®é¢æäº¤è¿æªå®¡æ ¸ï¼æ æ³è¿è¡æ¤åå®¡æ ¸ï¼" |
| | | } |
| | | 5.toByte() -> { |
| | | response.success = false |
| | | response.message = "é®é¢æ´æ¹è¿æªæäº¤ï¼æ æ³è¿è¡æ¤åå®¡æ ¸ï¼" |
| | | } |
| | | } |
| | | } else if (extension3 == Constant.PROBLEM_CHECK_PASS || extension3 == Constant.PROBLEM_CHECK_FAIL) { |
| | | when (action) { |
| | |
| | | response.message = "é®é¢è¿æªæ´æ¹ï¼æ æ³è¿è¡æ´æ¹å®¡æ ¸ï¼æä½æ æ" |
| | | } |
| | | } |
| | | 4.toByte() -> { |
| | | extension3 = Constant.PROBLEM_UNCHECKED |
| | | } |
| | | 5.toByte() -> { |
| | | response.success = false |
| | | response.message = "é®é¢æ´æ¹è¿æªå®¡æ ¸ï¼æ æ³è¿è¡æ´æ¹å®¡æ ¸æ¤åæä½ï¼æä½æ æ" |
| | | } |
| | | } |
| | | } else if (extension3 == Constant.CHANGE_UNCHECKED) { |
| | | event = "å¨${subtask?.scensename}å®¡æ ¸äºä¸ä¸ªæ´æ¹" |
| | |
| | | } |
| | | 2.toByte() -> extension3 = Constant.CHANGE_CHECK_PASS |
| | | 3.toByte() -> extension3 = Constant.CHANGE_CHECK_FAIL |
| | | 4.toByte() -> { |
| | | response.success = false |
| | | response.message = "é®é¢æ´æ¹è¿æªå®¡æ ¸ï¼æ æ³è¿è¡æ¤åå®¡æ ¸ï¼" |
| | | } |
| | | 5.toByte() -> { |
| | | response.success = false |
| | | response.message = "é®é¢æäº¤å·²å®¡æ ¸ï¼å¹¶ä¸å·²è¢«æ´æ¹ãæä½æ æ" |
| | | } |
| | | } |
| | | } else if (extension3 == Constant.CHANGE_CHECK_PASS || extension3 == Constant.CHANGE_CHECK_FAIL) { |
| | | when (action) { |
| | |
| | | } |
| | | 2.toByte() -> extension3 = Constant.CHANGE_CHECK_PASS |
| | | 3.toByte() -> extension3 = Constant.CHANGE_CHECK_FAIL |
| | | 4.toByte() -> { |
| | | response.success = false |
| | | response.message = "é®é¢æäº¤å·²å®¡æ ¸ï¼å¹¶ä¸å·²è¢«æ´æ¹ï¼æ æ³è¿è¡é®é¢å®¡æ ¸æ¤éæä½ãæä½æ æ" |
| | | } |
| | | 5.toByte() -> { |
| | | extension3 = Constant.CHANGE_UNCHECKED |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | mediafileService.deleteList(deleteImg) |
| | | return "success" |
| | | } |
| | | |
| | | |
| | | override fun changeProblem(problemId: String, files: Array<MultipartFile>): BaseResponse<String> { |
| | | // é®é¢åé®é¢å¾çåæ³æ§æ£æ¥ |
| | |
| | | |
| | | override fun getSceneProSummary( |
| | | areaVo: AreaVo, |
| | | sortBy: String, |
| | | page: Int, |
| | | per_page: Int, |
| | | ): Pair<DataHead?, List<SceneProblemSummary>?> { |
| | | areaVo.scensetypeid ?: throw BizException("缺å°åºæ¯ç±»ååæ°") |
| | | val task = taskRep.findOneTask(areaVo) ?: throw BizException("æªæ¾å°å¯¹åºçå·¡æ¥æ»ä»»å¡") |
| | | // areaVo.scensetypeid ?: throw BizException("缺å°åºæ¯ç±»ååæ°") |
| | | // val task = taskRep.findOneTask(areaVo) ?: throw BizException("æªæ¾å°å¯¹åºçå·¡æ¥æ»ä»»å¡") |
| | | val p = PageHelper.startPage<SceneProblemSummary>(page, per_page) |
| | | val res = problemRep.selectSceneProSummary(task.tguid!!, areaVo.scensetypeid!!, areaVo.sort, sortBy) |
| | | val res = problemRep.selectSceneProSummary(areaVo) |
| | | return DataHead(p.pageNum, p.pages, p.total) to res |
| | | } |
| | | } |
| | |
| | | package cn.flightfeather.supervision.lightshare.service.impl |
| | | |
| | | import cn.flightfeather.supervision.common.utils.Constant |
| | | import cn.flightfeather.supervision.common.utils.UUIDGenerator |
| | | import cn.flightfeather.supervision.domain.ds1.entity.Problemtype |
| | | import cn.flightfeather.supervision.domain.ds1.mapper.ProblemtypeMapper |
| | | import cn.flightfeather.supervision.lightshare.service.ProblemtypeService |
| | |
| | | import cn.flightfeather.supervision.lightshare.vo.ProblemtypeVo |
| | | import org.springframework.beans.BeanUtils |
| | | import org.springframework.stereotype.Service |
| | | import org.springframework.transaction.annotation.Transactional |
| | | import tk.mybatis.mapper.entity.Example |
| | | import tk.mybatis.mapper.util.StringUtil |
| | | import java.util.* |
| | | |
| | | @Service |
| | | class ProblemtypeServiceImpl(val problemtypeMapper: ProblemtypeMapper) : ProblemtypeService { |
| | |
| | | districtName = t.districtname |
| | | townCode = t.towncode |
| | | townName = t.townname |
| | | subTaskSummary = subtaskMapper.getSummary(t.tguid!!, areaVo.scensetypeid?.toIntOrNull()) |
| | | areaVo.topTaskId = t.tguid |
| | | subTaskSummary = subTaskRep.findSummary(areaVo) |
| | | } |
| | | res.add(pro) |
| | | } |
| | |
| | | return taskVoList |
| | | } |
| | | |
| | | override fun getDayTask(taskId: String, userId: String, userType: String): List<DayTaskProgressVo> { |
| | | val example = Example(Task::class.java) |
| | | val criteria = example.createCriteria() |
| | | //æé æ¥è¯¢æ¡ä»¶ |
| | | criteria.andEqualTo("tsguid", taskId) |
| | | if (userType == "1") { |
| | | criteria.andLike("executorguids", "%$userId%") |
| | | } |
| | | |
| | | override fun getDayTask(taskId: String, userId: String?, userType: String): List<DayTaskProgressVo> { |
| | | val resultList = ArrayList<DayTaskProgressVo>() |
| | | |
| | | // è·åæ»ä»»å¡ä¸æææ¥ä»»å¡ |
| | | val dayTasks = if (userType == "1") { |
| | | taskRep.findDayTasks(taskId, userId) |
| | | } else { |
| | | taskRep.findDayTasks(taskId) |
| | | } |
| | | |
| | | // è·åæ»ä»»å¡ä¸ææçåä»»å¡ |
| | | val subTasks = subTaskRep.findAll(Subtask().apply { tguid = taskId }) |
| | | |
| | | //æ ¹æ®sqlæ¡ä»¶æ¥è¯¢ |
| | | taskMapper.selectByExample(example).forEach { |
| | | val exampleTotal = Example(Subtask::class.java).apply { |
| | | createCriteria().andEqualTo("tsguid", it.tguid) |
| | | dayTasks.forEach {t-> |
| | | // çéå½åæ¥ä»»å¡ä¸çåä»»å¡ |
| | | val filterSubTasks = subTasks.filter {s-> |
| | | s?.tsguid == t?.tguid |
| | | } |
| | | // å任塿»æ° |
| | | val total = filterSubTasks.size |
| | | |
| | | // åä»»å¡å®ææ° |
| | | val complete = filterSubTasks.count {fs-> |
| | | fs?.status == Constant.TaskProgress.RUNINGSTATUS3.text |
| | | } |
| | | |
| | | val total = subtaskMapper.selectCountByExample(exampleTotal) |
| | | |
| | | val exampleComplete = exampleTotal.apply { |
| | | and().andEqualTo("status", Constant.TaskProgress.RUNINGSTATUS3.text) |
| | | // è·å彿¥ææçé®é¢ |
| | | val subTaskIds = filterSubTasks.map { fs-> fs?.stguid } |
| | | val problemList = if (subTaskIds.isNotEmpty()) { |
| | | problemListMapper.selectByExample(Example(Problemlist::class.java).apply { |
| | | createCriteria().andIn("stguid", subTaskIds) |
| | | }) |
| | | } else{ |
| | | emptyList() |
| | | } |
| | | val complete = subtaskMapper.selectCountByExample(exampleComplete) |
| | | |
| | | |
| | | var changed = 0 |
| | | problemListMapper.findUnchangedCount(it.tguid ?: "").forEach { i -> |
| | | //ç»æè¡¨ç¤ºè¯¥å任塿ªæ´æ¹é®é¢æ° |
| | | if (i == 0) { |
| | | changed++ |
| | | } |
| | | } |
| | | |
| | | //å®¡æ ¸æ¯å¦å®æ |
| | | var check = false |
| | | with(subtaskMapper.selectByExample(exampleTotal)) breaking@{ |
| | | forEach { |
| | | problemListMapper.selectByExample(Example(Problemlist::class.java).apply { |
| | | createCriteria().andEqualTo("stguid", it.stguid) |
| | | }).forEach { problem -> |
| | | if (problem.extension3 == Constant.PROBLEM_UNCHECKED) { |
| | | check = true |
| | | return@breaking |
| | | } |
| | | var check = true |
| | | filterSubTasks.forEach {fs -> |
| | | // çéæ¯ä¸ªåä»»å¡ä¸çé®é¢æªæ´æ¹æ° |
| | | problemList.filter { p-> p?.stguid == fs?.stguid }.onEach { pro -> |
| | | // å½åå¨è³å°ä¸ä¸ªé®é¢æ²¡æå®¡æ ¸æ¶ï¼å½æ¥å®¡æ ¸ç¶æä¸ºæªå®¡æ ¸ |
| | | if (pro.extension3 == Constant.PROBLEM_UNCHECKED || pro.extension3 == Constant.CHANGE_UNCHECKED) { |
| | | check = false |
| | | } |
| | | }.count { i -> i?.ischanged != true }.let { c -> |
| | | // æ²¡ææªæ´æ¹é®é¢æ¶ï¼å表示该åä»»å¡å·²ç»æ´æ¹å®æ |
| | | if (c == 0) { |
| | | changed++ |
| | | } |
| | | } |
| | | } |
| | | |
| | | resultList.add(DayTaskProgressVo( |
| | | it.tguid, it.starttime, taskId, complete, changed, total, check |
| | | t?.tguid, t?.starttime, taskId, complete, changed, total, check |
| | | )) |
| | | } |
| | | |
| | |
| | | @JsonInclude(JsonInclude.Include.NON_NULL) |
| | | @ApiModel("åºåæ¡ä»¶") |
| | | open class AreaVo { |
| | | @ApiModelProperty("æ»ä»»å¡id") |
| | | var topTaskId: String? = null |
| | | |
| | | @ApiModelProperty("ç份ç¼ç ") |
| | | var provincecode: String? = null |
| | | |
| | |
| | | } |
| | | } catch (e: BizException) { |
| | | BaseResponse(false, message = e.message ?: "") |
| | | } catch (e: Exception) { |
| | | // fixme: to log system |
| | | |
| | | BaseResponse(false, message = "æå¡å¨åºç°å
é¨é误") |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.flightfeather.supervision.lightshare.web |
| | | |
| | | import cn.flightfeather.supervision.domain.ds1.entity.DustDataResult |
| | | import cn.flightfeather.supervision.lightshare.service.MonitorDataService |
| | | 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 |
| | | |
| | | /** |
| | | * çæµæ°æ®ï¼å
嫿¬å°çæµãæ²¹ççæµççææçæµæ°æ®ï¼ç¸å
³APIæ¥å£ |
| | | * @date 2025/3/19 |
| | | * @author feiyu02 |
| | | */ |
| | | @Api(tags = ["MonitorDataController"], description = "çæµæ°æ®ï¼å
嫿¬å°çæµãæ²¹ççæµççææçæµæ°æ®ï¼ç¸å
³APIæ¥å£") |
| | | @RestController |
| | | @RequestMapping("/monitor/data") |
| | | class MonitorDataController(private val monitorDataService: MonitorDataService) { |
| | | |
| | | @ApiOperation(value = "ä¸ä¼ æ¬å°çæµæ°æ®çæåº¦ç»è®¡ç»æ") |
| | | @PutMapping("/result/construction/upload") |
| | | fun uploadDustDataResult( |
| | | @ApiParam("ç»è®¡ç»æ") @RequestBody dataList: List<DustDataResult>, |
| | | ) = resPack { monitorDataService.uploadDustDataResult(dataList) } |
| | | |
| | | @ApiOperation(value = "æ¥è¯¢æ¬å°çæµæ°æ®çæåº¦ç»è®¡ç»æ") |
| | | @PostMapping("/result/construction/get") |
| | | fun fetchDustDataResult( |
| | | @ApiParam("åºåæ¡ä»¶ä¿¡æ¯") @RequestBody areaVo: AreaVo |
| | | ) = resPack { monitorDataService.fetchDustDataResult(areaVo) } |
| | | } |
| | |
| | | @PostMapping("/check") |
| | | fun checkProblem( |
| | | @ApiParam(value = "é®é¢id主é®") @RequestParam("pId") pId: String, |
| | | @ApiParam(value = "å®¡æ ¸æä½, 0: å®¡æ ¸éè¿ï¼1: å®¡æ ¸ä¸éè¿ï¼2: æ´æ¹éè¿ï¼3: æ´æ¹ä¸éè¿", |
| | | allowableValues = "0,1,2,3") @RequestParam("action") action: Byte, |
| | | @ApiParam(value = "å®¡æ ¸æä½, 0: å®¡æ ¸éè¿ï¼1: å®¡æ ¸ä¸éè¿ï¼2: æ´æ¹éè¿ï¼3: æ´æ¹ä¸éè¿ï¼4ï¼é®é¢å®¡æ ¸æ¤åï¼5ï¼æ´æ¹å®¡æ ¸æ¤å", |
| | | allowableValues = "0,1,2,3,4,5") @RequestParam("action") action: Byte, |
| | | @ApiParam(value = "å®¡æ ¸å¤æ³¨") @RequestParam("remark") remark: String, |
| | | @ApiParam(value = "ç¨æ·id") @RequestParam("userId") userId: String, |
| | | @ApiParam(value = "ç¨æ·å") @RequestParam("userName") userName: String, |
| | |
| | | @PostMapping("/summary/scene") |
| | | fun getSceneProSummary( |
| | | @RequestBody areaVo: AreaVo, |
| | | @ApiParam(value = "æåºå段", allowableValues = "pro, changePer") @RequestParam sortBy: String, |
| | | @ApiParam(value = "页ç ") @RequestParam(value = "page") page: Int, |
| | | @ApiParam(value = "åé¡µæ°æ®é") @RequestParam(value = "per_page") perPage: Int, |
| | | ) = resPack { problemlistService.getSceneProSummary(areaVo, sortBy, page, perPage) } |
| | | ) = resPack { problemlistService.getSceneProSummary(areaVo, page, perPage) } |
| | | } |
| | |
| | | @GetMapping("/dayTask/{taskId}") |
| | | fun getDayTask( |
| | | @PathVariable("taskId") taskId: String, |
| | | @RequestParam("userId") userId: String, |
| | | @RequestParam("userId", required = false) userId: String?, |
| | | @RequestParam("userType") userType: String |
| | | ) = taskService.getDayTask(taskId, userId, userType) |
| | | |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.flightfeather.supervision.socket; |
| | | |
| | | import com.google.gson.*; |
| | | |
| | | import java.lang.reflect.Type; |
| | | import java.time.LocalDateTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | |
| | | /** |
| | | * LocalDateTimeç±»åçæ¶é´æ ¼å¼åºåååååºååç±» |
| | | * by hc 2024.12.6 |
| | | */ |
| | | public class LocalDateTimeAdapter implements JsonDeserializer<LocalDateTime>, JsonSerializer<LocalDateTime> { |
| | | private final DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); |
| | | |
| | | @Override |
| | | public JsonElement serialize(LocalDateTime src, Type typeOfSrc, JsonSerializationContext context) { |
| | | return new JsonPrimitive(dateTimeFormatter.format(src)); |
| | | } |
| | | |
| | | @Override |
| | | public LocalDateTime deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException { |
| | | try { |
| | | return LocalDateTime.parse(json.getAsString(), dateTimeFormatter); |
| | | } catch (Exception e) { |
| | | throw new JsonParseException(e); |
| | | } |
| | | } |
| | | } |
| | | |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.flightfeather.supervision.socket; |
| | | |
| | | public class WebSocketMessage { |
| | | /* |
| | | * æ¶æ¯ç±»å |
| | | * */ |
| | | private int type; |
| | | |
| | | /* |
| | | * æ¶æ¯å
容 |
| | | * */ |
| | | private Object content; |
| | | |
| | | public WebSocketMessage() { |
| | | } |
| | | |
| | | public WebSocketMessage(int type, Object content) { |
| | | this.type = type; |
| | | this.content = content; |
| | | } |
| | | |
| | | public int getType() { |
| | | return type; |
| | | } |
| | | |
| | | public void setType(int type) { |
| | | this.type = type; |
| | | } |
| | | |
| | | public Object getContent() { |
| | | return content; |
| | | } |
| | | |
| | | public void setContent(Object content) { |
| | | this.content = content; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.flightfeather.supervision.socket; |
| | | |
| | | import cn.flightfeather.supervision.common.utils.JsonUtil; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | public class WebSocketMessageParser { |
| | | private static final String START_STR = "##"; |
| | | private static final String SPLIT_STR = "&&"; |
| | | private static final String END_STR = "%%"; |
| | | |
| | | /** |
| | | * æ¶æ¯æ ¼å¼æ ¡éª |
| | | * @param message æ¶æ¯ |
| | | * @return æ ¼å¼æ¯å¦åè§ |
| | | */ |
| | | private static boolean verificationMessage(String message) { |
| | | if (StringUtils.isEmpty(message)) { |
| | | return false; |
| | | } |
| | | if (!message.startsWith(START_STR)) { |
| | | return false; |
| | | } |
| | | if (!message.endsWith(END_STR)) { |
| | | return false; |
| | | } |
| | | return true; |
| | | } |
| | | /** |
| | | * è§£æåºç±»ååå
容 |
| | | * @param message socketæ¶æ¯ä¸çdataåæ®µ |
| | | * @return è§£æç»æï¼å¦ææ ¼å¼ä¸æ£ç¡®åè¿ånull |
| | | */ |
| | | public static WebSocketMessage decodeMessage(String message) { |
| | | if (!verificationMessage(message)) { |
| | | // 忥ä¸ä¸ªä¸ä¼è¢«å¤ççæ¶æ¯ |
| | | return new WebSocketMessage(-1, ""); |
| | | } |
| | | WebSocketMessage webSocketMessage = new WebSocketMessage(); |
| | | String[] parts = message.substring(START_STR.length(), message.length() - END_STR.length()).split(SPLIT_STR); |
| | | webSocketMessage.setType(Integer.parseInt(parts[0])); |
| | | webSocketMessage.setContent(JsonUtil.INSTANCE.getGson().fromJson(parts[1], Object.class)); |
| | | return webSocketMessage; |
| | | } |
| | | /** |
| | | * çææå®æ ¼å¼çæ¶æ¯å符串 |
| | | * @return çæçæ¶æ¯å符串 |
| | | */ |
| | | public static String encodeMessage(WebSocketMessage webSocketMessage) { |
| | | return START_STR + webSocketMessage.getType() + SPLIT_STR + JsonUtil.INSTANCE.getGson().toJson(webSocketMessage.getContent(), webSocketMessage.getContent().getClass()) + END_STR; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.flightfeather.supervision.socket; |
| | | |
| | | import cn.flightfeather.supervision.common.executor.BgTaskStatus; |
| | | import cn.flightfeather.supervision.common.utils.Constant; |
| | | |
| | | public class WebSocketSendMessageUtil { |
| | | |
| | | /** |
| | | * åéåå°ä»»å¡çsocketæ¶æ¯ |
| | | * @param bgTaskStatus æ¶æ¯çå
容 |
| | | */ |
| | | public static void sendBgTaskMessage(BgTaskStatus bgTaskStatus) { |
| | | WebSocketMessage webSocketMessage = new WebSocketMessage(Constant.SocketMessageType.BG_TASK.getValue(), |
| | | bgTaskStatus); |
| | | String message = WebSocketMessageParser.encodeMessage(webSocketMessage); |
| | | WebSocketSenderHandler.getInstance().broadcast(message); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.flightfeather.supervision.socket; |
| | | |
| | | import cn.flightfeather.supervision.socket.processor.WebSocketSender; |
| | | import org.springframework.beans.BeansException; |
| | | import org.springframework.context.ApplicationContext; |
| | | import org.springframework.context.ApplicationContextAware; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | @Component |
| | | public class WebSocketSenderHandler implements ApplicationContextAware { |
| | | static private ApplicationContext applicationContext; |
| | | @Override |
| | | public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { |
| | | WebSocketSenderHandler.applicationContext = applicationContext; |
| | | } |
| | | public static WebSocketSender getInstance() { |
| | | return applicationContext.getBean(WebSocketSender.class); |
| | | } |
| | | } |
| | |
| | | package cn.flightfeather.supervision.socket.config |
| | | |
| | | import cn.flightfeather.supervision.common.utils.Constant |
| | | import cn.flightfeather.supervision.socket.WebSocketMessageParser |
| | | import cn.flightfeather.supervision.socket.WsSessionManager |
| | | import cn.flightfeather.supervision.socket.processor.WebSocketReceiver |
| | | import org.springframework.stereotype.Component |
| | |
| | | val payload = message.payload |
| | | val sessionId = session.attributes["session_id"] |
| | | println("server æ¥æ¶å° $sessionId åéç $payload") |
| | | if (WebSocketMessageParser.decodeMessage(payload).type == |
| | | Constant.SocketHeartMessageType.HEART_MESSAGE_TYPE.value) { |
| | | webSocketReceiver.onReceiveHeartMsg(payload, sessionId.toString()) |
| | | } |
| | | webSocketReceiver.onReceiveMsg(payload) |
| | | // session.sendMessage(TextMessage("server åéç» " + sessionId + " æ¶æ¯ " + payload + " " + LocalDateTime.now() |
| | | // .toString())) |
| | |
| | | |
| | | import cn.flightfeather.supervision.common.log.BizLog |
| | | import cn.flightfeather.supervision.common.log.WorkStreamLogInfo |
| | | import cn.flightfeather.supervision.common.utils.Constant |
| | | import cn.flightfeather.supervision.socket.WebSocketMessage |
| | | import cn.flightfeather.supervision.socket.WebSocketMessageParser |
| | | import org.springframework.stereotype.Component |
| | | import java.time.LocalDateTime |
| | | |
| | | /** |
| | | * webSocketæ¶æ¯æ¥æ¶ç®¡ç |
| | |
| | | * @author feiyu02 |
| | | */ |
| | | @Component |
| | | class WebSocketReceiver(private val bizLog: BizLog) { |
| | | class WebSocketReceiver(private val bizLog: BizLog, private val webSocketSender: WebSocketSender) { |
| | | |
| | | /** |
| | | * æ¥æ¶æ¶æ¯å¤ç |
| | |
| | | bizLog.info(WorkStreamLogInfo("8FAqSPnAA8ry4ExX", "æ±æ£å¼º", "å¨ä¸æµ·å¹¿åç²ç
¤ç°æéå
¬å¸æ°å¢ä¸ä¸ªé®é¢")) |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * æ¥æ¶å¿è·³æ¶æ¯å¤ç |
| | | */ |
| | | fun onReceiveHeartMsg(msg: String, sessionId: String) { |
| | | val content = WebSocketMessageParser.encodeMessage(WebSocketMessage(Constant.SocketHeartMessageType.HEART_MESSAGE_TYPE.value, |
| | | LocalDateTime.now())) |
| | | webSocketSender.sendMsg(content, sessionId) |
| | | } |
| | | } |
| | |
| | | DR_Id, DR_Scene_Id, DR_Scene_Name, DR_Device_Code, DR_Time, DR_Exceed_Times, DR_Avg, |
| | | DR_Max, DR_Min, DR_Over_Avg_Per, DR_Data_Num, DR_Effective_Rate |
| | | </sql> |
| | | |
| | | <!-- æ°æ®ç»è®¡ç»ææ¶é´æ¡ä»¶ --> |
| | | <sql id="Where_Plan_Time"> |
| | | <if test="starttime != null"> |
| | | AND ${tableAlias}.DR_Time >= #{starttime} |
| | | </if> |
| | | <if test="endtime != null"> |
| | | AND ${tableAlias}.DR_Time <= #{endtime} |
| | | </if> |
| | | </sql> |
| | | |
| | | <select id="selectByArea" resultMap="BaseResultMap"> |
| | | select |
| | | <include refid="Base_Column_List"/> |
| | | from ea_t_dust_data_result as a |
| | | left join sm_t_scense as b |
| | | on a.DR_Scene_Id = b.S_GUID |
| | | <where> |
| | | <include refid="cn.flightfeather.supervision.domain.ds1.mapper.ScenseMapper.Where_Area"> |
| | | <property name="tableAlias" value="b"/> |
| | | </include> |
| | | <include refid="cn.flightfeather.supervision.domain.ds1.mapper.ScenseMapper.Where_Type"> |
| | | <property name="tableAlias" value="b"/> |
| | | </include> |
| | | <include refid="Where_Plan_Time"> |
| | | <property name="tableAlias" value="a"/> |
| | | </include> |
| | | </where> |
| | | </select> |
| | | </mapper> |
| | |
| | | LEFT JOIN sm_t_scense AS f ON a.S_GUID = f.S_GUID |
| | | LEFT JOIN tm_t_subtask AS c ON a.ST_GUID = c.ST_GUID |
| | | <where> |
| | | <if test="startTime != null"> |
| | | AND c.ST_PlanStartTime >= #{startTime} |
| | | </if> |
| | | <if test="endTime != null"> |
| | | AND c.ST_PlanStartTime <= #{endTime} |
| | | </if> |
| | | <if test="districtCode != null"> |
| | | AND f.S_DistrictCode = #{districtCode} |
| | | </if> |
| | | <if test="sceneType != null"> |
| | | AND f.S_TypeID = #{sceneType} |
| | | </if> |
| | | <if test="sceneId != null"> |
| | | AND a.S_GUID = #{sceneId} |
| | | </if> |
| | | <!-- <if test="startTime != null">--> |
| | | <!-- AND c.ST_PlanStartTime >= #{startTime}--> |
| | | <!-- </if>--> |
| | | <!-- <if test="endTime != null">--> |
| | | <!-- AND c.ST_PlanStartTime <= #{endTime}--> |
| | | <!-- </if>--> |
| | | <!-- <if test="districtCode != null">--> |
| | | <!-- AND f.S_DistrictCode = #{districtCode}--> |
| | | <!-- </if>--> |
| | | <if test="scensetypeid != null"> |
| | | AND f.S_TypeID = #{scensetypeid} |
| | | </if> |
| | | <if test="sceneId != null"> |
| | | AND a.S_GUID = #{sceneId} |
| | | </if> |
| | | <include refid="cn.flightfeather.supervision.domain.ds1.mapper.ScenseMapper.Where_Area"> |
| | | <property name="tableAlias" value="f"/> |
| | | </include> |
| | | <include refid="cn.flightfeather.supervision.domain.ds1.mapper.SubtaskMapper.Where_Plan_Time"> |
| | | <property name="tableAlias" value="c"/> |
| | | </include> |
| | | </where> |
| | | GROUP BY |
| | | b.PT_TypeName |
| | |
| | | sm_t_scense AS b |
| | | LEFT JOIN tm_t_subtask AS a ON a.ST_ScenseID = b.S_GUID |
| | | LEFT JOIN im_t_problemlist AS d ON a.ST_GUID = d.ST_GUID |
| | | WHERE |
| | | a.T_GUID = #{topTaskId} |
| | | <if test="sceneTypeId != null"> |
| | | and b.S_TypeID = #{sceneTypeId} |
| | | </if> |
| | | <where> |
| | | <include refid="cn.flightfeather.supervision.domain.ds1.mapper.ScenseMapper.Where_Area"> |
| | | <property name="tableAlias" value="b"/> |
| | | </include> |
| | | <include refid="cn.flightfeather.supervision.domain.ds1.mapper.SubtaskMapper.Where_Plan_Time"> |
| | | <property name="tableAlias" value="a"/> |
| | | </include> |
| | | <!-- a.T_GUID = #{topTaskId}--> |
| | | <if test="scensetypeid != null"> |
| | | and b.S_TypeID = #{scensetypeid} |
| | | </if> |
| | | </where> |
| | | GROUP BY |
| | | b.S_GUID |
| | | ) as t_p |
| | |
| | | S_Contacts, S_CreateDate, S_UpdateDate, S_Extension1, S_Extension2, S_Index, S_Remark |
| | | </sql> |
| | | |
| | | <!-- è¡æ¿åºåæ¡ä»¶ --> |
| | | <sql id="Where_Area"> |
| | | <if test="provincecode != null"> |
| | | AND ${tableAlias}.S_ProvinceCode = #{provincecode} |
| | | </if> |
| | | <if test="provincename != null"> |
| | | AND ${tableAlias}.S_ProvinceName = #{provincename} |
| | | </if> |
| | | <if test="citycode != null"> |
| | | AND ${tableAlias}.S_CityCode = #{citycode} |
| | | </if> |
| | | <if test="cityname != null"> |
| | | AND ${tableAlias}.S_CityName = #{cityname} |
| | | </if> |
| | | <if test="districtcode != null"> |
| | | AND ${tableAlias}.S_DistrictCode = #{districtcode} |
| | | </if> |
| | | <if test="districtname != null"> |
| | | AND ${tableAlias}.S_DistrictName = #{districtname} |
| | | </if> |
| | | <if test="towncode != null"> |
| | | AND ${tableAlias}.S_TownCode = #{towncode} |
| | | </if> |
| | | <if test="townname != null"> |
| | | AND ${tableAlias}.S_TownName = #{townname} |
| | | </if> |
| | | </sql> |
| | | |
| | | <!-- åºæ¯ç±»åæ¡ä»¶ --> |
| | | <sql id="Where_Type"> |
| | | <if test="scensetypeid != null"> |
| | | AND ${tableAlias}.S_TypeID = #{scensetypeid} |
| | | </if> |
| | | </sql> |
| | | |
| | | <select id="selectNoAccountScene" resultMap="BaseResultMap"> |
| | | select a.* FROM sm_t_scense as a LEFT JOIN sm_t_userinfo as b on a.S_GUID = b.D_GUID WHERE b.UI_GUID is null |
| | | </select> |
| | |
| | | <select id="getSummaryByArea" resultMap="SubTaskSummary"> |
| | | <include refid="Sub_Task_Summary_Column_List"/> |
| | | <where> |
| | | <include refid="Where_Area"> |
| | | <property name="tableAlias" value="a"/> |
| | | <include refid="cn.flightfeather.supervision.domain.ds1.mapper.ScenseMapper.Where_Area"> |
| | | <property name="tableAlias" value="b"/> |
| | | </include> |
| | | <include refid="Where_Plan_Time"> |
| | | <property name="tableAlias" value="a"/> |
| | | </include> |
| | | <if test="scensetypeid != null"> |
| | | AND b.S_TypeID = #{scensetypeid} |
| | | </if> |
| | | <if test="topTaskId != null"> |
| | | AND a.T_GUID = #{topTaskId} |
| | | </if> |
| | | </where> |
| | | GROUP BY |
| | | a.ST_GUID |
| | |
| | | */ |
| | | @Test |
| | | fun test() { |
| | | val taskId = "88wgq9l5gm9cUMg1" |
| | | val districtCode = "310104" |
| | | // val taskId = "88wgq9l5gm9cUMg1" |
| | | // val districtCode = "310104" |
| | | val districtName = "徿±åº" |
| | | val year = 2024 |
| | | val month = 5 |
| | | val month = 11 |
| | | val sceneType = Constant.SceneType.TYPE5.value.toInt() |
| | | // xhFuDataAnalysis.setResource(taskId, sceneType, year, month) |
| | | // xhFuDataAnalysis.execute() |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.flightfeather.supervision.business.crosstimechange |
| | | |
| | | import cn.flightfeather.supervision.common.utils.Constant |
| | | import cn.flightfeather.supervision.lightshare.vo.AreaVo |
| | | import org.junit.Test |
| | | import org.junit.jupiter.api.Assertions.* |
| | | import org.junit.jupiter.api.extension.ExtendWith |
| | | import org.junit.runner.RunWith |
| | | import org.springframework.beans.factory.annotation.Autowired |
| | | import org.springframework.boot.test.context.SpringBootTest |
| | | import org.springframework.test.context.junit.jupiter.SpringExtension |
| | | import org.springframework.test.context.junit4.SpringRunner |
| | | import java.time.LocalDateTime |
| | | |
| | | @RunWith(SpringRunner::class) |
| | | @ExtendWith(SpringExtension::class) |
| | | @SpringBootTest |
| | | class CrossTimeChangeManagerTest { |
| | | |
| | | @Autowired |
| | | lateinit var crossTimeChangeManager: CrossTimeChangeManager |
| | | |
| | | @Test |
| | | fun execute() { |
| | | // crossTimeChangeManager.execute(AreaVo().apply { |
| | | // provincecode = "31" |
| | | // citycode = "3100" |
| | | // districtcode = "310104" |
| | | // starttime = LocalDateTime.of(2024, 3, 1, 0, 0, 0, 0) |
| | | // endtime = LocalDateTime.of(2024, 6, 30, 23, 59, 59, 999) |
| | | // scensetypeid = Constant.SceneType.TYPE5.value |
| | | // }, "徿±é¤é¥®åå²é®é¢å¯æ´æ¹ç»è®¡-3è³6æ.xlsx") |
| | | |
| | | crossTimeChangeManager.execute(AreaVo().apply { |
| | | provincecode = "31" |
| | | citycode = "3100" |
| | | districtcode = "310104" |
| | | starttime = LocalDateTime.of(2024, 7, 1, 0, 0, 0, 0) |
| | | endtime = LocalDateTime.of(2024, 10, 31, 23, 59, 59, 999) |
| | | scensetypeid = Constant.SceneType.TYPE5.value |
| | | }, "徿±é¤é¥®åå²é®é¢å¯æ´æ¹ç»è®¡-7è³10æ.xlsx") |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package cn.flightfeather.supervision.lightshare.service.impl |
| | | |
| | | import cn.flightfeather.supervision.SupervisionApplication |
| | | import cn.flightfeather.supervision.common.utils.Constant |
| | | import cn.flightfeather.supervision.lightshare.service.DomaincatalogService |
| | | import cn.flightfeather.supervision.lightshare.vo.AreaVo |
| | | import org.junit.Test |
| | | import org.junit.runner.RunWith |
| | | import org.springframework.beans.factory.annotation.Autowired |
| | | import org.springframework.boot.test.context.SpringBootTest |
| | | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner |
| | | |
| | | @RunWith(SpringJUnit4ClassRunner::class) |
| | | @SpringBootTest(classes = [SupervisionApplication::class]) |
| | | class DomaincatalogServiceImplTest { |
| | | |
| | | @Autowired |
| | | lateinit var domaincatalogService: DomaincatalogService |
| | | |
| | | @Test |
| | | fun quickConfiguration() { |
| | | domaincatalogService.quickConfiguration( |
| | | Constant.SceneType.TYPE15, AreaVo().apply { |
| | | provincecode = "31" |
| | | provincename = "䏿µ·å¸" |
| | | citycode = "3100" |
| | | cityname = "䏿µ·å¸" |
| | | districtcode = "310105" |
| | | districtname = "é¿å®åº" |
| | | }, |
| | | Constant.SceneType.TYPE1, AreaVo().apply { |
| | | provincecode = "31" |
| | | provincename = "䏿µ·å¸" |
| | | citycode = "3100" |
| | | cityname = "䏿µ·å¸" |
| | | districtcode = "310105" |
| | | districtname = "é¿å®åº" |
| | | } |
| | | ) |
| | | } |
| | | } |