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
c0a7a341
Commit
c0a7a341
authored
Jan 06, 2022
by
lijingjing
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
编号规则处理;
parent
1c603dfa
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
30 additions
and
87 deletions
+30
-87
DateKit.java
...ain/java/com/patzn/cloud/service/lims/common/DateKit.java
+20
-4
IContractSamplingService.java
...d/service/lims/hmhj/service/IContractSamplingService.java
+0
-2
ContractSamplingServiceImpl.java
...e/lims/hmhj/service/impl/ContractSamplingServiceImpl.java
+8
-58
EntrustServiceImpl.java
...ud/service/lims/hmhj/service/impl/EntrustServiceImpl.java
+2
-23
No files found.
src/main/java/com/patzn/cloud/service/lims/common/DateKit.java
View file @
c0a7a341
...
...
@@ -2,10 +2,7 @@ package com.patzn.cloud.service.lims.common;
import
com.patzn.cloud.commons.constant.CommonConstants
;
import
java.time.LocalDate
;
import
java.time.Period
;
import
java.time.ZoneId
;
import
java.time.ZonedDateTime
;
import
java.time.*
;
import
java.time.format.DateTimeFormatter
;
import
java.util.ArrayList
;
import
java.util.Date
;
...
...
@@ -93,4 +90,23 @@ public class DateKit {
LocalDate
start
=
LocalDate
.
parse
(
yearMonth
+
"-01"
,
DateTimeFormatter
.
ofPattern
(
CommonConstants
.
YEAR_MONTH_DAY
));
return
dateBetweenTwoDates
(
start
,
start
.
plusMonths
(
1
));
}
/**
* 根据当前系统时间获取班次
* @return
*/
public
static
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
=
"C"
;
if
(
now
.
isAfter
(
zero
)
&&
now
.
isBefore
(
eight
))
{
clazz
=
"E"
;
}
else
if
(
now
.
isAfter
(
eight
)
&&
now
.
isBefore
(
sixth
))
{
clazz
=
"A"
;
}
return
clazz
;
}
}
src/main/java/com/patzn/cloud/service/lims/hmhj/service/IContractSamplingService.java
View file @
c0a7a341
...
...
@@ -28,6 +28,4 @@ public interface IContractSamplingService extends IBaseService<ContractSampling>
boolean
saveOrUpdateInfoBatch
(
List
<
ContractSampling
>
sampleList
);
boolean
updateSampling
(
ContractSampling
contractSampling
);
String
getNewCode
(
String
queryKey
,
int
lens
);
}
src/main/java/com/patzn/cloud/service/lims/hmhj/service/impl/ContractSamplingServiceImpl.java
View file @
c0a7a341
...
...
@@ -8,7 +8,6 @@ import com.baomidou.mybatisplus.toolkit.CollectionUtils;
import
com.patzn.cloud.commons.api.RestAssert
;
import
com.patzn.cloud.commons.controller.Account
;
import
com.patzn.cloud.commons.controller.LoginHelper
;
import
com.patzn.cloud.commons.exception.PatznException
;
import
com.patzn.cloud.commons.service.impl.BaseServiceImpl
;
import
com.patzn.cloud.feign.base.client.SysOrgClient
;
import
com.patzn.cloud.feign.lims.hmhj.client.LmsChemicalCategoryClient
;
...
...
@@ -17,6 +16,7 @@ import com.patzn.cloud.service.hmhj.entity.*;
import
com.patzn.cloud.service.hmhj.enums.CodeTypeEnum
;
import
com.patzn.cloud.service.hmhj.vo.ContractSamplingVO
;
import
com.patzn.cloud.service.lims.chemical.entity.LmsChemicalCategory
;
import
com.patzn.cloud.service.lims.common.DateKit
;
import
com.patzn.cloud.service.lims.hmhj.common.consts.HmConst
;
import
com.patzn.cloud.service.lims.hmhj.mapper.ContractSamplingMapper
;
import
com.patzn.cloud.service.lims.hmhj.service.*
;
...
...
@@ -24,7 +24,6 @@ import org.apache.commons.lang3.StringUtils;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.time.LocalTime
;
import
java.util.Collections
;
import
java.util.List
;
...
...
@@ -58,6 +57,9 @@ public class ContractSamplingServiceImpl extends BaseServiceImpl<ContractSamplin
@Autowired
private
IUserInspectionCodeService
userInspectionCodeService
;
@Autowired
private
IEntrustSampleService
entrustSampleService
;
@Override
public
Page
<
ContractSampling
>
page
(
Page
<
ContractSampling
>
page
,
ContractSampling
contractSampling
)
{
Wrapper
wrapper
=
new
EntityWrapper
<>(
contractSampling
);
...
...
@@ -214,42 +216,11 @@ public class ContractSamplingServiceImpl extends BaseServiceImpl<ContractSamplin
}
// 原铝散样样品编号处理
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
sampleCode
=
sampleCode
.
replace
(
"BC"
,
clazz
);
// @yyMM&CH&BC&SN len(SN) = 3
String
queryKey
=
sampleCode
.
substring
(
0
,
sampleCode
.
length
()
-
3
);
sampleCode
=
getNewCode
(
queryKey
,
3
);
}
// 电解质散样样品编号处理
else
if
(
CodeTypeEnum
.
ELECT_BULK_SAMPLE_CODE
==
codeType
)
{
// 替换槽号CH
sampleCode
=
sampleCode
.
replace
(
"CH"
,
sample
.
getSlotNo
());
// @yyMM&CH&SN len(SN) = 3
String
queryKey
=
sampleCode
.
substring
(
0
,
sampleCode
.
length
()
-
3
);
sampleCode
=
getNewCode
(
queryKey
,
3
);
}
//原铝重取样品编号处理
else
if
(
CodeTypeEnum
.
AL_RETAKE_SAMPLE_CODE
==
codeType
)
{
// 替换槽号CH
sampleCode
=
sampleCode
.
replace
(
"CH"
,
sample
.
getSlotNo
());
// @yyMMdd&CH&C&SN len(SN) = 1
String
queryKey
=
sampleCode
.
substring
(
0
,
sampleCode
.
length
()
-
1
);
sampleCode
=
getNewCode
(
queryKey
,
1
);
sampleCode
=
sampleCode
.
replace
(
"BC"
,
DateKit
.
getShiftByNow
());
// YYMMDD+(A/C/E)+SN(1)+ 槽号(4)
String
queryKey
=
sampleCode
.
substring
(
0
,
7
)
+
"_"
+
sampleCode
.
substring
(
8
);
sampleCode
=
entrustSampleService
.
getNewCode
(
queryKey
,
7
,
1
);
}
}
...
...
@@ -269,24 +240,4 @@ public class ContractSamplingServiceImpl extends BaseServiceImpl<ContractSamplin
}
}
}
@Override
public
String
getNewCode
(
String
queryKey
,
int
lens
)
{
String
startKey
=
"0000000000000000000"
,
defKey
=
queryKey
+
startKey
.
substring
(
0
,
lens
-
1
)
+
1
;
if
(
StringUtils
.
isBlank
(
queryKey
))
{
return
defKey
;
}
String
lastCode
=
baseMapper
.
selectLastCode
(
queryKey
);
if
(
StringUtils
.
isBlank
(
lastCode
))
{
return
defKey
;
}
String
sampleSN
=
lastCode
.
substring
(
lastCode
.
length
()
-
lens
);
try
{
Integer
nextSN
=
Integer
.
parseInt
(
sampleSN
)
+
1
;
return
queryKey
+
startKey
.
substring
(
0
,
lens
-
nextSN
.
toString
().
length
())
+
nextSN
;
}
catch
(
NumberFormatException
e
)
{
logger
.
error
(
e
.
getMessage
(),
e
.
getCause
());
throw
new
PatznException
(
"合同样品编码流水号获取异常"
);
}
}
}
\ No newline at end of file
src/main/java/com/patzn/cloud/service/lims/hmhj/service/impl/EntrustServiceImpl.java
View file @
c0a7a341
...
...
@@ -27,6 +27,7 @@ import com.patzn.cloud.service.hmhj.vo.EntrustSampleItemVO;
import
com.patzn.cloud.service.hmhj.vo.EntrustSampleVO
;
import
com.patzn.cloud.service.hmhj.vo.EntrustVO
;
import
com.patzn.cloud.service.lims.chemical.entity.LmsChemicalCategory
;
import
com.patzn.cloud.service.lims.common.DateKit
;
import
com.patzn.cloud.service.lims.common.consts.Symbol
;
import
com.patzn.cloud.service.lims.common.service.ILmsMsgService
;
import
com.patzn.cloud.service.lims.hmhj.common.EntrustFlowUtils
;
...
...
@@ -44,7 +45,6 @@ import org.springframework.transaction.annotation.Transactional;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.*
;
import
java.math.BigDecimal
;
import
java.time.LocalTime
;
import
java.util.*
;
import
java.util.concurrent.Executor
;
import
java.util.stream.Collectors
;
...
...
@@ -251,7 +251,7 @@ public class EntrustServiceImpl extends BaseServiceImpl<EntrustMapper, Entrust>
// 原铝散样样品编号处理
else
if
(
CodeTypeEnum
.
AL_BULK_SAMPLE_CODE
==
codeType
)
{
// 替换班次BC
sampleCode
=
sampleCode
.
replace
(
"BC"
,
getShiftByNow
());
sampleCode
=
sampleCode
.
replace
(
"BC"
,
DateKit
.
getShiftByNow
());
// YYMMDD+(A/C/E)+SN(1)+ 槽号(4)
String
queryKey
=
sampleCode
.
substring
(
0
,
7
)
+
"_"
+
sampleCode
.
substring
(
8
);
sampleCode
=
entrustSampleService
.
getNewCode
(
queryKey
,
7
,
1
);
...
...
@@ -290,27 +290,6 @@ 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
)
{
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