Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
D
dsk-operate-sys-cscec
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
fulixin
dsk-operate-sys-cscec
Commits
10cbbca3
Commit
10cbbca3
authored
Mar 07, 2024
by
chenyuefang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
a9e080ae
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
52 additions
and
23 deletions
+52
-23
CbSummaryServiceImpl.java
...java/com/dsk/cscec/service/impl/CbSummaryServiceImpl.java
+52
-23
No files found.
dsk-module/dsk-biz-api/src/main/java/com/dsk/cscec/service/impl/CbSummaryServiceImpl.java
View file @
10cbbca3
...
@@ -96,11 +96,12 @@ public class CbSummaryServiceImpl extends ServiceImpl<CbSummaryMapper, CbSummary
...
@@ -96,11 +96,12 @@ public class CbSummaryServiceImpl extends ServiceImpl<CbSummaryMapper, CbSummary
cbProjectFile
.
setFileParseStatus
(
CbProjectConstants
.
PROJECT_FILE_STATUS_PARSE_FAIL
);
cbProjectFile
.
setFileParseStatus
(
CbProjectConstants
.
PROJECT_FILE_STATUS_PARSE_FAIL
);
cbProjectFile
.
setFailRemark
(
e
.
getMessage
());
cbProjectFile
.
setFailRemark
(
e
.
getMessage
());
cbProjectFileMapper
.
updateById
(
cbProjectFile
);
cbProjectFileMapper
.
updateById
(
cbProjectFile
);
log
.
error
(
projectId
+
"项目 成本汇总解析失败"
+
e
);
}
}
// }
// }
});
});
log
.
info
(
projectId
+
"项目 成本汇总解析成功"
);
}
}
/**
/**
...
@@ -132,11 +133,19 @@ public class CbSummaryServiceImpl extends ServiceImpl<CbSummaryMapper, CbSummary
...
@@ -132,11 +133,19 @@ public class CbSummaryServiceImpl extends ServiceImpl<CbSummaryMapper, CbSummary
transactionTemplate
.
execute
(
status
->
{
transactionTemplate
.
execute
(
status
->
{
try
{
try
{
boolean
flag
=
this
.
saveBatch
(
addList
);
//分批次插入
if
(!
flag
)
{
if
(
addList
.
size
()
>
1000
)
{
throw
new
ServiceException
(
"导入数据失败"
);
int
index
=
0
;
int
total
=
addList
.
size
();
while
(
index
<
total
)
{
List
<
CbSummary
>
divideList
=
addList
.
subList
(
index
,
Math
.
min
(
index
+=
1000
,
total
));
Assert
.
isTrue
(
this
.
saveBatch
(
divideList
),
"数据插入失败"
);
}
}
else
{
Assert
.
isTrue
(
this
.
saveBatch
(
addList
),
"数据插入失败"
);
}
}
//处理父级id
//处理父级id
List
<
CbSummary
>
cbSummaryList
=
baseMapper
.
selectList
(
List
<
CbSummary
>
cbSummaryList
=
baseMapper
.
selectList
(
new
LambdaQueryWrapper
<
CbSummary
>()
new
LambdaQueryWrapper
<
CbSummary
>()
...
@@ -161,17 +170,22 @@ public class CbSummaryServiceImpl extends ServiceImpl<CbSummaryMapper, CbSummary
...
@@ -161,17 +170,22 @@ public class CbSummaryServiceImpl extends ServiceImpl<CbSummaryMapper, CbSummary
}
}
cbSummary
.
setParentId
(
parent
.
getId
());
cbSummary
.
setParentId
(
parent
.
getId
());
}
}
//分批次修改
flag
=
this
.
updateBatchById
(
cbSummaryList
);
if
(
cbSummaryList
.
size
()
>
1000
)
{
if
(!
flag
)
{
int
index
=
0
;
throw
new
ServiceException
(
"更新数据失败"
);
int
total
=
cbSummaryList
.
size
();
while
(
index
<
total
)
{
List
<
CbSummary
>
divideList
=
cbSummaryList
.
subList
(
index
,
Math
.
min
(
index
+=
1000
,
total
));
Assert
.
isTrue
(
this
.
updateBatchById
(
divideList
),
"更新数据失败"
);
}
}
else
{
Assert
.
isTrue
(
this
.
updateBatchById
(
cbSummaryList
),
"更新数据失败"
);
}
}
//修改文件状态为解析成功
//修改文件状态为解析成功
file
.
setFileParseStatus
(
CbProjectConstants
.
PROJECT_FILE_STATUS_PARSE_SUCCESS
);
file
.
setFileParseStatus
(
CbProjectConstants
.
PROJECT_FILE_STATUS_PARSE_SUCCESS
);
flag
=
cbProjectFileMapper
.
updateById
(
file
)
>
0
;
Assert
.
isTrue
(
cbProjectFileMapper
.
updateById
(
file
)
>
0
,
"更新文件状态失败"
);
if
(!
flag
)
{
throw
new
ServiceException
(
"更新文件状态失败"
);
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
status
.
setRollbackOnly
();
status
.
setRollbackOnly
();
throw
e
;
throw
e
;
...
@@ -211,11 +225,19 @@ public class CbSummaryServiceImpl extends ServiceImpl<CbSummaryMapper, CbSummary
...
@@ -211,11 +225,19 @@ public class CbSummaryServiceImpl extends ServiceImpl<CbSummaryMapper, CbSummary
transactionTemplate
.
execute
(
status
->
{
transactionTemplate
.
execute
(
status
->
{
try
{
try
{
boolean
flag
=
this
.
saveBatch
(
addList
);
//分批次插入
if
(!
flag
)
{
if
(
addList
.
size
()
>
1000
)
{
throw
new
ServiceException
(
"导入数据失败"
);
int
index
=
0
;
int
total
=
addList
.
size
();
while
(
index
<
total
)
{
List
<
CbSummary
>
divideList
=
addList
.
subList
(
index
,
Math
.
min
(
index
+=
1000
,
total
));
Assert
.
isTrue
(
this
.
saveBatch
(
divideList
),
"数据插入失败"
);
}
}
else
{
Assert
.
isTrue
(
this
.
saveBatch
(
addList
),
"数据插入失败"
);
}
}
//处理父级id
//处理父级id
List
<
CbSummary
>
cbSummaryList
=
baseMapper
.
selectList
(
List
<
CbSummary
>
cbSummaryList
=
baseMapper
.
selectList
(
new
LambdaQueryWrapper
<
CbSummary
>()
new
LambdaQueryWrapper
<
CbSummary
>()
...
@@ -249,14 +271,21 @@ public class CbSummaryServiceImpl extends ServiceImpl<CbSummaryMapper, CbSummary
...
@@ -249,14 +271,21 @@ public class CbSummaryServiceImpl extends ServiceImpl<CbSummaryMapper, CbSummary
}
}
cbSummary
.
setParentId
(
parent
.
getId
());
cbSummary
.
setParentId
(
parent
.
getId
());
}
}
//分批次修改
this
.
updateBatchById
(
cbSummaryList
);
if
(
cbSummaryList
.
size
()
>
1000
)
{
int
index
=
0
;
int
total
=
cbSummaryList
.
size
();
while
(
index
<
total
)
{
List
<
CbSummary
>
divideList
=
cbSummaryList
.
subList
(
index
,
Math
.
min
(
index
+=
1000
,
total
));
Assert
.
isTrue
(
this
.
updateBatchById
(
divideList
),
"更新数据失败"
);
}
}
else
{
Assert
.
isTrue
(
this
.
updateBatchById
(
cbSummaryList
),
"更新数据失败"
);
}
//修改文件状态为解析成功
//修改文件状态为解析成功
file
.
setFileParseStatus
(
CbProjectConstants
.
PROJECT_FILE_STATUS_PARSE_SUCCESS
);
file
.
setFileParseStatus
(
CbProjectConstants
.
PROJECT_FILE_STATUS_PARSE_SUCCESS
);
flag
=
cbProjectFileMapper
.
updateById
(
file
)
>
0
;
Assert
.
isTrue
(
cbProjectFileMapper
.
updateById
(
file
)
>
0
,
"更新文件状态失败"
);
if
(!
flag
)
{
throw
new
ServiceException
(
"更新文件状态失败"
);
}
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
status
.
setRollbackOnly
();
status
.
setRollbackOnly
();
throw
e
;
throw
e
;
...
@@ -307,7 +336,7 @@ public class CbSummaryServiceImpl extends ServiceImpl<CbSummaryMapper, CbSummary
...
@@ -307,7 +336,7 @@ public class CbSummaryServiceImpl extends ServiceImpl<CbSummaryMapper, CbSummary
List
<
CbSummaryActualListVo
>
childrenList
=
baseMapper
.
getByParentId
(
bo
.
getId
(),
bo
.
getExpenseDate
());
List
<
CbSummaryActualListVo
>
childrenList
=
baseMapper
.
getByParentId
(
bo
.
getId
(),
bo
.
getExpenseDate
());
//截至本月费用汇总
//截至本月费用汇总
childrenList
.
forEach
(
children
->
{
childrenList
.
parallelStream
().
forEach
(
children
->
{
Map
<
String
,
BigDecimal
>
total
=
cbSummaryActualMapper
.
getTotal
(
children
.
getId
(),
bo
.
getExpenseDate
());
Map
<
String
,
BigDecimal
>
total
=
cbSummaryActualMapper
.
getTotal
(
children
.
getId
(),
bo
.
getExpenseDate
());
children
.
setTaxExclusiveExpenseTotal
(
total
.
get
(
"taxExclusiveExpenseTotal"
));
children
.
setTaxExclusiveExpenseTotal
(
total
.
get
(
"taxExclusiveExpenseTotal"
));
children
.
setTaxInclusiveExpenseTotal
(
total
.
get
(
"taxInclusiveExpenseTotal"
));
children
.
setTaxInclusiveExpenseTotal
(
total
.
get
(
"taxInclusiveExpenseTotal"
));
...
@@ -330,7 +359,7 @@ public class CbSummaryServiceImpl extends ServiceImpl<CbSummaryMapper, CbSummary
...
@@ -330,7 +359,7 @@ public class CbSummaryServiceImpl extends ServiceImpl<CbSummaryMapper, CbSummary
}
else
{
}
else
{
// //递归列表
// //递归列表
// childrenList = getProjectSumList(bo);
// childrenList = getProjectSumList(bo);
childrenList
.
forEach
(
child
->{
childrenList
.
parallelStream
().
forEach
(
child
->{
Long
count
=
baseMapper
.
selectCount
(
new
LambdaQueryWrapper
<
CbSummary
>().
eq
(
CbSummary:
:
getParentId
,
child
.
getId
()));
Long
count
=
baseMapper
.
selectCount
(
new
LambdaQueryWrapper
<
CbSummary
>().
eq
(
CbSummary:
:
getParentId
,
child
.
getId
()));
if
(
count
>
0
l
){
if
(
count
>
0
l
){
child
.
setHasChildren
(
1
);
child
.
setHasChildren
(
1
);
...
...
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