Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-boot-biz
Project
Project
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
项目统一框架
amos-boot-biz
Commits
d1b12488
Commit
d1b12488
authored
May 31, 2024
by
刘凡
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增:修改气瓶校验
parent
aae26323
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
376 additions
and
96 deletions
+376
-96
CylinderFillingAuditFieldEnum.java
...s/api/openapi/constant/CylinderFillingAuditFieldEnum.java
+33
-0
CylinderInfoFieldEnum.java
...join/amos/api/openapi/constant/CylinderInfoFieldEnum.java
+42
-20
CylinderInspectionFieldEnum.java
...mos/api/openapi/constant/CylinderInspectionFieldEnum.java
+34
-0
CylinderTagFieldEnum.java
...ejoin/amos/api/openapi/constant/CylinderTagFieldEnum.java
+32
-0
CylinderUnitFieldEnum.java
...join/amos/api/openapi/constant/CylinderUnitFieldEnum.java
+37
-14
FillingAfterFieldEnum.java
...join/amos/api/openapi/constant/FillingAfterFieldEnum.java
+36
-14
FillingBeforeFieldEnum.java
...oin/amos/api/openapi/constant/FillingBeforeFieldEnum.java
+41
-18
FillingRecordFieldEnum.java
...oin/amos/api/openapi/constant/FillingRecordFieldEnum.java
+38
-15
CylinderFillingDataValidationService.java
...pi/face/service/CylinderFillingDataValidationService.java
+83
-15
No files found.
amos-boot-data/amos-boot-data-openapi/src/main/java/com/yeejoin/amos/api/openapi/constant/CylinderFillingAuditFieldEnum.java
0 → 100644
View file @
d1b12488
package
com
.
yeejoin
.
amos
.
api
.
openapi
.
constant
;
import
lombok.AllArgsConstructor
;
import
lombok.Getter
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.stream.Collectors
;
@AllArgsConstructor
@Getter
public
enum
CylinderFillingAuditFieldEnum
{
sequenceCode
(
true
,
true
),
fillingExamineId
(
true
,
true
),
fillingAuditDate
(
true
,
false
),
fillingAuditUrl
(
true
,
false
),
fillingAuditname
(
true
,
false
),
syncDate
(
true
,
false
),
syncState
(
true
,
false
);
private
boolean
isRequire
;
private
boolean
isUnique
;
public
static
List
<
String
>
getAllRequireKeys
()
{
List
<
String
>
keys
=
Arrays
.
stream
(
values
()).
filter
(
e
->
e
.
isRequire
).
map
(
e
->
e
.
name
()).
collect
(
Collectors
.
toList
());
return
keys
;
}
public
static
List
<
String
>
getAllUniqueKeys
()
{
List
<
String
>
keys
=
Arrays
.
stream
(
values
()).
filter
(
e
->
e
.
isUnique
).
map
(
e
->
e
.
name
()).
collect
(
Collectors
.
toList
());
return
keys
;
}
}
amos-boot-data/amos-boot-data-openapi/src/main/java/com/yeejoin/amos/api/openapi/constant/CylinderInfoFieldEnum.java
View file @
d1b12488
package
com
.
yeejoin
.
amos
.
api
.
openapi
.
constant
;
package
com
.
yeejoin
.
amos
.
api
.
openapi
.
constant
;
import
lombok.AllArgsConstructor
;
import
lombok.Getter
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.stream.Collectors
;
@AllArgsConstructor
@Getter
public
enum
CylinderInfoFieldEnum
{
public
enum
CylinderInfoFieldEnum
{
creditCode
,
creditCode
(
true
,
false
),
unitName
,
unitName
(
true
,
false
),
sequenceCode
,
sequenceCode
(
true
,
true
),
cylinderVariety
,
cylinderVariety
(
true
,
false
),
cylinderVarietyName
,
cylinderVarietyName
(
true
,
false
),
factoryNum
,
factoryNum
(
true
,
false
),
fillingMedia
,
fillingMedia
(
true
,
false
),
fillingMediaName
,
fillingMediaName
(
true
,
false
),
manufacturingUnit
,
manufacturingUnit
(
true
,
false
),
manufacturingDate
,
manufacturingDate
(
true
,
false
),
valveManufacturUnit
,
valveManufacturUnit
(
true
,
false
),
nominalWorkPressure
,
nominalWorkPressure
(
true
,
false
),
volume
,
volume
(
true
,
false
),
productQualified
,
productQualified
(
true
,
false
),
proofQuality
,
proofQuality
(
true
,
false
),
supervisionInspec
,
supervisionInspec
(
true
,
false
),
typeExperiments
,
typeExperiments
(
true
,
false
),
cylinderStatus
,
cylinderStatus
(
true
,
false
),
syncDate
,
syncDate
(
true
,
false
),
syncState
;
syncState
(
true
,
false
);
private
boolean
isRequire
;
private
boolean
isUnique
;
public
static
List
<
String
>
getAllRequireKeys
()
{
List
<
String
>
keys
=
Arrays
.
stream
(
values
()).
filter
(
e
->
e
.
isRequire
).
map
(
e
->
e
.
name
()).
collect
(
Collectors
.
toList
());
return
keys
;
}
public
static
List
<
String
>
getAllUniqueKeys
()
{
List
<
String
>
keys
=
Arrays
.
stream
(
values
()).
filter
(
e
->
e
.
isUnique
).
map
(
e
->
e
.
name
()).
collect
(
Collectors
.
toList
());
return
keys
;
}
}
}
amos-boot-data/amos-boot-data-openapi/src/main/java/com/yeejoin/amos/api/openapi/constant/CylinderInspectionFieldEnum.java
0 → 100644
View file @
d1b12488
package
com
.
yeejoin
.
amos
.
api
.
openapi
.
constant
;
import
lombok.AllArgsConstructor
;
import
lombok.Getter
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.stream.Collectors
;
@AllArgsConstructor
@Getter
public
enum
CylinderInspectionFieldEnum
{
sequenceCode
(
true
,
true
),
inspectionUnit
(
true
,
true
),
inspectionDate
(
true
,
true
),
inspectionResult
(
true
,
true
),
scrapQuantity
(
true
,
true
),
nextInspectionDate
(
true
,
true
),
syncDate
(
true
,
true
),
syncState
(
true
,
true
);
private
boolean
isRequire
;
private
boolean
isUnique
;
public
static
List
<
String
>
getAllRequireKeys
()
{
List
<
String
>
keys
=
Arrays
.
stream
(
values
()).
filter
(
e
->
e
.
isRequire
).
map
(
e
->
e
.
name
()).
collect
(
Collectors
.
toList
());
return
keys
;
}
public
static
List
<
String
>
getAllUniqueKeys
()
{
List
<
String
>
keys
=
Arrays
.
stream
(
values
()).
filter
(
e
->
e
.
isUnique
).
map
(
e
->
e
.
name
()).
collect
(
Collectors
.
toList
());
return
keys
;
}
}
amos-boot-data/amos-boot-data-openapi/src/main/java/com/yeejoin/amos/api/openapi/constant/CylinderTagFieldEnum.java
0 → 100644
View file @
d1b12488
package
com
.
yeejoin
.
amos
.
api
.
openapi
.
constant
;
import
lombok.AllArgsConstructor
;
import
lombok.Getter
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.stream.Collectors
;
@AllArgsConstructor
@Getter
public
enum
CylinderTagFieldEnum
{
sequenceCode
(
true
,
true
),
qrCode
(
true
,
true
),
electronicLabelCode
(
true
,
true
),
gasCylinderStamp
(
true
,
true
),
syncDate
(
true
,
false
),
syncState
(
true
,
false
);
private
boolean
isRequire
;
private
boolean
isUnique
;
public
static
List
<
String
>
getAllRequireKeys
()
{
List
<
String
>
keys
=
Arrays
.
stream
(
values
()).
filter
(
e
->
e
.
isRequire
).
map
(
e
->
e
.
name
()).
collect
(
Collectors
.
toList
());
return
keys
;
}
public
static
List
<
String
>
getAllUniqueKeys
()
{
List
<
String
>
keys
=
Arrays
.
stream
(
values
()).
filter
(
e
->
e
.
isUnique
).
map
(
e
->
e
.
name
()).
collect
(
Collectors
.
toList
());
return
keys
;
}
}
amos-boot-data/amos-boot-data-openapi/src/main/java/com/yeejoin/amos/api/openapi/constant/CylinderUnitFieldEnum.java
View file @
d1b12488
package
com
.
yeejoin
.
amos
.
api
.
openapi
.
constant
;
package
com
.
yeejoin
.
amos
.
api
.
openapi
.
constant
;
import
lombok.AllArgsConstructor
;
import
lombok.Getter
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.stream.Collectors
;
@AllArgsConstructor
@Getter
public
enum
CylinderUnitFieldEnum
{
public
enum
CylinderUnitFieldEnum
{
unitId
,
unitId
(
true
,
true
),
regionCode
,
regionCode
(
true
,
false
),
regionName
,
regionName
(
true
,
false
),
unitName
,
unitName
(
true
,
true
),
creditCode
,
creditCode
(
true
,
true
),
address
,
address
(
true
,
false
),
unitPerson
,
unitPerson
(
true
,
false
),
personMobilePhone
,
personMobilePhone
(
true
,
false
),
personTelephone
,
personTelephone
(
true
,
false
),
securityAdm
,
securityAdm
(
true
,
false
),
securityAdmPhone
,
securityAdmPhone
(
true
,
false
),
postalCode
,
postalCode
(
true
,
false
),
syncDate
,
syncDate
(
true
,
false
),
syncState
;
syncState
(
true
,
false
);
private
boolean
isRequire
;
private
boolean
isUnique
;
public
static
List
<
String
>
getAllRequireKeys
()
{
List
<
String
>
keys
=
Arrays
.
stream
(
values
()).
filter
(
e
->
e
.
isRequire
).
map
(
e
->
e
.
name
()).
collect
(
Collectors
.
toList
());
return
keys
;
}
public
static
List
<
String
>
getAllUniqueKeys
()
{
List
<
String
>
keys
=
Arrays
.
stream
(
values
()).
filter
(
e
->
e
.
isUnique
).
map
(
e
->
e
.
name
()).
collect
(
Collectors
.
toList
());
return
keys
;
}
}
}
amos-boot-data/amos-boot-data-openapi/src/main/java/com/yeejoin/amos/api/openapi/constant/FillingAfterFieldEnum.java
View file @
d1b12488
package
com
.
yeejoin
.
amos
.
api
.
openapi
.
constant
;
package
com
.
yeejoin
.
amos
.
api
.
openapi
.
constant
;
import
lombok.AllArgsConstructor
;
import
lombok.Getter
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.stream.Collectors
;
@AllArgsConstructor
@Getter
public
enum
FillingAfterFieldEnum
{
public
enum
FillingAfterFieldEnum
{
sequenceCode
,
sequenceCode
(
true
,
true
),
fillingCheckId
,
fillingCheckId
(
true
,
true
),
withinScope
,
withinScope
(
true
,
false
),
sealedState
,
sealedState
(
true
,
false
),
defective
,
defective
(
true
,
false
),
abnormaLTemperature
,
abnormaLTemperature
(
true
,
false
),
warningSign
,
warningSign
(
true
,
false
),
compliance
,
compliance
(
true
,
false
),
checkResults
,
checkResults
(
true
,
false
),
nonconformances
,
nonconformances
(
true
,
false
),
inspector
,
inspector
(
true
,
false
),
inspectionDate
,
inspectionDate
(
true
,
false
),
syncDate
,
syncDate
(
true
,
false
),
syncState
;
syncState
(
true
,
false
);
private
boolean
isRequire
;
private
boolean
isUnique
;
public
static
List
<
String
>
getAllRequireKeys
()
{
List
<
String
>
keys
=
Arrays
.
stream
(
values
()).
filter
(
e
->
e
.
isRequire
).
map
(
e
->
e
.
name
()).
collect
(
Collectors
.
toList
());
return
keys
;
}
public
static
List
<
String
>
getAllUniqueKeys
()
{
List
<
String
>
keys
=
Arrays
.
stream
(
values
()).
filter
(
e
->
e
.
isUnique
).
map
(
e
->
e
.
name
()).
collect
(
Collectors
.
toList
());
return
keys
;
}
}
}
amos-boot-data/amos-boot-data-openapi/src/main/java/com/yeejoin/amos/api/openapi/constant/FillingBeforeFieldEnum.java
View file @
d1b12488
package
com
.
yeejoin
.
amos
.
api
.
openapi
.
constant
;
package
com
.
yeejoin
.
amos
.
api
.
openapi
.
constant
;
import
lombok.AllArgsConstructor
;
import
lombok.Getter
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.stream.Collectors
;
@AllArgsConstructor
@Getter
public
enum
FillingBeforeFieldEnum
{
public
enum
FillingBeforeFieldEnum
{
sequenceCode
,
sequenceCode
(
true
,
true
),
fillingBeforeId
,
fillingBeforeId
(
true
,
true
),
creditCode
,
creditCode
(
true
,
false
),
fillingUnitName
,
fillingUnitName
(
true
,
false
),
inspectorUser
,
inspectorUser
(
true
,
false
),
inspectionDate
,
inspectionDate
(
true
,
false
),
isValid
,
isValid
(
true
,
false
),
same
,
same
(
true
,
false
),
isRegulations
,
isRegulations
(
true
,
false
),
isComplianceWithGBT
,
isComplianceWithGBT
(
true
,
false
),
haveStillPressure
,
haveStillPressure
(
true
,
false
),
isComplete
,
isComplete
(
true
,
false
),
haveSecurityDocuments
,
haveSecurityDocuments
(
true
,
false
),
fillBeforeItem
,
fillBeforeItem
(
true
,
false
),
checkResults
,
checkResults
(
true
,
false
),
nonconformances
,
nonconformances
(
true
,
false
),
syncDate
,
syncDate
(
true
,
false
),
syncState
;
syncState
(
true
,
false
);
private
boolean
isRequire
;
private
boolean
isUnique
;
public
static
List
<
String
>
getAllRequireKeys
()
{
List
<
String
>
keys
=
Arrays
.
stream
(
values
()).
filter
(
e
->
e
.
isRequire
).
map
(
e
->
e
.
name
()).
collect
(
Collectors
.
toList
());
return
keys
;
}
public
static
List
<
String
>
getAllUniqueKeys
()
{
List
<
String
>
keys
=
Arrays
.
stream
(
values
()).
filter
(
e
->
e
.
isUnique
).
map
(
e
->
e
.
name
()).
collect
(
Collectors
.
toList
());
return
keys
;
}
}
}
amos-boot-data/amos-boot-data-openapi/src/main/java/com/yeejoin/amos/api/openapi/constant/FillingRecordFieldEnum.java
View file @
d1b12488
package
com
.
yeejoin
.
amos
.
api
.
openapi
.
constant
;
package
com
.
yeejoin
.
amos
.
api
.
openapi
.
constant
;
import
lombok.AllArgsConstructor
;
import
lombok.Getter
;
import
java.util.Arrays
;
import
java.util.List
;
import
java.util.stream.Collectors
;
@AllArgsConstructor
@Getter
public
enum
FillingRecordFieldEnum
{
public
enum
FillingRecordFieldEnum
{
sequenceCode
,
sequenceCode
(
true
,
true
),
fillingRecordId
,
fillingRecordId
(
true
,
true
),
fillingBeforeId
,
fillingBeforeId
(
true
,
true
),
fillingCheckId
,
fillingCheckId
(
true
,
true
),
fillingExamineId
,
fillingExamineId
(
true
,
true
),
fillingStartTime
,
fillingStartTime
(
true
,
false
),
fillingEndTime
,
fillingEndTime
(
true
,
false
),
fillingUser
,
fillingUser
(
true
,
false
),
inspectorName
,
inspectorName
(
true
,
false
),
fillingQuantity
,
fillingQuantity
(
true
,
false
),
dischargeVolume
,
dischargeVolume
(
true
,
false
),
temperature
,
temperature
(
true
,
false
),
abnormal
,
abnormal
(
true
,
false
),
syncDate
,
syncDate
(
true
,
false
),
syncState
;
syncState
(
true
,
false
);
private
boolean
isRequire
;
private
boolean
isUnique
;
public
static
List
<
String
>
getAllRequireKeys
()
{
List
<
String
>
keys
=
Arrays
.
stream
(
values
()).
filter
(
e
->
e
.
isRequire
).
map
(
e
->
e
.
name
()).
collect
(
Collectors
.
toList
());
return
keys
;
}
public
static
List
<
String
>
getAllUniqueKeys
()
{
List
<
String
>
keys
=
Arrays
.
stream
(
values
()).
filter
(
e
->
e
.
isUnique
).
map
(
e
->
e
.
name
()).
collect
(
Collectors
.
toList
());
return
keys
;
}
}
}
amos-boot-data/amos-boot-data-openapi/src/main/java/com/yeejoin/amos/api/openapi/face/service/CylinderFillingDataValidationService.java
View file @
d1b12488
...
@@ -35,14 +35,13 @@ public class CylinderFillingDataValidationService {
...
@@ -35,14 +35,13 @@ public class CylinderFillingDataValidationService {
*/
*/
public
boolean
validatEcylinderUnit
(
List
<
CylinderUnitModel
>
unitData
)
{
public
boolean
validatEcylinderUnit
(
List
<
CylinderUnitModel
>
unitData
)
{
JSONArray
jsonArray
=
JSONArray
.
fromObject
(
unitData
);
JSONArray
jsonArray
=
JSONArray
.
fromObject
(
unitData
);
List
<
String
>
keys
=
Arrays
.
stream
(
CylinderUnitFieldEnum
.
values
()).
map
(
e
->
e
.
name
()).
collect
(
Collectors
.
toList
());
// 1.必填校验
// 1.必填校验
List
<
String
>
errorRows
=
validateRequired
(
keys
,
jsonArray
);
List
<
String
>
errorRows
=
validateRequired
(
CylinderUnitFieldEnum
.
getAllRequireKeys
()
,
jsonArray
);
if
(!
ObjectUtils
.
isEmpty
(
errorRows
))
{
if
(!
ObjectUtils
.
isEmpty
(
errorRows
))
{
throw
new
BadRequest
(
JSONArray
.
fromObject
(
errorRows
.
stream
().
map
(
e
->
"必填字段为空::"
+
e
).
collect
(
Collectors
.
toList
())).
toString
());
throw
new
BadRequest
(
JSONArray
.
fromObject
(
errorRows
.
stream
().
map
(
e
->
"必填字段为空::"
+
e
).
collect
(
Collectors
.
toList
())).
toString
());
}
}
// 2.本次上传数据唯一性校验
// 2.本次上传数据唯一性校验
errorRows
=
validateUnique
(
keys
,
jsonArray
);
errorRows
=
validateUnique
(
CylinderUnitFieldEnum
.
getAllUniqueKeys
()
,
jsonArray
);
if
(!
ObjectUtils
.
isEmpty
(
errorRows
))
{
if
(!
ObjectUtils
.
isEmpty
(
errorRows
))
{
throw
new
BadRequest
(
JSONArray
.
fromObject
(
errorRows
.
stream
().
map
(
e
->
"上传数据重复:"
+
e
).
collect
(
Collectors
.
toList
())).
toString
());
throw
new
BadRequest
(
JSONArray
.
fromObject
(
errorRows
.
stream
().
map
(
e
->
"上传数据重复:"
+
e
).
collect
(
Collectors
.
toList
())).
toString
());
}
}
...
@@ -56,16 +55,20 @@ public class CylinderFillingDataValidationService {
...
@@ -56,16 +55,20 @@ public class CylinderFillingDataValidationService {
}
}
/**
* 校验气瓶数据
* @param infoData
* @return
*/
public
boolean
validateCylinderInfo
(
List
<
CylinderInfoModel
>
infoData
)
{
public
boolean
validateCylinderInfo
(
List
<
CylinderInfoModel
>
infoData
)
{
JSONArray
jsonArray
=
JSONArray
.
fromObject
(
infoData
);
JSONArray
jsonArray
=
JSONArray
.
fromObject
(
infoData
);
List
<
String
>
keys
=
Arrays
.
stream
(
CylinderInfoFieldEnum
.
values
()).
map
(
e
->
e
.
name
()).
collect
(
Collectors
.
toList
());
// 1.必填校验
// 1.必填校验
List
<
String
>
errorRows
=
validateRequired
(
keys
,
jsonArray
);
List
<
String
>
errorRows
=
validateRequired
(
CylinderInfoFieldEnum
.
getAllRequireKeys
()
,
jsonArray
);
if
(!
ObjectUtils
.
isEmpty
(
errorRows
))
{
if
(!
ObjectUtils
.
isEmpty
(
errorRows
))
{
throw
new
BadRequest
(
JSONArray
.
fromObject
(
errorRows
.
stream
().
map
(
e
->
"必填字段为空::"
+
e
).
collect
(
Collectors
.
toList
())).
toString
());
throw
new
BadRequest
(
JSONArray
.
fromObject
(
errorRows
.
stream
().
map
(
e
->
"必填字段为空::"
+
e
).
collect
(
Collectors
.
toList
())).
toString
());
}
}
// 2.本次上传数据唯一性校验
// 2.本次上传数据唯一性校验
errorRows
=
validateUnique
(
keys
,
jsonArray
);
errorRows
=
validateUnique
(
CylinderInfoFieldEnum
.
getAllUniqueKeys
()
,
jsonArray
);
if
(!
ObjectUtils
.
isEmpty
(
errorRows
))
{
if
(!
ObjectUtils
.
isEmpty
(
errorRows
))
{
throw
new
BadRequest
(
JSONArray
.
fromObject
(
errorRows
.
stream
().
map
(
e
->
"上传数据重复:"
+
e
).
collect
(
Collectors
.
toList
())).
toString
());
throw
new
BadRequest
(
JSONArray
.
fromObject
(
errorRows
.
stream
().
map
(
e
->
"上传数据重复:"
+
e
).
collect
(
Collectors
.
toList
())).
toString
());
}
}
...
@@ -84,6 +87,73 @@ public class CylinderFillingDataValidationService {
...
@@ -84,6 +87,73 @@ public class CylinderFillingDataValidationService {
return
true
;
return
true
;
}
}
public
boolean
validateCylinderTag
(
List
<
CylinderTagsModel
>
tagData
)
{
JSONArray
jsonArray
=
JSONArray
.
fromObject
(
tagData
);
// 1.必填校验
List
<
String
>
errorRows
=
validateRequired
(
CylinderTagFieldEnum
.
getAllRequireKeys
(),
jsonArray
);
if
(!
ObjectUtils
.
isEmpty
(
errorRows
))
{
throw
new
BadRequest
(
JSONArray
.
fromObject
(
errorRows
.
stream
().
map
(
e
->
"必填字段为空::"
+
e
).
collect
(
Collectors
.
toList
())).
toString
());
}
// 2.本次上传数据唯一性校验
errorRows
=
validateUnique
(
CylinderTagFieldEnum
.
getAllUniqueKeys
(),
jsonArray
);
if
(!
ObjectUtils
.
isEmpty
(
errorRows
))
{
throw
new
BadRequest
(
JSONArray
.
fromObject
(
errorRows
.
stream
().
map
(
e
->
"上传数据重复:"
+
e
).
collect
(
Collectors
.
toList
())).
toString
());
}
// 3.检查气瓶唯一标识码是否存在
Set
<
String
>
sequenceCodes
=
getAllData
(
FillingBeforeFieldEnum
.
sequenceCode
.
name
(),
jsonArray
);
errorRows
=
getNotExistSequenceCodes
(
sequenceCodes
);
if
(!
ObjectUtils
.
isEmpty
(
errorRows
))
{
throw
new
BadRequest
(
JSONArray
.
fromObject
(
errorRows
.
stream
().
map
(
e
->
"气瓶唯一标识码不存在:"
+
e
).
collect
(
Collectors
.
toList
())).
toString
());
}
return
true
;
}
boolean
validateCylinderInspection
(
List
<
CylinderInspectionModel
>
inspectionData
)
{
JSONArray
jsonArray
=
JSONArray
.
fromObject
(
inspectionData
);
// 1.必填校验
List
<
String
>
errorRows
=
validateRequired
(
CylinderInspectionFieldEnum
.
getAllRequireKeys
(),
jsonArray
);
if
(!
ObjectUtils
.
isEmpty
(
errorRows
))
{
throw
new
BadRequest
(
JSONArray
.
fromObject
(
errorRows
.
stream
().
map
(
e
->
"必填字段为空::"
+
e
).
collect
(
Collectors
.
toList
())).
toString
());
}
// 2.本次上传数据唯一性校验
errorRows
=
validateUnique
(
CylinderInspectionFieldEnum
.
getAllUniqueKeys
(),
jsonArray
);
if
(!
ObjectUtils
.
isEmpty
(
errorRows
))
{
throw
new
BadRequest
(
JSONArray
.
fromObject
(
errorRows
.
stream
().
map
(
e
->
"上传数据重复:"
+
e
).
collect
(
Collectors
.
toList
())).
toString
());
}
// 3.检查气瓶唯一标识码是否存在
Set
<
String
>
sequenceCodes
=
getAllData
(
FillingBeforeFieldEnum
.
sequenceCode
.
name
(),
jsonArray
);
errorRows
=
getNotExistSequenceCodes
(
sequenceCodes
);
if
(!
ObjectUtils
.
isEmpty
(
errorRows
))
{
throw
new
BadRequest
(
JSONArray
.
fromObject
(
errorRows
.
stream
().
map
(
e
->
"气瓶唯一标识码不存在:"
+
e
).
collect
(
Collectors
.
toList
())).
toString
());
}
return
true
;
}
boolean
validateCylinderFillingExamineModel
(
List
<
CylinderFillingExamineModel
>
inspectionData
)
{
JSONArray
jsonArray
=
JSONArray
.
fromObject
(
inspectionData
);
// 1.必填校验
List
<
String
>
errorRows
=
validateRequired
(
CylinderFillingAuditFieldEnum
.
getAllRequireKeys
(),
jsonArray
);
if
(!
ObjectUtils
.
isEmpty
(
errorRows
))
{
throw
new
BadRequest
(
JSONArray
.
fromObject
(
errorRows
.
stream
().
map
(
e
->
"必填字段为空::"
+
e
).
collect
(
Collectors
.
toList
())).
toString
());
}
// 2.本次上传数据唯一性校验
errorRows
=
validateUnique
(
CylinderFillingAuditFieldEnum
.
getAllUniqueKeys
(),
jsonArray
);
if
(!
ObjectUtils
.
isEmpty
(
errorRows
))
{
throw
new
BadRequest
(
JSONArray
.
fromObject
(
errorRows
.
stream
().
map
(
e
->
"上传数据重复:"
+
e
).
collect
(
Collectors
.
toList
())).
toString
());
}
// 3.检查气瓶唯一标识码是否存在
Set
<
String
>
sequenceCodes
=
getAllData
(
FillingBeforeFieldEnum
.
sequenceCode
.
name
(),
jsonArray
);
errorRows
=
getNotExistSequenceCodes
(
sequenceCodes
);
if
(!
ObjectUtils
.
isEmpty
(
errorRows
))
{
throw
new
BadRequest
(
JSONArray
.
fromObject
(
errorRows
.
stream
().
map
(
e
->
"气瓶唯一标识码不存在:"
+
e
).
collect
(
Collectors
.
toList
())).
toString
());
}
return
true
;
}
/**
/**
* 验证气瓶充装数据
* 验证气瓶充装数据
* @return
* @return
...
@@ -121,14 +191,13 @@ public class CylinderFillingDataValidationService {
...
@@ -121,14 +191,13 @@ public class CylinderFillingDataValidationService {
* @return List 异常数据
* @return List 异常数据
*/
*/
public
List
<
String
>
validateFillingBeforeData
(
JSONArray
jsonArray
)
{
public
List
<
String
>
validateFillingBeforeData
(
JSONArray
jsonArray
)
{
List
<
String
>
keys
=
Arrays
.
stream
(
FillingBeforeFieldEnum
.
values
()).
map
(
e
->
e
.
name
()).
collect
(
Collectors
.
toList
());
// 1.必填校验
// 1.必填校验
List
<
String
>
errorRows
=
validateRequired
(
keys
,
jsonArray
);
List
<
String
>
errorRows
=
validateRequired
(
FillingBeforeFieldEnum
.
getAllRequireKeys
()
,
jsonArray
);
if
(!
ObjectUtils
.
isEmpty
(
errorRows
))
{
if
(!
ObjectUtils
.
isEmpty
(
errorRows
))
{
return
errorRows
.
stream
().
map
(
e
->
"必填字段为空::"
+
e
).
collect
(
Collectors
.
toList
());
return
errorRows
.
stream
().
map
(
e
->
"必填字段为空::"
+
e
).
collect
(
Collectors
.
toList
());
}
}
// 2.本次上传数据唯一性校验
// 2.本次上传数据唯一性校验
errorRows
=
validateUnique
(
keys
,
jsonArray
);
errorRows
=
validateUnique
(
FillingBeforeFieldEnum
.
getAllUniqueKeys
()
,
jsonArray
);
if
(!
ObjectUtils
.
isEmpty
(
errorRows
))
{
if
(!
ObjectUtils
.
isEmpty
(
errorRows
))
{
return
errorRows
.
stream
().
map
(
e
->
"上传数据重复:"
+
e
).
collect
(
Collectors
.
toList
());
return
errorRows
.
stream
().
map
(
e
->
"上传数据重复:"
+
e
).
collect
(
Collectors
.
toList
());
}
}
...
@@ -153,14 +222,13 @@ public class CylinderFillingDataValidationService {
...
@@ -153,14 +222,13 @@ public class CylinderFillingDataValidationService {
* @return List 异常数据
* @return List 异常数据
*/
*/
public
List
<
String
>
validateFillingRecordData
(
JSONArray
jsonArray
)
{
public
List
<
String
>
validateFillingRecordData
(
JSONArray
jsonArray
)
{
List
<
String
>
keys
=
Arrays
.
stream
(
FillingRecordFieldEnum
.
values
()).
map
(
e
->
e
.
name
()).
collect
(
Collectors
.
toList
());
// 1.必填校验
// 1.必填校验
List
<
String
>
errorRows
=
validateRequired
(
keys
,
jsonArray
);
List
<
String
>
errorRows
=
validateRequired
(
FillingRecordFieldEnum
.
getAllRequireKeys
()
,
jsonArray
);
if
(!
ObjectUtils
.
isEmpty
(
errorRows
))
{
if
(!
ObjectUtils
.
isEmpty
(
errorRows
))
{
return
errorRows
.
stream
().
map
(
e
->
"必填字段为空::"
+
e
).
collect
(
Collectors
.
toList
());
return
errorRows
.
stream
().
map
(
e
->
"必填字段为空::"
+
e
).
collect
(
Collectors
.
toList
());
}
}
// 2.本次上传数据唯一性校验
// 2.本次上传数据唯一性校验
errorRows
=
validateUnique
(
keys
,
jsonArray
);
errorRows
=
validateUnique
(
FillingRecordFieldEnum
.
getAllUniqueKeys
()
,
jsonArray
);
if
(!
ObjectUtils
.
isEmpty
(
errorRows
))
{
if
(!
ObjectUtils
.
isEmpty
(
errorRows
))
{
return
errorRows
.
stream
().
map
(
e
->
"上传数据重复:"
+
e
).
collect
(
Collectors
.
toList
());
return
errorRows
.
stream
().
map
(
e
->
"上传数据重复:"
+
e
).
collect
(
Collectors
.
toList
());
}
}
...
@@ -185,14 +253,14 @@ public class CylinderFillingDataValidationService {
...
@@ -185,14 +253,14 @@ public class CylinderFillingDataValidationService {
* @return List 异常数据
* @return List 异常数据
*/
*/
public
List
<
String
>
validateFillinAfterData
(
JSONArray
jsonArray
)
{
public
List
<
String
>
validateFillinAfterData
(
JSONArray
jsonArray
)
{
List
<
String
>
keys
=
Arrays
.
stream
(
FillingAfterFieldEnum
.
values
()).
map
(
e
->
e
.
name
()).
collect
(
Collectors
.
toList
());
// 1.必填校验
// 1.必填校验
List
<
String
>
errorRows
=
validateRequired
(
keys
,
jsonArray
);
List
<
String
>
errorRows
=
validateRequired
(
FillingAfterFieldEnum
.
getAllRequireKeys
()
,
jsonArray
);
if
(!
ObjectUtils
.
isEmpty
(
errorRows
))
{
if
(!
ObjectUtils
.
isEmpty
(
errorRows
))
{
return
errorRows
.
stream
().
map
(
e
->
"必填字段为空::"
+
e
).
collect
(
Collectors
.
toList
());
return
errorRows
.
stream
().
map
(
e
->
"必填字段为空::"
+
e
).
collect
(
Collectors
.
toList
());
}
}
// 2.本次上传数据唯一性校验
// 2.本次上传数据唯一性校验
errorRows
=
validateUnique
(
keys
,
jsonArray
);
errorRows
=
validateUnique
(
FillingAfterFieldEnum
.
getAllUniqueKeys
()
,
jsonArray
);
if
(!
ObjectUtils
.
isEmpty
(
errorRows
))
{
if
(!
ObjectUtils
.
isEmpty
(
errorRows
))
{
return
errorRows
.
stream
().
map
(
e
->
"上传数据重复:"
+
e
).
collect
(
Collectors
.
toList
());
return
errorRows
.
stream
().
map
(
e
->
"上传数据重复:"
+
e
).
collect
(
Collectors
.
toList
());
}
}
...
...
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