|
@@ -75,7 +75,7 @@ public class SaleClueInfoServiceImpl implements ISaleClueInfoService {
|
|
|
* Description: 销售线索添加
|
|
|
* 支持excel 和 csv 文件上传
|
|
|
*------------
|
|
|
- * @param files
|
|
|
+ * @param file
|
|
|
* @param salesLeadsType 销售线索类型1:50W低潜;2:50W中高潜;3:200W高潜;4:200W-500w;5:500W
|
|
|
* @param uploadDate 时间 格式为202205
|
|
|
* @param createUserId
|
|
@@ -83,34 +83,34 @@ public class SaleClueInfoServiceImpl implements ISaleClueInfoService {
|
|
|
* Return com.ruixuan.common.core.domain.ResultResponse
|
|
|
*/
|
|
|
@Override
|
|
|
- public ResultResponse importSaleExcelOrCsv(List<MultipartFile> files, int salesLeadsType, Long uploadDate, Long createUserId) throws Exception{
|
|
|
+ public ResultResponse importSaleExcelOrCsv(MultipartFile file, int salesLeadsType, Long uploadDate, Long createUserId) throws Exception{
|
|
|
|
|
|
List<Map<String,String>> dataList = new ArrayList<>();
|
|
|
- for (MultipartFile file : files) {
|
|
|
- //文件类型
|
|
|
- String fileType = FileTypeUtils.gerFileTypeXlsOrCsv(file);
|
|
|
- if (StringUtils.equals("excel",fileType)){
|
|
|
- //读取Excel
|
|
|
- EasyExcel.read(file.getInputStream(),null,
|
|
|
- new ImportExcelListener()).sheet().headRowNumber(1).doRead();
|
|
|
- //头 信息
|
|
|
- //Map<Integer, String> headList = ImportExcelListener.importHeadList;
|
|
|
- //结果集
|
|
|
- dataList = ImportExcelListener.importDataList;
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- if (StringUtils.equals("csv",fileType)){
|
|
|
- dataList = CsvImportUtil.readCSV(file);
|
|
|
- }
|
|
|
- //处理数据结果
|
|
|
- resultData(dataList,salesLeadsType,createUserId);
|
|
|
-
|
|
|
- //excel 清除监听数据
|
|
|
- ImportExcelListener.importDataList.clear();
|
|
|
- ImportExcelListener.importHeadList.clear();
|
|
|
+
|
|
|
+ //文件类型
|
|
|
+ String fileType = FileTypeUtils.gerFileTypeXlsOrCsv(file);
|
|
|
+
|
|
|
+ if (StringUtils.equals("excel",fileType)){
|
|
|
+ //读取Excel
|
|
|
+ EasyExcel.read(file.getInputStream(),null,
|
|
|
+ new ImportExcelListener()).sheet().headRowNumber(1).doRead();
|
|
|
+ //头 信息
|
|
|
+ //Map<Integer, String> headList = ImportExcelListener.importHeadList;
|
|
|
+ //结果集
|
|
|
+ dataList = ImportExcelListener.importDataList;
|
|
|
+
|
|
|
}
|
|
|
|
|
|
+ if (StringUtils.equals("csv",fileType)){
|
|
|
+ dataList = CsvImportUtil.readCSV(file);
|
|
|
+ }
|
|
|
+ //处理数据结果
|
|
|
+ resultData(dataList,salesLeadsType,createUserId);
|
|
|
+
|
|
|
+ //excel 清除监听数据
|
|
|
+ ImportExcelListener.importDataList.clear();
|
|
|
+ ImportExcelListener.importHeadList.clear();
|
|
|
+
|
|
|
return ResultResponse.successMsg("保存成功",null);
|
|
|
}
|
|
|
|