Browse Source

消贷合同还款计划表模块

master
fanzongzhe 2 years ago
parent
commit
0e30d7030d
  1. 37
      anrui-buscenter/anrui-buscenter-api/src/main/java/com/yxt/anrui/buscenter/api/bussalesorderloancontract/BusLoancontractForRepayQuery.java
  2. 36
      anrui-buscenter/anrui-buscenter-api/src/main/java/com/yxt/anrui/buscenter/api/bussalesorderloancontract/BusLoancontractForRepayVo.java
  3. 5
      anrui-buscenter/anrui-buscenter-api/src/main/java/com/yxt/anrui/buscenter/api/bussalesorderloancontract/BusSalesOrderLoancontractFeign.java
  4. 5
      anrui-buscenter/anrui-buscenter-api/src/main/java/com/yxt/anrui/buscenter/api/bussalesorderloancontract/BusSalesOrderLoancontractFeignFallback.java
  5. 4
      anrui-buscenter/anrui-buscenter-biz/src/main/java/com/yxt/anrui/buscenter/biz/bussalesorderloancontract/BusSalesOrderLoancontractMapper.java
  6. 39
      anrui-buscenter/anrui-buscenter-biz/src/main/java/com/yxt/anrui/buscenter/biz/bussalesorderloancontract/BusSalesOrderLoancontractMapper.xml
  7. 14
      anrui-buscenter/anrui-buscenter-biz/src/main/java/com/yxt/anrui/buscenter/biz/bussalesorderloancontract/BusSalesOrderLoancontractRest.java
  8. 246
      anrui-buscenter/anrui-buscenter-biz/src/main/java/com/yxt/anrui/buscenter/biz/bussalesorderloancontract/BusSalesOrderLoancontractService.java
  9. 54
      anrui-riskcenter/anrui-riskcenter-api/src/main/java/com/yxt/anrui/riskcenter/api/loanrepaymentschedule/LoanCreateSchedulePdfDto.java
  10. 59
      anrui-riskcenter/anrui-riskcenter-api/src/main/java/com/yxt/anrui/riskcenter/api/loanrepaymentschedule/LoanCreateSchedulePdfVo.java
  11. 28
      anrui-riskcenter/anrui-riskcenter-api/src/main/java/com/yxt/anrui/riskcenter/api/loanrepaymentschedule/LoanCreateScheduleVinOneVo.java
  12. 25
      anrui-riskcenter/anrui-riskcenter-api/src/main/java/com/yxt/anrui/riskcenter/api/loanrepaymentschedule/LoanCreateScheduleVinsListVo.java
  13. 37
      anrui-riskcenter/anrui-riskcenter-api/src/main/java/com/yxt/anrui/riskcenter/api/loanrepaymentschedule/LoanCreateScheduleVinsVo.java
  14. 60
      anrui-riskcenter/anrui-riskcenter-api/src/main/java/com/yxt/anrui/riskcenter/api/loanrepaymentschedule/LoanRepaymentSchedule.java
  15. 47
      anrui-riskcenter/anrui-riskcenter-api/src/main/java/com/yxt/anrui/riskcenter/api/loanrepaymentschedule/LoanRepaymentScheduleFeign.java
  16. 35
      anrui-riskcenter/anrui-riskcenter-api/src/main/java/com/yxt/anrui/riskcenter/api/loanrepaymentschedule/LoanRepaymentScheduleFeignFallback.java
  17. 4
      anrui-riskcenter/anrui-riskcenter-api/src/main/java/com/yxt/anrui/riskcenter/api/loanwarrantinformation/LoanTransferInfoDto.java
  18. 4
      anrui-riskcenter/anrui-riskcenter-api/src/main/java/com/yxt/anrui/riskcenter/api/loanwarrantinformation/LoanTransferInfoVo.java
  19. 4
      anrui-riskcenter/anrui-riskcenter-api/src/main/java/com/yxt/anrui/riskcenter/api/loanwarrantinformation/LoanWarrantInformation.java
  20. 4
      anrui-riskcenter/anrui-riskcenter-api/src/main/java/com/yxt/anrui/riskcenter/api/loanwarrantinformation/LoanWarrantInformationDetailsVo.java
  21. 24
      anrui-riskcenter/anrui-riskcenter-biz/src/main/java/com/yxt/anrui/riskcenter/biz/loanrepaymentschedule/LoanRepaymentScheduleMapper.java
  22. 11
      anrui-riskcenter/anrui-riskcenter-biz/src/main/java/com/yxt/anrui/riskcenter/biz/loanrepaymentschedule/LoanRepaymentScheduleMapper.xml
  23. 45
      anrui-riskcenter/anrui-riskcenter-biz/src/main/java/com/yxt/anrui/riskcenter/biz/loanrepaymentschedule/LoanRepaymentScheduleRest.java
  24. 510
      anrui-riskcenter/anrui-riskcenter-biz/src/main/java/com/yxt/anrui/riskcenter/biz/loanrepaymentschedule/LoanRepaymentScheduleService.java
  25. 12
      anrui-riskcenter/anrui-riskcenter-biz/src/main/java/com/yxt/anrui/riskcenter/biz/loanwarrantinformation/LoanWarrantInformationService.java
  26. 1397
      anrui-riskcenter/anrui-riskcenter-biz/src/main/resources/ftl/mainSchedule.ftl
  27. 1533
      anrui-riskcenter/anrui-riskcenter-biz/src/main/resources/ftl/otherSchedule.ftl

37
anrui-buscenter/anrui-buscenter-api/src/main/java/com/yxt/anrui/buscenter/api/bussalesorderloancontract/BusLoancontractForRepayQuery.java

@ -0,0 +1,37 @@
package com.yxt.anrui.buscenter.api.bussalesorderloancontract;
import com.yxt.common.core.query.Query;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author Administrator
* @description
* @date 2023/9/1 11:29
*/
@Data
public class BusLoancontractForRepayQuery implements Query {
@ApiModelProperty("销售部门")
private String orgName;
@ApiModelProperty("销售专员")
private String staffName;
@ApiModelProperty("分公司名称")
private String useOrgName;
@ApiModelProperty("消贷合同编号")
private String loanContractNo; // 消贷合同编号
@ApiModelProperty("借款人名称")
private String borrowerName; // 借款人名称
@ApiModelProperty("资方名称")
private String bankName;
@ApiModelProperty("金融产品名称")
private String policyName; // 金融产品名称
@ApiModelProperty("组织全路径")
private String orgPath;
@ApiModelProperty("菜单sid")
private String menuSid;
@ApiModelProperty("菜单url")
private String menuUrl;
@ApiModelProperty("用户sid")
private String userSid;
}

36
anrui-buscenter/anrui-buscenter-api/src/main/java/com/yxt/anrui/buscenter/api/bussalesorderloancontract/BusLoancontractForRepayVo.java

@ -0,0 +1,36 @@
package com.yxt.anrui.buscenter.api.bussalesorderloancontract;
import com.yxt.common.core.vo.Vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author Administrator
* @description
* @date 2023/9/1 11:21
*/
@Data
public class BusLoancontractForRepayVo implements Vo {
@ApiModelProperty("销售订单sid")
private String salesOrderSid; // 销售订单sid
@ApiModelProperty("销售部门")
private String orgName;
@ApiModelProperty("销售专员")
private String staffName;
@ApiModelProperty("分公司名称")
private String useOrgName;
@ApiModelProperty("消贷合同编号")
private String loanContractNo; // 消贷合同编号
@ApiModelProperty("借款人名称")
private String borrowerName; // 借款人名称
@ApiModelProperty("车架号")
private String vinNo; // 台数
@ApiModelProperty("资方名称")
private String bankName;
@ApiModelProperty("资方合同号")
private String bankContractNo; // 资方合同号
@ApiModelProperty("金融产品名称")
private String policyName; // 金融产品名称
}

5
anrui-buscenter/anrui-buscenter-api/src/main/java/com/yxt/anrui/buscenter/api/bussalesorderloancontract/BusSalesOrderLoancontractFeign.java

@ -90,4 +90,9 @@ public interface BusSalesOrderLoancontractFeign {
@PostMapping("/updateBankConAndBusNo")
@ResponseBody
ResultBean updateBankConAndBusNo(@RequestParam("loanContractSid") String loanContractSid,@RequestParam("bankContractNo") String bankContractNo);
@ApiOperation("消贷合同生成还款计划表列表")
@PostMapping("/listPageForRepay")
@ResponseBody
public ResultBean<PagerVo<BusLoancontractForRepayVo>> listPageForRepay(@RequestBody PagerQuery<BusLoancontractForRepayQuery> pq);
}

5
anrui-buscenter/anrui-buscenter-api/src/main/java/com/yxt/anrui/buscenter/api/bussalesorderloancontract/BusSalesOrderLoancontractFeignFallback.java

