Commit 18f0805c authored by Data-王博's avatar Data-王博

修复重复推送 第一次数据错误问题,回盘文件空行问题

parent 05575964
......@@ -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");
}
......
......@@ -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.insertSelective(repaymentPlanDetail);
repaymentPlanDetailMapper.insertOrUpdate(repaymentPlanDetail);
});
}
return row;
......
......@@ -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);
......
......@@ -13,6 +13,7 @@ public interface RepaymentPlanDetailMapper {
int insert(RepaymentPlanDetail record);
int insertSelective(RepaymentPlanDetail record);
int insertOrUpdate(RepaymentPlanDetail record);
RepaymentPlanDetail selectByPrimaryKey(Long id);
......
......@@ -34,7 +34,7 @@ public class PaymentDetail implements Serializable{
//放款方id
private Long paymentCorpId;
//总本金
private BigDecimal totalPrincipal;
private BigDecimal totalPrincipal=BigDecimal.ZERO;
//放款时间
private Date loanPaidAt;
//申请借款时间
......
......@@ -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已代偿
......
......@@ -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,
......
......@@ -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,
......
......@@ -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" +
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment