Browse Source

销售线索查询

yangzian 3 years ago
parent
commit
64d53e5fa4

+ 24 - 7
ruixuan-salesLeads/src/main/java/com.ruixuan.salesLeads/controller/SaleClueInfoController.java

@@ -4,8 +4,10 @@ import com.alibaba.excel.EasyExcel;
 import com.ruixuan.common.core.controller.BaseController;
 import com.ruixuan.common.core.domain.ResultResponse;
 import com.ruixuan.common.utils.DateUtils;
+import com.ruixuan.common.utils.StringUtils;
 import com.ruixuan.common.utils.file.FileTypeUtils;
 import com.ruixuan.salesLeads.listener.ImportExcelListener;
+import com.ruixuan.salesLeads.pojo.SaleClueInfoPojo;
 import com.ruixuan.salesLeads.pojo.TestPojo;
 import com.ruixuan.salesLeads.service.ISaleClueInfoService;
 import com.ruixuan.salesLeads.service.ITestService;
@@ -53,24 +55,39 @@ public class SaleClueInfoController extends BaseController {
                                       @ApiParam("年-月") @RequestParam("uploadDate") String uploadDate,
                                       @ApiParam("创建人") @RequestParam("createUserId") Long createUserId
                                       ) throws Exception{
-
-
         if (files.isEmpty()){
             return ResultResponse.error("文件不能为空,请选择文件!");
         }
-
         for (MultipartFile file : files) {
-
            if (!FileTypeUtils.fileNameSuffix(file)){
                return ResultResponse.error("请上传正确格式的文件,支持扩展名.xls;.xlsx;.csv");
            }
-
         }
-
         Long year = DateUtils.strDateToInt(uploadDate);
-
         return saleClueInfoServiceImpl.importSaleExcelOrCsv(files,salesLeadsType,year,createUserId);
+    }
+
+
+
+
+
+    @ApiOperation(value = "销售线索列表查询",notes = "销售线索列表查询,查询条件为空时,所对应的字段可以不传。")
+    @GetMapping(value = "/selectSaleClueInfoList")
+    public ResultResponse<List<SaleClueInfoPojo>> selectSaleClueInfoList(
+            @ApiParam("卖家昵称") @RequestParam(value = "sellerName",required = false) String sellerName,
+            @ApiParam("年-月") @RequestParam(value = "uploadDate", required = false) String uploadDate,
+            @ApiParam("是否分配销售 0-否 1-是") @RequestParam(value = "distributionSaleFlag",required = false)String distributionSaleFlag,
+            @ApiParam("行业id") @RequestParam(value = "industryId",required = false)String industryId,
+            @ApiParam("粉丝量级 1:0~50w 2:50W~200W 3:200W~500W 4:500W以上") @RequestParam(value = "fansType",required = false)String fansType,
+            @ApiParam("创建人") @RequestParam(value = "createUserId",required = false) Long createUserId) throws Exception{
+
+        return saleClueInfoServiceImpl.selectSaleClueInfoList(sellerName,
+                StringUtils.isEmpty(uploadDate) ? null : DateUtils.strDateToInt(uploadDate),
+                distributionSaleFlag,industryId,fansType, createUserId);
 
     }
 
+
+
+
 }

+ 17 - 0
ruixuan-salesLeads/src/main/java/com.ruixuan.salesLeads/mapper/SaleClueInfoMapper.java

@@ -22,4 +22,21 @@ public interface SaleClueInfoMapper {
      * @param saleClueList
      */
     void replaceSaleClueInfoBatch(@Param(value = "saleClueList") List<SaleClueInfoPojo> saleClueList);
+
+    /**
+     * 查询销售线索信息
+     * @param sellerName 卖家昵称
+     * @param uploadDate 上传日期 202205
+     * @param distributionSaleFlag 是否分配销售 0-否 1-是
+     * @param industryId 行业id
+     * @param fansType 粉丝类别
+     * @param createUserId
+     * @return
+     */
+    List<SaleClueInfoPojo> selectSaleClueInfoList(@Param(value = "sellerName") String sellerName,
+                                                  @Param(value = "uploadDate") Long uploadDate,
+                                                  @Param(value = "distributionSaleFlag") String distributionSaleFlag,
+                                                  @Param(value = "industryId") String industryId,
+                                                  @Param(value = "fansType") String fansType,
+                                                  @Param(value = "createUserId") Long createUserId);
 }

+ 25 - 0
ruixuan-salesLeads/src/main/java/com.ruixuan.salesLeads/mapper/SaleClueRecordInfoMapper.java

