|
@@ -0,0 +1,138 @@
|
|
|
+package com.ruixuan.salesLeads.service.impl;
|
|
|
+
|
|
|
+import com.alibaba.excel.EasyExcel;
|
|
|
+import com.ruixuan.common.core.domain.ResultResponse;
|
|
|
+import com.ruixuan.common.utils.PageUtils;
|
|
|
+import com.ruixuan.common.utils.StringUtils;
|
|
|
+import com.ruixuan.salesLeads.listener.ImportExcelListener;
|
|
|
+import com.ruixuan.salesLeads.mapper.SaleClueInfoMapper;
|
|
|
+import com.ruixuan.salesLeads.mapper.SaleQuotaInfoMapper;
|
|
|
+import com.ruixuan.salesLeads.mapper.TestMapper;
|
|
|
+import com.ruixuan.salesLeads.pojo.SaleClueInfoPojo;
|
|
|
+import com.ruixuan.salesLeads.pojo.SaleQuotaInfoPojo;
|
|
|
+import com.ruixuan.salesLeads.pojo.TestPojo;
|
|
|
+import com.ruixuan.salesLeads.service.ISaleClueInfoService;
|
|
|
+import com.ruixuan.salesLeads.service.ITestService;
|
|
|
+import com.ruixuan.system.domain.SysAreaInfo;
|
|
|
+import com.ruixuan.system.domain.SysIndustryInfo;
|
|
|
+import com.ruixuan.system.mapper.SysAreaInfoMapper;
|
|
|
+import com.ruixuan.system.mapper.SysIndustryInfoMapper;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.web.multipart.MultipartFile;
|
|
|
+
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
+/**
|
|
|
+ * ***************************************************
|
|
|
+ *
|
|
|
+ * @Auther: zianY
|
|
|
+ * @Descipion: demo测试
|
|
|
+ * @CreateDate: 2022-05-19
|
|
|
+ * ****************************************************
|
|
|
+ */
|
|
|
+@Service
|
|
|
+@Slf4j
|
|
|
+public class SaleClueInfoServiceImpl implements ISaleClueInfoService {
|
|
|
+
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private SaleClueInfoMapper saleClueInfoMapper;
|
|
|
+
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private SaleQuotaInfoMapper saleQuotaInfoMapper;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private SysIndustryInfoMapper sysIndustryInfoMapper;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private SysAreaInfoMapper sysAreaInfoMapper;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public ResultResponse importSaleClueExcel(List<MultipartFile> files, int salesLeadsType, Long uploadDate, Long createUserId) throws Exception{
|
|
|
+
|
|
|
+
|
|
|
+ for (MultipartFile file : files) {
|
|
|
+ //读取Excel
|
|
|
+ EasyExcel.read(file.getInputStream(),null,
|
|
|
+ new ImportExcelListener()).sheet().headRowNumber(1).doRead();
|
|
|
+
|
|
|
+
|
|
|
+ //结果集
|
|
|
+ List<Map<String,String>> dataList = ImportExcelListener.importDataList;
|
|
|
+
|
|
|
+ //头 信息
|
|
|
+ //Map<Integer, String> headList = ImportExcelListener.importHeadList;
|
|
|
+
|
|
|
+ //log.info("--结果shuju---{}",dataList);
|
|
|
+
|
|
|
+ //log.info("--结果表头---{}",headList);
|
|
|
+
|
|
|
+
|
|
|
+ List<SaleClueInfoPojo> clueList = new ArrayList<>();
|
|
|
+ List<SaleQuotaInfoPojo> quotaList = new ArrayList<>();
|
|
|
+ for (Map<String, String> dataMap : dataList) {
|
|
|
+ SaleClueInfoPojo clue = new SaleClueInfoPojo();
|
|
|
+ SaleQuotaInfoPojo quota = new SaleQuotaInfoPojo();
|
|
|
+
|
|
|
+ clue.setSalesLeadsType(salesLeadsType);
|
|
|
+ clue.setSellerId(Long.valueOf(dataMap.get("sellerId")));
|
|
|
+ clue.setSellerName(dataMap.get("sellerName"));
|
|
|
+ clue.setFans(Long.valueOf(dataMap.get("fans")));
|
|
|
+ clue.setTelephone(Long.valueOf(dataMap.get("telephone")));
|
|
|
+ clue.setProviderFlag(dataMap.get("providerFlag").equals("否") ? 0 : 1);
|
|
|
+ clue.setTransitionFlag(Integer.valueOf(dataMap.get("transitionFlag")));
|
|
|
+ clue.setCreateUserId(createUserId);
|
|
|
+
|
|
|
+ //查询行业
|
|
|
+ SysIndustryInfo industryInfo = sysIndustryInfoMapper.getIndustryInfoByName(dataMap.get("industryId"));
|
|
|
+ clue.setIndustryId(StringUtils.isNull(industryInfo) ? 0 : industryInfo.getId());
|
|
|
+
|
|
|
+ //根据城市查询 省市id
|
|
|
+ SysAreaInfo areaInfo = sysAreaInfoMapper.getAreaInfoByName(dataMap.get("cityId"));
|
|
|
+ clue.setProvinceId(areaInfo.getParentCode());
|
|
|
+ clue.setCityId(areaInfo.getCode());
|
|
|
+
|
|
|
+
|
|
|
+ quota.setNearlyThirtyDays(dataMap.get("NearlyThirtyDays"));
|
|
|
+ quota.setGmvMonth(Long.valueOf(dataMap.get("gmvMonth")));
|
|
|
+ quota.setGmv(dataMap.get("gmv"));
|
|
|
+
|
|
|
+ quota.setMtdDate(Long.valueOf(dataMap.get("mtdDate")));
|
|
|
+ quota.setMtd(dataMap.get("mtd"));
|
|
|
+ quota.setCreateUserId(createUserId);
|
|
|
+ quota.setSellerId(Long.valueOf(dataMap.get("sellerId")));
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ clueList.add(clue);
|
|
|
+ quotaList.add(quota);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ saleClueInfoMapper.replaceSaleClueInfoBatch(clueList);
|
|
|
+ saleQuotaInfoMapper.replaceSaleQuotaInfoBatch(quotaList);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ ImportExcelListener.importDataList.clear();
|
|
|
+ ImportExcelListener.importHeadList.clear();
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+}
|