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
4d7aa03a
Commit
4d7aa03a
authored
Feb 22, 2023
by
zhangsen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
参考代码检查插件处理阻断漏洞
parent
be6298e4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
138 additions
and
221 deletions
+138
-221
StockDetail.java
...va/com/yeejoin/equipmanage/common/entity/StockDetail.java
+1
-11
ChartsUtils.java
...ava/com/yeejoin/equipmanage/common/utils/ChartsUtils.java
+9
-5
ExcelUtil.java
.../java/com/yeejoin/equipmanage/common/utils/ExcelUtil.java
+37
-54
FileHelper.java
...java/com/yeejoin/equipmanage/common/utils/FileHelper.java
+40
-126
FileUtil.java
...n/java/com/yeejoin/equipmanage/common/utils/FileUtil.java
+13
-4
TikaUtils.java
.../java/com/yeejoin/equipmanage/common/utils/TikaUtils.java
+11
-2
WordTemplateUtils.java
...m/yeejoin/equipmanage/common/utils/WordTemplateUtils.java
+6
-0
CarServiceImpl.java
.../com/yeejoin/equipmanage/service/impl/CarServiceImpl.java
+21
-19
No files found.
amos-boot-module/amos-boot-module-api/amos-boot-module-equip-api/src/main/java/com/yeejoin/equipmanage/common/entity/StockDetail.java
View file @
4d7aa03a
...
...
@@ -24,7 +24,7 @@ import java.util.Date;
@Accessors
(
chain
=
true
)
@TableName
(
"wl_stock_detail"
)
@ApiModel
(
value
=
"StockDetail对象"
,
description
=
"库存明细"
)
public
class
StockDetail
extends
BaseEntity
implements
Cloneable
{
public
class
StockDetail
extends
BaseEntity
{
private
static
final
long
serialVersionUID
=
1L
;
...
...
@@ -90,14 +90,4 @@ public class StockDetail extends BaseEntity implements Cloneable {
@ApiModelProperty
(
value
=
"位置信息"
)
private
String
area
;
@Override
public
StockDetail
clone
()
{
try
{
return
(
StockDetail
)
super
.
clone
();
}
catch
(
CloneNotSupportedException
e
)
{
e
.
printStackTrace
();
}
return
null
;
}
}
amos-boot-module/amos-boot-module-api/amos-boot-module-equip-api/src/main/java/com/yeejoin/equipmanage/common/utils/ChartsUtils.java
View file @
4d7aa03a
...
...
@@ -23,12 +23,8 @@ import java.awt.image.BufferedImage;
import
java.io.File
;
import
java.io.FileInputStream
;
import
java.io.IOException
;
import
java.util.Base64
;
import
java.util.HashMap
;
import
java.util.Iterator
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
import
java.util.*
;
/**
* @author lisong
...
...
@@ -76,6 +72,14 @@ public class ChartsUtils {
fis
.
close
();
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
finally
{
if
(
fis
!=
null
)
{
try
{
fis
.
close
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
}
return
fileBytes
;
}
...
...
amos-boot-module/amos-boot-module-api/amos-boot-module-equip-api/src/main/java/com/yeejoin/equipmanage/common/utils/ExcelUtil.java
View file @
4d7aa03a
package
com
.
yeejoin
.
equipmanage
.
common
.
utils
;
import
java.io.File
;
import
java.io.FileInputStream
;
import
java.io.FileNotFoundException
;
import
java.io.FileOutputStream
;
import
java.io.IOException
;
import
java.io.OutputStream
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
import
javax.servlet.http.HttpServletResponse
;
import
org.apache.poi.hssf.usermodel.HSSFCell
;
import
org.apache.poi.hssf.usermodel.HSSFCellStyle
;
import
org.apache.poi.hssf.usermodel.HSSFFont
;
import
org.apache.poi.hssf.usermodel.HSSFRichTextString
;
import
org.apache.poi.hssf.usermodel.HSSFRow
;
import
org.apache.poi.hssf.usermodel.HSSFSheet
;
import
org.apache.poi.hssf.usermodel.HSSFWorkbook
;
import
org.apache.poi.hssf.util.HSSFColor
;
import
org.apache.poi.ss.usermodel.BorderStyle
;
import
org.apache.poi.ss.usermodel.Cell
;
import
org.apache.poi.ss.usermodel.CellStyle
;
import
org.apache.poi.ss.usermodel.Font
;
import
org.apache.poi.ss.usermodel.HorizontalAlignment
;
import
org.apache.poi.ss.usermodel.Row
;
import
org.apache.poi.ss.usermodel.Sheet
;
import
org.apache.poi.ss.usermodel.VerticalAlignment
;
import
org.apache.poi.ss.usermodel.Workbook
;
import
org.apache.poi.hssf.usermodel.*
;
import
org.apache.poi.ss.usermodel.*
;
import
org.apache.poi.ss.util.CellRangeAddress
;
import
org.apache.poi.xssf.streaming.SXSSFCell
;
import
org.apache.poi.xssf.streaming.SXSSFRow
;
...
...
@@ -36,6 +9,12 @@ import org.apache.poi.xssf.streaming.SXSSFSheet;
import
org.apache.poi.xssf.streaming.SXSSFWorkbook
;
import
org.apache.poi.xssf.usermodel.XSSFWorkbook
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.*
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
/**
*
...
...
@@ -105,22 +84,16 @@ public class ExcelUtil
}
return
workbook
;
}
public
static
void
createXSSFExcel
(
String
path
,
String
fileName
,
List
<
String
>
headers
,
List
<
List
<
String
>>
dataList
)
{
try
{
File
file
=
new
File
(
path
);
if
(!
file
.
isDirectory
())
{
file
.
mkdirs
();
}
file
=
new
File
(
path
+
"\\"
+
fileName
);
XSSFWorkbook
workbook
;
if
(!
file
.
exists
())
{
workbook
=
new
XSSFWorkbook
();
}
else
{
workbook
=
new
XSSFWorkbook
(
new
FileInputStream
(
file
));
}
SXSSFWorkbook
sxssfWorkbook
=
new
SXSSFWorkbook
(
workbook
,
2000
);
File
file
=
new
File
(
path
+
"\\"
+
fileName
);
if
(!
file
.
isDirectory
())
{
file
.
mkdirs
();
}
try
(
FileInputStream
inputStream
=
new
FileInputStream
(
file
);
FileOutputStream
out
=
new
FileOutputStream
(
file
);
XSSFWorkbook
workbook
=
file
.
exists
()
?
new
XSSFWorkbook
(
inputStream
)
:
new
XSSFWorkbook
();
SXSSFWorkbook
sxssfWorkbook
=
new
SXSSFWorkbook
(
workbook
,
2000
))
{
int
sheetNum
=
sxssfWorkbook
.
getNumberOfSheets
();
if
(
sheetNum
==
0
)
{
sxssfWorkbook
.
createSheet
();
...
...
@@ -150,16 +123,13 @@ public class ExcelUtil
}
fillExcelContent
(
sheet
,
sheet
.
getLastRowNum
(),
dataList
);
}
FileOutputStream
out
=
new
FileOutputStream
(
file
);
sxssfWorkbook
.
write
(
out
);
out
.
close
();
}
catch
(
FileNotFoundException
e
)
{
e
.
printStackTrace
();
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
public
static
void
fillExcelContent
(
SXSSFSheet
sheet
,
int
lastRowNum
,
List
<
List
<
String
>>
dataList
)
{
for
(
int
i
=
0
;
i
<
dataList
.
size
();
i
++)
{
SXSSFRow
row
=
sheet
.
createRow
(
lastRowNum
+
i
+
1
);
...
...
@@ -217,14 +187,14 @@ public class ExcelUtil
public
static
void
exportXlSXExcel
(
HttpServletResponse
response
,
File
file
,
String
fileName
)
{
try
OutputStream
output
=
null
;
try
(
FileInputStream
inputStream
=
new
FileInputStream
(
file
))
{
String
name
=
new
String
(
fileName
.
getBytes
(
"UTF-8"
),
"ISO8859_1"
);
OutputStream
output
=
response
.
getOutputStream
();
output
=
response
.
getOutputStream
();
response
.
setHeader
(
"Content-disposition"
,
"attachment; filename="
+
name
);
response
.
setContentType
(
"application/vnd.ms-excel;charset=utf-8"
);
FileInputStream
inputStream
=
new
FileInputStream
(
file
);
int
b
=
0
;
byte
[]
buffer
=
new
byte
[
1024
*
10
];
while
(
b
!=
-
1
){
...
...
@@ -232,14 +202,21 @@ public class ExcelUtil
if
(-
1
!=
b
)
{
output
.
write
(
buffer
,
0
,
b
);
}
}
inputStream
.
close
();
}
output
.
flush
();
output
.
close
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
finally
{
try
{
if
(
output
!=
null
)
{
output
.
close
();
}
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
}
...
...
@@ -517,11 +494,17 @@ public class ExcelUtil
cell
.
setCellStyle
(
style2
);
}
}
return
workbook
;
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
return
null
;
}
finally
{
try
{
workbook
.
close
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
return
workbook
;
}
/**
...
...
amos-boot-module/amos-boot-module-api/amos-boot-module-equip-api/src/main/java/com/yeejoin/equipmanage/common/utils/FileHelper.java
View file @
4d7aa03a
This diff is collapsed.
Click to expand it.
amos-boot-module/amos-boot-module-api/amos-boot-module-equip-api/src/main/java/com/yeejoin/equipmanage/common/utils/FileUtil.java
View file @
4d7aa03a
...
...
@@ -31,10 +31,19 @@ public class FileUtil {
if
(!
targetFile
.
exists
())
{
targetFile
.
mkdirs
();
}
FileOutputStream
out
=
new
FileOutputStream
(
filePath
+
fileName
);
out
.
write
(
file
);
out
.
flush
();
out
.
close
();
FileOutputStream
out
=
null
;
try
{
out
=
new
FileOutputStream
(
filePath
+
fileName
);
out
.
write
(
file
);
out
.
flush
();
out
.
close
();
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
finally
{
if
(
null
!=
out
)
{
out
.
close
();
}
}
}
/**
...
...
amos-boot-module/amos-boot-module-api/amos-boot-module-equip-api/src/main/java/com/yeejoin/equipmanage/common/utils/TikaUtils.java
View file @
4d7aa03a
...
...
@@ -34,8 +34,9 @@ public class TikaUtils {
public
static
String
fileToTxt
(
File
file
)
{
Parser
parser
=
new
AutoDetectParser
();
InputStream
inputStream
=
null
;
try
{
InputStream
inputStream
=
new
FileInputStream
(
file
);
inputStream
=
new
FileInputStream
(
file
);
DefaultHandler
handler
=
new
BodyContentHandler
();
Metadata
metadata
=
new
Metadata
();
ParseContext
parseContext
=
new
ParseContext
();
...
...
@@ -49,6 +50,14 @@ public class TikaUtils {
return
handler
.
toString
();
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
finally
{
try
{
if
(
null
!=
inputStream
)
{
inputStream
.
close
();
}
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
return
null
;
}
...
...
@@ -73,7 +82,7 @@ public class TikaUtils {
}
return
null
;
return
""
;
}
...
...
amos-boot-module/amos-boot-module-api/amos-boot-module-equip-api/src/main/java/com/yeejoin/equipmanage/common/utils/WordTemplateUtils.java
View file @
4d7aa03a
...
...
@@ -202,6 +202,12 @@ public class WordTemplateUtils {
in
.
close
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
finally
{
try
{
in
.
close
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
BASE64Encoder
encoder
=
new
BASE64Encoder
();
return
encoder
.
encode
(
data
);
...
...
amos-boot-module/amos-boot-module-biz/amos-boot-module-equip-biz/src/main/java/com/yeejoin/equipmanage/service/impl/CarServiceImpl.java
View file @
4d7aa03a
...
...
@@ -38,6 +38,7 @@ import org.apache.commons.lang3.StringUtils;
import
org.gavaghan.geodesy.Ellipsoid
;
import
org.gavaghan.geodesy.GeodeticCalculator
;
import
org.gavaghan.geodesy.GlobalCoordinates
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.context.annotation.Lazy
;
...
...
@@ -486,12 +487,13 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS
stockDetailMapper
.
updateById
(
stockDetail
);
addStockDetailId
(
stockDetail
.
getId
());
StockDetail
stockDetail_clone
=
stockDetail
.
clone
();
stockDetail_clone
.
setId
(
null
);
stockDetail_clone
.
setAmount
(
lossCount
);
stockDetail_clone
.
setStatus
(
EquipStatusEnum
.
LOSS
.
getCode
().
toString
());
stockDetailMapper
.
insert
(
stockDetail_clone
);
addStockDetailId
(
stockDetail_clone
.
getId
());
StockDetail
stockDetailClone
=
new
StockDetail
();
BeanUtils
.
copyProperties
(
stockDetail
,
stockDetailClone
);
stockDetailClone
.
setId
(
null
);
stockDetailClone
.
setAmount
(
lossCount
);
stockDetailClone
.
setStatus
(
EquipStatusEnum
.
LOSS
.
getCode
().
toString
());
stockDetailMapper
.
insert
(
stockDetailClone
);
addStockDetailId
(
stockDetailClone
.
getId
());
Stock
stock
=
stockMapper
.
selectById
(
stockDetail
.
getStockId
());
stock
.
setAmount
(
stock
.
getAmount
()
-
lossCount
);
stockMapper
.
updateById
(
stock
);
...
...
@@ -501,10 +503,10 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS
// 损耗清单详情
WastageBillDetail
detail
=
new
WastageBillDetail
();
detail
.
setAmount
(
BigDecimal
.
valueOf
(
lossCount
));
detail
.
setStockDetailId
(
stockDetail
_c
lone
.
getId
());
detail
.
setStockDetailId
(
stockDetail
C
lone
.
getId
());
detail
.
setWastageBillId
(
bill
.
getId
());
wastageBillDetailMapper
.
insert
(
detail
);
journalMapper
.
insert
(
createJournal
(
ex
,
stockDetail
_c
lone
.
getId
(),
lossCount
));
journalMapper
.
insert
(
createJournal
(
ex
,
stockDetail
C
lone
.
getId
(),
lossCount
));
return
0
d
;
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
...
...
@@ -604,7 +606,7 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS
List
<
SystemDic
>
listd
=
systemDicMapper
.
selectByMap
(
columnMap
);
p
.
setLossStateId
(
listd
.
get
(
0
).
getId
());
});
lossHandlers
.
add
(
p
->
this
.
loss
(
p
)
);
lossHandlers
.
add
(
this
::
loss
);
// 同步搜索
/*
...
...
@@ -624,21 +626,21 @@ public class CarServiceImpl extends ServiceImpl<CarMapper, Car> implements ICarS
stockDetailMapper
.
updateById
(
detail
);
params
.
addStockDetailId
(
r
.
getStockDetailId
());
StockDetail
detail
_onCar
=
null
;
StockDetail
detail
OnCar
=
new
StockDetail
()
;
BeanUtils
.
copyProperties
(
detail
,
detailOnCar
);
// 新增车载记录
detail_onCar
=
detail
.
clone
();
detail
_o
nCar
.
setId
(
null
);
detail
_o
nCar
.
setAmount
(
r
.
getAmount
());
detail
_o
nCar
.
setStatus
(
EquipStatusEnum
.
ONCAR
.
getCode
().
toString
());
stockDetailMapper
.
insert
(
detail
_o
nCar
);
params
.
addStockDetailId
(
detail
_o
nCar
.
getId
());
//
detail_onCar = detail.clone();
detail
O
nCar
.
setId
(
null
);
detail
O
nCar
.
setAmount
(
r
.
getAmount
());
detail
O
nCar
.
setStatus
(
EquipStatusEnum
.
ONCAR
.
getCode
().
toString
());
stockDetailMapper
.
insert
(
detail
O
nCar
);
params
.
addStockDetailId
(
detail
O
nCar
.
getId
());
// 装车
extinguishantOnCarMapper
.
insert
(
params
.
create
(
r
,
detail
_o
nCar
));
extinguishantOnCarMapper
.
insert
(
params
.
create
(
r
,
detail
O
nCar
));
// 流水
journalMapper
.
insert
(
params
.
createJournal
(
r
,
detail
_o
nCar
.
getId
()));
journalMapper
.
insert
(
params
.
createJournal
(
r
,
detail
O
nCar
.
getId
()));
});
}
catch
(
Exception
e
)
{
...
...
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