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
94662d07
Commit
94662d07
authored
Nov 18, 2022
by
曹盼盼
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改管材校验
parent
084bedb0
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
106 additions
and
57 deletions
+106
-57
ImageEnum.java
.../com/yeejoin/amos/boot/module/ugp/api/Enum/ImageEnum.java
+24
-0
MaterialServiceImpl.java
...boot/module/ugp/biz/service/impl/MaterialServiceImpl.java
+7
-3
VerifyServiceImpl.java
...s/boot/module/ugp/biz/service/impl/VerifyServiceImpl.java
+75
-54
No files found.
amos-boot-system-ugp/amos-boot-module-ugp-api/src/main/java/com/yeejoin/amos/boot/module/ugp/api/Enum/ImageEnum.java
0 → 100644
View file @
94662d07
package
com
.
yeejoin
.
amos
.
boot
.
module
.
ugp
.
api
.
Enum
;
import
lombok.AllArgsConstructor
;
import
lombok.Getter
;
import
lombok.NoArgsConstructor
;
/**
* @Author cpp
* @Description
* @Date 2022/11/18
*/
@Getter
@AllArgsConstructor
@NoArgsConstructor
public
enum
ImageEnum
{
JPG
(
"jpg"
),
JPEG
(
"jpeg"
),
GIF
(
"gif"
),
PNG
(
"png"
),
BMP
(
"bmp"
),
PSD
(
"psd"
);
private
String
name
;
}
amos-boot-system-ugp/amos-boot-module-ugp-biz/src/main/java/com/yeejoin/amos/boot/module/ugp/biz/service/impl/MaterialServiceImpl.java
View file @
94662d07
...
...
@@ -169,8 +169,11 @@ public class MaterialServiceImpl extends BaseService<MaterialDto, Material, Mate
return
jsonObject
;
}
public
Material
getMaterial
(
Long
materialId
){
Material
material
=
materialMapper
.
selectById
(
materialId
);
return
material
;
// 根据管材编号查询管材(管材编号必须唯一,报错一因为脏数据管材编号不唯一)
public
Material
getMaterial
(
String
code
){
LambdaQueryWrapper
<
Material
>
wrapper
=
new
LambdaQueryWrapper
<>(
);
wrapper
.
eq
(
Material
::
getCode
,
code
);
Material
material
=
materialMapper
.
selectOne
(
wrapper
);
return
material
;
}
}
\ No newline at end of file
amos-boot-system-ugp/amos-boot-module-ugp-biz/src/main/java/com/yeejoin/amos/boot/module/ugp/biz/service/impl/VerifyServiceImpl.java
View file @
94662d07
...
...
@@ -8,6 +8,7 @@ import com.alibaba.fastjson.JSONObject;
import
com.yeejoin.amos.boot.module.common.api.entity.OrgUsr
;
import
com.yeejoin.amos.boot.module.ugp.api.Enum.ImageEnum
;
import
com.yeejoin.amos.boot.module.ugp.api.Enum.StageEnum
;
import
com.yeejoin.amos.boot.module.ugp.api.Enum.VerifyEnum
;
...
...
@@ -39,7 +40,11 @@ import org.springframework.stereotype.Service;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
org.typroject.tyboot.core.restful.utils.ResponseHelper
;
import
javax.imageio.ImageIO
;
import
java.awt.*
;
import
java.awt.image.BufferedImage
;
import
java.io.File
;
import
java.io.IOException
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.util.*
;
...
...
@@ -322,7 +327,7 @@ public class VerifyServiceImpl extends BaseService<VerifyDto,Verify,VerifyMapper
Long
welderId
=
orgService
.
getReginParams
(
).
getBusinessInfo
(
).
getUserSequenceNbr
(
);
Long
random
=
jsonObject
.
getLong
(
"random"
);
//随机值
Long
projectId
=
jsonObject
.
getLong
(
"projectId"
);
//项目id
//
Long welderId = jsonObject.getLong("welderId"); //焊工id
//
Long welderId = jsonObject.getLong("welderId"); //焊工id
String
location
=
jsonObject
.
getString
(
"location"
);
//焊接定位信息
String
stage
=
jsonObject
.
getString
(
"stage"
);
//阶段检验
Date
time
=
new
Date
();
// //获取当前校验时间
...
...
@@ -386,16 +391,18 @@ public class VerifyServiceImpl extends BaseService<VerifyDto,Verify,VerifyMapper
if
(
stage
.
equals
(
StageEnum
.
焊前管材质量
.
getVerifyName
())){
//管材未校验,进行效验步骤
Long
materialId
=
jsonObject
.
getLong
(
"materialId"
);
//管材id
// Long materialId = jsonObject.getLong("materialId");//管材id
//改为管材编号
String
materialCode
=
jsonObject
.
getString
(
"materialId"
);
verify
.
setStage
(
StageEnum
.
焊前管材质量
.
getStage
());
/**校验*/
Boolean
flag
=
false
;
if
(!
ValidationUtil
.
isEmpty
(
material
Id
))
{
Material
material
=
materialService
.
getMaterial
(
material
Id
);
if
(!
ValidationUtil
.
isEmpty
(
material
Code
))
{
Material
material
=
materialService
.
getMaterial
(
material
Code
);
if
(!
ValidationUtil
.
isEmpty
(
material
))
{
jsonObject
.
put
(
"valid"
,
"有效"
);
jsonObject
.
put
(
"accord"
,
"符合"
);
flag
=
true
;
if
(
StringUtils
.
isNotEmpty
(
material
.
getManufacturer
()))
{
jsonObject
.
put
(
"manufacturer"
,
material
.
getManufacturer
());
}
...
...
@@ -403,6 +410,7 @@ public class VerifyServiceImpl extends BaseService<VerifyDto,Verify,VerifyMapper
jsonObject
.
put
(
"batchNumber"
,
material
.
getBatchNum
());
}
jsonObject
.
put
(
"permission"
,
"合格期内"
);
flag
=
true
;
}
else
{
jsonObject
.
put
(
"valid"
,
"已超期"
);
...
...
@@ -921,75 +929,50 @@ public class VerifyServiceImpl extends BaseService<VerifyDto,Verify,VerifyMapper
if
(
welderId
!=
null
)
{
openDto
.
setDetailId
(
welderId
);
//焊工的老照片
Map
map
=
orgService
.
getdetialInfo
(
welderId
.
toString
(
));
String
image
=
map
.
get
(
"image"
).
toString
();
JSONArray
jsonArray
=
JSONArray
.
parseArray
(
image
);
for
(
Object
o
:
jsonArray
)
{
JSONObject
ob
=
JSONObject
.
parseObject
(
o
.
toString
(
));
String
url
=
ob
.
getString
(
"url"
);
if
(!
StringUtils
.
isEmpty
(
url
))
{
openDto
.
setOldPhoto
(
url
);
if
(!
ValidationUtil
.
isEmpty
(
map
))
{
String
image
=
String
.
valueOf
(
map
.
get
(
"image"
))
;
if
(
StringUtils
.
isNotEmpty
(
image
))
{
JSONArray
jsonArray
=
JSONArray
.
parseArray
(
image
);
if
(
jsonArray
!=
null
&&
jsonArray
.
size
()>
0
)
{
for
(
Object
o
:
jsonArray
)
{
JSONObject
ob
=
JSONObject
.
parseObject
(
o
.
toString
(
));
if
(
ob
!=
null
)
{
String
url
=
ob
.
getString
(
"url"
);
if
(!
StringUtils
.
isEmpty
(
url
))
{
openDto
.
setOldPhoto
(
url
);
}
}
}
}
}
}
}
}
if
(
StageEnum
.
焊前设备
.
getStage
().
equals
(
verify
.
getStage
()))
{
Long
weldingId
=
object
.
getLong
(
"weldingId"
);
if
(
weldingId
!=
null
)
{
openDto
.
setDetailId
(
weldingId
);
AttachmentDto
enuipment
=
attachmentService
.
getAttachment
(
weldingId
);
if
(
enuipment
!=
null
)
{
String
info
=
enuipment
.
getInfo
(
);
if
(
StringUtils
.
isNotEmpty
(
info
))
{
JSONArray
jsonArray
=
JSONArray
.
parseArray
(
info
);
for
(
Object
o
:
jsonArray
)
{
JSONObject
object1
=
JSONObject
.
parseObject
(
o
.
toString
(
));
String
info1
=
object1
.
getString
(
"info"
);
JSONArray
jsonArray1
=
JSONArray
.
parseArray
(
info1
);
for
(
Object
o1
:
jsonArray1
)
{
JSONObject
object2
=
JSONObject
.
parseObject
(
o1
.
toString
(
));
String
url
=
object2
.
getString
(
"url"
);
if
(
StringUtils
.
isNotEmpty
(
url
))
{
openDto
.
setOldPhoto
(
url
);
}
}
}
}
String
image
=
this
.
getImage
(
weldingId
);
if
(
StringUtils
.
isNotEmpty
(
image
))
{
openDto
.
setOldPhoto
(
image
);
}
}
}
if
(
StageEnum
.
焊前管材质量
.
getStage
().
equals
(
verify
.
getStage
()))
{
Long
materialId
=
object
.
getLong
(
"materialId"
);
if
(
materialId
!=
null
)
{
openDto
.
setDetailId
(
materialId
);
AttachmentDto
enuipment
=
attachmentService
.
getAttachment
(
materialId
);
if
(
enuipment
!=
null
)
{
String
info
=
enuipment
.
getInfo
(
);
if
(
StringUtils
.
isNotEmpty
(
info
))
{
JSONArray
jsonArray
=
JSONArray
.
parseArray
(
info
);
for
(
Object
o
:
jsonArray
)
{
JSONObject
object1
=
JSONObject
.
parseObject
(
o
.
toString
(
));
String
info1
=
object1
.
getString
(
"info"
);
JSONArray
jsonArray1
=
JSONArray
.
parseArray
(
info1
);
for
(
Object
o1
:
jsonArray1
)
{
JSONObject
object2
=
JSONObject
.
parseObject
(
o1
.
toString
(
));
String
url
=
object2
.
getString
(
"url"
);
if
(
StringUtils
.
isNotEmpty
(
url
))
{
openDto
.
setOldPhoto
(
url
);
}
}
}
}
String
image
=
this
.
getImage
(
materialId
);
if
(
StringUtils
.
isNotEmpty
(
image
))
{
openDto
.
setOldPhoto
(
image
);
}
}
}
}
}
...
...
@@ -998,6 +981,44 @@ public class VerifyServiceImpl extends BaseService<VerifyDto,Verify,VerifyMapper
return
list
;
}
// 图片公共方法
public
String
getImage
(
Long
id
){
String
oldPhoto
=
null
;
if
(
id
!=
null
)
{
AttachmentDto
enuipment
=
attachmentService
.
getAttachment
(
id
);
if
(
enuipment
!=
null
)
{
String
info
=
enuipment
.
getInfo
(
);
if
(
StringUtils
.
isNotEmpty
(
info
))
{
JSONArray
jsonArray
=
JSONArray
.
parseArray
(
info
);
for
(
Object
o
:
jsonArray
)
{
JSONObject
object1
=
JSONObject
.
parseObject
(
o
.
toString
(
));
String
info1
=
object1
.
getString
(
"info"
);
JSONArray
jsonArray1
=
JSONArray
.
parseArray
(
info1
);
for
(
Object
o1
:
jsonArray1
)
{
JSONObject
object2
=
JSONObject
.
parseObject
(
o1
.
toString
(
));
oldPhoto
=
object2
.
getString
(
"url"
);
if
(
StringUtils
.
isNotEmpty
(
oldPhoto
))
{
String
[]
split
=
oldPhoto
.
split
(
"."
);
//不区分大小写.jpe .JPE,需要转换成小写写
String
suffix
=
split
[
split
.
length
-
1
].
toLowerCase
(
);
if
(
suffix
.
contains
(
ImageEnum
.
GIF
.
getName
())
||
suffix
.
contains
(
ImageEnum
.
PNG
.
getName
())
||
suffix
.
contains
(
ImageEnum
.
JPG
.
getName
())
||
suffix
.
contains
(
ImageEnum
.
JPEG
.
getName
())
||
suffix
.
contains
(
ImageEnum
.
BMP
.
getName
())
||
suffix
.
contains
(
ImageEnum
.
PSD
.
getName
()))
{
return
oldPhoto
;
}
}
}
}
}
}
}
return
oldPhoto
;
}
...
...
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