瀏覽代碼

Merge remote-tracking branch 'origin/master'

yumeng 1 年之前
父節點
當前提交
600c78e0de

+ 20 - 2
ruixuan-live/src/main/java/com/ruixuan/isc/controller/KuaishouPromoterController.java

@@ -6,7 +6,6 @@ import com.ruixuan.common.core.domain.AjaxResult;
 import com.ruixuan.common.core.page.TableDataInfo;
 import com.ruixuan.common.utils.Check;
 import com.ruixuan.common.utils.Result;
-import com.ruixuan.common.utils.spring.SpringUtils;
 import com.ruixuan.isc.entity.JYKuaishouPromoter;
 import com.ruixuan.isc.entity.KuaishouPromoter;
 import com.ruixuan.isc.service.IKuaishouPromoterService;
@@ -138,7 +137,7 @@ public class KuaishouPromoterController extends BaseController {
         if (Check.isNotNull(promoterId)) {
             promoterId = promoterId.trim();
         }
-        List<JYKuaishouPromoter> list = kuaishouPromoterService.selectKuaishouPromoterList3(userId, promoterId, promoterNickName, mediaId,type, parameter, orderBy);
+        List<JYKuaishouPromoter> list = kuaishouPromoterService.selectKuaishouPromoterList3(userId, promoterId, promoterNickName, mediaId, type, parameter, orderBy);
         return getDataTable(list);
     }
 
@@ -274,6 +273,15 @@ public class KuaishouPromoterController extends BaseController {
     }
 
     /**
+     * 修改骄阳达人 信息
+     */
+    @PostMapping(value = "/edit3")
+    @ApiOperation(value = "修改骄阳达人")
+    public AjaxResult edit3(@RequestBody JYKuaishouPromoter kuaishouPromoter) {
+        return toAjax(kuaishouPromoterService.updateKuaishouPromoter3(kuaishouPromoter));
+    }
+
+    /**
      * 修改快手达人标签信息
      */
     @PostMapping(value = "/updatePromoterLabel")
@@ -292,6 +300,16 @@ public class KuaishouPromoterController extends BaseController {
         return kuaishouPromoterService.deleteKuaishouPromoterById(id, userId);
     }
 
+    /**
+     * 删除骄阳达人 信息
+     */
+    @GetMapping("/deleteById3")
+    @ApiOperation(value = "删除骄阳达人")
+    public Result deleteById3(@ApiParam("主键") @RequestParam(value = "id", required = true) Long id,
+                              @ApiParam("操作人ID") @RequestParam(value = "userId", required = true) Long userId) {
+        return kuaishouPromoterService.deleteKuaishouPromoterById3(id, userId);
+    }
+
 
     /**
      * 读取图片文字信息

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

@@ -27,11 +27,11 @@ public interface KuaishouPromoterMapper {
                                                              @Param("mediaId") String mediaId,
                                                              @Param("parameter") String parameter, @Param("orderBy") String orderBy);
 
- public List<JYKuaishouPromoter> selectKuaishouPromoterList3(@Param("userList") List<Long> userList, @Param("promoterId") String promoterId,
-                                                             @Param("promoterNickName") String promoterNickName,
-                                                             @Param("mediaId") String mediaId,
-                                                             @Param("type") String type,
-                                                             @Param("parameter") String parameter, @Param("orderBy") String orderBy);
+    public List<JYKuaishouPromoter> selectKuaishouPromoterList3(@Param("userList") List<Long> userList, @Param("promoterId") String promoterId,
+                                                                @Param("promoterNickName") String promoterNickName,
+                                                                @Param("mediaId") String mediaId,
+                                                                @Param("type") String type,
+                                                                @Param("parameter") String parameter, @Param("orderBy") String orderBy);
 
     /**
      * 新增快手达人 信息
@@ -114,7 +114,15 @@ public interface KuaishouPromoterMapper {
 
     KuaishouPromoter getOneByIdAndPromoterId3(@Param("userId") Long userId, @Param("promoterId") String promoterId);
 
-   void insertKuaishouPromoter3(JYKuaishouPromoter promoter);
+    void insertKuaishouPromoter3(JYKuaishouPromoter promoter);
+
+    void updateKuaishouPromoterByPromoterId3(JYKuaishouPromoter kuaishouPromoter);
+
+    int updateKuaishouPromoter3(JYKuaishouPromoter kuaishouPromoter);
+
+    JYKuaishouPromoter selectKuaishouPromoterById3(Long id);
+
+    void deleteKuaishouPromoterById3(Long id);
 
-   void updateKuaishouPromoterByPromoterId3(JYKuaishouPromoter kuaishouPromoter);
+    List<JYKuaishouPromoter> getFailInfo3();
 }

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

@@ -31,7 +31,7 @@ public interface IKuaishouPromoterService {
      */
     public List<KuaishouPromoter> selectKuaishouPromoterList(Long userId, String promoterId, String promoterNickName, String mediaId, String parameter, String orderBy);
 