@ -84,4 +84,9 @@ public class BusSalesOrderLoancontractFeignFallback implements BusSalesOrderLoan
public ResultBean updateBankConAndBusNo(String loanContractSid, String bankContractNo) {
return null;
}
@Override
public ResultBean<PagerVo<BusLoancontractForRepayVo>> listPageForRepay(PagerQuery<BusLoancontractForRepayQuery> pq) {
return null;
}
}

4
anrui-buscenter/anrui-buscenter-biz/src/main/java/com/yxt/anrui/buscenter/biz/bussalesorderloancontract/BusSalesOrderLoancontractMapper.java

@ -26,9 +26,11 @@
package com.yxt.anrui.buscenter.biz.bussalesorderloancontract;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.yxt.anrui.buscenter.api.bussalesorderloancontract.BusLoancontractForRepayVo;
import com.yxt.anrui.buscenter.api.bussalesorderloancontract.BusSalesOrderLoancontractDetailsVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@ -71,6 +73,8 @@ public interface BusSalesOrderLoancontractMapper extends BaseMapper<BusSalesOrde
@Select("select * from bus_sales_order_loancontract where borrowerSid = #{saleOrderBorrowerSid}")
List<BusSalesOrderLoancontractDetailsVo> selectByBorrowerSid(String saleOrderBorrowerSid);
IPage<BusLoancontractForRepayVo> listPageForRepay(IPage<BusSalesOrderLoancontract> page,@Param(Constants.WRAPPER) QueryWrapper<BusSalesOrderLoancontract> qw);
@Update("update bus_sales_order_loancontract set bankContractNo=#{bankContractNo},busNo='305' where sid=#{loanContractSid}")
void updateBankConAndBusNo(@Param("loanContractSid") String loanContractSid,@Param("bankContractNo") String bankContractNo);
}

39
anrui-buscenter/anrui-buscenter-biz/src/main/java/com/yxt/anrui/buscenter/biz/bussalesorderloancontract/BusSalesOrderLoancontractMapper.xml

@ -1,13 +1,34 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yxt.anrui.buscenter.biz.bussalesorderloancontract.BusSalesOrderLoancontractMapper">
<!-- <where> ${ew.sqlSegment} </where>-->
<!-- ${ew.customSqlSegment} -->
<select id="selectPageVo" resultType="com.yxt.anrui.buscenter.api.bussalesorderloancontract.BusSalesOrderLoancontractVo">
SELECT * FROM bus_sales_order_loancontract <where> ${ew.sqlSegment} </where>
</select>
<select id="selectListAllVo" resultType="com.yxt.anrui.buscenter.api.bussalesorderloancontract.BusSalesOrderLoancontractVo">
SELECT * FROM bus_sales_order_loancontract <where> ${ew.sqlSegment} </where>
</select>
<!-- <where> ${ew.sqlSegment} </where>-->
<!-- ${ew.customSqlSegment} -->
<select id="selectPageVo"
resultType="com.yxt.anrui.buscenter.api.bussalesorderloancontract.BusSalesOrderLoancontractVo">
SELECT * FROM bus_sales_order_loancontract
<where>${ew.sqlSegment}</where>
</select>
<select id="selectListAllVo"
resultType="com.yxt.anrui.buscenter.api.bussalesorderloancontract.BusSalesOrderLoancontractVo">
SELECT * FROM bus_sales_order_loancontract
<where>${ew.sqlSegment}</where>
</select>
<select id="listPageForRepay"
resultType="com.yxt.anrui.buscenter.api.bussalesorderloancontract.BusLoancontractForRepayVo">
SELECT
bs.sid as salesOrderSid,
bs.orgName as orgName,
bs.staffName as staffName,
bs.useOrgName as useOrgName,
co.loanCotractNo as loanContractNo,
co.borrowerName as borrowerName,
co.bankName as bankName,
co.bankContractNo as bankContractNo,
co.policyName as policyName
FROM
bus_sales_order_loancontract AS co
LEFT JOIN bus_sales_order AS bs ON co.salesOrderSid = bs.sid
<where>${ew.sqlSegment}</where>
</select>
</mapper>

14
anrui-buscenter/anrui-buscenter-biz/src/main/java/com/yxt/anrui/buscenter/biz/bussalesorderloancontract/BusSalesOrderLoancontractRest.java

