|
@@ -2,10 +2,12 @@ package com.ruixuan.salesLeads.service.impl;
|
|
|
|
|
|
import com.alibaba.excel.EasyExcel;
|
|
import com.alibaba.excel.EasyExcel;
|
|
import com.ruixuan.common.core.domain.ResultResponse;
|
|
import com.ruixuan.common.core.domain.ResultResponse;
|
|
|
|
+import com.ruixuan.common.utils.PageUtils;
|
|
import com.ruixuan.common.utils.StringUtils;
|
|
import com.ruixuan.common.utils.StringUtils;
|
|
import com.ruixuan.common.utils.file.FileTypeUtils;
|
|
import com.ruixuan.common.utils.file.FileTypeUtils;
|
|
import com.ruixuan.salesLeads.listener.ImportExcelListener;
|
|
import com.ruixuan.salesLeads.listener.ImportExcelListener;
|
|
import com.ruixuan.salesLeads.mapper.SaleClueInfoMapper;
|
|
import com.ruixuan.salesLeads.mapper.SaleClueInfoMapper;
|
|
|
|
+import com.ruixuan.salesLeads.mapper.SaleClueRecordInfoMapper;
|
|
import com.ruixuan.salesLeads.mapper.SaleQuotaInfoMapper;
|
|
import com.ruixuan.salesLeads.mapper.SaleQuotaInfoMapper;
|
|
import com.ruixuan.salesLeads.pojo.SaleClueInfoPojo;
|
|
import com.ruixuan.salesLeads.pojo.SaleClueInfoPojo;
|
|
import com.ruixuan.salesLeads.pojo.SaleQuotaInfoPojo;
|
|
import com.ruixuan.salesLeads.pojo.SaleQuotaInfoPojo;
|
|
@@ -68,47 +70,32 @@ public class SaleClueInfoServiceImpl implements ISaleClueInfoService {
|
|
@Override
|
|
@Override
|
|
public ResultResponse importSaleExcelOrCsv(List<MultipartFile> files, int salesLeadsType, Long uploadDate, Long createUserId) throws Exception{
|
|
public ResultResponse importSaleExcelOrCsv(List<MultipartFile> files, int salesLeadsType, Long uploadDate, Long createUserId) throws Exception{
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
List<Map<String,String>> dataList = new ArrayList<>();
|
|
List<Map<String,String>> dataList = new ArrayList<>();
|
|
-
|
|
|
|
for (MultipartFile file : files) {
|
|
for (MultipartFile file : files) {
|
|
-
|
|
|
|
//文件类型
|
|
//文件类型
|
|
String fileType = FileTypeUtils.gerFileTypeXlsOrCsv(file);
|
|
String fileType = FileTypeUtils.gerFileTypeXlsOrCsv(file);
|
|
-
|
|
|
|
if (StringUtils.equals("excel",fileType)){
|
|
if (StringUtils.equals("excel",fileType)){
|
|
-
|
|
|
|
//读取Excel
|
|
//读取Excel
|
|
EasyExcel.read(file.getInputStream(),null,
|
|
EasyExcel.read(file.getInputStream(),null,
|
|
new ImportExcelListener()).sheet().headRowNumber(1).doRead();
|
|
new ImportExcelListener()).sheet().headRowNumber(1).doRead();
|
|
-
|
|
|
|
//头 信息
|
|
//头 信息
|
|
//Map<Integer, String> headList = ImportExcelListener.importHeadList;
|
|
//Map<Integer, String> headList = ImportExcelListener.importHeadList;
|
|
-
|
|
|
|
//结果集
|
|
//结果集
|
|
dataList = ImportExcelListener.importDataList;
|
|
dataList = ImportExcelListener.importDataList;
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
if (StringUtils.equals("csv",fileType)){
|
|
if (StringUtils.equals("csv",fileType)){
|
|
-
|
|
|
|
dataList = CsvImportUtil.readCSV(file);
|
|
dataList = CsvImportUtil.readCSV(file);
|
|
-
|
|
|
|
}
|
|
}
|
|
-
|
|
|
|
//处理数据结果
|
|
//处理数据结果
|
|
resultData(dataList,salesLeadsType,createUserId);
|
|
resultData(dataList,salesLeadsType,createUserId);
|
|
|
|
|
|
-
|
|
|
|
//excel 清除监听数据
|
|
//excel 清除监听数据
|
|
ImportExcelListener.importDataList.clear();
|
|
ImportExcelListener.importDataList.clear();
|
|
ImportExcelListener.importHeadList.clear();
|
|
ImportExcelListener.importHeadList.clear();
|
|
-
|
|
|
|
-
|
|
|
|
}
|
|
}
|
|
|
|
|
|
-
|
|
|
|
return ResultResponse.successMsg("保存成功",null);
|
|
return ResultResponse.successMsg("保存成功",null);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -120,7 +107,6 @@ public class SaleClueInfoServiceImpl implements ISaleClueInfoService {
|
|
* @param createUserId
|
|
* @param createUserId
|
|
*/
|
|
*/
|
|
public void resultData(List<Map<String,String>> dataList,int salesLeadsType,Long createUserId){
|
|
public void resultData(List<Map<String,String>> dataList,int salesLeadsType,Long createUserId){
|
|
-
|
|
|
|
List<SaleClueInfoPojo> clueList = new ArrayList<>();
|
|
List<SaleClueInfoPojo> clueList = new ArrayList<>();
|
|
List<SaleQuotaInfoPojo> quotaList = new ArrayList<>();
|
|
List<SaleQuotaInfoPojo> quotaList = new ArrayList<>();
|
|
for (Map<String, String> dataMap : dataList) {
|
|
for (Map<String, String> dataMap : dataList) {
|
|
@@ -135,11 +121,9 @@ public class SaleClueInfoServiceImpl implements ISaleClueInfoService {
|
|
clue.setProviderFlag(dataMap.get("providerFlag").equals("否") ? 0 : 1);
|
|
clue.setProviderFlag(dataMap.get("providerFlag").equals("否") ? 0 : 1);
|
|
clue.setTransitionFlag(Integer.valueOf(dataMap.get("transitionFlag")));
|
|
clue.setTransitionFlag(Integer.valueOf(dataMap.get("transitionFlag")));
|
|
clue.setCreateUserId(createUserId);
|
|
clue.setCreateUserId(createUserId);
|
|
-
|
|
|
|
//查询行业
|
|
//查询行业
|
|
SysIndustryInfo industryInfo = sysIndustryInfoMapper.getIndustryInfoByName(dataMap.get("industryId"));
|
|
SysIndustryInfo industryInfo = sysIndustryInfoMapper.getIndustryInfoByName(dataMap.get("industryId"));
|
|
clue.setIndustryId(StringUtils.isNull(industryInfo) ? 0 : industryInfo.getId());
|
|
clue.setIndustryId(StringUtils.isNull(industryInfo) ? 0 : industryInfo.getId());
|
|
-
|
|
|
|
//根据城市查询 省市id
|
|
//根据城市查询 省市id
|
|
SysAreaInfo areaInfo = sysAreaInfoMapper.getAreaInfoByName(dataMap.get("cityId"));
|
|
SysAreaInfo areaInfo = sysAreaInfoMapper.getAreaInfoByName(dataMap.get("cityId"));
|
|
clue.setProvinceId(areaInfo.getParentCode());
|
|
clue.setProvinceId(areaInfo.getParentCode());
|
|
@@ -167,6 +151,30 @@ public class SaleClueInfoServiceImpl implements ISaleClueInfoService {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private SaleClueRecordInfoMapper saleClueRecordInfoMapper;
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public ResultResponse<List<SaleClueInfoPojo>> selectSaleClueInfoList(String sellerName, Long uploadDate, String distributionSaleFlag, String industryId, String fansType, Long createUserId) throws Exception {
|
|
|
|
+
|
|
|
|
+ PageUtils.startPage();
|
|
|
|
+ List<SaleClueInfoPojo> saleList = saleClueInfoMapper.selectSaleClueInfoList(sellerName,uploadDate,distributionSaleFlag,industryId,fansType, createUserId);
|
|
|
|
+ saleList.forEach(clue ->{
|
|
|
|
+ clue.setFirstRecord(saleClueRecordInfoMapper.getSaleClueRecordNumber(clue.getSellerId(),1));
|
|
|
|
+ clue.setSecondRecord(saleClueRecordInfoMapper.getSaleClueRecordNumber(clue.getSellerId(),2));
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ return ResultResponse.successMsg("查询成功。",saleList);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|