Commit 44d3dbe2 authored by LSL's avatar LSL

本息服初始化

parent 3ba6c9ab
......@@ -52,6 +52,11 @@ public class BackedCommand extends AbstractCommand {
public JsonResult execute() {
String request = RuntimeContextHolder.currentRuntimeContext().getRequestBody();
BackedRequest backedRequest = JSONObject.parseObject(request, BackedRequest.class);
//查询还款编号
RepayModel repayModel = loanRepayComponent.getByBackedNo(backedRequest.getBackedNo());
if (repayModel!=null){
throw new BizException("还款单已存在!");
}
try {
//生成 windows_repay 信息
creditRepay(backedRequest);
......
......@@ -49,6 +49,11 @@ public class BackedCommandnew {
@Transactional
public JsonResult execute(BackedRequest backedRequest) {
//查询还款编号
RepayModel repayModel = loanRepayComponent.getByBackedNo(backedRequest.getBackedNo());
if (repayModel!=null){
throw new BizException("还款单已存在!");
}
try {
//生成 windows_repay 信息
creditRepay(backedRequest);
......
......@@ -5,4 +5,6 @@ import com.jqtx.windows.component.model.RepayModel;
public interface LoanRepayComponent {
int insert(RepayModel repayModel);
RepayModel getByBackedNo(String backedNo);
}
......@@ -3,14 +3,16 @@ package com.jqtx.windows.component.impl;
import cn.hutool.core.bean.BeanUtil;
import com.jqtx.windows.component.LoanPlanComponent;
import com.jqtx.windows.component.LoanRepayComponent;
import com.jqtx.windows.component.model.LoanModel;
import com.jqtx.windows.component.model.RepayModel;
import com.jqtx.windows.repository.entity.WindowsPlan;
import com.jqtx.windows.repository.entity.WindowsRepay;
import com.jqtx.windows.repository.entity.*;
import com.jqtx.windows.repository.mapper.WindowsPlanMapper;
import com.jqtx.windows.repository.mapper.WindowsRepayMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class LoanReapyComponentImpl implements LoanRepayComponent {
......@@ -23,4 +25,13 @@ public class LoanReapyComponentImpl implements LoanRepayComponent {
int i = windowsRepayMapper.insertSelective(windowsPlan);
return i;
}
@Override
public RepayModel getByBackedNo(String backedNo) {
WindowsRepayExample example = new WindowsRepayExample();
WindowsRepayExample.Criteria criteria = example.createCriteria();
criteria.andBackedNoEqualTo(backedNo);
List<WindowsRepay> windowsRepays = windowsRepayMapper.selectByExample(example);
return windowsRepays.stream().map(m -> BeanUtil.toBean(m, RepayModel.class)).findFirst().orElse(null);
}
}
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