Pārlūkot izejas kodu

Merge remote-tracking branch 'origin/test' into test

syh 5 gadi atpakaļ
vecāks
revīzija
03f1738c82
15 mainītis faili ar 1021 papildinājumiem un 841 dzēšanām
  1. 7 5
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/CreateInternalServiceImpl.java
  2. 580 580
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/SysPermissionController.java
  3. 35 25
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/mapper/SysPermissionMapper.java
  4. 19 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/mapper/xml/SysPermissionMapper.xml
  5. 2 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/ISysPermissionService.java
  6. 1 0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/impl/SysDepartServiceImpl.java
  7. 179 176
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/impl/SysPermissionServiceImpl.java
  8. 10 5
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/graphql/controller/KuaishouWebController.java
  9. 1 1
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/graphql/entity/KuaishouCommentConfig.java
  10. 20 7
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/graphql/job/KuaishouCommentDayJob.java
  11. 96 0
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/graphql/job/KuaishouCommentHourJob.java
  12. 5 5
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/graphql/service/IKuaishouWebInterfaceService.java
  13. 64 33
      module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/graphql/service/impl/KuaishouWebInterfaceServiceImpl.java
  14. 0 3
      module-report/src/main/java/cn/com/ctop/bytedance/service/impl/BytedanceReportServiceImpl.java
  15. 2 1
      module-toutiao/src/main/java/cn/com/ctop/toutiao/service/impl/ByteDanceAdvertiserDataServiceImpl.java

+ 7 - 5
jeecg-boot-module-system/src/main/java/org/jeecg/modules/ctop/service/impl/CreateInternalServiceImpl.java

@@ -23,6 +23,7 @@ import com.fasterxml.jackson.databind.DeserializationFeature;
 import com.fasterxml.jackson.databind.JsonNode;
 import com.fasterxml.jackson.databind.JsonNode;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import lombok.extern.slf4j.Slf4j;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.http.impl.client.BasicCookieStore;
 import org.apache.http.impl.cookie.BasicClientCookie;
 import org.apache.http.impl.cookie.BasicClientCookie;
 import org.jeecg.modules.ctop.service.ICreateInternalService;
 import org.jeecg.modules.ctop.service.ICreateInternalService;
 import org.openqa.selenium.By;
 import org.openqa.selenium.By;
@@ -236,9 +237,9 @@ public class CreateInternalServiceImpl implements ICreateInternalService {
         chromeOptions.addArguments("--window-size=1920,1080");
         chromeOptions.addArguments("--window-size=1920,1080");
         chromeOptions.addArguments("--user-agent=" + HttpUtils2.USER_AGENT);
         chromeOptions.addArguments("--user-agent=" + HttpUtils2.USER_AGENT);
         chromeOptions.setAcceptInsecureCerts(true);
         chromeOptions.setAcceptInsecureCerts(true);
-        chromeOptions.addArguments("--proxy-server=http://220.189.86.111:45641");
         WebDriver webDriver = new ChromeDriver(chromeOptions);
         WebDriver webDriver = new ChromeDriver(chromeOptions);
         try {
         try {
+            HttpUtils2.cookieStore = new BasicCookieStore();
             webDriver.manage().deleteAllCookies();
             webDriver.manage().deleteAllCookies();
             //获取登录页面
             //获取登录页面
             webDriver.get(url);
             webDriver.get(url);
@@ -249,7 +250,6 @@ public class CreateInternalServiceImpl implements ICreateInternalService {
                 ck.setPath(cookie.getPath());
                 ck.setPath(cookie.getPath());
                 HttpUtils2.cookieStore.addCookie(ck);
                 HttpUtils2.cookieStore.addCookie(ck);
             }
             }
-            String html = webDriver.getPageSource();
             Map<String, String> header = new HashMap<String, String>();
             Map<String, String> header = new HashMap<String, String>();
             header.put("Accept", "*/*");
             header.put("Accept", "*/*");
             header.put("Connection", "keep-alive");
             header.put("Connection", "keep-alive");
@@ -263,7 +263,7 @@ public class CreateInternalServiceImpl implements ICreateInternalService {
             param.put("account", bindAccountLogin.getAccountName());
             param.put("account", bindAccountLogin.getAccountName());
             param.put("password", bindAccountLogin.getPassword());
             param.put("password", bindAccountLogin.getPassword());
             param.put("captcha", "hqde");
             param.put("captcha", "hqde");
-            param.put("is_30_days_no_login", "true");
+            param.put("is_30_days_no_login", "false");
             param.put("service", "https://ad.oceanengine.com");
             param.put("service", "https://ad.oceanengine.com");
             String res = HttpUtils2.httpPostParamRequest("https://sso.toutiao.com/account_login/", param, header);
             String res = HttpUtils2.httpPostParamRequest("https://sso.toutiao.com/account_login/", param, header);
 
 
@@ -369,6 +369,7 @@ public class CreateInternalServiceImpl implements ICreateInternalService {
                         audienceParam.put("location_type", 4);
                         audienceParam.put("location_type", 4);
                         audienceParam.put("aweme_account_fans", 0);
                         audienceParam.put("aweme_account_fans", 0);
                         String tokenStr = HttpUtils2.httpPostRequest("https://ad.oceanengine.com/api/v1/hl/ad/audience/estimate/", audienceParam, header);
                         String tokenStr = HttpUtils2.httpPostRequest("https://ad.oceanengine.com/api/v1/hl/ad/audience/estimate/", audienceParam, header);
+                        System.out.println("tokenStr:" + tokenStr);
                         JsonNode tokenNode = mapper.readTree(tokenStr);
                         JsonNode tokenNode = mapper.readTree(tokenStr);
                         Map<String, Object> planParam = new HashMap<>();
                         Map<String, Object> planParam = new HashMap<>();
                         //模板名称
                         //模板名称
@@ -476,7 +477,7 @@ public class CreateInternalServiceImpl implements ICreateInternalService {
                                 planParam.put("convert_id", convertId);
                                 planParam.put("convert_id", convertId);
                             }
                             }
                         }
                         }
-                        System.out.println(planParam);
+                        System.out.println("广告组创建参数:" + planParam);
                         String createResult = HttpUtils2.httpPostRequest("https://ad.oceanengine.com/overture/ad/create/", planParam, header);
                         String createResult = HttpUtils2.httpPostRequest("https://ad.oceanengine.com/overture/ad/create/", planParam, header);
                         JSONObject result = JSONObject.parseObject(createResult);
                         JSONObject result = JSONObject.parseObject(createResult);
                         System.out.println("创建广告计划返回信息:" + result.toJSONString());
                         System.out.println("创建广告计划返回信息:" + result.toJSONString());
@@ -657,7 +658,8 @@ public class CreateInternalServiceImpl implements ICreateInternalService {
         } finally {
         } finally {
             //清除所有的缓存
             //清除所有的缓存
             webDriver.manage().deleteAllCookies();
             webDriver.manage().deleteAllCookies();
-            webDriver.quit();
+            webDriver.close();
+            HttpUtils2.cookieStore = new BasicCookieStore();
         }
         }
         ResultMapUtils.setResultMap(resultMap, StatusCode.COMMON_SUCCESS.getCode());
         ResultMapUtils.setResultMap(resultMap, StatusCode.COMMON_SUCCESS.getCode());
         return resultMap;
         return resultMap;

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 580 - 580
jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/SysPermissionController.java


+ 35 - 25
jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/mapper/SysPermissionMapper.java

@@ -1,14 +1,13 @@
 package org.jeecg.modules.system.mapper;
 package org.jeecg.modules.system.mapper;
 
 
