Procházet zdrojové kódy

Merge remote-tracking branch 'origin/master'

yumeng před 4 roky
rodič
revize
915555b14b

+ 31 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/controller/UserAllocationController.java

@@ -16,6 +16,7 @@ import cn.com.ctop.kuaishou.modules.batch.service.IKuaishouInterfaceService;
 import cn.com.ctop.toutiao.modules.material.service.IByteDanceAdvertiserDataService;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import io.swagger.annotations.Api;
@@ -476,4 +477,34 @@ public class UserAllocationController {
         return result;
     }
 
+    /**
+     *  账户绑定是否开启删评论开关
+     */
+    @PostMapping(value = "/onOrOffDeleteComment")
+    public Result<Object> onOrOffMonitoringLink(@RequestParam Long accountId, @RequestParam Integer switchType){
+        Result<Object> result=new Result<>();
+        UserAllocation userAllocation=new UserAllocation();
+        userAllocation.setAccountId(accountId);
+        UpdateWrapper<UserAllocation> wrapper=new UpdateWrapper<>();
+        //开启删评论
+        if(switchType==0){
+            wrapper.set("delete_comment",0);
+            wrapper.setEntity(userAllocation);
+            boolean update = userAllocationService.update(wrapper);
+            if(update){
+                result.success("删评论开启成功");
+            }
+        }else if(switchType==1){
+            wrapper.set("delete_comment",1);
+            wrapper.setEntity(userAllocation);
+            boolean update = userAllocationService.update(wrapper);
+            if(update){
+                result.success("删评论关闭成功");
+            }
+        }else {
+            result.error500("未知操作");
+        }
+        return result;
+    }
+
 }

+ 7 - 0
module-common/src/main/java/cn/com/ctop/common/module/entity/UserAllocation.java

@@ -126,6 +126,13 @@ public class UserAllocation implements Serializable {
     private Integer landingPage;
 
     /**
+     * 是否开启删评论
+     * 0 启动
+     * 1 禁用
+     */
+    private Integer deleteComment;
+
+    /**
      * 修改时间
      */
     @Excel(name = "修改时间", width = 20, format = "yyyy-MM-dd HH:mm:ss")

+ 2 - 0
module-common/src/main/java/cn/com/ctop/common/module/mapper/UserAllocationMapper.java

@@ -31,4 +31,6 @@ public interface UserAllocationMapper extends BaseMapper<UserAllocation> {
     UserAllocation getUserAllocation(@Param("accountId") Long accountId);
 
     JSONObject getSwitchStatusByAccount(@Param("accountId") Long accountId);
+
+    List<Long>  queryAccountsByDeleteComment();
 }

+ 11 - 0
module-common/src/main/java/cn/com/ctop/common/module/mapper/xml/UserAllocationMapper.xml

@@ -85,5 +85,16 @@
             account_id = #{accountId}
     </select>
 
+    <select id="queryAccountsByDeleteComment" resultType="java.lang.Long">
+        SELECT
+            account_id
+        FROM
+            ctop_user_allocation
+        WHERE
+            media_id = 2
+          AND account_status = 0
+          AND delete_comment = 0
+    </select>
+
 
 </mapper>

+ 2 - 0
module-common/src/main/java/cn/com/ctop/common/module/service/IUserAllocationService.java

@@ -36,4 +36,6 @@ public interface IUserAllocationService extends IService<UserAllocation> {
     List<UserAllocation> getUserAllocations(String mediaId ,int switchType);
 
     JSONObject getSwitchStatusByAccount(Long accountId);
+
+    List<Long> getAccountsByDeleteComment();
 }

+ 5 - 0
module-common/src/main/java/cn/com/ctop/common/module/service/impl/UserAllocationServiceImpl.java

@@ -134,4 +134,9 @@ public class UserAllocationServiceImpl extends ServiceImpl<UserAllocationMapper,
     public JSONObject getSwitchStatusByAccount(Long accountId) {
         return userAllocationMapper.getSwitchStatusByAccount(accountId);
     }
+
+    @Override
+    public List<Long> getAccountsByDeleteComment() {
+        return userAllocationMapper.queryAccountsByDeleteComment();
+    }
 }

+ 53 - 0
module-job-kuaishou/src/main/java/cn/com/ctop/job/kuaishou/handler/KuaiShouDeleteCommentJob.java

@@ -0,0 +1,53 @@
+package cn.com.ctop.job.kuaishou.handler;
+
+import cn.com.ctop.common.module.service.IUserAllocationService;
+import cn.com.ctop.kuaishou.modules.batch.service.IKuaiShouCommentService;
+import com.xxl.job.core.context.XxlJobHelper;
+import com.xxl.job.core.handler.annotation.XxlJob;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import java.util.List;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+@Component
+public class KuaiShouDeleteCommentJob {
+
+    @Autowired
+    private IUserAllocationService allocationService;
+
+    @Autowired
+    private IKuaiShouCommentService kuaiShouCommentService;
+
+    static ExecutorService executorService = Executors.newFixedThreadPool(10);
+
+    static CountDownLatch countDownLatch = null;
+
+    @XxlJob("kuaiShouDeleteCommentJob")
+    public void kuaiShouDeleteComment(){
+        Long start = System.currentTimeMillis();
+        //查询需要删除的账户
+        List<Long> accountIds = allocationService.getAccountsByDeleteComment();
+        if (!accountIds.isEmpty()) {
+            countDownLatch = new CountDownLatch(accountIds.size());
+            accountIds.forEach(accountId -> executorService.submit(() -> {
+                try {
+                    kuaiShouCommentService.shieldComment(accountId);
+                } catch (Exception e) {
+                    XxlJobHelper.log(e.getMessage(), e);
+                } finally {
+                    countDownLatch.countDown();
+                }
+            }));
+            try {
+                countDownLatch.await();
+            } catch (InterruptedException e) {
+                e.printStackTrace();
+            }
+            Long end = System.currentTimeMillis();
+            XxlJobHelper.log("快手删评论所用时长:{}毫秒", end - start);
+        }
+    }
+}

+ 1 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/report/service/impl/RuleKuaiShouPlanServiceImpl.java

@@ -169,6 +169,7 @@ public class RuleKuaiShouPlanServiceImpl implements IRuleKuaiShouPlanService {
                 unit.setUnitId(unitDetail.getLong("unit_id"));
                 unit.setUnitName(unitDetail.getString("unit_name"));
                 unit.setCharge(unitDetail.getBigDecimal("charge"));
+                //未知优化目标数据存空
                 if(group.getOcpxActionType()!=0){
                     unit.setConvertNum(handleConvertNum(group.getOcpxActionType(),unitDetail));
                     if(unit.getConvertNum()!=0){