Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
platform
/
platform-process-server
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit cb78df64
authored
Jan 10, 2024
by
谢海旭
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
下发门店接口:instParam参数增加 商户名
1 parent
d9156447
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
3 deletions
platform-process/src/main/java/cn/com/glsx/process/modules/service/SopInstService.java
platform-process/src/main/java/cn/com/glsx/process/util/SopTplParamHandler.java
platform-process/src/main/java/cn/com/glsx/process/modules/service/SopInstService.java
View file @
cb78df6
...
@@ -381,7 +381,11 @@ public class SopInstService {
...
@@ -381,7 +381,11 @@ public class SopInstService {
sopInst
.
setInstId
(
tplId
+
grantId
);
sopInst
.
setInstId
(
tplId
+
grantId
);
sopInst
.
setGrantId
(
grantId
);
sopInst
.
setGrantId
(
grantId
);
// 处理模板定义的初始化参数
// 处理模板定义的初始化参数
sopInst
.
setInstParam
(
SopTplParamHandler
.
addMerchantId
(
SopTplParamHandler
.
extract
(
sopTplDTO
.
getTplParamDef
()),
sopTplGrant
.
getGroupId
())
);
String
instParam
=
SopTplParamHandler
.
extract
(
sopTplDTO
.
getTplParamDef
());
instParam
=
SopTplParamHandler
.
addMap2FirstLevel
(
instParam
,
"merchantId"
,
sopTplGrant
.
getGroupId
());
instParam
=
SopTplParamHandler
.
addMap2FirstLevel
(
instParam
,
"merchantName"
,
sopTplGrant
.
getGroupName
());
sopInst
.
setInstParam
(
instParam
);
sopInst
.
setCreateTime
(
date
);
sopInst
.
setCreateTime
(
date
);
sopInst
.
setUpdateTime
(
date
);
sopInst
.
setUpdateTime
(
date
);
sopInst
.
setInstStatus
(
SopInstStatusEnum
.
UNUSED
.
getValue
());
sopInst
.
setInstStatus
(
SopInstStatusEnum
.
UNUSED
.
getValue
());
...
...
platform-process/src/main/java/cn/com/glsx/process/util/SopTplParamHandler.java
View file @
cb78df6
...
@@ -17,6 +17,12 @@ import java.util.List;
...
@@ -17,6 +17,12 @@ import java.util.List;
public
class
SopTplParamHandler
{
public
class
SopTplParamHandler
{
public
ObjectMapper
objectMapper
=
new
ObjectMapper
();
public
ObjectMapper
objectMapper
=
new
ObjectMapper
();
/**
* 提取模板默认参数
*
* @param tplParam
* @return
*/
public
String
extract
(
String
tplParam
)
{
public
String
extract
(
String
tplParam
)
{
if
(!
StringUtils
.
hasLength
(
tplParam
))
{
if
(!
StringUtils
.
hasLength
(
tplParam
))
{
return
null
;
return
null
;
...
@@ -30,7 +36,15 @@ public class SopTplParamHandler {
...
@@ -30,7 +36,15 @@ public class SopTplParamHandler {
}
}
}
}
public
String
addMerchantId
(
String
paramJson
,
String
merchantId
)
{
/**
* 在json参数第一层添加key-value
*
* @param paramJson 目标json字符串
* @param key
* @param value
* @return
*/
public
String
addMap2FirstLevel
(
String
paramJson
,
String
key
,
String
value
)
{
if
(!
StringUtils
.
hasLength
(
paramJson
))
{
if
(!
StringUtils
.
hasLength
(
paramJson
))
{
return
null
;
return
null
;
}
}
...
@@ -38,7 +52,7 @@ public class SopTplParamHandler {
...
@@ -38,7 +52,7 @@ public class SopTplParamHandler {
try
{
try
{
JsonNode
jsonNode
=
objectMapper
.
readTree
(
paramJson
);
JsonNode
jsonNode
=
objectMapper
.
readTree
(
paramJson
);
ObjectNode
objectNode
=
(
ObjectNode
)
jsonNode
;
ObjectNode
objectNode
=
(
ObjectNode
)
jsonNode
;
objectNode
.
put
(
"merchantId"
,
merchantId
);
objectNode
.
put
(
key
,
value
);
return
objectNode
.
toString
();
return
objectNode
.
toString
();
}
catch
(
JsonProcessingException
e
)
{
}
catch
(
JsonProcessingException
e
)
{
throw
new
AdminException
(
ResultEnum
.
DATA_HANDLE_ERROR
.
getCode
(),
"参数转json对象异常"
);
throw
new
AdminException
(
ResultEnum
.
DATA_HANDLE_ERROR
.
getCode
(),
"参数转json对象异常"
);
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment