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
0b72ee34
Commit
0b72ee34
authored
Jul 12, 2022
by
chenzhao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改 力量调派 任务派发逻辑 / 防火监督待办/防火监督定时任务对其他状态计划的超时判断
parent
552b98df
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
77 additions
and
5 deletions
+77
-5
PowerTransferController.java
...ot/module/jcs/biz/controller/PowerTransferController.java
+34
-1
IPlanDao.java
...in/amos/supervision/business/dao/repository/IPlanDao.java
+5
-0
PlanTaskServiceImpl.java
...upervision/business/service/impl/PlanTaskServiceImpl.java
+38
-4
No files found.
amos-boot-module/amos-boot-module-biz/amos-boot-module-jcs-biz/src/main/java/com/yeejoin/amos/boot/module/jcs/biz/controller/PowerTransferController.java
View file @
0b72ee34
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jcs
.
biz
.
controller
;
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jcs
.
biz
.
controller
;
import
java.util.Arrays
;
import
java.util.Arrays
;
import
java.util.List
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.yeejoin.amos.boot.biz.common.entity.BaseEntity
;
import
com.yeejoin.amos.boot.module.jcs.api.dto.PowerTransferCompanyDto
;
import
com.yeejoin.amos.boot.module.jcs.api.entity.UserCar
;
import
com.yeejoin.amos.boot.module.jcs.api.mapper.UserCarMapper
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.GetMapping
;
...
@@ -12,7 +18,9 @@ import org.springframework.web.bind.annotation.RequestMethod;
...
@@ -12,7 +18,9 @@ import org.springframework.web.bind.annotation.RequestMethod;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.typroject.tyboot.core.foundation.enumeration.UserType
;
import
org.typroject.tyboot.core.foundation.enumeration.UserType
;
import
org.typroject.tyboot.core.foundation.utils.ValidationUtil
;
import
org.typroject.tyboot.core.restful.doc.TycloudOperation
;
import
org.typroject.tyboot.core.restful.doc.TycloudOperation
;
import
org.typroject.tyboot.core.restful.exception.instance.BadRequest
;
import
org.typroject.tyboot.core.restful.utils.ResponseHelper
;
import
org.typroject.tyboot.core.restful.utils.ResponseHelper
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
import
org.typroject.tyboot.core.restful.utils.ResponseModel
;
...
@@ -49,7 +57,9 @@ public class PowerTransferController extends BaseController {
...
@@ -49,7 +57,9 @@ public class PowerTransferController extends BaseController {
@Autowired
@Autowired
FireTeamServiceImpl
fireTeamService
;
FireTeamServiceImpl
fireTeamService
;
@Autowired
@Autowired
EquipFeignClient
equipFeignClient
;
EquipFeignClient
docequipFeignClient
;
@Autowired
UserCarMapper
userCarMapper
;
/**
/**
* 新增力量调派
* 新增力量调派
...
@@ -174,6 +184,29 @@ public class PowerTransferController extends BaseController {
...
@@ -174,6 +184,29 @@ public class PowerTransferController extends BaseController {
@RequestMapping
(
value
=
"/create"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"/create"
,
method
=
RequestMethod
.
POST
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"力量调派-任务派发"
,
notes
=
"力量调派-任务派发"
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"力量调派-任务派发"
,
notes
=
"力量调派-任务派发"
)
public
ResponseModel
<
Boolean
>
createPowerTransfer
(
@RequestBody
PowerTransferDto
powerTransferDto
)
{
public
ResponseModel
<
Boolean
>
createPowerTransfer
(
@RequestBody
PowerTransferDto
powerTransferDto
)
{
List
<
PowerTransferCompanyDto
>
powerTransferCompanyDotList
=
powerTransferDto
.
getPowerTransferCompanyDotList
();
StringBuilder
content
=
new
StringBuilder
();
powerTransferCompanyDotList
.
forEach
(
e
->{
if
(
e
.
getPowerTransferCompanyResourcesDtoList
()!=
null
){
e
.
getPowerTransferCompanyResourcesDtoList
().
forEach
(
c
->
{
LambdaQueryWrapper
<
UserCar
>
wrapper
=
new
LambdaQueryWrapper
<>();
wrapper
.
eq
(
UserCar:
:
getCarId
,
c
.
getResourcesId
());
wrapper
.
eq
(
BaseEntity:
:
getIsDelete
,
false
);
Integer
count
=
userCarMapper
.
selectCount
(
wrapper
);
if
(
count
<
1
){
content
.
append
(
c
.
getResourcesName
()+
":"
+
c
.
getResourcesNum
()+
" "
);
}
}
);
}
});
if
(!
ValidationUtil
.
isEmpty
(
content
)){
throw
new
BadRequest
(
"车辆:"
+
content
+
"未绑定人员,无法调派"
);
}
AgencyUserModel
userInfo
=
getUserInfo
();
AgencyUserModel
userInfo
=
getUserInfo
();
powerTransferDto
.
setTaskSenderId
(
Long
.
parseLong
(
userInfo
.
getUserId
()));
powerTransferDto
.
setTaskSenderId
(
Long
.
parseLong
(
userInfo
.
getUserId
()));
powerTransferDto
.
setTaskSenderName
(
userInfo
.
getRealName
());
powerTransferDto
.
setTaskSenderName
(
userInfo
.
getRealName
());
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-supervision-biz/src/main/java/com/yeejoin/amos/supervision/business/dao/repository/IPlanDao.java
View file @
0b72ee34
...
@@ -22,6 +22,11 @@ public interface IPlanDao extends BaseDao<Plan, Long> {
...
@@ -22,6 +22,11 @@ public interface IPlanDao extends BaseDao<Plan, Long> {
@Modifying
@Modifying
@Transactional
@Transactional
@Query
(
value
=
"select * from p_plan WHERE status NOT IN (0,5,6,7,8)"
,
nativeQuery
=
true
)
List
<
Plan
>
queryOutTimePlan
();
@Modifying
@Transactional
@Query
(
value
=
"select * from p_plan WHERE route_id = ?1 and status = ?2"
,
nativeQuery
=
true
)
@Query
(
value
=
"select * from p_plan WHERE route_id = ?1 and status = ?2"
,
nativeQuery
=
true
)
List
<
Plan
>
queryPlanByRouteId
(
long
routeId
,
String
status
);
List
<
Plan
>
queryPlanByRouteId
(
long
routeId
,
String
status
);
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-supervision-biz/src/main/java/com/yeejoin/amos/supervision/business/service/impl/PlanTaskServiceImpl.java
View file @
0b72ee34
...
@@ -377,6 +377,31 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
...
@@ -377,6 +377,31 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
SimpleDateFormat
df
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
SimpleDateFormat
df
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
String
strDate
=
df
.
format
(
now
);
String
strDate
=
df
.
format
(
now
);
String
tomorrow
=
DateUtil
.
getIntervalDateStr
(
now
,
1
,
"yyyy-MM-dd"
);
// 下一天
String
tomorrow
=
DateUtil
.
getIntervalDateStr
(
now
,
1
,
"yyyy-MM-dd"
);
// 下一天
//除草稿状态外其他状态过了计划结束时间都需要根据任务状态更新计划状态。
List
<
Plan
>
planLists
=
iplanDao
.
queryOutTimePlan
();
if
(
CollectionUtils
.
isNotEmpty
(
planLists
)){
for
(
Plan
plan
:
planLists
)
{
// 当前时间在计划结束时间之前,则计划还未超时
Date
date
=
new
Date
();
Time
time
=
new
Time
(
date
.
getTime
());
String
planEndTime
=
plan
.
getPlanEnd
()
+
" "
+
plan
.
getDayEnd
().
toString
();
try
{
Date
parse
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
).
parse
(
planEndTime
);
if
(
time
.
before
(
new
Time
(
parse
.
getTime
()))){
continue
;
}
}
catch
(
ParseException
e
)
{
e
.
printStackTrace
();
}
HashMap
<
String
,
Object
>
param
=
new
HashMap
<
String
,
Object
>();
param
.
put
(
"id"
,
plan
.
getId
());
param
.
put
(
"status"
,
PlanStatusEnum
.
COMPLETED
.
getValue
());
planMapper
.
updPlanStatusOrGenDate
(
param
);
}
}
// 根据计划状态5,6和next_gen_date查询需要生成任务的计划
// 根据计划状态5,6和next_gen_date查询需要生成任务的计划
List
<
Plan
>
planList
=
iplanDao
.
queryScheduledPlan
(
strDate
,
List
<
Plan
>
planList
=
iplanDao
.
queryScheduledPlan
(
strDate
,
String
.
valueOf
(
PlanStatusEnum
.
EXAMINE_DEVELOPED
.
getValue
()),
String
.
valueOf
(
PlanStatusEnum
.
EXAMINE_DEVELOPED
.
getValue
()),
...
@@ -414,6 +439,7 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
...
@@ -414,6 +439,7 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
int
num
=
0
;
int
num
=
0
;
//根据计划id查询关联的任务
//根据计划id查询关联的任务
List
<
PlanTask
>
planTaskByRouteId
=
planTaskMapper
.
getPlanTaskByRouteId
(
plan
.
getId
());
List
<
PlanTask
>
planTaskByRouteId
=
planTaskMapper
.
getPlanTaskByRouteId
(
plan
.
getId
());
if
(!
ValidationUtil
.
isEmpty
(
planTaskByRouteId
)){
if
(!
ValidationUtil
.
isEmpty
(
planTaskByRouteId
)){
HashMap
<
String
,
Object
>
param
=
new
HashMap
<
String
,
Object
>();
HashMap
<
String
,
Object
>
param
=
new
HashMap
<
String
,
Object
>();
param
.
put
(
"pointId"
,
plan
.
getId
());
param
.
put
(
"pointId"
,
plan
.
getId
());
...
@@ -427,6 +453,10 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
...
@@ -427,6 +453,10 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
}
else
{
}
else
{
paramMap
.
put
(
"status"
,
PlanStatusEnum
.
COMPLETED
.
getValue
());
paramMap
.
put
(
"status"
,
PlanStatusEnum
.
COMPLETED
.
getValue
());
}
}
}
else
{
paramMap
.
put
(
"status"
,
PlanStatusEnum
.
OUT_TIME
.
getValue
());
planMapper
.
updPlanStatusOrGenDate
(
paramMap
);
continue
;
}
}
if
(
plan
.
getIsFixedDate
().
equals
(
"2"
)){
if
(
plan
.
getIsFixedDate
().
equals
(
"2"
)){
paramMap
.
put
(
"status"
,
PlanStatusEnum
.
OUT_TIME
.
getValue
());
paramMap
.
put
(
"status"
,
PlanStatusEnum
.
OUT_TIME
.
getValue
());
...
@@ -437,7 +467,7 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
...
@@ -437,7 +467,7 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
planTaskMapper
.
updateTaskDetailStatusByPlanId
(
plan
.
getId
());
planTaskMapper
.
updateTaskDetailStatusByPlanId
(
plan
.
getId
());
continue
;
continue
;
}
}
planMapper
.
updPlanStatusOrGenDate
(
paramMap
);
if
(!
ObjectUtils
.
isEmpty
(
paramMap
.
get
(
"status"
))
&&
paramMap
.
get
(
"status"
).
equals
(
PlanStatusEnum
.
OUT_TIME
.
getValue
())){
if
(!
ObjectUtils
.
isEmpty
(
paramMap
.
get
(
"status"
))
&&
paramMap
.
get
(
"status"
).
equals
(
PlanStatusEnum
.
OUT_TIME
.
getValue
())){
// 计划超时,修改计划下任务状态
// 计划超时,修改计划下任务状态
...
@@ -854,13 +884,17 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
...
@@ -854,13 +884,17 @@ public class PlanTaskServiceImpl implements IPlanTaskService {
}
}
}
}
log
.
info
(
String
.
format
(
"计划对象:%s"
,
JSON
.
toJSON
(
plan
)));
log
.
info
(
String
.
format
(
"计划对象:%s"
,
JSON
.
toJSON
(
plan
)));
// 规则推送消息
rulePlanService
.
addPlanRule
(
plan
,
null
,
RuleTypeEnum
.
消息型计划生成
,
extraUserIds
);
// 根据bug4150 将此处的计划生成的枚举值变成了消息,既TASK ->
// NOTIFY
String
userIdString
=
plan
.
getUserId
();
String
userIdString
=
plan
.
getUserId
();
FeignClientResult
amosIdListByUserIds
=
jcsFeignClient
.
getAmosIdListByUserIds
(
userIdString
);
FeignClientResult
amosIdListByUserIds
=
jcsFeignClient
.
getAmosIdListByUserIds
(
userIdString
);
List
<
String
>
result
=
(
List
<
String
>)
amosIdListByUserIds
.
getResult
();
List
<
String
>
result
=
(
List
<
String
>)
amosIdListByUserIds
.
getResult
();
// 规则推送消息
extraUserIds
.
removeAll
(
result
);
//给执行人只发送待办 不发通知
rulePlanService
.
addPlanRule
(
plan
,
null
,
RuleTypeEnum
.
消息型计划生成
,
extraUserIds
);
// 根据bug4150 将此处的计划生成的枚举值变成了消息,既TASK ->
// NOTIFY
if
(
org
.
apache
.
commons
.
lang3
.
ObjectUtils
.
isNotEmpty
(
result
))
{
if
(
org
.
apache
.
commons
.
lang3
.
ObjectUtils
.
isNotEmpty
(
result
))
{
// String[] userIdArr = userIdString.split(",");
// String[] userIdArr = userIdString.split(",");
// List<String> userIdList = Arrays.asList(userIdArr);
// List<String> userIdList = Arrays.asList(userIdArr);
...
...
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