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
e5cd9dc0
Commit
e5cd9dc0
authored
Apr 28, 2022
by
chenzhao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改隐患阻断bug
parent
3c9738c6
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
153 additions
and
9 deletions
+153
-9
LatentDangerController.java
...entdanger/business/controller/LatentDangerController.java
+7
-2
LatentDangerServiceImpl.java
...danger/business/service/impl/LatentDangerServiceImpl.java
+144
-5
ILatentDangerService.java
...ntdanger/business/service/intfc/ILatentDangerService.java
+2
-2
No files found.
amos-boot-module/amos-boot-module-biz/amos-boot-module-latentdanger-biz/src/main/java/com/yeejoin/amos/latentdanger/business/controller/LatentDangerController.java
View file @
e5cd9dc0
...
...
@@ -96,7 +96,7 @@ public class LatentDangerController extends BaseController {
String
departmentName
=
getDepartmentName
(
reginParams
);
RoleBo
role
=
reginParams
.
getRole
();
return
ResponseHelper
.
buildResponse
(
iLatentDangerService
.
savePatrol
(
latentDangerDtoList
,
user
.
getUserId
(),
user
.
getRealName
(),
deptId
,
departmentName
,
companyId
,
loginOrgCode
,
role
));
user
.
getRealName
(),
deptId
,
departmentName
,
companyId
,
loginOrgCode
,
role
,
null
));
}
@ApiOperation
(
value
=
"隐患列表"
,
notes
=
"隐患列表"
)
...
...
@@ -406,7 +406,12 @@ public class LatentDangerController extends BaseController {
@GetMapping
(
value
=
"/web/updateStatusByUserIdAndPlandIdLike/{userId}/{plandId}"
)
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
public
ResponseModel
updateStatusByUserIdAndPlandIdLike
(
@PathVariable
String
userId
,
@PathVariable
String
plandId
)
{
iLatentDangerService
.
updateStatusByUserIdAndPlandIdLike
(
userId
,
plandId
);
ReginParams
reginParams
=
getSelectedOrgInfo
();
try
{
iLatentDangerService
.
updateStatusByUserIdAndPlandIdLike
(
userId
,
plandId
,
reginParams
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
ResponseHelper
.
buildResponse
(
null
);
}
}
amos-boot-module/amos-boot-module-biz/amos-boot-module-latentdanger-biz/src/main/java/com/yeejoin/amos/latentdanger/business/service/impl/LatentDangerServiceImpl.java
View file @
e5cd9dc0
...
...
@@ -19,6 +19,7 @@ import java.util.stream.Collectors;
import
org.apache.commons.lang3.ObjectUtils
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.data.domain.PageImpl
;
...
...
@@ -236,9 +237,95 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
}
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
List
<
LatentDanger
>
savePatrolPlanB
(
List
<
LatentDangerDto
>
latentDangerDtoList
,
String
userId
,
String
userRealName
,
String
departmentId
,
String
departmentName
,
String
companyId
,
String
orgCode
,
RoleBo
role
)
throws
Exception
{
if
(
ValidationUtil
.
isEmpty
(
latentDangerDtoList
))
{
throw
new
Exception
(
"参数有误"
);
}
// 获取业务类型枚举
LatentDangerBizTypeEnum
bizTypeEnum
=
LatentDangerBizTypeEnum
.
getByCode
(
bizType
);
if
(
ValidationUtil
.
isEmpty
(
bizTypeEnum
))
{
throw
new
Exception
(
"业务类型有误"
);
}
List
<
LatentDanger
>
dangerList
=
Lists
.
newArrayList
();
for
(
LatentDangerDto
param
:
latentDangerDtoList
)
{
String
businessKey
=
RandomUtil
.
buildOrderNo
();
LatentDangerLevelEnum
levelEnum
=
LatentDangerLevelEnum
.
getEnumByCode
(
param
.
getDangerLevel
());
if
(
levelEnum
==
null
)
{
throw
new
Exception
(
"隐患等级参数有误"
);
}
LatentDangerTypeEnum
dangerTypeEnum
=
LatentDangerTypeEnum
.
getByCode
(
latentDangerDtoList
.
get
(
0
).
getCheckMode
());
if
(
ValidationUtil
.
isEmpty
(
dangerTypeEnum
))
{
throw
new
Exception
(
"检查类型参数有误"
);
}
Date
endTime
=
DateUtils
.
getTargetEndTime
(
param
.
getReformLimitDate
());
param
.
setReformLimitDate
(
endTime
);
// 保存隐患
LatentDanger
latentDanger
=
importSaveLatentDanger
(
param
,
userId
,
departmentId
,
businessKey
,
orgCode
,
dangerTypeEnum
);
JSONObject
instance
=
new
JSONObject
();
// 巡检业务需要在填写隐患后直接开启工作流
if
(
bizTypeEnum
==
LatentDangerBizTypeEnum
.
巡检
)
{
// 更新巡检p_check_input表state字段
updateCheckInputDangerState
(
latentDanger
.
getBizId
(),
DangerHandleStateEnum
.
HANDLE
.
getCode
());
Long
dangerId
=
latentDanger
.
getId
();
Date
startDate
=
new
Date
();
JSONObject
jsonObject
=
remoteWorkFlowService
.
startNew
(
dangerId
,
businessKey
,
processDefinitionKey
);
Date
endDate
=
new
Date
();
logger
.
info
(
"-------------------------提交隐患时间"
+
(
endDate
.
getTime
()
-
startDate
.
getTime
()));
if
(
jsonObject
==
null
)
{
TransactionAspectSupport
.
currentTransactionStatus
().
setRollbackOnly
();
throw
new
Exception
(
"启动流程失败"
);
}
instance
=
jsonObject
.
getJSONObject
(
"data"
);
if
(
instance
==
null
)
{
throw
new
Exception
(
"无提交隐患权限"
);
}
}
JSONObject
flowJson
=
new
JSONObject
();
if
(!
ValidationUtil
.
isEmpty
(
param
.
getPhotoUrl
()))
{
flowJson
.
put
(
"photoUrls"
,
Joiner
.
on
(
","
).
join
(
param
.
getPhotoUrl
()));
}
if
(!
ValidationUtil
.
isEmpty
(
param
.
getId
())
&&
!
"draft"
.
equals
(
latentDanger
.
getDangerState
())
||
!
ValidationUtil
.
isEmpty
(
param
.
getId
())
&&
"dangerSubmit"
.
equals
(
latentDanger
.
getDangerState
())
)
{
// 第一次保存隐患提交记录
LatentDangerFlowRecord
inputRecord
=
saveFlowRecord
(
instance
.
getString
(
"id"
),
"提交隐患"
,
userId
,
departmentId
,
flowJson
,
latentDanger
.
getId
(),
role
,
LatentDangerExecuteTypeEnum
.
填写隐患完成
.
getName
(),
latentDanger
.
getRemark
(),
userRealName
,
departmentName
,
latentDanger
.
getDangerState
(),
ExecuteTypeEnum
.
通过
.
getCode
());
latentDanger
.
setCurrentFlowRecordId
(
inputRecord
.
getId
());
latentDanger
.
setInstanceId
(
instance
.
getString
(
"id"
));
latentDangerMapper
.
updateById
(
latentDanger
);
ruleDangerService
.
addLatentDangerRule
(
latentDanger
,
RuleTypeEnum
.
隐患第一次提交
.
getCode
(),
onSiteConfirmRole
);
}
// TODO 使用远程调用替换
// LatentDangerPatrolBo patrolBo = latentDangerPatrolMapper.getByDangerId(latentDanger.getId());
// sendMessage(latentDanger, LatentDangerExecuteTypeEnum.填写隐患完成, patrolBo,
// "巡检隐患排查与治理", this.getNextExecuteUsers(latentDanger.getInstanceId()), userRealName, departmentName);
// try {
// webMqttComponent.publish(dangerTopic, "");
// } catch (Exception e) {
// logger.error("巡检隐患提交数字换流站页面推送失败-----------" + e.getMessage());
// }
dangerList
.
add
(
latentDanger
);
}
return
dangerList
;
}
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Override
public
List
<
LatentDanger
>
savePatrol
(
List
<
LatentDangerDto
>
latentDangerDtoList
,
String
userId
,
String
userRealName
,
String
departmentId
,
String
departmentName
,
String
companyId
,
String
orgCode
,
RoleBo
role
)
String
departmentId
,
String
departmentName
,
String
companyId
,
String
orgCode
,
RoleBo
role
,
String
flag
)
throws
Exception
{
if
(
ValidationUtil
.
isEmpty
(
latentDangerDtoList
))
{
throw
new
Exception
(
"参数有误"
);
...
...
@@ -294,7 +381,21 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
if
(!
ValidationUtil
.
isEmpty
(
param
.
getPhotoUrl
()))
{
flowJson
.
put
(
"photoUrls"
,
Joiner
.
on
(
","
).
join
(
param
.
getPhotoUrl
()));
}
if
(
ValidationUtil
.
isEmpty
(
param
.
getId
())
&&
!
"draft"
.
equals
(
latentDanger
.
getDangerState
()))
{
//为不影响其他业余 加一个判断 flag == 1 是外部单位导入的隐患
if
(
flag
==
null
){
if
(
ValidationUtil
.
isEmpty
(
param
.
getId
())
&&
!
"draft"
.
equals
(
latentDanger
.
getDangerState
())
)
{
// 第一次保存隐患提交记录
LatentDangerFlowRecord
inputRecord
=
saveFlowRecord
(
instance
.
getString
(
"id"
),
"提交隐患"
,
userId
,
departmentId
,
flowJson
,
latentDanger
.
getId
(),
role
,
LatentDangerExecuteTypeEnum
.
填写隐患完成
.
getName
(),
latentDanger
.
getRemark
(),
userRealName
,
departmentName
,
latentDanger
.
getDangerState
(),
ExecuteTypeEnum
.
通过
.
getCode
());
latentDanger
.
setCurrentFlowRecordId
(
inputRecord
.
getId
());
latentDanger
.
setInstanceId
(
instance
.
getString
(
"id"
));
latentDangerMapper
.
updateById
(
latentDanger
);
ruleDangerService
.
addLatentDangerRule
(
latentDanger
,
RuleTypeEnum
.
隐患第一次提交
.
getCode
(),
onSiteConfirmRole
);
}
}
else
if
(
flag
.
equals
(
"1"
)){
if
(!
ValidationUtil
.
isEmpty
(
param
.
getId
())
&&
!
"draft"
.
equals
(
latentDanger
.
getDangerState
())
)
{
// 第一次保存隐患提交记录
LatentDangerFlowRecord
inputRecord
=
saveFlowRecord
(
instance
.
getString
(
"id"
),
"提交隐患"
,
userId
,
departmentId
,
flowJson
,
latentDanger
.
getId
(),
role
,
...
...
@@ -306,6 +407,9 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
ruleDangerService
.
addLatentDangerRule
(
latentDanger
,
RuleTypeEnum
.
隐患第一次提交
.
getCode
(),
onSiteConfirmRole
);
}
}
// TODO 使用远程调用替换
// LatentDangerPatrolBo patrolBo = latentDangerPatrolMapper.getByDangerId(latentDanger.getId());
// sendMessage(latentDanger, LatentDangerExecuteTypeEnum.填写隐患完成, patrolBo,
...
...
@@ -446,7 +550,8 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
latentDanger
.
setPhotoUrls
(
Joiner
.
on
(
","
).
join
(
dangerDto
.
getPhotoUrl
()));
}
this
.
saveOrUpdate
(
latentDanger
);
return
latentDanger
;
return
latentDangerMapper
.
selectById
(
latentDanger
.
getId
());
//return latentDanger;
}
public
LatentDangerFlowRecord
saveFlowRecord
(
String
taskId
,
String
taskName
,
String
userId
,
String
departmentId
,
...
...
@@ -2597,7 +2702,7 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
return
resultMap
;
}
public
void
updateStatusByUserIdAndPlandIdLike
(
String
userId
,
String
plandId
)
{
public
void
updateStatusByUserIdAndPlandIdLike
(
String
userId
,
String
plandId
,
ReginParams
reginParams
)
throws
Exception
{
String
plandId1
=
"planId\""
+
":"
+
"\""
+
plandId
;
List
<
LatentDanger
>
list
=
latentDangerMapper
.
updateStatusByUserIdAndPlandIdLike
(
userId
,
plandId1
);
list
.
stream
().
forEach
(
i
->{
...
...
@@ -2605,6 +2710,39 @@ public class LatentDangerServiceImpl extends BaseService<LatentDangerBo, LatentD
i
.
setDangerStateName
(
LatentDangerState
.
SupervisionDangerStateEnum
.
提交隐患
.
getName
());
});
this
.
saveOrUpdateBatch
(
list
);
// this.saveOrUpdateBatch(list);
List
<
LatentDangerDto
>
dangerDtos
=
Lists
.
newArrayList
();
for
(
LatentDanger
latentDanger
:
list
)
{
LatentDangerDto
latentDangerDto
=
new
LatentDangerDto
();
BeanUtils
.
copyProperties
(
latentDanger
,
latentDangerDto
);
latentDangerDto
.
setCheckMode
(
latentDanger
.
getDangerType
());
dangerDtos
.
add
(
latentDangerDto
);
}
String
userRealName
=
null
;
String
departmentId
=
null
;
String
departmentName
=
null
;
String
companyId
=
null
;
String
orgCode
=
null
;
RoleBo
role
=
null
;
if
(
reginParams
.
getPersonIdentity
()
!=
null
){
userRealName
=
reginParams
.
getPersonIdentity
().
getPersonName
();
}
if
(
reginParams
.
getDepartment
().
getSequenceNbr
()
!=
null
)
{
departmentId
=
reginParams
.
getDepartment
().
getSequenceNbr
().
toString
();
}
if
(
reginParams
.
getDepartment
().
getDepartmentName
()
!=
null
)
{
departmentName
=
reginParams
.
getDepartment
().
getDepartmentName
();
}
if
(
reginParams
.
getCompany
()
!=
null
)
{
companyId
=
reginParams
.
getCompany
().
getSequenceNbr
().
toString
();
orgCode
=
reginParams
.
getCompany
().
getOrgCode
();
}
if
(
reginParams
.
getRole
()
!=
null
)
{
role
=
reginParams
.
getRole
();
}
this
.
savePatrol
(
dangerDtos
,
userId
,
userRealName
,
departmentId
,
departmentName
,
companyId
,
orgCode
,
role
,
"1"
);
}
}
\ No newline at end of file
amos-boot-module/amos-boot-module-biz/amos-boot-module-latentdanger-biz/src/main/java/com/yeejoin/amos/latentdanger/business/service/intfc/ILatentDangerService.java
View file @
e5cd9dc0
...
...
@@ -38,7 +38,7 @@ public interface ILatentDangerService {
String
departmentId
,
String
departmentName
,
String
companyId
,
String
orgCode
,
RoleBo
role
);
List
<
LatentDanger
>
savePatrol
(
List
<
LatentDangerDto
>
latentDangerDtoList
,
String
userId
,
String
userRealName
,
String
departmentId
,
String
departmentName
,
String
companyId
,
String
orgCode
,
RoleBo
role
)
throws
Exception
;
String
departmentId
,
String
departmentName
,
String
companyId
,
String
orgCode
,
RoleBo
role
,
String
flag
)
throws
Exception
;
CommonResponse
list
(
String
toke
,
String
product
,
String
appKey
,
LatentDangerListParam
latentDangerListParam
,
AgencyUserModel
user
,
String
loginOrgCode
,
String
deptId
);
...
...
@@ -195,5 +195,5 @@ public interface ILatentDangerService {
public
Map
<
String
,
Integer
>
currentLandgerCount
(
String
companyId
,
String
loginOrgCode
);
void
updateStatusByUserIdAndPlandIdLike
(
String
userId
,
String
planId
)
;
void
updateStatusByUserIdAndPlandIdLike
(
String
userId
,
String
planId
,
ReginParams
reginParams
)
throws
Exception
;
}
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