Commit cf43fece authored by fangxinjiang's avatar fangxinjiang

社保公积金基数批量导入导出-fxj

parent 3d1b27b8
...@@ -257,23 +257,24 @@ public class SysBaseSetInfoServiceImpl extends ServiceImpl<SysBaseSetInfoMapper, ...@@ -257,23 +257,24 @@ public class SysBaseSetInfoServiceImpl extends ServiceImpl<SysBaseSetInfoMapper,
sysBaseSetInfo.setBaseType(baseType); sysBaseSetInfo.setBaseType(baseType);
sysBaseSetInfo.setDeleteFlag(CommonConstants.STATUS_NORMAL); sysBaseSetInfo.setDeleteFlag(CommonConstants.STATUS_NORMAL);
sysBaseSetInfo.setStatus(CommonConstants.ZERO_INT); sysBaseSetInfo.setStatus(CommonConstants.ZERO_INT);
sysBaseSetInfo.setApplyStartDate(new Date());
// 查询符合条件的基数列表 // 查询符合条件的基数列表
List<SysBaseSetInfo> sysBaseSetInfoList = baseMapper.getSysBaseSetInfoNoPage(sysBaseSetInfo); List<SysBaseSetInfo> sysBaseSetInfoList = baseMapper.getSysBaseSetInfoNoPage(sysBaseSetInfo);
// 返回的map // 返回的map
Map<String, SysBaseSetInfo> setInfoMap = new HashMap<>(); Map<String, SysBaseSetInfo> setInfoMap = new HashMap<>();
if (sysBaseSetInfoList != null && !sysBaseSetInfoList.isEmpty()) { if (sysBaseSetInfoList != null && !sysBaseSetInfoList.isEmpty()) {
// map的键 // map的键
String key; SysBaseSetInfo temp;
for (SysBaseSetInfo setInfo : sysBaseSetInfoList) { for (SysBaseSetInfo setInfo : sysBaseSetInfoList) {
/*key = setInfo.getDepartId() + CommonConstants.DOWN_LINE_STRING + setInfo.getProvince() temp = setInfoMap.get(setInfo.getDepartName());
+ CommonConstants.DOWN_LINE_STRING + setInfo.getCity(); if (temp != null) {
if (setInfo.getTown() != null) { if (setInfo.getApplyStartDate().getTime() > temp.getApplyStartDate().getTime()) {
key += CommonConstants.DOWN_LINE_STRING + setInfo.getTown(); setInfoMap.put(setInfo.getDepartName(), setInfo);
}*/ }
}else {
setInfoMap.put(setInfo.getDepartName(), setInfo); setInfoMap.put(setInfo.getDepartName(), setInfo);
} }
} }
}
return setInfoMap; return setInfoMap;
} }
...@@ -532,8 +533,19 @@ public class SysBaseSetInfoServiceImpl extends ServiceImpl<SysBaseSetInfoMapper, ...@@ -532,8 +533,19 @@ public class SysBaseSetInfoServiceImpl extends ServiceImpl<SysBaseSetInfoMapper,
log.error(CommonConstants.IMPORT_DATA_ANALYSIS_ERROR,e); log.error(CommonConstants.IMPORT_DATA_ANALYSIS_ERROR,e);
return R.failed(CommonConstants.IMPORT_DATA_ANALYSIS_ERROR); return R.failed(CommonConstants.IMPORT_DATA_ANALYSIS_ERROR);
} }
boolean isTrue = true;
for (ErrorMessage message : errorMessageList) {
if (!CommonConstants.SAVE_SUCCESS.equals(message.getMessage())) {
isTrue = false;
break;
}
}
if (isTrue) {
return R.ok();
} else {
return R.ok(errorMessageList); return R.ok(errorMessageList);
} }
}
@Override @Override
public R<List<ErrorMessage>> importSocialDiy(InputStream inputStream) { public R<List<ErrorMessage>> importSocialDiy(InputStream inputStream) {
...@@ -588,8 +600,19 @@ public class SysBaseSetInfoServiceImpl extends ServiceImpl<SysBaseSetInfoMapper, ...@@ -588,8 +600,19 @@ public class SysBaseSetInfoServiceImpl extends ServiceImpl<SysBaseSetInfoMapper,
log.error(CommonConstants.IMPORT_DATA_ANALYSIS_ERROR,e); log.error(CommonConstants.IMPORT_DATA_ANALYSIS_ERROR,e);
return R.failed(CommonConstants.IMPORT_DATA_ANALYSIS_ERROR); return R.failed(CommonConstants.IMPORT_DATA_ANALYSIS_ERROR);
} }
boolean isTrue = true;
for (ErrorMessage message : errorMessageList) {
if (!CommonConstants.SAVE_SUCCESS.equals(message.getMessage())) {
isTrue = false;
break;
}
}
if (isTrue) {
return R.ok();
} else {
return R.ok(errorMessageList); return R.ok(errorMessageList);
} }
}
private void importSysBaseSetSocial(List<SysBaseSetSocialInsertVo> excelVOList, List<ErrorMessage> errorMessageList) { private void importSysBaseSetSocial(List<SysBaseSetSocialInsertVo> excelVOList, List<ErrorMessage> errorMessageList) {
// 区域数据初始化 // 区域数据初始化
HashMap<String, String> areaMap = new HashMap<>(); HashMap<String, String> areaMap = new HashMap<>();
...@@ -1174,7 +1197,7 @@ public class SysBaseSetInfoServiceImpl extends ServiceImpl<SysBaseSetInfoMapper, ...@@ -1174,7 +1197,7 @@ public class SysBaseSetInfoServiceImpl extends ServiceImpl<SysBaseSetInfoMapper,
// 插入 // 插入
try { try {
insertFundExcel(temp,infoVo,fundProList); insertFundExcel(temp,infoVo,fundProList,fundSetInfoMap);
}catch (Exception e){ }catch (Exception e){
errorMsg = new ErrorMessage(excel.getRowIndex(),"数据保存失败,请修改后重新提交"); errorMsg = new ErrorMessage(excel.getRowIndex(),"数据保存失败,请修改后重新提交");
errorMessageList.add(errorMsg); errorMessageList.add(errorMsg);
...@@ -1187,7 +1210,7 @@ public class SysBaseSetInfoServiceImpl extends ServiceImpl<SysBaseSetInfoMapper, ...@@ -1187,7 +1210,7 @@ public class SysBaseSetInfoServiceImpl extends ServiceImpl<SysBaseSetInfoMapper,
/** /**
* 插入excel bad record * 插入excel bad record
*/ */
private void insertFundExcel(SysBaseSetInfo old,SysBaseSetInfo insert,List<SysPayProportion> fundProList) { private void insertFundExcel(SysBaseSetInfo old,SysBaseSetInfo insert,List<SysPayProportion> fundProList,Map<String, SysBaseSetInfo> fundSetInfoMap) {
if (Common.isNotNull(old) && Common.isNotNull(old.getId()));{ if (Common.isNotNull(old) && Common.isNotNull(old.getId()));{
baseMapper.updateById( old); baseMapper.updateById( old);
} }
...@@ -1198,6 +1221,7 @@ public class SysBaseSetInfoServiceImpl extends ServiceImpl<SysBaseSetInfoMapper, ...@@ -1198,6 +1221,7 @@ public class SysBaseSetInfoServiceImpl extends ServiceImpl<SysBaseSetInfoMapper,
sysPayProportionService.save(fundPro); sysPayProportionService.save(fundPro);
} }
} }
fundSetInfoMap.put(insert.getDepartName(), insert);
} }
/** /**
......
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