|
|
@@ -28,6 +28,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
+import org.springframework.web.multipart.MultipartFile;
|
|
|
import org.springframework.web.socket.TextMessage;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
@@ -534,7 +535,9 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
|
|
|
return selectAUC;
|
|
|
}
|
|
|
|
|
|
- private void checkUserName(InputAddCustomer in) {
|
|
|
+
|
|
|
+
|
|
|
+ private void checkUserName(InputAddCustomer in) {
|
|
|
if (!userMapper.checkUser("", in.getName(), "", in.getType(), null, null).isEmpty())
|
|
|
throw new BusinessException(new Error(ErrorConstants.CUSTOMER_ALREADY_EXIST, in.getName(), ""));
|
|
|
String name2=null;
|
|
|
@@ -3046,6 +3049,49 @@ public class CustomerServiceImpl extends BaseMybatisDao<UserMapper> implements C
|
|
|
}
|
|
|
return param;
|
|
|
}
|
|
|
+ @Override
|
|
|
+ public Object importExcel(MultipartFile file) {
|
|
|
+ NewExcelUtil<InputExcelUser> newExcelUtil=new NewExcelUtil<>(InputExcelUser.class);
|
|
|
+ List<InputExcelUser> list = null;
|
|
|
+ try {
|
|
|
+ list = newExcelUtil.importExcel(file.getInputStream(),0);
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new BusinessException(e.getMessage());
|
|
|
+ }
|
|
|
+ return pushUserName(list);
|
|
|
+ }
|
|
|
+
|
|
|
+ private Object pushUserName(List<InputExcelUser> list) {
|
|
|
+ List<InputExcelUser> res=new ArrayList<>();
|
|
|
+ List<InputExcelUser> list2=new ArrayList<>();
|
|
|
+ int i = 0;
|
|
|
+ for (InputExcelUser e : list) {
|
|
|
+ i++;
|
|
|
+ list2.add(e);
|
|
|
+ if (list2.size()==100||i==list.size()){
|
|
|
+ List<UserNamesListBo> userNamesListBos = userNamesMapper.selectUserNameList(list2);
|
|
|
+ if (!userNamesListBos.isEmpty()){
|
|
|
+ for (InputExcelUser excelUser : list2) {
|
|
|
+ for (UserNamesListBo ex2 : userNamesListBos) {
|
|
|
+ if (ex2.getName().equals(excelUser.getName())){
|
|
|
+ excelUser.setType(1);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(excelUser.getType()==null){
|
|
|
+ excelUser.setType(0);
|
|
|
+ }
|
|
|
+ if (excelUser.getType()==1){
|
|
|
+ res.add(excelUser);
|
|
|
+ }
|
|
|
|
|
|
+ }
|
|
|
+ }
|
|
|
+ list2.clear();
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ return res;
|
|
|
+ }
|
|
|
|
|
|
}
|