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
3a20ec59
Commit
3a20ec59
authored
Nov 19, 2018
by
sherlock
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
DFFS
parent
b1366f10
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
119 additions
and
5 deletions
+119
-5
SpringContextUtil.java
.../java/pwc/taxtech/atms/common/util/SpringContextUtil.java
+28
-5
TemplateGroupServiceImpl.java
...c/taxtech/atms/service/impl/TemplateGroupServiceImpl.java
+3
-0
DFFS.java
.../taxtech/atms/vat/service/impl/report/functions/DFFS.java
+88
-0
No files found.
atms-api/src/main/java/pwc/taxtech/atms/common/util/SpringContextUtil.java
View file @
3a20ec59
...
...
@@ -4,11 +4,7 @@ import org.springframework.beans.BeansException;
import
org.springframework.context.ApplicationContext
;
import
org.springframework.context.ApplicationContextAware
;
import
org.springframework.stereotype.Component
;
import
pwc.taxtech.atms.dao.FormulaAdminMapper
;
import
pwc.taxtech.atms.dao.OrganizationMapper
;
import
pwc.taxtech.atms.dao.ProjectDao
;
import
pwc.taxtech.atms.dao.ProjectMapper
;
import
pwc.taxtech.atms.dao.ProjectServiceTypeMapper
;
import
pwc.taxtech.atms.dao.*
;
import
pwc.taxtech.atms.invoice.InputInvoiceMapper
;
import
pwc.taxtech.atms.invoice.OutputInvoiceDetailMapper
;
import
pwc.taxtech.atms.invoice.OutputInvoiceMapper
;
...
...
@@ -33,6 +29,7 @@ public class SpringContextUtil implements ApplicationContextAware {
public
static
PeriodTemplateMapper
periodTemplateMapper
;
public
static
PeriodStandardAccountMapper
periodStandardAccountMapper
;
public
static
ProjectDao
projectDao
;
public
static
GlBalanceMapper
glBalanceMapper
;
public
static
BalanceMapper
balanceMapper
;
// public static DataSourceMapper dataSourceMapper;
public
static
PeriodDataSourceMapper
periodDataSourceMapper
;
...
...
@@ -54,6 +51,8 @@ public class SpringContextUtil implements ApplicationContextAware {
public
static
CellDataSourceMapper
cellDataSourceMapper
;
public
static
PeriodCellDataSourceMapper
periodCellDataSourceMapper
;
public
static
OrganizationMapper
organizationMapper
;
public
static
EnterpriseAccountSetOrgMapper
enterpriseAccountSetOrgMapper
;
public
static
AccountMappingMapper
accountMappingMapper
;
/**
* 获取bean
...
...
@@ -66,6 +65,30 @@ public class SpringContextUtil implements ApplicationContextAware {
return
SpringContextUtil
.
webApplicationContext
.
getBean
(
requiredType
);
}
public
static
AccountMappingMapper
getAccountMappingMapper
()
{
return
accountMappingMapper
;
}
public
static
void
setAccountMappingMapper
(
AccountMappingMapper
accountMappingMapper
)
{
SpringContextUtil
.
accountMappingMapper
=
accountMappingMapper
;
}
public
static
EnterpriseAccountSetOrgMapper
getEnterpriseAccountSetOrgMapper
()
{
return
enterpriseAccountSetOrgMapper
;
}
public
static
void
setEnterpriseAccountSetOrgMapper
(
EnterpriseAccountSetOrgMapper
enterpriseAccountSetOrgMapper
)
{
SpringContextUtil
.
enterpriseAccountSetOrgMapper
=
enterpriseAccountSetOrgMapper
;
}
public
static
GlBalanceMapper
getGlBalanceMapper
()
{
return
glBalanceMapper
;
}
public
static
void
setGlBalanceMapper
(
GlBalanceMapper
glBalanceMapper
)
{
SpringContextUtil
.
glBalanceMapper
=
glBalanceMapper
;
}
@Override
public
void
setApplicationContext
(
ApplicationContext
applicationContext
)
throws
BeansException
{
webApplicationContext
=
applicationContext
;
...
...
atms-api/src/main/java/pwc/taxtech/atms/service/impl/TemplateGroupServiceImpl.java
View file @
3a20ec59
...
...
@@ -212,6 +212,9 @@ public class TemplateGroupServiceImpl extends AbstractService {
templateGroupMapper
.
insertSelective
(
templateGroup
);
for
(
int
i
=
0
;
i
<
workbook
.
getNumberOfSheets
();
i
++)
{
String
sheetName
=
workbook
.
getSheetName
(
i
);
if
(!
templateGroupDto
.
getSheetNameList
().
contains
(
sheetName
)){
continue
;
}
String
newName
=
sheetName
+
CommonUtils
.
getUUID
()
+
POIUtil
.
getFileSuffix
(
fileName
).
get
();
Sheet
sheet
=
workbook
.
getSheetAt
(
i
);
Optional
<
Workbook
>
optional
=
POIUtil
.
cloneNewSheet
(
sheet
,
fileName
);
...
...
atms-api/src/main/java/pwc/taxtech/atms/vat/service/impl/report/functions/DFFS.java
0 → 100644
View file @
3a20ec59
package
pwc
.
taxtech
.
atms
.
vat
.
service
.
impl
.
report
.
functions
;
import
com.grapecity.documents.excel.G
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.poi.ss.formula.OperationEvaluationContext
;
import
org.apache.poi.ss.formula.eval.NumberEval
;
import
org.apache.poi.ss.formula.eval.ValueEval
;
import
org.apache.poi.ss.formula.functions.FreeRefFunction
;
import
pwc.taxtech.atms.common.util.DateUtils
;
import
pwc.taxtech.atms.common.util.SpringContextUtil
;
import
pwc.taxtech.atms.entity.AccountMapping
;
import
pwc.taxtech.atms.entity.AccountMappingExample
;
import
pwc.taxtech.atms.entity.EnterpriseAccountSetOrg
;
import
pwc.taxtech.atms.entity.EnterpriseAccountSetOrgExample
;
import
pwc.taxtech.atms.vat.entity.GlBalance
;
import
pwc.taxtech.atms.vat.entity.GlBalanceExample
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.stream.Collectors
;
public
class
DFFS
extends
FunctionBase
implements
FreeRefFunction
{
public
DFFS
(
FormulaContext
formulaContext
)
{
super
(
formulaContext
);
}
@Override
public
ValueEval
evaluate
(
ValueEval
[]
args
,
OperationEvaluationContext
ec
)
{
if
(
args
.
length
<
4
)
{
return
null
;
}
int
type
=
getIntParam
(
args
[
0
],
ec
);
String
code
=
getStringParam
(
args
[
1
],
ec
);
int
year
=
getIntParam
(
args
[
2
],
ec
);
int
period
=
getIntParam
(
args
[
3
],
ec
);
String
formulaExpression
=
"DFFS("
+
type
+
","
+
code
+
","
+
year
+
","
+
period
+
")"
;
logger
.
debug
(
formulaExpression
);
year
=
getIntParam
(
args
[
2
],
ec
);
Integer
yearOffset
=
0
;
period
=
FormulaHelper
.
getPeriod
(
period
,
yearOffset
,
formulaContext
);
String
orgId
=
formulaContext
.
getOrganizationId
();
year
=
year
+
yearOffset
;
Date
date
=
DateUtils
.
strToDate
(
year
+
"-"
+
period
+
"-"
+
15
);
List
<
GlBalance
>
list
;
if
(
type
==
0
){
EnterpriseAccountSetOrgExample
example
=
new
EnterpriseAccountSetOrgExample
();
example
.
createCriteria
().
andEffectiveDateLessThanOrEqualTo
(
date
).
andExpiredDateGreaterThanOrEqualTo
(
date
).
andOrganizationIdEqualTo
(
orgId
);
List
<
EnterpriseAccountSetOrg
>
enterpriseAccountSetOrgs
=
SpringContextUtil
.
enterpriseAccountSetOrgMapper
.
selectByExample
(
example
);
if
(
CollectionUtils
.
isEmpty
(
enterpriseAccountSetOrgs
)){
return
NumberEval
.
ZERO
;
}
AccountMappingExample
accountMappingExample
=
new
AccountMappingExample
();
accountMappingExample
.
createCriteria
().
andOrganizationIdEqualTo
(
orgId
).
andEnterpriseAccountSetIdEqualTo
(
enterpriseAccountSetOrgs
.
get
(
0
).
getEnterpriseAccountSetId
());
List
<
AccountMapping
>
accountMappings
=
SpringContextUtil
.
accountMappingMapper
.
selectByExample
(
accountMappingExample
);
double
result
=
0
;
for
(
AccountMapping
a
:
accountMappings
){
result
+=
count
(
a
.
getEnterpriseAccountCode
());
}
new
NumberEval
(
result
);
}
else
if
(
type
==
1
){
return
new
NumberEval
(
count
(
code
));
}
return
null
;
}
private
double
count
(
String
code
){
GlBalanceExample
glBalanceExample
=
new
GlBalanceExample
();
GlBalanceExample
.
Criteria
c1
=
glBalanceExample
.
createCriteria
().
andSegment3EqualTo
(
code
);
GlBalanceExample
.
Criteria
c2
=
glBalanceExample
.
createCriteria
().
andSegment4EqualTo
(
code
);
glBalanceExample
.
or
(
c2
);
List
<
GlBalance
>
list
=
SpringContextUtil
.
glBalanceMapper
.
selectByExample
(
glBalanceExample
);
if
(
CollectionUtils
.
isEmpty
(
list
)){
return
0.0
;
}
List
<
GlBalance
>
temp
=
list
.
stream
().
filter
(
x
->
code
.
equalsIgnoreCase
(
x
.
getSegment3
())).
collect
(
Collectors
.
toList
());
if
(
CollectionUtils
.
isEmpty
(
temp
)){
temp
=
list
;
}
return
temp
.
stream
().
mapToDouble
(
a
->
a
.
getPtdCr
().
doubleValue
()).
sum
();
}
}
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