|
@@ -451,6 +451,7 @@ public class BusinessOpportunityServiceImpl extends ServiceImpl<BusinessOpportun
|
|
private CustomMapper customMapper;
|
|
private CustomMapper customMapper;
|
|
@Override
|
|
@Override
|
|
public HttpRespMsg importData(MultipartFile multipartFile) {
|
|
public HttpRespMsg importData(MultipartFile multipartFile) {
|
|
|
|
+ System.out.println("=====开始进行商机导入=====");
|
|
HttpRespMsg msg=new HttpRespMsg();
|
|
HttpRespMsg msg=new HttpRespMsg();
|
|
if(!multipartFile.getOriginalFilename().endsWith(".xlsx")){
|
|
if(!multipartFile.getOriginalFilename().endsWith(".xlsx")){
|
|
msg.setError("文件格式错误,请使用.xlsx格式的Excel文件进行导入");
|
|
msg.setError("文件格式错误,请使用.xlsx格式的Excel文件进行导入");
|
|
@@ -590,7 +591,7 @@ public class BusinessOpportunityServiceImpl extends ServiceImpl<BusinessOpportun
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if(modelName.equals("inchargerId")){
|
|
if(modelName.equals("inchargerId")){
|
|
- if(!org.springframework.util.StringUtils.isEmpty(cell.getStringCellValue())){
|
|
|
|
|
|
+ if(null != cell && !org.springframework.util.StringUtils.isEmpty(cell.getStringCellValue())){
|
|
String userName = cell.getStringCellValue();
|
|
String userName = cell.getStringCellValue();
|
|
Optional<User> first;
|
|
Optional<User> first;
|
|
if(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1){
|
|
if(wxCorpInfo!=null&&wxCorpInfo.getSaasSyncContact()==1){
|
|
@@ -607,7 +608,7 @@ public class BusinessOpportunityServiceImpl extends ServiceImpl<BusinessOpportun
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}else if(modelName.equals("stageId")){
|
|
}else if(modelName.equals("stageId")){
|
|
- if(!StringUtils.isEmpty(cell.getStringCellValue())){
|
|
|
|
|
|
+ if(null != cell && !StringUtils.isEmpty(cell.getStringCellValue())){
|
|
Optional<Stage> first = stage.stream().filter(s -> s.getName().equals(cell.getStringCellValue())).findFirst();
|
|
Optional<Stage> first = stage.stream().filter(s -> s.getName().equals(cell.getStringCellValue())).findFirst();
|
|
if(first.isPresent()){
|
|
if(first.isPresent()){
|
|
product.setStageId(first.get().getId());
|
|
product.setStageId(first.get().getId());
|
|
@@ -617,12 +618,12 @@ public class BusinessOpportunityServiceImpl extends ServiceImpl<BusinessOpportun
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}else if(modelName.equals("contactsId")){
|
|
}else if(modelName.equals("contactsId")){
|
|
- if(!StringUtils.isEmpty(cell.getStringCellValue())){
|
|
|
|
|
|
+ if(null != cell && !StringUtils.isEmpty(cell.getStringCellValue())){
|
|
Optional<Contacts> first = contacts.stream().filter(s -> s.getName().equals(cell.getStringCellValue())).findFirst();
|
|
Optional<Contacts> first = contacts.stream().filter(s -> s.getName().equals(cell.getStringCellValue())).findFirst();
|
|
product.setContactsId(first.map(Contacts::getId).orElse(null));
|
|
product.setContactsId(first.map(Contacts::getId).orElse(null));
|
|
}
|
|
}
|
|
}else if(modelName.equals("customerId")){
|
|
}else if(modelName.equals("customerId")){
|
|
- if(!StringUtils.isEmpty(cell.getStringCellValue())){
|
|
|
|
|
|
+ if(null != cell && !StringUtils.isEmpty(cell.getStringCellValue())){
|
|
Optional<Custom> first = customs.stream().filter(s -> s.getCustomName().equals(cell.getStringCellValue())).findFirst();
|
|
Optional<Custom> first = customs.stream().filter(s -> s.getCustomName().equals(cell.getStringCellValue())).findFirst();
|
|
product.setCustomerId(first.map(Custom::getId).orElse(null));
|
|
product.setCustomerId(first.map(Custom::getId).orElse(null));
|
|
}
|
|
}
|
|
@@ -646,7 +647,7 @@ public class BusinessOpportunityServiceImpl extends ServiceImpl<BusinessOpportun
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}else {
|
|
}else {
|
|
- if(!StringUtils.isEmpty(cell.getStringCellValue())){
|
|
|
|
|
|
+ if(null != cell && !StringUtils.isEmpty(cell.getStringCellValue())){
|
|
Class<BusinessOpportunity> productClass = BusinessOpportunity.class;
|
|
Class<BusinessOpportunity> productClass = BusinessOpportunity.class;
|
|
Method method = productClass.getMethod(setter,String.class);
|
|
Method method = productClass.getMethod(setter,String.class);
|
|
method.invoke(product,cell.getStringCellValue());
|
|
method.invoke(product,cell.getStringCellValue());
|