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
732042b1
Commit
732042b1
authored
Nov 18, 2018
by
neo.wang
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev_oracle_neo' into 'dev_oracle'
Dev oracle neo See merge request root/atms!197
parents
ffcc6a16
9c9ee3e4
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
82 additions
and
54 deletions
+82
-54
MyAsserts.java
...src/main/java/pwc/taxtech/atms/common/util/MyAsserts.java
+4
-0
Exceptions.java
.../src/main/java/pwc/taxtech/atms/exception/Exceptions.java
+1
-0
FormulaAgent.java
.../java/pwc/taxtech/atms/vat/service/impl/FormulaAgent.java
+7
-18
BB.java
...wc/taxtech/atms/vat/service/impl/report/functions/BB.java
+26
-11
FormulaAdminMapper.java
...rc/main/java/pwc/taxtech/atms/dao/FormulaAdminMapper.java
+44
-25
No files found.
atms-api/src/main/java/pwc/taxtech/atms/common/util/MyAsserts.java
View file @
732042b1
...
...
@@ -38,6 +38,10 @@ public class MyAsserts {
if
(
obj
==
null
||
obj
.
isEmpty
())
throw
exception
;
}
public
static
void
assertNotEmpty
(
Collection
obj
,
FormulaException
exception
)
{
if
(
obj
==
null
||
obj
.
isEmpty
())
throw
exception
;
}
public
static
void
assertNotEmpty
(
Collection
obj
,
ApiException
exception
)
{
if
(
obj
==
null
||
obj
.
isEmpty
())
throw
exception
;
}
...
...
atms-api/src/main/java/pwc/taxtech/atms/exception/Exceptions.java
View file @
732042b1
...
...
@@ -19,4 +19,5 @@ public class Exceptions {
public
static
final
ApiException
NOT_FOUND_TEMPLATE_GROUP_EXCEPTION
=
new
NotFoundException
(
"not found template group"
);
public
static
final
ApiException
NOT_FOUND_EXCEPTION
=
new
NotFoundException
(
"not found resources"
);
public
static
final
ApiException
REPORT_IN_PROCESS_OR_AGREED_EXCEPTION
=
new
PreconditionFailedException
(
"report in approval or agreed result"
);
public
static
final
FormulaException
PROJECT_NOT_FOUND
=
new
FormulaException
(
"project not found"
);;
}
atms-api/src/main/java/pwc/taxtech/atms/vat/service/impl/FormulaAgent.java
View file @
732042b1
...
...
@@ -8,6 +8,7 @@ import pwc.taxtech.atms.dao.FormulaAdminMapper;
import
pwc.taxtech.atms.dao.ProjectServiceTypeMapper
;
import
pwc.taxtech.atms.dpo.CellTemplatePerGroupDto
;
import
pwc.taxtech.atms.dpo.GroupId
;
import
pwc.taxtech.atms.entity.Project
;
import
pwc.taxtech.atms.entity.ProjectServiceType
;
import
pwc.taxtech.atms.entity.ProjectServiceTypeExample
;
import
pwc.taxtech.atms.exception.Exceptions
;
...
...
@@ -36,24 +37,12 @@ public class FormulaAgent {
@Autowired
private
PeriodDataSourceMapper
periodDataSourceMapper
;
public
List
<
CellTemplatePerGroupDto
>
getCellTemplateGroupDto
(
Long
templateGroupId
,
String
projectId
)
{
ProjectServiceTypeExample
pst
=
new
ProjectServiceTypeExample
();
pst
.
createCriteria
().
andTemplateGroupIdEqualTo
(
Long
.
valueOf
(
templateGroupId
))
.
andServiceTypeIdEqualTo
(
EnumServiceType
.
VAT
.
getCode
()
+
""
);
List
<
ProjectServiceType
>
pstReult
=
projectServiceTypeMapper
.
selectByExample
(
pst
);
List
<
CellTemplatePerGroupDto
>
cellTemplates
=
adminMp
.
getCellTemplatePerGroupDto
(
templateGroupId
);
if
(
pstReult
==
null
||
pstReult
.
isEmpty
())
{
List
<
GroupId
>
groupIds
=
adminMp
.
getTemplateGroupId
(
projectId
);
GroupId
groupId
;
if
(
groupIds
.
size
()
>
0
)
{
groupId
=
groupIds
.
stream
().
filter
(
m
->
m
.
isDefault
!=
1
).
findFirst
().
get
();
if
(
groupId
==
null
)
groupId
=
groupIds
.
get
(
0
);
cellTemplates
.
addAll
(
adminMp
.
getCellTemplatePerGroupDto
(
groupId
.
groupId
));
}
}
return
cellTemplates
;
public
List
<
CellTemplatePerGroupDto
>
getCellTemplateGroupDto
(
Long
templateGroupId
,
String
projectId
,
String
code
,
Integer
rowIndex
,
Integer
columnIndex
,
Integer
period
)
{
return
adminMp
.
getCellTemplatePerGroupDto
(
templateGroupId
,
code
,
rowIndex
,
columnIndex
,
projectId
,
period
);
}
public
Project
getFixedProject
(
String
projectId
,
Integer
year
)
{
return
adminMp
.
getFixedProject
(
projectId
,
year
);
}
public
List
<
PeriodDataSource
>
queryManualDataSource
(
Long
templateId
,
String
projectId
,
Integer
period
){
...
...
atms-api/src/main/java/pwc/taxtech/atms/vat/service/impl/report/functions/BB.java
View file @
732042b1
...
...
@@ -12,6 +12,7 @@ import pwc.taxtech.atms.dpo.CellTemplatePerGroupDto;
import
pwc.taxtech.atms.dto.vatdto.BBParasBo
;
import
pwc.taxtech.atms.dto.vatdto.CurrentPeriodBo
;
import
pwc.taxtech.atms.dto.vatdto.ReportCellDataSourceDto
;
import
pwc.taxtech.atms.entity.Project
;
import
pwc.taxtech.atms.exception.Exceptions
;
import
pwc.taxtech.atms.exception.FormulaException
;
import
pwc.taxtech.atms.vat.entity.PeriodCellData
;
...
...
@@ -60,14 +61,18 @@ public class BB extends FunctionBase implements FreeRefFunction {
BigDecimal
cellValue
=
BigDecimal
.
ZERO
;
try
{
CellTemplatePerGroupDto
cellTemplateData
=
agent
.
getCellTemplateGroupDto
(
formulaContext
.
getReportTemplateGroupId
(),
formulaContext
.
getProjectId
()).
stream
().
filter
(
dto
->
dto
.
getRowIndex
()
==
bo
.
getRowIndex
()
-
1
&&
dto
.
getColumnIndex
()
==
bo
.
getColumnIndex
()
-
1
&&
dto
.
getReportCode
().
equals
(
bo
.
getReportCode
()))
.
findFirst
().
orElseThrow
(()
->
{
return
Exceptions
.
BB_CELL_TEMP_NULL
;
});
MyAsserts
.
assertNotNull
(
cellTemplateData
,
Exceptions
.
BB_CELL_TEMP_NULL
);
List
<
CellTemplatePerGroupDto
>
cellTemplateDataList
;
if
(
curPeriod
.
getCurYear
()
!=
formulaContext
.
getYear
())
{
Project
project
=
agent
.
getFixedProject
(
formulaContext
.
getProjectId
(),
curPeriod
.
getCurYear
());
MyAsserts
.
assertNotNull
(
project
,
Exceptions
.
PROJECT_NOT_FOUND
);
cellTemplateDataList
=
agent
.
getCellTemplateGroupDto
(
formulaContext
.
getReportTemplateGroupId
(),
project
.
getId
(),
bo
.
getReportCode
(),
bo
.
getRowIndex
()
-
1
,
bo
.
getColumnIndex
()
-
1
,
curPeriod
.
getCurPeriod
());
}
else
{
cellTemplateDataList
=
agent
.
getCellTemplateGroupDto
(
formulaContext
.
getReportTemplateGroupId
(),
formulaContext
.
getProjectId
(),
bo
.
getReportCode
(),
bo
.
getRowIndex
()
-
1
,
bo
.
getColumnIndex
()
-
1
,
curPeriod
.
getCurPeriod
());
}
MyAsserts
.
assertNotEmpty
(
cellTemplateDataList
,
Exceptions
.
BB_CELL_TEMP_NULL
);
CellTemplatePerGroupDto
cellTemplateData
=
cellTemplateDataList
.
get
(
0
);
nullCellDto
.
fixedWithGroup
(
cellTemplateData
);
// todo: fix datasource name by templateList(neo)
...
...
@@ -109,9 +114,19 @@ public class BB extends FunctionBase implements FreeRefFunction {
((
ErrorEval
)
eval
).
getErrorCode
(),
((
ErrorEval
)
eval
).
getErrorString
());
if
(!
dss
.
isEmpty
())
cellValue
=
dss
.
get
(
0
).
getAmount
();
}
else
{
cellValue
=
new
BigDecimal
(
OperandResolver
.
coerceValueToDouble
(
eval
));
if
(!
dss
.
isEmpty
())
cellValue
=
cellValue
.
add
(
dss
.
get
(
0
).
getAmount
());
String
evalStr
=
OperandResolver
.
coerceValueToString
(
eval
);
logger
.
debug
(
"[BB_debug] eval other cell value {}"
,
evalStr
);
try
{
cellValue
=
new
BigDecimal
(
evalStr
).
setScale
(
4
,
BigDecimal
.
ROUND_HALF_DOWN
);
if
(!
dss
.
isEmpty
())
cellValue
=
cellValue
.
add
(
dss
.
get
(
0
).
getAmount
());
}
catch
(
Exception
e
)
{
if
(!
dss
.
isEmpty
())
cellValue
=
dss
.
get
(
0
).
getAmount
();
else
throw
e
;
}
}
nullCellDto
.
extractFromGroup
(
bo
,
formulaContext
.
getPeriod
(),
formulaContext
.
getYear
(),
cellTemplateData
);
...
...
atms-dao/src/main/java/pwc/taxtech/atms/dao/FormulaAdminMapper.java
View file @
732042b1
...
...
@@ -6,37 +6,43 @@ import org.apache.ibatis.annotations.Select;
import
pwc.taxtech.atms.MyMapper
;
import
pwc.taxtech.atms.dpo.CellTemplatePerGroupDto
;
import
pwc.taxtech.atms.dpo.GroupId
;
import
pwc.taxtech.atms.entity.Project
;
import
java.util.List
;
@Mapper
public
interface
FormulaAdminMapper
extends
MyMapper
{
@Select
(
"SELECT "
+
" cell_template.id AS cellTemplateID, "
+
" template.id AS reportTemplateID, "
+
" template.template_group_id AS reportTemplateGroupID, "
+
" cell_template.row_index AS rowIndex, "
+
" cell_template.column_index AS columnIndex, "
+
" template.Code AS reportCode, "
+
" cell_template.column_name AS columnName, "
+
" cell_template.row_name AS rowName, "
+
" cell_template.data_type AS resultType "
+
"FROM "
+
" template "
+
" JOIN "
+
" cell_template ON template.id = cell_template.report_template_id "
+
"WHERE "
+
" template.id IN ( "
+
" SELECT "
+
" ID "
+
" FROM "
+
" TEMPLATE "
+
" WHERE "
+
" TEMPLATE_GROUP_ID = #{groupId} "
+
" AND IS_ACTIVE_ASSOCIATION = 1 "
+
" )"
)
List
<
CellTemplatePerGroupDto
>
getCellTemplatePerGroupDto
(
@Param
(
"groupId"
)
Long
groupId
);
@Select
(
""
+
"SELECT "
+
" cell_template.CELL_TEMPLATE_ID AS cellTemplateID, "
+
" template.TEMPLATE_ID AS reportTemplateID, "
+
" template.template_group_id AS reportTemplateGroupID, "
+
" cell_template.row_index AS rowIndex, "
+
" cell_template.column_index AS columnIndex, "
+
" template.Code AS reportCode, "
+
" cell_template.column_name AS columnName, "
+
" cell_template.row_name AS rowName, "
+
" cell_template.data_type AS resultType "
+
"FROM "
+
" period_template template "
+
" JOIN period_cell_template cell_template ON template.TEMPLATE_ID = cell_template.report_template_id "
+
"WHERE "
+
" template.TEMPLATE_ID IN ( SELECT TEMPLATE_ID FROM period_template WHERE TEMPLATE_GROUP_ID = #{templateGroupId} "
+
" AND IS_ACTIVE_ASSOCIATION = 1 AND CODE = #{code} ) "
+
" AND ROW_INDEX = #{rowIndex} "
+
" AND COLUMN_INDEX = #{columnIndex} "
+
" AND template.PROJECT_ID = #{projectId} "
+
" AND template.PERIOD = #{period} "
+
" AND cell_template.PROJECT_ID = #{projectId} "
+
" AND cell_template.PERIOD = #{period}"
+
""
)
List
<
CellTemplatePerGroupDto
>
getCellTemplatePerGroupDto
(
@Param
(
"templateGroupId"
)
Long
templateGroupId
,
@Param
(
"code"
)
String
code
,
@Param
(
"rowIndex"
)
Integer
rowIndex
,
@Param
(
"columnIndex"
)
Integer
columnIndex
,
@Param
(
"projectId"
)
String
projectId
,
@Param
(
"period"
)
Integer
period
);
@Select
(
"SELECT "
+
...
...
@@ -64,4 +70,17 @@ public interface FormulaAdminMapper extends MyMapper {
" AND ROWNUM=1"
+
"ORDER BY ps.Service_Type_ID "
)
String
getPastProjectId
(
@Param
(
"year"
)
int
year
,
@Param
(
"orgId"
)
String
organizationId
);
@Select
(
""
+
"SELECT "
+
" p.ID AS id, "
+
" p.CODE AS code, "
+
" p.NAME AS name, "
+
" p.ORGANIZATION_ID AS organizationId "
+
"FROM "
+
" PROJECT p "
+
" JOIN ( SELECT CODE, ORGANIZATION_ID FROM PROJECT WHERE ID = #{projectId} ) t ON p.CODE = t.CODE "
+
" AND p.ORGANIZATION_ID = t.ORGANIZATION_ID AND p.YEAR = #{year}"
+
""
)
Project
getFixedProject
(
@Param
(
"projectId"
)
String
projectId
,
@Param
(
"year"
)
Integer
year
);
}
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