@ -25,6 +25,7 @@
*********************************************************/
package com.yxt.anrui.buscenter.biz.bussalesorderloancontract;
import com.yxt.anrui.buscenter.api.bussalesorderloancontract.*;
import com.yxt.common.core.query.PagerQuery;
import com.yxt.common.core.result.ResultBean;
import com.yxt.common.core.vo.PagerVo;
@ -34,12 +35,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import com.yxt.anrui.buscenter.api.bussalesorderloancontract.BusSalesOrderLoancontract;
import com.yxt.anrui.buscenter.api.bussalesorderloancontract.BusSalesOrderLoancontractQuery;
import com.yxt.anrui.buscenter.api.bussalesorderloancontract.BusSalesOrderLoancontractVo;
import com.yxt.anrui.buscenter.api.bussalesorderloancontract.BusSalesOrderLoancontractDetailsVo;
import com.yxt.anrui.buscenter.api.bussalesorderloancontract.BusSalesOrderLoancontractDto;
import com.yxt.anrui.buscenter.api.bussalesorderloancontract.BusSalesOrderLoancontractFeign;
/**
* Project: anrui-buscenter(销售订单) <br/>
@ -116,4 +111,11 @@ public class BusSalesOrderLoancontractRest implements BusSalesOrderLoancontractF
public ResultBean updateBankConAndBusNo(String loanContractSid, String bankContractNo) {
return busSalesOrderLoancontractService.updateBankConAndBusNo(loanContractSid,bankContractNo);
}
@Override
public ResultBean<PagerVo<BusLoancontractForRepayVo>> listPageForRepay(PagerQuery<BusLoancontractForRepayQuery> pq) {
ResultBean rb = ResultBean.fireFail();
PagerVo<BusLoancontractForRepayVo> pv = busSalesOrderLoancontractService.listPageForRepay(pq);
return rb.success().setData(pv);
}
}

246
anrui-buscenter/anrui-buscenter-biz/src/main/java/com/yxt/anrui/buscenter/biz/bussalesorderloancontract/BusSalesOrderLoancontractService.java

@ -28,22 +28,28 @@ package com.yxt.anrui.buscenter.biz.bussalesorderloancontract;
import cn.hutool.core.bean.BeanUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.yxt.anrui.buscenter.api.bussalesorderloancontract.*;
import com.yxt.anrui.buscenter.api.bussalesordervehicle.BusSalesOrderVehicle;
import com.yxt.anrui.buscenter.api.bussalesordervehicle.BusSalesOrderVehicleFeign;
import com.yxt.anrui.buscenter.biz.bussalesordervehicle.BusSalesOrderVehicleService;
import com.yxt.anrui.portal.api.sysuser.PrivilegeQuery;
import com.yxt.anrui.portal.api.sysuser.SysUserFeign;
import com.yxt.anrui.riskcenter.api.loanparameter.LoanParameter;
import com.yxt.anrui.riskcenter.api.loanparameter.LoanParameterQuery;
import com.yxt.anrui.riskcenter.api.loanparameter.LoanParameterVo;
import org.apache.commons.lang3.StringUtils;
import com.yxt.common.base.service.MybatisBaseService;
import com.yxt.common.base.utils.PagerUtil;
import com.yxt.common.core.query.PagerQuery;
import com.yxt.common.core.result.ResultBean;
import com.yxt.common.core.vo.PagerVo;
import com.yxt.anrui.buscenter.api.bussalesorderloancontract.BusSalesOrderLoancontract;
import com.yxt.anrui.buscenter.api.bussalesorderloancontract.BusSalesOrderLoancontractQuery;
import com.yxt.anrui.buscenter.api.bussalesorderloancontract.BusSalesOrderLoancontractVo;
import com.yxt.anrui.buscenter.api.bussalesorderloancontract.BusSalesOrderLoancontractDetailsVo;
import com.yxt.anrui.buscenter.api.bussalesorderloancontract.BusSalesOrderLoancontractDto;
import com.yxt.anrui.buscenter.api.bussalesorderloancontract.BusSalesOrderLoancontractFeign;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
/**
* Project: anrui-buscenter(销售订单) <br/>
@ -58,70 +64,178 @@ import java.util.List;
* @version 1.0
* @since 1.0
*/
@Service
public class BusSalesOrderLoancontractService extends MybatisBaseService<BusSalesOrderLoancontractMapper, BusSalesOrderLoancontract> {
private QueryWrapper<BusSalesOrderLoancontract> createQueryWrapper(BusSalesOrderLoancontractQuery query) {
// todo: 这里根据具体业务调整查询条件
// 多字段Like示例:qw.and(wrapper -> wrapper.like("name", query.getName()).or().like("remark", query.getName()));
QueryWrapper<BusSalesOrderLoancontract> qw = new QueryWrapper<>();
return qw;
}
public PagerVo<BusSalesOrderLoancontractVo> listPageVo(PagerQuery<BusSalesOrderLoancontractQuery> pq) {
BusSalesOrderLoancontractQuery query = pq.getParams();
QueryWrapper<BusSalesOrderLoancontract> qw = createQueryWrapper(query);
IPage<BusSalesOrderLoancontract> page = PagerUtil.queryToPage(pq);
IPage<BusSalesOrderLoancontractVo> pagging = baseMapper.selectPageVo(page, qw);
PagerVo<BusSalesOrderLoancontractVo> p = PagerUtil.pageToVo(pagging, null);
return p;
}
public String saveOrUpdateDto(BusSalesOrderLoancontractDto dto){
@Autowired
private SysUserFeign sysUserFeign;
@Autowired
private BusSalesOrderVehicleService busSalesOrderVehicleService;
private QueryWrapper<BusSalesOrderLoancontract> createQueryWrapper(BusSalesOrderLoancontractQuery query) {
// todo: 这里根据具体业务调整查询条件
// 多字段Like示例:qw.and(wrapper -> wrapper.like("name", query.getName()).or().like("remark", query.getName()));
QueryWrapper<BusSalesOrderLoancontract> qw = new QueryWrapper<>();
return qw;
}
public PagerVo<BusSalesOrderLoancontractVo> listPageVo(PagerQuery<BusSalesOrderLoancontractQuery> pq) {
BusSalesOrderLoancontractQuery query = pq.getParams();
QueryWrapper<BusSalesOrderLoancontract> qw = createQueryWrapper(query);
IPage<BusSalesOrderLoancontract> page = PagerUtil.queryToPage(pq);
IPage<BusSalesOrderLoancontractVo> pagging = baseMapper.selectPageVo(page, qw);
PagerVo<BusSalesOrderLoancontractVo> p = PagerUtil.pageToVo(pagging, null);
return p;
}
public String saveOrUpdateDto(BusSalesOrderLoancontractDto dto) {
String dtoSid = dto.getSid();
if (StringUtils.isBlank(dtoSid)) {
String sid = this.insertByDto(dto);
return sid;
}
this.updateByDto(dto);
return dtoSid;
}
public String insertByDto(BusSalesOrderLoancontractDto dto){
BusSalesOrderLoancontract entity = new BusSalesOrderLoancontract();
BeanUtil.copyProperties(dto, entity, "id", "sid");
baseMapper.insert(entity);
return entity.getSid();
}
public void updateByDto(BusSalesOrderLoancontractDto dto){
String dtoSid = dto.getSid();
String sid = this.insertByDto(dto);
return sid;
}
this.updateByDto(dto);
return dtoSid;
}
public String insertByDto(BusSalesOrderLoancontractDto dto) {
BusSalesOrderLoancontract entity = new BusSalesOrderLoancontract();
BeanUtil.copyProperties(dto, entity, "id", "sid");
baseMapper.insert(entity);
return entity.getSid();
}
public void updateByDto(BusSalesOrderLoancontractDto dto) {
String dtoSid = dto.getSid();
if (StringUtils.isBlank(dtoSid)) {
return;
}
BusSalesOrderLoancontract entity = fetchBySid(dtoSid);
BeanUtil.copyProperties(dto, entity, "id", "sid");
baseMapper.updateById(entity);
}
public BusSalesOrderLoancontractDetailsVo fetchDetailsVoBySid(String sid){
BusSalesOrderLoancontract entity = fetchBySid(sid);
BusSalesOrderLoancontractDetailsVo vo = new BusSalesOrderLoancontractDetailsVo();
BeanUtil.copyProperties(entity, vo);
return vo;
}
public List<BusSalesOrderLoancontractDetailsVo> selectByBorrowerSid(String saleOrderBorrowerSid) {
return baseMapper.selectByBorrowerSid(saleOrderBorrowerSid);
}
public BusSalesOrderLoancontract fetchDetailsByOrderSid(String sid) {
BusSalesOrderLoancontract entity = baseMapper.fetchDetailsByOrderSid(sid);
return entity;
}
public ResultBean updateBankConAndBusNo(String loanContractSid, String bankContractNo) {
ResultBean rb = ResultBean.fireFail();
baseMapper.updateBankConAndBusNo(loanContractSid,bankContractNo);
return rb.success();
}
}
BusSalesOrderLoancontract entity = fetchBySid(dtoSid);
BeanUtil.copyProperties(dto, entity, "id", "sid");
baseMapper.updateById(entity);
}
public BusSalesOrderLoancontractDetailsVo fetchDetailsVoBySid(String sid) {
BusSalesOrderLoancontract entity = fetchBySid(sid);
BusSalesOrderLoancontractDetailsVo vo = new BusSalesOrderLoancontractDetailsVo();
BeanUtil.copyProperties(entity, vo);
return vo;
}
public List<BusSalesOrderLoancontractDetailsVo> selectByBorrowerSid(String saleOrderBorrowerSid) {
return baseMapper.selectByBorrowerSid(saleOrderBorrowerSid);
}
public BusSalesOrderLoancontract fetchDetailsByOrderSid(String sid) {
BusSalesOrderLoancontract entity = baseMapper.fetchDetailsByOrderSid(sid);
return entity;
}
/**
* 消贷合同生成还款计划表列表
*
* @param pq
* @return
*/
public PagerVo<BusLoancontractForRepayVo> listPageForRepay(PagerQuery<BusLoancontractForRepayQuery> pq) {
IPage<BusSalesOrderLoancontract> page = PagerUtil.queryToPage(pq);
BusLoancontractForRepayQuery pagerQuery = pq.getParams();
QueryWrapper<BusSalesOrderLoancontract> qw = new QueryWrapper<>();
//=======================
PrivilegeQuery privilegeQuery = new PrivilegeQuery();
privilegeQuery.setOrgPath(pagerQuery.getOrgPath());
privilegeQuery.setMenuSid(pagerQuery.getMenuSid());
privilegeQuery.setMenuUrl(pagerQuery.getMenuUrl());
privilegeQuery.setUserSid(pagerQuery.getUserSid());
ResultBean<String> defaultIdReltBean = sysUserFeign.selectPrivilegeLevel(privilegeQuery);
if (StringUtils.isNotBlank(defaultIdReltBean.getData())) {
//数据权限ID(1集团、2事业部、3分公司、4部门、5个人)
String orgSidPath = pagerQuery.getOrgPath();
orgSidPath = orgSidPath + "/";
int i1 = orgSidPath.indexOf("/");
int i2 = orgSidPath.indexOf("/", i1 + 1);
int i3 = orgSidPath.indexOf("/", i2 + 1);
int i4 = orgSidPath.indexOf("/", i3 + 1);
String orgLevelKey = defaultIdReltBean.getData();
if ("1".equals(orgLevelKey)) {
orgSidPath = orgSidPath.substring(0, i1);
qw.like("bs.orgSidPath", orgSidPath);
} else if ("2".equals(orgLevelKey)) {
orgSidPath = orgSidPath.substring(0, i2);
qw.like("bs.orgSidPath", orgSidPath);
} else if ("3".equals(orgLevelKey)) {
orgSidPath = orgSidPath.substring(0, i3);
qw.like("bs.orgSidPath", orgSidPath);
} else if ("4".equals(orgLevelKey)) {
orgSidPath = orgSidPath.substring(0, i4);
qw.like("bs.orgSidPath", orgSidPath);
} else if ("5".equals(orgLevelKey)) {
qw.eq("bs.createBySid", pagerQuery.getUserSid());
} else {
PagerVo<BusLoancontractForRepayVo> p = new PagerVo<>();
return p;
}
} else {
PagerVo<BusLoancontractForRepayVo> p = new PagerVo<>();
return p;
}
//=======================
//分公司
if (StringUtils.isNotBlank(pagerQuery.getUseOrgName())) {
qw.like("bs.useOrgName", pagerQuery.getUseOrgName());
}
//销售部门
if (StringUtils.isNotBlank(pagerQuery.getOrgName())) {
qw.like("bs.orgName", pagerQuery.getOrgName());
}
//销售专员
if (StringUtils.isNotBlank(pagerQuery.getUseOrgName())) {
qw.like("bs.useOrgName", pagerQuery.getUseOrgName());
}
//消贷合同编号
if (StringUtils.isNotBlank(pagerQuery.getLoanContractNo())) {
qw.like("co.loanCotractNo", pagerQuery.getLoanContractNo());
}
//贷款人
if (StringUtils.isNotBlank(pagerQuery.getBorrowerName())) {
qw.like("co.borrowerName", pagerQuery.getBorrowerName());
}
//资方
if (StringUtils.isNotBlank(pagerQuery.getBankName())) {
qw.like("co.bankName", pagerQuery.getBankName());
}
//金融产品
if (StringUtils.isNotBlank(pagerQuery.getPolicyName())) {
qw.like("co.policyName", pagerQuery.getPolicyName());
}
qw.eq("co.isDelete", 0);
qw.orderByDesc("co.createTime");
IPage<BusLoancontractForRepayVo> pagging = baseMapper.listPageForRepay(page, qw);
List<BusLoancontractForRepayVo> records = pagging.getRecords();
records.removeAll(Collections.singleton(null));
if (!records.isEmpty()) {
for (BusLoancontractForRepayVo record : records) {
if (StringUtils.isNotBlank(record.getSalesOrderSid())) {
List<BusSalesOrderVehicle> busSalesOrderVehicles = busSalesOrderVehicleService.selectByOrderSid(record.getSalesOrderSid());
busSalesOrderVehicles.removeAll(Collections.singleton(null));
if (!busSalesOrderVehicles.isEmpty()) {
List<String> stringVinNos = busSalesOrderVehicles.stream().map(c -> c.getLinkNo()).collect(Collectors.toList());
if (!stringVinNos.isEmpty()) {
record.setVinNo(String.join(",", stringVinNos));
}
}
}
}
}
PagerVo<BusLoancontractForRepayVo> p = PagerUtil.pageToVo(pagging, null);
return p;
}
public ResultBean updateBankConAndBusNo(String loanContractSid, String bankContractNo) {
ResultBean rb = ResultBean.fireFail();
baseMapper.updateBankConAndBusNo(loanContractSid, bankContractNo);
return rb.success();
}
}

