Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
D
datasync-service
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
位宇华
datasync-service
Commits
21c6c7c3
Commit
21c6c7c3
authored
Dec 10, 2024
by
gaopengxuan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
现金流量表添加标识字段
parent
aeb1aea9
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
4 deletions
+28
-4
src/main/java/com/tianyi/sync/model/CashFlowModel.java
src/main/java/com/tianyi/sync/model/CashFlowModel.java
+10
-0
src/main/java/com/tianyi/sync/service/impl/CashFlowServiceImpl.java
...ava/com/tianyi/sync/service/impl/CashFlowServiceImpl.java
+16
-2
src/main/resources/mapper/FallSlaveMapper.xml
src/main/resources/mapper/FallSlaveMapper.xml
+2
-2
No files found.
src/main/java/com/tianyi/sync/model/CashFlowModel.java
View file @
21c6c7c3
...
...
@@ -27,6 +27,8 @@ public class CashFlowModel implements Serializable {
private
String
icpname
;
private
String
cashflow
;
public
String
getPeriod
()
{
return
period
;
}
...
...
@@ -114,4 +116,12 @@ public class CashFlowModel implements Serializable {
public
void
setIcpname
(
String
icpname
)
{
this
.
icpname
=
icpname
;
}
public
String
getCashflow
()
{
return
cashflow
;
}
public
void
setCashflow
(
String
cashflowflag
)
{
this
.
cashflow
=
cashflowflag
;
}
}
src/main/java/com/tianyi/sync/service/impl/CashFlowServiceImpl.java
View file @
21c6c7c3
...
...
@@ -38,23 +38,37 @@ public class CashFlowServiceImpl implements CashFlowService {
StopWatch
stopWatch
=
new
StopWatch
();
stopWatch
.
start
();
String
period
=
DateUtils
.
getYearAndMonthLast
();
//String period="2024-
10
";
//String period="2024-
08
";
List
<
String
>
stringList
=
fallSlaveMapper
.
getCodeList
().
stream
().
map
(
v
->
v
.
replaceAll
(
"[a-zA-Z]"
,
StringUtils
.
EMPTY
)).
collect
(
Collectors
.
toList
());
List
<
CashFlowModel
>
cashFlowModels
=
new
ArrayList
<>();
stringList
.
forEach
(
v
->{
List
<
CashFlowModel
>
cashFlowModelList
=
cashFlowMapper
.
getCashFlowInfo
(
period
,
v
);
for
(
CashFlowModel
model
:
cashFlowModelList
)
{
String
originalMonth
=
model
.
getPeriod
();
// 获取月份,例如"2024-10"
String
accountName
=
model
.
getItemname
();
if
(
originalMonth
!=
null
&&
originalMonth
.
contains
(
"-"
))
{
// 替换 "-" 为 "",得到 "202410"
String
formattedMonth
=
originalMonth
.
replace
(
"-"
,
""
);
model
.
setPeriod
(
formattedMonth
);
// 设置转换后的月份
}
// 判断 accountName 的最后四个字符,根据条件设置 itemType
if
(
accountName
!=
null
&&
accountName
.
length
()
>=
4
)
{
String
cashflowChars
=
accountName
.
substring
(
accountName
.
length
()
-
4
);
// 获取最后四个字符
if
(
"票据结算"
.
equals
(
cashflowChars
))
{
model
.
setCashflow
(
"02"
);
// 设置为 '02'
}
else
if
(
"内部结算"
.
equals
(
cashflowChars
))
{
model
.
setCashflow
(
"03"
);
// 设置为 '03'
}
else
{
model
.
setCashflow
(
"01"
);
// 默认设置为 '01'
}
}
}
cashFlowModels
.
addAll
(
cashFlowModelList
);
});
String
yearm
=
period
.
replace
(
"-"
,
""
);
if
(!
CollectionUtils
.
isEmpty
(
cashFlowModels
)){
fallSlaveMapper
.
deleteCashFlow
(
period
);
fallSlaveMapper
.
deleteCashFlow
(
yearm
);
fallSlaveMapper
.
save
(
cashFlowModels
);
}
stopWatch
.
stop
();
...
...
src/main/resources/mapper/FallSlaveMapper.xml
View file @
21c6c7c3
...
...
@@ -28,10 +28,10 @@
</select>
<insert
id=
"save"
>
INSERT INTO
elimtable.free_query_cashflow(yearm,accbook,voucher,direction,money,itemcode,itemname,entityname,entitycode,icpcode,icpname)
elimtable.free_query_cashflow(yearm,accbook,voucher,direction,money,itemcode,itemname,entityname,entitycode,icpcode,icpname
,cashflow
)
values
<foreach
collection=
"cashFlowModels"
index=
"index"
item=
"item"
separator=
","
>
(#{item.period},#{item.entitycode},#{item.voucher},#{item.direction},#{item.money},#{item.itemcode},#{item.itemname},#{item.entityname},#{item.entitycode},#{item.icpcode},#{item.icpname})
(#{item.period},#{item.entitycode},#{item.voucher},#{item.direction},#{item.money},#{item.itemcode},#{item.itemname},#{item.entityname},#{item.entitycode},#{item.icpcode},#{item.icpname}
,#{item.cashflow}
)
</foreach>
</insert>
...
...
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