Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
D
data-acquisition
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
竹天卫
data-acquisition
Commits
49e234cd
Commit
49e234cd
authored
Apr 27, 2021
by
renchao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
炮孔设计模块代码编写
parent
28ae1e11
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
13 deletions
+23
-13
TSampleLaboratorysheetController.java
...business/controller/TSampleLaboratorysheetController.java
+4
-0
TSampleListServiceImpl.java
...isition/business/service/impl/TSampleListServiceImpl.java
+1
-1
ImageUtil.java
.../java/cn/wise/sc/acquisition/business/util/ImageUtil.java
+18
-12
No files found.
acquisition-business/src/main/java/cn/wise/sc/acquisition/business/controller/TSampleLaboratorysheetController.java
View file @
49e234cd
...
@@ -5,6 +5,7 @@ import cn.wise.sc.acquisition.business.model.query.TSampleLaboratorysheetQuery;
...
@@ -5,6 +5,7 @@ import cn.wise.sc.acquisition.business.model.query.TSampleLaboratorysheetQuery;
import
cn.wise.sc.acquisition.business.service.ITSampleLaboratorysheetService
;
import
cn.wise.sc.acquisition.business.service.ITSampleLaboratorysheetService
;
import
com.baomidou.mybatisplus.extension.api.R
;
import
com.baomidou.mybatisplus.extension.api.R
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestBody
;
...
@@ -40,6 +41,9 @@ public class TSampleLaboratorysheetController {
...
@@ -40,6 +41,9 @@ public class TSampleLaboratorysheetController {
*/
*/
@ApiOperation
(
value
=
"根据样号查看分析结果"
)
@ApiOperation
(
value
=
"根据样号查看分析结果"
)
@RequestMapping
(
value
=
"/getByYh"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
value
=
"/getByYh"
,
method
=
RequestMethod
.
GET
)
@ApiImplicitParam
(
name
=
"Yh"
,
value
=
"样号"
,
required
=
true
,
dataType
=
"String"
)
public
R
getByYh
(
TSampleLaboratorysheetQuery
tSampleLaboratorysheetQuery
)
{
public
R
getByYh
(
TSampleLaboratorysheetQuery
tSampleLaboratorysheetQuery
)
{
return
itSampleLaboratorysheetService
.
getByYh
(
tSampleLaboratorysheetQuery
);
return
itSampleLaboratorysheetService
.
getByYh
(
tSampleLaboratorysheetQuery
);
}
}
...
...
acquisition-business/src/main/java/cn/wise/sc/acquisition/business/service/impl/TSampleListServiceImpl.java
View file @
49e234cd
...
@@ -29,7 +29,7 @@ import java.util.Optional;
...
@@ -29,7 +29,7 @@ import java.util.Optional;
* 服务实现类
* 服务实现类
* </p>
* </p>
*
*
* @author
ztw
* @author
renchao
* @since 2021-04-22
* @since 2021-04-22
*/
*/
@Service
@Service
...
...
acquisition-business/src/main/java/cn/wise/sc/acquisition/business/util/ImageUtil.java
View file @
49e234cd
...
@@ -30,7 +30,7 @@ public class ImageUtil {
...
@@ -30,7 +30,7 @@ public class ImageUtil {
* 将文件转化为字节
* 将文件转化为字节
*/
*/
public
static
byte
[]
transformByte
(
MultipartFile
file
)
{
public
static
byte
[]
transformByte
(
MultipartFile
file
)
{
if
(
file
==
null
)
throw
new
RuntimeException
(
"
文件为空
"
);
if
(
file
==
null
)
throw
new
RuntimeException
(
"
transformByte method:file is null
"
);
try
{
try
{
byte
[]
pictureData
=
new
byte
[(
int
)
file
.
getSize
()];
byte
[]
pictureData
=
new
byte
[(
int
)
file
.
getSize
()];
InputStream
inputStream
=
file
.
getInputStream
();
InputStream
inputStream
=
file
.
getInputStream
();
...
@@ -39,7 +39,7 @@ public class ImageUtil {
...
@@ -39,7 +39,7 @@ public class ImageUtil {
return
pictureData
;
return
pictureData
;
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
throw
new
RuntimeException
(
"
图片转化失败
"
);
throw
new
RuntimeException
(
"
file transform picture is failed
"
);
}
}
}
}
...
@@ -47,7 +47,8 @@ public class ImageUtil {
...
@@ -47,7 +47,8 @@ public class ImageUtil {
* 将字节转化为文件,并下载
* 将字节转化为文件,并下载
*/
*/
public
static
void
transformImage
(
byte
[]
data
,
final
HttpServletResponse
response
)
{
public
static
void
transformImage
(
byte
[]
data
,
final
HttpServletResponse
response
)
{
if
(
data
.
length
==
0
)
throw
new
RuntimeException
(
"图片数据为空"
);
if
(
data
.
length
==
0
)
throw
new
RuntimeException
(
"transformImage method:byte[] data is null"
);
if
(
response
==
null
)
throw
new
RuntimeException
(
"transformImage method:HttpServletResponse response is null"
);
response
.
setContentType
(
"image/jpeg"
);
response
.
setContentType
(
"image/jpeg"
);
response
.
setCharacterEncoding
(
"UTF-8"
);
response
.
setCharacterEncoding
(
"UTF-8"
);
OutputStream
outputSream
;
OutputStream
outputSream
;
...
@@ -58,7 +59,7 @@ public class ImageUtil {
...
@@ -58,7 +59,7 @@ public class ImageUtil {
outputSream
.
close
();
outputSream
.
close
();
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
throw
new
RuntimeException
(
"
图片下载失败
"
);
throw
new
RuntimeException
(
"
picture download is failed
"
);
}
}
}
}
...
@@ -67,7 +68,7 @@ public class ImageUtil {
...
@@ -67,7 +68,7 @@ public class ImageUtil {
* 将多个文件转化为字节
* 将多个文件转化为字节
*/
*/
public
static
byte
[]
transformByteMore
(
MultipartFile
[]
files
)
{
public
static
byte
[]
transformByteMore
(
MultipartFile
[]
files
)
{
if
(
files
==
null
||
files
.
length
==
0
)
throw
new
RuntimeException
(
"
文件为空
"
);
if
(
files
==
null
||
files
.
length
==
0
)
throw
new
RuntimeException
(
"
transformByteMore method:files is null
"
);
try
{
try
{
//创建字节流数组
//创建字节流数组
List
<
byte
[]>
bytes
=
new
ArrayList
<>();
List
<
byte
[]>
bytes
=
new
ArrayList
<>();
...
@@ -88,7 +89,7 @@ public class ImageUtil {
...
@@ -88,7 +89,7 @@ public class ImageUtil {
return
data
;
return
data
;
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
throw
new
RuntimeException
(
"
图片转化失败
"
);
throw
new
RuntimeException
(
"
files transform picture is failed
"
);
}
}
}
}
...
@@ -97,7 +98,8 @@ public class ImageUtil {
...
@@ -97,7 +98,8 @@ public class ImageUtil {
* 将字节转化为文件,并下载
* 将字节转化为文件,并下载
*/
*/
public
static
void
transformImageMore
(
byte
[]
data
,
final
HttpServletResponse
response
)
{
public
static
void
transformImageMore
(
byte
[]
data
,
final
HttpServletResponse
response
)
{
if
(
data
==
null
||
data
.
length
==
0
)
throw
new
RuntimeException
(
"图片数据为空"
);
if
(
data
==
null
||
data
.
length
==
0
)
throw
new
RuntimeException
(
"transformImageMore method:byte[] data is null"
);
if
(
response
==
null
)
throw
new
RuntimeException
(
"transformImageMore method:HttpServletResponse response is null"
);
response
.
setContentType
(
"image/jpeg"
);
response
.
setContentType
(
"image/jpeg"
);
response
.
setCharacterEncoding
(
"UTF-8"
);
response
.
setCharacterEncoding
(
"UTF-8"
);
OutputStream
outputSream
=
null
;
OutputStream
outputSream
=
null
;
...
@@ -114,7 +116,7 @@ public class ImageUtil {
...
@@ -114,7 +116,7 @@ public class ImageUtil {
}
}
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
throw
new
RuntimeException
(
"
图片下载失败
"
);
throw
new
RuntimeException
(
"
files transform picture is failed
"
);
}
}
}
}
...
@@ -122,9 +124,9 @@ public class ImageUtil {
...
@@ -122,9 +124,9 @@ public class ImageUtil {
* 根据obj类型获取图片
* 根据obj类型获取图片
*/
*/
public
static
void
getImage
(
Integer
imageType
,
Object
obj
,
final
HttpServletResponse
response
)
{
public
static
void
getImage
(
Integer
imageType
,
Object
obj
,
final
HttpServletResponse
response
)
{
if
(
imageType
==
null
||
imageType
.
intValue
()
==
0
)
throw
new
RuntimeException
(
"
下载图片时imageType为空
"
);
if
(
imageType
==
null
||
imageType
.
intValue
()
==
0
)
throw
new
RuntimeException
(
"
getImage method:imageType is null
"
);
if
(
obj
==
null
)
throw
new
RuntimeException
(
"
下载图片时obj为空
"
);
if
(
obj
==
null
)
throw
new
RuntimeException
(
"
getImage method:Object obj is null
"
);
if
(
response
==
null
)
throw
new
RuntimeException
(
"
下载图片时response为空
"
);
if
(
response
==
null
)
throw
new
RuntimeException
(
"
getImage method:HttpServletResponse response is null
"
);
byte
[]
data
=
null
;
byte
[]
data
=
null
;
if
(
obj
instanceof
TSampleList
)
{
if
(
obj
instanceof
TSampleList
)
{
...
@@ -152,6 +154,10 @@ public class ImageUtil {
...
@@ -152,6 +154,10 @@ public class ImageUtil {
* 根据类型保存并转化文件为图片 需要请求参数ImageType 保存的实体TSampleList 以及file
* 根据类型保存并转化文件为图片 需要请求参数ImageType 保存的实体TSampleList 以及file
*/
*/
public
static
void
setImage
(
Integer
imageType
,
Object
obj
,
MultipartFile
file
)
{
public
static
void
setImage
(
Integer
imageType
,
Object
obj
,
MultipartFile
file
)
{
if
(
imageType
==
null
||
imageType
.
intValue
()
==
0
)
throw
new
RuntimeException
(
"getImage method:imageType is null"
);
if
(
obj
==
null
)
throw
new
RuntimeException
(
"getImage method:Object obj is null"
);
if
(
file
==
null
)
throw
new
RuntimeException
(
"getImage method:MultipartFile file is null"
);
if
(
obj
instanceof
TSampleList
)
{
if
(
obj
instanceof
TSampleList
)
{
TSampleList
tSampleList
=
(
TSampleList
)
obj
;
TSampleList
tSampleList
=
(
TSampleList
)
obj
;
//判断保存二维码还是记录形式
//判断保存二维码还是记录形式
...
@@ -174,7 +180,7 @@ public class ImageUtil {
...
@@ -174,7 +180,7 @@ public class ImageUtil {
* @param content
* @param content
*/
*/
public
static
byte
[]
QRCodeGenerator
(
String
content
)
{
public
static
byte
[]
QRCodeGenerator
(
String
content
)
{
if
(
StringUtils
.
isEmpty
(
content
))
throw
new
RuntimeException
(
"
二维码转化内容为空
"
);
if
(
StringUtils
.
isEmpty
(
content
))
throw
new
RuntimeException
(
"
QRCodeGenerator method:String content is null
"
);
ByteArrayOutputStream
stream
=
new
ByteArrayOutputStream
();
ByteArrayOutputStream
stream
=
new
ByteArrayOutputStream
();
BufferedImage
bufferedImage
=
QrCodeUtil
.
generate
(
content
,
200
,
200
);
BufferedImage
bufferedImage
=
QrCodeUtil
.
generate
(
content
,
200
,
200
);
try
{
try
{
...
...
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