-import java.util.List;
-
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
 import org.apache.ibatis.annotations.Select;
 import org.apache.ibatis.annotations.Update;
 import org.apache.ibatis.annotations.Update;
 import org.jeecg.modules.system.entity.SysPermission;
 import org.jeecg.modules.system.entity.SysPermission;
 import org.jeecg.modules.system.model.TreeModel;
 import org.jeecg.modules.system.model.TreeModel;
 
 
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import java.util.List;
 
 
 /**
 /**
  * <p>
  * <p>
@@ -19,28 +18,39 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
  * @since 2018-12-21
  * @since 2018-12-21
  */
  */
 public interface SysPermissionMapper extends BaseMapper<SysPermission> {
 public interface SysPermissionMapper extends BaseMapper<SysPermission> {
-	/**
-	   * 通过父菜单ID查询子菜单
-	 * @param parentId
-	 * @return
-	 */
-	public List<TreeModel> queryListByParentId(@Param("parentId") String parentId);
-	
-	/**
-	  *   根据用户查询用户权限
-	 */
-	public List<SysPermission> queryByUser(@Param("username") String username);
-	
-	/**
-	 *   修改菜单状态字段: 是否子节点
-	 */
-	@Update("update sys_permission set is_leaf=#{leaf} where id = #{id}")
-	public int setMenuLeaf(@Param("id") String id,@Param("leaf") int leaf);
-	
-	/**
-	  *   获取模糊匹配规则的数据权限URL
-	 */
-	@Select("SELECT url FROM sys_permission WHERE del_flag = 0 and menu_type = 2 and url like '%*%'")
+    /**
+     * 通过父菜单ID查询子菜单
+     *
+     * @param parentId
+     * @return
+     */
+    public List<TreeModel> queryListByParentId(@Param("parentId") String parentId);
+
+    /**
+     * 根据用户查询用户权限
+     */
+    public List<SysPermission> queryByUser(@Param("username") String username);
+
+    /**
+     * 修改菜单状态字段: 是否子节点
+     */
+    @Update("update sys_permission set is_leaf=#{leaf} where id = #{id}")
+    public int setMenuLeaf(@Param("id") String id, @Param("leaf") int leaf);
+
+    /**
+     * 获取模糊匹配规则的数据权限URL
+     */
+    @Select("SELECT url FROM sys_permission WHERE del_flag = 0 and menu_type = 2 and url like '%*%'")
     public List<String> queryPermissionUrlWithStar();
     public List<String> queryPermissionUrlWithStar();
 
 
+
+    /**
+     * 查询 用户角色码
+     *
+     * @param username
+     * @return
+     */
+
+    String queryRoleCode(@Param("username") String username);
+
 }
 }

+ 19 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/mapper/xml/SysPermissionMapper.xml

@@ -54,4 +54,23 @@
 		   order by p.sort_no ASC
 		   order by p.sort_no ASC
 	</select>
 	</select>
 
 
+
+    <select id="queryRoleCode" parameterType="Object" resultType="java.lang.String">
+	SELECT
+    role_code
+    FROM
+    sys_role
+    WHERE
+    id = (
+    SELECT
+    t2.role_id
+    FROM
+    sys_user t1
+    LEFT JOIN sys_user_role t2 ON t1.id = t2.user_id
+    WHERE
+    t1.username = #{username,jdbcType=VARCHAR}
+    )
+	</select>
+
+
 </mapper>
 </mapper>

+ 2 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/ISysPermissionService.java

@@ -45,4 +45,6 @@ public interface ISysPermissionService extends IService<SysPermission> {
 	 * @return
 	 * @return
 	 */
 	 */
 	public List<String> queryPermissionUrlWithStar();
 	public List<String> queryPermissionUrlWithStar();
+
+	String queryRoleCode(String username);
 }
 }

+ 1 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/impl/SysDepartServiceImpl.java

