فهرست منبع

渠道添加 设置绑定达人上限功能

zhaoxian 2 سال پیش
والد
کامیت
7a52943ca3

+ 17 - 0
ruixuan-live/src/main/java/com/ruixuan/isc/controller/KuaishouPromoterController.java

@@ -125,6 +125,23 @@ public class KuaishouPromoterController extends BaseController {
     }
 
     /**
+     * 新增 设置渠道绑定达人数
+     */
+    @GetMapping(value = "/addPromotersCount")
+    @ApiOperation(value = "新增设置渠道绑定达人数")
+    public JSONObject addPromotersCount(Long userId, Long promotersCount) {
+        try {
+            return kuaishouPromoterService.addPromotersCount(userId, promotersCount);
+        } catch (Exception e) {
+            e.printStackTrace();
+            JSONObject result = new JSONObject();
+            result.put("code", -1);
+            result.put("msg", "失败");
+            return result;
+        }
+    }
+
+    /**
      * 新增达人跟进记录
      */
     @PostMapping(value = "/addFollowUpRecords")

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

@@ -89,5 +89,11 @@ public interface KuaishouPromoterMapper {
     List<JSONObject> getPromoterLabel(@Param("promoterId") Long promoterId, @Param("userId") Long userId);
 
 
-    KuaishouPromoter getOnlyPromoterInfoByUserId(@Param("promoterId") Long promoterId,@Param("userId") Long userId);
+    KuaishouPromoter getOnlyPromoterInfoByUserId(@Param("promoterId") Long promoterId, @Param("userId") Long userId);
+
+    Integer getUserPromotersCount(@Param("userId") Long userId);
+
+    Integer getBoundCount(@Param("userId") Long userId);
+
+    Integer addPromotersCount(@Param("userId") Long userId, @Param("promotersCount") Long promotersCount);
 }

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

@@ -62,7 +62,7 @@ public interface IKuaishouPromoterService {
 
     JSONObject getgetMonthPromoterTotal(List<Long> userList, String start, String end);
 
-    List<JSONObject> selectKuaishouPromoterList2(Long promoterId, String promoterNickName,String status, String parameter, String orderBy);
+    List<JSONObject> selectKuaishouPromoterList2(Long promoterId, String promoterNickName, String status, String parameter, String orderBy);
 
     Result supplementInfo();
 
@@ -75,4 +75,6 @@ public interface IKuaishouPromoterService {
     Result getGongHaiVideoSales(Long promoterId);
 
     KuaishouPromoter getOnlyPromoterInfoByUserId(Long promoterId, Long userId);
+
+    JSONObject addPromotersCount(Long userId, Long promotersCount);
 }

+ 21 - 1
ruixuan-live/src/main/java/com/ruixuan/isc/service/impl/KuaishouPromoterServiceImpl.java

@@ -216,6 +216,17 @@ public class KuaishouPromoterServiceImpl implements IKuaishouPromoterService {
                 }
             }
         }
+        //查询 设置可绑定达人数
+        Integer count = kuaishouPromoterMapper.getUserPromotersCount(promoter.getUserId());
+        if (Check.isNotNull(count)) {
+            //查询 已绑定达人数
+            Integer hCount = kuaishouPromoterMapper.getBoundCount(promoter.getUserId());
+            if (Check.isNotNull(hCount) && hCount >= count) {
+                result.put("code", 500);
+                result.put("msg", "绑定达人数过多,暂无法绑定!");
+                return result;
+            }
+        }
         SysUser sysUser = sysUserService.selectUserById(promoter.getUserId());
         if (Check.isNotNull(sysUser)) {
             promoter.setUserName(sysUser.getNickName());
@@ -320,6 +331,15 @@ public class KuaishouPromoterServiceImpl implements IKuaishouPromoterService {
     }
 
     @Override
+    public JSONObject addPromotersCount(Long userId, Long promotersCount) {
+        kuaishouPromoterMapper.addPromotersCount(userId, promotersCount);
+        JSONObject result = new JSONObject();
+        result.put("code", 200);
+        result.put("msg", "success");
+        return result;
+    }
+
+    @Override
     public Result updatePromoterLabel(JSONObject result) {
         Long promoterId = result.getLong("promoterId");
         Long userId = result.getLong("userId");
@@ -361,7 +381,7 @@ public class KuaishouPromoterServiceImpl implements IKuaishouPromoterService {
     @Override
     public Result deleteKuaishouPromoterById(Long id, Long userId) {
         KuaishouPromoter promoter = kuaishouPromoterMapper.selectKuaishouPromoterById(id);
-        List<KuaishouItemCollectSamples> list = kuaishouItemCollectSamplesService.getListByPromoterId(promoter.getPromoterId(),userId);
+        List<KuaishouItemCollectSamples> list = kuaishouItemCollectSamplesService.getListByPromoterId(promoter.getPromoterId(), userId);
         for (KuaishouItemCollectSamples item : list) {
             if (item.getCollectSampleStatus() != 2 && item.getCollectSampleStatus() != 7) {
                 return Result.error("该达人还有未完成的领样申请,请在完成后进行解绑!");

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

@@ -417,6 +417,7 @@
           AND user_id = #{userId}
         order by t2.id
     </select>
+
     <select id="getOnlyPromoterInfoByUserId" resultType="com.ruixuan.isc.entity.KuaishouPromoter">
         <include refid="selectKuaishouPromoterVo"/>
         where promoter_id = #{promoterId}
@@ -425,4 +426,28 @@
         </if>
         limit 1
     </select>
+
+    <select id="getUserPromotersCount" resultType="java.lang.Integer">
+        select promoters_count
+        from user_promoters_count
+        where user_id = #{userId}
+    </select>
+
+    <select id="getBoundCount" resultType="java.lang.Integer">
+        SELECT COUNT(1)
+        FROM `kuaishou_promoter`
+        WHERE user_id = #{userId}
+    </select>
+
+
+    <insert id="addPromotersCount">
+        replace
+        into user_promoters_count
+        (user_id, promoters_count)
+        values
+        (
+        #{userId},
+        #{promotersCount}
+        )
+    </insert>
 </mapper>

+ 7 - 1
ruixuan-live/src/main/resources/mapper/isc/SupplyChainMapper.xml

@@ -1306,7 +1306,8 @@
         t1.voucherValidOrderNum,
         t1.voucherOrderAmount,
         t1.voucherRegimentalPromotionAmount,
-        t1.voucherTotalRegimentalSettleAmount
+        t1.voucherTotalRegimentalSettleAmount,
+        IFNULL(t5.promoters_count,'-') as 'promoters_count'
         from (
         select collect_sample_id as 'collectSampleId',
         collect_sample_name as 'collectSampleName',
@@ -1368,6 +1369,11 @@
         group by collect_sample_id
         ) t4
         on t1.collectSampleId = t4.collectSampleId
+        left join (
+        select user_id,promoters_count
+        from user_promoters_count
+        ) t5
+        on t1.collectSampleId = t5.user_id
         order by t1.orderNum desc
     </select>
     <select id="bdDetailList" resultType="com.alibaba.fastjson.JSONObject">