Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
YeeAmosFireAutoSysRoot
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
station
YeeAmosFireAutoSysRoot
Commits
c47c8202
Commit
c47c8202
authored
Aug 30, 2022
by
高建强
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
item:新增根据批次号更新预案步骤按钮的状态接口
parent
0c437db9
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
100 additions
and
31 deletions
+100
-31
PlanVisual3dController.java
.../amos/fas/business/controller/PlanVisual3dController.java
+7
-0
PlanOperationRecordMapper.java
...os/fas/business/dao/mapper/PlanOperationRecordMapper.java
+3
-0
PlanVisual3dServiceImpl.java
...os/fas/business/service/impl/PlanVisual3dServiceImpl.java
+60
-31
IPlanVisual3dService.java
...amos/fas/business/service/intfc/IPlanVisual3dService.java
+9
-0
PlanStepVo.java
...ain/java/com/yeejoin/amos/fas/business/vo/PlanStepVo.java
+12
-0
PlanOperationRecordMapper.xml
...rc/main/resources/db/mapper/PlanOperationRecordMapper.xml
+9
-0
No files found.
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/controller/PlanVisual3dController.java
View file @
c47c8202
...
...
@@ -162,6 +162,13 @@ public class PlanVisual3dController extends BaseController {
}
@Permission
@ApiOperation
(
value
=
"根据批次号更新预案步骤按钮的状态"
,
notes
=
"根据批次号更新预案步骤按钮的状态"
)
@GetMapping
(
value
=
"/plan/updatePlanStepStatus"
)
public
ResponseModel
updatePlanStepStatus
(
@RequestParam
(
"batchNo"
)
String
batchNo
,
@RequestParam
(
"buttonCode"
)
String
buttonCode
,
@RequestParam
(
"status"
)
String
status
)
{
return
CommonResponseUtil
.
successNew
(
planVisual3dService
.
updatePlanStepStatus
(
batchNo
,
buttonCode
,
status
));
}
@Permission
@ApiOperation
(
value
=
"根据批次号获取预案的记录"
,
notes
=
"根据R批次号获取预案的记录"
)
@GetMapping
(
value
=
"/plan/getPlaneRecord"
)
public
ResponseModel
getPlaneRecord
(
@RequestParam
(
"batchNo"
)
String
batchNo
)
{
...
...
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/dao/mapper/PlanOperationRecordMapper.java
View file @
c47c8202
package
com
.
yeejoin
.
amos
.
fas
.
business
.
dao
.
mapper
;
import
com.google.gson.JsonObject
;
import
com.yeejoin.amos.fas.dao.entity.PlanRule
;
import
com.yeejoin.amos.fas.datasync.bo.PlanOperationRecordSyncBo
;
import
org.springframework.stereotype.Repository
;
...
...
@@ -34,4 +35,6 @@ public interface PlanOperationRecordMapper {
* @return
*/
String
getNewestBatchNo
();
PlanRule
getPlanRuleByBatchNo
(
String
batchNo
);
}
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/service/impl/PlanVisual3dServiceImpl.java
View file @
c47c8202
...
...
@@ -2,7 +2,6 @@ package com.yeejoin.amos.fas.business.service.impl;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.google.common.collect.Lists
;
import
com.yeejoin.amos.fas.business.constants.FasConstant
;
import
com.yeejoin.amos.fas.business.dao.mapper.DictMapper
;
...
...
@@ -10,6 +9,7 @@ import com.yeejoin.amos.fas.business.dao.mapper.PlanOperationRecordMapper;
import
com.yeejoin.amos.fas.business.dao.mapper.PlanVisual3dMapper
;
import
com.yeejoin.amos.fas.business.dao.repository.IContingencyOriginalDataDao
;
import
com.yeejoin.amos.fas.business.dao.repository.IContingencyPlanInstanceRepository
;
import
com.yeejoin.amos.fas.business.dao.repository.IPlanRuleDao
;
import
com.yeejoin.amos.fas.business.dao.repository.ITextPlanDao
;
import
com.yeejoin.amos.fas.business.feign.IMaasVisualServer
;
import
com.yeejoin.amos.fas.business.service.intfc.IDictService
;
...
...
@@ -17,15 +17,18 @@ import com.yeejoin.amos.fas.business.service.intfc.IPlanVisual3dService;
import
com.yeejoin.amos.fas.business.service.model.ToipResponse
;
import
com.yeejoin.amos.fas.business.util.JSONUtil
;
import
com.yeejoin.amos.fas.business.util.StringUtil
;
import
com.yeejoin.amos.fas.business.vo.PlanStepVo
;
import
com.yeejoin.amos.fas.business.vo.TreeSubjectVo
;
import
com.yeejoin.amos.fas.core.util.CommonResponse
;
import
com.yeejoin.amos.fas.core.util.CommonResponseUtil
;
import
com.yeejoin.amos.fas.dao.entity.ContingencyOriginalData
;
import
com.yeejoin.amos.fas.dao.entity.ContingencyPlanInstance
;
import
com.yeejoin.amos.fas.dao.entity.Dict
;
import
com.yeejoin.amos.fas.dao.entity.PlanRule
;
import
com.yeejoin.amos.fas.dao.entity.TextPlan
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.ObjectUtils
;
...
...
@@ -59,6 +62,9 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
@Autowired
private
IContingencyPlanInstanceRepository
contingencyPlanInstanceRepository
;
@Autowired
private
IPlanRuleDao
planRuleDao
;
@Override
public
List
<
TreeSubjectVo
>
getPlanTree
()
{
...
...
@@ -88,11 +94,11 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
@Override
public
TextPlan
getTextPlanInfoById
(
Long
id
)
{
Optional
<
TextPlan
>
textPlan
=
iTextPlanDao
.
findById
(
id
);
if
(
textPlan
.
isPresent
())
{
return
textPlan
.
get
();
}
return
null
;
Optional
<
TextPlan
>
textPlan
=
iTextPlanDao
.
findById
(
id
);
if
(
textPlan
.
isPresent
())
{
return
textPlan
.
get
();
}
return
null
;
}
private
List
<
TreeSubjectVo
>
listToTree
(
List
<
Object
>
list
)
{
...
...
@@ -117,11 +123,11 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
List
<
TreeSubjectVo
>
childrenVos
=
Lists
.
newArrayList
();
List
<
Object
>
res
=
(
List
<
Object
>)
response
.
getDataList
();
res
.
forEach
(
r
->
{
LinkedHashMap
<
String
,
Object
>
map1
=
(
LinkedHashMap
<
String
,
Object
>)
r
;
Integer
state
=
(
Integer
)
map1
.
get
(
"publishState"
);
if
(
state
==
0
)
{
//过滤 未发布状态
return
;
}
LinkedHashMap
<
String
,
Object
>
map1
=
(
LinkedHashMap
<
String
,
Object
>)
r
;
Integer
state
=
(
Integer
)
map1
.
get
(
"publishState"
);
if
(
state
==
0
)
{
//过滤 未发布状态
return
;
}
TreeSubjectVo
subjectVo
=
new
TreeSubjectVo
();
subjectVo
.
setType
(
"listNode"
);
subjectVo
.
setParentId
((
String
)
map
.
get
(
"id"
));
...
...
@@ -187,8 +193,7 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
Dict
dict
=
new
Dict
();
dict
.
setDictCode
(
type
);
List
<
Dict
>
dictList
=
dictService
.
getDictList
(
dict
);
Map
<
String
,
String
>
dicts
=
dictList
.
stream
().
collect
(
Collectors
.
toMap
(
Dict:
:
getDictValue
,
Dict:
:
getDictName
,
(
key1
,
key2
)
->
key2
));
Map
<
String
,
String
>
dicts
=
dictList
.
stream
().
collect
(
Collectors
.
toMap
(
Dict:
:
getDictValue
,
Dict:
:
getDictName
,
(
key1
,
key2
)
->
key2
));
//2.1换key为中文
Map
<
String
,
Object
>
tempMap
=
new
HashMap
<
String
,
Object
>();
...
...
@@ -215,22 +220,22 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
dict
.
setDictCode
(
FasConstant
.
PLAN_SOURCE_TYPE
);
List
<
Dict
>
dictList
=
dictMapper
.
getDictList
(
dict
);
List
<
Map
<
String
,
Object
>>
list
=
new
ArrayList
<>();
list
=
dictList
.
stream
().
map
(
e
->
{
list
=
dictList
.
stream
().
map
(
e
->
{
Map
<
String
,
Object
>
newMap
=
new
HashMap
<
String
,
Object
>();
newMap
.
put
(
"key"
,
e
.
getDictValue
());
newMap
.
put
(
"value"
,
e
.
getDictValue
());
//前端级联Cascader使用
newMap
.
put
(
"isLeaf"
,
false
);
////前端级联Cascader使用
newMap
.
put
(
"dataType"
,
"type"
);
newMap
.
put
(
"label"
,
e
.
getDictName
());
newMap
.
put
(
"key"
,
e
.
getDictValue
());
newMap
.
put
(
"value"
,
e
.
getDictValue
());
//前端级联Cascader使用
newMap
.
put
(
"isLeaf"
,
false
);
////前端级联Cascader使用
newMap
.
put
(
"dataType"
,
"type"
);
newMap
.
put
(
"label"
,
e
.
getDictName
());
return
newMap
;
}).
collect
(
Collectors
.
toList
());
return
list
;
}
@Override
public
List
<
TreeSubjectVo
>
getTextPlanBySubjectId
(
String
appId
)
{
//关联文字预案
List
<
TreeSubjectVo
>
subjectVos
=
new
ArrayList
<>();
@Override
public
List
<
TreeSubjectVo
>
getTextPlanBySubjectId
(
String
appId
)
{
//关联文字预案
List
<
TreeSubjectVo
>
subjectVos
=
new
ArrayList
<>();
List
<
TextPlan
>
textPlans
=
iTextPlanDao
.
findByAppId
(
appId
);
textPlans
.
forEach
(
t
->
{
TreeSubjectVo
textTreeSubjectVo
=
new
TreeSubjectVo
();
...
...
@@ -240,13 +245,13 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
textTreeSubjectVo
.
setType
(
"textNode"
);
subjectVos
.
add
(
textTreeSubjectVo
);
});
return
subjectVos
;
}
return
subjectVos
;
}
@Override
public
void
deleteTextPlanFile
(
Long
id
)
{
iTextPlanDao
.
deleteById
(
id
);
}
@Override
public
void
deleteTextPlanFile
(
Long
id
)
{
iTextPlanDao
.
deleteById
(
id
);
}
@Override
public
String
getNewestBatchNo
()
{
...
...
@@ -263,9 +268,13 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
// 查询当前步骤
ContingencyOriginalData
contingencyOriginalData
=
contingencyOriginalDataDao
.
findByBatchNo
(
batchNo
);
String
step
=
contingencyOriginalData
.
getStep
();
String
confirm
=
contingencyOriginalData
.
getConfirm
();
Map
<
String
,
Object
>
msgContext
=
new
HashMap
<>(
2
);
msgContext
.
put
(
"step"
,
objects
);
msgContext
.
put
(
"currentStep"
,
step
);
msgContext
.
put
(
"currentStep"
,
contingencyOriginalData
.
getStep
());
msgContext
.
put
(
"confirm"
,
contingencyOriginalData
.
getConfirm
());
msgContext
.
put
(
"createDate"
,
contingencyOriginalData
.
getCreateDate
());
msgContext
.
put
(
"batchNo"
,
contingencyOriginalData
.
getBatchNo
());
toipResponse
.
setMsgType
(
"steparea"
);
toipResponse
.
setMsgContext
(
msgContext
);
toipResponse
.
setContingency
(
contingencyOriginalData
);
...
...
@@ -303,4 +312,24 @@ public class PlanVisual3dServiceImpl implements IPlanVisual3dService {
}
return
toipResponse
;
}
@Override
@Transactional
public
ToipResponse
updatePlanStepStatus
(
String
batchNo
,
String
buttonCode
,
String
status
)
{
ToipResponse
toipResponse
=
new
ToipResponse
();
// 根据批次号查询预案步骤
PlanRule
planRule
=
planOperationRecordMapper
.
getPlanRuleByBatchNo
(
batchNo
);
String
planStep
=
planRule
.
getPlanStep
();
if
(
StringUtil
.
isNotEmpty
(
planStep
))
{
List
<
PlanStepVo
>
list
=
JSON
.
parseArray
(
planStep
,
PlanStepVo
.
class
);
List
<
PlanStepVo
>
collect
=
list
.
stream
().
peek
(
x
->
{
if
(
StringUtils
.
isNotBlank
(
buttonCode
)
&&
buttonCode
.
equalsIgnoreCase
(
x
.
getButtonCode
()))
{
x
.
setStepStatus
(
status
);
}
}).
collect
(
Collectors
.
toList
());
planRule
.
setPlanStep
(
JSON
.
toJSONString
(
collect
));
planRuleDao
.
save
(
planRule
);
}
return
toipResponse
;
}
}
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/service/intfc/IPlanVisual3dService.java
View file @
c47c8202
...
...
@@ -68,4 +68,13 @@ public interface IPlanVisual3dService {
* @return 预案记录
*/
ToipResponse
getPlaneRecordOneByBatchNo
(
String
batchNo
);
/**
* 根据批次号更新预案步骤按钮的状态
* @param batchNo 批次号
* @param buttonCode 按钮编码
* @param status 按钮状态:0-点击,1-已执行,2-点击未执行
* @return ToipResponse
*/
ToipResponse
updatePlanStepStatus
(
String
batchNo
,
String
buttonCode
,
String
status
);
}
YeeAmosFireAutoSysService/src/main/java/com/yeejoin/amos/fas/business/vo/PlanStepVo.java
0 → 100644
View file @
c47c8202
package
com
.
yeejoin
.
amos
.
fas
.
business
.
vo
;
import
lombok.Data
;
@Data
public
class
PlanStepVo
{
private
String
stepCode
;
private
String
stepName
;
private
String
stepStatus
;
private
String
buttonCode
;
}
YeeAmosFireAutoSysStart/src/main/resources/db/mapper/PlanOperationRecordMapper.xml
View file @
c47c8202
...
...
@@ -115,6 +115,15 @@
WHERE
cpor.batch_no = #{batchNo}
</select>
<select
id=
"getPlanRuleByBatchNo"
resultType=
"com.yeejoin.amos.fas.dao.entity.PlanRule"
>
SELECT
cpr.*
FROM
c_plan_rule cpr
LEFT JOIN c_plan_operation_record cpor ON cpor.plan_id = cpr.plan_id
WHERE
cpor.batch_no = #{batchNo}
</select>
<select
id=
"getNewestBatchNo"
resultType=
"java.lang.String"
>
select batch_no as batchNo from c_plan_operation_record where status = 0 and is_delete = 0 order by create_date desc limit 1
...
...
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