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
e1380145
Commit
e1380145
authored
Jun 11, 2018
by
frank.xa.zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
complete api for data view---VoucherSelectAdvancedCount
parent
c62cf22c
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
477 additions
and
14 deletions
+477
-14
VoucherSelect.java
...rc/main/java/pwc/taxtech/atms/constant/VoucherSelect.java
+42
-0
VoucherLevelEnum.java
...ava/pwc/taxtech/atms/constant/enums/VoucherLevelEnum.java
+25
-0
VoucherTmplDto.java
...main/java/pwc/taxtech/atms/dto/vatdto/VoucherTmplDto.java
+143
-0
DataSourcePoolService.java
.../pwc/taxtech/atms/service/impl/DataSourcePoolService.java
+6
-0
VoucherService.java
...ain/java/pwc/taxtech/atms/vat/service/VoucherService.java
+2
-2
VoucherServiceImpl.java
...pwc/taxtech/atms/vat/service/impl/VoucherServiceImpl.java
+258
-11
applicationContext-datasource.xml
...-api/src/main/resources/applicationContext-datasource.xml
+1
-1
No files found.
atms-api/src/main/java/pwc/taxtech/atms/constant/VoucherSelect.java
0 → 100644
View file @
e1380145
package
pwc
.
taxtech
.
atms
.
constant
;
public
class
VoucherSelect
{
public
static
final
String
S_EqualAnyKey
=
"等于任意一个关键词"
;
public
static
final
String
S_AnyHeaderKey
=
"以任意一个关键词开头"
;
public
static
final
String
S_AllKey
=
"包含全部关键词"
;
public
static
final
String
S_ContainAnyKey
=
"包含任意一个关键词"
;
public
static
final
String
S_AndAll
=
"与"
;
public
static
final
String
S_OrAll
=
"或"
;
public
static
final
String
S_Manual
=
"手工凭证"
;
public
static
final
String
S_Industry
=
"企业凭证"
;
public
static
final
String
S_Equal
=
"等于"
;
public
static
final
String
S_Greater
=
"大于"
;
public
static
final
String
S_GreaterEqual
=
"大于等于"
;
public
static
final
String
S_Include
=
"包含"
;
public
static
final
String
S_JFLJ
=
"借方累计金额"
;
public
static
final
String
S_Less
=
"小于"
;
public
static
final
String
S_LessEqual
=
"小于等于"
;
public
static
final
String
S_NotEqual
=
"不等于"
;
public
static
final
String
S_NotInclude
=
"不包含"
;
public
static
final
String
S_Or
=
"或者"
;
public
static
final
String
S_And
=
"并且"
;
public
static
final
String
S_Condition
=
"条件间的关系"
;
public
static
final
String
S_CorpAcctCoding
=
"科目代码"
;
public
static
final
String
S_CorpAcctName
=
"科目名称"
;
public
static
final
String
S_Period
=
"会计期间"
;
public
static
final
String
S_VoucherType
=
"凭证类型"
;
public
static
final
String
S_VoucherVID
=
"凭证编号"
;
public
static
final
String
S_VoucherSummary
=
"摘要关键字"
;
public
static
final
String
S_CustomerCode
=
"往来核算代码"
;
public
static
final
String
S_CustomerName
=
"往来核算名称"
;
public
static
final
String
S_Date
=
"凭证日期"
;
public
static
final
String
S_Debit
=
"借方金额"
;
public
static
final
String
S_Credit
=
"贷方金额"
;
public
static
final
String
S_Source
=
"凭证来源"
;
public
static
final
String
S_AllJe
=
"显示全部凭证"
;
public
static
final
String
S_DAcctCode
=
"借方科目代码"
;
public
static
final
String
S_CAcctCode
=
"贷方科目代码"
;
public
static
final
String
S_VSummary
=
"摘要包含"
;
public
static
final
String
S_TaxType
=
"税种"
;
public
static
final
String
S_NegativeNum
=
"是否包含借方红字或贷方红字"
;
}
atms-api/src/main/java/pwc/taxtech/atms/constant/enums/VoucherLevelEnum.java
0 → 100644
View file @
e1380145
package
pwc
.
taxtech
.
atms
.
constant
.
enums
;
public
enum
VoucherLevelEnum
{
FirstSort
(
1
,
"运算字符查询"
),
SecondSort
(
2
,
"like字段查询"
),
ThirdSort
(
3
,
"IsNull查询"
);
private
int
code
;
private
String
description
;
VoucherLevelEnum
(
int
code
,
String
description
)
{
this
.
code
=
code
;
this
.
description
=
description
;
}
public
int
getCode
()
{
return
code
;
}
public
String
getDescription
()
{
return
description
;
}
}
atms-api/src/main/java/pwc/taxtech/atms/dto/vatdto/VoucherTmplDto.java
0 → 100644
View file @
e1380145
package
pwc
.
taxtech
.
atms
.
dto
.
vatdto
;
import
pwc.taxtech.atms.constant.enums.VoucherSearchEnum
;
import
java.util.List
;
public
class
VoucherTmplDto
{
private
String
columnName
;
private
String
columnText
;
private
String
lkh
;
private
VoucherSearchEnum
logic
;
private
String
relation
;
private
String
rkh
;
private
int
row
;
private
int
sort
;
private
String
sql
;
private
List
<
String
>
sqlList
;
private
int
tmplCode
;
private
int
tmplId
;
private
String
tmplName
;
private
int
type
;
private
String
value
;
public
String
getColumnName
()
{
return
columnName
;
}
public
void
setColumnName
(
String
columnName
)
{
this
.
columnName
=
columnName
;
}
public
String
getColumnText
()
{
return
columnText
;
}
public
void
setColumnText
(
String
columnText
)
{
this
.
columnText
=
columnText
;
}
public
String
getLkh
()
{
return
lkh
;
}
public
void
setLkh
(
String
lkh
)
{
this
.
lkh
=
lkh
;
}
public
VoucherSearchEnum
getLogic
()
{
return
logic
;
}
public
void
setLogic
(
VoucherSearchEnum
logic
)
{
this
.
logic
=
logic
;
}
public
String
getRelation
()
{
return
relation
;
}
public
void
setRelation
(
String
relation
)
{
this
.
relation
=
relation
;
}
public
String
getRkh
()
{
return
rkh
;
}
public
void
setRkh
(
String
rkh
)
{
this
.
rkh
=
rkh
;
}
public
int
getRow
()
{
return
row
;
}
public
void
setRow
(
int
row
)
{
this
.
row
=
row
;
}
public
int
getSort
()
{
return
sort
;
}
public
void
setSort
(
int
sort
)
{
this
.
sort
=
sort
;
}
public
String
getSql
()
{
return
sql
;
}
public
void
setSql
(
String
sql
)
{
this
.
sql
=
sql
;
}
public
List
<
String
>
getSqlList
()
{
return
sqlList
;
}
public
void
setSqlList
(
List
<
String
>
sqlList
)
{
this
.
sqlList
=
sqlList
;
}
public
int
getTmplCode
()
{
return
tmplCode
;
}
public
void
setTmplCode
(
int
tmplCode
)
{
this
.
tmplCode
=
tmplCode
;
}
public
int
getTmplId
()
{
return
tmplId
;
}
public
void
setTmplId
(
int
tmplId
)
{
this
.
tmplId
=
tmplId
;
}
public
String
getTmplName
()
{
return
tmplName
;
}
public
void
setTmplName
(
String
tmplName
)
{
this
.
tmplName
=
tmplName
;
}
public
int
getType
()
{
return
type
;
}
public
void
setType
(
int
type
)
{
this
.
type
=
type
;
}
public
String
getValue
()
{
return
value
;
}
public
void
setValue
(
String
value
)
{
this
.
value
=
value
;
}
}
atms-api/src/main/java/pwc/taxtech/atms/service/impl/DataSourcePoolService.java
View file @
e1380145
...
...
@@ -13,6 +13,7 @@ import org.springframework.beans.factory.annotation.Qualifier;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.core.io.support.PathMatchingResourcePatternResolver
;
import
org.springframework.jdbc.core.JdbcTemplate
;
import
org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource
;
import
org.springframework.stereotype.Service
;
import
pwc.taxtech.atms.common.datasource.DataSourceConfig
;
...
...
@@ -95,4 +96,9 @@ public class DataSourcePoolService extends AbstractRoutingDataSource {
return
new
SqlSessionTemplate
(
sqlSessionFactory
);
}
@Bean
public
JdbcTemplate
dynamicJdbcTemplate
(
@Qualifier
(
"DynamicDataSource"
)
DataSource
dynamicDataSource
)
{
return
new
JdbcTemplate
(
dynamicDataSource
);
}
}
atms-api/src/main/java/pwc/taxtech/atms/vat/service/VoucherService.java
View file @
e1380145
...
...
@@ -16,7 +16,7 @@ public interface VoucherService {
* @param pagingInfo 分页信息
* @return 分录信息
*/
OperationResultDto
<
Object
>
V
oucherSelectAdvancedByEntry
(
List
<
QueryConditionDto
>
listQueryCondition
,
VoucherSearchEnum
mainRelation
,
boolean
allJe
,
PagingDto
pagingInfo
);
OperationResultDto
<
Object
>
v
oucherSelectAdvancedByEntry
(
List
<
QueryConditionDto
>
listQueryCondition
,
VoucherSearchEnum
mainRelation
,
boolean
allJe
,
PagingDto
pagingInfo
);
/**
* 根据满足查询条件返回总数
...
...
@@ -26,5 +26,5 @@ public interface VoucherService {
* @param allJe 显示全部凭证
* @return 满足条件的总条数
*/
OperationResultDto
<
Object
>
VoucherSelectAdvancedCount
(
List
<
QueryConditionDto
>
listQueryCondition
,
VoucherSearchEnum
mainRelation
,
boolean
isEntryShow
,
boolean
allJe
)
;
OperationResultDto
<
Object
>
voucherSelectAdvancedCount
(
List
<
QueryConditionDto
>
listQueryCondition
,
VoucherSearchEnum
mainRelation
,
boolean
isEntryShow
,
boolean
allJe
)
throws
Exception
;
}
atms-api/src/main/java/pwc/taxtech/atms/vat/service/impl/VoucherServiceImpl.java
View file @
e1380145
package
pwc
.
taxtech
.
atms
.
vat
.
service
.
impl
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.jdbc.core.JdbcTemplate
;
import
org.springframework.stereotype.Service
;
import
pwc.taxtech.atms.constant.VoucherSelect
;
import
pwc.taxtech.atms.constant.enums.VoucherLevelEnum
;
import
pwc.taxtech.atms.constant.enums.VoucherSearchEnum
;
import
pwc.taxtech.atms.dto.OperationResultDto
;
import
pwc.taxtech.atms.dto.PagingDto
;
import
pwc.taxtech.atms.dto.vatdto.QueryConditionDto
;
import
pwc.taxtech.atms.dto.vatdto.VoucherTmplDto
;
import
pwc.taxtech.atms.vat.service.VoucherService
;
import
java.util.List
;
import
javax.annotation.Resource
;
import
java.util.*
;
import
java.util.stream.Collectors
;
@Service
public
class
VoucherServiceImpl
extends
VatAbstractService
implements
VoucherService
{
@Resource
(
name
=
"dynamicJdbcTemplate"
)
JdbcTemplate
jdbcTemplate
;
@Override
public
OperationResultDto
<
Object
>
V
oucherSelectAdvancedByEntry
(
List
<
QueryConditionDto
>
listQueryCondition
,
VoucherSearchEnum
mainRelation
,
boolean
allJe
,
PagingDto
pagingInfo
)
{
public
OperationResultDto
<
Object
>
v
oucherSelectAdvancedByEntry
(
List
<
QueryConditionDto
>
listQueryCondition
,
VoucherSearchEnum
mainRelation
,
boolean
allJe
,
PagingDto
pagingInfo
)
{
return
null
;
}
@Override
public
OperationResultDto
<
Object
>
VoucherSelectAdvancedCount
(
List
<
QueryConditionDto
>
listQueryCondition
,
VoucherSearchEnum
mainRelation
,
boolean
isEntryShow
,
boolean
allJe
)
{
public
OperationResultDto
<
Object
>
voucherSelectAdvancedCount
(
List
<
QueryConditionDto
>
listQueryCondition
,
VoucherSearchEnum
mainRelation
,
boolean
isEntryShow
,
boolean
allJe
)
throws
Exception
{
OperationResultDto
<
Object
>
result
=
new
OperationResultDto
<>();
String
exceptionString
=
""
;
String
Buffer
exceptionString
=
new
StringBuffer
(
""
)
;
String
sqlWhere
=
getSqlWhereCondition
(
listQueryCondition
,
mainRelation
,
allJe
,
exceptionString
);
if
(
StringUtils
.
isNotBlank
(
exceptionString
))
{
result
.
setResult
(
false
);
result
.
setResultMsg
(
exceptionString
);
result
.
setResultMsg
(
exceptionString
.
toString
()
);
return
result
;
}
...
...
@@ -33,20 +42,258 @@ public class VoucherServiceImpl extends VatAbstractService implements VoucherSer
if
(
isEntryShow
)
{
if
(
allJe
)
{
sql
=
"select count(1) as TotalCount from"
+
" (select distinct
[Period],[Group],[VID]
from"
+
" (select
[Period],[Group],[VID]
from Voucher "
+
sqlWhere
+
")TB)abc"
+
" left join Voucher c on abc.
[Period]=c.[Period] and abc.[Group]=c.[Group] and abc.[VID]=c.[VID]
"
;
" (select distinct
Period,`Group`,VID
from"
+
" (select
Period,`Group`,VID
from Voucher "
+
sqlWhere
+
")TB)abc"
+
" left join Voucher c on abc.
Period=c.Period and abc.`Group`=c.`Group` and abc.VID=c.VID
"
;
}
else
{
sql
=
"select count(1) as TotalCount from Voucher "
+
sqlWhere
;
}
}
else
{
sql
=
"Select count(1) as TotalCount from (select
[Period],[Group],[VID] from Voucher "
+
sqlWhere
+
" group by [Period],[Group],[VID]
)TB"
;
sql
=
"Select count(1) as TotalCount from (select
Period,`Group`,VID from Voucher "
+
sqlWhere
+
" group by Period,`Group`,VID
)TB"
;
}
int
total
=
jdbcTemplate
.
queryForObject
(
sql
,
int
.
class
);
result
.
setResult
(
true
);
result
.
setData
(
total
);
return
null
;
}
private
String
getSqlWhereCondition
(
List
<
QueryConditionDto
>
listQueryCondition
,
VoucherSearchEnum
mainRelation
,
boolean
allJe
,
String
exceptionString
)
{
return
""
;
private
String
getSqlWhereCondition
(
List
<
QueryConditionDto
>
listQueryCondition
,
VoucherSearchEnum
mainRelation
,
boolean
allJe
,
StringBuffer
exceptionString
)
throws
Exception
{
//what does this statement used for?
exceptionString
=
new
StringBuffer
(
""
);
if
(
mainRelation
!=
VoucherSearchEnum
.
S_AndAll
&&
mainRelation
!=
VoucherSearchEnum
.
S_OrAll
)
{
throw
new
Exception
(
"条件关系定义错误"
);
}
List
<
VoucherTmplDto
>
tmpls
=
new
ArrayList
<>();
for
(
QueryConditionDto
queryConditionDto
:
listQueryCondition
)
{
switch
(
queryConditionDto
.
getConditionName
())
{
case
VoucherSelect
.
S_CorpAcctCoding
:
tmpls
.
add
(
createQueryScriptByTmplList
(
Arrays
.
asList
(
queryConditionDto
.
getSearchValue
().
split
(
" "
))
,
VoucherSearchEnum
.
values
()[
queryConditionDto
.
getSearchKeyWord
()]
,
"`AcctCode`"
,
mainRelation
,
null
));
break
;
case
VoucherSelect
.
S_CorpAcctName
:
tmpls
.
add
(
createQueryScriptByTmplList
(
Arrays
.
asList
(
queryConditionDto
.
getSearchValue
().
split
(
" "
))
,
VoucherSearchEnum
.
values
()[
queryConditionDto
.
getSearchKeyWord
()]
,
"EnterpriseAccount.`Name`"
,
mainRelation
,
null
));
break
;
case
VoucherSelect
.
S_VoucherType
:
tmpls
.
add
(
createQueryScriptByTmplList
(
Arrays
.
asList
(
queryConditionDto
.
getSearchValue
().
split
(
" "
))
,
VoucherSearchEnum
.
values
()[
queryConditionDto
.
getSearchKeyWord
()]
,
"`Group`"
,
mainRelation
,
null
));
break
;
case
VoucherSelect
.
S_VoucherVID
:
tmpls
.
add
(
createQueryScriptByTmplList
(
Arrays
.
asList
(
queryConditionDto
.
getSearchValue
().
split
(
" "
))
,
VoucherSearchEnum
.
values
()[
queryConditionDto
.
getSearchKeyWord
()]
,
"`VID`"
,
mainRelation
,
null
));
break
;
case
VoucherSelect
.
S_VoucherSummary
:
tmpls
.
add
(
createQueryScriptByTmplList
(
Arrays
.
asList
(
queryConditionDto
.
getSearchValue
().
split
(
" "
))
,
VoucherSearchEnum
.
values
()[
queryConditionDto
.
getSearchKeyWord
()]
,
"`Summary`"
,
mainRelation
,
null
));
break
;
case
VoucherSelect
.
S_Period
:
tmpls
.
add
(
createQueryScriptByTmplList
(
Arrays
.
asList
(
queryConditionDto
.
getSearchValue
().
split
(
" "
))
,
VoucherSearchEnum
.
values
()[
queryConditionDto
.
getSearchKeyWord
()]
,
"`Period`"
,
mainRelation
,
null
));
break
;
case
VoucherSelect
.
S_Debit
:
tmpls
.
add
(
createQueryScriptByTmplList
(
Arrays
.
asList
(
queryConditionDto
.
getSearchValue
().
split
(
" "
))
,
VoucherSearchEnum
.
values
()[
queryConditionDto
.
getSearchKeyWord
()]
,
"`Debit`"
,
mainRelation
,
null
));
break
;
case
VoucherSelect
.
S_Credit
:
tmpls
.
add
(
createQueryScriptByTmplList
(
Arrays
.
asList
(
queryConditionDto
.
getSearchValue
().
split
(
" "
))
,
VoucherSearchEnum
.
values
()[
queryConditionDto
.
getSearchKeyWord
()]
,
"`Credit`"
,
mainRelation
,
null
));
break
;
case
VoucherSelect
.
S_Date
:
tmpls
.
add
(
createQueryScriptByTmplList
(
Arrays
.
asList
(
queryConditionDto
.
getSearchValue
().
split
(
" "
))
,
VoucherSearchEnum
.
values
()[
queryConditionDto
.
getSearchKeyWord
()]
,
"`Date`"
,
mainRelation
,
null
));
break
;
case
VoucherSelect
.
S_CustomerCode
:
tmpls
.
add
(
createQueryScriptByTmplList
(
Arrays
.
asList
(
queryConditionDto
.
getSearchValue
().
split
(
" "
))
,
VoucherSearchEnum
.
values
()[
queryConditionDto
.
getSearchKeyWord
()]
,
"Voucher.CustomerCode"
,
mainRelation
,
null
));
break
;
case
VoucherSelect
.
S_CustomerName
:
tmpls
.
add
(
createQueryScriptByTmplList
(
Arrays
.
asList
(
queryConditionDto
.
getSearchValue
().
split
(
" "
))
,
VoucherSearchEnum
.
values
()[
queryConditionDto
.
getSearchKeyWord
()]
,
"Voucher.CustomerName"
,
mainRelation
,
null
));
break
;
default
:
throw
new
Exception
(
"未处理的条件类型:"
+
queryConditionDto
.
getConditionName
());
}
}
tmpls
.
forEach
(
p
->
{
if
(
StringUtils
.
isBlank
(
p
.
getSql
()))
{
tmpls
.
remove
(
p
);
}
});
return
getSqlWhereCondition
(
tmpls
);
}
private
VoucherTmplDto
createQueryScriptByTmplList
(
List
<
String
>
strList
,
VoucherSearchEnum
relation
,
String
columnName
,
VoucherSearchEnum
logic
,
String
strValue
)
throws
Exception
{
VoucherTmplDto
temp
=
new
VoucherTmplDto
();
temp
.
setLogic
(
logic
);
StringBuffer
sb
=
new
StringBuffer
();
sb
.
append
(
"("
);
int
count
=
strList
.
size
();
switch
(
relation
)
{
case
S_EqualAnyKey:
for
(
int
i
=
0
;
i
<
count
;
i
++)
{
sb
.
append
(
columnName
+
"=`"
+
strList
.
get
(
i
)
+
"`"
+
(
i
<
(
count
-
1
)
?
" or "
:
")"
));
}
temp
.
setSort
(
VoucherLevelEnum
.
FirstSort
.
getCode
());
break
;
case
S_AnyHeaderKey:
for
(
int
i
=
0
;
i
<
count
;
i
++)
{
sb
.
append
(
columnName
+
"=`"
+
strList
.
get
(
i
)
+
"`"
+
(
i
<
(
count
-
1
)
?
" or "
:
")"
));
}
temp
.
setSort
(
VoucherLevelEnum
.
SecondSort
.
getCode
());
break
;
case
S_AllKey:
for
(
int
i
=
0
;
i
<
count
;
i
++)
{
sb
.
append
(
columnName
+
"like'"
+
strList
.
get
(
i
)
+
"'"
+
(
i
<
(
count
-
1
)
?
" and "
:
")"
));
}
temp
.
setSort
(
VoucherLevelEnum
.
SecondSort
.
getCode
());
break
;
case
S_ContainAnyKey:
for
(
int
i
=
0
;
i
<
count
;
i
++)
{
sb
.
append
(
columnName
+
"like'"
+
strList
.
get
(
i
)
+
"'"
+
(
i
<
(
count
-
1
)
?
" or "
:
")"
));
}
temp
.
setSort
(
VoucherLevelEnum
.
SecondSort
.
getCode
());
break
;
case
S_Equal:
sb
.
append
(
columnName
+
" ='"
+
strValue
+
"'"
);
temp
.
setSort
(
VoucherLevelEnum
.
FirstSort
.
getCode
());
break
;
case
S_Greater:
sb
.
append
(
columnName
+
" >'"
+
strValue
+
"'"
);
temp
.
setSort
(
VoucherLevelEnum
.
FirstSort
.
getCode
());
break
;
case
S_GreaterEqual:
sb
.
append
(
columnName
+
" >='"
+
strValue
+
"'"
);
temp
.
setSort
(
VoucherLevelEnum
.
FirstSort
.
getCode
());
break
;
case
S_Less:
//小于
sb
.
append
(
columnName
+
"< '"
+
strValue
+
"')"
);
temp
.
setSort
(
VoucherLevelEnum
.
FirstSort
.
getCode
());
break
;
case
S_LessEqual:
//小于等于
sb
.
append
(
columnName
+
"<= '"
+
strValue
+
"')"
);
temp
.
setSort
(
VoucherLevelEnum
.
FirstSort
.
getCode
());
break
;
case
S_Manual:
sb
.
append
(
columnName
+
"=1"
);
temp
.
setSort
(
VoucherLevelEnum
.
FirstSort
.
getCode
());
break
;
case
S_Industry:
sb
.
append
(
columnName
+
" is null"
);
temp
.
setSort
(
VoucherLevelEnum
.
ThirdSort
.
getCode
());
break
;
case
S_FromTo:
if
(
strList
.
size
()
!=
2
)
{
throw
new
Exception
(
"数据格式错误"
);
}
if
(!
strList
.
get
(
0
).
toLowerCase
().
equals
(
"null"
)
&&
!
strList
.
get
(
1
).
toLowerCase
().
equals
(
"null"
))
{
if
(
columnName
.
equals
(
"`Debit`"
)
||
columnName
.
equals
(
"`Credit`"
))
{
sb
.
append
(
columnName
+
">="
+
Double
.
valueOf
(
strList
.
get
(
0
))
+
" And "
+
columnName
+
" <="
+
Double
.
valueOf
(
strList
.
get
(
1
))
+
")"
);
}
else
{
sb
.
append
(
columnName
+
">='"
+
strList
.
get
(
0
)
+
"' And "
+
columnName
+
" <= '"
+
strList
.
get
(
1
)
+
"')"
);
}
}
else
if
(
strList
.
get
(
0
).
toLowerCase
().
equals
(
"null"
)
&&
strList
.
get
(
1
).
toLowerCase
().
equals
(
"null"
))
{
break
;
}
else
if
(!
strList
.
get
(
0
).
toLowerCase
().
equals
(
"null"
)
&&
strList
.
get
(
1
).
toLowerCase
().
equals
(
"null"
))
{
if
(
columnName
.
equals
(
"`Debit`"
)
||
columnName
.
equals
(
"`Credit`"
))
{
sb
.
append
(
columnName
+
">="
+
Double
.
valueOf
(
strList
.
get
(
0
))
+
")"
);
}
else
{
sb
.
append
(
columnName
+
">='"
+
strList
.
get
(
0
)
+
"')"
);
}
}
else
if
(
strList
.
get
(
0
).
toLowerCase
().
equals
(
"null"
)
&&
!
strList
.
get
(
1
).
toLowerCase
().
equals
(
"null"
))
{
if
(
columnName
.
equals
(
"`Debit`"
)
||
columnName
.
equals
(
"`Credit`"
))
{
sb
.
append
(
columnName
+
" <="
+
Double
.
valueOf
(
strList
.
get
(
1
))
+
")"
);
}
else
{
sb
.
append
(
columnName
+
" <= '"
+
strList
.
get
(
1
)
+
"')"
);
}
}
temp
.
setSort
(
VoucherLevelEnum
.
FirstSort
.
getCode
());
break
;
}
temp
.
setSql
(
sb
.
toString
());
String
acctStrs
=
""
;
if
(
columnName
.
equals
(
"EnterpriseAccount.`Name`"
))
{
acctStrs
=
"select AcctCode from EnterpriseAccount where "
+
temp
.
getSql
();
List
<
Map
<
String
,
Object
>>
result
=
jdbcTemplate
.
queryForList
(
acctStrs
);
int
num
=
result
.
size
();
if
(
num
>
0
)
{
sb
=
new
StringBuffer
();
sb
.
append
(
"("
);
for
(
int
idx
=
0
;
idx
<
num
;
idx
++)
{
Map
<
String
,
Object
>
item
=
result
.
get
(
idx
);
sb
.
append
(
"AcctCode='"
+
item
.
get
(
"AcctCode"
)
+
"'"
+
(
idx
<
(
num
-
1
)
?
" or "
:
")"
));
}
temp
.
setSort
(
VoucherLevelEnum
.
FirstSort
.
getCode
());
temp
.
setSql
(
sb
.
toString
());
}
else
{
temp
.
setSql
(
"(AcctCode is null)"
);
temp
.
setSort
(
VoucherLevelEnum
.
ThirdSort
.
getCode
());
}
}
return
temp
;
}
private
String
getSqlWhereCondition
(
List
<
VoucherTmplDto
>
tmplList
)
throws
Exception
{
List
<
VoucherTmplDto
>
smallTemp
=
tmplList
.
stream
().
sorted
(
Comparator
.
comparing
(
VoucherTmplDto:
:
getSort
).
reversed
()).
collect
(
Collectors
.
toList
());
int
count
=
1
;
int
tCount
=
smallTemp
.
size
();
StringBuilder
sqlWhere
=
new
StringBuilder
();
if
(
tCount
>
0
)
{
sqlWhere
.
append
(
" where"
);
}
for
(
VoucherTmplDto
t
:
smallTemp
)
{
String
logic
=
""
;
if
(
t
.
getLogic
().
equals
(
VoucherSearchEnum
.
S_OrAll
))
{
logic
=
" OR"
;
}
else
if
(
t
.
getLogic
().
equals
(
VoucherSearchEnum
.
S_AndAll
))
{
logic
=
" AND"
;
}
else
{
throw
new
Exception
(
"未处理的条件关系:"
+
t
.
getLogic
().
toString
());
}
sqlWhere
.
append
(
" "
).
append
(
t
.
getSql
()).
append
(
count
<
tCount
?
logic
+
" "
:
" "
);
count
++;
}
return
sqlWhere
.
toString
();
}
}
atms-api/src/main/resources/applicationContext-datasource.xml
View file @
e1380145
...
...
@@ -43,7 +43,7 @@
<!-- 配置监控统计拦截的filters -->
<property
name=
"filters"
value=
"stat"
/>
</bean>
</bean>
<bean
id=
"jdbcTemplate"
class=
"org.springframework.jdbc.core.JdbcTemplate"
>
<property
name=
"dataSource"
ref=
"dataSource"
/>
...
...
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