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
4b47db19
Commit
4b47db19
authored
Apr 09, 2019
by
kevin
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev_mysql' of
https://gitee.com/Memorydoc/atms
into dev_mysql
parents
3fd60ed7
35ce6e92
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
94 additions
and
17 deletions
+94
-17
AnalysisJob.java
...in/java/pwc/taxtech/atms/common/schedule/AnalysisJob.java
+8
-4
FileExcelUtil.java
...main/java/pwc/taxtech/atms/common/util/FileExcelUtil.java
+49
-0
AnalysisJobServiceImpl.java
...pwc/taxtech/atms/service/impl/AnalysisJobServiceImpl.java
+0
-0
AnalysisServiceImpl.java
...va/pwc/taxtech/atms/service/impl/AnalysisServiceImpl.java
+16
-3
ReportServiceImpl.java
.../pwc/taxtech/atms/vat/service/impl/ReportServiceImpl.java
+5
-4
AnalysisTest.java
...test/java/pwc/taxtech/atms/service/impl/AnalysisTest.java
+16
-6
No files found.
atms-api/src/main/java/pwc/taxtech/atms/common/schedule/AnalysisJob.java
View file @
4b47db19
...
...
@@ -37,9 +37,12 @@ public class AnalysisJob extends QuartzJobBean {
protected
void
executeInternal
(
JobExecutionContext
jobExecutionContext
)
throws
JobExecutionException
{
Integer
period
=
DateUtils
.
getPeriodNow
();
OrganizationExample
e
=
new
OrganizationExample
();
e
.
createCriteria
().
andIsActiveEqualTo
(
true
);
//
e.createCriteria().andIsActiveEqualTo(true);
List
<
Organization
>
orgs
=
organizationMapper
.
selectByExample
(
e
);
logger
.
info
(
String
.
format
(
"开始分析%s机构数据"
,
period
));
analysisJobService
.
analysisMaster
(
orgs
,
period
,
EnumTbImportType
.
CoverImport
.
getCode
());
logger
.
info
(
String
.
format
(
"开始分析%s预期返还税数据"
,
period
));
analysisJobService
.
analysisExpectedTax
(
orgs
,
period
,
EnumTbImportType
.
CoverImport
.
getCode
());
...
...
@@ -49,15 +52,16 @@ public class AnalysisJob extends QuartzJobBean {
logger
.
info
(
String
.
format
(
"开始分析%s档案管理数据"
,
period
));
analysisJobService
.
analysisFileManagement
(
orgs
,
period
,
EnumTbImportType
.
CoverImport
.
getCode
());
logger
.
info
(
String
.
format
(
"开始分析%s机构数据"
,
period
));
analysisJobService
.
analysisMaster
(
orgs
,
period
,
EnumTbImportType
.
CoverImport
.
getCode
());
logger
.
info
(
String
.
format
(
"开始分析%s申报表数据"
,
period
));
analysisJobService
.
analysisSales
(
orgs
,
period
,
EnumTbImportType
.
CoverImport
.
getCode
());
logger
.
info
(
String
.
format
(
"开始分析%s返还后税数据"
,
period
));
analysisJobService
.
analysisTaxReturnEnd
(
orgs
,
period
,
EnumTbImportType
.
CoverImport
.
getCode
());
logger
.
info
(
String
.
format
(
"开始分析%税种税金计算数据"
,
period
));
analysisJobService
.
analysisTax
(
orgs
,
period
,
EnumTbImportType
.
CoverImport
.
getCode
());
}
}
atms-api/src/main/java/pwc/taxtech/atms/common/util/FileExcelUtil.java
View file @
4b47db19
...
...
@@ -11,6 +11,7 @@ package pwc.taxtech.atms.common.util;
import
com.google.common.collect.Lists
;
import
org.activiti.engine.ProcessEngine
;
import
org.activiti.engine.ProcessEngineConfiguration
;
import
org.apache.poi.hssf.usermodel.HSSFCell
;
import
org.apache.poi.ss.usermodel.*
;
import
org.apache.poi.xssf.streaming.SXSSFSheet
;
import
org.nutz.http.Http
;
...
...
@@ -23,6 +24,7 @@ import javax.servlet.ServletOutputStream;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
import
java.io.*
;
import
java.math.BigDecimal
;
import
java.net.URLEncoder
;
import
java.util.List
;
import
java.util.zip.ZipEntry
;
...
...
@@ -379,4 +381,50 @@ public class FileExcelUtil {
}
}
/**
*
* @param cell 获取值的单元格
* @param zero 是否将空 或者null转换成 zero
* @return
*/
public
static
Object
getCellValue
(
Cell
cell
,
Boolean
zero
)
{
String
cellValue
=
null
;
switch
(
cell
.
getCellType
())
{
case
Cell
.
CELL_TYPE_STRING
:
//字符串类型
cellValue
=
cell
.
getStringCellValue
();
if
(
cellValue
.
trim
().
equals
(
""
)
||
cellValue
.
trim
().
length
()
<=
0
)
cellValue
=
""
;
break
;
case
Cell
.
CELL_TYPE_NUMERIC
:
//数值类型
cellValue
=
String
.
valueOf
(
cell
.
getNumericCellValue
());
break
;
case
Cell
.
CELL_TYPE_FORMULA
:
//公式
cell
.
setCellType
(
HSSFCell
.
CELL_TYPE_NUMERIC
);
cellValue
=
String
.
valueOf
(
cell
.
getNumericCellValue
());
break
;
case
Cell
.
CELL_TYPE_BLANK
:
cellValue
=
""
;
break
;
case
Cell
.
CELL_TYPE_BOOLEAN
:
break
;
case
Cell
.
CELL_TYPE_ERROR
:
break
;
default
:
break
;
}
if
(
""
.
equals
(
cellValue
)
&&
zero
)
return
BigDecimal
.
ZERO
;
if
(
zero
){
try
{
return
new
BigDecimal
(
cellValue
);
}
catch
(
Exception
e
){
logger
.
warn
(
"获取Cell,在值转换成数字的地方出错"
);
return
BigDecimal
.
ZERO
;
}
}
return
cellValue
;
}
}
\ No newline at end of file
atms-api/src/main/java/pwc/taxtech/atms/service/impl/AnalysisJobServiceImpl.java
View file @
4b47db19
This diff is collapsed.
Click to expand it.
atms-api/src/main/java/pwc/taxtech/atms/service/impl/AnalysisServiceImpl.java
View file @
4b47db19
...
...
@@ -285,7 +285,7 @@ public class AnalysisServiceImpl extends BaseService {
AnalysisTax
model
=
new
AnalysisTax
();
model
.
setId
(
idService
.
nextId
());
model
.
setOrganizationId
(
org
.
getId
());
model
.
setSeqNo
(
org
.
getCode
()+
""
+
period
);
model
.
setSeqNo
(
getSeqNoByPeriod
(
org
.
getId
(),
period
)
);
model
.
setPeriod
(
period
);
model
.
setCompanyName
(
org
.
getName
());
model
.
setTaxGroup
(
getCellStringValue
(
sheet
.
getRow
(
0
).
getCell
(
k
)));
...
...
@@ -293,6 +293,16 @@ public class AnalysisServiceImpl extends BaseService {
return
model
;
}
public
String
getSeqNoByPeriod
(
String
orgId
,
Integer
period
){
AnalysisMasterExample
analysisMasterExample
=
new
AnalysisMasterExample
();
analysisMasterExample
.
createCriteria
().
andPeriodEqualTo
(
period
).
andOrganizationIdEqualTo
(
orgId
);
List
<
AnalysisMaster
>
analysisMasters
=
analysisMasterMapper
.
selectByExample
(
analysisMasterExample
);
if
(
analysisMasters
.
size
()
!=
0
)
return
analysisMasters
.
get
(
0
).
getSeqNo
();
return
null
;
}
private
void
importAnalysisReturnTaxExcelFile
(
MultipartFile
file
,
String
periodDate
)
{
try
{
InputStream
inputStream
=
file
.
getInputStream
();
...
...
@@ -346,7 +356,7 @@ public class AnalysisServiceImpl extends BaseService {
AnalysisActualTaxReturn
model
=
new
AnalysisActualTaxReturn
();
model
.
setId
(
idService
.
nextId
());
model
.
setOrganizationId
(
org
.
getId
());
model
.
setSeqNo
(
org
.
getCode
()+
""
+
period
);
model
.
setSeqNo
(
getSeqNoByPeriod
(
org
.
getId
(),
period
)
);
model
.
setPeriod
(
period
);
model
.
setCompanyName
(
org
.
getName
());
model
.
setTaxReturnGroup
(
getCellStringValue
(
sheet
.
getRow
(
0
).
getCell
(
k
)));
...
...
@@ -381,6 +391,10 @@ public class AnalysisServiceImpl extends BaseService {
model
.
setInternAmount
(
getCellBigDecimalValue
(
sheet
.
getRow
(
j
).
getCell
(
2
)));
model
.
setVendorAmount
(
getCellBigDecimalValue
(
sheet
.
getRow
(
j
).
getCell
(
3
)));
model
.
setTotalAmount
(
getCellBigDecimalValue
(
sheet
.
getRow
(
j
).
getCell
(
4
)));
//通过公司名称查询orgId
OrganizationExample
example
=
new
OrganizationExample
();
example
.
createCriteria
().
andNameEqualTo
(
getCellStringValue
(
sheet
.
getRow
(
j
).
getCell
(
0
)));
model
.
setSeqNo
(
getSeqNoByPeriod
(
organizationMapper
.
selectByExample
(
example
).
get
(
0
).
getId
(),
Integer
.
parseInt
(
periodDate
)));
lists
.
add
(
model
);
}
AnalysisEmployeeNumExample
example
=
new
AnalysisEmployeeNumExample
();
...
...
@@ -487,7 +501,6 @@ public class AnalysisServiceImpl extends BaseService {
throw
new
ServiceException
(
e
);
}
}
private
void
importAnalysisInterTaxDataExcelFile
(
MultipartFile
file
,
String
periodDate
,
String
companyName
,
String
country
)
{
try
{
...
...
atms-api/src/main/java/pwc/taxtech/atms/vat/service/impl/ReportServiceImpl.java
View file @
4b47db19
...
...
@@ -2465,6 +2465,7 @@ public class ReportServiceImpl extends BaseService {
for
(
int
m
=
0
;
m
<
3
;
m
++)
{
FileExcelUtil
.
cloneCell
(
sheetAt
.
getRow
(
m
).
getCell
(
2
),
sheetAt
.
getRow
(
m
).
getCell
(
1
));
sheetAt
.
getRow
(
m
).
getCell
(
3
).
setCellValue
(
""
);
sheetAt
.
getRow
(
m
).
getCell
(
1
).
setCellValue
(
""
);
}
style1
.
setFillBackgroundColor
(
IndexedColors
.
YELLOW
.
getIndex
());
...
...
@@ -2472,7 +2473,7 @@ public class ReportServiceImpl extends BaseService {
sheetAt
.
getRow
(
2
).
getCell
(
2
).
setCellValue
(
"本期:"
+
spreadData
.
get
(
0
).
getPeriod
());
}
/*
public String getCellStringValue(Cell cell) {
public
String
getCellStringValue
(
Cell
cell
)
{
String
cellValue
=
null
;
switch
(
cell
.
getCellType
())
{
case
HSSFCell
.
CELL_TYPE_STRING
:
//字符串类型
...
...
@@ -2498,7 +2499,7 @@ public class ReportServiceImpl extends BaseService {
break
;
}
return
cellValue
;
}
*/
}
@Autowired
private
OrganizationMapper
organizationMapper
;
...
...
@@ -2525,7 +2526,7 @@ public class ReportServiceImpl extends BaseService {
}
}
private
String
getCellStringValue
(
Cell
cell
)
{
/*
private String getCellStringValue(Cell cell) {
if (cell.getCellTypeEnum().equals(CellType.STRING)) {
return cell.getStringCellValue();
} else if (cell.getCellTypeEnum().equals(CellType.NUMERIC)) {
...
...
@@ -2534,5 +2535,5 @@ public class ReportServiceImpl extends BaseService {
}
logger.warn("获取单元格数据类型未匹配");
return null;
}
}
*/
}
atms-api/src/test/java/pwc/taxtech/atms/service/impl/AnalysisTest.java
View file @
4b47db19
...
...
@@ -28,7 +28,7 @@ public class AnalysisTest extends CommonIT {
public
void
analysisExpectedTax
(){
Integer
period
=
DateUtils
.
getPeriodNow
();
OrganizationExample
e
=
new
OrganizationExample
();
e
.
createCriteria
().
andIsActiveEqualTo
(
true
);
//
e.createCriteria().andIsActiveEqualTo(true);
List
<
Organization
>
orgs
=
organizationMapper
.
selectByExample
(
e
);
logger
.
info
(
String
.
format
(
"开始分析%s预期返还税数据"
,
period
));
analysisJobService
.
analysisExpectedTax
(
orgs
,
period
,
EnumTbImportType
.
CoverImport
.
getCode
());
...
...
@@ -39,7 +39,7 @@ public class AnalysisTest extends CommonIT {
public
void
analysisFee
(){
Integer
period
=
DateUtils
.
getPeriodNow
();
OrganizationExample
e
=
new
OrganizationExample
();
e
.
createCriteria
().
andIsActiveEqualTo
(
true
);
//
e.createCriteria().andIsActiveEqualTo(true);
List
<
Organization
>
orgs
=
organizationMapper
.
selectByExample
(
e
);
logger
.
info
(
String
.
format
(
"开始分析%s费用数据"
,
period
));
analysisJobService
.
analysisFee
(
orgs
,
period
,
EnumTbImportType
.
CoverImport
.
getCode
());
...
...
@@ -49,7 +49,7 @@ public class AnalysisTest extends CommonIT {
public
void
analysisFileManagement
(){
Integer
period
=
DateUtils
.
getPeriodNow
();
OrganizationExample
e
=
new
OrganizationExample
();
e
.
createCriteria
().
andIsActiveEqualTo
(
true
);
//
e.createCriteria().andIsActiveEqualTo(true);
List
<
Organization
>
orgs
=
organizationMapper
.
selectByExample
(
e
);
logger
.
info
(
String
.
format
(
"开始分析%s文档管理数据"
,
period
));
...
...
@@ -60,7 +60,7 @@ public class AnalysisTest extends CommonIT {
public
void
analysisMaster
(){
Integer
period
=
DateUtils
.
getPeriodNow
();
OrganizationExample
e
=
new
OrganizationExample
();
e
.
createCriteria
().
andIsActiveEqualTo
(
true
);
//
e.createCriteria().andIsActiveEqualTo(true);
List
<
Organization
>
orgs
=
organizationMapper
.
selectByExample
(
e
);
logger
.
info
(
String
.
format
(
"开始分析%s机构数据"
,
period
));
analysisJobService
.
analysisMaster
(
orgs
,
period
,
EnumTbImportType
.
CoverImport
.
getCode
());
...
...
@@ -70,7 +70,7 @@ public class AnalysisTest extends CommonIT {
public
void
analysisSales
(){
Integer
period
=
DateUtils
.
getPeriodNow
();
OrganizationExample
e
=
new
OrganizationExample
();
e
.
createCriteria
().
andIsActiveEqualTo
(
true
);
//
e.createCriteria().andIsActiveEqualTo(true);
List
<
Organization
>
orgs
=
organizationMapper
.
selectByExample
(
e
);
logger
.
info
(
String
.
format
(
"开始分析%s申报表数据"
,
period
));
analysisJobService
.
analysisSales
(
orgs
,
period
,
EnumTbImportType
.
CoverImport
.
getCode
());
...
...
@@ -80,9 +80,19 @@ public class AnalysisTest extends CommonIT {
public
void
analysisTaxReturnEnd
(){
Integer
period
=
DateUtils
.
getPeriodNow
();
OrganizationExample
e
=
new
OrganizationExample
();
e
.
createCriteria
().
andIsActiveEqualTo
(
true
);
//
e.createCriteria().andIsActiveEqualTo(true);
List
<
Organization
>
orgs
=
organizationMapper
.
selectByExample
(
e
);
logger
.
info
(
String
.
format
(
"开始分析%s返还后税数据"
,
period
));
analysisJobService
.
analysisTaxReturnEnd
(
orgs
,
period
,
EnumTbImportType
.
CoverImport
.
getCode
());
}
@Test
public
void
analysisTax
(){
Integer
period
=
DateUtils
.
getPeriodNow
();
OrganizationExample
e
=
new
OrganizationExample
();
//e.createCriteria().andIsActiveEqualTo(true);
List
<
Organization
>
orgs
=
organizationMapper
.
selectByExample
(
e
);
logger
.
info
(
String
.
format
(
"开始分析%s返还后税数据"
,
period
));
analysisJobService
.
analysisTax
(
orgs
,
period
,
EnumTbImportType
.
CoverImport
.
getCode
());
}
}
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