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
1c603dfa
Commit
1c603dfa
authored
Jan 06, 2022
by
lijingjing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
编号规则处理;
parent
1775bc9f
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
87 additions
and
38 deletions
+87
-38
IEntrustSampleService.java
...loud/service/lims/hmhj/service/IEntrustSampleService.java
+2
-0
EntrustReportServiceImpl.java
...vice/lims/hmhj/service/impl/EntrustReportServiceImpl.java
+14
-4
EntrustSampleServiceImpl.java
...vice/lims/hmhj/service/impl/EntrustSampleServiceImpl.java
+32
-0
EntrustServiceImpl.java
...ud/service/lims/hmhj/service/impl/EntrustServiceImpl.java
+39
-34
No files found.
src/main/java/com/patzn/cloud/service/lims/hmhj/service/IEntrustSampleService.java
View file @
1c603dfa
...
@@ -123,6 +123,8 @@ public interface IEntrustSampleService extends IBaseService<EntrustSample> {
...
@@ -123,6 +123,8 @@ public interface IEntrustSampleService extends IBaseService<EntrustSample> {
String
getNewCode
(
String
queryKey
,
int
lens
);
String
getNewCode
(
String
queryKey
,
int
lens
);
String
getNewCode
(
String
queryKey
,
int
start
,
int
lens
);
EntrustSample
getByContractId
(
Long
contractId
);
EntrustSample
getByContractId
(
Long
contractId
);
boolean
saveOrUpdateInfoBatch
(
List
<
EntrustSample
>
sampleList
);
boolean
saveOrUpdateInfoBatch
(
List
<
EntrustSample
>
sampleList
);
...
...
src/main/java/com/patzn/cloud/service/lims/hmhj/service/impl/EntrustReportServiceImpl.java
View file @
1c603dfa
...
@@ -6,7 +6,6 @@ import com.baomidou.mybatisplus.mapper.Wrapper;
...
@@ -6,7 +6,6 @@ import com.baomidou.mybatisplus.mapper.Wrapper;
import
com.baomidou.mybatisplus.plugins.Page
;
import
com.baomidou.mybatisplus.plugins.Page
;
import
com.baomidou.mybatisplus.toolkit.CollectionUtils
;
import
com.baomidou.mybatisplus.toolkit.CollectionUtils
;
import
com.baomidou.mybatisplus.toolkit.IdWorker
;
import
com.baomidou.mybatisplus.toolkit.IdWorker
;
import
com.baomidou.mybatisplus.toolkit.StringUtils
;
import
com.google.common.collect.Lists
;
import
com.google.common.collect.Lists
;
import
com.patzn.cloud.commons.api.RestAssert
;
import
com.patzn.cloud.commons.api.RestAssert
;
import
com.patzn.cloud.commons.controller.Account
;
import
com.patzn.cloud.commons.controller.Account
;
...
@@ -31,6 +30,7 @@ import com.patzn.cloud.service.lims.hmhj.mapper.EntrustReportMapper;
...
@@ -31,6 +30,7 @@ import com.patzn.cloud.service.lims.hmhj.mapper.EntrustReportMapper;
import
com.patzn.cloud.service.lims.hmhj.original.OriginalUtil
;
import
com.patzn.cloud.service.lims.hmhj.original.OriginalUtil
;
import
com.patzn.cloud.service.lims.hmhj.service.*
;
import
com.patzn.cloud.service.lims.hmhj.service.*
;
import
org.apache.commons.lang3.ArrayUtils
;
import
org.apache.commons.lang3.ArrayUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.poi.ss.util.CellRangeAddress
;
import
org.apache.poi.ss.util.CellRangeAddress
;
import
org.apache.poi.xssf.usermodel.*
;
import
org.apache.poi.xssf.usermodel.*
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.BeanUtils
;
...
@@ -206,16 +206,20 @@ public class EntrustReportServiceImpl extends BaseServiceImpl<EntrustReportMappe
...
@@ -206,16 +206,20 @@ public class EntrustReportServiceImpl extends BaseServiceImpl<EntrustReportMappe
if
(
CollectionUtils
.
isEmpty
(
sampleList
))
{
if
(
CollectionUtils
.
isEmpty
(
sampleList
))
{
return
;
return
;
}
}
// 正常情况下,所有的样品数据一级编码都不能为空
Map
<
String
,
String
>
sampleMap
=
sampleList
.
stream
().
collect
(
Collectors
.
toMap
(
t
->
{
Map
<
String
,
String
>
sampleMap
=
sampleList
.
stream
().
collect
(
Collectors
.
toMap
(
t
->
{
if
(
StringUtils
.
isNotEmpty
(
t
.
getThirdCode
()))
{
if
(
StringUtils
.
isNotEmpty
(
t
.
getThirdCode
()))
{
return
t
.
getThirdCode
();
return
t
.
getThirdCode
();
}
else
if
(
StringUtils
.
isNotEmpty
(
t
.
getSecondCode
()))
{
}
else
if
(
StringUtils
.
isNotEmpty
(
t
.
getSecondCode
()))
{
return
t
.
getSecondCode
();
return
t
.
getSecondCode
();
}
else
{
}
else
if
(
StringUtils
.
isNotBlank
(
t
.
getFirstCode
()))
{
return
t
.
getFirstCode
();
return
t
.
getFirstCode
();
}
else
{
return
t
.
getCode
();
}
}
},
EntrustSample:
:
getFirstCode
));
},
t
->
{
return
StringUtils
.
isNotBlank
(
t
.
getFirstCode
())
?
t
.
getFirstCode
()
:
t
.
getCode
();
}));
// objectKey data
// objectKey data
InputStream
is
=
ossClient
.
download
(
report
.
getObjectKey
());
InputStream
is
=
ossClient
.
download
(
report
.
getObjectKey
());
...
@@ -236,6 +240,9 @@ public class EntrustReportServiceImpl extends BaseServiceImpl<EntrustReportMappe
...
@@ -236,6 +240,9 @@ public class EntrustReportServiceImpl extends BaseServiceImpl<EntrustReportMappe
for
(
int
i
=
1
;
i
<
rowNum
;
i
++)
{
for
(
int
i
=
1
;
i
<
rowNum
;
i
++)
{
startRow
=
i
;
startRow
=
i
;
XSSFRow
xssfRow
=
sheet
.
getRow
(
i
);
XSSFRow
xssfRow
=
sheet
.
getRow
(
i
);
if
(
null
==
xssfRow
)
{
continue
;
}
for
(
int
j
=
0
;
j
<
xssfRow
.
getLastCellNum
();
j
++)
{
for
(
int
j
=
0
;
j
<
xssfRow
.
getLastCellNum
();
j
++)
{
String
title
=
getCellValue
(
xssfRow
,
j
);
String
title
=
getCellValue
(
xssfRow
,
j
);
if
(
"试样编号"
.
equals
(
title
))
{
if
(
"试样编号"
.
equals
(
title
))
{
...
@@ -247,6 +254,9 @@ public class EntrustReportServiceImpl extends BaseServiceImpl<EntrustReportMappe
...
@@ -247,6 +254,9 @@ public class EntrustReportServiceImpl extends BaseServiceImpl<EntrustReportMappe
for
(
int
i
=
startRow
+
1
;
i
<
rowNum
;
i
++)
{
for
(
int
i
=
startRow
+
1
;
i
<
rowNum
;
i
++)
{
XSSFRow
xssfRow
=
sheet
.
getRow
(
i
);
XSSFRow
xssfRow
=
sheet
.
getRow
(
i
);
if
(
null
==
xssfRow
)
{
continue
;
}
String
sampleCode
=
getCellValue
(
xssfRow
,
sampleCodePos
);
String
sampleCode
=
getCellValue
(
xssfRow
,
sampleCodePos
);
if
(
org
.
apache
.
commons
.
lang3
.
StringUtils
.
isBlank
(
sampleCode
))
{
if
(
org
.
apache
.
commons
.
lang3
.
StringUtils
.
isBlank
(
sampleCode
))
{
continue
;
continue
;
...
...
src/main/java/com/patzn/cloud/service/lims/hmhj/service/impl/EntrustSampleServiceImpl.java
View file @
1c603dfa
...
@@ -1936,6 +1936,38 @@ public class EntrustSampleServiceImpl extends BaseServiceImpl<EntrustSampleMappe
...
@@ -1936,6 +1936,38 @@ public class EntrustSampleServiceImpl extends BaseServiceImpl<EntrustSampleMappe
}
}
@Override
@Override
public
String
getNewCode
(
String
queryKey
,
int
start
,
int
lens
)
{
String
startKey
=
"000000000000000000"
;
// 长度默认1
lens
=
lens
==
0
?
1
:
lens
;
// 默认值:xxx___zz或者 xxxzz___此处使用替换
String
repSymbol
=
""
;
while
(
repSymbol
.
length
()
!=
lens
)
{
repSymbol
+=
"_"
;
}
String
repStr
=
startKey
.
substring
(
0
,
lens
-
1
)
+
1
;
String
defKey
=
queryKey
.
replace
(
repSymbol
,
repStr
);
// ==
if
(
StringUtils
.
isBlank
(
queryKey
))
{
return
defKey
;
}
String
lastCode
=
baseMapper
.
selectLastCode
(
queryKey
);
if
(
StringUtils
.
isBlank
(
lastCode
))
{
return
defKey
;
}
// 截取最大编号中的流水号信息
String
sampleSN
=
lastCode
.
substring
(
start
,
start
+
lens
);
try
{
Integer
nextSN
=
Integer
.
parseInt
(
sampleSN
)
+
1
;
repStr
=
startKey
.
substring
(
0
,
lens
-
nextSN
.
toString
().
length
())
+
nextSN
;
return
queryKey
.
replace
(
repSymbol
,
repStr
);
}
catch
(
NumberFormatException
e
)
{
logger
.
error
(
e
.
getMessage
(),
e
.
getCause
());
throw
new
PatznException
(
"样品编码流水号获取异常"
);
}
}
@Override
public
EntrustSample
getByContractId
(
Long
contractId
)
{
public
EntrustSample
getByContractId
(
Long
contractId
)
{
if
(
null
==
contractId
)
{
if
(
null
==
contractId
)
{
return
null
;
return
null
;
...
...
src/main/java/com/patzn/cloud/service/lims/hmhj/service/impl/EntrustServiceImpl.java
View file @
1c603dfa
...
@@ -250,43 +250,27 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
...
@@ -250,43 +250,27 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
}
}
// 原铝散样样品编号处理
// 原铝散样样品编号处理
else
if
(
CodeTypeEnum
.
AL_BULK_SAMPLE_CODE
==
codeType
)
{
else
if
(
CodeTypeEnum
.
AL_BULK_SAMPLE_CODE
==
codeType
)
{
// 替换槽号CH
sampleCode
=
sampleCode
.
replace
(
"CH"
,
sample
.
getSlotNo
());
// 根据当前系统时间获取班次
LocalTime
now
=
LocalTime
.
now
();
LocalTime
zero
=
LocalTime
.
parse
(
"00:00:00"
);
LocalTime
eight
=
LocalTime
.
parse
(
"08:00:00"
);
LocalTime
sixth
=
LocalTime
.
parse
(
"16:00:00"
);
String
clazz
;
if
(
now
.
isAfter
(
zero
)
&&
now
.
isBefore
(
eight
))
{
clazz
=
"E"
;
}
else
if
(
now
.
isAfter
(
eight
)
&&
now
.
isBefore
(
sixth
))
{
clazz
=
"A"
;
}
else
{
clazz
=
"C"
;
}
// 替换班次BC
// 替换班次BC
sampleCode
=
sampleCode
.
replace
(
"BC"
,
clazz
);
sampleCode
=
sampleCode
.
replace
(
"BC"
,
getShiftByNow
()
);
//
@yyMM&CH&BC&SN len(SN) = 3
//
YYMMDD+(A/C/E)+SN(1)+ 槽号(4)
String
queryKey
=
sampleCode
.
substring
(
0
,
sampleCode
.
length
()
-
3
);
String
queryKey
=
sampleCode
.
substring
(
0
,
7
)
+
"_"
+
sampleCode
.
substring
(
8
);
sampleCode
=
entrustSampleService
.
getNewCode
(
queryKey
,
3
);
sampleCode
=
entrustSampleService
.
getNewCode
(
queryKey
,
7
,
1
);
}
}
// 电解质散样样品编号处理
// 电解质散样样品编号处理
else
if
(
CodeTypeEnum
.
ELECT_BULK_SAMPLE_CODE
==
codeType
)
{
// else if (CodeTypeEnum.ELECT_BULK_SAMPLE_CODE == codeType) {
// 替换槽号CH
// // D+@yyMMdd&-&${et.slotNo}
sampleCode
=
sampleCode
.
replace
(
"CH"
,
sample
.
getSlotNo
());
// String queryKey = sampleCode.substring(0, sampleCode.length() - 3);
// @yyMM&CH&SN len(SN) = 3
// sampleCode = entrustSampleService.getNewCode(queryKey, 3);
String
queryKey
=
sampleCode
.
substring
(
0
,
sampleCode
.
length
()
-
3
);
// }
sampleCode
=
entrustSampleService
.
getNewCode
(
queryKey
,
3
);
//== 原铝重取样品编号处理
}
// add by meazty on 2022-01-06 14:42〔原铝重取不再根据以下规则生成,使用默认规则即可〕
//原铝重取样品编号处理
// else if (CodeTypeEnum.AL_RETAKE_SAMPLE_CODE == codeType) {
else
if
(
CodeTypeEnum
.
AL_RETAKE_SAMPLE_CODE
==
codeType
)
{
// // 替换槽号CH
// 替换槽号CH
// sampleCode = sampleCode.replace("CH", sample.getSlotNo());
sampleCode
=
sampleCode
.
replace
(
"CH"
,
sample
.
getSlotNo
());
// // @yyMMdd&CH&C&SN len(SN) = 1
// @yyMMdd&CH&C&SN len(SN) = 1
// String queryKey = sampleCode.substring(0, sampleCode.length() - 1);
String
queryKey
=
sampleCode
.
substring
(
0
,
sampleCode
.
length
()
-
1
);
// sampleCode = entrustSampleService.getNewCode(queryKey, 1);
sampleCode
=
entrustSampleService
.
getNewCode
(
queryKey
,
1
);
// }
}
}
}
if
(
StringUtils
.
isNotBlank
(
sampleCode
))
{
if
(
StringUtils
.
isNotBlank
(
sampleCode
))
{
...
@@ -306,6 +290,27 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
...
@@ -306,6 +290,27 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
}
}
}
}
/**
* 根据当前系统时间获取班次
* @return
*/
private
String
getShiftByNow
()
{
// 根据当前系统时间获取班次
LocalTime
now
=
LocalTime
.
now
();
LocalTime
zero
=
LocalTime
.
parse
(
"00:00:00"
);
LocalTime
eight
=
LocalTime
.
parse
(
"08:00:00"
);
LocalTime
sixth
=
LocalTime
.
parse
(
"16:00:00"
);
String
clazz
;
if
(
now
.
isAfter
(
zero
)
&&
now
.
isBefore
(
eight
))
{
clazz
=
"E"
;
}
else
if
(
now
.
isAfter
(
eight
)
&&
now
.
isBefore
(
sixth
))
{
clazz
=
"A"
;
}
else
{
clazz
=
"C"
;
}
return
clazz
;
}
// 验证样品非空字段
// 验证样品非空字段
private
void
judgeSampleFields
(
EntrustSample
sample
,
boolean
isRequiredFill
)
{
private
void
judgeSampleFields
(
EntrustSample
sample
,
boolean
isRequiredFill
)
{
if
(
isRequiredFill
)
{
if
(
isRequiredFill
)
{
...
...
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