Browse Source

Merge branch 'test'

zhaoxian 2 năm trước cách đây
mục cha
commit
daf2f4e618
16 tập tin đã thay đổi với 770 bổ sung53 xóa
  1. 70 0
      ruixuan-live/src/main/java/com/ruixuan/isc/controller/KuaishouLabelController.java
  2. 57 9
      ruixuan-live/src/main/java/com/ruixuan/isc/controller/KuaishouPromoterController.java
  3. 44 0
      ruixuan-live/src/main/java/com/ruixuan/isc/entity/KuaishouLabel.java
  4. 12 0
      ruixuan-live/src/main/java/com/ruixuan/isc/entity/KuaishouPromoter.java
  5. 2 0
      ruixuan-live/src/main/java/com/ruixuan/isc/mapper/KuaishouItemCollectSamplesMapper.java
  6. 66 0
      ruixuan-live/src/main/java/com/ruixuan/isc/mapper/KuaishouLabelMapper.java
  7. 17 1
      ruixuan-live/src/main/java/com/ruixuan/isc/mapper/KuaishouPromoterMapper.java
  8. 2 0
      ruixuan-live/src/main/java/com/ruixuan/isc/service/IKuaishouItemCollectSamplesService.java
  9. 63 0
      ruixuan-live/src/main/java/com/ruixuan/isc/service/IKuaishouLabelService.java
  10. 9 2
      ruixuan-live/src/main/java/com/ruixuan/isc/service/IKuaishouPromoterService.java
  11. 5 0
      ruixuan-live/src/main/java/com/ruixuan/isc/service/impl/KuaishouItemCollectSamplesServiceImpl.java
  12. 88 0
      ruixuan-live/src/main/java/com/ruixuan/isc/service/impl/KuaishouLabelServiceImpl.java
  13. 83 6
      ruixuan-live/src/main/java/com/ruixuan/isc/service/impl/KuaishouPromoterServiceImpl.java
  14. 5 0
      ruixuan-live/src/main/resources/mapper/isc/KuaishouItemCollectSamplesMapper.xml
  15. 88 0
      ruixuan-live/src/main/resources/mapper/isc/KuaishouLabelMapper.xml
  16. 159 35
      ruixuan-live/src/main/resources/mapper/isc/KuaishouPromoterMapper.xml

+ 70 - 0
ruixuan-live/src/main/java/com/ruixuan/isc/controller/KuaishouLabelController.java

@@ -0,0 +1,70 @@
+package com.ruixuan.isc.controller;
+
+
+import com.ruixuan.common.core.controller.BaseController;
+import com.ruixuan.common.core.domain.AjaxResult;
+import com.ruixuan.common.core.page.TableDataInfo;
+import com.ruixuan.common.utils.Result;
+import com.ruixuan.isc.entity.KuaishouLabel;
+import com.ruixuan.isc.service.IKuaishouLabelService;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+/**
+ * 快手标签Controller
+ *
+ * @author ruoyi
+ * @date 2023-03-28
+ */
+@Api(tags = "---------快手标签")
+@RestController
+@RequestMapping("/kuaishou/label")
+public class KuaishouLabelController extends BaseController {
+    @Autowired
+    private IKuaishouLabelService kuaishouLabelService;
+
+    /**
+     * 查询快手标签列表
+     */
+    @ApiOperation(value = "查询快手标签列表")
+    @GetMapping("/list")
+    public TableDataInfo list(KuaishouLabel kuaishouLabel) {
+        startPage();
+        List<KuaishouLabel> list = kuaishouLabelService.selectKuaishouLabelList(kuaishouLabel);
+        return getDataTable(list);
+    }
+
+    /**
+     * 新增快手标签
+     */
+    @ApiOperation(value = "新增快手标签")
+    @PostMapping(value = "/add")
+    public Result add(@RequestBody KuaishouLabel kuaishouLabel) {
+        return kuaishouLabelService.insertKuaishouLabel(kuaishouLabel);
+    }
+
+    /**
+     * 修改快手标签
+     */
+    @PostMapping(value = "/edit")
+    public AjaxResult edit(@RequestBody KuaishouLabel kuaishouLabel) {
+        return toAjax(kuaishouLabelService.updateKuaishouLabel(kuaishouLabel));
+    }
+
+    /**
+     * 删除快手标签
+     */
+    @ApiOperation(value = "删除快手标签")
+    @GetMapping(value = "/deleteById")
+    public AjaxResult remove(Long id) {
+        return toAjax(kuaishouLabelService.deleteKuaishouLabelById(id));
+    }
+}

+ 57 - 9
ruixuan-live/src/main/java/com/ruixuan/isc/controller/KuaishouPromoterController.java

@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject;
 import com.ruixuan.common.core.controller.BaseController;
 import com.ruixuan.common.core.domain.AjaxResult;
 import com.ruixuan.common.core.page.TableDataInfo;
+import com.ruixuan.common.utils.Result;
 import com.ruixuan.isc.entity.KuaishouPromoter;
 import com.ruixuan.isc.service.IKuaishouPromoterService;
 import com.ruixuan.isc.utils.Tess4jClient;
