Browse Source

Merge branch 'fix/organization_import_72' into 'develop'

组织导入添加校验手机号有效性 Fix/organization import 72

See merge request o2oa/o2oa!1191
o2null 5 years ago
parent
commit
9c1aa6649f

+ 6 - 6
o2server/x_organization_assemble_control/src/main/java/com/x/organization/assemble/control/jaxrs/export/ActionExportAll.java

@@ -222,7 +222,7 @@ public class ActionExportAll extends BaseAction {
 			// 先创建表头
 			row = sheet.createRow(0);
 			row.createCell(0).setCellValue("组织名称 *");
-			row.createCell(1).setCellValue("组织编号 *");
+			row.createCell(1).setCellValue("唯一编码 *");
 			row.createCell(2).setCellValue("组织级别名称 *");
 			row.createCell(3).setCellValue("上级组织编号");
 			row.createCell(4).setCellValue("描述");
@@ -270,7 +270,7 @@ public class ActionExportAll extends BaseAction {
 			// 先创建表头
 			row = sheet.createRow(0);
 			row.createCell(0).setCellValue("人员姓名 *");
-			row.createCell(1).setCellValue("员工账号 *");
+			row.createCell(1).setCellValue("唯一编码 *");
 			row.createCell(2).setCellValue("手机号码 *");
 			row.createCell(3).setCellValue("人员编号");
 			row.createCell(4).setCellValue("办公电话");
@@ -302,8 +302,8 @@ public class ActionExportAll extends BaseAction {
 			
 			// 先创建表头
 			row = sheet.createRow(0);
-			row.createCell(0).setCellValue("员工账号 *");
-			row.createCell(1).setCellValue("组织编号 *");
+			row.createCell(0).setCellValue("人员唯一编码 *");
+			row.createCell(1).setCellValue("组织唯一编码 *");
 			row.createCell(2).setCellValue("职务编号");
 			row.createCell(3).setCellValue("主兼职");
 
@@ -375,8 +375,8 @@ public class ActionExportAll extends BaseAction {
 			row = sheet.createRow(0);
 			row.createCell(0).setCellValue("群组名称 *");
 			row.createCell(1).setCellValue("群组编号 *");
-			row.createCell(2).setCellValue("人员编号");
-			row.createCell(3).setCellValue("组织编号");
+			row.createCell(2).setCellValue("人员唯一编码");
+			row.createCell(3).setCellValue("组织唯一编码");
 			row.createCell(4).setCellValue("子群组编号");
 			row.createCell(5).setCellValue("描述");
 

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

@@ -260,7 +260,7 @@ class ActionInputAll extends BaseAction {
 						String orderNumber = configurator.getCellStringValue(row.getCell(configurator.getOrderNumberColumn()));
 						orderNumber = StringUtils.trimToEmpty(orderNumber);
 						Integer order = null;
-						if(orderNumber!=null){
+						if(StringUtils.isNotEmpty(orderNumber)){
 							order = Integer.valueOf(orderNumber);
 						}
 						unitItem.setOrderNumber(order);
@@ -585,7 +585,7 @@ class ActionInputAll extends BaseAction {
 				continue;
 			}
 			if (StringUtils.isEmpty(o.getUnique())) {
-				this.setUnitMemo(workbook, configurator, o, "组织编号不能为空.");
+				this.setUnitMemo(workbook, configurator, o, "组织唯一编码不能为空.");
 				validate = false;
 				continue;
 			}
@@ -607,7 +607,9 @@ class ActionInputAll extends BaseAction {
 						}
 					}
 				}
-				
+				if(!validate){
+					continue;
+				}
 				Unit p = null;
 				p = emc.flag(o.getUnique(), Unit.class);
 				if (null != p) {
@@ -639,7 +641,7 @@ class ActionInputAll extends BaseAction {
 				continue;
 			}*/
 			if (StringUtils.isEmpty(o.getUnique())) {
-				this.setPersonMemo(workbook, configurator, o, "员工账号不能为空.");
+				this.setPersonMemo(workbook, configurator, o, "员工唯一编码不能为空.");
 				validate = false;
 				continue;
 			}
@@ -648,6 +650,11 @@ class ActionInputAll extends BaseAction {
 				validate = false;
 				continue;
 			}
+			if(!this.checkMobile(business, o.getMobile())){
+				this.setPersonMemo(workbook, configurator, o, "手机号码不符合指定规则.");
+				validate = false;
+				continue;
+			}
 			this.setPersonMemo(workbook, configurator, o, "校验通过.");
 			/*if(o.getAttributes().isEmpty()|| StringUtils.isEmpty(o.getAttributes().get("idNumber"))){
 				this.setPersonMemo(workbook, configurator, o, "身份证号不能为空.");
@@ -664,8 +671,17 @@ class ActionInputAll extends BaseAction {
 							validate = false;
 							continue;
 						}
+						if (StringUtils.isNotEmpty(o.getMobile()) && StringUtils.equals(o.getMobile(), item.getMobile())) {
+							this.setPersonMemo(workbook, configurator, o, "手机号码冲突,本次导入中不唯一."); 
+							validate = false;
+							continue;
+						}
 					}
 				}
+				
+				if(!validate){
+					continue;
+				}
 				Person p = null;
 				p = emc.flag(o.getUnique(), Person.class);
 				if (null != p) {
@@ -673,6 +689,16 @@ class ActionInputAll extends BaseAction {
 					validate = false;
 					continue;
 				}
+				
+				Person pc = null;
+				pc = emc.flag(o.getMobile(), Person.class);
+				if (null != pc) {
+					System.out.println("手机号码: " + o.getMobile() + " 与已经存在手机号码: " + pc.getMobile() + " 冲突.");
+					this.setPersonMemo(workbook, configurator, o, "手机号码: " + o.getMobile() + " 与已经存在手机号码: " + pc.getMobile() + " 冲突.");
+					validate = false;
+					continue;
+				}
+				
 				this.setPersonMemo(workbook, configurator, o, "校验通过.");
 			}
 		}
@@ -704,12 +730,12 @@ class ActionInputAll extends BaseAction {
 				identityItem.setRow(i);
 				identitys.add(identityItem);
 				if (StringUtils.isEmpty(unique)) {
-					this.setIdentityMemo(workbook, configurator, identityItem, "员工账号不能为空.");
+					this.setIdentityMemo(workbook, configurator, identityItem, "员工唯一编码不能为空.");
 					validate = false;
 					continue;
 				}
 				if (StringUtils.isEmpty(unitCode)) {
-					this.setIdentityMemo(workbook, configurator, identityItem, "组织编号不能为空.");
+					this.setIdentityMemo(workbook, configurator, identityItem, "组织唯一编码不能为空.");
 					validate = false;
 					continue;
 				}

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

@@ -74,7 +74,7 @@ public class ActionTemplate extends BaseAction {
 		Cell cell = row.createCell(0);
 		cell.setCellValue("组织名称 *");
 		cell = row.createCell(1);
-		cell.setCellValue("组织编号 *");
+		cell.setCellValue("唯一编码 *");
 		cell = row.createCell(2);
 		cell.setCellValue("组织级别名称 *");
 		cell = row.createCell(3);
@@ -96,7 +96,7 @@ public class ActionTemplate extends BaseAction {
 		Cell cell = row.createCell(0);
 		cell.setCellValue("人员姓名 *");
 		cell = row.createCell(1);
-		cell.setCellValue("员工账号 *");
+		cell.setCellValue("唯一编码 *");
 		cell = row.createCell(2);
 		cell.setCellValue("手机号码 *");
 		cell = row.createCell(3);
@@ -118,9 +118,9 @@ public class ActionTemplate extends BaseAction {
 		XSSFSheet sheet = workbook.createSheet("人员身份信息");
 		Row row = sheet.createRow(0);
 		Cell cell = row.createCell(0);
-		cell.setCellValue("员工账号 *");
+		cell.setCellValue("人员唯一编码 *");
 		cell = row.createCell(1);
-		cell.setCellValue("组织编号 *");
+		cell.setCellValue("组织唯一编码 *");
 		cell = row.createCell(2);
 		cell.setCellValue("职务编号");
 		cell = row.createCell(3);
@@ -156,9 +156,9 @@ public class ActionTemplate extends BaseAction {
 		cell = row.createCell(1);
 		cell.setCellValue("群组编号 *");
 		cell = row.createCell(2);
-		cell.setCellValue("人员编号");
+		cell.setCellValue("人员唯一编码");
 		cell = row.createCell(3);
-		cell.setCellValue("组织编号");
+		cell.setCellValue("组织唯一编码");
 		cell = row.createCell(4);
 		cell.setCellValue("子群组编号");
 		cell = row.createCell(5);

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

@@ -3,8 +3,12 @@ package com.x.organization.assemble.control.jaxrs.inputperson;
 import java.util.Arrays;
 import java.util.List;
 
+import org.apache.commons.lang3.StringUtils;
+
 import com.x.base.core.project.cache.ApplicationCache;
+import com.x.base.core.project.config.Config;
 import com.x.base.core.project.jaxrs.StandardJaxrsAction;
+import com.x.organization.assemble.control.Business;
 
 import net.sf.ehcache.Ehcache;
 
@@ -14,6 +18,14 @@ abstract class BaseAction extends StandardJaxrsAction {
 	protected static List<String> genderTypeMaleItems = Arrays.asList(new String[] { "m", "M", "男", "male" });
 
 	protected Ehcache cache = ApplicationCache.instance().getCache(CacheInputResult.class);
+	
+	protected boolean checkMobile(Business business, String mobile) throws Exception {
+		if (!Config.person().isMobile(mobile)) {
+			return false;
+		}else{
+			return true;
+		}
+	}
 
 	public static class CacheInputResult {
 

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

@@ -72,8 +72,8 @@ public class GroupSheetConfigurator extends GsonPropertyObject {
 
 	private static List<String> uniqueItems = Arrays.asList(new String[] { "群组编号 *",  "unique" });
 	private static List<String> nameItems = Arrays.asList(new String[] { "群组名称 *", "name" });
-	private static List<String> personCodeItems = Arrays.asList(new String[] { "人员编号", "personCode" });
-	private static List<String> unitCodeItems = Arrays.asList(new String[] { "组织编号", "unitCode" });
+	private static List<String> personCodeItems = Arrays.asList(new String[] { "人员编号", "人员唯一编码" });
+	private static List<String> unitCodeItems = Arrays.asList(new String[] { "组织编号", "组织唯一编码" });
 	private static List<String> groupCodeItems = Arrays.asList(new String[] { "子群组编号","群组编号", "groupCode" });
 	private static List<String> descriptionItems = Arrays.asList(new String[] { "描述","群组描述", "description" });
 

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

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

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

@@ -75,7 +75,7 @@ public class PersonSheetConfigurator extends GsonPropertyObject {
 
 	private static List<String> nameItems = Arrays.asList(new String[] { "人员姓名 *", "人员姓名", "name" });
 	private static List<String> employeeItems = Arrays.asList(new String[] { "人员编号 *", "人员编号", "unique" });
-	private static List<String> uniqueItems = Arrays.asList(new String[] { "登录账号 *", "员工账号 *", "employee" });
+	private static List<String> uniqueItems = Arrays.asList(new String[] { "唯一编码 *", "员工账号 *", "employee" });
 	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" });

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

@@ -70,7 +70,7 @@ public class UnitSheetConfigurator extends GsonPropertyObject {
 	}
 
 	private static List<String> nameItems = Arrays.asList(new String[] { "组织名称 *", "name" });
-	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> superiorItems = Arrays.asList(new String[] { "上级组织", "上级组织编号", "superior"});
 	private static List<String> orderNumberItems = Arrays.asList(new String[] { "排序", "排序号", "orderNumber" });