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
4743eb24
Commit
4743eb24
authored
May 19, 2022
by
lisong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
巡检任务生成-下发app对应执行人待办消息
parent
49a694d3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
73 additions
and
2 deletions
+73
-2
PlanTaskServiceImpl.java
...mos/patrol/business/service/impl/PlanTaskServiceImpl.java
+73
-2
No files found.
amos-boot-module/amos-boot-module-biz/amos-boot-module-patrol-biz/src/main/java/com/yeejoin/amos/patrol/business/service/impl/PlanTaskServiceImpl.java
View file @
4743eb24
package
com
.
yeejoin
.
amos
.
patrol
.
business
.
service
.
impl
;
import
cn.hutool.core.date.DateTime
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.google.common.base.Joiner
;
import
com.yeejoin.amos.boot.biz.common.constants.RuleConstant
;
import
com.yeejoin.amos.component.rule.RuleTrigger
;
import
com.yeejoin.amos.feign.privilege.model.AgencyUserModel
;
import
com.yeejoin.amos.feign.privilege.model.DepartmentModel
;
import
com.yeejoin.amos.patrol.business.constants.XJConstant
;
import
com.yeejoin.amos.patrol.business.dao.mapper.PlanMapper
;
import
com.yeejoin.amos.patrol.business.dao.mapper.PlanTaskDetailMapper
;
import
com.yeejoin.amos.patrol.business.dao.mapper.PlanTaskMapper
;
import
com.yeejoin.amos.patrol.business.dao.repository.*
;
import
com.yeejoin.amos.patrol.business.dao.repository.ICheckDao
;
import
com.yeejoin.amos.patrol.business.dao.repository.IPlanDao
;
import
com.yeejoin.amos.patrol.business.dao.repository.IPlanTaskDao
;
import
com.yeejoin.amos.patrol.business.dao.repository.IPlanTaskDetailDao
;
import
com.yeejoin.amos.patrol.business.dao.repository.IRoutePointDao
;
import
com.yeejoin.amos.patrol.business.dto.MsgRo
;
import
com.yeejoin.amos.patrol.business.entity.mybatis.CheckChkExListBo
;
import
com.yeejoin.amos.patrol.business.entity.mybatis.PointCheckDetailBo
;
import
com.yeejoin.amos.patrol.business.feign.Business
;
...
...
@@ -53,7 +62,17 @@ import org.typroject.tyboot.core.foundation.utils.ValidationUtil;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Calendar
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.HashSet
;
import
java.util.Iterator
;
import
java.util.LinkedHashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
import
java.util.function.Function
;
import
java.util.stream.Collectors
;
...
...
@@ -91,6 +110,20 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
@Autowired
private
EquipFeign
equipFeign
;
@Autowired
private
RulePlanService
rulePlanService
;
@Autowired
private
RuleTrigger
ruleTrigger
;
private
final
String
packageId
=
"消息/addCheckRule"
;
private
final
String
msgType
=
"patrolSystem"
;
private
final
String
APP
=
"APP"
;
private
final
String
WEB
=
"WEB"
;
private
final
String
APP_WEB
=
"APP/WEB"
;
private
static
final
String
TAB
=
"\r\n"
;
@Override
public
Page
<
HashMap
<
String
,
Object
>>
getPlanTaskInfo
(
String
toke
,
String
product
,
String
appKey
,
PlanTaskPageParam
params
)
{
long
total
=
planTaskMapper
.
countPlanTask
(
params
);
...
...
@@ -680,6 +713,8 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
planTask
.
setEndTime
(
endTime
);
// 1.保存执行数据主表
iplanTaskDao
.
saveAndFlush
(
planTask
);
// 发送APP待办消息
sendMessage
(
plan
,
planTask
);
String
executorId
=
planTask
.
getUserId
();
long
planId
=
planTask
.
getId
();
for
(
int
i1
=
0
;
i1
<
pointIdList
.
size
();
i1
++)
{
...
...
@@ -729,6 +764,42 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
// return deptMap;
}
public
void
sendMessage
(
Plan
plan
,
PlanTask
planTask
)
throws
Exception
{
MsgRo
msgRo
=
new
MsgRo
();
// 标题
msgRo
.
setName
(
plan
.
getName
());
// 内容
String
body
=
""
;
body
+=
"待执行巡检任务"
+
TAB
;
body
+=
"巡检任务名称:"
+
plan
.
getName
()
+
TAB
;
body
+=
"执行时间:"
+
planTask
.
getBeginTime
()
+
"-"
+
planTask
.
getEndTime
();
msgRo
.
setContent
(
body
);
// 接收人
ArrayList
<
String
>
userIdList
=
new
ArrayList
<>();
userIdList
.
add
(
planTask
.
getUserId
());
msgRo
.
setRecivers
(
userIdList
);
msgRo
.
setMsgType
(
msgType
);
msgRo
.
setTerminal
(
APP_WEB
);
msgRo
.
setSendTime
(
DateTime
.
now
().
toString
());
// 关联id
msgRo
.
setRelationId
(
String
.
valueOf
(
plan
.
getId
()));
// 扩展参数
HashMap
<
String
,
String
>
extras
=
new
HashMap
<>();
extras
.
put
(
"type"
,
msgType
);
extras
.
put
(
"planId"
,
String
.
valueOf
(
plan
.
getId
()));
extras
.
put
(
"planTaskId"
,
String
.
valueOf
(
planTask
.
getId
()));
msgRo
.
setExtras
(
extras
);
msgRo
.
setIsSendApp
(
true
);
msgRo
.
setIsSendWeb
(
true
);
msgRo
.
setCategory
(
RuleConstant
.
TASK
);
// PushMsgParam pushMsgParam = new PushMsgParam();
// rulePlanService.sendRule(pushMsgParam);
log
.
info
(
"巡检待办任务:%s {}"
,
JSON
.
toJSON
(
msgRo
));
//触发规则
ruleTrigger
.
publish
(
msgRo
,
packageId
,
new
String
[
0
]);
}
@Override
public
List
<
PlanTask
>
getPlanTaskByRouteId
(
Long
routeId
)
{
List
<
PlanTask
>
planTaskList
=
planTaskMapper
.
getPlanTaskByRouteId
(
routeId
);
...
...
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