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
bd1a4b5f
Commit
bd1a4b5f
authored
May 11, 2018
by
eddie.woo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add getEnterpriseAccountList
parent
a32d7f12
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
127 additions
and
0 deletions
+127
-0
EnterpriseAccountConstant.java
.../pwc/taxtech/atms/constant/EnterpriseAccountConstant.java
+5
-0
EnterpriseAccountManagerController.java
...h/atms/controller/EnterpriseAccountManagerController.java
+9
-0
EnterpriseAccountMapper.java
...in/java/pwc/taxtech/atms/dao/EnterpriseAccountMapper.java
+5
-0
EnterpriseAccountService.java
...va/pwc/taxtech/atms/service/EnterpriseAccountService.java
+2
-0
EnterpriseAccountServiceImpl.java
...xtech/atms/service/impl/EnterpriseAccountServiceImpl.java
+74
-0
EnterpriseAccountMapper.xml
...esources/pwc/taxtech/atms/dao/EnterpriseAccountMapper.xml
+32
-0
No files found.
atms-api/src/main/java/pwc/taxtech/atms/constant/EnterpriseAccountConstant.java
View file @
bd1a4b5f
...
...
@@ -73,4 +73,9 @@ public class EnterpriseAccountConstant {
public
static
final
List
<
String
>
acctPropLogList
=
Arrays
.
asList
(
""
,
"资产"
,
"负债"
,
"共同"
,
"权益"
,
"成本"
,
"损益"
,
"其他"
);
public
class
StdCode
{
public
static
final
String
NULL_STD_CODE
=
"00"
;
public
static
final
String
EMPTY_STD_CODE
=
"0000"
;
}
}
atms-api/src/main/java/pwc/taxtech/atms/controller/EnterpriseAccountManagerController.java
View file @
bd1a4b5f
...
...
@@ -261,4 +261,13 @@ public class EnterpriseAccountManagerController {
public
List
<
EnterpriseAccountSetDto
>
getEnterpriseAccountSetListByOrgID
(
@RequestParam
String
orgID
)
{
return
enterpriseAccountService
.
getEnterpriseAccountSetListByOrgID
(
orgID
);
}
@ResponseBody
@ApiOperation
(
value
=
"科目对应列表"
)
@RequestMapping
(
value
=
"getEnterpriseAccountList"
,
method
=
RequestMethod
.
GET
)
public
List
<
EnterpriseAccountDto
>
getEnterpriseAccountList
(
@RequestParam
String
espID
,
@RequestParam
String
orgID
,
@RequestParam
String
filterType
)
{
return
enterpriseAccountService
.
getList
(
espID
,
orgID
,
filterType
);
}
}
atms-api/src/main/java/pwc/taxtech/atms/dao/EnterpriseAccountMapper.java
View file @
bd1a4b5f
...
...
@@ -5,6 +5,7 @@ import org.apache.ibatis.annotations.Mapper;
import
org.apache.ibatis.annotations.Param
;
import
org.apache.ibatis.session.RowBounds
;
import
pwc.taxtech.atms.MyMapper
;
import
pwc.taxtech.atms.dto.epaccount.EnterpriseAccountDto
;
import
pwc.taxtech.atms.entitiy.EnterpriseAccount
;
import
pwc.taxtech.atms.entitiy.EnterpriseAccountExample
;
...
...
@@ -105,4 +106,7 @@ public interface EnterpriseAccountMapper extends MyMapper {
* @mbg.generated
*/
int
updateByPrimaryKey
(
EnterpriseAccount
record
);
List
<
EnterpriseAccountDto
>
getDto
(
@Param
(
"epAccountSetID"
)
String
epAccountSetID
,
@Param
(
"orgId"
)
String
orgId
,
@Param
(
"industryId"
)
String
industryId
);
}
\ No newline at end of file
atms-api/src/main/java/pwc/taxtech/atms/service/EnterpriseAccountService.java
View file @
bd1a4b5f
...
...
@@ -99,6 +99,8 @@ public interface EnterpriseAccountService {
List
<
AccountMappingDto
>
getAccountMappingOrg
(
String
organizationID
);
List
<
EnterpriseAccountSetDto
>
getEnterpriseAccountSetListByOrgID
(
String
orgId
);
List
<
EnterpriseAccountDto
>
getList
(
String
epAccountSetID
,
String
orgId
,
String
filterType
);
}
atms-api/src/main/java/pwc/taxtech/atms/service/impl/EnterpriseAccountServiceImpl.java
View file @
bd1a4b5f
...
...
@@ -2,6 +2,7 @@
package
pwc
.
taxtech
.
atms
.
service
.
impl
;
import
com.google.common.collect.Lists
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.nutz.lang.Files
;
...
...
@@ -621,6 +622,79 @@ public class EnterpriseAccountServiceImpl extends AbstractService implements Ent
.
map
(
this
::
toAccountSetDto
).
collect
(
Collectors
.
toList
());
}
@Override
public
List
<
EnterpriseAccountDto
>
getList
(
String
epAccountSetID
,
String
orgId
,
String
filterType
)
{
if
(
StringUtils
.
isAnyBlank
(
epAccountSetID
,
orgId
))
{
return
Collections
.
emptyList
();
}
Organization
organization
=
organizationMapper
.
selectByPrimaryKey
(
orgId
);
Industry
industry
=
industryMapper
.
selectByPrimaryKey
(
organization
.
getIndustryID
());
String
industryId
=
null
==
industry
?
IndustryConstant
.
GeneralIndustryID
:
industry
.
getID
();
List
<
EnterpriseAccountDto
>
dtoList
=
enterpriseAccountMapper
.
getDto
(
epAccountSetID
,
orgId
,
industryId
);
// dtoList = dtoList.stream().map(x -> {
// if (StringUtils.isBlank(x.getParentCode())) {
// x.setParentCode(StringUtils.EMPTY);
// }
// return x;
// }).sorted(Comparator.comparing(EnterpriseAccountDto::getParentCode)
// .thenComparing(EnterpriseAccountDto::getIsActive).reversed()
// .thenComparing(EnterpriseAccountDto::getCode)).collect(Collectors.toList());
List
<
EnterpriseAccountDto
>
result
;
switch
(
filterType
)
{
//未对应
case
"0"
:
result
=
dtoList
.
stream
().
filter
(
x
->
StringUtils
.
isBlank
(
x
.
getStdCode
())).
collect
(
Collectors
.
toList
());
break
;
//已对应
case
"1"
:
result
=
dtoList
.
stream
().
filter
(
x
->
StringUtils
.
isNotBlank
(
x
.
getStdCode
())).
collect
(
Collectors
.
toList
());
break
;
//借贷方向不一致
case
"2"
:
result
=
dtoList
.
stream
().
filter
(
x
->
StringUtils
.
isNotBlank
(
x
.
getStdCode
())
&&
!
StringUtils
.
equalsAny
(
x
.
getStdCode
(),
EnterpriseAccountConstant
.
StdCode
.
EMPTY_STD_CODE
,
EnterpriseAccountConstant
.
StdCode
.
NULL_STD_CODE
)
&&
x
.
getDirection
()
!=
x
.
getStdDirection
()).
collect
(
Collectors
.
toList
());
break
;
//科目类型不一致
case
"3"
:
result
=
dtoList
.
stream
().
filter
(
x
->
StringUtils
.
isNotBlank
(
x
.
getStdCode
())
&&
!
StringUtils
.
equalsAny
(
x
.
getStdCode
(),
EnterpriseAccountConstant
.
StdCode
.
EMPTY_STD_CODE
,
EnterpriseAccountConstant
.
StdCode
.
NULL_STD_CODE
)
&&
x
.
getAcctProp
()
!=
x
.
getStdAcctProp
()).
collect
(
Collectors
.
toList
());
break
;
default
:
result
=
dtoList
;
}
List
<
EnterpriseAccountDto
>
rootList
=
result
.
stream
().
filter
(
x
->
StringUtils
.
isBlank
(
x
.
getParentCode
())).
map
(
x
->
{
x
.
setTreeLevel
(
0
);
return
x
;
}).
collect
(
Collectors
.
toList
());
List
<
EnterpriseAccountDto
>
total
=
Lists
.
newArrayList
();
formatEpAccountDtoTree
(
rootList
,
result
,
total
);
return
total
.
stream
().
sorted
(
Comparator
.
comparing
(
EnterpriseAccountDto:
:
getCode
)).
collect
(
Collectors
.
toList
());
}
private
void
formatEpAccountDtoTree
(
List
<
EnterpriseAccountDto
>
rootList
,
List
<
EnterpriseAccountDto
>
allList
,
List
<
EnterpriseAccountDto
>
result
)
{
if
(
CollectionUtils
.
isEmpty
(
rootList
))
{
return
;
}
int
level
=
rootList
.
get
(
0
).
getTreeLevel
()
+
1
;
rootList
.
forEach
(
item
->
{
result
.
add
(
item
);
List
<
EnterpriseAccountDto
>
subList
=
allList
.
stream
().
filter
(
x
->
StringUtils
.
equals
(
x
.
getParentCode
(),
item
.
getCode
()))
.
map
(
x
->
{
x
.
setTreeLevel
(
level
);
x
.
setParentName
(
item
.
getName
());
x
.
setParentFullName
(
item
.
getFullName
());
return
x
;
}).
collect
(
Collectors
.
toList
());
if
(
CollectionUtils
.
isNotEmpty
(
subList
))
{
result
.
addAll
(
subList
);
formatEpAccountDtoTree
(
subList
,
allList
,
result
);
}
});
}
private
EnterpriseAccountSetDto
toAccountSetDto
(
EnterpriseAccountSet
accountSet
)
{
EnterpriseAccountSetDto
dto
=
new
EnterpriseAccountSetDto
();
return
CommonUtils
.
copyProperties
(
accountSet
,
dto
);
...
...
atms-api/src/main/resources/pwc/taxtech/atms/dao/EnterpriseAccountMapper.xml
View file @
bd1a4b5f
...
...
@@ -508,4 +508,35 @@
order by ${orderByClause}
</if>
</select>
<select
id=
"getDto"
resultType=
"pwc.taxtech.atms.dto.epaccount.EnterpriseAccountDto"
>
SELECT ea.ID, ea.CODE as code, ea.NAME as name, ea.ParentCode as parentCode, ea.FullName as fullName
, ea.IsLeaf as isLeaf, ea.RuleType as ruleType, ea.AcctLevel as acctLevel, ea.AcctProp as acctProp, ea.Direction as direction
, ea.IsActive as isActive
, CASE
WHEN am.StandardAccountCode = '0000' THEN am.StandardAccountCode
ELSE sa.CODE
END AS stdCode, sa.NAME AS stdName, sa.ParentCode AS stdParentCode, sa.Direction AS stdDirection, sa.AcctProp AS stdAcctProp
, sa.FullName AS stdFullName
FROM (
SELECT *
FROM EnterpriseAccount
WHERE Enterpriseaccountsetid = #{epAccountSetID}
) ea
LEFT JOIN (
SELECT *
FROM AccountMapping
WHERE OrganizationID = #{orgId}
AND IndustryID = #{industryId}
AND EnterpriseAccountSetID = #{epAccountSetID}
) am
ON ea.CODE = am.EnterpriseAccountCode
LEFT JOIN (
SELECT *
FROM StandardAccount
WHERE IndustryID = #{industryId}
) sa
ON am.StandardAccountCode = sa.CODE
ORDER BY ea.CODE
</select>
</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