From 5c0d2ecb9476515cab0f1cc52ba49b02a5149a67 Mon Sep 17 00:00:00 2001 From: 许鹏程 <1821349743@qq.com> Date: 星期三, 05 七月 2023 11:12:52 +0800 Subject: [PATCH] 数据模板解析 --- src/main/java/com/product/module/data/service/OrganizationImportService.java | 3378 +++++++++++++++++++++++++++++----------------------------- 1 files changed, 1,689 insertions(+), 1,689 deletions(-) diff --git a/src/main/java/com/product/module/data/service/OrganizationImportService.java b/src/main/java/com/product/module/data/service/OrganizationImportService.java index b4fd7a6..5e30c98 100644 --- a/src/main/java/com/product/module/data/service/OrganizationImportService.java +++ b/src/main/java/com/product/module/data/service/OrganizationImportService.java @@ -36,1789 +36,1789 @@ public class OrganizationImportService extends AbstractBaseService implements IOrganizationImportService { - @Autowired - StaffManagerService staffManagerService; + @Autowired + StaffManagerService staffManagerService; - private final String companyLevelSeparator = ">"; + private final String companyLevelSeparator = ">"; - /** - * 瀵煎叆鍏徃 涔嬪墠 鏁版嵁澶勭悊 - * - * @param dt - * @throws BaseException - */ - @Override - public DataTableEntity importCompanyBefore(DataTableEntity dt) throws BaseException { - ImportErrorEntity errorEntity = new ImportErrorEntity(); - try { + /** + * 瀵煎叆鍏徃 涔嬪墠 鏁版嵁澶勭悊 + * + * @param dt + * @throws BaseException + */ + @Override + public DataTableEntity importCompanyBefore(DataTableEntity dt) throws BaseException { + ImportErrorEntity errorEntity = new ImportErrorEntity(); + try { - SystemUser currentUser = SpringMVCContextHolder.getCurrentUser(); - //绠$悊鍛樻潈闄愰獙璇� - managerPermissionValidation(errorEntity, currentUser); - FieldSetEntity managerFieldSet = currentUser.getCurrentManager(); - String managerCompany = managerFieldSet.getString(CmnConst.ORG_LEVEL_UUID); - // 褰撳墠绠$悊鍛樼鐞嗙殑鍏徃 - String managerCompanyUuids = currentUser.getCurrentCompany().getString(CmnConst.ORG_LEVEL_UUID); - if (!BaseUtil.dataTableIsEmpty(dt)) { - //鏁版嵁楠岃瘉缁撴灉 - Map<String, String> fieldType = Maps.newHashMap(); - fieldType.put(CmnConst.SEQUENCE, "int"); - errorEntity = fieldRequiredValidation(dt, new String[]{CmnConst.FIELD_ORG_LEVEL_NAME, CmnConst.FIELD_ORG_LEVEL_ALL, CmnConst.SEQUENCE}, null, f -> { - if (f != null && f[0] != null) { - FieldSetEntity fse = f[0]; - //鍏徃鍚嶇О - String companyName = fse.getString(CmnConst.FIELD_ORG_LEVEL_NAME); - //鍏徃鍏ㄧО - String companyAllName = fse.getString(CmnConst.FIELD_ORG_LEVEL_ALL); - //涓婄骇鍏徃鍏ㄧО - String parentAllName = companyAllName.replace(companyLevelSeparator + companyName, ""); - fse.setValue("parentAllName", parentAllName); - } - }); - DataTableEntity systemData = getBaseDao().listTable(CmnConst.TABLE_PRODUCT_SYS_ORG_LEVELS, " org_level_type=0 AND " - + BaseUtil.buildQuestionMarkFilter(CmnConst.ORG_LEVEL_UUID, managerCompanyUuids.split(","), true), new Object[]{}, "org_level_code"); - // 楠岃瘉閲嶅 & 鍚堝苟閿欒淇℃伅 - errorEntity.mergeError(fieldRepeatValidation(dt, systemData, CmnConst.FIELD_ORG_LEVEL_ALL)); - if (errorEntity.isError) { - errorEntity.newThrowBaseException(); - } - List<FieldSetEntity> data = dt.getData(); - data.sort((a, b) -> { - String Aorg_level_all = a.getString(CmnConst.FIELD_ORG_LEVEL_ALL); - String Borg_level_all = b.getString(CmnConst.FIELD_ORG_LEVEL_ALL); - int lengthA = Aorg_level_all != null ? Aorg_level_all.length() : -1; - int lengthB = Borg_level_all != null ? Borg_level_all.length() : -1; - return lengthA - lengthB; - }); - // 鑾峰彇褰撳墠绠$悊绠$悊鍏徃浠ュ強瀛愬叕鍙� - DataTableEntity allCompany = getBaseDao().listTable(CmnConst.TABLE_PRODUCT_SYS_ORG_LEVELS, " org_level_type=0 AND " - + BaseUtil.buildQuestionMarkFilter(CmnConst.ORG_LEVEL_UUID, managerCompanyUuids.split(","), true), new Object[]{}, "org_level_code"); - Map<String, String> levelCode = Maps.newHashMap(); - if (!BaseUtil.dataTableIsEmpty(allCompany)) { - for (int i = 0; i < allCompany.getRows(); i++) { - String org_level_all = allCompany.getString(i, CmnConst.FIELD_ORG_LEVEL_ALL); - String org_level_code = allCompany.getString(i, CmnConst.FIELD_ORG_LEVEL_CODE); - // 灏嗗叕鍙哥紪鐮佺敤鍏ㄧО瀛樺偍 - levelCode.put(org_level_all, org_level_code); - } - } - for (FieldSetEntity fse : data) { - //褰撳墠琛� - Integer rowIndex = fse.getInteger("~row~"); - //鍏徃鍏ㄧО - String companyAllName = fse.getString(CmnConst.FIELD_ORG_LEVEL_ALL); - //涓婄骇缁勭粐鏈烘瀯鍏ㄧО - String parentAllName = fse.getString("parentAllName"); - //涓婄骇鏈烘瀯缂栫爜 - String code = levelCode.get(parentAllName); - if (StringUtils.isEmpty(code)) { - errorEntity.addError(rowIndex, " 鑾峰彇涓婄骇鏈烘瀯缂栫爜閿欒锛岃妫�鏌ュ叕鍙稿悕绉般�佸叏绉版槸鍚︽纭紝閿欒琛屽彿锛�").append(rowIndex + 1); - continue; - } - //鍒濆鍖栧叕鍙告暟鎹� - initOrganizationFieldSet(fse, currentUser.getClient_uuid(), code, 0); - // 灏嗗綋鍓嶅叕鍙哥敓鎴愮殑org_level_code 鏀惧叆map涓� - levelCode.put(companyAllName, fse.getString(CmnConst.FIELD_ORG_LEVEL_CODE)); - String uuid = null; - try { - // 淇濆瓨鍑洪敊鐩存帴璺宠繃璇ユ潯鏁版嵁 - getBaseDao().add(fse); - } catch (Exception e) { - continue; - } - if (null != uuid) { - // 瀵煎叆鏃跺垱寤鸿鍏徃鐨勬暟鎹潈闄� - FieldSetEntity fs = new FieldSetEntity(); - fs.setTableName(CmnConst.TABLE_PRODUCT_SYS_DATA_STRATEGY_MASTER); + SystemUser currentUser = SpringMVCContextHolder.getCurrentUser(); + //绠$悊鍛樻潈闄愰獙璇� + managerPermissionValidation(errorEntity, currentUser); + FieldSetEntity managerFieldSet = currentUser.getCurrentManager(); + String managerCompany = managerFieldSet.getString(CmnConst.ORG_LEVEL_UUID); + // 褰撳墠绠$悊鍛樼鐞嗙殑鍏徃 + String managerCompanyUuids = currentUser.getCurrentCompany().getString(CmnConst.ORG_LEVEL_UUID); + if (!BaseUtil.dataTableIsEmpty(dt)) { + //鏁版嵁楠岃瘉缁撴灉 + Map<String, String> fieldType = Maps.newHashMap(); + fieldType.put(CmnConst.SEQUENCE, "int"); + errorEntity = fieldRequiredValidation(dt, new String[]{CmnConst.FIELD_ORG_LEVEL_NAME, CmnConst.FIELD_ORG_LEVEL_ALL, CmnConst.SEQUENCE}, null, f -> { + if (f != null && f[0] != null) { + FieldSetEntity fse = f[0]; + //鍏徃鍚嶇О + String companyName = fse.getString(CmnConst.FIELD_ORG_LEVEL_NAME); + //鍏徃鍏ㄧО + String companyAllName = fse.getString(CmnConst.FIELD_ORG_LEVEL_ALL); + //涓婄骇鍏徃鍏ㄧО + String parentAllName = companyAllName.replace(companyLevelSeparator + companyName, ""); + fse.setValue("parentAllName", parentAllName); + } + }); + DataTableEntity systemData = getBaseDao().listTable(CmnConst.TABLE_PRODUCT_SYS_ORG_LEVELS, " org_level_type=0 AND " + + BaseUtil.buildQuestionMarkFilter(CmnConst.ORG_LEVEL_UUID, managerCompanyUuids.split(","), true), new Object[]{}, "org_level_code"); + // 楠岃瘉閲嶅 & 鍚堝苟閿欒淇℃伅 + errorEntity.mergeError(fieldRepeatValidation(dt, systemData, CmnConst.FIELD_ORG_LEVEL_ALL)); + if (errorEntity.isError) { + errorEntity.newThrowBaseException(); + } + List<FieldSetEntity> data = dt.getData(); + data.sort((a, b) -> { + String Aorg_level_all = a.getString(CmnConst.FIELD_ORG_LEVEL_ALL); + String Borg_level_all = b.getString(CmnConst.FIELD_ORG_LEVEL_ALL); + int lengthA = Aorg_level_all != null ? Aorg_level_all.length() : -1; + int lengthB = Borg_level_all != null ? Borg_level_all.length() : -1; + return lengthA - lengthB; + }); + // 鑾峰彇褰撳墠绠$悊绠$悊鍏徃浠ュ強瀛愬叕鍙� + DataTableEntity allCompany = getBaseDao().listTable(CmnConst.TABLE_PRODUCT_SYS_ORG_LEVELS, " org_level_type=0 AND " + + BaseUtil.buildQuestionMarkFilter(CmnConst.ORG_LEVEL_UUID, managerCompanyUuids.split(","), true), new Object[]{}, "org_level_code"); + Map<String, String> levelCode = Maps.newHashMap(); + if (!BaseUtil.dataTableIsEmpty(allCompany)) { + for (int i = 0; i < allCompany.getRows(); i++) { + String org_level_all = allCompany.getString(i, CmnConst.FIELD_ORG_LEVEL_ALL); + String org_level_code = allCompany.getString(i, CmnConst.FIELD_ORG_LEVEL_CODE); + // 灏嗗叕鍙哥紪鐮佺敤鍏ㄧО瀛樺偍 + levelCode.put(org_level_all, org_level_code); + } + } + for (FieldSetEntity fse : data) { + //褰撳墠琛� + Integer rowIndex = fse.getInteger("~row~"); + //鍏徃鍏ㄧО + String companyAllName = fse.getString(CmnConst.FIELD_ORG_LEVEL_ALL); + //涓婄骇缁勭粐鏈烘瀯鍏ㄧО + String parentAllName = fse.getString("parentAllName"); + //涓婄骇鏈烘瀯缂栫爜 + String code = levelCode.get(parentAllName); + if (StringUtils.isEmpty(code)) { + errorEntity.addError(rowIndex, " 鑾峰彇涓婄骇鏈烘瀯缂栫爜閿欒锛岃妫�鏌ュ叕鍙稿悕绉般�佸叏绉版槸鍚︽纭紝閿欒琛屽彿锛�").append(rowIndex + 1); + continue; + } + //鍒濆鍖栧叕鍙告暟鎹� + initOrganizationFieldSet(fse, currentUser.getClient_uuid(), code, 0); + // 灏嗗綋鍓嶅叕鍙哥敓鎴愮殑org_level_code 鏀惧叆map涓� + levelCode.put(companyAllName, fse.getString(CmnConst.FIELD_ORG_LEVEL_CODE)); + String uuid = null; + try { + // 淇濆瓨鍑洪敊鐩存帴璺宠繃璇ユ潯鏁版嵁 + getBaseDao().add(fse); + } catch (Exception e) { + continue; + } + if (null != uuid) { + // 瀵煎叆鏃跺垱寤鸿鍏徃鐨勬暟鎹潈闄� + FieldSetEntity fs = new FieldSetEntity(); + fs.setTableName(CmnConst.TABLE_PRODUCT_SYS_DATA_STRATEGY_MASTER); // fs.setValue(CmnConst.ORG_LEVEL_UUID, uuid); - fs.setValue("property_uuid", "001"); - fs.setValue("is_used", "1"); - fs.setValue("effective_start_date", new Date()); - fs.setValue(CmnConst.CREATED_BY, currentUser.getUser_id()); - fs.setValue(CmnConst.CREATED_UTC_DATETIME, new Date()); - getBaseDao().add(fs); - } - } - // 鍥炲啓鍒伴殣钘忕鐞嗗憳鎵�绠$悊鐨勫叕鍙� todo group_concat 澶浼氭姤閿� - getBaseDao().executeUpdate("UPDATE product_sys_org_manager SET org_level_uuid =(SELECT group_concat(UUID) FROM product_sys_org_levels WHERE CLIENT_UUID =? AND ORG_LEVEL_TYPE =0) WHERE CLIENTS_UUID=? AND MANAGER_TYPE=? " - , new Object[]{currentUser.getClient_uuid(), currentUser.getClient_uuid(), 3}); - // 鍥炲啓褰撳墠绠$悊鍛樼鐞嗙殑鍏徃 - if (currentUser.getUserType() == 2 && dt.getUuids() != null) { - if (!StringUtils.isEmpty(managerCompany)) { - managerCompany += ","; - } else { - managerCompany = ""; - } - managerCompany += dt.getUuidsToString(); - String manager_uuid = managerFieldSet.getUUID(); - String sql = "update product_sys_org_manager set org_level_uuid=? where uuid=?"; - getBaseDao().executeUpdate(sql, new Object[]{managerCompany, manager_uuid}); - } - //鎶涘嚭閿欒 - if (errorEntity.isError) { - errorEntity.newThrowBaseException(); - } - UpdateLoginUserInfoService loginUserInfoService = SpringBeanUtil.getBean("updateLoginUserInfoService", UpdateLoginUserInfoService.class); - loginUserInfoService.updateUserInfoByUserId(new Object[]{currentUser.getUser_id()}, false); - return dt; - } else { - errorEntity.newThrowBaseException("瀵煎叆鍏徃澶辫触锛屾湭鎻愬彇鍒版暟鎹�"); - } - } catch (BaseException e) { - throw e; - } catch (Exception e) { - e.printStackTrace(); - errorEntity.addError(0, "瀵煎叆鍏徃澶辫触锛屾湭鐭ラ敊璇� 锛�" + e.getMessage()); - errorEntity.newThrowBaseException(); - } - return null; - } + fs.setValue("property_uuid", "001"); + fs.setValue("is_used", "1"); + fs.setValue("effective_start_date", new Date()); + fs.setValue(CmnConst.CREATED_BY, currentUser.getUser_id()); + fs.setValue(CmnConst.CREATED_UTC_DATETIME, new Date()); + getBaseDao().add(fs); + } + } + // 鍥炲啓鍒伴殣钘忕鐞嗗憳鎵�绠$悊鐨勫叕鍙� todo group_concat 澶浼氭姤閿� + getBaseDao().executeUpdate("UPDATE product_sys_org_manager SET org_level_uuid =(SELECT group_concat(UUID) FROM product_sys_org_levels WHERE CLIENT_UUID =? AND ORG_LEVEL_TYPE =0) WHERE CLIENTS_UUID=? AND MANAGER_TYPE=? " + , new Object[]{currentUser.getClient_uuid(), currentUser.getClient_uuid(), 3}); + // 鍥炲啓褰撳墠绠$悊鍛樼鐞嗙殑鍏徃 + if (currentUser.getUserType() == 2 && dt.getUuids() != null) { + if (!StringUtils.isEmpty(managerCompany)) { + managerCompany += ","; + } else { + managerCompany = ""; + } + managerCompany += dt.getUuidsToString(); + String manager_uuid = managerFieldSet.getUUID(); + String sql = "update product_sys_org_manager set org_level_uuid=? where uuid=?"; + getBaseDao().executeUpdate(sql, new Object[]{managerCompany, manager_uuid}); + } + //鎶涘嚭閿欒 + if (errorEntity.isError) { + errorEntity.newThrowBaseException(); + } + UpdateLoginUserInfoService loginUserInfoService = SpringBeanUtil.getBean("updateLoginUserInfoService", UpdateLoginUserInfoService.class); + loginUserInfoService.updateUserInfoByUserId(new Object[]{currentUser.getUser_id()}, false); + return dt; + } else { + errorEntity.newThrowBaseException("瀵煎叆鍏徃澶辫触锛屾湭鎻愬彇鍒版暟鎹�"); + } + } catch (BaseException e) { + throw e; + } catch (Exception e) { + e.printStackTrace(); + errorEntity.addError(0, "瀵煎叆鍏徃澶辫触锛屾湭鐭ラ敊璇� 锛�" + e.getMessage()); + errorEntity.newThrowBaseException(); + } + return null; + } - /** - * 瀛楁閲嶅楠岃瘉 - * - * @param errorEntity - * @param importData 瀵煎叆鏁版嵁 - * @param systemData 绯荤粺鏁版嵁 锛堝彲閫夛級 - * @param fieldNames 瀛楁鍚嶇О - * @return - * @throws BaseException - */ - protected ImportErrorEntity fieldRepeatValidation(ImportErrorEntity errorEntity, DataTableEntity importData, DataTableEntity systemData, String[] fieldNames) throws BaseException { - if (fieldNames == null || fieldNames.length <= 0) { - return errorEntity; - } - List<FieldSetEntity> dataList = importData.clones().getData(); - Map<String, Object> valueMap = Maps.newHashMap(); - if (!BaseUtil.dataTableIsEmpty(systemData)) { - for (int i = 0; i < systemData.getRows(); i++) { - for (String field : fieldNames) { - String value = systemData.getString(i, field); - if (!StringUtils.isEmpty(value)) { - valueMap.put(field + this.companyLevelSeparator + value, Boolean.FALSE); - } - } - } - } - fieldRepeatValidation(errorEntity, dataList, valueMap, fieldNames); - return errorEntity; - } + /** + * 瀛楁閲嶅楠岃瘉 + * + * @param errorEntity + * @param importData 瀵煎叆鏁版嵁 + * @param systemData 绯荤粺鏁版嵁 锛堝彲閫夛級 + * @param fieldNames 瀛楁鍚嶇О + * @return + * @throws BaseException + */ + protected ImportErrorEntity fieldRepeatValidation(ImportErrorEntity errorEntity, DataTableEntity importData, DataTableEntity systemData, String[] fieldNames) throws BaseException { + if (fieldNames == null || fieldNames.length <= 0) { + return errorEntity; + } + List<FieldSetEntity> dataList = importData.clones().getData(); + Map<String, Object> valueMap = Maps.newHashMap(); + if (!BaseUtil.dataTableIsEmpty(systemData)) { + for (int i = 0; i < systemData.getRows(); i++) { + for (String field : fieldNames) { + String value = systemData.getString(i, field); + if (!StringUtils.isEmpty(value)) { + valueMap.put(field + this.companyLevelSeparator + value, Boolean.FALSE); + } + } + } + } + fieldRepeatValidation(errorEntity, dataList, valueMap, fieldNames); + return errorEntity; + } - /** - * 瀛楁閲嶅楠岃瘉 - * - * @param dataList 瀵煎叆鏁版嵁 - * @param valueMap - * @param fieldNames 瀛楁鍚嶇О - * @throws BaseException - */ - protected void fieldRepeatValidation(ImportErrorEntity errorEntity, List<FieldSetEntity> dataList, Map<String, Object> valueMap, String[] fieldNames) throws BaseException { + /** + * 瀛楁閲嶅楠岃瘉 + * + * @param dataList 瀵煎叆鏁版嵁 + * @param valueMap + * @param fieldNames 瀛楁鍚嶇О + * @throws BaseException + */ + protected void fieldRepeatValidation(ImportErrorEntity errorEntity, List<FieldSetEntity> dataList, Map<String, Object> valueMap, String[] fieldNames) throws BaseException { - for (FieldSetEntity fse : dataList) { - DataLocation dataLocation = getDataLocation(fse); - for (String fieldName : fieldNames) { - String value = fse.getString(fieldName); - if (!StringUtils.isEmpty(value)) { - if (valueMap.get(fieldName + this.companyLevelSeparator + value) != null) { - Object val = valueMap.get(fieldName + this.companyLevelSeparator + value); - if (val != null) { - String error; - if (val instanceof Boolean) { - // 绯荤粺涓瓨鍦� - // 绗� N 琛岋紝绗� N 鍒楋紝'琛ㄥご鍚嶇О' ('鏁版嵁鍊�') 鏁版嵁閲嶅锛屽湪绯荤粺涓凡瀛樺湪 - error = "绗� %s 琛岋紝绗� %s 鍒� '%s', 鏁版嵁閲嶅锛屽湪绯荤粺涓凡瀛樺湪"; - error = String.format(error, dataLocation.getRowIndex(), dataLocation.getColIndex(fieldName), dataLocation.getColName(fieldName), value); - } else { - FieldSetEntity fs = (FieldSetEntity) val; - DataLocation historyLocation = getDataLocation(fs); - // 绗琋琛岋紝绗� N鍒楋紝'琛ㄥご鍚嶇О' ('鏁版嵁鍊�') 鏁版嵁鍜岀 %s 琛岋紝绗琋琛岋紝绗� N鍒楋紝'琛ㄥご鍚嶇О' ('鏁版嵁鍊�') 鏁版嵁閲嶅 - error = "绗� %s 琛岋紝绗� %s 鍒� '%s', 鏁版嵁鍜岀 %s 琛岋紝绗� %s 鍒� '%s' ,鏁版嵁閲嶅"; - error = String.format(error, dataLocation.getRowIndex(), dataLocation.getColIndex(fieldName), dataLocation.getColName(fieldName), value, - historyLocation.getRowIndex(), historyLocation.getColIndex(fieldName), historyLocation.getColName(fieldName), value); - } - errorEntity.addError(dataLocation.getRowIndex(), error); - } - } else { - valueMap.put(fieldName + this.companyLevelSeparator + value, fse); - } - } - } - } - } + for (FieldSetEntity fse : dataList) { + DataLocation dataLocation = getDataLocation(fse); + for (String fieldName : fieldNames) { + String value = fse.getString(fieldName); + if (!StringUtils.isEmpty(value)) { + if (valueMap.get(fieldName + this.companyLevelSeparator + value) != null) { + Object val = valueMap.get(fieldName + this.companyLevelSeparator + value); + if (val != null) { + String error; + if (val instanceof Boolean) { + // 绯荤粺涓瓨鍦� + // 绗� N 琛岋紝绗� N 鍒楋紝'琛ㄥご鍚嶇О' ('鏁版嵁鍊�') 鏁版嵁閲嶅锛屽湪绯荤粺涓凡瀛樺湪 + error = "绗� %s 琛岋紝绗� %s 鍒� '%s', 鏁版嵁閲嶅锛屽湪绯荤粺涓凡瀛樺湪"; + error = String.format(error, dataLocation.getRowIndex(), dataLocation.getColIndex(fieldName), dataLocation.getColName(fieldName), value); + } else { + FieldSetEntity fs = (FieldSetEntity) val; + DataLocation historyLocation = getDataLocation(fs); + // 绗琋琛岋紝绗� N鍒楋紝'琛ㄥご鍚嶇О' ('鏁版嵁鍊�') 鏁版嵁鍜岀 %s 琛岋紝绗琋琛岋紝绗� N鍒楋紝'琛ㄥご鍚嶇О' ('鏁版嵁鍊�') 鏁版嵁閲嶅 + error = "绗� %s 琛岋紝绗� %s 鍒� '%s', 鏁版嵁鍜岀 %s 琛岋紝绗� %s 鍒� '%s' ,鏁版嵁閲嶅"; + error = String.format(error, dataLocation.getRowIndex(), dataLocation.getColIndex(fieldName), dataLocation.getColName(fieldName), value, + historyLocation.getRowIndex(), historyLocation.getColIndex(fieldName), historyLocation.getColName(fieldName), value); + } + errorEntity.addError(dataLocation.getRowIndex(), error); + } + } else { + valueMap.put(fieldName + this.companyLevelSeparator + value, fse); + } + } + } + } + } - /** - * 瀛楁閲嶅楠岃瘉 - * - * @param importData 瀵煎叆鏁版嵁 - * @param systemData 绯荤粺鏁版嵁 锛堝彲閫夛級 - * @param fieldName 瀛楁鍚嶇О - * @return - * @throws BaseException - */ - protected ImportErrorEntity fieldRepeatValidation(DataTableEntity importData, DataTableEntity - systemData, String fieldName) throws BaseException { - return fieldRepeatValidation(new ImportErrorEntity(), importData, systemData, new String[]{fieldName}); - } + /** + * 瀛楁閲嶅楠岃瘉 + * + * @param importData 瀵煎叆鏁版嵁 + * @param systemData 绯荤粺鏁版嵁 锛堝彲閫夛級 + * @param fieldName 瀛楁鍚嶇О + * @return + * @throws BaseException + */ + protected ImportErrorEntity fieldRepeatValidation(DataTableEntity importData, DataTableEntity + systemData, String fieldName) throws BaseException { + return fieldRepeatValidation(new ImportErrorEntity(), importData, systemData, new String[]{fieldName}); + } - /** - * 瀛楁蹇呭~楠岃瘉 - * - * @param dt - * @return - * @throws BaseException - */ - protected ImportErrorEntity fieldRequiredValidation(DataTableEntity dt, String[] - fieldNames, Map<String, String> fieldType, CallBack<FieldSetEntity> callBack) throws BaseException { - ImportErrorEntity errorEntity = new ImportErrorEntity(); - for (int i = 0; i < dt.getRows(); i++) { - FieldSetEntity fieldSetEntity = dt.getFieldSetEntity(i); - if (callBack != null) { - callBack.method(fieldSetEntity); - } - fieldRequiredValidation(errorEntity, fieldSetEntity, fieldNames, fieldType); - } + /** + * 瀛楁蹇呭~楠岃瘉 + * + * @param dt + * @return + * @throws BaseException + */ + protected ImportErrorEntity fieldRequiredValidation(DataTableEntity dt, String[] + fieldNames, Map<String, String> fieldType, CallBack<FieldSetEntity> callBack) throws BaseException { + ImportErrorEntity errorEntity = new ImportErrorEntity(); + for (int i = 0; i < dt.getRows(); i++) { + FieldSetEntity fieldSetEntity = dt.getFieldSetEntity(i); + if (callBack != null) { + callBack.method(fieldSetEntity); + } + fieldRequiredValidation(errorEntity, fieldSetEntity, fieldNames, fieldType); + } - return errorEntity; - } + return errorEntity; + } - /** - * 瀛楁绫诲瀷楠岃瘉 - * 鐩墠鏀寔 int double dateTime - * - * @param errorEntity - * @param fse - * @param fieldTypeMap - * @return - * @throws BaseException - */ - protected boolean fieldTypeValidation(ImportErrorEntity errorEntity, FieldSetEntity - fse, Map<String, String> fieldTypeMap) throws BaseException { - boolean flag = true; - if (fieldTypeMap != null && fieldTypeMap.size() > 0 && fse != null) { - for (Map.Entry<String, String> v : fieldTypeMap.entrySet()) { - String fieldType = v.getValue(); - String key = v.getKey(); - Object value = fse.getObject(key); - if (value == null) { - continue; - } - String type = null; - String msg = ""; - try { - switch (fieldType) { - case "int": - type = "鏁存暟"; - fse.getInteger(key); - continue; - case "dateTime": - type = "鏃ユ湡"; - Date date = fse.getDate(key); - fse.setValue(key, date); - continue; - case "double": - type = "灏忔暟"; - fse.getDouble(key); - continue; - case "mobile_phone": - type = "绉诲姩鐢佃瘽"; - String phone = fse.getString(key); - // 楠岃瘉鏄惁涓轰腑鍥藉ぇ闄� 鎵嬫満鍙� - if (!BaseUtil.isChinaPhoneLegal(phone)) { - throw new BaseException("", ""); - } - continue; - case "id_card": - type = "韬唤璇佸彿鐮�"; - String idCard = fse.getString(key); - // 楠岃瘉韬唤璇佸彿鐮佹槸鍚﹀悎娉� - if (IdcardUtils.validateCard(idCard)) { - msg = BaseUtil.idCardVerification(idCard); - throw new BaseException("", ""); - } - continue; - case "email": - type = "閭"; - String email = fse.getString(key); - // 閭楠岃瘉 - if (!BaseUtil.isEmail(email)) { - throw new BaseException("", ""); - } - continue; - case "sex": - type = "鎬у埆"; - String sex = fse.getString(key); - // 閭楠岃瘉 - if (!"鐢�".equals(sex) && !"濂�".equals(sex)) { - throw new BaseException("", ""); - } - continue; - default: - } - } catch (BaseException e) { - DataLocation dataLocation = getDataLocation(fse); - String error = "绗� %s 琛岋紝绗� %s 鍒楋紝鏁版嵁绫诲瀷閿欒" + (type != null ? "锛岃杈撳叆姝g‘鐨� '%s'鍊�" : ""); - if (type != null) { - error = String.format(error, dataLocation.getRowIndex(), dataLocation.getColIndex(key), type); - } else { - error = String.format(error, dataLocation.getRowIndex(), dataLocation.getColIndex(key)); - } - if (!StringUtils.isEmpty(msg)) { - error += "," + msg; - } - errorEntity.addError(dataLocation.getRowIndex(), error); - flag = false; - } - } - } + /** + * 瀛楁绫诲瀷楠岃瘉 + * 鐩墠鏀寔 int double dateTime + * + * @param errorEntity + * @param fse + * @param fieldTypeMap + * @return + * @throws BaseException + */ + protected boolean fieldTypeValidation(ImportErrorEntity errorEntity, FieldSetEntity + fse, Map<String, String> fieldTypeMap) throws BaseException { + boolean flag = true; + if (fieldTypeMap != null && fieldTypeMap.size() > 0 && fse != null) { + for (Map.Entry<String, String> v : fieldTypeMap.entrySet()) { + String fieldType = v.getValue(); + String key = v.getKey(); + Object value = fse.getObject(key); + if (value == null) { + continue; + } + String type = null; + String msg = ""; + try { + switch (fieldType) { + case "int": + type = "鏁存暟"; + fse.getInteger(key); + continue; + case "dateTime": + type = "鏃ユ湡"; + Date date = fse.getDate(key); + fse.setValue(key, date); + continue; + case "double": + type = "灏忔暟"; + fse.getDouble(key); + continue; + case "mobile_phone": + type = "绉诲姩鐢佃瘽"; + String phone = fse.getString(key); + // 楠岃瘉鏄惁涓轰腑鍥藉ぇ闄� 鎵嬫満鍙� + if (!BaseUtil.isChinaPhoneLegal(phone)) { + throw new BaseException("", ""); + } + continue; + case "id_card": + type = "韬唤璇佸彿鐮�"; + String idCard = fse.getString(key); + // 楠岃瘉韬唤璇佸彿鐮佹槸鍚﹀悎娉� + if (IdcardUtils.validateCard(idCard)) { + msg = BaseUtil.idCardVerification(idCard); + throw new BaseException("", ""); + } + continue; + case "email": + type = "閭"; + String email = fse.getString(key); + // 閭楠岃瘉 + if (!BaseUtil.isEmail(email)) { + throw new BaseException("", ""); + } + continue; + case "sex": + type = "鎬у埆"; + String sex = fse.getString(key); + // 閭楠岃瘉 + if (!"鐢�".equals(sex) && !"濂�".equals(sex)) { + throw new BaseException("", ""); + } + continue; + default: + } + } catch (BaseException e) { + DataLocation dataLocation = getDataLocation(fse); + String error = "绗� %s 琛岋紝绗� %s 鍒楋紝鏁版嵁绫诲瀷閿欒" + (type != null ? "锛岃杈撳叆姝g‘鐨� '%s'鍊�" : ""); + if (type != null) { + error = String.format(error, dataLocation.getRowIndex(), dataLocation.getColIndex(key), type); + } else { + error = String.format(error, dataLocation.getRowIndex(), dataLocation.getColIndex(key)); + } + if (!StringUtils.isEmpty(msg)) { + error += "," + msg; + } + errorEntity.addError(dataLocation.getRowIndex(), error); + flag = false; + } + } + } - return flag; - } + return flag; + } - /** - * 瀛楁蹇呭~楠岃瘉 - * - * @param fse - * @return - * @throws BaseException - */ - private boolean fieldRequiredValidation(ImportErrorEntity errorEntity, FieldSetEntity fse, String[] - fieldNames, Map<String, String> fieldType) throws BaseException { - if (fse == null || fieldNames == null || fieldNames.length <= 0) { - return true; - } - DataLocation dataLocation = getDataLocation(fse); - boolean flag = true; - for (String fieldName : fieldNames) { - if (!StringUtils.isEmpty(fieldName)) { - String value = fse.getString(fieldName); - if (StringUtils.isEmpty(value)) { - String error = "绗� %s 琛岋紝绗� %s 鍒� '%s', 涓嶈兘涓虹┖"; - Integer rowIndex = dataLocation.getRowIndex(); - String colIndex = dataLocation.getColIndex(fieldName); - String colName = dataLocation.getColName(fieldName); - error = String.format(error, rowIndex, colIndex, colName); - errorEntity.addError(rowIndex, error); - flag = false; - } - } - } - if (flag) { - return fieldTypeValidation(errorEntity, fse, fieldType); - } else { - fieldTypeValidation(errorEntity, fse, fieldType); - return false; - } - } + /** + * 瀛楁蹇呭~楠岃瘉 + * + * @param fse + * @return + * @throws BaseException + */ + private boolean fieldRequiredValidation(ImportErrorEntity errorEntity, FieldSetEntity fse, String[] + fieldNames, Map<String, String> fieldType) throws BaseException { + if (fse == null || fieldNames == null || fieldNames.length <= 0) { + return true; + } + DataLocation dataLocation = getDataLocation(fse); + boolean flag = true; + for (String fieldName : fieldNames) { + if (!StringUtils.isEmpty(fieldName)) { + String value = fse.getString(fieldName); + if (StringUtils.isEmpty(value)) { + String error = "绗� %s 琛岋紝绗� %s 鍒� '%s', 涓嶈兘涓虹┖"; + Integer rowIndex = dataLocation.getRowIndex(); + String colIndex = dataLocation.getColIndex(fieldName); + String colName = dataLocation.getColName(fieldName); + error = String.format(error, rowIndex, colIndex, colName); + errorEntity.addError(rowIndex, error); + flag = false; + } + } + } + if (flag) { + return fieldTypeValidation(errorEntity, fse, fieldType); + } else { + fieldTypeValidation(errorEntity, fse, fieldType); + return false; + } + } - /** - * 瀵煎叆閮ㄩ棬 涔嬪墠 鏁版嵁澶勭悊 - * - * @param dt - * @throws BaseException - */ - @Override - public DataTableEntity importDeptBefore(DataTableEntity dt) throws BaseException { - ImportErrorEntity errorEntity = new ImportErrorEntity(); - if (!BaseUtil.dataTableIsEmpty(dt)) { - try { - SystemUser currentUser = SpringMVCContextHolder.getCurrentUser(); - //绠$悊鍛樻潈闄愰獙璇� - managerPermissionValidation(errorEntity, currentUser); + /** + * 瀵煎叆閮ㄩ棬 涔嬪墠 鏁版嵁澶勭悊 + * + * @param dt + * @throws BaseException + */ + @Override + public DataTableEntity importDeptBefore(DataTableEntity dt) throws BaseException { + ImportErrorEntity errorEntity = new ImportErrorEntity(); + if (!BaseUtil.dataTableIsEmpty(dt)) { + try { + SystemUser currentUser = SpringMVCContextHolder.getCurrentUser(); + //绠$悊鍛樻潈闄愰獙璇� + managerPermissionValidation(errorEntity, currentUser); - Map<String, String> fieldType = Maps.newHashMap(); - fieldType.put(CmnConst.SEQUENCE, "int"); - //鏁版嵁蹇呭~楠岃瘉缁撴灉 - errorEntity = fieldRequiredValidation(dt, new String[]{CmnConst.FIELD_ORG_LEVEL_NAME, CmnConst.FIELD_ORG_LEVEL_ALL, CmnConst.SEQUENCE, CmnConst.ORG_LEVEL_UUID}, fieldType, null); - if (errorEntity.isError) { - errorEntity.newThrowBaseException(); - } - FieldSetEntity currentManager = currentUser.getCurrentManager(); - String managerCompanyUuids = currentManager.getString(CmnConst.ORG_LEVEL_UUID); - String uuidFilter = BaseUtil.buildQuestionMarkFilter("uuid", managerCompanyUuids.split(","), true); - StringBuilder sql = new StringBuilder(8); - sql.append(" select uuid,org_level_name,org_level_code, "); - sql.append(" org_level_code_parent,org_level_all,org_level_type "); - sql.append(" FROM product_sys_org_levels where client_uuid=? and ( "); - sql.append(" ( "); - sql.append(" ").append(uuidFilter); - sql.append(" AND org_level_type=0 ) "); - sql.append(" or ( "); - sql.append(" ").append(uuidFilter.replace("uuid", "org_level_uuid")); - sql.append(" AND org_level_type=1 ) "); - sql.append(" ) order by org_level_code,org_level_type"); - // 绯荤粺鏁版嵁 - DataTableEntity systemData = getBaseDao().listTable(sql.toString(), new Object[]{currentUser.getClient_uuid()}); - importDeptBefore(dt, systemData, currentUser, errorEntity); - return dt; - } catch (BaseException e) { - e.printStackTrace(); - throw e; - } catch (Exception e) { - e.printStackTrace(); - errorEntity.addError(0, "瀵煎叆閮ㄩ棬澶辫触锛屾湭鐭ラ敊璇� 锛�" + e.getMessage()); - errorEntity.newThrowBaseException(); - } - } - errorEntity.newThrowBaseException("瀵煎叆鍏徃澶辫触锛屾湭鎻愬彇鍒版暟鎹�"); - return null; - } + Map<String, String> fieldType = Maps.newHashMap(); + fieldType.put(CmnConst.SEQUENCE, "int"); + //鏁版嵁蹇呭~楠岃瘉缁撴灉 + errorEntity = fieldRequiredValidation(dt, new String[]{CmnConst.FIELD_ORG_LEVEL_NAME, CmnConst.FIELD_ORG_LEVEL_ALL, CmnConst.SEQUENCE, CmnConst.ORG_LEVEL_UUID}, fieldType, null); + if (errorEntity.isError) { + errorEntity.newThrowBaseException(); + } + FieldSetEntity currentManager = currentUser.getCurrentManager(); + String managerCompanyUuids = currentManager.getString(CmnConst.ORG_LEVEL_UUID); + String uuidFilter = BaseUtil.buildQuestionMarkFilter("uuid", managerCompanyUuids.split(","), true); + StringBuilder sql = new StringBuilder(8); + sql.append(" select uuid,org_level_name,org_level_code, "); + sql.append(" org_level_code_parent,org_level_all,org_level_type "); + sql.append(" FROM product_sys_org_levels where client_uuid=? and ( "); + sql.append(" ( "); + sql.append(" ").append(uuidFilter); + sql.append(" AND org_level_type=0 ) "); + sql.append(" or ( "); + sql.append(" ").append(uuidFilter.replace("uuid", "org_level_uuid")); + sql.append(" AND org_level_type=1 ) "); + sql.append(" ) order by org_level_code,org_level_type"); + // 绯荤粺鏁版嵁 + DataTableEntity systemData = getBaseDao().listTable(sql.toString(), new Object[]{currentUser.getClient_uuid()}); + importDeptBefore(dt, systemData, currentUser, errorEntity); + return dt; + } catch (BaseException e) { + e.printStackTrace(); + throw e; + } catch (Exception e) { + e.printStackTrace(); + errorEntity.addError(0, "瀵煎叆閮ㄩ棬澶辫触锛屾湭鐭ラ敊璇� 锛�" + e.getMessage()); + errorEntity.newThrowBaseException(); + } + } + errorEntity.newThrowBaseException("瀵煎叆鍏徃澶辫触锛屾湭鎻愬彇鍒版暟鎹�"); + return null; + } - private void importDeptBefore(DataTableEntity dt, DataTableEntity systemData, SystemUser - user, ImportErrorEntity errorEntity) throws BaseException { - List<FieldSetEntity> data = dt.getData(); - // 鏈烘瀯鍏ㄧО鎺掑簭 - data.sort(Comparator.comparing(a -> a.getString(CmnConst.FIELD_ORG_LEVEL_ALL))); - if (BaseUtil.dataTableIsEmpty(systemData)) { - errorEntity.newThrowBaseException("鑾峰彇绯荤粺鏈烘瀯淇℃伅澶辫触锛岃鑱旂郴绠$悊鍛� "); - } - List<FieldSetEntity> systemDataList = systemData.getData(); - // 鍏徃 - Map<String, FieldSetEntity> companyMap = Maps.newHashMap(); - // 閮ㄩ棬 - Map<String, FieldSetEntity> deptMap = Maps.newHashMap(); - for (FieldSetEntity fse : systemDataList) { - // 鏈烘瀯绫诲瀷 - String orgLevelType = fse.getString(CmnConst.FIELD_ORG_LEVEL_TYPE); - // 鏈烘瀯鍏ㄧО - String org_level_all = fse.getString(CmnConst.FIELD_ORG_LEVEL_ALL); - Map<String, FieldSetEntity> map; - if ("0".equals(orgLevelType)) { - map = companyMap; - } else if ("1".equals(org_level_all)) { - map = deptMap; - } else { - continue; - } - map.put(org_level_all, fse); - } - for (int i = 0; i < dt.getRows(); i++) { - FieldSetEntity fse = dt.getFieldSetEntity(i); - // 鍏徃鍏ㄧО - String companyAllName = fse.getString(CmnConst.ORG_LEVEL_UUID); - // 閮ㄩ棬鍏ㄧО - String deptAllName = fse.getString(CmnConst.FIELD_ORG_LEVEL_ALL); - // 閮ㄩ棬鍚嶇О - String deptName = fse.getString(CmnConst.FIELD_ORG_LEVEL_NAME); + private void importDeptBefore(DataTableEntity dt, DataTableEntity systemData, SystemUser + user, ImportErrorEntity errorEntity) throws BaseException { + List<FieldSetEntity> data = dt.getData(); + // 鏈烘瀯鍏ㄧО鎺掑簭 + data.sort(Comparator.comparing(a -> a.getString(CmnConst.FIELD_ORG_LEVEL_ALL))); + if (BaseUtil.dataTableIsEmpty(systemData)) { + errorEntity.newThrowBaseException("鑾峰彇绯荤粺鏈烘瀯淇℃伅澶辫触锛岃鑱旂郴绠$悊鍛� "); + } + List<FieldSetEntity> systemDataList = systemData.getData(); + // 鍏徃 + Map<String, FieldSetEntity> companyMap = Maps.newHashMap(); + // 閮ㄩ棬 + Map<String, FieldSetEntity> deptMap = Maps.newHashMap(); + for (FieldSetEntity fse : systemDataList) { + // 鏈烘瀯绫诲瀷 + String orgLevelType = fse.getString(CmnConst.FIELD_ORG_LEVEL_TYPE); + // 鏈烘瀯鍏ㄧО + String org_level_all = fse.getString(CmnConst.FIELD_ORG_LEVEL_ALL); + Map<String, FieldSetEntity> map; + if ("0".equals(orgLevelType)) { + map = companyMap; + } else if ("1".equals(org_level_all)) { + map = deptMap; + } else { + continue; + } + map.put(org_level_all, fse); + } + for (int i = 0; i < dt.getRows(); i++) { + FieldSetEntity fse = dt.getFieldSetEntity(i); + // 鍏徃鍏ㄧО + String companyAllName = fse.getString(CmnConst.ORG_LEVEL_UUID); + // 閮ㄩ棬鍏ㄧО + String deptAllName = fse.getString(CmnConst.FIELD_ORG_LEVEL_ALL); + // 閮ㄩ棬鍚嶇О + String deptName = fse.getString(CmnConst.FIELD_ORG_LEVEL_NAME); - DataLocation dataLocation = getDataLocation(fse); - FieldSetEntity companyFse = companyMap.get(companyAllName); - if (companyFse == null || StringUtils.isEmpty(companyFse.getUUID())) { - String error = "绗� %s 琛岋紝涓婄骇鏈烘瀯鑾峰彇澶辫触锛屾墍灞炲叕鍙镐笉瀛樺湪锛岃妫�鏌�' %s '鏄惁姝g‘锛�' %s '"; - error = String.format(error, dataLocation.getRowIndex(), dataLocation.getColName(CmnConst.ORG_LEVEL_UUID), companyAllName); - errorEntity.addError(dataLocation.getRowIndex(), error); - continue; - } - String error = "绗� %s 琛岋紝涓婄骇鏈烘瀯鑾峰彇澶辫触锛屼笂绾ч儴闂ㄤ笉瀛樺湪锛岃妫�鏌�' %s '鏄惁姝g‘锛�' %s '"; - // 閮ㄩ棬涓婄骇鍏ㄧО - String parentDeptAllName = getParentAllName(deptAllName, deptName); - if (StringUtils.isEmpty(parentDeptAllName)) { - error = String.format(error, dataLocation.getRowIndex(), dataLocation.getColName(CmnConst.FIELD_ORG_LEVEL_ALL), deptAllName); - errorEntity.addError(dataLocation.getRowIndex(), error); - continue; - } - // 涓婄骇缂栫爜 - String code; - // 涓婄骇鏈烘瀯鐨剈uid - String parentUuid; - if (!parentDeptAllName.equals(companyAllName)) { - FieldSetEntity deptFse = deptMap.get(parentDeptAllName); - if (deptFse == null || StringUtils.isEmpty(deptFse.getUUID())) { - error = String.format(error, dataLocation.getRowIndex(), dataLocation.getColName(CmnConst.FIELD_ORG_LEVEL_ALL), deptAllName); - errorEntity.addError(dataLocation.getRowIndex(), error); - continue; - } - // 鍙栧嚭涓婄骇閮ㄩ棬鐨刢ode浣滀负涓婄骇缂栫爜 - code = deptFse.getString(CmnConst.FIELD_ORG_LEVEL_CODE); + DataLocation dataLocation = getDataLocation(fse); + FieldSetEntity companyFse = companyMap.get(companyAllName); + if (companyFse == null || StringUtils.isEmpty(companyFse.getUUID())) { + String error = "绗� %s 琛岋紝涓婄骇鏈烘瀯鑾峰彇澶辫触锛屾墍灞炲叕鍙镐笉瀛樺湪锛岃妫�鏌�' %s '鏄惁姝g‘锛�' %s '"; + error = String.format(error, dataLocation.getRowIndex(), dataLocation.getColName(CmnConst.ORG_LEVEL_UUID), companyAllName); + errorEntity.addError(dataLocation.getRowIndex(), error); + continue; + } + String error = "绗� %s 琛岋紝涓婄骇鏈烘瀯鑾峰彇澶辫触锛屼笂绾ч儴闂ㄤ笉瀛樺湪锛岃妫�鏌�' %s '鏄惁姝g‘锛�' %s '"; + // 閮ㄩ棬涓婄骇鍏ㄧО + String parentDeptAllName = getParentAllName(deptAllName, deptName); + if (StringUtils.isEmpty(parentDeptAllName)) { + error = String.format(error, dataLocation.getRowIndex(), dataLocation.getColName(CmnConst.FIELD_ORG_LEVEL_ALL), deptAllName); + errorEntity.addError(dataLocation.getRowIndex(), error); + continue; + } + // 涓婄骇缂栫爜 + String code; + // 涓婄骇鏈烘瀯鐨剈uid + String parentUuid; + if (!parentDeptAllName.equals(companyAllName)) { + FieldSetEntity deptFse = deptMap.get(parentDeptAllName); + if (deptFse == null || StringUtils.isEmpty(deptFse.getUUID())) { + error = String.format(error, dataLocation.getRowIndex(), dataLocation.getColName(CmnConst.FIELD_ORG_LEVEL_ALL), deptAllName); + errorEntity.addError(dataLocation.getRowIndex(), error); + continue; + } + // 鍙栧嚭涓婄骇閮ㄩ棬鐨刢ode浣滀负涓婄骇缂栫爜 + code = deptFse.getString(CmnConst.FIELD_ORG_LEVEL_CODE); - parentUuid = deptFse.getString(CmnConst.ORG_LEVEL_UUID); - } else { - // 鍙栧嚭涓婄骇鍏徃鐨刢ode浣滀负涓婄骇缂栫爜 - code = companyFse.getString(CmnConst.FIELD_ORG_LEVEL_CODE); - parentUuid = companyFse.getUUID(); - } - initOrganizationFieldSet(fse, user.getClient_uuid(), code, 1); - fse.setValue(CmnConst.ORG_LEVEL_UUID, parentUuid); - getBaseDao().saveFieldSetEntity(fse); - deptMap.put(deptAllName, fse); - } - if (errorEntity.isError) { - errorEntity.newThrowBaseException(); - } - } + parentUuid = deptFse.getString(CmnConst.ORG_LEVEL_UUID); + } else { + // 鍙栧嚭涓婄骇鍏徃鐨刢ode浣滀负涓婄骇缂栫爜 + code = companyFse.getString(CmnConst.FIELD_ORG_LEVEL_CODE); + parentUuid = companyFse.getUUID(); + } + initOrganizationFieldSet(fse, user.getClient_uuid(), code, 1); + fse.setValue(CmnConst.ORG_LEVEL_UUID, parentUuid); + getBaseDao().saveFieldSetEntity(fse); + deptMap.put(deptAllName, fse); + } + if (errorEntity.isError) { + errorEntity.newThrowBaseException(); + } + } - private String getParentAllName(String allName, String name) { - if (!StringUtils.isEmpty(allName) && !StringUtils.isEmpty(name)) { - int index = allName.indexOf(this.companyLevelSeparator + name); - if (index > -1) { - return allName.substring(0, index); - } - } - return ""; - } + private String getParentAllName(String allName, String name) { + if (!StringUtils.isEmpty(allName) && !StringUtils.isEmpty(name)) { + int index = allName.indexOf(this.companyLevelSeparator + name); + if (index > -1) { + return allName.substring(0, index); + } + } + return ""; + } - /** - * 瀵煎叆宀椾綅绛夌骇 涔嬪墠 鏁版嵁澶勭悊 - * - * @param dt - * @throws BaseException - */ - @Override - public DataTableEntity importPostLevelBefore(DataTableEntity dt) throws BaseException { - ImportErrorEntity errorEntity = new ImportErrorEntity(); - try { - if (!BaseUtil.dataTableIsEmpty(dt)) { - SystemUser currentUser = SpringMVCContextHolder.getCurrentUser(); - //绠$悊鍛樻潈闄愰獙璇� - managerPermissionValidation(errorEntity, currentUser); - // 褰撳墠绠$悊鍛樼鐞嗙殑鍏徃 - String managerCompanyUuids = currentUser.getCurrentManager().getString(CmnConst.ORG_LEVEL_UUID); - Map<String, List<FieldSetEntity>> groupCompany = Maps.newHashMap(); - Map<String, String> fieldType = Maps.newHashMap(); - fieldType.put(CmnConst.SEQUENCE, "int"); - fieldType.put(CmnConst.FIELD_JOB_GRADE_CLASS, "int"); - StringBuilder sql = new StringBuilder(); - sql.append(" select concat( "); - sql.append(" org_level_uuid,'>',job_grade_name) uuid "); - sql.append(" FROM product_sys_job_post_grades where "); - sql.append(BaseUtil.buildQuestionMarkFilter("org_level_uuid", managerCompanyUuids.split(","), true)); - DataTableEntity systemData = getBaseDao().listTable(sql.toString(), new Object[]{}); - Set<Object> systemDataSet = Sets.newHashSet(); - if (!BaseUtil.dataTableIsEmpty(systemData)) { - systemDataSet.addAll(Arrays.asList(systemData.getUuidsToString().split(","))); - } - for (int i = 0; i < dt.getRows(); i++) { - FieldSetEntity fse = dt.getFieldSetEntity(i); - // 瀛楁蹇呭~楠岃瘉 - boolean validation = fieldRequiredValidation(errorEntity, fse, new String[]{CmnConst.ORG_LEVEL_UUID, CmnConst.FIELD_JOB_GRADE_NAME, CmnConst.SEQUENCE, CmnConst.FIELD_JOB_GRADE_CLASS}, fieldType); - if (!validation) { - // 楠岃瘉鏈�氳繃 璺宠繃璇ユ潯鏁版嵁 - continue; - } - // 鍏徃鍏ㄧО - String companyAllName = fse.getString(CmnConst.ORG_LEVEL_UUID); + /** + * 瀵煎叆宀椾綅绛夌骇 涔嬪墠 鏁版嵁澶勭悊 + * + * @param dt + * @throws BaseException + */ + @Override + public DataTableEntity importPostLevelBefore(DataTableEntity dt) throws BaseException { + ImportErrorEntity errorEntity = new ImportErrorEntity(); + try { + if (!BaseUtil.dataTableIsEmpty(dt)) { + SystemUser currentUser = SpringMVCContextHolder.getCurrentUser(); + //绠$悊鍛樻潈闄愰獙璇� + managerPermissionValidation(errorEntity, currentUser); + // 褰撳墠绠$悊鍛樼鐞嗙殑鍏徃 + String managerCompanyUuids = currentUser.getCurrentManager().getString(CmnConst.ORG_LEVEL_UUID); + Map<String, List<FieldSetEntity>> groupCompany = Maps.newHashMap(); + Map<String, String> fieldType = Maps.newHashMap(); + fieldType.put(CmnConst.SEQUENCE, "int"); + fieldType.put(CmnConst.FIELD_JOB_GRADE_CLASS, "int"); + StringBuilder sql = new StringBuilder(); + sql.append(" select concat( "); + sql.append(" org_level_uuid,'>',job_grade_name) uuid "); + sql.append(" FROM product_sys_job_post_grades where "); + sql.append(BaseUtil.buildQuestionMarkFilter("org_level_uuid", managerCompanyUuids.split(","), true)); + DataTableEntity systemData = getBaseDao().listTable(sql.toString(), new Object[]{}); + Set<Object> systemDataSet = Sets.newHashSet(); + if (!BaseUtil.dataTableIsEmpty(systemData)) { + systemDataSet.addAll(Arrays.asList(systemData.getUuidsToString().split(","))); + } + for (int i = 0; i < dt.getRows(); i++) { + FieldSetEntity fse = dt.getFieldSetEntity(i); + // 瀛楁蹇呭~楠岃瘉 + boolean validation = fieldRequiredValidation(errorEntity, fse, new String[]{CmnConst.ORG_LEVEL_UUID, CmnConst.FIELD_JOB_GRADE_NAME, CmnConst.SEQUENCE, CmnConst.FIELD_JOB_GRADE_CLASS}, fieldType); + if (!validation) { + // 楠岃瘉鏈�氳繃 璺宠繃璇ユ潯鏁版嵁 + continue; + } + // 鍏徃鍏ㄧО + String companyAllName = fse.getString(CmnConst.ORG_LEVEL_UUID); - List<FieldSetEntity> groupPostGradeList = groupCompany.get(companyAllName); - if (groupPostGradeList == null) { - groupPostGradeList = Lists.newArrayList(); - groupCompany.put(companyAllName, groupPostGradeList); - } - groupPostGradeList.add(fse); - } - if (errorEntity.isError) { - errorEntity.newThrowBaseException(); - } - Set<String> companyAllNames = groupCompany.keySet(); - sql = new StringBuilder(); - sql.append(" select uuid,org_level_all "); - sql.append(" FROM product_sys_org_levels "); - sql.append(" where "); - sql.append(BaseUtil.buildQuestionMarkFilter("uuid", managerCompanyUuids.split(","), true)); - sql.append(" AND "); - sql.append(BaseUtil.buildQuestionMarkFilter("org_level_all", companyAllNames.toArray(), true)); - // 鏍规嵁鐢ㄦ埛涓婁紶鐨勫叕鍙稿叏绉� & 璇ョ鐞嗗憳绠$悊鐨勬墍鏈夊叕鍙� 杩涜鏌ヨ鍏徃鐨剈uid - DataTableEntity companyInfo = getBaseDao().listTable(sql.toString(), new Object[]{}); - // 瀹氫箟娌℃湁鎵惧埌鍏徃鐨勬暟鎹� 鍐欏叆閿欒鏂规硶 - CallBack<FieldSetEntity> callBack = (value) -> { - for (FieldSetEntity fs : value) { - DataLocation dataLocation = getDataLocation(fs); - String error = "绗� %s 琛岋紝绗� %s 鏁版嵁閿欒,鎵�灞炲叕鍙镐笉瀛樺湪锛岃妫�鏌ュ垪 '%s'"; - errorEntity.addError(dataLocation.getRowIndex(), String.format(error, - dataLocation.getRowIndex(), - dataLocation.getColIndex(CmnConst.ORG_LEVEL_UUID), - dataLocation.getColName(CmnConst.ORG_LEVEL_UUID))); - } - }; - // 娌℃湁鏌ヨ鍒版墍鏈夊叕鍙镐俊鎭� - if (BaseUtil.dataTableIsEmpty(companyInfo)) { - for (List<FieldSetEntity> value : groupCompany.values()) { - // 寰幆鍐欏叆閿欒 - callBack.method(value.toArray(new FieldSetEntity[]{})); - } - errorEntity.newThrowBaseException(); - } else { - // copy 鍏徃鍏ㄧО - Set<String> companyNames = Sets.newHashSet(); - companyNames.addAll(companyAllNames); - // 寰幆鏌ヨ鐨勫叕鍙哥粨鏋� - for (int i = 0; i < companyInfo.getRows(); i++) { - String uuid = companyInfo.getString(i, CmnConst.UUID); - String org_level_all = companyInfo.getString(i, CmnConst.FIELD_ORG_LEVEL_ALL); - if (companyNames.contains(org_level_all)) { - companyNames.remove(org_level_all); - } - List<FieldSetEntity> postGradeList = groupCompany.get(org_level_all); - if (postGradeList != null) { - for (FieldSetEntity fs : postGradeList) { - // 灏嗗叕鍙竨uid鍐欏叆姣忔潯鏁版嵁 - BaseUtil.createCreatorAndCreationTime(currentUser, fs); - fs.setValue(CmnConst.ORG_LEVEL_UUID, uuid); - fs.setValue(CmnConst.IS_USED, 1); - String job_grade_name = fs.getString(CmnConst.FIELD_JOB_GRADE_NAME); + List<FieldSetEntity> groupPostGradeList = groupCompany.get(companyAllName); + if (groupPostGradeList == null) { + groupPostGradeList = Lists.newArrayList(); + groupCompany.put(companyAllName, groupPostGradeList); + } + groupPostGradeList.add(fse); + } + if (errorEntity.isError) { + errorEntity.newThrowBaseException(); + } + Set<String> companyAllNames = groupCompany.keySet(); + sql = new StringBuilder(); + sql.append(" select uuid,org_level_all "); + sql.append(" FROM product_sys_org_levels "); + sql.append(" where "); + sql.append(BaseUtil.buildQuestionMarkFilter("uuid", managerCompanyUuids.split(","), true)); + sql.append(" AND "); + sql.append(BaseUtil.buildQuestionMarkFilter("org_level_all", companyAllNames.toArray(), true)); + // 鏍规嵁鐢ㄦ埛涓婁紶鐨勫叕鍙稿叏绉� & 璇ョ鐞嗗憳绠$悊鐨勬墍鏈夊叕鍙� 杩涜鏌ヨ鍏徃鐨剈uid + DataTableEntity companyInfo = getBaseDao().listTable(sql.toString(), new Object[]{}); + // 瀹氫箟娌℃湁鎵惧埌鍏徃鐨勬暟鎹� 鍐欏叆閿欒鏂规硶 + CallBack<FieldSetEntity> callBack = (value) -> { + for (FieldSetEntity fs : value) { + DataLocation dataLocation = getDataLocation(fs); + String error = "绗� %s 琛岋紝绗� %s 鏁版嵁閿欒,鎵�灞炲叕鍙镐笉瀛樺湪锛岃妫�鏌ュ垪 '%s'"; + errorEntity.addError(dataLocation.getRowIndex(), String.format(error, + dataLocation.getRowIndex(), + dataLocation.getColIndex(CmnConst.ORG_LEVEL_UUID), + dataLocation.getColName(CmnConst.ORG_LEVEL_UUID))); + } + }; + // 娌℃湁鏌ヨ鍒版墍鏈夊叕鍙镐俊鎭� + if (BaseUtil.dataTableIsEmpty(companyInfo)) { + for (List<FieldSetEntity> value : groupCompany.values()) { + // 寰幆鍐欏叆閿欒 + callBack.method(value.toArray(new FieldSetEntity[]{})); + } + errorEntity.newThrowBaseException(); + } else { + // copy 鍏徃鍏ㄧО + Set<String> companyNames = Sets.newHashSet(); + companyNames.addAll(companyAllNames); + // 寰幆鏌ヨ鐨勫叕鍙哥粨鏋� + for (int i = 0; i < companyInfo.getRows(); i++) { + String uuid = companyInfo.getString(i, CmnConst.UUID); + String org_level_all = companyInfo.getString(i, CmnConst.FIELD_ORG_LEVEL_ALL); + if (companyNames.contains(org_level_all)) { + companyNames.remove(org_level_all); + } + List<FieldSetEntity> postGradeList = groupCompany.get(org_level_all); + if (postGradeList != null) { + for (FieldSetEntity fs : postGradeList) { + // 灏嗗叕鍙竨uid鍐欏叆姣忔潯鏁版嵁 + BaseUtil.createCreatorAndCreationTime(currentUser, fs); + fs.setValue(CmnConst.ORG_LEVEL_UUID, uuid); + fs.setValue(CmnConst.IS_USED, 1); + String job_grade_name = fs.getString(CmnConst.FIELD_JOB_GRADE_NAME); // String group_name = fs.getString(CmnConst.FIELD_GROUP_NAME); - String managerValue = uuid + this.companyLevelSeparator + job_grade_name; + String managerValue = uuid + this.companyLevelSeparator + job_grade_name; - if (systemDataSet.contains(managerValue)) { + if (systemDataSet.contains(managerValue)) { - DataLocation dataLocation = getDataLocation(fs); - String error = "绗� %s 琛岋紝绗� %s 鍒楋紝鏁版嵁閲嶅"; - error = String.format(error, dataLocation.getRowIndex(), dataLocation.getColIndex(CmnConst.FIELD_JOB_GRADE_NAME)); - errorEntity.addError(dataLocation.getRowIndex(), error); - continue; - } - systemDataSet.add(managerValue); - } - if (errorEntity.isError) { - errorEntity.newThrowBaseException(); - } - } - } - // 鍒ゆ柇鏈夋槸鍚︽湁鍏徃娌℃煡璇㈠埌 - if (companyNames != null && companyNames.size() > 0) { - List<FieldSetEntity> postGradeList = Lists.newArrayList(); - for (String companyName : companyNames) { - //灏嗘病鏌ヨ鍒扮殑鍏徃鎵�灞炲矖浣嶇瓑绾у悎骞� - postGradeList.addAll(groupCompany.get(companyName)); - } - if (postGradeList.size() > 0) { - //璋冪敤閿欒缁勮鍥炶皟 - callBack.method(postGradeList.toArray(new FieldSetEntity[]{})); - // 鎶涘嚭閿欒 - errorEntity.newThrowBaseException(); - } - } - // 淇濆瓨鎵�鏈夋暟鎹� - getBaseDao().add(dt); - return dt; - } - } - } catch (Exception e) { - e.printStackTrace(); + DataLocation dataLocation = getDataLocation(fs); + String error = "绗� %s 琛岋紝绗� %s 鍒楋紝鏁版嵁閲嶅"; + error = String.format(error, dataLocation.getRowIndex(), dataLocation.getColIndex(CmnConst.FIELD_JOB_GRADE_NAME)); + errorEntity.addError(dataLocation.getRowIndex(), error); + continue; + } + systemDataSet.add(managerValue); + } + if (errorEntity.isError) { + errorEntity.newThrowBaseException(); + } + } + } + // 鍒ゆ柇鏈夋槸鍚︽湁鍏徃娌℃煡璇㈠埌 + if (companyNames != null && companyNames.size() > 0) { + List<FieldSetEntity> postGradeList = Lists.newArrayList(); + for (String companyName : companyNames) { + //灏嗘病鏌ヨ鍒扮殑鍏徃鎵�灞炲矖浣嶇瓑绾у悎骞� + postGradeList.addAll(groupCompany.get(companyName)); + } + if (postGradeList.size() > 0) { + //璋冪敤閿欒缁勮鍥炶皟 + callBack.method(postGradeList.toArray(new FieldSetEntity[]{})); + // 鎶涘嚭閿欒 + errorEntity.newThrowBaseException(); + } + } + // 淇濆瓨鎵�鏈夋暟鎹� + getBaseDao().add(dt); + return dt; + } + } + } catch (Exception e) { + e.printStackTrace(); - errorEntity.newThrowBaseException("瀵煎叆宀椾綅绛夌骇澶辫触", e); - } - errorEntity.newThrowBaseException("瀵煎叆宀椾綅绛夌骇澶辫触锛屾湭鎻愬彇鍒版暟鎹�"); - return null; - } + errorEntity.newThrowBaseException("瀵煎叆宀椾綅绛夌骇澶辫触", e); + } + errorEntity.newThrowBaseException("瀵煎叆宀椾綅绛夌骇澶辫触锛屾湭鎻愬彇鍒版暟鎹�"); + return null; + } - /** - * 瀵煎叆宀椾綅 涔嬪墠 鏁版嵁澶勭悊 - * - * @param dt - * @throws BaseException - */ - @Override - public DataTableEntity importPostBefore(DataTableEntity dt) throws BaseException { - ImportErrorEntity errorEntity = new ImportErrorEntity(); - if (!BaseUtil.dataTableIsEmpty(dt)) { - SystemUser currentUser = SpringMVCContextHolder.getCurrentUser(); - //绠$悊鍛樻潈闄愰獙璇� - managerPermissionValidation(errorEntity, currentUser); - Map<String, String> fieldType = Maps.newHashMap(); - // 褰撳墠绠$悊鍛樼鐞嗙殑鍏徃 - String managerCompanyUuids = currentUser.getCurrentManager().getString(CmnConst.ORG_LEVEL_UUID); - fieldType.put(CmnConst.SEQUENCE, "int"); - String companyFilter = BaseUtil.buildQuestionMarkFilter(CmnConst.ORG_LEVEL_UUID, managerCompanyUuids.split(","), true); - StringBuilder sql = new StringBuilder(8); - sql.append(" SELECT org_level_all uuid, uuid dept_uuid,org_level_uuid FROM product_sys_org_levels where org_level_type=1 and length(org_level_uuid)>0 "); - sql.append(" and "); - sql.append(companyFilter); - DataTableEntity deptData = getBaseDao().listTable(sql.toString(), new Object[]{}); - if (BaseUtil.dataTableIsEmpty(deptData)) { - errorEntity.newThrowBaseException("鎮ㄦ墍绠$悊鐨勫叕鍙告病鏈夊彲渚涢�夋嫨鐨勯儴闂紝璇锋牳瀵归儴闂ㄦ暟鎹�"); - } - sql = new StringBuilder(8); - sql.append(" SELECT job_grade_name uuid,org_level_uuid,uuid grade_uuid "); - sql.append(" FROM product_sys_job_post_grades WHERE "); - sql.append(companyFilter); - // 鏌ヨ褰撳墠绠$悊绠$悊鍏徃鎵�鏈夌殑宀椾綅绛夌骇 - DataTableEntity postGradeData = getBaseDao().listTable(sql.toString(), new Object[]{}); - if (BaseUtil.dataTableIsEmpty(postGradeData)) { + /** + * 瀵煎叆宀椾綅 涔嬪墠 鏁版嵁澶勭悊 + * + * @param dt + * @throws BaseException + */ + @Override + public DataTableEntity importPostBefore(DataTableEntity dt) throws BaseException { + ImportErrorEntity errorEntity = new ImportErrorEntity(); + if (!BaseUtil.dataTableIsEmpty(dt)) { + SystemUser currentUser = SpringMVCContextHolder.getCurrentUser(); + //绠$悊鍛樻潈闄愰獙璇� + managerPermissionValidation(errorEntity, currentUser); + Map<String, String> fieldType = Maps.newHashMap(); + // 褰撳墠绠$悊鍛樼鐞嗙殑鍏徃 + String managerCompanyUuids = currentUser.getCurrentManager().getString(CmnConst.ORG_LEVEL_UUID); + fieldType.put(CmnConst.SEQUENCE, "int"); + String companyFilter = BaseUtil.buildQuestionMarkFilter(CmnConst.ORG_LEVEL_UUID, managerCompanyUuids.split(","), true); + StringBuilder sql = new StringBuilder(8); + sql.append(" SELECT org_level_all uuid, uuid dept_uuid,org_level_uuid FROM product_sys_org_levels where org_level_type=1 and length(org_level_uuid)>0 "); + sql.append(" and "); + sql.append(companyFilter); + DataTableEntity deptData = getBaseDao().listTable(sql.toString(), new Object[]{}); + if (BaseUtil.dataTableIsEmpty(deptData)) { + errorEntity.newThrowBaseException("鎮ㄦ墍绠$悊鐨勫叕鍙告病鏈夊彲渚涢�夋嫨鐨勯儴闂紝璇锋牳瀵归儴闂ㄦ暟鎹�"); + } + sql = new StringBuilder(8); + sql.append(" SELECT job_grade_name uuid,org_level_uuid,uuid grade_uuid "); + sql.append(" FROM product_sys_job_post_grades WHERE "); + sql.append(companyFilter); + // 鏌ヨ褰撳墠绠$悊绠$悊鍏徃鎵�鏈夌殑宀椾綅绛夌骇 + DataTableEntity postGradeData = getBaseDao().listTable(sql.toString(), new Object[]{}); + if (BaseUtil.dataTableIsEmpty(postGradeData)) { // errorEntity.newThrowBaseException("鎮ㄦ墍绠$悊鐨勫叕鍙告病鏈夊彲渚涢�夋嫨鐨勫矖浣嶇瓑绾э紝璇锋牳瀵瑰矖浣嶇瓑绾ф暟鎹�"); - } - for (int i = 0; i < dt.getRows(); i++) { - FieldSetEntity fse = dt.getFieldSetEntity(i); - // 瀛楁蹇呭~ & 绫诲瀷楠岃瘉 - boolean validationResult = fieldRequiredValidation(errorEntity, fse, new String[]{CmnConst.FIELD_DEPT_UUID, CmnConst.FIELD_JOB_POST_NAME, CmnConst.SEQUENCE}, fieldType); - if (!validationResult) { - // 楠岃瘉鏈�氳繃璺宠繃 - continue; - } - // 閮ㄩ棬鍏ㄧО - String deptAllName = fse.getString(CmnConst.FIELD_DEPT_UUID); - // 宀椾綅绛夌骇鍚嶇О - String[] gradeNames = BaseUtil.ifNull(fse.getString(CmnConst.FIELD_JOB_POST_GRADE), "").split(","); - List<FieldSetEntity> fieldSetEntity = deptData.getFieldSetEntity(deptAllName); - // 閮ㄩ棬鎵�鍦ㄧ殑鍏徃 - String companyUuid = null; - // 閿欒鏍囪瘑 - boolean errorFlag = false; - DataLocation dataLocation = null; - if (fieldSetEntity == null || fieldSetEntity.size() < 1) { - dataLocation = getDataLocation(fse); - String error = "绗� %s 琛岋紝绗� %s 鍒楋紝閮ㄩ棬涓嶅瓨鍦紝璇锋牳瀵� '%s' 鏁版嵁鍦ㄧ郴缁熶腑鏄惁瀛樺湪"; - error = String.format(error, dataLocation.getRowIndex(), dataLocation.getColIndex(CmnConst.FIELD_DEPT_UUID), dataLocation.getColName(CmnConst.FIELD_DEPT_UUID)); - errorEntity.addError(dataLocation.getRowIndex(), error); - errorFlag = true; - } else { - FieldSetEntity fs = fieldSetEntity.get(0); - companyUuid = fs.getString(CmnConst.ORG_LEVEL_UUID); - fse.setValue(CmnConst.FIELD_DEPT_UUID, fs.getString(CmnConst.FIELD_DEPT_UUID)); - } - // 鏍规嵁宀椾綅绛夌骇鍚嶇О鍙栧嚭鐩稿叧鏁版嵁 - List<FieldSetEntity> postGradeList = new ArrayList<>(); - for (String gradeName : gradeNames) { - if (!BaseUtil.dataTableIsEmpty(postGradeData) && postGradeData.getFieldSetEntity(gradeName) != null) { - postGradeList.addAll(postGradeData.getFieldSetEntity(gradeName)); - } - } - String error = "绗� %s 琛岋紝绗� %s 鍒楋紝宀椾綅绛夌骇涓嶅瓨鍦紝璇锋牳瀵� '%s' 鏁版嵁鍦ㄧ郴缁熶腑鏄惁瀛樺湪"; - // 鍒ゆ柇宀椾綅绛夌骇鏄惁瀛樺湪 榛樿涓嶆姏鍑洪敊璇� - if (postGradeList.size() < 1 && false) { - if (dataLocation == null) { - dataLocation = getDataLocation(fse); - } - error = String.format(error, dataLocation.getRowIndex(), dataLocation.getColIndex(CmnConst.FIELD_JOB_POST_GRADE), dataLocation.getColName(CmnConst.FIELD_JOB_POST_GRADE)); - errorEntity.addError(dataLocation.getRowIndex(), error); - errorFlag = true; - } else if (postGradeList.size() > 0) { - String gradeUuid = ""; - // 寰幆宀椾綅绛夌骇 - for (FieldSetEntity fs : postGradeList) { - // 鏌ユ壘宀椾綅绛夌骇涓庡叕鍙告槸鍚﹀尮閰� - if (companyUuid != null && companyUuid.equals(fs.getString(CmnConst.ORG_LEVEL_UUID))) { - if (!StringUtils.isEmpty(gradeUuid)) { - gradeUuid += ","; - } - gradeUuid += fs.getString("grade_uuid"); - } - } - // 娌℃湁鍖归厤鍒拌鍏徃涓嬫湁鐩稿簲鐨勫矖浣嶇瓑绾� - if (StringUtils.isEmpty(gradeUuid)) { - if (dataLocation == null) { - dataLocation = getDataLocation(fse); - } - error = "绗� %s 琛岋紝绗� %s 鍒楋紝宀椾綅绛夌骇鍦ㄤ笉瀛樺湪锛岃鏍稿 '%s' 鏁版嵁鍦ㄦ墍灞為儴闂ㄧ殑鍏徃涓槸鍚﹀瓨鍦�"; - error = String.format(error, dataLocation.getRowIndex(), dataLocation.getColIndex(CmnConst.FIELD_JOB_POST_GRADE), dataLocation.getColName(CmnConst.FIELD_JOB_POST_GRADE)); - errorEntity.addError(dataLocation.getRowIndex(), error); - errorFlag = true; - } else { - String[] gradeUuids = gradeUuid.split(","); - // 鍒涘缓宀椾綅涓庡矖浣嶇瓑绾х殑鏄犲皠琛� - DataTableEntity subGradeMapping = new DataTableEntity(); - for (String uuid : gradeUuids) { - FieldSetEntity gradeMappingFieldSet = new FieldSetEntity(); - gradeMappingFieldSet.setTableName(CmnConst.TABLE_PRODUCT_SYS_JOB_POSTS_GRADES_MAPPING); - gradeMappingFieldSet.setValue("job_grade_uuid", uuid); - BaseUtil.createCreatorAndCreationTime(gradeMappingFieldSet); - subGradeMapping.addFieldSetEntity(gradeMappingFieldSet); - } - fse.addSubDataTable(subGradeMapping); - fse.setValue(CmnConst.FIELD_JOB_POST_GRADE, null); - } - } - if (errorFlag) { - continue; - } - // 瀵煎叆鏁版嵁榛樿鍚敤 - fse.setValue(CmnConst.IS_USED, 1); - } - if (errorEntity.isError) { - errorEntity.newThrowBaseException(); - } else { - return dt; - } - } - errorEntity.newThrowBaseException("瀵煎叆宀椾綅绛夌骇澶辫触锛屾湭鎻愬彇鍒版暟鎹�"); - return null; - } + } + for (int i = 0; i < dt.getRows(); i++) { + FieldSetEntity fse = dt.getFieldSetEntity(i); + // 瀛楁蹇呭~ & 绫诲瀷楠岃瘉 + boolean validationResult = fieldRequiredValidation(errorEntity, fse, new String[]{CmnConst.FIELD_DEPT_UUID, CmnConst.FIELD_JOB_POST_NAME, CmnConst.SEQUENCE}, fieldType); + if (!validationResult) { + // 楠岃瘉鏈�氳繃璺宠繃 + continue; + } + // 閮ㄩ棬鍏ㄧО + String deptAllName = fse.getString(CmnConst.FIELD_DEPT_UUID); + // 宀椾綅绛夌骇鍚嶇О + String[] gradeNames = BaseUtil.ifNull(fse.getString(CmnConst.FIELD_JOB_POST_GRADE), "").split(","); + List<FieldSetEntity> fieldSetEntity = deptData.getFieldSetEntity(deptAllName); + // 閮ㄩ棬鎵�鍦ㄧ殑鍏徃 + String companyUuid = null; + // 閿欒鏍囪瘑 + boolean errorFlag = false; + DataLocation dataLocation = null; + if (fieldSetEntity == null || fieldSetEntity.size() < 1) { + dataLocation = getDataLocation(fse); + String error = "绗� %s 琛岋紝绗� %s 鍒楋紝閮ㄩ棬涓嶅瓨鍦紝璇锋牳瀵� '%s' 鏁版嵁鍦ㄧ郴缁熶腑鏄惁瀛樺湪"; + error = String.format(error, dataLocation.getRowIndex(), dataLocation.getColIndex(CmnConst.FIELD_DEPT_UUID), dataLocation.getColName(CmnConst.FIELD_DEPT_UUID)); + errorEntity.addError(dataLocation.getRowIndex(), error); + errorFlag = true; + } else { + FieldSetEntity fs = fieldSetEntity.get(0); + companyUuid = fs.getString(CmnConst.ORG_LEVEL_UUID); + fse.setValue(CmnConst.FIELD_DEPT_UUID, fs.getString(CmnConst.FIELD_DEPT_UUID)); + } + // 鏍规嵁宀椾綅绛夌骇鍚嶇О鍙栧嚭鐩稿叧鏁版嵁 + List<FieldSetEntity> postGradeList = new ArrayList<>(); + for (String gradeName : gradeNames) { + if (!BaseUtil.dataTableIsEmpty(postGradeData) && postGradeData.getFieldSetEntity(gradeName) != null) { + postGradeList.addAll(postGradeData.getFieldSetEntity(gradeName)); + } + } + String error = "绗� %s 琛岋紝绗� %s 鍒楋紝宀椾綅绛夌骇涓嶅瓨鍦紝璇锋牳瀵� '%s' 鏁版嵁鍦ㄧ郴缁熶腑鏄惁瀛樺湪"; + // 鍒ゆ柇宀椾綅绛夌骇鏄惁瀛樺湪 榛樿涓嶆姏鍑洪敊璇� + if (postGradeList.size() < 1 && false) { + if (dataLocation == null) { + dataLocation = getDataLocation(fse); + } + error = String.format(error, dataLocation.getRowIndex(), dataLocation.getColIndex(CmnConst.FIELD_JOB_POST_GRADE), dataLocation.getColName(CmnConst.FIELD_JOB_POST_GRADE)); + errorEntity.addError(dataLocation.getRowIndex(), error); + errorFlag = true; + } else if (postGradeList.size() > 0) { + String gradeUuid = ""; + // 寰幆宀椾綅绛夌骇 + for (FieldSetEntity fs : postGradeList) { + // 鏌ユ壘宀椾綅绛夌骇涓庡叕鍙告槸鍚﹀尮閰� + if (companyUuid != null && companyUuid.equals(fs.getString(CmnConst.ORG_LEVEL_UUID))) { + if (!StringUtils.isEmpty(gradeUuid)) { + gradeUuid += ","; + } + gradeUuid += fs.getString("grade_uuid"); + } + } + // 娌℃湁鍖归厤鍒拌鍏徃涓嬫湁鐩稿簲鐨勫矖浣嶇瓑绾� + if (StringUtils.isEmpty(gradeUuid)) { + if (dataLocation == null) { + dataLocation = getDataLocation(fse); + } + error = "绗� %s 琛岋紝绗� %s 鍒楋紝宀椾綅绛夌骇鍦ㄤ笉瀛樺湪锛岃鏍稿 '%s' 鏁版嵁鍦ㄦ墍灞為儴闂ㄧ殑鍏徃涓槸鍚﹀瓨鍦�"; + error = String.format(error, dataLocation.getRowIndex(), dataLocation.getColIndex(CmnConst.FIELD_JOB_POST_GRADE), dataLocation.getColName(CmnConst.FIELD_JOB_POST_GRADE)); + errorEntity.addError(dataLocation.getRowIndex(), error); + errorFlag = true; + } else { + String[] gradeUuids = gradeUuid.split(","); + // 鍒涘缓宀椾綅涓庡矖浣嶇瓑绾х殑鏄犲皠琛� + DataTableEntity subGradeMapping = new DataTableEntity(); + for (String uuid : gradeUuids) { + FieldSetEntity gradeMappingFieldSet = new FieldSetEntity(); + gradeMappingFieldSet.setTableName(CmnConst.TABLE_PRODUCT_SYS_JOB_POSTS_GRADES_MAPPING); + gradeMappingFieldSet.setValue("job_grade_uuid", uuid); + BaseUtil.createCreatorAndCreationTime(gradeMappingFieldSet); + subGradeMapping.addFieldSetEntity(gradeMappingFieldSet); + } + fse.addSubDataTable(subGradeMapping); + fse.setValue(CmnConst.FIELD_JOB_POST_GRADE, null); + } + } + if (errorFlag) { + continue; + } + // 瀵煎叆鏁版嵁榛樿鍚敤 + fse.setValue(CmnConst.IS_USED, 1); + } + if (errorEntity.isError) { + errorEntity.newThrowBaseException(); + } else { + return dt; + } + } + errorEntity.newThrowBaseException("瀵煎叆宀椾綅绛夌骇澶辫触锛屾湭鎻愬彇鍒版暟鎹�"); + return null; + } - /** - * 瀵煎叆鍛樺伐 涔嬪墠 鏁版嵁澶勭悊 - * - * @param fse - * @throws BaseException - */ - @Override - public DataTableEntity importStaffBefore(DataTableEntity fse) throws BaseException { - ImportStaffDataVo staffDataVo = new ImportStaffDataVo(fse); - staffDataVo.startImporting(); - return fse; - } + /** + * 瀵煎叆鍛樺伐 涔嬪墠 鏁版嵁澶勭悊 + * + * @param fse + * @throws BaseException + */ + @Override + public DataTableEntity importStaffBefore(DataTableEntity fse) throws BaseException { + ImportStaffDataVo staffDataVo = new ImportStaffDataVo(fse); + staffDataVo.startImporting(); + return fse; + } - /** - * 鍛樺伐瀵煎叆鎿嶄綔绫� - */ - private class ImportStaffDataVo { - //瀵煎叆鐨勬墍鏈夋暟鎹� - private DataTableEntity dt; - /** - * 閿欒澶勭悊绫� - */ - private ImportErrorEntity errorEntity; - /** - * 绯荤粺涓笂绾ч瀵兼暟鎹� - */ - DataTableEntity directLeaderData; - /** - * 閮ㄩ棬鏁版嵁 - */ - DataTableEntity deptData; - /** - * 瑙掕壊鏁版嵁 - */ - DataTableEntity roleData; - /** - * 宀椾綅 & 宀椾綅绛夌骇鏁版嵁 - */ - DataTableEntity postData; - /** - * 鍛樺伐琛ㄥ巻鍙叉暟鎹� - */ - DataTableEntity systemData; - /** - * 瀵煎叆鏁版嵁鐨勬墍鏈夐瀵�(鍛樺伐缂栫爜锛� - */ - Set<String> direct_leader_codes; - /** - * 瀵煎叆鐨勬暟鎹寜閮ㄩ棬鍒嗙粍 - */ - Map<String, List<FieldSetEntity>> deptGroupMap; - /** - * 褰撳墠鐢ㄦ埛 - */ - SystemUser currentUser; - /** - * 褰撳墠瀹㈡埛 - */ - String client_uuid; - /** - * 瀵煎叆鐨勬暟鎹互鍛樺伐缂栫爜瀛樻斁锛堝憳宸ョ紪鐮佹槸鍞竴鐨勶級 - */ - Map<String, FieldSetEntity> staffCodeMap; - /** - * 瀵煎叆鏁版嵁绫诲瀷楠岃瘉 - */ - Map<String, String> fieldType; - /** - * 鍏徃杩囨护鏉′欢 - */ - String companyFilter; - /** - * 鍒嗛殧绗� - */ - String separator = ">"; + /** + * 鍛樺伐瀵煎叆鎿嶄綔绫� + */ + private class ImportStaffDataVo { + //瀵煎叆鐨勬墍鏈夋暟鎹� + private DataTableEntity dt; + /** + * 閿欒澶勭悊绫� + */ + private ImportErrorEntity errorEntity; + /** + * 绯荤粺涓笂绾ч瀵兼暟鎹� + */ + DataTableEntity directLeaderData; + /** + * 閮ㄩ棬鏁版嵁 + */ + DataTableEntity deptData; + /** + * 瑙掕壊鏁版嵁 + */ + DataTableEntity roleData; + /** + * 宀椾綅 & 宀椾綅绛夌骇鏁版嵁 + */ + DataTableEntity postData; + /** + * 鍛樺伐琛ㄥ巻鍙叉暟鎹� + */ + DataTableEntity systemData; + /** + * 瀵煎叆鏁版嵁鐨勬墍鏈夐瀵�(鍛樺伐缂栫爜锛� + */ + Set<String> direct_leader_codes; + /** + * 瀵煎叆鐨勬暟鎹寜閮ㄩ棬鍒嗙粍 + */ + Map<String, List<FieldSetEntity>> deptGroupMap; + /** + * 褰撳墠鐢ㄦ埛 + */ + SystemUser currentUser; + /** + * 褰撳墠瀹㈡埛 + */ + String client_uuid; + /** + * 瀵煎叆鐨勬暟鎹互鍛樺伐缂栫爜瀛樻斁锛堝憳宸ョ紪鐮佹槸鍞竴鐨勶級 + */ + Map<String, FieldSetEntity> staffCodeMap; + /** + * 瀵煎叆鏁版嵁绫诲瀷楠岃瘉 + */ + Map<String, String> fieldType; + /** + * 鍏徃杩囨护鏉′欢 + */ + String companyFilter; + /** + * 鍒嗛殧绗� + */ + String separator = ">"; - StringBuilder sql; - /** - * 鍒濆瀵嗙爜 - * 鏉ユ簮浜� properties 涓殑鍒濆瀵嗙爜 濡備笉瀛樺湪榛樿涓� '123' - */ - String init_pwd; - /** - * 閮ㄩ棬鍏ㄧО瀛樻斁鐨勯儴闂ㄨ鎯呮暟鎹� - */ - private Map<String, FieldSetEntity> deptMap; - /** - * 鍛樺伐绠$悊service - * 瀹氫箟璇ユ搷浣滅被涓伩鍏嶆病蹇呰鐨勬敞鍏� 杩涘叆鏋勯�犳椂浼氬垵濮嬪寲瀵瑰簲bean - */ - private StaffManagerService staffManagerService; + StringBuilder sql; + /** + * 鍒濆瀵嗙爜 + * 鏉ユ簮浜� properties 涓殑鍒濆瀵嗙爜 濡備笉瀛樺湪榛樿涓� '123' + */ + String init_pwd; + /** + * 閮ㄩ棬鍏ㄧО瀛樻斁鐨勯儴闂ㄨ鎯呮暟鎹� + */ + private Map<String, FieldSetEntity> deptMap; + /** + * 鍛樺伐绠$悊service + * 瀹氫箟璇ユ搷浣滅被涓伩鍏嶆病蹇呰鐨勬敞鍏� 杩涘叆鏋勯�犳椂浼氬垵濮嬪寲瀵瑰簲bean + */ + private StaffManagerService staffManagerService; - /** - * 鏋勯�犳柟娉� 鐢ㄤ簬clone 闈炲繀瑕佷笉瑕佽嚜琛岃皟鐢ㄦ鏂规硶 - * - * @param currentData - * @param currentDeptData - */ - ImportStaffDataVo(FieldSetEntity currentData, FieldSetEntity currentDeptData) throws BaseException { - // 璇ユ瀯閫犵敤浜� clone 鏂规硶 - // 闈瀋lone 鏂瑰紡璋冪敤浼氬嚭鐜版湭鐭ラ敊璇� - this.currentData = currentData; - this.currentDeptData = currentDeptData; - if (currentData == null || currentDeptData == null) { - try { - throw new RuntimeException("Constructor arguments cannot be null"); - } catch (RuntimeException e) { - throw new BaseException(e); - } - } - } + /** + * 鏋勯�犳柟娉� 鐢ㄤ簬clone 闈炲繀瑕佷笉瑕佽嚜琛岃皟鐢ㄦ鏂规硶 + * + * @param currentData + * @param currentDeptData + */ + ImportStaffDataVo(FieldSetEntity currentData, FieldSetEntity currentDeptData) throws BaseException { + // 璇ユ瀯閫犵敤浜� clone 鏂规硶 + // 闈瀋lone 鏂瑰紡璋冪敤浼氬嚭鐜版湭鐭ラ敊璇� + this.currentData = currentData; + this.currentDeptData = currentDeptData; + if (currentData == null || currentDeptData == null) { + try { + throw new RuntimeException("Constructor arguments cannot be null"); + } catch (RuntimeException e) { + throw new BaseException(e); + } + } + } - /** - * 鏃犲弬鏋勯�� 鍒濆蹇呰鏁版嵁 - * - * @param dt - */ - public ImportStaffDataVo(DataTableEntity dt) throws BaseException { - errorEntity = new ImportErrorEntity(); - if (BaseUtil.dataTableIsEmpty(dt)) { - errorEntity.newThrowBaseException("瀵煎叆鍛樺伐澶辫触锛屾湭鎻愬彇鍒版暟鎹�"); - } - this.staffManagerService = SpringBeanUtil.getBean("staffManagerService", StaffManagerService.class); - direct_leader_codes = Sets.newHashSet(); - fieldType = Maps.newHashMap(); - currentUser = SpringMVCContextHolder.getCurrentUser(); - client_uuid = currentUser.getClient_uuid(); - staffCodeMap = Maps.newHashMap(); - deptGroupMap = Maps.newHashMap(); - init_pwd = Global.getSystemConfig("initial.pwd", "123"); - this.dt = dt; - //绠$悊鍛樻潈闄愰獙璇� - managerPermissionValidation(errorEntity, currentUser); - // 鍏徃杩囨护鏉′欢 - companyFilter = BaseUtil.buildQuestionMarkFilter(CmnConst.ORG_LEVEL_UUID, currentUser.getCurrentManager().getString(CmnConst.ORG_LEVEL_UUID).split(","), true); - fieldType.put("id_number", "id_card"); - fieldType.put("birth_date", "dateTime"); - fieldType.put("entry_datetime", "dateTime"); - fieldType.put("mobile_phone", "mobile_phone"); - fieldType.put("staff_email", "email"); - fieldType.put("age", "int"); - } + /** + * 鏃犲弬鏋勯�� 鍒濆蹇呰鏁版嵁 + * + * @param dt + */ + public ImportStaffDataVo(DataTableEntity dt) throws BaseException { + errorEntity = new ImportErrorEntity(); + if (BaseUtil.dataTableIsEmpty(dt)) { + errorEntity.newThrowBaseException("瀵煎叆鍛樺伐澶辫触锛屾湭鎻愬彇鍒版暟鎹�"); + } + this.staffManagerService = SpringBeanUtil.getBean("staffManagerService", StaffManagerService.class); + direct_leader_codes = Sets.newHashSet(); + fieldType = Maps.newHashMap(); + currentUser = SpringMVCContextHolder.getCurrentUser(); + client_uuid = currentUser.getClient_uuid(); + staffCodeMap = Maps.newHashMap(); + deptGroupMap = Maps.newHashMap(); + init_pwd = Global.getSystemConfig("initial.pwd", "123"); + this.dt = dt; + //绠$悊鍛樻潈闄愰獙璇� + managerPermissionValidation(errorEntity, currentUser); + // 鍏徃杩囨护鏉′欢 + companyFilter = BaseUtil.buildQuestionMarkFilter(CmnConst.ORG_LEVEL_UUID, currentUser.getCurrentManager().getString(CmnConst.ORG_LEVEL_UUID).split(","), true); + fieldType.put("id_number", "id_card"); + fieldType.put("birth_date", "dateTime"); + fieldType.put("entry_datetime", "dateTime"); + fieldType.put("mobile_phone", "mobile_phone"); + fieldType.put("staff_email", "email"); + fieldType.put("age", "int"); + } - /** - * 瀵煎叆鏁版嵁鍏ュ彛 - * 寮�濮嬪鍏� - */ - public void startImporting() throws BaseException { - // 鏁版嵁鏈夋晥鎬ч獙璇� 鏁版嵁蹇呭~楠岃瘉 & 鏁版嵁鏈夋晥鎬ч獙璇� & 鏁版嵁鍒嗙粍 - this.requiredValidation(); - // 鏌ヨ绯荤粺涓凡瀛樺湪鐨勫憳宸� - findExistStaff(); - // 鏁版嵁閲嶅楠岃瘉 - this.repeatValidation(); - this.throwError(); - // 鍒濆鍖栨墍闇�鏁版嵁 - this.initializeSystemData(); - // 寮�濮嬪鐞嗗鍏ユ暟鎹� - this.handleDataTable(); - } + /** + * 瀵煎叆鏁版嵁鍏ュ彛 + * 寮�濮嬪鍏� + */ + public void startImporting() throws BaseException { + // 鏁版嵁鏈夋晥鎬ч獙璇� 鏁版嵁蹇呭~楠岃瘉 & 鏁版嵁鏈夋晥鎬ч獙璇� & 鏁版嵁鍒嗙粍 + this.requiredValidation(); + // 鏌ヨ绯荤粺涓凡瀛樺湪鐨勫憳宸� + findExistStaff(); + // 鏁版嵁閲嶅楠岃瘉 + this.repeatValidation(); + this.throwError(); + // 鍒濆鍖栨墍闇�鏁版嵁 + this.initializeSystemData(); + // 寮�濮嬪鐞嗗鍏ユ暟鎹� + this.handleDataTable(); + } - /** - * handleDataTable 閬嶅巻鏃剁殑鏁版嵁 - * 鍙兘鏄�氳繃 clone 瀵硅薄璧嬪�肩殑 娌℃湁閫氳繃 handleDataTable 鏂规硶 - */ - private FieldSetEntity currentData; - /** - * handleDataTable 閬嶅巻鏁版嵁瀵瑰簲鐨勯儴闂� - * 鍙兘鏄�氳繃 clone 瀵硅薄璧嬪�肩殑 娌℃湁閫氳繃 handleDataTable 鏂规硶 - */ - private FieldSetEntity currentDeptData; + /** + * handleDataTable 閬嶅巻鏃剁殑鏁版嵁 + * 鍙兘鏄�氳繃 clone 瀵硅薄璧嬪�肩殑 娌℃湁閫氳繃 handleDataTable 鏂规硶 + */ + private FieldSetEntity currentData; + /** + * handleDataTable 閬嶅巻鏁版嵁瀵瑰簲鐨勯儴闂� + * 鍙兘鏄�氳繃 clone 瀵硅薄璧嬪�肩殑 娌℃湁閫氳繃 handleDataTable 鏂规硶 + */ + private FieldSetEntity currentDeptData; - /** - * 涓婄骇棰嗗鏈壘鍒� - */ - private void superStaffNotExist() throws BaseException { - DataLocation dataLocation = getDataLocation(this.currentData); - String error = "绗� %s 琛岋紝绗� %s 鍒楋紝涓婄骇棰嗗鑾峰彇澶辫触锛岃妫�鏌� %s 濉啓鍊兼槸鍚︽纭紝璇ュ垪鍊煎簲濉啓 %s 鍒楀搴旂殑鍊�"; - error = String.format(error, dataLocation.getRowIndex(), dataLocation.getColIndex(CmnConst.FIELD_DIRECT_LEADER_CODE), dataLocation.getColName(CmnConst.FIELD_DIRECT_LEADER_CODE), dataLocation.getColName(CmnConst.FIELD_STAFF_CODE)); - errorEntity.addError(dataLocation.getRowIndex(), error); - } + /** + * 涓婄骇棰嗗鏈壘鍒� + */ + private void superStaffNotExist() throws BaseException { + DataLocation dataLocation = getDataLocation(this.currentData); + String error = "绗� %s 琛岋紝绗� %s 鍒楋紝涓婄骇棰嗗鑾峰彇澶辫触锛岃妫�鏌� %s 濉啓鍊兼槸鍚︽纭紝璇ュ垪鍊煎簲濉啓 %s 鍒楀搴旂殑鍊�"; + error = String.format(error, dataLocation.getRowIndex(), dataLocation.getColIndex(CmnConst.FIELD_DIRECT_LEADER_CODE), dataLocation.getColName(CmnConst.FIELD_DIRECT_LEADER_CODE), dataLocation.getColName(CmnConst.FIELD_STAFF_CODE)); + errorEntity.addError(dataLocation.getRowIndex(), error); + } - /** - * 澶勭悊鎵�鏈夎褰� - */ - private void handleDataTable() throws BaseException { - for (Map.Entry<String, List<FieldSetEntity>> fieldSets : this.deptGroupMap.entrySet()) { - String deptAllName = fieldSets.getKey(); - currentDeptData = this.getStaffDept(deptAllName); - List<FieldSetEntity> values = fieldSets.getValue(); - if (currentDeptData == null) { - for (int i = 0; i < values.size(); i++) { - this.currentData = values.get(i); - DataLocation dataLocation = getDataLocation(this.currentData); - String error = "绗� %s 琛岋紝绗� %s 鍒楋紝閮ㄩ棬鍦ㄧ郴缁熸垨绠$悊鐨勫叕鍙镐腑涓嶅瓨鍦紝璇锋鏌ュ垪 '%s' 鐨勫�� '%s' 鏄惁姝g‘"; - error = String.format(error, dataLocation.getRowIndex(), dataLocation.getColIndex(CmnConst.FIELD_DEPT_UUID), - dataLocation.getColName(CmnConst.FIELD_DEPT_UUID), deptAllName); - this.errorEntity.addError(dataLocation.getRowIndex(), error); - } - continue; - } - for (FieldSetEntity value : values) { - if (value.getBoolean("~processed~")) { - continue; - } - this.currentData = value; - this.handleFieldSet(); - } - } - throwError(); - } + /** + * 澶勭悊鎵�鏈夎褰� + */ + private void handleDataTable() throws BaseException { + for (Map.Entry<String, List<FieldSetEntity>> fieldSets : this.deptGroupMap.entrySet()) { + String deptAllName = fieldSets.getKey(); + currentDeptData = this.getStaffDept(deptAllName); + List<FieldSetEntity> values = fieldSets.getValue(); + if (currentDeptData == null) { + for (int i = 0; i < values.size(); i++) { + this.currentData = values.get(i); + DataLocation dataLocation = getDataLocation(this.currentData); + String error = "绗� %s 琛岋紝绗� %s 鍒楋紝閮ㄩ棬鍦ㄧ郴缁熸垨绠$悊鐨勫叕鍙镐腑涓嶅瓨鍦紝璇锋鏌ュ垪 '%s' 鐨勫�� '%s' 鏄惁姝g‘"; + error = String.format(error, dataLocation.getRowIndex(), dataLocation.getColIndex(CmnConst.FIELD_DEPT_UUID), + dataLocation.getColName(CmnConst.FIELD_DEPT_UUID), deptAllName); + this.errorEntity.addError(dataLocation.getRowIndex(), error); + } + continue; + } + for (FieldSetEntity value : values) { + if (value.getBoolean("~processed~")) { + continue; + } + this.currentData = value; + this.handleFieldSet(); + } + } + throwError(); + } - /** - * 澶勭悊鍗曟潯璁板綍 - */ - private void handleFieldSet() throws BaseException { - if (this.currentData.getBoolean("~processed~")) { - return; - } - String dept_uuid = this.currentDeptData.getString(CmnConst.UUID); - String org_level_uuid = this.currentDeptData.getString(CmnConst.ORG_LEVEL_UUID); - this.currentData.setValue("~processed~", 1); - this.currentData.setValue("~dept_uuid~", dept_uuid); - this.currentData.setValue(CmnConst.FIELD_STAFF_CODE, this.currentData.getString("~temp_staff_code~")); - this.currentData.setValue(CmnConst.FIELD_DEPT_UUID, currentDeptData.getString(CmnConst.FIELD_DEPT_UUID)); - this.currentData.setValue(CmnConst.ORG_LEVEL_UUID, org_level_uuid); - this.currentData.setValue("status", 1); + /** + * 澶勭悊鍗曟潯璁板綍 + */ + private void handleFieldSet() throws BaseException { + if (this.currentData.getBoolean("~processed~")) { + return; + } + String dept_uuid = this.currentDeptData.getString(CmnConst.UUID); + String org_level_uuid = this.currentDeptData.getString(CmnConst.ORG_LEVEL_UUID); + this.currentData.setValue("~processed~", 1); + this.currentData.setValue("~dept_uuid~", dept_uuid); + this.currentData.setValue(CmnConst.FIELD_STAFF_CODE, this.currentData.getString("~temp_staff_code~")); + this.currentData.setValue(CmnConst.FIELD_DEPT_UUID, currentDeptData.getString(CmnConst.FIELD_DEPT_UUID)); + this.currentData.setValue(CmnConst.ORG_LEVEL_UUID, org_level_uuid); + this.currentData.setValue("status", 1); - //鍙栧嚭閰嶇疆涓处鎴峰垵濮嬪瘑鐮� - this.currentData.setValue(CmnConst.USER_PWD, this.init_pwd); - String sex = this.currentData.getString("sex"); - if (!StringUtils.isEmpty(sex)) { - // 鎬у埆涓嶄负绌烘椂 杞崲鍙傜収鏁版嵁 鎬у埆楠岃瘉宸插湪涓婁釜鏂规硶涓獙璇佽繃 - this.currentData.setValue("sex", sex.equals("鐢�") ? 0 : 1); - } - // 瀵煎叆鏁版嵁閰嶇疆涓� 浣跨敤 staff_avatar 瀛楁浣滀负鐢ㄦ埛鐧诲綍璐︽埛鐨勮浇浣� 鍦ㄦ澶勮浆鎹㈠洖鏉� - this.currentData.setValue(CmnConst.USER_ACCOUNT, this.currentData.getString("staff_avatar")); - // 鍒犻櫎杞戒綋鏁版嵁 - this.currentData.remove("staff_avatar"); - // 灏唖how_name 瀛楁锛堝憳宸ュ悕绉帮級 澶嶅埗鍒� user琛ㄥ瓧娈典笂 - this.currentData.setValue(CmnConst.USER_NAME, this.currentData.getString("show_name")); - String job_post_grade_uuid = this.currentData.getString(CmnConst.FIELD_JOB_POST_GRADE_UUID); - String job_post_name = this.currentData.getString("job_post_uuid"); + //鍙栧嚭閰嶇疆涓处鎴峰垵濮嬪瘑鐮� + this.currentData.setValue(CmnConst.USER_PWD, this.init_pwd); + String sex = this.currentData.getString("sex"); + if (!StringUtils.isEmpty(sex)) { + // 鎬у埆涓嶄负绌烘椂 杞崲鍙傜収鏁版嵁 鎬у埆楠岃瘉宸插湪涓婁釜鏂规硶涓獙璇佽繃 + this.currentData.setValue("sex", sex.equals("鐢�") ? 0 : 1); + } + // 瀵煎叆鏁版嵁閰嶇疆涓� 浣跨敤 staff_avatar 瀛楁浣滀负鐢ㄦ埛鐧诲綍璐︽埛鐨勮浇浣� 鍦ㄦ澶勮浆鎹㈠洖鏉� + this.currentData.setValue(CmnConst.USER_ACCOUNT, this.currentData.getString("staff_avatar")); + // 鍒犻櫎杞戒綋鏁版嵁 + this.currentData.remove("staff_avatar"); + // 灏唖how_name 瀛楁锛堝憳宸ュ悕绉帮級 澶嶅埗鍒� user琛ㄥ瓧娈典笂 + this.currentData.setValue(CmnConst.USER_NAME, this.currentData.getString("show_name")); + String job_post_grade_uuid = this.currentData.getString(CmnConst.FIELD_JOB_POST_GRADE_UUID); + String job_post_name = this.currentData.getString("job_post_uuid"); - // 宀椾綅 & 宀椾綅绛夌骇 - List<FieldSetEntity> postDataList = postData.getFieldSetEntity(this.currentData.getString("job_post_uuid")); - if (postDataList == null || postDataList.size() <= 0) { - // 娌℃湁宀椾綅 - postNotExist.method(this.currentData, "job_post_uuid"); - } else { - // 璁板綍鎵惧埌鐨勫矖浣嶇瓑绾uid 锛屽涓敤閫楀彿鍒嗛殧 - String grade_uuid = ""; - // 宀椾綅uuid - String post_uuid = null; - // 寰幆绯荤粺涓矖浣嶆暟鎹� - for (FieldSetEntity postFs : postDataList) { - // 鍒ゆ柇宀椾綅鏄惁鍦ㄩ儴闂ㄤ笅 & 宀椾綅鍚嶇О鍜屽鍏ユ暟鎹殑宀椾綅鍚嶇О鏄惁鐩稿悓 - if (currentDeptData.getString(CmnConst.FIELD_DEPT_UUID).equals(postFs.getString(CmnConst.FIELD_DEPT_UUID)) && job_post_name.equals(postFs.getUUID())) { - // 绯荤粺涓矖浣嶇殑uuid - String job_post_uuid = postFs.getString("job_post_uuid"); - // 宀椾綅uuid涓嶄负绌烘椂 鍒ゆ柇褰撳墠postFs 涓殑宀椾綅uuid鏄惁璺熷凡鎵惧埌鐨勫矖浣嶇浉鍚� - if (post_uuid != null && !post_uuid.equals(job_post_uuid)) { - continue; - } - if (post_uuid == null) { - // 璁板綍宀椾綅uuid - post_uuid = job_post_uuid; - } - // 鑾峰彇宀椾綅涓殑宀椾綅绛夌骇鍚嶇О - String job_grade_name = postFs.getString(CmnConst.FIELD_JOB_GRADE_NAME); - // 鎷嗗垎寰幆瀵煎叆宀椾綅绛夌骇鍚嶇О - if (!BaseUtil.strIsNull(job_post_grade_uuid)) { - for (String grade_name : job_post_grade_uuid.split(",")) { - // 鍒ゆ柇宀椾綅绛夌骇鍚嶇О鍜岀郴缁熶腑鐩稿悓 - if (job_grade_name.equals(grade_name)) { - if (!StringUtils.isEmpty(grade_uuid)) { - grade_uuid += ","; - } - grade_uuid += postFs.getString(CmnConst.FIELD_JOB_POST_GRADE); - } - } - } - } + // 宀椾綅 & 宀椾綅绛夌骇 + List<FieldSetEntity> postDataList = postData.getFieldSetEntity(this.currentData.getString("job_post_uuid")); + if (postDataList == null || postDataList.size() <= 0) { + // 娌℃湁宀椾綅 + postNotExist.method(this.currentData, "job_post_uuid"); + } else { + // 璁板綍鎵惧埌鐨勫矖浣嶇瓑绾uid 锛屽涓敤閫楀彿鍒嗛殧 + String grade_uuid = ""; + // 宀椾綅uuid + String post_uuid = null; + // 寰幆绯荤粺涓矖浣嶆暟鎹� + for (FieldSetEntity postFs : postDataList) { + // 鍒ゆ柇宀椾綅鏄惁鍦ㄩ儴闂ㄤ笅 & 宀椾綅鍚嶇О鍜屽鍏ユ暟鎹殑宀椾綅鍚嶇О鏄惁鐩稿悓 + if (currentDeptData.getString(CmnConst.FIELD_DEPT_UUID).equals(postFs.getString(CmnConst.FIELD_DEPT_UUID)) && job_post_name.equals(postFs.getUUID())) { + // 绯荤粺涓矖浣嶇殑uuid + String job_post_uuid = postFs.getString("job_post_uuid"); + // 宀椾綅uuid涓嶄负绌烘椂 鍒ゆ柇褰撳墠postFs 涓殑宀椾綅uuid鏄惁璺熷凡鎵惧埌鐨勫矖浣嶇浉鍚� + if (post_uuid != null && !post_uuid.equals(job_post_uuid)) { + continue; + } + if (post_uuid == null) { + // 璁板綍宀椾綅uuid + post_uuid = job_post_uuid; + } + // 鑾峰彇宀椾綅涓殑宀椾綅绛夌骇鍚嶇О + String job_grade_name = postFs.getString(CmnConst.FIELD_JOB_GRADE_NAME); + // 鎷嗗垎寰幆瀵煎叆宀椾綅绛夌骇鍚嶇О + if (!BaseUtil.strIsNull(job_post_grade_uuid)) { + for (String grade_name : job_post_grade_uuid.split(",")) { + // 鍒ゆ柇宀椾綅绛夌骇鍚嶇О鍜岀郴缁熶腑鐩稿悓 + if (job_grade_name.equals(grade_name)) { + if (!StringUtils.isEmpty(grade_uuid)) { + grade_uuid += ","; + } + grade_uuid += postFs.getString(CmnConst.FIELD_JOB_POST_GRADE); + } + } + } + } - } - // 娌℃湁鎵惧埌宀椾綅 - if (StringUtils.isEmpty(post_uuid)) { - // 鎶涘嚭宀椾綅鏈壘鍒伴敊璇� - postNotExist.method(this.currentData, "job_post_uuid"); - } else { - // 鎵惧埌宀椾綅 - this.currentData.setValue("job_post_uuid", post_uuid); - } - // 娌℃湁鎵惧埌宀椾綅绛夌骇 - if (!StringUtils.isEmpty(grade_uuid)) { + } + // 娌℃湁鎵惧埌宀椾綅 + if (StringUtils.isEmpty(post_uuid)) { + // 鎶涘嚭宀椾綅鏈壘鍒伴敊璇� + postNotExist.method(this.currentData, "job_post_uuid"); + } else { + // 鎵惧埌宀椾綅 + this.currentData.setValue("job_post_uuid", post_uuid); + } + // 娌℃湁鎵惧埌宀椾綅绛夌骇 + if (!StringUtils.isEmpty(grade_uuid)) { // postNotExist.method(this.currentData, CmnConst.FIELD_JOB_POST_GRADE_UUID); // } else { - this.currentData.setValue(CmnConst.FIELD_JOB_POST_GRADE_UUID, grade_uuid); - } - } - // 瀵煎叆鏁版嵁涓矖浣嶅悕绉� - String[] role_uuids = this.currentData.getString("role_uuids").split(","); - String roleUuid = ""; - // 瑙掕壊澶勭悊 - roleFor: - // 寰幆瑙掕壊鍚嶇О - for (String roleName : role_uuids) { - // 浣跨敤瑙掕壊鍚嶇О鑾峰彇绯荤粺鏁版嵁 - List<FieldSetEntity> roleList = roleData.getFieldSetEntity(roleName); - if (roleList != null && roleList.size() > 0) { - // 寰幆绯荤粺涓殑瑙掕壊 - for (FieldSetEntity roleFs : roleList) { - // 鍥犵郴缁熶腑瑙掕壊鎵�灞炲叕鍙稿彲澶氶�夛紝鍦ㄦ澶勫墠鍚庢嫾鎺ラ�楀彿 - String roleCompany = "," + roleFs.getString(CmnConst.ORG_LEVEL_UUID) + ","; - // 鍒ゆ柇瑙掕壊鏄惁鏈夊鍏ユ暟鎹殑鍏徃 - if (roleCompany.contains("," + org_level_uuid + ",")) { - String role_uuid = roleFs.getString("role_uuid"); - if (!StringUtils.isEmpty(roleUuid)) { - roleUuid += ","; - } - roleUuid += role_uuid; - continue roleFor; - } - } - } + this.currentData.setValue(CmnConst.FIELD_JOB_POST_GRADE_UUID, grade_uuid); + } + } + // 瀵煎叆鏁版嵁涓矖浣嶅悕绉� + String[] role_uuids = this.currentData.getString("role_uuids").split(","); + String roleUuid = ""; + // 瑙掕壊澶勭悊 + roleFor: + // 寰幆瑙掕壊鍚嶇О + for (String roleName : role_uuids) { + // 浣跨敤瑙掕壊鍚嶇О鑾峰彇绯荤粺鏁版嵁 + List<FieldSetEntity> roleList = roleData.getFieldSetEntity(roleName); + if (roleList != null && roleList.size() > 0) { + // 寰幆绯荤粺涓殑瑙掕壊 + for (FieldSetEntity roleFs : roleList) { + // 鍥犵郴缁熶腑瑙掕壊鎵�灞炲叕鍙稿彲澶氶�夛紝鍦ㄦ澶勫墠鍚庢嫾鎺ラ�楀彿 + String roleCompany = "," + roleFs.getString(CmnConst.ORG_LEVEL_UUID) + ","; + // 鍒ゆ柇瑙掕壊鏄惁鏈夊鍏ユ暟鎹殑鍏徃 + if (roleCompany.contains("," + org_level_uuid + ",")) { + String role_uuid = roleFs.getString("role_uuid"); + if (!StringUtils.isEmpty(roleUuid)) { + roleUuid += ","; + } + roleUuid += role_uuid; + continue roleFor; + } + } + } - // 娌℃湁鎵惧埌瑙掕壊鏁版嵁 鎶涘嚭閿欒 - roleNotExist.method(this.currentData, roleName); + // 娌℃湁鎵惧埌瑙掕壊鏁版嵁 鎶涘嚭閿欒 + roleNotExist.method(this.currentData, roleName); - } - this.currentData.setValue("role_uuids", roleUuid); - //瑁呰浇涓婄骇棰嗗code - this.loadingSuperCode(); - if (staffManagerService == null) { - staffManagerService = SpringBeanUtil.getBean("staffManagerService", StaffManagerService.class); - } - staffManagerService.saveStaffInfo(this.currentData); - } + } + this.currentData.setValue("role_uuids", roleUuid); + //瑁呰浇涓婄骇棰嗗code + this.loadingSuperCode(); + if (staffManagerService == null) { + staffManagerService = SpringBeanUtil.getBean("staffManagerService", StaffManagerService.class); + } + staffManagerService.saveStaffInfo(this.currentData); + } - /** - * 鎶涘嚭閿欒 - * - * @throws BaseException - */ - void throwError() throws BaseException { - if (errorEntity.isError) { - errorEntity.newThrowBaseException(); - } - } + /** + * 鎶涘嚭閿欒 + * + * @throws BaseException + */ + void throwError() throws BaseException { + if (errorEntity.isError) { + errorEntity.newThrowBaseException(); + } + } - /** - * 瑁呰浇涓婄骇棰嗗缂栫爜 - * - * @return - */ - private boolean loadingSuperCode() throws BaseException { - // 涓婄骇棰嗗锛堝憳宸ョ紪鐮侊級 - String direct_leader_code = this.currentData.getString(CmnConst.FIELD_DIRECT_LEADER_CODE); - String superCode = ""; - if (!StringUtils.isEmpty(direct_leader_code)) { - List<FieldSetEntity> fieldSetEntity = directLeaderData.getFieldSetEntity(direct_leader_code); - if (staffCodeMap.get(direct_leader_code) == null && (fieldSetEntity == null || fieldSetEntity.size() <= 0)) { - // 鏈壘鍒颁笂绾ч瀵� - this.superStaffNotExist(); - return false; - } else { - //涓婄骇棰嗗鍦ㄥ鍏ユ暟鎹� 鎴栫郴缁熶腑宸插瓨鍦� - // 鏍规嵁缂栫爜鑾峰彇涓婄骇锛堝鍏ユ暟鎹級 - FieldSetEntity superFs = staffCodeMap.get(direct_leader_code); - if (superFs == null && (fieldSetEntity == null || fieldSetEntity.size() <= 0)) { - // 鏈壘鍒颁笂绾ч瀵� - this.superStaffNotExist(); - return false; - } else if (superFs == null) { - // 鍦ㄧ郴缁熶腑鎷垮嚭涓婄骇棰嗗 - superFs = fieldSetEntity.get(0); - } - String user_id = superFs.getString(CmnConst.USER_ID); - if (StringUtils.isEmpty(user_id)) { - // user_id 涓嶅瓨鍦紝璇ヤ笂绾у湪瀵煎叆鏁版嵁涓湭淇濆瓨杩� - String deptAllName = superFs.getString(CmnConst.FIELD_DEPT_UUID); - if (superFs.getBoolean("~processed~")) { - deptAllName = superFs.getString("~" + CmnConst.FIELD_DEPT_UUID + "~"); - } - FieldSetEntity deptFs = getStaffDept(deptAllName); - if (deptFs == null) { - return false; - } - // 鍏嬮殕褰撳墠瀵硅薄 灏嗙埗绾х殑閮ㄩ棬 & 鍛樺伐琛ㄦ暟鎹斁鍏ュ厠闅嗗璞′腑 - ImportStaffDataVo clone = this.clone(deptFs, superFs); - // 鍏堣鐖剁骇鏁版嵁杩涜淇濆瓨鎿嶄綔 - // 杩欓噷浼氬嚭鐜伴�掑綊鎿嶄綔 鍥犱负 handleFieldSet 鏂规硶璋冪敤浜嗗綋鍓嶆柟娉� 鐖剁骇鐨勭埗绾ц繘鍏ヤ竴鑷寸殑鍒ゆ柇浼氫竴鐩撮�掑綊 clone骞朵繚瀛� - // 濡傛灉閫掑綊灞傛暟杩囧鍙兘浼氬嚭鐜� full gc - clone.handleFieldSet(); - } else { - //宸蹭繚瀛樿繃鐨勬暟鎹� 鍙栧嚭宸茬敓鎴愮殑tricode - superCode = superFs.getString(CmnConst.TRICODE); - } - } - } - this.currentData.setValue(CmnConst.FIELD_DIRECT_LEADER_CODE, superCode); - return true; - } + /** + * 瑁呰浇涓婄骇棰嗗缂栫爜 + * + * @return + */ + private boolean loadingSuperCode() throws BaseException { + // 涓婄骇棰嗗锛堝憳宸ョ紪鐮侊級 + String direct_leader_code = this.currentData.getString(CmnConst.FIELD_DIRECT_LEADER_CODE); + String superCode = ""; + if (!StringUtils.isEmpty(direct_leader_code)) { + List<FieldSetEntity> fieldSetEntity = directLeaderData.getFieldSetEntity(direct_leader_code); + if (staffCodeMap.get(direct_leader_code) == null && (fieldSetEntity == null || fieldSetEntity.size() <= 0)) { + // 鏈壘鍒颁笂绾ч瀵� + this.superStaffNotExist(); + return false; + } else { + //涓婄骇棰嗗鍦ㄥ鍏ユ暟鎹� 鎴栫郴缁熶腑宸插瓨鍦� + // 鏍规嵁缂栫爜鑾峰彇涓婄骇锛堝鍏ユ暟鎹級 + FieldSetEntity superFs = staffCodeMap.get(direct_leader_code); + if (superFs == null && (fieldSetEntity == null || fieldSetEntity.size() <= 0)) { + // 鏈壘鍒颁笂绾ч瀵� + this.superStaffNotExist(); + return false; + } else if (superFs == null) { + // 鍦ㄧ郴缁熶腑鎷垮嚭涓婄骇棰嗗 + superFs = fieldSetEntity.get(0); + } + String user_id = superFs.getString(CmnConst.USER_ID); + if (StringUtils.isEmpty(user_id)) { + // user_id 涓嶅瓨鍦紝璇ヤ笂绾у湪瀵煎叆鏁版嵁涓湭淇濆瓨杩� + String deptAllName = superFs.getString(CmnConst.FIELD_DEPT_UUID); + if (superFs.getBoolean("~processed~")) { + deptAllName = superFs.getString("~" + CmnConst.FIELD_DEPT_UUID + "~"); + } + FieldSetEntity deptFs = getStaffDept(deptAllName); + if (deptFs == null) { + return false; + } + // 鍏嬮殕褰撳墠瀵硅薄 灏嗙埗绾х殑閮ㄩ棬 & 鍛樺伐琛ㄦ暟鎹斁鍏ュ厠闅嗗璞′腑 + ImportStaffDataVo clone = this.clone(deptFs, superFs); + // 鍏堣鐖剁骇鏁版嵁杩涜淇濆瓨鎿嶄綔 + // 杩欓噷浼氬嚭鐜伴�掑綊鎿嶄綔 鍥犱负 handleFieldSet 鏂规硶璋冪敤浜嗗綋鍓嶆柟娉� 鐖剁骇鐨勭埗绾ц繘鍏ヤ竴鑷寸殑鍒ゆ柇浼氫竴鐩撮�掑綊 clone骞朵繚瀛� + // 濡傛灉閫掑綊灞傛暟杩囧鍙兘浼氬嚭鐜� full gc + clone.handleFieldSet(); + } else { + //宸蹭繚瀛樿繃鐨勬暟鎹� 鍙栧嚭宸茬敓鎴愮殑tricode + superCode = superFs.getString(CmnConst.TRICODE); + } + } + } + this.currentData.setValue(CmnConst.FIELD_DIRECT_LEADER_CODE, superCode); + return true; + } - /** - * 鍏嬮殕瀵硅薄 - * 鍏嬮殕鍚� sql 鎴愬憳鍙橀噺鏈垵濮嬪寲 - * - * @param currentDeptData - * @param currentData - * @return - */ - private ImportStaffDataVo clone(FieldSetEntity currentDeptData, FieldSetEntity currentData) throws BaseException { - ImportStaffDataVo clone = new ImportStaffDataVo(currentData, currentDeptData); - clone.deptData = this.deptData; - clone.postData = this.postData; - clone.roleData = this.roleData; - clone.deptGroupMap = this.deptGroupMap; - clone.errorEntity = this.errorEntity; - clone.direct_leader_codes = this.direct_leader_codes; - clone.deptMap = this.deptMap; - clone.dt = this.dt; - clone.systemData = this.systemData; - clone.directLeaderData = this.directLeaderData; - clone.staffCodeMap = this.staffCodeMap; - clone.companyFilter = this.companyFilter; - clone.currentUser = this.currentUser; - clone.fieldType = this.fieldType; - clone.init_pwd = this.init_pwd; - clone.client_uuid = this.client_uuid; - return clone; - } + /** + * 鍏嬮殕瀵硅薄 + * 鍏嬮殕鍚� sql 鎴愬憳鍙橀噺鏈垵濮嬪寲 + * + * @param currentDeptData + * @param currentData + * @return + */ + private ImportStaffDataVo clone(FieldSetEntity currentDeptData, FieldSetEntity currentData) throws BaseException { + ImportStaffDataVo clone = new ImportStaffDataVo(currentData, currentDeptData); + clone.deptData = this.deptData; + clone.postData = this.postData; + clone.roleData = this.roleData; + clone.deptGroupMap = this.deptGroupMap; + clone.errorEntity = this.errorEntity; + clone.direct_leader_codes = this.direct_leader_codes; + clone.deptMap = this.deptMap; + clone.dt = this.dt; + clone.systemData = this.systemData; + clone.directLeaderData = this.directLeaderData; + clone.staffCodeMap = this.staffCodeMap; + clone.companyFilter = this.companyFilter; + clone.currentUser = this.currentUser; + clone.fieldType = this.fieldType; + clone.init_pwd = this.init_pwd; + clone.client_uuid = this.client_uuid; + return clone; + } - /** - * 鏍规嵁閮ㄩ棬鍏ㄧО鑾峰彇閮ㄩ棬璇︽儏 - * - * @param deptAllName - * @return - * @throws BaseException - */ - private FieldSetEntity getStaffDept(String deptAllName) throws BaseException { - if (deptMap == null) { - deptMap = Maps.newHashMap(); - } - if (deptMap.get(deptAllName) != null) { - return deptMap.get(deptAllName); - } - List<FieldSetEntity> deptDatList = deptData.getFieldSetEntity(deptAllName); - if (deptDatList == null || deptDatList.size() < 0) { - return null; - } - return deptDatList.get(0); - } + /** + * 鏍规嵁閮ㄩ棬鍏ㄧО鑾峰彇閮ㄩ棬璇︽儏 + * + * @param deptAllName + * @return + * @throws BaseException + */ + private FieldSetEntity getStaffDept(String deptAllName) throws BaseException { + if (deptMap == null) { + deptMap = Maps.newHashMap(); + } + if (deptMap.get(deptAllName) != null) { + return deptMap.get(deptAllName); + } + List<FieldSetEntity> deptDatList = deptData.getFieldSetEntity(deptAllName); + if (deptDatList == null || deptDatList.size() < 0) { + return null; + } + return deptDatList.get(0); + } - /** - * 瑙掕壊鏈壘鍒伴敊璇洖璋� - */ - private CallBack<Object> roleNotExist = f -> { - FieldSetEntity fs = (FieldSetEntity) f[0]; - Object role_name = f[1]; - DataLocation dataLocation = getDataLocation(fs); - String error = "绗� %s 琛岋紝绗� %s 鍒楋紝%s 鍦ㄧ郴缁熶腑涓嶅瓨鍦紝璇锋鏌ュ垪鍊�%s 鏄惁姝g‘"; - error = String.format(error, dataLocation.getRowIndex(), dataLocation.getColIndex("role_uuids"), - dataLocation.getColName("role_uuids"), role_name); - errorEntity.addError(dataLocation.getRowIndex(), error); - }; - /** - * 宀椾綅 & 宀椾綅绛夌骇鏈壘鍒伴敊璇洖璋� - */ - private CallBack<Object> postNotExist = f -> { - FieldSetEntity fs = (FieldSetEntity) f[0]; - String fieldName = (String) f[1]; - DataLocation datLocation = getDataLocation(fs); - String error = "绗� %s 琛岋紝绗� %s 鍒楋紝'%s' 鏁版嵁鍦ㄧ郴缁熶腑涓嶅瓨鍦紝璇锋鏌� '%s' 鏄惁姝g‘"; - error = String.format(error, datLocation.getRowIndex(), datLocation.getColIndex(fieldName), - datLocation.getColName(fieldName), fs.getString(fieldName)); - errorEntity.addError(datLocation.getRowIndex(), error); - }; + /** + * 瑙掕壊鏈壘鍒伴敊璇洖璋� + */ + private CallBack<Object> roleNotExist = f -> { + FieldSetEntity fs = (FieldSetEntity) f[0]; + Object role_name = f[1]; + DataLocation dataLocation = getDataLocation(fs); + String error = "绗� %s 琛岋紝绗� %s 鍒楋紝%s 鍦ㄧ郴缁熶腑涓嶅瓨鍦紝璇锋鏌ュ垪鍊�%s 鏄惁姝g‘"; + error = String.format(error, dataLocation.getRowIndex(), dataLocation.getColIndex("role_uuids"), + dataLocation.getColName("role_uuids"), role_name); + errorEntity.addError(dataLocation.getRowIndex(), error); + }; + /** + * 宀椾綅 & 宀椾綅绛夌骇鏈壘鍒伴敊璇洖璋� + */ + private CallBack<Object> postNotExist = f -> { + FieldSetEntity fs = (FieldSetEntity) f[0]; + String fieldName = (String) f[1]; + DataLocation datLocation = getDataLocation(fs); + String error = "绗� %s 琛岋紝绗� %s 鍒楋紝'%s' 鏁版嵁鍦ㄧ郴缁熶腑涓嶅瓨鍦紝璇锋鏌� '%s' 鏄惁姝g‘"; + error = String.format(error, datLocation.getRowIndex(), datLocation.getColIndex(fieldName), + datLocation.getColName(fieldName), fs.getString(fieldName)); + errorEntity.addError(datLocation.getRowIndex(), error); + }; - /** - * 鍒濆鍖栫郴缁熸暟鎹� - */ - private void initializeSystemData() throws BaseException { - //鏌ヨ涓婄骇棰嗗 - findDirectLeaderData(); - // 鏌ヨ绠$悊鍛樼鐞嗙殑(鍏徃涓嬬殑)閮ㄩ棬 - findDeptData(); - // 绠$悊鍛樼鐞嗙殑瑙掕壊 - findRoleData(); - // 绠$悊鍛樼鐞嗙殑宀椾綅 & 宀椾綅绛夌骇 - findPostData(); - this.throwError(); - } + /** + * 鍒濆鍖栫郴缁熸暟鎹� + */ + private void initializeSystemData() throws BaseException { + //鏌ヨ涓婄骇棰嗗 + findDirectLeaderData(); + // 鏌ヨ绠$悊鍛樼鐞嗙殑(鍏徃涓嬬殑)閮ㄩ棬 + findDeptData(); + // 绠$悊鍛樼鐞嗙殑瑙掕壊 + findRoleData(); + // 绠$悊鍛樼鐞嗙殑宀椾綅 & 宀椾綅绛夌骇 + findPostData(); + this.throwError(); + } - /** - * 鏌ヨ鎵�鏈夊矖浣� & 宀椾綅绛夌骇 - */ - private void findPostData() throws BaseException { - sql = new StringBuilder(); - sql.append(" select a.job_post_name uuid,a.uuid job_post_uuid,c.job_grade_name,c.uuid job_post_grades_uuid,a.dept_uuid FROM product_sys_job_posts a "); - sql.append(" LEFT join product_sys_job_posts_grades_mapping b on "); - sql.append(" a.dept_uuid in (select uuid FROM product_sys_org_levels where org_level_type=1 and "); - sql.append(companyFilter); - sql.append(" ) and a.uuid=b.job_post_uuid "); - sql.append(" LEFT join product_sys_job_post_grades c on b.job_grade_uuid=c.uuid "); - sql.append(" group by a.job_post_name,a.uuid ,c.job_grade_name,c.uuid,a.dept_uuid "); - // 鏌ヨ宀椾綅 & 宀椾綅绛夌骇 - postData = getBaseDao().listTable(sql.toString(), new Object[]{}); - if (BaseUtil.dataTableIsEmpty(roleData)) { - errorEntity.addError(0, "绯荤粺涓病鏈夊彲渚涢�夋嫨鐨勫矖浣嶆垨宀椾綅绛夌骇"); - } - } + /** + * 鏌ヨ鎵�鏈夊矖浣� & 宀椾綅绛夌骇 + */ + private void findPostData() throws BaseException { + sql = new StringBuilder(); + sql.append(" select a.job_post_name uuid,a.uuid job_post_uuid,c.job_grade_name,c.uuid job_post_grades_uuid,a.dept_uuid FROM product_sys_job_posts a "); + sql.append(" LEFT join product_sys_job_posts_grades_mapping b on "); + sql.append(" a.dept_uuid in (select uuid FROM product_sys_org_levels where org_level_type=1 and "); + sql.append(companyFilter); + sql.append(" ) and a.uuid=b.job_post_uuid "); + sql.append(" LEFT join product_sys_job_post_grades c on b.job_grade_uuid=c.uuid "); + sql.append(" group by a.job_post_name,a.uuid ,c.job_grade_name,c.uuid,a.dept_uuid "); + // 鏌ヨ宀椾綅 & 宀椾綅绛夌骇 + postData = getBaseDao().listTable(sql.toString(), new Object[]{}); + if (BaseUtil.dataTableIsEmpty(roleData)) { + errorEntity.addError(0, "绯荤粺涓病鏈夊彲渚涢�夋嫨鐨勫矖浣嶆垨宀椾綅绛夌骇"); + } + } - /** - * 鏌ヨ鎵�鏈夎鑹� - */ - private void findRoleData() throws BaseException { - sql = new StringBuilder(); - sql.append(" select role_name as uuid,uuid as role_uuid,org_level_uuid FROM product_sys_role "); - sql.append(" where is_used = 1 and "); - sql.append(companyFilter); - // 鏌ヨ瑙掕壊 - roleData = getBaseDao().listTable(sql.toString(), new Object[]{}); - if (BaseUtil.dataTableIsEmpty(roleData)) { - errorEntity.addError(0, "绯荤粺涓病鏈夊彲渚涢�夋嫨鐨勮鑹�"); - } - } + /** + * 鏌ヨ鎵�鏈夎鑹� + */ + private void findRoleData() throws BaseException { + sql = new StringBuilder(); + sql.append(" select role_name as uuid,uuid as role_uuid,org_level_uuid FROM product_sys_role "); + sql.append(" where is_used = 1 and "); + sql.append(companyFilter); + // 鏌ヨ瑙掕壊 + roleData = getBaseDao().listTable(sql.toString(), new Object[]{}); + if (BaseUtil.dataTableIsEmpty(roleData)) { + errorEntity.addError(0, "绯荤粺涓病鏈夊彲渚涢�夋嫨鐨勮鑹�"); + } + } - /** - * 鏌ヨ鎵�鏈夐儴闂� - */ - private void findDeptData() throws BaseException { - // 鏌ヨ閮ㄩ棬 - sql = new StringBuilder(); - sql.append(" select org_level_all uuid,uuid as dept_uuid,org_level_uuid,org_level_code,org_level_code_parent FROM product_sys_org_levels "); - sql.append(" where org_level_type = 1 and "); - sql.append(BaseUtil.buildQuestionMarkFilter(CmnConst.FIELD_ORG_LEVEL_ALL, deptGroupMap.size(), true)); - sql.append(" and "); - sql.append(companyFilter); - // 鏌ヨ閮ㄩ棬 - deptData = getBaseDao().listTable(sql.toString(), deptGroupMap.keySet().toArray()); - if (BaseUtil.dataTableIsEmpty(deptData)) { - errorEntity.addError(0, "绯荤粺涓病鏈夊彲渚涢�夋嫨鐨勯儴闂�"); - } - } + /** + * 鏌ヨ鎵�鏈夐儴闂� + */ + private void findDeptData() throws BaseException { + // 鏌ヨ閮ㄩ棬 + sql = new StringBuilder(); + sql.append(" select org_level_all uuid,uuid as dept_uuid,org_level_uuid,org_level_code,org_level_code_parent FROM product_sys_org_levels "); + sql.append(" where org_level_type = 1 and "); + sql.append(BaseUtil.buildQuestionMarkFilter(CmnConst.FIELD_ORG_LEVEL_ALL, deptGroupMap.size(), true)); + sql.append(" and "); + sql.append(companyFilter); + // 鏌ヨ閮ㄩ棬 + deptData = getBaseDao().listTable(sql.toString(), deptGroupMap.keySet().toArray()); + if (BaseUtil.dataTableIsEmpty(deptData)) { + errorEntity.addError(0, "绯荤粺涓病鏈夊彲渚涢�夋嫨鐨勯儴闂�"); + } + } - /** - * 鏌ヨ瀵煎叆鏁版嵁鎵�鏈夌殑涓婄骇棰嗗 - */ - private void findDirectLeaderData() throws BaseException { - sql = new StringBuilder(); - sql.append(" SELECT staff_code uuid,tricode,user_id FROM product_sys_staffs "); - sql.append(" where "); - sql.append(BaseUtil.buildQuestionMarkFilter(CmnConst.FIELD_STAFF_CODE, direct_leader_codes.size(), true)); - if (direct_leader_codes.size() > 0) { - sql.append(" and "); - } - sql.append(" org_level_uuid in (select uuid FROM product_sys_org_levels where org_level_type=0 and client_uuid=?) "); - // 鏆傛椂娉ㄩ噴涓嶇敤鍏徃鍋氶檺鍒� + /** + * 鏌ヨ瀵煎叆鏁版嵁鎵�鏈夌殑涓婄骇棰嗗 + */ + private void findDirectLeaderData() throws BaseException { + sql = new StringBuilder(); + sql.append(" SELECT staff_code uuid,tricode,user_id FROM product_sys_staffs "); + sql.append(" where "); + sql.append(BaseUtil.buildQuestionMarkFilter(CmnConst.FIELD_STAFF_CODE, direct_leader_codes.size(), true)); + if (direct_leader_codes.size() > 0) { + sql.append(" and "); + } + sql.append(" org_level_uuid in (select uuid FROM product_sys_org_levels where org_level_type=0 and client_uuid=?) "); + // 鏆傛椂娉ㄩ噴涓嶇敤鍏徃鍋氶檺鍒� // sql.append(" and "); // sql.append(companyFilter); - // 鏌ヨ涓婄骇棰嗗 - List<String> params = Lists.newArrayList(direct_leader_codes.iterator()); - params.add(currentUser.getClient_uuid()); - directLeaderData = getBaseDao().listTable(sql.toString(), params.toArray()); - } + // 鏌ヨ涓婄骇棰嗗 + List<String> params = Lists.newArrayList(direct_leader_codes.iterator()); + params.add(currentUser.getClient_uuid()); + directLeaderData = getBaseDao().listTable(sql.toString(), params.toArray()); + } - /** - * 鏌ヨ鎵�鏈夊憳宸ョ紪鐮佷互鍙妘ser琛ㄤ腑鐨勮处鍙� - */ - private void findExistStaff() throws BaseException { - sql = new StringBuilder(126); - sql.append(" select concat(b.client_uuid,'>',staff_code) staff_code,a.user_account as staff_avatar "); - sql.append(" FROM product_sys_users a left join product_sys_staffs b on (b.client_uuid=? or b.uuid is null) and a.user_id=b.user_id "); - systemData = getBaseDao().listTable(sql.toString(), new Object[]{client_uuid}); - } + /** + * 鏌ヨ鎵�鏈夊憳宸ョ紪鐮佷互鍙妘ser琛ㄤ腑鐨勮处鍙� + */ + private void findExistStaff() throws BaseException { + sql = new StringBuilder(126); + sql.append(" select concat(b.client_uuid,'>',staff_code) staff_code,a.user_account as staff_avatar "); + sql.append(" FROM product_sys_users a left join product_sys_staffs b on (b.client_uuid=? or b.uuid is null) and a.user_id=b.user_id "); + systemData = getBaseDao().listTable(sql.toString(), new Object[]{client_uuid}); + } - /** - * 鏁版嵁鏍煎紡鏁堥獙 - */ - private void repeatValidation() throws BaseException { - // 娉� 锛歴taff_avatar 瀛楁涓� user琛ㄤ腑 user_account 鐨勮浇浣� - fieldRepeatValidation(errorEntity, dt, systemData, new String[]{CmnConst.FIELD_STAFF_CODE, "staff_avatar"}); - } + /** + * 鏁版嵁鏍煎紡鏁堥獙 + */ + private void repeatValidation() throws BaseException { + // 娉� 锛歴taff_avatar 瀛楁涓� user琛ㄤ腑 user_account 鐨勮浇浣� + fieldRepeatValidation(errorEntity, dt, systemData, new String[]{CmnConst.FIELD_STAFF_CODE, "staff_avatar"}); + } - /** - * 蹇呭~鏁堥獙 鏁版嵁澶勭悊 - */ - private void requiredValidation() throws BaseException { - errorEntity.mergeError(fieldRequiredValidation(dt, new String[]{"show_name", "staff_avatar", CmnConst.FIELD_STAFF_CODE, - CmnConst.FIELD_DEPT_UUID, "job_post_uuid", "role_uuids"}, fieldType, (FieldSetEntity[] f) -> { - FieldSetEntity fs = f[0]; - //涓婄骇棰嗗缂栫爜 - String direct_leader_code = fs.getString(CmnConst.FIELD_DIRECT_LEADER_CODE); - //宸ヤ綔閮ㄩ棬鍏ㄧО - String deptAllName = fs.getString(CmnConst.FIELD_DEPT_UUID); - String id_number = fs.getString("id_number"); - String age = fs.getString("age"); - Date birth_date = fs.getDate("birth_date"); - String sex = fs.getString("sex"); - String staff_code = fs.getString(CmnConst.FIELD_STAFF_CODE); + /** + * 蹇呭~鏁堥獙 鏁版嵁澶勭悊 + */ + private void requiredValidation() throws BaseException { + errorEntity.mergeError(fieldRequiredValidation(dt, new String[]{"show_name", "staff_avatar", CmnConst.FIELD_STAFF_CODE, + CmnConst.FIELD_DEPT_UUID, "job_post_uuid", "role_uuids"}, fieldType, (FieldSetEntity[] f) -> { + FieldSetEntity fs = f[0]; + //涓婄骇棰嗗缂栫爜 + String direct_leader_code = fs.getString(CmnConst.FIELD_DIRECT_LEADER_CODE); + //宸ヤ綔閮ㄩ棬鍏ㄧО + String deptAllName = fs.getString(CmnConst.FIELD_DEPT_UUID); + String id_number = fs.getString("id_number"); + String age = fs.getString("age"); + Date birth_date = fs.getDate("birth_date"); + String sex = fs.getString("sex"); + String staff_code = fs.getString(CmnConst.FIELD_STAFF_CODE); - if (!StringUtils.isEmpty(staff_code)) { - fs.setValue("~temp_staff_code~", staff_code); - fs.setValue(CmnConst.FIELD_STAFF_CODE, client_uuid + this.separator + staff_code); - staffCodeMap.put(staff_code, fs); - } - fs.setValue(CmnConst.CLIENT_UUID, client_uuid); - if (!StringUtils.isEmpty(direct_leader_code)) { - //灏嗕笂绾ч瀵肩紪鐮佺粺涓�鏀惧叆闆嗗悎涓� - // 涓婄骇棰嗗缂栫爜 = 鍛樺伐缂栫爜 - direct_leader_codes.add(direct_leader_code); - } - //鎸夐儴闂ㄥ垎缁勬暟鎹� - if (!StringUtils.isEmpty(deptAllName)) { - List<FieldSetEntity> fieldSets = deptGroupMap.get(deptAllName); - if (fieldSets == null) { - fieldSets = Lists.newArrayList(); - deptGroupMap.put(deptAllName, fieldSets); - } - fieldSets.add(fs); - } - if (!StringUtils.isEmpty(id_number)) { - try { - if (birth_date == null) { - // 鏍规嵁韬唤璇佸彇鍑虹敓鏃ユ湡 - fs.setValue("birth_date", BaseUtil.getBirthday(id_number)); - } - if (StringUtils.isEmpty(age)) { - // 鏍规嵁韬唤璇佸彇鍑哄勾榫� - fs.setValue("age", BaseUtil.getAge(id_number)); - } - if (StringUtils.isEmpty(sex)) { - // 鏍规嵁韬唤璇佸彇鍑烘�у埆 - fs.setValue("sex", BaseUtil.getSex(id_number)); - } - } catch (Exception e) { + if (!StringUtils.isEmpty(staff_code)) { + fs.setValue("~temp_staff_code~", staff_code); + fs.setValue(CmnConst.FIELD_STAFF_CODE, client_uuid + this.separator + staff_code); + staffCodeMap.put(staff_code, fs); + } + fs.setValue(CmnConst.CLIENT_UUID, client_uuid); + if (!StringUtils.isEmpty(direct_leader_code)) { + //灏嗕笂绾ч瀵肩紪鐮佺粺涓�鏀惧叆闆嗗悎涓� + // 涓婄骇棰嗗缂栫爜 = 鍛樺伐缂栫爜 + direct_leader_codes.add(direct_leader_code); + } + //鎸夐儴闂ㄥ垎缁勬暟鎹� + if (!StringUtils.isEmpty(deptAllName)) { + List<FieldSetEntity> fieldSets = deptGroupMap.get(deptAllName); + if (fieldSets == null) { + fieldSets = Lists.newArrayList(); + deptGroupMap.put(deptAllName, fieldSets); + } + fieldSets.add(fs); + } + if (!StringUtils.isEmpty(id_number)) { + try { + if (birth_date == null) { + // 鏍规嵁韬唤璇佸彇鍑虹敓鏃ユ湡 + fs.setValue("birth_date", BaseUtil.getBirthday(id_number)); + } + if (StringUtils.isEmpty(age)) { + // 鏍规嵁韬唤璇佸彇鍑哄勾榫� + fs.setValue("age", BaseUtil.getAge(id_number)); + } + if (StringUtils.isEmpty(sex)) { + // 鏍规嵁韬唤璇佸彇鍑烘�у埆 + fs.setValue("sex", BaseUtil.getSex(id_number)); + } + } catch (Exception e) { - } - } + } + } - })); + })); - } - } + } + } - /** - * 閲嶈浇瀵煎叆鍛樺伐鏂规硶 - * 澶勭悊鍏徃銆侀儴闂ㄣ�佸矖浣嶃�佸矖浣嶇瓑绾с�佽处鍙� 鐩稿叧鏁版嵁 - * - * @param postData 绯荤粺宀椾綅 & 宀椾綅绛夌骇鏁版嵁 - * @param roleData 绯荤粺瑙掕壊鏁版嵁 - * @param roleNotExist 瑙掕壊涓嶅瓨鍦ㄩ敊璇洖璋� - * @param postNotExist 宀椾綅 & 宀椾綅绛夌骇涓嶅瓨鍦ㄩ敊璇洖璋� - * @param fs 瀵煎叆鏁版嵁 - * @param deptFieldSet 閮ㄩ棬鏁版嵁 - * @param deptAllName 閮ㄩ棬鍏ㄧО - * @throws BaseException - */ - private void importStaffBefore(DataTableEntity postData, DataTableEntity - roleData, CallBack<Object> roleNotExist, CallBack<Object> postNotExist, FieldSetEntity fs, FieldSetEntity deptFieldSet, String deptAllName) throws BaseException { + /** + * 閲嶈浇瀵煎叆鍛樺伐鏂规硶 + * 澶勭悊鍏徃銆侀儴闂ㄣ�佸矖浣嶃�佸矖浣嶇瓑绾с�佽处鍙� 鐩稿叧鏁版嵁 + * + * @param postData 绯荤粺宀椾綅&宀椾綅绛夌骇鏁版嵁 + * @param roleData 绯荤粺瑙掕壊鏁版嵁 + * @param roleNotExist 瑙掕壊涓嶅瓨鍦ㄩ敊璇洖璋� + * @param postNotExist 宀椾綅&宀椾綅绛夌骇涓嶅瓨鍦ㄩ敊璇洖璋� + * @param fs 瀵煎叆鏁版嵁 + * @param deptFieldSet 閮ㄩ棬鏁版嵁 + * @param deptAllName 閮ㄩ棬鍏ㄧО + * @throws BaseException + */ + private void importStaffBefore(DataTableEntity postData, DataTableEntity + roleData, CallBack<Object> roleNotExist, CallBack<Object> postNotExist, FieldSetEntity fs, FieldSetEntity deptFieldSet, String deptAllName) throws BaseException { - String dept_uuid = fs.getString(CmnConst.UUID); - String org_level_uuid = fs.getString(CmnConst.ORG_LEVEL_UUID); - fs.setValue(CmnConst.FIELD_STAFF_CODE, fs.getString("~temp_staff_code~")); - fs.setValue(CmnConst.FIELD_DEPT_UUID, dept_uuid); - fs.setValue(CmnConst.ORG_LEVEL_UUID, org_level_uuid); + String dept_uuid = fs.getString(CmnConst.UUID); + String org_level_uuid = fs.getString(CmnConst.ORG_LEVEL_UUID); + fs.setValue(CmnConst.FIELD_STAFF_CODE, fs.getString("~temp_staff_code~")); + fs.setValue(CmnConst.FIELD_DEPT_UUID, dept_uuid); + fs.setValue(CmnConst.ORG_LEVEL_UUID, org_level_uuid); - String job_post_grade_uuid = fs.getString(CmnConst.FIELD_JOB_POST_GRADE); - String job_post_name = fs.getString("job_post_uuid"); + String job_post_grade_uuid = fs.getString(CmnConst.FIELD_JOB_POST_GRADE); + String job_post_name = fs.getString("job_post_uuid"); - // 宀椾綅 & 宀椾綅绛夌骇 - List<FieldSetEntity> postDataList = postData.getFieldSetEntity(deptAllName); - if (postDataList == null || postDataList.size() <= 0) { - // 娌℃湁宀椾綅 - postNotExist.method(fs, "job_post_uuid"); - } else { - // 璁板綍鎵惧埌鐨勫矖浣嶇瓑绾uid 锛屽涓敤閫楀彿鍒嗛殧 - String grade_uuid = ""; - // 宀椾綅uuid - String post_uuid = null; - // 寰幆绯荤粺涓矖浣嶆暟鎹� - for (FieldSetEntity postFs : postDataList) { - // 鍒ゆ柇宀椾綅鏄惁鍦ㄩ儴闂ㄤ笅 & 宀椾綅鍚嶇О鍜屽鍏ユ暟鎹殑宀椾綅鍚嶇О鏄惁鐩稿悓 - if (dept_uuid.equals(postFs.getString(CmnConst.FIELD_DEPT_UUID)) && job_post_name.equals(postFs.getString(CmnConst.FIELD_JOB_POST_NAME))) { - // 绯荤粺涓矖浣嶇殑uuid - String job_post_uuid = postFs.getString("job_post_uuid"); - // 宀椾綅uuid涓嶄负绌烘椂 鍒ゆ柇褰撳墠postFs 涓殑宀椾綅uuid鏄惁璺熷凡鎵惧埌鐨勫矖浣嶇浉鍚� - if (post_uuid != null && !post_uuid.equals(job_post_uuid)) { - continue; - } - if (post_uuid == null) { - // 璁板綍宀椾綅uuid - post_uuid = job_post_uuid; - } - // 鑾峰彇宀椾綅涓殑宀椾綅绛夌骇鍚嶇О - String job_grade_name = postFs.getString(CmnConst.FIELD_JOB_GRADE_NAME); - // 鎷嗗垎寰幆瀵煎叆宀椾綅绛夌骇鍚嶇О - for (String grade_name : job_post_grade_uuid.split(",")) { - // 鍒ゆ柇宀椾綅绛夌骇鍚嶇О鍜岀郴缁熶腑鐩稿悓 - if (job_grade_name.equals(grade_name)) { - if (!StringUtils.isEmpty(grade_uuid)) { - grade_uuid += ","; - } - grade_uuid += postFs.getString(CmnConst.FIELD_JOB_POST_GRADE); - } - } - } - // 娌℃湁鎵惧埌宀椾綅 - if (StringUtils.isEmpty(post_uuid)) { - // 鎶涘嚭宀椾綅鏈壘鍒伴敊璇� - postNotExist.method(fs, "job_post_uuid"); - } else { - // 鎵惧埌宀椾綅 - fs.setValue("job_post_uuid", post_uuid); - } - // 娌℃湁鎵惧埌宀椾綅绛夌骇 - if (StringUtils.isEmpty(grade_uuid)) { - postNotExist.method(fs, CmnConst.FIELD_JOB_POST_GRADE); - } else { - fs.setValue(CmnConst.FIELD_JOB_POST_GRADE, grade_uuid); - } - } - } - // 瀵煎叆鏁版嵁涓矖浣嶅悕绉� - String[] role_uuids = (String[]) fs.getObject("role_uuids"); - String roleUuid = ""; - // 瑙掕壊澶勭悊 - roleFor: - // 寰幆瑙掕壊鍚嶇О - for (String roleName : role_uuids) { - // 浣跨敤瑙掕壊鍚嶇О鑾峰彇绯荤粺鏁版嵁 - List<FieldSetEntity> roleList = roleData.getFieldSetEntity(roleName); - // 鍦ㄧ郴缁熶腑娌℃湁鎵惧埌瑙掕壊鍚嶇О涓�鑷寸殑鏁版嵁 - if (roleList == null || roleList.size() <= 0) { - roleNotExist.method(fs, roleName); - } else { - // 寰幆绯荤粺涓殑瑙掕壊 - for (FieldSetEntity roleFs : roleList) { - // 鍥犵郴缁熶腑瑙掕壊鎵�灞炲叕鍙稿彲澶氶�夛紝鍦ㄦ澶勫墠鍚庢嫾鎺ラ�楀彿 - String roleCompany = "," + roleFs.getString(CmnConst.ORG_LEVEL_UUID) + ","; - // 鍒ゆ柇瑙掕壊鏄惁鏈夊鍏ユ暟鎹殑鍏徃 - if (roleCompany.contains("," + org_level_uuid + ",")) { - String role_uuid = roleFs.getString("role_uuid"); - if (!StringUtils.isEmpty(roleUuid)) { - roleUuid += ","; - } - roleUuid += role_uuid; - continue roleFor; - } - } - // 娌℃湁鎵惧埌瑙掕壊鏁版嵁 鎶涘嚭閿欒 - roleNotExist.method(fs, roleName); - } + // 宀椾綅 & 宀椾綅绛夌骇 + List<FieldSetEntity> postDataList = postData.getFieldSetEntity(deptAllName); + if (postDataList == null || postDataList.size() <= 0) { + // 娌℃湁宀椾綅 + postNotExist.method(fs, "job_post_uuid"); + } else { + // 璁板綍鎵惧埌鐨勫矖浣嶇瓑绾uid 锛屽涓敤閫楀彿鍒嗛殧 + String grade_uuid = ""; + // 宀椾綅uuid + String post_uuid = null; + // 寰幆绯荤粺涓矖浣嶆暟鎹� + for (FieldSetEntity postFs : postDataList) { + // 鍒ゆ柇宀椾綅鏄惁鍦ㄩ儴闂ㄤ笅 & 宀椾綅鍚嶇О鍜屽鍏ユ暟鎹殑宀椾綅鍚嶇О鏄惁鐩稿悓 + if (dept_uuid.equals(postFs.getString(CmnConst.FIELD_DEPT_UUID)) && job_post_name.equals(postFs.getString(CmnConst.FIELD_JOB_POST_NAME))) { + // 绯荤粺涓矖浣嶇殑uuid + String job_post_uuid = postFs.getString("job_post_uuid"); + // 宀椾綅uuid涓嶄负绌烘椂 鍒ゆ柇褰撳墠postFs 涓殑宀椾綅uuid鏄惁璺熷凡鎵惧埌鐨勫矖浣嶇浉鍚� + if (post_uuid != null && !post_uuid.equals(job_post_uuid)) { + continue; + } + if (post_uuid == null) { + // 璁板綍宀椾綅uuid + post_uuid = job_post_uuid; + } + // 鑾峰彇宀椾綅涓殑宀椾綅绛夌骇鍚嶇О + String job_grade_name = postFs.getString(CmnConst.FIELD_JOB_GRADE_NAME); + // 鎷嗗垎寰幆瀵煎叆宀椾綅绛夌骇鍚嶇О + for (String grade_name : job_post_grade_uuid.split(",")) { + // 鍒ゆ柇宀椾綅绛夌骇鍚嶇О鍜岀郴缁熶腑鐩稿悓 + if (job_grade_name.equals(grade_name)) { + if (!StringUtils.isEmpty(grade_uuid)) { + grade_uuid += ","; + } + grade_uuid += postFs.getString(CmnConst.FIELD_JOB_POST_GRADE); + } + } + } + // 娌℃湁鎵惧埌宀椾綅 + if (StringUtils.isEmpty(post_uuid)) { + // 鎶涘嚭宀椾綅鏈壘鍒伴敊璇� + postNotExist.method(fs, "job_post_uuid"); + } else { + // 鎵惧埌宀椾綅 + fs.setValue("job_post_uuid", post_uuid); + } + // 娌℃湁鎵惧埌宀椾綅绛夌骇 + if (StringUtils.isEmpty(grade_uuid)) { + postNotExist.method(fs, CmnConst.FIELD_JOB_POST_GRADE); + } else { + fs.setValue(CmnConst.FIELD_JOB_POST_GRADE, grade_uuid); + } + } + } + // 瀵煎叆鏁版嵁涓矖浣嶅悕绉� + String[] role_uuids = (String[]) fs.getObject("role_uuids"); + String roleUuid = ""; + // 瑙掕壊澶勭悊 + roleFor: + // 寰幆瑙掕壊鍚嶇О + for (String roleName : role_uuids) { + // 浣跨敤瑙掕壊鍚嶇О鑾峰彇绯荤粺鏁版嵁 + List<FieldSetEntity> roleList = roleData.getFieldSetEntity(roleName); + // 鍦ㄧ郴缁熶腑娌℃湁鎵惧埌瑙掕壊鍚嶇О涓�鑷寸殑鏁版嵁 + if (roleList == null || roleList.size() <= 0) { + roleNotExist.method(fs, roleName); + } else { + // 寰幆绯荤粺涓殑瑙掕壊 + for (FieldSetEntity roleFs : roleList) { + // 鍥犵郴缁熶腑瑙掕壊鎵�灞炲叕鍙稿彲澶氶�夛紝鍦ㄦ澶勫墠鍚庢嫾鎺ラ�楀彿 + String roleCompany = "," + roleFs.getString(CmnConst.ORG_LEVEL_UUID) + ","; + // 鍒ゆ柇瑙掕壊鏄惁鏈夊鍏ユ暟鎹殑鍏徃 + if (roleCompany.contains("," + org_level_uuid + ",")) { + String role_uuid = roleFs.getString("role_uuid"); + if (!StringUtils.isEmpty(roleUuid)) { + roleUuid += ","; + } + roleUuid += role_uuid; + continue roleFor; + } + } + // 娌℃湁鎵惧埌瑙掕壊鏁版嵁 鎶涘嚭閿欒 + roleNotExist.method(fs, roleName); + } - } - } + } + } - /** - * 鑾峰彇鏁版嵁浣嶇疆瀵硅薄 - * - * @param fse - * @return - */ - private DataLocation getDataLocation(FieldSetEntity fse) { - if (fse.getString("~dataLocation~") != null) { - return (DataLocation) fse.getObject("~dataLocation~"); - } else { - DataLocation dataLocation = new DataLocation(fse); - fse.setValue("~dataLocation~", dataLocation); - return dataLocation; - } - } + /** + * 鑾峰彇鏁版嵁浣嶇疆瀵硅薄 + * + * @param fse + * @return + */ + private DataLocation getDataLocation(FieldSetEntity fse) { + if (fse.getString("~dataLocation~") != null) { + return (DataLocation) fse.getObject("~dataLocation~"); + } else { + DataLocation dataLocation = new DataLocation(fse); + fse.setValue("~dataLocation~", dataLocation); + return dataLocation; + } + } - /** - * 鍒濆鍖栨満鏋勬暟鎹� - * - * @param fse - * @param level_type - */ - public void initOrganizationFieldSet(FieldSetEntity fse, String client_uuid, String parentCode, - int level_type) { - fse.setValue(CmnConst.FIELD_ORG_LEVEL_CODE_PARENT, parentCode); - fse.setValue(CmnConst.FIELD_ORG_LEVEL_CODE, BaseUtil.createCode(fse, CmnConst.TABLE_PRODUCT_SYS_ORG_LEVELS, CmnConst.FIELD_ORG_LEVEL_CODE, parentCode)); - BaseUtil.createCreatorAndCreationTime(fse); - fse.remove(CmnConst.ORG_LEVEL_UUID); - fse.setValue(CmnConst.CLIENT_UUID, client_uuid); - fse.setValue(CmnConst.FIELD_ORG_LEVEL_STATUS, 0); - fse.setValue(CmnConst.FIELD_ORG_LEVEL_TYPE, level_type); - fse.setCodeFieldUpdateFlat(CmnConst.FIELD_ORG_LEVEL_CODE, false); - } + /** + * 鍒濆鍖栨満鏋勬暟鎹� + * + * @param fse + * @param level_type + */ + public void initOrganizationFieldSet(FieldSetEntity fse, String client_uuid, String parentCode, + int level_type) { + fse.setValue(CmnConst.FIELD_ORG_LEVEL_CODE_PARENT, parentCode); + fse.setValue(CmnConst.FIELD_ORG_LEVEL_CODE, BaseUtil.createCode(fse, CmnConst.TABLE_PRODUCT_SYS_ORG_LEVELS, CmnConst.FIELD_ORG_LEVEL_CODE, parentCode)); + BaseUtil.createCreatorAndCreationTime(fse); + fse.remove(CmnConst.ORG_LEVEL_UUID); + fse.setValue(CmnConst.CLIENT_UUID, client_uuid); + fse.setValue(CmnConst.FIELD_ORG_LEVEL_STATUS, 0); + fse.setValue(CmnConst.FIELD_ORG_LEVEL_TYPE, level_type); + fse.setCodeFieldUpdateFlat(CmnConst.FIELD_ORG_LEVEL_CODE, false); + } - public void managerPermissionValidation(ImportErrorEntity errorEntity, SystemUser user) throws - BaseException { - FieldSetEntity managerFieldSet = user.getCurrentManager(); - if (managerFieldSet == null || user.getUserType() != 2) { - errorEntity.newThrowBaseException("娌℃湁瀵煎叆姝ゆ暟鎹殑鏉冮檺锛岃鑱旂郴缁熺鐞嗗憳"); - } else if (StringUtils.isEmpty(managerFieldSet.getString(CmnConst.ORG_LEVEL_UUID))) { - errorEntity.newThrowBaseException("鍏徃鏉冮檺涓嶅瓨鍦紝璇疯仈绯荤粺绠$悊鍛�"); - } - } + public void managerPermissionValidation(ImportErrorEntity errorEntity, SystemUser user) throws + BaseException { + FieldSetEntity managerFieldSet = user.getCurrentManager(); + if (managerFieldSet == null || user.getUserType() != 2) { + errorEntity.newThrowBaseException("娌℃湁瀵煎叆姝ゆ暟鎹殑鏉冮檺锛岃鑱旂郴缁熺鐞嗗憳"); + } else if (StringUtils.isEmpty(managerFieldSet.getString(CmnConst.ORG_LEVEL_UUID))) { + errorEntity.newThrowBaseException("鍏徃鏉冮檺涓嶅瓨鍦紝璇疯仈绯荤粺绠$悊鍛�"); + } + } - /** - * 閿欒浣嶇疆 - */ - class DataLocation { + /** + * 閿欒浣嶇疆 + */ + class DataLocation { - //褰撳墠琛� - private Integer rowIndex; - //鍒楀悕 - private List<String> colNameList; - //瀛楁鍒楃储寮� - private Map<String, String> fieldIndex; + //褰撳墠琛� + private Integer rowIndex; + //鍒楀悕 + private List<String> colNameList; + //瀛楁鍒楃储寮� + private Map<String, String> fieldIndex; - DataLocation(FieldSetEntity fse) { - //褰撳墠琛� - this.rowIndex = fse.getInteger("~row~"); - //鍒楀悕 - this.colNameList = (List<String>) fse.getObject("~colName~"); - //瀛楁鍒楃储寮� - this.fieldIndex = (Map<String, String>) fse.getObject("~fieldIndex~"); - } + DataLocation(FieldSetEntity fse) { + //褰撳墠琛� + this.rowIndex = fse.getInteger("~row~"); + //鍒楀悕 + this.colNameList = (List<String>) fse.getObject("~colName~"); + //瀛楁鍒楃储寮� + this.fieldIndex = (Map<String, String>) fse.getObject("~fieldIndex~"); + } - /** - * 鑾峰彇褰撳墠琛岀储寮� - * - * @return - */ - public Integer getRowIndex() { - return rowIndex + 1; - } + /** + * 鑾峰彇褰撳墠琛岀储寮� + * + * @return + */ + public Integer getRowIndex() { + return rowIndex + 1; + } - /** - * 鑾峰彇褰撳墠鍒楃储寮� - * - * @param fieldName - * @return - */ - public String getColIndex(String fieldName) { - if (fieldIndex == null || StringUtils.isEmpty(fieldName)) { - return null; - } - String colIndex = fieldIndex.get(fieldName); - return !StringUtils.isEmpty(colIndex) ? String.valueOf(Integer.valueOf(colIndex) + 1) : "鏈煡"; - } + /** + * 鑾峰彇褰撳墠鍒楃储寮� + * + * @param fieldName + * @return + */ + public String getColIndex(String fieldName) { + if (fieldIndex == null || StringUtils.isEmpty(fieldName)) { + return null; + } + String colIndex = fieldIndex.get(fieldName); + return !StringUtils.isEmpty(colIndex) ? String.valueOf(Integer.valueOf(colIndex) + 1) : "鏈煡"; + } - /** - * 鑾峰彇褰撳墠鍒楀悕绉� - * - * @param fieldName - * @return - */ - public String getColName(String fieldName) { - String colIndex = getColIndex(fieldName); - if (this.colNameList == null || colIndex == null || "鏈煡".equals(colIndex)) { - return "鏈煡鍒楀悕"; - } - return colNameList.get(Integer.valueOf(colIndex) - 1); - } + /** + * 鑾峰彇褰撳墠鍒楀悕绉� + * + * @param fieldName + * @return + */ + public String getColName(String fieldName) { + String colIndex = getColIndex(fieldName); + if (this.colNameList == null || colIndex == null || "鏈煡".equals(colIndex)) { + return "鏈煡鍒楀悕"; + } + return colNameList.get(Integer.valueOf(colIndex) - 1); + } - } + } - static class ImportErrorEntity { + static class ImportErrorEntity { - interface errorMsg { - errorMsg append(Object errorMsg); - } + interface errorMsg { + errorMsg append(Object errorMsg); + } - private Map<Integer, String> errorMap; + private Map<Integer, String> errorMap; - private boolean isError = false; + private boolean isError = false; - /** - * 鏂板閿欒 鑷姩鎹㈣ - * - * @param row - * @param errorMsg - * @return - */ - public errorMsg addError(int row, String errorMsg) { - if (errorMap == null) { - errorMap = Maps.newHashMap(); - } - isError = true; - String error = errorMap.get(row); - if (!StringUtils.isEmpty(error)) { - error += "\n"; - } else { - error = ""; - } - error += errorMsg; - errorMap.put(row, error); - return (emg) -> this.append(row, String.valueOf(emg)); - } + /** + * 鏂板閿欒 鑷姩鎹㈣ + * + * @param row + * @param errorMsg + * @return + */ + public errorMsg addError(int row, String errorMsg) { + if (errorMap == null) { + errorMap = Maps.newHashMap(); + } + isError = true; + String error = errorMap.get(row); + if (!StringUtils.isEmpty(error)) { + error += "\n"; + } else { + error = ""; + } + error += errorMsg; + errorMap.put(row, error); + return (emg) -> this.append(row, String.valueOf(emg)); + } - /** - * 鍚堝苟閿欒 - * - * @param errorEntity - * @return - */ - public ImportErrorEntity mergeError(ImportErrorEntity errorEntity) { - Map<Integer, String> errorMap = errorEntity.errorMap; - if (errorEntity.isError) { - if (this.errorMap == null) { - this.errorMap = errorMap; - this.isError = true; - return this; - } else { - errorMap.forEach((k, v) -> { - String error = this.errorMap.get(k); - if (!StringUtils.isEmpty(error)) { - error += "\n"; - } else { - error = ""; - } - error += v; - this.isError = true; - this.errorMap.put(k, error); - }); - } - } - return this; - } + /** + * 鍚堝苟閿欒 + * + * @param errorEntity + * @return + */ + public ImportErrorEntity mergeError(ImportErrorEntity errorEntity) { + Map<Integer, String> errorMap = errorEntity.errorMap; + if (errorEntity.isError) { + if (this.errorMap == null) { + this.errorMap = errorMap; + this.isError = true; + return this; + } else { + errorMap.forEach((k, v) -> { + String error = this.errorMap.get(k); + if (!StringUtils.isEmpty(error)) { + error += "\n"; + } else { + error = ""; + } + error += v; + this.isError = true; + this.errorMap.put(k, error); + }); + } + } + return this; + } - /** - * 鎷兼帴閿欒 - * - * @param row - * @param errorMsg - * @return - */ - public errorMsg append(int row, String errorMsg) { - if (errorMap == null) { - errorMap = Maps.newHashMap(); - } - isError = true; - String error = errorMap.get(row); - if (StringUtils.isEmpty(error)) { - error = ""; - } - error += errorMsg; - errorMap.put(row, error); - return (emg) -> this.append(row, String.valueOf(emg)); - } + /** + * 鎷兼帴閿欒 + * + * @param row + * @param errorMsg + * @return + */ + public errorMsg append(int row, String errorMsg) { + if (errorMap == null) { + errorMap = Maps.newHashMap(); + } + isError = true; + String error = errorMap.get(row); + if (StringUtils.isEmpty(error)) { + error = ""; + } + error += errorMsg; + errorMap.put(row, error); + return (emg) -> this.append(row, String.valueOf(emg)); + } - public void newThrowBaseException() { - newThrowBaseException(null, null); - } + public void newThrowBaseException() { + newThrowBaseException(null, null); + } - public void newThrowBaseException(String msg, Exception exception) { - if (!StringUtils.isEmpty(msg)) { - throw new BaseException(CmnCode.UPLOAD_TEMPLATE_IMPORT_DATA_FAIL.getValue(), msg); - } else if (errorMap != null) { - List<Integer> es = Lists.newArrayList(errorMap.keySet().iterator()); - StringBuilder errorMsg = new StringBuilder(); - for (Integer e : es) { - String error = errorMap.get(e); - if (!StringUtils.isEmpty(error)) { - errorMsg.append(error).append("\n"); - } - } - if (errorMsg.length() > 0) { - if (exception != null) { - throw new BaseException(CmnCode.UPLOAD_TEMPLATE_IMPORT_DATA_FAIL.getValue(), errorMsg.toString(), exception); - } else { - throw new BaseException(CmnCode.UPLOAD_TEMPLATE_IMPORT_DATA_FAIL.getValue(), errorMsg.toString()); - } - } - throw new BaseException(CmnCode.UPLOAD_TEMPLATE_IMPORT_DATA_FAIL.getValue(), " 鏈煡閿欒锛岃鑱旂郴绠$悊鍛橈紝error message is empty for 'throwExportDataError' Method "); - } - if (exception != null) { - throw new BaseException(CmnCode.UPLOAD_TEMPLATE_IMPORT_DATA_FAIL.getValue(), " 鏈煡閿欒锛岃鑱旂郴绠$悊鍛橈紝error message is empty for 'throwExportDataError' Method ", exception); - } - throw new BaseException(CmnCode.UPLOAD_TEMPLATE_IMPORT_DATA_FAIL.getValue(), " 鏈煡閿欒锛岃鑱旂郴绠$悊鍛橈紝error message is empty for 'throwExportDataError' Method "); - } + public void newThrowBaseException(String msg, Exception exception) { + if (!StringUtils.isEmpty(msg)) { + throw new BaseException(CmnCode.UPLOAD_TEMPLATE_IMPORT_DATA_FAIL.getValue(), msg); + } else if (errorMap != null) { + List<Integer> es = Lists.newArrayList(errorMap.keySet().iterator()); + StringBuilder errorMsg = new StringBuilder(); + for (Integer e : es) { + String error = errorMap.get(e); + if (!StringUtils.isEmpty(error)) { + errorMsg.append(error).append("\n"); + } + } + if (errorMsg.length() > 0) { + if (exception != null) { + throw new BaseException(CmnCode.UPLOAD_TEMPLATE_IMPORT_DATA_FAIL.getValue(), errorMsg.toString(), exception); + } else { + throw new BaseException(CmnCode.UPLOAD_TEMPLATE_IMPORT_DATA_FAIL.getValue(), errorMsg.toString()); + } + } + throw new BaseException(CmnCode.UPLOAD_TEMPLATE_IMPORT_DATA_FAIL.getValue(), " 鏈煡閿欒锛岃鑱旂郴绠$悊鍛橈紝error message is empty for 'throwExportDataError' Method "); + } + if (exception != null) { + throw new BaseException(CmnCode.UPLOAD_TEMPLATE_IMPORT_DATA_FAIL.getValue(), " 鏈煡閿欒锛岃鑱旂郴绠$悊鍛橈紝error message is empty for 'throwExportDataError' Method ", exception); + } + throw new BaseException(CmnCode.UPLOAD_TEMPLATE_IMPORT_DATA_FAIL.getValue(), " 鏈煡閿欒锛岃鑱旂郴绠$悊鍛橈紝error message is empty for 'throwExportDataError' Method "); + } - public void newThrowBaseException(String msg) { - newThrowBaseException(msg, null); - } + public void newThrowBaseException(String msg) { + newThrowBaseException(msg, null); + } - } + } } -- Gitblit v1.9.2