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
413352a3
Commit
413352a3
authored
Nov 07, 2018
by
sherlock
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug:app-overview:listView\cardView
parent
c28f4dd6
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
205 additions
and
9 deletions
+205
-9
TemplateGroupServiceImpl.java
...c/taxtech/atms/service/impl/TemplateGroupServiceImpl.java
+47
-9
PeriodDataSourceMapper.java
...java/pwc/taxtech/atms/vat/dao/PeriodDataSourceMapper.java
+3
-0
PeriodDataSourceExtendsMapper.xml
...ch/atms/vat/dao/extends/PeriodDataSourceExtendsMapper.xml
+155
-0
No files found.
atms-api/src/main/java/pwc/taxtech/atms/service/impl/TemplateGroupServiceImpl.java
View file @
413352a3
...
...
@@ -35,16 +35,15 @@ import pwc.taxtech.atms.entity.TemplateExample;
import
pwc.taxtech.atms.entity.TemplateGroup
;
import
pwc.taxtech.atms.entity.TemplateGroupExample
;
import
pwc.taxtech.atms.exception.ServiceException
;
import
pwc.taxtech.atms.vat.dao.PeriodDataSourceMapper
;
import
pwc.taxtech.atms.vat.entity.PeriodCellData
;
import
pwc.taxtech.atms.vat.entity.PeriodDataSource
;
import
java.io.ByteArrayInputStream
;
import
java.io.ByteArrayOutputStream
;
import
java.io.InputStream
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Optional
;
import
java.math.BigDecimal
;
import
java.util.*
;
import
java.util.stream.Collectors
;
@Service
...
...
@@ -67,7 +66,8 @@ public class TemplateGroupServiceImpl extends AbstractService {
private
CellTemplateConfigMapper
cellTemplateConfigMapper
;
@Autowired
private
CellTemplateConfigDao
cellTemplateConfigDao
;
@Autowired
private
PeriodDataSourceMapper
periodDataSourceMapper
;
public
List
<
TemplateGroupDto
>
get
()
{
List
<
TemplateGroup
>
templateGroups
=
templateGroupMapper
.
selectByExample
(
new
TemplateGroupExample
());
...
...
@@ -236,6 +236,7 @@ public class TemplateGroupServiceImpl extends AbstractService {
templateMapper
.
insertSelective
(
template
);
List
<
CellTemplate
>
cellTemplateList
=
Lists
.
newArrayList
();
List
<
CellTemplateConfig
>
cellTemplateConfigList
=
Lists
.
newArrayList
();
List
<
PeriodDataSource
>
periodDataSourceList
=
Lists
.
newArrayList
();
for
(
int
r
=
sheet
.
getFirstRowNum
();
r
<=
sheet
.
getLastRowNum
();
r
++)
{
Row
row
=
sheet
.
getRow
(
r
);
for
(
int
c
=
row
.
getFirstCellNum
();
c
<=
row
.
getLastCellNum
();
c
++)
{
...
...
@@ -271,10 +272,26 @@ public class TemplateGroupServiceImpl extends AbstractService {
config
.
setDataSourceType
(
1
);
//todo 枚举
config
.
setFormula
(
POIUtil
.
getCellFormulaString
(
cell
));
// config.setFormula(cell.getCellFormula());
// config.setFormulaDataSource(
); //todo KV相关
config
.
setFormulaDataSource
(
"报表数据"
);
//todo KV相关
config
.
setUpdateTime
(
now
);
config
.
setUpdateBy
(
authUserHelper
.
getCurrentUserId
());
cellTemplateConfigList
.
add
(
config
);
PeriodDataSource
pds
=
new
PeriodDataSource
();
pds
.
setAmount
(
BigDecimal
.
ZERO
);
pds
.
setUpdateBy
(
"Admin"
);
pds
.
setUpdateTime
(
new
Date
());
pds
.
setId
(
distributedIdService
.
nextId
());
pds
.
setCreateTime
(
new
Date
());
pds
.
setCellTemplateId
(
cellTemplate
.
getId
());
pds
.
setCreateBy
(
"Admin"
);
pds
.
setDescription
(
" "
);
pds
.
setName
(
"ReportDataSource"
);
Calendar
cal
=
Calendar
.
getInstance
();
pds
.
setPeriod
(
cal
.
get
(
Calendar
.
MONTH
)
+
1
);
pds
.
setType
(
5
);
pds
.
setColumnIndex
(
cell
.
getColumnIndex
());
pds
.
setRowIndex
(
cell
.
getRowIndex
());
periodDataSourceList
.
add
(
pds
);
}
}
}
...
...
@@ -282,6 +299,8 @@ public class TemplateGroupServiceImpl extends AbstractService {
tmpList
.
forEach
(
list
->
cellTemplateMapper
.
batchInsert2
(
list
));
List
<
List
<
CellTemplateConfig
>>
tmpConfigList
=
CommonUtils
.
subListWithLen
(
cellTemplateConfigList
,
CommonUtils
.
BATCH_NUM
);
tmpConfigList
.
forEach
(
list
->
cellTemplateConfigMapper
.
batchInsert
(
list
));
List
<
List
<
PeriodDataSource
>>
tmpPeriodList
=
CommonUtils
.
subListWithLen
(
periodDataSourceList
,
CommonUtils
.
BATCH_NUM
);
tmpPeriodList
.
forEach
(
list
->
periodDataSourceMapper
.
batchInsert
(
list
));
}
}
catch
(
Exception
e
)
{
...
...
@@ -336,6 +355,7 @@ public class TemplateGroupServiceImpl extends AbstractService {
templateMapper
.
insertSelective
(
template
);
List
<
CellTemplate
>
cellTemplateList
=
Lists
.
newArrayList
();
List
<
CellTemplateConfig
>
cellTemplateConfigList
=
Lists
.
newArrayList
();
List
<
PeriodDataSource
>
periodDataSourceList
=
Lists
.
newArrayList
();
for
(
int
r
=
sheet
.
getFirstRowNum
();
r
<=
sheet
.
getLastRowNum
();
r
++)
{
Row
row
=
sheet
.
getRow
(
r
);
for
(
int
c
=
row
.
getFirstCellNum
();
c
<=
row
.
getLastCellNum
();
c
++)
{
...
...
@@ -364,10 +384,26 @@ public class TemplateGroupServiceImpl extends AbstractService {
config
.
setDataSourceType
(
1
);
//todo 枚举
config
.
setFormula
(
POIUtil
.
getCellFormulaString
(
cell
));
// config.setFormula(cell.getCellFormula());
// config.setFormulaDataSource(
); //todo KV相关
config
.
setFormulaDataSource
(
"报表数据"
);
//todo KV相关
config
.
setUpdateTime
(
now
);
config
.
setUpdateBy
(
authUserHelper
.
getCurrentUserId
());
cellTemplateConfigList
.
add
(
config
);
PeriodDataSource
pds
=
new
PeriodDataSource
();
pds
.
setAmount
(
BigDecimal
.
ZERO
);
pds
.
setUpdateBy
(
"Admin"
);
pds
.
setUpdateTime
(
new
Date
());
pds
.
setId
(
distributedIdService
.
nextId
());
pds
.
setCreateTime
(
new
Date
());
pds
.
setCellTemplateId
(
cellTemplate
.
getId
());
pds
.
setCreateBy
(
"Admin"
);
pds
.
setDescription
(
" "
);
pds
.
setName
(
"ReportDataSource"
);
Calendar
cal
=
Calendar
.
getInstance
();
pds
.
setPeriod
(
cal
.
get
(
Calendar
.
MONTH
)
+
1
);
pds
.
setType
(
5
);
pds
.
setColumnIndex
(
cell
.
getColumnIndex
());
pds
.
setRowIndex
(
cell
.
getRowIndex
());
periodDataSourceList
.
add
(
pds
);
}
}
}
...
...
@@ -376,6 +412,8 @@ public class TemplateGroupServiceImpl extends AbstractService {
tmpList
.
forEach
(
list
->
cellTemplateDao
.
batchInsert
(
list
));
//todo 批量插入优化
List
<
List
<
CellTemplateConfig
>>
tmpConfigList
=
CommonUtils
.
subListWithLen
(
cellTemplateConfigList
,
CommonUtils
.
BATCH_NUM
);
tmpConfigList
.
forEach
(
list
->
cellTemplateConfigDao
.
batchInsert
(
list
));
List
<
List
<
PeriodDataSource
>>
tmpPeriodList
=
CommonUtils
.
subListWithLen
(
periodDataSourceList
,
CommonUtils
.
BATCH_NUM
);
tmpPeriodList
.
forEach
(
list
->
periodDataSourceMapper
.
batchInsert
(
list
));
}
}
catch
(
Exception
e
)
{
logger
.
error
(
"importTemplateExcelFile error."
,
e
);
...
...
atms-dao/src/main/java/pwc/taxtech/atms/vat/dao/PeriodDataSourceMapper.java
View file @
413352a3
...
...
@@ -137,4 +137,6 @@ public interface PeriodDataSourceMapper extends MyVatMapper {
List
<
DataSourceExtendDto
>
getManualDataSource
(
Long
cellDataID
);
DataSourceCellDataDto
getManualDataSource2
(
Long
dataSourceID
);
int
batchInsert
(
List
<
PeriodDataSource
>
list
);
}
\ No newline at end of file
atms-dao/src/main/resources/pwc/taxtech/atms/vat/dao/extends/PeriodDataSourceExtendsMapper.xml
View file @
413352a3
...
...
@@ -338,4 +338,158 @@
WHERE
CELLDATASOURCE.DATA_SOURCE_ID = #{dataSourceID,jdbcType=BIGINT} AND ROWNUM = 1
</select>
<insert
id=
"batchInsert"
parameterType=
"pwc.taxtech.atms.vat.entity.PeriodDataSource"
>
INSERT ALL
<foreach
collection=
"list"
item=
"item"
>
INTO PERIOD_DATA_SOURCE VALUES
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<choose>
<when
test=
"item.id != null"
>
#{item.id,jdbcType=BIGINT},
</when>
</choose>
<choose>
<when
test=
"item.type != null"
>
#{item.type,jdbcType=INTEGER},
</when>
<otherwise>
0,
</otherwise>
</choose>
<choose>
<when
test=
"item.name != null"
>
#{item.name,jdbcType=VARCHAR},
</when>
<otherwise>
'',
</otherwise>
</choose>
<choose>
<when
test=
"item.amount != null"
>
#{item.amount,jdbcType=DECIMAL},
</when>
<otherwise>
0,
</otherwise>
</choose>
<choose>
<when
test=
"item.description != null"
>
#{item.description,jdbcType=VARCHAR},
</when>
<otherwise>
'',
</otherwise>
</choose>
<choose>
<when
test=
"item.keyValueDataId != null"
>
#{item.keyValueDataId,jdbcType=VARCHAR},
</when>
<otherwise>
0,
</otherwise>
</choose>
<choose>
<when
test=
"item.createBy != null"
>
#{item.createBy,jdbcType=VARCHAR},
</when>
<otherwise>
'',
</otherwise>
</choose>
<choose>
<when
test=
"item.createTime != null"
>
#{item.createTime,jdbcType=TIMESTAMP},
</when>
<otherwise>
TO_DATE('1970-01-01 08:00:00','yyyy-mm-dd hh24:mi:ss'),
</otherwise>
</choose>
<choose>
<when
test=
"item.updateBy != null"
>
#{item.updateBy,jdbcType=VARCHAR},
</when>
<otherwise>
'',
</otherwise>
</choose>
<choose>
<when
test=
"item.updateTime != null"
>
#{item.updateTime,jdbcType=TIMESTAMP},
</when>
<otherwise>
TO_DATE('1970-01-01 08:00:00','yyyy-mm-dd hh24:mi:ss'),
</otherwise>
</choose>
<choose>
<when
test=
"item.rowName != null"
>
#{item.rowName,jdbcType=VARCHAR},
</when>
<otherwise>
'',
</otherwise>
</choose>
<choose>
<when
test=
"item.columnName != null"
>
#{item.columnName,jdbcType=VARCHAR},
</when>
<otherwise>
'',
</otherwise>
</choose>
<choose>
<when
test=
"item.rowIndex != null"
>
#{item.rowIndex,jdbcType=INTEGER},
</when>
<otherwise>
0,
</otherwise>
</choose>
<choose>
<when
test=
"item.remapBatchId != null"
>
#{item.remapBatchId,jdbcType=VARCHAR},
</when>
<otherwise>
'',
</otherwise>
</choose>
<choose>
<when
test=
"item.columnIndex != null"
>
#{item.columnIndex,jdbcType=INTEGER},
</when>
<otherwise>
0,
</otherwise>
</choose>
<choose>
<when
test=
"item.cellTemplateId != null"
>
#{item.cellTemplateId,jdbcType=BIGINT},
</when>
<otherwise>
0,
</otherwise>
</choose>
<choose>
<when
test=
"item.period != null"
>
#{item.period,jdbcType=INTEGER},
</when>
<otherwise>
0,
</otherwise>
</choose>
<choose>
<when
test=
"item.projectId != null"
>
#{item.projectId,jdbcType=VARCHAR},
</when>
<otherwise>
'',
</otherwise>
</choose>
</trim>
</foreach>
SELECT 1 FROM DUAL
</insert>
</mapper>
\ No newline at end of file
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