Преглед на файлове

录入渠道客户修改

anderx преди 4 години
родител
ревизия
8784525da3

+ 2 - 2
src/main/java/com/goafanti/common/mapper/UserChannelMapper.xml

@@ -294,7 +294,7 @@
  	a.society_tag societyTag ,a.province,a.city from user_channel a
     left join user b on a.uid=b.id  
     where 1=1
-    and a.status in (3,4,5,9,10,11,12,13,14)
+    and a.status in (3,4,5,9,10,11,12,13)
     <if test="aid !=null">
     and a.aid= #{aid} 
     </if>
@@ -309,7 +309,7 @@
     left join user b on a.uid=b.id  left join organization_identity c on a.uid =c.uid 
     left join district_glossory d1 on c.location_province =d1.id 
     left join district_glossory d2 on c.location_city =d2.id
-    where 1=1 and a.status in (3,4,5,9,10,11,12,13,14)
+    where 1=1 and a.status in (3,4,5,9,10,11,12,13)
     <if test="aid !=null">
     and a.aid= #{aid} 
     </if>

+ 39 - 19
src/main/java/com/goafanti/user/service/impl/UserChannelServiceImpl.java

@@ -37,6 +37,7 @@ import com.goafanti.common.enums.SocietyTag;
 import com.goafanti.common.error.BusinessException;
 import com.goafanti.common.model.User;
 import com.goafanti.common.utils.ExcelUtils;
+import com.goafanti.common.utils.LoggerUtils;
 import com.goafanti.common.utils.PasswordUtil;
 import com.goafanti.common.utils.StringUtils;
 import com.goafanti.core.mybatis.BaseMybatisDao;
@@ -155,6 +156,9 @@ public class UserChannelServiceImpl extends BaseMybatisDao<UserChannelMapper> im
 			    	try {
 			        switch (cellNum) {
 						case 0:
+							if (StringUtils.isEmpty(getCellValue(cell))) {
+								throw new Exception();
+							}
 							in.setUserName(getCellValue(cell));
 							break;
 						case 1:
@@ -170,9 +174,16 @@ public class UserChannelServiceImpl extends BaseMybatisDao<UserChannelMapper> im
 							in.setSocietyTags(getCellValue(cell));
 							break;
 						case 4:
+							if (StringUtils.isEmpty(getCellValue(cell))) {
+								System.out.println("联系人");
+								throw new Exception();
+							}
 							in.setContacts(getCellValue(cell));
 							break;
 						case 5:
+							if (StringUtils.isEmpty(getCellValue(cell))) {
+								throw new Exception();
+							}
 							in.setContactMobile(getCellValue(cell));
 							break;
 				    	case 6:
@@ -180,7 +191,7 @@ public class UserChannelServiceImpl extends BaseMybatisDao<UserChannelMapper> im
 							break;
 						}
 			    	} catch (Exception e) {
-			    		throw new BusinessException(new Error("表格第"+(rowNum+1)+"行输入内容不正确。"));
+			    		throw new BusinessException(new Error("表格第"+(rowNum+1)+"行输入内容不完整。"));
 					}
 		        }
 		        String uid=UUID.randomUUID().toString();
@@ -194,12 +205,7 @@ public class UserChannelServiceImpl extends BaseMybatisDao<UserChannelMapper> im
 		        	in.setStatus(ChannelStatus.FFMC.getCode());
 					in.setUserStatus(1);
 					list3.add(in);
-				}else if (StringUtils.isBlank(in.getContacts())||StringUtils.isBlank(in.getContactMobile())) {
-		        	in.setUid(uid);
-		        	in.setStatus(ChannelStatus.WXLXR.getCode());
-					in.setUserStatus(1);
-					list3.add(in);
-				} else if (u == null) {
+				}else if (u == null) {
 					in.setUid(uid);
 					in.setUserStatus(0);
 					in.setStatus(ChannelStatus.WFP.getCode());
@@ -232,18 +238,12 @@ public class UserChannelServiceImpl extends BaseMybatisDao<UserChannelMapper> im
 		        
     		}
         }
-        for (InputUserChannel in : list) {
-        	int i=0;
-			for (InputUserChannel in2 : list) {
-				if (in.getUserName().equals(in2.getUserName())) {
-					i++;
-					if (i>1) {
-						throw new BusinessException(String.format("客户名称:%s 重复录入", in.getUserName()));
-					}
-				}
-			}
-			
-		}
+        //检查重复名称 
+        checkListName(list);
+        checkListName(list2);
+        checkListName(list3);
+        //list成功录入 list2是已存在 list3是非法名称 3个处理方式不一样,
+        //已存在则是不用新增直接关联,非法名称则不用关联也不用新增
         if (!list.isEmpty()) {
         	userMapper.insertBatch(list);
         	organizationIdentityMapper.insertBatch(list);
@@ -266,6 +266,26 @@ public class UserChannelServiceImpl extends BaseMybatisDao<UserChannelMapper> im
     	
     	
     }
+
+
+
+	private void checkListName(List<InputUserChannel> list) {
+		System.out.println("list.size="+list.size());
+		for (InputUserChannel in : list) {
+        	int i=0;
+			for (InputUserChannel in2 : list) {
+				System.out.println(in.getUserName()+"--"+in2.getUserName()+"="+in.getUserName().equals(in2.getUserName()));
+				if (in.getUserName().equals(in2.getUserName())) {
+					i++;
+					if (i>1) {
+						LoggerUtils.error(getClass(), String.format("客户名称:%s 重复录入", in.getUserName()));
+						throw new BusinessException(String.format("客户名称:%s 重复录入", in.getUserName()));
+					}
+				}
+			}
+			
+		}
+	}
 	
 	
 	  /**