-    public List<JYKuaishouPromoter> selectKuaishouPromoterList3(Long userId, String promoterId, String promoterNickName, String mediaId,String type, String parameter, String orderBy);
+    public List<JYKuaishouPromoter> selectKuaishouPromoterList3(Long userId, String promoterId, String promoterNickName, String mediaId, String type, String parameter, String orderBy);
 
     /**
      * 新增快手达人 信息
@@ -88,4 +88,8 @@ public interface IKuaishouPromoterService {
     List<String> selectPromoterIdListByTime(List<Long> userList, Long startDate, Long endDate);
 
     JSONObject insertKuaishouPromoter3(JYKuaishouPromoter kuaishouPromoter);
+
+    int updateKuaishouPromoter3(JYKuaishouPromoter kuaishouPromoter);
+
+    Result deleteKuaishouPromoterById3(Long id, Long userId);
 }

+ 63 - 3
ruixuan-live/src/main/java/com/ruixuan/isc/service/impl/KuaishouPromoterServiceImpl.java

@@ -157,7 +157,7 @@ public class KuaishouPromoterServiceImpl implements IKuaishouPromoterService {
             orderBy = "desc";
         }
         PageUtils.startPage();
-        List<JYKuaishouPromoter> list = kuaishouPromoterMapper.selectKuaishouPromoterList3(userList, promoterId, promoterNickName, mediaId,type, parameter, orderBy);
+        List<JYKuaishouPromoter> list = kuaishouPromoterMapper.selectKuaishouPromoterList3(userList, promoterId, promoterNickName, mediaId, type, parameter, orderBy);
         list.forEach(ent -> {
             JSONObject follow = kuaishouPromoterMapper.getFollowUpRecordsByUserId(ent.getPromoterId(), ent.getUserId());
             ent.setFollowUpRecord(Check.isNull(follow) ? "-" : follow.getString("txt"));
@@ -303,7 +303,7 @@ public class KuaishouPromoterServiceImpl implements IKuaishouPromoterService {
         try {
             if (flag) {
                 /*缓存标记,每日第一次访问调用该接口,更新达人部分(昵称,省市,粉丝,总销售,头像等)数据*/
