Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-boot-biz
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
项目统一框架
amos-boot-biz
Commits
b411ba69
Commit
b411ba69
authored
Nov 27, 2023
by
tianyiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新索引--涉及任务下发、定时器修改、任务执行
parent
c2984d5b
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
363 additions
and
61 deletions
+363
-61
AppCheckInputRespone.java
...mos/patrol/core/common/response/AppCheckInputRespone.java
+5
-1
PlanMapper.java
...m/yeejoin/amos/patrol/business/dao/mapper/PlanMapper.java
+2
-0
PlanTaskMapper.java
...ejoin/amos/patrol/business/dao/mapper/PlanTaskMapper.java
+81
-32
PlanTaskStaticDto.java
...m/yeejoin/amos/patrol/business/dto/PlanTaskStaticDto.java
+21
-0
PlanTaskServiceImpl.java
...mos/patrol/business/service/impl/PlanTaskServiceImpl.java
+143
-28
dbTemplate_plan.xml
...trol-biz/src/main/resources/db/mapper/dbTemplate_plan.xml
+5
-0
dbTemplate_plan_task.xml
...biz/src/main/resources/db/mapper/dbTemplate_plan_task.xml
+106
-0
No files found.
amos-boot-system-tzs/amos-boot-module-tzspatrol/amos-boot-module-tzspatrol-api/src/main/java/com/yeejoin/amos/patrol/core/common/response/AppCheckInputRespone.java
View file @
b411ba69
...
...
@@ -4,6 +4,8 @@ import java.util.List;
public
class
AppCheckInputRespone
{
private
String
inputName
;
private
String
pointId
;
private
String
inputValue
;
...
...
@@ -24,7 +26,9 @@ public class AppCheckInputRespone{
public
String
getDefaultValue
()
{
return
defaultValue
;
}
public
String
getPointId
()
{
return
pointId
;
}
public
void
setDefaultValue
(
String
defaultValue
)
{
this
.
defaultValue
=
defaultValue
;
}
...
...
amos-boot-system-tzs/amos-boot-module-tzspatrol/amos-boot-module-tzspatrol-biz/src/main/java/com/yeejoin/amos/patrol/business/dao/mapper/PlanMapper.java
View file @
b411ba69
...
...
@@ -58,4 +58,6 @@ public interface PlanMapper extends BaseMapper {
* 初始化计划下次执行时间
*/
void
initUpdatePlanNextGenDate
();
Plan
getPlan
(
String
planId
);
}
amos-boot-system-tzs/amos-boot-module-tzspatrol/amos-boot-module-tzspatrol-biz/src/main/java/com/yeejoin/amos/patrol/business/dao/mapper/PlanTaskMapper.java
View file @
b411ba69
package
com
.
yeejoin
.
amos
.
patrol
.
business
.
dao
.
mapper
;
import
com.yeejoin.amos.patrol.business.dto.PlanTaskStaticDto
;
import
com.yeejoin.amos.patrol.business.entity.mybatis.CheckChkExListBo
;
import
com.yeejoin.amos.patrol.business.entity.mybatis.PlanTaskPointInputItemBo
;
import
com.yeejoin.amos.patrol.business.entity.mybatis.PointCheckDetailBo
;
...
...
@@ -8,6 +9,7 @@ import com.yeejoin.amos.patrol.business.param.PlanTaskPageParam;
import
com.yeejoin.amos.patrol.business.vo.CodeOrderVo
;
import
com.yeejoin.amos.patrol.business.vo.LeavePlanTaskVo
;
import
com.yeejoin.amos.patrol.business.vo.PlanTaskVo
;
import
com.yeejoin.amos.patrol.core.common.response.AppCheckInputRespone
;
import
com.yeejoin.amos.patrol.dao.entity.Plan
;
import
com.yeejoin.amos.patrol.dao.entity.PlanTask
;
import
com.yeejoin.amos.patrol.dao.entity.PlanTaskDetail
;
...
...
@@ -23,30 +25,37 @@ import java.util.Map;
public
interface
PlanTaskMapper
extends
BaseMapper
{
/**
* 统计-计划执行
*
* @param params
* @return
*/
long
countPlanTask
(
PlanTaskPageParam
params
);
/**
* 计划执行查询
* @param params
* @return
*/
/**
* 计划执行查询
*
* @param params
* @return
*/
List
<
HashMap
<
String
,
Object
>>
getPlanTaskInfo
(
PlanTaskPageParam
params
);
/**
* 批量删除
*
* @param strArry
*/
void
planTaskDet
(
String
[]
strArry
);
/**
* 更新任务表
*
* @param param
*/
void
updatePlanTaskPtInfo
(
HashMap
<
String
,
Object
>
param
);
/**
* 查询需删除的任务信息列表
*
* @param param
* @return
*/
...
...
@@ -59,6 +68,7 @@ public interface PlanTaskMapper extends BaseMapper {
* @return
*/
List
<
PlanTask
>
getPlanTaskByRouteId
(
@Param
(
value
=
"routeId"
)
Long
routeId
);
/**
* 根据巡检点id获取关联的计划任务
*
...
...
@@ -66,67 +76,86 @@ public interface PlanTaskMapper extends BaseMapper {
* @return
*/
List
<
HashMap
<
String
,
Object
>>
getPlanTaskByPointId
(
HashMap
<
String
,
Object
>
param
);
/**
* 根据条件查询计划任务列表
* 根据条件查询计划任务列表
*
* @param params
* @return
*/
List
<
Map
<
String
,
Object
>>
getPlanTasks
(
HashMap
<
String
,
Object
>
params
);
/**
* 通过计划任务Id获得计划任务信息
* 通过计划任务Id获得计划任务信息
*
* @param planTaskId
* @return
*/
Map
queryPlanTaskById
(
@Param
(
value
=
"planTaskId"
)
Long
planTaskId
);
Map
queryPlanTaskById
(
@Param
(
value
=
"planTaskId"
)
Long
planTaskId
);
/**
* 通过计划任务Id获取任务所有点信息
* 通过计划任务Id获取任务所有点信息
*
* @param planTaskId
* @return
*/
List
getPlanTaskPoints
(
@Param
(
value
=
"planTaskId"
)
Long
planTaskId
);
List
getPlanTaskPoints
(
@Param
(
value
=
"planTaskId"
)
Long
planTaskId
);
/**
* 获取用户当前所有可以做的任务个数
* 获取用户当前所有可以做的任务个数
*
* @param userId
* @return
*/
int
getCurrentPlanTaskCount
(
@Param
(
value
=
"userId"
)
String
userId
);
int
getCurrentPlanTaskCount
(
@Param
(
value
=
"userId"
)
String
userId
);
/**
* 根据计划任务id获取所有巡检项信息
*
* @param planTaskId
* @return
*/
List
<
PlanTaskPointInputItemBo
>
getPlanTaskPointInputItemByPlanTaskId
(
@Param
(
value
=
"planTaskId"
)
Long
planTaskId
,
@Param
(
value
=
"planTaskDetailStatus"
)
String
planTaskDetailStatus
);
List
<
PlanTaskPointInputItemBo
>
getPlanTaskPointInputItemByPlanTaskId
(
@Param
(
value
=
"planTaskId"
)
Long
planTaskId
,
@Param
(
value
=
"planTaskDetailStatus"
)
String
planTaskDetailStatus
);
/**
* 条件查询数据
*
* @param param
* @return
*/
List
<
PlanTaskVo
>
getPlanTaskInfoList
(
PlanTaskPageParam
param
);
/**
* 根据ids获取执行计划
*
* @param ids
* @return
*/
List
<
PlanTaskVo
>
getPlanTaskListByIds
(
@Param
(
"ids"
)
Long
[]
ids
);
/**
* 分页统计
*
* @param param
* @return
*/
long
countChkExListData
(
CheckPtListPageParam
param
);
long
countChkExListDataNew
(
CheckPtListPageParam
param
);
/**
* 今日执行情况,业务信息查询
*
* @param param
* @return
*/
List
<
CheckChkExListBo
>
getChkExList
(
CheckPtListPageParam
param
);
List
<
CheckChkExListBo
>
getChkExListNew
(
CheckPtListPageParam
param
);
/**
* 任务分页查询数量
*
* @param params 参数
* @return long
*/
...
...
@@ -137,6 +166,7 @@ public interface PlanTaskMapper extends BaseMapper {
/**
* 根据计划id和点id获取点详情
*
* @param planTaskId
* @param pointId
* @return
...
...
@@ -145,19 +175,24 @@ public interface PlanTaskMapper extends BaseMapper {
/**
* 根据路线id和点id获取该点的检查项
*
* @param routeId
* @param pointId
* @return
*/
List
<
PointCheckDetailBo
>
getPointInputByRouteIdAndPointId
(
@Param
(
"routeId"
)
Long
routeId
,
@Param
(
"pointId"
)
Long
pointId
);
List
<
PointCheckDetailBo
>
getPointInputByRouteIdAndPointId
(
@Param
(
"routeId"
)
Long
routeId
,
@Param
(
"pointId"
)
Long
pointId
);
/**
* 统计当日任务累计完成情况
* 统计当日任务累计完成情况
*
* @param loginOrgCode
* @return
*/
String
getCumulativePlanCountByOrgCode
(
@Param
(
"orgCode"
)
String
loginOrgCode
);
/**
* 获取用户离线巡检计划任务信息
*
* @param params
* @return
*/
...
...
@@ -170,17 +205,19 @@ public interface PlanTaskMapper extends BaseMapper {
* @param pointId
* @return
*/
List
<
PointInputItem
>
getRoutePointInputItem
(
@Param
(
value
=
"routeId"
)
long
routeId
,
@Param
(
value
=
"pointId"
)
long
pointId
);
List
<
PointInputItem
>
getRoutePointInputItem
(
@Param
(
value
=
"routeId"
)
long
routeId
,
@Param
(
value
=
"pointId"
)
long
pointId
);
List
<
CodeOrderVo
>
queryCodeOrderVo
(
HashMap
<
String
,
Object
>
params
);
/**
* 重新统计用户重做日期段内计划任务
*
* @param userId
* @param refDate
* @param orgCode
*/
void
reformStatistics
(
@Param
(
value
=
"userId"
)
String
userId
,
@Param
(
value
=
"refDate"
)
String
refDate
,
@Param
(
value
=
"orgCode"
)
String
orgCode
);
void
reformStatistics
(
@Param
(
value
=
"userId"
)
String
userId
,
@Param
(
value
=
"refDate"
)
String
refDate
,
@Param
(
value
=
"orgCode"
)
String
orgCode
);
List
<
Map
<
String
,
Object
>>
countFinishByPlanIds
(
List
<
Long
>
planIds
);
...
...
@@ -194,38 +231,39 @@ public interface PlanTaskMapper extends BaseMapper {
/**
* 消防巡检信息统计
*
* @param bizOrgCode 业务公司编码
* @return 消防巡检信息统计
*/
List
<
Map
<
String
,
Object
>>
firePatrolStatics
(
@Param
(
"bizOrgCode"
)
String
bizOrgCode
);
long
countData
(
@Param
(
value
=
"param"
)
PlanTaskPageParam
param
);
long
countData
(
@Param
(
value
=
"param"
)
PlanTaskPageParam
param
);
List
<
HashMap
<
String
,
Object
>>
planTaskPage
(
@Param
(
value
=
"param"
)
PlanTaskPageParam
param
);
List
<
HashMap
<
String
,
Object
>>
planTaskPage
(
@Param
(
value
=
"param"
)
PlanTaskPageParam
param
);
Map
<
String
,
Object
>
getPlanTaskBasicInfo
(
@Param
(
value
=
"taskDetailId"
)
String
taskDetailId
);
Map
<
String
,
Object
>
getPlanTaskBasicInfo
(
@Param
(
value
=
"taskDetailId"
)
String
taskDetailId
);
Map
<
String
,
Object
>
getPlanTaskExecuteInfo
(
@Param
(
value
=
"taskDetailId"
)
String
taskDetailId
);
Map
<
String
,
Object
>
getPlanTaskExecuteInfo
(
@Param
(
value
=
"taskDetailId"
)
String
taskDetailId
);
List
<
String
>
getDefinitionObjCode
(
@Param
(
value
=
"taskDetailId"
)
String
taskDetailId
);
List
<
String
>
getDefinitionObjCode
(
@Param
(
value
=
"taskDetailId"
)
String
taskDetailId
);
Map
<
String
,
Object
>
getDefectEquipInfo
(
@Param
(
value
=
"id"
)
String
id
);
Map
<
String
,
Object
>
getDefectEquipInfo
(
@Param
(
value
=
"id"
)
String
id
);
List
<
Map
<
String
,
Object
>>
getCheckMissedEquipInfo
(
@Param
(
value
=
"taskDetailId"
)
String
taskDetailId
);
List
<
Map
<
String
,
Object
>>
getCheckMissedEquipInfo
(
@Param
(
value
=
"taskDetailId"
)
String
taskDetailId
);
List
<
Map
<
String
,
Object
>>
getCheckQualifiedEquipInfo
(
@Param
(
value
=
"taskDetailId"
)
String
taskDetailId
);
List
<
Map
<
String
,
Object
>>
getCheckQualifiedEquipInfo
(
@Param
(
value
=
"taskDetailId"
)
String
taskDetailId
);
List
<
Map
<
String
,
Object
>>
getCheckNotQualifiedEquipInfo
(
@Param
(
value
=
"taskDetailId"
)
String
taskDetailId
);
List
<
Map
<
String
,
Object
>>
getCheckNotQualifiedEquipInfo
(
@Param
(
value
=
"taskDetailId"
)
String
taskDetailId
);
String
getCheckIdByDetailId
(
@Param
(
value
=
"taskDetailId"
)
String
taskDetailId
);
String
getCheckIdByDetailId
(
@Param
(
value
=
"taskDetailId"
)
String
taskDetailId
);
String
queryByCompanyCode
(
@Param
(
"companyCode"
)
String
companyCode
);
List
<
Map
<
String
,
Object
>>
getStatics
(
@Param
(
"bizOrgCode"
)
String
bizOrgCode
);
Map
<
String
,
Object
>
queryPatrolInfoList
(
@Param
(
value
=
"bizOrgCode"
)
String
bizOrgCode
,
@Param
(
value
=
"startDate"
)
Date
startDate
,
@Param
(
value
=
"endDate"
)
Date
endDate
);
Map
<
String
,
Object
>
queryPatrolInfoList
(
@Param
(
value
=
"bizOrgCode"
)
String
bizOrgCode
,
@Param
(
value
=
"startDate"
)
Date
startDate
,
@Param
(
value
=
"endDate"
)
Date
endDate
);
Map
<
String
,
Object
>
queryPatrolEquipInfo
(
@Param
(
value
=
"bizOrgCode"
)
String
bizOrgCode
,
@Param
(
value
=
"startDate"
)
Date
startDate
,
@Param
(
value
=
"endDate"
)
Date
endDate
);
Map
<
String
,
Object
>
queryPatrolEquipInfo
(
@Param
(
value
=
"bizOrgCode"
)
String
bizOrgCode
,
@Param
(
value
=
"startDate"
)
Date
startDate
,
@Param
(
value
=
"endDate"
)
Date
endDate
);
List
<
Long
>
getPlanTaskListByPlanId
(
long
planId
,
int
finishStatus
);
...
...
@@ -244,6 +282,7 @@ public interface PlanTaskMapper extends BaseMapper {
List
<
PlanTaskDetail
>
selectTaskDetails
(
String
id
);
Map
<
String
,
Object
>
selectTaskStatus
(
Long
planTaskId
);
void
updatePlanTaskList
(
long
planId
,
int
oldStatus
,
int
newStatus
);
List
<
PlanTask
>
findPlanTask
();
...
...
@@ -260,11 +299,11 @@ public interface PlanTaskMapper extends BaseMapper {
List
<
StaticDay
>
findStaticWeek
();
void
insertAll
(
String
table
,
StaticDay
item
);
void
insertAll
(
String
table
,
StaticDay
item
);
void
updateData
(
String
table
,
List
<
StaticDay
>
list
);
void
updateData
(
String
table
,
List
<
StaticDay
>
list
);
void
updateSingle
(
String
table
,
int
riskEnd
,
int
noRiskEnd
,
String
orgCode
,
String
checkTime
);
void
updateSingle
(
String
table
,
int
riskEnd
,
int
noRiskEnd
,
String
orgCode
,
String
checkTime
);
int
deleteDate
(
String
table
);
...
...
@@ -276,4 +315,14 @@ public interface PlanTaskMapper extends BaseMapper {
List
<
String
>
selectPlanTaskIdLists
(
long
planId
,
int
status
,
int
status1
);
List
<
PlanTask
>
selectTaskList
(
@Param
(
value
=
"ids"
)
List
<
String
>
ids
);
List
<
PlanTaskStaticDto
>
queryPlanTaskStaticById
(
@Param
(
value
=
"planTaskIds"
)
List
<
String
>
planTaskIds
);
List
<
ESTaskDetailDto
>
selectTaskDetailList
(
@Param
(
value
=
"taskIds"
)
List
<
String
>
taskIds
);
List
<
ESTaskDetailDto
>
selectTaskInfoList
(
@Param
(
value
=
"id"
)
long
id
);
List
<
AppCheckInputRespone
>
selectPointInputs
();
List
<
String
>
getPlanTaskIds
(
@Param
(
value
=
"id"
)
long
id
);
}
amos-boot-system-tzs/amos-boot-module-tzspatrol/amos-boot-module-tzspatrol-biz/src/main/java/com/yeejoin/amos/patrol/business/dto/PlanTaskStaticDto.java
0 → 100644
View file @
b411ba69
package
com
.
yeejoin
.
amos
.
patrol
.
business
.
dto
;
import
lombok.Data
;
import
java.util.Collection
;
@Data
public
class
PlanTaskStaticDto
{
private
String
planTaskId
;
private
String
finshNum
;
private
String
omission
;
private
String
unqualified
;
private
String
unplan
;
private
String
taskPlanNum
;
}
\ No newline at end of file
amos-boot-system-tzs/amos-boot-module-tzspatrol/amos-boot-module-tzspatrol-biz/src/main/java/com/yeejoin/amos/patrol/business/service/impl/PlanTaskServiceImpl.java
View file @
b411ba69
...
...
@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSON;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.google.common.base.Joiner
;
import
com.google.common.base.Stopwatch
;
import
com.sun.corba.se.impl.activation.RepositoryImpl
;
import
com.yeejoin.amos.boot.biz.common.constants.RuleConstant
;
import
com.yeejoin.amos.boot.biz.common.utils.DateUtils
;
...
...
@@ -19,6 +20,7 @@ import com.yeejoin.amos.patrol.business.constants.XJConstant;
import
com.yeejoin.amos.patrol.business.dao.mapper.*
;
import
com.yeejoin.amos.patrol.business.dao.repository.*
;
import
com.yeejoin.amos.patrol.business.dto.MsgRo
;
import
com.yeejoin.amos.patrol.business.dto.PlanTaskStaticDto
;
import
com.yeejoin.amos.patrol.business.dto.UserDetailsDto
;
import
com.yeejoin.amos.patrol.business.entity.mybatis.CheckChkExListBo
;
import
com.yeejoin.amos.patrol.business.entity.mybatis.PointCheckDetailBo
;
...
...
@@ -75,6 +77,7 @@ import org.springframework.transaction.support.TransactionSynchronization;
import
org.springframework.transaction.support.TransactionSynchronizationManager
;
import
org.springframework.util.Assert
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.util.StopWatch
;
import
org.springframework.util.StringUtils
;
import
org.springframework.web.multipart.MultipartFile
;
import
org.typroject.tyboot.core.foundation.context.RequestContext
;
...
...
@@ -103,6 +106,8 @@ import java.text.SimpleDateFormat;
import
java.time.LocalDateTime
;
import
java.time.ZoneId
;
import
java.util.*
;
import
java.util.concurrent.ExecutorService
;
import
java.util.concurrent.Executors
;
import
java.util.function.Function
;
import
java.util.stream.Collectors
;
...
...
@@ -837,7 +842,7 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
return
PlanTaskUtil
.
genWholeExeData
(
timeList
,
plan
,
userDetailsDtos
,
route
);
}
private
ExecutorService
threadPool
=
Executors
.
newCachedThreadPool
();
/**
* plantask及det入库
...
...
@@ -961,33 +966,6 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
jobService
.
planTaskAddJob
(
planTask
);
Iterable
<
PlanTaskDetail
>
planTaskDetails
=
repositoryTs
.
batchSave
(
planTaskDetailListSync
);
Long
routId
=
planTaskMapper
.
selectRoutId
(
String
.
valueOf
(
planTask
.
getId
()));
List
<
PlanTaskDetail
>
planTaskDetailList
=
new
ArrayList
<>();
planTaskDetails
.
forEach
(
single
->
planTaskDetailList
.
add
(
single
));
for
(
PlanTaskDetail
taskDetail
:
planTaskDetailList
)
{
Point
point
=
pointMapper
.
selectPointInfo
(
taskDetail
.
getPointId
());
taskDetail
.
setName
(
point
.
getName
());
taskDetail
.
setPointNo
(
point
.
getPointNo
());
AppPointCheckRespone
appPointCheckRespone
=
planService
.
queryPointPlanTaskDetail
(
null
,
null
,
null
,
taskDetail
.
getTaskNo
(),
taskDetail
.
getPointId
());
JSONObject
jsonObject
=
jobService
.
getCheckInput
(
routId
,
taskDetail
.
getPointId
(),
"save"
,
null
);
appPointCheckRespone
.
setAppCheckInput
(
jsonObject
);
ESTaskDetailDto
esTaskDetailDto
=
JSONObject
.
parseObject
(
toJSONString
(
appPointCheckRespone
),
ESTaskDetailDto
.
class
);
esTaskDetail
.
save
(
esTaskDetailDto
);
}
for
(
ESPlanTaskListDto
esPlanTaskListDto
:
esPlanTaskListDtos
)
{
List
<
PlanTaskDetail
>
newPlanTaskDetailList
=
planTaskDetailList
.
stream
().
filter
(
x
->
x
.
getTaskNo
()
==
Long
.
valueOf
(
esPlanTaskListDto
.
getPlanTaskId
())).
collect
(
Collectors
.
toList
());
esPlanTaskListDto
.
setPoints
(
newPlanTaskDetailList
);
Map
task
=
queryPlanTaskById
(
Long
.
valueOf
(
esPlanTaskListDto
.
getPlanTaskId
()));
esPlanTaskListDto
.
setFinshNum
(
ObjectUtils
.
isEmpty
(
task
.
get
(
"finshNum"
))
?
"0"
:
task
.
get
(
"finshNum"
).
toString
());
esPlanTaskListDto
.
setOmission
(
ObjectUtils
.
isEmpty
(
task
.
get
(
"omission"
))
?
"0"
:
task
.
get
(
"omission"
).
toString
());
esPlanTaskListDto
.
setUnqualified
(
ObjectUtils
.
isEmpty
(
task
.
get
(
"unqualified"
))
?
"0"
:
task
.
get
(
"unqualified"
).
toString
());
esPlanTaskListDto
.
setUnplan
(
ObjectUtils
.
isEmpty
(
task
.
get
(
"unplan"
))
?
"0"
:
task
.
get
(
"unplan"
).
toString
());
esPlanTaskListDto
.
setTaskPlanNum
(
ObjectUtils
.
isEmpty
(
task
.
get
(
"taskPlanNum"
))
?
"0"
:
task
.
get
(
"taskPlanNum"
).
toString
());
}
saveEsPlanTaskList
(
esPlanTaskListDtos
,
oldEsPlanTaskListDtos
);
// 3.如果为自动任务调用,则更新id,如果重做或且下次时间大于等于明天,则更新planTaskId到plan表
Date
genDate
=
DateUtil
.
str2Date
(
list
.
get
(
list
.
size
()
-
1
).
get
(
"NEXT_GEN_DATE"
).
toString
(),
"yyyy-MM-dd"
);
//下次生成日期
...
...
@@ -1008,6 +986,12 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
paramMap
.
put
(
"next_gen_date"
,
DateUtil
.
formatDatrToStr
(
now
,
"yyyy-MM-dd"
));
}
planMapper
.
updPlanStatusOrGenDate
(
paramMap
);
// 更新下次任务生成日期
threadPool
.
submit
(()
->
{
//异步存储任务和任务详情到es
asyncSavePlanTaskAndDetailListToEs
(
planTaskDetails
,
esPlanTaskListDtos
,
oldEsPlanTaskListDtos
);
});
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
log
.
error
(
e
.
getMessage
());
...
...
@@ -1016,6 +1000,137 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
}
}
private
void
asyncSavePlanTaskAndDetailListToEs
(
Iterable
<
PlanTaskDetail
>
planTaskDetails
,
List
<
ESPlanTaskListDto
>
esPlanTaskListDtos
,
List
<
ESPlanTaskListDto
>
oldEsPlanTaskListDtos
)
{
log
.
error
(
"异步存储任务和任务详情到es"
);
Plan
plan
=
planMapper
.
getPlan
(
esPlanTaskListDtos
.
get
(
0
).
getPlanId
());
StopWatch
stopWatch
=
new
StopWatch
();
stopWatch
.
start
();
List
<
String
>
taskIds
=
planTaskMapper
.
getPlanTaskIds
(
plan
.
getId
());
List
<
ESTaskDetailDto
>
esTaskDetailDtos
=
new
ArrayList
<>();
if
(!
ValidationUtil
.
isEmpty
(
taskIds
))
{
if
(
taskIds
.
size
()
>
10000
)
{
int
index
=
10000
;
for
(
int
i
=
0
;
i
<
taskIds
.
size
();
i
+=
10000
)
{
if
(
i
+
10000
>
taskIds
.
size
())
{
index
=
taskIds
.
size
()
-
i
;
}
List
<
String
>
newList
=
taskIds
.
subList
(
i
,
i
+
index
);
List
<
ESTaskDetailDto
>
maps
=
planTaskMapper
.
selectTaskDetailList
(
newList
);
esTaskDetailDtos
.
addAll
(
maps
);
}
}
else
{
List
<
ESTaskDetailDto
>
maps
=
planTaskMapper
.
selectTaskDetailList
(
taskIds
);
esTaskDetailDtos
.
addAll
(
maps
);
}
}
stopWatch
.
stop
();
log
.
info
(
"获取点详情基础数据,耗时:{} 秒"
,
stopWatch
.
getTotalTimeSeconds
());
StopWatch
stopWatch1
=
new
StopWatch
();
stopWatch1
.
start
();
List
<
ESTaskDetailDto
>
esTaskInfo
=
planTaskMapper
.
selectTaskInfoList
(
plan
.
getId
());
stopWatch1
.
stop
();
log
.
info
(
"获取点详情其他数据,耗时:{} 秒"
,
stopWatch1
.
getTotalTimeSeconds
());
List
<
AppCheckInputRespone
>
pointInputs
=
planTaskMapper
.
selectPointInputs
();
StopWatch
stopWatch2
=
new
StopWatch
();
stopWatch2
.
start
();
for
(
ESTaskDetailDto
esTaskDetailDto
:
esTaskDetailDtos
)
{
ESTaskDetailDto
taskInfo
=
esTaskInfo
.
stream
().
filter
(
x
->
x
.
getPlanTaskId
().
equals
(
esTaskDetailDto
.
getPlanTaskId
())).
collect
(
Collectors
.
toList
()).
get
(
0
);
esTaskDetailDto
.
setPlanName
(
plan
.
getName
());
esTaskDetailDto
.
setBeginTime
(
taskInfo
.
getBeginTime
());
esTaskDetailDto
.
setEndTime
(
taskInfo
.
getEndTime
());
esTaskDetailDto
.
setTaskStatus
(
taskInfo
.
getTaskStatus
());
List
<
AppCheckInputRespone
>
collect
=
pointInputs
.
stream
().
filter
(
x
->
x
.
getPointId
().
equals
(
esTaskDetailDto
.
getPointId
())).
collect
(
Collectors
.
toList
());
JSONObject
appResponeMap
=
new
JSONObject
();
appResponeMap
.
put
(
"items"
,
collect
);
esTaskDetailDto
.
setAppCheckInput
(
appResponeMap
);
}
stopWatch2
.
stop
();
log
.
info
(
"组装点详情数据,耗时:{} 秒"
,
stopWatch2
.
getTotalTimeSeconds
());
StopWatch
stopWatch3
=
new
StopWatch
();
stopWatch3
.
start
();
esTaskDetail
.
saveAll
(
esTaskDetailDtos
);
stopWatch3
.
stop
();
log
.
info
(
"点详情数据存入es,耗时:{} 秒"
,
stopWatch3
.
getTotalTimeSeconds
());
StopWatch
stopWatch4
=
new
StopWatch
();
stopWatch4
.
start
();
List
<
PlanTaskDetail
>
planTaskDetailList
=
new
ArrayList
<>();
planTaskDetails
.
forEach
(
single
->
planTaskDetailList
.
add
(
single
));
stopWatch4
.
stop
();
log
.
info
(
"planTaskDetails转化,耗时:{} 秒"
,
stopWatch4
.
getTotalTimeSeconds
());
StopWatch
stopWatch5
=
new
StopWatch
();
stopWatch5
.
start
();
List
<
String
>
planTaskIds
=
esPlanTaskListDtos
.
stream
().
map
(
ESPlanTaskListDto:
:
getPlanTaskId
).
collect
(
Collectors
.
toList
());
List
<
PlanTaskStaticDto
>
planTaskStaticListMap
=
new
ArrayList
<>();
if
(!
ValidationUtil
.
isEmpty
(
planTaskIds
))
{
if
(
planTaskIds
.
size
()
>
10000
)
{
int
index
=
10000
;
for
(
int
i
=
0
;
i
<
planTaskIds
.
size
();
i
+=
10000
)
{
if
(
i
+
10000
>
planTaskIds
.
size
())
{
index
=
planTaskIds
.
size
()
-
i
;
}
List
<
String
>
newList
=
planTaskIds
.
subList
(
i
,
i
+
index
);
List
<
PlanTaskStaticDto
>
maps
=
queryPlanTaskStaticById
(
newList
);
planTaskStaticListMap
.
addAll
(
maps
);
}
}
else
{
List
<
PlanTaskStaticDto
>
maps
=
queryPlanTaskStaticById
(
planTaskIds
);
planTaskStaticListMap
.
addAll
(
maps
);
}
}
stopWatch5
.
stop
();
log
.
info
(
"esPlanTaskListDtos统计组装,耗时:{} 秒"
,
stopWatch5
.
getTotalTimeSeconds
());
StopWatch
stopWatch6
=
new
StopWatch
();
stopWatch6
.
start
();
for
(
ESPlanTaskListDto
esPlanTaskListDto
:
esPlanTaskListDtos
)
{
List
<
PlanTaskDetail
>
newPlanTaskDetailList
=
planTaskDetailList
.
stream
().
filter
(
x
->
x
.
getTaskNo
()
==
Long
.
valueOf
(
esPlanTaskListDto
.
getPlanTaskId
())).
collect
(
Collectors
.
toList
());
esPlanTaskListDto
.
setPoints
(
newPlanTaskDetailList
);
if
(!
ValidationUtil
.
isEmpty
(
planTaskIds
))
{
PlanTaskStaticDto
task
=
planTaskStaticListMap
.
stream
().
filter
(
x
->
x
.
getPlanTaskId
().
equals
(
esPlanTaskListDto
.
getPlanTaskId
())).
collect
(
Collectors
.
toList
()).
get
(
0
);
esPlanTaskListDto
.
setFinshNum
(
ObjectUtils
.
isEmpty
(
task
.
getFinshNum
())
?
"0"
:
task
.
getFinshNum
());
esPlanTaskListDto
.
setOmission
(
ObjectUtils
.
isEmpty
(
task
.
getOmission
())
?
"0"
:
task
.
getOmission
());
esPlanTaskListDto
.
setUnqualified
(
ObjectUtils
.
isEmpty
(
task
.
getUnqualified
())
?
"0"
:
task
.
getUnqualified
());
esPlanTaskListDto
.
setUnplan
(
ObjectUtils
.
isEmpty
(
task
.
getUnplan
())
?
"0"
:
task
.
getUnplan
());
esPlanTaskListDto
.
setTaskPlanNum
(
ObjectUtils
.
isEmpty
(
task
.
getTaskPlanNum
())
?
"0"
:
task
.
getTaskPlanNum
());
}
else
{
esPlanTaskListDto
.
setFinshNum
(
"0"
);
esPlanTaskListDto
.
setOmission
(
"0"
);
esPlanTaskListDto
.
setUnqualified
(
"0"
);
esPlanTaskListDto
.
setUnplan
(
"0"
);
esPlanTaskListDto
.
setTaskPlanNum
(
"0"
);
}
}
stopWatch6
.
stop
();
log
.
info
(
"esPlanTaskListDtos数据组装,耗时:{} 秒"
,
stopWatch6
.
getTotalTimeSeconds
());
saveEsPlanTaskList
(
esPlanTaskListDtos
,
oldEsPlanTaskListDtos
);
}
public
static
CheckInput
paraseSelect
(
CheckInput
checkInput
,
String
json
)
{
JSONArray
jsonArray
=
JSONArray
.
parseArray
(
json
);
if
(!
ObjectUtils
.
isEmpty
(
jsonArray
))
{
for
(
int
i
=
0
;
i
<
jsonArray
.
size
();
i
++)
{
JSONObject
jsonObject
=
jsonArray
.
getJSONObject
(
i
);
String
validateName
=
jsonObject
.
getString
(
"name"
);
String
validateIsOk
=
jsonObject
.
getString
(
"isOk"
);
if
(
validateIsOk
.
equals
(
"是"
))
{
checkInput
.
setInputValue
(
validateName
);
}
}
}
return
checkInput
;
}
private
List
<
PlanTaskStaticDto
>
queryPlanTaskStaticById
(
List
<
String
>
planTaskIds
)
{
return
planTaskMapper
.
queryPlanTaskStaticById
(
planTaskIds
);
}
public
void
saveEsPlanTaskList
(
List
<
ESPlanTaskListDto
>
esPlanTaskListDtos
,
List
<
ESPlanTaskListDto
>
oldEsPlanTaskListDtos
)
{
if
(!
ValidationUtil
.
isEmpty
(
oldEsPlanTaskListDtos
))
{
...
...
amos-boot-system-tzs/amos-boot-module-tzspatrol/amos-boot-module-tzspatrol-biz/src/main/resources/db/mapper/dbTemplate_plan.xml
View file @
b411ba69
...
...
@@ -167,4 +167,8 @@
<update
id=
"initUpdatePlanNextGenDate"
>
UPDATE p_plan p SET p.next_gen_date = CURDATE() WHERE p.is_delete = 0 AND p.status = 0 AND p.plan_end IS NULL AND p.next_gen_date
<![CDATA[ < ]]>
CURDATE();
</update>
<select
id=
"getPlan"
resultType=
"com.yeejoin.amos.patrol.dao.entity.Plan"
>
select * from p_plan where id = #{planId}
</select>
</mapper>
\ No newline at end of file
amos-boot-system-tzs/amos-boot-module-tzspatrol/amos-boot-module-tzspatrol-biz/src/main/resources/db/mapper/dbTemplate_plan_task.xml
View file @
b411ba69
...
...
@@ -1761,4 +1761,109 @@
#{id}
</foreach>
</select>
<select
id=
"queryPlanTaskStaticById"
resultType=
"com.yeejoin.amos.patrol.business.dto.PlanTaskStaticDto"
>
SELECT
a.planTaskId,
sum(a.finish) finshNum,
sum(a.omission) omission,
sum(a.unqualified) unqualified,
sum(a.unplan) unplan,
count(a.finish) taskPlanNum
FROM
(
SELECT
pt.id planTaskId,
CASE ptd.status
WHEN 1 THEN
1
ELSE
0
END finish,
CASE ptd.status
WHEN 3 THEN
1
ELSE
0
END omission,
CASE ptd.status
WHEN 2 THEN
1
ELSE
0
END unqualified,
CASE ptd.status
WHEN 0 THEN
1
ELSE
0
END unplan
FROM
p_plan_task_detail ptd
LEFT JOIN p_plan_task pt ON ptd.task_no = pt.id
) a
where a.planTaskId IN
<foreach
item=
"id"
collection=
"planTaskIds"
index=
"index"
open=
"("
separator=
","
close=
")"
>
#{id}
</foreach>
GROUP BY a.planTaskId
</select>
<select
id=
"selectTaskDetailList"
resultType=
"com.yeejoin.amos.patrol.dao.entity.ESTaskDetailDto"
>
SELECT
pptd.id,
pptd.task_no planTaskId,
pptd.status pointStatus,
pp.id pointId,
pp.name pointName,
pp.point_no pointNo,
pp.shot_min_number shortMinNumber,
pp.shot_max_number shortMaxNumber,
'0' checkId
FROM
"p_plan_task_detail" pptd LEFT JOIN p_point pp ON pp.id = pptd.point_id WHERE
task_no IN
<foreach
item=
"id"
collection=
"taskIds"
index=
"index"
open=
"("
separator=
","
close=
")"
>
#{id}
</foreach>
</select>
<select
id=
"selectTaskInfoList"
resultType=
"com.yeejoin.amos.patrol.dao.entity.ESTaskDetailDto"
>
SELECT
id planTaskId,
date_format(ppt.begin_time,'%Y-%m-%d %H:%i:%s') beginTime,
date_format(ppt.end_time,'%Y-%m-%d %H:%i:%s') endTime,
ppt.finish_status taskStatus
FROM
p_plan_task ppt
WHERE
plan_id = #{id};
</select>
<select
id=
"selectPointInputs"
resultType=
"com.yeejoin.amos.patrol.core.common.response.AppCheckInputRespone"
>
SELECT
ppi.point_id,
null inputValue,
null pointInputImgUrls,
pii.default_value,
pii.ID inputItemId,
pii.NAME inputName,
pii.ID checkInputId,
pii.item_type itemType,
pii.risk_desc riskDesc,
pii.data_json dataJson,
pii.is_must isMust,
pii.default_value defaultValue,
pii.picture_json pictureJson,
pii.is_multiline isMultiline,
pii.order_no orderNo
FROM
p_point_inputitem ppi
LEFT JOIN p_input_item pii ON ppi.input_item_id = pii."id"
</select>
<select
id=
"getPlanTaskIds"
resultType=
"java.lang.String"
>
SELECT ID FROM p_plan_task WHERE plan_id = #{id}
</select>
</mapper>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment