|
@@ -37,6 +37,7 @@ import com.goafanti.common.enums.SocietyTag;
|
|
|
import com.goafanti.common.error.BusinessException;
|
|
import com.goafanti.common.error.BusinessException;
|
|
|
import com.goafanti.common.model.User;
|
|
import com.goafanti.common.model.User;
|
|
|
import com.goafanti.common.utils.ExcelUtils;
|
|
import com.goafanti.common.utils.ExcelUtils;
|
|
|
|
|
+import com.goafanti.common.utils.LoggerUtils;
|
|
|
import com.goafanti.common.utils.PasswordUtil;
|
|
import com.goafanti.common.utils.PasswordUtil;
|
|
|
import com.goafanti.common.utils.StringUtils;
|
|
import com.goafanti.common.utils.StringUtils;
|
|
|
import com.goafanti.core.mybatis.BaseMybatisDao;
|
|
import com.goafanti.core.mybatis.BaseMybatisDao;
|
|
@@ -155,6 +156,9 @@ public class UserChannelServiceImpl extends BaseMybatisDao<UserChannelMapper> im
|
|
|
try {
|
|
try {
|
|
|
switch (cellNum) {
|
|
switch (cellNum) {
|
|
|
case 0:
|
|
case 0:
|
|
|
|
|
+ if (StringUtils.isEmpty(getCellValue(cell))) {
|
|
|
|
|
+ throw new Exception();
|
|
|
|
|
+ }
|
|
|
in.setUserName(getCellValue(cell));
|
|
in.setUserName(getCellValue(cell));
|
|
|
break;
|
|
break;
|
|
|
case 1:
|
|
case 1:
|
|
@@ -170,9 +174,16 @@ public class UserChannelServiceImpl extends BaseMybatisDao<UserChannelMapper> im
|
|
|
in.setSocietyTags(getCellValue(cell));
|
|
in.setSocietyTags(getCellValue(cell));
|
|
|
break;
|
|
break;
|
|
|
case 4:
|
|
case 4:
|
|
|
|
|
+ if (StringUtils.isEmpty(getCellValue(cell))) {
|
|
|
|
|
+ System.out.println("联系人");
|
|
|
|
|
+ throw new Exception();
|
|
|
|
|
+ }
|
|
|
in.setContacts(getCellValue(cell));
|
|
in.setContacts(getCellValue(cell));
|
|
|
break;
|
|
break;
|
|
|
case 5:
|
|
case 5:
|
|
|
|
|
+ if (StringUtils.isEmpty(getCellValue(cell))) {
|
|
|
|
|
+ throw new Exception();
|
|
|
|
|
+ }
|
|
|
in.setContactMobile(getCellValue(cell));
|
|
in.setContactMobile(getCellValue(cell));
|
|
|
break;
|
|
break;
|
|
|
case 6:
|
|
case 6:
|
|
@@ -180,7 +191,7 @@ public class UserChannelServiceImpl extends BaseMybatisDao<UserChannelMapper> im
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
|
- throw new BusinessException(new Error("表格第"+(rowNum+1)+"行输入内容不正确。"));
|
|
|
|
|
|
|
+ throw new BusinessException(new Error("表格第"+(rowNum+1)+"行输入内容不完整。"));
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
String uid=UUID.randomUUID().toString();
|
|
String uid=UUID.randomUUID().toString();
|
|
@@ -194,12 +205,7 @@ public class UserChannelServiceImpl extends BaseMybatisDao<UserChannelMapper> im
|
|
|
in.setStatus(ChannelStatus.FFMC.getCode());
|
|
in.setStatus(ChannelStatus.FFMC.getCode());
|
|
|
in.setUserStatus(1);
|
|
in.setUserStatus(1);
|
|
|
list3.add(in);
|
|
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.setUid(uid);
|
|
|
in.setUserStatus(0);
|
|
in.setUserStatus(0);
|
|
|
in.setStatus(ChannelStatus.WFP.getCode());
|
|
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()) {
|
|
if (!list.isEmpty()) {
|
|
|
userMapper.insertBatch(list);
|
|
userMapper.insertBatch(list);
|
|
|
organizationIdentityMapper.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()));
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|