Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
finance-api
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Data-王博
finance-api
Commits
18f0805c
Commit
18f0805c
authored
Jun 04, 2017
by
Data-王博
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复重复推送 第一次数据错误问题,回盘文件空行问题
parent
05575964
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
74 additions
and
33 deletions
+74
-33
ApiCommonController.java
.../quantgroup/financial/controller/ApiCommonController.java
+16
-20
PaymentDaoImpl.java
...java/cn/quantgroup/financial/dao/impl/PaymentDaoImpl.java
+2
-7
PaymentDetailMapper.java
...a/cn/quantgroup/financial/mapper/PaymentDetailMapper.java
+1
-0
RepaymentPlanDetailMapper.java
...uantgroup/financial/mapper/RepaymentPlanDetailMapper.java
+1
-0
PaymentDetail.java
...ain/java/cn/quantgroup/financial/model/PaymentDetail.java
+1
-1
RepaymentPlanDetail.java
...va/cn/quantgroup/financial/model/RepaymentPlanDetail.java
+5
-5
PaymentDetailMapper.xml
src/main/resources/mapper/PaymentDetailMapper.xml
+21
-0
RepaymentPlanDetailMapper.xml
src/main/resources/mapper/RepaymentPlanDetailMapper.xml
+17
-0
TestJson.java
src/test/java/cn/quantgroup/financial/json/TestJson.java
+10
-0
No files found.
src/main/java/cn/quantgroup/financial/controller/ApiCommonController.java
View file @
18f0805c
...
...
@@ -99,32 +99,28 @@ public class ApiCommonController {
}
@RequestMapping
(
value
=
"/repayment/repairData"
,
method
=
{
RequestMethod
.
POST
,
RequestMethod
.
GET
})
public
@ResponseBody
JsonResult
repairOldData
(){
List
<
Long
>
list
=
new
ArrayList
<>(
Arrays
.
asList
());
for
(
Long
loanId:
list
){
public
@ResponseBody
JsonResult
repairOldData
(
@RequestBody
List
<
Long
>
loanIdList
){
for
(
Long
loanId:
loanIdList
){
try
{
logger
.
info
(
"repairOldData loanId={}"
,
loanId
);
PaymentDetail
paymentDetailOld
=
paymentDetailMapper
.
getByLoanHistoryId
(
loanId
);
if
(
paymentDetailOld
==
null
){
iApiCommonService
.
queryData
(
loanId
,
null
);
}
iApiCommonService
.
queryData
(
loanId
,
null
);
}
catch
(
Exception
e
)
{
logger
.
error
(
e
.
getMessage
(),
e
);
}
}
Date
date
=
new
Date
();
Calendar
calendar
=
Calendar
.
getInstance
();
calendar
.
set
(
Calendar
.
DAY_OF_MONTH
,
27
);
calendar
.
set
(
Calendar
.
MONTH
,
0
);
calendar
.
set
(
Calendar
.
HOUR_OF_DAY
,
0
);
calendar
.
set
(
Calendar
.
MINUTE
,
0
);
calendar
.
set
(
Calendar
.
SECOND
,
0
);
calendar
.
set
(
Calendar
.
MILLISECOND
,
0
);
logger
.
info
(
"update time={} "
+
calendar
.
getTime
());
Integer
row
=
iApiCommonService
.
updateBatchStatus
(
calendar
.
getTime
(),
CompensationStatus
.
already_status
.
get
());
logger
.
info
(
"repairOldData update row={}"
,
row
);
return
JsonResult
.
SUCCESS
(
row
);
//
Date date = new Date();
//
Calendar calendar = Calendar.getInstance();
//
calendar.set(Calendar.DAY_OF_MONTH,27);
//
calendar.set(Calendar.MONTH,0);
//
calendar.set(Calendar.HOUR_OF_DAY,0);
//
calendar.set(Calendar.MINUTE,0);
//
calendar.set(Calendar.SECOND,0);
//
calendar.set(Calendar.MILLISECOND,0);
//
logger.info("update time={} "+calendar.getTime());
//
Integer row = iApiCommonService.updateBatchStatus(calendar.getTime(), CompensationStatus.already_status.get());
//
//
logger.info("repairOldData update row={}",row);
return
JsonResult
.
SUCCESS
(
"success"
);
}
...
...
src/main/java/cn/quantgroup/financial/dao/impl/PaymentDaoImpl.java
View file @
18f0805c
...
...
@@ -105,15 +105,10 @@ public class PaymentDaoImpl implements IPaymentDao {
paymentDetail
.
setUpdateTime
(
new
Date
());
PaymentDetail
paymentDetailOld
=
paymentDetailMapper
.
getByLoanHistoryId
(
paymentDetail
.
getLoanHistoryId
());
Integer
row
=
0
;
if
(
paymentDetailOld
==
null
){
row
=
paymentDetailMapper
.
insertSelective
(
paymentDetail
);
}
else
{
logger
.
info
(
"paymentDetail id={} already exist ,json={}"
,
paymentDetail
.
getLoanHistoryId
(),
JSON
.
toJSONString
(
paymentDetail
));
return
row
;
}
row
=
paymentDetailMapper
.
insertOrUpdate
(
paymentDetail
);
if
(
row
>
0
){
paymentDetail
.
getRepaymentPlanDetailList
().
forEach
(
repaymentPlanDetail
->
{
repaymentPlanDetailMapper
.
insert
Selectiv
e
(
repaymentPlanDetail
);
repaymentPlanDetailMapper
.
insert
OrUpdat
e
(
repaymentPlanDetail
);
});
}
return
row
;
...
...
src/main/java/cn/quantgroup/financial/mapper/PaymentDetailMapper.java
View file @
18f0805c
...
...
@@ -15,6 +15,7 @@ public interface PaymentDetailMapper {
PaymentDetail
getByLoanHistoryId
(
@Param
(
"loanHistoryId"
)
Long
loanHistoryId
);
int
insertSelective
(
PaymentDetail
record
);
int
insertOrUpdate
(
PaymentDetail
record
);
int
updateMerchantContractNoByLoanHistoryId
(
@Param
(
"contractNo"
)
String
contractNo
,
@Param
(
"loanHistoryId"
)
Long
loanHistoryId
);
PaymentDetail
selectByPrimaryKey
(
Long
id
);
...
...
src/main/java/cn/quantgroup/financial/mapper/RepaymentPlanDetailMapper.java
View file @
18f0805c
...
...
@@ -13,6 +13,7 @@ public interface RepaymentPlanDetailMapper {
int
insert
(
RepaymentPlanDetail
record
);
int
insertSelective
(
RepaymentPlanDetail
record
);
int
insertOrUpdate
(
RepaymentPlanDetail
record
);
RepaymentPlanDetail
selectByPrimaryKey
(
Long
id
);
...
...
src/main/java/cn/quantgroup/financial/model/PaymentDetail.java
View file @
18f0805c
...
...
@@ -34,7 +34,7 @@ public class PaymentDetail implements Serializable{
//放款方id
private
Long
paymentCorpId
;
//总本金
private
BigDecimal
totalPrincipal
;
private
BigDecimal
totalPrincipal
=
BigDecimal
.
ZERO
;
//放款时间
private
Date
loanPaidAt
;
//申请借款时间
...
...
src/main/java/cn/quantgroup/financial/model/RepaymentPlanDetail.java
View file @
18f0805c
...
...
@@ -21,15 +21,15 @@ public class RepaymentPlanDetail implements Serializable{
//还款截止时间
private
Date
deadLine
;
//本金
private
BigDecimal
principal
;
private
BigDecimal
principal
=
BigDecimal
.
ZERO
;
//利息
private
BigDecimal
interest
;
private
BigDecimal
interest
=
BigDecimal
.
ZERO
;
//量化派服务费
private
BigDecimal
lhpServiceFee
;
private
BigDecimal
lhpServiceFee
=
BigDecimal
.
ZERO
;
//资金方服务费
private
BigDecimal
fundingServiceFee
;
private
BigDecimal
fundingServiceFee
=
BigDecimal
.
ZERO
;
//活动减免
private
BigDecimal
discount
;
private
BigDecimal
discount
=
BigDecimal
.
ZERO
;
//减免类型
private
String
discountType
;
//代偿状态值 0 未代偿 1已代偿
...
...
src/main/resources/mapper/PaymentDetailMapper.xml
View file @
18f0805c
...
...
@@ -58,6 +58,27 @@
delete from paymentdetail
where id = #{id,jdbcType=BIGINT}
</delete>
<insert
id=
"insertOrUpdate"
parameterType=
"cn.quantgroup.financial.model.PaymentDetail"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
insert into paymentdetail (id, userId, userName,
userPhoneNo, userIdNo, userIdType,
loanHistoryId, loanManifestHistoryId, merchantContractNo,
fundingCorpName, fundingCorpId, paymentCorpName,
paymentCorpId, totalPrincipal, loanPaidAt,
loanCreateAt, contractTotalTerm, createTime,
updateTime)
values (#{id,jdbcType=BIGINT}, #{userId,jdbcType=BIGINT}, #{userName,jdbcType=VARCHAR},
#{userPhoneNo,jdbcType=VARCHAR}, #{userIdNo,jdbcType=VARCHAR}, #{userIdType,jdbcType=TINYINT},
#{loanHistoryId,jdbcType=BIGINT}, #{loanManifestHistoryId,jdbcType=BIGINT}, #{merchantContractNo,jdbcType=VARCHAR},
#{fundingCorpName,jdbcType=VARCHAR}, #{fundingCorpId,jdbcType=BIGINT}, #{paymentCorpName,jdbcType=VARCHAR},
#{paymentCorpId,jdbcType=BIGINT}, #{totalPrincipal,jdbcType=DECIMAL}, #{loanPaidAt,jdbcType=TIMESTAMP},
#{loanCreateAt,jdbcType=TIMESTAMP}, #{contractTotalTerm,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP},
#{updateTime,jdbcType=TIMESTAMP}) on duplicate key update userId=#{userId,jdbcType=BIGINT},userName=#{userName,jdbcType=VARCHAR},
userPhoneNo=#{userPhoneNo,jdbcType=VARCHAR},userIdNo=#{userIdNo,jdbcType=VARCHAR},userIdType= #{userIdType,jdbcType=TINYINT},
loanManifestHistoryId=#{loanManifestHistoryId,jdbcType=BIGINT},merchantContractNo=#{merchantContractNo,jdbcType=VARCHAR},
fundingCorpName = #{fundingCorpName,jdbcType=VARCHAR},fundingCorpId=#{fundingCorpId,jdbcType=BIGINT},paymentCorpName=#{paymentCorpName,jdbcType=VARCHAR},
paymentCorpId = #{paymentCorpId,jdbcType=BIGINT},totalPrincipal=#{totalPrincipal,jdbcType=DECIMAL},loanPaidAt=#{loanPaidAt,jdbcType=TIMESTAMP},
loanCreateAt = #{loanCreateAt,jdbcType=TIMESTAMP},contractTotalTerm=#{contractTotalTerm,jdbcType=INTEGER},updateTime=#{updateTime,jdbcType=TIMESTAMP}
</insert>
<insert
id=
"insert"
parameterType=
"cn.quantgroup.financial.model.PaymentDetail"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
insert into paymentdetail (id, userId, userName,
userPhoneNo, userIdNo, userIdType,
...
...
src/main/resources/mapper/RepaymentPlanDetailMapper.xml
View file @
18f0805c
...
...
@@ -87,6 +87,23 @@
#{loanHistoryId}
</foreach>
</select>
<insert
id=
"insertOrUpdate"
parameterType=
"cn.quantgroup.financial.model.RepaymentPlanDetail"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
insert into repaymentplandetail (id, loanHistoryId, repaymentPlanId,
currentTerm, deadLine, principal,
interest, lhpServiceFee, fundingServiceFee,
discount, discountType, compensationStatus,
compensationDate, createTime, updateTime
)
values (#{id,jdbcType=BIGINT}, #{loanHistoryId,jdbcType=BIGINT}, #{repaymentPlanId,jdbcType=BIGINT},
#{currentTerm,jdbcType=INTEGER}, #{deadLine,jdbcType=TIMESTAMP}, #{principal,jdbcType=DECIMAL},
#{interest,jdbcType=DECIMAL}, #{lhpServiceFee,jdbcType=DECIMAL}, #{fundingServiceFee,jdbcType=DECIMAL},
#{discount,jdbcType=DECIMAL}, #{discountType,jdbcType=VARCHAR}, #{compensationStatus,jdbcType=TINYINT},
#{compensationDate,jdbcType=TIMESTAMP}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}
) on duplicate key update currentTerm=#{currentTerm,jdbcType=INTEGER},deadLine=#{deadLine,jdbcType=TIMESTAMP},principal=#{principal,jdbcType=DECIMAL},
interest=#{interest,jdbcType=DECIMAL},lhpServiceFee=#{lhpServiceFee,jdbcType=DECIMAL},fundingServiceFee=#{fundingServiceFee,jdbcType=DECIMAL},
discount=#{discount,jdbcType=DECIMAL},discountType=#{discountType,jdbcType=VARCHAR},compensationStatus=#{compensationStatus,jdbcType=TINYINT},
compensationDate=#{compensationDate,jdbcType=TIMESTAMP},updateTime=#{updateTime,jdbcType=TIMESTAMP}
</insert>
<insert
id=
"insert"
parameterType=
"cn.quantgroup.financial.model.RepaymentPlanDetail"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
insert into repaymentplandetail (id, loanHistoryId, repaymentPlanId,
currentTerm, deadLine, principal,
...
...
src/test/java/cn/quantgroup/financial/json/TestJson.java
View file @
18f0805c
...
...
@@ -6,7 +6,9 @@ import cn.quantgroup.financial.model.RepaymentPlanStatus;
import
com.alibaba.fastjson.JSON
;
import
org.junit.Test
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
/**
* Created by WuKong on 2017/1/6.
...
...
@@ -30,6 +32,14 @@ public class TestJson {
System
.
out
.
println
(
JSON
.
toJSONString
(
repaymentPlanStatus
));
}
@Test
public
void
testList
(){
List
<
Long
>
loanIdlist
=
new
ArrayList
<>();
loanIdlist
.
add
(
34920666L
);
loanIdlist
.
add
(
34920667L
);
String
json
=
JSON
.
toJSONString
(
loanIdlist
);
System
.
out
.
println
(
json
);
}
@Test
public
void
testPaymentJson
(){
String
json
=
"{\n"
+
...
...
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