Browse Source

查询达人详情

zhaoxian 2 years ago
parent
commit
f2245622c3

+ 16 - 8
ruixuan-live/src/main/java/com/ruixuan/isc/controller/KuaishouPromoterController.java

@@ -1,6 +1,5 @@
 package com.ruixuan.isc.controller;
 
-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;
@@ -10,9 +9,7 @@ import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.DeleteMapping;
 import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -60,13 +57,22 @@ public class KuaishouPromoterController extends BaseController {
      * 获取快手达人信息
      */
     @GetMapping(value = "/getPromoterInfo")
-    @ApiOperation(value = "获取快手达人信息")
+    @ApiOperation(value = "获取快手达人短视频信息")
     public AjaxResult getPromoterInfo(@ApiParam("达人ID") @RequestParam(value = "promoterId", required = true) Long promoterId) {
         return kuaishouPromoterService.getPromoterInfo(promoterId);
     }
 
 
     /**
+     * 获取快手达人信息
+     */
+    @GetMapping(value = "/getOnlyPromoterInfo")
+    @ApiOperation(value = "只获取达人信息")
+    public AjaxResult getOnlyPromoterInfo(@ApiParam("达人ID") @RequestParam(value = "promoterId", required = true) Long promoterId) {
+        return AjaxResult.success(kuaishouPromoterService.getOnlyPromoterInfo(promoterId));
+    }
+
+    /**
      * 新增快手达人 信息
      */
     @PostMapping(value = "/add")
@@ -87,9 +93,11 @@ public class KuaishouPromoterController extends BaseController {
     /**
      * 删除快手达人 信息
      */
-    @DeleteMapping("/{ids}")
-//    @ApiOperation(value = "删除快手达人")
-    public AjaxResult remove(@PathVariable Long[] ids) {
-        return toAjax(kuaishouPromoterService.deleteKuaishouPromoterByIds(ids));
+    @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));
     }
 }

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

@@ -58,4 +58,6 @@ public interface KuaishouPromoterMapper {
     KuaishouPromoter getOneByIdAndPromoterId(@Param("userId") Long userId, @Param("promoterId") Long promoterId);
 
     JSONObject getNearlyMonthGmv(@Param("promoterId") Long promoterId, @Param("start") String start, @Param("end") String end);
+
+    void insertKuaishouPromoterRecord(JSONObject record);
 }

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

@@ -46,20 +46,14 @@ public interface IKuaishouPromoterService {
     public int updateKuaishouPromoter(KuaishouPromoter kuaishouPromoter);
 
     /**
-     * 批量删除快手达人 信息
-     *
-     * @param ids 需要删除的快手达人 信息主键集合
-     * @return 结果
-     */
-    public int deleteKuaishouPromoterByIds(Long[] ids);
-
-    /**
      * 删除快手达人 信息信息
      *
      * @param id 快手达人 信息主键
      * @return 结果
      */
-    public int deleteKuaishouPromoterById(Long id);
+    public int deleteKuaishouPromoterById(Long id, Long userId);
 
     AjaxResult getPromoterInfo(Long promoterId);
+
+    KuaishouPromoter getOnlyPromoterInfo(Long promoterId);
 }

+ 14 - 12
ruixuan-live/src/main/java/com/ruixuan/isc/service/impl/KuaishouPromoterServiceImpl.java

@@ -19,6 +19,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;
@@ -196,24 +197,21 @@ public class KuaishouPromoterServiceImpl implements IKuaishouPromoterService {
     }
 
     /**
-     * 批量删除快手达人 信息
-     *
-     * @param ids 需要删除的快手达人 信息主键
-     * @return 结果
-     */
-    @Override
-    public int deleteKuaishouPromoterByIds(Long[] ids) {
-        return kuaishouPromoterMapper.deleteKuaishouPromoterByIds(ids);
-    }
-
-    /**
      * 删除快手达人 信息信息
      *
      * @param id 快手达人 信息主键
      * @return 结果
      */
     @Override
-    public int deleteKuaishouPromoterById(Long id) {
+    public int deleteKuaishouPromoterById(Long id, Long userId) {
+        KuaishouPromoter promoter = kuaishouPromoterMapper.selectKuaishouPromoterById(id);
+        if (Check.isNotNull(promoter)) {
+            JSONObject record = new JSONObject();
+            record.put("promoterId", promoter.getPromoterId());
+            record.put("userId", promoter.getUserId());
+            record.put("operatorId", userId);
+            kuaishouPromoterMapper.insertKuaishouPromoterRecord(record);
+        }
         return kuaishouPromoterMapper.deleteKuaishouPromoterById(id);
     }
 
@@ -264,4 +262,8 @@ public class KuaishouPromoterServiceImpl implements IKuaishouPromoterService {
         return ajaxResult;
     }
 
+    @Override
+    public KuaishouPromoter getOnlyPromoterInfo(Long promoterId) {
+            return kuaishouPromoterMapper.getOneByIdAndPromoterId(null, promoterId);
+    }
 }

+ 17 - 0
ruixuan-live/src/main/resources/mapper/isc/KuaishouPromoterMapper.xml

@@ -170,4 +170,21 @@
           AND FROM_UNIXTIME(order_create_time / 1000, '%Y-%m-%d') >= #{start}
           AND FROM_UNIXTIME(order_create_time / 1000, '%Y-%m-%d') <= #{end}
     </select>
+
+
+    <insert id="insertKuaishouPromoterRecord" parameterType="com.alibaba.fastjson.JSONObject" useGeneratedKeys="true"
+            keyProperty="id">
+        insert into kuaishou_promoter_record
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="promoterId != null">promoter_id,</if>
+            <if test="userId != null">user_id,</if>
+            <if test="operatorId != null">operator_id,</if>
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="promoterId != null">#{promoterId},</if>
+            <if test="userId != null">#{userId},</if>
+            <if test="operatorId != null">#{operatorId},</if>
+        </trim>
+    </insert>
+
 </mapper>

+ 1 - 1
ruixuan-system/src/main/resources/mapper/system/SysUserMapper.xml

@@ -376,7 +376,7 @@
         WHERE r.del_flag = 0
           AND u.del_flag = 0
           AND u.STATUS = 0
-          and r.role_key = #{roleKey}
+          and r.role_key like concat('%', #{roleKey}, '%')
     </select>
 
 </mapper>