-                String key = DateUtils.getDate() + "_" + promoterId;
+                String key = DateUtils.getDate() + "_" + id + "_" + promoterId;
                 String value = (String) redisUtil.get(key);
                 if (Check.isNotNull(value) && "1".equals(value)) {
                     return;
@@ -370,7 +370,7 @@ public class KuaishouPromoterServiceImpl implements IKuaishouPromoterService {
         try {
             if (flag) {
                 /*缓存标记,每日第一次访问调用该接口,更新达人部分(昵称,省市,粉丝,总销售,头像等)数据*/
-                String key = DateUtils.getDate() + "_" + promoterId;
+                String key = DateUtils.getDate() + "_" + promoterId + "_" + id;
                 String value = (String) redisUtil.get(key);
                 if (Check.isNotNull(value) && "1".equals(value)) {
                     return;
@@ -452,9 +452,31 @@ public class KuaishouPromoterServiceImpl implements IKuaishouPromoterService {
         thread.start();
         List<String> promoters = new ArrayList<>();
         list.forEach(kuaishouPromoter -> promoters.add(kuaishouPromoter.getPromoterId() + "【" + kuaishouPromoter.getMediaId() + "】"));
+        String jyMsg = supplementInfo3();
+        promoters.add(jyMsg);
         return Result.success("共计" + list.size() + "条,数据补充中...", promoters);
     }
 
+    //骄阳补全
+    public String supplementInfo3() {
+        List<JYKuaishouPromoter> list = kuaishouPromoterMapper.getFailInfo3();
+        Thread thread = new Thread() {
+            @Override
+            public void run() {
+                try {
+                    list.forEach(kuaishouPromoter -> editPromoter3(kuaishouPromoter.getId(), kuaishouPromoter.getMediaId(), kuaishouPromoter.getPromoterId(), false));
+                } catch (Exception e) {
+                    e.printStackTrace();
+                }
+            }
+        };
+        thread.start();
+        List<String> promoters = new ArrayList<>();
+        list.forEach(kuaishouPromoter -> promoters.add(kuaishouPromoter.getPromoterId()));
+        return "-------------骄阳共计" + list.size() + "条,达人IDS: " + promoters.toString();
+    }
+
+
     @Override
     public int addFollowUpRecords(JSONObject result) {
         return kuaishouPromoterMapper.addFollowUpRecords(result);
@@ -542,6 +564,17 @@ public class KuaishouPromoterServiceImpl implements IKuaishouPromoterService {
     }
 
     /**
+     * 修改快手达人 信息
+     *
+     * @param kuaishouPromoter 快手达人 信息
+     * @return 结果
+     */
+    @Override
+    public int updateKuaishouPromoter3(JYKuaishouPromoter kuaishouPromoter) {
+        return kuaishouPromoterMapper.updateKuaishouPromoter3(kuaishouPromoter);
+    }
+
+    /**
      * 删除快手达人 信息信息
      *
      * @param id 快手达人 信息主键 follow_up_records
@@ -573,6 +606,33 @@ public class KuaishouPromoterServiceImpl implements IKuaishouPromoterService {
         return Result.success();
     }
 
+    /**
+     * 删除快手达人 信息信息
+     *
+     * @param id 快手达人 信息主键 follow_up_records
+     * @return 结果
+     */
+    @Override
+    public Result deleteKuaishouPromoterById3(Long id, Long userId) {
+        JYKuaishouPromoter promoter = kuaishouPromoterMapper.selectKuaishouPromoterById3(id);
+
+        if (Check.isNotNull(promoter)) {
+            JSONObject record = new JSONObject();
+            record.put("promoterId", promoter.getPromoterId());
+            record.put("userId", promoter.getUserId());
+            record.put("operatorId", userId);
+            List<JSONObject> roles = sysUserService.getUserRoleByUserId(userId);
+            if (Check.isNotNull(roles)) {
+                record.put("roleName", roles.get(0).getString("role_name") + " (解绑骄阳)");
+                record.put("roleKey", roles.get(0).getString("role_key"));
+            }
+
+            kuaishouPromoterMapper.insertKuaishouPromoterRecord(record);
+        }
+        kuaishouPromoterMapper.deleteKuaishouPromoterById3(id);
+        return Result.success();
+    }
+
     @Override
     public AjaxResult getPromoterInfo(String promoterId) {
         AjaxResult ajaxResult = null;

+ 104 - 6
ruixuan-live/src/main/resources/mapper/isc/KuaishouPromoterMapper.xml

@@ -274,12 +274,64 @@
         where id = #{id}
     </select>
 
+    <select id="selectKuaishouPromoterById3" parameterType="Long" resultType="com.ruixuan.isc.entity.JYKuaishouPromoter">
+        select id,
+               media_id,
+               user_id,
+               user_name,
+               promoter_id,
+               promoter_nick_name,
+               `state`,
+               province,
+               commission_requirement,
+               category_requirement,
+               promoter_url,
+               phone,
+               consignee,
+               promoter_address,
+               total_sale,
+               fans_number,
+               avg_video_sales,
+               video_sales,
+               create_time,
+               update_time
+        from jy_kuaishou_promoter
+        where id = #{id}
+    </select>
+
     <select id="getFailInfo" resultMap="KuaishouPromoterResult">
         <include refid="selectKuaishouPromoterVo"/>
         where (promoter_nick_name = '' or promoter_nick_name is null)
         AND state =1
     </select>
 
+
+    <select id="getFailInfo3" resultType="com.ruixuan.isc.entity.JYKuaishouPromoter">
+        select id,
+               media_id,
+               user_id,
+               user_name,
+               promoter_id,
+               promoter_nick_name,
+               `state`,
+               province,
+               commission_requirement,
+               category_requirement,
+               promoter_url,
+               phone,
+               consignee,
+               promoter_address,
+               total_sale,
+               fans_number,
+               avg_video_sales,
+               video_sales,
+               create_time,
+               update_time
+        from jy_kuaishou_promoter
+        where (promoter_nick_name = '' or promoter_nick_name is null)
+          AND state = 1
+    </select>
+
     <select id="getBoundPromoterRoleKey" resultType="com.alibaba.fastjson.JSONObject">
         SELECT t1.user_id,
                t3.role_key,
@@ -330,7 +382,7 @@
         limit 1
     </select>
 
-    <select id="getOneByIdAndPromoterId3" resultMap="KuaishouPromoterResult">
+    <select id="getOneByIdAndPromoterId3" resultType="com.ruixuan.isc.entity.JYKuaishouPromoter">
         select
         id,
         media_id,
@@ -440,7 +492,7 @@
     </insert>
 
 
-    <insert id="insertKuaishouPromoter3" parameterType="com.ruixuan.isc.entity.KuaishouPromoter" useGeneratedKeys="true"
+    <insert id="insertKuaishouPromoter3" parameterType="com.ruixuan.isc.entity.JYKuaishouPromoter" useGeneratedKeys="true"
             keyProperty="id">
         insert into jy_kuaishou_promoter
         <trim prefix="(" suffix=")" suffixOverrides=",">
@@ -527,6 +579,33 @@
         where id = #{id}
     </update>
 
+    <update id="updateKuaishouPromoter3" parameterType="com.ruixuan.isc.entity.JYKuaishouPromoter">
+        update jy_kuaishou_promoter
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="userId != null">user_id = #{userId},</if>
+            <if test="mediaId != null">media_id = #{mediaId},</if>
+            <if test="type != null">type = #{type},</if>
+            <if test="userName != null">user_name = #{userName},</if>
+            <if test="promoterId != null">promoter_id = #{promoterId},</if>
+            <if test="promoterNickName != null">promoter_nick_name = #{promoterNickName},</if>
+            <if test="totalSale != null">total_sale = #{totalSale},</if>
+            <if test="fansNumber != null">fans_number = #{fansNumber},</if>
+            <if test="promoterUrl != null">promoter_url = #{promoterUrl},</if>
+            <if test="phone != null">phone = #{phone},</if>
+            <if test="consignee != null">consignee = #{consignee},</if>
+            <if test="promoterAddress != null">promoter_address = #{promoterAddress},</if>
+            <if test="state != null">state = #{state},</if>
+            <if test="province != null">province = #{province},</if>
+            <if test="commissionRequirement != null">commission_requirement = #{commissionRequirement},</if>
+            <if test="categoryRequirement != null">category_requirement = #{categoryRequirement},</if>
+            <if test="avgVideoSales != null">avg_video_sales = #{avgVideoSales},</if>
+            <if test="videoSales != null">video_sales = #{videoSales},</if>
+            <if test="createTime != null">create_time = #{createTime},</if>
+            <if test="updateTime != null">update_time = #{updateTime},</if>
+        </trim>
+        where id = #{id}
+    </update>
+
     <update id="updateKuaishouPromoterByPromoterId" parameterType="com.ruixuan.isc.entity.KuaishouPromoter">
         update kuaishou_promoter
         <trim prefix="SET" suffixOverrides=",">
@@ -558,7 +637,7 @@
         where promoter_id = #{promoterId}
     </update>
 
-    <update id="updateKuaishouPromoterByPromoterId3" parameterType="com.ruixuan.isc.entity.KuaishouPromoter">
+    <update id="updateKuaishouPromoterByPromoterId3" parameterType="com.ruixuan.isc.entity.JYKuaishouPromoter">
         update jy_kuaishou_promoter
         <trim prefix="SET" suffixOverrides=",">
             <if test="userId != null">user_id = #{userId},</if>
@@ -596,6 +675,12 @@
         where id = #{id}
     </delete>
 
+    <delete id="deleteKuaishouPromoterById3" parameterType="Long">
+        delete
+        from jy_kuaishou_promoter
+        where id = #{id}
+    </delete>
+
     <delete id="deleteKuaishouPromoterByIds" parameterType="String">
         delete from kuaishou_promoter where id in
         <foreach item="id" collection="array" open="(" separator="," close=")">
@@ -707,7 +792,9 @@
         WHERE user_id = #{userId}
     </select>
     <select id="getRuleName" resultType="java.lang.String" parameterType="java.lang.Long">
-        select rule_name  from  kuaishou_settlement_rules where id = #{ruleId}
+        select rule_name
+        from kuaishou_settlement_rules
+        where id = #{ruleId}
     </select>
 
 
@@ -723,10 +810,21 @@
         )
     </insert>
     <insert id="addRule">
-        replace into
+        replace
+        into
          promoter_bind_rule(promoter_id,rule_id,rule_name,create_time,update_time)
           values
-        (#{promoterId},#{ruleId},#{ruleName},now(),now())
+        (
+        #{promoterId},
+        #{ruleId},
+        #{ruleName},
+        now
+        (
+        ),
+        now
+        (
+        )
+        )
 
     </insert>
 </mapper>