54
anrui-riskcenter/anrui-riskcenter-api/src/main/java/com/yxt/anrui/riskcenter/api/loanrepaymentschedule/LoanCreateSchedulePdfDto.java

@ -0,0 +1,54 @@
package com.yxt.anrui.riskcenter.api.loanrepaymentschedule;
import com.yxt.common.core.dto.Dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author Administrator
* @description
* @date 2023/9/4 14:04
*/
@Data
public class LoanCreateSchedulePdfDto implements Dto {
@ApiModelProperty("销售订单sid")
private String salesOrderSid;
@ApiModelProperty("金融方案sid")
private String solutionsSid;
@ApiModelProperty("消贷合同编号")
private String loanContractNo;
@ApiModelProperty("借款人名称")
private String borrowerName;
@ApiModelProperty("车辆台数")
private String vehCount;
@ApiModelProperty("资方名称")
private String policyName;
@ApiModelProperty("主产品贷款金额")
private String loanAmount;
@ApiModelProperty("主产品期数")
private String mainPeriod;
@ApiModelProperty("主产品首期还款日")
private String mainRepayDate;
@ApiModelProperty("主产品首期月还")
private String mainFirstRepay;
@ApiModelProperty("主产品期间月还")
private String mainMidRepay;
@ApiModelProperty("主产品期末月还")
private String mainLastRepay;
@ApiModelProperty("其他融资方")
private String otherPolicyName;
@ApiModelProperty("其他融贷款金额")
private String otherAmount;
@ApiModelProperty("其他融期数")
private String otherPeriod;
@ApiModelProperty("其他融首期还款日")
private String otherRepayDate;
@ApiModelProperty("其他融首期月还")
private String otherFirstRepay;
@ApiModelProperty("其他融期间月还")
private String otherMidRepay;
@ApiModelProperty("其他融期末月还")
private String otherLastRepay;
@ApiModelProperty("是否有其他融 0没有1有")
private String isOtherPolicy;
}

59
anrui-riskcenter/anrui-riskcenter-api/src/main/java/com/yxt/anrui/riskcenter/api/loanrepaymentschedule/LoanCreateSchedulePdfVo.java

@ -0,0 +1,59 @@
package com.yxt.anrui.riskcenter.api.loanrepaymentschedule;
import com.yxt.common.core.vo.Vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
/**
* @author Administrator
* @description
* @date 2023/9/1 15:01
*/
@Data
public class LoanCreateSchedulePdfVo implements Vo {
@ApiModelProperty("销售订单sid")
private String salesOrderSid;
@ApiModelProperty("金融方案sid")
private String solutionsSid;
@ApiModelProperty("消贷合同编号")
private String loanContractNo;
@ApiModelProperty("借款人名称")
private String borrowerName;
@ApiModelProperty("车辆台数")
private String vehCount;
@ApiModelProperty("资方名称")
private String policyName;
@ApiModelProperty("主产品贷款金额")
private String loanAmount;
@ApiModelProperty("主产品期数")
private String mainPeriod;
@ApiModelProperty("主产品首期还款日")
private String mainRepayDate;
@ApiModelProperty("主产品首期月还")
private String mainFirstRepay;
@ApiModelProperty("主产品期间月还")
private String mainMidRepay;
@ApiModelProperty("主产品期末月还")
private String mainLastRepay;
@ApiModelProperty("其他融资方")
private String otherPolicyName;
@ApiModelProperty("其他融贷款金额")
private String otherAmount;
@ApiModelProperty("其他融期数")
private String otherPeriod;
@ApiModelProperty("其他融首期还款日")
private String otherRepayDate;
@ApiModelProperty("其他融首期月还")
private String otherFirstRepay;
@ApiModelProperty("其他融期间月还")
private String otherMidRepay;
@ApiModelProperty("其他融期末月还")
private String otherLastRepay;
@ApiModelProperty("是否有其他融 0没有1有")
private String isOtherPolicy;
}

28
anrui-riskcenter/anrui-riskcenter-api/src/main/java/com/yxt/anrui/riskcenter/api/loanrepaymentschedule/LoanCreateScheduleVinOneVo.java

@ -0,0 +1,28 @@
package com.yxt.anrui.riskcenter.api.loanrepaymentschedule;
import com.yxt.common.core.vo.Vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.ArrayList;
import java.util.List;
/**
* @author Administrator
* @description
* @date 2023/9/5 14:34
*/
@Data
public class LoanCreateScheduleVinOneVo implements Vo {
@ApiModelProperty("借款人名称")
private String borrowerName;
@ApiModelProperty("车架号")
private String vinNo;
@ApiModelProperty("是否有其他融 0没有1有")
private String isOtherPolicy;
@ApiModelProperty("主产品首期还款日")
private String mainRepayDate;
@ApiModelProperty("其他融首期还款日")
private String otherRepayDate;
private List<LoanCreateScheduleVinsListVo> scheduleVins = new ArrayList<>();
}

25
anrui-riskcenter/anrui-riskcenter-api/src/main/java/com/yxt/anrui/riskcenter/api/loanrepaymentschedule/LoanCreateScheduleVinsListVo.java

@ -0,0 +1,25 @@
package com.yxt.anrui.riskcenter.api.loanrepaymentschedule;
import com.yxt.common.core.vo.Vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author Administrator
* @description
* @date 2023/9/4 14:15
*/
@Data
public class LoanCreateScheduleVinsListVo implements Vo {
@ApiModelProperty("期数")
private String period;
@ApiModelProperty("还款月份")
private String repayMonth;
@ApiModelProperty("主产品月还")
private String mainRepay;
@ApiModelProperty("其他融期间月还")
private String otherRepay;
@ApiModelProperty("合计")
private String amount;
}

37
anrui-riskcenter/anrui-riskcenter-api/src/main/java/com/yxt/anrui/riskcenter/api/loanrepaymentschedule/LoanCreateScheduleVinsVo.java

@ -0,0 +1,37 @@
package com.yxt.anrui.riskcenter.api.loanrepaymentschedule;
import com.yxt.common.core.vo.Vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.ArrayList;
import java.util.List;
/**
* @author Administrator
* @description
* @date 2023/9/4 14:11
*/
@Data
public class LoanCreateScheduleVinsVo implements Vo {
@ApiModelProperty("销售订单sid")
private String salesOrderSid;
@ApiModelProperty("消贷合同编号")
private String loanContractNo;
@ApiModelProperty("借款人名称")
private String borrowerName;
@ApiModelProperty("资方")
private String bankName;
@ApiModelProperty("车辆台数")
private String vehCount;
@ApiModelProperty("车架号")
private String vinNo;
@ApiModelProperty("是否有其他融 0没有1有")
private String isOtherPolicy;
@ApiModelProperty("主产品首期还款日")
private String mainRepayDate;
@ApiModelProperty("其他融首期还款日")
private String otherRepayDate;
private List<LoanCreateScheduleVinsListVo> scheduleVins = new ArrayList<>();
}

