From 85ef942e7195abeb71466b7159c3ee30161e1e54 Mon Sep 17 00:00:00 2001
From: feiyu02 <risaku@163.com>
Date: 星期二, 07 四月 2026 08:51:01 +0800
Subject: [PATCH] 2026.4.7
---
src/main/kotlin/cn/flightfeather/supervision/lightshare/service/impl/SubtaskServiceImpl.kt | 159 +++++++++++++++++++++++++++++++++++++---------------
1 files changed, 112 insertions(+), 47 deletions(-)
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 f02a9e1..251713f 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
@@ -1,7 +1,6 @@
package cn.flightfeather.supervision.lightshare.service.impl
import cn.flightfeather.supervision.business.autooutput.score.AopEvaluation
-import cn.flightfeather.supervision.common.exception.BizException
import cn.flightfeather.supervision.domain.ds1.entity.*
import cn.flightfeather.supervision.domain.ds1.mapper.*
import cn.flightfeather.supervision.common.utils.Constant
@@ -33,20 +32,28 @@
@Autowired
lateinit var taskService: TaskService
+
@Autowired
lateinit var taskMapper: TaskMapper
+
@Autowired
lateinit var evaluationMapper: EvaluationMapper
+
@Autowired
lateinit var problemlistMapper: ProblemlistMapper
+
@Autowired
lateinit var mediafileMapper: MediafileMapper
+
@Autowired
lateinit var scenseMapper: ScenseMapper
+
@Autowired
lateinit var inspectionMapper: InspectionMapper
+
@Autowired
lateinit var monitorobjectversionMapper: MonitorobjectversionMapper
+
@Autowired
lateinit var problemtypeMapper: ProblemtypeMapper
@@ -65,11 +72,11 @@
criteria.andEqualTo("towncode", areaVo.towncode)
criteria.andBetween("planstarttime", areaVo.starttime, areaVo.endtime)
if (!Objects.equals(userGuid, Constant.UserType.ALL_USER.des))
- criteria.andLike("executorguids","%"+userGuid+"%")
+ criteria.andLike("executorguids", "%" + userGuid + "%")
var completecount = 0
var subtasklist = subtaskMapper.selectByExample(example)
subtasklist.forEach {
- if (Objects.equals(it.status, Constant.TaskProgress.RUNINGSTATUS3.text)){
+ if (Objects.equals(it.status, Constant.TaskProgress.RUNINGSTATUS3.text)) {
completecount++
}
}
@@ -96,33 +103,41 @@
return subtaskVoList
}
- override fun findByDayTaskID(dayTaskId: String, userId: String, userType: String): List<Subtask> {
+ override fun findByDayTaskID(dayTaskId: String, userId: String, userType: String): List<SubtaskVo> {
val example = Example(Subtask::class.java)
val criteria = example.createCriteria()
criteria.andEqualTo("tsguid", dayTaskId)
if (userType == "1") {
example.and(
- example.createCriteria().orLike("executorguids", "%$userId%")
- .orLike("stAssessorguid", "%$userId%")
+ example.createCriteria().orLike("executorguids", "%$userId%")
+ .orLike("stAssessorguid", "%$userId%")
)
}
example.orderBy("name")
- val result = subtaskMapper.selectByExample(example).apply{
- forEach breaking@{
- //宸插鏍告彁绀�
- it.remark= Constant.PROBLEM_CHECK_PASS
-
- problemlistMapper.selectByExample(Example(Problemlist::class.java).apply {
- createCriteria().andEqualTo("stguid", it.stguid)
- and(createCriteria().orIsNull("remark")
- .orNotEqualTo("remark", Constant.PROBLEM_DELETED))
- }).forEach {problem ->
- //瀛愪换鍔′腑鏈夐棶棰樻湭瀹℃牳鏃讹紝璁剧疆鏈鏍告彁绀�
- if (problem.extension3 == Constant.PROBLEM_UNCHECKED) {
- it.remark= Constant.PROBLEM_UNCHECKED
- return@breaking
- }
+ val result = subtaskMapper.selectByExample(example).map {
+ val vo = SubtaskVo()
+ BeanUtils.copyProperties(it, vo)
+ vo
+ }.onEach {
+ //宸插鏍告彁绀�
+ it.remark = Constant.PROBLEM_CHECK_PASS
+ problemlistMapper.selectByExample(Example(Problemlist::class.java).apply {
+ createCriteria().andEqualTo("stguid", it.stguid)
+ and(
+ createCriteria().orIsNull("remark")
+ .orNotEqualTo("remark", Constant.PROBLEM_DELETED)
+ )
+ }).forEach { problem ->
+ //瀛愪换鍔′腑鏈夐棶棰樻湭瀹℃牳鏃讹紝璁剧疆鏈鏍告彁绀�
+ if (problem.extension3 == Constant.PROBLEM_UNCHECKED) {
+ it.remark = Constant.PROBLEM_UNCHECKED
}
+ }
+
+ // 鍦烘櫙绫诲瀷
+ scenseMapper.selectByPrimaryKey(it.scenseid)?.let { s->
+ it.sceneTypeId = s.typeid
+ it.sceneTypeName = s.type
}
}
return result
@@ -168,13 +183,13 @@
} else {
guid
}
- val userTypeId = if (userType == "涓荤閮ㄩ棬"){
+ val userTypeId = if (userType == "涓荤閮ㄩ棬") {
"2"
- }else if (userType == "椋炵窘鐢ㄦ埛") {
+ } else if (userType == "椋炵窘鐢ㄦ埛") {
"1"
- } else if(userType == "绠$悊鍛�"){
+ } else if (userType == "绠$悊鍛�") {
"0"
- }else if (userType == "鍦烘櫙") {
+ } else if (userType == "鍦烘櫙") {
"3"
} else {
userType
@@ -197,16 +212,19 @@
two = dateString
three = DateUtil.addMonth(dateString, 1)
}
+
"Left" -> {
one = DateUtil.addMonth(dateString, 1)
two = DateUtil.addMonth(dateString, 2)
three = DateUtil.addMonth(dateString, 3)
}
+
"Right" -> {
one = DateUtil.addMonth(dateString, -1)
two = DateUtil.addMonth(dateString, -2)
three = DateUtil.addMonth(dateString, -3)
}
+
else -> {
//鍙傛暟涓嶆纭氨杩斿洖
return taskPackList
@@ -251,16 +269,19 @@
two = dateString
three = DateUtil.addMonth(dateString, 1)
}
+
"Left" -> {
one = DateUtil.addMonth(dateString, 1)
two = DateUtil.addMonth(dateString, 2)
three = DateUtil.addMonth(dateString, 3)
}
+
"Right" -> {
one = DateUtil.addMonth(dateString, -1)
two = DateUtil.addMonth(dateString, -2)
three = DateUtil.addMonth(dateString, -3)
}
+
else -> {
//鍙傛暟涓嶆纭氨杩斿洖
return taskPackList
@@ -422,21 +443,22 @@
subtask.tsguid = daytaskVo.tguid
//*锛堜慨鏀癸級*鏃ヤ换鍔℃鍦ㄦ墽琛岋紝瀛愪换鍔$粨鏉燂紝閬嶅巻鎵�鏈夊叾浣欏瓙浠诲姟锛岄兘鏄粨鏉熸椂鎵嶅皢鏃ヤ换鍔′慨鏀逛负缁撴潫****
if (subtask.status == Constant.TaskProgress.RUNINGSTATUS3.text
- && daytaskVo.runingstatus == Constant.TaskProgress.RUNINGSTATUS2.text){
+ && daytaskVo.runingstatus == Constant.TaskProgress.RUNINGSTATUS2.text
+ ) {
val subtaskVolist = findByDayTaskID(daytaskVo.tguid!!)
var bool = false
subtaskVolist.forEach {
- if (it.status != Constant.TaskProgress.RUNINGSTATUS3.text){
+ if (it.status != Constant.TaskProgress.RUNINGSTATUS3.text) {
bool = true
}
}
- if (!bool){
+ if (!bool) {
daytaskVo.runingstatus = Constant.TaskProgress.RUNINGSTATUS3.text
}
}
//涓よ�呯姸鎬佺浉鍚屾椂涓嶅仛淇敼锛屽叾浣欐儏鍐垫棩浠诲姟閮戒负姝e湪鎵ц
- else if (subtask.status != daytaskVo.runingstatus){
+ else if (subtask.status != daytaskVo.runingstatus) {
daytaskVo.runingstatus = Constant.TaskProgress.RUNINGSTATUS2.text
}
val daytask = Task()
@@ -465,7 +487,7 @@
}
@Transactional
- override fun delete(id: String): Int{
+ override fun delete(id: String): Int {
val subtask = subtaskMapper.selectByPrimaryKey(id)
val dayTaskId = subtask.tsguid
subtaskMapper.deleteByPrimaryKey(id)
@@ -500,7 +522,15 @@
}
- override fun searchSubTask(token: String, sceneType: Int?, districtCode: String?, startTime: String?, endTime: String?, page: Int?, perPage: Int?): BaseSearchResultVo {
+ override fun searchSubTask(
+ token: String,
+ sceneType: Int?,
+ districtCode: String?,
+ startTime: String?,
+ endTime: String?,
+ page: Int?,
+ perPage: Int?,
+ ): BaseSearchResultVo {
if (token != "jingan") {
return BaseSearchResultVo().apply {
head = DataHead().apply {
@@ -543,7 +573,7 @@
// val p = PageHelper.startPage<Subtask>(page ?: 1, perPage ?: 30)
subtaskMapper.getSubtask2(null, null, _districtCode, _sceneType.toByte(), _startTime, _endTime).forEach {
if (!subtaskMap.containsKey(it.subTaskId)) {
- val vo =SubtaskSearchResultVo()
+ val vo = SubtaskSearchResultVo()
BeanUtils.copyProperties(it, vo)
subtaskMap[it.subTaskId] = vo
}
@@ -553,7 +583,7 @@
problemMap[it.problemId] = problemDetail
subtaskMap[it.subTaskId]?.problemList?.add(problemDetail)
}
- val url = it.mExtension1 + it.mGuid+ ".jpg"
+ val url = it.mExtension1 + it.mGuid + ".jpg"
if (it.isChanged == true) {
problemMap[it.problemId]?.rectificationPics?.add(url)
} else {
@@ -647,8 +677,10 @@
.andNotEqualTo("extension3", Constant.CHANGE_CHECK_FAIL)
.andIsNotNull("extension3")
time?.let {
- and(createCriteria().orGreaterThan("time", it)
- .orGreaterThan("changedtime", it))
+ and(
+ createCriteria().orGreaterThan("time", it)
+ .orGreaterThan("changedtime", it)
+ )
}
}).forEach { p ->
val problem = ProblemDetail().apply {
@@ -743,7 +775,16 @@
return BaseResponse(true, "璇锋眰鎴愬姛", data = result)
}
- override fun searchSubTask3(token: String, updateTime: String?, sceneType: Int?, districtCode: String?, startTime: String?, endTime: String?, page: Int?, perPage: Int?): BaseResponse<BaseSearchResultVo> {
+ override fun searchSubTask3(
+ token: String,
+ updateTime: String?,
+ sceneType: Int?,
+ districtCode: String?,
+ startTime: String?,
+ endTime: String?,
+ page: Int?,
+ perPage: Int?,
+ ): BaseResponse<BaseSearchResultVo> {
if (token != "jinshan") {
return BaseResponse(false, "璇锋眰token閿欒")
}
@@ -798,8 +839,10 @@
.andNotEqualTo("extension3", Constant.CHANGE_CHECK_FAIL)
.andIsNotNull("extension3")
time?.let {
- and(createCriteria().orGreaterThan("time", it)
- .orGreaterThan("changedtime", it))
+ and(
+ createCriteria().orGreaterThan("time", it)
+ .orGreaterThan("changedtime", it)
+ )
}
}).forEach { p ->
val problem = ProblemDetail().apply {
@@ -868,7 +911,7 @@
// val p = PageHelper.startPage<Subtask>(page ?: 1, perPage ?: 30)
subtaskMapper.getSubtask2(time, time2, _districtCode, _sceneType?.toByte(), null, null).forEach {
if (!subtaskMap.containsKey(it.subTaskId)) {
- val vo =SubtaskSearchResultVo()
+ val vo = SubtaskSearchResultVo()
BeanUtils.copyProperties(it, vo)
subtaskMap[it.subTaskId] = vo
}
@@ -878,7 +921,7 @@
problemMap[it.problemId] = problemDetail
subtaskMap[it.subTaskId]?.problemList?.add(problemDetail)
}
- val url = it.mExtension1 + it.mGuid+ ".jpg"
+ val url = it.mExtension1 + it.mGuid + ".jpg"
if (it.isChanged == true) {
problemMap[it.problemId]?.rectificationPics?.add(url)
} else {
@@ -899,15 +942,37 @@
return BaseResponse(true, "璇锋眰鎴愬姛", data = result)
}
- override fun findByDate(date: String, userId: String): List<SubtaskVo> {
- val time = DateUtil.StringToDate(date)
+ override fun findByDate(date: String?, userId: String?, sceneId: String?): List<SubtaskVo> {
+ val time = if (date == null) null else DateUtil.StringToDate(date)
val resultList = mutableListOf<SubtaskVo>()
- subtaskMapper.selectByExample(Example(Subtask::class.java).apply {
- createCriteria().andLessThanOrEqualTo("planstarttime", time)
+ val subtasks = if (time != null) {
+ // 鑾峰彇鏌愪竴澶╃殑宸℃煡浠诲姟
+ subtaskMapper.selectByExample(Example(Subtask::class.java).apply {
+ createCriteria().andLessThanOrEqualTo("planstarttime", time)
.andGreaterThanOrEqualTo("planendtime", time)
- }).forEach {
+ .apply { sceneId?.let { andEqualTo("scenseid", it) } }
+ })
+ } else {
+ // 鑾峰彇鏈�杩戜竴娆℃�讳换鍔″唴鐨勶紙鏌愪釜鍦烘櫙鐨勶級鎵�鏈夊贰鏌ヤ换鍔�
+ PageHelper.startPage<Subtask>(1, 1)
+ val lastOne = subtaskMapper.selectByExample(Example(Subtask::class.java).apply {
+ createCriteria().apply {
+ sceneId?.let { andEqualTo("scenseid", it) }
+ }
+ orderBy("planstarttime").desc()
+ }).takeIf { it.isNotEmpty() }?.get(0)
+ if (lastOne == null) {
+ emptyList()
+ } else {
+ subtaskMapper.selectByExample(Example(Subtask::class.java).apply {
+ createCriteria().andEqualTo("tguid", lastOne.tguid)
+ .andEqualTo("scenseid", lastOne.scenseid)
+ })
+ }
+ }
+ subtasks.forEach {
val vo = SubtaskVo()
BeanUtils.copyProperties(it, vo)
resultList.add(vo)
@@ -920,7 +985,7 @@
topTaskId: String,
startTime: String?,
endTime: String?,
- sceneTypeId: Int?
+ sceneTypeId: Int?,
): List<Subtask> {
return subtaskMapper.selectByTopTask2(topTaskId, sceneTypeId)
@@ -933,7 +998,7 @@
override fun getTaskProgressByArea(areaVo: AreaVo): List<TaskProgressVo> {
// areaVo.scensetypeid ?: throw BizException("缂哄皯鍦烘櫙绫诲瀷鍙傛暟")
val res = mutableListOf<TaskProgressVo>()
- taskRep.findTasks(areaVo).forEach {t->
+ taskRep.findTasks(areaVo).forEach { t ->
if (t?.tguid == null) return@forEach
val pro = TaskProgressVo().apply {
tguid = t.tguid
--
Gitblit v1.9.3