Browse Source

人员组织导入导出服务

luojing 5 years ago
parent
commit
2746d69205

+ 27 - 23
o2server/x_organization_assemble_control/src/main/java/com/x/organization/assemble/control/jaxrs/inputperson/ActionInputAll.java

@@ -258,12 +258,6 @@ class ActionInputAll extends BaseAction {
 					unitItem.setRow(i);
 					unitItem.setRow(i);
 					name = StringUtils.trimToEmpty(name);
 					name = StringUtils.trimToEmpty(name);
 					unitItem.setName(name);
 					unitItem.setName(name);
-					if (null != configurator.getShortNameColumn()) {
-						String shortName = configurator
-								.getCellStringValue(row.getCell(configurator.getShortNameColumn()));
-						shortName = StringUtils.trimToEmpty(shortName);
-						unitItem.setShortName(shortName);
-					}
 					if (null != configurator.getUniqueColumn()) {
 					if (null != configurator.getUniqueColumn()) {
 						String unique = configurator.getCellStringValue(row.getCell(configurator.getUniqueColumn()));
 						String unique = configurator.getCellStringValue(row.getCell(configurator.getUniqueColumn()));
 						unique = StringUtils.trimToEmpty(unique);
 						unique = StringUtils.trimToEmpty(unique);
@@ -318,9 +312,9 @@ class ActionInputAll extends BaseAction {
 		if (null == configurator.getNameColumn()) {
 		if (null == configurator.getNameColumn()) {
 			throw new ExceptionNameColumnEmpty();
 			throw new ExceptionNameColumnEmpty();
 		}
 		}
-		if (null == configurator.getUniqueColumn()) {
+		/*if (null == configurator.getUniqueColumn()) {
 			throw new ExceptionUniqueColumnEmpty();
 			throw new ExceptionUniqueColumnEmpty();
-		}
+		}*/
 		if (null == configurator.getEmployeeColumn()) {
 		if (null == configurator.getEmployeeColumn()) {
 			throw new ExceptionEmployeeColumnEmpty();
 			throw new ExceptionEmployeeColumnEmpty();
 		}
 		}
@@ -328,9 +322,9 @@ class ActionInputAll extends BaseAction {
 			throw new ExceptionMobileColumnEmpty();
 			throw new ExceptionMobileColumnEmpty();
 		}
 		}
 		//System.out.println(configurator.getAttributes().get(""));
 		//System.out.println(configurator.getAttributes().get(""));
-		if (configurator.getAttributes().isEmpty()) {
+		/*if (configurator.getAttributes().isEmpty()) {
 			throw new ExceptionIdNumberColumnEmpty();
 			throw new ExceptionIdNumberColumnEmpty();
-		}
+		}*/
 		List<PersonItem> peoples = new ArrayList<>();
 		List<PersonItem> peoples = new ArrayList<>();
 		for (int i = configurator.getFirstRow(); i <= configurator.getLastRow(); i++) {
 		for (int i = configurator.getFirstRow(); i <= configurator.getLastRow(); i++) {
 			Row row = sheet.getRow(i);
 			Row row = sheet.getRow(i);
@@ -357,16 +351,25 @@ class ActionInputAll extends BaseAction {
 					personItem.setName(name);
 					personItem.setName(name);
 					personItem.setGenderType(genderType);
 					personItem.setGenderType(genderType);
 					personItem.setMobile(mobile);
 					personItem.setMobile(mobile);
+					if (null != configurator.getUniqueColumn()) {
+						String unique = configurator.getCellStringValue(row.getCell(configurator.getUniqueColumn()));
+						unique = StringUtils.trimToEmpty(unique);
+						personItem.setUnique(unique);
+					}
 					if (null != configurator.getEmployeeColumn()) {
 					if (null != configurator.getEmployeeColumn()) {
 						String employee = configurator
 						String employee = configurator
 								.getCellStringValue(row.getCell(configurator.getEmployeeColumn()));
 								.getCellStringValue(row.getCell(configurator.getEmployeeColumn()));
 						employee = StringUtils.trimToEmpty(employee);
 						employee = StringUtils.trimToEmpty(employee);
 						personItem.setEmployee(employee);
 						personItem.setEmployee(employee);
+						if(null == configurator.getUniqueColumn()){
+							personItem.setUnique(employee);
+						}
 					}
 					}
-					if (null != configurator.getUniqueColumn()) {
-						String unique = configurator.getCellStringValue(row.getCell(configurator.getUniqueColumn()));
-						unique = StringUtils.trimToEmpty(unique);
-						personItem.setUnique(unique);
+					
+					if (null != configurator.getOfficePhoneColumn()) {
+						String officePhone = configurator.getCellStringValue(row.getCell(configurator.getOfficePhoneColumn()));
+						officePhone = StringUtils.trimToEmpty(officePhone);
+						personItem.setUnique(officePhone);
 					}
 					}
 					if (null != configurator.getMailColumn()) {
 					if (null != configurator.getMailColumn()) {
 						String mail = configurator.getCellStringValue(row.getCell(configurator.getMailColumn()));
 						String mail = configurator.getCellStringValue(row.getCell(configurator.getMailColumn()));
@@ -619,11 +622,11 @@ class ActionInputAll extends BaseAction {
 				validate = false;
 				validate = false;
 				continue;
 				continue;
 			}
 			}
-			if (StringUtils.isEmpty(o.getUnique())) {
+			/*if (StringUtils.isEmpty(o.getUnique())) {
 				this.setPersonMemo(workbook, configurator, o, "人员编号不能为空.");
 				this.setPersonMemo(workbook, configurator, o, "人员编号不能为空.");
 				validate = false;
 				validate = false;
 				continue;
 				continue;
-			}
+			}*/
 			if (StringUtils.isEmpty(o.getEmployee())) {
 			if (StringUtils.isEmpty(o.getEmployee())) {
 				this.setPersonMemo(workbook, configurator, o, "登录账号不能为空.");
 				this.setPersonMemo(workbook, configurator, o, "登录账号不能为空.");
 				validate = false;
 				validate = false;
@@ -634,18 +637,18 @@ class ActionInputAll extends BaseAction {
 				validate = false;
 				validate = false;
 				continue;
 				continue;
 			}
 			}
-			if(o.getAttributes().isEmpty()|| StringUtils.isEmpty(o.getAttributes().get("idNumber"))){
+			/*if(o.getAttributes().isEmpty()|| StringUtils.isEmpty(o.getAttributes().get("idNumber"))){
 				this.setPersonMemo(workbook, configurator, o, "身份证号不能为空.");
 				this.setPersonMemo(workbook, configurator, o, "身份证号不能为空.");
 				validate = false;
 				validate = false;
 				continue;
 				continue;
-			}
+			}*/
 		}
 		}
 		if (validate) {
 		if (validate) {
 			for (PersonItem o : person) {
 			for (PersonItem o : person) {
 				for (PersonItem item : person) {
 				for (PersonItem item : person) {
 					if (o != item) {
 					if (o != item) {
-						if (StringUtils.isNotEmpty(o.getUnique()) && StringUtils.equals(o.getUnique(), item.getUnique())) {
-							this.setPersonMemo(workbook, configurator, o, "唯一编码冲突,本次导入中不唯一.");
+						if (StringUtils.isNotEmpty(o.getEmployee()) && StringUtils.equals(o.getEmployee(), item.getEmployee())) {
+							this.setPersonMemo(workbook, configurator, o, "员工账号冲突,本次导入中不唯一.");
 							validate = false;
 							validate = false;
 							continue;
 							continue;
 						}
 						}
@@ -655,7 +658,7 @@ class ActionInputAll extends BaseAction {
 				Person p = null;
 				Person p = null;
 				p = emc.flag(o.getUnique(), Person.class);
 				p = emc.flag(o.getUnique(), Person.class);
 				if (null != p) {
 				if (null != p) {
-					this.setPersonMemo(workbook, configurator, o, "人员编号: " + o.getUnique() + " 与已经存在人员: " + p.getName() + " 冲突.");
+					this.setPersonMemo(workbook, configurator, o, "人员: " + o.getName() + " 与已经存在人员: " + p.getName() + " 冲突.");
 					validate = false;
 					validate = false;
 					continue;
 					continue;
 				}
 				}
@@ -690,7 +693,7 @@ class ActionInputAll extends BaseAction {
 				identityItem.setRow(i);
 				identityItem.setRow(i);
 				identitys.add(identityItem);
 				identitys.add(identityItem);
 				if (StringUtils.isEmpty(unique)) {
 				if (StringUtils.isEmpty(unique)) {
-					this.setIdentityMemo(workbook, configurator, identityItem, "人员编号不能为空.");
+					this.setIdentityMemo(workbook, configurator, identityItem, "员工账号不能为空.");
 					validate = false;
 					validate = false;
 					continue;
 					continue;
 				}
 				}
@@ -715,7 +718,7 @@ class ActionInputAll extends BaseAction {
 					personcheck = true;
 					personcheck = true;
 				}else{
 				}else{
 					for (PersonItem personItem : persons) {
 					for (PersonItem personItem : persons) {
-						if (StringUtils.isNotEmpty(personItem.getUnique()) && StringUtils.equals(personItem.getUnique(), unique)) {
+						if (StringUtils.isNotEmpty(personItem.getEmployee()) && StringUtils.equals(personItem.getEmployee(), unique)) {
 							personcheck = true;
 							personcheck = true;
 						}
 						}
 					}
 					}
@@ -798,6 +801,7 @@ class ActionInputAll extends BaseAction {
 				
 				
 				Person person = null;
 				Person person = null;
 				person = emc.flag(personCode, Person.class);
 				person = emc.flag(personCode, Person.class);
+				System.out.println("personCode="+personCode);
 				if(person != null){
 				if(person != null){
 					personcheck = true;
 					personcheck = true;
 				}else{
 				}else{

+ 1 - 1
o2server/x_organization_assemble_control/src/main/java/com/x/organization/assemble/control/jaxrs/inputperson/IdentitySheetConfigurator.java

@@ -64,7 +64,7 @@ public class IdentitySheetConfigurator extends GsonPropertyObject {
 		}
 		}
 	}
 	}
 
 
-	private static List<String> uniqueItems = Arrays.asList(new String[] { "人员编号 *", "编码", "unique" });
+	private static List<String> uniqueItems = Arrays.asList(new String[] { "人员编号 *", "员工账号 *", "unique" });
 	private static List<String> unitCodeItems = Arrays.asList(new String[] { "组织编号 *", "组织编号", "unitCode" });
 	private static List<String> unitCodeItems = Arrays.asList(new String[] { "组织编号 *", "组织编号", "unitCode" });
 	private static List<String> dutyCodeItems = Arrays.asList(new String[] { "职务编号", "dutyCode"});
 	private static List<String> dutyCodeItems = Arrays.asList(new String[] { "职务编号", "dutyCode"});
 	private static List<String> majorItems = Arrays.asList(new String[] { "主兼职","major" });
 	private static List<String> majorItems = Arrays.asList(new String[] { "主兼职","major" });

+ 9 - 0
o2server/x_organization_assemble_control/src/main/java/com/x/organization/assemble/control/jaxrs/inputperson/PersonItem.java

@@ -14,6 +14,7 @@ public class PersonItem extends GsonPropertyObject {
 	private String unique;
 	private String unique;
 	private String employee;
 	private String employee;
 	private String mobile;
 	private String mobile;
+	private String officePhone;
 	private String password;
 	private String password;
 
 
 	private Integer row;
 	private Integer row;
@@ -67,6 +68,14 @@ public class PersonItem extends GsonPropertyObject {
 	public void setMobile(String mobile) {
 	public void setMobile(String mobile) {
 		this.mobile = mobile;
 		this.mobile = mobile;
 	}
 	}
+	
+	public String getOfficePhone() {
+		return officePhone;
+	}
+
+	public void setOfficePhone(String officePhone) {
+		this.officePhone = officePhone;
+	}
 
 
 	public Map<String, String> getAttributes() {
 	public Map<String, String> getAttributes() {
 		return attributes;
 		return attributes;

+ 8 - 8
o2server/x_organization_assemble_control/src/main/java/com/x/organization/assemble/control/jaxrs/inputperson/PersonSheetConfigurator.java

@@ -29,7 +29,7 @@ public class PersonSheetConfigurator extends GsonPropertyObject {
 	private Integer uniqueColumn;
 	private Integer uniqueColumn;
 	private Integer employeeColumn;
 	private Integer employeeColumn;
 	private Integer mobileColumn;
 	private Integer mobileColumn;
-	private Integer idNumberColumn;
+	private Integer officePhoneColumn;
 	private Integer genderTypeColumn;
 	private Integer genderTypeColumn;
 	private Integer mailColumn;
 	private Integer mailColumn;
 
 
@@ -59,13 +59,12 @@ public class PersonSheetConfigurator extends GsonPropertyObject {
 						this.mailColumn = i;
 						this.mailColumn = i;
 					} else if (genderTypeItems.contains(str)) {
 					} else if (genderTypeItems.contains(str)) {
 						this.genderTypeColumn = i;
 						this.genderTypeColumn = i;
-					} else if ("身份证号 *".equals(str)) {
-						this.attributes.put("idNumber", new Integer(i));
+					} else if (officePhoneItems.contains(str)) {
+						this.officePhoneColumn = i;
 					} else {
 					} else {
 						Matcher matcher = attributePattern.matcher(str);
 						Matcher matcher = attributePattern.matcher(str);
 						if (matcher.matches()) {
 						if (matcher.matches()) {
 							String attribute = matcher.group(1);
 							String attribute = matcher.group(1);
-							System.out.println("attribute="+attribute+"_value="+i);
 							this.attributes.put(attribute, new Integer(i));
 							this.attributes.put(attribute, new Integer(i));
 						}
 						}
 					}
 					}
@@ -75,9 +74,10 @@ public class PersonSheetConfigurator extends GsonPropertyObject {
 	}
 	}
 
 
 	private static List<String> nameItems = Arrays.asList(new String[] { "人员姓名 *", "人员姓名", "name" });
 	private static List<String> nameItems = Arrays.asList(new String[] { "人员姓名 *", "人员姓名", "name" });
-	private static List<String> uniqueItems = Arrays.asList(new String[] { "人员编号 *", "编码", "unique" });
-	private static List<String> employeeItems = Arrays.asList(new String[] { "登录账号 *", "员工编号", "employee" });
+	private static List<String> uniqueItems = Arrays.asList(new String[] { "人员编号 *", "人员编号", "unique" });
+	private static List<String> employeeItems = Arrays.asList(new String[] { "登录账号 *", "员工账号 *", "employee" });
 	private static List<String> mobileItems = Arrays.asList(new String[] { "手机号码 *", "手机", "联系电话", "phone", "mobile" });
 	private static List<String> mobileItems = Arrays.asList(new String[] { "手机号码 *", "手机", "联系电话", "phone", "mobile" });
+	private static List<String> officePhoneItems = Arrays.asList(new String[] { "办公电话", "办公室电话", "工作电话", "officePhone" });
 	private static List<String> mailItems = Arrays.asList(new String[] { "电子邮件", "邮件", "邮箱", "邮件地址", "mail", "email" });
 	private static List<String> mailItems = Arrays.asList(new String[] { "电子邮件", "邮件", "邮箱", "邮件地址", "mail", "email" });
 	private static List<String> genderTypeItems = Arrays.asList(new String[] { "性别", "gender", "genderType" });
 	private static List<String> genderTypeItems = Arrays.asList(new String[] { "性别", "gender", "genderType" });
 
 
@@ -147,8 +147,8 @@ public class PersonSheetConfigurator extends GsonPropertyObject {
 		return mailColumn;
 		return mailColumn;
 	}
 	}
 	
 	
-	public Integer getIdNumberColumn() {
-		return idNumberColumn;
+	public Integer getOfficePhoneColumn() {
+		return officePhoneColumn; 
 	}
 	}
 
 
 	public Integer getSheetIndex() {
 	public Integer getSheetIndex() {

+ 0 - 8
o2server/x_organization_assemble_control/src/main/java/com/x/organization/assemble/control/jaxrs/inputperson/UnitSheetConfigurator.java

@@ -26,7 +26,6 @@ public class UnitSheetConfigurator extends GsonPropertyObject {
 	private Integer lastRow;
 	private Integer lastRow;
 
 
 	private Integer nameColumn;
 	private Integer nameColumn;
-	private Integer shortNameColumn;
 	private Integer uniqueColumn;
 	private Integer uniqueColumn;
 	private Integer unitTypeColumn;
 	private Integer unitTypeColumn;
 	private Integer superiorColumn;
 	private Integer superiorColumn;
@@ -48,8 +47,6 @@ public class UnitSheetConfigurator extends GsonPropertyObject {
 				if (StringUtils.isNotEmpty(str)) {
 				if (StringUtils.isNotEmpty(str)) {
 					if (nameItems.contains(str)) {
 					if (nameItems.contains(str)) {
 						this.nameColumn = i;
 						this.nameColumn = i;
-					} else if (shortNameItems.contains(str)) {
-						this.shortNameColumn = i;
 					} else if (uniqueItems.contains(str)) {
 					} else if (uniqueItems.contains(str)) {
 						this.uniqueColumn = i;
 						this.uniqueColumn = i;
 					} else if (unitTypeItems.contains(str)) {
 					} else if (unitTypeItems.contains(str)) {
@@ -73,7 +70,6 @@ public class UnitSheetConfigurator extends GsonPropertyObject {
 	}
 	}
 
 
 	private static List<String> nameItems = Arrays.asList(new String[] { "组织名称 *", "name" });
 	private static List<String> nameItems = Arrays.asList(new String[] { "组织名称 *", "name" });
-	private static List<String> shortNameItems = Arrays.asList(new String[] { "组织代字", "代字", "shortName" });
 	private static List<String> uniqueItems = Arrays.asList(new String[] { "编号", "组织编号 *", "unique" });
 	private static List<String> uniqueItems = Arrays.asList(new String[] { "编号", "组织编号 *", "unique" });
 	private static List<String> unitTypeItems = Arrays.asList(new String[] { "组织级别编号 *", "组织级别名称 *", "unitType" });
 	private static List<String> unitTypeItems = Arrays.asList(new String[] { "组织级别编号 *", "组织级别名称 *", "unitType" });
 	private static List<String> superiorItems = Arrays.asList(new String[] { "上级组织", "上级组织编号", "superior"});
 	private static List<String> superiorItems = Arrays.asList(new String[] { "上级组织", "上级组织编号", "superior"});
@@ -114,10 +110,6 @@ public class UnitSheetConfigurator extends GsonPropertyObject {
 		return nameColumn;
 		return nameColumn;
 	}
 	}
 
 
-	public Integer getShortNameColumn() {
-		return shortNameColumn;
-	}
-
 	public Integer getUniqueColumn() {
 	public Integer getUniqueColumn() {
 		return uniqueColumn;
 		return uniqueColumn;
 	}
 	}