60
anrui-riskcenter/anrui-riskcenter-api/src/main/java/com/yxt/anrui/riskcenter/api/loanrepaymentschedule/LoanRepaymentSchedule.java

@ -0,0 +1,60 @@
package com.yxt.anrui.riskcenter.api.loanrepaymentschedule;
import com.baomidou.mybatisplus.annotation.TableName;
import com.yxt.common.core.domain.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
import java.util.Date;
/**
* @author Administrator
* @description
* @date 2023/8/16 14:34
*/
@Data
@ApiModel(value = "还款计划表", description = "还款计划表")
@TableName("loan_repayment_schedule")
public class LoanRepaymentSchedule extends BaseEntity {
@ApiModelProperty("销售订单sid")
private String salesOrderSid;
@ApiModelProperty("借款人sid")
private String borrowerSid;
@ApiModelProperty("借款人名称")
private String borrowerName;
@ApiModelProperty("车架号")
private String vinNo;
@ApiModelProperty("车辆台数")
private String vehCount;
@ApiModelProperty("消贷合同编号")
private String loanContractNo;
@ApiModelProperty("资方名称")
private String bankName;
@ApiModelProperty("主产品期数")
private String mainPeriod;
@ApiModelProperty("主产品首期还款日")
private Date mainRepayDate;
@ApiModelProperty("主产品首期月还")
private BigDecimal mainFirstRepay;
@ApiModelProperty("主产品期间月还")
private BigDecimal mainMidRepay;
@ApiModelProperty("主产品期末月还")
private BigDecimal mainLastRepay;
@ApiModelProperty("其他融期数")
private String otherPeriod;
@ApiModelProperty("其他融首期还款日")
private Date otherRepayDate;
@ApiModelProperty("其他融首期月还")
private BigDecimal otherFirstRepay;
@ApiModelProperty("其他融期间月还")
private BigDecimal otherMidRepay;
@ApiModelProperty("其他融期末月还")
private BigDecimal otherLastRepay;
@ApiModelProperty("是否有其他融 0没有1有")
private String isOtherPolicy;
@ApiModelProperty("还款计划单下载地址")
private String schedulePath;
}

47
anrui-riskcenter/anrui-riskcenter-api/src/main/java/com/yxt/anrui/riskcenter/api/loanrepaymentschedule/LoanRepaymentScheduleFeign.java

@ -0,0 +1,47 @@
package com.yxt.anrui.riskcenter.api.loanrepaymentschedule;
import com.yxt.common.core.result.ResultBean;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* @description: 还款计划表
* @author: fan
* @date: 2023/7/6
**/
@Api(tags = "还款计划表")
@FeignClient(
contextId = "anrui-riskcenter-LoanRepaymentSchedule",
name = "anrui-riskcenter",
path = "v1/loanrepaymentschedule",
fallback = LoanRepaymentScheduleFeignFallback.class)
public interface LoanRepaymentScheduleFeign {
@ApiOperation("根据销售订单SID生成还款计划表回显")
@GetMapping("/loanCreateSchedule")
@ResponseBody
public ResultBean<LoanCreateSchedulePdfVo> loanCreateSchedule(@RequestParam("salesOrderSid") String salesOrderSid);
@ApiOperation("生成还款计划表")
@PostMapping("/loanCreateSchedulePdf")
@ResponseBody
public ResultBean<String> loanCreateSchedulePdf(@RequestBody LoanCreateSchedulePdfVo dto);
@ApiOperation("查看多台还款计划表")
@GetMapping("/viewVinsSchedule")
@ResponseBody
public ResultBean<LoanCreateScheduleVinsVo> viewVinsSchedule(@RequestParam("salesOrderSid") String salesOrderSid);
@ApiOperation("查看单台还款计划表")
@GetMapping("/viewVinOneSchedule")
@ResponseBody
public ResultBean<List<LoanCreateScheduleVinOneVo>> viewVinOneSchedule(@RequestParam("salesOrderSid") String salesOrderSid);
}

35
anrui-riskcenter/anrui-riskcenter-api/src/main/java/com/yxt/anrui/riskcenter/api/loanrepaymentschedule/LoanRepaymentScheduleFeignFallback.java

@ -0,0 +1,35 @@
package com.yxt.anrui.riskcenter.api.loanrepaymentschedule;
import com.yxt.common.core.result.ResultBean;
import org.springframework.stereotype.Component;
import java.util.List;
/**
* @author Administrator
* @description
* @date 2023/8/16 14:36
*/
@Component
public class LoanRepaymentScheduleFeignFallback implements LoanRepaymentScheduleFeign {
@Override
public ResultBean<LoanCreateSchedulePdfVo> loanCreateSchedule(String salesOrderSid) {
return null;
}
@Override
public ResultBean<String> loanCreateSchedulePdf(LoanCreateSchedulePdfVo dto) {
return null;
}
@Override
public ResultBean<LoanCreateScheduleVinsVo> viewVinsSchedule(String salesOrderSid) {
return null;
}
@Override
public ResultBean<List<LoanCreateScheduleVinOneVo>> viewVinOneSchedule(String salesOrderSid) {
return null;
}
}

4
anrui-riskcenter/anrui-riskcenter-api/src/main/java/com/yxt/anrui/riskcenter/api/loanwarrantinformation/LoanTransferInfoDto.java

