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
98220b51
Commit
98220b51
authored
May 31, 2024
by
刘凡
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增:新增多数据源以及数据校验代码
parent
fd812606
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
502 additions
and
4 deletions
+502
-4
pom.xml
amos-boot-data/amos-boot-data-openapi/pom.xml
+31
-1
DataSourceConfig.java
...com/yeejoin/amos/api/openapi/config/DataSourceConfig.java
+16
-0
CylinderInfoFieldEnum.java
...join/amos/api/openapi/constant/CylinderInfoFieldEnum.java
+24
-0
CylinderUnitFieldEnum.java
...join/amos/api/openapi/constant/CylinderUnitFieldEnum.java
+18
-0
FillingAfterFieldEnum.java
...join/amos/api/openapi/constant/FillingAfterFieldEnum.java
+18
-0
FillingBeforeFieldEnum.java
...oin/amos/api/openapi/constant/FillingBeforeFieldEnum.java
+22
-0
FillingRecordFieldEnum.java
...oin/amos/api/openapi/constant/FillingRecordFieldEnum.java
+19
-0
CylinderFillingDataValidationResultModel.java
.../face/model/CylinderFillingDataValidationResultModel.java
+14
-0
RegistrationInfoMapper.java
...amos/api/openapi/face/orm/dao/RegistrationInfoMapper.java
+9
-0
UseInfoMapper.java
.../yeejoin/amos/api/openapi/face/orm/dao/UseInfoMapper.java
+5
-0
CylinderFillingDataValidationService.java
...pi/face/service/CylinderFillingDataValidationService.java
+301
-0
CylinderFillingService.java
...amos/api/openapi/face/service/CylinderFillingService.java
+3
-1
EnterpriseInfoService.java
.../amos/api/openapi/face/service/EnterpriseInfoService.java
+7
-0
application-vb.properties
...data-openapi/src/main/resources/application-vb.properties
+15
-2
No files found.
amos-boot-data/amos-boot-data-openapi/pom.xml
View file @
98220b51
...
@@ -28,8 +28,17 @@
...
@@ -28,8 +28,17 @@
<groupId>
org.springframework.boot
</groupId>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-jdbc
</artifactId>
<artifactId>
spring-boot-starter-jdbc
</artifactId>
</dependency>
</dependency>
<!-- Vastbase G100 -->
<dependency>
<dependency>
<groupId>
com.baomidou
</groupId>
<artifactId>
dynamic-datasource-spring-boot-starter
</artifactId>
<version>
3.1.0
</version>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-data-jpa
</artifactId>
</dependency>
<!-- Vastbase G100 -->
<dependency>
@
<groupId>
cn.com.vastdata
</groupId>
<groupId>
cn.com.vastdata
</groupId>
<artifactId>
vastbase
</artifactId>
<artifactId>
vastbase
</artifactId>
<version>
1.0.0.2
</version>
<version>
1.0.0.2
</version>
...
@@ -156,6 +165,27 @@
...
@@ -156,6 +165,27 @@
<artifactId>
jettison
</artifactId>
<artifactId>
jettison
</artifactId>
<version>
1.3.7
</version>
<version>
1.3.7
</version>
</dependency>
</dependency>
<dependency>
<groupId>
tech.tablesaw
</groupId>
<artifactId>
tablesaw-core
</artifactId>
<version>
0.43.1
</version>
</dependency>
<dependency>
<groupId>
tech.tablesaw
</groupId>
<artifactId>
tablesaw-json
</artifactId>
<version>
0.43.1
</version>
</dependency>
<dependency>
<groupId>
tech.tablesaw
</groupId>
<artifactId>
tablesaw-jsplot
</artifactId>
<version>
0.43.1
</version>
</dependency>
<dependency>
<groupId>
tech.tablesaw
</groupId>
<artifactId>
tablesaw-excel
</artifactId>
<version>
0.43.1
</version>
</dependency>
</dependencies>
</dependencies>
<build>
<build>
<plugins>
<plugins>
...
...
amos-boot-data/amos-boot-data-openapi/src/main/java/com/yeejoin/amos/api/openapi/config/DataSourceConfig.java
0 → 100644
View file @
98220b51
package
com
.
yeejoin
.
amos
.
api
.
openapi
.
config
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.jdbc.datasource.DataSourceTransactionManager
;
import
javax.sql.DataSource
;
@Configuration
public
class
DataSourceConfig
{
@Bean
public
DataSourceTransactionManager
transactionManager
(
DataSource
dataSource
)
{
return
new
DataSourceTransactionManager
(
dataSource
);
}
}
amos-boot-data/amos-boot-data-openapi/src/main/java/com/yeejoin/amos/api/openapi/constant/CylinderInfoFieldEnum.java
0 → 100644
View file @
98220b51
package
com
.
yeejoin
.
amos
.
api
.
openapi
.
constant
;
public
enum
CylinderInfoFieldEnum
{
creditCode
,
unitName
,
sequenceCode
,
cylinderVariety
,
cylinderVarietyName
,
factoryNum
,
fillingMedia
,
fillingMediaName
,
manufacturingUnit
,
manufacturingDate
,
valveManufacturUnit
,
nominalWorkPressure
,
volume
,
productQualified
,
proofQuality
,
supervisionInspec
,
typeExperiments
,
cylinderStatus
,
syncDate
,
syncState
;
}
amos-boot-data/amos-boot-data-openapi/src/main/java/com/yeejoin/amos/api/openapi/constant/CylinderUnitFieldEnum.java
0 → 100644
View file @
98220b51
package
com
.
yeejoin
.
amos
.
api
.
openapi
.
constant
;
public
enum
CylinderUnitFieldEnum
{
unitId
,
regionCode
,
regionName
,
unitName
,
creditCode
,
address
,
unitPerson
,
personMobilePhone
,
personTelephone
,
securityAdm
,
securityAdmPhone
,
postalCode
,
syncDate
,
syncState
;
}
amos-boot-data/amos-boot-data-openapi/src/main/java/com/yeejoin/amos/api/openapi/constant/FillingAfterFieldEnum.java
0 → 100644
View file @
98220b51
package
com
.
yeejoin
.
amos
.
api
.
openapi
.
constant
;
public
enum
FillingAfterFieldEnum
{
sequenceCode
,
fillingCheckId
,
withinScope
,
sealedState
,
defective
,
abnormaLTemperature
,
warningSign
,
compliance
,
checkResults
,
nonconformances
,
inspector
,
inspectionDate
,
syncDate
,
syncState
;
}
amos-boot-data/amos-boot-data-openapi/src/main/java/com/yeejoin/amos/api/openapi/constant/FillingBeforeFieldEnum.java
0 → 100644
View file @
98220b51
package
com
.
yeejoin
.
amos
.
api
.
openapi
.
constant
;
public
enum
FillingBeforeFieldEnum
{
sequenceCode
,
fillingBeforeId
,
creditCode
,
fillingUnitName
,
inspectorUser
,
inspectionDate
,
isValid
,
same
,
isRegulations
,
isComplianceWithGBT
,
haveStillPressure
,
isComplete
,
haveSecurityDocuments
,
fillBeforeItem
,
checkResults
,
nonconformances
,
syncDate
,
syncState
;
}
amos-boot-data/amos-boot-data-openapi/src/main/java/com/yeejoin/amos/api/openapi/constant/FillingRecordFieldEnum.java
0 → 100644
View file @
98220b51
package
com
.
yeejoin
.
amos
.
api
.
openapi
.
constant
;
public
enum
FillingRecordFieldEnum
{
sequenceCode
,
fillingRecordId
,
fillingBeforeId
,
fillingCheckId
,
fillingExamineId
,
fillingStartTime
,
fillingEndTime
,
fillingUser
,
inspectorName
,
fillingQuantity
,
dischargeVolume
,
temperature
,
abnormal
,
syncDate
,
syncState
;
}
amos-boot-data/amos-boot-data-openapi/src/main/java/com/yeejoin/amos/api/openapi/face/model/CylinderFillingDataValidationResultModel.java
0 → 100644
View file @
98220b51
package
com
.
yeejoin
.
amos
.
api
.
openapi
.
face
.
model
;
import
lombok.Data
;
import
java.util.List
;
@Data
public
class
CylinderFillingDataValidationResultModel
{
private
List
<
String
>
beforeErrorData
;
private
List
<
String
>
recordErrorData
;
private
List
<
String
>
afterErrorData
;
private
String
result
=
"success"
;
}
amos-boot-data/amos-boot-data-openapi/src/main/java/com/yeejoin/amos/api/openapi/face/orm/dao/RegistrationInfoMapper.java
View file @
98220b51
package
com
.
yeejoin
.
amos
.
api
.
openapi
.
face
.
orm
.
dao
;
package
com
.
yeejoin
.
amos
.
api
.
openapi
.
face
.
orm
.
dao
;
import
com.baomidou.dynamic.datasource.annotation.DS
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.yeejoin.amos.api.openapi.face.orm.entity.RegistrationInfo
;
import
com.yeejoin.amos.api.openapi.face.orm.entity.RegistrationInfo
;
import
org.springframework.data.jpa.repository.Query
;
import
org.springframework.data.repository.query.Param
;
import
java.util.List
;
import
java.util.Set
;
/**
/**
* 特种设备基本信息-注册登记信息 Mapper 接口
* 特种设备基本信息-注册登记信息 Mapper 接口
...
@@ -11,4 +17,7 @@ import com.yeejoin.amos.api.openapi.face.orm.entity.RegistrationInfo;
...
@@ -11,4 +17,7 @@ import com.yeejoin.amos.api.openapi.face.orm.entity.RegistrationInfo;
*/
*/
public
interface
RegistrationInfoMapper
extends
BaseMapper
<
RegistrationInfo
>
{
public
interface
RegistrationInfoMapper
extends
BaseMapper
<
RegistrationInfo
>
{
@DS
(
"tzs"
)
@Query
(
"SELECT DISTINCT r.* FROM idx_biz_jg_use_info i, idx_biz_jg_register_info r WHERE i.data_source = 'jg' AND i.RECORD = r.RECORD AND r.EQU_CODE IN :values"
)
List
<
RegistrationInfo
>
getUseInfoByEquipCode
(
@Param
(
"values"
)
Set
<
String
>
sequenceCodes
);
}
}
amos-boot-data/amos-boot-data-openapi/src/main/java/com/yeejoin/amos/api/openapi/face/orm/dao/UseInfoMapper.java
View file @
98220b51
...
@@ -2,6 +2,11 @@ package com.yeejoin.amos.api.openapi.face.orm.dao;
...
@@ -2,6 +2,11 @@ package com.yeejoin.amos.api.openapi.face.orm.dao;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.yeejoin.amos.api.openapi.face.orm.entity.UseInfo
;
import
com.yeejoin.amos.api.openapi.face.orm.entity.UseInfo
;
import
org.springframework.data.jpa.repository.Query
;
import
org.springframework.data.repository.query.Param
;
import
java.util.List
;
import
java.util.Set
;
/**
/**
* 特种设备基本信息-使用信息 Mapper 接口
* 特种设备基本信息-使用信息 Mapper 接口
...
...
amos-boot-data/amos-boot-data-openapi/src/main/java/com/yeejoin/amos/api/openapi/face/service/CylinderFillingDataValidationService.java
0 → 100644
View file @
98220b51
package
com
.
yeejoin
.
amos
.
api
.
openapi
.
face
.
service
;
import
com.yeejoin.amos.api.openapi.constant.*
;
import
com.yeejoin.amos.api.openapi.face.model.*
;
import
com.yeejoin.amos.api.openapi.face.orm.dao.RegistrationInfoMapper
;
import
com.yeejoin.amos.api.openapi.face.orm.entity.RegistrationInfo
;
import
net.sf.json.JSONArray
;
import
net.sf.json.JSONObject
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
org.springframework.util.ObjectUtils
;
import
org.typroject.tyboot.core.restful.exception.instance.BadRequest
;
import
java.util.*
;
import
java.util.concurrent.CompletableFuture
;
import
java.util.concurrent.ExecutionException
;
import
java.util.stream.Collectors
;
/**
* 气瓶数据校验
*/
@Component
public
class
CylinderFillingDataValidationService
{
@Autowired
EnterpriseInfoService
enterpriseInfoService
;
@Autowired
RegistrationInfoMapper
registrationInfoMapper
;
/**
* 企业信息校验
* @param unitData
* @return
*/
public
boolean
validatEcylinderUnit
(
List
<
CylinderUnitModel
>
unitData
)
{
JSONArray
jsonArray
=
JSONArray
.
fromObject
(
unitData
);
List
<
String
>
keys
=
Arrays
.
stream
(
CylinderUnitFieldEnum
.
values
()).
map
(
e
->
e
.
name
()).
collect
(
Collectors
.
toList
());
// 1.必填校验
List
<
String
>
errorRows
=
validateRequired
(
keys
,
jsonArray
);
if
(!
ObjectUtils
.
isEmpty
(
errorRows
))
{
throw
new
BadRequest
(
JSONArray
.
fromObject
(
errorRows
.
stream
().
map
(
e
->
"必填字段为空::"
+
e
).
collect
(
Collectors
.
toList
())).
toString
());
}
// 2.本次上传数据唯一性校验
errorRows
=
validateUnique
(
keys
,
jsonArray
);
if
(!
ObjectUtils
.
isEmpty
(
errorRows
))
{
throw
new
BadRequest
(
JSONArray
.
fromObject
(
errorRows
.
stream
().
map
(
e
->
"上传数据重复:"
+
e
).
collect
(
Collectors
.
toList
())).
toString
());
}
// 3.检查企业统一社会信用代码是否存在
Set
<
String
>
creditCodes
=
getAllData
(
FillingBeforeFieldEnum
.
creditCode
.
name
(),
jsonArray
);
errorRows
=
getNotExistEnterpriseInfoByCreditCode
(
creditCodes
);
if
(!
ObjectUtils
.
isEmpty
(
errorRows
))
{
throw
new
BadRequest
(
JSONArray
.
fromObject
(
errorRows
.
stream
().
map
(
e
->
"企业统一社会信用代码不存在:"
+
e
).
collect
(
Collectors
.
toList
())).
toString
());
}
return
true
;
}
public
boolean
validateCylinderInfo
(
List
<
CylinderInfoModel
>
infoData
)
{
JSONArray
jsonArray
=
JSONArray
.
fromObject
(
infoData
);
List
<
String
>
keys
=
Arrays
.
stream
(
CylinderInfoFieldEnum
.
values
()).
map
(
e
->
e
.
name
()).
collect
(
Collectors
.
toList
());
// 1.必填校验
List
<
String
>
errorRows
=
validateRequired
(
keys
,
jsonArray
);
if
(!
ObjectUtils
.
isEmpty
(
errorRows
))
{
throw
new
BadRequest
(
JSONArray
.
fromObject
(
errorRows
.
stream
().
map
(
e
->
"必填字段为空::"
+
e
).
collect
(
Collectors
.
toList
())).
toString
());
}
// 2.本次上传数据唯一性校验
errorRows
=
validateUnique
(
keys
,
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
());
}
// 4.检查企业统一社会信用代码是否存在
Set
<
String
>
creditCodes
=
getAllData
(
FillingBeforeFieldEnum
.
creditCode
.
name
(),
jsonArray
);
errorRows
=
getNotExistEnterpriseInfoByCreditCode
(
creditCodes
);
if
(!
ObjectUtils
.
isEmpty
(
errorRows
))
{
throw
new
BadRequest
(
JSONArray
.
fromObject
(
errorRows
.
stream
().
map
(
e
->
"企业统一社会信用代码不存在:"
+
e
).
collect
(
Collectors
.
toList
())).
toString
());
}
return
true
;
}
/**
* 验证气瓶充装数据
* @return
*/
public
CylinderFillingDataValidationResultModel
validateFilling
(
JSONObject
jsonobject
)
throws
ExecutionException
,
InterruptedException
{
CylinderFillingDataValidationResultModel
result
=
new
CylinderFillingDataValidationResultModel
();
CompletableFuture
<
List
<
String
>>
beforeFuture
=
CompletableFuture
.
supplyAsync
(()
->
{
// 异步校验检验前数据
return
validateFillingBeforeData
(
jsonobject
.
getJSONArray
(
"fillingBefore"
));
});
CompletableFuture
<
List
<
String
>>
recordFuture
=
CompletableFuture
.
supplyAsync
(()
->
{
// 异步校验检填充数据
return
validateFillingRecordData
(
jsonobject
.
getJSONArray
(
"filling"
));
});
CompletableFuture
<
List
<
String
>>
afterFuture
=
CompletableFuture
.
supplyAsync
(()
->
{
// 异步校验检填充后数据
return
validateFillinAfterData
(
jsonobject
.
getJSONArray
(
"fillingAfter"
));
});
/**
* 等待校验结果
*/
CompletableFuture
.
allOf
(
beforeFuture
,
recordFuture
,
afterFuture
);
result
.
setBeforeErrorData
(
beforeFuture
.
get
());
result
.
setRecordErrorData
(
recordFuture
.
get
());
result
.
setAfterErrorData
(
afterFuture
.
get
());
return
result
;
}
/**
* 验证检验前数据
* @param jsonArray
* @return List 异常数据
*/
public
List
<
String
>
validateFillingBeforeData
(
JSONArray
jsonArray
)
{
List
<
String
>
keys
=
Arrays
.
stream
(
FillingBeforeFieldEnum
.
values
()).
map
(
e
->
e
.
name
()).
collect
(
Collectors
.
toList
());
// 1.必填校验
List
<
String
>
errorRows
=
validateRequired
(
keys
,
jsonArray
);
if
(!
ObjectUtils
.
isEmpty
(
errorRows
))
{
return
errorRows
.
stream
().
map
(
e
->
"必填字段为空::"
+
e
).
collect
(
Collectors
.
toList
());
}
// 2.本次上传数据唯一性校验
errorRows
=
validateUnique
(
keys
,
jsonArray
);
if
(!
ObjectUtils
.
isEmpty
(
errorRows
))
{
return
errorRows
.
stream
().
map
(
e
->
"上传数据重复:"
+
e
).
collect
(
Collectors
.
toList
());
}
// 3.检查气瓶唯一标识码是否存在
Set
<
String
>
sequenceCodes
=
getAllData
(
FillingBeforeFieldEnum
.
sequenceCode
.
name
(),
jsonArray
);
errorRows
=
getNotExistSequenceCodes
(
sequenceCodes
);
if
(!
ObjectUtils
.
isEmpty
(
errorRows
))
{
return
errorRows
.
stream
().
map
(
e
->
"气瓶唯一标识码不存在:"
+
e
).
collect
(
Collectors
.
toList
());
}
// 4.检查企业统一社会信用代码是否存在
Set
<
String
>
creditCodes
=
getAllData
(
FillingBeforeFieldEnum
.
creditCode
.
name
(),
jsonArray
);
errorRows
=
getNotExistEnterpriseInfoByCreditCode
(
creditCodes
);
if
(!
ObjectUtils
.
isEmpty
(
errorRows
))
{
return
errorRows
.
stream
().
map
(
e
->
"企业统一社会信用代码不存在:"
+
e
).
collect
(
Collectors
.
toList
());
}
return
null
;
}
/**
* 验证检验记录数据
* @param jsonArray
* @return List 异常数据
*/
public
List
<
String
>
validateFillingRecordData
(
JSONArray
jsonArray
)
{
List
<
String
>
keys
=
Arrays
.
stream
(
FillingRecordFieldEnum
.
values
()).
map
(
e
->
e
.
name
()).
collect
(
Collectors
.
toList
());
// 1.必填校验
List
<
String
>
errorRows
=
validateRequired
(
keys
,
jsonArray
);
if
(!
ObjectUtils
.
isEmpty
(
errorRows
))
{
return
errorRows
.
stream
().
map
(
e
->
"必填字段为空::"
+
e
).
collect
(
Collectors
.
toList
());
}
// 2.本次上传数据唯一性校验
errorRows
=
validateUnique
(
keys
,
jsonArray
);
if
(!
ObjectUtils
.
isEmpty
(
errorRows
))
{
return
errorRows
.
stream
().
map
(
e
->
"上传数据重复:"
+
e
).
collect
(
Collectors
.
toList
());
}
// 3.检查气瓶唯一标识码是否存在
Set
<
String
>
sequenceCodes
=
getAllData
(
FillingBeforeFieldEnum
.
sequenceCode
.
name
(),
jsonArray
);
errorRows
=
getNotExistSequenceCodes
(
sequenceCodes
);
if
(!
ObjectUtils
.
isEmpty
(
errorRows
))
{
return
errorRows
.
stream
().
map
(
e
->
"气瓶唯一标识码不存在:"
+
e
).
collect
(
Collectors
.
toList
());
}
// 4.检查企业统一社会信用代码是否存在
Set
<
String
>
creditCodes
=
getAllData
(
FillingBeforeFieldEnum
.
creditCode
.
name
(),
jsonArray
);
errorRows
=
getNotExistEnterpriseInfoByCreditCode
(
creditCodes
);
if
(!
ObjectUtils
.
isEmpty
(
errorRows
))
{
return
errorRows
.
stream
().
map
(
e
->
"企业统一社会信用代码不存在:"
+
e
).
collect
(
Collectors
.
toList
());
}
return
null
;
}
/**
* 验证检验后数据
* @param jsonArray
* @return List 异常数据
*/
public
List
<
String
>
validateFillinAfterData
(
JSONArray
jsonArray
)
{
List
<
String
>
keys
=
Arrays
.
stream
(
FillingAfterFieldEnum
.
values
()).
map
(
e
->
e
.
name
()).
collect
(
Collectors
.
toList
());
// 1.必填校验
List
<
String
>
errorRows
=
validateRequired
(
keys
,
jsonArray
);
if
(!
ObjectUtils
.
isEmpty
(
errorRows
))
{
return
errorRows
.
stream
().
map
(
e
->
"必填字段为空::"
+
e
).
collect
(
Collectors
.
toList
());
}
// 2.本次上传数据唯一性校验
errorRows
=
validateUnique
(
keys
,
jsonArray
);
if
(!
ObjectUtils
.
isEmpty
(
errorRows
))
{
return
errorRows
.
stream
().
map
(
e
->
"上传数据重复:"
+
e
).
collect
(
Collectors
.
toList
());
}
// 3.检查气瓶唯一标识码是否存在
Set
<
String
>
sequenceCodes
=
getAllData
(
FillingBeforeFieldEnum
.
sequenceCode
.
name
(),
jsonArray
);
errorRows
=
getNotExistSequenceCodes
(
sequenceCodes
);
if
(!
ObjectUtils
.
isEmpty
(
errorRows
))
{
return
errorRows
.
stream
().
map
(
e
->
"气瓶唯一标识码不存在:"
+
e
).
collect
(
Collectors
.
toList
());
}
// 4.检查企业统一社会信用代码是否存在
Set
<
String
>
creditCodes
=
getAllData
(
FillingBeforeFieldEnum
.
creditCode
.
name
(),
jsonArray
);
errorRows
=
getNotExistEnterpriseInfoByCreditCode
(
creditCodes
);
if
(!
ObjectUtils
.
isEmpty
(
errorRows
))
{
return
errorRows
.
stream
().
map
(
e
->
"企业统一社会信用代码不存在:"
+
e
).
collect
(
Collectors
.
toList
());
}
return
null
;
}
/**
* 必填校验
* @param keys 需要校验的key
* @param jsonArray 被校验数据
* @return 校验结果 通过为 true,不通过为false
*/
public
List
<
String
>
validateRequired
(
List
<
String
>
keys
,
JSONArray
jsonArray
)
{
List
<
String
>
errorList
=
new
ArrayList
<>();
for
(
int
i
=
0
;
i
<
jsonArray
.
size
();
i
++)
{
JSONObject
row
=
jsonArray
.
getJSONObject
(
i
);
for
(
String
key
:
keys
)
{
if
(!
row
.
containsKey
(
key
)
||
row
.
get
(
key
)
==
null
)
{
errorList
.
add
(
row
.
toString
());
}
}
}
return
errorList
;
}
/**
* 数据唯一性校验
* @param keys 需要校验的key
* @param jsonArray 被校验数据
* @return 校验结果 通过为 true,不通过为false
*/
public
List
<
String
>
validateUnique
(
List
<
String
>
keys
,
JSONArray
jsonArray
)
{
Map
<
String
,
Set
<
Object
>>
valuesMap
=
new
HashMap
<>();
List
<
String
>
errorList
=
new
ArrayList
<>();
for
(
String
key
:
keys
)
{
valuesMap
.
put
(
key
,
new
HashSet
<>());
}
for
(
int
i
=
0
;
i
<
jsonArray
.
size
();
i
++)
{
JSONObject
row
=
jsonArray
.
getJSONObject
(
i
);
for
(
String
key
:
keys
)
{
if
(
valuesMap
.
get
(
key
).
contains
(
row
.
get
(
key
)))
{
errorList
.
add
(
row
.
toString
());
}
valuesMap
.
get
(
key
).
add
(
row
.
get
(
key
));
}
}
return
errorList
;
}
/**
* 获取指定 key的所有数据
* @param key
* @param jsonArray
* @return
*/
public
Set
<
String
>
getAllData
(
String
key
,
JSONArray
jsonArray
)
{
Set
<
String
>
sequenceCode
=
new
HashSet
<>();
for
(
int
i
=
0
;
i
<
jsonArray
.
size
();
i
++)
{
JSONObject
row
=
jsonArray
.
getJSONObject
(
i
);
sequenceCode
.
add
(
row
.
get
(
key
).
toString
());
}
return
sequenceCode
;
}
/**
* 校验企业唯一信用代码
* @param creditCodes
* @return
*/
public
List
<
String
>
getNotExistEnterpriseInfoByCreditCode
(
Set
<
String
>
creditCodes
)
{
List
<
EnterpriseInfoModel
>
enterpriseInfos
=
enterpriseInfoService
.
getEnterpriseInfoByCreditCode
(
creditCodes
);
if
(
enterpriseInfos
.
size
()
<
creditCodes
.
size
())
{
List
<
String
>
userCodes
=
enterpriseInfos
.
stream
().
map
(
e
->
e
.
getUseCode
()).
collect
(
Collectors
.
toList
());
return
creditCodes
.
stream
().
filter
(
c
->
!
userCodes
.
contains
(
c
)).
collect
(
Collectors
.
toList
());
}
return
null
;
}
/**
* 获取不存在的气瓶编码
* @param sequenceCodes
* @return
*/
public
List
<
String
>
getNotExistSequenceCodes
(
Set
<
String
>
sequenceCodes
)
{
List
<
RegistrationInfo
>
useInfos
=
registrationInfoMapper
.
getUseInfoByEquipCode
(
sequenceCodes
);
if
(
useInfos
.
size
()
<
sequenceCodes
.
size
())
{
List
<
String
>
equipCodes
=
useInfos
.
stream
().
map
(
e
->
e
.
getEquCode
()).
collect
(
Collectors
.
toList
());
return
sequenceCodes
.
stream
().
filter
(
c
->
!
equipCodes
.
contains
(
c
)).
collect
(
Collectors
.
toList
());
}
return
null
;
}
}
amos-boot-data/amos-boot-data-openapi/src/main/java/com/yeejoin/amos/api/openapi/face/service/CylinderFillingService.java
View file @
98220b51
...
@@ -53,5 +53,7 @@ public class CylinderFillingService extends BaseService<CylinderFillingModel,Cyl
...
@@ -53,5 +53,7 @@ public class CylinderFillingService extends BaseService<CylinderFillingModel,Cyl
String
tokenKey
=
Redis
.
genKey
(
Constant
.
TOKEN_PREFIX
,
RequestContext
.
getToken
());
String
tokenKey
=
Redis
.
genKey
(
Constant
.
TOKEN_PREFIX
,
RequestContext
.
getToken
());
BizTokenModel
bizTokenModel
=
(
BizTokenModel
)
redisTemplate
.
opsForValue
().
get
(
tokenKey
);
BizTokenModel
bizTokenModel
=
(
BizTokenModel
)
redisTemplate
.
opsForValue
().
get
(
tokenKey
);
return
bizTokenModel
.
getAppId
();
return
bizTokenModel
.
getAppId
();
}
}
}
}
amos-boot-data/amos-boot-data-openapi/src/main/java/com/yeejoin/amos/api/openapi/face/service/EnterpriseInfoService.java
View file @
98220b51
package
com
.
yeejoin
.
amos
.
api
.
openapi
.
face
.
service
;
package
com
.
yeejoin
.
amos
.
api
.
openapi
.
face
.
service
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.dynamic.datasource.annotation.DS
;
import
com.yeejoin.amos.api.openapi.enums.JgFileAttributeEnum
;
import
com.yeejoin.amos.api.openapi.enums.JgFileAttributeEnum
;
import
com.yeejoin.amos.api.openapi.enums.JgFileObjectEnum
;
import
com.yeejoin.amos.api.openapi.enums.JgFileObjectEnum
;
import
com.yeejoin.amos.api.openapi.face.model.EnterpriseInfoModel
;
import
com.yeejoin.amos.api.openapi.face.model.EnterpriseInfoModel
;
...
@@ -16,6 +17,7 @@ import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
...
@@ -16,6 +17,7 @@ import org.typroject.tyboot.core.restful.exception.instance.BadRequest;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Set
;
/**
/**
* 企业数据信息 服务类
* 企业数据信息 服务类
...
@@ -132,4 +134,9 @@ public class EnterpriseInfoService extends AppBaseService<EnterpriseInfoModel, E
...
@@ -132,4 +134,9 @@ public class EnterpriseInfoService extends AppBaseService<EnterpriseInfoModel, E
throw
new
BadRequest
(
"使用单位标识码为:"
+
models
.
getUseUnitCode
()+
"的企业,"
+
"同步状态不能为空!"
);
throw
new
BadRequest
(
"使用单位标识码为:"
+
models
.
getUseUnitCode
()+
"的企业,"
+
"同步状态不能为空!"
);
}
}
}
}
@DS
(
"tzs"
)
public
List
<
EnterpriseInfoModel
>
getEnterpriseInfoByCreditCode
(
Set
<
String
>
useCode
)
{
return
this
.
queryForList
(
""
,
false
,
useCode
);
}
}
}
amos-boot-data/amos-boot-data-openapi/src/main/resources/application-vb.properties
View file @
98220b51
...
@@ -2,10 +2,23 @@ spring.application.name=AMOS-API-OPENAPI
...
@@ -2,10 +2,23 @@ spring.application.name=AMOS-API-OPENAPI
server.servlet.context-path
=
/openapi
server.servlet.context-path
=
/openapi
server.port
=
11001
server.port
=
11001
# jdbc_config
# jdbc_config
spring.datasource.driver-class-name
=
cn.com.vastbase.Driver
spring.datasource.url
=
jdbc:vastbase://172.16.10.243:5432/tzs_amos_tzs_biz_init?currentSchema=amos_openapi_cyl
spring.datasource.url
=
jdbc:vastbase://172.16.10.243:5432/tzs_amos_tzs_biz_init?currentSchema=amos_openapi_cyl
&allowMultiQueries=true
spring.datasource.username
=
admin
spring.datasource.username
=
admin
spring.datasource.password
=
Yeejoin@2023
spring.datasource.password
=
Yeejoin@2023
spring.datasource.driver-class-name
=
cn.com.vastbase.Driver
spring.datasource.dynamic.primary
=
openapi
#ds tzs
spring.datasource.dynamic.datasource.openapi.url
=
jdbc:vastbase://172.16.10.243:5432/tzs_amos_tzs_biz_init?currentSchema=amos_openapi_cyl&allowMultiQueries=true
spring.datasource.dynamic.datasource.openapi.username
=
admin
spring.datasource.dynamic.datasource.openapi.password
=
Yeejoin@2023
spring.datasource.dynamic.datasource.openapi.driver-class-name
=
cn.com.vastbase.Driver
#ds cyl
spring.datasource.dynamic.datasource.tzs.url
=
jdbc:vastbase://172.16.10.243:5432/tzs_amos_tzs_biz_init?currentSchema=amos_openapi_cyl&allowMultiQueries=true
spring.datasource.dynamic.datasource.tzs.username
=
admin
spring.datasource.dynamic.datasource.tzs.password
=
Yeejoin@2023
spring.datasource.dynamic.datasource.tzs.driver-class-name
=
cn.com.vastbase.Driver
spring.datasource.type
=
com.zaxxer.hikari.HikariDataSource
spring.datasource.type
=
com.zaxxer.hikari.HikariDataSource
spring.datasource.hikari.minimum-idle
=
5
spring.datasource.hikari.minimum-idle
=
5
...
...
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