public List getMidLevelEvaluations(final List midLevelDemocracyEvaluations, \n final String templateCode, \n final String activityId, \n final LoginUserPojo loginUserPojo, \n final Map<String, String> appraiseeEmpCodeMap, \n final Map<String, String> examinerEmpMap) { \n /** \n * 这里是为了将Excel数据一对多考核关系转换为一对一的考核关系 \n * 客户上传的模板中被考核者数据对应多个考核者,且被考核者数据只在第一行首先是,下面所对应的被考核者为空 \n * 这里需要将被考核者空白的属性进行赋值 \n * 领导班子和领导人员+廉洁测评的导入考核关系字段不相同, \n * 行号 列1 列2 列3... \n * 1 被考核者名称 被考核者员工编号 考核者信息... \n * 2 "", "" ""...(此处为空白) \n * ... 第二个被考核者信息 \n * ... \n */ \n // 考核测评数据集合 \n final List evaluationExaminers = new ArrayList<>(); \n // 中层民主测评数据迭代器 \n final ListIterator listIterator = midLevelDemocracyEvaluations.listIterator(); \n // Excel第一行一定有值,将第一行数据设置为中层民主数据标准 \n final MidLevelDemocracyEvaluationVO standardMiddleEvaluation = listIterator.next(); \n while (listIterator.hasNext()) { \n final MidLevelDemocracyEvaluationVO currentMiddleEvaluation = listIterator.next(); \n if (StringUtils.isBlank(currentMiddleEvaluation.getAppraiseeName())) { \n // 将前一条的中层民主数据对象属性设置到当前中层民主数据对象属性 \n // 被考核者一对多的考核关系,转换为一对一的考核关系,用于在数据中进行数据存储 \n setMidLevelEvaluationInfo(standardMiddleEvaluation, currentMiddleEvaluation, templateCode); \n break; \n } \n // 创建并添加考核测评数据 \n evaluationExaminers.add(createEvaluationExaminer(activityId, loginUserPojo, currentMiddleEvaluation, appraiseeEmpCodeMap, examinerEmpMap)); \n // 将当前中层民主数据对象作为标准,后续迭代根据标准来进行属性拷贝 \n leaderIncorruptibleEvaluationConvertMapper.copyMidLevelEvalaution(currentMiddleEvaluation, standardMiddleEvaluation); \n } \n return evaluationExaminers; \n }

代码优化: 将Excel数据一对多考核关系转换为一对一

原文地址: https://www.cveoy.top/t/topic/qqME 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录