@ -16,7 +16,9 @@ import java.util.List;
@Data
public class LoanTransferInfoDto implements Dto {
private String[] sids;
@ApiModelProperty("移交资料")
@ApiModelProperty("移交资料key")
private String transferInformationKey;
@ApiModelProperty("移交资料value")
private String transferInformation;
@ApiModelProperty("送达日期")
private String deliveryDate;

4
anrui-riskcenter/anrui-riskcenter-api/src/main/java/com/yxt/anrui/riskcenter/api/loanwarrantinformation/LoanTransferInfoVo.java

@ -20,7 +20,9 @@ public class LoanTransferInfoVo implements Vo {
private String contractNo;
@ApiModelProperty("车架号")
private String vinNo;
@ApiModelProperty("移交资料")
@ApiModelProperty("移交资料key")
private String transferInformationKey;
@ApiModelProperty("移交资料value")
private String transferInformation;
@ApiModelProperty("送达日期")
private String deliveryDate;

4
anrui-riskcenter/anrui-riskcenter-api/src/main/java/com/yxt/anrui/riskcenter/api/loanwarrantinformation/LoanWarrantInformation.java

@ -29,7 +29,9 @@ public class LoanWarrantInformation extends BaseEntity {
private Date deliveryDate;
@ApiModelProperty("业务车辆sid")
private String busVinSid;
@ApiModelProperty("移交资料")
@ApiModelProperty("移交资料key")
private String transferInformationKey;
@ApiModelProperty("移交资料value")
private String transferInformation;
@ApiModelProperty("移交备注")
private String transferRemarks;

4
anrui-riskcenter/anrui-riskcenter-api/src/main/java/com/yxt/anrui/riskcenter/api/loanwarrantinformation/LoanWarrantInformationDetailsVo.java

@ -34,7 +34,9 @@ public class LoanWarrantInformationDetailsVo implements Vo {
private List<String> taxiFiles = new ArrayList<>();
@ApiModelProperty("行驶证")
private List<String> drivingFiles = new ArrayList<>();
@ApiModelProperty("移交资料")
@ApiModelProperty("移交资料key")
private String transferInformationKey;
@ApiModelProperty("移交资料value")
private String transferInformation;
@ApiModelProperty("送达日期")
private String deliveryDate;

24
anrui-riskcenter/anrui-riskcenter-biz/src/main/java/com/yxt/anrui/riskcenter/biz/loanrepaymentschedule/LoanRepaymentScheduleMapper.java

@ -0,0 +1,24 @@
package com.yxt.anrui.riskcenter.biz.loanrepaymentschedule;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.yxt.anrui.riskcenter.api.loanparameter.LoanParameter;
import com.yxt.anrui.riskcenter.api.loanparameter.LoanParameterVo;
import com.yxt.anrui.riskcenter.api.loanrepaymentschedule.LoanRepaymentSchedule;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/**
* @description:
* @author: fan
* @date: 2023/8/21
**/
@Mapper
public interface LoanRepaymentScheduleMapper extends BaseMapper<LoanRepaymentSchedule> {
LoanRepaymentSchedule selectByOrderSid(String salesOrderSid);
}

11
anrui-riskcenter/anrui-riskcenter-biz/src/main/java/com/yxt/anrui/riskcenter/biz/loanrepaymentschedule/LoanRepaymentScheduleMapper.xml

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.yxt.anrui.riskcenter.biz.loanrepaymentschedule.LoanRepaymentScheduleMapper">
<select id="selectByOrderSid"
resultType="com.yxt.anrui.riskcenter.api.loanrepaymentschedule.LoanRepaymentSchedule">
select *
from loan_repayment_schedule
where salesOrderSid = #{salesOrderSid}
</select>
</mapper>

45
anrui-riskcenter/anrui-riskcenter-biz/src/main/java/com/yxt/anrui/riskcenter/biz/loanrepaymentschedule/LoanRepaymentScheduleRest.java

@ -0,0 +1,45 @@
package com.yxt.anrui.riskcenter.biz.loanrepaymentschedule;
import com.yxt.anrui.riskcenter.api.loanrepaymentschedule.*;
import com.yxt.common.core.result.ResultBean;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* @description:
* @author: fan
* @date: 2023/8/21
**/
@Api(tags = "还款计划表")
@RestController
@RequestMapping("v1/loanrepaymentschedule")
public class LoanRepaymentScheduleRest implements LoanRepaymentScheduleFeign {
@Autowired
private LoanRepaymentScheduleService loanRepaymentScheduleService;
@Override
public ResultBean<LoanCreateSchedulePdfVo> loanCreateSchedule(String salesOrderSid) {
return loanRepaymentScheduleService.loanCreateSchedule(salesOrderSid);
}
@Override
public ResultBean<String> loanCreateSchedulePdf(LoanCreateSchedulePdfVo dto) {
return loanRepaymentScheduleService.loanCreateSchedulePdf(dto);
}
@Override
public ResultBean<LoanCreateScheduleVinsVo> viewVinsSchedule(String salesOrderSid) {
return loanRepaymentScheduleService.viewVinsSchedule(salesOrderSid);
}
@Override
public ResultBean<List<LoanCreateScheduleVinOneVo>> viewVinOneSchedule(String salesOrderSid) {
return loanRepaymentScheduleService.viewVinOneSchedule(salesOrderSid);
}
}

510
anrui-riskcenter/anrui-riskcenter-biz/src/main/java/com/yxt/anrui/riskcenter/biz/loanrepaymentschedule/LoanRepaymentScheduleService.java

@ -0,0 +1,510 @@
package com.yxt.anrui.riskcenter.biz.loanrepaymentschedule;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.date.DateUtil;
import com.yxt.anrui.buscenter.api.bussalesorderloancontract.BusSalesOrderLoancontract;
import com.yxt.anrui.buscenter.api.bussalesorderloancontract.BusSalesOrderLoancontractFeign;
import com.yxt.anrui.buscenter.api.bussalesordervehicle.BusSalesOrderVehicle;
import com.yxt.anrui.buscenter.api.bussalesordervehicle.BusSalesOrderVehicleFeign;
import com.yxt.anrui.buscenter.api.busvehicledatahandover.BusDataListPdfVo;
import com.yxt.anrui.buscenter.api.busvehicledatahandover.BusVehicleDataHandoverPdfVo;
import com.yxt.anrui.portal.api.sysorganization.SysOrganizationFeign;
import com.yxt.anrui.portal.api.sysstafforg.SysStaffOrgFeign;
import com.yxt.anrui.portal.api.sysuser.SysUserFeign;
import com.yxt.anrui.riskcenter.api.loanrepaymentschedule.*;
import com.yxt.anrui.riskcenter.api.loansolutions.LoanSolutions;
import com.yxt.anrui.riskcenter.api.loansolutionsotherpolicy.LoanSolutionsOtherpolicy;
import com.yxt.anrui.riskcenter.biz.loansolutions.LoanSolutionsService;
import com.yxt.anrui.riskcenter.biz.loansolutionsotherpolicy.LoanSolutionsOtherpolicyService;
import com.yxt.common.base.config.component.DocPdfComponent;
import com.yxt.common.base.service.MybatisBaseService;
import com.yxt.common.base.utils.StringUtils;
import com.yxt.common.base.utils.WordConvertUtils;
import com.yxt.common.core.result.ResultBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.io.File;
import java.io.InputStream;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.*;
import java.util.stream.Collectors;
/**
* @description:
* @author: fan
* @date: 2023/8/21
**/
@Service
public class LoanRepaymentScheduleService extends MybatisBaseService<LoanRepaymentScheduleMapper, LoanRepaymentSchedule> {
@Autowired
private SysUserFeign sysUserFeign;
@Autowired
private SysStaffOrgFeign sysStaffOrgFeign;
@Autowired
private SysOrganizationFeign sysOrganizationFeign;
@Autowired
private BusSalesOrderLoancontractFeign busSalesOrderLoancontractFeign;
@Autowired
private LoanSolutionsService loanSolutionsService;
@Autowired
private LoanSolutionsOtherpolicyService loanSolutionsOtherpolicyService;
@Autowired
private BusSalesOrderVehicleFeign busSalesOrderVehicleFeign;
@Autowired
private DocPdfComponent docPdfComponent;
/**
* 根据销售订单SID生成还款计划表回显
*
* @param salesOrderSid
* @return
*/
public ResultBean<LoanCreateSchedulePdfVo> loanCreateSchedule(String salesOrderSid) {
ResultBean<LoanCreateSchedulePdfVo> rb = ResultBean.fireFail();
LoanCreateSchedulePdfVo vo = new LoanCreateSchedulePdfVo();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
vo.setSalesOrderSid(salesOrderSid);
BusSalesOrderLoancontract loancontract = busSalesOrderLoancontractFeign.fetchDetailsByOrderSid(salesOrderSid).getData();
if (null != loancontract) {
// 消贷合同编号
if (StringUtils.isNotBlank(loancontract.getLoanCotractNo())) {
vo.setLoanContractNo(loancontract.getLoanCotractNo());
}
// 贷款人车辆台数
if (null != (loancontract.getVehCount())) {
vo.setVehCount(loancontract.getVehCount().toString());
}
// 贷款人
if (StringUtils.isNotBlank(loancontract.getBorrowerName())) {
vo.setBorrowerName(loancontract.getBorrowerName());
}
}
LoanSolutions loanSolutions = loanSolutionsService.selectBySaleOrderSid(salesOrderSid);
if (null != loanSolutions) {
// 产品方案sid
vo.setSolutionsSid(loanSolutions.getSid());
// 主金融产品
if (StringUtils.isNotBlank(loanSolutions.getPolicyName())) {
vo.setPolicyName(loanSolutions.getPolicyName());
}
// 主产品贷款金额
if (null != loanSolutions.getLoanAmount()) {
vo.setLoanAmount(loanSolutions.getLoanAmount().toString());
}
// 主产品期数
if (StringUtils.isNotBlank(loanSolutions.getLoanPeriod())) {
vo.setMainPeriod(loanSolutions.getLoanPeriod());
}
LoanRepaymentSchedule schedule = baseMapper.selectByOrderSid(salesOrderSid);
if (null != schedule) {
// 主产品首期还款日
if (null != schedule.getMainRepayDate()) {
vo.setMainRepayDate(sdf.format(schedule.getMainRepayDate()));
}
// 主产品首期月还
if (null != schedule.getMainFirstRepay()) {
vo.setMainFirstRepay(schedule.getMainFirstRepay().toString());
}
// 主产品期间月还
if (null != schedule.getMainMidRepay()) {
vo.setMainMidRepay(schedule.getMainMidRepay().toString());
}
// 主产品期末月还
if (null != schedule.getMainLastRepay()) {
vo.setMainLastRepay(schedule.getMainLastRepay().toString());
}
}
//查看是否有其他融
LoanSolutionsOtherpolicy otherpolicy = loanSolutionsOtherpolicyService.selectByLoanSid(loanSolutions.getSid());
if (null != otherpolicy) {
if (StringUtils.isNotBlank(otherpolicy.getOtherPolicyPeriod())) {
vo.setIsOtherPolicy("1");
// 其他融产品
if (StringUtils.isNotBlank(otherpolicy.getOtherPolicyName())) {
vo.setOtherPolicyName(otherpolicy.getOtherPolicyName());
}
// 其他融贷款金额
if (null != otherpolicy.getOtherPolicyAmount()) {
vo.setOtherAmount(otherpolicy.getOtherPolicyAmount().toString());
}
// 其他融期数
if (StringUtils.isNotBlank(otherpolicy.getOtherPolicyPeriod())) {
vo.setOtherPeriod(otherpolicy.getOtherPolicyPeriod());
}
if (null != schedule) {
// 其他融首期还款日
if (null != schedule.getOtherRepayDate()) {
vo.setOtherRepayDate(sdf.format(schedule.getOtherRepayDate()));
}
// 其他融首期月还
if (null != schedule.getOtherFirstRepay()) {
vo.setOtherFirstRepay(schedule.getOtherFirstRepay().toString());
}
// 其他融期间月还
if (null != schedule.getOtherMidRepay()) {
vo.setOtherMidRepay(schedule.getOtherMidRepay().toString());
}
// 其他融期末月还
if (null != schedule.getOtherLastRepay()) {
vo.setOtherLastRepay(schedule.getOtherLastRepay().toString());
}
}
} else {
vo.setIsOtherPolicy("0");
}
}
}
return rb.success().setData(vo);
}
/**
* 生成还款计划表pdf
*
* @param dto
* @return
*/
@Transactional(rollbackFor = Exception.class)
public ResultBean<String> loanCreateSchedulePdf(LoanCreateSchedulePdfVo dto) {
ResultBean<String> rb = ResultBean.fireFail();
LoanRepaymentSchedule loanRepaymentSchedule = baseMapper.selectByOrderSid(dto.getSalesOrderSid());
if (StringUtils.isBlank(dto.getMainRepayDate())) {
return rb.setMsg("请选择主金融产品首期还款日!");
}
if (StringUtils.isBlank(dto.getMainFirstRepay())) {
return rb.setMsg("请填写主金融产品首期月还!");
}
if (StringUtils.isBlank(dto.getMainMidRepay())) {
return rb.setMsg("请填写主金融产品期间月还!");
}
if (StringUtils.isBlank(dto.getMainLastRepay())) {
return rb.setMsg("请填写主金融产品末期月还!");
}
if (dto.getIsOtherPolicy().equals("1")) {
if (StringUtils.isBlank(dto.getOtherRepayDate())) {
return rb.setMsg("请选择其他融首期还款日!");
}
if (StringUtils.isBlank(dto.getOtherFirstRepay())) {
return rb.setMsg("请填写其他融首期月还!");
}
if (StringUtils.isBlank(dto.getOtherMidRepay())) {
return rb.setMsg("请填写其他融期间月还!");
}
if (StringUtils.isBlank(dto.getOtherLastRepay())) {
return rb.setMsg("请填写其他融末期月还!");
}
}
if (null != loanRepaymentSchedule) {
BeanUtil.copyProperties(dto, loanRepaymentSchedule, "id", "sid");
baseMapper.updateById(loanRepaymentSchedule);
} else {
LoanRepaymentSchedule entity = new LoanRepaymentSchedule();
BeanUtil.copyProperties(dto, entity, "id", "sid");
List<BusSalesOrderVehicle> busSalesOrderVehicles = busSalesOrderVehicleFeign.selectListByOrderSid(dto.getSalesOrderSid()).getData();
busSalesOrderVehicles.removeAll(Collections.singleton(null));
if (!busSalesOrderVehicles.isEmpty()) {
List<String> stringVinNos = busSalesOrderVehicles.stream().map(c -> c.getLinkNo()).collect(Collectors.toList());
if (!stringVinNos.isEmpty()) {
entity.setVinNo(String.join(",", stringVinNos));
}
}
BusSalesOrderLoancontract loancontract = busSalesOrderLoancontractFeign.fetchDetailsByOrderSid(dto.getSalesOrderSid()).getData();
if (null != loancontract) {
if (StringUtils.isNotBlank(loancontract.getBorrowerSid())) {
entity.setBorrowerSid(loancontract.getBorrowerSid());
}
if (StringUtils.isNotBlank(loancontract.getBankName())) {
entity.setBankName(loancontract.getBankName());
}
}
baseMapper.insert(entity);
}
// 生成还款计划表pdf
String template = "/template/";
String returnPath = "";
LoanCreateScheduleVinsVo createScheduleVinsVo = viewVinsSchedule(dto.getSalesOrderSid()).getData();
if (null != createScheduleVinsVo) {
String pdfPath = commonCreatePdf(createScheduleVinsVo);
String filePath = pdfPath.substring(docPdfComponent.getUploadTemplateUrl().length());
returnPath = template + filePath;
LoanRepaymentSchedule entity = baseMapper.selectByOrderSid(dto.getSalesOrderSid());
if (null != entity) {
entity.setSchedulePath(filePath);
baseMapper.updateById(entity);
}
}
return rb.success().setData(returnPath);
}
/**
* 还款计划表多台回显
*
* @param salesOrderSid
* @return
*/
public ResultBean<LoanCreateScheduleVinsVo> viewVinsSchedule(String salesOrderSid) {
ResultBean<LoanCreateScheduleVinsVo> rb = ResultBean.fireFail();
LoanCreateScheduleVinsVo vo = new LoanCreateScheduleVinsVo();
BusSalesOrderLoancontract loancontract = busSalesOrderLoancontractFeign.fetchDetailsByOrderSid(salesOrderSid).getData();
if (null != loancontract) {
if (StringUtils.isNotBlank(loancontract.getBankName())) {
vo.setBankName(loancontract.getBankName());
}
}
LoanRepaymentSchedule schedule = baseMapper.selectByOrderSid(salesOrderSid);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
String mainDate = "";
String otherDate = "";
String isOther = "";
BigDecimal mainF = new BigDecimal(0);
BigDecimal otherF = new BigDecimal(0);
BigDecimal mainM = new BigDecimal(0);
BigDecimal otherM = new BigDecimal(0);
BigDecimal mainL = new BigDecimal(0);
BigDecimal otherL = new BigDecimal(0);
if (null != schedule) {
BeanUtil.copyProperties(schedule, vo);
if (null != schedule.getMainRepayDate()) {
mainDate = sdf.format(schedule.getMainRepayDate());
}
if (null != schedule.getOtherRepayDate()) {
otherDate = sdf.format(schedule.getOtherRepayDate());
}
//主产品月还日
if (StringUtils.isNotBlank(mainDate)) {
String[] splitMainDate = mainDate.split("-");
String day = splitMainDate[2];
if (day.length() == 2 && Integer.parseInt(day) >= 10) {
vo.setMainRepayDate(day);
} else {
vo.setMainRepayDate(day.replace("0", ""));
}
}
//其他融月还日
if (StringUtils.isNotBlank(otherDate)) {
String[] splitOtherDate = otherDate.split("-");
String day = splitOtherDate[2];
if (day.length() == 2 && Integer.parseInt(day) >= 10) {
vo.setOtherRepayDate(day);
} else {
vo.setOtherRepayDate(day.replace("0", ""));
}
}
//月还金额
if (null != schedule.getMainFirstRepay()) {
mainF = schedule.getMainFirstRepay();
}
if (null != schedule.getMainMidRepay()) {
mainM = schedule.getMainMidRepay();
}
if (null != schedule.getMainLastRepay()) {
mainL = schedule.getMainLastRepay();
}
if (null != schedule.getOtherFirstRepay()) {
otherF = schedule.getOtherFirstRepay();
}
if (null != schedule.getOtherMidRepay()) {
otherM = schedule.getOtherMidRepay();
}
if (null != schedule.getOtherLastRepay()) {
otherL = schedule.getOtherLastRepay();
}
//-----还款计划表列表信息-------
List<LoanCreateScheduleVinsListVo> scheduleVins = new ArrayList<>();
if (StringUtils.isNotBlank(schedule.getMainPeriod())) {
int mainPeriod = Integer.parseInt(schedule.getMainPeriod());
if (StringUtils.isNotBlank(schedule.getIsOtherPolicy())) {
isOther = schedule.getIsOtherPolicy();
}
String otherPer = "";
if (StringUtils.isNotBlank(schedule.getOtherPeriod())) {
otherPer = schedule.getOtherPeriod();
}
int otherMidPer = 0;
int otherLastPer = 0;
String month = "";
String year = "";
String moth = "";
String otherMoth = "";
String otherFDate = "";
String otherMonth = "";
if (StringUtils.isNotBlank(mainDate)) {
String[] splitMain = mainDate.split("-");
year = splitMain[0];
moth = splitMain[1];
if (moth.length() == 2 && Integer.parseInt(moth) >= 10) {
month = moth;
} else {
month = moth.replace("0", "");
}
}
if (StringUtils.isNotBlank(otherDate)) {
String[] splitOther = otherDate.split("-");
otherMoth = splitOther[1];
if (otherMoth.length() == 2 && Integer.parseInt(otherMoth) >= 10) {
otherMonth = otherMoth;
} else {
otherMonth = otherMoth.replace("0", "");
}
otherFDate = splitOther[0] + otherMonth;
}
for (int i = 1; i <= mainPeriod; i++) {
String yearMonth = year + month;
LoanCreateScheduleVinsListVo scheduleVo = new LoanCreateScheduleVinsListVo();
scheduleVo.setRepayMonth(year + "年" + month + "月");
scheduleVo.setPeriod(String.valueOf(i));
int m = Integer.parseInt(month);
month = String.valueOf(++m);
if (Integer.parseInt(month) > 12) {
int y = Integer.parseInt(year);
year = String.valueOf(++y);
month = "1";
}
if (isOther.equals("1")) {
//首期
if (i == 1) {
scheduleVo.setMainRepay(mainF.toString());
} else if (i == mainPeriod) {
scheduleVo.setMainRepay(mainL.toString());
} else {
scheduleVo.setMainRepay(mainM.toString());
}
if ((yearMonth.equals(otherFDate))) {
scheduleVo.setOtherRepay(otherF.toString());
scheduleVo.setAmount((new BigDecimal(scheduleVo.getMainRepay()).add(otherF)).toString());
otherMidPer = (i + Integer.parseInt(otherPer)) - 2;
otherLastPer = (i + Integer.parseInt(otherPer)) - 1;
} else if (i <= otherMidPer && otherMidPer != 0) {
scheduleVo.setOtherRepay(otherM.toString());
scheduleVo.setAmount((new BigDecimal(scheduleVo.getMainRepay()).add(otherM)).toString());
} else if (i == otherLastPer && otherLastPer != 0) {
scheduleVo.setOtherRepay(otherL.toString());
scheduleVo.setAmount((new BigDecimal(scheduleVo.getMainRepay()).add(otherL)).toString());
} else if (scheduleVo.getOtherRepay() == null || "".equals(scheduleVo.getOtherRepay())) {
scheduleVo.setAmount(scheduleVo.getMainRepay());
scheduleVo.setOtherRepay("");
}
} else if (isOther.equals("0")) {
//首期
if (i == 1) {
scheduleVo.setMainRepay(mainF.toString());
} else if (i == mainPeriod) {
scheduleVo.setMainRepay(mainL.toString());
} else {
scheduleVo.setMainRepay(mainM.toString());
}
if (scheduleVo.getOtherRepay() == null || "".equals(scheduleVo.getOtherRepay())) {
scheduleVo.setAmount(scheduleVo.getMainRepay());
scheduleVo.setOtherRepay("");
}
}
scheduleVins.add(scheduleVo);
}
if (!scheduleVins.isEmpty()) {
vo.setScheduleVins(scheduleVins);
}
}
}
return rb.success().setData(vo);
}
/**
* 生成pdf
*
* @param pdfVo
* @return
*/
public String commonCreatePdf(LoanCreateScheduleVinsVo pdfVo) {
Map<String, Object> dataMap = new HashMap<String, Object>();
List<LoanCreateScheduleVinsListVo> pdfVos = pdfVo.getScheduleVins();
List<Map<String, Object>> newList = new ArrayList<>();
dataMap.put("loanContractNo", pdfVo.getLoanContractNo());
dataMap.put("borrowerName", pdfVo.getBorrowerName());
dataMap.put("vehCount", pdfVo.getVehCount());
dataMap.put("bankName", pdfVo.getBankName());
dataMap.put("vinNo", pdfVo.getVinNo());
dataMap.put("mainRepayDate", pdfVo.getMainRepayDate());
if (StringUtils.isNotBlank(pdfVo.getOtherRepayDate())) {
dataMap.put("otherRepayDate", pdfVo.getOtherRepayDate());
}
if (!pdfVos.isEmpty()) {
for (LoanCreateScheduleVinsListVo detailsVo : pdfVos) {
Map<String, Object> map = new HashMap<>();
map.put("period", detailsVo.getPeriod());
map.put("repayMonth", detailsVo.getRepayMonth());
map.put("mainRepay", detailsVo.getMainRepay());
if (StringUtils.isNotBlank(detailsVo.getOtherRepay())) {
map.put("otherRepay", detailsVo.getOtherRepay());
}
map.put("amount", detailsVo.getAmount());
newList.add(map);
}
}
dataMap.put("newList", newList);
String path = "";
String targetPath = docPdfComponent.getUploadTemplateUrl();
try {
String ftl = "";
if (pdfVo.getIsOtherPolicy().equals("0")) {
ftl = "ftl/mainSchedule.ftl";
} else if (pdfVo.getIsOtherPolicy().equals("1")) {
ftl = "ftl/otherSchedule.ftl";
}
//获取模板
InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream(ftl);
//生成word文件名
String dateStr = DateUtil.format(new Date(), "yyyyMMdd");
long seconds = System.currentTimeMillis();
String typeName = dateStr + seconds + ".doc";
File file = new File(targetPath + "repaymentSchedule" + seconds + ".ftl");
File dir = new File(targetPath);
WordConvertUtils.inputStreamToFile(inputStream, file);
WordConvertUtils.creatWord1(dataMap, file, targetPath, typeName, dir);
//新生成的word路径
String wordPath = targetPath + typeName;
//生成出门证文件名
String pdfName = "还款计划表" + dateStr + seconds + ".pdf";
WordConvertUtils.doc2pdf(wordPath, targetPath, pdfName);
path = targetPath + pdfName;
} catch (NoClassDefFoundError e) {
e.printStackTrace();
path = targetPath + "temp";
}
return path;
}
public ResultBean<List<LoanCreateScheduleVinOneVo>> viewVinOneSchedule(String salesOrderSid) {
ResultBean<List<LoanCreateScheduleVinOneVo>> rb = ResultBean.fireFail();
List<LoanCreateScheduleVinOneVo> list = new ArrayList<>();
LoanRepaymentSchedule schedule = baseMapper.selectByOrderSid(salesOrderSid);
LoanCreateScheduleVinsVo scheduleVinsVo = viewVinsSchedule(salesOrderSid).getData();
if (null != schedule) {
if (StringUtils.isNotBlank(schedule.getVinNo())) {
if (!schedule.getVinNo().contains(",")) {
LoanCreateScheduleVinOneVo vinOneVo = new LoanCreateScheduleVinOneVo();
if (null != scheduleVinsVo) {
BeanUtil.copyProperties(scheduleVinsVo, vinOneVo);
list.add(vinOneVo);
}
} else {
String vinNos = schedule.getVinNo();
String[] split = vinNos.split(",");
for (int i = 0; i < split.length; i++) {
LoanCreateScheduleVinOneVo vinOneVo = new LoanCreateScheduleVinOneVo();
if (null != scheduleVinsVo) {
BeanUtil.copyProperties(scheduleVinsVo, vinOneVo);
vinOneVo.setVinNo(split[i]);
list.add(vinOneVo);
}
}
}
}
}
return rb.success().setData(list);
}
}

12
anrui-riskcenter/anrui-riskcenter-biz/src/main/java/com/yxt/anrui/riskcenter/biz/loanwarrantinformation/LoanWarrantInformationService.java

@ -136,10 +136,14 @@ public class LoanWarrantInformationService extends MybatisBaseService<LoanWarran
if (StringUtils.isNotBlank(pagerQuery.getVinNo())) {
qw.like("vinNo", pagerQuery.getVinNo());
}
//资方
//状态
if (StringUtils.isNotBlank(pagerQuery.getAuditStateKey())) {
qw.eq("auditStateKey", pagerQuery.getAuditStateKey());
}
//状态
if (StringUtils.isNotBlank(pagerQuery.getBankName())) {
qw.like("bankName", pagerQuery.getBankName());
}
String createStartTime = pagerQuery.getStartTime();
String createEndTime = pagerQuery.getEndTime();
qw.apply(StringUtils.isNotEmpty(createStartTime), "date_format (transferDate,'%Y-%m-%d') >= date_format('" + createStartTime + "','%Y-%m-%d')").
@ -278,6 +282,9 @@ public class LoanWarrantInformationService extends MybatisBaseService<LoanWarran
if (StringUtils.isNotBlank(entity.getBankName())) {
vo.setBankName(entity.getBankName());
}
if (StringUtils.isNotBlank(entity.getTransferInformationKey())) {
vo.setTransferInformationKey(entity.getTransferInformationKey());
}
if (StringUtils.isNotBlank(entity.getTransferInformation())) {
vo.setTransferInformation(entity.getTransferInformation());
}
@ -353,6 +360,9 @@ public class LoanWarrantInformationService extends MybatisBaseService<LoanWarran
if (StringUtils.isNotBlank(entity.getTransferRemarks())) {
vo.setTransferRemarks(entity.getTransferRemarks());
}
if (StringUtils.isNotBlank(entity.getTransferInformationKey())) {
vo.setTransferInformationKey(entity.getTransferInformationKey());
}
if (StringUtils.isNotBlank(entity.getTransferInformation())) {
vo.setTransferInformation(entity.getTransferInformation());
}

1397
anrui-riskcenter/anrui-riskcenter-biz/src/main/resources/ftl/mainSchedule.ftl

File diff suppressed because it is too large

1533
anrui-riskcenter/anrui-riskcenter-biz/src/main/resources/ftl/otherSchedule.ftl

File diff suppressed because it is too large
Loading…
Cancel
Save