Commit d30eafea authored by huyuchen's avatar huyuchen

优化修改

parent 64b7c6c5
...@@ -567,4 +567,8 @@ public interface ErrorCodes { ...@@ -567,4 +567,8 @@ public interface ErrorCodes {
* 社保办理:无办理权限或无可需要办理的社保数据 * 社保办理:无办理权限或无可需要办理的社保数据
*/ */
String SOCIAL_IMPORT_HANDLE_NOT_EXITS = "social.import.handle.not.exits"; String SOCIAL_IMPORT_HANDLE_NOT_EXITS = "social.import.handle.not.exits";
/**
* 社保办理:该数据已处理,请勿重复操作
*/
String SOCIAL_IMPORT_SAME_INFO = "social.import.same.info";
} }
...@@ -221,6 +221,7 @@ fund_import_handle_reason_not_empty=\u516C\u79EF\u91D1\u529E\u7406\uFF1A\u529E\u ...@@ -221,6 +221,7 @@ fund_import_handle_reason_not_empty=\u516C\u79EF\u91D1\u529E\u7406\uFF1A\u529E\u
social_import_handle_reason_not_empty=\u793E\u4FDD\u529E\u7406\uFF1A\u4EFB\u4E00\u9669\u79CD\u529E\u7406\u5931\u8D25\uFF0C\u5931\u8D25\u7C7B\u578B\u5FC5\u586B social_import_handle_reason_not_empty=\u793E\u4FDD\u529E\u7406\uFF1A\u4EFB\u4E00\u9669\u79CD\u529E\u7406\u5931\u8D25\uFF0C\u5931\u8D25\u7C7B\u578B\u5FC5\u586B
social_import_handle_not_empty=\u793E\u4FDD\u529E\u7406\u5931\u8D25\uFF0C\u5FC5\u987B\u529E\u7406\u5176\u4E2D\u4E00\u4E2A\u9669\u79CD social_import_handle_not_empty=\u793E\u4FDD\u529E\u7406\u5931\u8D25\uFF0C\u5FC5\u987B\u529E\u7406\u5176\u4E2D\u4E00\u4E2A\u9669\u79CD
social.import.handle.not.exits=\u65E0\u529E\u7406\u6743\u9650\u6216\u65E0\u53EF\u9700\u8981\u529E\u7406\u7684\u793E\u4FDD\u6570\u636E social.import.handle.not.exits=\u65E0\u529E\u7406\u6743\u9650\u6216\u65E0\u53EF\u9700\u8981\u529E\u7406\u7684\u793E\u4FDD\u6570\u636E
social.import.same.info=\u8BE5\u6570\u636E\u5DF2\u5904\u7406\uFF0C\u8BF7\u52FF\u91CD\u590D\u64CD\u4F5C
......
...@@ -78,6 +78,7 @@ import java.math.BigDecimal; ...@@ -78,6 +78,7 @@ import java.math.BigDecimal;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.*; import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
...@@ -5029,6 +5030,7 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T ...@@ -5029,6 +5030,7 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
} }
List<ErrorMessage> errorMessageList = new ArrayList<>(); List<ErrorMessage> errorMessageList = new ArrayList<>();
ExcelUtil<FundImportHandleVo> util1 = new ExcelUtil<>(FundImportHandleVo.class); ExcelUtil<FundImportHandleVo> util1 = new ExcelUtil<>(FundImportHandleVo.class);
ConcurrentHashMap<String, String> map = new ConcurrentHashMap<>();
// 写法2: // 写法2:
// 匿名内部类 不用额外写一个DemoDataListener // 匿名内部类 不用额外写一个DemoDataListener
// 这里 需要指定读用哪个class去读,然后读取第一个sheet 文件流会自动关闭 // 这里 需要指定读用哪个class去读,然后读取第一个sheet 文件流会自动关闭
...@@ -5073,7 +5075,7 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T ...@@ -5073,7 +5075,7 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
*/ */
private void saveData() { private void saveData() {
log.info("{}条数据,开始存储数据库!", cachedDataList.size()); log.info("{}条数据,开始存储数据库!", cachedDataList.size());
fundImportHandle(cachedDataList, errorMessageList,user,tDispatchInfo); fundImportHandle(cachedDataList, errorMessageList,user,tDispatchInfo,map);
log.info("存储数据库成功!"); log.info("存储数据库成功!");
} }
}).sheet().doRead(); }).sheet().doRead();
...@@ -5091,7 +5093,8 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T ...@@ -5091,7 +5093,8 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
* @Param * @Param
* @return * @return
**/ **/
public void fundImportHandle(List<FundImportHandleVo> excelVOList, List<ErrorMessage> errorMessageList, YifuUser user,TDispatchInfo dispatchInfo) { public void fundImportHandle(List<FundImportHandleVo> excelVOList, List<ErrorMessage> errorMessageList,
YifuUser user,TDispatchInfo dispatchInfo,ConcurrentHashMap<String, String> map) {
if (!Common.isNotNull(excelVOList)) { if (!Common.isNotNull(excelVOList)) {
return; return;
} }
...@@ -5127,6 +5130,13 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T ...@@ -5127,6 +5130,13 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), MsgUtils.getMessage(CommonConstants.PARAM_INFO_ERROR),excel)); errorMessageList.add(new ErrorMessage(excel.getRowIndex(), MsgUtils.getMessage(CommonConstants.PARAM_INFO_ERROR),excel));
continue; continue;
} }
//表内数据重复 员工身份证
if (null == map.get(excel.getEmpIdcard())) {
map.put(excel.getEmpIdcard(),excel.getRowIndex().toString());
} else {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), MsgUtils.getMessage(ErrorCodes.SOCIAL_IMPORT_SAME_INFO) , excel));
continue;
}
// 办理失败,原因必填 // 办理失败,原因必填
if (CommonConstants.ONE_STRING.equals(excel.getHandleStatus()) && Common.isEmpty(excel.getReasonType())){ if (CommonConstants.ONE_STRING.equals(excel.getHandleStatus()) && Common.isEmpty(excel.getReasonType())){
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), MsgUtils.getMessage(ErrorCodes.FUND_IMPORT_HANDLE_REASON_NOT_EMPY),excel)); errorMessageList.add(new ErrorMessage(excel.getRowIndex(), MsgUtils.getMessage(ErrorCodes.FUND_IMPORT_HANDLE_REASON_NOT_EMPY),excel));
...@@ -5185,6 +5195,7 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T ...@@ -5185,6 +5195,7 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
} }
List<ErrorMessage> errorMessageList = new ArrayList<>(); List<ErrorMessage> errorMessageList = new ArrayList<>();
ExcelUtil<SocialImportHandleVo> util1 = new ExcelUtil<>(SocialImportHandleVo.class); ExcelUtil<SocialImportHandleVo> util1 = new ExcelUtil<>(SocialImportHandleVo.class);
ConcurrentHashMap<String, String> idcardMap = new ConcurrentHashMap<>();
// 写法2: // 写法2:
// 匿名内部类 不用额外写一个DemoDataListener // 匿名内部类 不用额外写一个DemoDataListener
// 这里 需要指定读用哪个class去读,然后读取第一个sheet 文件流会自动关闭 // 这里 需要指定读用哪个class去读,然后读取第一个sheet 文件流会自动关闭
...@@ -5229,7 +5240,7 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T ...@@ -5229,7 +5240,7 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
*/ */
private void saveData() { private void saveData() {
log.info("{}条数据,开始存储数据库!", cachedDataList.size()); log.info("{}条数据,开始存储数据库!", cachedDataList.size());
socialImportHandle(cachedDataList, errorMessageList,user,mId); socialImportHandle(cachedDataList, errorMessageList,user,mId,idcardMap);
log.info("存储数据库成功!"); log.info("存储数据库成功!");
} }
}).sheet().doRead(); }).sheet().doRead();
...@@ -5247,7 +5258,8 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T ...@@ -5247,7 +5258,8 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
* @Param * @Param
* @return * @return
**/ **/
public void socialImportHandle(List<SocialImportHandleVo> excelVOList, List<ErrorMessage> errorMessageList, YifuUser user,String mId) { public void socialImportHandle(List<SocialImportHandleVo> excelVOList, List<ErrorMessage> errorMessageList,
YifuUser user,String mId,ConcurrentHashMap<String, String> map) {
if (!Common.isNotNull(excelVOList)) { if (!Common.isNotNull(excelVOList)) {
return; return;
} }
...@@ -5274,8 +5286,6 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T ...@@ -5274,8 +5286,6 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
String handlerRemaek; String handlerRemaek;
Map<String,String> map = new HashMap<>();
for (int i = 0; i < excelVOList.size(); i++) { for (int i = 0; i < excelVOList.size(); i++) {
StringBuilder socialSucessType = new StringBuilder(); StringBuilder socialSucessType = new StringBuilder();
StringBuilder socialFailureType = new StringBuilder(); StringBuilder socialFailureType = new StringBuilder();
...@@ -5285,7 +5295,7 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T ...@@ -5285,7 +5295,7 @@ public class TDispatchInfoServiceImpl extends ServiceImpl<TDispatchInfoMapper, T
if (null == map.get(excel.getEmpIdcard())) { if (null == map.get(excel.getEmpIdcard())) {
map.put(excel.getEmpIdcard(),excel.getRowIndex().toString()); map.put(excel.getEmpIdcard(),excel.getRowIndex().toString());
} else { } else {
errorMessageList.add(new ErrorMessage(excel.getRowIndex(), "存在重复身份证行(" + map.get(excel.getEmpIdcard())+ ")请先去重" , excel)); errorMessageList.add(new ErrorMessage(excel.getRowIndex(), MsgUtils.getMessage(ErrorCodes.SOCIAL_IMPORT_SAME_INFO) , excel));
continue; continue;
} }
//身份证加任一险种必填 //身份证加任一险种必填
......
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