|
|
@ -22,11 +22,13 @@ import com.yxt.anrui.portal.api.sysstafforg.SysStaffOrgFeign; |
|
|
|
import com.yxt.anrui.portal.api.sysuser.PrivilegeQuery; |
|
|
|
import com.yxt.anrui.portal.api.sysuser.SysUserFeign; |
|
|
|
import com.yxt.anrui.portal.api.sysuser.SysUserVo; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanbepadsincereapply.ReturnExcelInfo; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanoverduefin.*; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanoverduefin.flowable.OverdueApplyNodeQuery; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanoverduefin.flowable.OverdueApplyNodeVo; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanoverduefin.flowable.OverdueApplyTaskQuery; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanoverduefindetails.LoanOverdueFinDetailsDto; |
|
|
|
import com.yxt.anrui.riskcenter.api.loanrepaymentschedule.LoanRepaymentScheduleDetailsVo; |
|
|
|
import com.yxt.anrui.riskcenter.biz.loanoverduefindetails.LoanOverdueFinDetailsService; |
|
|
|
import com.yxt.common.base.config.component.FileUploadComponent; |
|
|
|
import com.yxt.common.base.service.MybatisBaseService; |
|
|
@ -38,12 +40,21 @@ import com.yxt.messagecenter.api.message.MessageFeign; |
|
|
|
import com.yxt.messagecenter.api.message.MessageFlowVo; |
|
|
|
import com.yxt.messagecenter.api.message.MessageFlowableQuery; |
|
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
|
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.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.web.multipart.MultipartFile; |
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest; |
|
|
|
import java.io.File; |
|
|
|
import java.io.IOException; |
|
|
|
import java.io.InputStream; |
|
|
|
import java.util.*; |
|
|
|
import java.util.concurrent.*; |
|
|
|
import java.util.stream.Collectors; |
|
|
@ -603,7 +614,7 @@ public class LoanOverdueFinService extends MybatisBaseService<LoanOverdueFinMapp |
|
|
|
|
|
|
|
public List<LoanOverdueFinDetailsDto> detailsList(String useOrgSid, String stopDate) { |
|
|
|
QueryWrapper qw = new QueryWrapper(); |
|
|
|
qw.eq("1",1); |
|
|
|
qw.eq("1", 1); |
|
|
|
qw.groupBy("a1.vinNo"); |
|
|
|
qw.groupBy("a1.busVinSid"); |
|
|
|
List<LoanOverdueFinDetailsDto> detailsDtoList = baseMapper.detailsList(useOrgSid, qw, stopDate); |
|
|
@ -611,7 +622,181 @@ public class LoanOverdueFinService extends MybatisBaseService<LoanOverdueFinMapp |
|
|
|
return detailsDtoList; |
|
|
|
} |
|
|
|
|
|
|
|
public ResultBean<List<ExcelFinVo>> getExcelInfo(MultipartFile file, HttpServletRequest request) { |
|
|
|
return null; |
|
|
|
public ResultBean<List<ExcelFinVo>> getExcelInfo(MultipartFile file, HttpServletRequest request) throws IOException { |
|
|
|
ResultBean rb = ResultBean.fireFail(); |
|
|
|
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("上传文件不正确"); |
|
|
|
} |
|
|
|
int[] resultCell = new int[]{0, 1, 2, 3}; |
|
|
|
List<ExcelFinVo> list = new ArrayList<>(); |
|
|
|
List<ExcelFinVo> list2 = new ArrayList<>(); |
|
|
|
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); |
|
|
|
ReturnExcelFinVo importReturn = getSheetVal(sheet, resultCell); |
|
|
|
list = importReturn.getInfos(); |
|
|
|
for (ExcelFinVo excelFinVo : list) { |
|
|
|
String customerName = excelFinVo.getCustomerName(); |
|
|
|
customerName = customerName.substring(0, customerName.length() - 8); |
|
|
|
excelFinVo.setCustomerName(customerName); |
|
|
|
list2.add(excelFinVo); |
|
|
|
} |
|
|
|
if (StringUtils.isNotBlank(importReturn.getCheckInfo())) { |
|
|
|
return rb.setMsg(importReturn.getCheckInfo()); |
|
|
|
} else { |
|
|
|
return rb.success().setData(list2).setMsg("成功导入数据,请点击确定按钮"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private ReturnExcelFinVo getSheetVal(Sheet sheet, int[] resultCell) { |
|
|
|
ReturnExcelFinVo returnExcelFinVo = new ReturnExcelFinVo(); |
|
|
|
List<ExcelFinVo> importVoList = new ArrayList<>(); |
|
|
|
Set<String> checkWord = new HashSet<>(); |
|
|
|
for (int r = 0; r < sheet.getLastRowNum(); r++) { |
|
|
|
Row row = sheet.getRow(r); |
|
|
|
if (row == null) { |
|
|
|
continue; |
|
|
|
} |
|
|
|
ExcelFinVo excelFinVo = new ExcelFinVo(); |
|
|
|
for (int i = 0; i < row.getPhysicalNumberOfCells(); i++) { |
|
|
|
String trim = new String(); |
|
|
|
try { |
|
|
|
trim = getCellVal(row.getCell(i)).toString().trim(); |
|
|
|
if (StringUtils.isBlank(trim)) { |
|
|
|
NullPointerException nullPointerException = new NullPointerException(); |
|
|
|
} |
|
|
|
String temp = getCellVal(row.getCell(i)).toString().trim(); |
|
|
|
temp = temp.replace(".0", ""); |
|
|
|
for (int j = 0; j < temp.length(); j++) { |
|
|
|
if (i == resultCell[j]) { |
|
|
|
switch (i) { |
|
|
|
case 0: |
|
|
|
excelFinVo.setCustomerNo(temp); |
|
|
|
break; |
|
|
|
case 1: |
|
|
|
excelFinVo.setCustomerName(temp); |
|
|
|
break; |
|
|
|
case 2: |
|
|
|
excelFinVo.setVinNo(temp); |
|
|
|
break; |
|
|
|
case 3: |
|
|
|
excelFinVo.setTiredDeficiency(temp); |
|
|
|
break; |
|
|
|
default: |
|
|
|
break; |
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
continue; |
|
|
|
} |
|
|
|
} |
|
|
|
} catch (Exception e) { |
|
|
|
if (StringUtils.isBlank(trim)) { |
|
|
|
String word = new String(); |
|
|
|
switch (i) { |
|
|
|
case 0: |
|
|
|
word = "客户编码"; |
|
|
|
break; |
|
|
|
case 1: |
|
|
|
word = "客户名称"; |
|
|
|
break; |
|
|
|
case 2: |
|
|
|
word = "车架号"; |
|
|
|
break; |
|
|
|
case 3: |
|
|
|
word = "财务累欠金额"; |
|
|
|
default: |
|
|
|
break; |
|
|
|
} |
|
|
|
continue; |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
importVoList.add(excelFinVo); |
|
|
|
|
|
|
|
} |
|
|
|
if (!importVoList.isEmpty()) { |
|
|
|
for (ExcelFinVo excelFinVo : importVoList) { |
|
|
|
if (StringUtils.isBlank(excelFinVo.getCustomerNo())) { |
|
|
|
checkWord.add("客户编码不能为空"); |
|
|
|
} |
|
|
|
if (StringUtils.isBlank(excelFinVo.getCustomerName())) { |
|
|
|
checkWord.add("客户名称不能为空"); |
|
|
|
} |
|
|
|
if (StringUtils.isBlank(excelFinVo.getVinNo())) { |
|
|
|
checkWord.add("车架号不能为空"); |
|
|
|
} |
|
|
|
if (StringUtils.isBlank(excelFinVo.getTiredDeficiency())) { |
|
|
|
checkWord.add("财务累欠金额不能为空"); |
|
|
|
} |
|
|
|
List<LoanRepaymentScheduleDetailsVo> loanRepaymentScheduleDetailsVos = loanOverdueFinDetailsService.selectByCustomerNo(excelFinVo.getCustomerNo()); |
|
|
|
loanRepaymentScheduleDetailsVos.removeAll(Collections.singleton(null)); |
|
|
|
if (loanRepaymentScheduleDetailsVos.isEmpty()) { |
|
|
|
if (StringUtils.isNotBlank(excelFinVo.getCustomerNo())) { |
|
|
|
checkWord.add("客户编码" + excelFinVo.getCustomerNo() + "在还款计划表中不存在"); |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
StringBuffer sbcheck1 = new StringBuffer(); |
|
|
|
if (!checkWord.isEmpty()) { |
|
|
|
for (String s : checkWord) { |
|
|
|
if (StringUtils.isBlank(s)) { |
|
|
|
continue; |
|
|
|
} |
|
|
|
sbcheck1.append(s).append(";"); |
|
|
|
} |
|
|
|
} |
|
|
|
if (sbcheck1.length() > 0) { |
|
|
|
sbcheck1.delete(sbcheck1.length() - 1, sbcheck1.length()); |
|
|
|
returnExcelFinVo.setCheckInfo(sbcheck1.toString()); |
|
|
|
returnExcelFinVo.setInfos(new ArrayList<>()); |
|
|
|
return returnExcelFinVo; |
|
|
|
} |
|
|
|
returnExcelFinVo.setInfos(importVoList); |
|
|
|
return returnExcelFinVo; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
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; |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|