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
a612be28
Commit
a612be28
authored
Jul 06, 2023
by
lisong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加监管码导出
parent
7065f92c
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
439 additions
and
15 deletions
+439
-15
ImageSizeEnums.java
...eejoin/amos/boot/module/tzs/api/enums/ImageSizeEnums.java
+45
-0
IdxFeignService.java
...n/amos/boot/module/tzs/flc/api/feign/IdxFeignService.java
+1
-0
EquipmentCategoryMapper.xml
...api/src/main/resources/mapper/EquipmentCategoryMapper.xml
+1
-0
EquipmentCategoryController.java
...odule/tzs/biz/controller/EquipmentCategoryController.java
+75
-4
ImageUtils.java
...om/yeejoin/amos/boot/module/tzs/biz/utils/ImageUtils.java
+305
-0
RegUnitInfoServiceImpl.java
...dule/tzs/flc/biz/service/impl/RegUnitInfoServiceImpl.java
+12
-11
bigBg.png
...mos-boot-module-tzs-biz/src/main/resources/temp/bigBg.png
+0
-0
centreBg.png
...-boot-module-tzs-biz/src/main/resources/temp/centreBg.png
+0
-0
dt.png
...s/amos-boot-module-tzs-biz/src/main/resources/temp/dt.png
+0
-0
smallBg.png
...s-boot-module-tzs-biz/src/main/resources/temp/smallBg.png
+0
-0
No files found.
amos-boot-system-tzs/amos-boot-module-tzs-api/src/main/java/com/yeejoin/amos/boot/module/tzs/api/enums/ImageSizeEnums.java
0 → 100644
View file @
a612be28
package
com
.
yeejoin
.
amos
.
boot
.
module
.
tzs
.
api
.
enums
;
import
lombok.AllArgsConstructor
;
import
lombok.Getter
;
@AllArgsConstructor
@Getter
public
enum
ImageSizeEnums
{
/**
* 导出监管码、96333码尺寸
*/
// 监管码-大
JG_BIG
(
"JG_BIG"
,
"bigBg.png"
,
350
,
350
,
60
,
720
,
190
,
0
,
0
,
780
,
680
),
// 监管码-中
JG_MID
(
"JG_MID"
,
"centreBg.png"
,
230
,
230
,
40
,
480
,
170
,
0
,
0
,
520
,
525
),
// 监管码-小
JG_MIN
(
"JG_MIN"
,
"smallBg.png"
,
170
,
170
,
30
,
360
,
110
,
0
,
0
,
380
,
355
),
// 96333电梯码
DT
(
"DT"
,
"dt.png"
,
170
,
170
,
30
,
30
,
110
,
0
,
0
,
330
,
355
);
String
code
;
String
bgPath
;
Integer
with
;
Integer
height
;
Integer
size
;
Integer
imagesX
;
Integer
imagesY
;
Integer
text1X
;
Integer
text1Y
;
Integer
text2X
;
Integer
text2Y
;
public
static
ImageSizeEnums
getEnumByCode
(
String
code
)
{
for
(
ImageSizeEnums
value
:
ImageSizeEnums
.
values
())
{
if
(
value
.
getCode
().
equals
(
code
))
{
return
value
;
}
}
return
null
;
}
}
amos-boot-system-tzs/amos-boot-module-tzs-api/src/main/java/com/yeejoin/amos/boot/module/tzs/flc/api/feign/IdxFeignService.java
View file @
a612be28
...
...
@@ -84,6 +84,7 @@ public interface IdxFeignService {
FeignClientResult
<
String
>
submit
(
@RequestParam
(
value
=
"pageId"
)
long
pageId
,
@RequestParam
(
value
=
"taskId"
,
required
=
false
)
String
taskId
,
@RequestParam
(
value
=
"planInstanceId"
,
required
=
false
)
String
planInstanceId
,
@RequestParam
(
value
=
"bizField"
,
required
=
false
)
String
bizField
,
@RequestParam
(
value
=
"topic"
,
required
=
false
)
String
topic
,
@RequestParam
(
value
=
"tableName"
,
required
=
false
)
String
tableName
,
@RequestBody
Map
<
String
,
Object
>
kv
)
throws
Exception
;
...
...
amos-boot-system-tzs/amos-boot-module-tzs-api/src/main/resources/mapper/EquipmentCategoryMapper.xml
View file @
a612be28
...
...
@@ -345,6 +345,7 @@
<if
test=
"dto.ORG_BRANCH_NAME != '' and dto.ORG_BRANCH_NAME != null"
>
and ORG_BRANCH_NAME = #{dto.ORG_BRANCH_NAME}
</if>
<if
test=
"dto.USE_PLACE != '' and dto.USE_PLACE != null"
>
and USE_PLACE = #{dto.USE_PLACE}
</if>
<if
test=
"dto.STATUS != '' and dto.STATUS != null"
>
and STATUS = #{dto.STATUS}
</if>
<if
test=
"dto.EQU_CATEGORY != '' and dto.EQU_CATEGORY != null"
>
and EQU_CATEGORY = #{dto.EQU_CATEGORY}
</if>
<if
test=
"dto.USE_UNIT_CREDIT_CODE != '' and dto.USE_UNIT_CREDIT_CODE != null"
>
and USE_UNIT_CREDIT_CODE like concat('%', #{dto.USE_UNIT_CREDIT_CODE},'%')
</if>
<if
test=
"dto.ORG_BRANCH_CODE != '' and dto.ORG_BRANCH_CODE != null"
>
and ORG_BRANCH_CODE like concat('%', #{dto.ORG_BRANCH_CODE},'%')
</if>
<if
test=
'dto.ids != null'
>
and SEQUENCE_NBR in
...
...
amos-boot-system-tzs/amos-boot-module-tzs-biz/src/main/java/com/yeejoin/amos/boot/module/tzs/biz/controller/EquipmentCategoryController.java
View file @
a612be28
package
com
.
yeejoin
.
amos
.
boot
.
module
.
tzs
.
biz
.
controller
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
...
...
@@ -13,13 +14,16 @@ import com.yeejoin.amos.boot.module.tzs.api.dto.EquipExportDto;
import
com.yeejoin.amos.boot.module.tzs.api.dto.EquipmentCategoryDto
;
import
com.yeejoin.amos.boot.module.tzs.api.entity.CategoryOtherInfo
;
import
com.yeejoin.amos.boot.module.tzs.api.entity.EquipmentCategory
;
import
com.yeejoin.amos.boot.module.tzs.api.enums.ImageSizeEnums
;
import
com.yeejoin.amos.boot.module.tzs.api.mapper.EquipmentCategoryMapper
;
import
com.yeejoin.amos.boot.module.tzs.api.service.IEquipmentCategoryService
;
import
com.yeejoin.amos.boot.module.tzs.api.vo.EquipExportVo
;
import
com.yeejoin.amos.boot.module.tzs.biz.service.impl.EquipmentCategoryServiceImpl
;
import
com.yeejoin.amos.boot.module.tzs.biz.utils.ImageUtils
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.util.ObjectUtils
;
import
org.springframework.web.bind.annotation.*
;
...
...
@@ -30,10 +34,12 @@ import org.typroject.tyboot.core.restful.utils.ResponseModel;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
java.util.ArrayList
;
import
java.util.Collection
;
import
java.util.List
;
import
java.util.Map
;
import
java.io.*
;
import
java.net.URL
;
import
java.util.*
;
import
java.util.stream.Collectors
;
import
java.util.zip.ZipEntry
;
import
java.util.zip.ZipOutputStream
;
/**
* 装备分类
...
...
@@ -55,6 +61,13 @@ public class EquipmentCategoryController extends BaseController {
EquipmentCategoryMapper
equipmentCategoryMapper
;
@Value
(
"${regulatory_code_prefix}"
)
String
REGULATORY_CODE_PREFIX
;
/**
* 监管码背景图路径
*/
private
static
final
String
BASE_PATH
=
"amos-boot-system-tzs/amos-boot-module-tzs-biz/src/main/resources/temp/"
;
/**
* 新增装备分类
...
...
@@ -374,6 +387,64 @@ public class EquipmentCategoryController extends BaseController {
}
@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
)
throws
IOException
{
FileInputStream
bgImgFile
=
null
;
ImageSizeEnums
imageSizeEnums
=
ImageSizeEnums
.
getEnumByCode
(
type
);
try
{
bgImgFile
=
new
FileInputStream
(
BASE_PATH
+
imageSizeEnums
.
getBgPath
());
}
catch
(
FileNotFoundException
e
)
{
e
.
printStackTrace
();
}
File
QrCodeFile
=
new
File
(
BASE_PATH
+
code
+
".png"
);
ImageUtils
.
creatQRCode
(
QrCodeFile
,
bgImgFile
,
imageSizeEnums
.
getWith
(),
imageSizeEnums
.
getHeight
(),
REGULATORY_CODE_PREFIX
+
code
,
""
,
code
,
imageSizeEnums
.
getSize
(),
imageSizeEnums
.
getImagesX
(),
imageSizeEnums
.
getImagesY
(),
imageSizeEnums
.
getText1X
(),
imageSizeEnums
.
getText1Y
(),
imageSizeEnums
.
getText2X
(),
imageSizeEnums
.
getText2Y
());
ImageUtils
.
downloadResource
(
code
+
".png"
,
BASE_PATH
+
code
+
".png"
,
response
);
QrCodeFile
.
delete
();
}
@TycloudOperation
(
ApiLevel
=
UserType
.
AGENCY
)
@GetMapping
(
value
=
"/exportImageZip"
)
@ApiOperation
(
httpMethod
=
"GET"
,
value
=
"设备信息导出"
,
notes
=
"设备信息导出"
)
public
void
exportImageZip
(
HttpServletResponse
response
,
EquipExportDto
dto
,
@RequestParam
(
"type"
)
String
type
)
throws
IOException
{
File
delete
=
new
File
(
BASE_PATH
+
"images"
);
if
(!
delete
.
exists
())
{
delete
.
mkdir
();
}
ImageSizeEnums
imageSizeEnums
=
ImageSizeEnums
.
getEnumByCode
(
type
);
//创建list 存放图片
List
<
File
>
fileList
=
new
ArrayList
<>();
List
<
EquipExportVo
>
equipExportData
=
equipmentCategoryServiceImpl
.
getEquipExportData
(
dto
);
List
<
EquipExportVo
>
unique
=
equipExportData
.
stream
().
collect
(
Collectors
.
collectingAndThen
(
Collectors
.
toCollection
(()
->
new
TreeSet
<>(
Comparator
.
comparing
(
o
->
o
.
getSupervisoryCode
()
+
";"
+
o
.
getCode96333
()))),
ArrayList:
:
new
)
);
for
(
EquipExportVo
equipExportDatum
:
unique
)
{
FileInputStream
bgImgFile
=
new
FileInputStream
(
BASE_PATH
+
imageSizeEnums
.
getBgPath
());
if
(
"DT"
.
equals
(
type
)
&&
!
ObjectUtils
.
isEmpty
(
equipExportDatum
.
getCode96333
()))
{
File
QrCodeFile
=
new
File
(
BASE_PATH
+
"images/"
+
equipExportDatum
.
getCode96333
()
+
".png"
);
ImageUtils
.
creatQRCode
(
QrCodeFile
,
bgImgFile
,
imageSizeEnums
.
getWith
(),
imageSizeEnums
.
getHeight
(),
REGULATORY_CODE_PREFIX
+
equipExportDatum
.
getCode96333
(),
""
,
equipExportDatum
.
getCode96333
(),
imageSizeEnums
.
getSize
(),
imageSizeEnums
.
getImagesX
(),
imageSizeEnums
.
getImagesY
(),
imageSizeEnums
.
getText1X
(),
imageSizeEnums
.
getText1Y
(),
imageSizeEnums
.
getText2X
(),
imageSizeEnums
.
getText2Y
());
fileList
.
add
(
new
File
(
BASE_PATH
+
"images/"
+
equipExportDatum
.
getCode96333
()
+
".png"
));
}
else
if
(!
ObjectUtils
.
isEmpty
(
equipExportDatum
.
getSupervisoryCode
()))
{
File
QrCodeFile
=
new
File
(
BASE_PATH
+
"images/"
+
equipExportDatum
.
getSupervisoryCode
()
+
".png"
);
ImageUtils
.
creatQRCode
(
QrCodeFile
,
bgImgFile
,
imageSizeEnums
.
getWith
(),
imageSizeEnums
.
getHeight
(),
REGULATORY_CODE_PREFIX
+
equipExportDatum
.
getSupervisoryCode
(),
""
,
equipExportDatum
.
getSupervisoryCode
(),
imageSizeEnums
.
getSize
(),
imageSizeEnums
.
getImagesX
(),
imageSizeEnums
.
getImagesY
(),
imageSizeEnums
.
getText1X
(),
imageSizeEnums
.
getText1Y
(),
imageSizeEnums
.
getText2X
(),
imageSizeEnums
.
getText2Y
());
fileList
.
add
(
new
File
(
BASE_PATH
+
"images/"
+
equipExportDatum
.
getSupervisoryCode
()
+
".png"
));
}
bgImgFile
.
close
();
}
File
zipFile
=
new
File
(
BASE_PATH
+
"images/imageZip.zip"
);
zipFile
.
createTempFile
(
"imageZip"
,
".zip"
);
// 调用压缩方法
ImageUtils
.
zipFiles
(
fileList
,
zipFile
);
ImageUtils
.
downloadResourceZip
(
"imageZip.zip"
,
BASE_PATH
+
"images/imageZip.zip"
,
response
);
zipFile
.
delete
();
ImageUtils
.
deleteAllFilesOfDir
(
delete
);
if
(
delete
.
exists
())
{
ImageUtils
.
deleteAllFilesOfDir
(
delete
);
}
}
}
amos-boot-system-tzs/amos-boot-module-tzs-biz/src/main/java/com/yeejoin/amos/boot/module/tzs/biz/utils/ImageUtils.java
0 → 100644
View file @
a612be28
package
com
.
yeejoin
.
amos
.
boot
.
module
.
tzs
.
biz
.
utils
;
import
com.google.zxing.BarcodeFormat
;
import
com.google.zxing.EncodeHintType
;
import
com.google.zxing.MultiFormatWriter
;
import
com.google.zxing.common.BitMatrix
;
import
com.itextpdf.text.pdf.qrcode.ErrorCorrectionLevel
;
import
javax.imageio.ImageIO
;
import
javax.servlet.http.HttpServletResponse
;
import
java.awt.*
;
import
java.awt.image.BufferedImage
;
import
java.io.*
;
import
java.net.URLEncoder
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.zip.ZipEntry
;
import
java.util.zip.ZipOutputStream
;
public
class
ImageUtils
{
private
static
final
int
QRCOLOR
=
0x201f1f
;
// 二维码颜色:黑色
private
static
final
int
BGWHITE
=
0xFFFFFF
;
//二维码背景颜色:白色
private
static
Map
<
EncodeHintType
,
Object
>
hints
=
new
HashMap
<
EncodeHintType
,
Object
>()
{
private
static
final
long
serialVersionUID
=
1L
;
{
put
(
EncodeHintType
.
ERROR_CORRECTION
,
ErrorCorrectionLevel
.
M
);
// 设置QR二维码的纠错级别(H为最高级别)
put
(
EncodeHintType
.
CHARACTER_SET
,
"utf-8"
);
// 设置编码方式
put
(
EncodeHintType
.
MARGIN
,
0
);
// 白边
}
};
/**
* 生成二维码图片+背景+文字描述
*
* @param codeFile 生成图地址
* @param bgImgFile 背景图地址
* @param width 二维码宽度
* @param height 二维码高度
* @param qrUrl 内容
* @param note 文字说明
* @param tui 文字说明2
* @param size 文字大小
* @param imagesX 二维码x轴方向
* @param imagesY 二维码y轴方向
* @param text1X 文字描述1x轴方向
* @param text1Y 文字描述1y轴方向
* @param text2X 文字描述2x轴方向
* @param text2Y 文字描述2y轴方向
*/
public
static
void
creatQRCode
(
File
codeFile
,
FileInputStream
bgImgFile
,
Integer
width
,
Integer
height
,
String
qrUrl
,
String
note
,
String
tui
,
Integer
size
,
Integer
imagesX
,
Integer
imagesY
,
Integer
text1X
,
Integer
text1Y
,
Integer
text2X
,
Integer
text2Y
)
throws
IOException
{
try
{
MultiFormatWriter
multiFormatWriter
=
new
MultiFormatWriter
();
BitMatrix
bm
=
multiFormatWriter
.
encode
(
qrUrl
,
BarcodeFormat
.
QR_CODE
,
width
,
height
,
hints
);
BufferedImage
image
=
new
BufferedImage
(
width
,
height
,
BufferedImage
.
TYPE_INT_RGB
);
for
(
int
x
=
0
;
x
<
width
;
x
++)
{
for
(
int
y
=
0
;
y
<
height
;
y
++)
{
image
.
setRGB
(
x
,
y
,
bm
.
get
(
x
,
y
)
?
QRCOLOR
:
BGWHITE
);
}
}
BufferedImage
backgroundImage
=
ImageIO
.
read
(
bgImgFile
);
int
bgWidth
=
backgroundImage
.
getWidth
();
int
qrWidth
=
image
.
getWidth
();
int
disx
=
(
bgWidth
-
qrWidth
)
-
imagesX
;
int
disy
=
imagesY
;
Graphics2D
rng
=
backgroundImage
.
createGraphics
();
rng
.
setComposite
(
AlphaComposite
.
getInstance
(
AlphaComposite
.
SRC_ATOP
));
rng
.
drawImage
(
image
,
disx
,
disy
,
width
,
height
,
null
);
// 抗锯齿
rng
.
setRenderingHint
(
RenderingHints
.
KEY_ANTIALIASING
,
RenderingHints
.
VALUE_ANTIALIAS_ON
);
// 文字描述参数设置
Color
textColor
=
Color
.
white
;
rng
.
setColor
(
textColor
);
rng
.
drawImage
(
backgroundImage
,
0
,
0
,
null
);
// 设置字体类型和大小(BOLD加粗/ PLAIN平常)
rng
.
setFont
(
new
Font
(
"Microsoft YaHei"
,
Font
.
BOLD
,
size
));
// 设置字体颜色
rng
.
setColor
(
Color
.
black
);
int
strWidth
=
rng
.
getFontMetrics
().
stringWidth
(
note
);
// 文字1显示位置
int
disx1
=
(
bgWidth
-
strWidth
)
-
text1X
;
//左右
rng
.
drawString
(
note
,
disx1
,
text1Y
);
//上下
// 文字2显示位置
int
disx2
=
(
bgWidth
-
strWidth
)
-
text2X
;
//左右
rng
.
drawString
(
tui
,
disx2
,
text2Y
);
//上下
rng
.
dispose
();
image
=
backgroundImage
;
image
.
flush
();
ImageIO
.
write
(
image
,
"png"
,
codeFile
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
finally
{
if
(
null
!=
bgImgFile
)
{
bgImgFile
.
close
();
}
}
}
/**
* 下载图片
*
* @param fileName
* @param resourceName
* @param response
*/
public
static
void
downloadResource
(
String
fileName
,
String
resourceName
,
HttpServletResponse
response
)
{
DataInputStream
in
=
null
;
OutputStream
out
=
null
;
InputStream
fileInputStream
=
null
;
try
{
response
.
reset
();
response
.
setCharacterEncoding
(
"UTF-8"
);
response
.
setHeader
(
"content-Type"
,
"image/png"
);
response
.
setHeader
(
"Content-Disposition"
,
"attachment;filename="
+
URLEncoder
.
encode
(
fileName
,
"UTF-8"
));
response
.
setHeader
(
"Access-Control-Expose-Headers"
,
"Content-Disposition"
);
fileInputStream
=
new
FileInputStream
(
resourceName
);
in
=
new
DataInputStream
(
fileInputStream
);
out
=
response
.
getOutputStream
();
int
bytes
=
0
;
byte
[]
bufferOut
=
new
byte
[
1024
];
while
((
bytes
=
in
.
read
(
bufferOut
))
!=
-
1
)
{
out
.
write
(
bufferOut
,
0
,
bytes
);
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
response
.
reset
();
}
finally
{
try
{
if
(
out
!=
null
)
{
out
.
close
();
}
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
try
{
if
(
in
!=
null
)
{
in
.
close
();
}
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
try
{
if
(
fileInputStream
!=
null
)
{
fileInputStream
.
close
();
}
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
}
/**
* 下载压缩包
*
* @param fileName
* @param resourceName
* @param response
*/
public
static
void
downloadResourceZip
(
String
fileName
,
String
resourceName
,
HttpServletResponse
response
)
{
DataInputStream
in
=
null
;
OutputStream
out
=
null
;
InputStream
fileInputStream
=
null
;
try
{
response
.
reset
();
response
.
setCharacterEncoding
(
"UTF-8"
);
response
.
setHeader
(
"content-Type"
,
"application/zip"
);
response
.
setHeader
(
"Content-Disposition"
,
"attachment;filename="
+
URLEncoder
.
encode
(
fileName
,
"UTF-8"
));
response
.
setHeader
(
"Access-Control-Expose-Headers"
,
"Content-Disposition"
);
fileInputStream
=
new
FileInputStream
(
resourceName
);
in
=
new
DataInputStream
(
fileInputStream
);
out
=
response
.
getOutputStream
();
int
bytes
=
0
;
byte
[]
bufferOut
=
new
byte
[
1024
];
while
((
bytes
=
in
.
read
(
bufferOut
))
!=
-
1
)
{
out
.
write
(
bufferOut
,
0
,
bytes
);
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
response
.
reset
();
}
finally
{
try
{
if
(
out
!=
null
)
{
out
.
close
();
}
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
try
{
if
(
in
!=
null
)
{
in
.
close
();
}
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
try
{
if
(
fileInputStream
!=
null
)
{
fileInputStream
.
close
();
}
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
}
/**
* 压缩文件
*
* @param srcFiles
* @param zipFile
*/
public
static
void
zipFiles
(
List
<
File
>
srcFiles
,
File
zipFile
)
{
try
{
if
(
srcFiles
.
size
()
!=
0
)
{
// 判断压缩后的文件存在不,不存在则创建
if
(!
zipFile
.
exists
())
{
zipFile
.
createNewFile
();
}
else
{
zipFile
.
delete
();
zipFile
.
createNewFile
();
}
// 创建 FileInputStream 对象
InputStream
fileInputStream
=
null
;
// 实例化 FileOutputStream 对象
FileOutputStream
fileOutputStream
=
new
FileOutputStream
(
zipFile
);
// 实例化 ZipOutputStream 对象
ZipOutputStream
zipOutputStream
=
new
ZipOutputStream
(
fileOutputStream
);
// 创建 ZipEntry 对象
ZipEntry
zipEntry
=
null
;
// 遍历源文件数组
// for (int i = 0; i < srcFiles.size(); i++) {
// // 将源文件数组中的当前文件读入 FileInputStream 流中
// File file = srcFiles.get(i);
// fileInputStream = new FileInputStream(file);
// // 实例化 ZipEntry 对象,源文件数组中的当前文件
// zipEntry = new ZipEntry(i + ".jpg");
// zipOutputStream.putNextEntry(zipEntry);
// // 该变量记录每次真正读的字节个数
// int len;
// // 定义每次读取的字节数组
// byte[] buffer = new byte[1024];
// while ((len = fileInputStream.read(buffer)) > 0) {
// zipOutputStream.write(buffer, 0, len);
// }
// }
for
(
File
srcFile
:
srcFiles
)
{
fileInputStream
=
new
FileInputStream
(
srcFile
);
// 实例化 ZipEntry 对象,源文件数组中的当前文件
zipEntry
=
new
ZipEntry
(
srcFile
.
getName
());
zipOutputStream
.
putNextEntry
(
zipEntry
);
// 该变量记录每次真正读的字节个数
int
len
;
// 定义每次读取的字节数组
byte
[]
buffer
=
new
byte
[
1024
];
while
((
len
=
fileInputStream
.
read
(
buffer
))
>
0
)
{
zipOutputStream
.
write
(
buffer
,
0
,
len
);
}
}
zipOutputStream
.
closeEntry
();
zipOutputStream
.
close
();
fileInputStream
.
close
();
fileOutputStream
.
close
();
System
.
out
.
println
(
"下载完成"
);
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
/**
* 删除文件夹(强制删除)
*
* @param file
*/
public
static
void
deleteAllFilesOfDir
(
File
file
)
{
if
(
null
!=
file
)
{
if
(!
file
.
exists
())
return
;
if
(
file
.
isFile
())
{
boolean
result
=
file
.
delete
();
int
tryCount
=
0
;
while
(!
result
&&
tryCount
++
<
10
)
{
System
.
gc
();
// 回收资源
result
=
file
.
delete
();
}
}
File
[]
files
=
file
.
listFiles
();
if
(
null
!=
files
)
{
for
(
int
i
=
0
;
i
<
files
.
length
;
i
++)
{
deleteAllFilesOfDir
(
files
[
i
]);
}
}
file
.
delete
();
}
}
}
amos-boot-system-tzs/amos-boot-module-tzs-biz/src/main/java/com/yeejoin/amos/boot/module/tzs/flc/biz/service/impl/RegUnitInfoServiceImpl.java
View file @
a612be28
...
...
@@ -780,18 +780,19 @@ public class RegUnitInfoServiceImpl extends BaseService<RegUnitInfoDto, RegUnitI
String
userIdsTask
=
String
.
join
(
","
,
task
);
// 添加被检查企业下的人员id
objectMap
.
put
(
"CHECKED_COMPANY_USERS"
,
userIds
);
objectMap
.
put
(
"CHECKED_COMPANY_USER_ids"
,
userIdsTask
);
// 表单信息提交
FeignClientResult
<
String
>
submit
=
idxFeignService
.
submit
(
pageId
,
taskId
,
planInstanceId
,
topic
,
tableName
,
objectMap
);
if
(
"200"
.
equals
(
String
.
valueOf
(
submit
.
getStatus
())))
{
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
put
(
"title"
,
"企业整改"
);
jsonObject
.
put
(
"userIds"
,
userIdsTask
);
logger
.
info
(
"idx执行任务更新参数,{}"
,
JSONObject
.
toJSONString
(
jsonObject
));
//FeignClientResult<JSONObject> jsonObjectFeignClientResult = idxFeignService.updateAmosTask(taskId, jsonObject);
updateAmosTask
(
taskId
,
jsonObject
);
//logger.info("idx执行任务更新任务返回参数,{}", JSONObject.toJSONString(jsonObjectFeignClientResult));
}
FeignClientResult
<
String
>
submit
=
idxFeignService
.
submit
(
pageId
,
taskId
,
planInstanceId
,
"CHECKED_COMPANY_USER_ids"
,
topic
,
tableName
,
objectMap
);
//
if ("200".equals(String.valueOf(submit.getStatus()))) {
//
JSONObject jsonObject = new JSONObject();
//
jsonObject.put("title", "企业整改");
//
jsonObject.put("userIds", userIdsTask);
//
logger.info("idx执行任务更新参数,{}", JSONObject.toJSONString(jsonObject));
//
//FeignClientResult<JSONObject> jsonObjectFeignClientResult = idxFeignService.updateAmosTask(taskId, jsonObject);
//
updateAmosTask(taskId, jsonObject);
//
//logger.info("idx执行任务更新任务返回参数,{}", JSONObject.toJSONString(jsonObjectFeignClientResult));
//
//
}
return
"ok"
;
}
...
...
amos-boot-system-tzs/amos-boot-module-tzs-biz/src/main/resources/temp/bigBg.png
0 → 100644
View file @
a612be28
76.4 KB
amos-boot-system-tzs/amos-boot-module-tzs-biz/src/main/resources/temp/centreBg.png
0 → 100644
View file @
a612be28
43 KB
amos-boot-system-tzs/amos-boot-module-tzs-biz/src/main/resources/temp/dt.png
0 → 100644
View file @
a612be28
23.4 KB
amos-boot-system-tzs/amos-boot-module-tzs-biz/src/main/resources/temp/smallBg.png
0 → 100644
View file @
a612be28
29.4 KB
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