Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
patzn-cloud-service-hmhj
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wangweidong
patzn-cloud-service-hmhj
Commits
0f3c2618
Commit
0f3c2618
authored
Jul 10, 2021
by
ghxdhr
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改检测委托书的打印状态
parent
7cac6acc
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
44 additions
and
6 deletions
+44
-6
EntrustController.java
...cloud/service/lims/hmhj/controller/EntrustController.java
+9
-0
IEntrustService.java
...atzn/cloud/service/lims/hmhj/service/IEntrustService.java
+3
-0
EntrustServiceImpl.java
...ud/service/lims/hmhj/service/impl/EntrustServiceImpl.java
+32
-6
No files found.
src/main/java/com/patzn/cloud/service/lims/hmhj/controller/EntrustController.java
View file @
0f3c2618
package
com
.
patzn
.
cloud
.
service
.
lims
.
hmhj
.
controller
;
import
com.baomidou.kisso.annotation.Action
;
import
com.baomidou.kisso.annotation.Login
;
import
com.google.common.collect.Lists
;
import
com.patzn.cloud.service.hmhj.dto.EntrustDTO
;
import
com.patzn.cloud.service.hmhj.entity.Entrust
;
...
...
@@ -846,4 +848,11 @@ public class EntrustController extends ServiceController {
return
success
(
entrustService
.
exportEntrust
(
ids
,
response
));
}
/* 打印检测委托书完成后的ajax调用,先使用未登录方式 */
@ApiOperation
(
"修改检测委托书打印状态"
)
@Login
(
action
=
Action
.
Skip
)
@PostMapping
(
"/update_print_status"
)
public
RestResult
<
Boolean
>
updatePrintStatus
(
@RequestParam
(
"ids"
)
List
<
Long
>
ids
)
{
return
success
(
entrustService
.
updatePrintStatus
(
ids
));
}
}
src/main/java/com/patzn/cloud/service/lims/hmhj/service/IEntrustService.java
View file @
0f3c2618
...
...
@@ -93,4 +93,7 @@ public interface IEntrustService extends IBaseService<Entrust> {
boolean
rejectSubmitApply
(
Long
id
,
String
reason
,
Account
account
);
Boolean
exportEntrust
(
List
<
Long
>
ids
,
HttpServletResponse
response
);
/* 修改检测委托书的打印状态 */
Boolean
updatePrintStatus
(
List
<
Long
>
ids
);
}
src/main/java/com/patzn/cloud/service/lims/hmhj/service/impl/EntrustServiceImpl.java
View file @
0f3c2618
...
...
@@ -1267,6 +1267,24 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
return
false
;
}
/* 修改检测委托书的状态 */
@Override
public
Boolean
updatePrintStatus
(
List
<
Long
>
ids
)
{
if
(
CollectionUtils
.
isNotEmpty
(
ids
))
{
List
<
Entrust
>
entrusts
=
ids
.
stream
().
map
(
id
->
{
Entrust
entrust
=
new
Entrust
();
entrust
.
setId
(
id
);
entrust
.
setPrintStatus
(
1
);
return
entrust
;
}).
collect
(
Collectors
.
toList
());
/* 删除上传的文件 */
List
<
EntrustAnnex
>
entrustAnnex
=
entrustAnnexService
.
list
(
Condition
.
create
().
in
(
"entrust_id"
,
ids
));
ossClient
.
deleteObjects
(
entrustAnnex
.
stream
().
map
(
ea
->
ea
.
getObjectKey
()).
collect
(
Collectors
.
toList
()));
return
this
.
updateBatchById
(
entrusts
);
}
return
true
;
}
private
ByteArrayOutputStream
getEntrustBaos
()
{
InputStream
inputStream
=
this
.
getClass
().
getClassLoader
().
getResourceAsStream
(
"\\templates.\\word.\\entrust.\\EntrustExportTemplate.docx"
);
RestAssert
.
fail
(
null
==
inputStream
,
"委托检测书模板获取失败"
);
...
...
@@ -1304,9 +1322,18 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
filter
(
s
->
entrust
.
getId
().
equals
(
s
.
getEntrustId
())).
collect
(
Collectors
.
toList
());
/* 该样品对应的项目 */
List
<
EntrustSampleItem
>
currItems
=
items
.
stream
()
List
<
EntrustSampleItem
>
currItems
=
new
ArrayList
<>();
if
(
CollectionUtils
.
isNotEmpty
(
samples
))
{
/* 该样品对应的项目 */
currItems
=
items
.
stream
()
.
filter
(
i
->
samples
.
get
(
0
).
getId
().
equals
(
i
.
getEntrustSampleId
()))
.
collect
(
Collectors
.
toList
());
dataMap
.
put
(
"sample"
,
samples
.
get
(
0
));
}
else
{
dataMap
.
put
(
"sample"
,
new
EntrustSample
());
}
/* 委托*/
dataMap
.
put
(
"entrust"
,
entrust
);
/* 项目名 */
Set
<
String
>
itemNames
=
currItems
.
stream
().
filter
(
i
->
StringUtils
.
isNotEmpty
(
i
.
getName
()))
.
map
(
i
->
i
.
getName
()).
collect
(
Collectors
.
toSet
());
...
...
@@ -1314,7 +1341,10 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
Set
<
String
>
standards
=
currItems
.
stream
()
.
filter
(
i
->
StringUtils
.
isNotEmpty
(
i
.
getStandard
()))
.
map
(
i
->
i
.
getStandard
()).
collect
(
Collectors
.
toSet
());
dataMap
.
put
(
"entrust"
,
entrust
);
dataMap
.
put
(
"itemNames"
,
ListToStringUtils
.
listToString
(
itemNames
,
"、"
,
gangCode
));
dataMap
.
put
(
"standards"
,
ListToStringUtils
.
listToString
(
standards
,
"、"
,
gangCode
));
/* 委托时间和样品接收时间 */
dataMap
.
put
(
"entrustTimeStr"
,
StringHandleUtils
.
parse
(
DateUtils
.
toYearMonthDay
(
entrust
.
getEntrustTime
()),
gangCode
));
dataMap
.
put
(
"entrustTimeStrCn"
,
StringHandleUtils
.
parse
(
DateUtils
.
toYearMonthDayChinese
(
entrust
.
getEntrustTime
()),
gangCode
));
...
...
@@ -1324,10 +1354,6 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
dataMap
.
put
(
"receiveTimeStrCn"
,
StringHandleUtils
.
parse
(
DateUtils
.
toYearMonthDayChinese
(
entrust
.
getReceiveTime
()),
gangCode
));
dataMap
.
put
(
"receiveTimeStrPoint"
,
StringHandleUtils
.
parse
(
DateUtils
.
toYearMonthDayPoint
(
entrust
.
getReceiveTime
()),
gangCode
));
dataMap
.
put
(
"sample"
,
samples
.
get
(
0
));
dataMap
.
put
(
"itemNames"
,
ListToStringUtils
.
listToString
(
itemNames
,
"、"
,
gangCode
));
dataMap
.
put
(
"standards"
,
ListToStringUtils
.
listToString
(
standards
,
"、"
,
gangCode
));
XWPFTemplate
template
=
XWPFTemplate
.
compile
(
new
ByteArrayInputStream
(
baos
.
toByteArray
())).
setDefaultValue
(
"/"
).
render
(
dataMap
);
String
filePath
=
filePathPrefix
+
entrust
.
getCode
()
+
"检测委托书.docx"
;
File
file
=
new
File
(
filePath
);
...
...
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