@@ -0,0 +1,25 @@
+package com.ruixuan.salesLeads.mapper;
+
+import com.ruixuan.salesLeads.pojo.SaleClueRecordInfoPojo;
+import com.ruixuan.salesLeads.pojo.SaleQuotaInfoPojo;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * ***************************************************
+ *
+ * @Auther: zianY
+ * @Descipion: 销售线索-跟进记录
+ * @CreateDate: 2022-05-30
+ * ****************************************************
+ */
+public interface SaleClueRecordInfoMapper {
+
+
+    /**
+     *
+     * @param
+     */
+    SaleClueRecordInfoPojo getSaleClueRecordNumber(@Param(value = "sellerId") Long sellerId, @Param(value = "number")int number);
+}

+ 17 - 0
ruixuan-salesLeads/src/main/java/com.ruixuan.salesLeads/pojo/SaleClueInfoPojo.java

@@ -40,12 +40,18 @@ public class SaleClueInfoPojo {
 
     @ApiModelProperty("所属行业")
     private int industryId;
+    @ApiModelProperty("所属行业")
+    private String industryName;
 
     @ApiModelProperty("常驻省份")
     private int provinceId;
+    @ApiModelProperty("常驻省份")
+    private String provinceName;
 
     @ApiModelProperty("常驻城市")
     private int cityId;
+    @ApiModelProperty("常驻城市")
+    private String cityName;
 
     @ApiModelProperty("联系方式")
     private Long telephone;
@@ -84,4 +90,15 @@ public class SaleClueInfoPojo {
     private String updateTime;
 
 
+    @ApiModelProperty("第一次跟进情况")
+    private SaleClueRecordInfoPojo firstRecord;
+    @ApiModelProperty("第二次跟进情况")
+    private SaleClueRecordInfoPojo secondRecord;
+
+
+
+
+
+
+
 }

+ 54 - 0
ruixuan-salesLeads/src/main/java/com.ruixuan.salesLeads/pojo/SaleClueRecordInfoPojo.java

@@ -0,0 +1,54 @@
+package com.ruixuan.salesLeads.pojo;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * ***************************************************
+ *
+ * @Auther: zianY
+ * @Descipion: 销售线索-跟进记录信息表
+ * @CreateDate: 2022-05-30
+ * ****************************************************
+ */
+
+
+@Data
+@ApiModel(value = "saleClueRecordInfoPojo", description = "销售线索-跟进记录信息表")
+public class SaleClueRecordInfoPojo {
+
+
+    private int id;
+
+    @ApiModelProperty("卖家id")
+    private Long sellerId;
+
+    @ApiModelProperty("当前跟进次数")
+    private int recordTimes;
+
+    @ApiModelProperty("跟进话术1-扶持 2-活动")
+    private int recordScript;
+
+    @ApiModelProperty("是否继续跟进 1-继续跟进 2-意向合作 3-跟进完成无合作")
+    private int continueFlag;
+
+    @ApiModelProperty("意向合作 1-不合作可跟进 2-添加微信 3-操盘合作 4-服务商合作 5-金牛合作 6-无法添加微信")
+    private int intendedCooperation;
+
+    @ApiModelProperty("跟进详情")
+    private String recordInfo;
+
+    @ApiModelProperty("备注")
+    private String remarks;
+
+
+    @ApiModelProperty("创建人")
+    private Long createUserId;
+
+    @ApiModelProperty("创建时间")
+    private String createTime;
+
+
+
+}

+ 5 - 0
ruixuan-salesLeads/src/main/java/com.ruixuan.salesLeads/service/ISaleClueInfoService.java

@@ -1,6 +1,8 @@
 package com.ruixuan.salesLeads.service;
 
 import com.ruixuan.common.core.domain.ResultResponse;
+import com.ruixuan.salesLeads.pojo.SaleClueInfoPojo;
+import org.apache.ibatis.annotations.Param;
 import org.springframework.web.multipart.MultipartFile;
 
 import java.util.List;
@@ -17,4 +19,7 @@ public interface ISaleClueInfoService {
 
 
     ResultResponse importSaleExcelOrCsv(List<MultipartFile> files,int salesLeadsType,Long uploadDate,Long createUserId)throws Exception;
+
+
+    ResultResponse<List<SaleClueInfoPojo>> selectSaleClueInfoList(String sellerName, Long uploadDate, String distributionSaleFlag, String industryId, String fansType, Long createUserId)throws Exception;
 }

+ 26 - 18
ruixuan-salesLeads/src/main/java/com.ruixuan.salesLeads/service/impl/SaleClueInfoServiceImpl.java

@@ -2,10 +2,12 @@ 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.common.utils.file.FileTypeUtils;
 import com.ruixuan.salesLeads.listener.ImportExcelListener;
 import com.ruixuan.salesLeads.mapper.SaleClueInfoMapper;
+import com.ruixuan.salesLeads.mapper.SaleClueRecordInfoMapper;
 import com.ruixuan.salesLeads.mapper.SaleQuotaInfoMapper;
 import com.ruixuan.salesLeads.pojo.SaleClueInfoPojo;
 import com.ruixuan.salesLeads.pojo.SaleQuotaInfoPojo;
@@ -68,47 +70,32 @@ public class SaleClueInfoServiceImpl implements ISaleClueInfoService {
     @Override
     public ResultResponse importSaleExcelOrCsv(List<MultipartFile> files, 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();
-
-
         }
 
-
         return ResultResponse.successMsg("保存成功",null);
     }
 
@@ -120,7 +107,6 @@ public class SaleClueInfoServiceImpl implements ISaleClueInfoService {
      * @param createUserId
      */
     public void resultData(List<Map<String,String>> dataList,int salesLeadsType,Long createUserId){
-
         List<SaleClueInfoPojo> clueList = new ArrayList<>();
         List<SaleQuotaInfoPojo> quotaList = new ArrayList<>();
         for (Map<String, String> dataMap : dataList) {
@@ -135,11 +121,9 @@ public class SaleClueInfoServiceImpl implements ISaleClueInfoService {
             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());
@@ -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);
+    }
+
+
+
+
+
 
 
 }

+ 64 - 5
ruixuan-salesLeads/src/main/resources/mapper/salesLeads/SaleClueInfoMapper.xml

@@ -4,11 +4,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.ruixuan.salesLeads.mapper.SaleClueInfoMapper">
 
-
-	
-
-
-<!-- 批量新增销售线索-->
+	<!-- 批量新增销售线索-->
 	<insert id="replaceSaleClueInfoBatch">
 		replace into sale_clue_info(
 		sales_leads_type,
@@ -52,6 +48,69 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 		</foreach>
 	</insert>
 
+	<select id="selectSaleClueInfoList" resultType="com.ruixuan.salesLeads.pojo.SaleClueInfoPojo">
+		SELECT
+			s.id,
+			s.sales_leads_type,
+			s.seller_id,
+			s.seller_name,
+			s.fans,
+			s.industry_id,
+			(SELECT name from sys_industry_info i where i.id = s.industry_id) industryName,
+			s.province_id,
+			(SELECT name from sys_area_info a WHERE a.`code` = s.province_id) provinceName,
+			s.city_id,
+			(SELECT name from sys_area_info a WHERE a.`code` = s.city_id) cityName,
+			s.telephone,
+			s.provider_flag,
+			s.transition_flag,
+			s.upload_date,
+			s.distribution_sale_flag,
+			s.sale_id,
+			(SELECT u.nick_name FROM sys_user u WHERE u.user_id = s.sale_id ) saleName,
+			s.state,
+			s.offline_sale_flag,
+			s.create_user_id,
+			s.create_time
+		FROM
+			sale_clue_info s
+		<where>
+			<if test="sellerName !=null and sellerName != ''">
+				and s.seller_name like CONCAT('%', CONCAT(#{sellerName}, '%')) or s.seller_id like CONCAT('%', CONCAT(#{sellerName}, '%'))
+			</if>
+			<if test="uploadDate !=null and uploadDate != ''">
+				and s.upload_date = #{uploadDate}
+			</if>
+			<if test="distributionSaleFlag !=null and distributionSaleFlag != ''" >
+				and s.distribution_sale_flag = #{distributionSaleFlag}
+			</if>
+			<if test="industryId !=null and industryId != ''">
+				and s.industry_id = #{industryId}
+			</if>
+			<if test="fansType == '1'.toString()">
+				and s.fans BETWEEN 0 AND 500000
+			</if>
+			<if test="fansType == '2'.toString()">
+				and s.fans BETWEEN 500000 AND 2000000
+			</if>
+			<if test="fansType == '3'.toString()">
+				and s.fans BETWEEN 2000000 AND 5000000
+			</if>
+			<if test="fansType == '4'.toString()">
+				and s.fans &gt;=5000000
+			</if>
+
+		</where>
+
+
+
+
+
+
+
+	</select>
+
+
 
 
 </mapper> 

+ 38 - 0
ruixuan-salesLeads/src/main/resources/mapper/salesLeads/SaleClueRecordInfoMapper.xml

@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.ruixuan.salesLeads.mapper.SaleClueRecordInfoMapper">
+
+
+	<select id="getSaleClueRecordNumber" resultType="com.ruixuan.salesLeads.pojo.SaleClueRecordInfoPojo">
+		SELECT
+		r.id,
+		r.seller_id,
+		r.record_times,
+		r.record_script,
+		r.continue_flag,
+		r.intended_cooperation,
+		r.record_info,
+		r.remarks,
+		r.create_user_id,
+		r.create_time
+		FROM
+		sale_clue_record_info r
+		<where>
+			<if test="sellerId !=null and sellerId != ''">
+				and r.seller_id = #{sellerId}
+			</if>
+			<if test="number !=null and number != ''">
+				and r.record_times = #{number}
+			</if>
+		</where>
+		LIMIT 1
+	</select>
+
+
+
+
+
+
+</mapper>