Browse Source

修改还款计划表下载功能

master
fanzongzhe0036 3 months ago
parent
commit
6fb758e361
  1. 3
      anrui-riskcenter/anrui-riskcenter-biz/src/main/java/com/yxt/anrui/riskcenter/biz/loanrepaymentschedule/LoanRepaymentScheduleMapper.java
  2. 5
      anrui-riskcenter/anrui-riskcenter-biz/src/main/java/com/yxt/anrui/riskcenter/biz/loanrepaymentschedule/LoanRepaymentScheduleMapper.xml
  3. 84
      anrui-riskcenter/anrui-riskcenter-biz/src/main/java/com/yxt/anrui/riskcenter/biz/loanrepaymentschedule/LoanRepaymentScheduleService.java

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

@ -14,7 +14,6 @@ import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;
import java.util.List;
import java.util.Map;
/**
@ -68,4 +67,6 @@ public interface LoanRepaymentScheduleMapper extends BaseMapper<LoanRepaymentSch
@Update("update `anrui_buscenter`.`bus_sales_order_loancontract` set `repaymentState`=0,`repaymentCreateTime`=NULL where bankContractNo=#{bankContractNo}")
void deleteScheduleLoanContractNo(@Param("bankContractNo")String bankContractNo);
String selAllDueMoneyByVinNo(@Param("sid") String sid, @Param("vinNo")String vinNo);
}

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

@ -216,4 +216,9 @@
FROM loan_repayment_plan_details AS p
WHERE p.vinNo LIKE CONCAT('%', #{vinNo}, '%') LIMIT 1
</select>
<select id="selAllDueMoneyByVinNo" resultType="java.lang.String">
SELECT SUM(dueMoney) as money
FROM loan_repayment_plan_details AS p
WHERE p.scheduleSid = #{sid} and p.vinNo = #{vinNo}
</select>
</mapper>

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

@ -2703,6 +2703,32 @@ public class LoanRepaymentScheduleService extends MybatisBaseService<LoanRepayme
String mainOrOther = "";
if (null != salesOrder) {
if (!vehicles.isEmpty()) {
String singleVinNo = "";
if (isDifferent.equals("1")) {
//查询每个车辆的还款总额,来判断哪个是与其他车辆不同的金额
Map<String,String> vinMap = new HashMap<>();
List<String> allDueMoneyList = new ArrayList<>();
for (BusSalesOrderVehicle vehicle : vehicles) {
String vinNo = "";
String linkNo = vehicle.getLinkNo();
if (vehicle.getLinkNo().length() > 8) {
vinNo = linkNo.substring(linkNo.length() - 8);
} else {
vinNo = linkNo;
}
String allDueMoney = baseMapper.selAllDueMoneyByVinNo(schedule.getSid(),vinNo);
vinMap.put(allDueMoney,vinNo);
allDueMoneyList.add(allDueMoney);
}
String singleDueMoney = allDueMoneyList.stream()
.collect(Collectors.groupingBy(Function.identity(), Collectors.counting()))
.entrySet().stream()
.filter(entry -> entry.getValue() == 1)
.findFirst()
.map(Map.Entry::getKey)
.orElseThrow(() -> new NoSuchElementException("未找到唯一元素"));
singleVinNo = vinMap.get(singleDueMoney);
}
for (BusSalesOrderVehicle busSalesOrderVehicle : vehicles) {
String vinNo = "";
String linkNo = busSalesOrderVehicle.getLinkNo();
@ -2883,14 +2909,26 @@ public class LoanRepaymentScheduleService extends MybatisBaseService<LoanRepayme
if (null != schedule.getMainRepayDate()) {
pdf.setDueDate(DateUtil.formatDate(schedule.getMainRepayDate()));
}
if (null != schedule.getMainFirstRepay() && null != schedule.getOtherFirstRepay()) {
pdf.setFMoney(schedule.getMainFirstRepay().toString() + "/" + schedule.getOtherFirstRepay());
}
if (null != schedule.getMainMidRepay() && null != schedule.getOtherMidRepay()) {
pdf.setMMoney(schedule.getMainMidRepay().toString() + "/" + schedule.getOtherMidRepay());
}
if (null != schedule.getMainLastRepay() && null != schedule.getOtherLastRepay()) {
pdf.setLMoney(schedule.getMainLastRepay().toString() + "/" + schedule.getOtherLastRepay());
if (isDifferent.equals("1") && singleVinNo.equals(vinNo)) {
if (null != schedule.getSingleOtherFirstRepay() && null != schedule.getSingleMainFirstRepay()) {
pdf.setFMoney(schedule.getSingleMainFirstRepay().toString()+ "/" +schedule.getSingleOtherFirstRepay().toString());
}
if (null != schedule.getSingleOtherMidRepay() && null != schedule.getSingleMainMidRepay()) {
pdf.setMMoney(schedule.getSingleMainMidRepay().toString()+ "/" +schedule.getSingleOtherMidRepay().toString());
}
if (null != schedule.getSingleOtherLastRepay() && null != schedule.getSingleMainLastRepay()) {
pdf.setLMoney(schedule.getSingleMainLastRepay().toString()+ "/" +schedule.getSingleOtherLastRepay().toString());
}
} else {
if (null != schedule.getMainFirstRepay() && null != schedule.getOtherFirstRepay()) {
pdf.setFMoney(schedule.getMainFirstRepay().toString() + "/" + schedule.getOtherFirstRepay());
}
if (null != schedule.getMainMidRepay() && null != schedule.getOtherMidRepay()) {
pdf.setMMoney(schedule.getMainMidRepay().toString() + "/" + schedule.getOtherMidRepay());
}
if (null != schedule.getMainLastRepay() && null != schedule.getOtherLastRepay()) {
pdf.setLMoney(schedule.getMainLastRepay().toString() + "/" + schedule.getOtherLastRepay());
}
}
String amountMoney = baseMapper.selSumAmountDueMoney(schedule.getSid(), vinNo, mainOrOther);
if (StringUtils.isNotBlank(amountMoney)) {
@ -2954,9 +2992,6 @@ public class LoanRepaymentScheduleService extends MybatisBaseService<LoanRepayme
}
}
}
System.out.println("------------------------");
System.out.println(pdfs);
System.out.println("------------------------");
return pdfs;
}
@ -3434,9 +3469,6 @@ public class LoanRepaymentScheduleService extends MybatisBaseService<LoanRepayme
String targetPath = docPdfComponent.getUploadTemplateUrl();
try {
File file = WordConvertUtils.mulFile2One(fileList2, targetPath + dateStr + seconds + "还款计划凭证.pdf");
System.out.println("===============================");
System.out.println(file.getAbsolutePath());
System.out.println("===============================");
} catch (Exception e) {
e.printStackTrace();
}
@ -3903,6 +3935,12 @@ public class LoanRepaymentScheduleService extends MybatisBaseService<LoanRepayme
BigDecimal otherM = new BigDecimal(0);
BigDecimal mainL = new BigDecimal(0);
BigDecimal otherL = new BigDecimal(0);
BigDecimal smainF = new BigDecimal(0);
BigDecimal sotherF = new BigDecimal(0);
BigDecimal smainM = new BigDecimal(0);
BigDecimal sotherM = new BigDecimal(0);
BigDecimal smainL = new BigDecimal(0);
BigDecimal sotherL = new BigDecimal(0);
if (null != schedule) {
if (schedule.getSameBank().equals("0")) {
BeanUtil.copyProperties(schedule, vo);
@ -3951,6 +3989,24 @@ public class LoanRepaymentScheduleService extends MybatisBaseService<LoanRepayme
if (null != schedule.getOtherLastRepay()) {
otherL = schedule.getOtherLastRepay();
}
if (null != schedule.getSingleMainFirstRepay()) {
smainF = schedule.getSingleMainFirstRepay();
}
if (null != schedule.getSingleMainMidRepay()) {
smainM = schedule.getSingleMainMidRepay();
}
if (null != schedule.getSingleMainLastRepay()) {
smainL = schedule.getSingleMainLastRepay();
}
if (null != schedule.getSingleOtherFirstRepay()) {
sotherF = schedule.getSingleOtherFirstRepay();
}
if (null != schedule.getSingleOtherMidRepay()) {
sotherM = schedule.getSingleOtherMidRepay();
}
if (null != schedule.getSingleOtherLastRepay()) {
sotherL = schedule.getSingleOtherLastRepay();
}
//-----还款计划表列表信息-------
List<LoanCreateScheduleVinsListVo> scheduleVins = new ArrayList<>();
if (StringUtils.isNotBlank(schedule.getMainPeriod())) {

Loading…
Cancel
Save