Commit 2433731b authored by fangxinjiang's avatar fangxinjiang

保单号维护表分页-fxj

parent d610e8e7
......@@ -213,6 +213,10 @@ public class TInsurancePolicyServiceImpl extends ServiceImpl<TInsurancePolicyMap
List<ErrorMessage> errorMessageList = new ArrayList<>();
ExcelUtil<InsurancePolicyImportVo> util1 = new ExcelUtil<>(InsurancePolicyImportVo.class);
Map<String, String> policyNoMap = new HashMap<>();
// 获取所有的保险公司
Map<String, TInsuranceCompany> companyMap = getCompanyMap();
// 获取所有险种
Map<String, TInsuranceType> typeMap = getTypeMap();
// 匿名内部类 不用额外写一个DemoDataListener
// 这里 需要指定读用哪个class去读,然后读取第一个sheet 文件流会自动关闭
try {
......@@ -255,7 +259,7 @@ public class TInsurancePolicyServiceImpl extends ServiceImpl<TInsurancePolicyMap
*/
private void saveData() {
log.info("{}条数据,开始存储数据库!", cachedDataList.size());
importInsurancePolicy(cachedDataList, errorMessageList, user, policyNoMap);
importInsurancePolicy(cachedDataList, errorMessageList, user, policyNoMap,companyMap,typeMap);
log.info("存储数据库成功!");
}
}).sheet().doRead();
......@@ -264,21 +268,20 @@ public class TInsurancePolicyServiceImpl extends ServiceImpl<TInsurancePolicyMap
return R.failed(CommonConstants.IMPORT_DATA_ANALYSIS_ERROR);
} finally {
Common.clear(policyNoMap);
Common.clear(companyMap);
Common.clear(typeMap);
}
return Common.judgeAllMessage(errorMessageList);
}
public void importInsurancePolicy(List<InsurancePolicyImportVo> excelVOList,
List<ErrorMessage> errorMessageList,
YifuUser user, Map<String, String> policyNoMap) {
YifuUser user, Map<String, String> policyNoMap,
Map<String, TInsuranceCompany> companyMap,
Map<String, TInsuranceType> typeMap) {
if (!Common.isNotNull(excelVOList)) {
return;
}
Map<String, String> excelVOTemp = new HashMap<>();
// 获取所有的保险公司
Map<String, TInsuranceCompany> companyMap = getCompanyMap();
// 获取所有险种
Map<String, TInsuranceType> typeMap = getTypeMap();
//获取本次导入对应的保单号是否已经存在
Map<String, String> existMap = getExistMap(excelVOList);
InsurancePolicyImportVo excel = null;
......@@ -341,12 +344,9 @@ public class TInsurancePolicyServiceImpl extends ServiceImpl<TInsurancePolicyMap
tBusinessOperateService.save(operate);
policyNoMap.put(excel.getPolicyNo(), excel.getRowIndex().toString());
// 清理map list 等数据
Common.clear(excelVOList);
Common.clear(companyMap);
Common.clear(typeMap);
Common.clear(excelVOTemp);
}
// 清理map list 等数据
Common.clear(excelVOList);
}
private Map<String, String> getExistMap(List<InsurancePolicyImportVo> excelVOList) {
......
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