Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
W
windows
Project
Project
Details
Activity
Releases
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zhanhai
windows
Commits
58259cdf
Commit
58259cdf
authored
Jan 18, 2024
by
张庆
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增挡板规则
parent
13b4d91f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
146 additions
and
0 deletions
+146
-0
FaModel.java
src/main/java/com/jqtx/windows/component/model/FaModel.java
+21
-0
SyncFaJob.java
src/main/java/com/jqtx/windows/job/SyncFaJob.java
+125
-0
No files found.
src/main/java/com/jqtx/windows/component/model/FaModel.java
0 → 100644
View file @
58259cdf
package
com
.
jqtx
.
windows
.
component
.
model
;
import
lombok.Data
;
@Data
public
class
FaModel
{
private
String
loanReqNo
;
private
String
term
;
private
String
dateDue
;
private
String
totalAmt
;
private
String
prinAmt
;
private
String
intAmt
;
private
String
ointAmt
;
}
src/main/java/com/jqtx/windows/job/SyncFaJob.java
0 → 100644
View file @
58259cdf
package
com
.
jqtx
.
windows
.
job
;
import
cn.hutool.core.date.DateUtil
;
import
cn.hutool.core.io.FileUtil
;
import
cn.hutool.core.util.CharsetUtil
;
import
cn.hutool.extra.ssh.Sftp
;
import
com.jqtx.infrastructure.oss.starter.config.OssUtils
;
import
com.jqtx.windows.common.config.SftpConfig
;
import
com.jqtx.windows.common.config.snow.SnowSequenceHelper
;
import
com.jqtx.windows.component.*
;
import
com.jqtx.windows.component.enums.LoanStatusEnum
;
import
com.jqtx.windows.component.impl.BackedBurdenComponentImpl
;
import
com.jqtx.windows.component.model.*
;
import
com.jqtx.windows.infrastructure.feign.enums.DebtInfoStatusEnum
;
import
com.xxl.job.core.context.XxlJobHelper
;
import
com.xxl.job.core.handler.annotation.XxlJob
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
java.io.IOException
;
import
java.math.BigDecimal
;
import
java.time.LocalDate
;
import
java.time.LocalDateTime
;
import
java.util.ArrayList
;
import
java.util.Calendar
;
import
java.util.Date
;
import
java.util.List
;
@Component
@Slf4j
public
class
SyncFaJob
{
@Autowired
private
OssUtils
ossUtils
;
@Autowired
private
LoanPlanComponent
loanPlanComponent
;
@Autowired
private
SftpConfig
sftpConfig
;
@XxlJob
(
"SyncFaJob"
)
public
void
run
()
{
String
param
=
XxlJobHelper
.
getJobParam
();
Sftp
sftp
=
new
Sftp
(
sftpConfig
.
getSshHost
(),
sftpConfig
.
getSshPort
(),
sftpConfig
.
getSshUser
(),
sftpConfig
.
getSshPass
(),
CharsetUtil
.
CHARSET_UTF_8
);
try
{
String
date
=
""
;
if
(
StringUtils
.
isNotEmpty
(
param
))
{
date
=
param
;
}
else
{
Calendar
cal
=
Calendar
.
getInstance
();
//获取前面的时间用-负号
cal
.
setTime
(
new
Date
());
cal
.
add
(
Calendar
.
DAY_OF_MONTH
,
-
1
);
Date
time
=
cal
.
getTime
();
date
=
DateUtil
.
format
(
time
,
"yyyyMMdd"
);
}
if
(
sftp
.
isDir
(
"/download/overdue/"
+
date
))
{
sftp
.
cd
(
"/download/overdue/"
+
date
+
"/capital"
);
sftp
.
get
(
"overdue_capital"
+
date
+
".txt"
,
"overdue_capital"
+
date
+
".txt"
);
ossUtils
.
ossUpload
(
"ZN/overdue/"
+
date
+
".txt"
,
FileUtil
.
file
(
"overdue_capital"
+
date
+
".txt"
));
String
stringObject
=
getStringObject
(
"ZN/overdue/"
+
date
+
".txt"
);
log
.
info
(
"oss逾期数据:{}"
,
stringObject
);
//存储并去平账
List
<
FaModel
>
getlist
=
getlist
(
stringObject
);
for
(
FaModel
faModel
:
getlist
)
{
//查询plan
LoanPlanModel
planModel
=
loanPlanComponent
.
getPlanNoByLoan
(
faModel
.
getLoanReqNo
(),
faModel
.
getTerm
());
planModel
.
setPlanFa
(
new
BigDecimal
(
faModel
.
getOintAmt
()));
loanPlanComponent
.
updateByLoanPlanModel
(
planModel
);
}
FileUtil
.
del
(
"/assurance_sftp.txt"
);
}
else
{
log
.
info
(
"浙农逾期文件不存在:{}"
,
date
);
}
}
catch
(
Exception
e
)
{
log
.
info
(
"浙农逾期错误:{}"
,
e
.
getMessage
());
}
finally
{
//关闭sftp连接
sftp
.
close
();
}
}
public
String
getStringObject
(
String
uri
)
{
byte
[]
bytes
=
new
byte
[
0
];
try
{
bytes
=
ossUtils
.
ossDownLoad
(
uri
);
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
return
new
String
(
bytes
);
}
/**
* 组装还融担的全部model
*
* @param jsonResult
* @return
*/
private
List
<
FaModel
>
getlist
(
String
jsonResult
)
{
ArrayList
<
FaModel
>
list
=
new
ArrayList
<>();
String
[]
split
=
jsonResult
.
split
(
"\n"
);
if
(
split
==
null
)
{
return
list
;
}
for
(
String
modelstr
:
split
)
{
String
[]
split1
=
modelstr
.
split
(
"\\|"
);
FaModel
model
=
new
FaModel
();
model
.
setLoanReqNo
(
split1
[
0
]);
model
.
setTerm
(
split1
[
1
]);
model
.
setDateDue
(
split1
[
2
]);
model
.
setTotalAmt
(
split1
[
3
]);
model
.
setPrinAmt
(
split1
[
4
]);
model
.
setIntAmt
(
split1
[
5
]);
model
.
setOintAmt
(
split1
[
6
]);
list
.
add
(
model
);
}
return
list
;
}
}
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