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
e9f08ea4
Commit
e9f08ea4
authored
Dec 11, 2018
by
eddie.woo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
modify
parent
45e9dc37
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
2 deletions
+42
-2
CommonUtil.java
...rc/main/java/pwc/taxtech/atms/common/util/CommonUtil.java
+19
-0
LgGlBalanceService.java
...ava/pwc/taxtech/atms/service/impl/LgGlBalanceService.java
+23
-2
No files found.
atms-api/src/main/java/pwc/taxtech/atms/common/util/CommonUtil.java
0 → 100644
View file @
e9f08ea4
package
pwc
.
taxtech
.
atms
.
common
.
util
;
import
java.math.BigDecimal
;
public
class
CommonUtil
{
/**
* add
*
* @param v1 BigDecimal
* @param v2 BigDecimal
* @return BigDecimal
*/
public
static
BigDecimal
add
(
BigDecimal
v1
,
BigDecimal
v2
)
{
v1
=
null
==
v1
?
BigDecimal
.
ZERO
:
v1
;
v2
=
null
==
v2
?
BigDecimal
.
ZERO
:
v2
;
return
v1
.
add
(
v2
);
}
}
atms-api/src/main/java/pwc/taxtech/atms/service/impl/LgGlBalanceService.java
View file @
e9f08ea4
...
@@ -6,10 +6,12 @@ import cn.pwc.soap.client.domain.GLBalanceDto;
...
@@ -6,10 +6,12 @@ import cn.pwc.soap.client.domain.GLBalanceDto;
import
cn.pwc.soap.client.domain.GlBalanceParam
;
import
cn.pwc.soap.client.domain.GlBalanceParam
;
import
cn.pwc.soap.client.domain.SoapResponse
;
import
cn.pwc.soap.client.domain.SoapResponse
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
pwc.taxtech.atms.common.ServiceException
;
import
pwc.taxtech.atms.common.ServiceException
;
import
pwc.taxtech.atms.common.config.SystemConfig
;
import
pwc.taxtech.atms.common.config.SystemConfig
;
import
pwc.taxtech.atms.common.util.CommonUtil
;
import
pwc.taxtech.atms.constant.Constant
;
import
pwc.taxtech.atms.constant.Constant
;
import
pwc.taxtech.atms.dao.EnterpriseAccountMapper
;
import
pwc.taxtech.atms.dao.EnterpriseAccountMapper
;
import
pwc.taxtech.atms.dao.EnterpriseAccountSetOrgMapper
;
import
pwc.taxtech.atms.dao.EnterpriseAccountSetOrgMapper
;
...
@@ -66,11 +68,12 @@ public class LgGlBalanceService extends BaseService {
...
@@ -66,11 +68,12 @@ public class LgGlBalanceService extends BaseService {
logger
.
error
(
"queryGLBalance error."
+
JSON
.
toJSONString
(
response
));
logger
.
error
(
"queryGLBalance error."
+
JSON
.
toJSONString
(
response
));
throw
new
ServiceException
(
"ErrorResponse"
);
throw
new
ServiceException
(
"ErrorResponse"
);
}
}
//分组
去重,重复的取第一个元素
//分组
求和 需求确认by sherry
response
.
getData
().
stream
().
collect
(
Collectors
.
groupingBy
(
o
->
StringUtils
.
joinWith
(
"_"
,
response
.
getData
().
stream
().
collect
(
Collectors
.
groupingBy
(
o
->
StringUtils
.
joinWith
(
"_"
,
o
.
getSegment1
(),
o
.
getSegment3
(),
o
.
getSegment4
()))).
values
().
forEach
(
list
->
{
o
.
getSegment1
(),
o
.
getSegment3
(),
o
.
getSegment4
()))).
values
().
forEach
(
list
->
{
GlBalance
glBalance
=
new
GlBalance
();
GlBalance
glBalance
=
new
GlBalance
();
beanUtil
.
copyProperties
(
list
.
get
(
0
),
glBalance
);
GLBalanceDto
sum
=
sum
(
list
);
beanUtil
.
copyProperties
(
sum
,
glBalance
);
glBalance
.
setPeriodName
(
period
);
glBalance
.
setPeriodName
(
period
);
GlBalanceExample
example
=
new
GlBalanceExample
();
GlBalanceExample
example
=
new
GlBalanceExample
();
...
@@ -119,4 +122,22 @@ public class LgGlBalanceService extends BaseService {
...
@@ -119,4 +122,22 @@ public class LgGlBalanceService extends BaseService {
}
}
}
}
private
GLBalanceDto
sum
(
List
<
GLBalanceDto
>
list
)
{
if
(
CollectionUtils
.
isEmpty
(
list
))
{
return
null
;
}
GLBalanceDto
result
=
list
.
get
(
0
);
list
.
subList
(
1
,
list
.
size
()).
forEach
(
o
->
{
result
.
setBeginCrBalance
(
CommonUtil
.
add
(
result
.
getBeginCrBalance
(),
o
.
getBeginCrBalance
()));
result
.
setBeginDrBalance
(
CommonUtil
.
add
(
result
.
getBeginDrBalance
(),
o
.
getBeginDrBalance
()));
result
.
setEndCrBalance
(
CommonUtil
.
add
(
result
.
getEndCrBalance
(),
o
.
getEndCrBalance
()));
result
.
setEndDrBalance
(
CommonUtil
.
add
(
result
.
getEndDrBalance
(),
o
.
getEndDrBalance
()));
result
.
setPtdCr
(
CommonUtil
.
add
(
result
.
getPtdCr
(),
o
.
getPtdCr
()));
result
.
setPtdDr
(
CommonUtil
.
add
(
result
.
getPtdDr
(),
o
.
getPtdDr
()));
result
.
setYtdCr
(
CommonUtil
.
add
(
result
.
getYtdCr
(),
o
.
getYtdCr
()));
result
.
setYtdDr
(
CommonUtil
.
add
(
result
.
getYtdDr
(),
o
.
getYtdDr
()));
});
return
result
;
}
}
}
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