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
ec917d6a
Commit
ec917d6a
authored
Aug 18, 2021
by
suhuiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.漏检增加记录点名称、路线名称、计划名称
parent
d28bc056
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
149 additions
and
629 deletions
+149
-629
PlanTaskPointInputItemBo.java
...nce/business/entity/mybatis/PlanTaskPointInputItemBo.java
+29
-144
PlanTaskServiceImpl.java
...aintenance/business/service/impl/PlanTaskServiceImpl.java
+17
-331
IPlanTaskService.java
.../maintenance/business/service/intfc/IPlanTaskService.java
+90
-114
JobService.java
.../java/com/yeejoin/amos/maintenance/quartz/JobService.java
+3
-34
dbTemplate_plan_task.xml
...nce/src/main/resources/db/mapper/dbTemplate_plan_task.xml
+10
-6
No files found.
amos-boot-module/amos-boot-module-biz/amos-boot-module-maintenance-biz/src/main/java/com/yeejoin/amos/maintenance/business/entity/mybatis/PlanTaskPointInputItemBo.java
View file @
ec917d6a
package
com
.
yeejoin
.
amos
.
maintenance
.
business
.
entity
.
mybatis
;
import
lombok.Data
;
import
java.util.Date
;
/**
* @author DELL
*/
@Data
public
class
PlanTaskPointInputItemBo
{
/**
...
...
@@ -65,153 +71,32 @@ public class PlanTaskPointInputItemBo {
private
String
inputName
;
private
Long
classifyId
;
//新增执行部门
/**
* 执行部门
*/
private
String
depId
;
//执行人名称
/**
* 执行人名称
*/
private
String
userName
;
//执行部门名称
private
String
depName
;
public
String
getUserName
()
{
return
userName
;
}
public
void
setUserName
(
String
userName
)
{
this
.
userName
=
userName
;
}
public
String
getDepName
()
{
return
depName
;
}
public
void
setDepName
(
String
depName
)
{
this
.
depName
=
depName
;
}
public
Long
getInputItemId
()
{
return
inputItemId
;
}
public
void
setInputItemId
(
Long
inputItemId
)
{
this
.
inputItemId
=
inputItemId
;
}
public
int
getOrderNo
()
{
return
orderNo
;
}
public
void
setOrderNo
(
int
orderNo
)
{
this
.
orderNo
=
orderNo
;
}
public
long
getPointId
()
{
return
pointId
;
}
public
void
setPointId
(
long
pointId
)
{
this
.
pointId
=
pointId
;
}
public
long
getPlanTaskId
()
{
return
planTaskId
;
}
public
void
setPlanTaskId
(
long
planTaskId
)
{
this
.
planTaskId
=
planTaskId
;
}
public
long
getRouteId
()
{
return
routeId
;
}
public
void
setRouteId
(
long
routeId
)
{
this
.
routeId
=
routeId
;
}
public
long
getPlanId
()
{
return
planId
;
}
public
void
setPlanId
(
long
planId
)
{
this
.
planId
=
planId
;
}
public
String
getUserId
()
{
return
userId
;
}
public
void
setUserId
(
String
userId
)
{
this
.
userId
=
userId
;
}
public
String
getOrgCode
()
{
return
orgCode
;
}
public
void
setOrgCode
(
String
orgCode
)
{
this
.
orgCode
=
orgCode
;
}
public
Date
getEndTime
()
{
return
endTime
;
}
public
void
setEndTime
(
Date
endTime
)
{
this
.
endTime
=
endTime
;
}
public
long
getRoutePointItemId
()
{
return
routePointItemId
;
}
public
void
setRoutePointItemId
(
long
routePointItemId
)
{
this
.
routePointItemId
=
routePointItemId
;
}
public
long
getPlanTaskDetailId
()
{
return
planTaskDetailId
;
}
public
void
setPlanTaskDetailId
(
long
planTaskDetailId
)
{
this
.
planTaskDetailId
=
planTaskDetailId
;
}
public
String
getClassifyName
()
{
return
classifyName
;
}
public
void
setClassifyName
(
String
classifyName
)
{
this
.
classifyName
=
classifyName
;
}
public
Long
getClassifyId
()
{
return
classifyId
;
}
public
void
setClassifyId
(
Long
classifyId
)
{
this
.
classifyId
=
classifyId
;
}
public
String
getInputName
()
{
return
inputName
;
}
public
void
setInputName
(
String
inputName
)
{
this
.
inputName
=
inputName
;
}
public
String
getDepId
()
{
return
depId
;
}
/**
* 执行部门名称
*/
private
String
depName
;
public
void
setDepId
(
String
depId
)
{
this
.
depId
=
depId
;
}
/**
* 冗余字段:点名称
*/
private
String
pointName
;
/**
* 冗余字段:路线名称
*/
private
String
routeName
;
/**
* 冗余字段:计划名称
*/
private
String
planName
;
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-maintenance-biz/src/main/java/com/yeejoin/amos/maintenance/business/service/impl/PlanTaskServiceImpl.java
View file @
ec917d6a
...
...
@@ -117,17 +117,16 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
//3.计算生成数据的日期区间(前10位:yyyy-MM-dd)
CalDateVo
vo
=
PlanTaskUtil
.
reGenPlanTaskData
(
plan
,
strBeginDate
,
strEndDate
);
if
(
null
==
vo
)
{
//计划未开始,则结束
//计划未开始,则结束
if
(
null
==
vo
)
{
return
;
}
if
(!
vo
.
getIsGenData
())
{
//日期不符合条件直接结束
//日期不符合条件直接结束
if
(!
vo
.
getIsGenData
())
{
return
;
}
//
3
.删除planTask表,按照计划id+日期
//
4
.删除planTask表,按照计划id+日期
deletePlanTaskAndDet
(
param
);
//5.执行数据生成(具体时间 + 人员)
...
...
@@ -135,68 +134,9 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
//6.插入planTask及planTaskDetail
insertPlanTaskAndDet
(
list
,
plan
,
flag
,
new
Date
());
//7.重新统计计划
if
(
ObjectUtils
.
isEmpty
(
plan
.
getUserId
()))
{
return
;
}
reformStatisticsPlanTask
(
strBeginDate
,
strEndDate
,
plan
.
getUserId
(),
plan
.
getOrgCode
());
}
}
@Override
public
void
reformStatisticsPlanTask
(
String
strBginDate
,
String
strEndDate
,
String
userId
,
String
orgCode
)
throws
ParseException
{
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
Date
startTime
=
sdf
.
parse
(
strBginDate
);
Date
endTime
=
sdf
.
parse
(
strEndDate
);
Calendar
cal
=
Calendar
.
getInstance
();
cal
.
setTime
(
startTime
);
Date
currentDate
=
new
Date
();
String
strCurrentDate
=
sdf
.
format
(
currentDate
);
long
abortTime
=
endTime
.
getTime
();
if
(
endTime
.
getTime
()
>=
sdf
.
parse
(
strCurrentDate
).
getTime
())
{
abortTime
=
sdf
.
parse
(
strCurrentDate
).
getTime
();
}
String
[]
ids
=
userId
.
split
(
","
);
// StringBuffer orgCodeBuffer = new StringBuffer();
// Map<String,String> deptMap =new HashMap<>();
// Set<Object> userIds =new HashSet<>();
// for (int i = 0; i <ids.length ; i++) {
// userIds.add(ids[i].toString());
// }
// Map<String,AgencyUserModel> agencyUserModelMap = remoteSecurityService.getUsersMap(toke.getToke(),toke.getProduct(),toke.getAppKey(),userIds);
// List<Map<String, String>> idOrgCodeList = new ArrayList<>();
// for(Map.Entry<String, AgencyUserModel> entry : agencyUserModelMap.entrySet()){
// String id = entry.getKey();
// AgencyUserModel agencyUserModels = entry.getValue();
// StringBuffer agencyUserOrgcode = new StringBuffer();
// if(agencyUserModelMap.size() > 0){
// agencyUserModels.getCompanys().forEach(companyModel -> {
// agencyUserOrgcode.append(companyModel.getOrgCode()).append(",");
// });
// }
// Map<String,String> map = new HashMap<>();
// map.put(id,agencyUserOrgcode.toString().substring(0,agencyUserOrgcode.length()-1));
// }
//
// Map<String, String> userIdOrgCodeMap = new HashMap<>(ids.length);
// if (!CollectionUtils.isEmpty(idOrgCodeList)) {
// userIdOrgCodeMap = idOrgCodeList.stream().collect(Collectors.toMap(x-> String.valueOf(x.get(
// "id")), x->x.get("org_code")));
// }
while
(
cal
.
getTime
().
getTime
()
<=
abortTime
)
{
String
refDate
=
sdf
.
format
(
cal
.
getTime
());
for
(
String
id
:
ids
)
{
if
(!
ObjectUtils
.
isEmpty
(
id
))
{
planTaskMapper
.
reformStatistics
(
id
,
refDate
,
orgCode
);
// planTaskMapper.reformStatistics(id, refDate, userIdOrgCodeMap.get(id));
}
}
cal
.
add
(
Calendar
.
DATE
,
1
);
}
}
@Override
@Transactional
(
rollbackFor
=
Exception
.
class
)
...
...
@@ -514,8 +454,8 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
jobService
.
planTaskAddJob
(
planTask
);
}
// 3.如果为自动任务调用,则更新id,如果重做或且下次时间大于等于明天,则更新planTaskId到plan表
Date
genDate
=
DateUtil
.
str2Date
(
list
.
get
(
list
.
size
()
-
1
).
get
(
"NEXT_GEN_DATE"
).
toString
(),
"yyyy-MM-dd"
);
//下次生成日期
// 3.如果为自动任务调用,则更新id,如果重做或且下次时间大于等于明天,则更新planTaskId到plan表
,下次生成日期
Date
genDate
=
DateUtil
.
str2Date
(
list
.
get
(
list
.
size
()
-
1
).
get
(
"NEXT_GEN_DATE"
).
toString
(),
"yyyy-MM-dd"
);
//明天
Date
tomorrow
=
DateUtil
.
getIntervalDate
(
now
,
1
);
String
strGenDate
=
list
.
get
(
list
.
size
()
-
1
).
get
(
"NEXT_GEN_DATE"
).
toString
().
substring
(
0
,
10
);
...
...
@@ -523,17 +463,21 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
paramMap
.
put
(
"id"
,
plan
.
getId
());
paramMap
.
put
(
"next_gen_date"
,
strGenDate
);
if
(
XJConstant
.
SCHED_FLAG
.
equals
(
flag
))
{
paramMap
.
put
(
"plan_task_id"
,
0
);
//修改为初始值
//修改为初始值
paramMap
.
put
(
"plan_task_id"
,
0
);
paramMap
.
put
(
"first_flag"
,
XJConstant
.
PLAN_FIRST_STATUS_NO
);
}
else
if
(!
XJConstant
.
SCHED_FLAG
.
equals
(
flag
)
&&
(
genDate
.
getTime
()
-
tomorrow
.
getTime
()
>=
0
)
&&
XJConstant
.
FIX_DATE_NO
.
equals
(
plan
.
getIsFixedDate
()))
{
//更新日期及plantaskId到plan表
}
else
if
(
genDate
.
getTime
()
-
tomorrow
.
getTime
()
>=
0
&&
XJConstant
.
FIX_DATE_NO
.
equals
(
plan
.
getIsFixedDate
()))
{
//更新日期及plantaskId到plan表
long
planTaskId
=
iplanTaskDao
.
findMaxIdByBatchNo
(
batchNo
);
paramMap
.
put
(
"plan_task_id"
,
planTaskId
);
// 更新新的任务id到plan
// 更新新的任务id到plan
paramMap
.
put
(
"plan_task_id"
,
planTaskId
);
paramMap
.
put
(
"first_flag"
,
XJConstant
.
PLAN_FIRST_STATUS_NO
);
}
if
(
DateUtil
.
str2Date
(
strGenDate
,
"yyyy-MM-dd"
).
getTime
()
-
now
.
getTime
()
<
0
||
org
.
apache
.
commons
.
lang
.
StringUtils
.
isBlank
(
strGenDate
))
{
paramMap
.
put
(
"next_gen_date"
,
DateUtil
.
formatDatrToStr
(
now
,
"yyyy-MM-dd"
));
}
planMapper
.
updPlanStatusOrGenDate
(
paramMap
);
// 更新下次任务生成日期
// 更新下次任务生成日期
planMapper
.
updPlanStatusOrGenDate
(
paramMap
);
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);
...
...
@@ -542,8 +486,7 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
@Override
public
List
<
PlanTask
>
getPlanTaskByRouteId
(
Long
routeId
)
{
List
<
PlanTask
>
planTaskList
=
planTaskMapper
.
getPlanTaskByRouteId
(
routeId
);
return
planTaskList
;
return
planTaskMapper
.
getPlanTaskByRouteId
(
routeId
);
}
@Override
...
...
@@ -578,11 +521,6 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
}
@Override
public
int
getCurrentPlanTaskCount
(
String
userId
)
{
return
planTaskMapper
.
getCurrentPlanTaskCount
(
userId
);
}
@Override
public
List
<
PlanTaskVo
>
getPlanTaskListByIds
(
String
toke
,
String
product
,
String
appKey
,
Long
[]
ids
)
{
List
<
PlanTaskVo
>
content
=
planTaskMapper
.
getPlanTaskListByIds
(
ids
);
...
...
@@ -717,153 +655,16 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
return
result
;
}
@Override
public
Map
<
String
,
Object
>
getPlanTaskStatisticsForApp
(
HashMap
<
String
,
Object
>
params
)
{
return
planTaskMapper
.
getPlanTaskStatisticsForApp
(
params
);
}
@Override
public
AppPointCheckRespone
queryPointPlanTaskDetail
(
String
toke
,
String
product
,
String
appKey
,
Long
planTaskId
,
Long
pointId
)
{
AppPointCheckRespone
pointCheckRespone
=
new
AppPointCheckRespone
();
Check
check
=
checkDao
.
findByPlanTaskIdAndPointId
(
planTaskId
,
pointId
);
if
(
check
!=
null
)
{
pointCheckRespone
=
checkService
.
queryCheckPointDetail
(
toke
,
product
,
appKey
,
check
.
getId
());
}
else
{
PointCheckDetailBo
planPointInfo
=
planTaskMapper
.
getPointPlanTaskInfo
(
planTaskId
,
pointId
);
if
(
planPointInfo
!=
null
)
{
List
<
String
>
userIds
=
Arrays
.
asList
(
planPointInfo
.
getUsername
().
split
(
","
));
List
<
AgencyUserModel
>
userModelList
=
remoteSecurityService
.
listUserByUserIds
(
toke
,
product
,
appKey
,
planPointInfo
.
getUsername
());
Map
<
String
,
String
>
userModelMap
=
userModelList
.
stream
().
collect
(
Collectors
.
toMap
(
AgencyUserModel:
:
getUserId
,
AgencyUserModel:
:
getRealName
,
(
k1
,
k2
)
->
k2
));
if
(
userModelMap
!=
null
)
{
List
<
String
>
userNameList
=
new
ArrayList
<>();
for
(
String
userId
:
userIds
)
{
userNameList
.
add
(
userModelMap
.
get
(
userId
));
}
userNameList
.
remove
(
""
);
userNameList
.
remove
(
null
);
pointCheckRespone
.
setUsername
(
Joiner
.
on
(
","
).
join
(
userNameList
));
}
DepartmentModel
departmentBo
=
remoteSecurityService
.
getDepartmentByDeptId
(
toke
,
product
,
appKey
,
planPointInfo
.
getUsername
());
if
(
departmentBo
!=
null
)
{
pointCheckRespone
.
setDepartmentName
(
departmentBo
.
getDepartmentName
());
}
pointCheckRespone
.
setPointId
(
pointId
);
pointCheckRespone
.
setPointName
(
planPointInfo
.
getPointName
());
pointCheckRespone
.
setPointNo
(
planPointInfo
.
getPointNo
());
pointCheckRespone
.
setPointStatus
(
"0"
);
pointCheckRespone
.
setPlanName
(
planPointInfo
.
getPlanName
());
List
<
PointCheckDetailBo
>
pointInputs
=
planTaskMapper
.
getPointInputByRouteIdAndPointId
(
planPointInfo
.
getRouteId
(),
planPointInfo
.
getPointId
());
JSONObject
appResponeMap
=
new
JSONObject
();
pointInputs
.
forEach
(
action
->
{
AppCheckInputRespone
input
=
new
AppCheckInputRespone
();
input
.
setInputName
(
action
.
getInputName
());
input
.
setCheckInputId
(
action
.
getCheckInputId
());
input
.
setDataJson
(
action
.
getDataJson
());
input
.
setIsMultiline
(
action
.
getIsMultiline
());
input
.
setIsMust
(
action
.
getIsMust
());
input
.
setItemType
(
action
.
getItemType
());
input
.
setOrderNo
(
action
.
getOrderNo
());
input
.
setPictureJson
(
action
.
getPictureJson
());
input
.
setClassifyId
(
action
.
getClassifyId
());
input
.
setClassifyName
(
action
.
getClassifyName
());
String
key
=
ObjectUtils
.
isEmpty
(
action
.
getClassifyName
())
?
"其他"
:
action
.
getClassifyName
();
if
(
appResponeMap
.
containsKey
(
key
))
{
appResponeMap
.
getJSONArray
(
key
).
add
(
input
);
}
else
{
List
<
AppCheckInputRespone
>
appCheckInputResponeList
=
new
ArrayList
<
AppCheckInputRespone
>();
appCheckInputResponeList
.
add
(
input
);
appResponeMap
.
put
(
key
,
appCheckInputResponeList
);
}
});
pointCheckRespone
.
setAppCheckInput
(
appResponeMap
);
}
else
{
return
null
;
}
}
return
pointCheckRespone
;
}
@Override
public
AppPointCheckRespone
queryPointPlanTaskDetailInVersion2
(
String
toke
,
String
product
,
String
appKey
,
Long
planTaskId
,
Long
pointId
)
{
AppPointCheckRespone
pointCheckRespone
=
new
AppPointCheckRespone
();
Check
check
=
checkDao
.
findByPlanTaskIdAndPointId
(
planTaskId
,
pointId
);
if
(
check
!=
null
)
{
pointCheckRespone
=
checkService
.
queryCheckPointDetailInVersion2
(
toke
,
product
,
appKey
,
check
.
getId
());
}
else
{
PointCheckDetailBo
planPointInfo
=
planTaskMapper
.
getPointPlanTaskInfo
(
planTaskId
,
pointId
);
if
(
planPointInfo
!=
null
)
{
pointCheckRespone
.
setPointId
(
pointId
);
pointCheckRespone
.
setPointName
(
planPointInfo
.
getPointName
());
pointCheckRespone
.
setPointNo
(
planPointInfo
.
getPointNo
());
pointCheckRespone
.
setPointStatus
(
"0"
);
pointCheckRespone
.
setPlanName
(
planPointInfo
.
getPlanName
());
List
<
AgencyUserModel
>
userModelList
=
remoteSecurityService
.
listUserByUserIds
(
toke
,
product
,
appKey
,
planPointInfo
.
getUserId
());
for
(
AgencyUserModel
userModel
:
userModelList
)
{
pointCheckRespone
.
setUsername
(
userModel
.
getRealName
());
}
// DepartmentModel departmentModel= remoteSecurityService.getDepartmentByDeptId(toke, product, appKey,planPointInfo.getCheckDepartmentId());
DepartmentModel
departmentModel
=
new
DepartmentModel
();
pointCheckRespone
.
setDepartmentName
(
departmentModel
.
getDepartmentName
());
List
<
PointCheckDetailBo
>
pointInputs
=
planTaskMapper
.
getPointInputByRouteIdAndPointId
(
planPointInfo
.
getRouteId
(),
planPointInfo
.
getPointId
());
JSONObject
appResponeMap
=
new
JSONObject
();
pointInputs
.
forEach
(
action
->
{
AppCheckInputRespone
input
=
new
AppCheckInputRespone
();
input
.
setInputName
(
action
.
getInputName
());
input
.
setCheckInputId
(
action
.
getCheckInputId
());
input
.
setDataJson
(
action
.
getDataJson
());
input
.
setIsMultiline
(
action
.
getIsMultiline
());
input
.
setIsMust
(
action
.
getIsMust
());
input
.
setItemType
(
action
.
getItemType
());
input
.
setOrderNo
(
action
.
getOrderNo
());
input
.
setPictureJson
(
action
.
getPictureJson
());
input
.
setClassifyId
(
action
.
getClassifyId
());
input
.
setClassifyName
(
action
.
getClassifyName
());
String
classifyName
=
action
.
getClassifyName
();
if
(!
StringUtil
.
isNotEmpty
(
classifyName
))
{
classifyName
=
"其他"
;
}
String
riskDesc
=
action
.
getRiskDesc
();
if
(!
StringUtil
.
isNotEmpty
(
riskDesc
))
{
riskDesc
=
XJConstant
.
DEFAULT_RISKDESC
;
}
JSONObject
classifyJson
;
if
(
appResponeMap
.
containsKey
(
classifyName
))
{
classifyJson
=
appResponeMap
.
getJSONObject
(
classifyName
);
}
else
{
classifyJson
=
new
JSONObject
();
}
JSONArray
riskDescArr
;
if
(
classifyJson
.
containsKey
(
riskDesc
))
{
riskDescArr
=
classifyJson
.
getJSONArray
(
riskDesc
);
}
else
{
riskDescArr
=
new
JSONArray
();
}
riskDescArr
.
add
(
action
);
classifyJson
.
put
(
riskDesc
,
riskDescArr
);
appResponeMap
.
put
(
classifyName
,
classifyJson
);
});
pointCheckRespone
.
setAppCheckInput
(
appResponeMap
);
}
else
{
return
null
;
}
}
return
pointCheckRespone
;
}
@Override
public
String
getCumulativePlanCountByOrgCode
(
String
loginOrgCode
)
{
return
planTaskMapper
.
getCumulativePlanCountByOrgCode
(
loginOrgCode
);
}
@Override
public
List
<
LeavePlanTaskVo
>
queryLeavePlanTask
(
HashMap
<
String
,
Object
>
params
)
{
return
planTaskMapper
.
queryLeavePlanTask
(
params
);
}
@Override
public
PlanTask
selectPlanTaskStatus
(
Long
id
)
{
...
...
@@ -880,121 +681,6 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
planMapper
.
initUpdatePlanNextGenDate
();
}
@Override
public
List
<
Map
<
String
,
Object
>>
queryPlanTaskTimeAxis
(
Long
userId
,
Integer
createDate
)
{
HashMap
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"userId"
,
userId
);
String
endTime
=
DateUtil
.
getShortCurrentDate
();
;
String
beginTime
=
""
;
if
(
createDate
!=
null
&&
createDate
==
7
)
{
beginTime
=
DateUtil
.
getIntervalDateStr
(
new
Date
(),
-
7
,
"yyyy-MM-dd"
);
}
else
if
(
createDate
!=
null
&&
createDate
==
30
)
{
beginTime
=
DateUtil
.
getIntervalDateStr
(
new
Date
(),
-
30
,
"yyyy-MM-dd"
);
}
else
{
beginTime
=
DateUtil
.
getShortCurrentDate
();
}
params
.
put
(
"beginTime"
,
beginTime
+
" 00:00:00"
);
params
.
put
(
"endTime"
,
endTime
+
" 23:59:59"
);
List
<
Map
<
String
,
Object
>>
content
=
planTaskMapper
.
queryPlanTaskTimeAxis
(
params
);
if
(!
CollectionUtils
.
isEmpty
(
content
))
{
Set
<
String
>
userIds
=
Sets
.
newHashSet
();
content
.
forEach
(
e
->
{
String
id
=
e
.
get
(
"userId"
).
toString
();
if
(
StringUtil
.
isNotEmpty
(
id
))
{
userIds
.
add
(
id
);
}
});
Toke
toke
=
remoteSecurityService
.
getServerToken
();
List
<
AgencyUserModel
>
userModelList
=
remoteSecurityService
.
listUserByUserIds
(
toke
.
getToke
(),
toke
.
getProduct
(),
toke
.
getAppKey
(),
Joiner
.
on
(
","
).
join
(
userIds
));
Map
<
String
,
String
>
userModelMap
=
userModelList
.
stream
().
collect
(
Collectors
.
toMap
(
AgencyUserModel:
:
getUserId
,
AgencyUserModel:
:
getRealName
,
(
k1
,
k2
)
->
k2
));
content
.
forEach
(
e
->
{
StringBuffer
userNames
=
new
StringBuffer
();
List
<
String
>
userIds1
=
Arrays
.
asList
(
e
.
get
(
"userId"
).
toString
().
split
(
","
));
for
(
String
userId1
:
userIds1
)
{
userNames
.
append
(
userModelMap
.
get
(
userId1
)).
append
(
","
);
}
e
.
put
(
"userName"
,
userNames
.
substring
(
0
,
userNames
.
length
()
-
1
));
e
.
put
(
"beginTime"
,
DateUtil
.
formatDatrToStr
((
Date
)
e
.
get
(
"beginTime"
),
DateUtil
.
LONG_PATTERN
));
e
.
put
(
"endTime"
,
DateUtil
.
formatDatrToStr
((
Date
)
e
.
get
(
"endTime"
),
DateUtil
.
LONG_PATTERN
));
});
}
return
content
;
}
@Override
public
List
<
Map
<
String
,
Object
>>
queryTimeAxis
(
Long
userId
,
Integer
createDate
)
{
HashMap
<
String
,
Object
>
params
=
new
HashMap
<>();
params
.
put
(
"userId"
,
userId
);
String
endTime
=
DateUtil
.
getShortCurrentDate
();
;
String
beginTime
=
""
;
if
(
createDate
!=
null
&&
createDate
==
7
)
{
beginTime
=
DateUtil
.
getIntervalDateStr
(
new
Date
(),
-
7
,
"yyyy-MM-dd"
);
}
else
if
(
createDate
!=
null
&&
createDate
==
30
)
{
beginTime
=
DateUtil
.
getIntervalDateStr
(
new
Date
(),
-
30
,
"yyyy-MM-dd"
);
}
else
{
beginTime
=
DateUtil
.
getShortCurrentDate
();
}
params
.
put
(
"beginTime"
,
beginTime
+
" 00:00:00"
);
params
.
put
(
"endTime"
,
endTime
+
" 23:59:59"
);
String
structListString
=
equipFeign
.
getStructureNameAll
();
JSONObject
jsonObject
=
JSONObject
.
parseObject
(
structListString
);
JSONArray
structList
=
jsonObject
.
getJSONArray
(
"result"
);
List
<
Map
<
String
,
Object
>>
result
=
new
ArrayList
<>();
List
<
Map
<
String
,
Object
>>
content
=
planTaskMapper
.
queryTimeAxis
(
params
);
if
(!
CollectionUtils
.
isEmpty
(
content
))
{
Set
<
String
>
userIds
=
Sets
.
newHashSet
();
content
.
forEach
(
e
->
{
String
id
=
e
.
get
(
"userId"
).
toString
();
if
(
StringUtil
.
isNotEmpty
(
id
))
{
userIds
.
add
(
id
);
}
});
Toke
toke
=
remoteSecurityService
.
getServerToken
();
List
<
AgencyUserModel
>
userModelList
=
remoteSecurityService
.
listUserByUserIds
(
toke
.
getToke
(),
toke
.
getProduct
(),
toke
.
getAppKey
(),
Joiner
.
on
(
","
).
join
(
userIds
));
Map
<
String
,
String
>
userModelMap
=
userModelList
.
stream
().
collect
(
Collectors
.
toMap
(
AgencyUserModel:
:
getUserId
,
AgencyUserModel:
:
getRealName
,
(
k1
,
k2
)
->
k2
));
content
.
forEach
(
e
->
{
StringBuffer
userNames
=
new
StringBuffer
();
List
<
String
>
userIds1
=
Arrays
.
asList
(
e
.
get
(
"userId"
).
toString
().
split
(
","
));
for
(
String
userId1
:
userIds1
)
{
userNames
.
append
(
userModelMap
.
get
(
userId1
)).
append
(
","
);
}
HashMap
<
String
,
Object
>
map
=
new
HashMap
();
map
.
put
(
"userName"
,
userNames
.
substring
(
0
,
userNames
.
length
()
-
1
));
map
.
put
(
"beginTime"
,
DateUtil
.
formatDatrToStr
((
Date
)
e
.
get
(
"beginTime"
),
DateUtil
.
LONG_PATTERN
));
map
.
put
(
"endTime"
,
DateUtil
.
formatDatrToStr
((
Date
)
e
.
get
(
"endTime"
),
DateUtil
.
LONG_PATTERN
));
map
.
put
(
"leftName"
,
"巡检点"
);
map
.
put
(
"titleName"
,
userNames
.
substring
(
0
,
userNames
.
length
()
-
1
)
+
"-"
+
e
.
get
(
"name"
).
toString
()
+
"-"
+
e
.
get
(
"STATUS"
).
toString
());
String
structName
=
""
;
if
(!
StringUtils
.
isEmpty
(
e
.
get
(
"risk_source_id"
)))
{
for
(
int
i
=
0
;
i
<
structList
.
size
();
i
++)
{
if
(
structList
.
getJSONObject
(
i
).
get
(
"id"
).
equals
(
e
.
get
(
"risk_source_id"
)))
{
structName
=
structList
.
getJSONObject
(
i
).
get
(
"name"
).
toString
();
}
}
}
else
{
structName
=
"无"
;
}
if
(!
StringUtils
.
isEmpty
(
e
.
get
(
"executorDate"
)))
{
map
.
put
(
"firstPropsValue"
,
structName
+
"-"
+
e
.
get
(
"executorDate"
));
}
else
{
map
.
put
(
"firstPropsValue"
,
structName
+
"-无"
);
}
result
.
add
(
map
);
});
}
return
result
;
}
@Override
public
Map
<
String
,
Object
>
planTaskPointDetail
(
String
planTaskDetailId
,
String
routePointId
)
{
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-maintenance-biz/src/main/java/com/yeejoin/amos/maintenance/business/service/intfc/IPlanTaskService.java
View file @
ec917d6a
package
com
.
yeejoin
.
amos
.
maintenance
.
business
.
service
.
intfc
;
import
java.text.ParseException
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
com.yeejoin.amos.maintenance.business.entity.mybatis.CheckChkExListBo
;
import
com.yeejoin.amos.maintenance.business.
vo.CodeOrderVo
;
import
com.yeejoin.amos.maintenance.business.
vo.LeavePlanTaskVo
;
import
com.yeejoin.amos.maintenance.business.
param.CheckPtListPageParam
;
import
com.yeejoin.amos.maintenance.business.
param.PlanTaskPageParam
;
import
com.yeejoin.amos.maintenance.business.vo.PlanTaskVo
;
import
com.yeejoin.amos.maintenance.core.common.request.CommonPageable
;
import
com.yeejoin.amos.maintenance.dao.entity.PlanTask
;
import
org.springframework.data.domain.Page
;
import
com.yeejoin.amos.maintenance.business.param.CheckPtListPageParam
;
import
com.yeejoin.amos.maintenance.business.param.PlanTaskPageParam
;
import
com.yeejoin.amos.maintenance.core.common.response.AppPointCheckRespone
;
import
com.yeejoin.amos.maintenance.dao.entity.PlanTask
;
import
java.text.ParseException
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
public
interface
IPlanTaskService
{
/**
* 计划执行查询
*/
Page
<
HashMap
<
String
,
Object
>>
getPlanTaskInfo
(
PlanTaskPageParam
params
);
/**
* 计划执行重做
*/
void
reGenPlanTask
(
HashMap
<
String
,
Object
>
param
)
throws
ParseException
;
/**
* 计划执行删除
*/
void
planTaskDet
(
String
[]
strArry
);
/**
* 执行计划导出
*/
List
<
PlanTaskVo
>
planTaskReport
(
String
toke
,
String
product
,
String
appKey
,
PlanTaskPageParam
params
);
/**
* 自动任务执行
* @param runDate
*/
void
taskExecution
(
String
runDate
);
/**
* 根据路线id获取关联的所有计划任务
*
* @param routeId
* @return
*/
List
<
PlanTask
>
getPlanTaskByRouteId
(
Long
routeId
);
/**
* 停用计划任务
*
* @param routeIds
*/
void
disablePlanTask
(
Long
[]
routeIds
);
/**
* 计划任务列表
* @param params
* @param page
* @return
*/
Page
<
HashMap
<
String
,
Object
>>
getPlanTasks
(
HashMap
<
String
,
Object
>
params
,
CommonPageable
page
);
/**
* 根据计划ID获取所有的 任务计划巡检点
* @param param
* @return
*/
List
getPlanTaskPoints
(
Map
<
String
,
Object
>
param
);
/**
* 获取用户当前所有有的计划任务
* @param userId
* @return
*/
int
getCurrentPlanTaskCount
(
String
userId
);
/**
* 今日执行情况
* @param params
* 计划执行查询
*/
Page
<
HashMap
<
String
,
Object
>>
getPlanTaskInfo
(
PlanTaskPageParam
params
);
/**
* 计划执行重做
*/
void
reGenPlanTask
(
HashMap
<
String
,
Object
>
param
)
throws
ParseException
;
/**
* 计划执行删除
*/
void
planTaskDet
(
String
[]
strArry
);
/**
* 执行计划导出
*/
List
<
PlanTaskVo
>
planTaskReport
(
String
toke
,
String
product
,
String
appKey
,
PlanTaskPageParam
params
);
/**
* 自动任务执行
*
* @param runDate
*/
void
taskExecution
(
String
runDate
);
/**
* 根据路线id获取关联的所有计划任务
*
* @param routeId
* @return
*/
Page
<
CheckChkExListBo
>
getChkExList
(
String
toke
,
String
product
,
String
appKey
,
CheckPtListPageParam
params
);
List
<
PlanTask
>
getPlanTaskByRouteId
(
Long
routeId
);
/**
* 根据id获取执行计划
* @param ids
* @return
*/
List
<
PlanTaskVo
>
getPlanTaskListByIds
(
String
toke
,
String
product
,
String
appKey
,
Long
[]
i
ds
);
/**
* 停用计划任务
*
* @param routeIds
*/
void
disablePlanTask
(
Long
[]
routeI
ds
);
/**
* 根据任务id点id 获取点详情
* @param planTaskId
* @param pointId
* @return
*/
AppPointCheckRespone
queryPointPlanTaskDetail
(
String
toke
,
String
product
,
String
appKey
,
Long
planTaskId
,
Long
pointId
);
AppPointCheckRespone
queryPointPlanTaskDetailInVersion2
(
String
toke
,
String
product
,
String
appKey
,
Long
planTaskId
,
Long
pointId
);
/**
* 计划任务列表
*
* @param params
* @param page
* @return
*/
Page
<
HashMap
<
String
,
Object
>>
getPlanTasks
(
HashMap
<
String
,
Object
>
params
,
CommonPageable
page
);
Map
<
String
,
Object
>
getPlanTaskStatisticsForApp
(
HashMap
<
String
,
Object
>
params
);
/**
* 获取公司计划累计情况
* @param loginOrgCode
* @return
*/
String
getCumulativePlanCountByOrgCode
(
String
loginOrgCode
);
/**
* 根据计划ID获取所有的 任务计划巡检点
*
* @param param
* @return
*/
List
getPlanTaskPoints
(
Map
<
String
,
Object
>
param
);
List
<
LeavePlanTaskVo
>
queryLeavePlanTask
(
HashMap
<
String
,
Object
>
params
);
/**
* 今日执行情况
*
* @param params
* @return
*/
Page
<
CheckChkExListBo
>
getChkExList
(
String
toke
,
String
product
,
String
appKey
,
CheckPtListPageParam
params
);
/**
* 根据id获取执行计划
*
* @param ids
* @return
*/
List
<
PlanTaskVo
>
getPlanTaskListByIds
(
String
toke
,
String
product
,
String
appKey
,
Long
[]
ids
);
PlanTask
selectPlanTaskStatus
(
Long
id
);
/**
* 获取公司计划累计情况
*
* @param loginOrgCode
* @return
*/
String
getCumulativePlanCountByOrgCode
(
String
loginOrgCode
);
void
reformStatisticsPlanTask
(
String
strBginDate
,
String
strEndDate
,
String
userId
,
String
orgCode
)
throws
ParseException
;
void
initPlanStatusOrGenDate
(
);
PlanTask
selectPlanTaskStatus
(
Long
id
);
List
<
Map
<
String
,
Object
>>
queryPlanTaskTimeAxis
(
Long
userId
,
Integer
createDate
);
List
<
Map
<
String
,
Object
>>
queryTimeAxis
(
Long
userId
,
Integer
createDate
);
void
initPlanStatusOrGenDate
(
);
/**
* 任务点详情
*
* @param planTaskDetailId 子表id
* @param routePointId
关系表id
* @return Map<String, Object>
*/
Map
<
String
,
Object
>
planTaskPointDetail
(
String
planTaskDetailId
,
String
routePointId
);
/**
* 任务点详情
*
* @param planTaskDetailId 子表id
* @param routePointId
关系表id
* @return Map<String, Object>
*/
Map
<
String
,
Object
>
planTaskPointDetail
(
String
planTaskDetailId
,
String
routePointId
);
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-maintenance-biz/src/main/java/com/yeejoin/amos/maintenance/quartz/JobService.java
View file @
ec917d6a
...
...
@@ -38,8 +38,6 @@ public class JobService implements IJobService {
@Autowired
private
IPlanTaskDao
iPlanTaskDao
;
@Autowired
private
IPlanDao
iPlanDao
;
@Autowired
private
IPlanTaskDetailDao
iPlanTaskDetailDao
;
...
...
@@ -51,9 +49,6 @@ public class JobService implements IJobService {
private
PlanTaskMapper
planTaskMapper
;
@Autowired
private
MsgMapper
msgMapper
;
@Autowired
private
ICheckDao
iCheckDao
;
@Autowired
...
...
@@ -69,14 +64,10 @@ public class JobService implements IJobService {
private
ITaskFeedbackDao
taskFeedbackDao
;
@Autowired
private
CheckMapper
checkMapper
;
@Autowired
private
RemoteSecurityService
remoteSecurityService
;
@Value
(
"${amosRefresh.patrol.topic}"
)
private
String
patrolTopic
;
@Autowired
private
MqttGateway
webMqttComponent
;
@Override
@Transactional
...
...
@@ -204,12 +195,15 @@ public class JobService implements IJobService {
check
.
setUserId
(
planTask
.
getUserId
());
check
.
setUserName
(
planTask
.
getUserName
());
check
.
setDepName
(
""
);
check
.
setPointName
(
arg
.
getPointName
());
check
.
setPointId
(
arg
.
getPointId
());
check
.
setUploadTime
(
new
Date
());
check
.
setPlanId
(
arg
.
getPlanId
());
check
.
setPlanName
(
arg
.
getPlanName
());
check
.
setPlanTaskId
(
arg
.
getPlanTaskId
());
check
.
setPlanTaskDetailId
(
arg
.
getPlanTaskDetailId
());
check
.
setRouteId
(
arg
.
getRouteId
());
check
.
setRouteName
(
arg
.
getRouteName
());
check
.
setCheckTime
(
arg
.
getEndTime
());
check
.
setIsOk
(
CheckStatusEnum
.
OMISSION
.
getCode
());
check
=
iCheckDao
.
saveAndFlush
(
check
);
...
...
@@ -301,7 +295,6 @@ public class JobService implements IJobService {
@Override
public
void
planTaskAddJob
(
PlanTask
planTask
)
{
// TODO Auto-generated method stub
try
{
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
Date
endTime
=
sdf
.
parse
(
planTask
.
getEndTime
());
...
...
@@ -316,30 +309,6 @@ public class JobService implements IJobService {
||
PlanTaskFinishStatusEnum
.
UNDERWAY
.
getValue
()
==
status
)
{
addJob
(
"planTask"
,
XJConstant
.
STATUS_MONITOR_END
,
planTask
.
getId
(),
endTime
);
// 添加监控任务开始结束定时任务
}
// 查询需要推送消息提醒
List
<
MsgConfigParam
>
configParam
=
msgMapper
.
getPlanTaskMsgConfigByUserIdAndStatus
(
planTask
.
getUserId
().
split
(
","
),
"True"
);
if
(!
configParam
.
isEmpty
())
{
configParam
.
forEach
(
config
->
{
String
jobType
=
""
;
Date
time
=
new
Date
();
int
minute
=
Integer
.
valueOf
(
config
.
getValue
());
long
tempTime
=
minute
*
60
*
1000
;
if
(
MsgSubscribeTypeEnum
.
PLANWARN
.
getName
().
equals
(
config
.
getMsgType
()))
{
time
=
new
Date
(
beginTime
.
getTime
()
-
tempTime
);
jobType
=
XJConstant
.
PLAN_TASK_WARN_MSG_PUSH
+
"-"
+
config
.
getUserId
();
}
else
if
(
MsgSubscribeTypeEnum
.
PLANBEGIN
.
getName
().
equals
(
config
.
getMsgType
()))
{
time
=
new
Date
(
beginTime
.
getTime
()
+
tempTime
);
jobType
=
XJConstant
.
PLAN_TASK_BEGIN_MSG_PUSH
+
"-"
+
config
.
getUserId
();
}
else
if
(
MsgSubscribeTypeEnum
.
PLANEND
.
getName
().
equals
(
config
.
getMsgType
()))
{
time
=
new
Date
(
endTime
.
getTime
()
+
tempTime
);
jobType
=
XJConstant
.
PLAN_TASK_END_MSG_PUSH
+
"-"
+
config
.
getUserId
();
}
addJob
(
"planTask"
,
jobType
,
planTask
.
getId
(),
time
);
});
}
}
else
{
updatePlanTaskStatus
(
planTask
,
PlanTaskFinishStatusEnum
.
OVERTIME
.
getValue
());
}
...
...
amos-boot-system-maintenance/src/main/resources/db/mapper/dbTemplate_plan_task.xml
View file @
ec917d6a
...
...
@@ -378,13 +378,14 @@
</select>
<select
id=
"getPlanTaskPointInputItemByPlanTaskId"
resultType=
"com.yeejoin.amos.maintenance.business.entity.mybatis.PlanTaskPointInputItemBo"
>
SELECT
ppi.input_item_id inputItemId,
temp1.order_no orderNo,
temp1.routePointItemId,
temp1.classifyId,
temp1.classifyName,
temp1.routeName,
temp1.pointName,
pii.`name` inputName,
temp2.*
FROM
...
...
@@ -399,11 +400,15 @@
prp.route_id,
prpi.id routePointItemId,
ppc.id classifyId,
ppc.`name` classifyName
ppc.`name` classifyName,
r.name as routeName,
p.name as pointName
FROM
p_route_point_item prpi
LEFT JOIN p_route_point prp ON prp.id = prpi.route_point_id
LEFT JOIN p_point_classify ppc ON prpi.point_classify_id = ppc.id
LEFT JOIN p_route r ON r.id = prp.route_id
LEFT JOIN p_point p ON p.id = prp.point_id
) temp1 ON(ppi.id = temp1.point_input_item_id)
RIGHT JOIN
...
...
@@ -417,16 +422,15 @@
ptd.org_code AS orgCode,
ptd.end_time AS endTime,
pptd.id as planTaskDetailId,
(select p_plan.dept_id from p_plan where p_plan.id=ptd.plan_id) depId
(select p_plan.dept_id from p_plan where p_plan.id=ptd.plan_id) depId,
(select p_plan.name from p_plan where p_plan.id=ptd.plan_id) planName
FROM
p_plan_task_detail pptd,
p_plan_task ptd
WHERE
pptd.task_no = ptd.id
AND ptd.id = #{planTaskId} and pptd.`status` = #{planTaskDetailStatus}
) temp2 on(temp1.point_id = temp2.pointId
AND temp1.route_id = temp2.routeId)
) temp2 on temp1.point_id = temp2.pointId AND temp1.route_id = temp2.routeId
</select>
<!-- 巡检执行情况统计分页用 -->
<select
id=
"countChkExListData"
resultType=
"long"
>
...
...
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