@@ -62,11 +63,10 @@ public class KuaishouPromoterController extends BaseController {
     @ApiOperation(value = "达人公海")
     public TableDataInfo list2(@ApiParam("达人ID") @RequestParam(value = "promoterId", required = false) Long promoterId,
                                @ApiParam("达人名称") @RequestParam(value = "promoterNickName", required = false) String promoterNickName,
+                               @ApiParam("认领状态,1-认领,2-未认领") @RequestParam(value = "status", required = false) String status,
                                @ApiParam("排序参数") @RequestParam(value = "parameter", required = false) String parameter,
-                               @ApiParam("正序倒叙") @RequestParam(value = "orderBy", required = false) String orderBy
-
-    ) {
-        List<KuaishouPromoter> list = kuaishouPromoterService.selectKuaishouPromoterList2(promoterId, promoterNickName, parameter, orderBy);
+                               @ApiParam("正序倒叙") @RequestParam(value = "orderBy", required = false) String orderBy) {
+        List<JSONObject> list = kuaishouPromoterService.selectKuaishouPromoterList2(promoterId, promoterNickName, status, parameter, orderBy);
         return getDataTable(list);
     }
 
@@ -113,7 +113,45 @@ public class KuaishouPromoterController extends BaseController {
     @PostMapping(value = "/add")
     @ApiOperation(value = "新增快手达人")
     public JSONObject add(@RequestBody KuaishouPromoter kuaishouPromoter) {
-        return kuaishouPromoterService.insertKuaishouPromoter(kuaishouPromoter);
+        try {
+            return kuaishouPromoterService.insertKuaishouPromoter(kuaishouPromoter);
+        } catch (Exception e) {
+            e.printStackTrace();
+            JSONObject result = new JSONObject();
+            result.put("code", -1);
+            result.put("msg", "失败");
+            return result;
+        }
+    }
+
+    /**
+     * 新增达人跟进记录
+     */
+    @PostMapping(value = "/addFollowUpRecords")
+    @ApiOperation(value = "新增达人跟进记录")
+    public Result addFollowUpRecords(@RequestBody JSONObject result) {
+        try {
+            kuaishouPromoterService.addFollowUpRecords(result);
+            return Result.success();
+        } catch (Exception e) {
+            e.printStackTrace();
+            return Result.error("失败");
+        }
+    }
+
+    /**
+     * 新增达人跟进记录
+     */
+    @PostMapping(value = "/updateFollowUpRecords")
+    @ApiOperation(value = "修改达人跟进记录")
+    public Result updateFollowUpRecords(@RequestBody JSONObject result) {
+        try {
+            kuaishouPromoterService.updateFollowUpRecords(result);
+            return Result.success();
+        } catch (Exception e) {
+            e.printStackTrace();
+            return Result.error("失败");
+        }
     }
 
     /**
@@ -126,14 +164,22 @@ public class KuaishouPromoterController extends BaseController {
     }
 
     /**
+     * 修改快手达人标签信息
+     */
+    @PostMapping(value = "/updatePromoterLabel")
+    @ApiOperation(value = "修改快手达人标签")
+    public Result updatePromoterLabel(@RequestBody JSONObject result) {
+        return kuaishouPromoterService.updatePromoterLabel(result);
+    }
+
+    /**
      * 删除快手达人 信息
      */
     @GetMapping("/deleteById")
     @ApiOperation(value = "删除快手达人")
-    public AjaxResult deleteById(@ApiParam("主键") @RequestParam(value = "id", required = true) Long id,
-                                 @ApiParam("操作人ID") @RequestParam(value = "userId", required = true) Long userId
-    ) {
-        return toAjax(kuaishouPromoterService.deleteKuaishouPromoterById(id, userId));
+    public Result deleteById(@ApiParam("主键") @RequestParam(value = "id", required = true) Long id,
+                             @ApiParam("操作人ID") @RequestParam(value = "userId", required = true) Long userId) {
+        return kuaishouPromoterService.deleteKuaishouPromoterById(id, userId);
     }
 
 
@@ -156,4 +202,6 @@ public class KuaishouPromoterController extends BaseController {
         result.put("message", "fail");
         return result;
     }
+
+
 }

+ 44 - 0
ruixuan-live/src/main/java/com/ruixuan/isc/entity/KuaishouLabel.java

@@ -0,0 +1,44 @@
+package com.ruixuan.isc.entity;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * 快手标签对象 kuaishou_label
+ *
+ * @author ruoyi
+ * @date 2023-03-28
+ */
+@Data
+public class KuaishouLabel {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 标签id
+     */
+    private Long id;
+
+    /**
+     * 标签名
+     */
+    @ApiModelProperty(name = "标签名")
+    private String labelName;
+
+    /**
+     * 标签颜色
+     */
+    @ApiModelProperty(name = "标签颜色")
+    private String labelColour;
+
+    /**
+     * 标签类别
+     */
+    @ApiModelProperty(name = "标签类别")
+    private String labelType;
+
+    /**
+     * 标签级别
+     */
+    @ApiModelProperty(name = "标签级别")
+    private String labelLevel;
+}

+ 12 - 0
ruixuan-live/src/main/java/com/ruixuan/isc/entity/KuaishouPromoter.java

@@ -1,11 +1,13 @@
 package com.ruixuan.isc.entity;
 
+import com.alibaba.fastjson.JSONObject;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
 import java.util.Date;
+import java.util.List;
 
 /**
  * 快手达人 信息对象 kuaishou_promoter
@@ -128,6 +130,16 @@ public class KuaishouPromoter {
     @ApiModelProperty(name = "出单金额")
     private String validAmount;
 
+    /**
+     * 跟进记录
+     */
+    @ApiModelProperty(name = "跟进记录")
+    private String followUpRecord;
+
+    /**
+     * 标签集
+     */
+    private List<JSONObject> labels;
 
     /**
      * 更新时间

+ 2 - 0
ruixuan-live/src/main/java/com/ruixuan/isc/mapper/KuaishouItemCollectSamplesMapper.java

@@ -112,5 +112,7 @@ public interface KuaishouItemCollectSamplesMapper {
     List<JSONObject> queryProductList(Map<String, Object> map);
 
     void batchProcess(@Param("ids") JSONArray ids,@Param("status") Integer status);
+
+    List<KuaishouItemCollectSamples> getListByPromoterId(@Param("promoterId") Long promoterId);
 }
 

+ 66 - 0
ruixuan-live/src/main/java/com/ruixuan/isc/mapper/KuaishouLabelMapper.java

@@ -0,0 +1,66 @@
+package com.ruixuan.isc.mapper;
+
+import com.ruixuan.isc.entity.KuaishouLabel;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * 快手标签Mapper接口
+ *
+ * @author ruoyi
+ * @date 2023-03-28
+ */
+public interface KuaishouLabelMapper {
+    /**
+     * 查询快手标签
+     *
+     * @param id 快手标签主键
+     * @return 快手标签
+     */
+    public KuaishouLabel selectKuaishouLabelById(Long id);
+
+    /**
+     * 查询快手标签列表
+     *
+     * @param kuaishouLabel 快手标签
+     * @return 快手标签集合
+     */
+    public List<KuaishouLabel> selectKuaishouLabelList(KuaishouLabel kuaishouLabel);
+
+    /**
+     * 新增快手标签
+     *
+     * @param kuaishouLabel 快手标签
+     * @return 结果
+     */
+    public int insertKuaishouLabel(KuaishouLabel kuaishouLabel);
+
+    /**
+     * 修改快手标签
+     *
+     * @param kuaishouLabel 快手标签
+     * @return 结果
+     */
+    public int updateKuaishouLabel(KuaishouLabel kuaishouLabel);
+
+    /**
+     * 删除快手标签
+     *
+     * @param id 快手标签主键
+     * @return 结果
+     */
+    public int deleteKuaishouLabelById(Long id);
+
+    /**
+     * 批量删除快手标签
+     *
+     * @param ids 需要删除的数据主键集合
+     * @return 结果
+     */
+    public int deleteKuaishouLabelByIds(Long[] ids);
+
+    int updateLabelColourStatus(@Param("labelColour") String labelColour);
+
+    String getLabelColour();
+}

+ 17 - 1
ruixuan-live/src/main/java/com/ruixuan/isc/mapper/KuaishouPromoterMapper.java

@@ -68,9 +68,25 @@ public interface KuaishouPromoterMapper {
 
     void updateKuaishouPromoterByPromoterId(KuaishouPromoter promoters);
 
-    List<KuaishouPromoter> selectAllPromoterList(@Param("promoterId") Long promoterId, @Param("promoterNickName") String promoterNickName, @Param("parameter") String parameter, @Param("orderBy") String orderBy);
+    List<JSONObject> selectAllPromoterList(@Param("promoterId") Long promoterId, @Param("promoterNickName") String promoterNickName, @Param("status") String status, @Param("parameter") String parameter, @Param("orderBy") String orderBy);
 
     List<KuaishouPromoter> getFailInfo();
 
     List<JSONObject> getBoundPromoterRoleKey(@Param("promoterId") Long promoterId);
+
+    int addFollowUpRecords(@Param("result") JSONObject result);
+
+    void updateFollowUpRecords(@Param("result") JSONObject result);
+
+    JSONObject getFollowUpRecordsByUserId(@Param("promoterId") Long promoterId, @Param("userId") Long userId);
+
+    List<JSONObject> getFollowUpRecordListByPromoterId(@Param("promoterId") Long promoterId, @Param("id") Long id);
+
+    int deletePromoterLabel(@Param("promoterId") Long promoterId, @Param("userId") Long userId);
+
+    void insertPromoterLabels(@Param("list") List<JSONObject> list);
+
+    List<JSONObject> getPromoterLabel(@Param("promoterId") Long promoterId, @Param("userId") Long userId);
+
+
 }

+ 2 - 0
ruixuan-live/src/main/java/com/ruixuan/isc/service/IKuaishouItemCollectSamplesService.java

@@ -107,5 +107,7 @@ public interface IKuaishouItemCollectSamplesService {
     void batchProcess(JSONArray ids,Integer status);
 
     void batchAddLogs(List<KuaishouItemCollectSampleLog> logs);
+
+    List<KuaishouItemCollectSamples> getListByPromoterId(Long promoterId);
 }
 

+ 63 - 0
ruixuan-live/src/main/java/com/ruixuan/isc/service/IKuaishouLabelService.java

@@ -0,0 +1,63 @@
+package com.ruixuan.isc.service;
+
+
+import com.ruixuan.common.utils.Result;
+import com.ruixuan.isc.entity.KuaishouLabel;
+
+import java.util.List;
+
+/**
+ * 快手标签Service接口
+ *
+ * @author ruoyi
+ * @date 2023-03-28
+ */
+public interface IKuaishouLabelService {
+    /**
+     * 查询快手标签
+     *
+     * @param id 快手标签主键
+     * @return 快手标签
+     */
+    public KuaishouLabel selectKuaishouLabelById(Long id);
+
+    /**
+     * 查询快手标签列表
+     *
+     * @param kuaishouLabel 快手标签
+     * @return 快手标签集合
+     */
+    public List<KuaishouLabel> selectKuaishouLabelList(KuaishouLabel kuaishouLabel);
+
+    /**
+     * 新增快手标签
+     *
+     * @param kuaishouLabel 快手标签
+     * @return 结果
+     */
+    public Result insertKuaishouLabel(KuaishouLabel kuaishouLabel);
+
+    /**
+     * 修改快手标签
+     *
+     * @param kuaishouLabel 快手标签
+     * @return 结果
+     */
+    public int updateKuaishouLabel(KuaishouLabel kuaishouLabel);
+
+    /**
+     * 批量删除快手标签
+     *
+     * @param ids 需要删除的快手标签主键集合
+     * @return 结果
+     */
+    public int deleteKuaishouLabelByIds(Long[] ids);
+
+    /**
+     * 删除快手标签信息
+     *
+     * @param id 快手标签主键
+     * @return 结果
+     */
+    public int deleteKuaishouLabelById(Long id);
+}

+ 9 - 2
ruixuan-live/src/main/java/com/ruixuan/isc/service/IKuaishouPromoterService.java

@@ -2,6 +2,7 @@ package com.ruixuan.isc.service;
 
 import com.alibaba.fastjson.JSONObject;
 import com.ruixuan.common.core.domain.AjaxResult;
+import com.ruixuan.common.utils.Result;
 import com.ruixuan.isc.entity.KuaishouPromoter;
 
 import java.util.List;
@@ -51,7 +52,7 @@ public interface IKuaishouPromoterService {
      * @param id 快手达人 信息主键
      * @return 结果
      */
-    public int deleteKuaishouPromoterById(Long id, Long userId);
+    public Result deleteKuaishouPromoterById(Long id, Long userId);
 
     AjaxResult getPromoterInfo(Long promoterId);
 
@@ -61,7 +62,13 @@ public interface IKuaishouPromoterService {
 
     JSONObject getgetMonthPromoterTotal(List<Long> userList, String start, String end);
 
-    List<KuaishouPromoter> selectKuaishouPromoterList2(Long promoterId, String promoterNickName, String parameter, String orderBy);
+    List<JSONObject> selectKuaishouPromoterList2(Long promoterId, String promoterNickName,String status, String parameter, String orderBy);
 
     String supplementInfo();
+
+    int addFollowUpRecords(JSONObject result);
+
+    Result updatePromoterLabel(JSONObject result);
+
+    void updateFollowUpRecords(JSONObject result);
 }

+ 5 - 0
ruixuan-live/src/main/java/com/ruixuan/isc/service/impl/KuaishouItemCollectSamplesServiceImpl.java

@@ -655,6 +655,11 @@ public class KuaishouItemCollectSamplesServiceImpl implements IKuaishouItemColle
         kuaishouItemCollectSamplesMapper.batchAddLogs(logs);
     }
 
+    @Override
+    public List<KuaishouItemCollectSamples> getListByPromoterId(Long promoterId) {
+        return kuaishouItemCollectSamplesMapper.getListByPromoterId(promoterId);
+    }
+
     // 渠道—数据分析
     private JSONObject getDataAnalysisByChannel(List<Long> userList, String startDate, String endDate) {
         JSONObject data = new JSONObject();

+ 88 - 0
ruixuan-live/src/main/java/com/ruixuan/isc/service/impl/KuaishouLabelServiceImpl.java

@@ -0,0 +1,88 @@
+package com.ruixuan.isc.service.impl;
+
+import com.ruixuan.common.utils.Result;
+import com.ruixuan.isc.entity.KuaishouLabel;
+import com.ruixuan.isc.mapper.KuaishouLabelMapper;
+import com.ruixuan.isc.service.IKuaishouLabelService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * 快手标签Service业务层处理
+ *
+ * @author ruoyi
+ * @date 2023-03-28
+ */
+@Service
+public class KuaishouLabelServiceImpl implements IKuaishouLabelService {
+    @Autowired
+    private KuaishouLabelMapper kuaishouLabelMapper;
+
+    /**
+     * 查询快手标签
+     *
+     * @param id 快手标签主键
+     * @return 快手标签
+     */
+    @Override
+    public KuaishouLabel selectKuaishouLabelById(Long id) {
+        return kuaishouLabelMapper.selectKuaishouLabelById(id);
+    }
+
+    /**
+     * 查询快手标签列表
+     *
+     * @param kuaishouLabel 快手标签
+     * @return 快手标签
+     */
+    @Override
+    public List<KuaishouLabel> selectKuaishouLabelList(KuaishouLabel kuaishouLabel) {
+        return kuaishouLabelMapper.selectKuaishouLabelList(kuaishouLabel);
+    }
+
+    /**
+     * 新增快手标签
+     */
+    @Override
+    public Result insertKuaishouLabel(KuaishouLabel kuaishouLabel) {
+        String colour = kuaishouLabelMapper.getLabelColour();
+        kuaishouLabel.setLabelColour(colour);
+        int i = kuaishouLabelMapper.insertKuaishouLabel(kuaishouLabel);
+        if (i > 0) {
+             kuaishouLabelMapper.updateLabelColourStatus(colour);
+        }
+        return Result.success(kuaishouLabel);
+    }
+
+    /**
+     * 修改快手标签
+     */
+    @Override
+    public int updateKuaishouLabel(KuaishouLabel kuaishouLabel) {
+        return kuaishouLabelMapper.updateKuaishouLabel(kuaishouLabel);
+    }
+
+    /**
+     * 批量删除快手标签
+     *
+     * @param ids 需要删除的快手标签主键
+     * @return 结果
+     */
+    @Override
+    public int deleteKuaishouLabelByIds(Long[] ids) {
+        return kuaishouLabelMapper.deleteKuaishouLabelByIds(ids);
+    }
+
+    /**
+     * 删除快手标签信息
+     *
+     * @param id 快手标签主键
+     * @return 结果
+     */
+    @Override
+    public int deleteKuaishouLabelById(Long id) {
+        return kuaishouLabelMapper.deleteKuaishouLabelById(id);
+    }
+}

+ 83 - 6
ruixuan-live/src/main/java/com/ruixuan/isc/service/impl/KuaishouPromoterServiceImpl.java

@@ -1,5 +1,6 @@
 package com.ruixuan.isc.service.impl;
 
+import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.ruixuan.common.core.domain.AjaxResult;
 import com.ruixuan.common.core.domain.entity.SysUser;
@@ -7,9 +8,12 @@ import com.ruixuan.common.utils.Check;
 import com.ruixuan.common.utils.DateUtils;
 import com.ruixuan.common.utils.PageUtils;
 import com.ruixuan.common.utils.RedisUtil;
+import com.ruixuan.common.utils.Result;
 import com.ruixuan.common.utils.http.HttpUtil;
+import com.ruixuan.isc.entity.KuaishouItemCollectSamples;
 import com.ruixuan.isc.entity.KuaishouPromoter;
 import com.ruixuan.isc.mapper.KuaishouPromoterMapper;
+import com.ruixuan.isc.service.IKuaishouItemCollectSamplesService;
 import com.ruixuan.isc.service.IKuaishouPromoterService;
 import com.ruixuan.system.service.ISysDeptService;
 import com.ruixuan.system.service.ISysRoleService;
@@ -19,6 +23,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 
+import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.Date;
@@ -56,6 +61,9 @@ public class KuaishouPromoterServiceImpl implements IKuaishouPromoterService {
     @Autowired
     private RedisUtil redisUtil;
 
+    @Autowired
+    private IKuaishouItemCollectSamplesService kuaishouItemCollectSamplesService;
+
     /**
      * 查询快手达人 信息列表
      *
@@ -84,25 +92,43 @@ public class KuaishouPromoterServiceImpl implements IKuaishouPromoterService {
         }
         if (Check.isNull(parameter)) {
             parameter = "t1.create_time";
+        } else {
+            switch (parameter) {
+                case "avg_video_sales":
+                    parameter = "SUBSTRING_INDEX(t1.avg_video_sales,'-',-1)+0";
+                    break;
+                case "video_sales":
+                    parameter = "SUBSTRING_INDEX(t1.video_sales,'-',1)+0";
+                    break;
+                case "total_sale":
+                    parameter = "SUBSTRING_INDEX(t1.total_sale,'-',-1)+0";
+                    break;
+            }
         }
         if (Check.isNull(orderBy)) {
             orderBy = "desc";
         }
         PageUtils.startPage();
         List<KuaishouPromoter> list = kuaishouPromoterMapper.selectKuaishouPromoterList(userList, promoterId, promoterNickName, parameter, orderBy);
+        list.forEach(ent -> {
+            JSONObject follow = kuaishouPromoterMapper.getFollowUpRecordsByUserId(ent.getPromoterId(), ent.getUserId());
+            ent.setFollowUpRecord(Check.isNull(follow) ? "-" : follow.getString("txt"));
+            List<JSONObject> promoterLabelList = kuaishouPromoterMapper.getPromoterLabel(ent.getPromoterId(), ent.getUserId());
+            ent.setLabels(promoterLabelList);
+        });
         return list;
     }
 
     @Override
-    public List<KuaishouPromoter> selectKuaishouPromoterList2(Long promoterId, String promoterNickName, String parameter, String orderBy) {
+    public List<JSONObject> selectKuaishouPromoterList2(Long promoterId, String promoterNickName, String status, String parameter, String orderBy) {
         if (Check.isNull(parameter)) {
-            parameter = "t1.create_time";
+            parameter = "promoterId";
         }
         if (Check.isNull(orderBy)) {
             orderBy = "desc";
         }
         PageUtils.startPage();
-        List<KuaishouPromoter> list = kuaishouPromoterMapper.selectAllPromoterList(promoterId, promoterNickName, parameter, orderBy);
+        List<JSONObject> list = kuaishouPromoterMapper.selectAllPromoterList(promoterId, promoterNickName, status, parameter, orderBy);
         return list;
     }
 
@@ -137,6 +163,18 @@ public class KuaishouPromoterServiceImpl implements IKuaishouPromoterService {
                 log.info("获取达人详情数据,用时:{}s", (System.currentTimeMillis() - startTime) / 1000);
                 data.put("promoterInfo", promoter);
                 data.put("result", result);
+                //跟进记录
+                JSONObject followUpRecord = kuaishouPromoterMapper.getFollowUpRecordsByUserId(promoter.getPromoterId(), promoter.getUserId());
+                data.put("followUpRecord", followUpRecord);
+                Long followUpRecordId = null;
+                if (Check.isNotNull(followUpRecord)) {
+                    followUpRecordId = followUpRecord.getLong("id");
+                }
+                List<JSONObject> followUpRecordList = kuaishouPromoterMapper.getFollowUpRecordListByPromoterId(promoter.getPromoterId(), followUpRecordId);
+                data.put("historyFollowUpRecord", followUpRecordList);
+                //标签
+                List<JSONObject> promoterLabelList = kuaishouPromoterMapper.getPromoterLabel(promoter.getPromoterId(), promoter.getUserId());
+                data.put("promoterLabelList", promoterLabelList);
             }
         } catch (Exception e) {
             e.printStackTrace();
@@ -244,6 +282,38 @@ public class KuaishouPromoterServiceImpl implements IKuaishouPromoterService {
         return "共计" + list.size() + "条,数据补充中...";
     }
 
+    @Override
+    public int addFollowUpRecords(JSONObject result) {
+        return kuaishouPromoterMapper.addFollowUpRecords(result);
+    }
+
+    @Override
+    public void updateFollowUpRecords(JSONObject result) {
+        kuaishouPromoterMapper.updateFollowUpRecords(result);
+    }
+
+    @Override
+    public Result updatePromoterLabel(JSONObject result) {
+        Long promoterId = result.getLong("promoterId");
+        Long userId = result.getLong("userId");
+        kuaishouPromoterMapper.deletePromoterLabel(promoterId, userId);
+        JSONArray ids = result.getJSONArray("ids");
+        if (Check.isNotNull(ids)) {
+            List<JSONObject> list = new ArrayList<>();
+            for (int i = 0; i < ids.size(); i++) {
+                JSONObject obj = new JSONObject();
+                Long labelId = ids.getLong(i);
+                obj.put("promoterId", promoterId);
+                obj.put("labelId", labelId);
+                obj.put("userId", userId);
+                list.add(obj);
+            }
+            kuaishouPromoterMapper.insertPromoterLabels(list);
+        }
+        return Result.success();
+    }
+
+
     /**
      * 修改快手达人 信息
      *
@@ -258,12 +328,18 @@ public class KuaishouPromoterServiceImpl implements IKuaishouPromoterService {
     /**
      * 删除快手达人 信息信息
      *
-     * @param id 快手达人 信息主键
+     * @param id 快手达人 信息主键 follow_up_records
      * @return 结果
      */
     @Override
-    public int deleteKuaishouPromoterById(Long id, Long userId) {
+    public Result deleteKuaishouPromoterById(Long id, Long userId) {
         KuaishouPromoter promoter = kuaishouPromoterMapper.selectKuaishouPromoterById(id);
+        List<KuaishouItemCollectSamples> list = kuaishouItemCollectSamplesService.getListByPromoterId(promoter.getPromoterId());
+        for (KuaishouItemCollectSamples item : list) {
+            if (item.getCollectSampleStatus() != 2 && item.getCollectSampleStatus() != 7) {
+                return Result.error("该达人还有未完成的领样申请,请在完成后进行解绑!");
+            }
+        }
         if (Check.isNotNull(promoter)) {
             JSONObject record = new JSONObject();
             record.put("promoterId", promoter.getPromoterId());
@@ -271,7 +347,8 @@ public class KuaishouPromoterServiceImpl implements IKuaishouPromoterService {
             record.put("operatorId", userId);
             kuaishouPromoterMapper.insertKuaishouPromoterRecord(record);
         }
-        return kuaishouPromoterMapper.deleteKuaishouPromoterById(id);
+        kuaishouPromoterMapper.deleteKuaishouPromoterById(id);
+        return Result.success();
     }
 
     @Override

+ 5 - 0
ruixuan-live/src/main/resources/mapper/isc/KuaishouItemCollectSamplesMapper.xml

@@ -605,6 +605,11 @@
         </where>
     </select>
 
+    <select id="getListByPromoterId" resultMap="KuaishouItemCollectSamplesResult">
+        <include refid="selectKuaishouItemCollectSamplesVo"/>
+        where promoter_id = #{promoterId}
+    </select>
+
     <select id="queryProductList" resultType="com.alibaba.fastjson.JSONObject">
         SELECT * from (SELECT
         promoter_id as 'promoterId',

+ 88 - 0
ruixuan-live/src/main/resources/mapper/isc/KuaishouLabelMapper.xml

@@ -0,0 +1,88 @@
+<?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.isc.mapper.KuaishouLabelMapper">
+
+    <resultMap type="com.ruixuan.isc.entity.KuaishouLabel" id="KuaishouLabelResult">
+        <result property="id" column="id"/>
+        <result property="labelName" column="label_name"/>
+        <result property="labelColour" column="label_colour"/>
+        <result property="labelType" column="label_type"/>
+        <result property="labelLevel" column="label_level"/>
+    </resultMap>
+
+    <sql id="selectKuaishouLabelVo">
+        select id, label_name, label_colour, label_type, label_level
+        from kuaishou_label
+    </sql>
+
+    <select id="selectKuaishouLabelList" parameterType="com.ruixuan.isc.entity.KuaishouLabel"
+            resultMap="KuaishouLabelResult">
+        <include refid="selectKuaishouLabelVo"/>
+        <where>
+            <if test="labelName != null  and labelName != ''">and label_name like concat('%', #{labelName}, '%')</if>
+            <if test="labelColour != null  and labelColour != ''">and label_colour = #{labelColour}</if>
+            <if test="labelType != null  and labelType != ''">and label_type = #{labelType}</if>
+            <if test="labelLevel != null  and labelLevel != ''">and label_level = #{labelLevel}</if>
+        </where>
+    </select>
+
+    <select id="selectKuaishouLabelById" parameterType="Long" resultMap="KuaishouLabelResult">
+        <include refid="selectKuaishouLabelVo"/>
+        where id = #{id}
+    </select>
+
+    <insert id="insertKuaishouLabel" parameterType="com.ruixuan.isc.entity.KuaishouLabel" useGeneratedKeys="true"
+            keyProperty="id">
+        insert into kuaishou_label
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="labelName != null">label_name,</if>
+            <if test="labelColour != null">label_colour,</if>
+            <if test="labelType != null">label_type,</if>
+            <if test="labelLevel != null">label_level,</if>
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="labelName != null">#{labelName},</if>
+            <if test="labelColour != null">#{labelColour},</if>
+            <if test="labelType != null">#{labelType},</if>
+            <if test="labelLevel != null">#{labelLevel},</if>
+        </trim>
+    </insert>
+
+    <update id="updateKuaishouLabel" parameterType="com.ruixuan.isc.entity.KuaishouLabel">
+        update kuaishou_label
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="labelName != null">label_name = #{labelName},</if>
+            <if test="labelColour != null">label_colour = #{labelColour},</if>
+            <if test="labelType != null">label_type = #{labelType},</if>
+            <if test="labelLevel != null">label_level = #{labelLevel},</if>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <delete id="deleteKuaishouLabelById" parameterType="Long">
+        delete
+        from kuaishou_label
+        where id = #{id}
+    </delete>
+
+    <delete id="deleteKuaishouLabelByIds" parameterType="String">
+        delete from kuaishou_label where id in
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+
+    <update id="updateLabelColourStatus">
+        update kuaishou_label_colour
+        set colour_status = 0
+        where colour_code = #{labelColour}
+    </update>
+
+    <select id="getLabelColour" resultType="String">
+        select colour_code
+        from kuaishou_label_colour
+        where colour_status = 1 Limit 1
+    </select>
+</mapper>

+ 159 - 35
ruixuan-live/src/main/resources/mapper/isc/KuaishouPromoterMapper.xml

@@ -27,6 +27,7 @@
         <result property="monthDayGmv" column="30day_gmv"/>
         <result property="monthDayOrderNum" column="30day_order_num"/>
         <result property="validAmount" column="valid_amount"/>
+        <result property="followUpRecord" column="txt"/>
     </resultMap>
 
     <sql id="selectKuaishouPromoterVo">
@@ -94,39 +95,101 @@
         order by ${parameter} ${orderBy}
     </select>
 
-    <select id="selectAllPromoterList" resultMap="KuaishouPromoterResult">
-        SELECT
-        t1.id,
-        t1.user_id,
-        t1.user_name,
-        t1.promoter_id,
-        t1.promoter_nick_name,
-        t1.`state`,
-        t1.province,
-        t1.commission_requirement,
-        t1.category_requirement,
-        t1.promoter_url,
-        t1.phone,
-        t1.consignee,
-        t1.promoter_address,
-        t1.total_sale,
-        t1.fans_number,
-        t1.avg_video_sales,
-        t1.video_sales,
-        t1.create_time,
-        t2.30day_gmv,
-        t2.30day_order_num
-        FROM
-        kuaishou_promoter t1
-        LEFT JOIN promoter_oerder_amount t2 on t1.promoter_id = t2.promoter_id
-        where t2.30day_order_num > 0
-        <if test="promoterId != null ">
-            and t1.promoter_id = #{promoterId}
+    <select id="selectAllPromoterList" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT *
+        FROM (
+        <if test="status == null or status == '' ">
+            SELECT
+            t1.promoter_id as 'promoterId',
+            t1.promoter_nick_name as 'promoterNickName',
+            user_name as 'userName',
+            t1.commission_requirement as 'commissionRequirement',
+            t1.promoter_url as 'promoterUrl',
+            t1.fans_number as 'fansNumber',
+            t2.30day_gmv as 'monthDayGmv',
+            t2.30day_order_num as 'monthDayOrderNum',
+            t2.valid_amount as 'validAmount'
+            FROM
+            kuaishou_promoter t1
+            LEFT JOIN promoter_oerder_amount t2 ON t1.promoter_id = t2.promoter_id
+            <where>
+                <if test="promoterId != null ">
+                    and t1.promoter_id = #{promoterId}
+                </if>
+                <if test="promoterNickName != null  and promoterNickName != ''">
+                    and t1.promoter_nick_name like concat('%', #{promoterNickName}, '%')
+                </if>
+            </where>
+            UNION ALL
+            SELECT
+            t1.promoter_id as 'promoterId',
+            t1.promoter_name as 'promoterNickName',
+            '-' as 'userName',
+            '-' as 'commissionRequirement',
+            t1.handurl as 'promoterUrl',
+            t1.fans as 'fansNumber',
+            t2.30day_gmv as 'monthDayGmv',
+            t2.30day_order_num as 'monthDayOrderNum',
+            t2.valid_amount as 'validAmount'
+            FROM
+            promoter_info t1
+            LEFT JOIN promoter_oerder_amount t2 ON t1.promoter_id = t2.promoter_id
+            WHERE
+            NOT EXISTS ( SELECT 1 FROM kuaishou_promoter t3 WHERE t3.promoter_id = t1.promoter_id )
+            <if test="promoterId != null ">
+                and t1.promoter_id = #{promoterId}
+            </if>
+            <if test="promoterNickName != null  and promoterNickName != ''">
+                and t1.promoter_name like concat('%', #{promoterNickName}, '%')
+            </if>
+        </if>
+        <if test="status == 2 ">
+            SELECT
+            t1.promoter_id as 'promoterId',
+            t1.promoter_name as 'promoterNickName',
+            '-' as 'userName',
+            '-' as 'commissionRequirement',
+            t1.handurl as 'promoterUrl',
+            t1.fans as 'fansNumber',
+            t2.30day_gmv as 'monthDayGmv',
+            t2.30day_order_num as 'monthDayOrderNum',
+            t2.valid_amount as 'validAmount'
+            FROM
+            promoter_info t1
+            LEFT JOIN promoter_oerder_amount t2 ON t1.promoter_id = t2.promoter_id
+            WHERE NOT EXISTS
+            (SELECT 1 FROM kuaishou_promoter t3 WHERE t3.promoter_id = t1.promoter_id)
+            <if test="promoterId != null ">
+                and t1.promoter_id = #{promoterId}
+            </if>
+            <if test="promoterNickName != null  and promoterNickName != ''">
+                and t1.promoter_name like concat('%', #{promoterNickName}, '%')
+            </if>
         </if>
-        <if test="promoterNickName != null  and promoterNickName != ''">
-            and t1.promoter_nick_name like concat('%', #{promoterNickName}, '%')
+        <if test="status == 1">
+            SELECT
+            t1.promoter_id as 'promoterId',
+            t1.promoter_nick_name as 'promoterNickName',
+            user_name as 'userName',
+            t1.commission_requirement as 'commissionRequirement',
+            t1.promoter_url as 'promoterUrl',
+            t1.fans_number as 'fansNumber',
+            t2.30day_gmv as 'monthDayGmv',
+            t2.30day_order_num as 'monthDayOrderNum',
+            t2.valid_amount as 'validAmount'
+            FROM
+            kuaishou_promoter t1
+            LEFT JOIN promoter_oerder_amount t2 on t1.promoter_id = t2.promoter_id
+            <where>
+                <if test="promoterId != null ">
+                    and t1.promoter_id = #{promoterId}
+                </if>
+                <if test="promoterNickName != null  and promoterNickName != ''">
+                    and t1.promoter_nick_name like concat('%', #{promoterNickName}, '%')
+                </if>
+            </where>
         </if>
-        order by ${parameter} ${orderBy}
+        ) t order by ${parameter} ${orderBy}
     </select>
 
     <select id="selectKuaishouPromoterById" parameterType="Long" resultMap="KuaishouPromoterResult">
@@ -140,9 +203,9 @@
     </select>
 
     <select id="getBoundPromoterRoleKey" resultType="com.alibaba.fastjson.JSONObject">
-        SELECT 	t1.user_id,
-                  t3.role_key,
-                  t1.user_name
+        SELECT t1.user_id,
+               t3.role_key,
+               t1.user_name
         FROM kuaishou_promoter t1
                  LEFT JOIN sys_user_role t2 ON t1.user_id = t2.user_id
                  LEFT JOIN sys_role t3 ON t2.role_id = t3.role_id
@@ -225,7 +288,6 @@
             <if test="phone != null">phone,</if>
             <if test="consignee != null">consignee,</if>
             <if test="promoterAddress != null">promoter_address,</if>
-
         </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="userId != null">#{userId},</if>
@@ -247,6 +309,22 @@
         </trim>
     </insert>
 
+    <insert id="addFollowUpRecords">
+        insert into kuaishou_promoter_follow_up_record
+        (promoter_id,
+         user_id,
+         txt)
+        values (#{result.promoterId},
+                #{result.userId},
+                #{result.txt})
+    </insert>
+
+    <update id="updateFollowUpRecords">
+        update kuaishou_promoter_follow_up_record
+        Set txt =#{result.txt}
+        where id = #{result.id}
+    </update>
+
     <update id="updateKuaishouPromoter" parameterType="com.ruixuan.isc.entity.KuaishouPromoter">
         update kuaishou_promoter
         <trim prefix="SET" suffixOverrides=",">
@@ -310,6 +388,21 @@
         </foreach>
     </delete>
 
+    <delete id="deletePromoterLabel" parameterType="Long">
+        delete
+        from kuaishou_promoter_label_rel
+        where promoter_id = #{promoterId}
+          AND user_id = #{userId}
+    </delete>
+
+    <insert id="insertPromoterLabels">
+        insert into kuaishou_promoter_label_rel
+        (promoter_id,user_id, label_id)
+        values
+        <foreach collection="list" item="ent" separator=",">
+            (#{ent.promoterId},#{ent.userId}, #{ent.labelId})
+        </foreach>
+    </insert>
     <select id="getNearlyMonthGmv" resultType="com.alibaba.fastjson.JSONObject">
         SELECT SUM(order_amount) as 'orderAmount', CONCAT(IFNULL(ROUND((SELECT COUNT(1)
                                                                         FROM kuaishou_item_collect_samples
@@ -341,4 +434,35 @@
         </trim>
     </insert>
 
+    <select id="getFollowUpRecordsByUserId" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT id,
+               txt
+        FROM kuaishou_promoter_follow_up_record
+        Where promoter_id = #{promoterId}
+          AND user_id = #{userId}
+        ORDER BY update_time DESC LIMIT 1
+    </select>
+
+    <select id="getFollowUpRecordListByPromoterId" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT t1.id,
+        txt,
+        t2.nick_name as 'userName',
+        t1.update_time as 'updateTime'
+        FROM kuaishou_promoter_follow_up_record t1
+        LEFT JOIN sys_user t2 ON t1.user_id = t2.user_id
+        Where t1.promoter_id = #{promoterId}
+        <if test="id != null">
+            AND t1.id != #{id}
+        </if>
+        ORDER BY t1.update_time DESC
+    </select>
+
+    <select id="getPromoterLabel" resultType="com.alibaba.fastjson.JSONObject">
+        SELECT t2.id as 'labelId', t2.label_colour as 'labelColour', t2.label_name as 'labelName'
+        FROM kuaishou_promoter_label_rel t1
+                 LEFT JOIN kuaishou_label t2 ON t1.label_id = t2.id
+        WHERE t1.promoter_id = #{promoterId}
+          AND user_id = #{userId}
+        order by t2.id
+    </select>
 </mapper>