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
3cbda766
Commit
3cbda766
authored
Jan 10, 2024
by
zhangsen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
根据流程状态name 获取流程状态code 公共方法
parent
e553ca3f
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
101 additions
and
45 deletions
+101
-45
CommonServiceImpl.java
...os/boot/module/jg/biz/service/impl/CommonServiceImpl.java
+21
-0
JgTransferNoticeServiceImpl.java
...dule/jg/biz/service/impl/JgTransferNoticeServiceImpl.java
+80
-45
No files found.
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/service/impl/CommonServiceImpl.java
View file @
3cbda766
...
...
@@ -7,6 +7,8 @@ import com.aspose.words.SaveFormat;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.yeejoin.amos.boot.biz.common.bo.CompanyBo
;
import
com.yeejoin.amos.boot.biz.common.bo.ReginParams
;
import
com.yeejoin.amos.boot.biz.common.entity.DataDictionary
;
import
com.yeejoin.amos.boot.biz.common.service.IDataDictionaryService
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisKey
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisUtils
;
import
com.yeejoin.amos.boot.module.jg.api.dto.ByteArrayMultipartFile
;
...
...
@@ -76,6 +78,9 @@ public class CommonServiceImpl implements ICommonService {
@Autowired
CommonMapper
commonMapper
;
@Autowired
IDataDictionaryService
iDataDictionaryService
;
@Value
(
"classpath:/json/superviseBusinessCategory.json"
)
private
Resource
superviseBusinessCategory
;
...
...
@@ -713,4 +718,19 @@ public class CommonServiceImpl implements ICommonService {
return
sb
.
length
()
>
0
?
sb
.
substring
(
0
,
sb
.
length
()
-
1
)
:
""
;
}
/**
* 根据流程状态name 获取流程状态code
* @param name 流程状态name
* @return 流程状态code
*/
public
Integer
getDictionaryCodeByName
(
String
name
)
{
List
<
DataDictionary
>
jggzzz
=
iDataDictionaryService
.
getByType
(
"JGGZZZ"
);
for
(
DataDictionary
item
:
jggzzz
)
{
if
(
item
.
getName
().
equals
(
name
))
{
return
Integer
.
parseInt
(
item
.
getCode
());
}
}
return
null
;
}
}
\ No newline at end of file
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/service/impl/JgTransferNoticeServiceImpl.java
View file @
3cbda766
...
...
@@ -11,11 +11,14 @@ import com.yeejoin.amos.boot.biz.common.bo.ReginParams;
import
com.yeejoin.amos.boot.biz.common.utils.DateUtils
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisKey
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisUtils
;
import
com.yeejoin.amos.boot.module.jg.api.common.BizCommonConstant
;
import
com.yeejoin.amos.boot.module.jg.api.dto.ByteArrayMultipartFile
;
import
com.yeejoin.amos.boot.module.jg.api.dto.JgInstallationNoticeDto
;
import
com.yeejoin.amos.boot.module.jg.api.dto.JgTransferNoticeDto
;
import
com.yeejoin.amos.boot.module.jg.api.dto.TaskModelDto
;
import
com.yeejoin.amos.boot.module.jg.api.entity.JgTransferNotice
;
import
com.yeejoin.amos.boot.module.jg.api.entity.JgTransferNoticeEq
;
import
com.yeejoin.amos.boot.module.jg.api.enums.BusinessTypeEnum
;
import
com.yeejoin.amos.boot.module.jg.api.mapper.JgTransferNoticeEqMapper
;
import
com.yeejoin.amos.boot.module.jg.api.mapper.JgTransferNoticeMapper
;
import
com.yeejoin.amos.boot.module.jg.api.service.IJgTransferNoticeService
;
...
...
@@ -358,13 +361,86 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto
ArrayList
<
String
>
roleListSecond
=
new
ArrayList
<>();
// 判断当前是否为提交
List
<
String
>
instanceIdList
=
new
ArrayList
<>();
workFlowInfo
(
submitType
,
taskName
,
deviceList
,
roleListFirst
,
roleListSecond
,
instanceIdList
);
List
<
JgTransferNotice
>
list
=
new
ArrayList
<>();
List
<
JgTransferNoticeEq
>
equipList
=
new
ArrayList
<>();
deviceList
.
forEach
(
obj
->
{
JgTransferNoticeEq
jgRelationEquip
=
new
JgTransferNoticeEq
();
JgTransferNotice
dto
=
new
JgTransferNotice
();
BeanUtils
.
copyProperties
(
model
,
dto
);
int
i
=
deviceList
.
indexOf
(
obj
);
String
applyNo
=
responseModel
.
getResult
().
get
(
i
);
dto
.
setPromoter
(
reginParams
.
getUserModel
().
getUserId
());
dto
.
setApplyNo
(
applyNo
);
dto
.
setNoticeDate
(
new
Date
());
if
(
SUBMIT_TYPE_FLOW
.
equals
(
submitType
))
{
dto
.
setNextExecuteIds
(
String
.
join
(
","
,
roleListSecond
));
dto
.
setInstanceStatus
(
String
.
join
(
","
,
roleListFirst
));
dto
.
setPromoter
(
reginParams
.
getUserModel
().
getUserId
());
dto
.
setStatus
(
taskName
[
0
]);
}
dto
.
setInstallUnitName
(
reginParams
.
getCompany
().
getCompanyName
());
dto
.
setInstallUnitCreditCode
(
reginParams
.
getCompany
().
getCompanyCode
());
jgRelationEquip
.
setEquId
(
String
.
valueOf
(
obj
.
get
(
"SEQUENCE_NBR"
)));
jgRelationEquip
.
setEquipTransferId
(
applyNo
);
if
(!
CollectionUtils
.
isEmpty
(
instanceIdList
))
{
dto
.
setInstanceId
(
instanceIdList
.
get
(
i
));
dto
.
setNoticeStatus
(
String
.
valueOf
(
FlowStatusEnum
.
TO_BE_PROCESSED
.
getCode
()));
}
else
{
dto
.
setNoticeStatus
(
String
.
valueOf
(
FlowStatusEnum
.
TO_BE_SUBMITTED
.
getCode
()));
}
list
.
add
(
dto
);
equipList
.
add
(
jgRelationEquip
);
});
jgTransferNoticeMapper
.
insertBatchSomeColumn
(
list
);
if
(
SUBMIT_TYPE_FLOW
.
equals
(
submitType
))
{
buildTask
(
list
);
}
List
<
JgTransferNoticeEq
>
jgRelationEquipList
=
equipList
.
stream
().
map
(
jgRelationEquip
->
{
List
<
JgTransferNotice
>
collect
=
list
.
stream
().
filter
(
JgTransferNotice
->
jgRelationEquip
.
getEquipTransferId
().
equals
(
JgTransferNotice
.
getApplyNo
())).
collect
(
Collectors
.
toList
());
Long
sequenceNbr
=
collect
.
get
(
0
).
getSequenceNbr
();
return
jgRelationEquip
.
setEquipTransferId
(
String
.
valueOf
(
sequenceNbr
));
}).
collect
(
Collectors
.
toList
());
jgTransferNoticeEqMapper
.
insertBatchSomeColumn
(
jgRelationEquipList
);
}
@Autowired
private
CommonServiceImpl
commonService
;
private
void
buildTask
(
List
<
JgTransferNotice
>
list
)
{
List
<
TaskModelDto
>
taskModelDtoList
=
new
ArrayList
<>();
list
.
forEach
(
item
->
{
TaskModelDto
taskModelDto
=
new
TaskModelDto
();
taskModelDto
.
setFlowCreateDate
(
item
.
getCreateDate
());
// taskModelDto.setTaskName(); // 工作流API返回
taskModelDto
.
setTaskCode
(
item
.
getApplyNo
());
taskModelDto
.
setTaskType
(
BusinessTypeEnum
.
JG_INSTALLATION_NOTIFICATION
.
getCode
());
taskModelDto
.
setTaskTypeLabel
(
BusinessTypeEnum
.
JG_INSTALLATION_NOTIFICATION
.
getName
());
taskModelDto
.
setRelationId
(
item
.
getInstanceId
());
// taskModelDto.setExecuteUserIds(); // 工作流API返回
taskModelDto
.
setTaskStatus
(
commonService
.
getDictionaryCodeByName
(
item
.
getNoticeStatus
()));
// 流程状态枚举
taskModelDto
.
setTaskStatusLabel
(
item
.
getNoticeStatus
());
taskModelDto
.
setStartUserId
(
item
.
getCreateUserId
());
taskModelDto
.
setStartUser
(
item
.
getRecUserName
());
// taskModelDto.setStartUserCompanyName(); // 任务发起人所在单位
taskModelDto
.
setStartDate
(
item
.
getCreateDate
());
taskModelDto
.
setModel
(
item
);
taskModelDtoList
.
add
(
taskModelDto
);
});
commonService
.
buildTaskModel
(
taskModelDtoList
);
}
private
void
workFlowInfo
(
String
submitType
,
String
[]
taskName
,
List
<
Map
<
String
,
Object
>>
deviceList
,
ArrayList
<
String
>
roleListFirst
,
ArrayList
<
String
>
roleListSecond
,
List
<
String
>
instanceIdList
)
{
if
(
SUBMIT_TYPE_FLOW
.
equals
(
submitType
))
{
// 发起流程
// ActWorkflowStartDTO dto = new ActWorkflowStartDTO();
ActWorkflowBatchDTO
actWorkflowBatchDTO
=
new
ActWorkflowBatchDTO
();
List
<
ActWorkflowStartDTO
>
list
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
deviceList
.
size
();
i
++
)
{
for
(
int
i
=
0
;
i
<
deviceList
.
size
();
i
++)
{
ActWorkflowStartDTO
dto
=
new
ActWorkflowStartDTO
();
dto
.
setProcessDefinitionKey
(
PROCESS_DEFINITION_KEY
);
dto
.
setBusinessKey
(
String
.
valueOf
(
i
));
...
...
@@ -383,7 +459,7 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto
instanceIdList
.
add
(
instanceId
);
// 查询下节点任务
if
(
returnList
.
get
(
0
).
equals
(
obj
))
{
getNext
(
roleListFirst
,
instanceId
,
taskName
);
getNext
(
roleListFirst
,
instanceId
,
taskName
);
}
// 推动下一个节点
AjaxResult
ajaxResult
=
Workflow
.
taskClient
.
getTask
(
instanceId
);
...
...
@@ -402,7 +478,7 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto
try
{
ajaxResult1
=
Workflow
.
taskClient
.
completeByTask
(
taskId
,
dto
);
if
(
ajaxResult1
.
get
(
"code"
).
equals
(
200
))
{
getNext
(
roleListSecond
,
instanceId
,
taskName
);
getNext
(
roleListSecond
,
instanceId
,
taskName
);
}
else
{
log
.
error
(
"提交失败"
);
}
...
...
@@ -414,47 +490,6 @@ public class JgTransferNoticeServiceImpl extends BaseService<JgTransferNoticeDto
log
.
error
(
"提交失败:{}"
,
e
);
}
}
List
<
JgTransferNotice
>
list
=
new
ArrayList
<>();
List
<
JgTransferNoticeEq
>
equipList
=
new
ArrayList
<>();
deviceList
.
forEach
(
obj
->
{
JgTransferNoticeEq
jgRelationEquip
=
new
JgTransferNoticeEq
();
JgTransferNotice
dto
=
new
JgTransferNotice
();
BeanUtils
.
copyProperties
(
model
,
dto
);
int
i
=
deviceList
.
indexOf
(
obj
);
String
applyNo
=
responseModel
.
getResult
().
get
(
i
);
dto
.
setPromoter
(
reginParams
.
getUserModel
().
getUserId
());
dto
.
setApplyNo
(
applyNo
);
dto
.
setNoticeDate
(
new
Date
());
if
(
SUBMIT_TYPE_FLOW
.
equals
(
submitType
))
{
dto
.
setNextExecuteIds
(
String
.
join
(
","
,
roleListSecond
));
dto
.
setInstanceStatus
(
String
.
join
(
","
,
roleListFirst
));
dto
.
setPromoter
(
reginParams
.
getUserModel
().
getUserId
());
dto
.
setStatus
(
taskName
[
0
]);
}
dto
.
setInstallUnitName
(
reginParams
.
getCompany
().
getCompanyName
());
dto
.
setInstallUnitCreditCode
(
reginParams
.
getCompany
().
getCompanyCode
());
jgRelationEquip
.
setEquId
(
String
.
valueOf
(
obj
.
get
(
"SEQUENCE_NBR"
)));
jgRelationEquip
.
setEquipTransferId
(
applyNo
);
if
(!
CollectionUtils
.
isEmpty
(
instanceIdList
))
{
dto
.
setInstanceId
(
instanceIdList
.
get
(
i
));
dto
.
setNoticeStatus
(
String
.
valueOf
(
FlowStatusEnum
.
TO_BE_PROCESSED
.
getCode
()));
}
else
{
dto
.
setNoticeStatus
(
String
.
valueOf
(
FlowStatusEnum
.
TO_BE_SUBMITTED
.
getCode
()));
}
list
.
add
(
dto
);
equipList
.
add
(
jgRelationEquip
);
});
jgTransferNoticeMapper
.
insertBatchSomeColumn
(
list
);
List
<
JgTransferNoticeEq
>
jgRelationEquipList
=
equipList
.
stream
().
map
(
jgRelationEquip
->
{
List
<
JgTransferNotice
>
collect
=
list
.
stream
().
filter
(
JgTransferNotice
->
jgRelationEquip
.
getEquipTransferId
().
equals
(
JgTransferNotice
.
getApplyNo
())).
collect
(
Collectors
.
toList
());
Long
sequenceNbr
=
collect
.
get
(
0
).
getSequenceNbr
();
return
jgRelationEquip
.
setEquipTransferId
(
String
.
valueOf
(
sequenceNbr
));
}).
collect
(
Collectors
.
toList
());
jgTransferNoticeEqMapper
.
insertBatchSomeColumn
(
jgRelationEquipList
);
}
private
void
convertField
(
JgTransferNoticeDto
model
)
{
...
...
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