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
ed3b38ed
Commit
ed3b38ed
authored
Jul 10, 2023
by
lijingjing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
部分内容更改;
parent
b67021fb
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
44 deletions
+23
-44
EntrustSampleServiceImpl.java
...vice/lims/hmhj/service/impl/EntrustSampleServiceImpl.java
+23
-44
No files found.
src/main/java/com/patzn/cloud/service/lims/hmhj/service/impl/EntrustSampleServiceImpl.java
View file @
ed3b38ed
...
...
@@ -19,6 +19,7 @@ import com.patzn.cloud.commons.toolkit.FileUtils;
import
com.patzn.cloud.commons.toolkit.IoUtils
;
import
com.patzn.cloud.commons.toolkit.MapMergeUtils
;
import
com.patzn.cloud.oss.starter.OssClient
;
import
com.patzn.cloud.service.BaseEntity
;
import
com.patzn.cloud.service.hmhj.dto.*
;
import
com.patzn.cloud.service.hmhj.entity.*
;
import
com.patzn.cloud.service.hmhj.enums.*
;
...
...
@@ -106,14 +107,11 @@ public class EntrustSampleServiceImpl extends BaseServiceImpl<EntrustSampleMappe
private
ServiceProperties
serviceProperties
;
@Resource
private
IUserInfoService
userInfoService
;
@Resource
private
RedisTemplate
<
String
,
String
>
redisTemplate
;
@Override
public
Page
<
EntrustSample
>
page
(
Page
<
EntrustSample
>
page
,
EntrustSample
entrustSample
)
{
Wrapper
wrapper
=
new
EntityWrapper
<>(
entrustSample
);
Wrapper
<
EntrustSample
>
wrapper
=
new
EntityWrapper
<>(
entrustSample
);
wrapper
.
orderAsc
(
Lists
.
newArrayList
(
"code"
,
"order_by"
));
return
this
.
page
(
page
,
wrapper
);
}
...
...
@@ -124,9 +122,7 @@ public class EntrustSampleServiceImpl extends BaseServiceImpl<EntrustSampleMappe
* @param list
*/
private
void
fillQualityCode
(
List
<?
extends
EntrustSample
>
list
)
{
CollectKit
.
forEach
(
list
,
d
->
{
d
.
setCode
(
d
.
getFirstCode
());
});
CollectKit
.
forEach
(
list
,
d
->
d
.
setCode
(
d
.
getFirstCode
()));
}
/**
...
...
@@ -135,9 +131,7 @@ public class EntrustSampleServiceImpl extends BaseServiceImpl<EntrustSampleMappe
* @param list
*/
private
void
fillAssayCode
(
List
<?
extends
EntrustSample
>
list
)
{
CollectKit
.
forEach
(
list
,
d
->
{
d
.
setCode
(
com
.
patzn
.
cloud
.
commons
.
toolkit
.
StringHandleUtils
.
nvl
(
d
.
getThirdCode
(),
d
.
getFirstCode
()));
});
CollectKit
.
forEach
(
list
,
d
->
d
.
setCode
(
com
.
patzn
.
cloud
.
commons
.
toolkit
.
StringHandleUtils
.
nvl
(
d
.
getThirdCode
(),
d
.
getFirstCode
())));
}
@Override
...
...
@@ -255,10 +249,6 @@ public class EntrustSampleServiceImpl extends BaseServiceImpl<EntrustSampleMappe
return
(
null
==
val1
?
0
:
val1
)
+
(
null
==
val2
?
0
:
val2
);
}
private
Double
getValSum
(
Double
val1
,
Double
val2
)
{
return
(
null
==
val1
?
0.0000
:
val1
)
+
(
null
==
val2
?
0.0000
:
val2
);
}
private
double
getPer
(
double
d
)
{
return
new
BigDecimal
(
d
).
setScale
(
2
,
RoundingMode
.
UP
).
doubleValue
();
}
...
...
@@ -383,9 +373,9 @@ public class EntrustSampleServiceImpl extends BaseServiceImpl<EntrustSampleMappe
val
.
setCVal
(
vo
.
getCVal
()).
setMnVal
(
vo
.
getMnVal
()).
setSiVal
(
vo
.
getSiVal
()).
setPVal
(
vo
.
getPVal
()).
setSVal
(
vo
.
getSVal
());
per
.
setCVal
(
vo
.
getCPer
()).
setMnVal
(
vo
.
getMnPer
()).
setSiVal
(
vo
.
getSiPer
()).
setPVal
(
vo
.
getPPer
()).
setSVal
(
vo
.
getSPer
());
ltNum
.
setCVal
(
vo
.
getCLtNum
()
+
""
).
setMnVal
(
vo
.
getMnLtNum
()
+
""
).
setSiVal
(
vo
.
getSiLtNum
()
+
""
).
setPVal
(
vo
.
getPLtNum
()
+
""
).
setSVal
(
CommonConstants
.
SYMBOL_CENTER_GANG
);
inNum
.
setCVal
(
vo
.
getCInNum
()
+
""
).
setMnVal
(
vo
.
getMnInNum
()
+
""
).
setSiVal
(
vo
.
getSiInNum
()
+
""
).
setPVal
(
vo
.
getPInNum
()
+
""
).
setSVal
(
vo
.
getSInNum
()
+
""
);
gtNum
.
setCVal
(
vo
.
getCGtNum
()
+
""
).
setMnVal
(
vo
.
getMnGtNum
()
+
""
).
setSiVal
(
vo
.
getSiGtNum
()
+
""
).
setPVal
(
vo
.
getPGtNum
()
+
""
).
setSVal
(
vo
.
getSGtNum
()
+
""
);
ltNum
.
setCVal
(
String
.
valueOf
(
vo
.
getCLtNum
())).
setMnVal
(
String
.
valueOf
(
vo
.
getMnLtNum
())).
setSiVal
(
String
.
valueOf
(
vo
.
getSiLtNum
())).
setPVal
(
String
.
valueOf
(
vo
.
getPLtNum
())
).
setSVal
(
CommonConstants
.
SYMBOL_CENTER_GANG
);
inNum
.
setCVal
(
String
.
valueOf
(
vo
.
getCInNum
())).
setMnVal
(
String
.
valueOf
(
vo
.
getMnInNum
())).
setSiVal
(
String
.
valueOf
(
vo
.
getSiInNum
())).
setPVal
(
String
.
valueOf
(
vo
.
getPInNum
())).
setSVal
(
String
.
valueOf
(
vo
.
getSInNum
())
);
gtNum
.
setCVal
(
String
.
valueOf
(
vo
.
getCGtNum
())).
setMnVal
(
String
.
valueOf
(
vo
.
getMnGtNum
())).
setSiVal
(
String
.
valueOf
(
vo
.
getSiGtNum
())).
setPVal
(
String
.
valueOf
(
vo
.
getPGtNum
())).
setSVal
(
String
.
valueOf
(
vo
.
getSGtNum
())
);
result
.
put
(
vo
.
getPeriod
(),
Lists
.
newArrayList
(
val
,
per
,
ltNum
,
inNum
,
gtNum
));
}
...
...
@@ -405,10 +395,9 @@ public class EntrustSampleServiceImpl extends BaseServiceImpl<EntrustSampleMappe
List
<
EntrustSample
>
sampleList
=
getByEntrustId
(
entrust
.
getId
());
RestAssert
.
fail
(
CollectionUtils
.
isEmpty
(
sampleList
),
String
.
format
(
"编号为【%s】的委托下样品为空"
,
entrust
.
getCode
()));
logger
.
error
(
"样品数量:{}"
,
sampleList
.
size
());
Long
[]
sampleIds
=
sampleList
.
stream
().
map
(
EntrustSample:
:
getId
).
toArray
(
size
->
new
Long
[
size
]
);
Long
[]
sampleIds
=
sampleList
.
stream
().
map
(
EntrustSample:
:
getId
).
toArray
(
Long
[]::
new
);
prints
(
"样品的下一级流程"
,
nextFlowStatus
);
//
EntrustSample
updateSample
=
new
EntrustSample
();
EntrustSampleItem
updateItem
=
new
EntrustSampleItem
();
EntrustSampleStatusEnum
sampleStatus
=
null
;
EntrustSampleItemStatusEnum
itemStatus
=
null
;
...
...
@@ -456,12 +445,9 @@ public class EntrustSampleServiceImpl extends BaseServiceImpl<EntrustSampleMappe
itemStatus
=
EntrustSampleItemStatusEnum
.
END
;
}
prints
(
"样品即将更新"
,
sampleStatus
);
prints
(
"项目即将更新"
,
itemStatus
);
// 哪一级别
int
whichLevel
=
1
;
int
nextFlowVal
=
nextFlowStatus
.
getValue
()
.
intValue
()
;
int
nextFlowVal
=
nextFlowStatus
.
getValue
();
// 用数字代码写的少,小于3,草稿和委托评审,对于编码级别不变
// 在等于4,用于二级编码
// 在大于4,小于14,用三级编码,若三级编码不存在,用二级编码
...
...
@@ -513,7 +499,7 @@ public class EntrustSampleServiceImpl extends BaseServiceImpl<EntrustSampleMappe
EntrustStatusEnum
statusEnum
=
entrust
.
getStatus
();
List
<
EntrustSample
>
sampleList
=
getByEntrustId
(
entrust
.
getId
());
RestAssert
.
fail
(
CollectionUtils
.
isEmpty
(
sampleList
),
String
.
format
(
"编号为【%s】委托下样品为空"
,
entrust
.
getCode
()));
Long
[]
sampleIds
=
sampleList
.
stream
().
map
(
t
->
t
.
getId
()).
toArray
(
size
->
new
Long
[
size
]
);
Long
[]
sampleIds
=
sampleList
.
stream
().
map
(
BaseEntity:
:
getId
).
toArray
(
Long
[]::
new
);
//
EntrustSample
updateSample
=
new
EntrustSample
();
EntrustSampleItem
updateItem
=
new
EntrustSampleItem
();
...
...
@@ -575,12 +561,12 @@ public class EntrustSampleServiceImpl extends BaseServiceImpl<EntrustSampleMappe
if
(
null
!=
sampleStatus
)
{
updateSample
.
setStatus
(
sampleStatus
);
updateSample
.
setProgress
(
sampleStatus
);
update
(
updateSample
,
Condition
.
create
().
eq
(
"entrust_id"
,
entrust
.
getId
()));
update
(
updateSample
,
Condition
.
<
EntrustSample
>
wrapper
().
eq
(
"entrust_id"
,
entrust
.
getId
()));
}
if
(
null
!=
itemStatus
)
{
updateItem
.
setStatus
(
itemStatus
);
updateItem
.
setProgress
(
itemStatus
);
entrustSampleItemService
.
update
(
updateItem
,
Condition
.
create
().
in
(
"entrust_sample_id"
,
sampleIds
));
entrustSampleItemService
.
update
(
updateItem
,
Condition
.
<
EntrustSampleItem
>
wrapper
().
in
(
"entrust_sample_id"
,
sampleIds
));
}
return
false
;
}
...
...
@@ -602,7 +588,7 @@ public class EntrustSampleServiceImpl extends BaseServiceImpl<EntrustSampleMappe
Long
entrustId
=
sampleDTOList
.
get
(
0
).
getEntrustId
();
RestAssert
.
fail
(
null
==
entrustId
,
"委托ID为空"
);
// 添加后排序,不论是否成功添加标样
List
<
EntrustSample
>
sampleList
=
list
(
Condition
.
create
().
eq
(
"entrust_id"
,
entrustId
)
List
<
EntrustSample
>
sampleList
=
list
(
Condition
.
<
EntrustSample
>
wrapper
().
eq
(
"entrust_id"
,
entrustId
)
.
orderBy
(
"order_by"
,
true
).
orderBy
(
"ctime"
,
false
));
//
List
<
Integer
>
orderByList
=
sampleList
.
stream
().
map
(
EntrustSample:
:
getOrderBy
).
collect
(
Collectors
.
toList
());
...
...
@@ -720,21 +706,14 @@ public class EntrustSampleServiceImpl extends BaseServiceImpl<EntrustSampleMappe
public
List
<
EntrustSampleVO
>
obtainMakeInfo
(
Long
[]
ids
,
Account
account
)
{
RestAssert
.
fail
(
ArrayUtils
.
isEmpty
(
ids
),
"请选择要制备的样品"
);
List
<
EntrustSample
>
entrustSamples
=
super
.
list
(
Condition
.
create
().
in
(
"id"
,
ids
));
List
<
EntrustSample
>
entrustSamples
=
super
.
list
(
Condition
.
<
EntrustSample
>
wrapper
().
in
(
"id"
,
ids
));
RestAssert
.
fail
(
CollectionUtils
.
isEmpty
(
entrustSamples
),
"请选择要制备的样品"
);
List
<
Long
>
sampleIds
=
entrustSamples
.
stream
().
map
(
s
->
{
return
s
.
getId
();
}).
collect
(
Collectors
.
toList
());
List
<
EntrustSampleItem
>
itemList
=
entrustSampleItemService
.
list
(
Condition
.
create
().
in
(
"entrust_sample_id"
,
ids
));
List
<
EntrustSampleItem
>
itemList
=
entrustSampleItemService
.
list
(
Condition
.<
EntrustSampleItem
>
wrapper
().
in
(
"entrust_sample_id"
,
ids
));
RestAssert
.
fail
(
CollectionUtils
.
isEmpty
(
itemList
),
"所选择的样品不含检测项目,无法制备"
);
Set
<
Long
>
setSampleIds
=
itemList
.
stream
().
map
(
i
->
{
return
i
.
getEntrustSampleId
();
}).
collect
(
Collectors
.
toSet
());
Set
<
Long
>
setSampleIds
=
itemList
.
stream
().
map
(
EntrustSampleItem:
:
getEntrustSampleId
).
collect
(
Collectors
.
toSet
());
if
(
setSampleIds
.
size
()
!=
ids
.
length
)
{
RestAssert
.
fail
(
CollectionUtils
.
isEmpty
(
itemList
),
"所选择的样品有不含检测项目的,请确认"
);
...
...
@@ -809,7 +788,7 @@ public class EntrustSampleServiceImpl extends BaseServiceImpl<EntrustSampleMappe
List
<
EntrustSample
>
sampleList
=
getBatchIds
(
sampleIdList
);
RestAssert
.
fail
(
CollectionUtils
.
isEmpty
(
sampleList
),
"请选择要制备的样品"
);
List
<
EntrustSampleItem
>
itemList
=
entrustSampleItemService
.
list
(
Condition
.
create
().
in
(
"entrust_sample_id"
,
sampleIdList
));
List
<
EntrustSampleItem
>
itemList
=
entrustSampleItemService
.
list
(
Condition
.
<
EntrustSampleItem
>
wrapper
().
in
(
"entrust_sample_id"
,
sampleIdList
));
RestAssert
.
fail
(
CollectionUtils
.
isEmpty
(
itemList
),
"所选择的样品不含检测项目,无法制备"
);
//
Set
<
Long
>
setSampleIds
=
itemList
.
stream
().
map
(
EntrustSampleItem:
:
getEntrustSampleId
).
collect
(
Collectors
.
toSet
());
...
...
@@ -940,6 +919,7 @@ public class EntrustSampleServiceImpl extends BaseServiceImpl<EntrustSampleMappe
Entrust
entrust
=
entrustService
.
getById
(
entrustId
);
// 报告模板
EntrustReportTemplate
sysFileTemplate
=
entrustReportTemplateService
.
getById
(
templateId
);
RestAssert
.
fail
(
null
==
sysFileTemplate
,
"选择的报告模板不存在"
);
// 样品名称集合
Set
<
String
>
sampleNameSet
=
new
HashSet
<>();
// 样品检测项目集合
...
...
@@ -957,8 +937,7 @@ public class EntrustSampleServiceImpl extends BaseServiceImpl<EntrustSampleMappe
}
String
sampleName
=
StringHandleUtils
.
join
(
sampleNameSet
);
if
(
sysFileTemplate
.
getObjectKey
().
contains
(
".docx"
))
{
RestAssert
.
fail
(
null
==
sysFileTemplate
,
"选择的报告模板不存在"
);
if
(
StringUtils
.
contains
(
sysFileTemplate
.
getObjectKey
(),
".docx"
))
{
String
sampleShape
=
sampleList
.
get
(
0
).
getSampleShape
();
Map
<
String
,
Object
>
contractMap
=
new
HashMap
<>();
contractMap
.
put
(
"s"
,
entrust
);
...
...
@@ -1004,10 +983,10 @@ public class EntrustSampleServiceImpl extends BaseServiceImpl<EntrustSampleMappe
}
}
}
else
if
(
sysFileTemplate
.
getObjectKey
().
contains
(
".xlsx"
))
{
}
else
if
(
StringUtils
.
contains
(
sysFileTemplate
.
getObjectKey
(),
".xlsx"
))
{
// 指标信息,包含样品ID
List
<
EntrustSampleItemIndexVO
>
indexVOList
=
new
ArrayList
<>()
;
List
<
EntrustSampleItemIndexVO
>
indexVOList
;
// 是否获取项目中的指标
boolean
isInReportIndex
=
sysFileTemplate
.
getTemplateSampleNum
()
>=
sampleVOList
.
size
();
if
(
isInReportIndex
)
{
...
...
@@ -1029,7 +1008,7 @@ public class EntrustSampleServiceImpl extends BaseServiceImpl<EntrustSampleMappe
logger
.
error
(
"==== EntrustSampleServiceImpl ==== makeReport ====> 生成XSSFWorkbook时异常:"
,
e
);
}
List
<
EntrustReportTemplateConfig
>
configList
=
entrustReportTemplateConfigService
.
list
(
Condition
.
create
().
eq
(
"template_id"
,
templateId
));
List
<
EntrustReportTemplateConfig
>
configList
=
entrustReportTemplateConfigService
.
list
(
Condition
.
<
EntrustReportTemplateConfig
>
wrapper
().
eq
(
"template_id"
,
templateId
));
OriginalUtil
.
doReplace
(
xssfWorkbook
,
entrust
);
Map
<
String
,
String
>
mapReplace
=
new
HashMap
<>();
...
...
@@ -2166,7 +2145,7 @@ public class EntrustSampleServiceImpl extends BaseServiceImpl<EntrustSampleMappe
OriginalUtil
.
doReplace
(
xssfWorkbook
,
entrust
);
Map
<
String
,
String
>
mapReplace
=
new
HashMap
<>();
mapReplace
.
put
(
"#{nowDate}"
,
DateUtils
.
toYearMonthDay
(
new
Date
()));
mapReplace
.
put
(
"#{sampleNum}"
,
sampleVOList
.
size
()
+
""
);
mapReplace
.
put
(
"#{sampleNum}"
,
String
.
valueOf
(
sampleVOList
.
size
())
);
mapReplace
.
put
(
"#{sampleFrom}"
,
sampleVOList
.
size
()
>
0
?
sampleVOList
.
get
(
0
).
getSampleFrom
()
:
" - "
);
mapReplace
.
put
(
"#{sampleName}"
,
sampleVOList
.
get
(
0
).
getName
());
...
...
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