Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
8
8timerapiv200
Overview
Overview
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
8timerv2
8timerapiv200
Commits
d95940e8
Commit
d95940e8
authored
Oct 17, 2022
by
翁国栋
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
管理员删除附件
parent
11a4da75
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
82 additions
and
11 deletions
+82
-11
src/main/java/cn/timer/api/controller/spmk/SpmkController.java
+29
-0
src/main/java/cn/timer/api/utils/router/RequestDataUtils.java
+53
-11
No files found.
src/main/java/cn/timer/api/controller/spmk/SpmkController.java
View file @
d95940e8
...
@@ -1355,4 +1355,33 @@ public class SpmkController {
...
@@ -1355,4 +1355,33 @@ public class SpmkController {
}
}
return
ResultUtil
.
data
(
"添加附件成功"
);
return
ResultUtil
.
data
(
"添加附件成功"
);
}
}
@PostMapping
(
value
=
"/del_file"
)
@ApiOperation
(
value
=
"添加附件"
,
httpMethod
=
"POST"
,
notes
=
"添加附件"
)
@Log
(
title
=
"审批-添加附件"
,
businessType
=
BusinessType
.
OTHER
)
public
Result
<
Object
>
delFileList
(
@CurrentUser
UserBean
userBean
,
@RequestBody
ApprovingDto
approvingDto
)
{
QyzxEmpEntAsso
ent
=
QyzxEmpEntAsso
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
QyzxEmpEntAsso
>().
lambda
().
eq
(
QyzxEmpEntAsso:
:
getOrgCode
,
userBean
.
getOrgCode
()).
eq
(
QyzxEmpEntAsso:
:
getEmpNum
,
userBean
.
getEmpNum
()));
if
(
ent
!=
null
)
{
if
(
ent
.
getUserType
()
==
2
)
{
return
ResultUtil
.
error
(
"暂无权限"
);
}
}
SpmkApproveDetailSummary
ad
=
SpmkApproveDetailSummary
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
SpmkApproveDetailSummary
>()
.
lambda
()
.
select
(
SpmkApproveDetailSummary:
:
getId
,
SpmkApproveDetailSummary:
:
getRequestData
,
SpmkApproveDetailSummary:
:
getFroms
,
SpmkApproveDetailSummary:
:
getFlowChildren
)
.
eq
(
SpmkApproveDetailSummary:
:
getId
,
approvingDto
.
getAsId
()));
// 审批详情 审批时添加 附件
try
{
if
(
RequestDataUtils
.
delFileList
(
ad
,
approvingDto
.
getFileList
())){
ad
.
updateById
();
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
ResultUtil
.
data
(
"删除附件成功"
);
}
}
}
src/main/java/cn/timer/api/utils/router/RequestDataUtils.java
View file @
d95940e8
...
@@ -12,6 +12,7 @@ import java.util.List;
...
@@ -12,6 +12,7 @@ import java.util.List;
/**
/**
* 申请数据工具类
* 申请数据工具类
*
* @author wuqingjun
* @author wuqingjun
* @email 284718418@qq.com
* @email 284718418@qq.com
* @date 2022-07-13 10:05:49
* @date 2022-07-13 10:05:49
...
@@ -44,45 +45,86 @@ public class RequestDataUtils {
...
@@ -44,45 +45,86 @@ public class RequestDataUtils {
/**
/**
* 审批详情 审批时添加 附件
* 审批详情 审批时添加 附件
*
* @param spmkApproveDetailSummary 审批详情数据
* @param spmkApproveDetailSummary 审批详情数据
* @param fileList 新增数据
* @param fileList 新增数据
* @throws Exception
* @throws Exception
*/
*/
public
static
Boolean
addFileList
(
SpmkApproveDetailSummary
spmkApproveDetailSummary
,
List
<
JSONObject
>
fileList
)
throws
Exception
{
public
static
Boolean
addFileList
(
SpmkApproveDetailSummary
spmkApproveDetailSummary
,
List
<
JSONObject
>
fileList
)
throws
Exception
{
if
(
CollectionUtils
.
isEmpty
(
fileList
))
{
if
(
CollectionUtils
.
isEmpty
(
fileList
))
{
return
false
;
return
false
;
}
}
log
.
info
(
"fileList = {}"
,
fileList
);
log
.
info
(
"fileList = {}"
,
fileList
);
List
<
JSONObject
>
forms
=
jsonObject
.
parseArray
(
spmkApproveDetailSummary
.
getFroms
(),
JSONObject
.
class
);
List
<
JSONObject
>
forms
=
jsonObject
.
parseArray
(
spmkApproveDetailSummary
.
getFroms
(),
JSONObject
.
class
);
if
(
CollectionUtils
.
isEmpty
(
forms
))
{
if
(
CollectionUtils
.
isEmpty
(
forms
))
{
return
false
;
return
false
;
}
}
String
inputId
=
""
;
String
inputId
=
""
;
// 找到审批表单对应的附件节点 inputId
// 找到审批表单对应的附件节点 inputId
for
(
JSONObject
object:
forms
)
{
for
(
JSONObject
object
:
forms
)
{
if
(
FORMS_CLASS_NAME_VALUE
.
equals
(
object
.
get
(
FORMS_CLASS_NAME_KEY
))
/*&& FORMS_DISPLAY_NAME_VALUE.equals(object.get(FORMS_DISPLAY_NAME_KEY))*/
)
{
if
(
FORMS_CLASS_NAME_VALUE
.
equals
(
object
.
get
(
FORMS_CLASS_NAME_KEY
))
/*&& FORMS_DISPLAY_NAME_VALUE.equals(object.get(FORMS_DISPLAY_NAME_KEY))*/
)
{
inputId
=
object
.
get
(
FORMS_INPUTID_KEY
).
toString
();
inputId
=
object
.
get
(
FORMS_INPUTID_KEY
).
toString
();
break
;
break
;
}
}
}
}
if
(
StringUtils
.
isEmpty
(
inputId
)
||
inputId
.
length
()
<=
0
)
{
if
(
StringUtils
.
isEmpty
(
inputId
)
||
inputId
.
length
()
<=
0
)
{
log
.
info
(
"审批详情 >审批时添加附件 forms not file point."
);
log
.
info
(
"审批详情 >审批时添加附件 forms not file point."
);
return
false
;
return
false
;
}
}
log
.
info
(
"forms = {}"
,
forms
);
log
.
info
(
"forms = {}"
,
forms
);
JSONObject
requestData
=
jsonObject
.
parseObject
(
spmkApproveDetailSummary
.
getRequestData
(),
JSONObject
.
class
);
JSONObject
requestData
=
jsonObject
.
parseObject
(
spmkApproveDetailSummary
.
getRequestData
(),
JSONObject
.
class
);
if
(
StringUtils
.
isEmpty
(
requestData
))
{
if
(
StringUtils
.
isEmpty
(
requestData
))
{
return
false
;
return
false
;
}
}
// 找到 申请数据 对应节点 的数据
// 找到 申请数据 对应节点 的数据
JSONObject
value
=
(
JSONObject
)
requestData
.
get
(
inputId
);
JSONObject
value
=
(
JSONObject
)
requestData
.
get
(
inputId
);
JSONArray
v
=
(
JSONArray
)
value
.
get
(
FORMS_INPUTID_KEY_VALUE
);
JSONArray
v
=
(
JSONArray
)
value
.
get
(
FORMS_INPUTID_KEY_VALUE
);
// 添加 申请数据 对应节点 的数据
// 添加 申请数据 对应节点 的数据
v
.
addAll
(
fileList
);
v
.
addAll
(
fileList
);
log
.
info
(
"requestData = {}"
,
requestData
);
log
.
info
(
"requestData = {}"
,
requestData
);
spmkApproveDetailSummary
.
setRequestData
(
requestData
.
toJSONString
());
spmkApproveDetailSummary
.
setRequestData
(
requestData
.
toJSONString
());
return
true
;
return
true
;
}
}
/**
* 审批详情 审批时添加 附件
*
* @param spmkApproveDetailSummary 审批详情数据
* @param fileList 新增数据
* @throws Exception
*/
public
static
Boolean
delFileList
(
SpmkApproveDetailSummary
spmkApproveDetailSummary
,
List
<
JSONObject
>
fileList
)
throws
Exception
{
log
.
info
(
"fileList = {}"
,
fileList
);
List
<
JSONObject
>
forms
=
jsonObject
.
parseArray
(
spmkApproveDetailSummary
.
getFroms
(),
JSONObject
.
class
);
if
(
CollectionUtils
.
isEmpty
(
forms
))
{
return
false
;
}
String
inputId
=
""
;
// 找到审批表单对应的附件节点 inputId
for
(
JSONObject
object
:
forms
)
{
if
(
FORMS_CLASS_NAME_VALUE
.
equals
(
object
.
get
(
FORMS_CLASS_NAME_KEY
))
/*&& FORMS_DISPLAY_NAME_VALUE.equals(object.get(FORMS_DISPLAY_NAME_KEY))*/
)
{
inputId
=
object
.
get
(
FORMS_INPUTID_KEY
).
toString
();
break
;
}
}
if
(
StringUtils
.
isEmpty
(
inputId
)
||
inputId
.
length
()
<=
0
)
{
log
.
info
(
"审批详情 >审批时添加附件 forms not file point."
);
return
false
;
}
log
.
info
(
"forms = {}"
,
forms
);
JSONObject
requestData
=
jsonObject
.
parseObject
(
spmkApproveDetailSummary
.
getRequestData
(),
JSONObject
.
class
);
if
(
StringUtils
.
isEmpty
(
requestData
))
{
return
false
;
}
// 找到 申请数据 对应节点 的数据
JSONObject
value
=
(
JSONObject
)
requestData
.
get
(
inputId
);
JSONArray
v
=
(
JSONArray
)
value
.
get
(
FORMS_INPUTID_KEY_VALUE
);
v
.
clear
();
if
(
fileList
.
size
()>=
0
)
{
v
.
addAll
(
fileList
);
}
spmkApproveDetailSummary
.
setRequestData
(
requestData
.
toJSONString
());
return
true
;
}
}
}
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