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
7c9ffaf7
Commit
7c9ffaf7
authored
Jan 09, 2024
by
tianyiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
安装告知修改
parent
f770b178
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
100 additions
and
49 deletions
+100
-49
IJgInstallationNoticeService.java
...t/module/jg/api/service/IJgInstallationNoticeService.java
+2
-1
JgInstallationNoticeController.java
...ule/jg/biz/controller/JgInstallationNoticeController.java
+2
-1
PublicWorkFlowMessage.java
...os/boot/module/jg/biz/listener/PublicWorkFlowMessage.java
+16
-8
JgInstallationNoticeServiceImpl.java
.../jg/biz/service/impl/JgInstallationNoticeServiceImpl.java
+80
-39
No files found.
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-api/src/main/java/com/yeejoin/amos/boot/module/jg/api/service/IJgInstallationNoticeService.java
View file @
7c9ffaf7
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
api
.
service
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.yeejoin.amos.boot.biz.common.bo.ReginParams
;
...
...
@@ -59,7 +60,7 @@ public interface IJgInstallationNoticeService extends IService<JgInstallationNot
* @param model 数据
* @param submitType 保存类型
*/
void
saveNotice
(
String
submitType
,
Map
<
String
,
Object
>
model
,
ReginParams
reginParams
);
void
saveNotice
(
String
submitType
,
JSONObject
model
,
ReginParams
reginParams
);
/**
* 打印告知单
...
...
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/controller/JgInstallationNoticeController.java
View file @
7c9ffaf7
package
com
.
yeejoin
.
amos
.
boot
.
module
.
jg
.
biz
.
controller
;
import
cn.hutool.core.bean.BeanUtil
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.amos.boot.biz.common.bo.ReginParams
;
import
com.yeejoin.amos.boot.biz.common.controller.BaseController
;
...
...
@@ -47,7 +48,7 @@ public class JgInstallationNoticeController extends BaseController {
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@PostMapping
(
value
=
"/save"
)
@ApiOperation
(
httpMethod
=
"POST"
,
value
=
"新增安装告知"
,
notes
=
"新增安装告知"
)
public
ResponseModel
<
String
>
save
(
@RequestParam
String
submitType
,
@RequestBody
Map
<
String
,
Object
>
model
)
{
public
ResponseModel
<
String
>
save
(
@RequestParam
String
submitType
,
@RequestBody
JSONObject
model
)
{
ReginParams
reginParams
=
getSelectedOrgInfo
();
iJgInstallationNoticeService
.
saveNotice
(
submitType
,
model
,
reginParams
);
...
...
amos-boot-system-tzs/amos-boot-module-jg/amos-boot-module-jg-biz/src/main/java/com/yeejoin/amos/boot/module/jg/biz/listener/PublicWorkFlowMessage.java
View file @
7c9ffaf7
...
...
@@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSON;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.yeejoin.amos.boot.module.jg.biz.service.impl.JgInstallationNoticeServiceImpl
;
import
com.yeejoin.amos.boot.module.jg.biz.service.impl.StartPlatformTokenService
;
import
com.yeejoin.amos.component.robot.AmosRequestContext
;
import
com.yeejoin.amos.feign.privilege.Privilege
;
import
com.yeejoin.amos.feign.privilege.model.AgencyUserModel
;
...
...
@@ -40,15 +41,16 @@ public class PublicWorkFlowMessage extends EmqxListener {
*/
public
static
final
String
WORKFLOW_TASK_COMPLETED
=
"workflow/task/completed"
;
//
/**
//
* 流程执行结束主题
//
*/
//
public static final String WORKFLOW_PROCESS_COMPLETE = "workflow/process/complete";
/**
* 流程执行结束主题
*/
public
static
final
String
WORKFLOW_PROCESS_COMPLETE
=
"workflow/process/complete"
;
@Autowired
private
JgInstallationNoticeServiceImpl
jgInstallationNoticeService
;
@Autowired
StartPlatformTokenService
platformTokenService
;
@PostConstruct
void
init
()
throws
Exception
{
...
...
@@ -59,9 +61,11 @@ public class PublicWorkFlowMessage extends EmqxListener {
@Override
public
void
processMessage
(
String
topic
,
MqttMessage
message
)
throws
Exception
{
RequestContext
.
setAppKey
(
amosAuth
.
getAppKey
());
RequestContext
.
setProduct
(
amosAuth
.
getProduct
());
RequestContext
.
setToken
(
amosAuth
.
getToken
());
// RequestContext.setAppKey(amosAuth.getAppKey());
// RequestContext.setProduct(amosAuth.getProduct());
// RequestContext.setToken(amosAuth.getToken());
// RequestContext.setAgencyCode(amosAuth.getUserId());
// platformTokenService.getToken();
JSONObject
messageObject
=
JSON
.
parseObject
(
new
String
(
message
.
getPayload
()));
String
businessKey
=
messageObject
.
get
(
"businessKey"
).
toString
();
String
[]
s
=
businessKey
.
split
(
"_"
);
...
...
@@ -76,6 +80,10 @@ public class PublicWorkFlowMessage extends EmqxListener {
if
(
"installationNotice"
.
equals
(
type
))
{
jgInstallationNoticeService
.
completeWorkFlow
(
messageObject
);
}
}
else
if
(
topic
.
equals
(
WORKFLOW_PROCESS_COMPLETE
))
{
if
(
"installationNotice"
.
equals
(
type
))
{
// jgInstallationNoticeService.completeWorkFlow(messageObject);
}
}
}
...
...
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/JgInstallationNoticeServiceImpl.java
View file @
7c9ffaf7
...
...
@@ -8,7 +8,6 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
com.yeejoin.amos.boot.biz.common.bo.ReginParams
;
import
com.yeejoin.amos.boot.biz.common.dao.mapper.DataDictionaryMapper
;
import
com.yeejoin.amos.boot.biz.common.entity.BaseEntity
;
import
com.yeejoin.amos.boot.biz.common.entity.DataDictionary
;
import
com.yeejoin.amos.boot.biz.common.utils.DateUtils
;
import
com.yeejoin.amos.boot.biz.common.utils.RedisKey
;
...
...
@@ -41,14 +40,17 @@ import com.yeejoin.amos.feign.workflow.model.AjaxResult;
import
com.yeejoin.amos.feign.workflow.model.TaskResultDTO
;
import
fr.opensagres.xdocreport.core.io.IOUtils
;
import
lombok.extern.slf4j.Slf4j
;
import
netscape.javascript.JSObject
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.core.io.Resource
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.PlatformTransactionManager
;
import
org.springframework.transaction.TransactionDefinition
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.support.TransactionSynchronization
;
import
org.springframework.transaction.support.TransactionSynchronizationManager
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.util.StringUtils
;
...
...
@@ -127,8 +129,13 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
private
TzBaseUnitLicenceMapper
baseUnitLicenceMapper
;
@Value
(
"classpath:/json/urlInfo.json"
)
p
rivate
Resource
bizTypeInfo
;
p
ublic
Resource
bizTypeInfo
;
@Autowired
private
TransactionDefinition
transactionDefinition
;
@Autowired
private
PlatformTransactionManager
platformTransactionManager
;
/**
* 根据sequenceNbr查询
...
...
@@ -421,9 +428,12 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
@Override
@SuppressWarnings
({
"Duplicates"
,
"rawtypes"
})
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
saveNotice
(
String
submitType
,
Map
<
String
,
Object
>
jgInstallationNoticeDtoMap
,
ReginParams
reginParams
)
{
public
void
saveNotice
(
String
submitType
,
JSONObject
jgInstallationNoticeDtoMap
,
ReginParams
reginParams
)
{
String
[]
taskName
=
new
String
[]{
"流程结束"
};
// TransactionStatus transactionStatus = platformTransactionManager.getTransaction(transactionDefinition);
// JgInstallationNoticeDto model = BeanUtil.toBeanIgnoreError(jgInstallationNoticeDtoMap.get(TABLE_PAGE_ID).toString(), JgInstallationNoticeDto.class);
JgInstallationNoticeDto
model
=
JSON
.
parseObject
(
jgInstallationNoticeDtoMap
.
get
(
TABLE_PAGE_ID
).
toString
(),
JgInstallationNoticeDto
.
class
);
// 字段转换
convertField
(
model
);
...
...
@@ -476,24 +486,51 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
jgInstallationNoticeMapper
.
insertBatchSomeColumn
(
list
);
ActWorkflowBatchDTO
actWorkflowBatchDTO
=
new
ActWorkflowBatchDTO
();
List
<
ActWorkflowStartDTO
>
workflowStartDTOS
=
new
ArrayList
<>();
list
.
forEach
(
item
->
{
if
(
SUBMIT_TYPE_FLOW
.
equals
(
submitType
))
{
// 发起流程
ActWorkflowStartDTO
dto
=
new
ActWorkflowStartDTO
();
dto
.
setProcessDefinitionKey
(
PROCESS_DEFINITION_KEY
);
dto
.
setBusinessKey
(
item
.
getSequenceNbr
()
+
"_"
+
"installationNotice"
);
dto
.
setCompleteFirstTask
(
Boolean
.
TRUE
);
workflowStartDTOS
.
add
(
dto
);
List
<
JgInstallationNoticeEq
>
jgRelationEquipList
=
equipList
.
stream
().
map
(
jgRelationEquip
->
{
List
<
JgInstallationNotice
>
collect
=
list
.
stream
().
filter
(
jgInstallationNotice
->
jgRelationEquip
.
getEquipTransferId
().
equals
(
jgInstallationNotice
.
getApplyNo
())).
collect
(
Collectors
.
toList
());
Long
sequenceNbr
=
collect
.
get
(
0
).
getSequenceNbr
();
return
jgRelationEquip
.
setEquipTransferId
(
String
.
valueOf
(
sequenceNbr
));
}).
collect
(
Collectors
.
toList
());
jgInstallationNoticeEqMapper
.
insertBatchSomeColumn
(
jgRelationEquipList
);
// 需要在事务提交之后,否则事务隔离查询不出数据
TransactionSynchronizationManager
.
registerSynchronization
(
new
TransactionSynchronization
()
{
@Override
public
void
afterCommit
()
{
ActWorkflowBatchDTO
actWorkflowBatchDTO
=
new
ActWorkflowBatchDTO
();
List
<
ActWorkflowStartDTO
>
workflowStartDTOS
=
new
ArrayList
<>();
list
.
forEach
(
item
->
{
if
(
SUBMIT_TYPE_FLOW
.
equals
(
submitType
))
{
// 发起流程
ActWorkflowStartDTO
dto
=
new
ActWorkflowStartDTO
();
dto
.
setProcessDefinitionKey
(
PROCESS_DEFINITION_KEY
);
dto
.
setBusinessKey
(
item
.
getSequenceNbr
()
+
"_"
+
"installationNotice"
);
dto
.
setCompleteFirstTask
(
Boolean
.
TRUE
);
HashMap
<
String
,
Object
>
variables
=
new
HashMap
<>();
variables
.
put
(
"code"
,
"2121"
);
dto
.
setVariables
(
variables
);
workflowStartDTOS
.
add
(
dto
);
}
});
try
{
actWorkflowBatchDTO
.
setProcess
(
workflowStartDTOS
);
Workflow
.
taskV2Client
.
startByVariableBatch
(
actWorkflowBatchDTO
);
}
catch
(
Exception
e
)
{
log
.
error
(
"提交失败:{}"
,
e
);
}
}
});
try
{
actWorkflowBatchDTO
.
setProcess
(
workflowStartDTOS
);
Workflow
.
taskV2Client
.
startByVariableBatch
(
actWorkflowBatchDTO
);
}
catch
(
Exception
e
)
{
log
.
error
(
"提交失败:{}"
,
e
);
}
// platformTransactionManager.commit(transactionStatus);
// list.forEach(item -> {
...
...
@@ -524,13 +561,6 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
// }
// });
List
<
JgInstallationNoticeEq
>
jgRelationEquipList
=
equipList
.
stream
().
map
(
jgRelationEquip
->
{
List
<
JgInstallationNotice
>
collect
=
list
.
stream
().
filter
(
jgInstallationNotice
->
jgRelationEquip
.
getEquipTransferId
().
equals
(
jgInstallationNotice
.
getApplyNo
())).
collect
(
Collectors
.
toList
());
Long
sequenceNbr
=
collect
.
get
(
0
).
getSequenceNbr
();
return
jgRelationEquip
.
setEquipTransferId
(
String
.
valueOf
(
sequenceNbr
));
}).
collect
(
Collectors
.
toList
());
jgInstallationNoticeEqMapper
.
insertBatchSomeColumn
(
jgRelationEquipList
);
}
...
...
@@ -718,8 +748,8 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
ArrayList
<
String
>
roleList
=
new
ArrayList
<>();
boolean
submit
=
submit
(
jgInstallationNotice
,
op
);
if
(
submit
)
{
getNext
(
roleList
,
dto
.
getInstanceId
(),
taskName
);
jgInstallationNotice
.
setStatus
(
taskName
[
0
]);
//
getNext(roleList, dto.getInstanceId(),taskName);
//
jgInstallationNotice.setStatus(taskName[0]);
if
(
"0"
.
equals
(
op
))
{
if
(
roleList
.
size
()
==
0
)
{
...
...
@@ -845,7 +875,7 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
List
<
AgencyUserModel
>
userList
=
Privilege
.
agencyUserClient
.
queryByRoleId
(
jgInstallationNotice
.
getNextExecuteIds
(),
null
,
Boolean
.
FALSE
).
getResult
();
List
<
String
>
userIds
=
userList
.
stream
().
map
(
AgencyUserModel:
:
getUserId
).
collect
(
Collectors
.
toList
());
taskV2Model
.
setExecuteUserIds
(
taskV2ModelOld
.
get
Create
UserId
());
taskV2Model
.
setExecuteUserIds
(
taskV2ModelOld
.
get
Rec
UserId
());
taskV2Model
.
setExtras
(
JSON
.
toJSONString
(
jgInstallationNotice
));
taskV2Model
.
setRelationId
(
jgInstallationNotice
.
getInstanceId
());
Map
<
String
,
Object
>
userOrgRoleMap
=
FeignUtil
.
remoteCall
(()
->
Privilege
.
userOrgRoleClient
.
getme
());
...
...
@@ -869,15 +899,15 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
public
void
buildTaskModel
(
TaskV2Model
model
){
ReginParams
reginParams
=
JSONObject
.
parseObject
(
redisUtils
.
get
(
RedisKey
.
buildReginKey
(
RequestContext
.
getExeUserId
(),
RequestContext
.
getToken
())).
toString
(),
ReginParams
.
class
);
//
ReginParams reginParams = JSONObject.parseObject(redisUtils.get(RedisKey.buildReginKey(RequestContext.getExeUserId(), RequestContext.getToken())).toString(), ReginParams.class);
model
.
setStartDate
(
new
Date
());
model
.
setStartUserId
(
reginParams
.
getUserModel
().
getUserId
());
model
.
setTaskSource
(
"workFlow"
);
model
.
setCreateDate
(
new
Date
());
model
.
setFinishStatus
(
Boolean
.
FALSE
);
model
.
setCreateUserId
(
reginParams
.
getUserModel
().
getUserId
());
model
.
setAgencyCode
(
reginParams
.
getUserModel
().
getAgencyCode
());
model
.
setTaskTitle
(
reginParams
.
getUserModel
().
getRealName
()
+
"发起了"
+
model
.
getTaskTitle
());
model
.
setAgencyCode
(
"tzs"
);
model
.
setCreateUserId
(
RequestContext
.
getExeUserId
());
model
.
setStartUserId
(
RequestContext
.
getExeUserId
());
model
.
setTaskTitle
(
"发起了"
+
model
.
getTaskTitle
());
Systemctl
.
taskV2Client
.
create
(
model
);
}
...
...
@@ -923,6 +953,14 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
public
void
updateByWorkFlow
(
JSONObject
jsonObject
)
{
JgInstallationNotice
jgInstallationNotice
=
this
.
getById
(
jsonObject
.
get
(
"businessId"
).
toString
());
List
<
String
>
list
=
(
List
<
String
>)
jsonObject
.
get
(
"candidateGroups"
);
JSONArray
executor
=
parseArray
(
jsonObject
.
get
(
"executor"
).
toString
());
List
<
String
>
userList
=
new
ArrayList
<>();
for
(
Object
datum
:
executor
)
{
if
(((
Map
)
datum
).
containsKey
(
"userId"
))
{
userList
.
add
(((
Map
)
datum
).
get
(
"userId"
).
toString
());
}
}
String
userIds
=
String
.
join
(
","
,
userList
);
jgInstallationNotice
.
setInstanceId
(
jsonObject
.
get
(
"processInstanceId"
).
toString
());
jgInstallationNotice
.
setNextExecuteIds
(
String
.
join
(
","
,
list
));
jgInstallationNotice
.
setInstanceStatus
(
jgInstallationNotice
.
getInstanceStatus
()
+
","
+
String
.
join
(
","
,
list
));
...
...
@@ -931,10 +969,11 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
// 代办业务
TaskV2Model
taskV2Model
=
new
TaskV2Model
();
//获取待办任务执行人
List
<
AgencyUserModel
>
userList
=
Privilege
.
agencyUserClient
.
queryByRoleId
(
jgInstallationNotice
.
getNextExecuteIds
(),
null
,
Boolean
.
FALSE
).
getResult
();
List
<
String
>
userIds
=
userList
.
stream
().
map
(
AgencyUserModel:
:
getUserId
).
collect
(
Collectors
.
toList
());
taskV2Model
.
setExecuteUserIds
(
CollectionUtils
.
isEmpty
(
userIds
)?
""
:
String
.
join
(
","
,
userIds
));
// List<AgencyUserModel> userList = Privilege.agencyUserClient
// .queryByRoleId(jgInstallationNotice.getNextExecuteIds(), null,Boolean.FALSE).getResult();
// List<String> userIds = userList.stream().map(AgencyUserModel::getUserId).collect(Collectors.toList());
taskV2Model
.
setExecuteUserIds
(
userIds
);
taskV2Model
.
setExtras
(
JSON
.
toJSONString
(
jgInstallationNotice
));
taskV2Model
.
setRelationId
(
jgInstallationNotice
.
getInstanceId
());
taskV2Model
.
setTaskType
(
"installNotice"
);
...
...
@@ -947,6 +986,8 @@ public class JgInstallationNoticeServiceImpl extends BaseService<JgInstallationN
taskV2Model
.
setTaskStatus
(
FlowStatusEnum
.
TO_BE_PROCESSED
.
getCode
());
taskV2Model
.
setTaskStatusLabel
(
FlowStatusEnum
.
TO_BE_PROCESSED
.
getName
());
taskV2Model
.
setTaskCode
(
jgInstallationNotice
.
getApplyNo
());
taskV2Model
.
setStartUserId
(
jgInstallationNotice
.
getCreateUserId
());
taskV2Model
.
setCreateUserId
(
jgInstallationNotice
.
getCreateUserId
());
buildTaskModel
(
taskV2Model
);
}
...
...
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