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
1648b34d
Commit
1648b34d
authored
Sep 07, 2023
by
lisong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加重复校验
parent
40430e55
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
53 additions
and
23 deletions
+53
-23
EquipmentCategoryController.java
...odule/ymt/biz/controller/EquipmentCategoryController.java
+53
-23
No files found.
amos-boot-system-tzs/amos-boot-module-ymt/amos-boot-module-ymt-biz/src/main/java/com/yeejoin/amos/boot/module/ymt/biz/controller/EquipmentCategoryController.java
View file @
1648b34d
...
...
@@ -13,19 +13,16 @@ import com.yeejoin.amos.boot.module.ymt.api.dto.EquipExportDto;
import
com.yeejoin.amos.boot.module.ymt.api.dto.EquipmentCategoryDto
;
import
com.yeejoin.amos.boot.module.ymt.api.entity.EquipmentCategory
;
import
com.yeejoin.amos.boot.module.ymt.api.entity.IdxBizJgOtherInfo
;
import
com.yeejoin.amos.boot.module.ymt.api.entity.TzsJgOtherInfo
;
import
com.yeejoin.amos.boot.module.ymt.api.enums.ImageSizeEnums
;
import
com.yeejoin.amos.boot.module.ymt.api.mapper.EquipmentCategoryMapper
;
import
com.yeejoin.amos.boot.module.ymt.api.mapper.IdxBizJgOtherInfoMapper
;
import
com.yeejoin.amos.boot.module.ymt.api.service.IEquipmentCategoryService
;
import
com.yeejoin.amos.boot.module.ymt.api.service.ITzsJgOtherInfoService
;
import
com.yeejoin.amos.boot.module.ymt.api.vo.EquipExportVo
;
import
com.yeejoin.amos.boot.module.ymt.biz.service.impl.EquipmentCategoryServiceImpl
;
import
com.yeejoin.amos.boot.module.ymt.biz.utils.ImageUtils
;
import
com.yeejoin.amos.component.robot.BadRequest
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.checkerframework.checker.units.qual.A
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.http.HttpStatus
;
...
...
@@ -386,6 +383,39 @@ public class EquipmentCategoryController extends BaseController {
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@GetMapping
(
value
=
"/checkRepeat"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"校验码重复"
,
notes
=
"校验码重复"
)
public
ResponseModel
<
Boolean
>
checkRepeat
(
@RequestParam
(
value
=
"code"
)
String
code
,
@RequestParam
(
value
=
"elevatorCode"
,
required
=
false
)
String
elevatorCode
)
{
return
ResponseHelper
.
buildResponse
(
repeat
(
code
,
elevatorCode
));
}
private
Boolean
repeat
(
String
code
,
String
elevatorCode
){
boolean
flag
=
true
;
if
(!
ObjectUtils
.
isEmpty
(
code
))
{
LambdaQueryWrapper
<
IdxBizJgOtherInfo
>
lambda
=
new
QueryWrapper
<
IdxBizJgOtherInfo
>().
lambda
();
lambda
.
eq
(
IdxBizJgOtherInfo:
:
getClaimStatus
,
"已认领"
);
lambda
.
eq
(
IdxBizJgOtherInfo:
:
getSupervisoryCode
,
code
);
Integer
integer
=
idxBizJgOtherInfoMapper
.
selectCount
(
lambda
);
if
(
integer
>
1
)
{
flag
=
false
;
}
}
if
(!
ObjectUtils
.
isEmpty
(
elevatorCode
))
{
LambdaQueryWrapper
<
IdxBizJgOtherInfo
>
lambda
=
new
QueryWrapper
<
IdxBizJgOtherInfo
>().
lambda
();
lambda
.
eq
(
IdxBizJgOtherInfo:
:
getClaimStatus
,
"已认领"
);
lambda
.
eq
(
IdxBizJgOtherInfo:
:
getCode96333
,
elevatorCode
);
Integer
integer
=
idxBizJgOtherInfoMapper
.
selectCount
(
lambda
);
if
(
integer
>
1
)
{
flag
=
false
;
}
}
return
flag
;
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@GetMapping
(
value
=
"/exportImage"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"设备监管码下载"
,
notes
=
"设备监管码下载"
)
public
void
exportImage
(
HttpServletResponse
response
,
@RequestParam
(
"code"
)
String
code
,
@RequestParam
(
"type"
)
String
type
,
@RequestParam
(
value
=
"elevatorCode"
,
required
=
false
)
String
elevatorCode
)
throws
IOException
,
FileNotFoundException
{
...
...
@@ -393,19 +423,10 @@ public class EquipmentCategoryController extends BaseController {
// 获取resources目录下的文件输入流
InputStream
bgImgFile
=
getClass
().
getClassLoader
().
getResourceAsStream
(
"temp/"
+
imageSizeEnums
.
getBgPath
());
File
QrCodeFile
;
LambdaQueryWrapper
<
IdxBizJgOtherInfo
>
lambda
=
new
QueryWrapper
<
IdxBizJgOtherInfo
>().
lambda
();
lambda
.
eq
(
IdxBizJgOtherInfo:
:
getClaimStatus
,
"已认领"
);
if
(
ImageSizeEnums
.
DT
.
getCode
().
equals
(
type
))
{
lambda
.
eq
(
IdxBizJgOtherInfo:
:
getCode96333
,
elevatorCode
);
}
else
{
lambda
.
eq
(
IdxBizJgOtherInfo:
:
getSupervisoryCode
,
code
);
}
Integer
integer
=
idxBizJgOtherInfoMapper
.
selectCount
(
lambda
);
if
(
integer
>
1
)
{
boolean
repeat
=
repeat
(
code
,
elevatorCode
);
if
(!
repeat
)
{
throw
new
BadRequest
(
"存在重复数据,请联系管理员!"
);
}
if
(
ImageSizeEnums
.
DT
.
getCode
().
equals
(
type
))
{
QrCodeFile
=
File
.
createTempFile
(
elevatorCode
,
".png"
);
ImageUtils
.
creatQRCode
(
QrCodeFile
,
bgImgFile
,
imageSizeEnums
.
getWith
(),
imageSizeEnums
.
getHeight
(),
REGULATORY_CODE_PREFIX
+
code
,
""
,
elevatorCode
,
imageSizeEnums
.
getSize
(),
imageSizeEnums
.
getImagesX
(),
imageSizeEnums
.
getImagesY
(),
imageSizeEnums
.
getText1X
(),
imageSizeEnums
.
getText1Y
(),
imageSizeEnums
.
getText2X
(),
imageSizeEnums
.
getText2Y
());
...
...
@@ -446,16 +467,25 @@ public class EquipmentCategoryController extends BaseController {
ImageUtils
.
downloadResourceZip
(
"设备码信息.zip"
,
zipFile
.
getAbsolutePath
(),
response
);
zipFile
.
delete
();
}
LambdaQueryWrapper
<
IdxBizJgOtherInfo
>
lambda
=
new
QueryWrapper
<
IdxBizJgOtherInfo
>().
lambda
();
lambda
.
eq
(
IdxBizJgOtherInfo:
:
getClaimStatus
,
"已认领"
);
if
(
ImageSizeEnums
.
DT
.
getCode
().
equals
(
type
))
{
lambda
.
in
(
IdxBizJgOtherInfo:
:
getCode96333
,
equipExportData
.
stream
().
map
(
item
->
item
.
get
(
"CODE96333"
)).
collect
(
Collectors
.
toList
()));
}
else
{
lambda
.
in
(
IdxBizJgOtherInfo:
:
getSupervisoryCode
,
equipExportData
.
stream
().
map
(
item
->
item
.
get
(
"SUPERVISORY_CODE"
)).
collect
(
Collectors
.
toList
()));
List
<
Object
>
code96333
=
equipExportData
.
stream
().
filter
(
item
->
!
ObjectUtils
.
isEmpty
(
item
.
get
(
"CODE96333"
))).
map
(
item
->
item
.
get
(
"CODE96333"
)).
collect
(
Collectors
.
toList
());
if
(!
ObjectUtils
.
isEmpty
(
code96333
))
{
LambdaQueryWrapper
<
IdxBizJgOtherInfo
>
lambda
=
new
QueryWrapper
<
IdxBizJgOtherInfo
>().
lambda
();
lambda
.
eq
(
IdxBizJgOtherInfo:
:
getClaimStatus
,
"已认领"
);
lambda
.
in
(
IdxBizJgOtherInfo:
:
getCode96333
,
code96333
);
Integer
integer
=
idxBizJgOtherInfoMapper
.
selectCount
(
lambda
);
if
(!
map
.
get
(
"size"
).
equals
(
String
.
valueOf
(
integer
)))
{
throw
new
BadRequest
(
"存在重复数据,请联系管理员!"
);
}
}
Integer
integer
=
idxBizJgOtherInfoMapper
.
selectCount
(
lambda
);
if
(!
map
.
get
(
"size"
).
equals
(
String
.
valueOf
(
integer
)))
{
throw
new
BadRequest
(
"存在重复数据,请联系管理员!"
);
List
<
Object
>
supervisoryCode
=
equipExportData
.
stream
().
filter
(
item
->
!
ObjectUtils
.
isEmpty
(
item
.
get
(
"SUPERVISORY_CODE"
))).
map
(
item
->
item
.
get
(
"SUPERVISORY_CODE"
)).
collect
(
Collectors
.
toList
());
if
(!
ObjectUtils
.
isEmpty
(
supervisoryCode
))
{
LambdaQueryWrapper
<
IdxBizJgOtherInfo
>
lambda
=
new
QueryWrapper
<
IdxBizJgOtherInfo
>().
lambda
();
lambda
.
eq
(
IdxBizJgOtherInfo:
:
getClaimStatus
,
"已认领"
);
lambda
.
in
(
IdxBizJgOtherInfo:
:
getSupervisoryCode
,
supervisoryCode
);
Integer
integer
=
idxBizJgOtherInfoMapper
.
selectCount
(
lambda
);
if
(!
map
.
get
(
"size"
).
equals
(
String
.
valueOf
(
integer
)))
{
throw
new
BadRequest
(
"存在重复数据,请联系管理员!"
);
}
}
if
(
ImageSizeEnums
.
DT
.
getCode
().
equals
(
type
))
{
for
(
JSONObject
equipExportDatum
:
equipExportData
.
stream
().
filter
(
item
->
!
ObjectUtils
.
isEmpty
(
item
.
get
(
"CODE96333"
))).
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