@@ -241,6 +241,7 @@ public class SysDepartServiceImpl extends ServiceImpl<SysDepartMapper, SysDepart
     public String selectIdByOrdCode(String orgCode) {
     public String selectIdByOrdCode(String orgCode) {
         QueryWrapper<SysDepart> queryWrapper = new QueryWrapper<>();
         QueryWrapper<SysDepart> queryWrapper = new QueryWrapper<>();
         queryWrapper.eq("org_code", orgCode).orderByDesc("create_time");
         queryWrapper.eq("org_code", orgCode).orderByDesc("create_time");
+        queryWrapper.last("limit 1");
         SysDepart depart = departMapper.selectOne(queryWrapper);
         SysDepart depart = departMapper.selectOne(queryWrapper);
         if (!Check.isNull(depart)) {
         if (!Check.isNull(depart)) {
             return depart.getId();
             return depart.getId();

+ 179 - 176
jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/impl/SysPermissionServiceImpl.java

@@ -1,11 +1,9 @@
 package org.jeecg.modules.system.service.impl;
 package org.jeecg.modules.system.service.impl;
 
 
-import java.util.Date;
-import java.util.List;
-
-import javax.annotation.Resource;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.jeecg.common.constant.CacheConstant;
 import org.jeecg.common.constant.CacheConstant;
-
 import org.jeecg.common.constant.CommonConstant;
 import org.jeecg.common.constant.CommonConstant;
 import org.jeecg.common.exception.JeecgBootException;
 import org.jeecg.common.exception.JeecgBootException;
 import org.jeecg.common.util.oConvertUtils;
 import org.jeecg.common.util.oConvertUtils;
@@ -20,9 +18,9 @@ import org.springframework.cache.annotation.Cacheable;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.transaction.annotation.Transactional;
 
 
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import javax.annotation.Resource;
+import java.util.Date;
+import java.util.List;
 
 
 /**
 /**
  * <p>
  * <p>
@@ -35,176 +33,181 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 @Service
 @Service
 public class SysPermissionServiceImpl extends ServiceImpl<SysPermissionMapper, SysPermission> implements ISysPermissionService {
 public class SysPermissionServiceImpl extends ServiceImpl<SysPermissionMapper, SysPermission> implements ISysPermissionService {
 
 
-	@Resource
-	private SysPermissionMapper sysPermissionMapper;
-	
-	@Resource
-	private ISysPermissionDataRuleService permissionDataRuleService;
-	
-	@Override
-	public List<TreeModel> queryListByParentId(String parentId) {
-		return sysPermissionMapper.queryListByParentId(parentId);
-	}
-
-	/**
-	  * 真实删除
-	 */
-	@Override
-	@Transactional
-	@CacheEvict(value = CacheConstant.PERMISSION_CACHE,allEntries=true)
-	public void deletePermission(String id) throws JeecgBootException {
-		SysPermission sysPermission = this.getById(id);
-		if(sysPermission==null) {
-			throw new JeecgBootException("未找到菜单信息");
-		}
-		String pid = sysPermission.getParentId();
-
-		if(oConvertUtils.isNotEmpty(pid)) {
-			int count = this.count(new QueryWrapper<SysPermission>().lambda().eq(SysPermission::getParentId, pid));
-			if(count==1) {
-				//若父节点无其他子节点,则该父节点是叶子节点
-				this.sysPermissionMapper.setMenuLeaf(pid, 1);
-			}
-		}
-		sysPermissionMapper.deleteById(id);
-		// 该节点可能是子节点但也可能是其它节点的父节点,所以需要级联删除
-		this.removeChildrenBy(sysPermission.getId());
-	}
-	
-	/**
-	 * 根据父id删除其关联的子节点数据
-	 * 
-	 * @return
-	 */
-	public void removeChildrenBy(String parentId) {
-		LambdaQueryWrapper<SysPermission> query = new LambdaQueryWrapper<>();
-		// 封装查询条件parentId为主键,
-		query.eq(SysPermission::getParentId, parentId);
-		// 查出该主键下的所有子级
-		List<SysPermission> permissionList = this.list(query);
-		if (permissionList != null && permissionList.size() > 0) {
+    @Resource
+    private SysPermissionMapper sysPermissionMapper;
+
+    @Resource
+    private ISysPermissionDataRuleService permissionDataRuleService;
+
+    @Override
+    public List<TreeModel> queryListByParentId(String parentId) {
+        return sysPermissionMapper.queryListByParentId(parentId);
+    }
+
+    /**
+     * 真实删除
+     */
+    @Override
+    @Transactional
+    @CacheEvict(value = CacheConstant.PERMISSION_CACHE, allEntries = true)
+    public void deletePermission(String id) throws JeecgBootException {
+        SysPermission sysPermission = this.getById(id);
+        if (sysPermission == null) {
+            throw new JeecgBootException("未找到菜单信息");
+        }
+        String pid = sysPermission.getParentId();
+
+        if (oConvertUtils.isNotEmpty(pid)) {
+            int count = this.count(new QueryWrapper<SysPermission>().lambda().eq(SysPermission::getParentId, pid));
+            if (count == 1) {
+                //若父节点无其他子节点,则该父节点是叶子节点
+                this.sysPermissionMapper.setMenuLeaf(pid, 1);
+            }
+        }
+        sysPermissionMapper.deleteById(id);
+        // 该节点可能是子节点但也可能是其它节点的父节点,所以需要级联删除
+        this.removeChildrenBy(sysPermission.getId());
+    }
+
+    /**
+     * 根据父id删除其关联的子节点数据
+     *
+     * @return
+     */
+    public void removeChildrenBy(String parentId) {
+        LambdaQueryWrapper<SysPermission> query = new LambdaQueryWrapper<>();
+        // 封装查询条件parentId为主键,
+        query.eq(SysPermission::getParentId, parentId);
+        // 查出该主键下的所有子级
+        List<SysPermission> permissionList = this.list(query);
+        if (permissionList != null && permissionList.size() > 0) {
             String id = "";
             String id = "";
             // 查出的子级数量
             // 查出的子级数量
             int num = 0;
             int num = 0;
-			// 如果查出的集合不为空, 则先删除所有
-			this.remove(query);
-			// 再遍历刚才查出的集合, 根据每个对象,查找其是否仍有子级
-			for (int i = 0, len = permissionList.size(); i < len; i++) {
-				id = permissionList.get(i).getId();
-				num = this.count(new LambdaQueryWrapper<SysPermission>().eq(SysPermission::getParentId, id));
-				// 如果有, 则递归
-				if (num > 0) {
-					this.removeChildrenBy(id);
-				}
-			}
-		}
-	}
-	
-	/**
-	  * 逻辑删除
-	 */
-	@Override
-	@CacheEvict(value = CacheConstant.PERMISSION_CACHE,allEntries=true)
-	public void deletePermissionLogical(String id) throws JeecgBootException {
-		SysPermission sysPermission = this.getById(id);
-		if(sysPermission==null) {
-			throw new JeecgBootException("未找到菜单信息");
-		}
-		String pid = sysPermission.getParentId();
-		int count = this.count(new QueryWrapper<SysPermission>().lambda().eq(SysPermission::getParentId, pid));
-		if(count==1) {
-			//若父节点无其他子节点,则该父节点是叶子节点
-			this.sysPermissionMapper.setMenuLeaf(pid, 1);
-		}
-		sysPermission.setDelFlag(1);
-		this.updateById(sysPermission);
-	}
-
-	@Override
-	@CacheEvict(value = CacheConstant.PERMISSION_CACHE,allEntries=true)
-	public void addPermission(SysPermission sysPermission) throws JeecgBootException {
-		//----------------------------------------------------------------------
-		//判断是否是一级菜单,是的话清空父菜单
-		if(CommonConstant.MENU_TYPE_0.equals(sysPermission.getMenuType())) {
-			sysPermission.setParentId(null);
-		}
-		//----------------------------------------------------------------------
-		String pid = sysPermission.getParentId();
-		if(oConvertUtils.isNotEmpty(pid)) {
-			//设置父节点不为叶子节点
-			this.sysPermissionMapper.setMenuLeaf(pid, 0);
-		}
-		sysPermission.setCreateTime(new Date());
-		sysPermission.setDelFlag(0);
-		sysPermission.setLeaf(true);
-		this.save(sysPermission);
-	}
-
-	@Override
-	@CacheEvict(value = CacheConstant.PERMISSION_CACHE,allEntries=true)
-	public void editPermission(SysPermission sysPermission) throws JeecgBootException {
-		SysPermission p = this.getById(sysPermission.getId());
-		//TODO 该节点判断是否还有子节点
-		if(p==null) {
-			throw new JeecgBootException("未找到菜单信息");
-		}else {
-			sysPermission.setUpdateTime(new Date());
-			//----------------------------------------------------------------------
-			//Step1.判断是否是一级菜单,是的话清空父菜单ID
-			if(CommonConstant.MENU_TYPE_0.equals(sysPermission.getMenuType())) {
-				sysPermission.setParentId("");
-			}
-			//Step2.判断菜单下级是否有菜单,无则设置为叶子节点
-			int count = this.count(new QueryWrapper<SysPermission>().lambda().eq(SysPermission::getParentId, sysPermission.getId()));
-			if(count==0) {
-				sysPermission.setLeaf(true);
-			}
-			//----------------------------------------------------------------------
-			this.updateById(sysPermission);
-			
-			//如果当前菜单的父菜单变了,则需要修改新父菜单和老父菜单的,叶子节点状态
-			String pid = sysPermission.getParentId();
-			if((oConvertUtils.isNotEmpty(pid) && !pid.equals(p.getParentId())) || oConvertUtils.isEmpty(pid)&&oConvertUtils.isNotEmpty(p.getParentId())) {
-				//a.设置新的父菜单不为叶子节点
-				this.sysPermissionMapper.setMenuLeaf(pid, 0);
-				//b.判断老的菜单下是否还有其他子菜单,没有的话则设置为叶子节点
-				int cc = this.count(new QueryWrapper<SysPermission>().lambda().eq(SysPermission::getParentId, p.getParentId()));
-				if(cc==0) {
-					if(oConvertUtils.isNotEmpty(p.getParentId())) {
-						this.sysPermissionMapper.setMenuLeaf(p.getParentId(), 1);
-					}
-				}
-				
-			}
-		}
-		
-	}
-
-	@Override
-	public List<SysPermission> queryByUser(String username) {
-		return this.sysPermissionMapper.queryByUser(username);
-	}
-
-	/**
-	 * 根据permissionId删除其关联的SysPermissionDataRule表中的数据
-	 */
-	@Override
-	public void deletePermRuleByPermId(String id) {
-		LambdaQueryWrapper<SysPermissionDataRule> query = new LambdaQueryWrapper<>();
-		query.eq(SysPermissionDataRule::getPermissionId, id);
-		int countValue = this.permissionDataRuleService.count(query);
-		if(countValue > 0) {
-			this.permissionDataRuleService.remove(query);	
-		}
-	}
-
-	/**
-	  *   获取模糊匹配规则的数据权限URL
-	 */
-	@Override
-	@Cacheable(value = CacheConstant.PERMISSION_CACHE)
-	public List<String> queryPermissionUrlWithStar() {
-		return this.baseMapper.queryPermissionUrlWithStar();
-	}
+            // 如果查出的集合不为空, 则先删除所有
+            this.remove(query);
+            // 再遍历刚才查出的集合, 根据每个对象,查找其是否仍有子级
+            for (int i = 0, len = permissionList.size(); i < len; i++) {
+                id = permissionList.get(i).getId();
+                num = this.count(new LambdaQueryWrapper<SysPermission>().eq(SysPermission::getParentId, id));
+                // 如果有, 则递归
+                if (num > 0) {
+                    this.removeChildrenBy(id);
+                }
+            }
+        }
+    }
+
+    /**
+     * 逻辑删除
+     */
+    @Override
+    @CacheEvict(value = CacheConstant.PERMISSION_CACHE, allEntries = true)
+    public void deletePermissionLogical(String id) throws JeecgBootException {
+        SysPermission sysPermission = this.getById(id);
+        if (sysPermission == null) {
+            throw new JeecgBootException("未找到菜单信息");
+        }
+        String pid = sysPermission.getParentId();
+        int count = this.count(new QueryWrapper<SysPermission>().lambda().eq(SysPermission::getParentId, pid));
+        if (count == 1) {
+            //若父节点无其他子节点,则该父节点是叶子节点
+            this.sysPermissionMapper.setMenuLeaf(pid, 1);
+        }
+        sysPermission.setDelFlag(1);
+        this.updateById(sysPermission);
+    }
+
+    @Override
+    @CacheEvict(value = CacheConstant.PERMISSION_CACHE, allEntries = true)
+    public void addPermission(SysPermission sysPermission) throws JeecgBootException {
+        //----------------------------------------------------------------------
+        //判断是否是一级菜单,是的话清空父菜单
+        if (CommonConstant.MENU_TYPE_0.equals(sysPermission.getMenuType())) {
+            sysPermission.setParentId(null);
+        }
+        //----------------------------------------------------------------------
+        String pid = sysPermission.getParentId();
+        if (oConvertUtils.isNotEmpty(pid)) {
+            //设置父节点不为叶子节点
+            this.sysPermissionMapper.setMenuLeaf(pid, 0);
+        }
+        sysPermission.setCreateTime(new Date());
+        sysPermission.setDelFlag(0);
+        sysPermission.setLeaf(true);
+        this.save(sysPermission);
+    }
+
+    @Override
+    @CacheEvict(value = CacheConstant.PERMISSION_CACHE, allEntries = true)
+    public void editPermission(SysPermission sysPermission) throws JeecgBootException {
+        SysPermission p = this.getById(sysPermission.getId());
+        //TODO 该节点判断是否还有子节点
+        if (p == null) {
+            throw new JeecgBootException("未找到菜单信息");
+        } else {
+            sysPermission.setUpdateTime(new Date());
+            //----------------------------------------------------------------------
+            //Step1.判断是否是一级菜单,是的话清空父菜单ID
+            if (CommonConstant.MENU_TYPE_0.equals(sysPermission.getMenuType())) {
+                sysPermission.setParentId("");
+            }
+            //Step2.判断菜单下级是否有菜单,无则设置为叶子节点
+            int count = this.count(new QueryWrapper<SysPermission>().lambda().eq(SysPermission::getParentId, sysPermission.getId()));
+            if (count == 0) {
+                sysPermission.setLeaf(true);
+            }
+            //----------------------------------------------------------------------
+            this.updateById(sysPermission);
+
+            //如果当前菜单的父菜单变了,则需要修改新父菜单和老父菜单的,叶子节点状态
+            String pid = sysPermission.getParentId();
+            if ((oConvertUtils.isNotEmpty(pid) && !pid.equals(p.getParentId())) || oConvertUtils.isEmpty(pid) && oConvertUtils.isNotEmpty(p.getParentId())) {
+                //a.设置新的父菜单不为叶子节点
+                this.sysPermissionMapper.setMenuLeaf(pid, 0);
+                //b.判断老的菜单下是否还有其他子菜单,没有的话则设置为叶子节点
+                int cc = this.count(new QueryWrapper<SysPermission>().lambda().eq(SysPermission::getParentId, p.getParentId()));
+                if (cc == 0) {
+                    if (oConvertUtils.isNotEmpty(p.getParentId())) {
+                        this.sysPermissionMapper.setMenuLeaf(p.getParentId(), 1);
+                    }
+                }
+
+            }
+        }
+
+    }
+
+    @Override
+    public List<SysPermission> queryByUser(String username) {
+        return this.sysPermissionMapper.queryByUser(username);
+    }
+
+    /**
+     * 根据permissionId删除其关联的SysPermissionDataRule表中的数据
+     */
+    @Override
+    public void deletePermRuleByPermId(String id) {
+        LambdaQueryWrapper<SysPermissionDataRule> query = new LambdaQueryWrapper<>();
+        query.eq(SysPermissionDataRule::getPermissionId, id);
+        int countValue = this.permissionDataRuleService.count(query);
+        if (countValue > 0) {
+            this.permissionDataRuleService.remove(query);
+        }
+    }
+
+    /**
+     * 获取模糊匹配规则的数据权限URL
+     */
+    @Override
+    @Cacheable(value = CacheConstant.PERMISSION_CACHE)
+    public List<String> queryPermissionUrlWithStar() {
+        return this.baseMapper.queryPermissionUrlWithStar();
+    }
+
+    @Override
+    public String queryRoleCode(String username) {
+        return this.sysPermissionMapper.queryRoleCode(username);
+    }
 
 
 }
 }

+ 10 - 5
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/graphql/controller/KuaishouWebController.java

@@ -101,7 +101,8 @@ public class KuaishouWebController {
     public Result<Map<String, Object>> videoList(String ksid, String pcursor) {
     public Result<Map<String, Object>> videoList(String ksid, String pcursor) {
         Result<Map<String, Object>> result = new Result<Map<String, Object>>();
         Result<Map<String, Object>> result = new Result<Map<String, Object>>();
         try {
         try {
-            Map<String, Object> statusMap = kuaishouWebInterfaceService.videoList(ksid, pcursor);
+            LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+            Map<String, Object> statusMap = kuaishouWebInterfaceService.videoList(user.getId(), ksid, pcursor);
             result.setSuccess(true);
             result.setSuccess(true);
             result.setResult(statusMap);
             result.setResult(statusMap);
         } catch (Exception e) {
         } catch (Exception e) {
@@ -115,7 +116,8 @@ public class KuaishouWebController {
     public Result<Map<String, Object>> commentList(String ksid, String photoId, String pcursor) {
     public Result<Map<String, Object>> commentList(String ksid, String photoId, String pcursor) {
         Result<Map<String, Object>> result = new Result<Map<String, Object>>();
         Result<Map<String, Object>> result = new Result<Map<String, Object>>();
         try {
         try {
-            Map<String, Object> statusMap = kuaishouWebInterfaceService.commentList(ksid, photoId, pcursor);
+            LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+            Map<String, Object> statusMap = kuaishouWebInterfaceService.commentList(user.getId(), ksid, photoId, pcursor);
             result.setSuccess(true);
             result.setSuccess(true);
             result.setResult(statusMap);
             result.setResult(statusMap);
         } catch (Exception e) {
         } catch (Exception e) {
@@ -129,7 +131,8 @@ public class KuaishouWebController {
     public Result<Map<String, Object>> commentDelete(String ksid, String photoId, Long commentId) {
     public Result<Map<String, Object>> commentDelete(String ksid, String photoId, Long commentId) {
         Result<Map<String, Object>> result = new Result<Map<String, Object>>();
         Result<Map<String, Object>> result = new Result<Map<String, Object>>();
         try {
         try {
-            Map<String, Object> statusMap = kuaishouWebInterfaceService.commentDelete(ksid, photoId, commentId);
+            LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+            Map<String, Object> statusMap = kuaishouWebInterfaceService.commentDelete(user.getId(), ksid, photoId, commentId);
             result.setSuccess(true);
             result.setSuccess(true);
             result.setResult(statusMap);
             result.setResult(statusMap);
         } catch (Exception e) {
         } catch (Exception e) {
@@ -143,7 +146,8 @@ public class KuaishouWebController {
     public Result<Map<String, Object>> commentAdd(String ksid, String photoId, String content, Long replyToCommentId, Long repltTo) {
     public Result<Map<String, Object>> commentAdd(String ksid, String photoId, String content, Long replyToCommentId, Long repltTo) {
         Result<Map<String, Object>> result = new Result<Map<String, Object>>();
         Result<Map<String, Object>> result = new Result<Map<String, Object>>();
         try {
         try {
-            Map<String, Object> statusMap = kuaishouWebInterfaceService.commentAdd(ksid, photoId, content, replyToCommentId, repltTo);
+            LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+            Map<String, Object> statusMap = kuaishouWebInterfaceService.commentAdd(user.getId(), ksid, photoId, content, replyToCommentId, repltTo);
             result.setSuccess(true);
             result.setSuccess(true);
             result.setResult(statusMap);
             result.setResult(statusMap);
         } catch (Exception e) {
         } catch (Exception e) {
@@ -157,7 +161,8 @@ public class KuaishouWebController {
     public Result<Map<String, Object>> subCommentList(String ksid, String photoId, Long rootCommentId, String pcursor) {
     public Result<Map<String, Object>> subCommentList(String ksid, String photoId, Long rootCommentId, String pcursor) {
         Result<Map<String, Object>> result = new Result<Map<String, Object>>();
         Result<Map<String, Object>> result = new Result<Map<String, Object>>();
         try {
         try {
-            Map<String, Object> statusMap = kuaishouWebInterfaceService.subCommentList(ksid, photoId, rootCommentId, pcursor);
+            LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+            Map<String, Object> statusMap = kuaishouWebInterfaceService.subCommentList(user.getId(), ksid, photoId, rootCommentId, pcursor);
             result.setSuccess(true);
             result.setSuccess(true);
             result.setResult(statusMap);
             result.setResult(statusMap);
         } catch (Exception e) {
         } catch (Exception e) {

+ 1 - 1
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/graphql/entity/KuaishouCommentConfig.java

@@ -10,7 +10,7 @@ import lombok.Data;
 public class KuaishouCommentConfig {
 public class KuaishouCommentConfig {
     @TableId(value = "ksid", type = IdType.INPUT)
     @TableId(value = "ksid", type = IdType.INPUT)
     private String ksid;
     private String ksid;
-    private Boolean autoDelete;
+    private Integer autoDelete;
     private String strategy;
     private String strategy;
     private String cycle;
     private String cycle;
 }
 }

+ 20 - 7
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/graphql/job/KuaishouCommentDayJob.java

@@ -1,6 +1,7 @@
 package cn.com.ctop.kuaishou.modules.graphql.job;
 package cn.com.ctop.kuaishou.modules.graphql.job;
 
 
 import cn.com.ctop.kuaishou.modules.graphql.entity.KuaishouCommentConfig;
 import cn.com.ctop.kuaishou.modules.graphql.entity.KuaishouCommentConfig;
+import cn.com.ctop.kuaishou.modules.graphql.entity.KuaishouCommentStat;
 import cn.com.ctop.kuaishou.modules.graphql.entity.KuaishouUserCookie;
 import cn.com.ctop.kuaishou.modules.graphql.entity.KuaishouUserCookie;
 import cn.com.ctop.kuaishou.modules.graphql.service.*;
 import cn.com.ctop.kuaishou.modules.graphql.service.*;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONArray;
@@ -31,7 +32,7 @@ public class KuaishouCommentDayJob implements Job {
     @Override
     @Override
     public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
     public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
         QueryWrapper<KuaishouCommentConfig> queryWrapper = new QueryWrapper<>();
         QueryWrapper<KuaishouCommentConfig> queryWrapper = new QueryWrapper<>();
-        queryWrapper.eq("auto_delete", true);
+        queryWrapper.eq("auto_delete", 1);
         queryWrapper.eq("cycle", "DAY");
         queryWrapper.eq("cycle", "DAY");
         List<KuaishouCommentConfig> kuaishouCommentConfigList = kuaishouCommentConfigService.list(queryWrapper);
         List<KuaishouCommentConfig> kuaishouCommentConfigList = kuaishouCommentConfigService.list(queryWrapper);
         if (kuaishouCommentConfigList != null && kuaishouCommentConfigList.size() > 0) {
         if (kuaishouCommentConfigList != null && kuaishouCommentConfigList.size() > 0) {
@@ -43,7 +44,7 @@ public class KuaishouCommentDayJob implements Job {
                 try {
                 try {
                     String pcursor = "";
                     String pcursor = "";
                     do {
                     do {
-                        Map<String, Object> videoMap = kuaishouWebInterfaceService.videoList(config.getKsid(), pcursor);
+                        Map<String, Object> videoMap = kuaishouWebInterfaceService.videoList(kuaishouUserCookie.getUserId(), config.getKsid(), pcursor);
                         JsonNode videoNode = mapToJson(videoMap);
                         JsonNode videoNode = mapToJson(videoMap);
                         pcursor = videoNode.get("data").get("publicFeeds").get("pcursor").asText();
                         pcursor = videoNode.get("data").get("publicFeeds").get("pcursor").asText();
                         Iterator<JsonNode> list = videoNode.get("data").get("publicFeeds").get("list").iterator();
                         Iterator<JsonNode> list = videoNode.get("data").get("publicFeeds").get("list").iterator();
@@ -54,20 +55,32 @@ public class KuaishouCommentDayJob implements Job {
                                 String photoId = node.get("photoId").asText();
                                 String photoId = node.get("photoId").asText();
                                 String commentPcursor = "";
                                 String commentPcursor = "";
                                 do {
                                 do {
-                                    Map<String, Object> commentMap = kuaishouWebInterfaceService.commentList(config.getKsid(), photoId, commentPcursor);
+                                    Map<String, Object> commentMap = kuaishouWebInterfaceService.commentList(kuaishouUserCookie.getUserId(), config.getKsid(), photoId, commentPcursor);
                                     JsonNode commentNode = mapToJson(commentMap);
                                     JsonNode commentNode = mapToJson(commentMap);
                                     commentPcursor = commentNode.get("data").get("shortVideoCommentList").get("pcursor").asText();
                                     commentPcursor = commentNode.get("data").get("shortVideoCommentList").get("pcursor").asText();
                                     Iterator<JsonNode> commentList = commentNode.get("data").get("shortVideoCommentList").get("commentList").iterator();
                                     Iterator<JsonNode> commentList = commentNode.get("data").get("shortVideoCommentList").get("commentList").iterator();
                                     while (commentList.hasNext()) {
                                     while (commentList.hasNext()) {
                                         JsonNode commentListNode = commentList.next();
                                         JsonNode commentListNode = commentList.next();
                                         Long commentId = commentListNode.get("commentId").asLong();
                                         Long commentId = commentListNode.get("commentId").asLong();
-                                        Map<String, Object> deleteMap = kuaishouWebInterfaceService.commentDelete(config.getKsid(), photoId, commentId);
-
+                                        Map<String, Object> deleteMap = kuaishouWebInterfaceService.commentDelete(kuaishouUserCookie.getUserId(), config.getKsid(), photoId, commentId);
+                                        if ((int) deleteMap.get("result") == 1) {
+                                            KuaishouCommentStat kuaishouCommentStat = kuaishouCommentStatService.getById(commentId);
+                                            if (kuaishouCommentStat == null) {
+                                                kuaishouCommentStat = new KuaishouCommentStat();
+                                                kuaishouCommentStat.setCommentId(commentId);
+                                                kuaishouCommentStat.setDeleteCount(1);
+                                                kuaishouCommentStat.setKsid(config.getKsid());
+                                                kuaishouCommentStatService.save(kuaishouCommentStat);
+                                            } else {
+                                                kuaishouCommentStat.setDeleteCount(kuaishouCommentStat.getDeleteCount() + 1);
+                                                kuaishouCommentStatService.updateById(kuaishouCommentStat);
+                                            }
+                                        }
                                     }
                                     }
-                                } while (!commentPcursor.equals("no_more"));
+                                } while (commentPcursor != null && !commentPcursor.equals("no_more"));
                             }
                             }
                         }
                         }
-                    } while (!pcursor.equals("no_more"));
+                    } while (pcursor != null && !pcursor.equals("no_more"));
 
 
                 } catch (Exception e) {
                 } catch (Exception e) {
                     e.printStackTrace();
                     e.printStackTrace();

+ 96 - 0
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/graphql/job/KuaishouCommentHourJob.java

@@ -0,0 +1,96 @@
+package cn.com.ctop.kuaishou.modules.graphql.job;
+
+import cn.com.ctop.kuaishou.modules.graphql.entity.KuaishouCommentConfig;
+import cn.com.ctop.kuaishou.modules.graphql.entity.KuaishouCommentStat;
+import cn.com.ctop.kuaishou.modules.graphql.entity.KuaishouUserCookie;
+import cn.com.ctop.kuaishou.modules.graphql.service.*;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.quartz.Job;
+import org.quartz.JobExecutionContext;
+import org.quartz.JobExecutionException;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+public class KuaishouCommentHourJob implements Job {
+    @Autowired
+    private IKuaishouCommentConfigService kuaishouCommentConfigService;
+    @Autowired
+    private IKuaishouCommentKeywordService kuaishouCommentKeywordService;
+    @Autowired
+    private IKuaishouCommentStatService kuaishouCommentStatService;
+    @Autowired
+    private IKuaishouUserCookieService kuaishouUserCookieService;
+    @Autowired
+    private IKuaishouWebInterfaceService kuaishouWebInterfaceService;
+
+    @Override
+    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
+        QueryWrapper<KuaishouCommentConfig> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("auto_delete", 1);
+        queryWrapper.eq("cycle", "HOUR");
+        List<KuaishouCommentConfig> kuaishouCommentConfigList = kuaishouCommentConfigService.list(queryWrapper);
+        if (kuaishouCommentConfigList != null && kuaishouCommentConfigList.size() > 0) {
+            for (KuaishouCommentConfig config : kuaishouCommentConfigList) {
+                QueryWrapper<KuaishouUserCookie> queryWrapper1 = new QueryWrapper<>();
+                queryWrapper1.eq("ksid", config.getKsid());
+                KuaishouUserCookie kuaishouUserCookie = kuaishouUserCookieService.getOne(queryWrapper1);
+
+                try {
+                    String pcursor = "";
+                    do {
+                        Map<String, Object> videoMap = kuaishouWebInterfaceService.videoList(kuaishouUserCookie.getUserId(), config.getKsid(), pcursor);
+                        JsonNode videoNode = mapToJson(videoMap);
+                        pcursor = videoNode.get("data").get("publicFeeds").get("pcursor").asText();
+                        Iterator<JsonNode> list = videoNode.get("data").get("publicFeeds").get("list").iterator();
+                        while (list.hasNext()) {
+                            JsonNode node = list.next();
+                            Integer commentCount = node.get("commentCount").asInt();
+                            if (commentCount > 0) {
+                                String photoId = node.get("photoId").asText();
+                                String commentPcursor = "";
+                                do {
+                                    Map<String, Object> commentMap = kuaishouWebInterfaceService.commentList(kuaishouUserCookie.getUserId(), config.getKsid(), photoId, commentPcursor);
+                                    JsonNode commentNode = mapToJson(commentMap);
+                                    commentPcursor = commentNode.get("data").get("shortVideoCommentList").get("pcursor").asText();
+                                    Iterator<JsonNode> commentList = commentNode.get("data").get("shortVideoCommentList").get("commentList").iterator();
+                                    while (commentList.hasNext()) {
+                                        JsonNode commentListNode = commentList.next();
+                                        Long commentId = commentListNode.get("commentId").asLong();
+                                        Map<String, Object> deleteMap = kuaishouWebInterfaceService.commentDelete(kuaishouUserCookie.getUserId(), config.getKsid(), photoId, commentId);
+                                        if ((int) deleteMap.get("result") == 1) {
+                                            KuaishouCommentStat kuaishouCommentStat = kuaishouCommentStatService.getById(commentId);
+                                            if (kuaishouCommentStat == null) {
+                                                kuaishouCommentStat = new KuaishouCommentStat();
+                                                kuaishouCommentStat.setCommentId(commentId);
+                                                kuaishouCommentStat.setDeleteCount(1);
+                                                kuaishouCommentStat.setKsid(config.getKsid());
+                                                kuaishouCommentStatService.save(kuaishouCommentStat);
+                                            } else {
+                                                kuaishouCommentStat.setDeleteCount(kuaishouCommentStat.getDeleteCount() + 1);
+                                                kuaishouCommentStatService.updateById(kuaishouCommentStat);
+                                            }
+                                        }
+                                    }
+                                } while (commentPcursor != null && !commentPcursor.equals("no_more"));
+                            }
+                        }
+                    } while (pcursor != null && !pcursor.equals("no_more"));
+
+                } catch (Exception e) {
+                    e.printStackTrace();
+                }
+            }
+        }
+    }
+
+    public JsonNode mapToJson(Map<String, Object> map) throws Exception {
+        ObjectMapper mapper = new ObjectMapper();
+        String json = mapper.writeValueAsString(map);
+        return mapper.readTree(json);
+    }
+}

+ 5 - 5
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/graphql/service/IKuaishouWebInterfaceService.java

@@ -22,13 +22,13 @@ public interface IKuaishouWebInterfaceService {
 
 
     public Map<String, Object> loginStatus(String taskId);
     public Map<String, Object> loginStatus(String taskId);
 
 
-    public Map<String, Object> commentDelete(String ksid, String photoId, Long commentId);
+    public Map<String, Object> commentDelete(String userId, String ksid, String photoId, Long commentId);
 
 
-    public Map<String, Object> videoList(String ksid, String pcursor);
+    public Map<String, Object> videoList(String userId, String ksid, String pcursor);
 
 
-    public Map<String, Object> commentList(String ksid, String photoId, String pcursor);
+    public Map<String, Object> commentList(String userId, String ksid, String photoId, String pcursor);
 
 
-    public Map<String, Object> commentAdd(String ksid, String photoId, String content, Long replyToCommentId, Long replyTo);
+    public Map<String, Object> commentAdd(String userId, String ksid, String photoId, String content, Long replyToCommentId, Long replyTo);
 
 
-    public Map<String, Object> subCommentList(String ksid, String photoId, Long rootCommentId, String pcursor);
+    public Map<String, Object> subCommentList(String userId, String ksid, String photoId, Long rootCommentId, String pcursor);
 }
 }

+ 64 - 33
module-kuaishou/src/main/java/cn/com/ctop/kuaishou/modules/graphql/service/impl/KuaishouWebInterfaceServiceImpl.java

@@ -107,11 +107,10 @@ public class KuaishouWebInterfaceServiceImpl implements IKuaishouWebInterfaceSer
         return queryStr;
         return queryStr;
     }
     }
 
 
-    public Map<String, Object> subCommentList(String ksid, String photoId, Long rootCommentId, String pcursor) {
-        LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+    public Map<String, Object> subCommentList(String userId, String ksid, String photoId, Long rootCommentId, String pcursor) {
         QueryWrapper<KuaishouUserCookie> queryWrapper = new QueryWrapper<KuaishouUserCookie>();
         QueryWrapper<KuaishouUserCookie> queryWrapper = new QueryWrapper<KuaishouUserCookie>();
         Map<String, Object> resultMap = new HashMap<>();
         Map<String, Object> resultMap = new HashMap<>();
-        queryWrapper.eq("user_id", user.getId());
+        queryWrapper.eq("user_id", userId);
         queryWrapper.eq("ksid", ksid);
         queryWrapper.eq("ksid", ksid);
         KuaishouUserCookie kuaishouUserCookie = kuaishouUserCookieService.getOne(queryWrapper);
         KuaishouUserCookie kuaishouUserCookie = kuaishouUserCookieService.getOne(queryWrapper);
         if (kuaishouUserCookie != null) {
         if (kuaishouUserCookie != null) {
@@ -138,7 +137,7 @@ public class KuaishouWebInterfaceServiceImpl implements IKuaishouWebInterfaceSer
                 if (resultNode.get("subCommentList").isNull() || resultNode.get("subCommentList").get("pcursor").isNull()) {
                 if (resultNode.get("subCommentList").isNull() || resultNode.get("subCommentList").get("pcursor").isNull()) {
                     ipPool.setStatus(2);
                     ipPool.setStatus(2);
                     iIpPoolService.updateById(ipPool);
                     iIpPoolService.updateById(ipPool);
-                    return subCommentList(ksid, photoId, rootCommentId, pcursor);
+                    return subCommentList(userId, ksid, photoId, rootCommentId, pcursor);
                 }
                 }
             } catch (Exception e) {
             } catch (Exception e) {
                 e.printStackTrace();
                 e.printStackTrace();
@@ -146,17 +145,16 @@ public class KuaishouWebInterfaceServiceImpl implements IKuaishouWebInterfaceSer
                     ipPool.setStatus(2);
                     ipPool.setStatus(2);
                     iIpPoolService.updateById(ipPool);
                     iIpPoolService.updateById(ipPool);
                 }
                 }
-                return subCommentList(ksid, photoId, rootCommentId, pcursor);
+                return subCommentList(userId, ksid, photoId, rootCommentId, pcursor);
             }
             }
         }
         }
         return resultMap;
         return resultMap;
     }
     }
 
 
-    public Map<String, Object> commentList(String ksid, String photoId, String pcursor) {
-        LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+    public Map<String, Object> commentList(String userId, String ksid, String photoId, String pcursor) {
         QueryWrapper<KuaishouUserCookie> queryWrapper = new QueryWrapper<KuaishouUserCookie>();
         QueryWrapper<KuaishouUserCookie> queryWrapper = new QueryWrapper<KuaishouUserCookie>();
         Map<String, Object> resultMap = new HashMap<>();
         Map<String, Object> resultMap = new HashMap<>();
-        queryWrapper.eq("user_id", user.getId());
+        queryWrapper.eq("user_id", userId);
         queryWrapper.eq("ksid", ksid);
         queryWrapper.eq("ksid", ksid);
         KuaishouUserCookie kuaishouUserCookie = kuaishouUserCookieService.getOne(queryWrapper);
         KuaishouUserCookie kuaishouUserCookie = kuaishouUserCookieService.getOne(queryWrapper);
         if (kuaishouUserCookie != null) {
         if (kuaishouUserCookie != null) {
@@ -193,7 +191,7 @@ public class KuaishouWebInterfaceServiceImpl implements IKuaishouWebInterfaceSer
                 if (httpClientEntity.getResult() == null) {
                 if (httpClientEntity.getResult() == null) {
                     ipPool.setStatus(2);
                     ipPool.setStatus(2);
                     iIpPoolService.updateById(ipPool);
                     iIpPoolService.updateById(ipPool);
-                    return commentList(ksid, photoId, pcursor);
+                    return commentList(userId, ksid, photoId, pcursor);
                 }
                 }
                 resultMap = mapper.readValue(httpClientEntity.getResult(), new TypeReference<Map<String, Object>>() {
                 resultMap = mapper.readValue(httpClientEntity.getResult(), new TypeReference<Map<String, Object>>() {
                 });
                 });
@@ -201,7 +199,7 @@ public class KuaishouWebInterfaceServiceImpl implements IKuaishouWebInterfaceSer
                 if (resultNode.get("shortVideoCommentList").isNull() || resultNode.get("shortVideoCommentList").get("pcursor").isNull()) {
                 if (resultNode.get("shortVideoCommentList").isNull() || resultNode.get("shortVideoCommentList").get("pcursor").isNull()) {
                     ipPool.setStatus(2);
                     ipPool.setStatus(2);
                     iIpPoolService.updateById(ipPool);
                     iIpPoolService.updateById(ipPool);
-                    return commentList(ksid, photoId, pcursor);
+                    return commentList(userId, ksid, photoId, pcursor);
                 }
                 }
             } catch (Exception e) {
             } catch (Exception e) {
                 if (ipPool != null) {
                 if (ipPool != null) {
@@ -209,7 +207,7 @@ public class KuaishouWebInterfaceServiceImpl implements IKuaishouWebInterfaceSer
                     iIpPoolService.updateById(ipPool);
                     iIpPoolService.updateById(ipPool);
                 }
                 }
                 e.printStackTrace();
                 e.printStackTrace();
-                return commentList(ksid, photoId, pcursor);
+                return commentList(userId, ksid, photoId, pcursor);
             }
             }
         }
         }
         return resultMap;
         return resultMap;
@@ -239,11 +237,11 @@ public class KuaishouWebInterfaceServiceImpl implements IKuaishouWebInterfaceSer
         return map;
         return map;
     }
     }
 
 
-    public Map<String, Object> videoList(String ksid, String pcursor) {
-        LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+    public Map<String, Object> videoList(String userId, String ksid, String pcursor) {
+
         QueryWrapper<KuaishouUserCookie> queryWrapper = new QueryWrapper<KuaishouUserCookie>();
         QueryWrapper<KuaishouUserCookie> queryWrapper = new QueryWrapper<KuaishouUserCookie>();
         Map<String, Object> resultMap = new HashMap<>();
         Map<String, Object> resultMap = new HashMap<>();
-        queryWrapper.eq("user_id", user.getId());
+        queryWrapper.eq("user_id", userId);
         queryWrapper.eq("ksid", ksid);
         queryWrapper.eq("ksid", ksid);
         KuaishouUserCookie kuaishouUserCookie = kuaishouUserCookieService.getOne(queryWrapper);
         KuaishouUserCookie kuaishouUserCookie = kuaishouUserCookieService.getOne(queryWrapper);
         if (kuaishouUserCookie != null) {
         if (kuaishouUserCookie != null) {
@@ -266,7 +264,7 @@ public class KuaishouWebInterfaceServiceImpl implements IKuaishouWebInterfaceSer
                 if (httpClientEntity.getResult() == null) {
                 if (httpClientEntity.getResult() == null) {
                     ipPool.setStatus(2);
                     ipPool.setStatus(2);
                     iIpPoolService.updateById(ipPool);
                     iIpPoolService.updateById(ipPool);
-                    return videoList(ksid, pcursor);
+                    return videoList(userId, ksid, pcursor);
                 }
                 }
                 Map<String, String> map = getTTfNumber(kuaishouUserCookie);
                 Map<String, String> map = getTTfNumber(kuaishouUserCookie);
                 for (String key : map.keySet()) {
                 for (String key : map.keySet()) {
@@ -280,7 +278,7 @@ public class KuaishouWebInterfaceServiceImpl implements IKuaishouWebInterfaceSer
                 if (resultNode.get("publicFeeds").isNull() || resultNode.get("publicFeeds").get("pcursor").isNull()) {
                 if (resultNode.get("publicFeeds").isNull() || resultNode.get("publicFeeds").get("pcursor").isNull()) {
                     ipPool.setStatus(2);
                     ipPool.setStatus(2);
                     iIpPoolService.updateById(ipPool);
                     iIpPoolService.updateById(ipPool);
-                    return videoList(ksid, pcursor);
+                    return videoList(userId, ksid, pcursor);
                 }
                 }
             } catch (Exception e) {
             } catch (Exception e) {
                 if (ipPool != null) {
                 if (ipPool != null) {
@@ -288,7 +286,7 @@ public class KuaishouWebInterfaceServiceImpl implements IKuaishouWebInterfaceSer
                     iIpPoolService.updateById(ipPool);
                     iIpPoolService.updateById(ipPool);
                 }
                 }
                 e.printStackTrace();
                 e.printStackTrace();
-                return videoList(ksid, pcursor);
+                return videoList(userId, ksid, pcursor);
             }
             }
         }
         }
         return resultMap;
         return resultMap;
@@ -337,11 +335,10 @@ public class KuaishouWebInterfaceServiceImpl implements IKuaishouWebInterfaceSer
         return kuaishouNumberMap.get(key);
         return kuaishouNumberMap.get(key);
     }
     }
 
 
-    public Map<String, Object> commentDelete(String ksid, String photoId, Long commentId) {
-        LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+    public Map<String, Object> commentDelete(String userId, String ksid, String photoId, Long commentId) {
         QueryWrapper<KuaishouUserCookie> queryWrapper = new QueryWrapper<KuaishouUserCookie>();
         QueryWrapper<KuaishouUserCookie> queryWrapper = new QueryWrapper<KuaishouUserCookie>();
         Map<String, Object> resultMap = new HashMap<>();
         Map<String, Object> resultMap = new HashMap<>();
-        queryWrapper.eq("user_id", user.getId());
+        queryWrapper.eq("user_id", userId);
         queryWrapper.eq("ksid", ksid);
         queryWrapper.eq("ksid", ksid);
         KuaishouUserCookie kuaishouUserCookie = kuaishouUserCookieService.getOne(queryWrapper);
         KuaishouUserCookie kuaishouUserCookie = kuaishouUserCookieService.getOne(queryWrapper);
         if (kuaishouUserCookie != null) {
         if (kuaishouUserCookie != null) {
@@ -375,11 +372,18 @@ public class KuaishouWebInterfaceServiceImpl implements IKuaishouWebInterfaceSer
                 ObjectMapper mapper = new ObjectMapper();
                 ObjectMapper mapper = new ObjectMapper();
                 resultMap = mapper.readValue(httpClientEntity.getResult(), new TypeReference<Map<String, Object>>() {
                 resultMap = mapper.readValue(httpClientEntity.getResult(), new TypeReference<Map<String, Object>>() {
                 });
                 });
-                if (((Integer) resultMap.get("result")) == 109) {
-                    ipPool.setStatus(2);
-                    iIpPoolService.updateById(ipPool);
-                    return commentDelete(ksid, photoId, commentId);
-                }
+                Integer code = ((Integer) resultMap.get("result"));
+//                if(code == 109){
+//
+//                }
+//                if (((Integer) resultMap.get("result")) == 109) {
+//                    reLogin(httpClientEntity,kuaishouUserCookie);
+//                    if(ipPool != null){
+//                        ipPool.setStatus(2);
+//                        iIpPoolService.updateById(ipPool);
+//                    }
+//                    return commentDelete(userId,ksid, photoId, commentId);
+//                }
             } catch (Exception e) {
             } catch (Exception e) {
                 e.printStackTrace();
                 e.printStackTrace();
             }
             }
@@ -387,11 +391,10 @@ public class KuaishouWebInterfaceServiceImpl implements IKuaishouWebInterfaceSer
         return resultMap;
         return resultMap;
     }
     }
 
 
-    public Map<String, Object> commentAdd(String ksid, String photoId, String content, Long replyToCommentId, Long replyTo) {
-        LoginUser user = (LoginUser) SecurityUtils.getSubject().getPrincipal();
+    public Map<String, Object> commentAdd(String userId, String ksid, String photoId, String content, Long replyToCommentId, Long replyTo) {
         QueryWrapper<KuaishouUserCookie> queryWrapper = new QueryWrapper<KuaishouUserCookie>();
         QueryWrapper<KuaishouUserCookie> queryWrapper = new QueryWrapper<KuaishouUserCookie>();
         Map<String, Object> resultMap = new HashMap<>();
         Map<String, Object> resultMap = new HashMap<>();
-        queryWrapper.eq("user_id", user.getId());
+        queryWrapper.eq("user_id", userId);
         queryWrapper.eq("ksid", ksid);
         queryWrapper.eq("ksid", ksid);
         KuaishouUserCookie kuaishouUserCookie = kuaishouUserCookieService.getOne(queryWrapper);
         KuaishouUserCookie kuaishouUserCookie = kuaishouUserCookieService.getOne(queryWrapper);
         if (kuaishouUserCookie != null) {
         if (kuaishouUserCookie != null) {
@@ -427,11 +430,12 @@ public class KuaishouWebInterfaceServiceImpl implements IKuaishouWebInterfaceSer
                 ObjectMapper mapper = new ObjectMapper();
                 ObjectMapper mapper = new ObjectMapper();
                 resultMap = mapper.readValue(httpClientEntity.getResult(), new TypeReference<Map<String, Object>>() {
                 resultMap = mapper.readValue(httpClientEntity.getResult(), new TypeReference<Map<String, Object>>() {
                 });
                 });
-                if (((Integer) resultMap.get("result")) == 109) {
-                    ipPool.setStatus(2);
-                    iIpPoolService.updateById(ipPool);
-                    return commentAdd(ksid, photoId, content, replyToCommentId, replyTo);
-                }
+//                if (((Integer) resultMap.get("result")) == 109) {
+//                    reLogin(httpClientEntity,kuaishouUserCookie);
+//                    ipPool.setStatus(2);
+//                    iIpPoolService.updateById(ipPool);
+//                    return commentAdd(userId,ksid, photoId, content, replyToCommentId, replyTo);
+//                }
             } catch (Exception e) {
             } catch (Exception e) {
                 e.printStackTrace();
                 e.printStackTrace();
             }
             }
@@ -985,6 +989,32 @@ public class KuaishouWebInterfaceServiceImpl implements IKuaishouWebInterfaceSer
         return httpClientEntity;
         return httpClientEntity;
     }
     }
 
 
+    public HttpClientEntity reLogin(HttpClientEntity httpClientEntity, KuaishouUserCookie kuaishouUserCookie) throws Exception {
+        Map<String, Object> params = new HashMap<String, Object>();
+        IpPool ipPool = iIpPoolService.getAvaliableIp();
+        params.put("sid", "kuaishou.live.web");
+        HttpClientUtils httpClientUtils = new HttpClientUtils();
+        httpClientEntity.setCloseableHttpClient(httpClientUtils.createSSLClientDefault(ipPool));
+        httpClientEntity.setUrl("https://id.kuaishou.com/pass/kuaishou/login/passToken");
+        httpClientEntity.setResult("");
+        httpClientEntity.setHeaders(getHeaders());
+        httpClientEntity.setParams(params);
+        httpClientEntity = httpClientUtils.httpPostParamRequest(httpClientEntity);
+        ObjectMapper mapper = new ObjectMapper();
+        JsonNode jsonNode = mapper.readTree(httpClientEntity.getResult());
+        String at = jsonNode.get("kuaishou.live.web.at").asText();
+        httpClientEntity.setUrl("https://live.kuaishou.com/graphql");
+        httpClientEntity = httpClientUtils.callingGraph(httpClientEntity, userLogin(at));
+        httpClientEntity = httpClientUtils.callingGraph(httpClientEntity, userInfoQuery());
+        JsonNode userNode = mapper.readTree(httpClientEntity.getResult());
+        QueryWrapper<KuaishouUserCookie> queryWrapper = new QueryWrapper<>();
+        queryWrapper.eq("user_id", kuaishouUserCookie.getUserId());
+        queryWrapper.eq("ksid", kuaishouUserCookie.getKsid());
+        kuaishouUserCookie.setCookie(new Gson().toJson(httpClientEntity.getCookieStore()));
+        kuaishouUserCookieService.update(kuaishouUserCookie, queryWrapper);
+        return httpClientEntity;
+    }
+
     public Date getCST(String strGMT) throws ParseException {
     public Date getCST(String strGMT) throws ParseException {
         if (strGMT == null) {
         if (strGMT == null) {
             return null;
             return null;
@@ -1008,6 +1038,7 @@ public class KuaishouWebInterfaceServiceImpl implements IKuaishouWebInterfaceSer
         return httpClientEntity;
         return httpClientEntity;
     }
     }
 
 
+
     public String qrLogin(String taskId) throws Exception {
     public String qrLogin(String taskId) throws Exception {
         HttpClientEntity httpClientEntity = this.kuaishouIndex();
         HttpClientEntity httpClientEntity = this.kuaishouIndex();
         httpClientEntity = this.kuaishouQrStart(httpClientEntity);
         httpClientEntity = this.kuaishouQrStart(httpClientEntity);

+ 0 - 3
module-report/src/main/java/cn/com/ctop/bytedance/service/impl/BytedanceReportServiceImpl.java

@@ -569,7 +569,6 @@ public class BytedanceReportServiceImpl implements IBytedanceReportService {
                 reportList = reportMapper.selectReportDetail(anotherDay);
                 reportList = reportMapper.selectReportDetail(anotherDay);
 
 
             } else if (type == 3) {// 近七天分天列表
             } else if (type == 3) {// 近七天分天列表
-
                 String endDate = DateUtils.getAnotherDay("yyyy-MM-dd", anotherDay, -7);
                 String endDate = DateUtils.getAnotherDay("yyyy-MM-dd", anotherDay, -7);
                 reportList = reportMapper.selectDayDetailByDate(anotherDay, endDate);
                 reportList = reportMapper.selectDayDetailByDate(anotherDay, endDate);
 
 
@@ -622,8 +621,6 @@ public class BytedanceReportServiceImpl implements IBytedanceReportService {
                     List<JSONObject> comparedArr = reportMapper.selectHourlyDetailsByDate(comparedDate);// 除数数据
                     List<JSONObject> comparedArr = reportMapper.selectHourlyDetailsByDate(comparedDate);// 除数数据
                     detailJson.put("statDate", comparedDate);
                     detailJson.put("statDate", comparedDate);
                     detailJson.put("comparedDetail", comparedArr);
                     detailJson.put("comparedDetail", comparedArr);
-
-
                     List<JSONObject> beComparedArr = reportMapper.selectHourlyDetailsByDate(beComparedDate);// 被除数数据
                     List<JSONObject> beComparedArr = reportMapper.selectHourlyDetailsByDate(beComparedDate);// 被除数数据
                     detailJson.put("beStatDate", beComparedDate);
                     detailJson.put("beStatDate", beComparedDate);
                     detailJson.put("beComparedDetail", beComparedArr);
                     detailJson.put("beComparedDetail", beComparedArr);

+ 2 - 1
module-toutiao/src/main/java/cn/com/ctop/toutiao/service/impl/ByteDanceAdvertiserDataServiceImpl.java

@@ -112,8 +112,9 @@ public class ByteDanceAdvertiserDataServiceImpl implements IByteDanceAdvertiserD
         param.put("page", pageNum);
         param.put("page", pageNum);
         param.put("page_size", 100);
         param.put("page_size", 100);
         param.put("filtering", filtering);
         param.put("filtering", filtering);
-
+        log.info("查询广告计划信息参数:{}", param.toJSONString());
         JSONObject resultObject = HttpUtils.bytedanceGetRequest(token.getAccessToken(), url, param);
         JSONObject resultObject = HttpUtils.bytedanceGetRequest(token.getAccessToken(), url, param);
+        log.info("获取公告计划信息返回数据:{}", resultObject.toJSONString());
         Integer code = resultObject.getInteger("code");
         Integer code = resultObject.getInteger("code");
         if (null == code || !code.equals(0)) {
         if (null == code || !code.equals(0)) {
             log.error("获取广告计划信息接口异常==》accountId:{},message:{}", accountId, resultObject.getString("message"));
             log.error("获取广告计划信息接口异常==》accountId:{},message:{}", accountId, resultObject.getString("message"));