|
@ -1,6 +1,7 @@ |
|
|
package com.yxt.anrui.riskcenter.biz.loanrepaymentschedule; |
|
|
package com.yxt.anrui.riskcenter.biz.loanrepaymentschedule; |
|
|
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil; |
|
|
import cn.hutool.core.bean.BeanUtil; |
|
|
|
|
|
import cn.hutool.core.date.DateTime; |
|
|
import cn.hutool.core.date.DateUtil; |
|
|
import cn.hutool.core.date.DateUtil; |
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
@ -39,6 +40,7 @@ import com.yxt.anrui.riskcenter.api.loanrepaymentplandetails.LoanRepaymentPlanDe |
|
|
import com.yxt.anrui.riskcenter.api.loanrepaymentplandetails.LoanRepaymentPlanDetailsDto; |
|
|
import com.yxt.anrui.riskcenter.api.loanrepaymentplandetails.LoanRepaymentPlanDetailsDto; |
|
|
import com.yxt.anrui.riskcenter.api.loanrepaymentschedule.*; |
|
|
import com.yxt.anrui.riskcenter.api.loanrepaymentschedule.*; |
|
|
import com.yxt.anrui.riskcenter.api.loanrepaymentschedule.historyData.HistoryDataImportVo; |
|
|
import com.yxt.anrui.riskcenter.api.loanrepaymentschedule.historyData.HistoryDataImportVo; |
|
|
|
|
|
import com.yxt.anrui.riskcenter.api.loanrepaymentschedule.historyData.ReturnMsg; |
|
|
import com.yxt.anrui.riskcenter.api.loansolutions.LoanSolutions; |
|
|
import com.yxt.anrui.riskcenter.api.loansolutions.LoanSolutions; |
|
|
import com.yxt.anrui.riskcenter.api.loansolutions.app.SolutionsDetailsVo; |
|
|
import com.yxt.anrui.riskcenter.api.loansolutions.app.SolutionsDetailsVo; |
|
|
import com.yxt.anrui.riskcenter.api.loansolutionsotherpolicy.LoanSolutionsOtherpolicy; |
|
|
import com.yxt.anrui.riskcenter.api.loansolutionsotherpolicy.LoanSolutionsOtherpolicy; |
|
@ -62,11 +64,20 @@ import com.yxt.common.core.vo.PagerVo; |
|
|
import com.yxt.messagecenter.api.message.MessageFeign; |
|
|
import com.yxt.messagecenter.api.message.MessageFeign; |
|
|
import com.yxt.messagecenter.api.message.PushMessageQuery; |
|
|
import com.yxt.messagecenter.api.message.PushMessageQuery; |
|
|
import com.yxt.messagecenter.api.message.PushSmsDto; |
|
|
import com.yxt.messagecenter.api.message.PushSmsDto; |
|
|
|
|
|
import org.apache.poi.hssf.usermodel.HSSFWorkbook; |
|
|
|
|
|
import org.apache.poi.ss.usermodel.Cell; |
|
|
|
|
|
import org.apache.poi.ss.usermodel.Row; |
|
|
|
|
|
import org.apache.poi.ss.usermodel.Sheet; |
|
|
|
|
|
import org.apache.poi.ss.usermodel.Workbook; |
|
|
|
|
|
import org.apache.poi.xssf.usermodel.XSSFWorkbook; |
|
|
import org.apache.tomcat.util.threads.ThreadPoolExecutor; |
|
|
import org.apache.tomcat.util.threads.ThreadPoolExecutor; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.stereotype.Service; |
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
import org.springframework.web.multipart.MultipartFile; |
|
|
|
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest; |
|
|
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
import java.io.File; |
|
|
import java.io.File; |
|
|
import java.io.InputStream; |
|
|
import java.io.InputStream; |
|
|
import java.math.BigDecimal; |
|
|
import java.math.BigDecimal; |
|
@ -75,6 +86,8 @@ import java.text.SimpleDateFormat; |
|
|
import java.util.*; |
|
|
import java.util.*; |
|
|
import java.util.concurrent.*; |
|
|
import java.util.concurrent.*; |
|
|
import java.util.function.Function; |
|
|
import java.util.function.Function; |
|
|
|
|
|
import java.util.regex.Matcher; |
|
|
|
|
|
import java.util.regex.Pattern; |
|
|
import java.util.stream.Collectors; |
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -4986,4 +4999,253 @@ public class LoanRepaymentScheduleService extends MybatisBaseService<LoanRepayme |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public ResultBean importHistoryData(MultipartFile file, HttpServletRequest request, HttpServletResponse response) { |
|
|
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
|
|
try { |
|
|
|
|
|
String temp = request.getSession().getServletContext().getRealPath(File.separator) + "temp";// 临时目录
|
|
|
|
|
|
File tempFile = new File(temp); |
|
|
|
|
|
if (!tempFile.exists()) { |
|
|
|
|
|
tempFile.mkdirs(); |
|
|
|
|
|
} |
|
|
|
|
|
String fileName = file.getOriginalFilename(); |
|
|
|
|
|
if (!fileName.matches("^.+\\.(?i)(xls)$") && !fileName.matches("^.+\\.(?i)(xlsx)$")) { |
|
|
|
|
|
return rb.fail().setMsg("上传文件不正确"); |
|
|
|
|
|
} |
|
|
|
|
|
boolean isExcel2003 = true; |
|
|
|
|
|
if (fileName.matches("^.+\\.(?i)(xlsx)$")) { |
|
|
|
|
|
isExcel2003 = false; |
|
|
|
|
|
} |
|
|
|
|
|
InputStream is = file.getInputStream(); |
|
|
|
|
|
Workbook wb = null; |
|
|
|
|
|
if (isExcel2003) { |
|
|
|
|
|
wb = new HSSFWorkbook(is); |
|
|
|
|
|
} else { |
|
|
|
|
|
wb = new XSSFWorkbook(is); |
|
|
|
|
|
} |
|
|
|
|
|
Sheet sheet = wb.getSheetAt(0); |
|
|
|
|
|
ReturnMsg returnMsg = getSheetVal(sheet); |
|
|
|
|
|
Set<String> setMsg = returnMsg.getSetMsg(); |
|
|
|
|
|
StringBuffer sbMsg = new StringBuffer(); |
|
|
|
|
|
if (null != setMsg && setMsg.size() > 0) { |
|
|
|
|
|
for (String s : setMsg) { |
|
|
|
|
|
sbMsg.append(s).append(","); |
|
|
|
|
|
} |
|
|
|
|
|
sbMsg.delete(sbMsg.length() - 1, sbMsg.length()); |
|
|
|
|
|
if (StringUtils.isNotBlank(sbMsg.toString())) { |
|
|
|
|
|
return rb.setMsg(sbMsg.toString()); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
e.printStackTrace(); |
|
|
|
|
|
} |
|
|
|
|
|
return rb.success(); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private ReturnMsg getSheetVal(Sheet sheet) { |
|
|
|
|
|
ReturnMsg returnMsg = new ReturnMsg(); |
|
|
|
|
|
List<HistoryDataImportVo> voList = new ArrayList<>(); |
|
|
|
|
|
Set<String> setMsg = new HashSet<>(); |
|
|
|
|
|
Row row1 = sheet.getRow(0); |
|
|
|
|
|
Map<Integer, String> header = new HashMap<>(); |
|
|
|
|
|
Map<String, String> map = new HashMap<>(); |
|
|
|
|
|
for (int i = 0; i < row1.getPhysicalNumberOfCells(); i++) { |
|
|
|
|
|
String trim = new String(); |
|
|
|
|
|
try { |
|
|
|
|
|
trim = getCellVal(row1.getCell(i)).toString().trim(); |
|
|
|
|
|
String temp = getCellVal(row1.getCell(i)).toString().trim(); |
|
|
|
|
|
if (StringUtils.isNotBlank(temp)) { |
|
|
|
|
|
header.put(i, temp); |
|
|
|
|
|
} |
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
e.printStackTrace(); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
for (int r = 1; r <= sheet.getLastRowNum(); r++) { |
|
|
|
|
|
HistoryDataImportVo info = new HistoryDataImportVo(); |
|
|
|
|
|
Row row = sheet.getRow(r); |
|
|
|
|
|
if (row == null) { |
|
|
|
|
|
continue; |
|
|
|
|
|
} |
|
|
|
|
|
for (int i = 0; i < header.size(); i++) { |
|
|
|
|
|
// String trim = new String();
|
|
|
|
|
|
try { |
|
|
|
|
|
// trim = getCellVal(row.getCell(i)).toString().trim();
|
|
|
|
|
|
String temp = ""; |
|
|
|
|
|
if (null != getCellVal(row.getCell(i))) { |
|
|
|
|
|
temp = getCellVal(row.getCell(i)).toString().trim(); |
|
|
|
|
|
} |
|
|
|
|
|
String head = header.get(i); |
|
|
|
|
|
String field = ""; |
|
|
|
|
|
if (StringUtils.isNotBlank(temp)) { |
|
|
|
|
|
field = temp; |
|
|
|
|
|
} |
|
|
|
|
|
if (head.equals("实际购车人名称")) { |
|
|
|
|
|
info.setActualName(field); |
|
|
|
|
|
} |
|
|
|
|
|
if (head.equals("实际购车人电话")) { |
|
|
|
|
|
info.setActualPhone(field); |
|
|
|
|
|
} |
|
|
|
|
|
if (head.equals("借款人(财务的客户)编码")) { |
|
|
|
|
|
info.setBorrowerNo(field); |
|
|
|
|
|
} |
|
|
|
|
|
if (head.equals("借款人(财务的客户)名称")) { |
|
|
|
|
|
info.setBorrowerName(field); |
|
|
|
|
|
} |
|
|
|
|
|
if (head.equals("车架号")) { |
|
|
|
|
|
info.setVinNo(field); |
|
|
|
|
|
} |
|
|
|
|
|
if (head.equals("消贷合同编号")) { |
|
|
|
|
|
info.setLoanContractNo(field); |
|
|
|
|
|
} |
|
|
|
|
|
if (head.equals("是否存在休眠或展期")) { |
|
|
|
|
|
info.setSleep(field); |
|
|
|
|
|
} |
|
|
|
|
|
if (head.equals("主产品资方合同号")) { |
|
|
|
|
|
info.setBankContractNo(field); |
|
|
|
|
|
} |
|
|
|
|
|
if (head.equals("主产品资方名称")) { |
|
|
|
|
|
info.setBankName(field); |
|
|
|
|
|
} |
|
|
|
|
|
if (head.equals("主产品期数")) { |
|
|
|
|
|
info.setMainPeriod(field); |
|
|
|
|
|
} |
|
|
|
|
|
if (head.equals("金融产品首付比例")) { |
|
|
|
|
|
info.setPaymentRatio(field); |
|
|
|
|
|
} |
|
|
|
|
|
if (head.equals("金融产品保证金比例")) { |
|
|
|
|
|
info.setDepositRatio(field); |
|
|
|
|
|
} |
|
|
|
|
|
if (head.equals("实收保证金金额")) { |
|
|
|
|
|
info.setDepositMoney(field); |
|
|
|
|
|
} |
|
|
|
|
|
if (head.equals("其他融资方合同号")) { |
|
|
|
|
|
info.setOtherBankNo(field); |
|
|
|
|
|
} |
|
|
|
|
|
if (head.equals("其他融资方名称")) { |
|
|
|
|
|
info.setOtherBankName(field); |
|
|
|
|
|
} |
|
|
|
|
|
if (head.equals("其他融期数")) { |
|
|
|
|
|
info.setOtherPeriod(field); |
|
|
|
|
|
} |
|
|
|
|
|
if (head.equals("主产品首期应还日期")) { |
|
|
|
|
|
info.setMainRepayDate(field); |
|
|
|
|
|
} |
|
|
|
|
|
if (head.equals("主产品第一期应还金额")) { |
|
|
|
|
|
info.setMainFirstRepay(field); |
|
|
|
|
|
} |
|
|
|
|
|
if (head.equals("主产品中间期")) { |
|
|
|
|
|
info.setMainMidRepay(field); |
|
|
|
|
|
} |
|
|
|
|
|
if (head.equals("主产品最后一期应还金额")) { |
|
|
|
|
|
info.setMainLastRepay(field); |
|
|
|
|
|
} |
|
|
|
|
|
if (head.equals("其他融首期应还日期")) { |
|
|
|
|
|
info.setOtherRepayDate(field); |
|
|
|
|
|
} |
|
|
|
|
|
if (head.equals("其他融第一期应还金额")) { |
|
|
|
|
|
info.setOtherFirstRepay(field); |
|
|
|
|
|
} |
|
|
|
|
|
if (head.equals("其他融中间期")) { |
|
|
|
|
|
info.setOtherMidRepay(field); |
|
|
|
|
|
} |
|
|
|
|
|
if (head.equals("其他融最后一期应还金额")) { |
|
|
|
|
|
info.setOtherLastRepay(field); |
|
|
|
|
|
} |
|
|
|
|
|
if (head.equals("首期总月还")) { |
|
|
|
|
|
info.setMainAmount(field); |
|
|
|
|
|
} |
|
|
|
|
|
if (head.equals("销售部门编码")) { |
|
|
|
|
|
info.setSalesDeptNo(field); |
|
|
|
|
|
} |
|
|
|
|
|
if (head.equals("销售部门")) { |
|
|
|
|
|
info.setSalesDept(field); |
|
|
|
|
|
} |
|
|
|
|
|
if (head.equals("分公司编码")) { |
|
|
|
|
|
info.setUseOrgNo(field); |
|
|
|
|
|
} |
|
|
|
|
|
if (head.equals("分公司")) { |
|
|
|
|
|
info.setUseOrgName(field); |
|
|
|
|
|
} |
|
|
|
|
|
if (head.equals("累欠本金(逾期月还)")) { |
|
|
|
|
|
info.setTiredMoney(field); |
|
|
|
|
|
} |
|
|
|
|
|
if (head.equals("其中公司垫还资方金额")) { |
|
|
|
|
|
info.setPaymentMoney(field); |
|
|
|
|
|
} |
|
|
|
|
|
if (head.equals("垫还资方逾期利息")) { |
|
|
|
|
|
info.setInterest(field); |
|
|
|
|
|
} |
|
|
|
|
|
if (head.equals("资金占用费(逾期利息)")) { |
|
|
|
|
|
info.setFund(field); |
|
|
|
|
|
} |
|
|
|
|
|
} catch (Exception e) { |
|
|
|
|
|
e.printStackTrace(); |
|
|
|
|
|
continue; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
voList.add(info); |
|
|
|
|
|
} |
|
|
|
|
|
returnMsg.setList(voList); |
|
|
|
|
|
return returnMsg; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public Object getCellVal(Cell cell) { |
|
|
|
|
|
Object obj = null; |
|
|
|
|
|
if (cell != null) { |
|
|
|
|
|
switch (cell.getCellTypeEnum()) { |
|
|
|
|
|
case BOOLEAN: |
|
|
|
|
|
obj = cell.getBooleanCellValue(); |
|
|
|
|
|
break; |
|
|
|
|
|
case ERROR: |
|
|
|
|
|
obj = cell.getErrorCellValue(); |
|
|
|
|
|
break; |
|
|
|
|
|
case NUMERIC: |
|
|
|
|
|
obj = cell.getNumericCellValue(); |
|
|
|
|
|
break; |
|
|
|
|
|
case STRING: |
|
|
|
|
|
obj = cell.getStringCellValue(); |
|
|
|
|
|
break; |
|
|
|
|
|
default: |
|
|
|
|
|
break; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
return obj; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public boolean isNum(String s) { |
|
|
|
|
|
if (org.apache.commons.lang3.StringUtils.isNotBlank(s)) { |
|
|
|
|
|
if (s.contains(".")) { |
|
|
|
|
|
return isNumeric(s); |
|
|
|
|
|
} else { |
|
|
|
|
|
return isNumericFirst(s); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
return false; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public boolean isNumeric(String s) { |
|
|
|
|
|
String substring = s.substring(0, s.lastIndexOf(".")); |
|
|
|
|
|
String substringLast = s.substring(s.lastIndexOf(".") + 1, s.length()); |
|
|
|
|
|
if (substring != null && !"".equals(substring.trim()) || substringLast != null && !"".equals(substringLast.trim())) { |
|
|
|
|
|
boolean matches = substring.matches("^[0-9]*$"); |
|
|
|
|
|
boolean b = substringLast.matches("^[0-9]*$"); |
|
|
|
|
|
if (matches && b) { |
|
|
|
|
|
return true; |
|
|
|
|
|
} else { |
|
|
|
|
|
return false; |
|
|
|
|
|
} |
|
|
|
|
|
} else |
|
|
|
|
|
return false; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public boolean isNumericFirst(String str) { |
|
|
|
|
|
Pattern pattern = Pattern.compile("[0-9]*"); |
|
|
|
|
|
System.out.println(str); |
|
|
|
|
|
Matcher isNum = pattern.matcher(str); |
|
|
|
|
|
if (!isNum.matches()) { |
|
|
|
|
|
return false; |
|
|
|
|
|
} |
|
|
|
|
|
return true; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|