Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
T
traffic-front
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wangxiaoming
traffic-front
Commits
8acff898
Commit
8acff898
authored
Sep 26, 2018
by
neo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[dev] delete some unused java file
parent
ccd54f84
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
0 additions
and
212 deletions
+0
-212
CorsFilter.java
...api/src/main/java/pwc/taxtech/atms/common/CorsFilter.java
+0
-36
ModelTypeEnum.java
.../src/main/java/pwc/taxtech/atms/common/ModelTypeEnum.java
+0
-29
MyAsserts.java
...src/main/java/pwc/taxtech/atms/common/util/MyAsserts.java
+0
-1
NPOIHelper.java
...rc/main/java/pwc/taxtech/atms/common/util/NPOIHelper.java
+0
-146
No files found.
atms-api/src/main/java/pwc/taxtech/atms/common/CorsFilter.java
deleted
100644 → 0
View file @
ccd54f84
package
pwc
.
taxtech
.
atms
.
common
;
import
java.io.IOException
;
import
javax.servlet.FilterChain
;
import
javax.servlet.ServletException
;
import
javax.servlet.http.Cookie
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
org.springframework.web.filter.OncePerRequestFilter
;
@Component
public
class
CorsFilter
extends
OncePerRequestFilter
{
@Autowired
private
AtmsApiSettings
atmsApiSettings
;
@Override
public
void
doFilterInternal
(
HttpServletRequest
request
,
HttpServletResponse
response
,
FilterChain
chain
)
throws
ServletException
,
IOException
{
response
.
setHeader
(
"Access-Control-Allow-Origin"
,
atmsApiSettings
.
getWebUrl
());
response
.
setHeader
(
"Access-Control-Allow-Credentials"
,
"true"
);
response
.
setHeader
(
"Access-Control-Allow-Methods"
,
"GET, POST, PUT, DELETE, OPTIONS"
);
response
.
setHeader
(
"Access-Control-Allow-Headers"
,
"origin, content-type, accept, x-requested-with, authorization, x-xsrf-token, X-HTTP-Method-Override, withcredentials, access-control-allow-origin,from"
);
response
.
setHeader
(
"Access-Control-Allow-Credentials"
,
"true"
);
if
(
"OPTIONS"
.
equalsIgnoreCase
(
request
.
getMethod
()))
{
return
;
}
chain
.
doFilter
(
request
,
response
);
}
}
atms-api/src/main/java/pwc/taxtech/atms/common/ModelTypeEnum.java
deleted
100644 → 0
View file @
ccd54f84
package
pwc
.
taxtech
.
atms
.
common
;
public
enum
ModelTypeEnum
{
SystemCommon
(
1
,
"SystemCommon"
,
"系统公共模型"
),
OrganizationCommon
(
2
,
"OrganizationCommon"
,
"机构公共模型"
),
OrganizationCustomize
(
3
,
"OrganizationCustomize"
,
"机构自定义模型"
);
private
Integer
code
;
private
String
name
;
private
String
displayName
;
ModelTypeEnum
(
Integer
code
,
String
name
,
String
displayName
){
this
.
code
=
code
;
this
.
name
=
name
;
this
.
displayName
=
displayName
;
}
public
String
toName
()
{
return
this
.
name
==
null
?
this
.
name
()
:
this
.
name
;
}
public
Integer
toCode
()
{
return
this
.
code
==
null
?
this
.
ordinal
()
:
this
.
code
;
}
public
String
toDisplayName
()
{
return
this
.
displayName
==
null
?
this
.
name
()
:
this
.
displayName
;
}
}
atms-api/src/main/java/pwc/taxtech/atms/common/util/MyAsserts.java
View file @
8acff898
package
pwc
.
taxtech
.
atms
.
common
.
util
;
import
pwc.taxtech.atms.dto.OperationResultDto
;
import
pwc.taxtech.atms.exception.ApiException
;
import
pwc.taxtech.atms.exception.FormulaException
;
...
...
atms-api/src/main/java/pwc/taxtech/atms/common/util/NPOIHelper.java
deleted
100644 → 0
View file @
ccd54f84
package
pwc
.
taxtech
.
atms
.
common
.
util
;
import
org.apache.poi.hssf.usermodel.HSSFDateUtil
;
import
org.apache.poi.openxml4j.exceptions.InvalidFormatException
;
import
org.apache.poi.ss.usermodel.Cell
;
import
org.apache.poi.ss.usermodel.Row
;
import
org.apache.poi.ss.usermodel.Sheet
;
import
org.apache.poi.ss.usermodel.Workbook
;
import
org.apache.poi.ss.usermodel.WorkbookFactory
;
import
org.apache.poi.xssf.usermodel.XSSFFormulaEvaluator
;
import
org.apache.poi.xssf.usermodel.XSSFWorkbook
;
import
pwc.taxtech.atms.constant.VATCommon
;
import
pwc.taxtech.atms.vat.dao.DataImportModel
;
import
java.io.FileInputStream
;
import
java.io.IOException
;
import
java.text.DateFormat
;
import
java.text.SimpleDateFormat
;
import
java.util.ArrayList
;
import
java.util.List
;
import
static
org
.
apache
.
poi
.
ss
.
usermodel
.
CellType
.
NUMERIC
;
import
static
pwc
.
taxtech
.
atms
.
constant
.
Constant
.
DEFAULT_RESULT
;
public
class
NPOIHelper
{
public
static
DataImportModel
renderTBDataTableFromExcel
(
FileInputStream
fis
,
Integer
selectedSheetIndex
,
int
headerRowIndex
,
boolean
haveHeader
,
Integer
topRowNumber
)
{
DataImportModel
dataImportModel
=
new
DataImportModel
();
Workbook
workbook
=
null
;
try
{
workbook
=
WorkbookFactory
.
create
(
fis
);
Sheet
sheet
=
workbook
.
getSheetAt
(
selectedSheetIndex
);
dataImportModel
.
setDataList
(
new
ArrayList
<>());
dataImportModel
.
setSheetNameList
(
new
ArrayList
<>());
dataImportModel
.
setResult
(
DEFAULT_RESULT
);
try
{
//TODO:should be replace by biz exception (neo)
if
(!(
workbook
instanceof
XSSFWorkbook
))
throw
new
RuntimeException
(
"not support workbook type"
);
XSSFFormulaEvaluator
eva
=
new
XSSFFormulaEvaluator
((
XSSFWorkbook
)
workbook
);
int
numberOfSheets
=
workbook
.
getNumberOfSheets
();
for
(
int
index
=
0
;
index
<
numberOfSheets
;
index
++)
{
dataImportModel
.
getSheetNameList
().
add
(
workbook
.
getSheetAt
(
index
).
getSheetName
());
}
//判断文件是否为空
if
(
sheet
.
getPhysicalNumberOfRows
()
==
0
)
{
dataImportModel
.
setResult
(
false
);
dataImportModel
.
setResultMsg
(
VATCommon
.
Const_ImportFileError
);
}
else
{
//var headerRow = sheet.GetRow(HeaderRowIndex);
int
cellCount
=
0
;
for
(
int
i
=
0
;
i
<=
sheet
.
getLastRowNum
();
i
++)
{
Row
row
=
sheet
.
getRow
(
i
);
if
(
row
!=
null
&&
row
.
getPhysicalNumberOfCells
()
>
cellCount
)
{
cellCount
=
row
.
getPhysicalNumberOfCells
();
}
}
List
<
String
>
rowList
=
new
ArrayList
<>();
//dataImportModel.dataList.Add(rowList);
dataImportModel
.
setLastRowIndex
(
sheet
.
getLastRowNum
());
int
RowStart
=
sheet
.
getFirstRowNum
();
for
(
int
i
=
RowStart
;
i
<=
sheet
.
getLastRowNum
();
i
++)
{
Row
row
=
sheet
.
getRow
(
i
);
if
(
row
!=
null
)
{
rowList
=
getOutputInvoiceRowValueList
(
eva
,
row
,
cellCount
);
dataImportModel
.
getDataList
().
add
(
rowList
);
}
}
}
}
catch
(
Exception
ex
)
{
dataImportModel
.
setResult
(
false
);
dataImportModel
.
setResultMsg
(
VATCommon
.
Const_ImportFileError
);
}
if
(
topRowNumber
>
0
)
{
//第一行为列头的话就多输出一行
int
startIndex
=
(
haveHeader
?
topRowNumber
+
1
:
topRowNumber
)-
1
;
int
endIndex
=
dataImportModel
.
getDataList
().
size
()
-
1
;
if
(
startIndex
<
dataImportModel
.
getDataList
().
size
())
{
dataImportModel
.
setDataList
(
dataImportModel
.
getDataList
().
subList
(
startIndex
,
endIndex
));
}
// dataImportModel.setDataList(dataImportModel.getDataList().subList(0,topRowNumber));
}
return
dataImportModel
;
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
catch
(
InvalidFormatException
e
)
{
e
.
printStackTrace
();
}
return
null
;
}
private
static
List
<
String
>
getOutputInvoiceRowValueList
(
XSSFFormulaEvaluator
eva
,
Row
row
,
int
cellCount
)
{
List
<
String
>
rowList
=
new
ArrayList
<>();
for
(
int
j
=
0
;
j
<
cellCount
;
j
++)
{
if
(
row
.
getCell
(
j
)
!=
null
)
{
rowList
.
add
(
getStringCellValue
(
eva
,
row
.
getCell
(
j
)));
}
else
{
rowList
.
add
(
null
);
}
}
return
rowList
;
}
private
static
String
getStringCellValue
(
XSSFFormulaEvaluator
eva
,
Cell
cell
)
{
// 获取单元格数据内容为字符串类型的数据
DateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
String
strCell
=
""
;
switch
(
cell
.
getCellTypeEnum
())
{
case
NUMERIC:
if
(
HSSFDateUtil
.
isCellDateFormatted
(
cell
))
{
strCell
=
sdf
.
format
(
cell
.
getDateCellValue
());
}
else
{
long
longVal
=
Math
.
round
(
cell
.
getNumericCellValue
());
if
(
Double
.
parseDouble
(
longVal
+
".0"
)
==
cell
.
getNumericCellValue
())
strCell
=
longVal
+
""
;
else
strCell
=
cell
.
getNumericCellValue
()
+
""
;
}
break
;
case
FORMULA:
try
{
if
(
eva
.
evaluate
(
cell
).
getCellTypeEnum
()
==
NUMERIC
)
{
strCell
=
eva
.
evaluate
(
cell
).
getNumberValue
()
+
""
;
}
else
{
strCell
=
eva
.
evaluate
(
cell
).
getStringValue
();
}
}
catch
(
Exception
ex
)
{
strCell
=
"#N/A"
;
}
break
;
default
:
strCell
=
cell
.
toString
();
break
;
}
return
strCell
;
}
}
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